@hero-design/rn 8.68.0 → 8.69.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 (46) hide show
  1. package/.turbo/turbo-build.log +3 -3
  2. package/CHANGELOG.md +15 -0
  3. package/es/index.js +248 -89
  4. package/lib/index.js +248 -88
  5. package/package.json +2 -2
  6. package/src/components/BottomSheet/Header.tsx +50 -27
  7. package/src/components/BottomSheet/StyledBottomSheet.tsx +35 -8
  8. package/src/components/BottomSheet/__tests__/__snapshots__/index.spec.tsx.snap +352 -1
  9. package/src/components/BottomSheet/__tests__/index.spec.tsx +30 -0
  10. package/src/components/BottomSheet/index.tsx +47 -30
  11. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +1 -1
  12. package/src/components/Progress/ProgressStep.tsx +87 -0
  13. package/src/components/Progress/StyledStep.tsx +48 -0
  14. package/src/components/Progress/__tests__/__snapshots__/index.spec.js.snap +209 -0
  15. package/src/components/Progress/__tests__/index.spec.js +26 -0
  16. package/src/components/Progress/index.tsx +6 -1
  17. package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +4 -4
  18. package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +3 -3
  19. package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +1 -1
  20. package/src/index.ts +2 -0
  21. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +16 -0
  22. package/src/theme/components/bottomSheet.ts +7 -0
  23. package/src/theme/components/progress.ts +11 -1
  24. package/src/theme/global/colors/__tests__/__snapshots__/swagLight.spec.ts.snap +7 -7
  25. package/src/theme/global/colors/__tests__/__snapshots__/swagLightJobs.spec.ts.snap +50 -0
  26. package/src/theme/global/colors/__tests__/swagLightJobs.spec.ts +7 -0
  27. package/src/theme/global/colors/swagLight.ts +7 -8
  28. package/src/theme/global/colors/swagLightJobs.ts +11 -0
  29. package/src/theme/global/colors/types.ts +4 -0
  30. package/src/theme/global/index.ts +2 -0
  31. package/src/theme/index.ts +2 -0
  32. package/stats/8.69.0/rn-stats.html +4842 -0
  33. package/types/components/BottomSheet/Header.d.ts +3 -2
  34. package/types/components/BottomSheet/StyledBottomSheet.d.ts +16 -2
  35. package/types/components/BottomSheet/index.d.ts +5 -1
  36. package/types/components/Box/StyledBox.d.ts +1 -1
  37. package/types/components/Progress/ProgressStep.d.ts +20 -0
  38. package/types/components/Progress/StyledStep.d.ts +21 -0
  39. package/types/components/Progress/index.d.ts +1 -0
  40. package/types/index.d.ts +2 -2
  41. package/types/theme/components/bottomSheet.d.ts +7 -0
  42. package/types/theme/components/progress.d.ts +9 -0
  43. package/types/theme/global/colors/swagLightJobs.d.ts +47 -0
  44. package/types/theme/global/colors/types.d.ts +2 -0
  45. package/types/theme/global/index.d.ts +4 -1
  46. package/types/theme/index.d.ts +2 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "8.68.0",
3
+ "version": "8.69.0",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -22,7 +22,7 @@
22
22
  "@emotion/native": "^11.9.3",
23
23
  "@emotion/primitives-core": "11.0.0",
24
24
  "@emotion/react": "^11.9.3",
25
- "@hero-design/colors": "8.44.0",
25
+ "@hero-design/colors": "8.45.0",
26
26
  "date-fns": "^2.16.1",
27
27
  "hero-editor": "^1.9.21",
28
28
  "nanoid": "^4.0.2"
@@ -1,50 +1,73 @@
1
+ import type { ReactElement } from 'react';
1
2
  import React from 'react';
2
3
  import { View } from 'react-native';
3
- import type { ReactElement } from 'react';
4
+ import { noop } from '../../utils/functions';
4
5
  import Button from '../Button';
5
6
  import Divider from '../Divider';
6
7
  import Typography from '../Typography';
7
8
  import {
9
+ StyledFloatingHeaderWrapper,
8
10
  StyledHeader,
9
11
  StyledHeaderWrapper,
10
12
  StyledIconWrapper,
11
13
  } from './StyledBottomSheet';
12
- import { noop } from '../../utils/functions';
14
+ import Icon from '../Icon';
15
+ import { useTheme } from '../../theme';
13
16
 
14
17
  const Header = ({
15
18
  content,
16
19
  showDivider,
17
20
  onRequestClose = noop,
18
21
  showCloseButton,
22
+ variant = 'fixed',
19
23
  }: {
20
24
  content: string | ReactElement;
21
25
  showDivider: boolean;
22
26
  onRequestClose?: () => void;
23
27
  showCloseButton: boolean;
24
- }) => (
25
- <>
26
- <StyledHeaderWrapper>
27
- {typeof content === 'string' ? (
28
- <StyledHeader>
29
- <Typography.Body variant="regular-bold">{content}</Typography.Body>
30
- </StyledHeader>
31
- ) : (
32
- <View style={{ flex: 1 }}>{content}</View>
33
- )}
34
- {showCloseButton ? (
35
- <StyledIconWrapper>
36
- <Button.Icon
37
- icon="cancel"
38
- onPress={onRequestClose}
39
- intent="text"
40
- testID="bottom-sheet-close-icon"
41
- size="xsmall"
42
- />
43
- </StyledIconWrapper>
44
- ) : null}
45
- </StyledHeaderWrapper>
46
- {showDivider ? <Divider /> : null}
47
- </>
48
- );
28
+ variant?: 'fixed' | 'floating';
29
+ }) => {
30
+ const theme = useTheme();
31
+
32
+ return (
33
+ <>
34
+ <StyledHeaderWrapper>
35
+ {typeof content === 'string' ? (
36
+ <StyledHeader>
37
+ <Typography.Body variant="regular-bold">{content}</Typography.Body>
38
+ </StyledHeader>
39
+ ) : (
40
+ <View style={{ flex: 1 }}>{content}</View>
41
+ )}
42
+ {showCloseButton ? (
43
+ <StyledIconWrapper>
44
+ {variant === 'fixed' ? (
45
+ <Button.Icon
46
+ icon="cancel"
47
+ onPress={onRequestClose}
48
+ intent="text"
49
+ testID="bottom-sheet-close-icon"
50
+ size="xsmall"
51
+ />
52
+ ) : (
53
+ <StyledFloatingHeaderWrapper
54
+ onPress={onRequestClose}
55
+ testID="bottom-sheet-close-icon"
56
+ >
57
+ <Icon
58
+ icon="cancel"
59
+ style={{
60
+ fontSize: theme.__hd__.bottomSheet.sizes.floatingCloseIcon,
61
+ }}
62
+ />
63
+ </StyledFloatingHeaderWrapper>
64
+ )}
65
+ </StyledIconWrapper>
66
+ ) : null}
67
+ </StyledHeaderWrapper>
68
+ {showDivider ? <Divider /> : null}
69
+ </>
70
+ );
71
+ };
49
72
 
50
73
  export default Header;
@@ -1,4 +1,6 @@
1
1
  import styled from '@emotion/native';
2
+ import type { ComponentProps } from 'react';
3
+ import type { ViewProps } from 'react-native';
2
4
  import {
3
5
  Animated,
4
6
  KeyboardAvoidingView,
@@ -6,10 +8,9 @@ import {
6
8
  Pressable,
7
9
  SafeAreaView,
8
10
  StyleSheet,
11
+ TouchableOpacity,
9
12
  View,
10
13
  } from 'react-native';
11
- import type { ComponentProps } from 'react';
12
- import type { ViewProps } from 'react-native';
13
14
 
14
15
  const AnimatedPressable = Animated.createAnimatedComponent(Pressable);
15
16
  const AnimatedSafeAreaView = Animated.createAnimatedComponent(SafeAreaView);
@@ -26,6 +27,23 @@ const StyledKeyboardAvoidingView = styled(
26
27
  flexDirection: 'column-reverse',
27
28
  }));
28
29
 
30
+ const StyledFloatingWrapper = styled(AnimatedSafeAreaView)(({ theme }) => ({
31
+ margin: theme.__hd__.bottomSheet.space.floatingContentMargin,
32
+ }));
33
+
34
+ const StyledFloatingBottomSheet = styled(Animated.View)(({ theme }) => ({
35
+ width: '100%',
36
+ shadowColor: theme.__hd__.bottomSheet.colors.shadow,
37
+ shadowOffset: theme.__hd__.bottomSheet.shadows.offset,
38
+ shadowOpacity: theme.__hd__.bottomSheet.shadows.opacity,
39
+ shadowRadius: theme.__hd__.bottomSheet.shadows.radius,
40
+ elevation: theme.__hd__.bottomSheet.shadows.elevation,
41
+ backgroundColor: theme.__hd__.bottomSheet.colors.background,
42
+ borderRadius: theme.__hd__.bottomSheet.radii.floating,
43
+ maxHeight: '100%',
44
+ padding: theme.__hd__.bottomSheet.space.floatingInnerPadding,
45
+ }));
46
+
29
47
  const StyledBottomSheet = styled(AnimatedSafeAreaView)<
30
48
  ComponentProps<typeof AnimatedSafeAreaView>
31
49
  >(({ theme }) => ({
@@ -70,20 +88,29 @@ const StyledFooter = styled(View)<ViewProps>(({ theme }) => ({
70
88
  }));
71
89
 
72
90
  const StyledIconWrapper = styled(View)<ViewProps>(({ theme }) => ({
73
- alignItems: 'center',
91
+ alignItems: 'flex-end',
74
92
  justifyContent: 'center',
75
93
  width: theme.__hd__.bottomSheet.sizes.closeIcon,
76
94
  height: theme.__hd__.bottomSheet.sizes.closeIcon,
77
95
  marginLeft: theme.__hd__.bottomSheet.space.closeIconMargin,
78
96
  }));
79
97
 
98
+ const StyledFloatingHeaderWrapper = styled(TouchableOpacity)(({ theme }) => ({
99
+ padding: theme.__hd__.bottomSheet.space.floatingHeaderIconPadding,
100
+ backgroundColor: theme.__hd__.bottomSheet.colors.floatingHeaderIconBackground,
101
+ borderRadius: theme.__hd__.bottomSheet.radii.floatingHeaderIcon,
102
+ }));
103
+
80
104
  export {
81
- StyledWrapper,
82
- StyledHeaderWrapper,
83
- StyledHeader,
105
+ StyledBackdrop,
106
+ StyledBottomSheet,
107
+ StyledFloatingBottomSheet,
108
+ StyledFloatingHeaderWrapper,
109
+ StyledFloatingWrapper,
84
110
  StyledFooter,
111
+ StyledHeader,
112
+ StyledHeaderWrapper,
85
113
  StyledIconWrapper,
86
- StyledBottomSheet,
87
- StyledBackdrop,
88
114
  StyledKeyboardAvoidingView,
115
+ StyledWrapper,
89
116
  };
@@ -232,7 +232,7 @@ exports[`BottomSheet renders correctly with open state 1`] = `
232
232
  style={
233
233
  [
234
234
  {
235
- "alignItems": "center",
235
+ "alignItems": "flex-end",
236
236
  "height": 48,
237
237
  "justifyContent": "center",
238
238
  "marginLeft": 12,
@@ -398,3 +398,354 @@ exports[`BottomSheet renders correctly with open state 1`] = `
398
398
  />
399
399
  </View>
400
400
  `;
401
+
402
+ exports[`BottomSheet renders floating BottomSheet correctly 1`] = `
403
+ <View
404
+ style={
405
+ {
406
+ "flex": 1,
407
+ }
408
+ }
409
+ >
410
+ <Modal
411
+ hardwareAccelerated={false}
412
+ onRequestClose={[MockFunction]}
413
+ supportedOrientations={
414
+ [
415
+ "portrait",
416
+ ]
417
+ }
418
+ transparent={true}
419
+ visible={true}
420
+ >
421
+ <View
422
+ pointerEvents="box-none"
423
+ style={
424
+ [
425
+ {
426
+ "bottom": 0,
427
+ "flexDirection": "column-reverse",
428
+ "left": 0,
429
+ "position": "absolute",
430
+ "right": 0,
431
+ "top": 0,
432
+ },
433
+ undefined,
434
+ ]
435
+ }
436
+ >
437
+ <View
438
+ onLayout={[Function]}
439
+ style={
440
+ [
441
+ [
442
+ {
443
+ "flex": 1,
444
+ "flexDirection": "column-reverse",
445
+ },
446
+ undefined,
447
+ ],
448
+ {
449
+ "paddingBottom": 0,
450
+ },
451
+ ]
452
+ }
453
+ >
454
+ <View
455
+ accessibilityState={
456
+ {
457
+ "busy": undefined,
458
+ "checked": undefined,
459
+ "disabled": undefined,
460
+ "expanded": undefined,
461
+ "selected": undefined,
462
+ }
463
+ }
464
+ accessibilityValue={
465
+ {
466
+ "max": undefined,
467
+ "min": undefined,
468
+ "now": undefined,
469
+ "text": undefined,
470
+ }
471
+ }
472
+ accessible={true}
473
+ collapsable={false}
474
+ focusable={true}
475
+ onBlur={[Function]}
476
+ onClick={[Function]}
477
+ onFocus={[Function]}
478
+ onResponderGrant={[Function]}
479
+ onResponderMove={[Function]}
480
+ onResponderRelease={[Function]}
481
+ onResponderTerminate={[Function]}
482
+ onResponderTerminationRequest={[Function]}
483
+ onStartShouldSetResponder={[Function]}
484
+ style={
485
+ {
486
+ "backgroundColor": "#000000",
487
+ "bottom": 0,
488
+ "left": 0,
489
+ "opacity": 0,
490
+ "position": "absolute",
491
+ "right": 0,
492
+ "top": 0,
493
+ }
494
+ }
495
+ />
496
+ <RCTSafeAreaView
497
+ collapsable={false}
498
+ style={
499
+ {
500
+ "margin": 16,
501
+ }
502
+ }
503
+ >
504
+ <View
505
+ collapsable={false}
506
+ style={
507
+ {
508
+ "backgroundColor": "#ffffff",
509
+ "borderRadius": 32,
510
+ "elevation": 10,
511
+ "maxHeight": "100%",
512
+ "padding": 8,
513
+ "shadowColor": "#001f23",
514
+ "shadowOffset": {
515
+ "height": 3,
516
+ "width": 0,
517
+ },
518
+ "shadowOpacity": 0.4,
519
+ "shadowRadius": 16,
520
+ "transform": [
521
+ {
522
+ "scaleY": 1,
523
+ },
524
+ {
525
+ "translateY": 1334,
526
+ },
527
+ ],
528
+ "width": "100%",
529
+ }
530
+ }
531
+ >
532
+ <View
533
+ style={
534
+ [
535
+ {
536
+ "flexDirection": "row",
537
+ "paddingHorizontal": 16,
538
+ "paddingVertical": 8,
539
+ },
540
+ undefined,
541
+ ]
542
+ }
543
+ >
544
+ <View
545
+ style={
546
+ [
547
+ {
548
+ "flex": 1,
549
+ "justifyContent": "center",
550
+ },
551
+ undefined,
552
+ ]
553
+ }
554
+ >
555
+ <Text
556
+ allowFontScaling={false}
557
+ style={
558
+ [
559
+ {
560
+ "color": "#001f23",
561
+ "fontFamily": "BeVietnamPro-SemiBold",
562
+ "fontSize": 16,
563
+ "letterSpacing": 0.24,
564
+ "lineHeight": 24,
565
+ },
566
+ undefined,
567
+ ]
568
+ }
569
+ themeIntent="body"
570
+ themeTypeface="neutral"
571
+ themeVariant="regular-bold"
572
+ >
573
+ Title
574
+ </Text>
575
+ </View>
576
+ <View
577
+ style={
578
+ [
579
+ {
580
+ "alignItems": "flex-end",
581
+ "height": 48,
582
+ "justifyContent": "center",
583
+ "marginLeft": 12,
584
+ "width": 48,
585
+ },
586
+ undefined,
587
+ ]
588
+ }
589
+ >
590
+ <View
591
+ accessibilityState={
592
+ {
593
+ "busy": undefined,
594
+ "checked": undefined,
595
+ "disabled": undefined,
596
+ "expanded": undefined,
597
+ "selected": undefined,
598
+ }
599
+ }
600
+ accessibilityValue={
601
+ {
602
+ "max": undefined,
603
+ "min": undefined,
604
+ "now": undefined,
605
+ "text": undefined,
606
+ }
607
+ }
608
+ accessible={true}
609
+ collapsable={false}
610
+ focusable={true}
611
+ onClick={[Function]}
612
+ onResponderGrant={[Function]}
613
+ onResponderMove={[Function]}
614
+ onResponderRelease={[Function]}
615
+ onResponderTerminate={[Function]}
616
+ onResponderTerminationRequest={[Function]}
617
+ onStartShouldSetResponder={[Function]}
618
+ style={
619
+ {
620
+ "backgroundColor": "#dadbde",
621
+ "borderRadius": 999,
622
+ "opacity": 1,
623
+ "padding": 8,
624
+ }
625
+ }
626
+ testID="bottom-sheet-close-icon"
627
+ >
628
+ <HeroIcon
629
+ name="cancel"
630
+ style={
631
+ [
632
+ {
633
+ "color": "#001f23",
634
+ "fontSize": 24,
635
+ },
636
+ {
637
+ "fontSize": 12,
638
+ },
639
+ ]
640
+ }
641
+ themeIntent="text"
642
+ themeSize="medium"
643
+ />
644
+ </View>
645
+ </View>
646
+ </View>
647
+ <Text>
648
+ Content
649
+ </Text>
650
+ <View>
651
+ <View
652
+ style={
653
+ [
654
+ {
655
+ "alignItems": "center",
656
+ "flexDirection": "row",
657
+ "justifyContent": "flex-end",
658
+ "paddingHorizontal": 12,
659
+ "paddingVertical": 2,
660
+ },
661
+ undefined,
662
+ ]
663
+ }
664
+ >
665
+ <View
666
+ accessibilityRole="button"
667
+ accessibilityState={
668
+ {
669
+ "busy": undefined,
670
+ "checked": undefined,
671
+ "disabled": undefined,
672
+ "expanded": undefined,
673
+ "selected": undefined,
674
+ }
675
+ }
676
+ accessibilityValue={
677
+ {
678
+ "max": undefined,
679
+ "min": undefined,
680
+ "now": undefined,
681
+ "text": undefined,
682
+ }
683
+ }
684
+ accessible={true}
685
+ collapsable={false}
686
+ focusable={false}
687
+ onClick={[Function]}
688
+ onResponderGrant={[Function]}
689
+ onResponderMove={[Function]}
690
+ onResponderRelease={[Function]}
691
+ onResponderTerminate={[Function]}
692
+ onResponderTerminationRequest={[Function]}
693
+ onStartShouldSetResponder={[Function]}
694
+ style={
695
+ {
696
+ "opacity": 1,
697
+ }
698
+ }
699
+ >
700
+ <View
701
+ style={
702
+ [
703
+ {},
704
+ ]
705
+ }
706
+ >
707
+ <Text
708
+ style={
709
+ [
710
+ {
711
+ "color": "#007AFF",
712
+ "fontSize": 18,
713
+ "margin": 8,
714
+ "textAlign": "center",
715
+ },
716
+ ]
717
+ }
718
+ >
719
+ Footer CTA
720
+ </Text>
721
+ </View>
722
+ </View>
723
+ </View>
724
+ </View>
725
+ </View>
726
+ </RCTSafeAreaView>
727
+ </View>
728
+ </View>
729
+ </Modal>
730
+ <View
731
+ pointerEvents="box-none"
732
+ position="bottom"
733
+ style={
734
+ [
735
+ {
736
+ "bottom": 0,
737
+ "elevation": 9999,
738
+ "flexDirection": "column-reverse",
739
+ "left": 0,
740
+ "paddingHorizontal": 24,
741
+ "paddingVertical": 16,
742
+ "position": "absolute",
743
+ "right": 0,
744
+ "top": 0,
745
+ },
746
+ undefined,
747
+ ]
748
+ }
749
+ />
750
+ </View>
751
+ `;
@@ -26,6 +26,25 @@ describe('BottomSheet', () => {
26
26
  expect(getByText('Content')).toBeDefined();
27
27
  });
28
28
 
29
+ it('renders floating BottomSheet correctly', () => {
30
+ const { toJSON, getByText } = renderWithTheme(
31
+ <BottomSheet
32
+ variant="floating"
33
+ open
34
+ header="Title"
35
+ footer={<Button title="Footer CTA" />}
36
+ onRequestClose={jest.fn()}
37
+ >
38
+ <Content />
39
+ </BottomSheet>
40
+ );
41
+
42
+ expect(toJSON()).toMatchSnapshot();
43
+ expect(getByText('Title')).toBeDefined();
44
+ expect(getByText('Footer CTA')).toBeDefined();
45
+ expect(getByText('Content')).toBeDefined();
46
+ });
47
+
29
48
  it('renders correctly with close state', () => {
30
49
  const { toJSON } = renderWithTheme(
31
50
  <BottomSheet
@@ -86,6 +105,17 @@ describe('BottomSheet', () => {
86
105
  expect(getByText('Content')).toBeDefined();
87
106
  });
88
107
 
108
+ it('renders floating header correctly', () => {
109
+ const { getByText } = renderWithTheme(
110
+ <BottomSheet open header="Title" variant="floating">
111
+ <Content />
112
+ </BottomSheet>
113
+ );
114
+
115
+ expect(getByText('Title')).toBeDefined();
116
+ expect(getByText('Content')).toBeDefined();
117
+ });
118
+
89
119
  it('renders custom header correctly', () => {
90
120
  const { getByText } = renderWithTheme(
91
121
  <BottomSheet open header={<Text>Custom Title</Text>}>