@elementor/editor-controls 4.1.0-748 → 4.1.0-749

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-748",
4
+ "version": "4.1.0-749",
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-748",
44
- "@elementor/editor-elements": "4.1.0-748",
45
- "@elementor/editor-props": "4.1.0-748",
46
- "@elementor/editor-responsive": "4.1.0-748",
47
- "@elementor/editor-ui": "4.1.0-748",
48
- "@elementor/editor-v1-adapters": "4.1.0-748",
49
- "@elementor/env": "4.1.0-748",
50
- "@elementor/http-client": "4.1.0-748",
43
+ "@elementor/editor-current-user": "4.1.0-749",
44
+ "@elementor/editor-elements": "4.1.0-749",
45
+ "@elementor/editor-props": "4.1.0-749",
46
+ "@elementor/editor-responsive": "4.1.0-749",
47
+ "@elementor/editor-ui": "4.1.0-749",
48
+ "@elementor/editor-v1-adapters": "4.1.0-749",
49
+ "@elementor/env": "4.1.0-749",
50
+ "@elementor/http-client": "4.1.0-749",
51
51
  "@elementor/icons": "^1.68.0",
52
- "@elementor/locations": "4.1.0-748",
53
- "@elementor/events": "4.1.0-748",
54
- "@elementor/query": "4.1.0-748",
55
- "@elementor/session": "4.1.0-748",
52
+ "@elementor/locations": "4.1.0-749",
53
+ "@elementor/events": "4.1.0-749",
54
+ "@elementor/query": "4.1.0-749",
55
+ "@elementor/session": "4.1.0-749",
56
56
  "@elementor/ui": "1.36.17",
57
- "@elementor/utils": "4.1.0-748",
58
- "@elementor/wp-media": "4.1.0-748",
57
+ "@elementor/utils": "4.1.0-749",
58
+ "@elementor/wp-media": "4.1.0-749",
59
59
  "@wordpress/i18n": "^5.13.0",
60
60
  "@monaco-editor/react": "^4.7.0",
61
61
  "dayjs": "^1.11.18",
@@ -9,6 +9,7 @@ import { useBoundProp } from '../bound-prop-context';
9
9
  import { ConditionalControlInfotip } from '../components/conditional-control-infotip';
10
10
  import ControlActions from '../control-actions/control-actions';
11
11
  import { createControl } from '../create-control';
12
+ import { type ControlProps } from '../utils/types';
12
13
 
13
14
  export type SelectOption = {
14
15
  label: string;
@@ -16,15 +17,22 @@ export type SelectOption = {
16
17
  disabled?: boolean;
17
18
  };
18
19
 
19
- type Props = {
20
+ type Props = ControlProps< {
20
21
  options: SelectOption[];
21
22
  onChange?: ( newValue: string | null, previousValue: string | null | undefined ) => void;
22
23
  fallbackLabels?: Record< string, string >;
23
- };
24
+ } >;
24
25
 
25
26
  const StyledSelect = styled( Select )( () => ( { '.MuiSelect-select.Mui-disabled': { cursor: 'not-allowed' } } ) );
26
27
 
27
- export const HtmlTagControl = createControl( ( { options, onChange, fallbackLabels = {} }: Props ) => {
28
+ export const HtmlTagControl = createControl( ( props: Props ) => {
29
+ const {
30
+ options,
31
+ onChange,
32
+ fallbackLabels = {},
33
+ context: { elementId },
34
+ } = props;
35
+
28
36
  const { value, setValue, disabled, placeholder } = useBoundProp( stringPropTypeUtil );
29
37
  const handleChange = ( event: SelectChangeEvent< StringPropValue[ 'value' ] > ) => {
30
38
  const newValue = event.target.value || null;
@@ -33,7 +41,7 @@ export const HtmlTagControl = createControl( ( { options, onChange, fallbackLabe
33
41
  setValue( newValue );
34
42
  };
35
43
 
36
- const elementLabel = getElementLabel() ?? 'element';
44
+ const elementLabel = getElementLabel( elementId ) ?? 'element';
37
45
  const infoTipProps = {
38
46
  title: __( 'HTML Tag', 'elementor' ),
39
47
  /* translators: %s is the element name. */
@@ -78,8 +86,8 @@ export const HtmlTagControl = createControl( ( { options, onChange, fallbackLabe
78
86
  disabled={ disabled }
79
87
  fullWidth
80
88
  >
81
- { options.map( ( { label, ...props } ) => (
82
- <MenuListItem key={ props.value } { ...props } value={ props.value ?? '' }>
89
+ { options.map( ( { label, ...itemProps } ) => (
90
+ <MenuListItem key={ itemProps.value } { ...itemProps } value={ itemProps.value ?? '' }>
83
91
  { label }
84
92
  </MenuListItem>
85
93
  ) ) }