react-native-varia 0.2.4 → 0.4.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 (43) hide show
  1. package/lib/components/Accordion.tsx +61 -21
  2. package/lib/components/Badge.tsx +9 -0
  3. package/lib/components/Button.tsx +21 -6
  4. package/lib/components/Checkbox.tsx +22 -8
  5. package/lib/components/CircleProgress.tsx +8 -0
  6. package/lib/components/Divider.tsx +11 -4
  7. package/lib/components/Drawer.tsx +34 -25
  8. package/lib/components/Field.tsx +4 -0
  9. package/lib/components/GradientBackground.tsx +3 -0
  10. package/lib/components/GradientText.tsx +37 -11
  11. package/lib/components/IconWrapper.tsx +3 -2
  12. package/lib/components/Input.tsx +47 -20
  13. package/lib/components/Link.tsx +4 -0
  14. package/lib/components/Modal.tsx +21 -14
  15. package/lib/components/NumberInput.tsx +27 -5
  16. package/lib/components/RadioGroup.tsx +19 -6
  17. package/lib/components/ReText.tsx +4 -1
  18. package/lib/components/Select.tsx +20 -0
  19. package/lib/components/Slider.tsx +244 -134
  20. package/lib/components/Slideshow.tsx +19 -3
  21. package/lib/components/Spinner.tsx +12 -2
  22. package/lib/components/Switch.tsx +57 -26
  23. package/lib/components/Text.tsx +3 -0
  24. package/lib/components/Toast.tsx +110 -36
  25. package/lib/patterns/index.tsx +299 -79
  26. package/lib/theme/Accordion.tsx +184 -0
  27. package/lib/theme/Button.recipe.tsx +24 -7
  28. package/lib/theme/{SlidingDrawer.recipe.tsx → Drawer.recipe.tsx} +4 -6
  29. package/lib/theme/Field.recipe.tsx +45 -15
  30. package/lib/theme/GradientText.recipe.tsx +103 -34
  31. package/lib/theme/Input.recipe.tsx +14 -6
  32. package/lib/theme/Select.recipe.tsx +3 -0
  33. package/lib/theme/Slider.recipe.tsx +108 -141
  34. package/lib/theme/Spinner.recipe.tsx +4 -0
  35. package/lib/theme/Switch.recipe.tsx +19 -0
  36. package/lib/theme/Text.recipe.tsx +63 -12
  37. package/lib/theme/Toast.recipe.tsx +40 -7
  38. package/lib/varia/mixins.ts +0 -4
  39. package/lib/varia/types.ts +11 -0
  40. package/lib/varia/utils.ts +172 -14
  41. package/package.json +1 -1
  42. package/lib/components/OldSlider.tsx +0 -327
  43. package/lib/components/SlidingDrawer.tsx +0 -301
@@ -1,18 +1,36 @@
1
1
  import React from 'react'
2
- import {type LayoutChangeEvent, View} from 'react-native'
2
+ import {type LayoutChangeEvent, View, ViewStyle} from 'react-native'
3
3
  import {StyleSheet, UnistylesVariants} from 'react-native-unistyles'
4
4
  import {Gesture, GestureDetector} from 'react-native-gesture-handler'
5
5
  import Animated, {
6
- useAnimatedReaction,
7
6
  useAnimatedStyle,
8
7
  useSharedValue,
9
8
  } from 'react-native-reanimated'
10
9
  import {runOnJS} from 'react-native-worklets'
11
10
  import {SliderStyles, SliderDefaultVariants} from '../theme/Slider.recipe'
12
11
  import {PalettesWithNestedKeys} from '../style/varia/types'
12
+ import {getCompoundVariantValue} from '../style/varia/utils'
13
+
14
+ function throttle<T extends (...args: any[]) => any>(
15
+ func: T,
16
+ limit = 50,
17
+ ): (...args: Parameters<T>) => void {
18
+ let inThrottle = false
19
+ return (...args: Parameters<T>) => {
20
+ if (!inThrottle) {
21
+ func(...(args as Parameters<T>))
22
+ inThrottle = true
23
+ setTimeout(() => {
24
+ inThrottle = false
25
+ }, limit)
26
+ }
27
+ }
28
+ }
13
29
 
14
30
  type SliderVariants = UnistylesVariants<typeof SliderStyles>
15
31
 
32
+ const AnimatedView = Animated.createAnimatedComponent(View)
33
+
16
34
  type ThumbStyleExtended = ReturnType<typeof SliderStyles.thumb> & {
17
35
  width: number
18
36
  height: number
@@ -23,7 +41,6 @@ type SliderProps = SliderVariants & {
23
41
  thickness?: number
24
42
  minimumTrackThickness?: number
25
43
  minimumTrackColor?: string
26
- displayStepsOnMinimumTrack?: boolean
27
44
  thumbSize?: {
28
45
  width: number
29
46
  height: number
@@ -33,26 +50,23 @@ type SliderProps = SliderVariants & {
33
50
  value?: number
34
51
  onValueChange?: (value: number) => void
35
52
  onSlidingComplete?: (value: number) => void
53
+ flex?: ViewStyle['flex']
54
+ alignSelf?: ViewStyle['alignSelf']
36
55
  }
37
56
 
38
57
  const Slider = ({
39
58
  colorPalette = 'accent',
40
59
  variant = SliderDefaultVariants.variant,
41
60
  size = SliderDefaultVariants.size,
42
- displayStepsOnMinimumTrack = false,
43
61
  thumbChildren: ThumbChildren,
44
62
  axis = 'x',
45
63
  value = 0,
46
64
  steps,
47
65
  onValueChange,
48
66
  onSlidingComplete,
67
+ flex = 0,
68
+ alignSelf = 'auto',
49
69
  }: SliderProps) => {
50
- // let styles
51
- // if (axis === 'x') {
52
- // styles = stylesX
53
- // } else {
54
- // styles = stylesY
55
- // }
56
70
  SliderStyles.useVariants({
57
71
  size,
58
72
  variant,
@@ -61,20 +75,36 @@ const Slider = ({
61
75
  styles.useVariants({
62
76
  axis,
63
77
  })
64
- const thumbStyle = SliderStyles.thumb(colorPalette) as ThumbStyleExtended
65
78
 
66
- const halfSize =
67
- axis === 'x' ? (thumbStyle.width ?? 0) / 2 : (thumbStyle.height ?? 0) / 2
79
+ const throttledOnValueChange = React.useMemo(() => {
80
+ if (!onValueChange) return undefined
81
+ return throttle(onValueChange, 50)
82
+ }, [onValueChange])
83
+
84
+ // const thumbStyle = SliderStyles.thumb(colorPalette) as ThumbStyleExtended
85
+ // const thumbWidth = getVariantValue(SliderStyles.thumb(colorPalette), 'size', size, 'width', true)
86
+ const thumbWidth = getCompoundVariantValue(
87
+ SliderStyles.thumb(colorPalette),
88
+ {axis, size},
89
+ 'width',
90
+ )
91
+ const thumbHeight = getCompoundVariantValue(
92
+ SliderStyles.thumb(colorPalette),
93
+ {axis, size},
94
+ 'height',
95
+ )
96
+ // const thumbHeight = getVariantValue(SliderStyles.thumb(colorPalette), 'size', size, 'height', true)
97
+
98
+ const halfSize = ((axis === 'x' ? thumbWidth : thumbHeight) ?? 0) / 2
68
99
  const context = useSharedValue({x: 0})
69
100
  const translate = useSharedValue(value)
70
101
  const trackLength = useSharedValue(0)
71
102
  const isInsideChild = useSharedValue(false)
72
103
 
73
- // const handleTrackLayout = (event: LayoutChangeEvent) => {
74
- // const {width, height} = event.nativeEvent.layout
75
- // console.log('🚀 ~ handleTrackLayout ~ width:', width)
76
- // trackLength.value = axis === 'x' ? width : height
77
- // }
104
+ const handleTrackLayout = (event: LayoutChangeEvent) => {
105
+ const {width, height} = event.nativeEvent.layout
106
+ trackLength.value = axis === 'x' ? width : height
107
+ }
78
108
 
79
109
  const slideGesture = Gesture.Pan()
80
110
  .onTouchesDown(() => {
@@ -84,7 +114,6 @@ const Slider = ({
84
114
  context.value.x = translate.value
85
115
  })
86
116
  .onUpdate(e => {
87
- // console.log('e', e.translationX)
88
117
  const stepLength = steps ? trackLength.value / steps : 1
89
118
  const delta = axis === 'y' ? -e.translationY : e.translationX
90
119
 
@@ -101,10 +130,10 @@ const Slider = ({
101
130
 
102
131
  if (steps) {
103
132
  const stepIndex = Math.round(snappedValue / stepLength)
104
- onValueChange && runOnJS(onValueChange)(stepIndex)
133
+ throttledOnValueChange && runOnJS(throttledOnValueChange)(stepIndex)
105
134
  } else {
106
- onValueChange &&
107
- runOnJS(onValueChange)(
135
+ throttledOnValueChange &&
136
+ runOnJS(throttledOnValueChange)(
108
137
  Math.round((snappedValue / trackLength.value) * 100) / 100,
109
138
  )
110
139
  }
@@ -121,6 +150,7 @@ const Slider = ({
121
150
  .onFinalize(() => {
122
151
  isInsideChild.value = false
123
152
  })
153
+
124
154
  const tapGesture = Gesture.Tap()
125
155
  .onBegin(e => {
126
156
  if (isInsideChild.value) {
@@ -156,58 +186,143 @@ const Slider = ({
156
186
  })
157
187
  .simultaneousWithExternalGesture(slideGesture)
158
188
 
159
- const animatedTrack = useAnimatedStyle(() => ({
160
- [axis === 'y' ? 'height' : 'width']: translate.value + halfSize,
161
- }))
189
+ const trackPan = Gesture.Pan()
190
+ .onBegin(e => {
191
+ if (trackLength.value <= 0) return
162
192
 
163
- const opacityTrack = steps !== undefined && displayStepsOnMinimumTrack
193
+ const tapPosition = axis === 'x' ? e.x : e.y
194
+ const stepLength = steps ? trackLength.value / steps : 1
195
+
196
+ const rawValue =
197
+ axis === 'y'
198
+ ? Math.max(
199
+ 0,
200
+ Math.min(trackLength.value - tapPosition, trackLength.value),
201
+ )
202
+ : Math.max(0, Math.min(tapPosition, trackLength.value))
203
+
204
+ const snappedValue = steps
205
+ ? Math.round(rawValue / stepLength) * stepLength
206
+ : rawValue
207
+
208
+ context.value.x = snappedValue
209
+ translate.value = snappedValue
210
+
211
+ if (steps) {
212
+ const stepIndex = Math.round(snappedValue / stepLength)
213
+ onValueChange && runOnJS(onValueChange)(stepIndex)
214
+ } else {
215
+ const normalizedValue =
216
+ Math.round((snappedValue / trackLength.value) * 100) / 100
217
+ onValueChange && runOnJS(onValueChange)(normalizedValue)
218
+ }
219
+ })
220
+ .onUpdate(e => {
221
+ if (trackLength.value <= 0) return
222
+
223
+ const stepLength = steps ? trackLength.value / steps : 1
224
+ const delta = axis === 'y' ? -e.translationY : e.translationX
225
+
226
+ const rawValue = Math.max(
227
+ 0,
228
+ Math.min(context.value.x + delta, trackLength.value),
229
+ )
230
+
231
+ if (steps) {
232
+ const snappedValue = Math.round(rawValue / stepLength) * stepLength
233
+ translate.value = snappedValue
234
+
235
+ const stepIndex = Math.round(snappedValue / stepLength)
236
+ throttledOnValueChange && runOnJS(throttledOnValueChange)(stepIndex)
237
+ } else {
238
+ translate.value = rawValue
239
+ throttledOnValueChange &&
240
+ runOnJS(throttledOnValueChange)(
241
+ Math.round((rawValue / trackLength.value) * 100) / 100,
242
+ )
243
+ }
244
+ })
245
+ .onEnd(() => {
246
+ const stepLength = steps ? trackLength.value / steps : 1
247
+
248
+ const snappedValue = steps
249
+ ? Math.round(translate.value / stepLength)
250
+ : translate.value / trackLength.value
251
+
252
+ onSlidingComplete && runOnJS(onSlidingComplete)(snappedValue)
253
+ })
254
+
255
+ const animatedTrack = useAnimatedStyle(() => {
256
+ return {
257
+ [axis === 'y' ? 'height' : 'width']: translate.value + halfSize,
258
+ }
259
+ })
260
+
261
+ const animatedThumb = useAnimatedStyle(() => {
262
+ if (axis === 'x') {
263
+ return {
264
+ transform: [{translateX: translate.value - halfSize}],
265
+ }
266
+ } else {
267
+ const translateY = trackLength.value - translate.value - halfSize
268
+ return {
269
+ transform: [{translateY}],
270
+ }
271
+ }
272
+ })
164
273
 
165
274
  return (
166
275
  <View
167
276
  style={[
168
- styles.container(halfSize),
277
+ styles.container(halfSize, flex, alignSelf),
169
278
  SliderStyles.container(colorPalette),
170
279
  ]}>
171
280
  {axis === 'x' && <View style={{width: halfSize}} />}
172
- <GestureDetector gesture={tapGesture}>
281
+ <GestureDetector gesture={Gesture.Simultaneous(trackPan, tapGesture)}>
173
282
  <View
174
283
  style={[
175
284
  styles.maximumTrack(),
176
285
  SliderStyles.maximumTrack(colorPalette),
177
286
  ]}
178
- // onLayout={handleTrackLayout}
179
- >
180
- {steps && (
181
- <View style={styles.steps}>
182
- {Array.from({length: steps + 1}, (_, index) => index).map(
183
- (_, i) => (
184
- <View
185
- key={i}
186
- style={[
187
- styles.step(i, steps),
188
- SliderStyles.step(colorPalette),
189
- ]}
190
- />
191
- ),
192
- )}
193
- </View>
194
- )}
195
- <Animated.View
287
+ onLayout={handleTrackLayout}>
288
+ <AnimatedView
196
289
  style={[
197
290
  styles.minimumTrack(halfSize),
198
- SliderStyles.minimumTrack(colorPalette, opacityTrack),
291
+ SliderStyles.minimumTrack(colorPalette),
199
292
  animatedTrack,
200
- ]}>
201
- <GestureDetector gesture={slideGesture}>
202
- <View
203
- style={[
204
- SliderStyles.thumb(colorPalette),
205
- styles.thumb(halfSize),
206
- ]}>
207
- {ThumbChildren || null}
293
+ ]}
294
+ />
295
+
296
+ {steps && (
297
+ <View style={[styles.stepsOverlay]} pointerEvents="none">
298
+ <View style={styles.steps}>
299
+ {Array.from({length: steps + 1}, (_, index) => index).map(
300
+ (_, i) => (
301
+ <View
302
+ key={i}
303
+ style={[
304
+ styles.step(i, steps),
305
+ SliderStyles.step(colorPalette),
306
+ ]}
307
+ />
308
+ ),
309
+ )}
208
310
  </View>
209
- </GestureDetector>
210
- </Animated.View>
311
+ </View>
312
+ )}
313
+ <GestureDetector gesture={slideGesture}>
314
+ <View style={styles.thumbContainerFull}>
315
+ <AnimatedView style={[animatedThumb, {flex: 1}]}>
316
+ <View
317
+ style={[
318
+ SliderStyles.thumb(colorPalette),
319
+ styles.thumb(halfSize),
320
+ ]}>
321
+ {ThumbChildren || null}
322
+ </View>
323
+ </AnimatedView>
324
+ </View>
325
+ </GestureDetector>
211
326
  </View>
212
327
  </GestureDetector>
213
328
  {axis === 'y' && <View style={{height: halfSize}} />}
@@ -216,18 +331,25 @@ const Slider = ({
216
331
  }
217
332
 
218
333
  const styles = StyleSheet.create(theme => ({
219
- container: (halfSize: number) => ({
334
+ container: (
335
+ halfSize: number,
336
+ flex: ViewStyle['flex'],
337
+ alignSelf: ViewStyle['alignSelf'],
338
+ ) => ({
339
+ flex,
340
+ alignSelf,
341
+ overflow: 'hidden',
342
+ // flexBasis: 'auto',
220
343
  variants: {
221
344
  axis: {
222
345
  x: {
223
- maxWidth: 'auto',
224
- width: '100%',
346
+ // maxWidth: 'auto',
225
347
  paddingTop: 0,
226
348
  paddingRight: halfSize,
227
349
  flexDirection: 'row',
228
350
  },
229
351
  y: {
230
- maxHeight: 'auto',
352
+ // maxHeight: 'auto',
231
353
  height: '100%',
232
354
  paddingTop: halfSize,
233
355
  paddingRight: 0,
@@ -235,84 +357,119 @@ const styles = StyleSheet.create(theme => ({
235
357
  },
236
358
  },
237
359
  },
360
+ _web: {
361
+ _classNames: 'slider-container-base',
362
+ flex: flex === 0 ? undefined : flex,
363
+ },
238
364
  }),
239
365
  maximumTrack: () => ({
240
366
  flex: 1,
241
- justifyContent: 'center',
242
367
  position: 'relative',
368
+ overflow: 'visible',
369
+ flexBasis: 'auto',
243
370
  variants: {
244
371
  axis: {
245
- x: {},
372
+ x: {
373
+ justifyContent: 'center',
374
+ },
246
375
  y: {
247
- alignItems: 'center',
376
+ justifyContent: 'flex-end',
248
377
  },
249
378
  },
250
379
  },
380
+ _web: {
381
+ _classNames: 'slider-maximun-track-base',
382
+ },
251
383
  }),
252
384
  minimumTrack: (halfSize: number) => ({
385
+ flexBasis: 'auto',
253
386
  variants: {
254
387
  axis: {
255
388
  x: {
389
+ flex: 1,
390
+ marginLeft: halfSize * -1,
256
391
  width: '100%',
257
- left: halfSize * -1,
258
392
  bottom: 'auto',
259
393
  paddingBottom: 0,
260
394
  paddingLeft: halfSize,
261
- borderBottomLeftRadius: 20,
262
- borderBottomRightRadius: 0,
263
- borderTopLeftRadius: 20,
264
395
  justifyContent: 'center',
396
+ alignItems: 'flex-end',
265
397
  },
266
398
  y: {
267
- position: 'absolute',
268
399
  height: '100%',
269
- left: 'auto',
270
- bottom: halfSize * -1,
271
400
  paddingBottom: halfSize,
401
+ marginBottom: halfSize * -1,
272
402
  paddingLeft: 0,
273
- borderBottomLeftRadius: 20,
274
- borderBottomRightRadius: 20,
275
- borderTopLeftRadius: 0,
276
- alignItems: 'center',
403
+ alignItems: 'flex-start',
277
404
  },
278
405
  },
279
406
  },
407
+ _web: {
408
+ _classNames: 'slider-minimum-track-base',
409
+ },
280
410
  }),
281
- thumb: halfSize => ({
282
- borderRadius: 25,
411
+ thumbContainerFull: {
283
412
  position: 'absolute',
413
+ left: 0,
414
+ right: 0,
415
+ top: 0,
416
+ bottom: 0,
417
+ zIndex: 2,
418
+ _web: {
419
+ _classNames: 'thumb-container-full-base',
420
+ },
421
+ },
422
+ thumb: halfSize => ({
284
423
  variants: {
285
424
  axis: {
286
425
  x: {
287
- right: 0,
288
- zIndex: 2,
289
- transform: [{translateX: '50%'}],
426
+ height: '100%',
427
+ justifyContent: 'center',
428
+ alignItems: 'center',
290
429
  },
291
430
  y: {
292
- top: 0,
293
- zIndex: 2,
294
- transform: [{translateY: halfSize * -1}],
431
+ width: '100%',
432
+ justifyContent: 'center',
433
+ alignItems: 'center',
295
434
  },
296
435
  },
297
436
  },
437
+ _web: {
438
+ _classNames: 'slider-thumb-base',
439
+ },
298
440
  }),
441
+
442
+ stepsOverlay: {
443
+ position: 'absolute',
444
+ left: 0,
445
+ right: 0,
446
+ top: 0,
447
+ bottom: 0,
448
+ zIndex: 1,
449
+ _web: {
450
+ _classNames: 'slider-steps-overlay-base',
451
+ },
452
+ },
299
453
  steps: {
300
454
  width: '100%',
301
455
  height: '100%',
302
456
  justifyContent: 'space-between',
303
457
  alignItems: 'center',
304
458
  zIndex: 0,
459
+ position: 'absolute',
305
460
  variants: {
306
461
  axis: {
307
462
  x: {
308
463
  flexDirection: 'row',
309
- position: 'absolute',
310
464
  },
311
465
  y: {
312
466
  flexDirection: 'column',
313
467
  },
314
468
  },
315
469
  },
470
+ _web: {
471
+ _classNames: 'slider-steps-base',
472
+ },
316
473
  },
317
474
  step: (index, length) => ({
318
475
  backgroundColor:
@@ -329,57 +486,10 @@ const styles = StyleSheet.create(theme => ({
329
486
  },
330
487
  },
331
488
  },
489
+ _web: {
490
+ _classNames: 'slider-step-base',
491
+ },
332
492
  }),
333
493
  }))
334
- // const stylesY = StyleSheet.create(theme => ({
335
- // container: halfSize => ({
336
- // maxHeight: 'auto',
337
- // height: '100%',
338
- // paddingTop: halfSize,
339
- // paddingRight: 0,
340
- // flexDirection: 'column',
341
- // }),
342
- // maximumTrack: () => ({
343
- // flex: 1,
344
- // justifyContent: 'center',
345
- // alignItems: 'center',
346
- // position: 'relative',
347
- // // borderWidth: 1,
348
- // // borderColor: 'yellow',
349
- // }),
350
- // minimumTrack: halfSize => ({
351
- // position: 'absolute',
352
- // height: '100%',
353
- // left: 'auto',
354
- // bottom: halfSize * -1,
355
- // paddingBottom: halfSize,
356
- // paddingLeft: 0,
357
- // borderBottomLeftRadius: 20,
358
- // borderBottomRightRadius: 20,
359
- // borderTopLeftRadius: 0,
360
- // alignItems: 'center',
361
- // }),
362
- // thumb: halfSize => ({
363
- // borderRadius: 25,
364
- // position: 'absolute',
365
- // top: 0,
366
- // zIndex: 2,
367
- // transform: [{translateY: halfSize * -1}],
368
- // }),
369
- // steps: {
370
- // width: '100%',
371
- // height: '100%',
372
- // justifyContent: 'space-between',
373
- // alignItems: 'center',
374
- // zIndex: 0,
375
- // flexDirection: 'column',
376
- // },
377
- // step: (index, length) => ({
378
- // width: '100%',
379
- // height: 1,
380
- // backgroundColor:
381
- // index === 0 || index === length ? 'transparent' : theme.colors.fg.default,
382
- // }),
383
- // }))
384
494
 
385
495
  export default Slider
@@ -18,6 +18,7 @@ export type SlideshowRef = {
18
18
  handlePrev: () => void | null
19
19
  }
20
20
 
21
+ const AnimatedView = Animated.createAnimatedComponent(View)
21
22
  type SlideshowVariants = UnistylesVariants<typeof SlideshowStyles>
22
23
 
23
24
  type Axis = 'x' | 'y'
@@ -174,7 +175,7 @@ const Slideshow = ({
174
175
  setContainerWidth(e.nativeEvent.layout.width)
175
176
  setContainerHeight(e.nativeEvent.layout.height)
176
177
  }}>
177
- <Animated.View
178
+ <AnimatedView
178
179
  style={[
179
180
  styles.slidesContainer(`${NUM_PAGES * 100}%`, isHorizontal),
180
181
  animatedStyle,
@@ -189,7 +190,7 @@ const Slideshow = ({
189
190
  {Slide}
190
191
  </View>
191
192
  ))}
192
- </Animated.View>
193
+ </AnimatedView>
193
194
  </View>
194
195
  </GestureDetector>
195
196
  </View>
@@ -201,15 +202,24 @@ export default Slideshow
201
202
  const styles = StyleSheet.create({
202
203
  flex: flex => ({
203
204
  flex,
205
+ flexBasis: 'auto',
204
206
  flexDirection: 'row',
207
+ alignSelf: 'stretch',
208
+ _web: {
209
+ _classNames: 'slideshow-container-flex-base',
210
+ },
205
211
  }),
206
212
 
207
213
  container: () => ({
214
+ flexBasis: 'auto',
208
215
  width: '100%',
209
- height: '100%',
216
+ maxHeight: '100%',
210
217
  overflow: 'hidden',
211
218
  justifyContent: 'flex-start',
212
219
  alignItems: 'flex-start',
220
+ _web: {
221
+ _classNames: 'slideshow-container-base',
222
+ },
213
223
  }),
214
224
 
215
225
  slidesContainer: (size, isHorizontal) => ({
@@ -217,6 +227,9 @@ const styles = StyleSheet.create({
217
227
  width: isHorizontal ? size : '100%',
218
228
  minHeight: isHorizontal ? '100%' : size,
219
229
  flex: 1,
230
+ _web: {
231
+ _classNames: 'slideshow-container-slides-container-base',
232
+ },
220
233
  }),
221
234
 
222
235
  slide: (size, isHorizontal) => ({
@@ -225,5 +238,8 @@ const styles = StyleSheet.create({
225
238
  height: isHorizontal ? '100%' : size,
226
239
  justifyContent: 'center',
227
240
  alignItems: 'center',
241
+ _web: {
242
+ _classNames: 'slideshow-container-slide-base',
243
+ },
228
244
  }),
229
245
  })
@@ -11,7 +11,7 @@ import {
11
11
  ThemeColors,
12
12
  } from '../style/varia/types'
13
13
  import {SpinnerTokens} from '../theme/Spinner.recipe'
14
- import {resolveColor} from '../style/varia/utils'
14
+ import {getVariantValue, resolveColor} from '../style/varia/utils'
15
15
  import {SpinnerStyles} from '../theme/Spinner.recipe'
16
16
 
17
17
  type SpinnerVariants = UnistylesVariants<typeof SpinnerStyles>
@@ -39,10 +39,20 @@ const BaseSpinner = ({
39
39
  size,
40
40
  })
41
41
 
42
+ // console.log('color', color)
43
+
44
+ const resolvedSize = getVariantValue(
45
+ SpinnerStyles.base,
46
+ 'size',
47
+ size,
48
+ 'width',
49
+ )
50
+
42
51
  return (
43
52
  <ActivityIndicator
53
+ testID="spinner"
44
54
  color={resolvedColor}
45
- size={SpinnerStyles.base.width}
55
+ size={resolvedSize}
46
56
  {...props}
47
57
  style={[style && style, mixins && mixins]}
48
58
  />