@rocapine/react-native-onboarding 1.25.1 → 1.27.0

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.
Files changed (52) hide show
  1. package/dist/evaluateCondition.d.ts.map +1 -1
  2. package/dist/evaluateCondition.js +44 -1
  3. package/dist/evaluateCondition.js.map +1 -1
  4. package/dist/index.d.ts +3 -3
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +6 -1
  7. package/dist/index.js.map +1 -1
  8. package/dist/onboarding-example.d.ts +2215 -1976
  9. package/dist/onboarding-example.d.ts.map +1 -1
  10. package/dist/onboarding-example.js +592 -545
  11. package/dist/onboarding-example.js.map +1 -1
  12. package/dist/steps/Carousel/types.d.ts +5 -1
  13. package/dist/steps/Carousel/types.d.ts.map +1 -1
  14. package/dist/steps/Commitment/types.d.ts +5 -1
  15. package/dist/steps/Commitment/types.d.ts.map +1 -1
  16. package/dist/steps/ComposableScreen/elements/ButtonElement.d.ts +5 -1
  17. package/dist/steps/ComposableScreen/elements/ButtonElement.d.ts.map +1 -1
  18. package/dist/steps/ComposableScreen/elements/IconElement.d.ts +4 -0
  19. package/dist/steps/ComposableScreen/elements/IconElement.d.ts.map +1 -1
  20. package/dist/steps/ComposableScreen/elements/IconElement.js +2 -0
  21. package/dist/steps/ComposableScreen/elements/IconElement.js.map +1 -1
  22. package/dist/steps/ComposableScreen/elements/WheelPickerElement.d.ts +124 -0
  23. package/dist/steps/ComposableScreen/elements/WheelPickerElement.d.ts.map +1 -0
  24. package/dist/steps/ComposableScreen/elements/WheelPickerElement.js +96 -0
  25. package/dist/steps/ComposableScreen/elements/WheelPickerElement.js.map +1 -0
  26. package/dist/steps/ComposableScreen/types.d.ts +14 -1
  27. package/dist/steps/ComposableScreen/types.d.ts.map +1 -1
  28. package/dist/steps/ComposableScreen/types.js +13 -1
  29. package/dist/steps/ComposableScreen/types.js.map +1 -1
  30. package/dist/steps/Loader/types.d.ts +5 -1
  31. package/dist/steps/Loader/types.d.ts.map +1 -1
  32. package/dist/steps/MediaContent/types.d.ts +5 -1
  33. package/dist/steps/MediaContent/types.d.ts.map +1 -1
  34. package/dist/steps/Picker/types.d.ts +5 -1
  35. package/dist/steps/Picker/types.d.ts.map +1 -1
  36. package/dist/steps/Question/types.d.ts +5 -1
  37. package/dist/steps/Question/types.d.ts.map +1 -1
  38. package/dist/steps/Ratings/types.d.ts +5 -1
  39. package/dist/steps/Ratings/types.d.ts.map +1 -1
  40. package/dist/steps/common.types.d.ts +30 -4
  41. package/dist/steps/common.types.d.ts.map +1 -1
  42. package/dist/steps/common.types.js +33 -3
  43. package/dist/steps/common.types.js.map +1 -1
  44. package/package.json +2 -2
  45. package/src/__tests__/evaluateCondition.test.ts +35 -0
  46. package/src/evaluateCondition.ts +41 -1
  47. package/src/index.ts +8 -0
  48. package/src/onboarding-example.ts +47 -0
  49. package/src/steps/ComposableScreen/elements/IconElement.ts +4 -0
  50. package/src/steps/ComposableScreen/elements/WheelPickerElement.ts +115 -0
  51. package/src/steps/ComposableScreen/types.ts +17 -0
  52. package/src/steps/common.types.ts +38 -5
@@ -112,629 +112,676 @@ exports.onboardingExample = {
112
112
  props: { flex: 1, edges: ["top", "bottom"] },
113
113
  children: [
114
114
  {
115
- id: "root",
116
- type: "YStack",
117
- props: { gap: 24, padding: 24 },
115
+ id: "scroll-root",
116
+ type: "ScrollView",
117
+ props: { flex: 1, showsVerticalScrollIndicator: false },
118
118
  children: [
119
119
  {
120
- id: "hero-lottie",
121
- type: "Lottie",
122
- props: {
123
- source: "https://raw.githubusercontent.com/airbnb/lottie-web/master/demo/adrock/data.json",
124
- height: 180,
125
- autoPlay: true,
126
- loop: true,
127
- },
128
- },
129
- {
130
- id: "hero-rive",
131
- type: "Rive",
132
- props: {
133
- url: "https://cdn.rive.app/animations/vehicles.riv",
134
- width: "100%",
135
- aspectRatio: 16 / 9,
136
- autoPlay: true,
137
- fit: "FitWidth",
138
- },
139
- },
140
- {
141
- id: "hero-image",
142
- type: "Image",
143
- props: {
144
- url: "https://picsum.photos/800/400?grayscale",
145
- height: 180,
146
- resizeMode: "cover",
147
- borderRadius: 16,
148
- },
149
- },
150
- {
151
- id: "hero-icon",
152
- type: "Icon",
153
- props: {
154
- name: "Star",
155
- size: 48,
156
- color: "#007AFF",
157
- marginVertical: 8,
158
- },
159
- },
160
- {
161
- id: "hero-video",
162
- type: "Video",
163
- props: {
164
- url: "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4",
165
- height: 200,
166
- borderRadius: 12,
167
- controls: true,
168
- muted: true,
169
- contentFit: "cover",
170
- },
171
- },
172
- {
173
- id: "kav-input",
174
- type: "KeyboardAvoidingView",
175
- props: { keyboardVerticalOffset: 24 },
120
+ id: "root",
121
+ type: "YStack",
122
+ props: { gap: 24, padding: 24 },
176
123
  children: [
177
124
  {
178
- id: "hero-input",
179
- type: "Input",
125
+ id: "hero-lottie",
126
+ type: "Lottie",
127
+ props: {
128
+ source: "https://raw.githubusercontent.com/airbnb/lottie-web/master/demo/adrock/data.json",
129
+ height: 180,
130
+ autoPlay: true,
131
+ loop: true,
132
+ },
133
+ },
134
+ {
135
+ id: "hero-rive",
136
+ type: "Rive",
137
+ props: {
138
+ url: "https://cdn.rive.app/animations/vehicles.riv",
139
+ width: "100%",
140
+ aspectRatio: 16 / 9,
141
+ autoPlay: true,
142
+ fit: "FitWidth",
143
+ },
144
+ },
145
+ {
146
+ id: "hero-image",
147
+ type: "Image",
148
+ props: {
149
+ url: "https://picsum.photos/800/400?grayscale",
150
+ height: 180,
151
+ resizeMode: "cover",
152
+ borderRadius: 16,
153
+ },
154
+ },
155
+ {
156
+ id: "hero-icon",
157
+ type: "Icon",
180
158
  props: {
181
- variableName: "name",
182
- placeholder: "Enter your name",
183
- keyboardType: "default",
184
- returnKeyType: "done",
185
- autoCapitalize: "words",
159
+ name: "Star",
160
+ size: 48,
161
+ color: "#007AFF",
162
+ fill: "#007AFF",
163
+ fillOpacity: 0.2,
186
164
  marginVertical: 8,
187
165
  },
188
166
  },
189
- ],
190
- },
191
- {
192
- id: "scroll-demo",
193
- type: "ScrollView",
194
- props: {
195
- horizontal: true,
196
- showsHorizontalScrollIndicator: false,
197
- contentContainerPadding: 4,
198
- },
199
- children: [
200
167
  {
201
- id: "scroll-card-1",
202
- type: "Text",
168
+ id: "hero-video",
169
+ type: "Video",
203
170
  props: {
204
- content: "Card 1",
205
- width: 160,
206
- height: 100,
207
- marginHorizontal: 6,
208
- borderWidth: 1,
171
+ url: "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4",
172
+ height: 200,
209
173
  borderRadius: 12,
210
- borderColor: "#00000020",
211
- paddingVertical: 38,
174
+ controls: true,
175
+ muted: true,
176
+ contentFit: "cover",
177
+ },
178
+ },
179
+ {
180
+ id: "kav-input",
181
+ type: "KeyboardAvoidingView",
182
+ props: { keyboardVerticalOffset: 24 },
183
+ children: [
184
+ {
185
+ id: "hero-input",
186
+ type: "Input",
187
+ props: {
188
+ variableName: "name",
189
+ placeholder: "Enter your name",
190
+ keyboardType: "default",
191
+ returnKeyType: "done",
192
+ autoCapitalize: "words",
193
+ marginVertical: 8,
194
+ },
195
+ },
196
+ ],
197
+ },
198
+ {
199
+ // Only shown once `name` has a non-empty value — demonstrates
200
+ // the unary `is_not_empty` condition operator.
201
+ id: "name-greeting",
202
+ type: "Text",
203
+ renderWhen: { variable: "name", operator: "is_not_empty" },
204
+ props: {
205
+ content: "Nice to meet you, {{name}}!",
206
+ mode: "expression",
207
+ fontSize: 14,
212
208
  textAlign: "center",
213
- fontSize: 16,
209
+ opacity: 0.6,
210
+ marginVertical: 4,
211
+ },
212
+ },
213
+ {
214
+ id: "scroll-demo",
215
+ type: "ScrollView",
216
+ props: {
217
+ horizontal: true,
218
+ showsHorizontalScrollIndicator: false,
219
+ contentContainerPadding: 4,
220
+ },
221
+ children: [
222
+ {
223
+ id: "scroll-card-1",
224
+ type: "Text",
225
+ props: {
226
+ content: "Card 1",
227
+ width: 160,
228
+ height: 100,
229
+ marginHorizontal: 6,
230
+ borderWidth: 1,
231
+ borderRadius: 12,
232
+ borderColor: "#00000020",
233
+ paddingVertical: 38,
234
+ textAlign: "center",
235
+ fontSize: 16,
236
+ fontWeight: "600",
237
+ },
238
+ },
239
+ {
240
+ id: "scroll-card-2",
241
+ type: "Text",
242
+ props: {
243
+ content: "Card 2",
244
+ width: 160,
245
+ height: 100,
246
+ marginHorizontal: 6,
247
+ borderWidth: 1,
248
+ borderRadius: 12,
249
+ borderColor: "#00000020",
250
+ paddingVertical: 38,
251
+ textAlign: "center",
252
+ fontSize: 16,
253
+ fontWeight: "600",
254
+ },
255
+ },
256
+ {
257
+ id: "scroll-card-3",
258
+ type: "Text",
259
+ props: {
260
+ content: "Card 3",
261
+ width: 160,
262
+ height: 100,
263
+ marginHorizontal: 6,
264
+ borderWidth: 1,
265
+ borderRadius: 12,
266
+ borderColor: "#00000020",
267
+ paddingVertical: 38,
268
+ textAlign: "center",
269
+ fontSize: 16,
270
+ fontWeight: "600",
271
+ },
272
+ },
273
+ {
274
+ id: "scroll-card-4",
275
+ type: "Text",
276
+ props: {
277
+ content: "Card 4",
278
+ width: 160,
279
+ height: 100,
280
+ marginHorizontal: 6,
281
+ borderWidth: 1,
282
+ borderRadius: 12,
283
+ borderColor: "#00000020",
284
+ paddingVertical: 38,
285
+ textAlign: "center",
286
+ fontSize: 16,
287
+ fontWeight: "600",
288
+ },
289
+ },
290
+ ],
291
+ },
292
+ {
293
+ id: "greeting",
294
+ type: "Text",
295
+ props: {
296
+ content: "Hello {{name}}!",
297
+ mode: "expression",
298
+ fontSize: 18,
214
299
  fontWeight: "600",
300
+ textAlign: "center",
301
+ marginVertical: 4,
215
302
  },
216
303
  },
217
304
  {
218
- id: "scroll-card-2",
305
+ id: "headline",
219
306
  type: "Text",
220
307
  props: {
221
- content: "Card 2",
222
- width: 160,
223
- height: 100,
224
- marginHorizontal: 6,
225
- borderWidth: 1,
226
- borderRadius: 12,
227
- borderColor: "#00000020",
228
- paddingVertical: 38,
308
+ content: "Built from the CMS",
309
+ fontSize: 28,
310
+ fontWeight: "700",
311
+ fontFamily: "Inter",
229
312
  textAlign: "center",
230
- fontSize: 16,
231
- fontWeight: "600",
232
313
  },
233
314
  },
234
315
  {
235
- id: "scroll-card-3",
316
+ id: "headline-display",
236
317
  type: "Text",
237
318
  props: {
238
- content: "Card 3",
239
- width: 160,
240
- height: 100,
241
- marginHorizontal: 6,
242
- borderWidth: 1,
243
- borderRadius: 12,
244
- borderColor: "#00000020",
245
- paddingVertical: 38,
319
+ content: "Runtime-loaded font",
320
+ fontSize: 32,
321
+ fontFamily: "Lobster",
322
+ fontStyle: "italic",
246
323
  textAlign: "center",
247
- fontSize: 16,
248
- fontWeight: "600",
324
+ marginVertical: 4,
249
325
  },
250
326
  },
251
327
  {
252
- id: "scroll-card-4",
328
+ id: "inherit-implicit",
253
329
  type: "Text",
254
330
  props: {
255
- content: "Card 4",
256
- width: 160,
257
- height: 100,
258
- marginHorizontal: 6,
259
- borderWidth: 1,
260
- borderRadius: 12,
261
- borderColor: "#00000020",
262
- paddingVertical: 38,
331
+ content: "Inherits theme.typography.defaultFontFamily (omitted)",
332
+ fontSize: 14,
263
333
  textAlign: "center",
264
- fontSize: 16,
265
- fontWeight: "600",
334
+ opacity: 0.6,
266
335
  },
267
336
  },
268
- ],
269
- },
270
- {
271
- id: "greeting",
272
- type: "Text",
273
- props: {
274
- content: "Hello {{name}}!",
275
- mode: "expression",
276
- fontSize: 18,
277
- fontWeight: "600",
278
- textAlign: "center",
279
- marginVertical: 4,
280
- },
281
- },
282
- {
283
- id: "headline",
284
- type: "Text",
285
- props: {
286
- content: "Built from the CMS",
287
- fontSize: 28,
288
- fontWeight: "700",
289
- fontFamily: "Inter",
290
- textAlign: "center",
291
- },
292
- },
293
- {
294
- id: "headline-display",
295
- type: "Text",
296
- props: {
297
- content: "Runtime-loaded font",
298
- fontSize: 32,
299
- fontFamily: "Lobster",
300
- fontStyle: "italic",
301
- textAlign: "center",
302
- marginVertical: 4,
303
- },
304
- },
305
- {
306
- id: "inherit-implicit",
307
- type: "Text",
308
- props: {
309
- content: "Inherits theme.typography.defaultFontFamily (omitted)",
310
- fontSize: 14,
311
- textAlign: "center",
312
- opacity: 0.6,
313
- },
314
- },
315
- {
316
- id: "inherit-explicit",
317
- type: "Text",
318
- props: {
319
- content: "Inherits theme.typography.defaultFontFamily (explicit \"inherit\")",
320
- fontFamily: "inherit",
321
- fontSize: 14,
322
- textAlign: "center",
323
- opacity: 0.6,
324
- },
325
- },
326
- {
327
- id: "subheadline",
328
- type: "Text",
329
- props: {
330
- content: "This screen is composed entirely from a JSON payload — no custom renderer needed.",
331
- fontSize: 15,
332
- textAlign: "center",
333
- lineHeight: 22,
334
- opacity: 0.6,
335
- },
336
- },
337
- {
338
- id: "hero-radio",
339
- type: "RadioGroup",
340
- props: {
341
- variableName: "plan",
342
- defaultValue: "monthly",
343
- gap: 8,
344
- marginVertical: 8,
345
- items: [
346
- { label: "Monthly", value: "monthly" },
347
- { label: "Yearly", value: "yearly" },
348
- { label: "Lifetime", value: "lifetime" },
349
- ],
350
- },
351
- },
352
- {
353
- id: "plan-display",
354
- type: "Text",
355
- props: {
356
- content: "Selected: {{plan}}",
357
- mode: "expression",
358
- fontSize: 14,
359
- textAlign: "center",
360
- opacity: 0.6,
361
- marginVertical: 4,
362
- },
363
- },
364
- {
365
- id: "lifetime-badge",
366
- renderWhen: {
367
- variable: "plan",
368
- operator: "eq",
369
- value: "lifetime",
370
- },
371
- type: "Text",
372
- props: {
373
- content: "🎉 Best value — lifetime access!",
374
- fontSize: 14,
375
- fontWeight: "600",
376
- textAlign: "center",
377
- marginVertical: 4,
378
- },
379
- },
380
- {
381
- id: "hero-checkbox",
382
- type: "CheckboxGroup",
383
- props: {
384
- variableName: "goals",
385
- defaultValues: ["health", "fitness"],
386
- gap: 8,
387
- marginVertical: 8,
388
- items: [
389
- { label: "Improve health", value: "health" },
390
- { label: "Build fitness", value: "fitness" },
391
- { label: "Lose weight", value: "weight" },
392
- { label: "Gain muscle", value: "muscle" },
393
- ],
394
- },
395
- },
396
- {
397
- id: "goals-display",
398
- type: "Text",
399
- props: {
400
- content: "Goals: {{goals}}",
401
- mode: "expression",
402
- fontSize: 14,
403
- textAlign: "center",
404
- opacity: 0.6,
405
- marginVertical: 4,
406
- },
407
- },
408
- {
409
- id: "hero-date-picker",
410
- type: "DatePicker",
411
- props: {
412
- variableName: "birthdate",
413
- defaultValue: "1990-01-01T00:00:00.000Z",
414
- mode: "date",
415
- display: "spinner",
416
- maximumDate: new Date().toISOString(), // static at module load time — suitable for demo; use a runtime value in production
417
- marginVertical: 8,
418
- },
419
- },
420
- {
421
- id: "birthdate-display",
422
- type: "Text",
423
- props: {
424
- content: "Birth date: {{birthdate}}",
425
- mode: "expression",
426
- fontSize: 14,
427
- textAlign: "center",
428
- opacity: 0.6,
429
- marginVertical: 4,
430
- },
431
- },
432
- {
433
- id: "hero-carousel",
434
- type: "Carousel",
435
- props: {
436
- carouselType: "parallax",
437
- autoPlay: false,
438
- loop: true,
439
- showDots: true,
440
- height: 220,
441
- borderRadius: 16,
442
- marginVertical: 8,
443
- defaultIndex: 0,
444
- variableName: "carouselPage",
445
- },
446
- children: [
447
337
  {
448
- id: "carousel-slide-1",
449
- type: "Image",
338
+ id: "inherit-explicit",
339
+ type: "Text",
450
340
  props: {
451
- url: "https://picsum.photos/400/220?random=10",
452
- height: 220,
453
- resizeMode: "cover",
341
+ content: "Inherits theme.typography.defaultFontFamily (explicit \"inherit\")",
342
+ fontFamily: "inherit",
343
+ fontSize: 14,
344
+ textAlign: "center",
345
+ opacity: 0.6,
454
346
  },
455
347
  },
456
348
  {
457
- id: "carousel-slide-2",
458
- type: "Image",
349
+ id: "subheadline",
350
+ type: "Text",
459
351
  props: {
460
- url: "https://picsum.photos/400/220?random=11",
461
- height: 220,
462
- resizeMode: "cover",
352
+ content: "This screen is composed entirely from a JSON payload — no custom renderer needed.",
353
+ fontSize: 15,
354
+ textAlign: "center",
355
+ lineHeight: 22,
356
+ opacity: 0.6,
463
357
  },
464
358
  },
465
359
  {
466
- id: "carousel-slide-3",
467
- type: "Image",
360
+ id: "hero-radio",
361
+ type: "RadioGroup",
468
362
  props: {
469
- url: "https://picsum.photos/400/220?random=12",
470
- height: 220,
471
- resizeMode: "cover",
363
+ variableName: "plan",
364
+ defaultValue: "monthly",
365
+ gap: 8,
366
+ marginVertical: 8,
367
+ items: [
368
+ { label: "Monthly", value: "monthly" },
369
+ { label: "Yearly", value: "yearly" },
370
+ { label: "Lifetime", value: "lifetime" },
371
+ ],
472
372
  },
473
373
  },
474
- ],
475
- },
476
- {
477
- id: "carousel-page-label",
478
- type: "Text",
479
- props: {
480
- content: "Carousel page: {{carouselPage}}",
481
- mode: "expression",
482
- fontSize: 14,
483
- textAlign: "center",
484
- opacity: 0.6,
485
- marginVertical: 4,
486
- },
487
- },
488
- {
489
- id: "carousel-controls",
490
- type: "XStack",
491
- props: { gap: 8, marginVertical: 4 },
492
- children: [
493
374
  {
494
- id: "carousel-go-prev",
495
- type: "Button",
375
+ id: "plan-display",
376
+ type: "Text",
496
377
  props: {
497
- label: "Prev",
498
- variant: "outlined",
499
- flex: 1,
500
- actions: [
501
- {
502
- type: "setVariable",
503
- name: "carouselPage",
504
- value: "{{carouselPage}} - 1",
505
- valueMode: "expression",
506
- },
378
+ content: "Selected: {{plan}}",
379
+ mode: "expression",
380
+ fontSize: 14,
381
+ textAlign: "center",
382
+ opacity: 0.6,
383
+ marginVertical: 4,
384
+ },
385
+ },
386
+ {
387
+ id: "lifetime-badge",
388
+ renderWhen: {
389
+ variable: "plan",
390
+ operator: "eq",
391
+ value: "lifetime",
392
+ },
393
+ type: "Text",
394
+ props: {
395
+ content: "🎉 Best value — lifetime access!",
396
+ fontSize: 14,
397
+ fontWeight: "600",
398
+ textAlign: "center",
399
+ marginVertical: 4,
400
+ },
401
+ },
402
+ {
403
+ id: "hero-checkbox",
404
+ type: "CheckboxGroup",
405
+ props: {
406
+ variableName: "goals",
407
+ defaultValues: ["health", "fitness"],
408
+ gap: 8,
409
+ marginVertical: 8,
410
+ items: [
411
+ { label: "Improve health", value: "health" },
412
+ { label: "Build fitness", value: "fitness" },
413
+ { label: "Lose weight", value: "weight" },
414
+ { label: "Gain muscle", value: "muscle" },
507
415
  ],
508
416
  },
509
417
  },
510
418
  {
511
- id: "carousel-go-next",
512
- type: "Button",
419
+ id: "goals-display",
420
+ type: "Text",
513
421
  props: {
514
- label: "Next",
515
- variant: "outlined",
516
- flex: 1,
517
- actions: [
518
- {
519
- type: "setVariable",
520
- name: "carouselPage",
521
- value: "{{carouselPage}} + 1",
522
- valueMode: "expression",
422
+ content: "Goals: {{goals}}",
423
+ mode: "expression",
424
+ fontSize: 14,
425
+ textAlign: "center",
426
+ opacity: 0.6,
427
+ marginVertical: 4,
428
+ },
429
+ },
430
+ {
431
+ id: "hero-date-picker",
432
+ type: "DatePicker",
433
+ props: {
434
+ variableName: "birthdate",
435
+ defaultValue: "1990-01-01T00:00:00.000Z",
436
+ mode: "date",
437
+ display: "spinner",
438
+ maximumDate: new Date().toISOString(), // static at module load time — suitable for demo; use a runtime value in production
439
+ marginVertical: 8,
440
+ },
441
+ },
442
+ {
443
+ id: "birthdate-display",
444
+ type: "Text",
445
+ props: {
446
+ content: "Birth date: {{birthdate}}",
447
+ mode: "expression",
448
+ fontSize: 14,
449
+ textAlign: "center",
450
+ opacity: 0.6,
451
+ marginVertical: 4,
452
+ },
453
+ },
454
+ {
455
+ id: "hero-weight-wheel",
456
+ type: "WheelPicker",
457
+ props: {
458
+ variableName: "weight",
459
+ defaultValue: "70",
460
+ range: { min: 40, max: 200, step: 1, unit: "kg" },
461
+ height: 180,
462
+ marginVertical: 8,
463
+ },
464
+ },
465
+ {
466
+ id: "weight-display",
467
+ type: "Text",
468
+ props: {
469
+ content: "Weight: {{weight}}",
470
+ mode: "expression",
471
+ fontSize: 14,
472
+ textAlign: "center",
473
+ opacity: 0.6,
474
+ marginVertical: 4,
475
+ },
476
+ },
477
+ {
478
+ id: "hero-carousel",
479
+ type: "Carousel",
480
+ props: {
481
+ carouselType: "parallax",
482
+ autoPlay: false,
483
+ loop: true,
484
+ showDots: true,
485
+ height: 220,
486
+ borderRadius: 16,
487
+ marginVertical: 8,
488
+ defaultIndex: 0,
489
+ variableName: "carouselPage",
490
+ },
491
+ children: [
492
+ {
493
+ id: "carousel-slide-1",
494
+ type: "Image",
495
+ props: {
496
+ url: "https://picsum.photos/400/220?random=10",
497
+ height: 220,
498
+ resizeMode: "cover",
523
499
  },
524
- ],
500
+ },
501
+ {
502
+ id: "carousel-slide-2",
503
+ type: "Image",
504
+ props: {
505
+ url: "https://picsum.photos/400/220?random=11",
506
+ height: 220,
507
+ resizeMode: "cover",
508
+ },
509
+ },
510
+ {
511
+ id: "carousel-slide-3",
512
+ type: "Image",
513
+ props: {
514
+ url: "https://picsum.photos/400/220?random=12",
515
+ height: 220,
516
+ resizeMode: "cover",
517
+ },
518
+ },
519
+ ],
520
+ },
521
+ {
522
+ id: "carousel-page-label",
523
+ type: "Text",
524
+ props: {
525
+ content: "Carousel page: {{carouselPage}}",
526
+ mode: "expression",
527
+ fontSize: 14,
528
+ textAlign: "center",
529
+ opacity: 0.6,
530
+ marginVertical: 4,
525
531
  },
526
532
  },
527
- ],
528
- },
529
- {
530
- id: "zstack-demo",
531
- type: "ZStack",
532
- props: {
533
- height: 200,
534
- borderRadius: 16,
535
- overflow: "hidden",
536
- marginVertical: 8,
537
- },
538
- children: [
539
533
  {
540
- id: "zstack-bg",
541
- type: "Image",
534
+ id: "carousel-controls",
535
+ type: "XStack",
536
+ props: { gap: 8, marginVertical: 4 },
537
+ children: [
538
+ {
539
+ id: "carousel-go-prev",
540
+ type: "Button",
541
+ props: {
542
+ label: "Prev",
543
+ variant: "outlined",
544
+ flex: 1,
545
+ actions: [
546
+ {
547
+ type: "setVariable",
548
+ name: "carouselPage",
549
+ value: "{{carouselPage}} - 1",
550
+ valueMode: "expression",
551
+ },
552
+ ],
553
+ },
554
+ },
555
+ {
556
+ id: "carousel-go-next",
557
+ type: "Button",
558
+ props: {
559
+ label: "Next",
560
+ variant: "outlined",
561
+ flex: 1,
562
+ actions: [
563
+ {
564
+ type: "setVariable",
565
+ name: "carouselPage",
566
+ value: "{{carouselPage}} + 1",
567
+ valueMode: "expression",
568
+ },
569
+ ],
570
+ },
571
+ },
572
+ ],
573
+ },
574
+ {
575
+ id: "zstack-demo",
576
+ type: "ZStack",
542
577
  props: {
543
- url: "https://picsum.photos/800/400?random=20",
544
578
  height: 200,
545
- resizeMode: "cover",
579
+ borderRadius: 16,
580
+ overflow: "hidden",
581
+ marginVertical: 8,
582
+ },
583
+ children: [
584
+ {
585
+ id: "zstack-bg",
586
+ type: "Image",
587
+ props: {
588
+ url: "https://picsum.photos/800/400?random=20",
589
+ height: 200,
590
+ resizeMode: "cover",
591
+ },
592
+ },
593
+ {
594
+ id: "zstack-overlay",
595
+ type: "YStack",
596
+ props: {
597
+ flex: 1,
598
+ backgroundColor: "rgba(0,0,0,0.45)",
599
+ padding: 20,
600
+ justifyContent: "flex-end",
601
+ },
602
+ children: [
603
+ {
604
+ id: "zstack-label",
605
+ type: "Text",
606
+ props: {
607
+ content: "ZStack: layered elements",
608
+ fontSize: 18,
609
+ fontWeight: "700",
610
+ color: "#fff",
611
+ },
612
+ },
613
+ ],
614
+ },
615
+ ],
616
+ },
617
+ {
618
+ id: "hero-button",
619
+ type: "Button",
620
+ props: {
621
+ label: "Get Started",
622
+ variant: "filled",
623
+ marginVertical: 8,
624
+ actions: [
625
+ { type: "custom", function: "trackCta", variables: ["name", "plan", "goals"] },
626
+ "continue",
627
+ ],
546
628
  },
547
629
  },
548
630
  {
549
- id: "zstack-overlay",
631
+ id: "gradient-card",
550
632
  type: "YStack",
551
633
  props: {
552
- flex: 1,
553
- backgroundColor: "rgba(0,0,0,0.45)",
554
634
  padding: 20,
555
- justifyContent: "flex-end",
635
+ gap: 8,
636
+ borderRadius: 16,
637
+ overflow: "hidden",
638
+ marginVertical: 4,
639
+ backgroundGradient: {
640
+ type: "linear",
641
+ from: "topLeft",
642
+ to: "bottomRight",
643
+ stops: [
644
+ { color: "#6C63FF" },
645
+ { color: "#FF6584" },
646
+ ],
647
+ },
556
648
  },
557
649
  children: [
558
650
  {
559
- id: "zstack-label",
651
+ id: "gradient-card-title",
560
652
  type: "Text",
561
- props: {
562
- content: "ZStack: layered elements",
563
- fontSize: 18,
564
- fontWeight: "700",
565
- color: "#fff",
566
- },
653
+ props: { content: "Linear gradient", fontSize: 15, fontWeight: "700", color: "#fff" },
654
+ },
655
+ {
656
+ id: "gradient-card-body",
657
+ type: "Text",
658
+ props: { content: "topLeft → bottomRight", fontSize: 12, color: "#fff", opacity: 0.85 },
567
659
  },
568
660
  ],
569
661
  },
570
- ],
571
- },
572
- {
573
- id: "hero-button",
574
- type: "Button",
575
- props: {
576
- label: "Get Started",
577
- variant: "filled",
578
- marginVertical: 8,
579
- actions: [
580
- { type: "custom", function: "trackCta", variables: ["name", "plan", "goals"] },
581
- "continue",
582
- ],
583
- },
584
- },
585
- {
586
- id: "gradient-card",
587
- type: "YStack",
588
- props: {
589
- padding: 20,
590
- gap: 8,
591
- borderRadius: 16,
592
- overflow: "hidden",
593
- marginVertical: 4,
594
- backgroundGradient: {
595
- type: "linear",
596
- from: "topLeft",
597
- to: "bottomRight",
598
- stops: [
599
- { color: "#6C63FF" },
600
- { color: "#FF6584" },
601
- ],
662
+ {
663
+ id: "gradient-button",
664
+ type: "Button",
665
+ props: {
666
+ label: "Gradient Button",
667
+ variant: "filled",
668
+ marginVertical: 4,
669
+ backgroundGradient: {
670
+ type: "linear",
671
+ from: "left",
672
+ to: "right",
673
+ stops: [
674
+ { color: "#FF6584", position: 0 },
675
+ { color: "#6C63FF", position: 1 },
676
+ ],
677
+ },
678
+ },
602
679
  },
603
- },
604
- children: [
605
680
  {
606
- id: "gradient-card-title",
681
+ id: "states-heading",
607
682
  type: "Text",
608
- props: { content: "Linear gradient", fontSize: 15, fontWeight: "700", color: "#fff" },
683
+ props: {
684
+ content: "Button states & shadow",
685
+ fontSize: 13,
686
+ fontWeight: "700",
687
+ marginVertical: 4,
688
+ opacity: 0.5,
689
+ },
609
690
  },
610
691
  {
611
- id: "gradient-card-body",
612
- type: "Text",
613
- props: { content: "topLeft → bottomRight", fontSize: 12, color: "#fff", opacity: 0.85 },
692
+ id: "btn-shadow",
693
+ type: "Button",
694
+ props: {
695
+ label: "Elevated (shadow)",
696
+ variant: "filled",
697
+ marginVertical: 4,
698
+ backgroundColor: "#6C63FF",
699
+ shadowColor: "#6C63FF",
700
+ shadowOffset: { width: 0, height: 6 },
701
+ shadowOpacity: 0.4,
702
+ shadowRadius: 12,
703
+ elevation: 8,
704
+ },
614
705
  },
615
- ],
616
- },
617
- {
618
- id: "gradient-button",
619
- type: "Button",
620
- props: {
621
- label: "Gradient Button",
622
- variant: "filled",
623
- marginVertical: 4,
624
- backgroundGradient: {
625
- type: "linear",
626
- from: "left",
627
- to: "right",
628
- stops: [
629
- { color: "#FF6584", position: 0 },
630
- { color: "#6C63FF", position: 1 },
631
- ],
706
+ {
707
+ id: "btn-pressed",
708
+ type: "Button",
709
+ props: {
710
+ label: "Press me (hold)",
711
+ variant: "filled",
712
+ marginVertical: 4,
713
+ backgroundColor: "#10b981",
714
+ transitionDurationMs: 300,
715
+ pressedStyle: {
716
+ opacity: 0.6,
717
+ backgroundColor: "#065f46",
718
+ },
719
+ },
632
720
  },
633
- },
634
- },
635
- {
636
- id: "states-heading",
637
- type: "Text",
638
- props: {
639
- content: "Button states & shadow",
640
- fontSize: 13,
641
- fontWeight: "700",
642
- marginVertical: 4,
643
- opacity: 0.5,
644
- },
645
- },
646
- {
647
- id: "btn-shadow",
648
- type: "Button",
649
- props: {
650
- label: "Elevated (shadow)",
651
- variant: "filled",
652
- marginVertical: 4,
653
- backgroundColor: "#6C63FF",
654
- shadowColor: "#6C63FF",
655
- shadowOffset: { width: 0, height: 6 },
656
- shadowOpacity: 0.4,
657
- shadowRadius: 12,
658
- elevation: 8,
659
- },
660
- },
661
- {
662
- id: "btn-pressed",
663
- type: "Button",
664
- props: {
665
- label: "Press me (hold)",
666
- variant: "filled",
667
- marginVertical: 4,
668
- backgroundColor: "#10b981",
669
- transitionDurationMs: 300,
670
- pressedStyle: {
671
- opacity: 0.6,
672
- backgroundColor: "#065f46",
673
- },
674
- },
675
- },
676
- {
677
- id: "btn-disabled",
678
- type: "Button",
679
- props: {
680
- label: "Always disabled",
681
- variant: "filled",
682
- marginVertical: 4,
683
- actions: ["continue"],
684
- disabledWhen: {
685
- variable: "never_enabled",
686
- operator: "neq",
687
- value: "yes",
688
- },
689
- disabledStyle: {
690
- backgroundColor: "#fee2e2",
691
- color: "#b91c1c",
692
- borderRadius: 12,
693
- },
694
- },
695
- },
696
- {
697
- id: "consent-toggle",
698
- type: "Button",
699
- props: {
700
- label: "I agree to the terms",
701
- variant: "outlined",
702
- marginVertical: 8,
703
- actions: [
704
- { type: "setVariable", name: "consent_given", value: "yes", label: "Agreed" },
705
- ],
706
- },
707
- },
708
- {
709
- id: "gated-continue",
710
- type: "Button",
711
- props: {
712
- label: "Continue (gated)",
713
- variant: "filled",
714
- marginVertical: 4,
715
- actions: ["continue"],
716
- disabledWhen: {
717
- variable: "consent_given",
718
- operator: "neq",
719
- value: "yes",
720
- },
721
- transitionDurationMs: 180,
722
- shadowColor: "#000",
723
- shadowOffset: { width: 0, height: 4 },
724
- shadowOpacity: 0.18,
725
- shadowRadius: 8,
726
- elevation: 4,
727
- pressedStyle: {
728
- opacity: 0.7,
729
- backgroundColor: "#4f46e5",
730
- },
731
- disabledStyle: {
732
- backgroundColor: "#d1d5db",
733
- color: "#6b7280",
734
- shadowOpacity: 0,
735
- elevation: 0,
736
- },
737
- },
721
+ {
722
+ id: "btn-disabled",
723
+ type: "Button",
724
+ props: {
725
+ label: "Always disabled",
726
+ variant: "filled",
727
+ marginVertical: 4,
728
+ actions: ["continue"],
729
+ disabledWhen: {
730
+ variable: "never_enabled",
731
+ operator: "neq",
732
+ value: "yes",
733
+ },
734
+ disabledStyle: {
735
+ backgroundColor: "#fee2e2",
736
+ color: "#b91c1c",
737
+ borderRadius: 12,
738
+ },
739
+ },
740
+ },
741
+ {
742
+ id: "consent-toggle",
743
+ type: "Button",
744
+ props: {
745
+ label: "I agree to the terms",
746
+ variant: "outlined",
747
+ marginVertical: 8,
748
+ actions: [
749
+ { type: "setVariable", name: "consent_given", value: "yes", label: "Agreed" },
750
+ ],
751
+ },
752
+ },
753
+ {
754
+ id: "gated-continue",
755
+ type: "Button",
756
+ props: {
757
+ label: "Continue (gated)",
758
+ variant: "filled",
759
+ marginVertical: 4,
760
+ actions: ["continue"],
761
+ disabledWhen: {
762
+ variable: "consent_given",
763
+ operator: "neq",
764
+ value: "yes",
765
+ },
766
+ transitionDurationMs: 180,
767
+ shadowColor: "#000",
768
+ shadowOffset: { width: 0, height: 4 },
769
+ shadowOpacity: 0.18,
770
+ shadowRadius: 8,
771
+ elevation: 4,
772
+ pressedStyle: {
773
+ opacity: 0.7,
774
+ backgroundColor: "#4f46e5",
775
+ },
776
+ disabledStyle: {
777
+ backgroundColor: "#d1d5db",
778
+ color: "#6b7280",
779
+ shadowOpacity: 0,
780
+ elevation: 0,
781
+ },
782
+ },
783
+ },
784
+ ],
738
785
  },
739
786
  ],
740
787
  },