@elementor/editor-editing-panel 1.44.0 → 1.46.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 +62 -0
- package/dist/index.d.mts +11 -4
- package/dist/index.d.ts +11 -4
- package/dist/index.js +867 -765
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +740 -636
- package/dist/index.mjs.map +1 -1
- package/package.json +14 -13
- package/src/components/css-classes/css-class-menu.tsx +6 -8
- package/src/components/css-classes/css-class-selector.tsx +17 -11
- package/src/components/settings-tab.tsx +25 -2
- package/src/components/style-indicator.tsx +19 -15
- package/src/components/style-sections/border-section/border-field.tsx +4 -6
- package/src/components/style-sections/border-section/border-radius-field.tsx +12 -9
- package/src/components/style-sections/effects-section/effects-section.tsx +6 -0
- 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 +31 -36
- package/src/components/style-sections/layout-section/flex-size-field.tsx +67 -69
- package/src/components/style-sections/layout-section/justify-content-field.tsx +10 -14
- package/src/components/style-sections/layout-section/layout-section.tsx +2 -2
- package/src/components/style-sections/layout-section/opacity-control-field.tsx +25 -0
- package/src/components/style-sections/layout-section/utils/rotated-icon.tsx +1 -1
- package/src/components/style-sections/layout-section/wrap-field.tsx +13 -17
- package/src/components/style-sections/position-section/dimensions-field.tsx +39 -21
- package/src/components/style-sections/position-section/offset-field.tsx +5 -2
- package/src/components/style-sections/position-section/position-section.tsx +6 -6
- package/src/components/style-sections/size-section/object-position-field.tsx +2 -24
- package/src/components/style-sections/size-section/size-section.tsx +52 -37
- 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 +4 -6
- package/src/components/style-sections/typography-section/typography-section.tsx +4 -2
- package/src/components/style-sections/typography-section/word-spacing-field.tsx +5 -2
- package/src/controls-registry/controls-registry.tsx +30 -10
- package/src/controls-registry/styles-field.tsx +1 -3
- package/src/dynamics/components/background-control-dynamic-tag.tsx +48 -0
- package/src/dynamics/components/dynamic-selection-control.tsx +10 -18
- package/src/dynamics/components/dynamic-selection.tsx +58 -77
- package/src/dynamics/hooks/use-prop-dynamic-action.tsx +1 -1
- package/src/dynamics/init.ts +21 -0
- package/src/hooks/use-styles-field.ts +9 -3
- package/src/hooks/use-styles-fields.ts +4 -4
- package/src/index.ts +1 -0
- package/src/popover-action.tsx +3 -5
- package/src/provider-colors-registry.ts +20 -0
- package/src/styles-inheritance/components/infotip/label-chip.tsx +4 -5
- package/src/styles-inheritance/components/styles-inheritance-indicator.tsx +32 -40
- package/src/styles-inheritance/components/styles-inheritance-infotip.tsx +1 -5
- package/src/styles-inheritance/components/styles-inheritance-section-indicators.tsx +29 -44
- package/src/styles-inheritance/components/ui-providers.tsx +18 -0
- package/src/styles-inheritance/hooks/use-normalized-inheritance-chain-items.tsx +1 -17
- package/src/styles-inheritance/types.ts +0 -2
- package/src/styles-inheritance/utils.ts +17 -1
- package/src/utils/get-styles-provider-color.ts +28 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-editing-panel",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.46.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Elementor Team",
|
|
6
6
|
"homepage": "https://elementor.com/",
|
|
@@ -39,31 +39,32 @@
|
|
|
39
39
|
"dev": "tsup --config=../../tsup.dev.ts"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@elementor/editor": "0.
|
|
43
|
-
"@elementor/editor-canvas": "0.
|
|
44
|
-
"@elementor/editor-controls": "
|
|
42
|
+
"@elementor/editor": "0.20.0",
|
|
43
|
+
"@elementor/editor-canvas": "0.24.0",
|
|
44
|
+
"@elementor/editor-controls": "1.1.0",
|
|
45
45
|
"@elementor/editor-current-user": "0.5.0",
|
|
46
|
-
"@elementor/editor-documents": "0.13.
|
|
47
|
-
"@elementor/editor-elements": "0.8.
|
|
48
|
-
"@elementor/editor-panels": "0.
|
|
49
|
-
"@elementor/editor-props": "0.
|
|
46
|
+
"@elementor/editor-documents": "0.13.7",
|
|
47
|
+
"@elementor/editor-elements": "0.8.6",
|
|
48
|
+
"@elementor/editor-panels": "0.16.0",
|
|
49
|
+
"@elementor/editor-props": "0.14.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.10",
|
|
52
|
+
"@elementor/editor-styles-repository": "0.10.3",
|
|
53
|
+
"@elementor/editor-ui": "0.12.0",
|
|
54
54
|
"@elementor/editor-v1-adapters": "0.12.0",
|
|
55
55
|
"@elementor/icons": "1.44.0",
|
|
56
56
|
"@elementor/locations": "0.8.0",
|
|
57
57
|
"@elementor/menus": "0.1.5",
|
|
58
58
|
"@elementor/schema": "0.1.2",
|
|
59
59
|
"@elementor/session": "0.1.0",
|
|
60
|
-
"@elementor/ui": "1.
|
|
60
|
+
"@elementor/ui": "1.35.5",
|
|
61
61
|
"@elementor/utils": "0.4.0",
|
|
62
62
|
"@elementor/wp-media": "0.6.0",
|
|
63
63
|
"@wordpress/i18n": "^5.13.0"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
|
-
"react": "^18.3.1"
|
|
66
|
+
"react": "^18.3.1",
|
|
67
|
+
"react-dom": "^18.3.1"
|
|
67
68
|
},
|
|
68
69
|
"devDependencies": {
|
|
69
70
|
"tsup": "^8.3.5"
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type StyleDefinitionState } from '@elementor/editor-styles';
|
|
3
|
-
import {
|
|
4
|
-
isElementsStylesProvider,
|
|
5
|
-
stylesRepository,
|
|
6
|
-
useUserStylesCapability,
|
|
7
|
-
} from '@elementor/editor-styles-repository';
|
|
3
|
+
import { stylesRepository, useUserStylesCapability } from '@elementor/editor-styles-repository';
|
|
8
4
|
import { MenuItemInfotip, MenuListItem } from '@elementor/editor-ui';
|
|
9
5
|
import { bindMenu, Divider, Menu, MenuSubheader, type PopupState, Stack } from '@elementor/ui';
|
|
10
6
|
import { __ } from '@wordpress/i18n';
|
|
11
7
|
|
|
12
8
|
import { useStyle } from '../../contexts/style-context';
|
|
13
9
|
import { type StyleDefinitionStateWithNormal } from '../../styles-inheritance/types';
|
|
10
|
+
import { getStylesProviderThemeColor } from '../../utils/get-styles-provider-color';
|
|
14
11
|
import { StyleIndicator } from '../style-indicator';
|
|
15
12
|
import { useCssClass } from './css-class-context';
|
|
16
13
|
import { useUnapplyClass } from './use-apply-and-unapply-class';
|
|
@@ -135,8 +132,6 @@ function StateMenuItem( { state, closeMenu, ...props }: StateMenuItemProps ) {
|
|
|
135
132
|
|
|
136
133
|
const isUpdateAllowed = ! state || userCan( provider ?? '' ).updateProps;
|
|
137
134
|
|
|
138
|
-
const indicatorVariant = ! provider || isElementsStylesProvider( provider ) ? 'local' : 'global';
|
|
139
|
-
|
|
140
135
|
const isStyled = modifiedStates[ state ?? 'normal' ] ?? false;
|
|
141
136
|
const disabled = ! isUpdateAllowed && ! isStyled;
|
|
142
137
|
const isActive = styleId === activeId;
|
|
@@ -164,7 +159,10 @@ function StateMenuItem( { state, closeMenu, ...props }: StateMenuItemProps ) {
|
|
|
164
159
|
>
|
|
165
160
|
<Stack gap={ 0.75 } direction="row" alignItems="center">
|
|
166
161
|
{ isStyled && (
|
|
167
|
-
<StyleIndicator
|
|
162
|
+
<StyleIndicator
|
|
163
|
+
aria-label={ __( 'Has style', 'elementor' ) }
|
|
164
|
+
getColor={ getStylesProviderThemeColor( provider ?? '' ) }
|
|
165
|
+
/>
|
|
168
166
|
) }
|
|
169
167
|
{ state ?? 'normal' }
|
|
170
168
|
</Stack>
|
|
@@ -14,12 +14,22 @@ import {
|
|
|
14
14
|
import { InfoAlert, WarningInfotip } from '@elementor/editor-ui';
|
|
15
15
|
import { ColorSwatchIcon, MapPinIcon } from '@elementor/icons';
|
|
16
16
|
import { createLocation } from '@elementor/locations';
|
|
17
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
type AutocompleteChangeReason,
|
|
19
|
+
Box,
|
|
20
|
+
Chip,
|
|
21
|
+
type ChipOwnProps,
|
|
22
|
+
FormLabel,
|
|
23
|
+
Link,
|
|
24
|
+
Stack,
|
|
25
|
+
Typography,
|
|
26
|
+
} from '@elementor/ui';
|
|
18
27
|
import { __ } from '@wordpress/i18n';
|
|
19
28
|
|
|
20
29
|
import { useClassesProp } from '../../contexts/classes-prop-context';
|
|
21
30
|
import { useElement } from '../../contexts/element-context';
|
|
22
31
|
import { useStyle } from '../../contexts/style-context';
|
|
32
|
+
import { getStylesProviderColorName } from '../../utils/get-styles-provider-color';
|
|
23
33
|
import {
|
|
24
34
|
CreatableAutocomplete,
|
|
25
35
|
type CreatableAutocompleteProps,
|
|
@@ -34,7 +44,7 @@ const ID = 'elementor-css-class-selector';
|
|
|
34
44
|
const TAGS_LIMIT = 50;
|
|
35
45
|
|
|
36
46
|
type StyleDefOption = Option & {
|
|
37
|
-
color: '
|
|
47
|
+
color: ChipOwnProps[ 'color' ];
|
|
38
48
|
icon: ReactElement | null;
|
|
39
49
|
provider: string | null;
|
|
40
50
|
};
|
|
@@ -141,13 +151,9 @@ export function CssClassSelector() {
|
|
|
141
151
|
/>
|
|
142
152
|
</WarningInfotip>
|
|
143
153
|
{ ! canEdit && (
|
|
144
|
-
<InfoAlert
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
'elementor'
|
|
148
|
-
) }
|
|
149
|
-
sx={ { mt: 1 } }
|
|
150
|
-
/>
|
|
154
|
+
<InfoAlert sx={ { mt: 1 } }>
|
|
155
|
+
{ __( 'With your current role, you can use existing classes but can’t modify them.', 'elementor' ) }
|
|
156
|
+
</InfoAlert>
|
|
151
157
|
) }
|
|
152
158
|
</Stack>
|
|
153
159
|
);
|
|
@@ -205,7 +211,7 @@ function useOptions() {
|
|
|
205
211
|
const isElements = isElementsStylesProvider( provider.getKey() );
|
|
206
212
|
const styleDefs = provider.actions.all( { elementId: element.id } );
|
|
207
213
|
|
|
208
|
-
// Add empty local option for elements, as fallback.
|
|
214
|
+
// Add an empty local option for elements, as fallback.
|
|
209
215
|
if ( isElements && styleDefs.length === 0 ) {
|
|
210
216
|
return [ EMPTY_OPTION ];
|
|
211
217
|
}
|
|
@@ -215,7 +221,7 @@ function useOptions() {
|
|
|
215
221
|
label: styleDef.label,
|
|
216
222
|
value: styleDef.id,
|
|
217
223
|
fixed: isElements,
|
|
218
|
-
color:
|
|
224
|
+
color: getStylesProviderColorName( provider.getKey() ),
|
|
219
225
|
icon: isElements ? <MapPinIcon /> : null,
|
|
220
226
|
provider: provider.getKey(),
|
|
221
227
|
};
|
|
@@ -8,7 +8,12 @@ import { Divider } from '@elementor/ui';
|
|
|
8
8
|
import { useElement } from '../contexts/element-context';
|
|
9
9
|
import { Control as BaseControl } from '../controls-registry/control';
|
|
10
10
|
import { ControlTypeContainer } from '../controls-registry/control-type-container';
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
type ControlType,
|
|
13
|
+
getControl,
|
|
14
|
+
getDefaultLayout,
|
|
15
|
+
getPropTypeUtil,
|
|
16
|
+
} from '../controls-registry/controls-registry';
|
|
12
17
|
import { SettingsField } from '../controls-registry/settings-field';
|
|
13
18
|
import { useDefaultPanelSettings } from '../hooks/use-default-panel-settings';
|
|
14
19
|
import { EXPERIMENTAL_FEATURES } from '../sync/experiments-flags';
|
|
@@ -64,14 +69,32 @@ const Control = ( { control }: { control: Control[ 'value' ] } ) => {
|
|
|
64
69
|
}
|
|
65
70
|
|
|
66
71
|
const layout = control.meta?.layout || getDefaultLayout( control.type as ControlType );
|
|
72
|
+
const controlProps = populateChildControlProps( control.props );
|
|
67
73
|
|
|
68
74
|
return (
|
|
69
75
|
<SettingsField bind={ control.bind }>
|
|
70
76
|
{ control.meta?.topDivider && <Divider /> }
|
|
71
77
|
<ControlTypeContainer layout={ layout }>
|
|
72
78
|
{ control.label ? <ControlFormLabel>{ control.label }</ControlFormLabel> : null }
|
|
73
|
-
<BaseControl type={ control.type as ControlType } props={
|
|
79
|
+
<BaseControl type={ control.type as ControlType } props={ controlProps } />
|
|
74
80
|
</ControlTypeContainer>
|
|
75
81
|
</SettingsField>
|
|
76
82
|
);
|
|
77
83
|
};
|
|
84
|
+
|
|
85
|
+
function populateChildControlProps( props: Record< string, unknown > ) {
|
|
86
|
+
if ( props.childControlType ) {
|
|
87
|
+
const childComponent = getControl( props.childControlType as ControlType );
|
|
88
|
+
const childPropType = getPropTypeUtil( props.childControlType as ControlType );
|
|
89
|
+
props = {
|
|
90
|
+
...props,
|
|
91
|
+
childControlConfig: {
|
|
92
|
+
component: childComponent,
|
|
93
|
+
props: props.childControlProps || {},
|
|
94
|
+
propTypeUtil: childPropType,
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return props;
|
|
100
|
+
}
|
|
@@ -1,23 +1,27 @@
|
|
|
1
|
-
import { styled } from '@elementor/ui';
|
|
2
|
-
|
|
3
|
-
type StyleIndicatorVariant = 'overridden' | 'local' | 'global';
|
|
1
|
+
import { styled, type Theme } from '@elementor/ui';
|
|
4
2
|
|
|
5
3
|
export const StyleIndicator = styled( 'div', {
|
|
6
|
-
shouldForwardProp: ( prop ) =>
|
|
7
|
-
} )<
|
|
4
|
+
shouldForwardProp: ( prop: string ) => ! [ 'isOverridden', 'getColor' ].includes( prop ),
|
|
5
|
+
} )<
|
|
6
|
+
| {
|
|
7
|
+
isOverridden?: boolean;
|
|
8
|
+
getColor?: never;
|
|
9
|
+
}
|
|
10
|
+
| {
|
|
11
|
+
isOverridden?: boolean;
|
|
12
|
+
getColor?: ( ( theme: Theme ) => string ) | null;
|
|
13
|
+
}
|
|
14
|
+
>`
|
|
8
15
|
width: 5px;
|
|
9
16
|
height: 5px;
|
|
10
17
|
border-radius: 50%;
|
|
11
|
-
background-color: ${ ( { theme,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return theme.palette.warning.light;
|
|
15
|
-
case 'global':
|
|
16
|
-
return theme.palette.global.dark;
|
|
17
|
-
case 'local':
|
|
18
|
-
return theme.palette.accent.main;
|
|
19
|
-
default:
|
|
20
|
-
return theme.palette.text.disabled;
|
|
18
|
+
background-color: ${ ( { theme, isOverridden, getColor } ) => {
|
|
19
|
+
if ( isOverridden ) {
|
|
20
|
+
return theme.palette.warning.light;
|
|
21
21
|
}
|
|
22
|
+
|
|
23
|
+
const providerColor = getColor?.( theme );
|
|
24
|
+
|
|
25
|
+
return providerColor ?? theme.palette.text.disabled;
|
|
22
26
|
} };
|
|
23
27
|
`;
|
|
@@ -2,7 +2,6 @@ import * as React from 'react';
|
|
|
2
2
|
import { ControlFormLabel } from '@elementor/editor-controls';
|
|
3
3
|
import { __ } from '@wordpress/i18n';
|
|
4
4
|
|
|
5
|
-
import { useStyle } from '../../../contexts/style-context';
|
|
6
5
|
import { useStylesFields } from '../../../hooks/use-styles-fields';
|
|
7
6
|
import { AddOrRemoveContent } from '../../add-or-remove-content';
|
|
8
7
|
import { BorderColorField } from './border-color-field';
|
|
@@ -16,22 +15,21 @@ const initialBorder = {
|
|
|
16
15
|
};
|
|
17
16
|
|
|
18
17
|
export const BorderField = () => {
|
|
19
|
-
const { canEdit } =
|
|
20
|
-
const [ border, setBorder ] = useStylesFields( Object.keys( initialBorder ) );
|
|
18
|
+
const { values, setValues, canEdit } = useStylesFields( Object.keys( initialBorder ) );
|
|
21
19
|
|
|
22
20
|
const addBorder = () => {
|
|
23
|
-
|
|
21
|
+
setValues( initialBorder );
|
|
24
22
|
};
|
|
25
23
|
|
|
26
24
|
const removeBorder = () => {
|
|
27
|
-
|
|
25
|
+
setValues( {
|
|
28
26
|
'border-width': null,
|
|
29
27
|
'border-color': null,
|
|
30
28
|
'border-style': null,
|
|
31
29
|
} );
|
|
32
30
|
};
|
|
33
31
|
|
|
34
|
-
const hasBorder = Object.values(
|
|
32
|
+
const hasBorder = Object.values( values ?? {} ).some( Boolean );
|
|
35
33
|
|
|
36
34
|
return (
|
|
37
35
|
<AddOrRemoveContent
|
|
@@ -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
|
};
|
|
@@ -2,11 +2,17 @@ import * as React from 'react';
|
|
|
2
2
|
import { BoxShadowRepeaterControl } from '@elementor/editor-controls';
|
|
3
3
|
|
|
4
4
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
5
|
+
import { PanelDivider } from '../../panel-divider';
|
|
5
6
|
import { SectionContent } from '../../section-content';
|
|
7
|
+
import { OpacityControlField } from '../layout-section/opacity-control-field';
|
|
6
8
|
|
|
7
9
|
export const EffectsSection = () => {
|
|
8
10
|
return (
|
|
9
11
|
<SectionContent>
|
|
12
|
+
<StylesField bind="opacity">
|
|
13
|
+
<OpacityControlField />
|
|
14
|
+
</StylesField>
|
|
15
|
+
<PanelDivider />
|
|
10
16
|
<StylesField bind="box-shadow">
|
|
11
17
|
<BoxShadowRepeaterControl />
|
|
12
18
|
</StylesField>
|
|
@@ -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,12 @@ 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
|
-
import { useStyle } from '../../../contexts/style-context';
|
|
10
9
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
11
|
-
import { useDirection } from '../../../hooks/use-direction';
|
|
12
10
|
import { useStylesField } from '../../../hooks/use-styles-field';
|
|
11
|
+
import { UiProviders } from '../../../styles-inheritance/components/ui-providers';
|
|
13
12
|
import { ControlLabel } from '../../control-label';
|
|
14
13
|
import { SectionContent } from '../../section-content';
|
|
15
14
|
|
|
@@ -48,9 +47,7 @@ const items: ToggleButtonGroupItem< GroupControlItemOption >[] = [
|
|
|
48
47
|
];
|
|
49
48
|
|
|
50
49
|
export const FlexOrderField = () => {
|
|
51
|
-
const {
|
|
52
|
-
const [ order, setOrder ] = useStylesField< NumberPropValue | null >( 'order' );
|
|
53
|
-
const { canEdit } = useStyle();
|
|
50
|
+
const { value: order, setValue: setOrder, canEdit } = useStylesField< NumberPropValue | null >( 'order' );
|
|
54
51
|
|
|
55
52
|
const [ groupControlValue, setGroupControlValue ] = useState( getGroupControlValue( order?.value || null ) );
|
|
56
53
|
|
|
@@ -67,43 +64,41 @@ export const FlexOrderField = () => {
|
|
|
67
64
|
};
|
|
68
65
|
|
|
69
66
|
return (
|
|
70
|
-
<
|
|
71
|
-
<
|
|
72
|
-
<
|
|
73
|
-
<
|
|
67
|
+
<UiProviders>
|
|
68
|
+
<StylesField bind={ 'order' }>
|
|
69
|
+
<SectionContent>
|
|
70
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
71
|
+
<Grid item xs={ 6 }>
|
|
72
|
+
<ControlLabel>{ __( 'Order', 'elementor' ) }</ControlLabel>
|
|
73
|
+
</Grid>
|
|
74
|
+
<Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'end' } }>
|
|
75
|
+
<ControlToggleButtonGroup
|
|
76
|
+
items={ items }
|
|
77
|
+
value={ groupControlValue }
|
|
78
|
+
onChange={ handleToggleButtonChange }
|
|
79
|
+
exclusive={ true }
|
|
80
|
+
disabled={ ! canEdit }
|
|
81
|
+
/>
|
|
82
|
+
</Grid>
|
|
83
|
+
</Grid>
|
|
84
|
+
|
|
85
|
+
{ CUSTOM === groupControlValue && (
|
|
74
86
|
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
75
87
|
<Grid item xs={ 6 }>
|
|
76
|
-
<ControlLabel>{ __( '
|
|
88
|
+
<ControlLabel>{ __( 'Custom order', 'elementor' ) }</ControlLabel>
|
|
77
89
|
</Grid>
|
|
78
90
|
<Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'end' } }>
|
|
79
|
-
<
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
exclusive={ true }
|
|
84
|
-
disabled={ ! canEdit }
|
|
91
|
+
<NumberControl
|
|
92
|
+
min={ FIRST_DEFAULT_VALUE + 1 }
|
|
93
|
+
max={ LAST_DEFAULT_VALUE - 1 }
|
|
94
|
+
shouldForceInt={ true }
|
|
85
95
|
/>
|
|
86
96
|
</Grid>
|
|
87
97
|
</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>
|
|
98
|
+
) }
|
|
99
|
+
</SectionContent>
|
|
100
|
+
</StylesField>
|
|
101
|
+
</UiProviders>
|
|
107
102
|
);
|
|
108
103
|
};
|
|
109
104
|
|