@hero-design/rn 7.25.0 → 7.26.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 (144) hide show
  1. package/.turbo/turbo-build.log +9 -9
  2. package/assets/fonts/BeVietnamPro-Bold.ttf +0 -0
  3. package/assets/fonts/{be-vietnam-pro-light.ttf → BeVietnamPro-Light.ttf} +0 -0
  4. package/assets/fonts/{be-vietnam-pro-regular.ttf → BeVietnamPro-Regular.ttf} +0 -0
  5. package/assets/fonts/{be-vietnam-pro-semibold.ttf → BeVietnamPro-SemiBold.ttf} +0 -0
  6. package/assets/fonts/RebondGrotesque-Light.otf +0 -0
  7. package/assets/fonts/RebondGrotesque-Regular.otf +0 -0
  8. package/assets/fonts/RebondGrotesque-SemiBold.otf +0 -0
  9. package/{lib/assets/fonts/hero-icons.ttf → assets/fonts/hero-icons-mobile.ttf} +0 -0
  10. package/es/index.js +9154 -12299
  11. package/jest.config.js +6 -2
  12. package/{assets/fonts/hero-icons.ttf → lib/assets/fonts/hero-icons-mobile.ttf} +0 -0
  13. package/lib/index.js +9154 -12298
  14. package/package.json +4 -4
  15. package/rollup.config.js +1 -1
  16. package/src/components/Accordion/__tests__/__snapshots__/AccordionItem.spec.tsx.snap +8 -0
  17. package/src/components/Accordion/__tests__/__snapshots__/index.spec.tsx.snap +12 -0
  18. package/src/components/Alert/__tests__/__snapshots__/index.spec.tsx.snap +11 -0
  19. package/src/components/Attachment/__tests__/__snapshots__/index.spec.tsx.snap +1 -0
  20. package/src/components/Avatar/{index.tsx → Avatar.tsx} +33 -18
  21. package/src/components/Avatar/AvatarStack/StyledAvatarStack.tsx +29 -0
  22. package/src/components/Avatar/AvatarStack/__tests__/StyledAvatarStack.spec.tsx +33 -0
  23. package/src/components/Avatar/AvatarStack/__tests__/__snapshots__/StyledAvatarStack.spec.tsx.snap +80 -0
  24. package/src/components/Avatar/AvatarStack/__tests__/__snapshots__/index.spec.tsx.snap +552 -0
  25. package/src/components/Avatar/AvatarStack/__tests__/index.spec.tsx +59 -0
  26. package/src/components/Avatar/AvatarStack/index.tsx +61 -0
  27. package/src/components/Avatar/AvatarStack/utils.ts +22 -0
  28. package/src/components/Avatar/StyledAvatar.tsx +6 -25
  29. package/src/components/Avatar/__tests__/StyledAvatar.spec.tsx +3 -19
  30. package/src/components/Avatar/__tests__/__snapshots__/StyledAvatar.spec.tsx.snap +3 -24
  31. package/src/components/Avatar/__tests__/__snapshots__/index.spec.tsx.snap +118 -20
  32. package/src/components/Avatar/__tests__/index.spec.tsx +25 -8
  33. package/src/components/Avatar/index.ts +6 -0
  34. package/src/components/Badge/__tests__/__snapshots__/Status.spec.tsx.snap +1 -0
  35. package/src/components/BottomNavigation/__tests__/__snapshots__/index.spec.tsx.snap +4 -0
  36. package/src/components/BottomSheet/__tests__/__snapshots__/index.spec.tsx.snap +2 -0
  37. package/src/components/Button/UtilityButton/__tests__/__snapshots__/index.spec.tsx.snap +2 -0
  38. package/src/components/Button/__tests__/__snapshots__/StyledButton.spec.tsx.snap +11 -0
  39. package/src/components/Calendar/__tests__/__snapshots__/CalendarRowItem.spec.tsx.snap +5 -0
  40. package/src/components/Card/DataCard/__tests__/__snapshots__/StyledDataCard.spec.tsx.snap +1 -1
  41. package/src/components/Card/DataCard/__tests__/__snapshots__/index.spec.tsx.snap +1 -1
  42. package/src/components/Card/__tests__/__snapshots__/index.spec.tsx.snap +4 -0
  43. package/src/components/Checkbox/__tests__/__snapshots__/index.spec.tsx.snap +4 -0
  44. package/src/components/ContentNavigator/__tests__/__snapshots__/StyledContentNavigator.spec.tsx.snap +1 -0
  45. package/src/components/ContentNavigator/__tests__/__snapshots__/index.spec.tsx.snap +2 -0
  46. package/src/components/ContentNavigator/index.tsx +8 -12
  47. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerAndroid.spec.tsx.snap +1 -0
  48. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +3 -0
  49. package/src/components/FAB/ActionGroup/__tests__/__snapshots__/index.spec.tsx.snap +12 -0
  50. package/src/components/FAB/__tests__/__snapshots__/StyledFAB.spec.tsx.snap +1 -0
  51. package/src/components/Icon/HeroIcon/glyphMap.json +1 -1
  52. package/src/components/Icon/HeroIcon/index.tsx +5 -1
  53. package/src/components/Icon/IconList.ts +11 -0
  54. package/src/components/List/__tests__/__snapshots__/BasicListItem.spec.tsx.snap +4 -0
  55. package/src/components/List/__tests__/__snapshots__/ListItem.spec.tsx.snap +54 -31
  56. package/src/components/List/__tests__/__snapshots__/StyledBasicListItem.spec.tsx.snap +4 -0
  57. package/src/components/List/__tests__/__snapshots__/StyledListItem.spec.tsx.snap +5 -1
  58. package/src/components/Progress/ProgressBar.tsx +19 -2
  59. package/src/components/Progress/ProgressCircle.tsx +30 -9
  60. package/src/components/Progress/StyledProgressBar.tsx +14 -7
  61. package/src/components/Progress/StyledProgressCircle.tsx +35 -24
  62. package/src/components/Progress/__tests__/__snapshots__/index.spec.js.snap +337 -30
  63. package/src/components/Progress/__tests__/index.spec.js +15 -0
  64. package/src/components/Progress/constants.ts +16 -0
  65. package/src/components/Progress/types.ts +7 -1
  66. package/src/components/Radio/__tests__/__snapshots__/Radio.spec.tsx.snap +2 -0
  67. package/src/components/Radio/__tests__/__snapshots__/RadioGroup.spec.tsx.snap +3 -0
  68. package/src/components/RichTextEditor/RichTextEditor.tsx +1 -1
  69. package/src/components/RichTextEditor/__mocks__/heroEditorApp.ts +2 -0
  70. package/src/components/RichTextEditor/__tests__/RichTextEditor.spec.tsx +36 -25
  71. package/src/components/RichTextEditor/__tests__/__snapshots__/RichTextEditor.spec.tsx.snap +8 -4
  72. package/src/components/RichTextEditor/heroEditorApp.ts +3 -0
  73. package/src/components/SectionHeading/__tests__/__snapshots__/index.spec.tsx.snap +4 -0
  74. package/src/components/Select/MultiSelect/__tests__/__snapshots__/Option.spec.tsx.snap +1 -0
  75. package/src/components/Select/MultiSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +20 -0
  76. package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +51 -0
  77. package/src/components/Select/MultiSelect/__tests__/index.spec.tsx +22 -0
  78. package/src/components/Select/MultiSelect/index.tsx +35 -13
  79. package/src/components/Select/SingleSelect/__tests__/__snapshots__/Option.spec.tsx.snap +1 -0
  80. package/src/components/Select/SingleSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +20 -0
  81. package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +46 -0
  82. package/src/components/Select/__tests__/__snapshots__/StyledSelect.spec.tsx.snap +1 -0
  83. package/src/components/Swipeable/__tests__/__snapshots__/SwipeableAction.spec.tsx.snap +3 -0
  84. package/src/components/Swipeable/__tests__/__snapshots__/index.spec.tsx.snap +1 -0
  85. package/src/components/Switch/SelectorSwitch/__tests__/__snapshots__/Option.spec.tsx.snap +1 -0
  86. package/src/components/Switch/SelectorSwitch/__tests__/__snapshots__/index.spec.tsx.snap +1 -0
  87. package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabs.spec.tsx.snap +2 -0
  88. package/src/components/Tabs/__tests__/__snapshots__/index.spec.tsx.snap +5 -0
  89. package/src/components/TextInput/__tests__/__snapshots__/StyledTextInput.spec.tsx.snap +22 -0
  90. package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +31 -0
  91. package/src/components/TimePicker/__tests__/__snapshots__/TimePickerAndroid.spec.tsx.snap +1 -0
  92. package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +3 -0
  93. package/src/components/Toast/__tests__/__snapshots__/Toast.spec.tsx.snap +13 -0
  94. package/src/components/Toolbar/__tests__/__snapshots__/ToolbarGroup.spec.tsx.snap +6 -0
  95. package/src/components/Toolbar/__tests__/__snapshots__/ToolbarItem.spec.tsx.snap +6 -0
  96. package/src/components/Typography/Text/StyledText.tsx +6 -2
  97. package/src/components/Typography/Text/__tests__/StyledText.spec.tsx +22 -0
  98. package/src/components/Typography/Text/__tests__/__snapshots__/StyledText.spec.tsx.snap +63 -0
  99. package/src/components/Typography/Text/index.tsx +8 -0
  100. package/src/index.ts +2 -1
  101. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +84 -21
  102. package/src/theme/components/avatar.ts +29 -5
  103. package/src/theme/components/badge.ts +1 -1
  104. package/src/theme/components/button.ts +2 -2
  105. package/src/theme/components/empty.ts +2 -2
  106. package/src/theme/components/fab.ts +3 -3
  107. package/src/theme/components/pinInput.ts +2 -2
  108. package/src/theme/components/progress.ts +37 -9
  109. package/src/theme/components/tag.ts +1 -1
  110. package/src/theme/components/typography.ts +1 -7
  111. package/src/theme/global/colors/global.ts +12 -3
  112. package/src/theme/global/colors/types.ts +5 -0
  113. package/src/theme/global/scale.ts +6 -2
  114. package/src/theme/global/typography.ts +23 -5
  115. package/types/components/Avatar/Avatar.d.ts +33 -0
  116. package/types/components/Avatar/AvatarStack/StyledAvatarStack.d.ts +17 -0
  117. package/types/components/Avatar/AvatarStack/index.d.ts +23 -0
  118. package/types/components/Avatar/AvatarStack/utils.d.ts +4 -0
  119. package/types/components/Avatar/StyledAvatar.d.ts +2 -12
  120. package/types/components/Avatar/index.d.ts +6 -25
  121. package/types/components/Icon/IconList.d.ts +1 -1
  122. package/types/components/Icon/index.d.ts +1 -1
  123. package/types/components/Icon/utils.d.ts +1 -1
  124. package/types/components/Progress/ProgressBar.d.ts +1 -1
  125. package/types/components/Progress/ProgressCircle.d.ts +4 -2
  126. package/types/components/Progress/StyledProgressBar.d.ts +2 -0
  127. package/types/components/Progress/StyledProgressCircle.d.ts +2 -0
  128. package/types/components/Progress/constants.d.ts +15 -0
  129. package/types/components/Progress/index.d.ts +1 -1
  130. package/types/components/Progress/types.d.ts +1 -1
  131. package/types/components/RichTextEditor/__mocks__/heroEditorApp.d.ts +2 -0
  132. package/types/components/RichTextEditor/heroEditorApp.d.ts +2 -0
  133. package/types/components/Select/MultiSelect/index.d.ts +4 -1
  134. package/types/components/Typography/Text/StyledText.d.ts +1 -0
  135. package/types/components/Typography/Text/index.d.ts +7 -1
  136. package/types/index.d.ts +2 -2
  137. package/types/theme/components/avatar.d.ts +4 -2
  138. package/types/theme/components/progress.d.ts +30 -9
  139. package/types/theme/components/typography.d.ts +1 -5
  140. package/types/theme/global/colors/types.d.ts +5 -0
  141. package/types/theme/global/index.d.ts +5 -0
  142. package/types/theme/global/scale.d.ts +4 -1
  143. package/types/theme/global/typography.d.ts +9 -2
  144. package/src/components/Icon/HeroIcon/fonts/hero-icons.ttf +0 -0
@@ -18,45 +18,64 @@ export interface ProgressCircleProps extends ViewProps {
18
18
  * The progress completion percentage: 0-100.
19
19
  */
20
20
  value: number;
21
+ /*
22
+ * Testing id of the component.
23
+ */
24
+ renderValue?: (value: number) => React.ReactNode;
21
25
  /**
22
26
  * Set intent for your progress.
23
27
  */
24
- intent?: 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'archived';
28
+ intent?:
29
+ | 'primary'
30
+ | 'success'
31
+ | 'warning'
32
+ | 'danger'
33
+ | 'info'
34
+ | 'archived'
35
+ | 'primary-inverted'
36
+ | 'success-inverted'
37
+ | 'warning-inverted'
38
+ | 'danger-inverted'
39
+ | 'info-inverted'
40
+ | 'archived-inverted';
25
41
  /**
26
42
  * Additional style.
27
43
  */
28
44
  style?: StyleProp<ViewStyle>;
29
45
  /*
30
46
  * Testing id of the component.
31
- * */
47
+ */
32
48
  testID?: string;
33
49
  }
34
50
 
35
51
  const HalfCircle = ({
36
52
  type,
37
- themeIntent = 'primary',
53
+ themeIntent,
38
54
  }: {
39
55
  type: 'background' | 'foreground';
40
- themeIntent?: ThemeIntent;
56
+ themeIntent: ThemeIntent;
41
57
  }) => (
42
58
  <StyledHalfCircleWrapper>
43
59
  {type === 'background' ? (
44
- <StyledHalfCircleInnerBG />
60
+ <StyledHalfCircleInnerBG themeIntent={themeIntent} />
45
61
  ) : (
46
62
  <StyledHalfCircleInnerFG themeIntent={themeIntent} />
47
63
  )}
48
64
  </StyledHalfCircleWrapper>
49
65
  );
50
66
 
67
+ const defaultRenderValue = (value: number) => `${value}%`;
68
+
51
69
  const ProgressCircle = ({
52
70
  value,
71
+ renderValue = defaultRenderValue,
53
72
  intent = 'primary',
54
73
  style,
55
74
  testID,
56
75
  ...nativeProps
57
76
  }: ProgressCircleProps): JSX.Element => {
58
77
  const theme = useTheme();
59
- const radius = theme.__hd__.progress.sizes.circleWidth / 2;
78
+ const radius = theme.__hd__.progress.sizes.circleDiameter / 2;
60
79
  const progressAnimatedValue = useRef<Animated.Value>(new Animated.Value(0));
61
80
 
62
81
  useEffect(() => {
@@ -116,7 +135,7 @@ const ProgressCircle = ({
116
135
  ],
117
136
  }}
118
137
  >
119
- <HalfCircle type="background" />
138
+ <HalfCircle type="background" themeIntent={intent} />
120
139
  </Animated.View>
121
140
  </View>
122
141
  <View
@@ -138,7 +157,7 @@ const ProgressCircle = ({
138
157
  opacity: interpolateOpacityRightHalf,
139
158
  }}
140
159
  >
141
- <HalfCircle type="background" />
160
+ <HalfCircle type="background" themeIntent={intent} />
142
161
  </Animated.View>
143
162
  </View>
144
163
  <StyledStrokeEnd themeIntent={intent} />
@@ -152,7 +171,9 @@ const ProgressCircle = ({
152
171
  <StyledStrokeEnd themeIntent={intent} />
153
172
  </Animated.View>
154
173
  <StyledDonutCircle>
155
- <Typography.Text fontSize="large">{`${value}%`}</Typography.Text>
174
+ <Typography.Text fontSize="large">
175
+ {renderValue(value)}
176
+ </Typography.Text>
156
177
  </StyledDonutCircle>
157
178
  </StyledContainer>
158
179
  </View>
@@ -2,19 +2,26 @@ import { Animated, View } from 'react-native';
2
2
  import styled from '@emotion/native';
3
3
  import type { ViewProps } from 'react-native';
4
4
  import type { ThemeIntent } from './types';
5
+ import { THEME_INTENT_MAP } from './constants';
5
6
 
6
- const StyledWrapper = styled(View)<ViewProps>(({ theme }) => ({
7
- height: theme.__hd__.progress.sizes.barHeight,
8
- alignSelf: 'stretch',
9
- backgroundColor: theme.__hd__.progress.colors.background,
10
- overflow: 'hidden',
11
- }));
7
+ const StyledWrapper = styled(View)<ViewProps & { themeIntent: ThemeIntent }>(
8
+ ({ theme, themeIntent }) => ({
9
+ height: theme.__hd__.progress.sizes.barHeight,
10
+ alignSelf: 'stretch',
11
+ backgroundColor:
12
+ theme.__hd__.progress.colors.incompleteness[
13
+ THEME_INTENT_MAP[themeIntent]
14
+ ],
15
+ overflow: 'hidden',
16
+ })
17
+ );
12
18
 
13
19
  const StyledInner = styled(Animated.View)<{ themeIntent: ThemeIntent }>(
14
20
  ({ theme, themeIntent }) => ({
15
21
  flex: 1,
16
22
  alignSelf: 'stretch',
17
- backgroundColor: theme.__hd__.progress.colors[themeIntent],
23
+ backgroundColor:
24
+ theme.__hd__.progress.colors.completeness[THEME_INTENT_MAP[themeIntent]],
18
25
  })
19
26
  );
20
27
 
@@ -2,9 +2,7 @@ import { View } from 'react-native';
2
2
  import styled from '@emotion/native';
3
3
  import type { ViewProps } from 'react-native';
4
4
  import type { ThemeIntent } from './types';
5
-
6
- const INNER_CIRCLE_PERCENTAGE = 0.85; // 85% width according to design
7
- const STROKE_WIDTH_PERCENTAGE = 0.075; // 7.5% width according to design
5
+ import { THEME_INTENT_MAP } from './constants';
8
6
 
9
7
  const StyledContainer = styled(View)<ViewProps>(({ theme }) => ({
10
8
  flexDirection: 'row',
@@ -12,35 +10,46 @@ const StyledContainer = styled(View)<ViewProps>(({ theme }) => ({
12
10
  }));
13
11
 
14
12
  const StyledHalfCircleWrapper = styled(View)<ViewProps>(({ theme }) => ({
15
- width: theme.__hd__.progress.sizes.circleWidth / 2,
16
- height: theme.__hd__.progress.sizes.circleWidth,
13
+ width: theme.__hd__.progress.sizes.circleDiameter / 2,
14
+ height: theme.__hd__.progress.sizes.circleDiameter,
17
15
  overflow: 'hidden',
18
16
  }));
19
17
 
20
18
  const StyledHalfCircleInnerFG = styled(View)<{ themeIntent: ThemeIntent }>(
21
19
  ({ theme, themeIntent }) => ({
22
- width: theme.__hd__.progress.sizes.circleWidth,
23
- height: theme.__hd__.progress.sizes.circleWidth,
24
- backgroundColor: theme.__hd__.progress.colors[themeIntent],
20
+ width: theme.__hd__.progress.sizes.circleDiameter,
21
+ height: theme.__hd__.progress.sizes.circleDiameter,
25
22
  borderRadius: theme.__hd__.progress.radii.default,
23
+ borderColor:
24
+ theme.__hd__.progress.colors.completeness[THEME_INTENT_MAP[themeIntent]],
25
+ borderWidth: theme.__hd__.progress.sizes.circleCompletenessHeight,
26
26
  })
27
27
  );
28
28
 
29
- const StyledHalfCircleInnerBG = styled(View)<ViewProps>(({ theme }) => ({
30
- width: theme.__hd__.progress.sizes.circleWidth,
31
- height: theme.__hd__.progress.sizes.circleWidth,
32
- backgroundColor: theme.__hd__.progress.colors.background,
33
- borderRadius: theme.__hd__.progress.radii.default,
34
- }));
29
+ const StyledHalfCircleInnerBG = styled(View)<{ themeIntent: ThemeIntent }>(
30
+ ({ theme, themeIntent }) => ({
31
+ width: theme.__hd__.progress.sizes.circleDiameter,
32
+ height: theme.__hd__.progress.sizes.circleDiameter,
33
+ borderRadius: theme.__hd__.progress.radii.default,
34
+ borderWidth: theme.__hd__.progress.sizes.circleCompletenessHeight,
35
+ borderColor:
36
+ theme.__hd__.progress.colors.incompleteness[
37
+ THEME_INTENT_MAP[themeIntent]
38
+ ],
39
+ })
40
+ );
35
41
 
36
42
  const StyledDonutCircle = styled(View)<ViewProps>(({ theme }) => ({
37
43
  position: 'absolute',
38
- top: theme.__hd__.progress.sizes.circleWidth * STROKE_WIDTH_PERCENTAGE,
39
- left: theme.__hd__.progress.sizes.circleWidth * STROKE_WIDTH_PERCENTAGE,
40
- width: theme.__hd__.progress.sizes.circleWidth * INNER_CIRCLE_PERCENTAGE,
41
- height: theme.__hd__.progress.sizes.circleWidth * INNER_CIRCLE_PERCENTAGE,
44
+ top: theme.__hd__.progress.sizes.circleCompletenessHeight,
45
+ left: theme.__hd__.progress.sizes.circleCompletenessHeight,
46
+ width:
47
+ theme.__hd__.progress.sizes.circleDiameter -
48
+ theme.__hd__.progress.sizes.circleCompletenessHeight * 2,
49
+ height:
50
+ theme.__hd__.progress.sizes.circleDiameter -
51
+ theme.__hd__.progress.sizes.circleCompletenessHeight * 2,
42
52
  zIndex: 3,
43
- backgroundColor: theme.__hd__.progress.colors.innerBackground,
44
53
  borderRadius: theme.__hd__.progress.radii.default,
45
54
  alignItems: 'center',
46
55
  justifyContent: 'center',
@@ -51,12 +60,14 @@ const StyledStrokeEnd = styled(View)<{ themeIntent: ThemeIntent }>(
51
60
  position: 'absolute',
52
61
  top: 0,
53
62
  left:
54
- theme.__hd__.progress.sizes.circleWidth / 2 -
55
- (theme.__hd__.progress.sizes.circleWidth * STROKE_WIDTH_PERCENTAGE) / 2,
56
- width: theme.__hd__.progress.sizes.circleWidth * STROKE_WIDTH_PERCENTAGE,
57
- height: theme.__hd__.progress.sizes.circleWidth * STROKE_WIDTH_PERCENTAGE,
63
+ (theme.__hd__.progress.sizes.circleDiameter -
64
+ theme.__hd__.progress.sizes.circleCompletenessHeight) /
65
+ 2,
66
+ width: theme.__hd__.progress.sizes.circleCompletenessHeight,
67
+ height: theme.__hd__.progress.sizes.circleCompletenessHeight,
58
68
  borderRadius: theme.__hd__.progress.radii.default,
59
- backgroundColor: theme.__hd__.progress.colors[themeIntent],
69
+ backgroundColor:
70
+ theme.__hd__.progress.colors.completeness[THEME_INTENT_MAP[themeIntent]],
60
71
  zIndex: 2,
61
72
  })
62
73
  );