@elementor/editor-editing-panel 3.35.0-374 → 3.35.0-376

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@elementor/editor-editing-panel",
3
- "version": "3.35.0-374",
3
+ "version": "3.35.0-376",
4
4
  "private": false,
5
5
  "author": "Elementor Team",
6
6
  "homepage": "https://elementor.com/",
@@ -39,27 +39,27 @@
39
39
  "dev": "tsup --config=../../tsup.dev.ts"
40
40
  },
41
41
  "dependencies": {
42
- "@elementor/editor": "3.35.0-374",
43
- "@elementor/editor-canvas": "3.35.0-374",
44
- "@elementor/editor-controls": "3.35.0-374",
45
- "@elementor/editor-documents": "3.35.0-374",
46
- "@elementor/editor-elements": "3.35.0-374",
47
- "@elementor/editor-interactions": "3.35.0-374",
48
- "@elementor/editor-panels": "3.35.0-374",
49
- "@elementor/editor-props": "3.35.0-374",
50
- "@elementor/editor-responsive": "3.35.0-374",
51
- "@elementor/editor-styles": "3.35.0-374",
52
- "@elementor/editor-styles-repository": "3.35.0-374",
53
- "@elementor/editor-ui": "3.35.0-374",
54
- "@elementor/editor-v1-adapters": "3.35.0-374",
42
+ "@elementor/editor": "3.35.0-376",
43
+ "@elementor/editor-canvas": "3.35.0-376",
44
+ "@elementor/editor-controls": "3.35.0-376",
45
+ "@elementor/editor-documents": "3.35.0-376",
46
+ "@elementor/editor-elements": "3.35.0-376",
47
+ "@elementor/editor-interactions": "3.35.0-376",
48
+ "@elementor/editor-panels": "3.35.0-376",
49
+ "@elementor/editor-props": "3.35.0-376",
50
+ "@elementor/editor-responsive": "3.35.0-376",
51
+ "@elementor/editor-styles": "3.35.0-376",
52
+ "@elementor/editor-styles-repository": "3.35.0-376",
53
+ "@elementor/editor-ui": "3.35.0-376",
54
+ "@elementor/editor-v1-adapters": "3.35.0-376",
55
55
  "@elementor/icons": "^1.63.0",
56
- "@elementor/locations": "3.35.0-374",
57
- "@elementor/menus": "3.35.0-374",
58
- "@elementor/schema": "3.35.0-374",
59
- "@elementor/session": "3.35.0-374",
56
+ "@elementor/locations": "3.35.0-376",
57
+ "@elementor/menus": "3.35.0-376",
58
+ "@elementor/schema": "3.35.0-376",
59
+ "@elementor/session": "3.35.0-376",
60
60
  "@elementor/ui": "1.36.17",
61
- "@elementor/utils": "3.35.0-374",
62
- "@elementor/wp-media": "3.35.0-374",
61
+ "@elementor/utils": "3.35.0-376",
62
+ "@elementor/wp-media": "3.35.0-376",
63
63
  "@wordpress/i18n": "^5.13.0"
64
64
  },
65
65
  "peerDependencies": {
@@ -0,0 +1,48 @@
1
+ import * as React from 'react';
2
+ import { useState } from 'react';
3
+ import { PromotionInfotip } from '@elementor/editor-ui';
4
+ import { CrownFilledIcon } from '@elementor/icons';
5
+ import { Chip } from '@elementor/ui';
6
+ import { __ } from '@wordpress/i18n';
7
+
8
+ import { StyleTabSection } from '../style-tab-section';
9
+
10
+ export const CustomCssSection = () => {
11
+ const [ showInfoTip, sethSowInfoTip ] = useState( false );
12
+
13
+ return (
14
+ <StyleTabSection
15
+ section={ {
16
+ name: 'Custom CSS',
17
+ title: __( 'Custom CSS', 'elementor' ),
18
+ action: (
19
+ <PromotionInfotip
20
+ title={ __( 'Custom CSS', 'elementor' ) }
21
+ content={ __(
22
+ 'Add custom CSS to refine and enrich the appearance of any element on your site.',
23
+ 'elementor'
24
+ ) }
25
+ assetUrl="https://assets.elementor.com/packages/v1/images/custom-css-promotion.png"
26
+ ctaUrl="https://go.elementor.com/go-pro-style-custom-css/"
27
+ open={ showInfoTip }
28
+ setOpen={ sethSowInfoTip }
29
+ >
30
+ <Chip
31
+ size="tiny"
32
+ color="promotion"
33
+ variant="standard"
34
+ icon={ <CrownFilledIcon /> }
35
+ sx={ {
36
+ mr: 1,
37
+ '& .MuiChip-label': {
38
+ display: 'none',
39
+ },
40
+ } }
41
+ onClick={ () => sethSowInfoTip( true ) }
42
+ />
43
+ </PromotionInfotip>
44
+ ),
45
+ } }
46
+ />
47
+ );
48
+ };
@@ -0,0 +1,13 @@
1
+ import { injectIntoStyleTab } from '../style-tab';
2
+ import { CustomCssSection } from './custom-css';
3
+
4
+ export const init = () => {
5
+ //Todo: Remove when v3.37 will released
6
+ if ( ! window.elementorPro ) {
7
+ injectIntoStyleTab( {
8
+ id: 'custom-css',
9
+ component: CustomCssSection,
10
+ options: { overwrite: true },
11
+ } );
12
+ }
13
+ };
@@ -12,14 +12,18 @@ type Props = PropsWithChildren< {
12
12
  defaultExpanded?: boolean;
13
13
  titleEnd?: CollapsibleValue< ReactNode | string >;
14
14
  unmountOnExit?: boolean;
15
+ action?: ReactNode;
15
16
  } >;
16
17
 
17
- export function Section( { title, children, defaultExpanded = false, titleEnd, unmountOnExit = true }: Props ) {
18
+ export function Section( { title, children, defaultExpanded = false, titleEnd, unmountOnExit = true, action }: Props ) {
18
19
  const [ isOpen, setIsOpen ] = useStateByElement( title, !! defaultExpanded );
19
20
  const ref = useRef< HTMLElement >( null );
21
+ const isDisabled = !! action;
20
22
 
21
23
  const handleClick = () => {
22
- setIsOpen( ! isOpen );
24
+ if ( ! isDisabled ) {
25
+ setIsOpen( ! isOpen );
26
+ }
23
27
  };
24
28
 
25
29
  const id = useId();
@@ -43,7 +47,8 @@ export function Section( { title, children, defaultExpanded = false, titleEnd, u
43
47
  />
44
48
  { getCollapsibleValue( titleEnd, isOpen ) }
45
49
  </Stack>
46
- <CollapseIcon open={ isOpen } color="secondary" fontSize="tiny" />
50
+ { action }
51
+ <CollapseIcon open={ isOpen } color="secondary" fontSize="tiny" disabled={ isDisabled } />
47
52
  </ListItemButton>
48
53
  <Collapse
49
54
  id={ contentId }
@@ -5,17 +5,18 @@ import { Section } from './section';
5
5
  import { getStylesInheritanceIndicators } from './style-tab-collapsible-content';
6
6
 
7
7
  type SectionType = {
8
- component: () => React.JSX.Element;
8
+ component?: () => React.JSX.Element;
9
9
  name: string;
10
10
  title: string;
11
+ action?: React.ReactNode;
11
12
  };
12
13
 
13
14
  type Props = { section: SectionType; fields?: string[]; unmountOnExit?: boolean };
14
15
 
15
16
  export const StyleTabSection = ( { section, fields = [], unmountOnExit = true }: Props ) => {
16
- const { component, name, title } = section;
17
+ const { component, name, title, action } = section;
17
18
  const tabDefaults = useDefaultPanelSettings();
18
- const SectionComponent = component;
19
+ const SectionComponent = component || ( () => <></> );
19
20
  const isExpanded = tabDefaults.defaultSectionsExpanded.style?.includes( name );
20
21
 
21
22
  return (
@@ -24,6 +25,7 @@ export const StyleTabSection = ( { section, fields = [], unmountOnExit = true }:
24
25
  defaultExpanded={ isExpanded }
25
26
  titleEnd={ getStylesInheritanceIndicators( fields ) }
26
27
  unmountOnExit={ unmountOnExit }
28
+ action={ action }
27
29
  >
28
30
  <SectionComponent />
29
31
  </Section>
package/src/init.ts CHANGED
@@ -3,6 +3,7 @@ import { __registerPanel as registerPanel } from '@elementor/editor-panels';
3
3
  import { blockCommand } from '@elementor/editor-v1-adapters';
4
4
 
5
5
  import { EditingPanelHooks } from './components/editing-panel-hooks';
6
+ import { init as initPromotionsSections } from './components/promotions/init';
6
7
  import { registerElementControls } from './controls-registry/element-controls/registry';
7
8
  import { init as initDynamics } from './dynamics/init';
8
9
  import { panel } from './panel';
@@ -29,6 +30,8 @@ export function init() {
29
30
  registerElementControls();
30
31
 
31
32
  initResetStyleProps();
33
+
34
+ initPromotionsSections();
32
35
  }
33
36
 
34
37
  const blockV1Panel = () => {