@hero-design/rn 8.70.0 → 8.72.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 +29 -0
- package/es/index.js +402 -219
- package/lib/index.js +402 -219
- 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/Chip/StyledChip.tsx +44 -8
- package/src/components/Chip/__tests__/__snapshots__/index.spec.tsx.snap +212 -2
- package/src/components/Chip/__tests__/index.spec.tsx +2 -0
- package/src/components/Chip/index.tsx +1 -1
- 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/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/theme/__tests__/__snapshots__/index.spec.ts.snap +50 -9
- package/src/theme/components/badge.ts +10 -1
- package/src/theme/components/button.ts +2 -2
- package/src/theme/components/chip.ts +4 -0
- package/src/theme/components/fab.ts +3 -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/stats/8.71.0/rn-stats.html +4842 -0
- package/stats/8.72.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/Chip/StyledChip.d.ts +1 -1
- package/types/components/Chip/index.d.ts +1 -1
- 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/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/theme/components/badge.d.ts +8 -0
- package/types/theme/components/chip.d.ts +4 -0
- package/types/theme/components/fab.d.ts +3 -0
- package/types/theme/components/search.d.ts +31 -5
|
@@ -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">
|
|
@@ -1,28 +1,53 @@
|
|
|
1
1
|
import styled from '@emotion/native';
|
|
2
2
|
import { TextInput, View } from 'react-native';
|
|
3
|
-
import
|
|
3
|
+
import { Theme } from '../../theme';
|
|
4
|
+
import Badge, { BadgeProps } from '../Badge';
|
|
4
5
|
|
|
5
6
|
export type State = 'default' | 'filled' | 'disabled' | 'readonly';
|
|
6
7
|
|
|
8
|
+
export type Variant = 'basic' | 'reversed';
|
|
9
|
+
|
|
7
10
|
export const StyledContainer = styled(View)(() => ({
|
|
8
11
|
width: '100%',
|
|
9
12
|
}));
|
|
10
13
|
|
|
14
|
+
const getBorderWidth = (
|
|
15
|
+
theme: Theme,
|
|
16
|
+
themeFocused: boolean,
|
|
17
|
+
themeVariant: Variant
|
|
18
|
+
) =>
|
|
19
|
+
themeFocused
|
|
20
|
+
? theme.__hd__.search.borderWidths.container[themeVariant].focused
|
|
21
|
+
: theme.__hd__.search.borderWidths.container[themeVariant].normal;
|
|
22
|
+
|
|
11
23
|
export const StyledInputContainer = styled(View)<{
|
|
12
24
|
themeFocused: boolean;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
themeVariant: Variant;
|
|
26
|
+
}>(({ theme, themeFocused, themeVariant }) => {
|
|
27
|
+
const borderWidth = getBorderWidth(theme, themeFocused, themeVariant);
|
|
28
|
+
return {
|
|
29
|
+
flexDirection: 'row',
|
|
30
|
+
alignItems: 'center',
|
|
31
|
+
paddingHorizontal:
|
|
32
|
+
theme.__hd__.search.space.containerHorizontalPadding - borderWidth,
|
|
33
|
+
paddingVertical:
|
|
34
|
+
theme.__hd__.search.space.containerVerticalPadding - borderWidth,
|
|
35
|
+
backgroundColor:
|
|
36
|
+
theme.__hd__.search.colors[themeVariant].containerBackground,
|
|
37
|
+
height: 56,
|
|
38
|
+
borderRadius: theme.__hd__.search.radii.container,
|
|
39
|
+
borderWidth,
|
|
40
|
+
borderColor: themeFocused
|
|
41
|
+
? theme.__hd__.search.colors[themeVariant].focusedBorder
|
|
42
|
+
: theme.__hd__.search.colors[themeVariant].border,
|
|
43
|
+
...(themeVariant === 'reversed' && {
|
|
44
|
+
elevation: theme.__hd__.search.shadows.elevation,
|
|
45
|
+
shadowOffset: theme.__hd__.search.shadows.offset,
|
|
46
|
+
shadowOpacity: theme.__hd__.search.shadows.opacity,
|
|
47
|
+
shadowRadius: theme.__hd__.search.shadows.radius,
|
|
48
|
+
}),
|
|
49
|
+
};
|
|
50
|
+
});
|
|
26
51
|
|
|
27
52
|
export const StyledAffixContainer = styled(View)(({ theme }) => ({
|
|
28
53
|
paddingHorizontal: theme.__hd__.search.space.prefixHorizontalPadding,
|
|
@@ -34,7 +59,7 @@ export const StyledSuffixContainer = styled(View)(({ theme }) => ({
|
|
|
34
59
|
alignItems: 'center',
|
|
35
60
|
width: theme.__hd__.search.sizes.surfixSize,
|
|
36
61
|
height: theme.__hd__.search.sizes.surfixSize,
|
|
37
|
-
backgroundColor: theme.__hd__.search.colors.
|
|
62
|
+
backgroundColor: theme.__hd__.search.colors.suffixBackground,
|
|
38
63
|
borderRadius: theme.__hd__.search.radii.surfix,
|
|
39
64
|
}));
|
|
40
65
|
|
|
@@ -57,9 +82,10 @@ export const StyledHandlerContainer = styled(View)(({ theme }) => ({
|
|
|
57
82
|
flexGrow: 1,
|
|
58
83
|
height: '100%',
|
|
59
84
|
marginHorizontal: theme.__hd__.search.space.inputHorizontalMargin,
|
|
85
|
+
paddingVertical: theme.__hd__.search.space.inputVerticalPadding,
|
|
60
86
|
}));
|
|
61
87
|
|
|
62
|
-
export const StyledBadge = styled(Badge)(({ theme }) => ({
|
|
88
|
+
export const StyledBadge = styled(Badge)<BadgeProps>(({ theme }) => ({
|
|
63
89
|
position: 'absolute',
|
|
64
90
|
top: theme.__hd__.search.space.badgeTop,
|
|
65
91
|
right: theme.__hd__.search.space.badgeRight,
|
|
@@ -56,6 +56,36 @@ describe('SearchOneLine', () => {
|
|
|
56
56
|
).toHaveLength(1);
|
|
57
57
|
});
|
|
58
58
|
|
|
59
|
+
it('renders reserved variant correctly', () => {
|
|
60
|
+
const { getByTestId, toJSON } = renderWithTheme(
|
|
61
|
+
<SearchOneLine
|
|
62
|
+
prefix="search-outlined"
|
|
63
|
+
suffix="adjustment"
|
|
64
|
+
testID="idle-search-text-input"
|
|
65
|
+
placeholder="Search"
|
|
66
|
+
variant="reversed"
|
|
67
|
+
/>
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
expect(toJSON()).toMatchSnapshot();
|
|
71
|
+
expect(getByTestId('idle-search-text-input')).toBeTruthy();
|
|
72
|
+
expect(
|
|
73
|
+
within(getByTestId('idle-search-text-input')).queryAllByTestId(
|
|
74
|
+
'text-input'
|
|
75
|
+
)
|
|
76
|
+
).toHaveLength(1);
|
|
77
|
+
expect(
|
|
78
|
+
within(getByTestId('idle-search-text-input')).queryAllByTestId(
|
|
79
|
+
'input-prefix'
|
|
80
|
+
)
|
|
81
|
+
).toHaveLength(1);
|
|
82
|
+
expect(
|
|
83
|
+
within(getByTestId('idle-search-text-input')).queryAllByTestId(
|
|
84
|
+
'input-suffix'
|
|
85
|
+
)
|
|
86
|
+
).toHaveLength(1);
|
|
87
|
+
});
|
|
88
|
+
|
|
59
89
|
it('renders custom affix correctly', () => {
|
|
60
90
|
const { getByTestId, toJSON } = renderWithTheme(
|
|
61
91
|
<SearchOneLine
|
|
@@ -17,4 +17,19 @@ describe('SearchTwoLine', () => {
|
|
|
17
17
|
expect(wrapper.getByText('Anywhere')).toBeDefined();
|
|
18
18
|
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
19
19
|
});
|
|
20
|
+
|
|
21
|
+
it('renders reserved variant correctly', () => {
|
|
22
|
+
const wrapper = renderWithTheme(
|
|
23
|
+
<SearchTwoLine
|
|
24
|
+
label="Find Work"
|
|
25
|
+
content={<Typography.Caption>Anywhere</Typography.Caption>}
|
|
26
|
+
prefix="search-outlined"
|
|
27
|
+
suffix="adjustment"
|
|
28
|
+
variant="reversed"
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
expect(wrapper.getByText('Find Work')).toBeDefined();
|
|
32
|
+
expect(wrapper.getByText('Anywhere')).toBeDefined();
|
|
33
|
+
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
34
|
+
});
|
|
20
35
|
});
|