@hero-design/rn 8.32.1 → 8.33.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 (29) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/es/index.js +163 -54
  3. package/lib/index.js +163 -54
  4. package/package.json +5 -5
  5. package/src/components/Button/LoadingIndicator/StyledLoadingIndicator.tsx +2 -1
  6. package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/index.spec.tsx.snap +10 -10
  7. package/src/components/Button/__tests__/__snapshots__/Button.spec.tsx.snap +6 -6
  8. package/src/components/FAB/ActionGroup/ActionItem.tsx +39 -14
  9. package/src/components/FAB/ActionGroup/__tests__/__snapshots__/index.spec.tsx.snap +982 -819
  10. package/src/components/FAB/ActionGroup/__tests__/index.spec.tsx +4 -11
  11. package/src/components/FAB/ActionGroup/index.tsx +119 -93
  12. package/src/components/FAB/AnimatedFABIcon.tsx +3 -5
  13. package/src/components/FAB/FAB.tsx +108 -28
  14. package/src/components/FAB/__tests__/__snapshots__/index.spec.tsx.snap +27 -9
  15. package/src/components/FAB/__tests__/index.spec.tsx +22 -2
  16. package/src/components/Typography/Text/index.tsx +19 -12
  17. package/src/components/Typography/index.tsx +3 -0
  18. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +1 -0
  19. package/src/theme/components/button.ts +1 -0
  20. package/src/types.ts +4 -0
  21. package/testUtils/setup.tsx +2 -0
  22. package/types/components/FAB/ActionGroup/ActionItem.d.ts +4 -2
  23. package/types/components/FAB/ActionGroup/StyledActionGroup.d.ts +1 -1
  24. package/types/components/FAB/ActionGroup/index.d.ts +8 -2
  25. package/types/components/FAB/FAB.d.ts +8 -2
  26. package/types/components/FAB/index.d.ts +3 -2
  27. package/types/components/Typography/index.d.ts +3 -0
  28. package/types/theme/components/button.d.ts +1 -0
  29. package/types/types.d.ts +3 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "8.32.1",
3
+ "version": "8.33.0",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -21,7 +21,7 @@
21
21
  "dependencies": {
22
22
  "@emotion/native": "^11.9.3",
23
23
  "@emotion/react": "^11.9.3",
24
- "@hero-design/colors": "8.32.1",
24
+ "@hero-design/colors": "8.33.0",
25
25
  "date-fns": "^2.16.1",
26
26
  "events": "^3.2.0",
27
27
  "hero-editor": "^1.9.21"
@@ -45,7 +45,7 @@
45
45
  "@babel/preset-typescript": "^7.17.12",
46
46
  "@babel/runtime": "^7.18.9",
47
47
  "@emotion/jest": "^11.9.3",
48
- "@hero-design/eslint-plugin": "8.32.1",
48
+ "@hero-design/eslint-plugin": "8.33.0",
49
49
  "@react-native-community/datetimepicker": "^3.5.2",
50
50
  "@react-native-community/slider": "4.1.12",
51
51
  "@rollup/plugin-babel": "^5.3.1",
@@ -61,10 +61,10 @@
61
61
  "@types/react-native": "^0.67.7",
62
62
  "@types/react-native-vector-icons": "^6.4.10",
63
63
  "babel-plugin-inline-import": "^3.0.0",
64
- "eslint-config-hd": "8.32.1",
64
+ "eslint-config-hd": "8.33.0",
65
65
  "eslint-plugin-import": "^2.27.5",
66
66
  "jest": "^27.3.1",
67
- "prettier-config-hd": "8.32.1",
67
+ "prettier-config-hd": "8.33.0",
68
68
  "react": "18.0.0",
69
69
  "react-native": "0.69.7",
70
70
  "react-native-gesture-handler": "~2.1.0",
@@ -29,7 +29,8 @@ const StyledLoadingIndicatorWrapper = styled(View)<ViewProps>(({ theme }) => ({
29
29
  flexDirection: 'row',
30
30
  justifyContent: 'center',
31
31
  alignItems: 'center',
32
- paddingVertical: theme.space.xxsmall,
32
+ paddingVertical:
33
+ theme.__hd__.button.space.loadingIndicatorWrapperVerticalPadding,
33
34
  }));
34
35
 
35
36
  const StyledLoadingDot = styled(View)<{
@@ -9,7 +9,7 @@ exports[`LoadingIndicator renders correctly when themeVariant is basic-transpare
9
9
  "alignItems": "center",
10
10
  "flexDirection": "row",
11
11
  "justifyContent": "center",
12
- "paddingVertical": 2,
12
+ "paddingVertical": 1,
13
13
  },
14
14
  Object {},
15
15
  ]
@@ -123,7 +123,7 @@ exports[`LoadingIndicator renders correctly when themeVariant is filled-danger 1
123
123
  "alignItems": "center",
124
124
  "flexDirection": "row",
125
125
  "justifyContent": "center",
126
- "paddingVertical": 2,
126
+ "paddingVertical": 1,
127
127
  },
128
128
  Object {},
129
129
  ]
@@ -237,7 +237,7 @@ exports[`LoadingIndicator renders correctly when themeVariant is filled-primary
237
237
  "alignItems": "center",
238
238
  "flexDirection": "row",
239
239
  "justifyContent": "center",
240
- "paddingVertical": 2,
240
+ "paddingVertical": 1,
241
241
  },
242
242
  Object {},
243
243
  ]
@@ -351,7 +351,7 @@ exports[`LoadingIndicator renders correctly when themeVariant is filled-secondar
351
351
  "alignItems": "center",
352
352
  "flexDirection": "row",
353
353
  "justifyContent": "center",
354
- "paddingVertical": 2,
354
+ "paddingVertical": 1,
355
355
  },
356
356
  Object {},
357
357
  ]
@@ -465,7 +465,7 @@ exports[`LoadingIndicator renders correctly when themeVariant is outlined-danger
465
465
  "alignItems": "center",
466
466
  "flexDirection": "row",
467
467
  "justifyContent": "center",
468
- "paddingVertical": 2,
468
+ "paddingVertical": 1,
469
469
  },
470
470
  Object {},
471
471
  ]
@@ -579,7 +579,7 @@ exports[`LoadingIndicator renders correctly when themeVariant is outlined-primar
579
579
  "alignItems": "center",
580
580
  "flexDirection": "row",
581
581
  "justifyContent": "center",
582
- "paddingVertical": 2,
582
+ "paddingVertical": 1,
583
583
  },
584
584
  Object {},
585
585
  ]
@@ -693,7 +693,7 @@ exports[`LoadingIndicator renders correctly when themeVariant is outlined-second
693
693
  "alignItems": "center",
694
694
  "flexDirection": "row",
695
695
  "justifyContent": "center",
696
- "paddingVertical": 2,
696
+ "paddingVertical": 1,
697
697
  },
698
698
  Object {},
699
699
  ]
@@ -807,7 +807,7 @@ exports[`LoadingIndicator renders correctly when themeVariant is text-danger 1`]
807
807
  "alignItems": "center",
808
808
  "flexDirection": "row",
809
809
  "justifyContent": "center",
810
- "paddingVertical": 2,
810
+ "paddingVertical": 1,
811
811
  },
812
812
  Object {},
813
813
  ]
@@ -921,7 +921,7 @@ exports[`LoadingIndicator renders correctly when themeVariant is text-primary 1`
921
921
  "alignItems": "center",
922
922
  "flexDirection": "row",
923
923
  "justifyContent": "center",
924
- "paddingVertical": 2,
924
+ "paddingVertical": 1,
925
925
  },
926
926
  Object {},
927
927
  ]
@@ -1035,7 +1035,7 @@ exports[`LoadingIndicator renders correctly when themeVariant is text-secondary
1035
1035
  "alignItems": "center",
1036
1036
  "flexDirection": "row",
1037
1037
  "justifyContent": "center",
1038
- "paddingVertical": 2,
1038
+ "paddingVertical": 1,
1039
1039
  },
1040
1040
  Object {},
1041
1041
  ]
@@ -107,7 +107,7 @@ exports[`Button renders correctly 2`] = `
107
107
  "alignItems": "center",
108
108
  "flexDirection": "row",
109
109
  "justifyContent": "center",
110
- "paddingVertical": 2,
110
+ "paddingVertical": 1,
111
111
  },
112
112
  Object {},
113
113
  ]
@@ -393,7 +393,7 @@ exports[`Button renders correctly 5`] = `
393
393
  "alignItems": "center",
394
394
  "flexDirection": "row",
395
395
  "justifyContent": "center",
396
- "paddingVertical": 2,
396
+ "paddingVertical": 1,
397
397
  },
398
398
  Object {},
399
399
  ]
@@ -677,7 +677,7 @@ exports[`Button renders correctly 8`] = `
677
677
  "alignItems": "center",
678
678
  "flexDirection": "row",
679
679
  "justifyContent": "center",
680
- "paddingVertical": 2,
680
+ "paddingVertical": 1,
681
681
  },
682
682
  Object {},
683
683
  ]
@@ -959,7 +959,7 @@ exports[`Button renders correctly 11`] = `
959
959
  "alignItems": "center",
960
960
  "flexDirection": "row",
961
961
  "justifyContent": "center",
962
- "paddingVertical": 2,
962
+ "paddingVertical": 1,
963
963
  },
964
964
  Object {},
965
965
  ]
@@ -1241,7 +1241,7 @@ exports[`Button renders correctly 14`] = `
1241
1241
  "alignItems": "center",
1242
1242
  "flexDirection": "row",
1243
1243
  "justifyContent": "center",
1244
- "paddingVertical": 2,
1244
+ "paddingVertical": 1,
1245
1245
  },
1246
1246
  Object {},
1247
1247
  ]
@@ -1456,7 +1456,7 @@ exports[`Button renders loading icon 1`] = `
1456
1456
  "alignItems": "center",
1457
1457
  "flexDirection": "row",
1458
1458
  "justifyContent": "center",
1459
- "paddingVertical": 2,
1459
+ "paddingVertical": 1,
1460
1460
  },
1461
1461
  Object {},
1462
1462
  ]
@@ -1,6 +1,11 @@
1
1
  import React from 'react';
2
2
  import type { ComponentProps } from 'react';
3
- import type { StyleProp, ViewStyle } from 'react-native';
3
+ import {
4
+ Animated,
5
+ Platform,
6
+ type StyleProp,
7
+ type ViewStyle,
8
+ } from 'react-native';
4
9
  import Icon from '../../Icon';
5
10
  import {
6
11
  StyledActionItem,
@@ -17,6 +22,8 @@ export interface ActionItemProps {
17
22
  onPress?: () => void;
18
23
  style?: StyleProp<ViewStyle>;
19
24
  key?: string;
25
+ index: number;
26
+ active?: boolean;
20
27
  }
21
28
  const ActionItem = ({
22
29
  icon,
@@ -24,23 +31,41 @@ const ActionItem = ({
24
31
  onPress,
25
32
  style,
26
33
  testID,
34
+ index,
35
+ active = false,
27
36
  }: ActionItemProps) => {
28
37
  const theme = useTheme();
38
+ const animatedValue = React.useRef(new Animated.Value(0));
39
+
40
+ const translateY = animatedValue.current.interpolate({
41
+ inputRange: [0, 1],
42
+ outputRange: [50, 0],
43
+ });
44
+
45
+ React.useEffect(() => {
46
+ Animated.spring(animatedValue.current, {
47
+ toValue: active ? 1 : 0,
48
+ useNativeDriver: Platform.OS !== 'web',
49
+ delay: index * 20,
50
+ }).start();
51
+ }, [active, index]);
29
52
 
30
53
  return (
31
- <StyledActionItem
32
- underlayColor={theme.__hd__.fab.colors.actionItemPressedBackground}
33
- style={style}
34
- onPress={onPress}
35
- testID={testID}
36
- >
37
- <>
38
- <StyledIconContainer>
39
- <StyledIcon size="xsmall" icon={icon} />
40
- </StyledIconContainer>
41
- <StyledActionItemText>{title}</StyledActionItemText>
42
- </>
43
- </StyledActionItem>
54
+ <Animated.View style={{ transform: [{ translateY }] }}>
55
+ <StyledActionItem
56
+ underlayColor={theme.__hd__.fab.colors.actionItemPressedBackground}
57
+ style={style}
58
+ onPress={onPress}
59
+ testID={testID}
60
+ >
61
+ <>
62
+ <StyledIconContainer>
63
+ <StyledIcon size="xsmall" icon={icon} />
64
+ </StyledIconContainer>
65
+ <StyledActionItemText>{title}</StyledActionItemText>
66
+ </>
67
+ </StyledActionItem>
68
+ </Animated.View>
44
69
  );
45
70
  };
46
71