@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/dist/index.js +91 -81
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/components/control-repeater/items/item.tsx +6 -0
- package/src/controls/repeatable-control.tsx +10 -2
- package/src/controls/transition-control/transition-selector.tsx +10 -7
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-
|
|
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-
|
|
44
|
-
"@elementor/editor-elements": "3.33.0-
|
|
45
|
-
"@elementor/editor-props": "3.33.0-
|
|
46
|
-
"@elementor/editor-responsive": "3.33.0-
|
|
47
|
-
"@elementor/editor-ui": "3.33.0-
|
|
48
|
-
"@elementor/editor-v1-adapters": "3.33.0-
|
|
49
|
-
"@elementor/env": "3.33.0-
|
|
50
|
-
"@elementor/http-client": "3.33.0-
|
|
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-
|
|
53
|
-
"@elementor/mixpanel": "3.33.0-
|
|
54
|
-
"@elementor/query": "3.33.0-
|
|
55
|
-
"@elementor/session": "3.33.0-
|
|
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-
|
|
58
|
-
"@elementor/wp-media": "3.33.0-
|
|
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
|
|
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
|
-
<
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
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
|