@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
|
@@ -35,41 +35,21 @@ describe('Chip', () => {
|
|
|
35
35
|
<ChipWithoutIcon />
|
|
36
36
|
);
|
|
37
37
|
|
|
38
|
-
expect(queryByTestId('chip-icon-
|
|
38
|
+
expect(queryByTestId('selected-chip-icon-cancel')).toBeFalsy();
|
|
39
39
|
expect(toJSON()).toMatchSnapshot();
|
|
40
40
|
|
|
41
41
|
fireEvent.press(getByTestId('chip'));
|
|
42
42
|
|
|
43
|
-
expect(getByTestId('chip-icon-
|
|
43
|
+
expect(getByTestId('selected-chip-icon-cancel')).toBeTruthy();
|
|
44
44
|
expect(toJSON()).toMatchSnapshot();
|
|
45
45
|
});
|
|
46
46
|
|
|
47
|
-
it('does not render icon when
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return (
|
|
52
|
-
<Chip
|
|
53
|
-
label="Cover my bills"
|
|
54
|
-
testID="chip"
|
|
55
|
-
icon="charging-station-outlined"
|
|
56
|
-
selected={selected}
|
|
57
|
-
variant="outlined"
|
|
58
|
-
onPress={() => setSelected(!selected)}
|
|
59
|
-
/>
|
|
60
|
-
);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const { getByTestId, toJSON, queryByTestId } = renderWithTheme(
|
|
64
|
-
<ChipWithIcon />
|
|
47
|
+
it('does not render selected icon when showSelectedIcon is false', () => {
|
|
48
|
+
const { toJSON, queryByTestId } = renderWithTheme(
|
|
49
|
+
<Chip label="Chip" showSelectedIcon={false} selected />
|
|
65
50
|
);
|
|
66
51
|
|
|
67
|
-
expect(queryByTestId('chip-icon-
|
|
68
|
-
expect(toJSON()).toMatchSnapshot();
|
|
69
|
-
|
|
70
|
-
fireEvent.press(getByTestId('chip'));
|
|
71
|
-
|
|
72
|
-
expect(queryByTestId('chip-icon-charging-station-outlined')).toBeFalsy();
|
|
52
|
+
expect(queryByTestId('chip-icon-checkmark')).toBeFalsy();
|
|
73
53
|
expect(toJSON()).toMatchSnapshot();
|
|
74
54
|
});
|
|
75
55
|
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ViewProps } from 'react-native';
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
StyledIconWrapper,
|
|
8
|
-
StyledLabel,
|
|
9
|
-
} from './StyledChip';
|
|
3
|
+
import Box from '../Box';
|
|
4
|
+
import Icon, { IconName } from '../Icon';
|
|
5
|
+
import Typography from '../Typography';
|
|
6
|
+
import { StyledChipWrapper } from './StyledChip';
|
|
10
7
|
|
|
11
8
|
export interface ChipProps extends ViewProps {
|
|
12
9
|
/**
|
|
@@ -22,13 +19,17 @@ export interface ChipProps extends ViewProps {
|
|
|
22
19
|
*/
|
|
23
20
|
selected?: boolean;
|
|
24
21
|
/**
|
|
25
|
-
* Icon of the chip.
|
|
22
|
+
* Icon of the chip.
|
|
26
23
|
*/
|
|
27
24
|
icon?: IconName;
|
|
28
25
|
/**
|
|
29
26
|
* Callback when the chip is pressed.
|
|
30
27
|
*/
|
|
31
28
|
onPress?: () => void;
|
|
29
|
+
/**
|
|
30
|
+
* Whether to show the selected icon when using outlined variant.
|
|
31
|
+
*/
|
|
32
|
+
showSelectedIcon?: boolean;
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
const Chip = ({
|
|
@@ -37,17 +38,11 @@ const Chip = ({
|
|
|
37
38
|
selected = false,
|
|
38
39
|
icon,
|
|
39
40
|
onPress,
|
|
41
|
+
showSelectedIcon = true,
|
|
40
42
|
...otherProps
|
|
41
43
|
}: ChipProps) => {
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
return icon;
|
|
45
|
-
}
|
|
46
|
-
if (selected) {
|
|
47
|
-
return 'checkmark';
|
|
48
|
-
}
|
|
49
|
-
return undefined;
|
|
50
|
-
}, [icon, selected, variant]);
|
|
44
|
+
const shouldShowSelectedIcon =
|
|
45
|
+
variant === 'outlined' && selected && showSelectedIcon;
|
|
51
46
|
|
|
52
47
|
return (
|
|
53
48
|
<StyledChipWrapper
|
|
@@ -56,25 +51,23 @@ const Chip = ({
|
|
|
56
51
|
themeSelected={selected}
|
|
57
52
|
{...otherProps}
|
|
58
53
|
>
|
|
59
|
-
{
|
|
60
|
-
<
|
|
61
|
-
<
|
|
54
|
+
{icon && (
|
|
55
|
+
<Box marginRight="small">
|
|
56
|
+
<Icon size="xsmall" icon={icon} testID={`chip-icon-${icon}`} />
|
|
57
|
+
</Box>
|
|
58
|
+
)}
|
|
59
|
+
|
|
60
|
+
<Typography.Body>{label}</Typography.Body>
|
|
61
|
+
|
|
62
|
+
{shouldShowSelectedIcon && (
|
|
63
|
+
<Box marginLeft="small">
|
|
64
|
+
<Icon
|
|
62
65
|
size="xsmall"
|
|
63
|
-
icon=
|
|
64
|
-
|
|
65
|
-
themeVariant={variant}
|
|
66
|
-
testID={`chip-icon-${internalIcon}`}
|
|
66
|
+
icon="cancel"
|
|
67
|
+
testID="selected-chip-icon-cancel"
|
|
67
68
|
/>
|
|
68
|
-
</
|
|
69
|
+
</Box>
|
|
69
70
|
)}
|
|
70
|
-
|
|
71
|
-
<StyledLabel
|
|
72
|
-
variant="small"
|
|
73
|
-
themeVariant={variant}
|
|
74
|
-
themeSelected={selected}
|
|
75
|
-
>
|
|
76
|
-
{label}
|
|
77
|
-
</StyledLabel>
|
|
78
71
|
</StyledChipWrapper>
|
|
79
72
|
);
|
|
80
73
|
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { useTheme } from '@emotion/react';
|
|
2
|
+
import React, { useMemo } from 'react';
|
|
3
|
+
import { LayoutChangeEvent, ViewProps } from 'react-native';
|
|
4
|
+
import {
|
|
5
|
+
StyledSingleStep,
|
|
6
|
+
StyledSingleStepContainer,
|
|
7
|
+
StyledStep,
|
|
8
|
+
StyledStepContainer,
|
|
9
|
+
} from './StyledStep';
|
|
10
|
+
|
|
11
|
+
export interface ProgressStepProps extends ViewProps {
|
|
12
|
+
/**
|
|
13
|
+
* The total number of steps.
|
|
14
|
+
*/
|
|
15
|
+
steps: number;
|
|
16
|
+
/**
|
|
17
|
+
* The current step.
|
|
18
|
+
*/
|
|
19
|
+
current: number;
|
|
20
|
+
/**
|
|
21
|
+
* Test ID of the component.
|
|
22
|
+
*/
|
|
23
|
+
testID?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
type StepState = 'complete' | 'incomplete' | 'current';
|
|
27
|
+
|
|
28
|
+
export const getStepState = (current: number, index: number): StepState => {
|
|
29
|
+
if (index < current) {
|
|
30
|
+
return 'complete';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (index === current) {
|
|
34
|
+
return 'current';
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return 'incomplete';
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const ProgressStep = ({
|
|
41
|
+
steps,
|
|
42
|
+
current,
|
|
43
|
+
onLayout,
|
|
44
|
+
...props
|
|
45
|
+
}: ProgressStepProps) => {
|
|
46
|
+
const theme = useTheme();
|
|
47
|
+
const [containerWidth, setContainerWidth] = React.useState(0);
|
|
48
|
+
|
|
49
|
+
const onContainerLayout = (event: LayoutChangeEvent) => {
|
|
50
|
+
setContainerWidth(event.nativeEvent.layout.width);
|
|
51
|
+
|
|
52
|
+
onLayout?.(event);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// Calculate the width for each step
|
|
56
|
+
const stepWidth = useMemo(() => {
|
|
57
|
+
let width = 0;
|
|
58
|
+
if (containerWidth > 0) {
|
|
59
|
+
width =
|
|
60
|
+
(containerWidth - (steps - 1) * theme.__hd__.progress.space.stepGap) /
|
|
61
|
+
steps;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return width;
|
|
65
|
+
}, [containerWidth, steps, theme]);
|
|
66
|
+
|
|
67
|
+
if (steps === 1) {
|
|
68
|
+
return (
|
|
69
|
+
<StyledSingleStepContainer {...props}>
|
|
70
|
+
<StyledSingleStep />
|
|
71
|
+
</StyledSingleStepContainer>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<StyledStepContainer {...props} onLayout={onContainerLayout}>
|
|
77
|
+
{Array.from({ length: steps }).map((_, index) => (
|
|
78
|
+
<StyledStep
|
|
79
|
+
themeState={getStepState(current - 1, index)}
|
|
80
|
+
themeWidth={stepWidth}
|
|
81
|
+
/>
|
|
82
|
+
))}
|
|
83
|
+
</StyledStepContainer>
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export default ProgressStep;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import styled from '@emotion/native';
|
|
2
|
+
import Box from '../Box';
|
|
3
|
+
|
|
4
|
+
type StepState = 'complete' | 'incomplete' | 'current';
|
|
5
|
+
|
|
6
|
+
const StyledStepContainer = styled(Box)({
|
|
7
|
+
display: 'flex',
|
|
8
|
+
flexDirection: 'row',
|
|
9
|
+
justifyContent: 'space-between',
|
|
10
|
+
alignItems: 'center',
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const StyledStep = styled(Box)<{
|
|
14
|
+
themeState: StepState;
|
|
15
|
+
themeWidth: number;
|
|
16
|
+
}>(({ theme, themeState, themeWidth }) => ({
|
|
17
|
+
height: theme.__hd__.progress.sizes.stepHeight,
|
|
18
|
+
borderRadius: theme.__hd__.progress.radii.default,
|
|
19
|
+
backgroundColor: theme.__hd__.progress.colors.step[themeState],
|
|
20
|
+
width: themeWidth,
|
|
21
|
+
}));
|
|
22
|
+
|
|
23
|
+
const StyledSingleStepContainer = styled(Box)(({ theme }) => ({
|
|
24
|
+
height: theme.__hd__.progress.sizes.stepHeight,
|
|
25
|
+
borderRadius: theme.__hd__.progress.radii.default,
|
|
26
|
+
backgroundColor: theme.__hd__.progress.colors.step.current,
|
|
27
|
+
width: '100%',
|
|
28
|
+
position: 'relative',
|
|
29
|
+
}));
|
|
30
|
+
|
|
31
|
+
const StyledSingleStep = styled(Box)(({ theme }) => ({
|
|
32
|
+
height: theme.__hd__.progress.sizes.stepHeight,
|
|
33
|
+
borderRadius: theme.__hd__.progress.radii.default,
|
|
34
|
+
backgroundColor: theme.__hd__.progress.colors.step.complete,
|
|
35
|
+
width: '70%',
|
|
36
|
+
position: 'absolute',
|
|
37
|
+
top: 0,
|
|
38
|
+
left: 0,
|
|
39
|
+
bottom: 0,
|
|
40
|
+
right: 0,
|
|
41
|
+
}));
|
|
42
|
+
|
|
43
|
+
export {
|
|
44
|
+
StyledStepContainer,
|
|
45
|
+
StyledStep,
|
|
46
|
+
StyledSingleStepContainer,
|
|
47
|
+
StyledSingleStep,
|
|
48
|
+
};
|
|
@@ -1087,3 +1087,212 @@ exports[`Progress.Circle renders correctly with intent 1`] = `
|
|
|
1087
1087
|
/>
|
|
1088
1088
|
</View>
|
|
1089
1089
|
`;
|
|
1090
|
+
|
|
1091
|
+
exports[`Progress.Step renders correctly 1`] = `
|
|
1092
|
+
<View
|
|
1093
|
+
style={
|
|
1094
|
+
{
|
|
1095
|
+
"flex": 1,
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
>
|
|
1099
|
+
<View
|
|
1100
|
+
onLayout={[Function]}
|
|
1101
|
+
style={
|
|
1102
|
+
[
|
|
1103
|
+
{},
|
|
1104
|
+
[
|
|
1105
|
+
{
|
|
1106
|
+
"alignItems": "center",
|
|
1107
|
+
"display": "flex",
|
|
1108
|
+
"flexDirection": "row",
|
|
1109
|
+
"justifyContent": "space-between",
|
|
1110
|
+
},
|
|
1111
|
+
undefined,
|
|
1112
|
+
],
|
|
1113
|
+
]
|
|
1114
|
+
}
|
|
1115
|
+
>
|
|
1116
|
+
<View
|
|
1117
|
+
style={
|
|
1118
|
+
[
|
|
1119
|
+
{},
|
|
1120
|
+
[
|
|
1121
|
+
{
|
|
1122
|
+
"backgroundColor": "#401960",
|
|
1123
|
+
"borderRadius": 999,
|
|
1124
|
+
"height": 8,
|
|
1125
|
+
"width": 0,
|
|
1126
|
+
},
|
|
1127
|
+
undefined,
|
|
1128
|
+
],
|
|
1129
|
+
]
|
|
1130
|
+
}
|
|
1131
|
+
themeState="complete"
|
|
1132
|
+
themeWidth={0}
|
|
1133
|
+
/>
|
|
1134
|
+
<View
|
|
1135
|
+
style={
|
|
1136
|
+
[
|
|
1137
|
+
{},
|
|
1138
|
+
[
|
|
1139
|
+
{
|
|
1140
|
+
"backgroundColor": "#DACCE4",
|
|
1141
|
+
"borderRadius": 999,
|
|
1142
|
+
"height": 8,
|
|
1143
|
+
"width": 0,
|
|
1144
|
+
},
|
|
1145
|
+
undefined,
|
|
1146
|
+
],
|
|
1147
|
+
]
|
|
1148
|
+
}
|
|
1149
|
+
themeState="current"
|
|
1150
|
+
themeWidth={0}
|
|
1151
|
+
/>
|
|
1152
|
+
<View
|
|
1153
|
+
style={
|
|
1154
|
+
[
|
|
1155
|
+
{},
|
|
1156
|
+
[
|
|
1157
|
+
{
|
|
1158
|
+
"backgroundColor": "#dadbde",
|
|
1159
|
+
"borderRadius": 999,
|
|
1160
|
+
"height": 8,
|
|
1161
|
+
"width": 0,
|
|
1162
|
+
},
|
|
1163
|
+
undefined,
|
|
1164
|
+
],
|
|
1165
|
+
]
|
|
1166
|
+
}
|
|
1167
|
+
themeState="incomplete"
|
|
1168
|
+
themeWidth={0}
|
|
1169
|
+
/>
|
|
1170
|
+
<View
|
|
1171
|
+
style={
|
|
1172
|
+
[
|
|
1173
|
+
{},
|
|
1174
|
+
[
|
|
1175
|
+
{
|
|
1176
|
+
"backgroundColor": "#dadbde",
|
|
1177
|
+
"borderRadius": 999,
|
|
1178
|
+
"height": 8,
|
|
1179
|
+
"width": 0,
|
|
1180
|
+
},
|
|
1181
|
+
undefined,
|
|
1182
|
+
],
|
|
1183
|
+
]
|
|
1184
|
+
}
|
|
1185
|
+
themeState="incomplete"
|
|
1186
|
+
themeWidth={0}
|
|
1187
|
+
/>
|
|
1188
|
+
<View
|
|
1189
|
+
style={
|
|
1190
|
+
[
|
|
1191
|
+
{},
|
|
1192
|
+
[
|
|
1193
|
+
{
|
|
1194
|
+
"backgroundColor": "#dadbde",
|
|
1195
|
+
"borderRadius": 999,
|
|
1196
|
+
"height": 8,
|
|
1197
|
+
"width": 0,
|
|
1198
|
+
},
|
|
1199
|
+
undefined,
|
|
1200
|
+
],
|
|
1201
|
+
]
|
|
1202
|
+
}
|
|
1203
|
+
themeState="incomplete"
|
|
1204
|
+
themeWidth={0}
|
|
1205
|
+
/>
|
|
1206
|
+
</View>
|
|
1207
|
+
<View
|
|
1208
|
+
pointerEvents="box-none"
|
|
1209
|
+
position="bottom"
|
|
1210
|
+
style={
|
|
1211
|
+
[
|
|
1212
|
+
{
|
|
1213
|
+
"bottom": 0,
|
|
1214
|
+
"elevation": 9999,
|
|
1215
|
+
"flexDirection": "column-reverse",
|
|
1216
|
+
"left": 0,
|
|
1217
|
+
"paddingHorizontal": 24,
|
|
1218
|
+
"paddingVertical": 16,
|
|
1219
|
+
"position": "absolute",
|
|
1220
|
+
"right": 0,
|
|
1221
|
+
"top": 0,
|
|
1222
|
+
},
|
|
1223
|
+
undefined,
|
|
1224
|
+
]
|
|
1225
|
+
}
|
|
1226
|
+
/>
|
|
1227
|
+
</View>
|
|
1228
|
+
`;
|
|
1229
|
+
|
|
1230
|
+
exports[`Progress.Step renders correctly with single step 1`] = `
|
|
1231
|
+
<View
|
|
1232
|
+
style={
|
|
1233
|
+
{
|
|
1234
|
+
"flex": 1,
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
>
|
|
1238
|
+
<View
|
|
1239
|
+
style={
|
|
1240
|
+
[
|
|
1241
|
+
{},
|
|
1242
|
+
[
|
|
1243
|
+
{
|
|
1244
|
+
"backgroundColor": "#DACCE4",
|
|
1245
|
+
"borderRadius": 999,
|
|
1246
|
+
"height": 8,
|
|
1247
|
+
"position": "relative",
|
|
1248
|
+
"width": "100%",
|
|
1249
|
+
},
|
|
1250
|
+
undefined,
|
|
1251
|
+
],
|
|
1252
|
+
]
|
|
1253
|
+
}
|
|
1254
|
+
>
|
|
1255
|
+
<View
|
|
1256
|
+
style={
|
|
1257
|
+
[
|
|
1258
|
+
{},
|
|
1259
|
+
[
|
|
1260
|
+
{
|
|
1261
|
+
"backgroundColor": "#401960",
|
|
1262
|
+
"borderRadius": 999,
|
|
1263
|
+
"bottom": 0,
|
|
1264
|
+
"height": 8,
|
|
1265
|
+
"left": 0,
|
|
1266
|
+
"position": "absolute",
|
|
1267
|
+
"right": 0,
|
|
1268
|
+
"top": 0,
|
|
1269
|
+
"width": "70%",
|
|
1270
|
+
},
|
|
1271
|
+
undefined,
|
|
1272
|
+
],
|
|
1273
|
+
]
|
|
1274
|
+
}
|
|
1275
|
+
/>
|
|
1276
|
+
</View>
|
|
1277
|
+
<View
|
|
1278
|
+
pointerEvents="box-none"
|
|
1279
|
+
position="bottom"
|
|
1280
|
+
style={
|
|
1281
|
+
[
|
|
1282
|
+
{
|
|
1283
|
+
"bottom": 0,
|
|
1284
|
+
"elevation": 9999,
|
|
1285
|
+
"flexDirection": "column-reverse",
|
|
1286
|
+
"left": 0,
|
|
1287
|
+
"paddingHorizontal": 24,
|
|
1288
|
+
"paddingVertical": 16,
|
|
1289
|
+
"position": "absolute",
|
|
1290
|
+
"right": 0,
|
|
1291
|
+
"top": 0,
|
|
1292
|
+
},
|
|
1293
|
+
undefined,
|
|
1294
|
+
]
|
|
1295
|
+
}
|
|
1296
|
+
/>
|
|
1297
|
+
</View>
|
|
1298
|
+
`;
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import renderWithTheme from '../../../testHelpers/renderWithTheme';
|
|
3
3
|
|
|
4
4
|
import Progress from '..';
|
|
5
|
+
import { getStepState } from '../ProgressStep';
|
|
5
6
|
|
|
6
7
|
describe('Progress.Circle', () => {
|
|
7
8
|
it('renders correctly', () => {
|
|
@@ -59,3 +60,28 @@ describe('Progress.Bar', () => {
|
|
|
59
60
|
expect(toJSON()).toMatchSnapshot();
|
|
60
61
|
});
|
|
61
62
|
});
|
|
63
|
+
|
|
64
|
+
describe('Progress.Step', () => {
|
|
65
|
+
it('renders correctly', () => {
|
|
66
|
+
const { toJSON } = renderWithTheme(<Progress.Step steps={5} current={2} />);
|
|
67
|
+
|
|
68
|
+
expect(toJSON()).toMatchSnapshot();
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('renders correctly with single step', () => {
|
|
72
|
+
const { toJSON } = renderWithTheme(<Progress.Step steps={1} current={1} />);
|
|
73
|
+
|
|
74
|
+
expect(toJSON()).toMatchSnapshot();
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it.each`
|
|
78
|
+
current | index | state
|
|
79
|
+
${1} | ${0} | ${'complete'}
|
|
80
|
+
${1} | ${1} | ${'current'}
|
|
81
|
+
${1} | ${2} | ${'incomplete'}
|
|
82
|
+
`('getStepState returns correct variant', ({ current, index, state }) => {
|
|
83
|
+
const result = getStepState(current, index);
|
|
84
|
+
|
|
85
|
+
expect(result).toBe(state);
|
|
86
|
+
});
|
|
87
|
+
});
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import ProgressCircle from './ProgressCircle';
|
|
2
2
|
import ProgressBar from './ProgressBar';
|
|
3
|
+
import ProgressStep from './ProgressStep';
|
|
3
4
|
|
|
4
|
-
const Progress = {
|
|
5
|
+
const Progress = {
|
|
6
|
+
Circle: ProgressCircle,
|
|
7
|
+
Bar: ProgressBar,
|
|
8
|
+
Step: ProgressStep,
|
|
9
|
+
} as const;
|
|
5
10
|
|
|
6
11
|
export default Progress;
|
|
@@ -426,7 +426,7 @@ exports[`rendering allows custom renderer 1`] = `
|
|
|
426
426
|
style={
|
|
427
427
|
[
|
|
428
428
|
{
|
|
429
|
-
"alignItems": "
|
|
429
|
+
"alignItems": "flex-end",
|
|
430
430
|
"height": 48,
|
|
431
431
|
"justifyContent": "center",
|
|
432
432
|
"marginLeft": 12,
|
|
@@ -2249,7 +2249,7 @@ exports[`rendering renders correctly when bottom sheet is visible 1`] = `
|
|
|
2249
2249
|
style={
|
|
2250
2250
|
[
|
|
2251
2251
|
{
|
|
2252
|
-
"alignItems": "
|
|
2252
|
+
"alignItems": "flex-end",
|
|
2253
2253
|
"height": 48,
|
|
2254
2254
|
"justifyContent": "center",
|
|
2255
2255
|
"marginLeft": 12,
|
|
@@ -4291,7 +4291,7 @@ exports[`rendering renders correctly when receives sections 1`] = `
|
|
|
4291
4291
|
style={
|
|
4292
4292
|
[
|
|
4293
4293
|
{
|
|
4294
|
-
"alignItems": "
|
|
4294
|
+
"alignItems": "flex-end",
|
|
4295
4295
|
"height": 48,
|
|
4296
4296
|
"justifyContent": "center",
|
|
4297
4297
|
"marginLeft": 12,
|
|
@@ -5614,7 +5614,7 @@ exports[`rendering renders correctly when receives sections 2`] = `
|
|
|
5614
5614
|
style={
|
|
5615
5615
|
[
|
|
5616
5616
|
{
|
|
5617
|
-
"alignItems": "
|
|
5617
|
+
"alignItems": "flex-end",
|
|
5618
5618
|
"height": 48,
|
|
5619
5619
|
"justifyContent": "center",
|
|
5620
5620
|
"marginLeft": 12,
|
|
@@ -425,7 +425,7 @@ exports[`rendering allows custom renderer 1`] = `
|
|
|
425
425
|
style={
|
|
426
426
|
[
|
|
427
427
|
{
|
|
428
|
-
"alignItems": "
|
|
428
|
+
"alignItems": "flex-end",
|
|
429
429
|
"height": 48,
|
|
430
430
|
"justifyContent": "center",
|
|
431
431
|
"marginLeft": 12,
|
|
@@ -2164,7 +2164,7 @@ exports[`rendering renders correctly when bottom sheet is visible 1`] = `
|
|
|
2164
2164
|
style={
|
|
2165
2165
|
[
|
|
2166
2166
|
{
|
|
2167
|
-
"alignItems": "
|
|
2167
|
+
"alignItems": "flex-end",
|
|
2168
2168
|
"height": 48,
|
|
2169
2169
|
"justifyContent": "center",
|
|
2170
2170
|
"marginLeft": 12,
|
|
@@ -4066,7 +4066,7 @@ exports[`rendering renders correctly when receives sections 1`] = `
|
|
|
4066
4066
|
style={
|
|
4067
4067
|
[
|
|
4068
4068
|
{
|
|
4069
|
-
"alignItems": "
|
|
4069
|
+
"alignItems": "flex-end",
|
|
4070
4070
|
"height": 48,
|
|
4071
4071
|
"justifyContent": "center",
|
|
4072
4072
|
"marginLeft": 12,
|
package/src/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ import theme, {
|
|
|
4
4
|
useTheme,
|
|
5
5
|
swagSystemPalette,
|
|
6
6
|
swagLightSystemPalette,
|
|
7
|
+
swagLightJobsSystemPalette,
|
|
7
8
|
swagDarkSystemPalette,
|
|
8
9
|
workSystemPalette,
|
|
9
10
|
jobsSystemPalette,
|
|
@@ -80,6 +81,7 @@ export {
|
|
|
80
81
|
withTheme,
|
|
81
82
|
swagSystemPalette,
|
|
82
83
|
swagLightSystemPalette,
|
|
84
|
+
swagLightJobsSystemPalette,
|
|
83
85
|
swagDarkSystemPalette,
|
|
84
86
|
workSystemPalette,
|
|
85
87
|
jobsSystemPalette,
|