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

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-759",
4
+ "version": "4.1.0-760",
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-759",
44
- "@elementor/editor-elements": "4.1.0-759",
45
- "@elementor/editor-props": "4.1.0-759",
46
- "@elementor/editor-responsive": "4.1.0-759",
47
- "@elementor/editor-ui": "4.1.0-759",
48
- "@elementor/editor-v1-adapters": "4.1.0-759",
49
- "@elementor/env": "4.1.0-759",
50
- "@elementor/http-client": "4.1.0-759",
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",
51
51
  "@elementor/icons": "^1.68.0",
52
- "@elementor/locations": "4.1.0-759",
53
- "@elementor/events": "4.1.0-759",
54
- "@elementor/query": "4.1.0-759",
55
- "@elementor/session": "4.1.0-759",
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",
56
56
  "@elementor/ui": "1.36.17",
57
- "@elementor/utils": "4.1.0-759",
58
- "@elementor/wp-media": "4.1.0-759",
57
+ "@elementor/utils": "4.1.0-760",
58
+ "@elementor/wp-media": "4.1.0-760",
59
59
  "@wordpress/i18n": "^5.13.0",
60
60
  "@monaco-editor/react": "^4.7.0",
61
61
  "dayjs": "^1.11.18",
@@ -6,6 +6,7 @@ import {
6
6
  bindPopover,
7
7
  bindTrigger,
8
8
  Box,
9
+ ClickAwayListener,
9
10
  IconButton,
10
11
  Infotip,
11
12
  Tooltip,
@@ -340,10 +341,14 @@ const RepeaterItem = < T, >( {
340
341
  actions,
341
342
  value,
342
343
  }: RepeaterItemProps< T > ) => {
343
- const { popoverState, popoverProps, ref, setRef } = usePopover( openOnMount, () => {
344
- onOpen();
345
- onPopoverOpen?.( value );
346
- } );
344
+ const { popoverState, popoverProps, ref, setRef } = usePopover(
345
+ openOnMount,
346
+ () => {
347
+ onOpen();
348
+ onPopoverOpen?.( value );
349
+ },
350
+ onPopoverClose
351
+ );
347
352
  const triggerProps = bindTrigger( popoverState );
348
353
 
349
354
  const duplicateLabel = __( 'Duplicate', 'elementor' );
@@ -392,22 +397,20 @@ const RepeaterItem = < T, >( {
392
397
  </>
393
398
  }
394
399
  />
395
- <RepeaterPopover
396
- width={ ref?.getBoundingClientRect().width }
397
- { ...popoverProps }
398
- onClose={ () => {
399
- popoverProps.onClose?.();
400
- onPopoverClose?.();
401
- } }
402
- anchorEl={ ref }
403
- >
404
- <Box>{ children( { anchorEl: ref } ) }</Box>
400
+ <RepeaterPopover width={ ref?.getBoundingClientRect().width } { ...popoverProps } anchorEl={ ref }>
401
+ <ClickAwayListener
402
+ mouseEvent="onMouseDown"
403
+ touchEvent="onTouchStart"
404
+ onClickAway={ popoverProps.onClose }
405
+ >
406
+ <Box>{ children( { anchorEl: ref } ) }</Box>
407
+ </ClickAwayListener>
405
408
  </RepeaterPopover>
406
409
  </>
407
410
  );
408
411
  };
409
412
 
410
- const usePopover = ( openOnMount: boolean, onOpen: () => void ) => {
413
+ const usePopover = ( openOnMount: boolean, onOpen: () => void, onPopoverClose?: () => void ) => {
411
414
  const [ ref, setRef ] = useState< HTMLElement | null >( null );
412
415
 
413
416
  const popoverState = usePopupState( { variant: 'popover' } );
@@ -422,10 +425,15 @@ const usePopover = ( openOnMount: boolean, onOpen: () => void ) => {
422
425
  // eslint-disable-next-line react-hooks/exhaustive-deps
423
426
  }, [ ref ] );
424
427
 
428
+ const onClose = () => {
429
+ popoverProps.onClose?.();
430
+ onPopoverClose?.();
431
+ };
432
+
425
433
  return {
426
434
  popoverState,
427
435
  ref,
428
436
  setRef,
429
- popoverProps,
437
+ popoverProps: { ...popoverProps, onClose },
430
438
  };
431
439
  };