@hero-design/rn 8.68.0 → 8.69.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 +15 -0
- package/es/index.js +248 -89
- package/lib/index.js +248 -88
- 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/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 +16 -0
- package/src/theme/components/bottomSheet.ts +7 -0
- package/src/theme/components/progress.ts +11 -1
- package/src/theme/global/colors/__tests__/__snapshots__/swagLight.spec.ts.snap +7 -7
- package/src/theme/global/colors/__tests__/__snapshots__/swagLightJobs.spec.ts.snap +50 -0
- package/src/theme/global/colors/__tests__/swagLightJobs.spec.ts +7 -0
- package/src/theme/global/colors/swagLight.ts +7 -8
- 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/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/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/progress.d.ts +9 -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>
|
|
@@ -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,
|
|
@@ -185,10 +185,13 @@ exports[`theme returns correct theme object 1`] = `
|
|
|
185
185
|
"colors": {
|
|
186
186
|
"backdrop": "#000000",
|
|
187
187
|
"background": "#ffffff",
|
|
188
|
+
"floatingHeaderIconBackground": "#dadbde",
|
|
188
189
|
"shadow": "#001f23",
|
|
189
190
|
},
|
|
190
191
|
"radii": {
|
|
191
192
|
"default": 16,
|
|
193
|
+
"floating": 32,
|
|
194
|
+
"floatingHeaderIcon": 999,
|
|
192
195
|
},
|
|
193
196
|
"shadows": {
|
|
194
197
|
"elevation": 10,
|
|
@@ -201,9 +204,13 @@ exports[`theme returns correct theme object 1`] = `
|
|
|
201
204
|
},
|
|
202
205
|
"sizes": {
|
|
203
206
|
"closeIcon": 48,
|
|
207
|
+
"floatingCloseIcon": 12,
|
|
204
208
|
},
|
|
205
209
|
"space": {
|
|
206
210
|
"closeIconMargin": 12,
|
|
211
|
+
"floatingContentMargin": 16,
|
|
212
|
+
"floatingHeaderIconPadding": 8,
|
|
213
|
+
"floatingInnerPadding": 8,
|
|
207
214
|
"footerHorizontalPadding": 12,
|
|
208
215
|
"footerVerticalPadding": 2,
|
|
209
216
|
"headerWrapperHorizontalPadding": 16,
|
|
@@ -725,6 +732,11 @@ exports[`theme returns correct theme object 1`] = `
|
|
|
725
732
|
"warning": "#e8e9ea",
|
|
726
733
|
"warningInverted": "#ffcb8d",
|
|
727
734
|
},
|
|
735
|
+
"step": {
|
|
736
|
+
"complete": "#401960",
|
|
737
|
+
"current": "#DACCE4",
|
|
738
|
+
"incomplete": "#dadbde",
|
|
739
|
+
},
|
|
728
740
|
},
|
|
729
741
|
"radii": {
|
|
730
742
|
"default": 999,
|
|
@@ -733,6 +745,10 @@ exports[`theme returns correct theme object 1`] = `
|
|
|
733
745
|
"barHeight": 8,
|
|
734
746
|
"circleCompletenessHeight": 8,
|
|
735
747
|
"circleDiameter": 72,
|
|
748
|
+
"stepHeight": 8,
|
|
749
|
+
},
|
|
750
|
+
"space": {
|
|
751
|
+
"stepGap": 4,
|
|
736
752
|
},
|
|
737
753
|
},
|
|
738
754
|
"radio": {
|
|
@@ -5,10 +5,12 @@ const getBottomSheetTheme = (theme: GlobalTheme) => {
|
|
|
5
5
|
shadow: theme.colors.primaryOutline,
|
|
6
6
|
background: theme.colors.defaultGlobalSurface,
|
|
7
7
|
backdrop: theme.colors.overlayGlobalSurface,
|
|
8
|
+
floatingHeaderIconBackground: theme.colors.archivedSurface,
|
|
8
9
|
};
|
|
9
10
|
|
|
10
11
|
const sizes = {
|
|
11
12
|
closeIcon: theme.sizes.xxxlarge,
|
|
13
|
+
floatingCloseIcon: theme.sizes.smallMedium,
|
|
12
14
|
};
|
|
13
15
|
|
|
14
16
|
const space = {
|
|
@@ -17,6 +19,9 @@ const getBottomSheetTheme = (theme: GlobalTheme) => {
|
|
|
17
19
|
closeIconMargin: theme.space.smallMedium,
|
|
18
20
|
footerVerticalPadding: theme.space.xxsmall,
|
|
19
21
|
footerHorizontalPadding: theme.space.smallMedium,
|
|
22
|
+
floatingContentMargin: theme.space.medium,
|
|
23
|
+
floatingInnerPadding: theme.space.small,
|
|
24
|
+
floatingHeaderIconPadding: theme.space.small,
|
|
20
25
|
};
|
|
21
26
|
|
|
22
27
|
const shadows = {
|
|
@@ -28,6 +33,8 @@ const getBottomSheetTheme = (theme: GlobalTheme) => {
|
|
|
28
33
|
|
|
29
34
|
const radii = {
|
|
30
35
|
default: theme.radii.xlarge,
|
|
36
|
+
floating: theme.radii['5xlarge'],
|
|
37
|
+
floatingHeaderIcon: theme.radii.rounded,
|
|
31
38
|
};
|
|
32
39
|
|
|
33
40
|
return { colors, shadows, radii, sizes, space };
|