@@ -29,6 +29,11 @@ const Player = lazy(
29
29
. then ( module => ( { default : module . Player } ) )
30
30
) ;
31
31
32
+ const DotLottiePlayer = lazy (
33
+ ( ) => import ( '@lottiefiles/dotlottie-react' )
34
+ . then ( module => ( { default : module . DotLottieReact } ) )
35
+ ) ;
36
+
32
37
/**
33
38
* JsonLottie Comp
34
39
*/
@@ -90,8 +95,9 @@ const speedOptions = [
90
95
] as const ;
91
96
92
97
const ModeOptions = [
93
- { label : "Data" , value : "standard" } ,
94
- { label : "Advanced" , value : "advanced" } ,
98
+ { label : "Lottie JSON" , value : "standard" } ,
99
+ { label : "DotLottie" , value : "dotLottie" } ,
100
+ { label : "IconScout" , value : "advanced" } ,
95
101
] as const ;
96
102
97
103
let JsonLottieTmpComp = ( function ( ) {
@@ -102,6 +108,7 @@ let JsonLottieTmpComp = (function () {
102
108
JSON . stringify ( defaultLottie , null , 2 )
103
109
) ,
104
110
srcIconScout : IconscoutControl ( IconScoutAssetType . LOTTIE ) ,
111
+ srcDotLottie : withDefault ( StringControl , 'https://assets-v2.lottiefiles.com/a/9e7d8a50-1180-11ee-89a6-3b0ab1ca8a0e/hUfEwc6xNt.lottie' ) ,
105
112
uuidIconScout : StringControl ,
106
113
valueIconScout : withDefault ( ArrayOrJSONObjectControl , JSON . stringify ( { } ) ) ,
107
114
speed : dropdownControl ( speedOptions , "1" ) ,
@@ -162,27 +169,50 @@ let JsonLottieTmpComp = (function () {
162
169
rotate : props . container . rotation ,
163
170
} }
164
171
>
165
- < Player
166
- key = {
167
- [ props . speed , props . animationStart , props . loop , props . value , props . keepLastFrame ] as any
168
- }
169
- keepLastFrame = { props . keepLastFrame }
170
- autoplay = { props . animationStart === "auto" && true }
171
- hover = { props . animationStart === "on hover" && true }
172
- loop = { props . loop === "single" ? false : true }
173
- speed = { Number ( props . speed ) }
174
- src = {
175
- props . sourceMode === 'advanced'
176
- ? ( isEmpty ( props . valueIconScout ) ? '' : props . valueIconScout )
177
- : props . value
178
- }
179
- style = { {
180
- height : "100%" ,
181
- width : "100%" ,
182
- maxWidth : "100%" ,
183
- maxHeight : "100%" ,
184
- } }
185
- />
172
+ { props . sourceMode === 'dotLottie'
173
+ ? (
174
+ < DotLottiePlayer
175
+ key = {
176
+ [ props . speed , props . animationStart , props . loop , props . value , props . keepLastFrame ] as any
177
+ }
178
+ // keepLastFrame={props.keepLastFrame}
179
+ autoplay = { props . animationStart === "auto" && true }
180
+ playOnHover = { props . animationStart === "on hover" && true }
181
+ loop = { props . loop === "single" ? false : true }
182
+ speed = { Number ( props . speed ) }
183
+ src = { props . srcDotLottie }
184
+ style = { {
185
+ height : "100%" ,
186
+ width : "100%" ,
187
+ maxWidth : "100%" ,
188
+ maxHeight : "100%" ,
189
+ } }
190
+ />
191
+ )
192
+ : (
193
+ < Player
194
+ key = {
195
+ [ props . speed , props . animationStart , props . loop , props . value , props . keepLastFrame ] as any
196
+ }
197
+ keepLastFrame = { props . keepLastFrame }
198
+ autoplay = { props . animationStart === "auto" && true }
199
+ hover = { props . animationStart === "on hover" && true }
200
+ loop = { props . loop === "single" ? false : true }
201
+ speed = { Number ( props . speed ) }
202
+ src = {
203
+ props . sourceMode === 'advanced'
204
+ ? ( isEmpty ( props . valueIconScout ) ? '' : props . valueIconScout )
205
+ : props . value
206
+ }
207
+ style = { {
208
+ height : "100%" ,
209
+ width : "100%" ,
210
+ maxWidth : "100%" ,
211
+ maxHeight : "100%" ,
212
+ } }
213
+ />
214
+ )
215
+ }
186
216
</ div >
187
217
</ div >
188
218
) ;
@@ -198,6 +228,9 @@ let JsonLottieTmpComp = (function () {
198
228
{ children . sourceMode . getView ( ) === 'standard' && children . value . propertyView ( {
199
229
label : trans ( "jsonLottie.lottieJson" ) ,
200
230
} ) }
231
+ { children . sourceMode . getView ( ) === 'dotLottie' && children . srcDotLottie . propertyView ( {
232
+ label : "Source" ,
233
+ } ) }
201
234
{ children . sourceMode . getView ( ) === 'advanced' && children . srcIconScout . propertyView ( {
202
235
label : "Lottie Source" ,
203
236
} ) }
0 commit comments