@hero-design/rn 8.36.2 → 8.37.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 (41) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/es/index.js +54 -90
  3. package/lib/index.js +54 -90
  4. package/package.json +7 -7
  5. package/src/components/Carousel/StyledCardCarousel.tsx +1 -1
  6. package/src/components/Carousel/__tests__/__snapshots__/CardCarousel.spec.tsx.snap +8 -8
  7. package/src/components/Checkbox/StyledCheckbox.tsx +7 -14
  8. package/src/components/Checkbox/__tests__/StyledCheckbox.spec.tsx +8 -12
  9. package/src/components/Checkbox/__tests__/__snapshots__/StyledCheckbox.spec.tsx.snap +4 -88
  10. package/src/components/Checkbox/__tests__/__snapshots__/index.spec.tsx.snap +12 -324
  11. package/src/components/Checkbox/__tests__/index.spec.tsx +7 -12
  12. package/src/components/Checkbox/index.tsx +7 -1
  13. package/src/components/Drawer/__tests__/__snapshots__/index.spec.tsx.snap +3 -3
  14. package/src/components/Drawer/index.tsx +3 -3
  15. package/src/components/FAB/ActionGroup/StyledActionGroup.tsx +4 -15
  16. package/src/components/FAB/ActionGroup/__tests__/__snapshots__/index.spec.tsx.snap +18 -48
  17. package/src/components/FAB/ActionGroup/__tests__/index.spec.tsx +36 -29
  18. package/src/components/FAB/ActionGroup/index.tsx +18 -29
  19. package/src/components/FAB/StyledFAB.tsx +1 -1
  20. package/src/components/FAB/__tests__/__snapshots__/StyledFAB.spec.tsx.snap +4 -4
  21. package/src/components/FAB/__tests__/__snapshots__/index.spec.tsx.snap +6 -6
  22. package/src/components/List/StyledListItem.tsx +5 -5
  23. package/src/components/List/__tests__/__snapshots__/StyledListItem.spec.tsx.snap +6 -6
  24. package/src/components/TextInput/__tests__/StyledTextInput.spec.tsx +2 -2
  25. package/src/components/TextInput/__tests__/__snapshots__/StyledTextInput.spec.tsx.snap +5 -14
  26. package/src/components/Toast/StyledToast.tsx +1 -1
  27. package/src/components/Toast/__tests__/__snapshots__/Toast.spec.tsx.snap +7 -7
  28. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +20 -23
  29. package/src/theme/components/cardCarousel.ts +5 -5
  30. package/src/theme/components/fab.ts +5 -11
  31. package/src/theme/components/list.ts +7 -4
  32. package/src/theme/components/toast.ts +5 -5
  33. package/src/theme/global/shadows.ts +3 -3
  34. package/types/components/Checkbox/StyledCheckbox.d.ts +0 -1
  35. package/types/components/Checkbox/index.d.ts +1 -0
  36. package/types/components/FAB/ActionGroup/StyledActionGroup.d.ts +2 -7
  37. package/types/components/FAB/ActionGroup/index.d.ts +5 -0
  38. package/types/theme/components/cardCarousel.d.ts +1 -1
  39. package/types/theme/components/fab.d.ts +1 -7
  40. package/types/theme/components/list.d.ts +9 -6
  41. package/types/theme/components/toast.d.ts +1 -1
@@ -19,8 +19,12 @@ exports[`Checkbox renders correctly when checked is false and there is no descri
19
19
  onStartShouldSetResponder={[Function]}
20
20
  style={
21
21
  Object {
22
+ "borderColor": "#001f23",
23
+ "borderRadius": 8,
24
+ "borderWidth": 1,
22
25
  "flexDirection": "row",
23
26
  "opacity": 1,
27
+ "padding": 16,
24
28
  }
25
29
  }
26
30
  >
@@ -73,8 +77,12 @@ exports[`Checkbox renders correctly when checked is true and there is no descrip
73
77
  onStartShouldSetResponder={[Function]}
74
78
  style={
75
79
  Object {
80
+ "borderColor": "#001f23",
81
+ "borderRadius": 8,
82
+ "borderWidth": 1,
76
83
  "flexDirection": "row",
77
84
  "opacity": 1,
85
+ "padding": 16,
78
86
  }
79
87
  }
80
88
  >
@@ -130,167 +138,7 @@ exports[`Checkbox renders correctly when checked is true and there is no descrip
130
138
  </View>
131
139
  `;
132
140
 
133
- exports[`Checkbox renders correctly when disabled is false, withBorder is false and readonly is false 1`] = `
134
- <View
135
- accessibilityState={
136
- Object {
137
- "disabled": false,
138
- }
139
- }
140
- accessible={true}
141
- collapsable={false}
142
- focusable={false}
143
- onClick={[Function]}
144
- onResponderGrant={[Function]}
145
- onResponderMove={[Function]}
146
- onResponderRelease={[Function]}
147
- onResponderTerminate={[Function]}
148
- onResponderTerminationRequest={[Function]}
149
- onStartShouldSetResponder={[Function]}
150
- style={
151
- Object {
152
- "flexDirection": "row",
153
- "opacity": 1,
154
- }
155
- }
156
- >
157
- <Text
158
- allowFontScaling={false}
159
- style={
160
- Array [
161
- Object {
162
- "color": "#001f23",
163
- "fontFamily": "BeVietnamPro-Regular",
164
- "fontSize": 14,
165
- "letterSpacing": 0.48,
166
- "lineHeight": 22,
167
- },
168
- Array [
169
- Object {
170
- "flex": 1,
171
- "paddingRight": 12,
172
- },
173
- undefined,
174
- ],
175
- ]
176
- }
177
- themeIntent="body"
178
- themeTypeface="neutral"
179
- themeVariant="small"
180
- >
181
- Please agree to our privacy policy
182
- </Text>
183
- <View
184
- style={
185
- Array [
186
- Object {
187
- "height": 24,
188
- "overflow": "hidden",
189
- "width": 24,
190
- },
191
- undefined,
192
- ]
193
- }
194
- >
195
- <View
196
- style={
197
- Array [
198
- Object {
199
- "borderColor": "#001f23",
200
- "borderRadius": 4,
201
- "borderWidth": 2,
202
- "flex": 1,
203
- },
204
- undefined,
205
- ]
206
- }
207
- themeState="default"
208
- />
209
- </View>
210
- </View>
211
- `;
212
-
213
- exports[`Checkbox renders correctly when disabled is false, withBorder is false and readonly is true 1`] = `
214
- <View
215
- accessibilityState={
216
- Object {
217
- "disabled": true,
218
- }
219
- }
220
- accessible={true}
221
- collapsable={false}
222
- focusable={false}
223
- onClick={[Function]}
224
- onResponderGrant={[Function]}
225
- onResponderMove={[Function]}
226
- onResponderRelease={[Function]}
227
- onResponderTerminate={[Function]}
228
- onResponderTerminationRequest={[Function]}
229
- onStartShouldSetResponder={[Function]}
230
- style={
231
- Object {
232
- "flexDirection": "row",
233
- "opacity": 1,
234
- }
235
- }
236
- >
237
- <Text
238
- allowFontScaling={false}
239
- style={
240
- Array [
241
- Object {
242
- "color": "#001f23",
243
- "fontFamily": "BeVietnamPro-Regular",
244
- "fontSize": 14,
245
- "letterSpacing": 0.48,
246
- "lineHeight": 22,
247
- },
248
- Array [
249
- Object {
250
- "flex": 1,
251
- "paddingRight": 12,
252
- },
253
- undefined,
254
- ],
255
- ]
256
- }
257
- themeIntent="body"
258
- themeTypeface="neutral"
259
- themeVariant="small"
260
- >
261
- Please agree to our privacy policy
262
- </Text>
263
- <View
264
- style={
265
- Array [
266
- Object {
267
- "height": 24,
268
- "overflow": "hidden",
269
- "width": 24,
270
- },
271
- undefined,
272
- ]
273
- }
274
- >
275
- <View
276
- style={
277
- Array [
278
- Object {
279
- "borderColor": "#808f91",
280
- "borderRadius": 4,
281
- "borderWidth": 2,
282
- "flex": 1,
283
- },
284
- undefined,
285
- ]
286
- }
287
- themeState="readonly"
288
- />
289
- </View>
290
- </View>
291
- `;
292
-
293
- exports[`Checkbox renders correctly when disabled is false, withBorder is true and readonly is false 1`] = `
141
+ exports[`Checkbox renders correctly when disabled is false and readonly is false 1`] = `
294
142
  <View
295
143
  accessibilityState={
296
144
  Object {
@@ -374,7 +222,7 @@ exports[`Checkbox renders correctly when disabled is false, withBorder is true a
374
222
  </View>
375
223
  `;
376
224
 
377
- exports[`Checkbox renders correctly when disabled is false, withBorder is true and readonly is true 1`] = `
225
+ exports[`Checkbox renders correctly when disabled is false and readonly is true 1`] = `
378
226
  <View
379
227
  accessibilityState={
380
228
  Object {
@@ -458,167 +306,7 @@ exports[`Checkbox renders correctly when disabled is false, withBorder is true a
458
306
  </View>
459
307
  `;
460
308
 
461
- exports[`Checkbox renders correctly when disabled is true, withBorder is false and readonly is false 1`] = `
462
- <View
463
- accessibilityState={
464
- Object {
465
- "disabled": true,
466
- }
467
- }
468
- accessible={true}
469
- collapsable={false}
470
- focusable={false}
471
- onClick={[Function]}
472
- onResponderGrant={[Function]}
473
- onResponderMove={[Function]}
474
- onResponderRelease={[Function]}
475
- onResponderTerminate={[Function]}
476
- onResponderTerminationRequest={[Function]}
477
- onStartShouldSetResponder={[Function]}
478
- style={
479
- Object {
480
- "flexDirection": "row",
481
- "opacity": 1,
482
- }
483
- }
484
- >
485
- <Text
486
- allowFontScaling={false}
487
- style={
488
- Array [
489
- Object {
490
- "color": "#4d6265",
491
- "fontFamily": "BeVietnamPro-Regular",
492
- "fontSize": 14,
493
- "letterSpacing": 0.48,
494
- "lineHeight": 22,
495
- },
496
- Array [
497
- Object {
498
- "flex": 1,
499
- "paddingRight": 12,
500
- },
501
- undefined,
502
- ],
503
- ]
504
- }
505
- themeIntent="subdued"
506
- themeTypeface="neutral"
507
- themeVariant="small"
508
- >
509
- Please agree to our privacy policy
510
- </Text>
511
- <View
512
- style={
513
- Array [
514
- Object {
515
- "height": 24,
516
- "overflow": "hidden",
517
- "width": 24,
518
- },
519
- undefined,
520
- ]
521
- }
522
- >
523
- <View
524
- style={
525
- Array [
526
- Object {
527
- "borderColor": "#bfc1c5",
528
- "borderRadius": 4,
529
- "borderWidth": 2,
530
- "flex": 1,
531
- },
532
- undefined,
533
- ]
534
- }
535
- themeState="disabled"
536
- />
537
- </View>
538
- </View>
539
- `;
540
-
541
- exports[`Checkbox renders correctly when disabled is true, withBorder is false and readonly is true 1`] = `
542
- <View
543
- accessibilityState={
544
- Object {
545
- "disabled": true,
546
- }
547
- }
548
- accessible={true}
549
- collapsable={false}
550
- focusable={false}
551
- onClick={[Function]}
552
- onResponderGrant={[Function]}
553
- onResponderMove={[Function]}
554
- onResponderRelease={[Function]}
555
- onResponderTerminate={[Function]}
556
- onResponderTerminationRequest={[Function]}
557
- onStartShouldSetResponder={[Function]}
558
- style={
559
- Object {
560
- "flexDirection": "row",
561
- "opacity": 1,
562
- }
563
- }
564
- >
565
- <Text
566
- allowFontScaling={false}
567
- style={
568
- Array [
569
- Object {
570
- "color": "#4d6265",
571
- "fontFamily": "BeVietnamPro-Regular",
572
- "fontSize": 14,
573
- "letterSpacing": 0.48,
574
- "lineHeight": 22,
575
- },
576
- Array [
577
- Object {
578
- "flex": 1,
579
- "paddingRight": 12,
580
- },
581
- undefined,
582
- ],
583
- ]
584
- }
585
- themeIntent="subdued"
586
- themeTypeface="neutral"
587
- themeVariant="small"
588
- >
589
- Please agree to our privacy policy
590
- </Text>
591
- <View
592
- style={
593
- Array [
594
- Object {
595
- "height": 24,
596
- "overflow": "hidden",
597
- "width": 24,
598
- },
599
- undefined,
600
- ]
601
- }
602
- >
603
- <View
604
- style={
605
- Array [
606
- Object {
607
- "borderColor": "#bfc1c5",
608
- "borderRadius": 4,
609
- "borderWidth": 2,
610
- "flex": 1,
611
- },
612
- undefined,
613
- ]
614
- }
615
- themeState="disabled"
616
- />
617
- </View>
618
- </View>
619
- `;
620
-
621
- exports[`Checkbox renders correctly when disabled is true, withBorder is true and readonly is false 1`] = `
309
+ exports[`Checkbox renders correctly when disabled is true and readonly is false 1`] = `
622
310
  <View
623
311
  accessibilityState={
624
312
  Object {
@@ -702,7 +390,7 @@ exports[`Checkbox renders correctly when disabled is true, withBorder is true an
702
390
  </View>
703
391
  `;
704
392
 
705
- exports[`Checkbox renders correctly when disabled is true, withBorder is true and readonly is true 1`] = `
393
+ exports[`Checkbox renders correctly when disabled is true and readonly is true 1`] = `
706
394
  <View
707
395
  accessibilityState={
708
396
  Object {
@@ -21,22 +21,17 @@ describe('getThemeState', () => {
21
21
 
22
22
  describe('Checkbox', () => {
23
23
  it.each`
24
- withBorder | disabled | readonly
25
- ${false} | ${false} | ${false}
26
- ${false} | ${true} | ${false}
27
- ${true} | ${false} | ${false}
28
- ${true} | ${true} | ${false}
29
- ${false} | ${false} | ${true}
30
- ${false} | ${true} | ${true}
31
- ${true} | ${false} | ${true}
32
- ${true} | ${true} | ${true}
24
+ disabled | readonly
25
+ ${false} | ${false}
26
+ ${true} | ${false}
27
+ ${false} | ${true}
28
+ ${true} | ${true}
33
29
  `(
34
- 'renders correctly when disabled is $disabled, withBorder is $withBorder and readonly is $readonly',
35
- ({ disabled, withBorder, readonly }) => {
30
+ 'renders correctly when disabled is $disabled and readonly is $readonly',
31
+ ({ disabled, readonly }) => {
36
32
  const wrapper = renderWithTheme(
37
33
  <Checkbox
38
34
  disabled={disabled}
39
- withBorder={withBorder}
40
35
  readonly={readonly}
41
36
  description="Please agree to our privacy policy"
42
37
  />
@@ -7,6 +7,7 @@ import {
7
7
  StyledDescription,
8
8
  StyledWrapper,
9
9
  } from './StyledCheckbox';
10
+ import { useDeprecation } from '../../utils/hooks';
10
11
 
11
12
  export interface CheckboxProps {
12
13
  /**
@@ -18,6 +19,7 @@ export interface CheckboxProps {
18
19
  */
19
20
  description?: string;
20
21
  /**
22
+ * @deprecated This prop will be removed in the next major release. Checkboxes will always have border.
21
23
  * Whether the border is shown.
22
24
  */
23
25
  withBorder?: boolean;
@@ -70,13 +72,17 @@ const Checkbox = ({
70
72
  testID,
71
73
  readonly = false,
72
74
  }: CheckboxProps) => {
75
+ useDeprecation(
76
+ `Checkbox's withBorder prop will be removed in the next major release, all checkboxes will have border by default. Please remove it.`,
77
+ withBorder === true
78
+ );
79
+
73
80
  const themeState = getThemeState({ disabled, readonly });
74
81
 
75
82
  return (
76
83
  <StyledWrapper
77
84
  onPress={onPress}
78
85
  disabled={disabled || readonly}
79
- themeWithBorder={withBorder}
80
86
  themeState={themeState}
81
87
  style={style}
82
88
  testID={testID}
@@ -66,7 +66,7 @@ exports[`Drawer renders correctly in invisible state 1`] = `
66
66
  "overflow": "hidden",
67
67
  "transform": Array [
68
68
  Object {
69
- "translateY": -0,
69
+ "translateY": -1334,
70
70
  },
71
71
  ],
72
72
  }
@@ -145,7 +145,7 @@ exports[`Drawer renders correctly in visible state 1`] = `
145
145
  "overflow": "hidden",
146
146
  "transform": Array [
147
147
  Object {
148
- "translateY": -0,
148
+ "translateY": 0,
149
149
  },
150
150
  ],
151
151
  }
@@ -224,7 +224,7 @@ exports[`Drawer renders correctly with no backdrop 1`] = `
224
224
  "overflow": "hidden",
225
225
  "transform": Array [
226
226
  Object {
227
- "translateY": -0,
227
+ "translateY": -1334,
228
228
  },
229
229
  ],
230
230
  }
@@ -1,6 +1,6 @@
1
- import React, { useEffect, useRef, useState } from 'react';
2
- import { Animated, Easing } from 'react-native';
3
1
  import type { ReactNode } from 'react';
2
+ import React, { useEffect, useRef, useState } from 'react';
3
+ import { Animated, Dimensions, Easing } from 'react-native';
4
4
  import DragableDrawer from './DragableDrawer';
5
5
 
6
6
  import {
@@ -40,7 +40,7 @@ const Drawer = ({
40
40
  testID,
41
41
  }: DrawerProps): JSX.Element => {
42
42
  const animatedValue = useRef(new Animated.Value(visible ? 1 : 0)).current;
43
- const [height, setHeight] = useState(0);
43
+ const [height, setHeight] = useState(Dimensions.get('window').height);
44
44
 
45
45
  const enableShadow = visible && !hasBackdrop;
46
46
 
@@ -1,10 +1,8 @@
1
- import { Animated, View } from 'react-native';
1
+ import { Animated, Pressable, View } from 'react-native';
2
2
  import styled from '@emotion/native';
3
3
  import type { ComponentProps } from 'react';
4
4
  import type { ViewProps } from 'react-native';
5
5
  import FAB from '../FAB';
6
- import Typography from '../../Typography';
7
- import type { TextProps } from '../../Typography/Text';
8
6
 
9
7
  const StyledContainer = styled(View)<ViewProps>({
10
8
  position: 'absolute',
@@ -40,9 +38,8 @@ const StyledFAB = styled(FAB)(({ theme }) => ({
40
38
  alignSelf: 'flex-end',
41
39
  }));
42
40
 
43
- const StyledBackdrop = styled(Animated.View)<
44
- ComponentProps<typeof Animated.View>
45
- >(({ theme }) => ({
41
+ const AnimatedPressable = Animated.createAnimatedComponent(Pressable);
42
+ const StyledBackdrop = styled(AnimatedPressable)(({ theme }) => ({
46
43
  position: 'absolute',
47
44
  left: 0,
48
45
  right: 0,
@@ -52,18 +49,10 @@ const StyledBackdrop = styled(Animated.View)<
52
49
  backgroundColor: theme.__hd__.fab.colors.backdropBackground,
53
50
  }));
54
51
 
55
- const StyledHeaderText = styled(Typography.Title)<TextProps>(({ theme }) => ({
56
- color: theme.__hd__.fab.colors.headerText,
57
- marginRight: theme.__hd__.fab.space.headerTextMarginRight,
58
- marginBottom: theme.__hd__.fab.space.headerTextMarginBottom,
59
- textAlign: 'right',
60
- }));
61
-
62
52
  export {
63
- StyledHeaderText,
53
+ StyledActionGroupContainer,
64
54
  StyledBackdrop,
65
55
  StyledContainer,
66
56
  StyledContainerInModal,
67
- StyledActionGroupContainer,
68
57
  StyledFAB,
69
58
  };
@@ -44,7 +44,7 @@ exports[`ActionGroup has active false 1`] = `
44
44
  "alignSelf": "flex-start",
45
45
  "backgroundColor": "#401960",
46
46
  "borderRadius": 999,
47
- "elevation": 2,
47
+ "elevation": 3,
48
48
  "flexDirection": "row",
49
49
  "justifyContent": "center",
50
50
  "padding": 20,
@@ -54,7 +54,7 @@ exports[`ActionGroup has active false 1`] = `
54
54
  "width": 0,
55
55
  },
56
56
  "shadowOpacity": 0.12,
57
- "shadowRadius": 8,
57
+ "shadowRadius": 4,
58
58
  },
59
59
  Array [
60
60
  Array [
@@ -197,7 +197,7 @@ exports[`ActionGroup has active true 1`] = `
197
197
  "alignSelf": "flex-start",
198
198
  "backgroundColor": "#33144d",
199
199
  "borderRadius": 999,
200
- "elevation": 2,
200
+ "elevation": 3,
201
201
  "flexDirection": "row",
202
202
  "justifyContent": "center",
203
203
  "padding": 20,
@@ -207,7 +207,7 @@ exports[`ActionGroup has active true 1`] = `
207
207
  "width": 0,
208
208
  },
209
209
  "shadowOpacity": 0.12,
210
- "shadowRadius": 8,
210
+ "shadowRadius": 4,
211
211
  },
212
212
  Array [
213
213
  Array [
@@ -307,7 +307,18 @@ exports[`ActionGroup has active true 1`] = `
307
307
  }
308
308
  >
309
309
  <View
310
+ accessible={true}
310
311
  collapsable={false}
312
+ focusable={true}
313
+ onBlur={[Function]}
314
+ onClick={[Function]}
315
+ onFocus={[Function]}
316
+ onResponderGrant={[Function]}
317
+ onResponderMove={[Function]}
318
+ onResponderRelease={[Function]}
319
+ onResponderTerminate={[Function]}
320
+ onResponderTerminationRequest={[Function]}
321
+ onStartShouldSetResponder={[Function]}
311
322
  style={
312
323
  Object {
313
324
  "backgroundColor": "#000000",
@@ -323,6 +334,7 @@ exports[`ActionGroup has active true 1`] = `
323
334
  />
324
335
  <View
325
336
  collapsable={false}
337
+ pointerEvents="box-none"
326
338
  style={
327
339
  Object {
328
340
  "alignItems": "flex-end",
@@ -333,48 +345,6 @@ exports[`ActionGroup has active true 1`] = `
333
345
  }
334
346
  testID="action-group"
335
347
  >
336
- <View
337
- collapsable={false}
338
- style={
339
- Object {
340
- "transform": Array [
341
- Object {
342
- "translateY": 50,
343
- },
344
- ],
345
- }
346
- }
347
- >
348
- <Text
349
- allowFontScaling={false}
350
- style={
351
- Array [
352
- Object {
353
- "color": "#001f23",
354
- "fontFamily": "BeVietnamPro-SemiBold",
355
- "fontSize": 24,
356
- "letterSpacing": 0,
357
- "lineHeight": 32,
358
- },
359
- Array [
360
- Object {
361
- "color": "#001f23",
362
- "marginBottom": 24,
363
- "marginRight": 24,
364
- "textAlign": "right",
365
- },
366
- undefined,
367
- ],
368
- ]
369
- }
370
- testID="header-text"
371
- themeIntent="body"
372
- themeLevel="h4"
373
- themeTypeface="neutral"
374
- >
375
- What would you like to create?
376
- </Text>
377
- </View>
378
348
  <View
379
349
  style={
380
350
  Array [
@@ -923,7 +893,7 @@ exports[`ActionGroup has active true 1`] = `
923
893
  "alignSelf": "flex-start",
924
894
  "backgroundColor": "#33144d",
925
895
  "borderRadius": 999,
926
- "elevation": 2,
896
+ "elevation": 3,
927
897
  "flexDirection": "row",
928
898
  "justifyContent": "center",
929
899
  "padding": 20,
@@ -933,7 +903,7 @@ exports[`ActionGroup has active true 1`] = `
933
903
  "width": 0,
934
904
  },
935
905
  "shadowOpacity": 0.12,
936
- "shadowRadius": 8,
906
+ "shadowRadius": 4,
937
907
  },
938
908
  Array [
939
909
  Array [