@elementor/editor-editing-panel 4.2.0-beta1 → 4.2.0-beta2

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.2.0-beta1",
3
+ "version": "4.2.0-beta2",
4
4
  "private": false,
5
5
  "author": "Elementor Team",
6
6
  "homepage": "https://elementor.com/",
@@ -39,31 +39,31 @@
39
39
  "dev": "tsup --config=../../tsup.dev.ts"
40
40
  },
41
41
  "dependencies": {
42
- "@elementor/editor": "4.2.0-beta1",
43
- "@elementor/editor-canvas": "4.2.0-beta1",
44
- "@elementor/editor-controls": "4.2.0-beta1",
45
- "@elementor/editor-documents": "4.2.0-beta1",
46
- "@elementor/editor-elements": "4.2.0-beta1",
47
- "@elementor/editor-interactions": "4.2.0-beta1",
48
- "@elementor/editor-notifications": "4.2.0-beta1",
49
- "@elementor/editor-panels": "4.2.0-beta1",
50
- "@elementor/editor-props": "4.2.0-beta1",
51
- "@elementor/editor-responsive": "4.2.0-beta1",
52
- "@elementor/editor-styles": "4.2.0-beta1",
53
- "@elementor/editor-styles-repository": "4.2.0-beta1",
54
- "@elementor/editor-ui": "4.2.0-beta1",
55
- "@elementor/editor-v1-adapters": "4.2.0-beta1",
56
- "@elementor/http-client": "4.2.0-beta1",
42
+ "@elementor/editor": "4.2.0-beta2",
43
+ "@elementor/editor-canvas": "4.2.0-beta2",
44
+ "@elementor/editor-controls": "4.2.0-beta2",
45
+ "@elementor/editor-documents": "4.2.0-beta2",
46
+ "@elementor/editor-elements": "4.2.0-beta2",
47
+ "@elementor/editor-interactions": "4.2.0-beta2",
48
+ "@elementor/editor-notifications": "4.2.0-beta2",
49
+ "@elementor/editor-panels": "4.2.0-beta2",
50
+ "@elementor/editor-props": "4.2.0-beta2",
51
+ "@elementor/editor-responsive": "4.2.0-beta2",
52
+ "@elementor/editor-styles": "4.2.0-beta2",
53
+ "@elementor/editor-styles-repository": "4.2.0-beta2",
54
+ "@elementor/editor-ui": "4.2.0-beta2",
55
+ "@elementor/editor-v1-adapters": "4.2.0-beta2",
56
+ "@elementor/http-client": "4.2.0-beta2",
57
57
  "@elementor/icons": "~1.75.1",
58
- "@elementor/editor-variables": "4.2.0-beta1",
59
- "@elementor/locations": "4.2.0-beta1",
60
- "@elementor/menus": "4.2.0-beta1",
61
- "@elementor/query": "4.2.0-beta1",
62
- "@elementor/schema": "4.2.0-beta1",
63
- "@elementor/session": "4.2.0-beta1",
58
+ "@elementor/editor-variables": "4.2.0-beta2",
59
+ "@elementor/locations": "4.2.0-beta2",
60
+ "@elementor/menus": "4.2.0-beta2",
61
+ "@elementor/query": "4.2.0-beta2",
62
+ "@elementor/schema": "4.2.0-beta2",
63
+ "@elementor/session": "4.2.0-beta2",
64
64
  "@elementor/ui": "1.37.5",
65
- "@elementor/utils": "4.2.0-beta1",
66
- "@elementor/wp-media": "4.2.0-beta1",
65
+ "@elementor/utils": "4.2.0-beta2",
66
+ "@elementor/wp-media": "4.2.0-beta2",
67
67
  "@wordpress/i18n": "^5.13.0"
68
68
  },
69
69
  "peerDependencies": {
@@ -134,6 +134,9 @@ const CLASS_STATES_MAP: Record< string, { label: string } > = {
134
134
  selected: {
135
135
  label: __( 'selected', 'elementor' ),
136
136
  },
137
+ disabled: {
138
+ label: __( 'disabled', 'elementor' ),
139
+ },
137
140
  };
138
141
 
139
142
  export function useElementStates() {
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { ControlToggleButtonGroup, type ToggleButtonGroupItem } from '@elementor/editor-controls';
2
+ import { ControlToggleButtonGroup, type ToggleButtonGroupItem, useBoundProp } from '@elementor/editor-controls';
3
3
  import { type StringPropValue } from '@elementor/editor-props';
4
4
  import { ArrowDownSmallIcon, ArrowRightIcon, LayoutDashboardIcon } from '@elementor/icons';
5
5
  import { Grid, ToggleButton, Tooltip, withDirection } from '@elementor/ui';
@@ -32,9 +32,9 @@ const directionOptions: ToggleButtonGroupItem< AutoFlowDirection >[] = [
32
32
  },
33
33
  ];
34
34
 
35
- const parseAutoFlow = ( value: string | null ): { direction: AutoFlowDirection; dense: boolean } => {
35
+ const parseAutoFlow = ( value: string | null ): { direction: AutoFlowDirection | null; dense: boolean } => {
36
36
  if ( ! value ) {
37
- return { direction: 'row', dense: false };
37
+ return { direction: null, dense: false };
38
38
  }
39
39
  const dense = value.includes( 'dense' );
40
40
  const direction = value.replace( /\s*dense\s*/, '' ).trim() as AutoFlowDirection;
@@ -46,21 +46,25 @@ const composeAutoFlow = ( direction: AutoFlowDirection, dense: boolean ): string
46
46
  };
47
47
 
48
48
  const GridAutoFlowFieldContent = () => {
49
- const { value, setValue } = useStylesField< StringPropValue | null >( 'grid-auto-flow', {
49
+ const { value, setValue, canEdit } = useStylesField< StringPropValue | null >( 'grid-auto-flow', {
50
50
  history: { propDisplayName: AUTO_FLOW_LABEL },
51
51
  } );
52
+ const { placeholder } = useBoundProp();
52
53
 
53
54
  const { direction, dense } = parseAutoFlow( value?.value ?? null );
55
+ const directionPlaceholder = parseAutoFlow( ( placeholder as StringPropValue | null )?.value ?? null ).direction;
54
56
 
55
57
  const handleDirectionChange = ( newDirection: AutoFlowDirection | null ) => {
56
58
  if ( ! newDirection ) {
59
+ setValue( null );
57
60
  return;
58
61
  }
59
62
  setValue( { $$type: 'string', value: composeAutoFlow( newDirection, dense ) } );
60
63
  };
61
64
 
62
65
  const handleDenseToggle = () => {
63
- setValue( { $$type: 'string', value: composeAutoFlow( direction, ! dense ) } );
66
+ const nextDirection = direction ?? 'row';
67
+ setValue( { $$type: 'string', value: composeAutoFlow( nextDirection, ! dense ) } );
64
68
  };
65
69
 
66
70
  return (
@@ -70,9 +74,11 @@ const GridAutoFlowFieldContent = () => {
70
74
  <ControlToggleButtonGroup
71
75
  items={ directionOptions }
72
76
  value={ direction }
77
+ placeholder={ directionPlaceholder }
73
78
  onChange={ handleDirectionChange }
74
79
  exclusive={ true }
75
80
  fullWidth={ true }
81
+ disabled={ ! canEdit }
76
82
  />
77
83
  </Grid>
78
84
  <Grid item>
@@ -83,6 +89,7 @@ const GridAutoFlowFieldContent = () => {
83
89
  onChange={ handleDenseToggle }
84
90
  size="tiny"
85
91
  aria-label={ DENSE_LABEL }
92
+ disabled={ ! canEdit }
86
93
  >
87
94
  <LayoutDashboardIcon fontSize="tiny" />
88
95
  </ToggleButton>
@@ -1,18 +1,33 @@
1
1
  import * as React from 'react';
2
- import { SwitchControl } from '@elementor/editor-controls';
2
+ import { updateElementEditorSettings, useElementEditorSettings } from '@elementor/editor-elements';
3
+ import { Box, Switch } from '@elementor/ui';
3
4
  import { __ } from '@wordpress/i18n';
4
5
 
5
- import { SettingsField } from '../../../controls-registry/settings-field';
6
+ import { useElement } from '../../../contexts/element-context';
6
7
  import { StylesFieldLayout } from '../../styles-field-layout';
7
8
 
8
9
  const GRID_OUTLINE_LABEL = __( 'Show Grid Outline', 'elementor' );
9
10
 
10
11
  export const GridOutlineField = () => {
12
+ const { element } = useElement();
13
+ const settings = useElementEditorSettings( element.id );
14
+ const value = settings?.grid_outline ?? true;
15
+
11
16
  return (
12
- <SettingsField bind="grid_outline" propDisplayName={ GRID_OUTLINE_LABEL }>
13
- <StylesFieldLayout label={ GRID_OUTLINE_LABEL }>
14
- <SwitchControl />
15
- </StylesFieldLayout>
16
- </SettingsField>
17
+ <StylesFieldLayout label={ GRID_OUTLINE_LABEL }>
18
+ <Box sx={ { display: 'flex', justifyContent: 'flex-end' } }>
19
+ <Switch
20
+ aria-label={ GRID_OUTLINE_LABEL }
21
+ checked={ value }
22
+ onChange={ ( event: React.ChangeEvent< HTMLInputElement > ) => {
23
+ updateElementEditorSettings( {
24
+ elementId: element.id,
25
+ settings: { grid_outline: event.target.checked },
26
+ } );
27
+ } }
28
+ size="small"
29
+ />
30
+ </Box>
31
+ </StylesFieldLayout>
17
32
  );
18
33
  };