@elementor/editor-controls 4.2.0-beta2 → 4.3.0-1000

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.2.0-beta2",
4
+ "version": "4.3.0-1000",
5
5
  "private": false,
6
6
  "author": "Elementor Team",
7
7
  "homepage": "https://elementor.com/",
@@ -40,23 +40,23 @@
40
40
  "dev": "tsup --config=../../tsup.dev.ts"
41
41
  },
42
42
  "dependencies": {
43
- "@elementor/editor-current-user": "4.2.0-beta2",
44
- "@elementor/editor-elements": "4.2.0-beta2",
45
- "@elementor/editor-props": "4.2.0-beta2",
46
- "@elementor/editor-responsive": "4.2.0-beta2",
47
- "@elementor/editor-ui": "4.2.0-beta2",
48
- "@elementor/editor-v1-adapters": "4.2.0-beta2",
49
- "@elementor/env": "4.2.0-beta2",
50
- "@elementor/events": "4.2.0-beta2",
51
- "@elementor/http-client": "4.2.0-beta2",
43
+ "@elementor/editor-current-user": "4.3.0-1000",
44
+ "@elementor/editor-elements": "4.3.0-1000",
45
+ "@elementor/editor-props": "4.3.0-1000",
46
+ "@elementor/editor-responsive": "4.3.0-1000",
47
+ "@elementor/editor-ui": "4.3.0-1000",
48
+ "@elementor/editor-v1-adapters": "4.3.0-1000",
49
+ "@elementor/env": "4.3.0-1000",
50
+ "@elementor/events": "4.3.0-1000",
51
+ "@elementor/http-client": "4.3.0-1000",
52
52
  "@elementor/icons": "~1.75.1",
53
- "@elementor/locations": "4.2.0-beta2",
54
- "@elementor/query": "4.2.0-beta2",
55
- "@elementor/schema": "4.2.0-beta2",
56
- "@elementor/session": "4.2.0-beta2",
53
+ "@elementor/locations": "4.3.0-1000",
54
+ "@elementor/query": "4.3.0-1000",
55
+ "@elementor/schema": "4.3.0-1000",
56
+ "@elementor/session": "4.3.0-1000",
57
57
  "@elementor/ui": "1.37.5",
58
- "@elementor/utils": "4.2.0-beta2",
59
- "@elementor/wp-media": "4.2.0-beta2",
58
+ "@elementor/utils": "4.3.0-1000",
59
+ "@elementor/wp-media": "4.3.0-1000",
60
60
  "@monaco-editor/react": "^4.7.0",
61
61
  "@tiptap/extension-bold": "^3.11.1",
62
62
  "@tiptap/extension-document": "^3.11.1",
@@ -88,37 +88,32 @@ type SortableItemSettings< T > = BaseItemSettings< T > & {
88
88
  getId: ( { item, index }: { item: T; index: number } ) => string;
89
89
  };
90
90
 
91
- type RepeaterProps< T > =
92
- | {
93
- label: string;
94
- values?: T[];
95
- openOnAdd?: boolean;
96
- setValues: ( newValue: T[], _: CreateOptions, meta?: SetRepeaterValuesMeta< T > ) => void;
97
- disabled?: boolean;
98
- disableAddItemButton?: boolean;
99
- addButtonInfotipContent?: React.ReactNode;
100
- showDuplicate?: boolean;
101
- showToggle?: boolean;
102
- showRemove?: boolean;
103
- openItem?: number;
104
- isSortable: false;
105
- itemSettings: BaseItemSettings< T >;
106
- }
107
- | {
108
- label: string;
109
- values?: T[];
110
- openOnAdd?: boolean;
111
- setValues: ( newValue: T[], _: CreateOptions, meta?: SetRepeaterValuesMeta< T > ) => void;
112
- disabled?: boolean;
113
- disableAddItemButton?: boolean;
114
- addButtonInfotipContent?: React.ReactNode;
115
- showDuplicate?: boolean;
116
- showToggle?: boolean;
117
- showRemove?: boolean;
118
- openItem?: number;
119
- isSortable?: true;
120
- itemSettings: SortableItemSettings< T >;
121
- };
91
+ type BaseProps< T > = {
92
+ label: string;
93
+ values?: T[];
94
+ openOnAdd?: boolean;
95
+ setValues: ( newValue: T[], _: CreateOptions, meta?: SetRepeaterValuesMeta< T > ) => void;
96
+ disabled?: boolean;
97
+ disableAddItemButton?: boolean;
98
+ addButtonInfotipContent?: React.ReactNode;
99
+ showDuplicate?: boolean;
100
+ showToggle?: boolean;
101
+ showRemove?: boolean;
102
+ openItem?: number;
103
+ adornment?: React.FC;
104
+ };
105
+
106
+ type SortableProps< T > = BaseProps< T > & {
107
+ isSortable?: true;
108
+ itemSettings: SortableItemSettings< T >;
109
+ };
110
+
111
+ type NonSortableProps< T > = BaseProps< T > & {
112
+ isSortable?: false;
113
+ itemSettings: BaseItemSettings< T >;
114
+ };
115
+
116
+ type RepeaterProps< T > = SortableProps< T > | NonSortableProps< T >;
122
117
 
123
118
  const EMPTY_OPEN_ITEM = -1;
124
119
 
@@ -136,6 +131,7 @@ export const Repeater = < T, >( {
136
131
  addButtonInfotipContent,
137
132
  openItem: initialOpenItem = EMPTY_OPEN_ITEM,
138
133
  isSortable = true,
134
+ adornment = ControlAdornments,
139
135
  }: RepeaterProps< RepeaterItem< T > > ) => {
140
136
  const [ openItem, setOpenItem ] = useState( initialOpenItem );
141
137
 
@@ -232,7 +228,7 @@ export const Repeater = < T, >( {
232
228
 
233
229
  return (
234
230
  <SectionContent gap={ 2 }>
235
- <RepeaterHeader label={ label } adornment={ ControlAdornments }>
231
+ <RepeaterHeader label={ label } adornment={ adornment }>
236
232
  { shouldShowInfotip ? (
237
233
  <Infotip
238
234
  placement="right"
@@ -6,16 +6,15 @@ import { Autocomplete, Grid, TextField } from '@elementor/ui';
6
6
  import { useBoundProp } from '../../bound-prop-context';
7
7
  import { ChipsList } from '../../components/chips-list';
8
8
  import { ControlFormLabel } from '../../components/control-form-label';
9
+ import ControlActions from '../../control-actions/control-actions';
10
+ import { createControl } from '../../create-control';
9
11
  import { CHIP_TRIGGER_KEYS, isValidEmail } from './utils';
10
12
 
11
- // type EmailChip = { label: string; value: string };
12
-
13
- type EmailChipsFieldProps = {
14
- fieldLabel: string;
13
+ type EmailChipsControlProps = {
15
14
  placeholder?: string;
16
15
  };
17
16
 
18
- export const EmailChipsField = ( { fieldLabel, placeholder }: EmailChipsFieldProps ) => {
17
+ export const EmailChipsControl = createControl( ( { placeholder }: EmailChipsControlProps ) => {
19
18
  const { value, setValue, disabled } = useBoundProp( stringArrayPropTypeUtil );
20
19
  const [ inputValue, setInputValue ] = useState( '' );
21
20
 
@@ -68,37 +67,48 @@ export const EmailChipsField = ( { fieldLabel, placeholder }: EmailChipsFieldPro
68
67
  };
69
68
 
70
69
  return (
71
- <Grid container direction="column" gap={ 0.5 }>
72
- <Grid item>
73
- <ControlFormLabel>{ fieldLabel }</ControlFormLabel>
74
- </Grid>
75
- <Grid item>
76
- <Autocomplete
77
- fullWidth
78
- multiple
79
- freeSolo
80
- size="tiny"
81
- disabled={ disabled }
82
- inputValue={ inputValue }
83
- onInputChange={ ( _, val, reason ) => {
84
- if ( reason !== 'reset' ) {
85
- setInputValue( val );
86
- }
87
- } }
88
- value={ selectedValues }
89
- onChange={ handleChange }
90
- options={ [] }
91
- onBlur={ handleBlur }
92
- getOptionLabel={ ( option ) => option }
93
- isOptionEqualToValue={ ( option, val ) => option === val }
94
- renderInput={ ( params ) => (
95
- <TextField { ...params } placeholder={ placeholder } onKeyDown={ handleKeyDown } />
96
- ) }
97
- renderTags={ ( tagValues, getTagProps ) => (
98
- <ChipsList getLabel={ ( option ) => option } getTagProps={ getTagProps } values={ tagValues } />
99
- ) }
100
- />
101
- </Grid>
102
- </Grid>
70
+ <ControlActions>
71
+ <Autocomplete
72
+ fullWidth
73
+ multiple
74
+ freeSolo
75
+ size="tiny"
76
+ disabled={ disabled }
77
+ inputValue={ inputValue }
78
+ onInputChange={ ( _, val, reason ) => {
79
+ if ( reason !== 'reset' ) {
80
+ setInputValue( val );
81
+ }
82
+ } }
83
+ value={ selectedValues }
84
+ onChange={ handleChange }
85
+ options={ [] }
86
+ onBlur={ handleBlur }
87
+ getOptionLabel={ ( option ) => option }
88
+ isOptionEqualToValue={ ( option, val ) => option === val }
89
+ renderInput={ ( params ) => (
90
+ <TextField { ...params } placeholder={ placeholder } onKeyDown={ handleKeyDown } />
91
+ ) }
92
+ renderTags={ ( tagValues, getTagProps ) => (
93
+ <ChipsList getLabel={ ( option ) => option } getTagProps={ getTagProps } values={ tagValues } />
94
+ ) }
95
+ />
96
+ </ControlActions>
103
97
  );
98
+ } );
99
+
100
+ type EmailChipsFieldProps = {
101
+ fieldLabel: string;
102
+ placeholder?: string;
104
103
  };
104
+
105
+ export const EmailChipsField = ( { fieldLabel, placeholder }: EmailChipsFieldProps ) => (
106
+ <Grid container direction="column" gap={ 0.5 }>
107
+ <Grid item>
108
+ <ControlFormLabel>{ fieldLabel }</ControlFormLabel>
109
+ </Grid>
110
+ <Grid item>
111
+ <EmailChipsControl placeholder={ placeholder } />
112
+ </Grid>
113
+ </Grid>
114
+ );
@@ -14,7 +14,9 @@ import { EmailField } from './email-field';
14
14
  import { shouldShowMentionsInfo } from './utils';
15
15
 
16
16
  export const SendToField = ( { placeholder }: { placeholder?: string } ) => (
17
- <EmailChipsField fieldLabel={ __( 'Send to', 'elementor' ) } placeholder={ placeholder } />
17
+ <PropKeyProvider bind="to">
18
+ <EmailChipsField fieldLabel={ __( 'Send to', 'elementor' ) } placeholder={ placeholder } />
19
+ </PropKeyProvider>
18
20
  );
19
21
 
20
22
  export const SubjectField = () => (
@@ -4,7 +4,7 @@ import { CollapsibleContent } from '@elementor/editor-ui';
4
4
  import { Box, Divider, Stack } from '@elementor/ui';
5
5
  import { __ } from '@wordpress/i18n';
6
6
 
7
- import { PropKeyProvider, PropProvider, useBoundProp } from '../../bound-prop-context';
7
+ import { PropProvider, useBoundProp } from '../../bound-prop-context';
8
8
  import { ControlLabel } from '../../components/control-label';
9
9
  import { createControl } from '../../create-control';
10
10
  import {
@@ -30,9 +30,7 @@ export const EmailFormActionControl = createControl(
30
30
  <ControlLabel>
31
31
  { label ? label + ' ' + __( 'settings', 'elementor' ) : __( 'Email settings', 'elementor' ) }
32
32
  </ControlLabel>
33
- <PropKeyProvider bind="to">
34
- <SendToField placeholder={ toPlaceholder } />
35
- </PropKeyProvider>
33
+ <SendToField placeholder={ toPlaceholder } />
36
34
  <SubjectField />
37
35
  <MessageField />
38
36
  <FromEmailField />
@@ -17,7 +17,6 @@ type PromotionEventOptions = {
17
17
  type MixpanelConfig = ReturnType< typeof getMixpanel >[ 'config' ];
18
18
 
19
19
  const getBaseEventProperties = ( data: PromotionTrackingData, config: MixpanelConfig ) => ( {
20
- app_type: config?.appTypes?.editor ?? 'editor',
21
20
  window_name: config?.appTypes?.editor ?? 'editor',
22
21
  interaction_type: config?.triggers?.click ?? 'Click',
23
22
  target_name: data.target_name,