@hero-design/rn 8.13.0 → 8.15.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 +9 -9
- package/assets/fonts/hero-icons-mobile.ttf +0 -0
- package/es/index.js +428 -395
- package/lib/assets/fonts/hero-icons-mobile.ttf +0 -0
- package/lib/index.js +428 -395
- package/package.json +5 -5
- package/src/components/Avatar/AvatarStack/__tests__/__snapshots__/StyledAvatarStack.spec.tsx.snap +0 -1
- package/src/components/Avatar/AvatarStack/__tests__/__snapshots__/index.spec.tsx.snap +0 -9
- package/src/components/Avatar/StyledAvatar.tsx +13 -3
- package/src/components/Avatar/__tests__/__snapshots__/index.spec.tsx.snap +0 -2
- package/src/components/Error/__tests__/__snapshots__/index.spec.tsx.snap +6 -0
- package/src/components/Error/__tests__/index.spec.tsx +2 -9
- package/src/components/Error/index.tsx +17 -9
- package/src/components/Icon/HeroIcon/glyphMap.json +1 -1
- package/src/components/Icon/IconList.ts +12 -0
- package/src/components/List/__tests__/__snapshots__/ListItem.spec.tsx.snap +0 -2
- package/src/components/Select/MultiSelect/__tests__/index.spec.tsx +19 -0
- package/src/components/Select/MultiSelect/index.tsx +7 -4
- package/src/components/Select/SingleSelect/__tests__/index.spec.tsx +16 -0
- package/src/components/Select/SingleSelect/index.tsx +7 -4
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +12 -10
- package/src/theme/components/avatar.ts +14 -12
- package/types/components/Error/index.d.ts +8 -8
- package/types/components/Icon/IconList.d.ts +1 -1
- package/types/components/Icon/index.d.ts +1 -1
- package/types/components/Icon/utils.d.ts +1 -1
- package/types/theme/components/avatar.d.ts +12 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hero-design/rn",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.15.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@emotion/native": "^11.9.3",
|
|
23
23
|
"@emotion/react": "^11.9.3",
|
|
24
|
-
"@hero-design/colors": "8.
|
|
24
|
+
"@hero-design/colors": "8.15.0",
|
|
25
25
|
"date-fns": "^2.16.1",
|
|
26
26
|
"events": "^3.2.0",
|
|
27
27
|
"hero-editor": "^1.9.21"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@babel/preset-typescript": "^7.17.12",
|
|
45
45
|
"@babel/runtime": "^7.18.9",
|
|
46
46
|
"@emotion/jest": "^11.9.3",
|
|
47
|
-
"@hero-design/eslint-plugin": "8.
|
|
47
|
+
"@hero-design/eslint-plugin": "8.15.0",
|
|
48
48
|
"@react-native-community/datetimepicker": "^3.5.2",
|
|
49
49
|
"@react-native-community/slider": "4.1.12",
|
|
50
50
|
"@rollup/plugin-babel": "^5.3.1",
|
|
@@ -60,9 +60,9 @@
|
|
|
60
60
|
"@types/react-native": "^0.67.7",
|
|
61
61
|
"@types/react-native-vector-icons": "^6.4.10",
|
|
62
62
|
"babel-plugin-inline-import": "^3.0.0",
|
|
63
|
-
"eslint-config-hd": "8.
|
|
63
|
+
"eslint-config-hd": "8.15.0",
|
|
64
64
|
"jest": "^27.3.1",
|
|
65
|
-
"prettier-config-hd": "8.
|
|
65
|
+
"prettier-config-hd": "8.15.0",
|
|
66
66
|
"react": "18.0.0",
|
|
67
67
|
"react-native": "0.69.7",
|
|
68
68
|
"react-native-gesture-handler": "~2.1.0",
|
|
@@ -50,7 +50,6 @@ exports[`AvatarStack renders correctly by default 1`] = `
|
|
|
50
50
|
Array [
|
|
51
51
|
Object {
|
|
52
52
|
"alignItems": "center",
|
|
53
|
-
"display": "flex",
|
|
54
53
|
"height": "100%",
|
|
55
54
|
"justifyContent": "center",
|
|
56
55
|
"width": "100%",
|
|
@@ -128,7 +127,6 @@ exports[`AvatarStack renders correctly by default 1`] = `
|
|
|
128
127
|
Array [
|
|
129
128
|
Object {
|
|
130
129
|
"alignItems": "center",
|
|
131
|
-
"display": "flex",
|
|
132
130
|
"height": "100%",
|
|
133
131
|
"justifyContent": "center",
|
|
134
132
|
"width": "100%",
|
|
@@ -206,7 +204,6 @@ exports[`AvatarStack renders correctly by default 1`] = `
|
|
|
206
204
|
Array [
|
|
207
205
|
Object {
|
|
208
206
|
"alignItems": "center",
|
|
209
|
-
"display": "flex",
|
|
210
207
|
"height": "100%",
|
|
211
208
|
"justifyContent": "center",
|
|
212
209
|
"width": "100%",
|
|
@@ -284,7 +281,6 @@ exports[`AvatarStack renders correctly by default 1`] = `
|
|
|
284
281
|
Array [
|
|
285
282
|
Object {
|
|
286
283
|
"alignItems": "center",
|
|
287
|
-
"display": "flex",
|
|
288
284
|
"height": "100%",
|
|
289
285
|
"justifyContent": "center",
|
|
290
286
|
"width": "100%",
|
|
@@ -362,7 +358,6 @@ exports[`AvatarStack renders correctly by default 1`] = `
|
|
|
362
358
|
Array [
|
|
363
359
|
Object {
|
|
364
360
|
"alignItems": "center",
|
|
365
|
-
"display": "flex",
|
|
366
361
|
"height": "100%",
|
|
367
362
|
"justifyContent": "center",
|
|
368
363
|
"width": "100%",
|
|
@@ -459,7 +454,6 @@ exports[`AvatarStack renders correctly with custom props 1`] = `
|
|
|
459
454
|
Array [
|
|
460
455
|
Object {
|
|
461
456
|
"alignItems": "center",
|
|
462
|
-
"display": "flex",
|
|
463
457
|
"height": "100%",
|
|
464
458
|
"justifyContent": "center",
|
|
465
459
|
"width": "100%",
|
|
@@ -537,7 +531,6 @@ exports[`AvatarStack renders correctly with custom props 1`] = `
|
|
|
537
531
|
Array [
|
|
538
532
|
Object {
|
|
539
533
|
"alignItems": "center",
|
|
540
|
-
"display": "flex",
|
|
541
534
|
"height": "100%",
|
|
542
535
|
"justifyContent": "center",
|
|
543
536
|
"width": "100%",
|
|
@@ -615,7 +608,6 @@ exports[`AvatarStack renders correctly with custom props 1`] = `
|
|
|
615
608
|
Array [
|
|
616
609
|
Object {
|
|
617
610
|
"alignItems": "center",
|
|
618
|
-
"display": "flex",
|
|
619
611
|
"height": "100%",
|
|
620
612
|
"justifyContent": "center",
|
|
621
613
|
"width": "100%",
|
|
@@ -693,7 +685,6 @@ exports[`AvatarStack renders correctly with custom props 1`] = `
|
|
|
693
685
|
Array [
|
|
694
686
|
Object {
|
|
695
687
|
"alignItems": "center",
|
|
696
|
-
"display": "flex",
|
|
697
688
|
"height": "100%",
|
|
698
689
|
"justifyContent": "center",
|
|
699
690
|
"width": "100%",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { View, Image, TouchableOpacity } from 'react-native';
|
|
1
|
+
import { View, Image, TouchableOpacity, Platform } from 'react-native';
|
|
2
2
|
import styled from '@emotion/native';
|
|
3
3
|
import Typography from '../Typography';
|
|
4
4
|
import { TextProps } from '../Typography/Text';
|
|
@@ -28,7 +28,6 @@ const StyledWrapper = styled(TouchableOpacity)<{
|
|
|
28
28
|
const StyledTextWrapper = styled(View)(() => ({
|
|
29
29
|
alignItems: 'center',
|
|
30
30
|
justifyContent: 'center',
|
|
31
|
-
display: 'flex',
|
|
32
31
|
width: '100%',
|
|
33
32
|
height: '100%',
|
|
34
33
|
}));
|
|
@@ -40,11 +39,22 @@ const StyledText = styled(Typography.Text)<
|
|
|
40
39
|
>(({ themeSize, theme }) => ({
|
|
41
40
|
fontFamily: theme.__hd__.avatar.fonts.default,
|
|
42
41
|
fontSize: theme.__hd__.avatar.fontSizes[themeSize],
|
|
43
|
-
lineHeight: 0, // auto center
|
|
44
42
|
textAlignVertical: 'center',
|
|
45
43
|
textAlign: 'center',
|
|
46
44
|
color: theme.__hd__.avatar.colors.text,
|
|
47
45
|
overflow: 'hidden',
|
|
46
|
+
...Platform.select({
|
|
47
|
+
ios: {
|
|
48
|
+
lineHeight: 0, // center on ios
|
|
49
|
+
},
|
|
50
|
+
android: {
|
|
51
|
+
lineHeight: null as unknown as number, // center on android
|
|
52
|
+
marginTop: theme.__hd__.avatar.spaces.titleMarginTopForAndroid[themeSize],
|
|
53
|
+
},
|
|
54
|
+
web: {
|
|
55
|
+
lineHeight: null as unknown as number, // center on android
|
|
56
|
+
},
|
|
57
|
+
}),
|
|
48
58
|
}));
|
|
49
59
|
|
|
50
60
|
const StyledImage = styled(Image)<{
|
|
@@ -33,7 +33,6 @@ exports[`Avatar fallbacks to title when there image failed to load 1`] = `
|
|
|
33
33
|
Array [
|
|
34
34
|
Object {
|
|
35
35
|
"alignItems": "center",
|
|
36
|
-
"display": "flex",
|
|
37
36
|
"height": "100%",
|
|
38
37
|
"justifyContent": "center",
|
|
39
38
|
"width": "100%",
|
|
@@ -187,7 +186,6 @@ exports[`Avatar shows title when there is no source 1`] = `
|
|
|
187
186
|
Array [
|
|
188
187
|
Object {
|
|
189
188
|
"alignItems": "center",
|
|
190
|
-
"display": "flex",
|
|
191
189
|
"height": "100%",
|
|
192
190
|
"justifyContent": "center",
|
|
193
191
|
"width": "100%",
|
|
@@ -57,6 +57,7 @@ exports[`Error renders error screen with image correctly 1`] = `
|
|
|
57
57
|
testID="error-image"
|
|
58
58
|
/>
|
|
59
59
|
<Text
|
|
60
|
+
allowFontScaling={false}
|
|
60
61
|
style={
|
|
61
62
|
Array [
|
|
62
63
|
Object {
|
|
@@ -86,6 +87,7 @@ exports[`Error renders error screen with image correctly 1`] = `
|
|
|
86
87
|
We’re sorry, something went wrong
|
|
87
88
|
</Text>
|
|
88
89
|
<Text
|
|
90
|
+
allowFontScaling={false}
|
|
89
91
|
style={
|
|
90
92
|
Array [
|
|
91
93
|
Object {
|
|
@@ -190,6 +192,7 @@ exports[`Error renders full screen error page correctly 1`] = `
|
|
|
190
192
|
testID="error-image"
|
|
191
193
|
/>
|
|
192
194
|
<Text
|
|
195
|
+
allowFontScaling={false}
|
|
193
196
|
style={
|
|
194
197
|
Array [
|
|
195
198
|
Object {
|
|
@@ -219,6 +222,7 @@ exports[`Error renders full screen error page correctly 1`] = `
|
|
|
219
222
|
We’re sorry, something went wrong
|
|
220
223
|
</Text>
|
|
221
224
|
<Text
|
|
225
|
+
allowFontScaling={false}
|
|
222
226
|
style={
|
|
223
227
|
Array [
|
|
224
228
|
Object {
|
|
@@ -282,6 +286,7 @@ exports[`Error renders title only correctly 1`] = `
|
|
|
282
286
|
}
|
|
283
287
|
>
|
|
284
288
|
<Text
|
|
289
|
+
allowFontScaling={false}
|
|
285
290
|
style={
|
|
286
291
|
Array [
|
|
287
292
|
Object {
|
|
@@ -311,6 +316,7 @@ exports[`Error renders title only correctly 1`] = `
|
|
|
311
316
|
We’re sorry, something went wrong
|
|
312
317
|
</Text>
|
|
313
318
|
<Text
|
|
319
|
+
allowFontScaling={false}
|
|
314
320
|
style={
|
|
315
321
|
Array [
|
|
316
322
|
Object {
|
|
@@ -9,7 +9,7 @@ const description = 'Please try again later';
|
|
|
9
9
|
describe('Error', () => {
|
|
10
10
|
it('renders title only correctly', () => {
|
|
11
11
|
const { toJSON, getByText } = renderWithTheme(
|
|
12
|
-
<Error
|
|
12
|
+
<Error title={title} description={description} />
|
|
13
13
|
);
|
|
14
14
|
|
|
15
15
|
expect(getByText(title)).toBeTruthy();
|
|
@@ -18,12 +18,7 @@ describe('Error', () => {
|
|
|
18
18
|
});
|
|
19
19
|
it('renders error screen with image correctly', () => {
|
|
20
20
|
const { toJSON, getByText, getByTestId } = renderWithTheme(
|
|
21
|
-
<Error
|
|
22
|
-
visible
|
|
23
|
-
title={title}
|
|
24
|
-
description={description}
|
|
25
|
-
image="path_to_image"
|
|
26
|
-
/>
|
|
21
|
+
<Error title={title} description={description} image="path_to_image" />
|
|
27
22
|
);
|
|
28
23
|
|
|
29
24
|
expect(getByText(title)).toBeTruthy();
|
|
@@ -34,7 +29,6 @@ describe('Error', () => {
|
|
|
34
29
|
it('renders full screen error page correctly', () => {
|
|
35
30
|
const { toJSON, getByText, getByTestId } = renderWithTheme(
|
|
36
31
|
<Error
|
|
37
|
-
visible
|
|
38
32
|
variant="full-screen"
|
|
39
33
|
title={title}
|
|
40
34
|
description={description}
|
|
@@ -52,7 +46,6 @@ describe('Error', () => {
|
|
|
52
46
|
const onSecondaryCtaPress = jest.fn();
|
|
53
47
|
const { getByText } = renderWithTheme(
|
|
54
48
|
<Error
|
|
55
|
-
visible
|
|
56
49
|
title={title}
|
|
57
50
|
description={description}
|
|
58
51
|
image="path_to_image"
|
|
@@ -13,8 +13,15 @@ import {
|
|
|
13
13
|
StyledErrorModal,
|
|
14
14
|
StyledErrorTitle,
|
|
15
15
|
} from './StyledError';
|
|
16
|
+
import { useDeprecation } from '../../utils/hooks';
|
|
16
17
|
|
|
17
|
-
interface
|
|
18
|
+
interface ErrorProps extends ViewProps {
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated use conditional rendering instead
|
|
21
|
+
*
|
|
22
|
+
* Visibility of the error
|
|
23
|
+
*/
|
|
24
|
+
visible?: boolean;
|
|
18
25
|
/**
|
|
19
26
|
* Variant of the error
|
|
20
27
|
*/
|
|
@@ -53,13 +60,6 @@ interface ErrorPageProps extends ViewProps {
|
|
|
53
60
|
onSecondaryCtaPress?: () => void;
|
|
54
61
|
}
|
|
55
62
|
|
|
56
|
-
type ErrorProps = ErrorPageProps & {
|
|
57
|
-
/**
|
|
58
|
-
* Visibility of the error
|
|
59
|
-
*/
|
|
60
|
-
visible: boolean;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
63
|
type onCloseCallbackType = 'cta' | 'secondaryCta' | null;
|
|
64
64
|
|
|
65
65
|
const ErrorPage = ({
|
|
@@ -73,7 +73,7 @@ const ErrorPage = ({
|
|
|
73
73
|
secondaryCtaText,
|
|
74
74
|
onSecondaryCtaPress,
|
|
75
75
|
...nativeProps
|
|
76
|
-
}:
|
|
76
|
+
}: ErrorProps): ReactElement => {
|
|
77
77
|
const showCta = ctaText && onCtaPress !== undefined;
|
|
78
78
|
const showSecondaryCta =
|
|
79
79
|
secondaryCtaText && onSecondaryCtaPress !== undefined;
|
|
@@ -127,6 +127,7 @@ const Error = ({
|
|
|
127
127
|
variant = 'in-page',
|
|
128
128
|
title,
|
|
129
129
|
description,
|
|
130
|
+
image,
|
|
130
131
|
testID,
|
|
131
132
|
ctaText,
|
|
132
133
|
onCtaPress,
|
|
@@ -134,6 +135,11 @@ const Error = ({
|
|
|
134
135
|
onSecondaryCtaPress,
|
|
135
136
|
...nativeProps
|
|
136
137
|
}: ErrorProps): ReactElement => {
|
|
138
|
+
useDeprecation(
|
|
139
|
+
`Visible prop is deprecated. Use conditional rendering instead`,
|
|
140
|
+
visible
|
|
141
|
+
);
|
|
142
|
+
|
|
137
143
|
const [isVisible, setIsVisible] = useState(visible);
|
|
138
144
|
const [ctaPressed, setCtaPressed] = useState<onCloseCallbackType>(null);
|
|
139
145
|
|
|
@@ -176,6 +182,7 @@ const Error = ({
|
|
|
176
182
|
variant={variant}
|
|
177
183
|
title={title}
|
|
178
184
|
description={description}
|
|
185
|
+
image={image}
|
|
179
186
|
testID={testID}
|
|
180
187
|
ctaText={ctaText}
|
|
181
188
|
onCtaPress={
|
|
@@ -202,6 +209,7 @@ const Error = ({
|
|
|
202
209
|
variant={variant}
|
|
203
210
|
title={title}
|
|
204
211
|
description={description}
|
|
212
|
+
image={image}
|
|
205
213
|
testID={testID}
|
|
206
214
|
ctaText={ctaText}
|
|
207
215
|
onCtaPress={onCtaPress}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"activate":59000,"add-emoji":59001,"add-person":59002,"adjustment":59003,"alignment":59004,"antenna":59005,"archive":59006,"assignment-warning":59007,"bank":59008,"bell":59009,"billing":59010,"bookmark-added":
|
|
1
|
+
{"activate":59000,"add-emoji":59001,"add-person":59002,"adjustment":59003,"alignment":59004,"antenna":59005,"archive":59006,"assignment-warning":59007,"bank":59008,"bell":59009,"billing":59010,"bolt":59011,"bookmark-added":59012,"bookmark":59013,"box-check":59014,"box":59015,"bpay":59016,"buildings":59017,"cake":59018,"calendar-clock":59019,"calendar":59020,"candy-box-menu":59021,"caret-down-small":59022,"caret-down":59023,"caret-left-small":59024,"caret-left":59025,"caret-right-small":59026,"caret-right":59027,"caret-up-small":59028,"caret-up":59029,"check-radio":59030,"circle-add":59031,"circle-cancel":59032,"circle-check":59033,"circle-down":59034,"circle-info":59035,"circle-left":59036,"circle-ok":59037,"circle-pencil":59038,"circle-question":59039,"circle-remove":59040,"circle-right":59041,"circle-up":59042,"circle-warning":59043,"clock-3":59044,"clock":59045,"cloud-download":59046,"cloud-upload":59047,"cog":59048,"coin":59049,"contacts":59050,"credit-card":59051,"diamond":59052,"direction-arrows":59053,"directory":59054,"document":59055,"dollar-coin-shine":59056,"double-buildings":59057,"edit-template":59058,"envelope":59059,"exclude":59060,"expense":59061,"eye-circle":59062,"eye-invisible":59063,"eye":59064,"face-meh":59065,"face-sad":59066,"face-smiley":59067,"feed":59068,"feedbacks":59069,"file-certified":59070,"file-clone":59071,"file-copy":59072,"file-csv":59073,"file-dispose":59074,"file-doc":59075,"file-excel":59076,"file-export":59077,"file-lock":59078,"file-pdf":59079,"file-powerpoint":59080,"file-search":59081,"file-secured":59082,"file-sheets":59083,"file-slide":59084,"file-verified":59085,"file-word":59086,"file":59087,"filter":59088,"folder-user":59089,"folder":59090,"format-bold":59091,"format-heading1":59092,"format-heading2":59093,"format-italic":59094,"format-list-bulleted":59095,"format-list-numbered":59096,"format-underlined":59097,"funnel-filter":59098,"global-dollar":59099,"globe":59100,"graduation-cap":59101,"graph":59102,"happy-sun":59103,"health-bag":59104,"heart":59105,"home":59106,"image":59107,"import":59108,"incident-siren":59109,"instapay":59110,"list":59111,"loading-2":59112,"loading":59113,"location":59114,"lock":59115,"looks-one":59116,"looks-two":59117,"media-content":59118,"menu":59119,"money-notes":59120,"moneybag":59121,"moon":59122,"multiple-stars":59123,"multiple-users":59124,"node":59125,"open-folder":59126,"paperclip":59127,"payment-summary":59128,"pencil":59129,"phone":59130,"piggy-bank":59131,"plane-up":59132,"plane":59133,"play-circle":59134,"print":59135,"raising-hands":59136,"reply-arrow":59137,"reply":59138,"reschedule":59139,"rostering":59140,"save":59141,"schedule-send":59142,"schedule":59143,"search-person":59144,"send":59145,"speaker-active":59146,"speaker":59147,"star-award":59148,"star-badge":59149,"star-circle":59150,"star-medal":59151,"star":59152,"steps-circle":59153,"stopwatch":59154,"suitcase":59155,"surfing":59156,"survey":59157,"swag-pillar-benefit":59158,"swag-pillar-career":59159,"swag-pillar-money":59160,"swag-pillar-work":59161,"swag":59162,"switch":59163,"tag":59164,"target":59165,"teams":59166,"timesheet":59167,"touch-id":59168,"trash-bin":59169,"unlock":59170,"user":59171,"video-1":59172,"video-2":59173,"wallet":59174,"warning":59175,"activate-outlined":59176,"add-credit-card-outlined":59177,"add-person-outlined":59178,"add-section-outlined":59179,"add-time-outlined":59180,"add":59181,"adjustment-outlined":59182,"alignment-2-outlined":59183,"alignment-outlined":59184,"all-caps":59185,"arrow-down":59186,"arrow-downwards":59187,"arrow-left":59188,"arrow-leftwards":59189,"arrow-right":59190,"arrow-rightwards":59191,"arrow-up":59192,"arrow-upwards":59193,"article-outlined":59194,"at-sign":59195,"auto-graph-outlined":59196,"beer-outlined":59197,"bell-active-outlined":59198,"bell-outlined":59199,"bell-slash-outlined":59200,"billing-outlined":59201,"body-outlined":59202,"bold":59203,"book-outlined":59204,"bookmark-added-outlined":59205,"bookmark-outlined":59206,"box-check-outlined":59207,"box-outlined":59208,"bullet-points":59209,"cake-outlined":59210,"calendar-dates-outlined":59211,"calendar-star-outlined":59212,"call-split-outlined":59213,"camera-outlined":59214,"cancel":59215,"car-forward-outlined":59216,"charging-station-outlined":59217,"chat-bubble-outlined":59218,"chat-unread-outlined":59219,"checkmark":59220,"circle-add-outlined":59221,"circle-cancel-outlined":59222,"circle-down-outlined":59223,"circle-info-outlined":59224,"circle-left-outlined":59225,"circle-ok-outlined":59226,"circle-question-outlined":59227,"circle-remove-outlined":59228,"circle-right-outlined":59229,"circle-up-outlined":59230,"circle-warning-outlined":59231,"clock-2-outlined":59232,"clock-outlined":59233,"cog-outlined":59234,"coin-outlined":59235,"comment-outlined":59236,"contacts-outlined":59237,"contacts-user-outlined":59238,"credit-card-outlined":59239,"cup-outlined":59240,"dentistry-outlined":59241,"direction-arrows-outlined":59242,"directory-outlined":59243,"document-outlined":59244,"dollar-box-outlined":59245,"dollar-card-outlined":59246,"dollar-coin-shine-outlined":59247,"dollar-credit-card-outlined":59248,"dollar-sign":59249,"double-buildings-outlined":59250,"double-left-arrows":59251,"double-right-arrows":59252,"download-outlined":59253,"edit-template-outlined":59254,"email-outlined":59255,"enter-arrow":59256,"envelope-outlined":59257,"expense-outlined":59258,"explore-outlined":59259,"external-link":59260,"eye-invisible-outlined":59261,"eye-outlined":59262,"face-id":59263,"face-meh-outlined":59264,"face-open-smiley-outlined":59265,"face-sad-outlined":59266,"face-smiley-outlined":59267,"fastfood-outlined":59268,"feed-outlined":59269,"file-certified-outlined":59270,"file-clone-outlined":59271,"file-copy-outlined":59272,"file-dispose-outlined":59273,"file-dollar-certified-outlined":59274,"file-dollar-outlined":59275,"file-download-outlined":59276,"file-export-outlined":59277,"file-lock-outlined":59278,"file-outlined":59279,"file-search-outlined":59280,"file-secured-outlined":59281,"file-statutory-outlined":59282,"file-verified-outlined":59283,"filter-outlined":59284,"folder-outlined":59285,"folder-user-outlined":59286,"form-outlined":59287,"funnel-filter-outline":59288,"graph-outlined":59289,"hand-holding-user-outlined":59290,"happy-sun-outlined":59291,"health-bag-outlined":59292,"heart-outlined":59293,"home-active-outlined":59294,"home-outlined":59295,"id-card-outlined":59296,"image-outlined":59297,"import-outlined":59298,"instapay-outlined":59299,"italic":59300,"link-1":59301,"link-2":59302,"list-outlined":59303,"live-help-outlined":59304,"location-on-outlined":59305,"location-outlined":59306,"lock-outlined":59307,"locked-file-outlined":59308,"log-out":59309,"media-content-outlined":59310,"menu-close":59311,"menu-expand":59312,"menu-fold-outlined":59313,"menu-unfold-outlined":59314,"moneybag-outlined":59315,"moon-outlined":59316,"more-horizontal":59317,"more-vertical":59318,"multiple-folders-outlined":59319,"multiple-users-outlined":59320,"near-me-outlined":59321,"node-outlined":59322,"number-points":59323,"number":59324,"overview-outlined":59325,"payment-summary-outlined":59326,"payslip-outlined":59327,"pencil-outlined":59328,"percentage":59329,"phone-outlined":59330,"piggy-bank-outlined":59331,"plane-outlined":59332,"play-circle-outlined":59333,"print-outlined":59334,"qr-code-outlined":59335,"qualification-outlined":59336,"re-assign":59337,"redeem":59338,"refresh":59339,"remove":59340,"reply-outlined":59341,"restart":59342,"return-arrow":59343,"rostering-outlined":59344,"save-outlined":59345,"schedule-outlined":59346,"search-outlined":59347,"search-secured-outlined":59348,"send-outlined":59349,"share-1":59350,"share-2":59351,"share-outlined":59352,"show-chart-outlined":59353,"single-down-arrow":59354,"single-left-arrow":59355,"single-right-arrow":59356,"single-up-arrow":59357,"speaker-active-outlined":59358,"speaker-outlined":59359,"star-circle-outlined":59360,"star-outlined":59361,"stopwatch-outlined":59362,"strikethrough":59363,"styler-outlined":59364,"suitcase-clock-outlined":59365,"suitcase-outlined":59366,"survey-outlined":59367,"switch-outlined":59368,"sync":59369,"tag-outlined":59370,"target-outlined":59371,"tennis-outlined":59372,"ticket-outlined":59373,"timesheet-outlined":59374,"today-outlined":59375,"transfer":59376,"trash-bin-outlined":59377,"umbrela-outlined":59378,"unavailable":59379,"underline":59380,"union-outlined":59381,"unlock-outlined":59382,"upload-outlined":59383,"user-circle-outlined":59384,"user-gear-outlined":59385,"user-outlined":59386,"user-rectangle-outlined":59387,"video-1-outlined":59388,"video-2-outlined":59389,"volunteer-outlined":59390,"wallet-outlined":59391}
|
|
@@ -11,6 +11,7 @@ const IconList = [
|
|
|
11
11
|
'bank',
|
|
12
12
|
'bell',
|
|
13
13
|
'billing',
|
|
14
|
+
'bolt',
|
|
14
15
|
'bookmark-added',
|
|
15
16
|
'bookmark',
|
|
16
17
|
'box-check',
|
|
@@ -155,6 +156,7 @@ const IconList = [
|
|
|
155
156
|
'steps-circle',
|
|
156
157
|
'stopwatch',
|
|
157
158
|
'suitcase',
|
|
159
|
+
'surfing',
|
|
158
160
|
'survey',
|
|
159
161
|
'swag-pillar-benefit',
|
|
160
162
|
'swag-pillar-career',
|
|
@@ -195,12 +197,14 @@ const IconList = [
|
|
|
195
197
|
'article-outlined',
|
|
196
198
|
'at-sign',
|
|
197
199
|
'auto-graph-outlined',
|
|
200
|
+
'beer-outlined',
|
|
198
201
|
'bell-active-outlined',
|
|
199
202
|
'bell-outlined',
|
|
200
203
|
'bell-slash-outlined',
|
|
201
204
|
'billing-outlined',
|
|
202
205
|
'body-outlined',
|
|
203
206
|
'bold',
|
|
207
|
+
'book-outlined',
|
|
204
208
|
'bookmark-added-outlined',
|
|
205
209
|
'bookmark-outlined',
|
|
206
210
|
'box-check-outlined',
|
|
@@ -237,6 +241,7 @@ const IconList = [
|
|
|
237
241
|
'contacts-user-outlined',
|
|
238
242
|
'credit-card-outlined',
|
|
239
243
|
'cup-outlined',
|
|
244
|
+
'dentistry-outlined',
|
|
240
245
|
'direction-arrows-outlined',
|
|
241
246
|
'directory-outlined',
|
|
242
247
|
'document-outlined',
|
|
@@ -263,6 +268,7 @@ const IconList = [
|
|
|
263
268
|
'face-open-smiley-outlined',
|
|
264
269
|
'face-sad-outlined',
|
|
265
270
|
'face-smiley-outlined',
|
|
271
|
+
'fastfood-outlined',
|
|
266
272
|
'feed-outlined',
|
|
267
273
|
'file-certified-outlined',
|
|
268
274
|
'file-clone-outlined',
|
|
@@ -281,6 +287,7 @@ const IconList = [
|
|
|
281
287
|
'filter-outlined',
|
|
282
288
|
'folder-outlined',
|
|
283
289
|
'folder-user-outlined',
|
|
290
|
+
'form-outlined',
|
|
284
291
|
'funnel-filter-outline',
|
|
285
292
|
'graph-outlined',
|
|
286
293
|
'hand-holding-user-outlined',
|
|
@@ -357,12 +364,16 @@ const IconList = [
|
|
|
357
364
|
'star-outlined',
|
|
358
365
|
'stopwatch-outlined',
|
|
359
366
|
'strikethrough',
|
|
367
|
+
'styler-outlined',
|
|
360
368
|
'suitcase-clock-outlined',
|
|
361
369
|
'suitcase-outlined',
|
|
362
370
|
'survey-outlined',
|
|
363
371
|
'switch-outlined',
|
|
364
372
|
'sync',
|
|
373
|
+
'tag-outlined',
|
|
365
374
|
'target-outlined',
|
|
375
|
+
'tennis-outlined',
|
|
376
|
+
'ticket-outlined',
|
|
366
377
|
'timesheet-outlined',
|
|
367
378
|
'today-outlined',
|
|
368
379
|
'transfer',
|
|
@@ -379,6 +390,7 @@ const IconList = [
|
|
|
379
390
|
'user-rectangle-outlined',
|
|
380
391
|
'video-1-outlined',
|
|
381
392
|
'video-2-outlined',
|
|
393
|
+
'volunteer-outlined',
|
|
382
394
|
'wallet-outlined',
|
|
383
395
|
] as const;
|
|
384
396
|
|
|
@@ -89,7 +89,6 @@ exports[`ListItem renders correctly ListItem with children 1`] = `
|
|
|
89
89
|
Array [
|
|
90
90
|
Object {
|
|
91
91
|
"alignItems": "center",
|
|
92
|
-
"display": "flex",
|
|
93
92
|
"height": "100%",
|
|
94
93
|
"justifyContent": "center",
|
|
95
94
|
"width": "100%",
|
|
@@ -679,7 +678,6 @@ exports[`ListItem renders correctly ListItem with prefix suffix is React.Element
|
|
|
679
678
|
Array [
|
|
680
679
|
Object {
|
|
681
680
|
"alignItems": "center",
|
|
682
|
-
"display": "flex",
|
|
683
681
|
"height": "100%",
|
|
684
682
|
"justifyContent": "center",
|
|
685
683
|
"width": "100%",
|
|
@@ -218,6 +218,25 @@ describe('rendering', () => {
|
|
|
218
218
|
expect(queryByText('Custom value')).toBeNull();
|
|
219
219
|
});
|
|
220
220
|
|
|
221
|
+
it('renders initial value when renderSelectedValue is passed', () => {
|
|
222
|
+
const { queryByText } = renderWithTheme(
|
|
223
|
+
<MultiSelect<string, CustomOptionType>
|
|
224
|
+
label="Choose collaborators"
|
|
225
|
+
footerLabel="Confirm"
|
|
226
|
+
options={collaboratorSections}
|
|
227
|
+
value={['Jack', 'Jane']}
|
|
228
|
+
onConfirm={jest.fn()}
|
|
229
|
+
renderSelectedValue={(selectedValue, _inputProps) => (
|
|
230
|
+
<Typography.Text>{`Selected: ${selectedValue.join(
|
|
231
|
+
', '
|
|
232
|
+
)}`}</Typography.Text>
|
|
233
|
+
)}
|
|
234
|
+
/>
|
|
235
|
+
);
|
|
236
|
+
|
|
237
|
+
expect(queryByText('Selected: Jack, Jane')).toBeTruthy();
|
|
238
|
+
});
|
|
239
|
+
|
|
221
240
|
it('allows custom footer', () => {
|
|
222
241
|
const { getByText, queryByText } = renderWithTheme(
|
|
223
242
|
<MultiSelect<string, CustomOptionType>
|
|
@@ -80,6 +80,7 @@ function MultiSelect<V, T extends OptionType<V>>({
|
|
|
80
80
|
.filter((opt) => value.includes(opt.value))
|
|
81
81
|
.map((opt) => opt.text)
|
|
82
82
|
.join(', ');
|
|
83
|
+
const rawValue = value.length > 0 ? value.join(', ') : '';
|
|
83
84
|
|
|
84
85
|
useEffect(() => {
|
|
85
86
|
setSelectingValue(value);
|
|
@@ -100,7 +101,7 @@ function MultiSelect<V, T extends OptionType<V>>({
|
|
|
100
101
|
<TextInput
|
|
101
102
|
{...inputProps}
|
|
102
103
|
label={label}
|
|
103
|
-
value={displayedValue}
|
|
104
|
+
value={renderSelectedValue ? rawValue : displayedValue}
|
|
104
105
|
suffix="arrow-down"
|
|
105
106
|
multiline
|
|
106
107
|
error={error}
|
|
@@ -111,7 +112,7 @@ function MultiSelect<V, T extends OptionType<V>>({
|
|
|
111
112
|
style={style}
|
|
112
113
|
testID={testID}
|
|
113
114
|
renderInputValue={
|
|
114
|
-
renderSelectedValue !== undefined &&
|
|
115
|
+
renderSelectedValue !== undefined && rawValue?.length > 0
|
|
115
116
|
? (props) => renderSelectedValue(value, props)
|
|
116
117
|
: undefined
|
|
117
118
|
}
|
|
@@ -121,8 +122,10 @@ function MultiSelect<V, T extends OptionType<V>>({
|
|
|
121
122
|
</View>
|
|
122
123
|
<BottomSheet
|
|
123
124
|
open={open}
|
|
124
|
-
onRequestClose={() =>
|
|
125
|
-
|
|
125
|
+
onRequestClose={() => {
|
|
126
|
+
onDismiss?.();
|
|
127
|
+
setOpen(false);
|
|
128
|
+
}}
|
|
126
129
|
header={label}
|
|
127
130
|
style={{
|
|
128
131
|
paddingBottom: isKeyboardVisible ? keyboardHeight : 0,
|
|
@@ -197,6 +197,22 @@ describe('rendering', () => {
|
|
|
197
197
|
);
|
|
198
198
|
expect(queryByText('Custom value')).toBeNull();
|
|
199
199
|
});
|
|
200
|
+
|
|
201
|
+
it('renders initial value when renderSelectedValue is passed', () => {
|
|
202
|
+
const { getByText } = renderWithTheme(
|
|
203
|
+
<SingleSelect<string, CustomOptionType>
|
|
204
|
+
label="Choose collaborators"
|
|
205
|
+
options={collaboratorSections}
|
|
206
|
+
value="Jack"
|
|
207
|
+
onConfirm={jest.fn()}
|
|
208
|
+
renderSelectedValue={(selectedValue) => (
|
|
209
|
+
<Typography.Text>{`Selected: ${selectedValue}`}</Typography.Text>
|
|
210
|
+
)}
|
|
211
|
+
/>
|
|
212
|
+
);
|
|
213
|
+
|
|
214
|
+
expect(getByText('Selected: Jack')).toBeTruthy();
|
|
215
|
+
});
|
|
200
216
|
});
|
|
201
217
|
|
|
202
218
|
describe('behavior', () => {
|
|
@@ -61,6 +61,7 @@ const SingleSelect = <V, T extends OptionType<V>>({
|
|
|
61
61
|
const sections = toSections(options);
|
|
62
62
|
const flatOptions = toFlatOptions(options);
|
|
63
63
|
const displayedValue = flatOptions.find((opt) => value === opt.value)?.text;
|
|
64
|
+
const rawValue = value ? String(value) : undefined;
|
|
64
65
|
|
|
65
66
|
return (
|
|
66
67
|
<>
|
|
@@ -77,7 +78,7 @@ const SingleSelect = <V, T extends OptionType<V>>({
|
|
|
77
78
|
<TextInput
|
|
78
79
|
{...inputProps}
|
|
79
80
|
label={label}
|
|
80
|
-
value={displayedValue}
|
|
81
|
+
value={renderSelectedValue ? rawValue : displayedValue}
|
|
81
82
|
suffix="arrow-down"
|
|
82
83
|
multiline
|
|
83
84
|
error={error}
|
|
@@ -88,7 +89,7 @@ const SingleSelect = <V, T extends OptionType<V>>({
|
|
|
88
89
|
style={style}
|
|
89
90
|
testID={testID}
|
|
90
91
|
renderInputValue={
|
|
91
|
-
renderSelectedValue !== undefined && !!
|
|
92
|
+
renderSelectedValue !== undefined && !!rawValue
|
|
92
93
|
? (props) => renderSelectedValue(value, props)
|
|
93
94
|
: undefined
|
|
94
95
|
}
|
|
@@ -98,8 +99,10 @@ const SingleSelect = <V, T extends OptionType<V>>({
|
|
|
98
99
|
</View>
|
|
99
100
|
<BottomSheet
|
|
100
101
|
open={open}
|
|
101
|
-
onRequestClose={() =>
|
|
102
|
-
|
|
102
|
+
onRequestClose={() => {
|
|
103
|
+
onDismiss?.();
|
|
104
|
+
setOpen(false);
|
|
105
|
+
}}
|
|
103
106
|
header={label}
|
|
104
107
|
style={{
|
|
105
108
|
paddingBottom: isKeyboardVisible ? keyboardHeight : 0,
|
|
@@ -80,16 +80,6 @@ Object {
|
|
|
80
80
|
"fonts": Object {
|
|
81
81
|
"default": "BeVietnamPro-Regular",
|
|
82
82
|
},
|
|
83
|
-
"lineHeights": Object {
|
|
84
|
-
"large": 28,
|
|
85
|
-
"medium": 26,
|
|
86
|
-
"small": 24,
|
|
87
|
-
"xlarge": 32,
|
|
88
|
-
"xxlarge": 44,
|
|
89
|
-
"xxxlarge": 36,
|
|
90
|
-
"xxxxlarge": 39,
|
|
91
|
-
"xxxxxlarge": 42,
|
|
92
|
-
},
|
|
93
83
|
"radii": Object {
|
|
94
84
|
"rounded": 999,
|
|
95
85
|
},
|
|
@@ -103,6 +93,18 @@ Object {
|
|
|
103
93
|
"xxxxlarge": 96,
|
|
104
94
|
"xxxxxlarge": 136,
|
|
105
95
|
},
|
|
96
|
+
"spaces": Object {
|
|
97
|
+
"titleMarginTopForAndroid": Object {
|
|
98
|
+
"large": -4,
|
|
99
|
+
"medium": -4,
|
|
100
|
+
"small": -2,
|
|
101
|
+
"xlarge": -4,
|
|
102
|
+
"xxlarge": -6,
|
|
103
|
+
"xxxlarge": -6,
|
|
104
|
+
"xxxxlarge": -8,
|
|
105
|
+
"xxxxxlarge": -8,
|
|
106
|
+
},
|
|
107
|
+
},
|
|
106
108
|
},
|
|
107
109
|
"badge": Object {
|
|
108
110
|
"colors": Object {
|