@hero-design/rn 8.40.0 → 8.40.2
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 +1 -1
- package/es/index.js +21 -14
- package/jest-ci.config.js +17 -0
- package/jest.config.js +0 -2
- package/lib/index.js +21 -14
- package/package.json +9 -8
- package/src/components/SectionHeading/StyledHeading.tsx +21 -10
- package/src/components/SectionHeading/__tests__/StyledHeading.spec.tsx +6 -2
- package/src/components/SectionHeading/__tests__/__snapshots__/StyledHeading.spec.tsx.snap +25 -2
- package/src/components/SectionHeading/__tests__/__snapshots__/index.spec.tsx.snap +153 -20
- package/src/components/SectionHeading/__tests__/index.spec.tsx +12 -0
- package/src/components/SectionHeading/index.tsx +51 -32
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +48 -40
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +36 -30
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +48 -40
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +24 -20
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +2 -1
- package/src/theme/components/sectionHeading.ts +2 -1
- package/types/components/SectionHeading/StyledHeading.d.ts +4 -1
- package/types/components/SectionHeading/index.d.ts +7 -1
- package/types/theme/components/sectionHeading.d.ts +1 -0
|
@@ -52,4 +52,16 @@ describe('SectionHeading', () => {
|
|
|
52
52
|
|
|
53
53
|
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
54
54
|
});
|
|
55
|
+
|
|
56
|
+
it.each`
|
|
57
|
+
size
|
|
58
|
+
${'small'}
|
|
59
|
+
${'medium'}
|
|
60
|
+
`('renders correct style with $size', ({ size }) => {
|
|
61
|
+
const wrapper = renderWithTheme(
|
|
62
|
+
<SectionHeading text="Section Heading" size={size} />
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
66
|
+
});
|
|
55
67
|
});
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
StyledWrapper,
|
|
10
10
|
} from './StyledHeading';
|
|
11
11
|
import type { IconName, IconProps } from '../Icon';
|
|
12
|
+
import { useDeprecation } from '../../utils/hooks';
|
|
12
13
|
|
|
13
14
|
export interface SectionHeadingProps extends ViewProps {
|
|
14
15
|
/**
|
|
@@ -24,10 +25,12 @@ export interface SectionHeadingProps extends ViewProps {
|
|
|
24
25
|
*/
|
|
25
26
|
rightChildren?: ReactElement;
|
|
26
27
|
/**
|
|
28
|
+
* @deprecated fontSize will be removed in the next major release.
|
|
27
29
|
* Size of the text.
|
|
28
30
|
*/
|
|
29
31
|
fontSize?: 'small' | 'medium' | 'large' | 'xlarge';
|
|
30
32
|
/**
|
|
33
|
+
* @deprecated fontWeight will be removed in the next major release.
|
|
31
34
|
* Heading's font-weight.
|
|
32
35
|
*/
|
|
33
36
|
fontWeight?: 'light' | 'regular' | 'semi-bold';
|
|
@@ -43,13 +46,15 @@ export interface SectionHeadingProps extends ViewProps {
|
|
|
43
46
|
* Testing id of the component.
|
|
44
47
|
*/
|
|
45
48
|
testID?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Component size.
|
|
51
|
+
*/
|
|
52
|
+
size?: 'small' | 'medium';
|
|
46
53
|
}
|
|
47
54
|
|
|
48
55
|
const ICON_SIZE_MAP = {
|
|
49
56
|
small: 'small',
|
|
50
57
|
medium: 'medium',
|
|
51
|
-
large: 'medium',
|
|
52
|
-
xlarge: 'large',
|
|
53
58
|
} as const;
|
|
54
59
|
|
|
55
60
|
const ICON_INTENT_MAP = {
|
|
@@ -65,37 +70,51 @@ const SectionHeading = ({
|
|
|
65
70
|
fontSize = 'large',
|
|
66
71
|
intent = 'body',
|
|
67
72
|
fontWeight = 'regular',
|
|
73
|
+
size = 'medium',
|
|
68
74
|
style,
|
|
69
75
|
testID,
|
|
70
|
-
}: SectionHeadingProps): ReactElement =>
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
76
|
+
}: SectionHeadingProps): ReactElement => {
|
|
77
|
+
useDeprecation(
|
|
78
|
+
`SectionHeading's fontSize prop is deprecated and will be removed in the next major release, please remove it.`,
|
|
79
|
+
fontSize !== undefined
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
useDeprecation(
|
|
83
|
+
`SectionHeading's fontWeight prop is deprecated and will be removed in the next major release, please remove it.`,
|
|
84
|
+
fontWeight !== undefined
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<StyledHeading themeSize={size} style={style} testID={testID}>
|
|
89
|
+
<StyledWrapper>
|
|
90
|
+
<StyledIconWrapper>
|
|
91
|
+
{icon !== undefined &&
|
|
92
|
+
(typeof icon === 'string' ? (
|
|
93
|
+
<Icon
|
|
94
|
+
icon={icon}
|
|
95
|
+
size={ICON_SIZE_MAP[size]}
|
|
96
|
+
intent={ICON_INTENT_MAP[intent]}
|
|
97
|
+
/>
|
|
98
|
+
) : (
|
|
99
|
+
React.cloneElement(icon, {
|
|
100
|
+
size: ICON_SIZE_MAP[size],
|
|
101
|
+
intent: ICON_INTENT_MAP[intent],
|
|
102
|
+
...icon.props,
|
|
103
|
+
})
|
|
104
|
+
))}
|
|
105
|
+
</StyledIconWrapper>
|
|
106
|
+
|
|
107
|
+
{size === 'small' ? (
|
|
108
|
+
<Typography.Caption intent={intent}>{text}</Typography.Caption>
|
|
109
|
+
) : (
|
|
110
|
+
<Typography.Body variant="small" intent={intent}>
|
|
111
|
+
{text}
|
|
112
|
+
</Typography.Body>
|
|
113
|
+
)}
|
|
114
|
+
</StyledWrapper>
|
|
115
|
+
{rightChildren}
|
|
116
|
+
</StyledHeading>
|
|
117
|
+
);
|
|
118
|
+
};
|
|
100
119
|
|
|
101
120
|
export default SectionHeading;
|
|
@@ -93,11 +93,13 @@ exports[`OptionList render isLoading correctly 1`] = `
|
|
|
93
93
|
},
|
|
94
94
|
]
|
|
95
95
|
}
|
|
96
|
+
themeSize="medium"
|
|
96
97
|
>
|
|
97
98
|
<View
|
|
98
99
|
style={
|
|
99
100
|
[
|
|
100
101
|
{
|
|
102
|
+
"alignItems": "center",
|
|
101
103
|
"display": "flex",
|
|
102
104
|
"flexDirection": "row",
|
|
103
105
|
},
|
|
@@ -109,7 +111,7 @@ exports[`OptionList render isLoading correctly 1`] = `
|
|
|
109
111
|
style={
|
|
110
112
|
[
|
|
111
113
|
{
|
|
112
|
-
"marginRight":
|
|
114
|
+
"marginRight": 12,
|
|
113
115
|
},
|
|
114
116
|
undefined,
|
|
115
117
|
]
|
|
@@ -122,17 +124,16 @@ exports[`OptionList render isLoading correctly 1`] = `
|
|
|
122
124
|
{
|
|
123
125
|
"color": "#001f23",
|
|
124
126
|
"fontFamily": "BeVietnamPro-Regular",
|
|
125
|
-
"fontSize":
|
|
127
|
+
"fontSize": 14,
|
|
126
128
|
"letterSpacing": 0.48,
|
|
127
|
-
"lineHeight":
|
|
129
|
+
"lineHeight": 22,
|
|
128
130
|
},
|
|
129
131
|
undefined,
|
|
130
132
|
]
|
|
131
133
|
}
|
|
132
|
-
themeFontSize="large"
|
|
133
|
-
themeFontWeight="regular"
|
|
134
134
|
themeIntent="body"
|
|
135
135
|
themeTypeface="neutral"
|
|
136
|
+
themeVariant="small"
|
|
136
137
|
>
|
|
137
138
|
A
|
|
138
139
|
</Text>
|
|
@@ -347,11 +348,13 @@ exports[`OptionList render isLoading correctly 1`] = `
|
|
|
347
348
|
},
|
|
348
349
|
]
|
|
349
350
|
}
|
|
351
|
+
themeSize="medium"
|
|
350
352
|
>
|
|
351
353
|
<View
|
|
352
354
|
style={
|
|
353
355
|
[
|
|
354
356
|
{
|
|
357
|
+
"alignItems": "center",
|
|
355
358
|
"display": "flex",
|
|
356
359
|
"flexDirection": "row",
|
|
357
360
|
},
|
|
@@ -363,7 +366,7 @@ exports[`OptionList render isLoading correctly 1`] = `
|
|
|
363
366
|
style={
|
|
364
367
|
[
|
|
365
368
|
{
|
|
366
|
-
"marginRight":
|
|
369
|
+
"marginRight": 12,
|
|
367
370
|
},
|
|
368
371
|
undefined,
|
|
369
372
|
]
|
|
@@ -376,17 +379,16 @@ exports[`OptionList render isLoading correctly 1`] = `
|
|
|
376
379
|
{
|
|
377
380
|
"color": "#001f23",
|
|
378
381
|
"fontFamily": "BeVietnamPro-Regular",
|
|
379
|
-
"fontSize":
|
|
382
|
+
"fontSize": 14,
|
|
380
383
|
"letterSpacing": 0.48,
|
|
381
|
-
"lineHeight":
|
|
384
|
+
"lineHeight": 22,
|
|
382
385
|
},
|
|
383
386
|
undefined,
|
|
384
387
|
]
|
|
385
388
|
}
|
|
386
|
-
themeFontSize="large"
|
|
387
|
-
themeFontWeight="regular"
|
|
388
389
|
themeIntent="body"
|
|
389
390
|
themeTypeface="neutral"
|
|
391
|
+
themeVariant="small"
|
|
390
392
|
>
|
|
391
393
|
B
|
|
392
394
|
</Text>
|
|
@@ -906,11 +908,13 @@ exports[`OptionList renders correctly 1`] = `
|
|
|
906
908
|
},
|
|
907
909
|
]
|
|
908
910
|
}
|
|
911
|
+
themeSize="medium"
|
|
909
912
|
>
|
|
910
913
|
<View
|
|
911
914
|
style={
|
|
912
915
|
[
|
|
913
916
|
{
|
|
917
|
+
"alignItems": "center",
|
|
914
918
|
"display": "flex",
|
|
915
919
|
"flexDirection": "row",
|
|
916
920
|
},
|
|
@@ -922,7 +926,7 @@ exports[`OptionList renders correctly 1`] = `
|
|
|
922
926
|
style={
|
|
923
927
|
[
|
|
924
928
|
{
|
|
925
|
-
"marginRight":
|
|
929
|
+
"marginRight": 12,
|
|
926
930
|
},
|
|
927
931
|
undefined,
|
|
928
932
|
]
|
|
@@ -935,17 +939,16 @@ exports[`OptionList renders correctly 1`] = `
|
|
|
935
939
|
{
|
|
936
940
|
"color": "#001f23",
|
|
937
941
|
"fontFamily": "BeVietnamPro-Regular",
|
|
938
|
-
"fontSize":
|
|
942
|
+
"fontSize": 14,
|
|
939
943
|
"letterSpacing": 0.48,
|
|
940
|
-
"lineHeight":
|
|
944
|
+
"lineHeight": 22,
|
|
941
945
|
},
|
|
942
946
|
undefined,
|
|
943
947
|
]
|
|
944
948
|
}
|
|
945
|
-
themeFontSize="large"
|
|
946
|
-
themeFontWeight="regular"
|
|
947
949
|
themeIntent="body"
|
|
948
950
|
themeTypeface="neutral"
|
|
951
|
+
themeVariant="small"
|
|
949
952
|
>
|
|
950
953
|
A
|
|
951
954
|
</Text>
|
|
@@ -1160,11 +1163,13 @@ exports[`OptionList renders correctly 1`] = `
|
|
|
1160
1163
|
},
|
|
1161
1164
|
]
|
|
1162
1165
|
}
|
|
1166
|
+
themeSize="medium"
|
|
1163
1167
|
>
|
|
1164
1168
|
<View
|
|
1165
1169
|
style={
|
|
1166
1170
|
[
|
|
1167
1171
|
{
|
|
1172
|
+
"alignItems": "center",
|
|
1168
1173
|
"display": "flex",
|
|
1169
1174
|
"flexDirection": "row",
|
|
1170
1175
|
},
|
|
@@ -1176,7 +1181,7 @@ exports[`OptionList renders correctly 1`] = `
|
|
|
1176
1181
|
style={
|
|
1177
1182
|
[
|
|
1178
1183
|
{
|
|
1179
|
-
"marginRight":
|
|
1184
|
+
"marginRight": 12,
|
|
1180
1185
|
},
|
|
1181
1186
|
undefined,
|
|
1182
1187
|
]
|
|
@@ -1189,17 +1194,16 @@ exports[`OptionList renders correctly 1`] = `
|
|
|
1189
1194
|
{
|
|
1190
1195
|
"color": "#001f23",
|
|
1191
1196
|
"fontFamily": "BeVietnamPro-Regular",
|
|
1192
|
-
"fontSize":
|
|
1197
|
+
"fontSize": 14,
|
|
1193
1198
|
"letterSpacing": 0.48,
|
|
1194
|
-
"lineHeight":
|
|
1199
|
+
"lineHeight": 22,
|
|
1195
1200
|
},
|
|
1196
1201
|
undefined,
|
|
1197
1202
|
]
|
|
1198
1203
|
}
|
|
1199
|
-
themeFontSize="large"
|
|
1200
|
-
themeFontWeight="regular"
|
|
1201
1204
|
themeIntent="body"
|
|
1202
1205
|
themeTypeface="neutral"
|
|
1206
|
+
themeVariant="small"
|
|
1203
1207
|
>
|
|
1204
1208
|
B
|
|
1205
1209
|
</Text>
|
|
@@ -1566,11 +1570,13 @@ exports[`OptionList trigger onPress correctly on changing selection 1`] = `
|
|
|
1566
1570
|
},
|
|
1567
1571
|
]
|
|
1568
1572
|
}
|
|
1573
|
+
themeSize="medium"
|
|
1569
1574
|
>
|
|
1570
1575
|
<View
|
|
1571
1576
|
style={
|
|
1572
1577
|
[
|
|
1573
1578
|
{
|
|
1579
|
+
"alignItems": "center",
|
|
1574
1580
|
"display": "flex",
|
|
1575
1581
|
"flexDirection": "row",
|
|
1576
1582
|
},
|
|
@@ -1582,7 +1588,7 @@ exports[`OptionList trigger onPress correctly on changing selection 1`] = `
|
|
|
1582
1588
|
style={
|
|
1583
1589
|
[
|
|
1584
1590
|
{
|
|
1585
|
-
"marginRight":
|
|
1591
|
+
"marginRight": 12,
|
|
1586
1592
|
},
|
|
1587
1593
|
undefined,
|
|
1588
1594
|
]
|
|
@@ -1595,17 +1601,16 @@ exports[`OptionList trigger onPress correctly on changing selection 1`] = `
|
|
|
1595
1601
|
{
|
|
1596
1602
|
"color": "#001f23",
|
|
1597
1603
|
"fontFamily": "BeVietnamPro-Regular",
|
|
1598
|
-
"fontSize":
|
|
1604
|
+
"fontSize": 14,
|
|
1599
1605
|
"letterSpacing": 0.48,
|
|
1600
|
-
"lineHeight":
|
|
1606
|
+
"lineHeight": 22,
|
|
1601
1607
|
},
|
|
1602
1608
|
undefined,
|
|
1603
1609
|
]
|
|
1604
1610
|
}
|
|
1605
|
-
themeFontSize="large"
|
|
1606
|
-
themeFontWeight="regular"
|
|
1607
1611
|
themeIntent="body"
|
|
1608
1612
|
themeTypeface="neutral"
|
|
1613
|
+
themeVariant="small"
|
|
1609
1614
|
>
|
|
1610
1615
|
A
|
|
1611
1616
|
</Text>
|
|
@@ -1820,11 +1825,13 @@ exports[`OptionList trigger onPress correctly on changing selection 1`] = `
|
|
|
1820
1825
|
},
|
|
1821
1826
|
]
|
|
1822
1827
|
}
|
|
1828
|
+
themeSize="medium"
|
|
1823
1829
|
>
|
|
1824
1830
|
<View
|
|
1825
1831
|
style={
|
|
1826
1832
|
[
|
|
1827
1833
|
{
|
|
1834
|
+
"alignItems": "center",
|
|
1828
1835
|
"display": "flex",
|
|
1829
1836
|
"flexDirection": "row",
|
|
1830
1837
|
},
|
|
@@ -1836,7 +1843,7 @@ exports[`OptionList trigger onPress correctly on changing selection 1`] = `
|
|
|
1836
1843
|
style={
|
|
1837
1844
|
[
|
|
1838
1845
|
{
|
|
1839
|
-
"marginRight":
|
|
1846
|
+
"marginRight": 12,
|
|
1840
1847
|
},
|
|
1841
1848
|
undefined,
|
|
1842
1849
|
]
|
|
@@ -1849,17 +1856,16 @@ exports[`OptionList trigger onPress correctly on changing selection 1`] = `
|
|
|
1849
1856
|
{
|
|
1850
1857
|
"color": "#001f23",
|
|
1851
1858
|
"fontFamily": "BeVietnamPro-Regular",
|
|
1852
|
-
"fontSize":
|
|
1859
|
+
"fontSize": 14,
|
|
1853
1860
|
"letterSpacing": 0.48,
|
|
1854
|
-
"lineHeight":
|
|
1861
|
+
"lineHeight": 22,
|
|
1855
1862
|
},
|
|
1856
1863
|
undefined,
|
|
1857
1864
|
]
|
|
1858
1865
|
}
|
|
1859
|
-
themeFontSize="large"
|
|
1860
|
-
themeFontWeight="regular"
|
|
1861
1866
|
themeIntent="body"
|
|
1862
1867
|
themeTypeface="neutral"
|
|
1868
|
+
themeVariant="small"
|
|
1863
1869
|
>
|
|
1864
1870
|
B
|
|
1865
1871
|
</Text>
|
|
@@ -2254,11 +2260,13 @@ exports[`OptionList trigger onPress correctly on select additional value 1`] = `
|
|
|
2254
2260
|
},
|
|
2255
2261
|
]
|
|
2256
2262
|
}
|
|
2263
|
+
themeSize="medium"
|
|
2257
2264
|
>
|
|
2258
2265
|
<View
|
|
2259
2266
|
style={
|
|
2260
2267
|
[
|
|
2261
2268
|
{
|
|
2269
|
+
"alignItems": "center",
|
|
2262
2270
|
"display": "flex",
|
|
2263
2271
|
"flexDirection": "row",
|
|
2264
2272
|
},
|
|
@@ -2270,7 +2278,7 @@ exports[`OptionList trigger onPress correctly on select additional value 1`] = `
|
|
|
2270
2278
|
style={
|
|
2271
2279
|
[
|
|
2272
2280
|
{
|
|
2273
|
-
"marginRight":
|
|
2281
|
+
"marginRight": 12,
|
|
2274
2282
|
},
|
|
2275
2283
|
undefined,
|
|
2276
2284
|
]
|
|
@@ -2283,17 +2291,16 @@ exports[`OptionList trigger onPress correctly on select additional value 1`] = `
|
|
|
2283
2291
|
{
|
|
2284
2292
|
"color": "#001f23",
|
|
2285
2293
|
"fontFamily": "BeVietnamPro-Regular",
|
|
2286
|
-
"fontSize":
|
|
2294
|
+
"fontSize": 14,
|
|
2287
2295
|
"letterSpacing": 0.48,
|
|
2288
|
-
"lineHeight":
|
|
2296
|
+
"lineHeight": 22,
|
|
2289
2297
|
},
|
|
2290
2298
|
undefined,
|
|
2291
2299
|
]
|
|
2292
2300
|
}
|
|
2293
|
-
themeFontSize="large"
|
|
2294
|
-
themeFontWeight="regular"
|
|
2295
2301
|
themeIntent="body"
|
|
2296
2302
|
themeTypeface="neutral"
|
|
2303
|
+
themeVariant="small"
|
|
2297
2304
|
>
|
|
2298
2305
|
A
|
|
2299
2306
|
</Text>
|
|
@@ -2508,11 +2515,13 @@ exports[`OptionList trigger onPress correctly on select additional value 1`] = `
|
|
|
2508
2515
|
},
|
|
2509
2516
|
]
|
|
2510
2517
|
}
|
|
2518
|
+
themeSize="medium"
|
|
2511
2519
|
>
|
|
2512
2520
|
<View
|
|
2513
2521
|
style={
|
|
2514
2522
|
[
|
|
2515
2523
|
{
|
|
2524
|
+
"alignItems": "center",
|
|
2516
2525
|
"display": "flex",
|
|
2517
2526
|
"flexDirection": "row",
|
|
2518
2527
|
},
|
|
@@ -2524,7 +2533,7 @@ exports[`OptionList trigger onPress correctly on select additional value 1`] = `
|
|
|
2524
2533
|
style={
|
|
2525
2534
|
[
|
|
2526
2535
|
{
|
|
2527
|
-
"marginRight":
|
|
2536
|
+
"marginRight": 12,
|
|
2528
2537
|
},
|
|
2529
2538
|
undefined,
|
|
2530
2539
|
]
|
|
@@ -2537,17 +2546,16 @@ exports[`OptionList trigger onPress correctly on select additional value 1`] = `
|
|
|
2537
2546
|
{
|
|
2538
2547
|
"color": "#001f23",
|
|
2539
2548
|
"fontFamily": "BeVietnamPro-Regular",
|
|
2540
|
-
"fontSize":
|
|
2549
|
+
"fontSize": 14,
|
|
2541
2550
|
"letterSpacing": 0.48,
|
|
2542
|
-
"lineHeight":
|
|
2551
|
+
"lineHeight": 22,
|
|
2543
2552
|
},
|
|
2544
2553
|
undefined,
|
|
2545
2554
|
]
|
|
2546
2555
|
}
|
|
2547
|
-
themeFontSize="large"
|
|
2548
|
-
themeFontWeight="regular"
|
|
2549
2556
|
themeIntent="body"
|
|
2550
2557
|
themeTypeface="neutral"
|
|
2558
|
+
themeVariant="small"
|
|
2551
2559
|
>
|
|
2552
2560
|
B
|
|
2553
2561
|
</Text>
|