@hero-design/rn 7.5.0 → 7.6.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 +8 -8
- package/es/index.js +474 -110
- package/lib/index.js +474 -108
- package/package.json +2 -2
- package/playground/.turbo/turbo-type-check.log +7 -0
- package/playground/package.json +3 -3
- package/playground/src/App.tsx +6 -0
- package/playground/src/ContentNavigator.tsx +3 -10
- package/playground/src/Select.tsx +32 -0
- package/playground/src/Switch.tsx +80 -0
- package/src/components/BottomSheet/Header.tsx +1 -1
- package/src/components/BottomSheet/__tests__/__snapshots__/index.spec.tsx.snap +8 -8
- package/src/components/BottomSheet/index.tsx +6 -0
- package/src/components/Radio/RadioGroup.tsx +31 -7
- package/src/components/Radio/types.ts +1 -0
- package/src/components/SectionHeading/StyledHeading.tsx +5 -5
- package/src/components/SectionHeading/__tests__/{StyledHeading.tsx → StyledHeading.spec.tsx} +0 -0
- package/src/components/SectionHeading/__tests__/__snapshots__/{StyledHeading.tsx.snap → StyledHeading.spec.tsx.snap} +0 -0
- package/src/components/Select/MultiSelect/Footer.tsx +15 -0
- package/src/components/Select/MultiSelect/OptionList.tsx +76 -0
- package/src/components/Select/MultiSelect/StyledMultiSelect.tsx +30 -0
- package/src/components/Select/MultiSelect/__tests__/StyledMultiSelect.spec.tsx +49 -0
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/StyledMultiSelect.spec.tsx.snap +108 -0
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +1630 -0
- package/src/components/Select/MultiSelect/__tests__/index.spec.tsx +94 -0
- package/src/components/Select/MultiSelect/index.tsx +103 -0
- package/src/components/Select/MultiSelect/types.ts +1 -0
- package/src/components/Select/index.tsx +5 -0
- package/src/components/Switch/StyledSwitch.tsx +50 -0
- package/src/components/Switch/__tests__/StyledHeading.spec.tsx +42 -0
- package/src/components/Switch/__tests__/__snapshots__/StyledHeading.spec.tsx.snap +74 -0
- package/src/components/Switch/__tests__/__snapshots__/index.spec.tsx.snap +129 -0
- package/src/components/Switch/__tests__/index.spec.tsx +24 -0
- package/src/components/Switch/index.tsx +87 -0
- package/src/components/TextInput/StyledTextInput.tsx +2 -6
- package/src/components/TextInput/__tests__/StyledTextInput.spec.tsx +1 -7
- package/src/components/TextInput/__tests__/__snapshots__/StyledTextInput.spec.tsx.snap +1 -22
- package/src/components/TextInput/__tests__/index.spec.tsx +2 -1
- package/src/components/TextInput/index.tsx +19 -6
- package/src/index.ts +4 -0
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +58 -1
- package/src/theme/components/sectionHeading.ts +18 -0
- package/src/theme/components/select.ts +23 -0
- package/src/theme/components/switch.ts +50 -0
- package/src/theme/components/textInput.ts +1 -1
- package/src/theme/global/colors.ts +1 -0
- package/src/theme/index.ts +12 -3
- package/types/components/BottomSheet/index.d.ts +5 -1
- package/types/components/Radio/RadioGroup.d.ts +11 -8
- package/types/components/Radio/index.d.ts +1 -1
- package/types/components/Radio/types.d.ts +5 -0
- package/types/components/SectionHeading/__tests__/{StyledHeading.d.ts → StyledHeading.spec.d.ts} +0 -0
- package/types/components/Select/MultiSelect/Footer.d.ts +5 -0
- package/types/components/Select/MultiSelect/OptionList.d.ts +3 -0
- package/types/components/Select/MultiSelect/StyledMultiSelect.d.ts +26 -0
- package/types/components/Select/MultiSelect/__tests__/StyledMultiSelect.spec.d.ts +1 -0
- package/types/components/Select/MultiSelect/__tests__/index.spec.d.ts +1 -0
- package/types/components/Select/MultiSelect/index.d.ts +39 -0
- package/types/components/Select/MultiSelect/types.d.ts +5 -0
- package/types/components/Select/index.d.ts +5 -0
- package/types/components/Switch/StyledSwitch.d.ts +36 -0
- package/types/components/Switch/__tests__/StyledHeading.spec.d.ts +1 -0
- package/types/components/Switch/__tests__/index.spec.d.ts +1 -0
- package/types/components/Switch/index.d.ts +30 -0
- package/types/components/TextInput/StyledTextInput.d.ts +1 -5
- package/types/components/TextInput/index.d.ts +13 -5
- package/types/index.d.ts +3 -1
- package/types/theme/components/sectionHeading.d.ts +13 -0
- package/types/theme/components/select.d.ts +17 -0
- package/types/theme/components/switch.d.ts +32 -0
- package/types/theme/components/textInput.d.ts +1 -1
- package/types/theme/global/colors.d.ts +1 -0
- package/types/theme/global/index.d.ts +1 -0
- package/types/theme/index.d.ts +8 -2
|
@@ -5,12 +5,13 @@ import TextInput from '../index';
|
|
|
5
5
|
describe('TextInput', () => {
|
|
6
6
|
it('renders label, prefix and native TextInput', () => {
|
|
7
7
|
const { queryAllByTestId, queryAllByText } = renderWithTheme(
|
|
8
|
-
<TextInput label="Input Label" prefix="user" />
|
|
8
|
+
<TextInput label="Input Label" prefix="user" suffix="arrow-down" />
|
|
9
9
|
);
|
|
10
10
|
|
|
11
11
|
expect(queryAllByText('Input Label')).toHaveLength(1);
|
|
12
12
|
expect(queryAllByTestId('input-label')).toHaveLength(1);
|
|
13
13
|
expect(queryAllByTestId('input-prefix')).toHaveLength(1);
|
|
14
|
+
expect(queryAllByTestId('input-suffix')).toHaveLength(1);
|
|
14
15
|
expect(queryAllByTestId('text-input')).toHaveLength(1);
|
|
15
16
|
});
|
|
16
17
|
});
|
|
@@ -3,11 +3,12 @@ import {
|
|
|
3
3
|
TextInputProps as NativeTextInputProps,
|
|
4
4
|
StyleProp,
|
|
5
5
|
ViewStyle,
|
|
6
|
+
TextStyle,
|
|
6
7
|
} from 'react-native';
|
|
7
|
-
import { Container, Label,
|
|
8
|
-
import { IconName } from '../Icon';
|
|
8
|
+
import { Container, Label, StyledTextInput } from './StyledTextInput';
|
|
9
|
+
import Icon, { IconName } from '../Icon';
|
|
9
10
|
|
|
10
|
-
interface TextInputProps extends NativeTextInputProps {
|
|
11
|
+
export interface TextInputProps extends NativeTextInputProps {
|
|
11
12
|
/**
|
|
12
13
|
* Field label.
|
|
13
14
|
*/
|
|
@@ -17,15 +18,23 @@ interface TextInputProps extends NativeTextInputProps {
|
|
|
17
18
|
*/
|
|
18
19
|
prefix?: IconName;
|
|
19
20
|
/**
|
|
20
|
-
*
|
|
21
|
+
* Name of Icon to render on the right side of the input.
|
|
22
|
+
*/
|
|
23
|
+
suffix?: IconName;
|
|
24
|
+
/**
|
|
25
|
+
* Additional wrapper style.
|
|
21
26
|
*/
|
|
22
27
|
style?: StyleProp<ViewStyle>;
|
|
28
|
+
/**
|
|
29
|
+
* Input text style.
|
|
30
|
+
*/
|
|
31
|
+
textStyle?: StyleProp<TextStyle>;
|
|
23
32
|
/**
|
|
24
33
|
* Testing id of the component.
|
|
25
34
|
*/
|
|
26
35
|
testID?: string;
|
|
27
36
|
/**
|
|
28
|
-
* Accessibility
|
|
37
|
+
* Accessibility label for the input (Android).
|
|
29
38
|
*/
|
|
30
39
|
accessibilityLabelledBy?: string;
|
|
31
40
|
}
|
|
@@ -33,7 +42,9 @@ interface TextInputProps extends NativeTextInputProps {
|
|
|
33
42
|
const TextInput = ({
|
|
34
43
|
label,
|
|
35
44
|
prefix,
|
|
45
|
+
suffix,
|
|
36
46
|
style,
|
|
47
|
+
textStyle,
|
|
37
48
|
testID,
|
|
38
49
|
accessibilityLabelledBy,
|
|
39
50
|
...nativeProps
|
|
@@ -48,13 +59,15 @@ const TextInput = ({
|
|
|
48
59
|
{label}
|
|
49
60
|
</Label>
|
|
50
61
|
)}
|
|
51
|
-
{prefix && <
|
|
62
|
+
{prefix && <Icon testID="input-prefix" icon={prefix} size="xsmall" />}
|
|
52
63
|
<StyledTextInput
|
|
64
|
+
style={textStyle}
|
|
53
65
|
testID="text-input"
|
|
54
66
|
// @ts-ignore
|
|
55
67
|
accessibilityLabelledBy={accessibilityLabelledBy}
|
|
56
68
|
{...nativeProps}
|
|
57
69
|
/>
|
|
70
|
+
{suffix && <Icon testID="input-suffix" icon={suffix} size="xsmall" />}
|
|
58
71
|
</Container>
|
|
59
72
|
);
|
|
60
73
|
|
package/src/index.ts
CHANGED
|
@@ -19,6 +19,8 @@ import Progress from './components/Progress';
|
|
|
19
19
|
import Spinner from './components/Spinner';
|
|
20
20
|
import Radio from './components/Radio';
|
|
21
21
|
import SectionHeading from './components/SectionHeading';
|
|
22
|
+
import Select from './components/Select';
|
|
23
|
+
import Switch from './components/Switch';
|
|
22
24
|
import Tabs from './components/Tabs';
|
|
23
25
|
import Tag from './components/Tag';
|
|
24
26
|
import TextInput from './components/TextInput';
|
|
@@ -47,6 +49,8 @@ export {
|
|
|
47
49
|
Spinner,
|
|
48
50
|
Radio,
|
|
49
51
|
SectionHeading,
|
|
52
|
+
Select,
|
|
53
|
+
Switch,
|
|
50
54
|
Tabs,
|
|
51
55
|
Tag,
|
|
52
56
|
TextInput,
|
|
@@ -320,6 +320,32 @@ Object {
|
|
|
320
320
|
"wrapperPadding": 16,
|
|
321
321
|
},
|
|
322
322
|
},
|
|
323
|
+
"sectionHeading": Object {
|
|
324
|
+
"colors": Object {
|
|
325
|
+
"background": "#dadbde",
|
|
326
|
+
},
|
|
327
|
+
"space": Object {
|
|
328
|
+
"headingHorizontalPadding": 16,
|
|
329
|
+
"headingMarginBottom": 16,
|
|
330
|
+
"headingVerticalPadding": 8,
|
|
331
|
+
"iconMarginRight": 8,
|
|
332
|
+
},
|
|
333
|
+
},
|
|
334
|
+
"select": Object {
|
|
335
|
+
"colors": Object {
|
|
336
|
+
"checkedOption": "#f1e9fb",
|
|
337
|
+
"footerText": "#7622d7",
|
|
338
|
+
"option": "#ffffff",
|
|
339
|
+
},
|
|
340
|
+
"radii": Object {
|
|
341
|
+
"option": 4,
|
|
342
|
+
},
|
|
343
|
+
"space": Object {
|
|
344
|
+
"optionListPadding": 16,
|
|
345
|
+
"optionListSpacing": 4,
|
|
346
|
+
"optionPadding": 16,
|
|
347
|
+
},
|
|
348
|
+
},
|
|
323
349
|
"spinner": Object {
|
|
324
350
|
"color": Object {
|
|
325
351
|
"default": "#7622d7",
|
|
@@ -333,6 +359,36 @@ Object {
|
|
|
333
359
|
"spinnerTextPaddingTop": 8,
|
|
334
360
|
},
|
|
335
361
|
},
|
|
362
|
+
"switch": Object {
|
|
363
|
+
"borderWidths": Object {
|
|
364
|
+
"default": 1,
|
|
365
|
+
},
|
|
366
|
+
"colors": Object {
|
|
367
|
+
"active": "#7622d7",
|
|
368
|
+
"inactive": "#727478",
|
|
369
|
+
"thumb": "#ffffff",
|
|
370
|
+
},
|
|
371
|
+
"heights": Object {
|
|
372
|
+
"medium": 28.799999999999997,
|
|
373
|
+
"small": 24,
|
|
374
|
+
},
|
|
375
|
+
"radii": Object {
|
|
376
|
+
"rounded": 999,
|
|
377
|
+
},
|
|
378
|
+
"spaces": Object {
|
|
379
|
+
"inactive": 0,
|
|
380
|
+
"medium": 4,
|
|
381
|
+
"small": 4,
|
|
382
|
+
},
|
|
383
|
+
"thumbSizes": Object {
|
|
384
|
+
"medium": 20.8,
|
|
385
|
+
"small": 16,
|
|
386
|
+
},
|
|
387
|
+
"widths": Object {
|
|
388
|
+
"medium": 56,
|
|
389
|
+
"small": 48,
|
|
390
|
+
},
|
|
391
|
+
},
|
|
336
392
|
"tabs": Object {
|
|
337
393
|
"borderWidths": Object {
|
|
338
394
|
"headerBottom": 1,
|
|
@@ -402,10 +458,10 @@ Object {
|
|
|
402
458
|
},
|
|
403
459
|
"space": Object {
|
|
404
460
|
"containerPadding": 16,
|
|
461
|
+
"inputHorizontalMargin": 8,
|
|
405
462
|
"labelHorizontalPadding": 4,
|
|
406
463
|
"labelLeft": 16,
|
|
407
464
|
"labelTop": -10,
|
|
408
|
-
"prefixMarginRight": 8,
|
|
409
465
|
},
|
|
410
466
|
},
|
|
411
467
|
"typography": Object {
|
|
@@ -447,6 +503,7 @@ Object {
|
|
|
447
503
|
"dangerLight": "#f2ae9d",
|
|
448
504
|
"disabledLightText": "#ccced1",
|
|
449
505
|
"disabledText": "#8b8d92",
|
|
506
|
+
"inactiveBackground": "#727478",
|
|
450
507
|
"info": "#4568fb",
|
|
451
508
|
"infoBackground": "#ecf0ff",
|
|
452
509
|
"infoLight": "#d1d9fe",
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { GlobalTheme } from '../global';
|
|
2
|
+
|
|
3
|
+
const getSectionHeadingTheme = (theme: GlobalTheme) => {
|
|
4
|
+
const colors = {
|
|
5
|
+
background: theme.colors.outline,
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const space = {
|
|
9
|
+
headingVerticalPadding: theme.space.small,
|
|
10
|
+
headingHorizontalPadding: theme.space.medium,
|
|
11
|
+
headingMarginBottom: theme.space.medium,
|
|
12
|
+
iconMarginRight: theme.space.small,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return { colors, space };
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default getSectionHeadingTheme;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { GlobalTheme } from '../global';
|
|
2
|
+
|
|
3
|
+
const getSelectTheme = (theme: GlobalTheme) => {
|
|
4
|
+
const colors = {
|
|
5
|
+
option: theme.colors.platformBackground,
|
|
6
|
+
checkedOption: theme.colors.primaryBackground,
|
|
7
|
+
footerText: theme.colors.primary,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const space = {
|
|
11
|
+
optionPadding: theme.space.medium,
|
|
12
|
+
optionListPadding: theme.space.medium, // left padding should be 12 according to the design
|
|
13
|
+
optionListSpacing: theme.space.xsmall,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const radii = {
|
|
17
|
+
option: theme.radii.base,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
return { space, colors, radii };
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default getSelectTheme;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { GlobalTheme } from '../global';
|
|
2
|
+
|
|
3
|
+
const getSwitchTheme = (theme: GlobalTheme) => {
|
|
4
|
+
const colors = {
|
|
5
|
+
thumb: theme.colors.platformBackground,
|
|
6
|
+
active: theme.colors.primary,
|
|
7
|
+
inactive: theme.colors.inactiveBackground,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const thumbSizes = {
|
|
11
|
+
small: theme.space.medium,
|
|
12
|
+
medium: theme.space.medium * 1.3,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const widths = {
|
|
16
|
+
small: theme.space.xxxlarge,
|
|
17
|
+
medium: theme.space.xxxxlarge,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const heights = {
|
|
21
|
+
small: theme.space.large,
|
|
22
|
+
medium: theme.space.large * 1.2,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const spaces = {
|
|
26
|
+
small: theme.space.xsmall,
|
|
27
|
+
medium: theme.space.xsmall,
|
|
28
|
+
inactive: 0,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const radii = {
|
|
32
|
+
rounded: theme.radii.rounded,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const borderWidths = {
|
|
36
|
+
default: theme.borderWidths.base,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
colors,
|
|
41
|
+
thumbSizes,
|
|
42
|
+
widths,
|
|
43
|
+
heights,
|
|
44
|
+
spaces,
|
|
45
|
+
radii,
|
|
46
|
+
borderWidths,
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export default getSwitchTheme;
|
|
@@ -11,7 +11,7 @@ const getTextInputTheme = (theme: GlobalTheme) => {
|
|
|
11
11
|
labelLeft: theme.space.medium,
|
|
12
12
|
labelTop: theme.lineHeights.small / -2,
|
|
13
13
|
labelHorizontalPadding: theme.space.xsmall,
|
|
14
|
-
|
|
14
|
+
inputHorizontalMargin: theme.space.small,
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
const fontSizes = {
|
package/src/theme/index.ts
CHANGED
|
@@ -20,8 +20,11 @@ import getDrawerTheme from './components/drawer';
|
|
|
20
20
|
import getFABTheme from './components/fab';
|
|
21
21
|
import getIconTheme from './components/icon';
|
|
22
22
|
import getProgressTheme from './components/progress';
|
|
23
|
-
import getSpinnerTheme from './components/spinner';
|
|
24
23
|
import getRadioTheme from './components/radio';
|
|
24
|
+
import getSectionHeadingTheme from './components/sectionHeading';
|
|
25
|
+
import getSelectTheme from './components/select';
|
|
26
|
+
import getSpinnerTheme from './components/spinner';
|
|
27
|
+
import getSwitchTheme from './components/switch';
|
|
25
28
|
import getTabsTheme from './components/tabs';
|
|
26
29
|
import getTagTheme from './components/tag';
|
|
27
30
|
import getTextInputTheme from './components/textInput';
|
|
@@ -42,8 +45,11 @@ type Theme = GlobalTheme & {
|
|
|
42
45
|
fab: ReturnType<typeof getFABTheme>;
|
|
43
46
|
icon: ReturnType<typeof getIconTheme>;
|
|
44
47
|
progress: ReturnType<typeof getProgressTheme>;
|
|
45
|
-
spinner: ReturnType<typeof getSpinnerTheme>;
|
|
46
48
|
radio: ReturnType<typeof getRadioTheme>;
|
|
49
|
+
sectionHeading: ReturnType<typeof getSectionHeadingTheme>;
|
|
50
|
+
select: ReturnType<typeof getSelectTheme>;
|
|
51
|
+
spinner: ReturnType<typeof getSpinnerTheme>;
|
|
52
|
+
switch: ReturnType<typeof getSwitchTheme>;
|
|
47
53
|
tabs: ReturnType<typeof getTabsTheme>;
|
|
48
54
|
tag: ReturnType<typeof getTagTheme>;
|
|
49
55
|
textInput: ReturnType<typeof getTextInputTheme>;
|
|
@@ -71,9 +77,12 @@ const getTheme = (
|
|
|
71
77
|
drawer: getDrawerTheme(globalTheme),
|
|
72
78
|
fab: getFABTheme(globalTheme),
|
|
73
79
|
icon: getIconTheme(globalTheme),
|
|
74
|
-
spinner: getSpinnerTheme(globalTheme),
|
|
75
80
|
progress: getProgressTheme(globalTheme),
|
|
76
81
|
radio: getRadioTheme(globalTheme),
|
|
82
|
+
sectionHeading: getSectionHeadingTheme(globalTheme),
|
|
83
|
+
select: getSelectTheme(globalTheme),
|
|
84
|
+
spinner: getSpinnerTheme(globalTheme),
|
|
85
|
+
switch: getSwitchTheme(globalTheme),
|
|
77
86
|
tabs: getTabsTheme(globalTheme),
|
|
78
87
|
tag: getTagTheme(globalTheme),
|
|
79
88
|
textInput: getTextInputTheme(globalTheme),
|
|
@@ -26,6 +26,10 @@ interface BottomSheetProps {
|
|
|
26
26
|
* is being dismiss by interacting outside of the bottom sheet.
|
|
27
27
|
*/
|
|
28
28
|
onRequestClose?: () => void;
|
|
29
|
+
/**
|
|
30
|
+
* Callback that is called once the bottom sheet has been dismissed.
|
|
31
|
+
*/
|
|
32
|
+
onDismiss?: () => void;
|
|
29
33
|
/**
|
|
30
34
|
* Displays an X button on bottom sheet header that will invoke onRequestClose callback on press.
|
|
31
35
|
*/
|
|
@@ -47,5 +51,5 @@ interface BottomSheetProps {
|
|
|
47
51
|
*/
|
|
48
52
|
testID?: string;
|
|
49
53
|
}
|
|
50
|
-
declare const BottomSheet: ({ open, header, footer, children, onOpen, onRequestClose, showCloseButton, hasBackdrop, showDivider, style, testID, }: BottomSheetProps) => JSX.Element;
|
|
54
|
+
declare const BottomSheet: ({ open, header, footer, children, onOpen, onRequestClose, onDismiss, showCloseButton, hasBackdrop, showDivider, style, testID, }: BottomSheetProps) => JSX.Element;
|
|
51
55
|
export default BottomSheet;
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
-
|
|
3
|
+
import { OptionType } from './types';
|
|
4
|
+
export interface RadioGroupProps<T> {
|
|
4
5
|
/**
|
|
5
6
|
* An array of radio options to be selected.
|
|
6
7
|
*/
|
|
7
|
-
options:
|
|
8
|
-
text: string;
|
|
9
|
-
value: string;
|
|
10
|
-
}[];
|
|
8
|
+
options: OptionType<T>[];
|
|
11
9
|
/**
|
|
12
10
|
* Radio input value.
|
|
13
11
|
*/
|
|
14
|
-
value:
|
|
12
|
+
value: T;
|
|
15
13
|
/**
|
|
16
14
|
* Press event handler receiving selected radio's value.
|
|
17
15
|
*/
|
|
18
|
-
onPress: (value:
|
|
16
|
+
onPress: (value: T) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Used to extract a unique key for a given option at the specified index. Key is used for caching and as the react key to track item re-ordering.
|
|
19
|
+
* The default extractor checks option.key, and then falls back to using the index, like React does.
|
|
20
|
+
*/
|
|
21
|
+
keyExtractor?: (option: OptionType<T>, index?: number) => string;
|
|
19
22
|
/**
|
|
20
23
|
* Additional style.
|
|
21
24
|
*/
|
|
@@ -25,5 +28,5 @@ export interface RadioGroupProps {
|
|
|
25
28
|
*/
|
|
26
29
|
testID?: string;
|
|
27
30
|
}
|
|
28
|
-
declare const RadioGroup: ({ value, onPress, options, style, testID, }: RadioGroupProps) => ReactElement;
|
|
31
|
+
declare const RadioGroup: <T>({ value, onPress, options, keyExtractor, style, testID, }: RadioGroupProps<T>) => ReactElement;
|
|
29
32
|
export default RadioGroup;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
declare const CompoundRadio: {
|
|
2
|
-
readonly Group: ({ value, onPress, options, style, testID, }: import("./RadioGroup").RadioGroupProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
2
|
+
readonly Group: <T>({ value, onPress, options, keyExtractor, style, testID, }: import("./RadioGroup").RadioGroupProps<T>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
3
3
|
};
|
|
4
4
|
export default CompoundRadio;
|
package/types/components/SectionHeading/__tests__/{StyledHeading.d.ts → StyledHeading.spec.d.ts}
RENAMED
|
File without changes
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { View, TouchableOpacity } from 'react-native';
|
|
2
|
+
declare const OptionWrapper: import("@emotion/native").StyledComponent<import("react-native").TouchableOpacityProps & {
|
|
3
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
4
|
+
as?: import("react").ElementType<any> | undefined;
|
|
5
|
+
} & {
|
|
6
|
+
themeSelected: boolean;
|
|
7
|
+
}, {}, {
|
|
8
|
+
ref?: import("react").Ref<TouchableOpacity> | undefined;
|
|
9
|
+
}>;
|
|
10
|
+
declare const OptionListWrapper: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
|
|
11
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
12
|
+
as?: import("react").ElementType<any> | undefined;
|
|
13
|
+
}, {}, {
|
|
14
|
+
ref?: import("react").Ref<View> | undefined;
|
|
15
|
+
}>;
|
|
16
|
+
declare const Spacer: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
|
|
17
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
18
|
+
as?: import("react").ElementType<any> | undefined;
|
|
19
|
+
}, {}, {
|
|
20
|
+
ref?: import("react").Ref<View> | undefined;
|
|
21
|
+
}>;
|
|
22
|
+
declare const FooterText: import("@emotion/native").StyledComponent<import("../../Typography/Text").TextProps & {
|
|
23
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
24
|
+
as?: import("react").ElementType<any> | undefined;
|
|
25
|
+
}, {}, {}>;
|
|
26
|
+
export { OptionWrapper, OptionListWrapper, Spacer, FooterText };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
import { OptionType } from './types';
|
|
3
|
+
export interface MultiSelectProps<T> {
|
|
4
|
+
/**
|
|
5
|
+
* An array of options to be selected.
|
|
6
|
+
*/
|
|
7
|
+
options: OptionType<T>[];
|
|
8
|
+
/**
|
|
9
|
+
* Current selected value.
|
|
10
|
+
*/
|
|
11
|
+
value: T[];
|
|
12
|
+
/**
|
|
13
|
+
* onPress event handler.
|
|
14
|
+
*/
|
|
15
|
+
onPress: (value: T[]) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Field label.
|
|
18
|
+
*/
|
|
19
|
+
label: string;
|
|
20
|
+
/**
|
|
21
|
+
* Footer label.
|
|
22
|
+
*/
|
|
23
|
+
footerLabel: string;
|
|
24
|
+
/**
|
|
25
|
+
* Used to extract a unique key for a given option at the specified index. Key is used for caching and as the react key to track item re-ordering.
|
|
26
|
+
* The default extractor checks option.key, and then falls back to using the index, like React does.
|
|
27
|
+
*/
|
|
28
|
+
keyExtractor?: (option: OptionType<T>, index?: number) => string;
|
|
29
|
+
/**
|
|
30
|
+
* Additional style.
|
|
31
|
+
*/
|
|
32
|
+
style?: StyleProp<ViewStyle>;
|
|
33
|
+
/**
|
|
34
|
+
* Testing id of the component.
|
|
35
|
+
*/
|
|
36
|
+
testID?: string;
|
|
37
|
+
}
|
|
38
|
+
declare function MultiSelect<T>({ options, value, testID, style, label, footerLabel, onPress, }: MultiSelectProps<T>): JSX.Element;
|
|
39
|
+
export default MultiSelect;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Animated, View } from 'react-native';
|
|
2
|
+
declare type ThemeSize = 'small' | 'medium';
|
|
3
|
+
declare const StyledWrapper: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
|
|
4
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
5
|
+
as?: import("react").ElementType<any> | undefined;
|
|
6
|
+
} & {
|
|
7
|
+
themeChecked: boolean | undefined;
|
|
8
|
+
themeSize: ThemeSize;
|
|
9
|
+
}, {}, {
|
|
10
|
+
ref?: import("react").Ref<View> | undefined;
|
|
11
|
+
}>;
|
|
12
|
+
declare const StyledDisabledWrapper: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
|
|
13
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
14
|
+
as?: import("react").ElementType<any> | undefined;
|
|
15
|
+
} & {
|
|
16
|
+
themeSize: ThemeSize;
|
|
17
|
+
}, {}, {
|
|
18
|
+
ref?: import("react").Ref<View> | undefined;
|
|
19
|
+
}>;
|
|
20
|
+
declare const StyledThumbWrapper: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
|
|
21
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
22
|
+
as?: import("react").ElementType<any> | undefined;
|
|
23
|
+
} & {
|
|
24
|
+
themeSize: ThemeSize;
|
|
25
|
+
}, {}, {
|
|
26
|
+
ref?: import("react").Ref<View> | undefined;
|
|
27
|
+
}>;
|
|
28
|
+
declare const StyledKnot: import("@emotion/native").StyledComponent<Animated.AnimatedProps<import("react-native").ViewProps & import("react").RefAttributes<View>> & {
|
|
29
|
+
children?: import("react").ReactNode;
|
|
30
|
+
} & {
|
|
31
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
32
|
+
as?: import("react").ElementType<any> | undefined;
|
|
33
|
+
} & {
|
|
34
|
+
themeSize: ThemeSize;
|
|
35
|
+
}, {}, {}>;
|
|
36
|
+
export { StyledWrapper, StyledDisabledWrapper, StyledThumbWrapper, StyledKnot };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
export interface SwitchProps {
|
|
4
|
+
/**
|
|
5
|
+
* Control whether the switch is checked
|
|
6
|
+
*/
|
|
7
|
+
checked?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Whether the switch is disabled
|
|
10
|
+
*/
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Event handler.
|
|
14
|
+
*/
|
|
15
|
+
onPress?: () => void;
|
|
16
|
+
/**
|
|
17
|
+
* Size of the switch
|
|
18
|
+
*/
|
|
19
|
+
size?: 'small' | 'medium';
|
|
20
|
+
/**
|
|
21
|
+
* Addditional style.
|
|
22
|
+
*/
|
|
23
|
+
style?: StyleProp<ViewStyle>;
|
|
24
|
+
/**
|
|
25
|
+
* Testing id of the component.
|
|
26
|
+
*/
|
|
27
|
+
testID?: string;
|
|
28
|
+
}
|
|
29
|
+
declare const Switch: ({ size, disabled, checked, onPress, style, testID, }: SwitchProps) => ReactElement;
|
|
30
|
+
export default Switch;
|
|
@@ -9,14 +9,10 @@ declare const Label: import("@emotion/native").StyledComponent<import("../Typogr
|
|
|
9
9
|
theme?: import("@emotion/react").Theme | undefined;
|
|
10
10
|
as?: import("react").ElementType<any> | undefined;
|
|
11
11
|
}, {}, {}>;
|
|
12
|
-
declare const Prefix: import("@emotion/native").StyledComponent<import("../Icon").IconProps & {
|
|
13
|
-
theme?: import("@emotion/react").Theme | undefined;
|
|
14
|
-
as?: import("react").ElementType<any> | undefined;
|
|
15
|
-
}, {}, {}>;
|
|
16
12
|
declare const StyledTextInput: import("@emotion/native").StyledComponent<import("react-native").TextInputProps & {
|
|
17
13
|
theme?: import("@emotion/react").Theme | undefined;
|
|
18
14
|
as?: import("react").ElementType<any> | undefined;
|
|
19
15
|
}, {}, {
|
|
20
16
|
ref?: import("react").Ref<TextInput> | undefined;
|
|
21
17
|
}>;
|
|
22
|
-
export { Container, Label,
|
|
18
|
+
export { Container, Label, StyledTextInput };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { TextInputProps as NativeTextInputProps, StyleProp, ViewStyle } from 'react-native';
|
|
1
|
+
import { TextInputProps as NativeTextInputProps, StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
2
2
|
import { IconName } from '../Icon';
|
|
3
|
-
interface TextInputProps extends NativeTextInputProps {
|
|
3
|
+
export interface TextInputProps extends NativeTextInputProps {
|
|
4
4
|
/**
|
|
5
5
|
* Field label.
|
|
6
6
|
*/
|
|
@@ -10,17 +10,25 @@ interface TextInputProps extends NativeTextInputProps {
|
|
|
10
10
|
*/
|
|
11
11
|
prefix?: IconName;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Name of Icon to render on the right side of the input.
|
|
14
|
+
*/
|
|
15
|
+
suffix?: IconName;
|
|
16
|
+
/**
|
|
17
|
+
* Additional wrapper style.
|
|
14
18
|
*/
|
|
15
19
|
style?: StyleProp<ViewStyle>;
|
|
20
|
+
/**
|
|
21
|
+
* Input text style.
|
|
22
|
+
*/
|
|
23
|
+
textStyle?: StyleProp<TextStyle>;
|
|
16
24
|
/**
|
|
17
25
|
* Testing id of the component.
|
|
18
26
|
*/
|
|
19
27
|
testID?: string;
|
|
20
28
|
/**
|
|
21
|
-
* Accessibility
|
|
29
|
+
* Accessibility label for the input (Android).
|
|
22
30
|
*/
|
|
23
31
|
accessibilityLabelledBy?: string;
|
|
24
32
|
}
|
|
25
|
-
declare const TextInput: ({ label, prefix, style, testID, accessibilityLabelledBy, ...nativeProps }: TextInputProps) => JSX.Element;
|
|
33
|
+
declare const TextInput: ({ label, prefix, suffix, style, textStyle, testID, accessibilityLabelledBy, ...nativeProps }: TextInputProps) => JSX.Element;
|
|
26
34
|
export default TextInput;
|
package/types/index.d.ts
CHANGED
|
@@ -18,9 +18,11 @@ import Progress from './components/Progress';
|
|
|
18
18
|
import Spinner from './components/Spinner';
|
|
19
19
|
import Radio from './components/Radio';
|
|
20
20
|
import SectionHeading from './components/SectionHeading';
|
|
21
|
+
import Select from './components/Select';
|
|
22
|
+
import Switch from './components/Switch';
|
|
21
23
|
import Tabs from './components/Tabs';
|
|
22
24
|
import Tag from './components/Tag';
|
|
23
25
|
import TextInput from './components/TextInput';
|
|
24
26
|
import Typography from './components/Typography';
|
|
25
|
-
export { theme, getTheme, useTheme, scale, ThemeProvider, Alert, Avatar, Badge, BottomNavigation, BottomSheet, Button, Card, Collapse, ContentNavigator, Divider, Drawer, FAB, Icon, Progress, Spinner, Radio, SectionHeading, Tabs, Tag, TextInput, Typography, };
|
|
27
|
+
export { theme, getTheme, useTheme, scale, ThemeProvider, Alert, Avatar, Badge, BottomNavigation, BottomSheet, Button, Card, Collapse, ContentNavigator, Divider, Drawer, FAB, Icon, Progress, Spinner, Radio, SectionHeading, Select, Switch, Tabs, Tag, TextInput, Typography, };
|
|
26
28
|
export * from './types';
|