@elementor/editor-controls 4.1.0-760 → 4.1.0-762

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@elementor/editor-controls",
3
3
  "description": "This package contains the controls model and utils for the Elementor editor",
4
- "version": "4.1.0-760",
4
+ "version": "4.1.0-762",
5
5
  "private": false,
6
6
  "author": "Elementor Team",
7
7
  "homepage": "https://elementor.com/",
@@ -40,22 +40,22 @@
40
40
  "dev": "tsup --config=../../tsup.dev.ts"
41
41
  },
42
42
  "dependencies": {
43
- "@elementor/editor-current-user": "4.1.0-760",
44
- "@elementor/editor-elements": "4.1.0-760",
45
- "@elementor/editor-props": "4.1.0-760",
46
- "@elementor/editor-responsive": "4.1.0-760",
47
- "@elementor/editor-ui": "4.1.0-760",
48
- "@elementor/editor-v1-adapters": "4.1.0-760",
49
- "@elementor/env": "4.1.0-760",
50
- "@elementor/http-client": "4.1.0-760",
43
+ "@elementor/editor-current-user": "4.1.0-762",
44
+ "@elementor/editor-elements": "4.1.0-762",
45
+ "@elementor/editor-props": "4.1.0-762",
46
+ "@elementor/editor-responsive": "4.1.0-762",
47
+ "@elementor/editor-ui": "4.1.0-762",
48
+ "@elementor/editor-v1-adapters": "4.1.0-762",
49
+ "@elementor/env": "4.1.0-762",
50
+ "@elementor/http-client": "4.1.0-762",
51
51
  "@elementor/icons": "^1.68.0",
52
- "@elementor/locations": "4.1.0-760",
53
- "@elementor/events": "4.1.0-760",
54
- "@elementor/query": "4.1.0-760",
55
- "@elementor/session": "4.1.0-760",
52
+ "@elementor/locations": "4.1.0-762",
53
+ "@elementor/events": "4.1.0-762",
54
+ "@elementor/query": "4.1.0-762",
55
+ "@elementor/session": "4.1.0-762",
56
56
  "@elementor/ui": "1.36.17",
57
- "@elementor/utils": "4.1.0-760",
58
- "@elementor/wp-media": "4.1.0-760",
57
+ "@elementor/utils": "4.1.0-762",
58
+ "@elementor/wp-media": "4.1.0-762",
59
59
  "@wordpress/i18n": "^5.13.0",
60
60
  "@monaco-editor/react": "^4.7.0",
61
61
  "dayjs": "^1.11.18",
@@ -26,12 +26,8 @@ const EmailField = ( { bind, label, placeholder }: { bind: string; label: string
26
26
  </PropKeyProvider>
27
27
  );
28
28
 
29
- const SendToField = () => (
30
- <EmailField
31
- bind="to"
32
- label={ __( 'Send to', 'elementor' ) }
33
- placeholder={ __( 'Where should we send new submissions?', 'elementor' ) }
34
- />
29
+ const SendToField = ( { placeholder }: { placeholder?: string } ) => (
30
+ <EmailField bind="to" label={ __( 'Send to', 'elementor' ) } placeholder={ placeholder } />
35
31
  );
36
32
 
37
33
  const SubjectField = () => (
@@ -133,14 +129,14 @@ const AdvancedSettings = () => (
133
129
  </CollapsibleContent>
134
130
  );
135
131
 
136
- export const EmailFormActionControl = createControl( () => {
132
+ export const EmailFormActionControl = createControl( ( { toPlaceholder }: { toPlaceholder?: string } ) => {
137
133
  const { value, setValue, ...propContext } = useBoundProp( emailPropTypeUtil );
138
134
 
139
135
  return (
140
136
  <PropProvider { ...propContext } value={ value } setValue={ setValue }>
141
137
  <Stack gap={ 2 }>
142
138
  <ControlLabel>{ __( 'Email settings', 'elementor' ) }</ControlLabel>
143
- <SendToField />
139
+ <SendToField placeholder={ toPlaceholder } />
144
140
  <SubjectField />
145
141
  <MessageField />
146
142
  <FromEmailField />
@@ -1,11 +1,15 @@
1
1
  import { useEffect, useState } from 'react';
2
2
 
3
+ import { EXTENDED_UNITS } from '../utils/resolve-size-value';
4
+
3
5
  type UseUnitSyncProps< U > = {
4
6
  unit: U;
5
7
  setUnit: ( unit: U ) => void;
6
8
  persistWhen: () => boolean;
7
9
  };
8
10
 
11
+ type ExtendedUnit = ( typeof EXTENDED_UNITS )[ keyof typeof EXTENDED_UNITS ];
12
+
9
13
  export const useUnitSync = < U >( { unit, setUnit, persistWhen }: UseUnitSyncProps< U > ) => {
10
14
  const [ state, setState ] = useState( unit );
11
15
 
@@ -16,10 +20,14 @@ export const useUnitSync = < U >( { unit, setUnit, persistWhen }: UseUnitSyncPro
16
20
  // eslint-disable-next-line react-hooks/exhaustive-deps
17
21
  }, [ unit ] );
18
22
 
23
+ const isExtendedUnit = ( value: U ): value is ExtendedUnit & U => {
24
+ return Object.values( EXTENDED_UNITS ).includes( value as ExtendedUnit );
25
+ };
26
+
19
27
  const setInternalValue = ( newUnit: U ) => {
20
28
  setState( newUnit );
21
29
 
22
- if ( persistWhen() ) {
30
+ if ( isExtendedUnit( newUnit ) || persistWhen() ) {
23
31
  setUnit( newUnit );
24
32
  }
25
33
  };
@@ -19,10 +19,11 @@ export const resolveBoundPropValue = < T extends SizeValue >(
19
19
  ] );
20
20
 
21
21
  const placeholderSource = propPlaceholder ?? boundPropPlaceholder;
22
+ const hasValue = Boolean( value );
22
23
 
23
24
  return {
24
25
  sizeValue,
25
- placeholder: resolvePlaceholder( placeholderSource ),
26
+ placeholder: hasValue ? undefined : resolvePlaceholder( placeholderSource ),
26
27
  };
27
28
  };
28
29