@elementor/editor-components 3.35.0-377 → 3.35.0-379

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-components",
3
3
  "description": "Elementor editor components",
4
- "version": "3.35.0-377",
4
+ "version": "3.35.0-379",
5
5
  "private": false,
6
6
  "author": "Elementor Team",
7
7
  "homepage": "https://elementor.com/",
@@ -40,29 +40,30 @@
40
40
  "dev": "tsup --config=../../tsup.dev.ts"
41
41
  },
42
42
  "dependencies": {
43
- "@elementor/editor": "3.35.0-377",
44
- "@elementor/editor-canvas": "3.35.0-377",
45
- "@elementor/editor-controls": "3.35.0-377",
46
- "@elementor/editor-documents": "3.35.0-377",
47
- "@elementor/editor-editing-panel": "3.35.0-377",
48
- "@elementor/editor-elements": "3.35.0-377",
49
- "@elementor/editor-elements-panel": "3.35.0-377",
50
- "@elementor/editor-mcp": "3.35.0-377",
51
- "@elementor/editor-panels": "3.35.0-377",
52
- "@elementor/editor-props": "3.35.0-377",
53
- "@elementor/editor-styles-repository": "3.35.0-377",
54
- "@elementor/editor-ui": "3.35.0-377",
55
- "@elementor/editor-v1-adapters": "3.35.0-377",
56
- "@elementor/http-client": "3.35.0-377",
43
+ "@elementor/editor": "3.35.0-379",
44
+ "@elementor/editor-canvas": "3.35.0-379",
45
+ "@elementor/editor-controls": "3.35.0-379",
46
+ "@elementor/editor-documents": "3.35.0-379",
47
+ "@elementor/editor-editing-panel": "3.35.0-379",
48
+ "@elementor/editor-elements": "3.35.0-379",
49
+ "@elementor/editor-elements-panel": "3.35.0-379",
50
+ "@elementor/editor-mcp": "3.35.0-379",
51
+ "@elementor/editor-panels": "3.35.0-379",
52
+ "@elementor/editor-props": "3.35.0-379",
53
+ "@elementor/editor-styles-repository": "3.35.0-379",
54
+ "@elementor/editor-ui": "3.35.0-379",
55
+ "@elementor/editor-v1-adapters": "3.35.0-379",
56
+ "@elementor/http-client": "3.35.0-379",
57
57
  "@elementor/icons": "^1.63.0",
58
- "@elementor/mixpanel": "3.35.0-377",
59
- "@elementor/query": "3.35.0-377",
60
- "@elementor/schema": "3.35.0-377",
61
- "@elementor/store": "3.35.0-377",
58
+ "@elementor/mixpanel": "3.35.0-379",
59
+ "@elementor/query": "3.35.0-379",
60
+ "@elementor/schema": "3.35.0-379",
61
+ "@elementor/store": "3.35.0-379",
62
62
  "@elementor/ui": "1.36.17",
63
- "@elementor/utils": "3.35.0-377",
63
+ "@elementor/utils": "3.35.0-379",
64
64
  "@wordpress/i18n": "^5.13.0",
65
- "@elementor/editor-notifications": "3.35.0-377"
65
+ "@elementor/editor-notifications": "3.35.0-379",
66
+ "@elementor/editor-current-user": "3.35.0-379"
66
67
  },
67
68
  "peerDependencies": {
68
69
  "react": "^18.3.1",
@@ -4,30 +4,33 @@ import { ComponentPropListIcon } from '@elementor/icons';
4
4
  import { Badge, Box, keyframes, styled, ToggleButton } from '@elementor/ui';
5
5
  import { __ } from '@wordpress/i18n';
6
6
 
7
- export const ComponentsBadge = ( { overridesCount }: { overridesCount: number } ) => {
8
- const prevCount = usePrevious( overridesCount );
7
+ export const ComponentsBadge = React.forwardRef< HTMLDivElement, { overridesCount: number } >(
8
+ ( { overridesCount }, ref ) => {
9
+ const prevCount = usePrevious( overridesCount );
9
10
 
10
- const isFirstOverride = prevCount === 0 && overridesCount === 1;
11
+ const isFirstOverride = prevCount === 0 && overridesCount === 1;
11
12
 
12
- return (
13
- <StyledBadge
14
- color="primary"
15
- key={ overridesCount }
16
- invisible={ overridesCount === 0 }
17
- animate={ isFirstOverride }
18
- anchorOrigin={ { vertical: 'top', horizontal: 'right' } }
19
- badgeContent={
20
- <Box sx={ { animation: ! isFirstOverride ? `${ slideUp } 300ms ease-out` : 'none' } }>
21
- { overridesCount }
22
- </Box>
23
- }
24
- >
25
- <ToggleButton value="overrides" size="tiny" aria-label={ __( 'View overrides', 'elementor' ) }>
26
- <ComponentPropListIcon fontSize="tiny" />
27
- </ToggleButton>
28
- </StyledBadge>
29
- );
30
- };
13
+ return (
14
+ <StyledBadge
15
+ ref={ ref }
16
+ color="primary"
17
+ key={ overridesCount }
18
+ invisible={ overridesCount === 0 }
19
+ animate={ isFirstOverride }
20
+ anchorOrigin={ { vertical: 'top', horizontal: 'right' } }
21
+ badgeContent={
22
+ <Box sx={ { animation: ! isFirstOverride ? `${ slideUp } 300ms ease-out` : 'none' } }>
23
+ { overridesCount }
24
+ </Box>
25
+ }
26
+ >
27
+ <ToggleButton value="overrides" size="tiny" aria-label={ __( 'View overrides', 'elementor' ) }>
28
+ <ComponentPropListIcon fontSize="tiny" />
29
+ </ToggleButton>
30
+ </StyledBadge>
31
+ );
32
+ }
33
+ );
31
34
 
32
35
  const StyledBadge = styled( Badge, { shouldForwardProp: ( prop ) => prop !== 'animate' } )(
33
36
  ( { theme, animate } ) => ( {
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import { useSuppressedMessage } from '@elementor/editor-current-user';
2
3
  import { getV1DocumentsManager } from '@elementor/editor-documents';
3
4
  import { ArrowLeftIcon, ComponentsFilledIcon } from '@elementor/icons';
4
5
  import { Box, Divider, IconButton, Stack, Tooltip, Typography } from '@elementor/ui';
@@ -6,21 +7,31 @@ import { __ } from '@wordpress/i18n';
6
7
 
7
8
  import { useNavigateBack } from '../../hooks/use-navigate-back';
8
9
  import { useCurrentComponentId } from '../../store/store';
10
+ import { ComponentIntroduction } from '../components-tab/component-introduction';
9
11
  import { ComponentsBadge } from './component-badge';
10
12
  import { useOverridableProps } from './use-overridable-props';
11
13
 
14
+ const MESSAGE_KEY = 'components-properties-introduction';
15
+
12
16
  export const ComponentPanelHeader = () => {
13
17
  const currentComponentId = useCurrentComponentId();
14
18
  const overridableProps = useOverridableProps( currentComponentId );
15
19
  const onBack = useNavigateBack();
16
20
  const componentName = getComponentName();
17
-
21
+ const [ isMessageSuppressed, suppressMessage ] = useSuppressedMessage( MESSAGE_KEY );
22
+ const [ shouldShowIntroduction, setShouldShowIntroduction ] = React.useState( ! isMessageSuppressed );
18
23
  const overridesCount = overridableProps ? Object.keys( overridableProps.props ).length : 0;
24
+ const anchorRef = React.useRef< HTMLDivElement >( null );
19
25
 
20
26
  if ( ! currentComponentId ) {
21
27
  return null;
22
28
  }
23
29
 
30
+ const handleCloseIntroduction = () => {
31
+ suppressMessage();
32
+ setShouldShowIntroduction( false );
33
+ };
34
+
24
35
  return (
25
36
  <Box>
26
37
  <Stack
@@ -42,9 +53,14 @@ export const ComponentPanelHeader = () => {
42
53
  </Typography>
43
54
  </Stack>
44
55
  </Stack>
45
- <ComponentsBadge overridesCount={ overridesCount } />
56
+ <ComponentsBadge overridesCount={ overridesCount } ref={ anchorRef } />
46
57
  </Stack>
47
58
  <Divider />
59
+ <ComponentIntroduction
60
+ anchorRef={ anchorRef }
61
+ shouldShowIntroduction={ shouldShowIntroduction }
62
+ onClose={ handleCloseIntroduction }
63
+ />
48
64
  </Box>
49
65
  );
50
66
  };
@@ -0,0 +1,68 @@
1
+ import * as React from 'react';
2
+ import { PopoverContent } from '@elementor/editor-controls';
3
+ import { PopoverHeader } from '@elementor/editor-ui';
4
+ import { Box, Button, Image, Popover, Stack, Typography } from '@elementor/ui';
5
+ import { __ } from '@wordpress/i18n';
6
+
7
+ export const ComponentIntroduction = ( {
8
+ anchorRef,
9
+ shouldShowIntroduction,
10
+ onClose,
11
+ }: {
12
+ anchorRef: React.RefObject< HTMLDivElement >;
13
+ shouldShowIntroduction: boolean;
14
+ onClose: () => void;
15
+ } ) => {
16
+ if ( ! anchorRef.current || ! shouldShowIntroduction ) {
17
+ return null;
18
+ }
19
+
20
+ return (
21
+ <Popover
22
+ anchorEl={ anchorRef.current }
23
+ open={ shouldShowIntroduction }
24
+ anchorOrigin={ {
25
+ vertical: 'top',
26
+ horizontal: 'right',
27
+ } }
28
+ transformOrigin={ {
29
+ vertical: 'top',
30
+ horizontal: -30,
31
+ } }
32
+ onClose={ onClose }
33
+ >
34
+ <Box sx={ { width: '296px' } }>
35
+ <PopoverHeader title={ __( 'Add your first property', 'elementor' ) } onClose={ onClose } />
36
+ <Image
37
+ sx={ { width: '296px', height: '160px' } }
38
+ src={ 'https://assets.elementor.com/packages/v1/images/components-properties-intro.png' }
39
+ alt={ '' }
40
+ />
41
+ <PopoverContent>
42
+ <Stack gap={ 1 } sx={ { p: 2 } }>
43
+ <Typography variant={ 'body2' }>
44
+ { __( 'Properties make instances flexible.', 'elementor' ) }
45
+ </Typography>
46
+ <Typography variant={ 'body2' }>
47
+ { __(
48
+ 'Click next to any setting you want users to customize - like text, images, or links.',
49
+ 'elementor'
50
+ ) }
51
+ </Typography>
52
+ <Typography variant={ 'body2' }>
53
+ { __(
54
+ 'Your properties will appear in the Properties panel, where you can organize and manage them anytime.',
55
+ 'elementor'
56
+ ) }
57
+ </Typography>
58
+ <Stack direction="row" alignItems="center" justifyContent="flex-end">
59
+ <Button size="medium" variant="contained" onClick={ onClose }>
60
+ { __( 'Got it', 'elementor' ) }
61
+ </Button>
62
+ </Stack>
63
+ </Stack>
64
+ </PopoverContent>
65
+ </Box>
66
+ </Popover>
67
+ );
68
+ };