@hero-design/rn 8.69.0 → 8.71.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 (34) hide show
  1. package/.turbo/turbo-build.log +3 -3
  2. package/CHANGELOG.md +23 -0
  3. package/es/index.js +114 -89
  4. package/lib/index.js +114 -89
  5. package/package.json +2 -2
  6. package/src/components/Card/StyledCard.tsx +6 -2
  7. package/src/components/Card/__tests__/__snapshots__/StyledCard.spec.tsx.snap +1 -1
  8. package/src/components/Card/__tests__/__snapshots__/index.spec.tsx.snap +7 -0
  9. package/src/components/Card/__tests__/index.spec.tsx +12 -0
  10. package/src/components/Card/index.tsx +8 -2
  11. package/src/components/Carousel/__tests__/__snapshots__/CardCarousel.spec.tsx.snap +4 -0
  12. package/src/components/Carousel/__tests__/__snapshots__/StyledCardCarousel.spec.tsx.snap +1 -0
  13. package/src/components/Chip/StyledChip.tsx +56 -50
  14. package/src/components/Chip/__tests__/__snapshots__/index.spec.tsx.snap +302 -336
  15. package/src/components/Chip/__tests__/index.spec.tsx +8 -26
  16. package/src/components/Chip/index.tsx +27 -34
  17. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +13 -6
  18. package/src/theme/components/card.ts +1 -0
  19. package/src/theme/components/chip.ts +12 -6
  20. package/src/theme/global/colors/__tests__/__snapshots__/swagLight.spec.ts.snap +5 -5
  21. package/src/theme/global/colors/__tests__/__snapshots__/swagLightGlobal.spec.ts.snap +39 -0
  22. package/src/theme/global/colors/__tests__/__snapshots__/swagLightJobs.spec.ts.snap +5 -5
  23. package/src/theme/global/colors/__tests__/swagLightGlobal.spec.ts +7 -0
  24. package/src/theme/global/colors/swagLight.ts +2 -2
  25. package/src/theme/global/colors/swagLightGlobal.ts +14 -0
  26. package/stats/8.70.0/rn-stats.html +4842 -0
  27. package/stats/8.71.0/rn-stats.html +4842 -0
  28. package/types/components/Card/StyledCard.d.ts +1 -0
  29. package/types/components/Card/index.d.ts +2 -1
  30. package/types/components/Chip/StyledChip.d.ts +2 -20
  31. package/types/components/Chip/index.d.ts +7 -3
  32. package/types/theme/components/card.d.ts +1 -0
  33. package/types/theme/components/chip.d.ts +12 -6
  34. package/types/theme/global/colors/swagLightGlobal.d.ts +3 -0
@@ -1,11 +1,8 @@
1
1
  import styled from '@emotion/native';
2
2
  import { TouchableOpacity } from 'react-native';
3
- import Box from '../Box';
4
- import Icon from '../Icon';
5
- import Typography from '../Typography';
6
3
 
7
4
  type StyledChipWrapperProps = {
8
- themeVariant?: 'outlined' | 'filled';
5
+ themeVariant?: 'outlined' | 'filled' | 'compact';
9
6
  themeSelected?: boolean;
10
7
  };
11
8
 
@@ -13,6 +10,7 @@ const StyledChipWrapper = styled(TouchableOpacity)<StyledChipWrapperProps>(
13
10
  ({ themeVariant, themeSelected, theme }) => {
14
11
  const getShadowStyles = () => {
15
12
  switch (themeVariant) {
13
+ case 'compact':
16
14
  case 'filled':
17
15
  return {
18
16
  ...theme.__hd__.chip.shadows.filledWrapper,
@@ -23,27 +21,20 @@ const StyledChipWrapper = styled(TouchableOpacity)<StyledChipWrapperProps>(
23
21
  };
24
22
 
25
23
  const getBorderStyles = () => {
26
- const commonStyle = {
27
- borderWidth: theme.__hd__.chip.sizes.wrapperBorder,
28
- };
29
-
30
- if (themeSelected) {
31
- return {
32
- ...commonStyle,
33
- borderColor: theme.__hd__.chip.colors.wrapperSelectedBorder,
34
- };
35
- }
36
-
37
24
  switch (themeVariant) {
38
25
  case 'outlined': {
39
26
  return {
40
- ...commonStyle,
41
- borderColor: theme.__hd__.chip.colors.wrapperBorder,
27
+ borderColor: themeSelected
28
+ ? theme.__hd__.chip.colors.outlinedSelectedBorder
29
+ : theme.__hd__.chip.colors.outlinedDefaultBorder,
30
+ borderWidth: themeSelected
31
+ ? theme.__hd__.chip.sizes.outlinedSelectedBorder
32
+ : theme.__hd__.chip.sizes.outlinedDefaultBorder,
42
33
  };
43
34
  }
35
+ case 'compact':
44
36
  case 'filled': {
45
37
  return {
46
- ...commonStyle,
47
38
  borderColor: theme.__hd__.chip.colors.wrapperSelectedBorder,
48
39
  };
49
40
  }
@@ -55,25 +46,62 @@ const StyledChipWrapper = styled(TouchableOpacity)<StyledChipWrapperProps>(
55
46
  switch (themeVariant) {
56
47
  case 'outlined': {
57
48
  return {
58
- backgroundColor: theme.__hd__.chip.colors.primaryBackground,
49
+ backgroundColor: themeSelected
50
+ ? theme.__hd__.chip.colors.outlinedSelectedBackground
51
+ : theme.__hd__.chip.colors.outlinedDefaultBackground,
59
52
  };
60
53
  }
61
- case 'filled':
54
+ case 'filled': {
62
55
  return {
63
56
  backgroundColor: theme.__hd__.chip.colors.secondaryBackground,
64
57
  };
58
+ }
59
+
60
+ case 'compact': {
61
+ return {
62
+ backgroundColor:
63
+ theme.__hd__.chip.colors.compactSelectedBackground,
64
+ };
65
+ }
65
66
  }
66
67
  } else {
67
68
  switch (themeVariant) {
68
69
  case 'outlined': {
69
70
  return {
70
- backgroundColor: theme.__hd__.chip.colors.outlinedBackground,
71
+ backgroundColor:
72
+ theme.__hd__.chip.colors.outlinedDefaultBackground,
71
73
  };
72
74
  }
73
- case 'filled':
75
+ case 'filled': {
74
76
  return {
75
77
  backgroundColor: theme.__hd__.chip.colors.filledBackground,
76
78
  };
79
+ }
80
+ case 'compact': {
81
+ return {
82
+ backgroundColor:
83
+ theme.__hd__.chip.colors.compactDefaultBackground,
84
+ };
85
+ }
86
+ }
87
+ }
88
+ };
89
+
90
+ const getPaddingStyles = () => {
91
+ switch (themeVariant) {
92
+ case 'compact': {
93
+ return {
94
+ paddingHorizontal:
95
+ theme.__hd__.chip.space.compactWrapperHorizontalPadding,
96
+ paddingVertical:
97
+ theme.__hd__.chip.space.compactWrapperVerticalPadding,
98
+ };
99
+ }
100
+ default: {
101
+ return {
102
+ paddingHorizontal: theme.__hd__.chip.space.wrapperHorizontalPadding,
103
+ paddingVertical: theme.__hd__.chip.space.wrapperVerticalPadding,
104
+ };
77
105
  }
78
106
  }
79
107
  };
@@ -84,38 +112,16 @@ const StyledChipWrapper = styled(TouchableOpacity)<StyledChipWrapperProps>(
84
112
  alignItems: 'center',
85
113
  justifyContent: 'center',
86
114
  borderRadius: theme.__hd__.chip.radii.wrapper,
87
- paddingVertical: theme.__hd__.chip.space.wrapperVerticalPadding,
88
- paddingHorizontal: theme.__hd__.chip.space.wrapperHorizontalPadding,
89
- borderWidth: theme.__hd__.chip.sizes.wrapperBorder,
115
+ marginTop:
116
+ themeSelected && themeVariant === 'outlined'
117
+ ? theme.__hd__.chip.space.outlinedSelectedMarginTop
118
+ : undefined,
90
119
  ...getShadowStyles(),
91
120
  ...getBorderStyles(),
121
+ ...getPaddingStyles(),
92
122
  ...getBackgroundStyles(),
93
123
  };
94
124
  }
95
125
  );
96
126
 
97
- const StyledIconWrapper = styled(Box)(({ theme }) => ({
98
- marginRight: theme.__hd__.chip.space.iconWrapperMarginRight,
99
- }));
100
-
101
- const StyledLabel = styled(Typography.Body)<{
102
- themeSelected?: boolean;
103
- themeVariant?: 'outlined' | 'filled';
104
- }>(({ themeSelected, themeVariant, theme }) => ({
105
- color:
106
- themeSelected && themeVariant === 'outlined'
107
- ? theme.__hd__.chip.colors.selectedPrimaryText
108
- : undefined,
109
- }));
110
-
111
- const StyledIcon = styled(Icon)<{
112
- themeSelected?: boolean;
113
- themeVariant?: 'outlined' | 'filled';
114
- }>(({ themeSelected, themeVariant, theme }) => ({
115
- color:
116
- themeSelected && themeVariant === 'outlined'
117
- ? theme.__hd__.chip.colors.selectedPrimaryText
118
- : undefined,
119
- }));
120
-
121
- export { StyledChipWrapper, StyledIcon, StyledIconWrapper, StyledLabel };
127
+ export { StyledChipWrapper };