@elementor/editor-editing-panel 4.1.0-807 → 4.1.0-809
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/dist/index.js +864 -684
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +702 -517
- package/dist/index.mjs.map +1 -1
- package/package.json +21 -21
- package/src/components/style-sections/layout-section/display-field.tsx +21 -8
- package/src/components/style-sections/layout-section/grid-auto-flow-field.tsx +102 -0
- package/src/components/style-sections/layout-section/grid-justify-items-field.tsx +58 -0
- package/src/components/style-sections/layout-section/grid-size-field.tsx +96 -0
- package/src/components/style-sections/layout-section/layout-section.tsx +18 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-editing-panel",
|
|
3
|
-
"version": "4.1.0-
|
|
3
|
+
"version": "4.1.0-809",
|
|
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-
|
|
43
|
-
"@elementor/editor-canvas": "4.1.0-
|
|
44
|
-
"@elementor/editor-controls": "4.1.0-
|
|
45
|
-
"@elementor/editor-documents": "4.1.0-
|
|
46
|
-
"@elementor/editor-elements": "4.1.0-
|
|
47
|
-
"@elementor/editor-interactions": "4.1.0-
|
|
48
|
-
"@elementor/editor-panels": "4.1.0-
|
|
49
|
-
"@elementor/editor-props": "4.1.0-
|
|
50
|
-
"@elementor/editor-responsive": "4.1.0-
|
|
51
|
-
"@elementor/editor-styles": "4.1.0-
|
|
52
|
-
"@elementor/editor-styles-repository": "4.1.0-
|
|
53
|
-
"@elementor/editor-ui": "4.1.0-
|
|
54
|
-
"@elementor/editor-v1-adapters": "4.1.0-
|
|
42
|
+
"@elementor/editor": "4.1.0-809",
|
|
43
|
+
"@elementor/editor-canvas": "4.1.0-809",
|
|
44
|
+
"@elementor/editor-controls": "4.1.0-809",
|
|
45
|
+
"@elementor/editor-documents": "4.1.0-809",
|
|
46
|
+
"@elementor/editor-elements": "4.1.0-809",
|
|
47
|
+
"@elementor/editor-interactions": "4.1.0-809",
|
|
48
|
+
"@elementor/editor-panels": "4.1.0-809",
|
|
49
|
+
"@elementor/editor-props": "4.1.0-809",
|
|
50
|
+
"@elementor/editor-responsive": "4.1.0-809",
|
|
51
|
+
"@elementor/editor-styles": "4.1.0-809",
|
|
52
|
+
"@elementor/editor-styles-repository": "4.1.0-809",
|
|
53
|
+
"@elementor/editor-ui": "4.1.0-809",
|
|
54
|
+
"@elementor/editor-v1-adapters": "4.1.0-809",
|
|
55
55
|
"@elementor/icons": "^1.68.0",
|
|
56
|
-
"@elementor/editor-variables": "4.1.0-
|
|
57
|
-
"@elementor/locations": "4.1.0-
|
|
58
|
-
"@elementor/menus": "4.1.0-
|
|
59
|
-
"@elementor/schema": "4.1.0-
|
|
60
|
-
"@elementor/session": "4.1.0-
|
|
56
|
+
"@elementor/editor-variables": "4.1.0-809",
|
|
57
|
+
"@elementor/locations": "4.1.0-809",
|
|
58
|
+
"@elementor/menus": "4.1.0-809",
|
|
59
|
+
"@elementor/schema": "4.1.0-809",
|
|
60
|
+
"@elementor/session": "4.1.0-809",
|
|
61
61
|
"@elementor/ui": "1.37.5",
|
|
62
|
-
"@elementor/utils": "4.1.0-
|
|
63
|
-
"@elementor/wp-media": "4.1.0-
|
|
62
|
+
"@elementor/utils": "4.1.0-809",
|
|
63
|
+
"@elementor/wp-media": "4.1.0-809",
|
|
64
64
|
"@wordpress/i18n": "^5.13.0"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { useMemo } from 'react';
|
|
2
3
|
import { type ToggleButtonGroupItem, ToggleControl } from '@elementor/editor-controls';
|
|
4
|
+
import { isExperimentActive } from '@elementor/editor-v1-adapters';
|
|
3
5
|
import { __ } from '@wordpress/i18n';
|
|
4
6
|
|
|
5
7
|
import { useStylesInheritanceChain } from '../../../contexts/styles-inheritance-context';
|
|
6
8
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
7
9
|
import { StylesFieldLayout } from '../../styles-field-layout';
|
|
8
10
|
|
|
9
|
-
type Displays = 'block' | 'flex' | 'inline-block' | 'inline-flex' | 'none';
|
|
11
|
+
type Displays = 'block' | 'flex' | 'grid' | 'inline-block' | 'inline-flex' | 'none';
|
|
10
12
|
|
|
11
13
|
const DISPLAY_LABEL = __( 'Display', 'elementor' );
|
|
12
14
|
|
|
@@ -24,15 +26,15 @@ const displayFieldItems: ToggleButtonGroupItem< Displays >[] = [
|
|
|
24
26
|
showTooltip: true,
|
|
25
27
|
},
|
|
26
28
|
{
|
|
27
|
-
value: '
|
|
28
|
-
renderContent: () => __( '
|
|
29
|
-
label: __( '
|
|
29
|
+
value: 'grid',
|
|
30
|
+
renderContent: () => __( 'Grid', 'elementor' ),
|
|
31
|
+
label: __( 'Grid', 'elementor' ),
|
|
30
32
|
showTooltip: true,
|
|
31
33
|
},
|
|
32
34
|
{
|
|
33
|
-
value: '
|
|
34
|
-
renderContent: () => __( '
|
|
35
|
-
label: __( '
|
|
35
|
+
value: 'inline-block',
|
|
36
|
+
renderContent: () => __( 'In-blk', 'elementor' ),
|
|
37
|
+
label: __( 'Inline-block', 'elementor' ),
|
|
36
38
|
showTooltip: true,
|
|
37
39
|
},
|
|
38
40
|
{
|
|
@@ -41,15 +43,26 @@ const displayFieldItems: ToggleButtonGroupItem< Displays >[] = [
|
|
|
41
43
|
label: __( 'Inline-flex', 'elementor' ),
|
|
42
44
|
showTooltip: true,
|
|
43
45
|
},
|
|
46
|
+
{
|
|
47
|
+
value: 'none',
|
|
48
|
+
renderContent: () => __( 'None', 'elementor' ),
|
|
49
|
+
label: __( 'None', 'elementor' ),
|
|
50
|
+
showTooltip: true,
|
|
51
|
+
},
|
|
44
52
|
];
|
|
45
53
|
|
|
46
54
|
export const DisplayField = () => {
|
|
47
55
|
const placeholder = useDisplayPlaceholderValue();
|
|
56
|
+
const isGridActive = isExperimentActive( 'e_css_grid' );
|
|
57
|
+
const items = useMemo(
|
|
58
|
+
() => ( isGridActive ? displayFieldItems : displayFieldItems.filter( ( item ) => item.value !== 'grid' ) ),
|
|
59
|
+
[ isGridActive ]
|
|
60
|
+
);
|
|
48
61
|
|
|
49
62
|
return (
|
|
50
63
|
<StylesField bind="display" propDisplayName={ DISPLAY_LABEL } placeholder={ placeholder }>
|
|
51
64
|
<StylesFieldLayout label={ DISPLAY_LABEL } direction="column">
|
|
52
|
-
<ToggleControl options={
|
|
65
|
+
<ToggleControl options={ items } maxItems={ 4 } fullWidth={ true } />
|
|
53
66
|
</StylesFieldLayout>
|
|
54
67
|
</StylesField>
|
|
55
68
|
);
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ControlToggleButtonGroup, type ToggleButtonGroupItem } from '@elementor/editor-controls';
|
|
3
|
+
import { type StringPropValue } from '@elementor/editor-props';
|
|
4
|
+
import { ArrowDownSmallIcon, ArrowRightIcon, LayoutDashboardIcon } from '@elementor/icons';
|
|
5
|
+
import { Grid, ToggleButton, Tooltip, withDirection } from '@elementor/ui';
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
|
|
8
|
+
import { StylesField } from '../../../controls-registry/styles-field';
|
|
9
|
+
import { useStylesField } from '../../../hooks/use-styles-field';
|
|
10
|
+
import { UiProviders } from '../../../styles-inheritance/components/ui-providers';
|
|
11
|
+
import { StylesFieldLayout } from '../../styles-field-layout';
|
|
12
|
+
|
|
13
|
+
type AutoFlowDirection = 'row' | 'column';
|
|
14
|
+
|
|
15
|
+
const AUTO_FLOW_LABEL = __( 'Auto flow', 'elementor' );
|
|
16
|
+
const DENSE_LABEL = __( 'Dense', 'elementor' );
|
|
17
|
+
|
|
18
|
+
const StartIcon = withDirection( ArrowRightIcon );
|
|
19
|
+
|
|
20
|
+
const directionOptions: ToggleButtonGroupItem< AutoFlowDirection >[] = [
|
|
21
|
+
{
|
|
22
|
+
value: 'row',
|
|
23
|
+
label: __( 'Row', 'elementor' ),
|
|
24
|
+
renderContent: ( { size } ) => <StartIcon fontSize={ size } />,
|
|
25
|
+
showTooltip: true,
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
value: 'column',
|
|
29
|
+
label: __( 'Column', 'elementor' ),
|
|
30
|
+
renderContent: ( { size } ) => <ArrowDownSmallIcon fontSize={ size } />,
|
|
31
|
+
showTooltip: true,
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
const parseAutoFlow = ( value: string | null ): { direction: AutoFlowDirection; dense: boolean } => {
|
|
36
|
+
if ( ! value ) {
|
|
37
|
+
return { direction: 'row', dense: false };
|
|
38
|
+
}
|
|
39
|
+
const dense = value.includes( 'dense' );
|
|
40
|
+
const direction = value.replace( /\s*dense\s*/, '' ).trim() as AutoFlowDirection;
|
|
41
|
+
return { direction: direction || 'row', dense };
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const composeAutoFlow = ( direction: AutoFlowDirection, dense: boolean ): string => {
|
|
45
|
+
return dense ? `${ direction } dense` : direction;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const GridAutoFlowFieldContent = () => {
|
|
49
|
+
const { value, setValue } = useStylesField< StringPropValue | null >( 'grid-auto-flow', {
|
|
50
|
+
history: { propDisplayName: AUTO_FLOW_LABEL },
|
|
51
|
+
} );
|
|
52
|
+
|
|
53
|
+
const { direction, dense } = parseAutoFlow( value?.value ?? null );
|
|
54
|
+
|
|
55
|
+
const handleDirectionChange = ( newDirection: AutoFlowDirection | null ) => {
|
|
56
|
+
if ( ! newDirection ) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
setValue( { $$type: 'string', value: composeAutoFlow( newDirection, dense ) } );
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const handleDenseToggle = () => {
|
|
63
|
+
setValue( { $$type: 'string', value: composeAutoFlow( direction, ! dense ) } );
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<StylesFieldLayout label={ AUTO_FLOW_LABEL }>
|
|
68
|
+
<Grid container gap={ 1 } flexWrap="nowrap" alignItems="center" justifyContent="flex-end">
|
|
69
|
+
<Grid item sx={ { width: 64, maxWidth: '100%' } }>
|
|
70
|
+
<ControlToggleButtonGroup
|
|
71
|
+
items={ directionOptions }
|
|
72
|
+
value={ direction }
|
|
73
|
+
onChange={ handleDirectionChange }
|
|
74
|
+
exclusive={ true }
|
|
75
|
+
fullWidth={ true }
|
|
76
|
+
/>
|
|
77
|
+
</Grid>
|
|
78
|
+
<Grid item>
|
|
79
|
+
<Tooltip title={ DENSE_LABEL }>
|
|
80
|
+
<ToggleButton
|
|
81
|
+
value="dense"
|
|
82
|
+
selected={ dense }
|
|
83
|
+
onChange={ handleDenseToggle }
|
|
84
|
+
size="tiny"
|
|
85
|
+
aria-label={ DENSE_LABEL }
|
|
86
|
+
>
|
|
87
|
+
<LayoutDashboardIcon fontSize="tiny" />
|
|
88
|
+
</ToggleButton>
|
|
89
|
+
</Tooltip>
|
|
90
|
+
</Grid>
|
|
91
|
+
</Grid>
|
|
92
|
+
</StylesFieldLayout>
|
|
93
|
+
);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export const GridAutoFlowField = () => (
|
|
97
|
+
<StylesField bind="grid-auto-flow" propDisplayName={ AUTO_FLOW_LABEL }>
|
|
98
|
+
<UiProviders>
|
|
99
|
+
<GridAutoFlowFieldContent />
|
|
100
|
+
</UiProviders>
|
|
101
|
+
</StylesField>
|
|
102
|
+
);
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type ToggleButtonGroupItem, ToggleControl } from '@elementor/editor-controls';
|
|
3
|
+
import {
|
|
4
|
+
LayoutAlignCenterIcon as CenterIcon,
|
|
5
|
+
LayoutAlignLeftIcon,
|
|
6
|
+
LayoutAlignRightIcon,
|
|
7
|
+
LayoutDistributeVerticalIcon as StretchIcon,
|
|
8
|
+
} from '@elementor/icons';
|
|
9
|
+
import { withDirection } 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 JustifyItems = 'start' | 'center' | 'end' | 'stretch';
|
|
17
|
+
|
|
18
|
+
const JUSTIFY_ITEMS_LABEL = __( 'Justify items', 'elementor' );
|
|
19
|
+
|
|
20
|
+
const StartIcon = withDirection( LayoutAlignLeftIcon );
|
|
21
|
+
const EndIcon = withDirection( LayoutAlignRightIcon );
|
|
22
|
+
|
|
23
|
+
const options: ToggleButtonGroupItem< JustifyItems >[] = [
|
|
24
|
+
{
|
|
25
|
+
value: 'start',
|
|
26
|
+
label: __( 'Start', 'elementor' ),
|
|
27
|
+
renderContent: ( { size } ) => <StartIcon fontSize={ size } />,
|
|
28
|
+
showTooltip: true,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
value: 'center',
|
|
32
|
+
label: __( 'Center', 'elementor' ),
|
|
33
|
+
renderContent: ( { size } ) => <CenterIcon fontSize={ size } />,
|
|
34
|
+
showTooltip: true,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
value: 'end',
|
|
38
|
+
label: __( 'End', 'elementor' ),
|
|
39
|
+
renderContent: ( { size } ) => <EndIcon fontSize={ size } />,
|
|
40
|
+
showTooltip: true,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
value: 'stretch',
|
|
44
|
+
label: __( 'Stretch', 'elementor' ),
|
|
45
|
+
renderContent: ( { size } ) => <StretchIcon fontSize={ size } />,
|
|
46
|
+
showTooltip: true,
|
|
47
|
+
},
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
export const GridJustifyItemsField = () => (
|
|
51
|
+
<StylesField bind="justify-items" propDisplayName={ JUSTIFY_ITEMS_LABEL }>
|
|
52
|
+
<UiProviders>
|
|
53
|
+
<StylesFieldLayout label={ JUSTIFY_ITEMS_LABEL }>
|
|
54
|
+
<ToggleControl options={ options } />
|
|
55
|
+
</StylesFieldLayout>
|
|
56
|
+
</UiProviders>
|
|
57
|
+
</StylesField>
|
|
58
|
+
);
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRef } from 'react';
|
|
3
|
+
import { SizeComponent } from '@elementor/editor-controls';
|
|
4
|
+
import { type StringPropValue } from '@elementor/editor-props';
|
|
5
|
+
import { Grid } from '@elementor/ui';
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
|
|
8
|
+
import { StylesField } from '../../../controls-registry/styles-field';
|
|
9
|
+
import { useStylesField } from '../../../hooks/use-styles-field';
|
|
10
|
+
import { StylesFieldLayout } from '../../styles-field-layout';
|
|
11
|
+
|
|
12
|
+
type GridTrackUnit = 'fr' | 'custom';
|
|
13
|
+
type GridTrackValue = { size: number | string; unit: GridTrackUnit };
|
|
14
|
+
|
|
15
|
+
const FR = 'fr' as const;
|
|
16
|
+
const CUSTOM = 'custom' as const;
|
|
17
|
+
const UNITS: GridTrackUnit[] = [ FR, CUSTOM ];
|
|
18
|
+
|
|
19
|
+
const REPEAT_FR_PATTERN = /^repeat\(\s*(\d+)\s*,\s*1fr\s*\)$/;
|
|
20
|
+
|
|
21
|
+
const cssToTrackValue = ( css: string | null ): GridTrackValue | null => {
|
|
22
|
+
if ( ! css ) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
const match = css.match( REPEAT_FR_PATTERN );
|
|
26
|
+
if ( match ) {
|
|
27
|
+
return { size: parseInt( match[ 1 ], 10 ), unit: FR };
|
|
28
|
+
}
|
|
29
|
+
return { size: css, unit: CUSTOM };
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const trackValueToCss = ( trackValue: GridTrackValue | null ): string | null => {
|
|
33
|
+
if ( ! trackValue || trackValue.size === '' || trackValue.size === null ) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
if ( trackValue.unit === FR ) {
|
|
37
|
+
return `repeat(${ trackValue.size }, 1fr)`;
|
|
38
|
+
}
|
|
39
|
+
return String( trackValue.size );
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
type GridTrackCssProp = 'grid-template-rows' | 'grid-template-columns';
|
|
43
|
+
|
|
44
|
+
type GridTrackFieldProps = {
|
|
45
|
+
cssProp: GridTrackCssProp;
|
|
46
|
+
label: string;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const GridTrackField = ( { cssProp, label }: GridTrackFieldProps ) => (
|
|
50
|
+
<StylesField bind={ cssProp } propDisplayName={ label }>
|
|
51
|
+
<GridTrackFieldContent cssProp={ cssProp } label={ label } />
|
|
52
|
+
</StylesField>
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
const GridTrackFieldContent = ( { cssProp, label }: GridTrackFieldProps ) => {
|
|
56
|
+
const { value, setValue } = useStylesField< StringPropValue | null >( cssProp, {
|
|
57
|
+
history: { propDisplayName: label },
|
|
58
|
+
} );
|
|
59
|
+
|
|
60
|
+
const anchorRef = useRef< HTMLDivElement >( null );
|
|
61
|
+
const trackValue = cssToTrackValue( value?.value ?? null );
|
|
62
|
+
|
|
63
|
+
const handleChange = ( newValue: GridTrackValue ) => {
|
|
64
|
+
const css = trackValueToCss( newValue );
|
|
65
|
+
setValue( css ? { $$type: 'string', value: css } : null );
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<StylesFieldLayout label={ label } direction="column">
|
|
70
|
+
<div ref={ anchorRef }>
|
|
71
|
+
<SizeComponent
|
|
72
|
+
units={ UNITS as unknown as Parameters< typeof SizeComponent >[ 0 ][ 'units' ] }
|
|
73
|
+
value={
|
|
74
|
+
( trackValue ?? { size: NaN, unit: FR } ) as Parameters< typeof SizeComponent >[ 0 ][ 'value' ]
|
|
75
|
+
}
|
|
76
|
+
defaultUnit={ FR as Parameters< typeof SizeComponent >[ 0 ][ 'defaultUnit' ] }
|
|
77
|
+
setValue={ handleChange as Parameters< typeof SizeComponent >[ 0 ][ 'setValue' ] }
|
|
78
|
+
onBlur={ () => {} }
|
|
79
|
+
min={ 1 }
|
|
80
|
+
anchorRef={ anchorRef }
|
|
81
|
+
/>
|
|
82
|
+
</div>
|
|
83
|
+
</StylesFieldLayout>
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export const GridSizeFields = () => (
|
|
88
|
+
<Grid container gap={ 2 } flexWrap="nowrap">
|
|
89
|
+
<Grid item xs={ 6 }>
|
|
90
|
+
<GridTrackField cssProp="grid-template-columns" label={ __( 'Columns', 'elementor' ) } />
|
|
91
|
+
</Grid>
|
|
92
|
+
<Grid item xs={ 6 }>
|
|
93
|
+
<GridTrackField cssProp="grid-template-rows" label={ __( 'Rows', 'elementor' ) } />
|
|
94
|
+
</Grid>
|
|
95
|
+
</Grid>
|
|
96
|
+
);
|
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { ControlFormLabel } from '@elementor/editor-controls';
|
|
3
3
|
import { useParentElement } from '@elementor/editor-elements';
|
|
4
4
|
import { type StringPropValue } from '@elementor/editor-props';
|
|
5
|
+
import { isExperimentActive } from '@elementor/editor-v1-adapters';
|
|
5
6
|
import { __ } from '@wordpress/i18n';
|
|
6
7
|
|
|
7
8
|
import { useElement } from '../../../contexts/element-context';
|
|
@@ -17,6 +18,9 @@ import { type FlexDirection, FlexDirectionField } from './flex-direction-field';
|
|
|
17
18
|
import { FlexOrderField } from './flex-order-field';
|
|
18
19
|
import { FlexSizeField } from './flex-size-field';
|
|
19
20
|
import { GapControlField } from './gap-control-field';
|
|
21
|
+
import { GridAutoFlowField } from './grid-auto-flow-field';
|
|
22
|
+
import { GridJustifyItemsField } from './grid-justify-items-field';
|
|
23
|
+
import { GridSizeFields } from './grid-size-field';
|
|
20
24
|
import { JustifyContentField } from './justify-content-field';
|
|
21
25
|
import { WrapField } from './wrap-field';
|
|
22
26
|
|
|
@@ -29,6 +33,7 @@ export const LayoutSection = () => {
|
|
|
29
33
|
} );
|
|
30
34
|
const displayPlaceholder = useDisplayPlaceholderValue();
|
|
31
35
|
const isDisplayFlex = shouldDisplayFlexFields( display, displayPlaceholder as StringPropValue );
|
|
36
|
+
const isDisplayGrid = 'grid' === ( display?.value ?? ( displayPlaceholder as StringPropValue )?.value );
|
|
32
37
|
const { element } = useElement();
|
|
33
38
|
const parent = useParentElement( element.id );
|
|
34
39
|
const parentStyle = useComputedStyle( parent?.id || null );
|
|
@@ -38,6 +43,7 @@ export const LayoutSection = () => {
|
|
|
38
43
|
<SectionContent>
|
|
39
44
|
<DisplayField />
|
|
40
45
|
{ isDisplayFlex && <FlexFields /> }
|
|
46
|
+
{ isExperimentActive( 'e_css_grid' ) && isDisplayGrid && <GridFields /> }
|
|
41
47
|
{ 'flex' === parentStyle?.display && <FlexChildFields parentStyleDirection={ parentStyleDirection } /> }
|
|
42
48
|
</SectionContent>
|
|
43
49
|
);
|
|
@@ -61,6 +67,18 @@ const FlexFields = () => {
|
|
|
61
67
|
);
|
|
62
68
|
};
|
|
63
69
|
|
|
70
|
+
const GridFields = () => (
|
|
71
|
+
<>
|
|
72
|
+
<GridSizeFields />
|
|
73
|
+
<GridAutoFlowField />
|
|
74
|
+
<PanelDivider />
|
|
75
|
+
<GapControlField />
|
|
76
|
+
<PanelDivider />
|
|
77
|
+
<GridJustifyItemsField />
|
|
78
|
+
<AlignItemsField />
|
|
79
|
+
</>
|
|
80
|
+
);
|
|
81
|
+
|
|
64
82
|
const FlexChildFields = ( { parentStyleDirection }: { parentStyleDirection: string } ) => (
|
|
65
83
|
<>
|
|
66
84
|
<PanelDivider />
|