@hero-design/rn 8.71.0 → 8.73.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 +33 -0
- package/es/index.js +790 -470
- package/lib/index.js +793 -472
- package/package.json +1 -1
- package/src/components/Accordion/AccordionItem.tsx +1 -1
- package/src/components/Accordion/__tests__/__snapshots__/AccordionItem.spec.tsx.snap +8 -8
- package/src/components/Accordion/__tests__/__snapshots__/index.spec.tsx.snap +12 -12
- package/src/components/Badge/StyledBadge.tsx +17 -2
- package/src/components/Badge/__tests__/Badge.spec.tsx +15 -0
- package/src/components/Badge/__tests__/__snapshots__/Badge.spec.tsx.snap +187 -0
- package/src/components/Badge/index.tsx +20 -36
- package/src/components/Badge/types.ts +55 -0
- package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/StyledLoadingIndicator.spec.tsx.snap +3 -3
- package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/index.spec.tsx.snap +9 -9
- package/src/components/Button/__tests__/__snapshots__/Button.spec.tsx.snap +7 -7
- package/src/components/Button/__tests__/__snapshots__/StyledButton.spec.tsx.snap +6 -6
- package/src/components/FAB/FAB.tsx +6 -1
- package/src/components/FAB/Pair/StyledFAB.tsx +19 -0
- package/src/components/FAB/Pair/__tests__/__snapshots__/index.spec.tsx.snap +276 -0
- package/src/components/FAB/Pair/__tests__/index.spec.tsx +39 -0
- package/src/components/FAB/Pair/index.tsx +46 -0
- package/src/components/FAB/__tests__/__snapshots__/index.spec.tsx.snap +31 -14
- package/src/components/FAB/index.tsx +3 -1
- package/src/components/MapPin/Focussed.tsx +28 -0
- package/src/components/MapPin/StyledMapPin.tsx +72 -0
- package/src/components/MapPin/__tests__/Focussed.spec.tsx +10 -0
- package/src/components/MapPin/__tests__/__snapshots__/Focussed.spec.tsx.snap +72 -0
- package/src/components/MapPin/__tests__/__snapshots__/index.spec.tsx.snap +470 -0
- package/src/components/MapPin/__tests__/index.spec.tsx +44 -0
- package/src/components/MapPin/index.tsx +64 -0
- package/src/components/MapPin/types.ts +41 -0
- package/src/components/PinInput/__tests__/index.spec.tsx +4 -0
- package/src/components/PinInput/index.tsx +7 -3
- package/src/components/Progress/ProgressStep.tsx +3 -1
- package/src/components/Progress/StyledStep.tsx +13 -11
- package/src/components/Progress/__tests__/__snapshots__/index.spec.js.snap +215 -4
- package/src/components/Progress/__tests__/index.spec.js +16 -4
- package/src/components/Search/SearchOneLine.tsx +7 -1
- package/src/components/Search/SearchSuffixIcon.tsx +12 -1
- package/src/components/Search/SearchTwoLine.tsx +7 -1
- package/src/components/Search/StyledSearch.tsx +42 -16
- package/src/components/Search/__tests__/SearchOneLine.spec.tsx +30 -0
- package/src/components/Search/__tests__/SearchTwoLine.spec.tsx +15 -0
- package/src/components/Search/__tests__/__snapshots__/SearchOneLine.spec.tsx.snap +166 -10
- package/src/components/Search/__tests__/__snapshots__/SearchSuffixIcon.spec.tsx.snap +3 -0
- package/src/components/Search/__tests__/__snapshots__/SearchTwoLine.spec.tsx.snap +182 -2
- package/src/components/Switch/__tests__/__snapshots__/StyledSwitch.spec.tsx.snap +1 -1
- package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabs.spec.tsx.snap +9 -0
- package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabsHeader.spec.tsx.snap +6 -0
- package/src/components/Tabs/__tests__/__snapshots__/TabWithBadge.spec.tsx.snap +3 -0
- package/src/components/Tabs/__tests__/__snapshots__/index.spec.tsx.snap +9 -0
- package/src/components/Toolbar/StyledToolbar.tsx +11 -0
- package/src/components/Toolbar/ToolbarItem.tsx +3 -3
- package/src/components/Toolbar/__tests__/__snapshots__/ToolbarItem.spec.tsx.snap +24 -4
- package/src/index.ts +2 -0
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +84 -9
- package/src/theme/components/badge.ts +10 -1
- package/src/theme/components/button.ts +2 -2
- package/src/theme/components/fab.ts +3 -0
- package/src/theme/components/mapPin.ts +47 -0
- package/src/theme/components/search.ts +30 -5
- package/src/theme/components/switch.ts +2 -2
- package/src/theme/components/toolbar.ts +1 -1
- package/src/theme/getTheme.ts +3 -0
- package/stats/8.72.0/rn-stats.html +4842 -0
- package/stats/8.73.0/rn-stats.html +4844 -0
- package/types/components/Badge/StyledBadge.d.ts +9 -1
- package/types/components/Badge/index.d.ts +3 -34
- package/types/components/Badge/types.d.ts +53 -0
- package/types/components/FAB/Pair/StyledFAB.d.ts +12 -0
- package/types/components/FAB/Pair/index.d.ts +16 -0
- package/types/components/FAB/index.d.ts +1 -0
- package/types/components/MapPin/Focussed.d.ts +13 -0
- package/types/components/MapPin/StyledMapPin.d.ts +32 -0
- package/types/components/MapPin/index.d.ts +5 -0
- package/types/components/MapPin/types.d.ts +38 -0
- package/types/components/Progress/StyledStep.d.ts +2 -0
- package/types/components/Search/SearchOneLine.d.ts +5 -0
- package/types/components/Search/SearchTwoLine.d.ts +5 -0
- package/types/components/Search/StyledSearch.d.ts +7 -2
- package/types/components/Toolbar/StyledToolbar.d.ts +9 -2
- package/types/index.d.ts +2 -1
- package/types/theme/components/badge.d.ts +8 -0
- package/types/theme/components/fab.d.ts +3 -0
- package/types/theme/components/mapPin.d.ts +40 -0
- package/types/theme/components/search.d.ts +31 -5
- package/types/theme/getTheme.d.ts +2 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import renderWithTheme from '../../../testHelpers/renderWithTheme';
|
|
3
|
+
import MapPin from '..';
|
|
4
|
+
|
|
5
|
+
describe('MapPin', () => {
|
|
6
|
+
it('renders icon correctly', () => {
|
|
7
|
+
const { getByTestId, toJSON } = renderWithTheme(
|
|
8
|
+
<MapPin icon="activate" testID="map-pin" />
|
|
9
|
+
);
|
|
10
|
+
expect(toJSON()).toMatchSnapshot();
|
|
11
|
+
expect(getByTestId('map-pin-icon')).toBeDefined();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('renders image correctly', () =>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+
},
|
|
21
|
+
}}
|
|
22
|
+
testID="map-pin"
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
expect(toJSON()).toMatchSnapshot();
|
|
26
|
+
expect(getByTestId('map-pin-image')).toBeDefined();
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('renders selected state correctly', () => {
|
|
30
|
+
const { getByTestId, toJSON } = renderWithTheme(
|
|
31
|
+
<MapPin icon="activate" state="selected" testID="map-pin" />
|
|
32
|
+
);
|
|
33
|
+
expect(toJSON()).toMatchSnapshot();
|
|
34
|
+
expect(getByTestId('map-pin-badge')).toBeDefined();
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('renders applied state correctly', () => {
|
|
38
|
+
const { getByTestId, toJSON } = renderWithTheme(
|
|
39
|
+
<MapPin icon="activate" state="applied" testID="map-pin" />
|
|
40
|
+
);
|
|
41
|
+
expect(toJSON()).toMatchSnapshot();
|
|
42
|
+
expect(getByTestId('map-pin-badge')).toBeDefined();
|
|
43
|
+
});
|
|
44
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
StyledContainer,
|
|
4
|
+
StyledBadge,
|
|
5
|
+
StyledImage,
|
|
6
|
+
StyledContent,
|
|
7
|
+
} from './StyledMapPin';
|
|
8
|
+
import Icon, { IconName } from '../Icon';
|
|
9
|
+
import { MapPinProps } from './types';
|
|
10
|
+
import MapPinFocussed from './Focussed';
|
|
11
|
+
|
|
12
|
+
const getBadgeIconName = (
|
|
13
|
+
state: 'idle' | 'selected' | 'applied'
|
|
14
|
+
): IconName | undefined => {
|
|
15
|
+
const iconMap: Record<'idle' | 'selected' | 'applied', IconName | undefined> =
|
|
16
|
+
{
|
|
17
|
+
idle: undefined,
|
|
18
|
+
selected: 'checkmark',
|
|
19
|
+
applied: 'mail-outlined',
|
|
20
|
+
};
|
|
21
|
+
return iconMap[state];
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const MapPin = ({
|
|
25
|
+
style,
|
|
26
|
+
testID,
|
|
27
|
+
state = 'idle',
|
|
28
|
+
image,
|
|
29
|
+
icon,
|
|
30
|
+
...nativeProps
|
|
31
|
+
}: MapPinProps): JSX.Element => {
|
|
32
|
+
const badgeIcon = getBadgeIconName(state);
|
|
33
|
+
return (
|
|
34
|
+
<StyledContainer {...nativeProps} style={style} testID={testID}>
|
|
35
|
+
<StyledContent themeState={state} themeIsIcon={!!icon}>
|
|
36
|
+
{image && (
|
|
37
|
+
<StyledImage
|
|
38
|
+
testID={testID ? `${testID}-image` : undefined}
|
|
39
|
+
{...image}
|
|
40
|
+
/>
|
|
41
|
+
)}
|
|
42
|
+
{icon && (
|
|
43
|
+
<Icon
|
|
44
|
+
icon={icon}
|
|
45
|
+
size="xsmall"
|
|
46
|
+
intent="text-inverted"
|
|
47
|
+
testID={testID ? `${testID}-icon` : undefined}
|
|
48
|
+
/>
|
|
49
|
+
)}
|
|
50
|
+
</StyledContent>
|
|
51
|
+
{badgeIcon && (
|
|
52
|
+
<StyledBadge
|
|
53
|
+
icon={badgeIcon}
|
|
54
|
+
intent="primary"
|
|
55
|
+
testID={testID ? `${testID}-badge` : undefined}
|
|
56
|
+
/>
|
|
57
|
+
)}
|
|
58
|
+
</StyledContainer>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export default Object.assign(MapPin, {
|
|
63
|
+
Focussed: MapPinFocussed,
|
|
64
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ViewProps, StyleProp, ViewStyle, ImageProps } from 'react-native';
|
|
2
|
+
import { IconName } from '../Icon';
|
|
3
|
+
|
|
4
|
+
interface BaseMapPinProps extends ViewProps {
|
|
5
|
+
/**
|
|
6
|
+
* Additional style.
|
|
7
|
+
*/
|
|
8
|
+
style?: StyleProp<ViewStyle>;
|
|
9
|
+
/**
|
|
10
|
+
* Testing id of the component.
|
|
11
|
+
*/
|
|
12
|
+
testID?: string;
|
|
13
|
+
/**
|
|
14
|
+
* State of the map pin.
|
|
15
|
+
*/
|
|
16
|
+
state?: 'idle' | 'selected' | 'applied';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface ImageMapPinProps extends BaseMapPinProps {
|
|
20
|
+
/**
|
|
21
|
+
* Icon to display in the map pin.
|
|
22
|
+
*/
|
|
23
|
+
icon?: never;
|
|
24
|
+
/**
|
|
25
|
+
* Image to display in the map pin.
|
|
26
|
+
*/
|
|
27
|
+
image: ImageProps;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface IconMapPinProps extends BaseMapPinProps {
|
|
31
|
+
/**
|
|
32
|
+
* Icon to display in the map pin.
|
|
33
|
+
*/
|
|
34
|
+
icon: IconName;
|
|
35
|
+
/**
|
|
36
|
+
* Image to display in the map pin.
|
|
37
|
+
*/
|
|
38
|
+
image?: never;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export type MapPinProps = ImageMapPinProps | IconMapPinProps;
|
|
@@ -82,6 +82,10 @@ describe('behaviors', () => {
|
|
|
82
82
|
|
|
83
83
|
expect(onChangeText).toHaveBeenCalledWith('1234');
|
|
84
84
|
expect(onFulfill).toHaveBeenCalledWith('1234');
|
|
85
|
+
|
|
86
|
+
fireEvent.changeText(hiddenInput, '56789');
|
|
87
|
+
expect(onChangeText).toHaveBeenCalledWith('5678');
|
|
88
|
+
expect(onFulfill).toHaveBeenCalledWith('5678');
|
|
85
89
|
});
|
|
86
90
|
|
|
87
91
|
it.each`
|
|
@@ -155,13 +155,17 @@ const PinInput = forwardRef<PinInputHandler, PinInputProps>(
|
|
|
155
155
|
const slicedText = text.slice(length);
|
|
156
156
|
|
|
157
157
|
onChangeText?.(normalizeValue(slicedText, length));
|
|
158
|
+
|
|
159
|
+
if (slicedText.length === length) {
|
|
160
|
+
onFulfill?.(slicedText);
|
|
161
|
+
}
|
|
158
162
|
} else {
|
|
159
163
|
// Prevent user from entering more than the length
|
|
160
164
|
onChangeText?.(trimmedPin);
|
|
161
|
-
}
|
|
162
165
|
|
|
163
|
-
|
|
164
|
-
|
|
166
|
+
if (trimmedPin.length === length) {
|
|
167
|
+
onFulfill?.(trimmedPin);
|
|
168
|
+
}
|
|
165
169
|
}
|
|
166
170
|
},
|
|
167
171
|
[length, onChangeText, onFulfill, trimmedValue.length]
|
|
@@ -28,17 +28,19 @@ const StyledSingleStepContainer = styled(Box)(({ theme }) => ({
|
|
|
28
28
|
position: 'relative',
|
|
29
29
|
}));
|
|
30
30
|
|
|
31
|
-
const StyledSingleStep = styled(Box)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
31
|
+
const StyledSingleStep = styled(Box)<{ themeState: 'complete' | 'incomplete' }>(
|
|
32
|
+
({ theme, themeState }) => ({
|
|
33
|
+
height: theme.__hd__.progress.sizes.stepHeight,
|
|
34
|
+
borderRadius: theme.__hd__.progress.radii.default,
|
|
35
|
+
backgroundColor: theme.__hd__.progress.colors.step.complete,
|
|
36
|
+
width: themeState === 'complete' ? '100%' : '70%',
|
|
37
|
+
position: 'absolute',
|
|
38
|
+
top: 0,
|
|
39
|
+
left: 0,
|
|
40
|
+
bottom: 0,
|
|
41
|
+
right: 0,
|
|
42
|
+
})
|
|
43
|
+
);
|
|
42
44
|
|
|
43
45
|
export {
|
|
44
46
|
StyledStepContainer,
|
|
@@ -1119,7 +1119,7 @@ exports[`Progress.Step renders correctly 1`] = `
|
|
|
1119
1119
|
{},
|
|
1120
1120
|
[
|
|
1121
1121
|
{
|
|
1122
|
-
"backgroundColor": "#
|
|
1122
|
+
"backgroundColor": "#DACCE4",
|
|
1123
1123
|
"borderRadius": 999,
|
|
1124
1124
|
"height": 8,
|
|
1125
1125
|
"width": 0,
|
|
@@ -1128,7 +1128,7 @@ exports[`Progress.Step renders correctly 1`] = `
|
|
|
1128
1128
|
],
|
|
1129
1129
|
]
|
|
1130
1130
|
}
|
|
1131
|
-
themeState="
|
|
1131
|
+
themeState="current"
|
|
1132
1132
|
themeWidth={0}
|
|
1133
1133
|
/>
|
|
1134
1134
|
<View
|
|
@@ -1137,7 +1137,7 @@ exports[`Progress.Step renders correctly 1`] = `
|
|
|
1137
1137
|
{},
|
|
1138
1138
|
[
|
|
1139
1139
|
{
|
|
1140
|
-
"backgroundColor": "#
|
|
1140
|
+
"backgroundColor": "#dadbde",
|
|
1141
1141
|
"borderRadius": 999,
|
|
1142
1142
|
"height": 8,
|
|
1143
1143
|
"width": 0,
|
|
@@ -1146,7 +1146,7 @@ exports[`Progress.Step renders correctly 1`] = `
|
|
|
1146
1146
|
],
|
|
1147
1147
|
]
|
|
1148
1148
|
}
|
|
1149
|
-
themeState="
|
|
1149
|
+
themeState="incomplete"
|
|
1150
1150
|
themeWidth={0}
|
|
1151
1151
|
/>
|
|
1152
1152
|
<View
|
|
@@ -1227,7 +1227,217 @@ exports[`Progress.Step renders correctly 1`] = `
|
|
|
1227
1227
|
</View>
|
|
1228
1228
|
`;
|
|
1229
1229
|
|
|
1230
|
+
exports[`Progress.Step renders correctly 2`] = `
|
|
1231
|
+
<View
|
|
1232
|
+
style={
|
|
1233
|
+
{
|
|
1234
|
+
"flex": 1,
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
>
|
|
1238
|
+
<View
|
|
1239
|
+
onLayout={[Function]}
|
|
1240
|
+
style={
|
|
1241
|
+
[
|
|
1242
|
+
{},
|
|
1243
|
+
[
|
|
1244
|
+
{
|
|
1245
|
+
"alignItems": "center",
|
|
1246
|
+
"display": "flex",
|
|
1247
|
+
"flexDirection": "row",
|
|
1248
|
+
"justifyContent": "space-between",
|
|
1249
|
+
},
|
|
1250
|
+
undefined,
|
|
1251
|
+
],
|
|
1252
|
+
]
|
|
1253
|
+
}
|
|
1254
|
+
>
|
|
1255
|
+
<View
|
|
1256
|
+
style={
|
|
1257
|
+
[
|
|
1258
|
+
{},
|
|
1259
|
+
[
|
|
1260
|
+
{
|
|
1261
|
+
"backgroundColor": "#401960",
|
|
1262
|
+
"borderRadius": 999,
|
|
1263
|
+
"height": 8,
|
|
1264
|
+
"width": 0,
|
|
1265
|
+
},
|
|
1266
|
+
undefined,
|
|
1267
|
+
],
|
|
1268
|
+
]
|
|
1269
|
+
}
|
|
1270
|
+
themeState="complete"
|
|
1271
|
+
themeWidth={0}
|
|
1272
|
+
/>
|
|
1273
|
+
<View
|
|
1274
|
+
style={
|
|
1275
|
+
[
|
|
1276
|
+
{},
|
|
1277
|
+
[
|
|
1278
|
+
{
|
|
1279
|
+
"backgroundColor": "#401960",
|
|
1280
|
+
"borderRadius": 999,
|
|
1281
|
+
"height": 8,
|
|
1282
|
+
"width": 0,
|
|
1283
|
+
},
|
|
1284
|
+
undefined,
|
|
1285
|
+
],
|
|
1286
|
+
]
|
|
1287
|
+
}
|
|
1288
|
+
themeState="complete"
|
|
1289
|
+
themeWidth={0}
|
|
1290
|
+
/>
|
|
1291
|
+
<View
|
|
1292
|
+
style={
|
|
1293
|
+
[
|
|
1294
|
+
{},
|
|
1295
|
+
[
|
|
1296
|
+
{
|
|
1297
|
+
"backgroundColor": "#401960",
|
|
1298
|
+
"borderRadius": 999,
|
|
1299
|
+
"height": 8,
|
|
1300
|
+
"width": 0,
|
|
1301
|
+
},
|
|
1302
|
+
undefined,
|
|
1303
|
+
],
|
|
1304
|
+
]
|
|
1305
|
+
}
|
|
1306
|
+
themeState="complete"
|
|
1307
|
+
themeWidth={0}
|
|
1308
|
+
/>
|
|
1309
|
+
<View
|
|
1310
|
+
style={
|
|
1311
|
+
[
|
|
1312
|
+
{},
|
|
1313
|
+
[
|
|
1314
|
+
{
|
|
1315
|
+
"backgroundColor": "#401960",
|
|
1316
|
+
"borderRadius": 999,
|
|
1317
|
+
"height": 8,
|
|
1318
|
+
"width": 0,
|
|
1319
|
+
},
|
|
1320
|
+
undefined,
|
|
1321
|
+
],
|
|
1322
|
+
]
|
|
1323
|
+
}
|
|
1324
|
+
themeState="complete"
|
|
1325
|
+
themeWidth={0}
|
|
1326
|
+
/>
|
|
1327
|
+
<View
|
|
1328
|
+
style={
|
|
1329
|
+
[
|
|
1330
|
+
{},
|
|
1331
|
+
[
|
|
1332
|
+
{
|
|
1333
|
+
"backgroundColor": "#401960",
|
|
1334
|
+
"borderRadius": 999,
|
|
1335
|
+
"height": 8,
|
|
1336
|
+
"width": 0,
|
|
1337
|
+
},
|
|
1338
|
+
undefined,
|
|
1339
|
+
],
|
|
1340
|
+
]
|
|
1341
|
+
}
|
|
1342
|
+
themeState="complete"
|
|
1343
|
+
themeWidth={0}
|
|
1344
|
+
/>
|
|
1345
|
+
</View>
|
|
1346
|
+
<View
|
|
1347
|
+
pointerEvents="box-none"
|
|
1348
|
+
position="bottom"
|
|
1349
|
+
style={
|
|
1350
|
+
[
|
|
1351
|
+
{
|
|
1352
|
+
"bottom": 0,
|
|
1353
|
+
"elevation": 9999,
|
|
1354
|
+
"flexDirection": "column-reverse",
|
|
1355
|
+
"left": 0,
|
|
1356
|
+
"paddingHorizontal": 24,
|
|
1357
|
+
"paddingVertical": 16,
|
|
1358
|
+
"position": "absolute",
|
|
1359
|
+
"right": 0,
|
|
1360
|
+
"top": 0,
|
|
1361
|
+
},
|
|
1362
|
+
undefined,
|
|
1363
|
+
]
|
|
1364
|
+
}
|
|
1365
|
+
/>
|
|
1366
|
+
</View>
|
|
1367
|
+
`;
|
|
1368
|
+
|
|
1230
1369
|
exports[`Progress.Step renders correctly with single step 1`] = `
|
|
1370
|
+
<View
|
|
1371
|
+
style={
|
|
1372
|
+
{
|
|
1373
|
+
"flex": 1,
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
>
|
|
1377
|
+
<View
|
|
1378
|
+
style={
|
|
1379
|
+
[
|
|
1380
|
+
{},
|
|
1381
|
+
[
|
|
1382
|
+
{
|
|
1383
|
+
"backgroundColor": "#DACCE4",
|
|
1384
|
+
"borderRadius": 999,
|
|
1385
|
+
"height": 8,
|
|
1386
|
+
"position": "relative",
|
|
1387
|
+
"width": "100%",
|
|
1388
|
+
},
|
|
1389
|
+
undefined,
|
|
1390
|
+
],
|
|
1391
|
+
]
|
|
1392
|
+
}
|
|
1393
|
+
>
|
|
1394
|
+
<View
|
|
1395
|
+
style={
|
|
1396
|
+
[
|
|
1397
|
+
{},
|
|
1398
|
+
[
|
|
1399
|
+
{
|
|
1400
|
+
"backgroundColor": "#401960",
|
|
1401
|
+
"borderRadius": 999,
|
|
1402
|
+
"bottom": 0,
|
|
1403
|
+
"height": 8,
|
|
1404
|
+
"left": 0,
|
|
1405
|
+
"position": "absolute",
|
|
1406
|
+
"right": 0,
|
|
1407
|
+
"top": 0,
|
|
1408
|
+
"width": "100%",
|
|
1409
|
+
},
|
|
1410
|
+
undefined,
|
|
1411
|
+
],
|
|
1412
|
+
]
|
|
1413
|
+
}
|
|
1414
|
+
themeState="complete"
|
|
1415
|
+
/>
|
|
1416
|
+
</View>
|
|
1417
|
+
<View
|
|
1418
|
+
pointerEvents="box-none"
|
|
1419
|
+
position="bottom"
|
|
1420
|
+
style={
|
|
1421
|
+
[
|
|
1422
|
+
{
|
|
1423
|
+
"bottom": 0,
|
|
1424
|
+
"elevation": 9999,
|
|
1425
|
+
"flexDirection": "column-reverse",
|
|
1426
|
+
"left": 0,
|
|
1427
|
+
"paddingHorizontal": 24,
|
|
1428
|
+
"paddingVertical": 16,
|
|
1429
|
+
"position": "absolute",
|
|
1430
|
+
"right": 0,
|
|
1431
|
+
"top": 0,
|
|
1432
|
+
},
|
|
1433
|
+
undefined,
|
|
1434
|
+
]
|
|
1435
|
+
}
|
|
1436
|
+
/>
|
|
1437
|
+
</View>
|
|
1438
|
+
`;
|
|
1439
|
+
|
|
1440
|
+
exports[`Progress.Step renders correctly with single step 2`] = `
|
|
1231
1441
|
<View
|
|
1232
1442
|
style={
|
|
1233
1443
|
{
|
|
@@ -1272,6 +1482,7 @@ exports[`Progress.Step renders correctly with single step 1`] = `
|
|
|
1272
1482
|
],
|
|
1273
1483
|
]
|
|
1274
1484
|
}
|
|
1485
|
+
themeState="incomplete"
|
|
1275
1486
|
/>
|
|
1276
1487
|
</View>
|
|
1277
1488
|
<View
|
|
@@ -62,14 +62,26 @@ describe('Progress.Bar', () => {
|
|
|
62
62
|
});
|
|
63
63
|
|
|
64
64
|
describe('Progress.Step', () => {
|
|
65
|
-
it
|
|
66
|
-
|
|
65
|
+
it.each`
|
|
66
|
+
current
|
|
67
|
+
${1}
|
|
68
|
+
${6}
|
|
69
|
+
`('renders correctly', ({ current }) => {
|
|
70
|
+
const { toJSON } = renderWithTheme(
|
|
71
|
+
<Progress.Step steps={5} current={current} />
|
|
72
|
+
);
|
|
67
73
|
|
|
68
74
|
expect(toJSON()).toMatchSnapshot();
|
|
69
75
|
});
|
|
70
76
|
|
|
71
|
-
it
|
|
72
|
-
|
|
77
|
+
it.each`
|
|
78
|
+
current
|
|
79
|
+
${1}
|
|
80
|
+
${0}
|
|
81
|
+
`('renders correctly with single step', ({ current }) => {
|
|
82
|
+
const { toJSON } = renderWithTheme(
|
|
83
|
+
<Progress.Step steps={1} current={current} />
|
|
84
|
+
);
|
|
73
85
|
|
|
74
86
|
expect(toJSON()).toMatchSnapshot();
|
|
75
87
|
});
|
|
@@ -66,6 +66,11 @@ interface SearchOneLineProps extends NativeTextInputProps {
|
|
|
66
66
|
* Whether to hide the character count.
|
|
67
67
|
* */
|
|
68
68
|
renderInputValue?: (inputProps: NativeTextInputProps) => React.ReactNode;
|
|
69
|
+
/**
|
|
70
|
+
* Variant of the SearchTwo
|
|
71
|
+
* @default 'basic'
|
|
72
|
+
*/
|
|
73
|
+
variant?: 'basic' | 'reversed';
|
|
69
74
|
}
|
|
70
75
|
|
|
71
76
|
export const getState = ({
|
|
@@ -115,6 +120,7 @@ const SearchOneLine = forwardRef<SearchOneLineHandles, SearchOneLineProps>(
|
|
|
115
120
|
placeholder,
|
|
116
121
|
disabled = false,
|
|
117
122
|
testID,
|
|
123
|
+
variant = 'basic',
|
|
118
124
|
...nativeProps
|
|
119
125
|
} = props;
|
|
120
126
|
|
|
@@ -157,7 +163,7 @@ const SearchOneLine = forwardRef<SearchOneLineHandles, SearchOneLineProps>(
|
|
|
157
163
|
testID={testID}
|
|
158
164
|
style={style}
|
|
159
165
|
>
|
|
160
|
-
<StyledInputContainer themeFocused={isFocused}>
|
|
166
|
+
<StyledInputContainer themeFocused={isFocused} themeVariant={variant}>
|
|
161
167
|
{renderPrefix({ prefix })}
|
|
162
168
|
{renderInput({
|
|
163
169
|
nativeInputProps: {
|
|
@@ -24,11 +24,22 @@ interface SearchSuffixIconProps {
|
|
|
24
24
|
badge?: Omit<BadgeProps, 'size'>;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
const renderBadge = (props: Omit<BadgeProps, 'size'>) => {
|
|
28
|
+
const { content, icon, ...rest } = props;
|
|
29
|
+
if (content)
|
|
30
|
+
return (
|
|
31
|
+
<StyledBadge intent="primary" content={content} size="small" {...rest} />
|
|
32
|
+
);
|
|
33
|
+
if (icon)
|
|
34
|
+
return <StyledBadge intent="primary" icon={icon} size="small" {...rest} />;
|
|
35
|
+
return null;
|
|
36
|
+
};
|
|
37
|
+
|
|
27
38
|
const SearchSuffixIcon = (props: SearchSuffixIconProps) => {
|
|
28
39
|
const { suffix, testID, style, badge } = props;
|
|
29
40
|
return (
|
|
30
41
|
<StyledSuffixContainer testID={testID} style={style}>
|
|
31
|
-
{!!badge &&
|
|
42
|
+
{!!badge && renderBadge(badge)}
|
|
32
43
|
{renderSuffix({ suffix })}
|
|
33
44
|
</StyledSuffixContainer>
|
|
34
45
|
);
|
|
@@ -34,6 +34,11 @@ interface SearchTwoLineProps {
|
|
|
34
34
|
* Testing id of the component.
|
|
35
35
|
*/
|
|
36
36
|
testID?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Variant of the SearchTwo
|
|
39
|
+
* @default 'basic'
|
|
40
|
+
*/
|
|
41
|
+
variant?: 'basic' | 'reversed';
|
|
37
42
|
}
|
|
38
43
|
|
|
39
44
|
const SearchTwoLine = (props: SearchTwoLineProps) => {
|
|
@@ -44,10 +49,11 @@ const SearchTwoLine = (props: SearchTwoLineProps) => {
|
|
|
44
49
|
label,
|
|
45
50
|
content,
|
|
46
51
|
testID,
|
|
52
|
+
variant = 'basic',
|
|
47
53
|
} = props;
|
|
48
54
|
return (
|
|
49
55
|
<StyledContainer style={style} testID={testID}>
|
|
50
|
-
<StyledInputContainer themeFocused={false}>
|
|
56
|
+
<StyledInputContainer themeFocused={false} themeVariant={variant}>
|
|
51
57
|
{renderPrefix({ prefix })}
|
|
52
58
|
<StyledHandlerContainer>
|
|
53
59
|
<Typography.Caption fontWeight="semi-bold">
|