@hero-design/rn 8.68.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 +32 -0
- package/es/index.js +310 -164
- package/lib/index.js +310 -163
- package/package.json +2 -2
- package/src/components/BottomSheet/Header.tsx +50 -27
- package/src/components/BottomSheet/StyledBottomSheet.tsx +35 -8
- package/src/components/BottomSheet/__tests__/__snapshots__/index.spec.tsx.snap +352 -1
- package/src/components/BottomSheet/__tests__/index.spec.tsx +30 -0
- package/src/components/BottomSheet/index.tsx +47 -30
- 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/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +1 -1
- package/src/components/Progress/ProgressStep.tsx +87 -0
- package/src/components/Progress/StyledStep.tsx +48 -0
- package/src/components/Progress/__tests__/__snapshots__/index.spec.js.snap +209 -0
- package/src/components/Progress/__tests__/index.spec.js +26 -0
- package/src/components/Progress/index.tsx +6 -1
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +4 -4
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +3 -3
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +1 -1
- package/src/index.ts +2 -0
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +25 -6
- package/src/theme/components/bottomSheet.ts +7 -0
- package/src/theme/components/card.ts +1 -0
- package/src/theme/components/chip.ts +8 -6
- package/src/theme/components/progress.ts +11 -1
- package/src/theme/global/colors/__tests__/__snapshots__/swagLight.spec.ts.snap +12 -12
- package/src/theme/global/colors/__tests__/__snapshots__/swagLightGlobal.spec.ts.snap +39 -0
- package/src/theme/global/colors/__tests__/__snapshots__/swagLightJobs.spec.ts.snap +50 -0
- package/src/theme/global/colors/__tests__/swagLightGlobal.spec.ts +7 -0
- package/src/theme/global/colors/__tests__/swagLightJobs.spec.ts +7 -0
- package/src/theme/global/colors/swagLight.ts +9 -10
- package/src/theme/global/colors/swagLightGlobal.ts +14 -0
- package/src/theme/global/colors/swagLightJobs.ts +11 -0
- package/src/theme/global/colors/types.ts +4 -0
- package/src/theme/global/index.ts +2 -0
- package/src/theme/index.ts +2 -0
- package/stats/8.69.0/rn-stats.html +4842 -0
- package/stats/8.70.0/rn-stats.html +4842 -0
- package/types/components/BottomSheet/Header.d.ts +3 -2
- package/types/components/BottomSheet/StyledBottomSheet.d.ts +16 -2
- package/types/components/BottomSheet/index.d.ts +5 -1
- package/types/components/Box/StyledBox.d.ts +1 -1
- 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/components/Progress/ProgressStep.d.ts +20 -0
- package/types/components/Progress/StyledStep.d.ts +21 -0
- package/types/components/Progress/index.d.ts +1 -0
- package/types/index.d.ts +2 -2
- package/types/theme/components/bottomSheet.d.ts +7 -0
- package/types/theme/components/card.d.ts +1 -0
- package/types/theme/components/chip.d.ts +8 -6
- package/types/theme/components/progress.d.ts +9 -0
- package/types/theme/global/colors/swagLightGlobal.d.ts +3 -0
- package/types/theme/global/colors/swagLightJobs.d.ts +47 -0
- package/types/theme/global/colors/types.d.ts +2 -0
- package/types/theme/global/index.d.ts +4 -1
- package/types/theme/index.d.ts +2 -2
|
@@ -12,13 +12,15 @@ import {
|
|
|
12
12
|
import BottomSheetContext from './BottomSheetContext';
|
|
13
13
|
import Footer from './Footer';
|
|
14
14
|
import Header from './Header';
|
|
15
|
+
import ScrollView from './ScrollView';
|
|
15
16
|
import {
|
|
16
17
|
StyledBackdrop,
|
|
17
18
|
StyledBottomSheet,
|
|
19
|
+
StyledFloatingBottomSheet,
|
|
20
|
+
StyledFloatingWrapper,
|
|
18
21
|
StyledKeyboardAvoidingView,
|
|
19
22
|
StyledWrapper,
|
|
20
23
|
} from './StyledBottomSheet';
|
|
21
|
-
import ScrollView from './ScrollView';
|
|
22
24
|
|
|
23
25
|
interface BottomSheetProps {
|
|
24
26
|
/**
|
|
@@ -82,6 +84,10 @@ interface BottomSheetProps {
|
|
|
82
84
|
* Supported orientations for the BottomSheet modal, iOS only.
|
|
83
85
|
*/
|
|
84
86
|
supportedOrientations?: ('portrait' | 'landscape')[];
|
|
87
|
+
/**
|
|
88
|
+
* Variant of the bottom sheet.
|
|
89
|
+
*/
|
|
90
|
+
variant?: 'fixed' | 'floating';
|
|
85
91
|
}
|
|
86
92
|
|
|
87
93
|
const BottomSheet = ({
|
|
@@ -100,6 +106,7 @@ const BottomSheet = ({
|
|
|
100
106
|
testID,
|
|
101
107
|
keyboardAvoidingViewProps = {},
|
|
102
108
|
supportedOrientations = ['portrait'],
|
|
109
|
+
variant = 'fixed',
|
|
103
110
|
}: BottomSheetProps): JSX.Element => {
|
|
104
111
|
const { height } = Dimensions.get('window');
|
|
105
112
|
|
|
@@ -159,6 +166,12 @@ const BottomSheet = ({
|
|
|
159
166
|
[setInternalShowDivider]
|
|
160
167
|
);
|
|
161
168
|
|
|
169
|
+
const BottomSheetWrapperComponent =
|
|
170
|
+
variant === 'fixed' ? React.Fragment : StyledFloatingWrapper;
|
|
171
|
+
|
|
172
|
+
const BottomSheetComponent =
|
|
173
|
+
variant === 'fixed' ? StyledBottomSheet : StyledFloatingBottomSheet;
|
|
174
|
+
|
|
162
175
|
return (
|
|
163
176
|
<Modal
|
|
164
177
|
visible={visible}
|
|
@@ -177,35 +190,39 @@ const BottomSheet = ({
|
|
|
177
190
|
style={{ opacity: interpolateOpacity }}
|
|
178
191
|
onPress={onRequestClose}
|
|
179
192
|
/>
|
|
180
|
-
<
|
|
181
|
-
|
|
182
|
-
style
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
193
|
+
<BottomSheetWrapperComponent>
|
|
194
|
+
<BottomSheetComponent
|
|
195
|
+
style={[
|
|
196
|
+
style,
|
|
197
|
+
{
|
|
198
|
+
transform: [
|
|
199
|
+
{ scaleY: height > 0 ? 1 : 0 },
|
|
200
|
+
{
|
|
201
|
+
translateY: interpolateY,
|
|
202
|
+
},
|
|
203
|
+
],
|
|
204
|
+
},
|
|
205
|
+
]}
|
|
206
|
+
>
|
|
207
|
+
{header !== undefined ? (
|
|
208
|
+
<Header
|
|
209
|
+
variant={variant}
|
|
210
|
+
content={header}
|
|
211
|
+
showDivider={internalShowDivider}
|
|
212
|
+
onRequestClose={onRequestClose}
|
|
213
|
+
showCloseButton={showCloseButton}
|
|
214
|
+
/>
|
|
215
|
+
) : null}
|
|
216
|
+
|
|
217
|
+
<BottomSheetContext.Provider value={BottomSheetContextValue}>
|
|
218
|
+
{children}
|
|
219
|
+
</BottomSheetContext.Provider>
|
|
220
|
+
|
|
221
|
+
{footer ? (
|
|
222
|
+
<Footer showDivider={showDivider}>{footer}</Footer>
|
|
223
|
+
) : null}
|
|
224
|
+
</BottomSheetComponent>
|
|
225
|
+
</BottomSheetWrapperComponent>
|
|
209
226
|
</StyledKeyboardAvoidingView>
|
|
210
227
|
</StyledWrapper>
|
|
211
228
|
</Modal>
|
|
@@ -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 };
|