@elementor/editor-editing-panel 4.1.0-817 → 4.1.0-819

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elementor/editor-editing-panel",
3
- "version": "4.1.0-817",
3
+ "version": "4.1.0-819",
4
4
  "private": false,
5
5
  "author": "Elementor Team",
6
6
  "homepage": "https://elementor.com/",
@@ -39,28 +39,28 @@
39
39
  "dev": "tsup --config=../../tsup.dev.ts"
40
40
  },
41
41
  "dependencies": {
42
- "@elementor/editor": "4.1.0-817",
43
- "@elementor/editor-canvas": "4.1.0-817",
44
- "@elementor/editor-controls": "4.1.0-817",
45
- "@elementor/editor-documents": "4.1.0-817",
46
- "@elementor/editor-elements": "4.1.0-817",
47
- "@elementor/editor-interactions": "4.1.0-817",
48
- "@elementor/editor-panels": "4.1.0-817",
49
- "@elementor/editor-props": "4.1.0-817",
50
- "@elementor/editor-responsive": "4.1.0-817",
51
- "@elementor/editor-styles": "4.1.0-817",
52
- "@elementor/editor-styles-repository": "4.1.0-817",
53
- "@elementor/editor-ui": "4.1.0-817",
54
- "@elementor/editor-v1-adapters": "4.1.0-817",
42
+ "@elementor/editor": "4.1.0-819",
43
+ "@elementor/editor-canvas": "4.1.0-819",
44
+ "@elementor/editor-controls": "4.1.0-819",
45
+ "@elementor/editor-documents": "4.1.0-819",
46
+ "@elementor/editor-elements": "4.1.0-819",
47
+ "@elementor/editor-interactions": "4.1.0-819",
48
+ "@elementor/editor-panels": "4.1.0-819",
49
+ "@elementor/editor-props": "4.1.0-819",
50
+ "@elementor/editor-responsive": "4.1.0-819",
51
+ "@elementor/editor-styles": "4.1.0-819",
52
+ "@elementor/editor-styles-repository": "4.1.0-819",
53
+ "@elementor/editor-ui": "4.1.0-819",
54
+ "@elementor/editor-v1-adapters": "4.1.0-819",
55
55
  "@elementor/icons": "^1.68.0",
56
- "@elementor/editor-variables": "4.1.0-817",
57
- "@elementor/locations": "4.1.0-817",
58
- "@elementor/menus": "4.1.0-817",
59
- "@elementor/schema": "4.1.0-817",
60
- "@elementor/session": "4.1.0-817",
56
+ "@elementor/editor-variables": "4.1.0-819",
57
+ "@elementor/locations": "4.1.0-819",
58
+ "@elementor/menus": "4.1.0-819",
59
+ "@elementor/schema": "4.1.0-819",
60
+ "@elementor/session": "4.1.0-819",
61
61
  "@elementor/ui": "1.37.5",
62
- "@elementor/utils": "4.1.0-817",
63
- "@elementor/wp-media": "4.1.0-817",
62
+ "@elementor/utils": "4.1.0-819",
63
+ "@elementor/wp-media": "4.1.0-819",
64
64
  "@wordpress/i18n": "^5.13.0"
65
65
  },
66
66
  "peerDependencies": {
@@ -0,0 +1,74 @@
1
+ import * as React from 'react';
2
+ import { type ToggleButtonGroupItem, ToggleControl } from '@elementor/editor-controls';
3
+ import {
4
+ JustifyBottomIcon,
5
+ JustifyCenterIcon,
6
+ JustifyTopIcon,
7
+ LayoutDistributeVerticalIcon as JustifyIcon,
8
+ } from '@elementor/icons';
9
+ import { type ToggleButtonProps } from '@elementor/ui';
10
+ import { __ } from '@wordpress/i18n';
11
+
12
+ import { StylesField } from '../../../controls-registry/styles-field';
13
+ import { UiProviders } from '../../../styles-inheritance/components/ui-providers';
14
+ import { StylesFieldLayout } from '../../styles-field-layout';
15
+
16
+ type AlignSelf = 'start' | 'center' | 'end' | 'stretch';
17
+
18
+ const ALIGN_SELF_LABEL = __( 'Align self', 'elementor' );
19
+
20
+ const ALIGN_SELF_CHILD_OFFSET_MAP: Record< string, number > = {
21
+ row: 0,
22
+ column: -90,
23
+ };
24
+
25
+ export const AlignSelfGridChild = ( { parentStyleDirection }: { parentStyleDirection: string } ) => (
26
+ <StylesField bind="align-self" propDisplayName={ ALIGN_SELF_LABEL }>
27
+ <UiProviders>
28
+ <StylesFieldLayout label={ ALIGN_SELF_LABEL }>
29
+ <ToggleControl options={ getOptions( parentStyleDirection ?? 'row' ) } />
30
+ </StylesFieldLayout>
31
+ </UiProviders>
32
+ </StylesField>
33
+ );
34
+
35
+ const RotatedIcon = ( {
36
+ icon: Icon,
37
+ size,
38
+ offset,
39
+ }: {
40
+ icon: React.JSX.ElementType;
41
+ size: ToggleButtonProps[ 'size' ];
42
+ offset?: number;
43
+ } ) => <Icon fontSize={ size } sx={ { rotate: `${ offset }deg` } } />;
44
+
45
+ const getOptions = ( parentStyleDirection: string ): ToggleButtonGroupItem< AlignSelf >[] => {
46
+ const offset = ALIGN_SELF_CHILD_OFFSET_MAP[ parentStyleDirection.replace( 'dense', '' ).trim() ];
47
+
48
+ return [
49
+ {
50
+ value: 'start',
51
+ label: __( 'Start', 'elementor' ),
52
+ renderContent: ( { size } ) => <RotatedIcon icon={ JustifyTopIcon } size={ size } offset={ offset } />,
53
+ showTooltip: true,
54
+ },
55
+ {
56
+ value: 'center',
57
+ label: __( 'Center', 'elementor' ),
58
+ renderContent: ( { size } ) => <RotatedIcon icon={ JustifyCenterIcon } size={ size } offset={ offset } />,
59
+ showTooltip: true,
60
+ },
61
+ {
62
+ value: 'end',
63
+ label: __( 'End', 'elementor' ),
64
+ renderContent: ( { size } ) => <RotatedIcon icon={ JustifyBottomIcon } size={ size } offset={ offset } />,
65
+ showTooltip: true,
66
+ },
67
+ {
68
+ value: 'stretch',
69
+ label: __( 'Stretch', 'elementor' ),
70
+ renderContent: ( { size } ) => <RotatedIcon icon={ JustifyIcon } size={ size } offset={ offset } />,
71
+ showTooltip: true,
72
+ },
73
+ ];
74
+ };
@@ -0,0 +1,78 @@
1
+ import * as React from 'react';
2
+ import { NumberInput } from '@elementor/editor-controls';
3
+ import { type SpanPropValue } from '@elementor/editor-props';
4
+ import { Grid } from '@elementor/ui';
5
+ import { __ } from '@wordpress/i18n';
6
+
7
+ import { StylesField } from '../../../controls-registry/styles-field';
8
+ import { useStylesField } from '../../../hooks/use-styles-field';
9
+ import { UiProviders } from '../../../styles-inheritance/components/ui-providers';
10
+ import { StylesFieldLayout } from '../../styles-field-layout';
11
+
12
+ type GridSpanCssProp = 'grid-column' | 'grid-row';
13
+
14
+ const MIN_SPAN = 1;
15
+
16
+ type GridSpanFieldProps = {
17
+ cssProp: GridSpanCssProp;
18
+ label: string;
19
+ };
20
+
21
+ const GridSpanFieldContent = ( { cssProp, label }: GridSpanFieldProps ) => {
22
+ const { value, setValue, canEdit } = useStylesField< SpanPropValue | null >( cssProp, {
23
+ history: { propDisplayName: label },
24
+ } );
25
+
26
+ const spanValue = value?.value ?? null;
27
+
28
+ const handleChange = ( event: React.ChangeEvent< HTMLInputElement > ) => {
29
+ const raw = event.target.value;
30
+
31
+ if ( raw === '' ) {
32
+ setValue( null );
33
+ return;
34
+ }
35
+
36
+ const num = parseInt( raw, 10 );
37
+
38
+ if ( Number.isNaN( num ) ) {
39
+ return;
40
+ }
41
+
42
+ const clamped = Math.max( num, MIN_SPAN );
43
+ setValue( { $$type: 'span', value: clamped } );
44
+ };
45
+
46
+ return (
47
+ <StylesFieldLayout label={ label } direction="column">
48
+ <NumberInput
49
+ size="tiny"
50
+ type="number"
51
+ fullWidth
52
+ disabled={ ! canEdit }
53
+ value={ spanValue ?? '' }
54
+ onInput={ handleChange }
55
+ inputProps={ { min: MIN_SPAN } }
56
+ />
57
+ </StylesFieldLayout>
58
+ );
59
+ };
60
+
61
+ const GridSpanField = ( { cssProp, label }: GridSpanFieldProps ) => (
62
+ <StylesField bind={ cssProp } propDisplayName={ label }>
63
+ <UiProviders>
64
+ <GridSpanFieldContent cssProp={ cssProp } label={ label } />
65
+ </UiProviders>
66
+ </StylesField>
67
+ );
68
+
69
+ export const GridSpanFields = () => (
70
+ <Grid container gap={ 2 } flexWrap="nowrap">
71
+ <Grid item xs={ 6 }>
72
+ <GridSpanField cssProp="grid-column" label={ __( 'Column Span', 'elementor' ) } />
73
+ </Grid>
74
+ <Grid item xs={ 6 }>
75
+ <GridSpanField cssProp="grid-row" label={ __( 'Row Span', 'elementor' ) } />
76
+ </Grid>
77
+ </Grid>
78
+ );
@@ -13,6 +13,7 @@ import { SectionContent } from '../../section-content';
13
13
  import { AlignContentField } from './align-content-field';
14
14
  import { AlignItemsField } from './align-items-field';
15
15
  import { AlignSelfChild } from './align-self-child-field';
16
+ import { AlignSelfGridChild } from './align-self-grid-child-field';
16
17
  import { DisplayField, useDisplayPlaceholderValue } from './display-field';
17
18
  import { type FlexDirection, FlexDirectionField } from './flex-direction-field';
18
19
  import { FlexOrderField } from './flex-order-field';
@@ -21,30 +22,49 @@ import { GapControlField } from './gap-control-field';
21
22
  import { GridAutoFlowField } from './grid-auto-flow-field';
22
23
  import { GridJustifyItemsField } from './grid-justify-items-field';
23
24
  import { GridSizeFields } from './grid-size-field';
25
+ import { GridSpanFields } from './grid-span-field';
24
26
  import { JustifyContentField } from './justify-content-field';
25
27
  import { WrapField } from './wrap-field';
26
28
 
27
29
  const DISPLAY_LABEL = __( 'Display', 'elementor' );
28
30
  const FLEX_WRAP_LABEL = __( 'Flex wrap', 'elementor' );
31
+ const DEFAULT_PARENT_FLOW_DIRECTION = 'row';
29
32
 
30
33
  export const LayoutSection = () => {
31
34
  const { value: display } = useStylesField< StringPropValue >( 'display', {
32
35
  history: { propDisplayName: DISPLAY_LABEL },
33
36
  } );
34
37
  const displayPlaceholder = useDisplayPlaceholderValue();
38
+ const isGridExperimentActive = isExperimentActive( 'e_css_grid' );
35
39
  const isDisplayFlex = shouldDisplayFlexFields( display, displayPlaceholder as StringPropValue );
36
40
  const isDisplayGrid = 'grid' === ( display?.value ?? ( displayPlaceholder as StringPropValue )?.value );
37
41
  const { element } = useElement();
38
42
  const parent = useParentElement( element.id );
39
43
  const parentStyle = useComputedStyle( parent?.id || null );
40
- const parentStyleDirection = parentStyle?.flexDirection ?? 'row';
44
+
45
+ const getParentStyleDirection = () => {
46
+ if ( 'flex' === parentStyle?.display ) {
47
+ return parentStyle?.flexDirection ?? DEFAULT_PARENT_FLOW_DIRECTION;
48
+ }
49
+
50
+ if ( 'grid' === parentStyle?.display ) {
51
+ return parentStyle?.gridAutoFlow ?? DEFAULT_PARENT_FLOW_DIRECTION;
52
+ }
53
+
54
+ return DEFAULT_PARENT_FLOW_DIRECTION;
55
+ };
41
56
 
42
57
  return (
43
58
  <SectionContent>
44
59
  <DisplayField />
45
60
  { isDisplayFlex && <FlexFields /> }
46
- { isExperimentActive( 'e_css_grid' ) && isDisplayGrid && <GridFields /> }
47
- { 'flex' === parentStyle?.display && <FlexChildFields parentStyleDirection={ parentStyleDirection } /> }
61
+ { 'flex' === parentStyle?.display && (
62
+ <FlexChildFields parentStyleDirection={ getParentStyleDirection() } />
63
+ ) }
64
+ { isGridExperimentActive && isDisplayGrid && <GridFields /> }
65
+ { isGridExperimentActive && 'grid' === parentStyle?.display && (
66
+ <GridChildFields parentStyleDirection={ getParentStyleDirection() } />
67
+ ) }
48
68
  </SectionContent>
49
69
  );
50
70
  };
@@ -89,6 +109,16 @@ const FlexChildFields = ( { parentStyleDirection }: { parentStyleDirection: stri
89
109
  </>
90
110
  );
91
111
 
112
+ const GridChildFields = ( { parentStyleDirection }: { parentStyleDirection: string } ) => (
113
+ <>
114
+ <PanelDivider />
115
+ <ControlFormLabel>{ __( 'Grid Child', 'elementor' ) }</ControlFormLabel>
116
+ <GridSpanFields />
117
+ <AlignSelfGridChild parentStyleDirection={ parentStyleDirection } />
118
+ <FlexOrderField />
119
+ </>
120
+ );
121
+
92
122
  const shouldDisplayFlexFields = ( display: StringPropValue | null, local: StringPropValue ) => {
93
123
  const value = display?.value ?? local?.value;
94
124
 
@@ -113,10 +113,10 @@ export const PositionSection = () => {
113
113
  { isNotStatic ? (
114
114
  <>
115
115
  <DimensionsField />
116
- <ZIndexField />
117
116
  </>
118
117
  ) : null }
119
118
 
119
+ <ZIndexField disabled={ ! isNotStatic } />
120
120
  <PanelDivider />
121
121
  <OffsetField />
122
122
  </SectionContent>
@@ -1,5 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { NumberControl } from '@elementor/editor-controls';
3
+ import { InfoCircleFilledIcon } from '@elementor/icons';
4
+ import { Alert, AlertTitle, Box, Infotip } from '@elementor/ui';
3
5
  import { __ } from '@wordpress/i18n';
4
6
 
5
7
  import { StylesField } from '../../../controls-registry/styles-field';
@@ -7,12 +9,36 @@ import { StylesFieldLayout } from '../../styles-field-layout';
7
9
 
8
10
  const Z_INDEX_LABEL = __( 'Z-index', 'elementor' );
9
11
 
10
- export const ZIndexField = () => {
11
- return (
12
+ export const ZIndexField = ( { disabled }: { disabled?: boolean } ) => {
13
+ const StyleField = (
12
14
  <StylesField bind="z-index" propDisplayName={ Z_INDEX_LABEL }>
13
15
  <StylesFieldLayout label={ Z_INDEX_LABEL }>
14
- <NumberControl />
16
+ <NumberControl disabled={ disabled } />
15
17
  </StylesFieldLayout>
16
18
  </StylesField>
17
19
  );
20
+
21
+ const content = (
22
+ <Alert color="secondary" icon={ <InfoCircleFilledIcon /> } size="small">
23
+ <AlertTitle>{ __( 'Z-index', 'elementor' ) }</AlertTitle>
24
+ <Box component="span">
25
+ { __(
26
+ 'z-index only works on positioned elements. Change position to relative, absolute, or fixed to enable layering.',
27
+ 'elementor'
28
+ ) }
29
+ </Box>
30
+ </Alert>
31
+ );
32
+ return disabled ? (
33
+ <Infotip
34
+ placement="right"
35
+ content={ content }
36
+ color="secondary"
37
+ slotProps={ { popper: { sx: { width: 300 } } } }
38
+ >
39
+ <Box>{ StyleField }</Box>
40
+ </Infotip>
41
+ ) : (
42
+ <>{ StyleField }</>
43
+ );
18
44
  };
@@ -81,6 +81,9 @@ export const StyleTab = () => {
81
81
  'align-content',
82
82
  'align-self',
83
83
  'gap',
84
+ 'order',
85
+ 'grid-column',
86
+ 'grid-row',
84
87
  ] }
85
88
  />
86
89
  <StyleTabSection