@hero-design/rn 8.69.0 → 8.70.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.
- package/.turbo/turbo-build.log +3 -3
- package/CHANGELOG.md +17 -0
- package/es/index.js +67 -80
- package/lib/index.js +67 -80
- package/package.json +2 -2
- package/src/components/Card/StyledCard.tsx +6 -2
- package/src/components/Card/__tests__/__snapshots__/StyledCard.spec.tsx.snap +1 -1
- package/src/components/Card/__tests__/__snapshots__/index.spec.tsx.snap +7 -0
- package/src/components/Card/__tests__/index.spec.tsx +12 -0
- package/src/components/Card/index.tsx +8 -2
- package/src/components/Carousel/__tests__/__snapshots__/CardCarousel.spec.tsx.snap +4 -0
- package/src/components/Carousel/__tests__/__snapshots__/StyledCardCarousel.spec.tsx.snap +1 -0
- package/src/components/Chip/StyledChip.tsx +15 -45
- package/src/components/Chip/__tests__/__snapshots__/index.spec.tsx.snap +145 -389
- package/src/components/Chip/__tests__/index.spec.tsx +6 -26
- package/src/components/Chip/index.tsx +26 -33
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +9 -6
- package/src/theme/components/card.ts +1 -0
- package/src/theme/components/chip.ts +8 -6
- package/src/theme/global/colors/__tests__/__snapshots__/swagLight.spec.ts.snap +5 -5
- package/src/theme/global/colors/__tests__/__snapshots__/swagLightGlobal.spec.ts.snap +39 -0
- package/src/theme/global/colors/__tests__/__snapshots__/swagLightJobs.spec.ts.snap +5 -5
- package/src/theme/global/colors/__tests__/swagLightGlobal.spec.ts +7 -0
- package/src/theme/global/colors/swagLight.ts +2 -2
- package/src/theme/global/colors/swagLightGlobal.ts +14 -0
- package/stats/8.70.0/rn-stats.html +4842 -0
- package/types/components/Card/StyledCard.d.ts +1 -0
- package/types/components/Card/index.d.ts +2 -1
- package/types/components/Chip/StyledChip.d.ts +1 -19
- package/types/components/Chip/index.d.ts +6 -2
- package/types/theme/components/card.d.ts +1 -0
- package/types/theme/components/chip.d.ts +8 -6
- package/types/theme/global/colors/swagLightGlobal.d.ts +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hero-design/rn",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.70.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.45.
|
|
25
|
+
"@hero-design/colors": "8.45.1",
|
|
26
26
|
"date-fns": "^2.16.1",
|
|
27
27
|
"hero-editor": "^1.9.21",
|
|
28
28
|
"nanoid": "^4.0.2"
|
|
@@ -9,11 +9,15 @@ const StyledCard = styled(View)<{
|
|
|
9
9
|
| 'danger'
|
|
10
10
|
| 'archived'
|
|
11
11
|
| 'neutral';
|
|
12
|
-
|
|
12
|
+
themeVariant?: 'basic' | 'super-round';
|
|
13
|
+
}>(({ theme, themeIntent, themeVariant }) => ({
|
|
13
14
|
...(themeIntent !== undefined && {
|
|
14
15
|
backgroundColor: theme.__hd__.card.colors[themeIntent],
|
|
15
16
|
}),
|
|
16
|
-
borderRadius:
|
|
17
|
+
borderRadius:
|
|
18
|
+
themeVariant === 'basic'
|
|
19
|
+
? theme.__hd__.card.radii.default
|
|
20
|
+
: theme.__hd__.card.radii.superRound,
|
|
17
21
|
overflow: 'hidden',
|
|
18
22
|
}));
|
|
19
23
|
|
|
@@ -20,6 +20,7 @@ exports[`Card renders correctly when intent is archived 1`] = `
|
|
|
20
20
|
]
|
|
21
21
|
}
|
|
22
22
|
themeIntent="archived"
|
|
23
|
+
themeVariant="basic"
|
|
23
24
|
>
|
|
24
25
|
<Text
|
|
25
26
|
allowFontScaling={false}
|
|
@@ -85,6 +86,7 @@ exports[`Card renders correctly when intent is danger 1`] = `
|
|
|
85
86
|
]
|
|
86
87
|
}
|
|
87
88
|
themeIntent="danger"
|
|
89
|
+
themeVariant="basic"
|
|
88
90
|
>
|
|
89
91
|
<Text
|
|
90
92
|
allowFontScaling={false}
|
|
@@ -150,6 +152,7 @@ exports[`Card renders correctly when intent is info 1`] = `
|
|
|
150
152
|
]
|
|
151
153
|
}
|
|
152
154
|
themeIntent="info"
|
|
155
|
+
themeVariant="basic"
|
|
153
156
|
>
|
|
154
157
|
<Text
|
|
155
158
|
allowFontScaling={false}
|
|
@@ -215,6 +218,7 @@ exports[`Card renders correctly when intent is primary 1`] = `
|
|
|
215
218
|
]
|
|
216
219
|
}
|
|
217
220
|
themeIntent="primary"
|
|
221
|
+
themeVariant="basic"
|
|
218
222
|
>
|
|
219
223
|
<Text
|
|
220
224
|
allowFontScaling={false}
|
|
@@ -279,6 +283,7 @@ exports[`Card renders correctly when intent is subdued 1`] = `
|
|
|
279
283
|
]
|
|
280
284
|
}
|
|
281
285
|
themeIntent="subdued"
|
|
286
|
+
themeVariant="basic"
|
|
282
287
|
>
|
|
283
288
|
<Text
|
|
284
289
|
allowFontScaling={false}
|
|
@@ -344,6 +349,7 @@ exports[`Card renders correctly when intent is success 1`] = `
|
|
|
344
349
|
]
|
|
345
350
|
}
|
|
346
351
|
themeIntent="success"
|
|
352
|
+
themeVariant="basic"
|
|
347
353
|
>
|
|
348
354
|
<Text
|
|
349
355
|
allowFontScaling={false}
|
|
@@ -407,6 +413,7 @@ exports[`Card renders correctly when intent is undefined 1`] = `
|
|
|
407
413
|
undefined,
|
|
408
414
|
]
|
|
409
415
|
}
|
|
416
|
+
themeVariant="basic"
|
|
410
417
|
>
|
|
411
418
|
<Text
|
|
412
419
|
allowFontScaling={false}
|
|
@@ -17,6 +17,18 @@ describe('Card', () => {
|
|
|
17
17
|
expect(queryAllByTestId('data-card-indicator')).toHaveLength(0);
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
+
it('renders super round card correctly', () => {
|
|
21
|
+
const { queryAllByTestId } = renderWithTheme(
|
|
22
|
+
<Card testID="card" variant="super-round">
|
|
23
|
+
<View testID="child-view" />
|
|
24
|
+
</Card>
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
expect(queryAllByTestId('card')).toHaveLength(1);
|
|
28
|
+
expect(queryAllByTestId('child-view')).toHaveLength(1);
|
|
29
|
+
expect(queryAllByTestId('data-card-indicator')).toHaveLength(0);
|
|
30
|
+
});
|
|
31
|
+
|
|
20
32
|
it.each`
|
|
21
33
|
intent
|
|
22
34
|
${undefined}
|
|
@@ -27,11 +27,17 @@ export interface CardProps extends ViewProps {
|
|
|
27
27
|
* Testing id of the component.
|
|
28
28
|
*/
|
|
29
29
|
testID?: string;
|
|
30
|
+
variant?: 'basic' | 'super-round';
|
|
30
31
|
}
|
|
31
32
|
|
|
32
|
-
const Card = ({
|
|
33
|
+
const Card = ({
|
|
34
|
+
intent,
|
|
35
|
+
children,
|
|
36
|
+
variant = 'basic',
|
|
37
|
+
...nativeProps
|
|
38
|
+
}: CardProps): JSX.Element => {
|
|
33
39
|
return (
|
|
34
|
-
<StyledCard {...nativeProps} themeIntent={intent}>
|
|
40
|
+
<StyledCard {...nativeProps} themeIntent={intent} themeVariant={variant}>
|
|
35
41
|
{children}
|
|
36
42
|
</StyledCard>
|
|
37
43
|
);
|
|
@@ -124,6 +124,7 @@ exports[`CardCarousel android should render correctly on iOS 1`] = `
|
|
|
124
124
|
],
|
|
125
125
|
]
|
|
126
126
|
}
|
|
127
|
+
themeVariant="basic"
|
|
127
128
|
>
|
|
128
129
|
<Text
|
|
129
130
|
allowFontScaling={false}
|
|
@@ -188,6 +189,7 @@ exports[`CardCarousel android should render correctly on iOS 1`] = `
|
|
|
188
189
|
],
|
|
189
190
|
]
|
|
190
191
|
}
|
|
192
|
+
themeVariant="basic"
|
|
191
193
|
>
|
|
192
194
|
<Text
|
|
193
195
|
allowFontScaling={false}
|
|
@@ -419,6 +421,7 @@ exports[`CardCarousel ios should render correctly on iOS 1`] = `
|
|
|
419
421
|
],
|
|
420
422
|
]
|
|
421
423
|
}
|
|
424
|
+
themeVariant="basic"
|
|
422
425
|
>
|
|
423
426
|
<Text
|
|
424
427
|
allowFontScaling={false}
|
|
@@ -483,6 +486,7 @@ exports[`CardCarousel ios should render correctly on iOS 1`] = `
|
|
|
483
486
|
],
|
|
484
487
|
]
|
|
485
488
|
}
|
|
489
|
+
themeVariant="basic"
|
|
486
490
|
>
|
|
487
491
|
<Text
|
|
488
492
|
allowFontScaling={false}
|
|
@@ -1,8 +1,5 @@
|
|
|
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
5
|
themeVariant?: 'outlined' | 'filled';
|
|
@@ -23,27 +20,19 @@ const StyledChipWrapper = styled(TouchableOpacity)<StyledChipWrapperProps>(
|
|
|
23
20
|
};
|
|
24
21
|
|
|
25
22
|
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
23
|
switch (themeVariant) {
|
|
38
24
|
case 'outlined': {
|
|
39
25
|
return {
|
|
40
|
-
|
|
41
|
-
|
|
26
|
+
borderColor: themeSelected
|
|
27
|
+
? theme.__hd__.chip.colors.outlinedSelectedBorder
|
|
28
|
+
: theme.__hd__.chip.colors.outlinedDefaultBorder,
|
|
29
|
+
borderWidth: themeSelected
|
|
30
|
+
? theme.__hd__.chip.sizes.outlinedSelectedBorder
|
|
31
|
+
: theme.__hd__.chip.sizes.outlinedDefaultBorder,
|
|
42
32
|
};
|
|
43
33
|
}
|
|
44
34
|
case 'filled': {
|
|
45
35
|
return {
|
|
46
|
-
...commonStyle,
|
|
47
36
|
borderColor: theme.__hd__.chip.colors.wrapperSelectedBorder,
|
|
48
37
|
};
|
|
49
38
|
}
|
|
@@ -55,7 +44,9 @@ const StyledChipWrapper = styled(TouchableOpacity)<StyledChipWrapperProps>(
|
|
|
55
44
|
switch (themeVariant) {
|
|
56
45
|
case 'outlined': {
|
|
57
46
|
return {
|
|
58
|
-
backgroundColor:
|
|
47
|
+
backgroundColor: themeSelected
|
|
48
|
+
? theme.__hd__.chip.colors.outlinedSelectedBackground
|
|
49
|
+
: theme.__hd__.chip.colors.outlinedDefaultBackground,
|
|
59
50
|
};
|
|
60
51
|
}
|
|
61
52
|
case 'filled':
|
|
@@ -67,7 +58,8 @@ const StyledChipWrapper = styled(TouchableOpacity)<StyledChipWrapperProps>(
|
|
|
67
58
|
switch (themeVariant) {
|
|
68
59
|
case 'outlined': {
|
|
69
60
|
return {
|
|
70
|
-
backgroundColor:
|
|
61
|
+
backgroundColor:
|
|
62
|
+
theme.__hd__.chip.colors.outlinedDefaultBackground,
|
|
71
63
|
};
|
|
72
64
|
}
|
|
73
65
|
case 'filled':
|
|
@@ -86,7 +78,9 @@ const StyledChipWrapper = styled(TouchableOpacity)<StyledChipWrapperProps>(
|
|
|
86
78
|
borderRadius: theme.__hd__.chip.radii.wrapper,
|
|
87
79
|
paddingVertical: theme.__hd__.chip.space.wrapperVerticalPadding,
|
|
88
80
|
paddingHorizontal: theme.__hd__.chip.space.wrapperHorizontalPadding,
|
|
89
|
-
|
|
81
|
+
marginTop: themeSelected
|
|
82
|
+
? theme.__hd__.chip.space.outlinedSelectedMarginTop
|
|
83
|
+
: undefined,
|
|
90
84
|
...getShadowStyles(),
|
|
91
85
|
...getBorderStyles(),
|
|
92
86
|
...getBackgroundStyles(),
|
|
@@ -94,28 +88,4 @@ const StyledChipWrapper = styled(TouchableOpacity)<StyledChipWrapperProps>(
|
|
|
94
88
|
}
|
|
95
89
|
);
|
|
96
90
|
|
|
97
|
-
|
|
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 };
|
|
91
|
+
export { StyledChipWrapper };
|