@elementor/editor-editing-panel 4.2.0-904 → 4.2.0-905

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-904",
3
+ "version": "4.2.0-905",
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-904",
43
- "@elementor/editor-canvas": "4.2.0-904",
44
- "@elementor/editor-controls": "4.2.0-904",
45
- "@elementor/editor-documents": "4.2.0-904",
46
- "@elementor/editor-elements": "4.2.0-904",
47
- "@elementor/editor-interactions": "4.2.0-904",
48
- "@elementor/editor-notifications": "4.2.0-904",
49
- "@elementor/editor-panels": "4.2.0-904",
50
- "@elementor/editor-props": "4.2.0-904",
51
- "@elementor/editor-responsive": "4.2.0-904",
52
- "@elementor/editor-styles": "4.2.0-904",
53
- "@elementor/editor-styles-repository": "4.2.0-904",
54
- "@elementor/editor-ui": "4.2.0-904",
55
- "@elementor/editor-v1-adapters": "4.2.0-904",
56
- "@elementor/http-client": "4.2.0-904",
42
+ "@elementor/editor": "4.2.0-905",
43
+ "@elementor/editor-canvas": "4.2.0-905",
44
+ "@elementor/editor-controls": "4.2.0-905",
45
+ "@elementor/editor-documents": "4.2.0-905",
46
+ "@elementor/editor-elements": "4.2.0-905",
47
+ "@elementor/editor-interactions": "4.2.0-905",
48
+ "@elementor/editor-notifications": "4.2.0-905",
49
+ "@elementor/editor-panels": "4.2.0-905",
50
+ "@elementor/editor-props": "4.2.0-905",
51
+ "@elementor/editor-responsive": "4.2.0-905",
52
+ "@elementor/editor-styles": "4.2.0-905",
53
+ "@elementor/editor-styles-repository": "4.2.0-905",
54
+ "@elementor/editor-ui": "4.2.0-905",
55
+ "@elementor/editor-v1-adapters": "4.2.0-905",
56
+ "@elementor/http-client": "4.2.0-905",
57
57
  "@elementor/icons": "~1.75.1",
58
- "@elementor/editor-variables": "4.2.0-904",
59
- "@elementor/locations": "4.2.0-904",
60
- "@elementor/menus": "4.2.0-904",
61
- "@elementor/query": "4.2.0-904",
62
- "@elementor/schema": "4.2.0-904",
63
- "@elementor/session": "4.2.0-904",
58
+ "@elementor/editor-variables": "4.2.0-905",
59
+ "@elementor/locations": "4.2.0-905",
60
+ "@elementor/menus": "4.2.0-905",
61
+ "@elementor/query": "4.2.0-905",
62
+ "@elementor/schema": "4.2.0-905",
63
+ "@elementor/session": "4.2.0-905",
64
64
  "@elementor/ui": "1.37.5",
65
- "@elementor/utils": "4.2.0-904",
66
- "@elementor/wp-media": "4.2.0-904",
65
+ "@elementor/utils": "4.2.0-905",
66
+ "@elementor/wp-media": "4.2.0-905",
67
67
  "@wordpress/i18n": "^5.13.0"
68
68
  },
69
69
  "peerDependencies": {
@@ -1,12 +1,22 @@
1
1
  import * as React from 'react';
2
2
  import { type PropsWithChildren } from 'react';
3
3
  import { ControlAdornments, ControlFormLabel } from '@elementor/editor-controls';
4
- import { Stack } from '@elementor/ui';
4
+ import { InfoCircleIcon } from '@elementor/icons';
5
+ import { Stack, Tooltip } from '@elementor/ui';
5
6
 
6
- export const ControlLabel = ( { children }: PropsWithChildren< object > ) => {
7
+ type ControlLabelProps = PropsWithChildren< {
8
+ infoTooltip?: string;
9
+ } >;
10
+
11
+ export const ControlLabel = ( { children, infoTooltip }: ControlLabelProps ) => {
7
12
  return (
8
13
  <Stack direction="row" alignItems="center" justifyItems="start" gap={ 0.25 }>
9
14
  <ControlFormLabel>{ children }</ControlFormLabel>
15
+ { infoTooltip && (
16
+ <Tooltip title={ infoTooltip } placement="top">
17
+ <InfoCircleIcon fontSize="tiny" />
18
+ </Tooltip>
19
+ ) }
10
20
  <ControlAdornments />
11
21
  </Stack>
12
22
  );
@@ -0,0 +1,63 @@
1
+ import * as React from 'react';
2
+ import { useRef } from 'react';
3
+ import { SizeControl } from '@elementor/editor-controls';
4
+ import { Stack } from '@elementor/ui';
5
+ import { __ } from '@wordpress/i18n';
6
+
7
+ import { StylesField } from '../../../controls-registry/styles-field';
8
+ import { StylesFieldLayout } from '../../styles-field-layout';
9
+
10
+ const DEFAULT_UNIT = 'fr' as const;
11
+
12
+ type SizeControlProps = React.ComponentProps< typeof SizeControl >;
13
+
14
+ const AUTO_ROWS_LABEL = __( 'Auto rows', 'elementor' );
15
+ const AUTO_COLUMNS_LABEL = __( 'Auto columns', 'elementor' );
16
+ const AUTO_ROWS_TOOLTIP = __(
17
+ 'Set the size for new rows created automatically when content exceeds the defined grid.',
18
+ 'elementor'
19
+ );
20
+ const AUTO_COLUMNS_TOOLTIP = __(
21
+ 'Set the size for new columns created automatically when content exceeds the defined grid.',
22
+ 'elementor'
23
+ );
24
+
25
+ type GridAutoTrackFieldProps = {
26
+ bind: 'grid-auto-rows' | 'grid-auto-columns';
27
+ infoTooltip: string;
28
+ label: string;
29
+ rowRef: React.RefObject< HTMLDivElement >;
30
+ };
31
+
32
+ const GridAutoTrackField = ( { bind, infoTooltip, label, rowRef }: GridAutoTrackFieldProps ) => (
33
+ <StylesField bind={ bind } propDisplayName={ label }>
34
+ <StylesFieldLayout infoTooltip={ infoTooltip } label={ label } ref={ rowRef }>
35
+ <SizeControl
36
+ enablePropTypeUnits
37
+ defaultUnit={ DEFAULT_UNIT as SizeControlProps[ 'defaultUnit' ] }
38
+ anchorRef={ rowRef }
39
+ />
40
+ </StylesFieldLayout>
41
+ </StylesField>
42
+ );
43
+
44
+ export const GridAutoTrackFields = () => {
45
+ const rowRef = useRef< HTMLDivElement >( null );
46
+
47
+ return (
48
+ <Stack gap={ 2 } pt={ 2 } ref={ rowRef }>
49
+ <GridAutoTrackField
50
+ bind="grid-auto-rows"
51
+ infoTooltip={ AUTO_ROWS_TOOLTIP }
52
+ label={ AUTO_ROWS_LABEL }
53
+ rowRef={ rowRef }
54
+ />
55
+ <GridAutoTrackField
56
+ bind="grid-auto-columns"
57
+ infoTooltip={ AUTO_COLUMNS_TOOLTIP }
58
+ label={ AUTO_COLUMNS_LABEL }
59
+ rowRef={ rowRef }
60
+ />
61
+ </Stack>
62
+ );
63
+ };
@@ -10,6 +10,7 @@ import { useComputedStyle } from '../../../hooks/use-computed-style';
10
10
  import { useStylesField } from '../../../hooks/use-styles-field';
11
11
  import { PanelDivider } from '../../panel-divider';
12
12
  import { SectionContent } from '../../section-content';
13
+ import { StyleTabCollapsibleContent } from '../../style-tab-collapsible-content';
13
14
  import { AlignContentField } from './align-content-field';
14
15
  import { AlignItemsField } from './align-items-field';
15
16
  import { AlignSelfChild } from './align-self-child-field';
@@ -20,6 +21,7 @@ import { FlexOrderField } from './flex-order-field';
20
21
  import { FlexSizeField } from './flex-size-field';
21
22
  import { GapControlField } from './gap-control-field';
22
23
  import { GridAutoFlowField } from './grid-auto-flow-field';
24
+ import { GridAutoTrackFields } from './grid-auto-track-fields';
23
25
  import { GridJustifyItemsField } from './grid-justify-items-field';
24
26
  import { GridOutlineField } from './grid-outline-field';
25
27
  import { GridSizeFields } from './grid-size-field';
@@ -93,6 +95,9 @@ const GridFields = () => (
93
95
  <GridOutlineField />
94
96
  <GridSizeFields />
95
97
  <GridAutoFlowField />
98
+ <StyleTabCollapsibleContent fields={ [ 'grid-auto-rows', 'grid-auto-columns' ] }>
99
+ <GridAutoTrackFields />
100
+ </StyleTabCollapsibleContent>
96
101
  <PanelDivider />
97
102
  <GapControlField />
98
103
  <PanelDivider />
@@ -84,6 +84,8 @@ export const StyleTab = () => {
84
84
  'order',
85
85
  'grid-column',
86
86
  'grid-row',
87
+ 'grid-auto-rows',
88
+ 'grid-auto-columns',
87
89
  ] }
88
90
  />
89
91
  <StyleTabSection
@@ -7,51 +7,47 @@ type StylesFieldLayoutProps = {
7
7
  label: string;
8
8
  children: React.ReactNode;
9
9
  direction?: 'row' | 'column';
10
+ infoTooltip?: string;
10
11
  };
11
12
 
12
13
  export const StylesFieldLayout = React.forwardRef< HTMLDivElement, StylesFieldLayoutProps >( ( props, ref ) => {
13
- const { direction = 'row', children, label } = props;
14
+ const { direction = 'row', children, label, infoTooltip } = props;
14
15
 
15
16
  const LayoutComponent = direction === 'row' ? Row : Column;
16
17
 
17
- return <LayoutComponent label={ label } ref={ ref } children={ children } />;
18
+ return <LayoutComponent label={ label } infoTooltip={ infoTooltip } ref={ ref } children={ children } />;
18
19
  } );
19
20
 
20
- const Row = React.forwardRef< HTMLDivElement, { label: string; children: React.ReactNode } >(
21
- ( { label, children }, ref ) => {
22
- return (
21
+ type LayoutProps = {
22
+ label: string;
23
+ children: React.ReactNode;
24
+ infoTooltip?: string;
25
+ };
26
+
27
+ const Row = React.forwardRef< HTMLDivElement, LayoutProps >( ( { label, children, infoTooltip }, ref ) => {
28
+ return (
29
+ <Grid container gap={ 2 } alignItems="center" flexWrap="nowrap" ref={ ref } aria-label={ `${ label } control` }>
30
+ <Grid item xs={ 6 }>
31
+ <ControlLabel infoTooltip={ infoTooltip }>{ label }</ControlLabel>
32
+ </Grid>
23
33
  <Grid
24
- container
25
- gap={ 2 }
26
- alignItems="center"
27
- flexWrap="nowrap"
28
- ref={ ref }
29
- aria-label={ `${ label } control` }
34
+ item
35
+ xs={ 6 }
36
+ sx={ ( theme: Theme ) => ( {
37
+ width: `calc(50% - ${ theme.spacing( 2 ) })`,
38
+ } ) }
30
39
  >
31
- <Grid item xs={ 6 }>
32
- <ControlLabel>{ label }</ControlLabel>
33
- </Grid>
34
- <Grid
35
- item
36
- xs={ 6 }
37
- sx={ ( theme: Theme ) => ( {
38
- width: `calc(50% - ${ theme.spacing( 2 ) })`,
39
- } ) }
40
- >
41
- { children }
42
- </Grid>
43
- </Grid>
44
- );
45
- }
46
- );
47
-
48
- const Column = React.forwardRef< HTMLDivElement, { label: string; children: React.ReactNode } >(
49
- ( { label, children }, ref ) => {
50
- return (
51
- <Stack gap={ 0.75 } ref={ ref }>
52
- <ControlLabel>{ label }</ControlLabel>
53
40
  { children }
54
- </Stack>
55
- );
56
- }
57
- );
41
+ </Grid>
42
+ </Grid>
43
+ );
44
+ } );
45
+
46
+ const Column = React.forwardRef< HTMLDivElement, LayoutProps >( ( { label, children, infoTooltip }, ref ) => {
47
+ return (
48
+ <Stack gap={ 0.75 } ref={ ref }>
49
+ <ControlLabel infoTooltip={ infoTooltip }>{ label }</ControlLabel>
50
+ { children }
51
+ </Stack>
52
+ );
53
+ } );