@elementor/editor-interactions 3.35.0-470 → 3.35.0-472
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 +36 -40
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -38
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
- package/src/components/controls/direction.tsx +2 -19
- package/src/components/controls/effect-type.tsx +3 -21
- package/src/components/controls/effect.tsx +17 -26
- package/src/components/controls/time-frame-indicator.tsx +17 -27
- package/src/components/controls/trigger.tsx +16 -26
- package/src/components/interaction-details.tsx +66 -35
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ControlFormLabel, PopoverGridContainer } from '@elementor/editor-controls';
|
|
3
2
|
import { MenuListItem } from '@elementor/editor-ui';
|
|
4
|
-
import {
|
|
3
|
+
import { Select, type SelectChangeEvent } from '@elementor/ui';
|
|
5
4
|
import { __ } from '@wordpress/i18n';
|
|
6
5
|
|
|
7
6
|
import { type FieldProps } from '../../types';
|
|
7
|
+
|
|
8
8
|
export function Effect( { value, onChange }: FieldProps ) {
|
|
9
9
|
const availableEffects = [
|
|
10
10
|
{ key: 'fade', label: __( 'Fade', 'elementor' ) },
|
|
@@ -13,29 +13,20 @@ export function Effect( { value, onChange }: FieldProps ) {
|
|
|
13
13
|
];
|
|
14
14
|
|
|
15
15
|
return (
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
<MenuListItem key={ effect.key } value={ effect.key }>
|
|
32
|
-
{ effect.label }
|
|
33
|
-
</MenuListItem>
|
|
34
|
-
);
|
|
35
|
-
} ) }
|
|
36
|
-
</Select>
|
|
37
|
-
</Grid>
|
|
38
|
-
</PopoverGridContainer>
|
|
39
|
-
</Grid>
|
|
16
|
+
<Select
|
|
17
|
+
fullWidth
|
|
18
|
+
displayEmpty
|
|
19
|
+
size="tiny"
|
|
20
|
+
value={ value }
|
|
21
|
+
onChange={ ( event: SelectChangeEvent< string > ) => onChange( event.target.value ) }
|
|
22
|
+
>
|
|
23
|
+
{ availableEffects.map( ( effect ) => {
|
|
24
|
+
return (
|
|
25
|
+
<MenuListItem key={ effect.key } value={ effect.key }>
|
|
26
|
+
{ effect.label }
|
|
27
|
+
</MenuListItem>
|
|
28
|
+
);
|
|
29
|
+
} ) }
|
|
30
|
+
</Select>
|
|
40
31
|
);
|
|
41
32
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ControlFormLabel, PopoverGridContainer } from '@elementor/editor-controls';
|
|
3
2
|
import { MenuListItem } from '@elementor/editor-ui';
|
|
4
|
-
import {
|
|
3
|
+
import { Select, type SelectChangeEvent } from '@elementor/ui';
|
|
5
4
|
import { __ } from '@wordpress/i18n';
|
|
6
5
|
|
|
7
6
|
import { type FieldProps } from '../../types';
|
|
8
7
|
|
|
9
|
-
export function TimeFrameIndicator( { value, onChange
|
|
8
|
+
export function TimeFrameIndicator( { value, onChange }: FieldProps ) {
|
|
10
9
|
const availableTimeFrames = [ '0', '100', '200', '300', '400', '500', '750', '1000', '1250', '1500' ].map(
|
|
11
10
|
( key ) => ( {
|
|
12
11
|
key,
|
|
@@ -16,29 +15,20 @@ export function TimeFrameIndicator( { value, onChange, label }: FieldProps ) {
|
|
|
16
15
|
);
|
|
17
16
|
|
|
18
17
|
return (
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
<MenuListItem key={ timeFrame.key } value={ timeFrame.key }>
|
|
35
|
-
{ timeFrame.label }
|
|
36
|
-
</MenuListItem>
|
|
37
|
-
);
|
|
38
|
-
} ) }
|
|
39
|
-
</Select>
|
|
40
|
-
</Grid>
|
|
41
|
-
</PopoverGridContainer>
|
|
42
|
-
</Grid>
|
|
18
|
+
<Select
|
|
19
|
+
fullWidth
|
|
20
|
+
displayEmpty
|
|
21
|
+
size="tiny"
|
|
22
|
+
value={ value }
|
|
23
|
+
onChange={ ( event: SelectChangeEvent< string > ) => onChange( event.target.value ) }
|
|
24
|
+
>
|
|
25
|
+
{ availableTimeFrames.map( ( timeFrame ) => {
|
|
26
|
+
return (
|
|
27
|
+
<MenuListItem key={ timeFrame.key } value={ timeFrame.key }>
|
|
28
|
+
{ timeFrame.label }
|
|
29
|
+
</MenuListItem>
|
|
30
|
+
);
|
|
31
|
+
} ) }
|
|
32
|
+
</Select>
|
|
43
33
|
);
|
|
44
34
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ControlFormLabel, PopoverGridContainer } from '@elementor/editor-controls';
|
|
3
2
|
import { MenuListItem } from '@elementor/editor-ui';
|
|
4
|
-
import {
|
|
3
|
+
import { Select, type SelectChangeEvent } from '@elementor/ui';
|
|
5
4
|
import { __ } from '@wordpress/i18n';
|
|
6
5
|
|
|
7
6
|
import { type FieldProps } from '../../types';
|
|
@@ -16,29 +15,20 @@ export function Trigger( { value, onChange }: FieldProps ) {
|
|
|
16
15
|
} ) );
|
|
17
16
|
|
|
18
17
|
return (
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
<MenuListItem key={ trigger.key } value={ trigger.key }>
|
|
35
|
-
{ trigger.label }
|
|
36
|
-
</MenuListItem>
|
|
37
|
-
);
|
|
38
|
-
} ) }
|
|
39
|
-
</Select>
|
|
40
|
-
</Grid>
|
|
41
|
-
</PopoverGridContainer>
|
|
42
|
-
</Grid>
|
|
18
|
+
<Select
|
|
19
|
+
fullWidth
|
|
20
|
+
displayEmpty
|
|
21
|
+
size="tiny"
|
|
22
|
+
onChange={ ( event: SelectChangeEvent< string > ) => onChange( event.target.value ) }
|
|
23
|
+
value={ value }
|
|
24
|
+
>
|
|
25
|
+
{ availableTriggers.map( ( trigger ) => {
|
|
26
|
+
return (
|
|
27
|
+
<MenuListItem key={ trigger.key } value={ trigger.key }>
|
|
28
|
+
{ trigger.label }
|
|
29
|
+
</MenuListItem>
|
|
30
|
+
);
|
|
31
|
+
} ) }
|
|
32
|
+
</Select>
|
|
43
33
|
);
|
|
44
34
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { useMemo } from 'react';
|
|
2
|
+
import { type PropsWithChildren, useMemo } from 'react';
|
|
3
3
|
import { ControlFormLabel, PopoverContent, PopoverGridContainer } from '@elementor/editor-controls';
|
|
4
4
|
import { Divider, Grid } from '@elementor/ui';
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
@@ -44,10 +44,13 @@ export const InteractionDetails = ( { interaction, onChange, onPlayInteraction }
|
|
|
44
44
|
const duration = extractNumber( interaction.animation.value.timing_config.value.duration, DEFAULT_VALUES.duration );
|
|
45
45
|
const delay = extractNumber( interaction.animation.value.timing_config.value.delay, DEFAULT_VALUES.delay );
|
|
46
46
|
const replay = extractBoolean( interaction.animation.value.config?.value.replay, DEFAULT_VALUES.replay );
|
|
47
|
+
|
|
47
48
|
const shouldShowReplay = TRIGGERS_WITH_REPLAY.includes( trigger );
|
|
49
|
+
|
|
48
50
|
const TriggerControl = useMemo( () => {
|
|
49
51
|
return getInteractionsControl( 'trigger' )?.component ?? null;
|
|
50
52
|
}, [] );
|
|
53
|
+
|
|
51
54
|
const ReplayControl = useMemo( () => {
|
|
52
55
|
if ( ! shouldShowReplay ) {
|
|
53
56
|
return null;
|
|
@@ -97,6 +100,7 @@ export const InteractionDetails = ( { interaction, onChange, onPlayInteraction }
|
|
|
97
100
|
onChange( updatedInteraction );
|
|
98
101
|
|
|
99
102
|
const interactionId = extractString( updatedInteraction.interaction_id );
|
|
103
|
+
|
|
100
104
|
setTimeout( () => {
|
|
101
105
|
onPlayInteraction( interactionId );
|
|
102
106
|
}, 0 );
|
|
@@ -106,47 +110,74 @@ export const InteractionDetails = ( { interaction, onChange, onPlayInteraction }
|
|
|
106
110
|
<PopoverContent p={ 1.5 }>
|
|
107
111
|
<Grid container spacing={ 1.5 }>
|
|
108
112
|
{ TriggerControl && (
|
|
109
|
-
<
|
|
113
|
+
<Field label={ __( 'Trigger', 'elementor' ) }>
|
|
114
|
+
<TriggerControl value={ trigger } onChange={ ( v ) => updateInteraction( { trigger: v } ) } />
|
|
115
|
+
</Field>
|
|
110
116
|
) }
|
|
117
|
+
|
|
111
118
|
{ ReplayControl && (
|
|
112
|
-
|
|
113
|
-
<
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
<ReplayControl
|
|
120
|
-
value={ replay }
|
|
121
|
-
onChange={ ( v ) => updateInteraction( { replay: v } ) }
|
|
122
|
-
disabled={ true }
|
|
123
|
-
/>
|
|
124
|
-
</Grid>
|
|
125
|
-
</PopoverGridContainer>
|
|
126
|
-
</Grid>
|
|
127
|
-
</>
|
|
119
|
+
<Field label={ __( 'Replay', 'elementor' ) }>
|
|
120
|
+
<ReplayControl
|
|
121
|
+
value={ replay }
|
|
122
|
+
onChange={ ( v ) => updateInteraction( { replay: v } ) }
|
|
123
|
+
disabled={ true }
|
|
124
|
+
/>
|
|
125
|
+
</Field>
|
|
128
126
|
) }
|
|
129
127
|
</Grid>
|
|
128
|
+
|
|
130
129
|
<Divider />
|
|
130
|
+
|
|
131
131
|
<Grid container spacing={ 1.5 }>
|
|
132
|
-
<
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
132
|
+
<Field label={ __( 'Effect', 'elementor' ) }>
|
|
133
|
+
<Effect value={ effect } onChange={ ( v ) => updateInteraction( { effect: v } ) } />
|
|
134
|
+
</Field>
|
|
135
|
+
|
|
136
|
+
<Field label={ __( 'Type', 'elementor' ) }>
|
|
137
|
+
<EffectType value={ type } onChange={ ( v ) => updateInteraction( { type: v } ) } />
|
|
138
|
+
</Field>
|
|
139
|
+
|
|
140
|
+
<Field label={ __( 'Direction', 'elementor' ) }>
|
|
141
|
+
<Direction
|
|
142
|
+
value={ direction }
|
|
143
|
+
onChange={ ( v ) => updateInteraction( { direction: v } ) }
|
|
144
|
+
interactionType={ type }
|
|
145
|
+
/>
|
|
146
|
+
</Field>
|
|
147
|
+
|
|
148
|
+
<Field label={ __( 'Duration', 'elementor' ) }>
|
|
149
|
+
<TimeFrameIndicator
|
|
150
|
+
value={ String( duration ) }
|
|
151
|
+
onChange={ ( v ) => updateInteraction( { duration: parseInt( v, 10 ) } ) }
|
|
152
|
+
/>
|
|
153
|
+
</Field>
|
|
154
|
+
|
|
155
|
+
<Field label={ __( 'Delay', 'elementor' ) }>
|
|
156
|
+
<TimeFrameIndicator
|
|
157
|
+
value={ String( delay ) }
|
|
158
|
+
onChange={ ( v ) => updateInteraction( { delay: parseInt( v, 10 ) } ) }
|
|
159
|
+
/>
|
|
160
|
+
</Field>
|
|
149
161
|
</Grid>
|
|
150
162
|
</PopoverContent>
|
|
151
163
|
);
|
|
152
164
|
};
|
|
165
|
+
|
|
166
|
+
type FieldProps = {
|
|
167
|
+
label: string;
|
|
168
|
+
} & PropsWithChildren;
|
|
169
|
+
|
|
170
|
+
function Field( { label, children }: FieldProps ) {
|
|
171
|
+
return (
|
|
172
|
+
<Grid item xs={ 12 }>
|
|
173
|
+
<PopoverGridContainer>
|
|
174
|
+
<Grid item xs={ 6 }>
|
|
175
|
+
<ControlFormLabel>{ label }</ControlFormLabel>
|
|
176
|
+
</Grid>
|
|
177
|
+
<Grid item xs={ 6 }>
|
|
178
|
+
{ children }
|
|
179
|
+
</Grid>
|
|
180
|
+
</PopoverGridContainer>
|
|
181
|
+
</Grid>
|
|
182
|
+
);
|
|
183
|
+
}
|