@elementor/editor-controls 3.33.0-253 → 3.33.0-255

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": "3.33.0-253",
4
+ "version": "3.33.0-255",
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": "3.33.0-253",
44
- "@elementor/editor-elements": "3.33.0-253",
45
- "@elementor/editor-props": "3.33.0-253",
46
- "@elementor/editor-responsive": "3.33.0-253",
47
- "@elementor/editor-ui": "3.33.0-253",
48
- "@elementor/editor-v1-adapters": "3.33.0-253",
49
- "@elementor/env": "3.33.0-253",
50
- "@elementor/http-client": "3.33.0-253",
43
+ "@elementor/editor-current-user": "3.33.0-255",
44
+ "@elementor/editor-elements": "3.33.0-255",
45
+ "@elementor/editor-props": "3.33.0-255",
46
+ "@elementor/editor-responsive": "3.33.0-255",
47
+ "@elementor/editor-ui": "3.33.0-255",
48
+ "@elementor/editor-v1-adapters": "3.33.0-255",
49
+ "@elementor/env": "3.33.0-255",
50
+ "@elementor/http-client": "3.33.0-255",
51
51
  "@elementor/icons": "^1.61.0",
52
- "@elementor/locations": "3.33.0-253",
53
- "@elementor/mixpanel": "3.33.0-253",
54
- "@elementor/query": "3.33.0-253",
55
- "@elementor/session": "3.33.0-253",
52
+ "@elementor/locations": "3.33.0-255",
53
+ "@elementor/mixpanel": "3.33.0-255",
54
+ "@elementor/query": "3.33.0-255",
55
+ "@elementor/session": "3.33.0-255",
56
56
  "@elementor/ui": "1.36.17",
57
- "@elementor/utils": "3.33.0-253",
58
- "@elementor/wp-media": "3.33.0-253",
57
+ "@elementor/utils": "3.33.0-255",
58
+ "@elementor/wp-media": "3.33.0-255",
59
59
  "@wordpress/i18n": "^5.13.0",
60
60
  "@monaco-editor/react": "^4.7.0",
61
61
  "dayjs": "^1.11.18",
@@ -2,6 +2,7 @@ import * as React from 'react';
2
2
  import { bindTrigger } from '@elementor/ui';
3
3
  import { __ } from '@wordpress/i18n';
4
4
 
5
+ import { RepeatableControlContext } from '../../../hooks/use-repeatable-control-context';
5
6
  import { RepeaterTag } from '../../repeater/repeater-tag';
6
7
  import { useRepeaterContext } from '../context/repeater-context';
7
8
  import { RepeaterItemActionsSlot, RepeaterItemIconSlot, RepeaterItemLabelSlot } from '../locations';
@@ -9,9 +10,14 @@ import { type ItemProps, type RepeatablePropValue } from '../types';
9
10
 
10
11
  export const Item = < T extends RepeatablePropValue >( { Label, Icon, actions }: ItemProps< T > ) => {
11
12
  const { popoverState, setRowRef, openItemIndex, setOpenItemIndex, index = -1, value } = useRepeaterContext();
13
+ const repeatableContext = React.useContext( RepeatableControlContext );
14
+ const disableOpen = !! repeatableContext?.props?.readOnly;
12
15
  const triggerProps = bindTrigger( popoverState );
13
16
 
14
17
  const onClick = ( ev: React.MouseEvent ) => {
18
+ if ( disableOpen ) {
19
+ return;
20
+ }
15
21
  triggerProps.onClick( ev );
16
22
  setOpenItemIndex( index );
17
23
  };
@@ -216,11 +216,19 @@ const shouldShowPlaceholder = ( pattern: string, data: Record< string, unknown >
216
216
  return false;
217
217
  };
218
218
 
219
+ const getTextColor = ( isReadOnly: boolean, showPlaceholder: boolean ): string => {
220
+ if ( isReadOnly ) {
221
+ return 'text.disabled';
222
+ }
223
+ return showPlaceholder ? 'text.tertiary' : 'text.primary';
224
+ };
225
+
219
226
  const ItemLabel = ( { value }: { value: Record< string, unknown > } ) => {
220
- const { placeholder, patternLabel } = useRepeatableControlContext();
227
+ const { placeholder, patternLabel, props: childProps } = useRepeatableControlContext();
221
228
  const showPlaceholder = shouldShowPlaceholder( patternLabel, value );
222
229
  const label = showPlaceholder ? placeholder : interpolate( patternLabel, value );
223
- const color = showPlaceholder ? 'text.tertiary' : 'text.primary';
230
+ const isReadOnly = !! childProps?.readOnly;
231
+ const color = getTextColor( isReadOnly, showPlaceholder );
224
232
 
225
233
  return (
226
234
  <Box component="span" color={ color }>
@@ -7,6 +7,7 @@ import { __ } from '@wordpress/i18n';
7
7
 
8
8
  import { useBoundProp } from '../../bound-prop-context';
9
9
  import { ItemSelector } from '../../components/item-selector';
10
+ import ControlActions from '../../control-actions/control-actions';
10
11
  import { transitionProperties, transitionsItemsList } from './data';
11
12
 
12
13
  const toTransitionSelectorValue = ( label: string ) => {
@@ -95,13 +96,15 @@ export const TransitionSelector = ( {
95
96
 
96
97
  return (
97
98
  <Box ref={ defaultRef }>
98
- <UnstableTag
99
- variant="outlined"
100
- label={ transitionLabel }
101
- endIcon={ <ChevronDownIcon fontSize="tiny" /> }
102
- { ...bindTrigger( popoverState ) }
103
- fullWidth
104
- />
99
+ <ControlActions>
100
+ <UnstableTag
101
+ variant="outlined"
102
+ label={ transitionLabel }
103
+ endIcon={ <ChevronDownIcon fontSize="tiny" /> }
104
+ { ...bindTrigger( popoverState ) }
105
+ fullWidth
106
+ />
107
+ </ControlActions>
105
108
  <Popover
106
109
  disablePortal
107
110
  disableScrollLock