@hero-design/rn 8.74.0 → 8.75.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 (30) hide show
  1. package/.turbo/turbo-build.log +2 -3
  2. package/CHANGELOG.md +14 -0
  3. package/assets/fonts/hero-icons-mobile.ttf +0 -0
  4. package/es/index.js +635 -522
  5. package/lib/assets/fonts/hero-icons-mobile.ttf +0 -0
  6. package/lib/index.js +635 -521
  7. package/package.json +4 -4
  8. package/src/components/BottomSheet/index.tsx +13 -14
  9. package/src/components/FloatingIsland/StyledFloatingIsland.tsx +32 -0
  10. package/src/components/FloatingIsland/__tests__/__snapshots__/index.spec.tsx.snap +561 -0
  11. package/src/components/FloatingIsland/__tests__/index.spec.tsx +67 -0
  12. package/src/components/FloatingIsland/index.tsx +94 -0
  13. package/src/components/Icon/HeroIcon/glyphMap.json +1 -1
  14. package/src/components/Icon/IconList.ts +4 -0
  15. package/src/index.ts +2 -0
  16. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +30 -0
  17. package/src/theme/components/floatingIsland.ts +31 -0
  18. package/src/theme/getTheme.ts +3 -0
  19. package/stats/8.74.1/rn-stats.html +4842 -0
  20. package/stats/8.75.0/rn-stats.html +4844 -0
  21. package/types/components/FloatingIsland/StyledFloatingIsland.d.ts +19 -0
  22. package/types/components/FloatingIsland/index.d.ts +23 -0
  23. package/types/components/Icon/IconList.d.ts +1 -1
  24. package/types/components/Icon/index.d.ts +1 -1
  25. package/types/components/Icon/utils.d.ts +1 -1
  26. package/types/components/Search/utils.d.ts +2 -2
  27. package/types/components/TextInput/index.d.ts +3 -3
  28. package/types/index.d.ts +2 -1
  29. package/types/theme/components/floatingIsland.d.ts +32 -0
  30. package/types/theme/getTheme.d.ts +2 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "8.74.0",
3
+ "version": "8.75.0",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -32,7 +32,7 @@
32
32
  "@react-native-community/datetimepicker": "^3.5.2 || ^7.6.1",
33
33
  "@react-native-community/slider": "^4.5.1",
34
34
  "react": "18.2.0",
35
- "react-native": "^0.73.8",
35
+ "react-native": "^0.74.5",
36
36
  "react-native-gesture-handler": "^2.15.0",
37
37
  "react-native-linear-gradient": "^2.8.3",
38
38
  "react-native-pager-view": "^6.2.1",
@@ -67,7 +67,7 @@
67
67
  "@types/react": "^18.2.0",
68
68
  "@types/react-native-vector-icons": "^6.4.10",
69
69
  "babel-plugin-inline-import": "^3.0.0",
70
- "babel-preset-expo": "9.5.2",
70
+ "babel-preset-expo": "^11.0.15",
71
71
  "core-js": "^3.33.0",
72
72
  "eslint": "^8.56.0",
73
73
  "eslint-config-hd": "8.42.4",
@@ -78,7 +78,7 @@
78
78
  "prettier-config-hd": "8.42.4",
79
79
  "react": "18.2.0",
80
80
  "react-dom": "^18.2.0",
81
- "react-native": "0.73.8",
81
+ "react-native": "^0.74.5",
82
82
  "react-native-gesture-handler": "^2.15.0",
83
83
  "react-native-linear-gradient": "2.8.3",
84
84
  "react-native-pager-view": "^6.2.1",
@@ -115,24 +115,18 @@ const BottomSheet = ({
115
115
  const animatedValue = useRef(new Animated.Value(open ? 0 : 1));
116
116
  const [internalShowDivider, setInternalShowDivider] =
117
117
  useState<boolean>(showDivider);
118
+ const canCallOnDismiss = useRef(false);
118
119
 
119
120
  useEffect(() => {
121
+ // Prevent calling onDismiss when the component has not yet opened
122
+ if (open && !canCallOnDismiss.current) {
123
+ canCallOnDismiss.current = true;
124
+ }
125
+
120
126
  // Show the modal before the open animation start
121
127
  if (open && !visible) {
122
128
  setVisibility(open);
123
129
  }
124
-
125
- // Delay closing the modal until after the closing animation end
126
- animatedValue.current.removeAllListeners();
127
- animatedValue.current.addListener(({ value }) => {
128
- const endValueOfTransition = open ? 1 : 0;
129
- if (endValueOfTransition === 0 && value === endValueOfTransition) {
130
- setVisibility(false);
131
- onDismiss?.();
132
- }
133
- });
134
-
135
- return () => animatedValue.current.removeAllListeners();
136
130
  }, [open]);
137
131
 
138
132
  // Animation
@@ -143,9 +137,14 @@ const BottomSheet = ({
143
137
  useNativeDriver: true,
144
138
  });
145
139
 
146
- animation.start(onAnimationEnd);
140
+ animation.start(() => {
141
+ if (!open && canCallOnDismiss.current) {
142
+ setVisibility(false);
143
+ onDismiss?.();
144
+ }
147
145
 
148
- return () => animation.stop();
146
+ onAnimationEnd?.();
147
+ });
149
148
  }, [open]);
150
149
 
151
150
  const interpolateY = animatedValue.current.interpolate({
@@ -0,0 +1,32 @@
1
+ import styled from '@emotion/native';
2
+ import Box from '../Box';
3
+ import Icon from '../Icon';
4
+
5
+ const StyledWrapper = styled.TouchableOpacity(({ theme }) => ({
6
+ alignSelf: 'flex-start',
7
+ position: 'absolute',
8
+ left: '50%',
9
+ zIndex: 9999,
10
+ flexDirection: 'row',
11
+ justifyContent: 'center',
12
+ alignItems: 'center',
13
+ padding: theme.__hd__.floatingIsland.space.wrapperPadding,
14
+ borderRadius: theme.__hd__.floatingIsland.radii.wrapper,
15
+ backgroundColor: theme.__hd__.floatingIsland.colors.wrapperBackground,
16
+ top: theme.__hd__.floatingIsland.space.wrapperTop,
17
+ ...theme.__hd__.floatingIsland.shadows.wrapper,
18
+ }));
19
+
20
+ const StyledPrefixWrapper = styled(Box)(({ theme }) => ({
21
+ marginRight: theme.__hd__.floatingIsland.space.prefixMarginRight,
22
+ }));
23
+
24
+ const StyledSuffixWrapper = styled(Box)(({ theme }) => ({
25
+ marginLeft: theme.__hd__.floatingIsland.space.suffixMarginLeft,
26
+ }));
27
+
28
+ const StyledIcon = styled(Icon)(({ theme }) => ({
29
+ padding: theme.__hd__.floatingIsland.space.iconPadding,
30
+ }));
31
+
32
+ export { StyledWrapper, StyledPrefixWrapper, StyledSuffixWrapper, StyledIcon };
@@ -0,0 +1,561 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`FloatingIsland renders correctly 1`] = `
4
+ <View
5
+ style={
6
+ {
7
+ "flex": 1,
8
+ }
9
+ }
10
+ >
11
+ <View
12
+ accessibilityState={
13
+ {
14
+ "busy": undefined,
15
+ "checked": undefined,
16
+ "disabled": true,
17
+ "expanded": undefined,
18
+ "selected": undefined,
19
+ }
20
+ }
21
+ accessibilityValue={
22
+ {
23
+ "max": undefined,
24
+ "min": undefined,
25
+ "now": undefined,
26
+ "text": undefined,
27
+ }
28
+ }
29
+ accessible={true}
30
+ collapsable={false}
31
+ focusable={false}
32
+ onClick={[Function]}
33
+ onLayout={[Function]}
34
+ onResponderGrant={[Function]}
35
+ onResponderMove={[Function]}
36
+ onResponderRelease={[Function]}
37
+ onResponderTerminate={[Function]}
38
+ onResponderTerminationRequest={[Function]}
39
+ onStartShouldSetResponder={[Function]}
40
+ style={
41
+ {
42
+ "alignItems": "center",
43
+ "alignSelf": "flex-start",
44
+ "backgroundColor": "#ffffff",
45
+ "borderRadius": 999,
46
+ "elevation": 3,
47
+ "flexDirection": "row",
48
+ "justifyContent": "center",
49
+ "left": "50%",
50
+ "opacity": 1,
51
+ "padding": 8,
52
+ "position": "absolute",
53
+ "shadowColor": "#001f23",
54
+ "shadowOffset": {
55
+ "height": 2,
56
+ "width": 0,
57
+ },
58
+ "shadowOpacity": 0.12,
59
+ "shadowRadius": 4,
60
+ "top": 12,
61
+ "zIndex": 9999,
62
+ }
63
+ }
64
+ >
65
+ <Text
66
+ allowFontScaling={false}
67
+ style={
68
+ [
69
+ {
70
+ "color": "#001f23",
71
+ "fontFamily": "BeVietnamPro-Regular",
72
+ "fontSize": 16,
73
+ "letterSpacing": 0.48,
74
+ "lineHeight": 24,
75
+ },
76
+ undefined,
77
+ ]
78
+ }
79
+ themeIntent="body"
80
+ themeTypeface="neutral"
81
+ themeVariant="regular"
82
+ >
83
+ Content
84
+ </Text>
85
+ </View>
86
+ <View
87
+ pointerEvents="box-none"
88
+ position="bottom"
89
+ style={
90
+ [
91
+ {
92
+ "bottom": 0,
93
+ "elevation": 9999,
94
+ "flexDirection": "column-reverse",
95
+ "left": 0,
96
+ "paddingHorizontal": 24,
97
+ "paddingVertical": 16,
98
+ "position": "absolute",
99
+ "right": 0,
100
+ "top": 0,
101
+ },
102
+ undefined,
103
+ ]
104
+ }
105
+ />
106
+ </View>
107
+ `;
108
+
109
+ exports[`FloatingIsland renders icons as prefix and suffix correctly 1`] = `
110
+ <View
111
+ style={
112
+ {
113
+ "flex": 1,
114
+ }
115
+ }
116
+ >
117
+ <View
118
+ accessibilityState={
119
+ {
120
+ "busy": undefined,
121
+ "checked": undefined,
122
+ "disabled": true,
123
+ "expanded": undefined,
124
+ "selected": undefined,
125
+ }
126
+ }
127
+ accessibilityValue={
128
+ {
129
+ "max": undefined,
130
+ "min": undefined,
131
+ "now": undefined,
132
+ "text": undefined,
133
+ }
134
+ }
135
+ accessible={true}
136
+ collapsable={false}
137
+ focusable={false}
138
+ onClick={[Function]}
139
+ onLayout={[Function]}
140
+ onResponderGrant={[Function]}
141
+ onResponderMove={[Function]}
142
+ onResponderRelease={[Function]}
143
+ onResponderTerminate={[Function]}
144
+ onResponderTerminationRequest={[Function]}
145
+ onStartShouldSetResponder={[Function]}
146
+ style={
147
+ {
148
+ "alignItems": "center",
149
+ "alignSelf": "flex-start",
150
+ "backgroundColor": "#ffffff",
151
+ "borderRadius": 999,
152
+ "elevation": 3,
153
+ "flexDirection": "row",
154
+ "justifyContent": "center",
155
+ "left": "50%",
156
+ "opacity": 1,
157
+ "padding": 8,
158
+ "position": "absolute",
159
+ "shadowColor": "#001f23",
160
+ "shadowOffset": {
161
+ "height": 2,
162
+ "width": 0,
163
+ },
164
+ "shadowOpacity": 0.12,
165
+ "shadowRadius": 4,
166
+ "top": 12,
167
+ "zIndex": 9999,
168
+ }
169
+ }
170
+ >
171
+ <View
172
+ style={
173
+ [
174
+ {},
175
+ [
176
+ {
177
+ "marginRight": 8,
178
+ },
179
+ undefined,
180
+ ],
181
+ ]
182
+ }
183
+ >
184
+ <HeroIcon
185
+ name="calendar"
186
+ style={
187
+ [
188
+ {
189
+ "color": "#001f23",
190
+ "fontSize": 20,
191
+ },
192
+ [
193
+ {
194
+ "padding": 12,
195
+ },
196
+ undefined,
197
+ ],
198
+ ]
199
+ }
200
+ testID="floating-island-prefix-icon"
201
+ themeIntent="text"
202
+ themeSize="small"
203
+ />
204
+ </View>
205
+ <Text
206
+ allowFontScaling={false}
207
+ style={
208
+ [
209
+ {
210
+ "color": "#001f23",
211
+ "fontFamily": "BeVietnamPro-Regular",
212
+ "fontSize": 16,
213
+ "letterSpacing": 0.48,
214
+ "lineHeight": 24,
215
+ },
216
+ undefined,
217
+ ]
218
+ }
219
+ themeIntent="body"
220
+ themeTypeface="neutral"
221
+ themeVariant="regular"
222
+ >
223
+ Content
224
+ </Text>
225
+ <View
226
+ style={
227
+ [
228
+ {},
229
+ [
230
+ {
231
+ "marginLeft": 16,
232
+ },
233
+ undefined,
234
+ ],
235
+ ]
236
+ }
237
+ >
238
+ <HeroIcon
239
+ name="cancel"
240
+ style={
241
+ [
242
+ {
243
+ "color": "#001f23",
244
+ "fontSize": 20,
245
+ },
246
+ [
247
+ {
248
+ "padding": 12,
249
+ },
250
+ undefined,
251
+ ],
252
+ ]
253
+ }
254
+ testID="floating-island-suffix-icon"
255
+ themeIntent="text"
256
+ themeSize="small"
257
+ />
258
+ </View>
259
+ </View>
260
+ <View
261
+ pointerEvents="box-none"
262
+ position="bottom"
263
+ style={
264
+ [
265
+ {
266
+ "bottom": 0,
267
+ "elevation": 9999,
268
+ "flexDirection": "column-reverse",
269
+ "left": 0,
270
+ "paddingHorizontal": 24,
271
+ "paddingVertical": 16,
272
+ "position": "absolute",
273
+ "right": 0,
274
+ "top": 0,
275
+ },
276
+ undefined,
277
+ ]
278
+ }
279
+ />
280
+ </View>
281
+ `;
282
+
283
+ exports[`FloatingIsland renders prefix correctly 1`] = `
284
+ <View
285
+ style={
286
+ {
287
+ "flex": 1,
288
+ }
289
+ }
290
+ >
291
+ <View
292
+ accessibilityState={
293
+ {
294
+ "busy": undefined,
295
+ "checked": undefined,
296
+ "disabled": true,
297
+ "expanded": undefined,
298
+ "selected": undefined,
299
+ }
300
+ }
301
+ accessibilityValue={
302
+ {
303
+ "max": undefined,
304
+ "min": undefined,
305
+ "now": undefined,
306
+ "text": undefined,
307
+ }
308
+ }
309
+ accessible={true}
310
+ collapsable={false}
311
+ focusable={false}
312
+ onClick={[Function]}
313
+ onLayout={[Function]}
314
+ onResponderGrant={[Function]}
315
+ onResponderMove={[Function]}
316
+ onResponderRelease={[Function]}
317
+ onResponderTerminate={[Function]}
318
+ onResponderTerminationRequest={[Function]}
319
+ onStartShouldSetResponder={[Function]}
320
+ style={
321
+ {
322
+ "alignItems": "center",
323
+ "alignSelf": "flex-start",
324
+ "backgroundColor": "#ffffff",
325
+ "borderRadius": 999,
326
+ "elevation": 3,
327
+ "flexDirection": "row",
328
+ "justifyContent": "center",
329
+ "left": "50%",
330
+ "opacity": 1,
331
+ "padding": 8,
332
+ "position": "absolute",
333
+ "shadowColor": "#001f23",
334
+ "shadowOffset": {
335
+ "height": 2,
336
+ "width": 0,
337
+ },
338
+ "shadowOpacity": 0.12,
339
+ "shadowRadius": 4,
340
+ "top": 12,
341
+ "zIndex": 9999,
342
+ }
343
+ }
344
+ >
345
+ <View
346
+ style={
347
+ [
348
+ {},
349
+ [
350
+ {
351
+ "marginRight": 8,
352
+ },
353
+ undefined,
354
+ ],
355
+ ]
356
+ }
357
+ >
358
+ <Text
359
+ allowFontScaling={false}
360
+ style={
361
+ [
362
+ {
363
+ "color": "#001f23",
364
+ "fontFamily": "BeVietnamPro-Regular",
365
+ "fontSize": 16,
366
+ "letterSpacing": 0.48,
367
+ "lineHeight": 24,
368
+ },
369
+ undefined,
370
+ ]
371
+ }
372
+ themeIntent="body"
373
+ themeTypeface="neutral"
374
+ themeVariant="regular"
375
+ >
376
+ Prefix
377
+ </Text>
378
+ </View>
379
+ <Text
380
+ allowFontScaling={false}
381
+ style={
382
+ [
383
+ {
384
+ "color": "#001f23",
385
+ "fontFamily": "BeVietnamPro-Regular",
386
+ "fontSize": 16,
387
+ "letterSpacing": 0.48,
388
+ "lineHeight": 24,
389
+ },
390
+ undefined,
391
+ ]
392
+ }
393
+ themeIntent="body"
394
+ themeTypeface="neutral"
395
+ themeVariant="regular"
396
+ >
397
+ Content
398
+ </Text>
399
+ </View>
400
+ <View
401
+ pointerEvents="box-none"
402
+ position="bottom"
403
+ style={
404
+ [
405
+ {
406
+ "bottom": 0,
407
+ "elevation": 9999,
408
+ "flexDirection": "column-reverse",
409
+ "left": 0,
410
+ "paddingHorizontal": 24,
411
+ "paddingVertical": 16,
412
+ "position": "absolute",
413
+ "right": 0,
414
+ "top": 0,
415
+ },
416
+ undefined,
417
+ ]
418
+ }
419
+ />
420
+ </View>
421
+ `;
422
+
423
+ exports[`FloatingIsland renders suffix correctly 1`] = `
424
+ <View
425
+ style={
426
+ {
427
+ "flex": 1,
428
+ }
429
+ }
430
+ >
431
+ <View
432
+ accessibilityState={
433
+ {
434
+ "busy": undefined,
435
+ "checked": undefined,
436
+ "disabled": true,
437
+ "expanded": undefined,
438
+ "selected": undefined,
439
+ }
440
+ }
441
+ accessibilityValue={
442
+ {
443
+ "max": undefined,
444
+ "min": undefined,
445
+ "now": undefined,
446
+ "text": undefined,
447
+ }
448
+ }
449
+ accessible={true}
450
+ collapsable={false}
451
+ focusable={false}
452
+ onClick={[Function]}
453
+ onLayout={[Function]}
454
+ onResponderGrant={[Function]}
455
+ onResponderMove={[Function]}
456
+ onResponderRelease={[Function]}
457
+ onResponderTerminate={[Function]}
458
+ onResponderTerminationRequest={[Function]}
459
+ onStartShouldSetResponder={[Function]}
460
+ style={
461
+ {
462
+ "alignItems": "center",
463
+ "alignSelf": "flex-start",
464
+ "backgroundColor": "#ffffff",
465
+ "borderRadius": 999,
466
+ "elevation": 3,
467
+ "flexDirection": "row",
468
+ "justifyContent": "center",
469
+ "left": "50%",
470
+ "opacity": 1,
471
+ "padding": 8,
472
+ "position": "absolute",
473
+ "shadowColor": "#001f23",
474
+ "shadowOffset": {
475
+ "height": 2,
476
+ "width": 0,
477
+ },
478
+ "shadowOpacity": 0.12,
479
+ "shadowRadius": 4,
480
+ "top": 12,
481
+ "zIndex": 9999,
482
+ }
483
+ }
484
+ >
485
+ <Text
486
+ allowFontScaling={false}
487
+ style={
488
+ [
489
+ {
490
+ "color": "#001f23",
491
+ "fontFamily": "BeVietnamPro-Regular",
492
+ "fontSize": 16,
493
+ "letterSpacing": 0.48,
494
+ "lineHeight": 24,
495
+ },
496
+ undefined,
497
+ ]
498
+ }
499
+ themeIntent="body"
500
+ themeTypeface="neutral"
501
+ themeVariant="regular"
502
+ >
503
+ Content
504
+ </Text>
505
+ <View
506
+ style={
507
+ [
508
+ {},
509
+ [
510
+ {
511
+ "marginLeft": 16,
512
+ },
513
+ undefined,
514
+ ],
515
+ ]
516
+ }
517
+ >
518
+ <Text
519
+ allowFontScaling={false}
520
+ style={
521
+ [
522
+ {
523
+ "color": "#001f23",
524
+ "fontFamily": "BeVietnamPro-Regular",
525
+ "fontSize": 16,
526
+ "letterSpacing": 0.48,
527
+ "lineHeight": 24,
528
+ },
529
+ undefined,
530
+ ]
531
+ }
532
+ themeIntent="body"
533
+ themeTypeface="neutral"
534
+ themeVariant="regular"
535
+ >
536
+ Suffix
537
+ </Text>
538
+ </View>
539
+ </View>
540
+ <View
541
+ pointerEvents="box-none"
542
+ position="bottom"
543
+ style={
544
+ [
545
+ {
546
+ "bottom": 0,
547
+ "elevation": 9999,
548
+ "flexDirection": "column-reverse",
549
+ "left": 0,
550
+ "paddingHorizontal": 24,
551
+ "paddingVertical": 16,
552
+ "position": "absolute",
553
+ "right": 0,
554
+ "top": 0,
555
+ },
556
+ undefined,
557
+ ]
558
+ }
559
+ />
560
+ </View>
561
+ `;