@elementor/editor-controls 4.0.0-520 → 4.0.0-522

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.0.0-520",
4
+ "version": "4.0.0-522",
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.0.0-520",
44
- "@elementor/editor-elements": "4.0.0-520",
45
- "@elementor/editor-props": "4.0.0-520",
46
- "@elementor/editor-responsive": "4.0.0-520",
47
- "@elementor/editor-ui": "4.0.0-520",
48
- "@elementor/editor-v1-adapters": "4.0.0-520",
49
- "@elementor/env": "4.0.0-520",
50
- "@elementor/http-client": "4.0.0-520",
43
+ "@elementor/editor-current-user": "4.0.0-522",
44
+ "@elementor/editor-elements": "4.0.0-522",
45
+ "@elementor/editor-props": "4.0.0-522",
46
+ "@elementor/editor-responsive": "4.0.0-522",
47
+ "@elementor/editor-ui": "4.0.0-522",
48
+ "@elementor/editor-v1-adapters": "4.0.0-522",
49
+ "@elementor/env": "4.0.0-522",
50
+ "@elementor/http-client": "4.0.0-522",
51
51
  "@elementor/icons": "^1.63.0",
52
- "@elementor/locations": "4.0.0-520",
53
- "@elementor/mixpanel": "4.0.0-520",
54
- "@elementor/query": "4.0.0-520",
55
- "@elementor/session": "4.0.0-520",
52
+ "@elementor/locations": "4.0.0-522",
53
+ "@elementor/mixpanel": "4.0.0-522",
54
+ "@elementor/query": "4.0.0-522",
55
+ "@elementor/session": "4.0.0-522",
56
56
  "@elementor/ui": "1.36.17",
57
- "@elementor/utils": "4.0.0-520",
58
- "@elementor/wp-media": "4.0.0-520",
57
+ "@elementor/utils": "4.0.0-522",
58
+ "@elementor/wp-media": "4.0.0-522",
59
59
  "@wordpress/i18n": "^5.13.0",
60
60
  "@monaco-editor/react": "^4.7.0",
61
61
  "dayjs": "^1.11.18",
@@ -0,0 +1,61 @@
1
+ import * as React from 'react';
2
+ import { useState } from 'react';
3
+ import { PromotionChip, PromotionInfotip } from '@elementor/editor-ui';
4
+ import { SitemapIcon } from '@elementor/icons';
5
+ import { Box, IconButton, Stack, Tooltip } from '@elementor/ui';
6
+ import { __ } from '@wordpress/i18n';
7
+
8
+ import { createControl } from '../../create-control';
9
+
10
+ const ARIA_LABEL = __( 'Display Conditions', 'elementor' );
11
+
12
+ function getDisplayConditionPromotion() {
13
+ return window.elementor?.config?.v4Promotions?.displayConditions;
14
+ }
15
+
16
+ export const DisplayConditionsControl = createControl( () => {
17
+ const [ isInfotipOpen, setIsInfotipOpen ] = useState( false );
18
+ const promotion = getDisplayConditionPromotion();
19
+
20
+ return (
21
+ <Stack
22
+ direction="row"
23
+ spacing={ 2 }
24
+ sx={ {
25
+ justifyContent: 'flex-end',
26
+ alignItems: 'center',
27
+ } }
28
+ >
29
+ <PromotionInfotip
30
+ title={ promotion?.title ?? '' }
31
+ content={ promotion?.content ?? '' }
32
+ assetUrl={ promotion?.image ?? '' }
33
+ ctaUrl={ promotion?.ctaUrl ?? '' }
34
+ open={ isInfotipOpen }
35
+ onClose={ () => setIsInfotipOpen( false ) }
36
+ >
37
+ <Box
38
+ onClick={ () => setIsInfotipOpen( ( prev ) => ! prev ) }
39
+ sx={ { cursor: 'pointer', display: 'inline-flex' } }
40
+ >
41
+ <PromotionChip />
42
+ </Box>
43
+ </PromotionInfotip>
44
+ <Tooltip title={ ARIA_LABEL } placement="top">
45
+ <IconButton
46
+ size="tiny"
47
+ aria-label={ ARIA_LABEL }
48
+ data-behavior="display-conditions"
49
+ onClick={ () => setIsInfotipOpen( ( prev ) => ! prev ) }
50
+ sx={ {
51
+ border: '1px solid',
52
+ borderColor: 'divider',
53
+ borderRadius: 1,
54
+ } }
55
+ >
56
+ <SitemapIcon fontSize="tiny" color="disabled" />
57
+ </IconButton>
58
+ </Tooltip>
59
+ </Stack>
60
+ );
61
+ } );
package/src/index.ts CHANGED
@@ -35,6 +35,7 @@ export { enqueueFont } from './controls/font-family-control/enqueue-font';
35
35
  export { transitionProperties, transitionsItemsList } from './controls/transition-control/data';
36
36
  export { DateTimeControl } from './controls/date-time-control';
37
37
  export { InlineEditingControl } from './controls/inline-editing-control';
38
+ export { DisplayConditionsControl } from './components/promotions/display-conditions-control';
38
39
 
39
40
  // components
40
41
  export { ControlFormLabel } from './components/control-form-label';