@elementor/editor-editing-panel 4.0.0-564 → 4.0.0-573

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.0.0-564",
3
+ "version": "4.0.0-573",
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.0.0-564",
43
- "@elementor/editor-canvas": "4.0.0-564",
44
- "@elementor/editor-controls": "4.0.0-564",
45
- "@elementor/editor-documents": "4.0.0-564",
46
- "@elementor/editor-elements": "4.0.0-564",
47
- "@elementor/editor-interactions": "4.0.0-564",
48
- "@elementor/editor-panels": "4.0.0-564",
49
- "@elementor/editor-props": "4.0.0-564",
50
- "@elementor/editor-responsive": "4.0.0-564",
51
- "@elementor/editor-styles": "4.0.0-564",
52
- "@elementor/editor-styles-repository": "4.0.0-564",
53
- "@elementor/editor-ui": "4.0.0-564",
54
- "@elementor/editor-v1-adapters": "4.0.0-564",
42
+ "@elementor/editor": "4.0.0-573",
43
+ "@elementor/editor-canvas": "4.0.0-573",
44
+ "@elementor/editor-controls": "4.0.0-573",
45
+ "@elementor/editor-documents": "4.0.0-573",
46
+ "@elementor/editor-elements": "4.0.0-573",
47
+ "@elementor/editor-interactions": "4.0.0-573",
48
+ "@elementor/editor-panels": "4.0.0-573",
49
+ "@elementor/editor-props": "4.0.0-573",
50
+ "@elementor/editor-responsive": "4.0.0-573",
51
+ "@elementor/editor-styles": "4.0.0-573",
52
+ "@elementor/editor-styles-repository": "4.0.0-573",
53
+ "@elementor/editor-ui": "4.0.0-573",
54
+ "@elementor/editor-v1-adapters": "4.0.0-573",
55
55
  "@elementor/icons": "^1.63.0",
56
- "@elementor/editor-variables": "4.0.0-564",
57
- "@elementor/locations": "4.0.0-564",
58
- "@elementor/menus": "4.0.0-564",
59
- "@elementor/schema": "4.0.0-564",
60
- "@elementor/session": "4.0.0-564",
56
+ "@elementor/editor-variables": "4.0.0-573",
57
+ "@elementor/locations": "4.0.0-573",
58
+ "@elementor/menus": "4.0.0-573",
59
+ "@elementor/schema": "4.0.0-573",
60
+ "@elementor/session": "4.0.0-573",
61
61
  "@elementor/ui": "1.36.17",
62
- "@elementor/utils": "4.0.0-564",
63
- "@elementor/wp-media": "4.0.0-564",
62
+ "@elementor/utils": "4.0.0-573",
63
+ "@elementor/wp-media": "4.0.0-573",
64
64
  "@wordpress/i18n": "^5.13.0"
65
65
  },
66
66
  "peerDependencies": {
@@ -1,10 +1,9 @@
1
1
  import * as React from 'react';
2
2
  import { type PropsWithChildren, type ReactNode, useId, useRef } from 'react';
3
- import { CollapseIcon, SectionRefContext } from '@elementor/editor-ui';
3
+ import { CollapseIcon, type CollapsibleValue, getCollapsibleValue, SectionRefContext } from '@elementor/editor-ui';
4
4
  import { Collapse, Divider, ListItemButton, ListItemText, Stack } from '@elementor/ui';
5
5
 
6
6
  import { useStateByElement } from '../hooks/use-state-by-element';
7
- import { type CollapsibleValue, getCollapsibleValue } from './collapsible-content';
8
7
 
9
8
  type Props = PropsWithChildren< {
10
9
  title: string;
@@ -1,8 +1,9 @@
1
1
  import * as React from 'react';
2
2
  import { type PropsWithChildren } from 'react';
3
+ import { CollapsibleContent } from '@elementor/editor-ui';
3
4
 
4
5
  import { StylesInheritanceSectionIndicators } from '../styles-inheritance/components/styles-inheritance-section-indicators';
5
- import { CollapsibleContent } from './collapsible-content';
6
+
6
7
  type Props = PropsWithChildren< { fields?: string[] } >;
7
8
 
8
9
  export const StyleTabCollapsibleContent = ( { fields = [], children }: Props ) => {
@@ -2,6 +2,7 @@ import {
2
2
  ChipsControl,
3
3
  type ControlComponent,
4
4
  DateTimeControl,
5
+ EmailFormActionControl,
5
6
  HtmlTagControl,
6
7
  ImageControl,
7
8
  InlineEditingControl,
@@ -23,6 +24,7 @@ import { type ControlLayout } from '@elementor/editor-elements';
23
24
  import {
24
25
  booleanPropTypeUtil,
25
26
  DateTimePropTypeUtil,
27
+ emailPropTypeUtil,
26
28
  htmlV2PropTypeUtil,
27
29
  imagePropTypeUtil,
28
30
  imageSrcPropTypeUtil,
@@ -63,6 +65,7 @@ const controlTypes = {
63
65
  toggle: { component: ToggleControl, layout: 'full', propTypeUtil: stringPropTypeUtil },
64
66
  'date-time': { component: DateTimeControl, layout: 'full', propTypeUtil: DateTimePropTypeUtil },
65
67
  'inline-editing': { component: InlineEditingControl, layout: 'full', propTypeUtil: htmlV2PropTypeUtil },
68
+ email: { component: EmailFormActionControl, layout: 'custom', propTypeUtil: emailPropTypeUtil },
66
69
  } as const satisfies ControlRegistry;
67
70
 
68
71
  export type ControlType = keyof typeof controlTypes;
@@ -11,6 +11,7 @@ import {
11
11
  } from '@elementor/editor-elements';
12
12
  import {
13
13
  type CreateOptions,
14
+ isDependency,
14
15
  isDependencyMet,
15
16
  type PropKey,
16
17
  type Props,
@@ -64,6 +65,17 @@ export const SettingsField = ( { bind, children, propDisplayName }: SettingsFiel
64
65
 
65
66
  const isDisabled = ( prop: PropType ) => ! isDependencyMet( prop?.dependencies, elementSettingValues ).isMet;
66
67
 
68
+ const propTypeToBind = propsSchema[ bind ];
69
+ const dependenciesResult = isDependencyMet( propTypeToBind?.dependencies, elementSettingValues );
70
+ const shouldHide =
71
+ ! dependenciesResult.isMet &&
72
+ ! isDependency( dependenciesResult.failingDependencies[ 0 ] ) &&
73
+ dependenciesResult.failingDependencies[ 0 ]?.effect === 'hide';
74
+
75
+ if ( shouldHide ) {
76
+ return null;
77
+ }
78
+
67
79
  return (
68
80
  <PropProvider propType={ propType } value={ value } setValue={ setValue } isDisabled={ isDisabled }>
69
81
  <PropKeyProvider bind={ bind }>{ children }</PropKeyProvider>
@@ -160,7 +160,10 @@ function handleUnmetCondition( props: {
160
160
  elementId: string;
161
161
  } ) {
162
162
  const { failingDependencies, dependency, elementValues, defaultValue, elementId } = props;
163
- const newValue = failingDependencies.find( ( term ) => term.newValue )?.newValue ?? null;
163
+ const termWithNewValue = failingDependencies.find(
164
+ ( term ): term is Dependency => 'newValue' in term && !! term.newValue
165
+ ) as Dependency | undefined;
166
+ const newValue = termWithNewValue?.newValue ?? null;
164
167
  const currentValue = extractValue( dependency.split( '.' ), elementValues ) ?? defaultValue;
165
168
 
166
169
  savePreviousValueToStorage( {
@@ -1,65 +0,0 @@
1
- import * as React from 'react';
2
- import { type ReactNode, useState } from 'react';
3
- import { CollapseIcon } from '@elementor/editor-ui';
4
- import { Button, Collapse, Stack, styled } from '@elementor/ui';
5
- import { __ } from '@wordpress/i18n';
6
-
7
- type StaticItem< T = unknown > = T extends ( ...args: unknown[] ) => unknown ? never : T;
8
-
9
- type CallbackItem< T > = ( isOpen: boolean ) => T;
10
- export type CollapsibleValue< T > = CallbackItem< T > | StaticItem< T >;
11
-
12
- type CollapsibleContentProps = React.PropsWithChildren< {
13
- defaultOpen?: boolean;
14
- titleEnd?: CollapsibleValue< ReactNode | string > | null;
15
- } >;
16
-
17
- const IndicatorsWrapper = styled( 'div' )`
18
- position: absolute;
19
- top: 0;
20
- right: ${ ( { theme } ) => theme.spacing( 3 ) };
21
- height: 100%;
22
- display: flex;
23
- flex-direction: column;
24
- align-items: center;
25
- justify-content: center;
26
- `;
27
-
28
- export const CollapsibleContent = ( { children, defaultOpen = false, titleEnd = null }: CollapsibleContentProps ) => {
29
- const [ open, setOpen ] = useState( defaultOpen );
30
-
31
- const handleToggle = () => {
32
- setOpen( ( prevOpen ) => ! prevOpen );
33
- };
34
-
35
- return (
36
- <Stack>
37
- <Stack sx={ { position: 'relative' } }>
38
- <Button
39
- fullWidth
40
- size="small"
41
- color="secondary"
42
- variant="outlined"
43
- onClick={ handleToggle }
44
- endIcon={ <CollapseIcon open={ open } /> }
45
- sx={ { my: 0.5 } }
46
- aria-label={ open ? 'Show less' : 'Show more' }
47
- >
48
- { open ? __( 'Show less', 'elementor' ) : __( 'Show more', 'elementor' ) }
49
- </Button>
50
- { titleEnd && <IndicatorsWrapper>{ getCollapsibleValue( titleEnd, open ) }</IndicatorsWrapper> }
51
- </Stack>
52
- <Collapse in={ open } timeout="auto" unmountOnExit>
53
- { children }
54
- </Collapse>
55
- </Stack>
56
- );
57
- };
58
-
59
- export function getCollapsibleValue< T >( value: CollapsibleValue< T >, isOpen: boolean ): T {
60
- if ( typeof value === 'function' ) {
61
- return ( value as CallbackItem< T > )( isOpen );
62
- }
63
-
64
- return value;
65
- }