@hero-design/rn 7.19.0 → 7.20.1

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 (183) hide show
  1. package/.eslintrc.json +6 -1
  2. package/.turbo/turbo-build.log +2 -2
  3. package/es/index.js +612 -242
  4. package/lib/index.js +612 -241
  5. package/package.json +4 -4
  6. package/src/components/Alert/StyledAlert.tsx +5 -5
  7. package/src/components/Alert/__tests__/__snapshots__/index.spec.tsx.snap +140 -19
  8. package/src/components/Alert/__tests__/index.spec.tsx +21 -0
  9. package/src/components/Alert/index.tsx +13 -6
  10. package/src/components/Avatar/StyledAvatar.tsx +2 -1
  11. package/src/components/Avatar/index.tsx +2 -1
  12. package/src/components/Box/StyledBox.tsx +54 -0
  13. package/src/components/Box/__tests__/__snapshots__/index.spec.tsx.snap +605 -0
  14. package/src/components/Box/__tests__/helpers.spec.ts +14 -0
  15. package/src/components/Box/__tests__/index.spec.tsx +155 -0
  16. package/src/components/Box/config.ts +201 -0
  17. package/src/components/Box/helpers.ts +10 -0
  18. package/src/components/Box/index.tsx +13 -0
  19. package/src/components/Box/types.ts +38 -0
  20. package/src/components/Calendar/__tests__/index.spec.tsx +13 -17
  21. package/src/components/Card/DataCard/StyledDataCard.tsx +8 -2
  22. package/src/components/Card/DataCard/__tests__/StyledDataCard.spec.tsx +1 -0
  23. package/src/components/Card/DataCard/__tests__/__snapshots__/StyledDataCard.spec.tsx.snap +16 -0
  24. package/src/components/Card/DataCard/index.tsx +1 -1
  25. package/src/components/Card/StyledCard.tsx +12 -19
  26. package/src/components/Card/__tests__/__snapshots__/index.spec.tsx.snap +147 -0
  27. package/src/components/Card/__tests__/index.spec.tsx +18 -0
  28. package/src/components/Card/index.tsx +6 -1
  29. package/src/components/Drawer/DragableDrawer/helpers.ts +3 -4
  30. package/src/components/FAB/ActionGroup/index.tsx +6 -8
  31. package/src/components/RichTextEditor/EditorToolbar.tsx +19 -18
  32. package/src/components/RichTextEditor/RichTextEditor.tsx +7 -2
  33. package/src/components/RichTextEditor/StyledRichTextEditor.ts +0 -2
  34. package/src/components/RichTextEditor/__tests__/RichTextEditor.spec.tsx +11 -12
  35. package/src/components/RichTextEditor/__tests__/__snapshots__/RichTextEditor.spec.tsx.snap +2 -10
  36. package/src/components/RichTextEditor/constants.ts +0 -11
  37. package/src/components/RichTextEditor/index.tsx +0 -3
  38. package/src/components/RichTextEditor/types.ts +9 -0
  39. package/src/components/SectionHeading/__tests__/__snapshots__/StyledHeading.spec.tsx.snap +1 -1
  40. package/src/components/SectionHeading/__tests__/__snapshots__/index.spec.tsx.snap +4 -4
  41. package/src/components/Select/MultiSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +22 -20
  42. package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +4 -4
  43. package/src/components/Select/SingleSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +22 -20
  44. package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +4 -4
  45. package/src/components/Spinner/AnimatedSpinner.tsx +7 -7
  46. package/src/components/Spinner/StyledSpinner.tsx +24 -19
  47. package/src/components/Spinner/__tests__/AnimatedSpinner.spec.tsx +1 -1
  48. package/src/components/Spinner/__tests__/StyledSpinner.spec.tsx +32 -16
  49. package/src/components/Spinner/__tests__/__snapshots__/AnimatedSpinner.spec.tsx.snap +14 -12
  50. package/src/components/Spinner/__tests__/__snapshots__/StyledSpinner.spec.tsx.snap +273 -31
  51. package/src/components/Spinner/__tests__/__snapshots__/index.spec.tsx.snap +14 -12
  52. package/src/components/Spinner/index.tsx +10 -2
  53. package/src/components/Tabs/ScrollableTabs.tsx +9 -4
  54. package/src/components/Tabs/StyledScrollableTabs.tsx +6 -5
  55. package/src/components/Tabs/StyledTabs.tsx +6 -0
  56. package/src/components/Tabs/TabWithBadge.tsx +68 -0
  57. package/src/components/Tabs/__tests__/ScrollableTabs.spec.tsx +13 -0
  58. package/src/components/Tabs/__tests__/TabWithBadge.spec.tsx +48 -0
  59. package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabs.spec.tsx.snap +205 -43
  60. package/src/components/Tabs/__tests__/__snapshots__/TabWithBadge.spec.tsx.snap +165 -0
  61. package/src/components/Tabs/__tests__/__snapshots__/index.spec.tsx.snap +135 -34
  62. package/src/components/Tabs/__tests__/index.spec.tsx +12 -0
  63. package/src/components/Tabs/index.tsx +11 -4
  64. package/src/components/Tag/StyledTag.tsx +1 -11
  65. package/src/components/Tag/__tests__/__snapshots__/Tag.spec.tsx.snap +4 -4
  66. package/src/components/Tag/index.tsx +2 -2
  67. package/src/components/TextInput/__tests__/index.spec.tsx +10 -14
  68. package/src/components/Toast/StyledToast.tsx +13 -7
  69. package/src/components/Toast/Toast.tsx +34 -9
  70. package/src/components/Toast/ToastProvider.tsx +15 -12
  71. package/src/components/Toast/__tests__/Toast.spec.tsx +17 -0
  72. package/src/components/Toast/__tests__/__snapshots__/Toast.spec.tsx.snap +299 -19
  73. package/src/components/Toast/types.ts +15 -1
  74. package/src/components/Typography/Text/StyledText.tsx +7 -1
  75. package/src/components/Typography/Text/__tests__/StyledText.spec.tsx +1 -0
  76. package/src/components/Typography/Text/__tests__/__snapshots__/StyledText.spec.tsx.snap +22 -0
  77. package/src/components/Typography/Text/index.tsx +7 -1
  78. package/src/index.ts +2 -0
  79. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +76 -23
  80. package/src/theme/components/.eslintrc.json +10 -0
  81. package/src/theme/components/alert.ts +5 -1
  82. package/src/theme/components/avatar.ts +2 -0
  83. package/src/theme/components/card.ts +6 -7
  84. package/src/theme/components/sectionHeading.ts +1 -1
  85. package/src/theme/components/spinner.ts +19 -7
  86. package/src/theme/components/tabs.ts +3 -2
  87. package/src/theme/components/tag.ts +13 -13
  88. package/src/theme/components/toast.ts +17 -3
  89. package/src/theme/components/typography.ts +2 -0
  90. package/src/theme/global/colors/swag.ts +23 -0
  91. package/src/theme/global/colors/types.ts +23 -0
  92. package/src/theme/global/colors/work.ts +5 -0
  93. package/src/types.ts +0 -2
  94. package/tsconfig.json +4 -15
  95. package/types/components/Accordion/StyledAccordion.d.ts +14 -14
  96. package/types/components/Alert/StyledAlert.d.ts +16 -16
  97. package/types/components/Alert/index.d.ts +1 -1
  98. package/types/components/Avatar/StyledAvatar.d.ts +16 -16
  99. package/types/components/Avatar/index.d.ts +2 -2
  100. package/types/components/Badge/StyledBadge.d.ts +7 -7
  101. package/types/components/BottomNavigation/StyledBottomNavigation.d.ts +21 -21
  102. package/types/components/BottomSheet/Header.d.ts +1 -1
  103. package/types/components/BottomSheet/StyledBottomSheet.d.ts +19 -19
  104. package/types/components/Box/StyledBox.d.ts +15 -0
  105. package/types/components/Box/__tests__/helpers.spec.d.ts +1 -0
  106. package/types/components/Box/__tests__/index.spec.d.ts +1 -0
  107. package/types/components/Box/config.d.ts +170 -0
  108. package/types/components/Box/helpers.d.ts +1 -0
  109. package/types/components/Box/index.d.ts +5 -0
  110. package/types/components/Box/types.d.ts +31 -0
  111. package/types/components/Button/LoadingIndicator/StyledLoadingIndicator.d.ts +7 -7
  112. package/types/components/Button/StyledButton.d.ts +16 -16
  113. package/types/components/Button/UtilityButton/StyledUtilityButton.d.ts +8 -8
  114. package/types/components/Calendar/StyledCalendar.d.ts +25 -25
  115. package/types/components/Calendar/helpers.d.ts +2 -2
  116. package/types/components/Card/DataCard/StyledDataCard.d.ts +7 -7
  117. package/types/components/Card/DataCard/index.d.ts +1 -1
  118. package/types/components/Card/StyledCard.d.ts +7 -6
  119. package/types/components/Card/index.d.ts +5 -1
  120. package/types/components/Checkbox/StyledCheckbox.d.ts +10 -10
  121. package/types/components/Collapse/StyledCollapse.d.ts +8 -8
  122. package/types/components/ContentNavigator/StyledContentNavigator.d.ts +5 -5
  123. package/types/components/DatePicker/StyledDatePicker.d.ts +3 -3
  124. package/types/components/Divider/StyledDivider.d.ts +5 -5
  125. package/types/components/Drawer/StyledDrawer.d.ts +19 -19
  126. package/types/components/Empty/StyledEmpty.d.ts +12 -12
  127. package/types/components/FAB/ActionGroup/StyledActionGroup.d.ts +11 -11
  128. package/types/components/FAB/ActionGroup/StyledActionItem.d.ts +7 -7
  129. package/types/components/FAB/StyledFAB.d.ts +8 -8
  130. package/types/components/Icon/HeroIcon/index.d.ts +3 -3
  131. package/types/components/List/StyledBasicListItem.d.ts +14 -14
  132. package/types/components/List/StyledListItem.d.ts +23 -23
  133. package/types/components/PinInput/StyledPinInput.d.ts +30 -30
  134. package/types/components/Progress/StyledProgressBar.d.ts +5 -5
  135. package/types/components/Progress/StyledProgressCircle.d.ts +18 -18
  136. package/types/components/Radio/StyledRadio.d.ts +9 -9
  137. package/types/components/RichTextEditor/EditorToolbar.d.ts +2 -2
  138. package/types/components/RichTextEditor/MentionList.d.ts +1 -1
  139. package/types/components/RichTextEditor/RichTextEditor.d.ts +4 -0
  140. package/types/components/RichTextEditor/StyledRichTextEditor.d.ts +6 -6
  141. package/types/components/RichTextEditor/StyledToolbar.d.ts +9 -9
  142. package/types/components/RichTextEditor/constants.d.ts +0 -10
  143. package/types/components/RichTextEditor/index.d.ts +2 -4
  144. package/types/components/RichTextEditor/types.d.ts +1 -0
  145. package/types/components/SectionHeading/StyledHeading.d.ts +9 -9
  146. package/types/components/Select/MultiSelect/Option.d.ts +1 -1
  147. package/types/components/Select/SingleSelect/Option.d.ts +1 -1
  148. package/types/components/Select/StyledSelect.d.ts +11 -11
  149. package/types/components/Select/helpers.d.ts +1 -1
  150. package/types/components/Spinner/AnimatedSpinner.d.ts +3 -1
  151. package/types/components/Spinner/StyledSpinner.d.ts +14 -12
  152. package/types/components/Spinner/index.d.ts +5 -1
  153. package/types/components/Switch/StyledSwitch.d.ts +5 -5
  154. package/types/components/Tabs/StyledScrollableTabs.d.ts +24 -22
  155. package/types/components/Tabs/StyledTabs.d.ts +26 -20
  156. package/types/components/Tabs/TabWithBadge.d.ts +17 -0
  157. package/types/components/Tabs/__tests__/TabWithBadge.spec.d.ts +1 -0
  158. package/types/components/Tabs/index.d.ts +3 -1
  159. package/types/components/Tag/StyledTag.d.ts +6 -6
  160. package/types/components/Tag/index.d.ts +1 -1
  161. package/types/components/TextInput/StyledTextInput.d.ts +44 -44
  162. package/types/components/TextInput/index.d.ts +5 -5
  163. package/types/components/TimePicker/StyledTimePicker.d.ts +3 -3
  164. package/types/components/Toast/StyledToast.d.ts +19 -18
  165. package/types/components/Toast/types.d.ts +2 -1
  166. package/types/components/Toolbar/StyledToolbar.d.ts +9 -9
  167. package/types/components/Typography/Text/StyledText.d.ts +4 -4
  168. package/types/components/Typography/Text/index.d.ts +1 -1
  169. package/types/index.d.ts +2 -1
  170. package/types/testHelpers/renderWithTheme.d.ts +1 -1
  171. package/types/theme/ThemeSwitcher.d.ts +1 -1
  172. package/types/theme/components/alert.d.ts +5 -1
  173. package/types/theme/components/avatar.d.ts +2 -0
  174. package/types/theme/components/card.d.ts +6 -7
  175. package/types/theme/components/spinner.d.ts +17 -5
  176. package/types/theme/components/tabs.d.ts +1 -0
  177. package/types/theme/components/tag.d.ts +2 -2
  178. package/types/theme/components/toast.d.ts +18 -2
  179. package/types/theme/components/typography.d.ts +2 -0
  180. package/types/theme/global/colors/types.d.ts +17 -0
  181. package/types/theme/global/index.d.ts +17 -0
  182. package/types/types.d.ts +1 -2
  183. package/types/utils/hooks.d.ts +1 -1
@@ -74,7 +74,7 @@ exports[`OptionList render isLoading correctly 1`] = `
74
74
  Array [
75
75
  Object {
76
76
  "alignContent": "center",
77
- "backgroundColor": "#e8e9ea",
77
+ "backgroundColor": "#f6f6f7",
78
78
  "display": "flex",
79
79
  "flexDirection": "row",
80
80
  "justifyContent": "space-between",
@@ -298,7 +298,7 @@ exports[`OptionList render isLoading correctly 1`] = `
298
298
  Array [
299
299
  Object {
300
300
  "alignContent": "center",
301
- "backgroundColor": "#e8e9ea",
301
+ "backgroundColor": "#f6f6f7",
302
302
  "display": "flex",
303
303
  "flexDirection": "row",
304
304
  "justifyContent": "space-between",
@@ -688,6 +688,7 @@ exports[`OptionList render isLoading correctly 1`] = `
688
688
  ]
689
689
  }
690
690
  themePosition="top"
691
+ themeSize="medium"
691
692
  >
692
693
  <View
693
694
  collapsable={false}
@@ -695,16 +696,16 @@ exports[`OptionList render isLoading correctly 1`] = `
695
696
  style={
696
697
  Array [
697
698
  Object {
698
- "backgroundColor": "#8505a2",
699
- "borderRadius": 8,
699
+ "backgroundColor": "#795e90",
700
+ "borderRadius": 999,
700
701
  "height": 16,
701
- "opacity": 1,
702
702
  "width": 16,
703
703
  },
704
704
  Object {},
705
705
  ]
706
706
  }
707
707
  themePosition="topLeft"
708
+ themeSize="medium"
708
709
  />
709
710
  <View
710
711
  collapsable={false}
@@ -712,17 +713,17 @@ exports[`OptionList render isLoading correctly 1`] = `
712
713
  style={
713
714
  Array [
714
715
  Object {
715
- "backgroundColor": "#8505a2",
716
- "borderRadius": 8,
716
+ "backgroundColor": "#a08cb0",
717
+ "borderRadius": 999,
717
718
  "height": 16,
718
719
  "marginLeft": 8,
719
- "opacity": 0.7,
720
720
  "width": 16,
721
721
  },
722
722
  Object {},
723
723
  ]
724
724
  }
725
725
  themePosition="topRight"
726
+ themeSize="medium"
726
727
  />
727
728
  </View>
728
729
  <View
@@ -738,6 +739,7 @@ exports[`OptionList render isLoading correctly 1`] = `
738
739
  ]
739
740
  }
740
741
  themePosition="bottom"
742
+ themeSize="medium"
741
743
  >
742
744
  <View
743
745
  collapsable={false}
@@ -745,16 +747,16 @@ exports[`OptionList render isLoading correctly 1`] = `
745
747
  style={
746
748
  Array [
747
749
  Object {
748
- "backgroundColor": "#8505a2",
749
- "borderRadius": 8,
750
+ "backgroundColor": "#d9d1df",
751
+ "borderRadius": 999,
750
752
  "height": 16,
751
- "opacity": 0.5,
752
753
  "width": 16,
753
754
  },
754
755
  Object {},
755
756
  ]
756
757
  }
757
758
  themePosition="bottomLeft"
759
+ themeSize="medium"
758
760
  />
759
761
  <View
760
762
  collapsable={false}
@@ -762,17 +764,17 @@ exports[`OptionList render isLoading correctly 1`] = `
762
764
  style={
763
765
  Array [
764
766
  Object {
765
- "backgroundColor": "#8505a2",
766
- "borderRadius": 8,
767
+ "backgroundColor": "#ece8ef",
768
+ "borderRadius": 999,
767
769
  "height": 16,
768
770
  "marginLeft": 8,
769
- "opacity": 0.3,
770
771
  "width": 16,
771
772
  },
772
773
  Object {},
773
774
  ]
774
775
  }
775
776
  themePosition="bottomRight"
777
+ themeSize="medium"
776
778
  />
777
779
  </View>
778
780
  </View>
@@ -846,7 +848,7 @@ exports[`OptionList renders correctly 1`] = `
846
848
  Array [
847
849
  Object {
848
850
  "alignContent": "center",
849
- "backgroundColor": "#e8e9ea",
851
+ "backgroundColor": "#f6f6f7",
850
852
  "display": "flex",
851
853
  "flexDirection": "row",
852
854
  "justifyContent": "space-between",
@@ -1070,7 +1072,7 @@ exports[`OptionList renders correctly 1`] = `
1070
1072
  Array [
1071
1073
  Object {
1072
1074
  "alignContent": "center",
1073
- "backgroundColor": "#e8e9ea",
1075
+ "backgroundColor": "#f6f6f7",
1074
1076
  "display": "flex",
1075
1077
  "flexDirection": "row",
1076
1078
  "justifyContent": "space-between",
@@ -1468,7 +1470,7 @@ exports[`OptionList trigger onPress correctly on select new value 1`] = `
1468
1470
  Array [
1469
1471
  Object {
1470
1472
  "alignContent": "center",
1471
- "backgroundColor": "#e8e9ea",
1473
+ "backgroundColor": "#f6f6f7",
1472
1474
  "display": "flex",
1473
1475
  "flexDirection": "row",
1474
1476
  "justifyContent": "space-between",
@@ -1692,7 +1694,7 @@ exports[`OptionList trigger onPress correctly on select new value 1`] = `
1692
1694
  Array [
1693
1695
  Object {
1694
1696
  "alignContent": "center",
1695
- "backgroundColor": "#e8e9ea",
1697
+ "backgroundColor": "#f6f6f7",
1696
1698
  "display": "flex",
1697
1699
  "flexDirection": "row",
1698
1700
  "justifyContent": "space-between",
@@ -2090,7 +2092,7 @@ exports[`OptionList trigger onPress correctly on unselect current value 1`] = `
2090
2092
  Array [
2091
2093
  Object {
2092
2094
  "alignContent": "center",
2093
- "backgroundColor": "#e8e9ea",
2095
+ "backgroundColor": "#f6f6f7",
2094
2096
  "display": "flex",
2095
2097
  "flexDirection": "row",
2096
2098
  "justifyContent": "space-between",
@@ -2314,7 +2316,7 @@ exports[`OptionList trigger onPress correctly on unselect current value 1`] = `
2314
2316
  Array [
2315
2317
  Object {
2316
2318
  "alignContent": "center",
2317
- "backgroundColor": "#e8e9ea",
2319
+ "backgroundColor": "#f6f6f7",
2318
2320
  "display": "flex",
2319
2321
  "flexDirection": "row",
2320
2322
  "justifyContent": "space-between",
@@ -449,7 +449,7 @@ Array [
449
449
  Array [
450
450
  Object {
451
451
  "alignContent": "center",
452
- "backgroundColor": "#e8e9ea",
452
+ "backgroundColor": "#f6f6f7",
453
453
  "display": "flex",
454
454
  "flexDirection": "row",
455
455
  "justifyContent": "space-between",
@@ -852,7 +852,7 @@ Array [
852
852
  Array [
853
853
  Object {
854
854
  "alignContent": "center",
855
- "backgroundColor": "#e8e9ea",
855
+ "backgroundColor": "#f6f6f7",
856
856
  "display": "flex",
857
857
  "flexDirection": "row",
858
858
  "justifyContent": "space-between",
@@ -5898,7 +5898,7 @@ Array [
5898
5898
  Array [
5899
5899
  Object {
5900
5900
  "alignContent": "center",
5901
- "backgroundColor": "#e8e9ea",
5901
+ "backgroundColor": "#f6f6f7",
5902
5902
  "display": "flex",
5903
5903
  "flexDirection": "row",
5904
5904
  "justifyContent": "space-between",
@@ -6122,7 +6122,7 @@ Array [
6122
6122
  Array [
6123
6123
  Object {
6124
6124
  "alignContent": "center",
6125
- "backgroundColor": "#e8e9ea",
6125
+ "backgroundColor": "#f6f6f7",
6126
6126
  "display": "flex",
6127
6127
  "flexDirection": "row",
6128
6128
  "justifyContent": "space-between",
@@ -7,7 +7,7 @@ const AnimatedRow = Animated.createAnimatedComponent(StyledSpinnerRow);
7
7
 
8
8
  const AnimatedDot = Animated.createAnimatedComponent(StyledSpinnerDot);
9
9
 
10
- const AnimatedSpinner = () => {
10
+ const AnimatedSpinner = ({ size = 'medium' }: { size: 'small' | 'medium' }) => {
11
11
  const rotateAnimation = useRef<Animated.Value>(new Animated.Value(0));
12
12
 
13
13
  useEffect(() => {
@@ -40,13 +40,13 @@ const AnimatedSpinner = () => {
40
40
  },
41
41
  ])}
42
42
  >
43
- <AnimatedRow themePosition="top">
44
- <AnimatedDot themePosition="topLeft" />
45
- <AnimatedDot themePosition="topRight" />
43
+ <AnimatedRow themePosition="top" themeSize={size}>
44
+ <AnimatedDot themePosition="topLeft" themeSize={size} />
45
+ <AnimatedDot themePosition="topRight" themeSize={size} />
46
46
  </AnimatedRow>
47
- <AnimatedRow themePosition="bottom">
48
- <AnimatedDot themePosition="bottomLeft" />
49
- <AnimatedDot themePosition="bottomRight" />
47
+ <AnimatedRow themePosition="bottom" themeSize={size}>
48
+ <AnimatedDot themePosition="bottomLeft" themeSize={size} />
49
+ <AnimatedDot themePosition="bottomRight" themeSize={size} />
50
50
  </AnimatedRow>
51
51
  </Animated.View>
52
52
  );
@@ -11,43 +11,48 @@ const StyledSpinnerContainer = styled(View)<ViewProps>({
11
11
  alignItems: 'center',
12
12
  });
13
13
 
14
- const StyledSpinnerRow = styled(View)<{ themePosition: 'top' | 'bottom' }>(
15
- ({ themePosition, theme }) => ({
16
- flexDirection: 'row',
17
- marginBottom:
18
- themePosition === 'top'
19
- ? theme.__hd__.spinner.space.spinnerDotPadding
20
- : 0,
21
- })
22
- );
14
+ const StyledSpinnerRow = styled(View)<{
15
+ themePosition: 'top' | 'bottom';
16
+ themeSize: 'small' | 'medium';
17
+ }>(({ themePosition, themeSize = 'medium', theme }) => ({
18
+ flexDirection: 'row',
19
+ marginBottom:
20
+ themePosition === 'top'
21
+ ? theme.__hd__.spinner.space.spinnerDotPadding[themeSize]
22
+ : 0,
23
+ }));
23
24
 
24
25
  const StyledSpinnerDot = styled(View)<{
25
26
  themePosition: 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight';
26
- }>(({ themePosition, theme }) => {
27
+ themeSize: 'small' | 'medium';
28
+ }>(({ themePosition, themeSize = 'medium', theme }) => {
27
29
  const themeStyling = () => {
28
30
  switch (themePosition) {
29
31
  case 'topLeft':
30
- return { opacity: 1 };
32
+ return {
33
+ backgroundColor: theme.__hd__.spinner.colors.dot1,
34
+ };
31
35
  case 'topRight':
32
36
  return {
33
- marginLeft: theme.__hd__.spinner.space.spinnerDotPadding,
34
- opacity: 0.7,
37
+ marginLeft: theme.__hd__.spinner.space.spinnerDotPadding[themeSize],
38
+ backgroundColor: theme.__hd__.spinner.colors.dot2,
35
39
  };
36
40
  case 'bottomLeft':
37
- return { opacity: 0.5 };
41
+ return {
42
+ backgroundColor: theme.__hd__.spinner.colors.dot3,
43
+ };
38
44
  case 'bottomRight':
39
45
  return {
40
- marginLeft: theme.__hd__.spinner.space.spinnerDotPadding,
41
- opacity: 0.3,
46
+ marginLeft: theme.__hd__.spinner.space.spinnerDotPadding[themeSize],
47
+ backgroundColor: theme.__hd__.spinner.colors.dot4,
42
48
  };
43
49
  }
44
50
  };
45
51
 
46
52
  return {
47
- height: scale(theme.__hd__.spinner.space.spinnerDot),
48
- width: scale(theme.__hd__.spinner.space.spinnerDot),
53
+ height: scale(theme.__hd__.spinner.space.spinnerDot[themeSize]),
54
+ width: scale(theme.__hd__.spinner.space.spinnerDot[themeSize]),
49
55
  borderRadius: theme.__hd__.spinner.radii.default,
50
- backgroundColor: theme.__hd__.spinner.color.default,
51
56
  ...themeStyling(),
52
57
  };
53
58
  });
@@ -4,7 +4,7 @@ import { AnimatedSpinner } from '../AnimatedSpinner';
4
4
 
5
5
  describe('AnimatedSpinner', () => {
6
6
  it('renders correctly', () => {
7
- const { toJSON } = renderWithTheme(<AnimatedSpinner />);
7
+ const { toJSON } = renderWithTheme(<AnimatedSpinner size="medium" />);
8
8
 
9
9
  expect(toJSON()).toMatchSnapshot();
10
10
  });
@@ -8,10 +8,20 @@ import {
8
8
  } from '../StyledSpinner';
9
9
 
10
10
  describe('StyledSpinnerContainer', () => {
11
- it('renders correctly', () => {
11
+ it('renders correctly in small size', () => {
12
12
  const { toJSON } = renderWithTheme(
13
13
  <StyledSpinnerContainer>
14
- <AnimatedSpinner />
14
+ <AnimatedSpinner size="small" />
15
+ </StyledSpinnerContainer>
16
+ );
17
+
18
+ expect(toJSON()).toMatchSnapshot();
19
+ });
20
+
21
+ it('renders correctly in medium size', () => {
22
+ const { toJSON } = renderWithTheme(
23
+ <StyledSpinnerContainer>
24
+ <AnimatedSpinner size="medium" />
15
25
  </StyledSpinnerContainer>
16
26
  );
17
27
 
@@ -21,14 +31,16 @@ describe('StyledSpinnerContainer', () => {
21
31
 
22
32
  describe('StyledSpinnerRow', () => {
23
33
  it.each`
24
- themePosition
25
- ${'top'}
26
- ${'bottom'}
34
+ themePosition | themeSize
35
+ ${'top'} | ${'small'}
36
+ ${'bottom'} | ${'small'}
37
+ ${'top'} | ${'medium'}
38
+ ${'bottom'} | ${'medium'}
27
39
  `(
28
- 'renders correctly when position is $themePosition',
29
- ({ themePosition }) => {
40
+ 'renders correctly when position is $themePosition, and size is $themeSize',
41
+ ({ themePosition, themeSize }) => {
30
42
  const { toJSON } = renderWithTheme(
31
- <StyledSpinnerRow themePosition={themePosition} />
43
+ <StyledSpinnerRow themePosition={themePosition} themeSize={themeSize} />
32
44
  );
33
45
 
34
46
  expect(toJSON()).toMatchSnapshot();
@@ -38,16 +50,20 @@ describe('StyledSpinnerRow', () => {
38
50
 
39
51
  describe('StyledSpinnerText', () => {
40
52
  it.each`
41
- themePosition
42
- ${'topLeft'}
43
- ${'topRight'}
44
- ${'bottomLeft'}
45
- ${'bottomRight'}
53
+ themePosition | themeSize
54
+ ${'topLeft'} | ${'small'}
55
+ ${'topRight'} | ${'small'}
56
+ ${'bottomLeft'} | ${'small'}
57
+ ${'bottomRight'} | ${'small'}
58
+ ${'topLeft'} | ${'medium'}
59
+ ${'topRight'} | ${'medium'}
60
+ ${'bottomLeft'} | ${'medium'}
61
+ ${'bottomRight'} | ${'medium'}
46
62
  `(
47
- 'renders correctly when position is $themePosition',
48
- ({ themePosition }) => {
63
+ 'renders correctly when position is $themePosition, size is $themeSize',
64
+ ({ themePosition, themeSize }) => {
49
65
  const { toJSON } = renderWithTheme(
50
- <StyledSpinnerDot themePosition={themePosition} />
66
+ <StyledSpinnerDot themePosition={themePosition} themeSize={themeSize} />
51
67
  );
52
68
 
53
69
  expect(toJSON()).toMatchSnapshot();
@@ -27,6 +27,7 @@ exports[`AnimatedSpinner renders correctly 1`] = `
27
27
  ]
28
28
  }
29
29
  themePosition="top"
30
+ themeSize="medium"
30
31
  >
31
32
  <View
32
33
  collapsable={false}
@@ -34,16 +35,16 @@ exports[`AnimatedSpinner renders correctly 1`] = `
34
35
  style={
35
36
  Array [
36
37
  Object {
37
- "backgroundColor": "#8505a2",
38
- "borderRadius": 8,
38
+ "backgroundColor": "#795e90",
39
+ "borderRadius": 999,
39
40
  "height": 16,
40
- "opacity": 1,
41
41
  "width": 16,
42
42
  },
43
43
  Object {},
44
44
  ]
45
45
  }
46
46
  themePosition="topLeft"
47
+ themeSize="medium"
47
48
  />
48
49
  <View
49
50
  collapsable={false}
@@ -51,17 +52,17 @@ exports[`AnimatedSpinner renders correctly 1`] = `
51
52
  style={
52
53
  Array [
53
54
  Object {
54
- "backgroundColor": "#8505a2",
55
- "borderRadius": 8,
55
+ "backgroundColor": "#a08cb0",
56
+ "borderRadius": 999,
56
57
  "height": 16,
57
58
  "marginLeft": 8,
58
- "opacity": 0.7,
59
59
  "width": 16,
60
60
  },
61
61
  Object {},
62
62
  ]
63
63
  }
64
64
  themePosition="topRight"
65
+ themeSize="medium"
65
66
  />
66
67
  </View>
67
68
  <View
@@ -77,6 +78,7 @@ exports[`AnimatedSpinner renders correctly 1`] = `
77
78
  ]
78
79
  }
79
80
  themePosition="bottom"
81
+ themeSize="medium"
80
82
  >
81
83
  <View
82
84
  collapsable={false}
@@ -84,16 +86,16 @@ exports[`AnimatedSpinner renders correctly 1`] = `
84
86
  style={
85
87
  Array [
86
88
  Object {
87
- "backgroundColor": "#8505a2",
88
- "borderRadius": 8,
89
+ "backgroundColor": "#d9d1df",
90
+ "borderRadius": 999,
89
91
  "height": 16,
90
- "opacity": 0.5,
91
92
  "width": 16,
92
93
  },
93
94
  Object {},
94
95
  ]
95
96
  }
96
97
  themePosition="bottomLeft"
98
+ themeSize="medium"
97
99
  />
98
100
  <View
99
101
  collapsable={false}
@@ -101,17 +103,17 @@ exports[`AnimatedSpinner renders correctly 1`] = `
101
103
  style={
102
104
  Array [
103
105
  Object {
104
- "backgroundColor": "#8505a2",
105
- "borderRadius": 8,
106
+ "backgroundColor": "#ece8ef",
107
+ "borderRadius": 999,
106
108
  "height": 16,
107
109
  "marginLeft": 8,
108
- "opacity": 0.3,
109
110
  "width": 16,
110
111
  },
111
112
  Object {},
112
113
  ]
113
114
  }
114
115
  themePosition="bottomRight"
116
+ themeSize="medium"
115
117
  />
116
118
  </View>
117
119
  </View>