@hero-design/rn 7.26.0 → 7.27.1
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/es/index.js +264 -201
- package/lib/index.js +264 -201
- package/package.json +4 -4
- package/src/components/Accordion/index.tsx +1 -1
- package/src/components/Avatar/AvatarStack/__tests__/StyledAvatarStack.spec.tsx +6 -3
- package/src/components/Avatar/AvatarStack/__tests__/__snapshots__/index.spec.tsx.snap +9 -9
- package/src/components/Avatar/AvatarStack/__tests__/index.spec.tsx +6 -3
- package/src/components/Avatar/AvatarStack/utils.ts +3 -6
- package/src/components/Card/index.tsx +18 -7
- package/src/components/Select/MultiSelect/index.tsx +5 -2
- package/src/components/Select/SingleSelect/index.tsx +5 -2
- package/src/components/Select/types.ts +15 -6
- package/src/components/Tabs/ScrollableTabs.tsx +2 -0
- package/src/components/Tabs/__tests__/ScrollableTabs.spec.tsx +1 -1
- package/src/components/Tabs/__tests__/index.spec.tsx +1 -1
- package/src/components/Tabs/index.tsx +7 -0
- package/src/components/Tag/StyledTag.tsx +42 -11
- package/src/components/Tag/__tests__/Tag.spec.tsx +28 -0
- package/src/components/Tag/__tests__/__snapshots__/Tag.spec.tsx.snap +135 -0
- package/src/components/Tag/index.tsx +15 -3
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +2 -23
- package/src/theme/components/avatar.ts +0 -23
- package/src/theme/components/tag.ts +1 -0
- package/src/theme/components/toolbar.ts +1 -1
- package/src/theme/global/colors/work.ts +4 -4
- package/src/utils/hooks.ts +18 -1
- package/types/components/Card/index.d.ts +1 -1
- package/types/components/Select/MultiSelect/index.d.ts +1 -1
- package/types/components/Select/SingleSelect/index.d.ts +1 -1
- package/types/components/Select/index.d.ts +1 -1
- package/types/components/Select/types.d.ts +15 -3
- package/types/components/Tabs/ScrollableTabs.d.ts +1 -1
- package/types/components/Tabs/index.d.ts +7 -2
- package/types/components/Tag/StyledTag.d.ts +3 -0
- package/types/components/Tag/index.d.ts +7 -2
- package/types/theme/components/avatar.d.ts +0 -1
- package/types/theme/components/tag.d.ts +1 -0
- package/types/utils/hooks.d.ts +2 -0
- package/src/components/Accordion/utils.tsx +0 -11
- package/types/components/Accordion/utils.d.ts +0 -1
|
@@ -16,6 +16,7 @@ exports[`Tag has archived style when intent is archived 1`] = `
|
|
|
16
16
|
]
|
|
17
17
|
}
|
|
18
18
|
themeIntent="archived"
|
|
19
|
+
themeVariant="outlined"
|
|
19
20
|
>
|
|
20
21
|
<Text
|
|
21
22
|
style={
|
|
@@ -32,6 +33,7 @@ exports[`Tag has archived style when intent is archived 1`] = `
|
|
|
32
33
|
]
|
|
33
34
|
}
|
|
34
35
|
themeIntent="archived"
|
|
36
|
+
themeVariant="outlined"
|
|
35
37
|
>
|
|
36
38
|
ARCHIVED
|
|
37
39
|
</Text>
|
|
@@ -54,6 +56,7 @@ exports[`Tag has archived style when intent is primary 1`] = `
|
|
|
54
56
|
]
|
|
55
57
|
}
|
|
56
58
|
themeIntent="primary"
|
|
59
|
+
themeVariant="outlined"
|
|
57
60
|
>
|
|
58
61
|
<Text
|
|
59
62
|
style={
|
|
@@ -70,6 +73,7 @@ exports[`Tag has archived style when intent is primary 1`] = `
|
|
|
70
73
|
]
|
|
71
74
|
}
|
|
72
75
|
themeIntent="primary"
|
|
76
|
+
themeVariant="outlined"
|
|
73
77
|
>
|
|
74
78
|
PRIMARY
|
|
75
79
|
</Text>
|
|
@@ -92,6 +96,7 @@ exports[`Tag has danger style when intent is danger 1`] = `
|
|
|
92
96
|
]
|
|
93
97
|
}
|
|
94
98
|
themeIntent="danger"
|
|
99
|
+
themeVariant="outlined"
|
|
95
100
|
>
|
|
96
101
|
<Text
|
|
97
102
|
style={
|
|
@@ -108,6 +113,7 @@ exports[`Tag has danger style when intent is danger 1`] = `
|
|
|
108
113
|
]
|
|
109
114
|
}
|
|
110
115
|
themeIntent="danger"
|
|
116
|
+
themeVariant="outlined"
|
|
111
117
|
>
|
|
112
118
|
DANGER
|
|
113
119
|
</Text>
|
|
@@ -130,6 +136,7 @@ exports[`Tag has default style when intent is default 1`] = `
|
|
|
130
136
|
]
|
|
131
137
|
}
|
|
132
138
|
themeIntent="default"
|
|
139
|
+
themeVariant="outlined"
|
|
133
140
|
>
|
|
134
141
|
<Text
|
|
135
142
|
style={
|
|
@@ -146,6 +153,7 @@ exports[`Tag has default style when intent is default 1`] = `
|
|
|
146
153
|
]
|
|
147
154
|
}
|
|
148
155
|
themeIntent="default"
|
|
156
|
+
themeVariant="outlined"
|
|
149
157
|
>
|
|
150
158
|
DEFAULT
|
|
151
159
|
</Text>
|
|
@@ -168,6 +176,7 @@ exports[`Tag has info style when intent is info 1`] = `
|
|
|
168
176
|
]
|
|
169
177
|
}
|
|
170
178
|
themeIntent="info"
|
|
179
|
+
themeVariant="outlined"
|
|
171
180
|
>
|
|
172
181
|
<Text
|
|
173
182
|
style={
|
|
@@ -184,6 +193,7 @@ exports[`Tag has info style when intent is info 1`] = `
|
|
|
184
193
|
]
|
|
185
194
|
}
|
|
186
195
|
themeIntent="info"
|
|
196
|
+
themeVariant="outlined"
|
|
187
197
|
>
|
|
188
198
|
INFO
|
|
189
199
|
</Text>
|
|
@@ -206,6 +216,7 @@ exports[`Tag has success style when intent is success 1`] = `
|
|
|
206
216
|
]
|
|
207
217
|
}
|
|
208
218
|
themeIntent="success"
|
|
219
|
+
themeVariant="outlined"
|
|
209
220
|
>
|
|
210
221
|
<Text
|
|
211
222
|
style={
|
|
@@ -222,6 +233,7 @@ exports[`Tag has success style when intent is success 1`] = `
|
|
|
222
233
|
]
|
|
223
234
|
}
|
|
224
235
|
themeIntent="success"
|
|
236
|
+
themeVariant="outlined"
|
|
225
237
|
>
|
|
226
238
|
SUCCESS
|
|
227
239
|
</Text>
|
|
@@ -244,6 +256,7 @@ exports[`Tag has warning style when intent is warning 1`] = `
|
|
|
244
256
|
]
|
|
245
257
|
}
|
|
246
258
|
themeIntent="warning"
|
|
259
|
+
themeVariant="outlined"
|
|
247
260
|
>
|
|
248
261
|
<Text
|
|
249
262
|
style={
|
|
@@ -260,8 +273,130 @@ exports[`Tag has warning style when intent is warning 1`] = `
|
|
|
260
273
|
]
|
|
261
274
|
}
|
|
262
275
|
themeIntent="warning"
|
|
276
|
+
themeVariant="outlined"
|
|
263
277
|
>
|
|
264
278
|
WARNING
|
|
265
279
|
</Text>
|
|
266
280
|
</View>
|
|
267
281
|
`;
|
|
282
|
+
|
|
283
|
+
exports[`Tag renders correctly when variant is filled and intent is danger 1`] = `
|
|
284
|
+
<View
|
|
285
|
+
style={
|
|
286
|
+
Array [
|
|
287
|
+
Object {
|
|
288
|
+
"backgroundColor": "#fcebe7",
|
|
289
|
+
"borderColor": "#fcebe7",
|
|
290
|
+
"borderRadius": 4,
|
|
291
|
+
"borderWidth": 1,
|
|
292
|
+
"paddingHorizontal": 8,
|
|
293
|
+
"paddingVertical": 2,
|
|
294
|
+
},
|
|
295
|
+
undefined,
|
|
296
|
+
]
|
|
297
|
+
}
|
|
298
|
+
themeIntent="danger"
|
|
299
|
+
themeVariant="filled"
|
|
300
|
+
>
|
|
301
|
+
<Text
|
|
302
|
+
style={
|
|
303
|
+
Array [
|
|
304
|
+
Object {
|
|
305
|
+
"color": "#001f23",
|
|
306
|
+
"fontFamily": "BeVietnamPro-SemiBold",
|
|
307
|
+
"fontSize": 12,
|
|
308
|
+
"includeFontPadding": false,
|
|
309
|
+
"textAlign": "center",
|
|
310
|
+
"textAlignVertical": "center",
|
|
311
|
+
},
|
|
312
|
+
undefined,
|
|
313
|
+
]
|
|
314
|
+
}
|
|
315
|
+
themeIntent="danger"
|
|
316
|
+
themeVariant="filled"
|
|
317
|
+
>
|
|
318
|
+
DANGER
|
|
319
|
+
</Text>
|
|
320
|
+
</View>
|
|
321
|
+
`;
|
|
322
|
+
|
|
323
|
+
exports[`Tag renders correctly when variant is filled and intent is warning 1`] = `
|
|
324
|
+
<View
|
|
325
|
+
style={
|
|
326
|
+
Array [
|
|
327
|
+
Object {
|
|
328
|
+
"backgroundColor": "#fff6eb",
|
|
329
|
+
"borderColor": "#fff6eb",
|
|
330
|
+
"borderRadius": 4,
|
|
331
|
+
"borderWidth": 1,
|
|
332
|
+
"paddingHorizontal": 8,
|
|
333
|
+
"paddingVertical": 2,
|
|
334
|
+
},
|
|
335
|
+
undefined,
|
|
336
|
+
]
|
|
337
|
+
}
|
|
338
|
+
themeIntent="warning"
|
|
339
|
+
themeVariant="filled"
|
|
340
|
+
>
|
|
341
|
+
<Text
|
|
342
|
+
style={
|
|
343
|
+
Array [
|
|
344
|
+
Object {
|
|
345
|
+
"color": "#001f23",
|
|
346
|
+
"fontFamily": "BeVietnamPro-SemiBold",
|
|
347
|
+
"fontSize": 12,
|
|
348
|
+
"includeFontPadding": false,
|
|
349
|
+
"textAlign": "center",
|
|
350
|
+
"textAlignVertical": "center",
|
|
351
|
+
},
|
|
352
|
+
undefined,
|
|
353
|
+
]
|
|
354
|
+
}
|
|
355
|
+
themeIntent="warning"
|
|
356
|
+
themeVariant="filled"
|
|
357
|
+
>
|
|
358
|
+
WARNING
|
|
359
|
+
</Text>
|
|
360
|
+
</View>
|
|
361
|
+
`;
|
|
362
|
+
|
|
363
|
+
exports[`Tag renders correctly with custom content 1`] = `
|
|
364
|
+
<View
|
|
365
|
+
style={
|
|
366
|
+
Array [
|
|
367
|
+
Object {
|
|
368
|
+
"backgroundColor": undefined,
|
|
369
|
+
"borderColor": "#401960",
|
|
370
|
+
"borderRadius": 4,
|
|
371
|
+
"borderWidth": 1,
|
|
372
|
+
"paddingHorizontal": 8,
|
|
373
|
+
"paddingVertical": 2,
|
|
374
|
+
},
|
|
375
|
+
undefined,
|
|
376
|
+
]
|
|
377
|
+
}
|
|
378
|
+
themeIntent="primary"
|
|
379
|
+
themeVariant="outlined"
|
|
380
|
+
>
|
|
381
|
+
<Text
|
|
382
|
+
style={
|
|
383
|
+
Array [
|
|
384
|
+
Object {
|
|
385
|
+
"color": "#001f23",
|
|
386
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
387
|
+
"fontSize": 14,
|
|
388
|
+
"letterSpacing": 0.42,
|
|
389
|
+
"lineHeight": 22,
|
|
390
|
+
},
|
|
391
|
+
undefined,
|
|
392
|
+
]
|
|
393
|
+
}
|
|
394
|
+
themeFontSize="medium"
|
|
395
|
+
themeFontWeight="regular"
|
|
396
|
+
themeIntent="body"
|
|
397
|
+
themeTypeface="neutral"
|
|
398
|
+
>
|
|
399
|
+
Custom Content
|
|
400
|
+
</Text>
|
|
401
|
+
</View>
|
|
402
|
+
`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ReactElement } from 'react';
|
|
2
2
|
import type { StyleProp, ViewStyle, ViewProps } from 'react-native';
|
|
3
3
|
import { StyledView, StyledText } from './StyledTag';
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ interface TagProps extends ViewProps {
|
|
|
6
6
|
/**
|
|
7
7
|
* Content of the Tag.
|
|
8
8
|
*/
|
|
9
|
-
content: string;
|
|
9
|
+
content: string | ReactElement;
|
|
10
10
|
/**
|
|
11
11
|
* Visual intent color to apply to Tag.
|
|
12
12
|
*/
|
|
@@ -18,6 +18,10 @@ interface TagProps extends ViewProps {
|
|
|
18
18
|
| 'warning'
|
|
19
19
|
| 'danger'
|
|
20
20
|
| 'archived';
|
|
21
|
+
/**
|
|
22
|
+
* Tag variant.
|
|
23
|
+
*/
|
|
24
|
+
variant?: 'filled' | 'outlined';
|
|
21
25
|
/**
|
|
22
26
|
* Additional style.
|
|
23
27
|
*/
|
|
@@ -30,6 +34,7 @@ interface TagProps extends ViewProps {
|
|
|
30
34
|
|
|
31
35
|
const Tag = ({
|
|
32
36
|
content,
|
|
37
|
+
variant = 'outlined',
|
|
33
38
|
intent = 'primary',
|
|
34
39
|
style,
|
|
35
40
|
testID,
|
|
@@ -38,10 +43,17 @@ const Tag = ({
|
|
|
38
43
|
<StyledView
|
|
39
44
|
{...nativeProps}
|
|
40
45
|
themeIntent={intent}
|
|
46
|
+
themeVariant={variant}
|
|
41
47
|
style={style}
|
|
42
48
|
testID={testID}
|
|
43
49
|
>
|
|
44
|
-
|
|
50
|
+
{typeof content === 'string' ? (
|
|
51
|
+
<StyledText themeIntent={intent} themeVariant={variant}>
|
|
52
|
+
{content}
|
|
53
|
+
</StyledText>
|
|
54
|
+
) : (
|
|
55
|
+
content
|
|
56
|
+
)}
|
|
45
57
|
</StyledView>
|
|
46
58
|
);
|
|
47
59
|
|
|
@@ -65,28 +65,6 @@ Object {
|
|
|
65
65
|
"primary": "#401960",
|
|
66
66
|
"success": "#5ace7d",
|
|
67
67
|
"text": "#ffffff",
|
|
68
|
-
"visualisation": Array [
|
|
69
|
-
"#48000a",
|
|
70
|
-
"#737479",
|
|
71
|
-
"#001f23",
|
|
72
|
-
"#353957",
|
|
73
|
-
"#25006e",
|
|
74
|
-
"#4568fb",
|
|
75
|
-
"#5a68e2",
|
|
76
|
-
"#4853b5",
|
|
77
|
-
"#48a564",
|
|
78
|
-
"#017d6d",
|
|
79
|
-
"#cc822a",
|
|
80
|
-
"#998000",
|
|
81
|
-
"#e3602a",
|
|
82
|
-
"#f46363",
|
|
83
|
-
"#de350b",
|
|
84
|
-
"#c38cee",
|
|
85
|
-
"#9f64e3",
|
|
86
|
-
"#8505a2",
|
|
87
|
-
"#7622d7",
|
|
88
|
-
"#401960",
|
|
89
|
-
],
|
|
90
68
|
"warning": "#ffbe71",
|
|
91
69
|
},
|
|
92
70
|
"fontSizes": Object {
|
|
@@ -766,6 +744,7 @@ Object {
|
|
|
766
744
|
"primaryBackground": undefined,
|
|
767
745
|
"success": "#017d6d",
|
|
768
746
|
"successBackground": "#f0fef4",
|
|
747
|
+
"text": "#001f23",
|
|
769
748
|
"warning": "#ffa234",
|
|
770
749
|
"warningBackground": "#fff6eb",
|
|
771
750
|
},
|
|
@@ -903,7 +882,7 @@ Object {
|
|
|
903
882
|
},
|
|
904
883
|
"colors": Object {
|
|
905
884
|
"background": "#ffffff",
|
|
906
|
-
"border": "#
|
|
885
|
+
"border": "#e8e9ea",
|
|
907
886
|
"danger": "#ffbe71",
|
|
908
887
|
"disabled": "#bfc1c5",
|
|
909
888
|
"error": "#f46363",
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { defaultMobilePalette as palette } from '@hero-design/colors';
|
|
2
1
|
import type { GlobalTheme } from '../global';
|
|
3
2
|
|
|
4
3
|
const getAvatarTheme = (theme: GlobalTheme) => {
|
|
@@ -9,28 +8,6 @@ const getAvatarTheme = (theme: GlobalTheme) => {
|
|
|
9
8
|
success: theme.colors.success,
|
|
10
9
|
warning: theme.colors.warning,
|
|
11
10
|
text: theme.colors.invertedText,
|
|
12
|
-
visualisation: [
|
|
13
|
-
palette.currant,
|
|
14
|
-
palette.sonicSilver,
|
|
15
|
-
palette.maasstrichtBlue,
|
|
16
|
-
palette.nightBlue,
|
|
17
|
-
palette.darkBlue,
|
|
18
|
-
palette.ultramarineBlue,
|
|
19
|
-
palette.royalBlue,
|
|
20
|
-
palette.royalBlueDark20,
|
|
21
|
-
palette.emeraldDark20,
|
|
22
|
-
palette.pineGreen,
|
|
23
|
-
palette.deepSaffronDark20,
|
|
24
|
-
palette.goldDark40,
|
|
25
|
-
palette.apple,
|
|
26
|
-
palette.pastelRed,
|
|
27
|
-
palette.vermilion,
|
|
28
|
-
palette.mauve,
|
|
29
|
-
palette.violetLight30,
|
|
30
|
-
palette.violet1,
|
|
31
|
-
palette.violet,
|
|
32
|
-
palette.scarletGum,
|
|
33
|
-
],
|
|
34
11
|
};
|
|
35
12
|
|
|
36
13
|
const sizes = {
|
|
@@ -20,6 +20,7 @@ const getTagTheme = (theme: GlobalTheme) => {
|
|
|
20
20
|
dangerBackground: theme.colors.errorSurface,
|
|
21
21
|
archived: theme.colors.onArchivedSurface,
|
|
22
22
|
archivedBackground: theme.colors.archivedSurface,
|
|
23
|
+
text: theme.colors.onDefaultGlobalSurface,
|
|
23
24
|
};
|
|
24
25
|
|
|
25
26
|
const fonts = {
|
|
@@ -3,7 +3,7 @@ import type { GlobalTheme } from '../global';
|
|
|
3
3
|
const getToolbarTheme = (theme: GlobalTheme) => {
|
|
4
4
|
const colors = {
|
|
5
5
|
background: theme.colors.defaultGlobalSurface,
|
|
6
|
-
border: theme.colors.
|
|
6
|
+
border: theme.colors.secondaryOutline,
|
|
7
7
|
primary: theme.colors.primary,
|
|
8
8
|
secondary: theme.colors.secondary,
|
|
9
9
|
info: theme.colors.info,
|
|
@@ -3,13 +3,13 @@ import swag from './swag';
|
|
|
3
3
|
import type { SystemPalette, BrandSystemPalette } from './types';
|
|
4
4
|
|
|
5
5
|
const workBrandSystemPallete: BrandSystemPalette = {
|
|
6
|
-
primary: palette.
|
|
6
|
+
primary: palette.policeBlue,
|
|
7
7
|
onPrimary: palette.white,
|
|
8
|
-
secondary: palette.
|
|
8
|
+
secondary: palette.policeBlueLight25,
|
|
9
9
|
onSecondary: palette.white,
|
|
10
10
|
defaultSurface: palette.white,
|
|
11
|
-
highlightedSurface: palette.
|
|
12
|
-
pressedSurface: palette.
|
|
11
|
+
highlightedSurface: palette.policeBlueLight90,
|
|
12
|
+
pressedSurface: palette.policeBlueLight20,
|
|
13
13
|
|
|
14
14
|
decorativePrimary: palette.gold,
|
|
15
15
|
decorativePrimarySurface: palette.goldLight80,
|
package/src/utils/hooks.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
2
|
|
|
3
3
|
// Get previous state value
|
|
4
4
|
export const usePrevious = <T>(value: T) => {
|
|
@@ -8,3 +8,20 @@ export const usePrevious = <T>(value: T) => {
|
|
|
8
8
|
}, [value]);
|
|
9
9
|
return ref.current;
|
|
10
10
|
};
|
|
11
|
+
|
|
12
|
+
export function usePropsOrInternalState<T>(
|
|
13
|
+
initialState: T,
|
|
14
|
+
state: T | undefined,
|
|
15
|
+
setState: ((val: T) => void) | undefined
|
|
16
|
+
): [T, (val: T) => void] {
|
|
17
|
+
const [internalState, setInternalState] = React.useState<T>(initialState);
|
|
18
|
+
|
|
19
|
+
return [state || internalState, setState || setInternalState];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const useDeprecation = (message: string, cond = true) => {
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
// eslint-disable-next-line no-console
|
|
25
|
+
console.warn(message);
|
|
26
|
+
}, [message, cond]);
|
|
27
|
+
};
|
|
@@ -24,7 +24,7 @@ interface CardProps extends ViewProps {
|
|
|
24
24
|
*/
|
|
25
25
|
testID?: string;
|
|
26
26
|
}
|
|
27
|
-
declare const _default: (({ variant, intent, children, ...nativeProps }: CardProps) => JSX.Element) & {
|
|
27
|
+
declare const _default: (({ variant: _variant, intent, children, ...nativeProps }: CardProps) => JSX.Element) & {
|
|
28
28
|
Data: ({ intent, children, ...nativeProps }: import("./DataCard").DataCardProps) => JSX.Element;
|
|
29
29
|
};
|
|
30
30
|
export default _default;
|
|
@@ -22,5 +22,5 @@ export interface MultiSelectProps<V, T extends OptionType<V> = OptionType<V>> ex
|
|
|
22
22
|
*/
|
|
23
23
|
renderSelectedValue?: (selectedValue: V[], inputProps: NativeTextInputProps) => React.ReactNode;
|
|
24
24
|
}
|
|
25
|
-
declare function MultiSelect<V, T extends OptionType<V>>({ footerLabel, label, loading, inputProps, onConfirm, onDimiss, onEndReached, onQueryChange, options, renderOption, renderSelectedValue, query, error, editable, disabled, numberOfLines, style, testID, value, }: MultiSelectProps<V, T>): JSX.Element;
|
|
25
|
+
declare function MultiSelect<V, T extends OptionType<V>>({ footerLabel, label, loading, inputProps, onConfirm, onDimiss, onDismiss, onEndReached, onQueryChange, options, renderOption, renderSelectedValue, query, error, editable, disabled, required, numberOfLines, style, testID, value, }: MultiSelectProps<V, T>): JSX.Element;
|
|
26
26
|
export default MultiSelect;
|
|
@@ -15,5 +15,5 @@ export interface SingleSelectProps<V, T extends OptionType<V> = OptionType<V>> e
|
|
|
15
15
|
*/
|
|
16
16
|
renderSelectedValue?: (selectedValue: V | null, inputProps: NativeTextInputProps) => React.ReactNode;
|
|
17
17
|
}
|
|
18
|
-
declare const SingleSelect: <V, T extends OptionType<V>>({ label, loading, inputProps, onConfirm, onDimiss, onEndReached, onQueryChange, options, renderOption, renderSelectedValue, query, error, editable, disabled, numberOfLines, style, testID, value, }: SingleSelectProps<V, T>) => JSX.Element;
|
|
18
|
+
declare const SingleSelect: <V, T extends OptionType<V>>({ label, loading, inputProps, onConfirm, onDimiss, onDismiss, onEndReached, onQueryChange, options, renderOption, renderSelectedValue, query, error, editable, disabled, required, numberOfLines, style, testID, value, }: SingleSelectProps<V, T>) => JSX.Element;
|
|
19
19
|
export default SingleSelect;
|
|
@@ -2,7 +2,7 @@ import MultiSelect from './MultiSelect';
|
|
|
2
2
|
import type { MultiSelectProps } from './MultiSelect';
|
|
3
3
|
import type { SingleSelectProps } from './SingleSelect';
|
|
4
4
|
export type { MultiSelectProps, SingleSelectProps };
|
|
5
|
-
declare const _default: (<V, T extends import("./types").OptionType<V>>({ label, loading, inputProps, onConfirm, onDimiss, onEndReached, onQueryChange, options, renderOption, renderSelectedValue, query, error, editable, disabled, numberOfLines, style, testID, value, }: SingleSelectProps<V, T>) => JSX.Element) & {
|
|
5
|
+
declare const _default: (<V, T extends import("./types").OptionType<V>>({ label, loading, inputProps, onConfirm, onDimiss, onDismiss, onEndReached, onQueryChange, options, renderOption, renderSelectedValue, query, error, editable, disabled, required, numberOfLines, style, testID, value, }: SingleSelectProps<V, T>) => JSX.Element) & {
|
|
6
6
|
Multi: typeof MultiSelect;
|
|
7
7
|
};
|
|
8
8
|
export default _default;
|
|
@@ -20,7 +20,7 @@ export declare type SectionListRenderOptionInfo<V, T extends OptionType<V>> = Se
|
|
|
20
20
|
selected: boolean;
|
|
21
21
|
onPress: () => void;
|
|
22
22
|
};
|
|
23
|
-
export interface SelectProps<V, T extends OptionType<V>> extends Pick<TextInputProps, 'editable' | 'disabled' | '
|
|
23
|
+
export interface SelectProps<V, T extends OptionType<V>> extends Pick<TextInputProps, 'editable' | 'disabled' | 'error' | 'required'> {
|
|
24
24
|
/**
|
|
25
25
|
* An array of options to be selected.
|
|
26
26
|
*/
|
|
@@ -43,9 +43,14 @@ export interface SelectProps<V, T extends OptionType<V>> extends Pick<TextInputP
|
|
|
43
43
|
*/
|
|
44
44
|
onQueryChange?: (value: string) => void;
|
|
45
45
|
/**
|
|
46
|
-
*
|
|
46
|
+
* @deprecated due to typo.
|
|
47
|
+
* Please use onDismiss instead.
|
|
47
48
|
*/
|
|
48
49
|
onDimiss?: () => void;
|
|
50
|
+
/**
|
|
51
|
+
* Event handler when selection dismiss
|
|
52
|
+
*/
|
|
53
|
+
onDismiss?: () => void;
|
|
49
54
|
/**
|
|
50
55
|
* Event handler when end of the list reached
|
|
51
56
|
*/
|
|
@@ -56,8 +61,10 @@ export interface SelectProps<V, T extends OptionType<V>> extends Pick<TextInputP
|
|
|
56
61
|
loading?: boolean;
|
|
57
62
|
/**
|
|
58
63
|
* Props that are passed to TextInput.
|
|
64
|
+
* Required is deprecated and will be removed in the next major release.
|
|
65
|
+
* Please use the outer required instead.
|
|
59
66
|
*/
|
|
60
|
-
inputProps?: Pick<TextInputProps, 'loading' | 'required'>;
|
|
67
|
+
inputProps?: Pick<TextInputProps, 'loading' | 'required' | 'numberOfLines'>;
|
|
61
68
|
/**
|
|
62
69
|
* Field label.
|
|
63
70
|
*/
|
|
@@ -70,4 +77,9 @@ export interface SelectProps<V, T extends OptionType<V>> extends Pick<TextInputP
|
|
|
70
77
|
* Testing id of the component.
|
|
71
78
|
*/
|
|
72
79
|
testID?: string;
|
|
80
|
+
/**
|
|
81
|
+
* @deprecated
|
|
82
|
+
* Please use inputProps.numberOfLines instead.
|
|
83
|
+
*/
|
|
84
|
+
numberOfLines?: number;
|
|
73
85
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { TabsProps } from '.';
|
|
2
|
-
declare const ScrollableTab: ({ onTabPress, selectedTabKey, tabs, containerStyle, barStyle, lazy, lazyPreloadDistance, testID: componentTestID, }: TabsProps) => JSX.Element;
|
|
2
|
+
declare const ScrollableTab: ({ onTabPress, selectedTabKey, tabs, containerStyle, barStyle, lazy, lazyPreloadDistance, swipeEnabled, testID: componentTestID, }: TabsProps) => JSX.Element;
|
|
3
3
|
export default ScrollableTab;
|
|
@@ -45,12 +45,17 @@ export interface TabsProps extends ViewProps {
|
|
|
45
45
|
* Defaults value is `1`.
|
|
46
46
|
*/
|
|
47
47
|
lazyPreloadDistance?: number;
|
|
48
|
+
/**
|
|
49
|
+
* Boolean indicating whether to enable swipe gestures. Passing `false` will disable swipe gestures, but the user can still switch tabs by pressing the tab bar.
|
|
50
|
+
* Defaults value is `true`.
|
|
51
|
+
*/
|
|
52
|
+
swipeEnabled?: boolean;
|
|
48
53
|
/**
|
|
49
54
|
* Testing id of the component.
|
|
50
55
|
*/
|
|
51
56
|
testID?: string;
|
|
52
57
|
}
|
|
53
|
-
declare const _default: (({ onTabPress, selectedTabKey, tabs, containerStyle, barStyle, lazy, lazyPreloadDistance, testID: componentTestID, }: TabsProps) => JSX.Element) & {
|
|
54
|
-
Scroll: ({ onTabPress, selectedTabKey, tabs, containerStyle, barStyle, lazy, lazyPreloadDistance, testID: componentTestID, }: TabsProps) => JSX.Element;
|
|
58
|
+
declare const _default: (({ onTabPress, selectedTabKey, tabs, containerStyle, barStyle, lazy, lazyPreloadDistance, swipeEnabled, testID: componentTestID, }: TabsProps) => JSX.Element) & {
|
|
59
|
+
Scroll: ({ onTabPress, selectedTabKey, tabs, containerStyle, barStyle, lazy, lazyPreloadDistance, swipeEnabled, testID: componentTestID, }: TabsProps) => JSX.Element;
|
|
55
60
|
};
|
|
56
61
|
export default _default;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { View, Text } from 'react-native';
|
|
2
2
|
declare type ThemeIntent = 'default' | 'primary' | 'info' | 'success' | 'warning' | 'danger' | 'archived';
|
|
3
|
+
declare type ThemeVariant = 'filled' | 'outlined';
|
|
3
4
|
declare const StyledView: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
|
|
4
5
|
theme?: import("@emotion/react").Theme | undefined;
|
|
5
6
|
as?: import("react").ElementType<any> | undefined;
|
|
6
7
|
} & {
|
|
7
8
|
themeIntent: ThemeIntent;
|
|
9
|
+
themeVariant: ThemeVariant;
|
|
8
10
|
}, {}, {
|
|
9
11
|
ref?: import("react").Ref<View> | undefined;
|
|
10
12
|
}>;
|
|
@@ -13,6 +15,7 @@ declare const StyledText: import("@emotion/native").StyledComponent<import("reac
|
|
|
13
15
|
as?: import("react").ElementType<any> | undefined;
|
|
14
16
|
} & {
|
|
15
17
|
themeIntent: ThemeIntent;
|
|
18
|
+
themeVariant: ThemeVariant;
|
|
16
19
|
}, {}, {
|
|
17
20
|
ref?: import("react").Ref<Text> | undefined;
|
|
18
21
|
}>;
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
1
2
|
import type { StyleProp, ViewStyle, ViewProps } from 'react-native';
|
|
2
3
|
interface TagProps extends ViewProps {
|
|
3
4
|
/**
|
|
4
5
|
* Content of the Tag.
|
|
5
6
|
*/
|
|
6
|
-
content: string;
|
|
7
|
+
content: string | ReactElement;
|
|
7
8
|
/**
|
|
8
9
|
* Visual intent color to apply to Tag.
|
|
9
10
|
*/
|
|
10
11
|
intent?: 'primary' | 'default' | 'info' | 'success' | 'warning' | 'danger' | 'archived';
|
|
12
|
+
/**
|
|
13
|
+
* Tag variant.
|
|
14
|
+
*/
|
|
15
|
+
variant?: 'filled' | 'outlined';
|
|
11
16
|
/**
|
|
12
17
|
* Additional style.
|
|
13
18
|
*/
|
|
@@ -17,5 +22,5 @@ interface TagProps extends ViewProps {
|
|
|
17
22
|
*/
|
|
18
23
|
testID?: string;
|
|
19
24
|
}
|
|
20
|
-
declare const Tag: ({ content, intent, style, testID, ...nativeProps }: TagProps) => JSX.Element;
|
|
25
|
+
declare const Tag: ({ content, variant, intent, style, testID, ...nativeProps }: TagProps) => JSX.Element;
|
|
21
26
|
export default Tag;
|
package/types/utils/hooks.d.ts
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
1
|
export declare const usePrevious: <T>(value: T) => T | undefined;
|
|
2
|
+
export declare function usePropsOrInternalState<T>(initialState: T, state: T | undefined, setState: ((val: T) => void) | undefined): [T, (val: T) => void];
|
|
3
|
+
export declare const useDeprecation: (message: string, cond?: boolean) => void;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
export function usePropsOrInternalState<T>(
|
|
4
|
-
initialState: T,
|
|
5
|
-
state: T | undefined,
|
|
6
|
-
setState: ((val: T) => void) | undefined
|
|
7
|
-
): [T, (val: T) => void] {
|
|
8
|
-
const [internalState, setInternalState] = React.useState<T>(initialState);
|
|
9
|
-
|
|
10
|
-
return [state || internalState, setState || setInternalState];
|
|
11
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function usePropsOrInternalState<T>(initialState: T, state: T | undefined, setState: ((val: T) => void) | undefined): [T, (val: T) => void];
|