@elementor/editor-controls 3.33.0-296 → 3.33.0-297

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": "3.33.0-296",
4
+ "version": "3.33.0-297",
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": "3.33.0-296",
44
- "@elementor/editor-elements": "3.33.0-296",
45
- "@elementor/editor-props": "3.33.0-296",
46
- "@elementor/editor-responsive": "3.33.0-296",
47
- "@elementor/editor-ui": "3.33.0-296",
48
- "@elementor/editor-v1-adapters": "3.33.0-296",
49
- "@elementor/env": "3.33.0-296",
50
- "@elementor/http-client": "3.33.0-296",
43
+ "@elementor/editor-current-user": "3.33.0-297",
44
+ "@elementor/editor-elements": "3.33.0-297",
45
+ "@elementor/editor-props": "3.33.0-297",
46
+ "@elementor/editor-responsive": "3.33.0-297",
47
+ "@elementor/editor-ui": "3.33.0-297",
48
+ "@elementor/editor-v1-adapters": "3.33.0-297",
49
+ "@elementor/env": "3.33.0-297",
50
+ "@elementor/http-client": "3.33.0-297",
51
51
  "@elementor/icons": "^1.61.0",
52
- "@elementor/locations": "3.33.0-296",
53
- "@elementor/mixpanel": "3.33.0-296",
54
- "@elementor/query": "3.33.0-296",
55
- "@elementor/session": "3.33.0-296",
52
+ "@elementor/locations": "3.33.0-297",
53
+ "@elementor/mixpanel": "3.33.0-297",
54
+ "@elementor/query": "3.33.0-297",
55
+ "@elementor/session": "3.33.0-297",
56
56
  "@elementor/ui": "1.36.17",
57
- "@elementor/utils": "3.33.0-296",
58
- "@elementor/wp-media": "3.33.0-296",
57
+ "@elementor/utils": "3.33.0-297",
58
+ "@elementor/wp-media": "3.33.0-297",
59
59
  "@wordpress/i18n": "^5.13.0",
60
60
  "@monaco-editor/react": "^4.7.0",
61
61
  "dayjs": "^1.11.18",
@@ -7,6 +7,7 @@ import {
7
7
  bindTrigger,
8
8
  Box,
9
9
  IconButton,
10
+ Infotip,
10
11
  Tooltip,
11
12
  type UnstableTagProps,
12
13
  usePopupState,
@@ -92,6 +93,7 @@ type RepeaterProps< T > =
92
93
  setValues: ( newValue: T[], _: CreateOptions, meta?: SetRepeaterValuesMeta< T > ) => void;
93
94
  disabled?: boolean;
94
95
  disableAddItemButton?: boolean;
96
+ addButtonInfotipContent?: React.ReactNode;
95
97
  showDuplicate?: boolean;
96
98
  showToggle?: boolean;
97
99
  showRemove?: boolean;
@@ -106,6 +108,7 @@ type RepeaterProps< T > =
106
108
  setValues: ( newValue: T[], _: CreateOptions, meta?: SetRepeaterValuesMeta< T > ) => void;
107
109
  disabled?: boolean;
108
110
  disableAddItemButton?: boolean;
111
+ addButtonInfotipContent?: React.ReactNode;
109
112
  showDuplicate?: boolean;
110
113
  showToggle?: boolean;
111
114
  showRemove?: boolean;
@@ -127,6 +130,7 @@ export const Repeater = < T, >( {
127
130
  showToggle = true,
128
131
  showRemove = true,
129
132
  disableAddItemButton = false,
133
+ addButtonInfotipContent,
130
134
  openItem: initialOpenItem = EMPTY_OPEN_ITEM,
131
135
  isSortable = true,
132
136
  }: RepeaterProps< RepeaterItem< T > > ) => {
@@ -206,18 +210,38 @@ export const Repeater = < T, >( {
206
210
  );
207
211
  };
208
212
 
213
+ const isButtonDisabled = disabled || disableAddItemButton;
214
+ const shouldShowInfotip = isButtonDisabled && addButtonInfotipContent;
215
+
216
+ const addButton = (
217
+ <IconButton
218
+ size={ SIZE }
219
+ sx={ {
220
+ ml: 'auto',
221
+ } }
222
+ disabled={ isButtonDisabled }
223
+ onClick={ addRepeaterItem }
224
+ aria-label={ __( 'Add item', 'elementor' ) }
225
+ >
226
+ <PlusIcon fontSize={ SIZE } />
227
+ </IconButton>
228
+ );
229
+
209
230
  return (
210
231
  <SectionContent gap={ 2 }>
211
232
  <RepeaterHeader label={ label } adornment={ ControlAdornments }>
212
- <IconButton
213
- size={ SIZE }
214
- sx={ { ml: 'auto' } }
215
- disabled={ disabled || disableAddItemButton }
216
- onClick={ addRepeaterItem }
217
- aria-label={ __( 'Add item', 'elementor' ) }
218
- >
219
- <PlusIcon fontSize={ SIZE } />
220
- </IconButton>
233
+ { shouldShowInfotip ? (
234
+ <Infotip
235
+ placement="right"
236
+ content={ addButtonInfotipContent }
237
+ color="secondary"
238
+ slotProps={ { popper: { sx: { width: 300 } } } }
239
+ >
240
+ <Box sx={ { ...( isButtonDisabled ? { cursor: 'not-allowed' } : {} ) } }>{ addButton }</Box>
241
+ </Infotip>
242
+ ) : (
243
+ addButton
244
+ ) }
221
245
  </RepeaterHeader>
222
246
  { 0 < uniqueKeys.length && (
223
247
  <SortableProvider value={ uniqueKeys } onChange={ onChangeOrder }>