@elementor/editor-editing-panel 1.43.1 → 1.45.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 +41 -0
- package/dist/index.d.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +1247 -977
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1025 -755
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -8
- package/src/action.tsx +1 -1
- package/src/components/add-or-remove-content.tsx +3 -4
- package/src/components/collapsible-content.tsx +42 -14
- package/src/components/control-label.tsx +1 -1
- package/src/components/section.tsx +21 -7
- package/src/components/style-sections/border-section/border-field.tsx +2 -1
- package/src/components/style-sections/border-section/border-radius-field.tsx +12 -9
- package/src/components/style-sections/layout-section/align-content-field.tsx +10 -14
- package/src/components/style-sections/layout-section/align-items-field.tsx +13 -17
- package/src/components/style-sections/layout-section/align-self-child-field.tsx +13 -17
- package/src/components/style-sections/layout-section/flex-direction-field.tsx +13 -17
- package/src/components/style-sections/layout-section/flex-order-field.tsx +30 -33
- package/src/components/style-sections/layout-section/flex-size-field.tsx +60 -59
- package/src/components/style-sections/layout-section/justify-content-field.tsx +10 -14
- package/src/components/style-sections/layout-section/wrap-field.tsx +13 -17
- package/src/components/style-sections/position-section/dimensions-field.tsx +33 -15
- package/src/components/style-sections/position-section/offset-field.tsx +5 -2
- package/src/components/style-sections/size-section/size-section.tsx +54 -39
- package/src/components/style-sections/spacing-section/spacing-section.tsx +1 -1
- package/src/components/style-sections/typography-section/column-gap-field.tsx +5 -2
- package/src/components/style-sections/typography-section/font-size-field.tsx +5 -2
- package/src/components/style-sections/typography-section/letter-spacing-field.tsx +5 -2
- package/src/components/style-sections/typography-section/line-height-field.tsx +5 -2
- package/src/components/style-sections/typography-section/text-alignment-field.tsx +12 -9
- package/src/components/style-sections/typography-section/text-stroke-field.tsx +2 -1
- package/src/components/style-sections/typography-section/typography-section.tsx +15 -3
- package/src/components/style-sections/typography-section/word-spacing-field.tsx +5 -2
- package/src/components/style-tab-collapsible-content.tsx +22 -0
- package/src/components/style-tab-section.tsx +30 -0
- package/src/components/style-tab.tsx +51 -35
- package/src/controls-registry/styles-field.tsx +1 -1
- package/src/dynamics/components/background-control-dynamic-tag.tsx +48 -0
- package/src/dynamics/components/dynamic-selection-control.tsx +11 -15
- package/src/dynamics/init.ts +21 -0
- package/src/index.ts +1 -0
- package/src/popover-action.tsx +3 -9
- package/src/styles-inheritance/components/{label-chip.tsx → infotip/label-chip.tsx} +1 -1
- package/src/styles-inheritance/{styles-inheritance-indicator.tsx → components/styles-inheritance-indicator.tsx} +8 -8
- package/src/styles-inheritance/{styles-inheritance-infotip.tsx → components/styles-inheritance-infotip.tsx} +7 -7
- package/src/styles-inheritance/components/styles-inheritance-section-indicators.tsx +113 -0
- package/src/styles-inheritance/components/ui-providers.tsx +18 -0
- /package/src/styles-inheritance/components/{action-icons.tsx → infotip/action-icons.tsx} +0 -0
- /package/src/styles-inheritance/components/{breakpoint-icon.tsx → infotip/breakpoint-icon.tsx} +0 -0
- /package/src/styles-inheritance/components/{index.ts → infotip/index.ts} +0 -0
- /package/src/styles-inheritance/components/{value-component.tsx → infotip/value-component.tsx} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-editing-panel",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.45.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Elementor Team",
|
|
6
6
|
"homepage": "https://elementor.com/",
|
|
@@ -40,17 +40,17 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@elementor/editor": "0.19.4",
|
|
43
|
-
"@elementor/editor-canvas": "0.
|
|
44
|
-
"@elementor/editor-controls": "0.
|
|
43
|
+
"@elementor/editor-canvas": "0.23.0",
|
|
44
|
+
"@elementor/editor-controls": "1.0.0",
|
|
45
45
|
"@elementor/editor-current-user": "0.5.0",
|
|
46
46
|
"@elementor/editor-documents": "0.13.6",
|
|
47
|
-
"@elementor/editor-elements": "0.8.
|
|
47
|
+
"@elementor/editor-elements": "0.8.5",
|
|
48
48
|
"@elementor/editor-panels": "0.15.4",
|
|
49
|
-
"@elementor/editor-props": "0.
|
|
49
|
+
"@elementor/editor-props": "0.13.0",
|
|
50
50
|
"@elementor/editor-responsive": "0.13.5",
|
|
51
|
-
"@elementor/editor-styles": "0.6.
|
|
52
|
-
"@elementor/editor-styles-repository": "0.10.
|
|
53
|
-
"@elementor/editor-ui": "0.
|
|
51
|
+
"@elementor/editor-styles": "0.6.9",
|
|
52
|
+
"@elementor/editor-styles-repository": "0.10.2",
|
|
53
|
+
"@elementor/editor-ui": "0.11.0",
|
|
54
54
|
"@elementor/editor-v1-adapters": "0.12.0",
|
|
55
55
|
"@elementor/icons": "1.44.0",
|
|
56
56
|
"@elementor/locations": "0.8.0",
|
package/src/action.tsx
CHANGED
|
@@ -17,7 +17,7 @@ export default function Action( { title, visible = true, icon: Icon, onClick }:
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
return (
|
|
20
|
-
<Tooltip placement="
|
|
20
|
+
<Tooltip placement="top" title={ title } arrow={ true }>
|
|
21
21
|
<IconButton aria-label={ title } size={ SIZE } onClick={ onClick }>
|
|
22
22
|
<Icon fontSize={ SIZE } />
|
|
23
23
|
</IconButton>
|
|
@@ -3,26 +3,25 @@ import { type PropsWithChildren } from 'react';
|
|
|
3
3
|
import { MinusIcon, PlusIcon } from '@elementor/icons';
|
|
4
4
|
import { Collapse, IconButton, Stack } from '@elementor/ui';
|
|
5
5
|
|
|
6
|
-
import { ControlLabel } from './control-label';
|
|
7
6
|
import { SectionContent } from './section-content';
|
|
8
7
|
|
|
9
8
|
const SIZE = 'tiny';
|
|
10
9
|
|
|
11
10
|
type Props = {
|
|
12
|
-
label: string;
|
|
13
11
|
isAdded: boolean;
|
|
14
12
|
onAdd: () => void;
|
|
15
13
|
onRemove: () => void;
|
|
16
14
|
disabled?: boolean;
|
|
15
|
+
renderLabel: () => React.ReactNode;
|
|
17
16
|
};
|
|
18
17
|
|
|
19
18
|
export const AddOrRemoveContent = ( {
|
|
20
19
|
isAdded,
|
|
21
|
-
label,
|
|
22
20
|
onAdd,
|
|
23
21
|
onRemove,
|
|
24
22
|
children,
|
|
25
23
|
disabled,
|
|
24
|
+
renderLabel,
|
|
26
25
|
}: PropsWithChildren< Props > ) => {
|
|
27
26
|
return (
|
|
28
27
|
<SectionContent>
|
|
@@ -34,7 +33,7 @@ export const AddOrRemoveContent = ( {
|
|
|
34
33
|
marginInlineEnd: -0.75,
|
|
35
34
|
} }
|
|
36
35
|
>
|
|
37
|
-
|
|
36
|
+
{ renderLabel() }
|
|
38
37
|
{ isAdded ? (
|
|
39
38
|
<IconButton size={ SIZE } onClick={ onRemove } aria-label="Remove" disabled={ disabled }>
|
|
40
39
|
<MinusIcon fontSize={ SIZE } />
|
|
@@ -1,15 +1,32 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import { Button, Collapse, Stack } from '@elementor/ui';
|
|
2
|
+
import { type ReactNode, useState } from 'react';
|
|
3
|
+
import { Button, Collapse, Stack, styled } from '@elementor/ui';
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
|
|
6
6
|
import { CollapseIcon } from './collapse-icon';
|
|
7
7
|
|
|
8
|
+
type StaticItem< T = unknown > = T extends ( ...args: unknown[] ) => unknown ? never : T;
|
|
9
|
+
|
|
10
|
+
type CallbackItem< T > = ( isOpen: boolean ) => T;
|
|
11
|
+
export type CollapsibleValue< T > = CallbackItem< T > | StaticItem< T >;
|
|
12
|
+
|
|
8
13
|
type CollapsibleContentProps = React.PropsWithChildren< {
|
|
9
14
|
defaultOpen?: boolean;
|
|
15
|
+
titleEnd?: CollapsibleValue< ReactNode | string > | null;
|
|
10
16
|
} >;
|
|
11
17
|
|
|
12
|
-
|
|
18
|
+
const IndicatorsWrapper = styled( 'div' )`
|
|
19
|
+
position: absolute;
|
|
20
|
+
top: 0;
|
|
21
|
+
right: ${ ( { theme } ) => theme.spacing( 3 ) };
|
|
22
|
+
height: 100%;
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
align-items: center;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
`;
|
|
28
|
+
|
|
29
|
+
export const CollapsibleContent = ( { children, defaultOpen = false, titleEnd = null }: CollapsibleContentProps ) => {
|
|
13
30
|
const [ open, setOpen ] = useState( defaultOpen );
|
|
14
31
|
|
|
15
32
|
const handleToggle = () => {
|
|
@@ -18,20 +35,31 @@ export const CollapsibleContent = ( { children, defaultOpen = false }: Collapsib
|
|
|
18
35
|
|
|
19
36
|
return (
|
|
20
37
|
<Stack>
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
38
|
+
<Stack sx={ { position: 'relative' } }>
|
|
39
|
+
<Button
|
|
40
|
+
fullWidth
|
|
41
|
+
size="small"
|
|
42
|
+
color="secondary"
|
|
43
|
+
variant="outlined"
|
|
44
|
+
onClick={ handleToggle }
|
|
45
|
+
endIcon={ <CollapseIcon open={ open } /> }
|
|
46
|
+
sx={ { my: 0.5 } }
|
|
47
|
+
>
|
|
48
|
+
{ open ? __( 'Show less', 'elementor' ) : __( 'Show more', 'elementor' ) }
|
|
49
|
+
</Button>
|
|
50
|
+
{ titleEnd && <IndicatorsWrapper>{ getCollapsibleValue( titleEnd, open ) }</IndicatorsWrapper> }
|
|
51
|
+
</Stack>
|
|
32
52
|
<Collapse in={ open } timeout="auto" unmountOnExit>
|
|
33
53
|
{ children }
|
|
34
54
|
</Collapse>
|
|
35
55
|
</Stack>
|
|
36
56
|
);
|
|
37
57
|
};
|
|
58
|
+
|
|
59
|
+
export function getCollapsibleValue< T >( value: CollapsibleValue< T >, isOpen: boolean ): T {
|
|
60
|
+
if ( typeof value === 'function' ) {
|
|
61
|
+
return ( value as CallbackItem< T > )( isOpen );
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return value;
|
|
65
|
+
}
|
|
@@ -5,7 +5,7 @@ import { Stack } from '@elementor/ui';
|
|
|
5
5
|
|
|
6
6
|
export const ControlLabel = ( { children }: PropsWithChildren< object > ) => {
|
|
7
7
|
return (
|
|
8
|
-
<Stack direction="row" alignItems="center" justifyItems="start" gap={
|
|
8
|
+
<Stack direction="row" alignItems="center" justifyItems="start" gap={ 0.25 }>
|
|
9
9
|
<ControlFormLabel>{ children }</ControlFormLabel>
|
|
10
10
|
<ControlAdornments />
|
|
11
11
|
</Stack>
|
|
@@ -1,34 +1,48 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { type PropsWithChildren, useId } from 'react';
|
|
2
|
+
import { type PropsWithChildren, type ReactNode, useId } from 'react';
|
|
3
|
+
import { isExperimentActive } from '@elementor/editor-v1-adapters';
|
|
3
4
|
import { Collapse, Divider, ListItemButton, ListItemText, Stack } from '@elementor/ui';
|
|
4
5
|
|
|
5
6
|
import { useStateByElement } from '../hooks/use-state-by-element';
|
|
7
|
+
import { EXPERIMENTAL_FEATURES } from '../sync/experiments-flags';
|
|
6
8
|
import { CollapseIcon } from './collapse-icon';
|
|
9
|
+
import { type CollapsibleValue, getCollapsibleValue } from './collapsible-content';
|
|
7
10
|
|
|
8
11
|
type Props = PropsWithChildren< {
|
|
9
12
|
title: string;
|
|
10
13
|
defaultExpanded?: boolean;
|
|
14
|
+
titleEnd?: CollapsibleValue< ReactNode | string >;
|
|
11
15
|
} >;
|
|
12
16
|
|
|
13
|
-
export function Section( { title, children, defaultExpanded = false }: Props ) {
|
|
17
|
+
export function Section( { title, children, defaultExpanded = false, titleEnd }: Props ) {
|
|
14
18
|
const [ isOpen, setIsOpen ] = useStateByElement( title, !! defaultExpanded );
|
|
15
19
|
|
|
20
|
+
const handleClick = () => {
|
|
21
|
+
setIsOpen( ! isOpen );
|
|
22
|
+
};
|
|
23
|
+
|
|
16
24
|
const id = useId();
|
|
17
25
|
const labelId = `label-${ id }`;
|
|
18
26
|
const contentId = `content-${ id }`;
|
|
19
27
|
|
|
28
|
+
const isUsingTitleEnd = isExperimentActive( EXPERIMENTAL_FEATURES.V_3_30 );
|
|
29
|
+
|
|
20
30
|
return (
|
|
21
31
|
<>
|
|
22
32
|
<ListItemButton
|
|
23
33
|
id={ labelId }
|
|
24
34
|
aria-controls={ contentId }
|
|
25
|
-
onClick={
|
|
35
|
+
onClick={ handleClick }
|
|
26
36
|
sx={ { '&:hover': { backgroundColor: 'transparent' } } }
|
|
27
37
|
>
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
38
|
+
<Stack direction="row" alignItems="center" justifyItems="start" flexGrow={ 1 } gap={ 0.5 }>
|
|
39
|
+
<ListItemText
|
|
40
|
+
secondary={ title }
|
|
41
|
+
secondaryTypographyProps={ { color: 'text.primary', variant: 'caption', fontWeight: 'bold' } }
|
|
42
|
+
sx={ { flexGrow: 0, flexShrink: 1, marginInlineEnd: 1 } }
|
|
43
|
+
/>
|
|
44
|
+
{ isUsingTitleEnd ? getCollapsibleValue( titleEnd, isOpen ) : null }
|
|
45
|
+
</Stack>
|
|
32
46
|
<CollapseIcon open={ isOpen } color="secondary" fontSize="tiny" />
|
|
33
47
|
</ListItemButton>
|
|
34
48
|
<Collapse id={ contentId } aria-labelledby={ labelId } in={ isOpen } timeout="auto" unmountOnExit>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { ControlFormLabel } from '@elementor/editor-controls';
|
|
2
3
|
import { __ } from '@wordpress/i18n';
|
|
3
4
|
|
|
4
5
|
import { useStyle } from '../../../contexts/style-context';
|
|
@@ -34,11 +35,11 @@ export const BorderField = () => {
|
|
|
34
35
|
|
|
35
36
|
return (
|
|
36
37
|
<AddOrRemoveContent
|
|
37
|
-
label={ __( 'Border', 'elementor' ) }
|
|
38
38
|
isAdded={ hasBorder }
|
|
39
39
|
onAdd={ addBorder }
|
|
40
40
|
onRemove={ removeBorder }
|
|
41
41
|
disabled={ ! canEdit }
|
|
42
|
+
renderLabel={ () => <ControlFormLabel>{ __( 'Border', 'elementor' ) }</ControlFormLabel> }
|
|
42
43
|
>
|
|
43
44
|
<BorderWidthField />
|
|
44
45
|
<BorderColorField />
|
|
@@ -13,6 +13,7 @@ import { __ } from '@wordpress/i18n';
|
|
|
13
13
|
|
|
14
14
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
15
15
|
import { useDirection } from '../../../hooks/use-direction';
|
|
16
|
+
import { UiProviders } from '../../../styles-inheritance/components/ui-providers';
|
|
16
17
|
|
|
17
18
|
const StartStartIcon = withDirection( RadiusTopLeftIcon );
|
|
18
19
|
const StartEndIcon = withDirection( RadiusTopRightIcon );
|
|
@@ -55,14 +56,16 @@ export const BorderRadiusField = () => {
|
|
|
55
56
|
const { isSiteRtl } = useDirection();
|
|
56
57
|
|
|
57
58
|
return (
|
|
58
|
-
<
|
|
59
|
-
<
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
59
|
+
<UiProviders>
|
|
60
|
+
<StylesField bind={ 'border-radius' }>
|
|
61
|
+
<EqualUnequalSizesControl
|
|
62
|
+
items={ getCorners( isSiteRtl ) }
|
|
63
|
+
label={ __( 'Border radius', 'elementor' ) }
|
|
64
|
+
icon={ <BorderCornersIcon fontSize={ 'tiny' } /> }
|
|
65
|
+
tooltipLabel={ __( 'Adjust corners', 'elementor' ) }
|
|
66
|
+
multiSizePropTypeUtil={ borderRadiusPropTypeUtil }
|
|
67
|
+
/>
|
|
68
|
+
</StylesField>
|
|
69
|
+
</UiProviders>
|
|
67
70
|
);
|
|
68
71
|
};
|
|
@@ -8,11 +8,11 @@ import {
|
|
|
8
8
|
JustifySpaceBetweenVerticalIcon as BetweenIcon,
|
|
9
9
|
JustifyTopIcon,
|
|
10
10
|
} from '@elementor/icons';
|
|
11
|
-
import {
|
|
11
|
+
import { Stack, withDirection } from '@elementor/ui';
|
|
12
12
|
import { __ } from '@wordpress/i18n';
|
|
13
13
|
|
|
14
14
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
15
|
-
import {
|
|
15
|
+
import { UiProviders } from '../../../styles-inheritance/components/ui-providers';
|
|
16
16
|
import { ControlLabel } from '../../control-label';
|
|
17
17
|
import { RotatedIcon } from './utils/rotated-icon';
|
|
18
18
|
|
|
@@ -67,18 +67,14 @@ const options: ToggleButtonGroupItem< AlignContent >[] = [
|
|
|
67
67
|
];
|
|
68
68
|
|
|
69
69
|
export const AlignContentField = () => {
|
|
70
|
-
const { isSiteRtl } = useDirection();
|
|
71
|
-
|
|
72
70
|
return (
|
|
73
|
-
<
|
|
74
|
-
<
|
|
75
|
-
<
|
|
76
|
-
<
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
</ThemeProvider>
|
|
82
|
-
</DirectionProvider>
|
|
71
|
+
<UiProviders>
|
|
72
|
+
<StylesField bind="align-content">
|
|
73
|
+
<Stack gap={ 1 }>
|
|
74
|
+
<ControlLabel>{ __( 'Align content', 'elementor' ) }</ControlLabel>
|
|
75
|
+
<ToggleControl options={ options } fullWidth={ true } />
|
|
76
|
+
</Stack>
|
|
77
|
+
</StylesField>
|
|
78
|
+
</UiProviders>
|
|
83
79
|
);
|
|
84
80
|
};
|
|
@@ -6,11 +6,11 @@ import {
|
|
|
6
6
|
LayoutAlignRightIcon,
|
|
7
7
|
LayoutDistributeVerticalIcon as JustifyIcon,
|
|
8
8
|
} from '@elementor/icons';
|
|
9
|
-
import {
|
|
9
|
+
import { Grid, withDirection } from '@elementor/ui';
|
|
10
10
|
import { __ } from '@wordpress/i18n';
|
|
11
11
|
|
|
12
12
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
13
|
-
import {
|
|
13
|
+
import { UiProviders } from '../../../styles-inheritance/components/ui-providers';
|
|
14
14
|
import { ControlLabel } from '../../control-label';
|
|
15
15
|
import { RotatedIcon } from './utils/rotated-icon';
|
|
16
16
|
|
|
@@ -52,22 +52,18 @@ const options: ToggleButtonGroupItem< AlignItems >[] = [
|
|
|
52
52
|
];
|
|
53
53
|
|
|
54
54
|
export const AlignItemsField = () => {
|
|
55
|
-
const { isSiteRtl } = useDirection();
|
|
56
|
-
|
|
57
55
|
return (
|
|
58
|
-
<
|
|
59
|
-
<
|
|
60
|
-
<
|
|
61
|
-
<Grid
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
<
|
|
66
|
-
<ToggleControl options={ options } />
|
|
67
|
-
</Grid>
|
|
56
|
+
<UiProviders>
|
|
57
|
+
<StylesField bind="align-items">
|
|
58
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
59
|
+
<Grid item xs={ 6 }>
|
|
60
|
+
<ControlLabel>{ __( 'Align items', 'elementor' ) }</ControlLabel>
|
|
61
|
+
</Grid>
|
|
62
|
+
<Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'end' } }>
|
|
63
|
+
<ToggleControl options={ options } />
|
|
68
64
|
</Grid>
|
|
69
|
-
</
|
|
70
|
-
</
|
|
71
|
-
</
|
|
65
|
+
</Grid>
|
|
66
|
+
</StylesField>
|
|
67
|
+
</UiProviders>
|
|
72
68
|
);
|
|
73
69
|
};
|
|
@@ -6,11 +6,11 @@ import {
|
|
|
6
6
|
LayoutAlignRightIcon,
|
|
7
7
|
LayoutDistributeVerticalIcon as JustifyIcon,
|
|
8
8
|
} from '@elementor/icons';
|
|
9
|
-
import {
|
|
9
|
+
import { Grid, type ToggleButtonProps, withDirection } from '@elementor/ui';
|
|
10
10
|
import { __ } from '@wordpress/i18n';
|
|
11
11
|
|
|
12
12
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
13
|
-
import {
|
|
13
|
+
import { UiProviders } from '../../../styles-inheritance/components/ui-providers';
|
|
14
14
|
import { ControlLabel } from '../../control-label';
|
|
15
15
|
import { type FlexDirection } from './flex-direction-field';
|
|
16
16
|
import { RotatedIcon } from './utils/rotated-icon';
|
|
@@ -85,22 +85,18 @@ const getOptions = ( parentStyleDirection: FlexDirection ) => [
|
|
|
85
85
|
];
|
|
86
86
|
|
|
87
87
|
export const AlignSelfChild = ( { parentStyleDirection }: { parentStyleDirection: FlexDirection } ) => {
|
|
88
|
-
const { isSiteRtl } = useDirection();
|
|
89
|
-
|
|
90
88
|
return (
|
|
91
|
-
<
|
|
92
|
-
<
|
|
93
|
-
<
|
|
94
|
-
<Grid
|
|
95
|
-
<
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
<
|
|
99
|
-
<ToggleControl options={ getOptions( parentStyleDirection as FlexDirection ) } />
|
|
100
|
-
</Grid>
|
|
89
|
+
<UiProviders>
|
|
90
|
+
<StylesField bind={ 'align-self' }>
|
|
91
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
92
|
+
<Grid item xs={ 6 }>
|
|
93
|
+
<ControlLabel>{ __( 'Align self', 'elementor' ) }</ControlLabel>
|
|
94
|
+
</Grid>
|
|
95
|
+
<Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'flex-end' } }>
|
|
96
|
+
<ToggleControl options={ getOptions( parentStyleDirection as FlexDirection ) } />
|
|
101
97
|
</Grid>
|
|
102
|
-
</
|
|
103
|
-
</
|
|
104
|
-
</
|
|
98
|
+
</Grid>
|
|
99
|
+
</StylesField>
|
|
100
|
+
</UiProviders>
|
|
105
101
|
);
|
|
106
102
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type ToggleButtonGroupItem, ToggleControl } from '@elementor/editor-controls';
|
|
3
3
|
import { ArrowDownSmallIcon, ArrowLeftIcon, ArrowRightIcon, ArrowUpSmallIcon } from '@elementor/icons';
|
|
4
|
-
import {
|
|
4
|
+
import { Grid, withDirection } from '@elementor/ui';
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
6
|
|
|
7
7
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
8
|
-
import {
|
|
8
|
+
import { UiProviders } from '../../../styles-inheritance/components/ui-providers';
|
|
9
9
|
import { ControlLabel } from '../../control-label';
|
|
10
10
|
|
|
11
11
|
export type FlexDirection = 'row' | 'row-reverse' | 'column' | 'column-reverse';
|
|
@@ -44,22 +44,18 @@ const options: ToggleButtonGroupItem< FlexDirection >[] = [
|
|
|
44
44
|
];
|
|
45
45
|
|
|
46
46
|
export const FlexDirectionField = () => {
|
|
47
|
-
const { isSiteRtl } = useDirection();
|
|
48
|
-
|
|
49
47
|
return (
|
|
50
|
-
<
|
|
51
|
-
<
|
|
52
|
-
<
|
|
53
|
-
<Grid
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
<
|
|
58
|
-
<ToggleControl options={ options } />
|
|
59
|
-
</Grid>
|
|
48
|
+
<UiProviders>
|
|
49
|
+
<StylesField bind="flex-direction">
|
|
50
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
51
|
+
<Grid item xs={ 6 }>
|
|
52
|
+
<ControlLabel>{ __( 'Direction', 'elementor' ) }</ControlLabel>
|
|
53
|
+
</Grid>
|
|
54
|
+
<Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'end' } }>
|
|
55
|
+
<ToggleControl options={ options } />
|
|
60
56
|
</Grid>
|
|
61
|
-
</
|
|
62
|
-
</
|
|
63
|
-
</
|
|
57
|
+
</Grid>
|
|
58
|
+
</StylesField>
|
|
59
|
+
</UiProviders>
|
|
64
60
|
);
|
|
65
61
|
};
|
|
@@ -3,13 +3,13 @@ import { useState } from 'react';
|
|
|
3
3
|
import { ControlToggleButtonGroup, NumberControl, type ToggleButtonGroupItem } from '@elementor/editor-controls';
|
|
4
4
|
import { type NumberPropValue } from '@elementor/editor-props';
|
|
5
5
|
import { ArrowDownSmallIcon, ArrowUpSmallIcon, PencilIcon } from '@elementor/icons';
|
|
6
|
-
import {
|
|
6
|
+
import { Grid } from '@elementor/ui';
|
|
7
7
|
import { __ } from '@wordpress/i18n';
|
|
8
8
|
|
|
9
9
|
import { useStyle } from '../../../contexts/style-context';
|
|
10
10
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
11
|
-
import { useDirection } from '../../../hooks/use-direction';
|
|
12
11
|
import { useStylesField } from '../../../hooks/use-styles-field';
|
|
12
|
+
import { UiProviders } from '../../../styles-inheritance/components/ui-providers';
|
|
13
13
|
import { ControlLabel } from '../../control-label';
|
|
14
14
|
import { SectionContent } from '../../section-content';
|
|
15
15
|
|
|
@@ -48,7 +48,6 @@ const items: ToggleButtonGroupItem< GroupControlItemOption >[] = [
|
|
|
48
48
|
];
|
|
49
49
|
|
|
50
50
|
export const FlexOrderField = () => {
|
|
51
|
-
const { isSiteRtl } = useDirection();
|
|
52
51
|
const [ order, setOrder ] = useStylesField< NumberPropValue | null >( 'order' );
|
|
53
52
|
const { canEdit } = useStyle();
|
|
54
53
|
|
|
@@ -67,43 +66,41 @@ export const FlexOrderField = () => {
|
|
|
67
66
|
};
|
|
68
67
|
|
|
69
68
|
return (
|
|
70
|
-
<
|
|
71
|
-
<
|
|
72
|
-
<
|
|
73
|
-
<
|
|
69
|
+
<UiProviders>
|
|
70
|
+
<StylesField bind={ 'order' }>
|
|
71
|
+
<SectionContent>
|
|
72
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
73
|
+
<Grid item xs={ 6 }>
|
|
74
|
+
<ControlLabel>{ __( 'Order', 'elementor' ) }</ControlLabel>
|
|
75
|
+
</Grid>
|
|
76
|
+
<Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'end' } }>
|
|
77
|
+
<ControlToggleButtonGroup
|
|
78
|
+
items={ items }
|
|
79
|
+
value={ groupControlValue }
|
|
80
|
+
onChange={ handleToggleButtonChange }
|
|
81
|
+
exclusive={ true }
|
|
82
|
+
disabled={ ! canEdit }
|
|
83
|
+
/>
|
|
84
|
+
</Grid>
|
|
85
|
+
</Grid>
|
|
86
|
+
|
|
87
|
+
{ CUSTOM === groupControlValue && (
|
|
74
88
|
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
75
89
|
<Grid item xs={ 6 }>
|
|
76
|
-
<ControlLabel>{ __( '
|
|
90
|
+
<ControlLabel>{ __( 'Custom order', 'elementor' ) }</ControlLabel>
|
|
77
91
|
</Grid>
|
|
78
92
|
<Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'end' } }>
|
|
79
|
-
<
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
exclusive={ true }
|
|
84
|
-
disabled={ ! canEdit }
|
|
93
|
+
<NumberControl
|
|
94
|
+
min={ FIRST_DEFAULT_VALUE + 1 }
|
|
95
|
+
max={ LAST_DEFAULT_VALUE - 1 }
|
|
96
|
+
shouldForceInt={ true }
|
|
85
97
|
/>
|
|
86
98
|
</Grid>
|
|
87
99
|
</Grid>
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
<ControlLabel>{ __( 'Custom order', 'elementor' ) }</ControlLabel>
|
|
93
|
-
</Grid>
|
|
94
|
-
<Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'end' } }>
|
|
95
|
-
<NumberControl
|
|
96
|
-
min={ FIRST_DEFAULT_VALUE + 1 }
|
|
97
|
-
max={ LAST_DEFAULT_VALUE - 1 }
|
|
98
|
-
shouldForceInt={ true }
|
|
99
|
-
/>
|
|
100
|
-
</Grid>
|
|
101
|
-
</Grid>
|
|
102
|
-
) }
|
|
103
|
-
</SectionContent>
|
|
104
|
-
</StylesField>
|
|
105
|
-
</ThemeProvider>
|
|
106
|
-
</DirectionProvider>
|
|
100
|
+
) }
|
|
101
|
+
</SectionContent>
|
|
102
|
+
</StylesField>
|
|
103
|
+
</UiProviders>
|
|
107
104
|
);
|
|
108
105
|
};
|
|
109
106
|
|