@hero-design/rn 8.98.1 → 8.99.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +3 -3
- package/CHANGELOG.md +6 -0
- package/babel.config.js +4 -1
- package/es/index.js +45 -66
- package/lib/index.js +45 -66
- package/package.json +39 -19
- package/src/components/AnimatedScroller/__tests__/__snapshots__/ScrollablesWithFAB.spec.tsx.snap +0 -3
- package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/index.spec.tsx.snap +52 -52
- package/src/components/Button/__tests__/__snapshots__/Button.spec.tsx.snap +87 -87
- package/src/components/ContentNavigator/__tests__/__snapshots__/index.spec.tsx.snap +2 -2
- package/src/components/FAB/ActionGroup/__tests__/__snapshots__/index.spec.tsx.snap +2 -4
- package/src/components/FAB/__tests__/__snapshots__/AnimatedFABIcon.spec.tsx.snap +2 -2
- package/src/components/FAB/__tests__/__snapshots__/index.spec.tsx.snap +1 -1
- package/src/components/Radio/Radio.tsx +7 -1
- package/src/components/Radio/RadioGroup.tsx +1 -0
- package/src/components/Radio/__tests__/Radio.spec.tsx +15 -0
- package/src/components/Radio/__tests__/RadioGroup.spec.tsx +27 -0
- package/src/components/Radio/types.ts +3 -1
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +1472 -1496
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +2992 -3040
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +1644 -1672
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +2512 -2554
- package/src/components/Spinner/__tests__/__snapshots__/AnimatedSpinner.spec.tsx.snap +6 -6
- package/src/components/Spinner/__tests__/__snapshots__/StyledSpinner.spec.tsx.snap +24 -24
- package/src/components/Spinner/__tests__/__snapshots__/index.spec.tsx.snap +6 -6
- package/src/components/Tabs/ScrollableTabs.tsx +0 -1
- package/src/components/Tabs/index.tsx +0 -1
- package/src/components/Toolbar/__tests__/__snapshots__/ToolbarItem.spec.tsx.snap +2 -2
- package/stats/8.98.1/rn-stats.html +3 -1
- package/stats/8.99.0/rn-stats.html +4842 -0
- package/testUtils/setup.tsx +0 -1
- package/types/components/Accordion/StyledAccordion.d.ts +3 -5
- package/types/components/Alert/StyledAlert.d.ts +3 -5
- package/types/components/Attachment/StyledAttachment.d.ts +3 -5
- package/types/components/Avatar/StyledAvatar.d.ts +3 -5
- package/types/components/BottomSheet/StyledBottomSheet.d.ts +3 -5
- package/types/components/Button/StyledButton.d.ts +3 -5
- package/types/components/Button/UtilityButton/StyledUtilityButton.d.ts +3 -5
- package/types/components/Calendar/StyledCalendar.d.ts +3 -5
- package/types/components/Checkbox/StyledCheckbox.d.ts +3 -5
- package/types/components/Chip/StyledChip.d.ts +2 -5
- package/types/components/FAB/ActionGroup/StyledActionItem.d.ts +2 -5
- package/types/components/FAB/StyledFAB.d.ts +2 -2
- package/types/components/FloatingIsland/StyledFloatingIsland.d.ts +2 -2
- package/types/components/List/StyledBasicListItem.d.ts +3 -5
- package/types/components/List/StyledListItem.d.ts +3 -5
- package/types/components/Radio/Radio.d.ts +6 -1
- package/types/components/Radio/types.d.ts +3 -1
- package/types/components/RichTextEditor/StyledToolbar.d.ts +3 -5
- package/types/components/Swipeable/StyledSwipeable.d.ts +2 -5
- package/types/components/Toast/StyledToast.d.ts +3 -5
- package/types/components/Toolbar/StyledToolbar.d.ts +3 -5
|
@@ -207,7 +207,7 @@ exports[`rendering renders correctly when icon buttons are disabled 1`] = `
|
|
|
207
207
|
}
|
|
208
208
|
accessible={true}
|
|
209
209
|
collapsable={false}
|
|
210
|
-
focusable={
|
|
210
|
+
focusable={false}
|
|
211
211
|
onClick={[Function]}
|
|
212
212
|
onResponderGrant={[Function]}
|
|
213
213
|
onResponderMove={[Function]}
|
|
@@ -280,7 +280,7 @@ exports[`rendering renders correctly when icon buttons are disabled 1`] = `
|
|
|
280
280
|
}
|
|
281
281
|
accessible={true}
|
|
282
282
|
collapsable={false}
|
|
283
|
-
focusable={
|
|
283
|
+
focusable={false}
|
|
284
284
|
onClick={[Function]}
|
|
285
285
|
onResponderGrant={[Function]}
|
|
286
286
|
onResponderMove={[Function]}
|
|
@@ -27,7 +27,6 @@ exports[`ActionGroup has active false 1`] = `
|
|
|
27
27
|
>
|
|
28
28
|
<View
|
|
29
29
|
collapsable={false}
|
|
30
|
-
style={{}}
|
|
31
30
|
>
|
|
32
31
|
<View
|
|
33
32
|
accessibilityState={
|
|
@@ -220,7 +219,6 @@ exports[`ActionGroup has active true 1`] = `
|
|
|
220
219
|
>
|
|
221
220
|
<View
|
|
222
221
|
collapsable={false}
|
|
223
|
-
style={{}}
|
|
224
222
|
>
|
|
225
223
|
<View
|
|
226
224
|
accessibilityState={
|
|
@@ -334,7 +332,7 @@ exports[`ActionGroup has active true 1`] = `
|
|
|
334
332
|
"textAlign": "center",
|
|
335
333
|
"textAlignVertical": "center",
|
|
336
334
|
},
|
|
337
|
-
|
|
335
|
+
undefined,
|
|
338
336
|
],
|
|
339
337
|
]
|
|
340
338
|
}
|
|
@@ -1155,7 +1153,7 @@ exports[`ActionGroup has active true 1`] = `
|
|
|
1155
1153
|
"textAlign": "center",
|
|
1156
1154
|
"textAlignVertical": "center",
|
|
1157
1155
|
},
|
|
1158
|
-
|
|
1156
|
+
undefined,
|
|
1159
1157
|
],
|
|
1160
1158
|
]
|
|
1161
1159
|
}
|
|
@@ -35,7 +35,7 @@ exports[`AnimatedFABIcon renders correctly when isActive is false 1`] = `
|
|
|
35
35
|
"textAlign": "center",
|
|
36
36
|
"textAlignVertical": "center",
|
|
37
37
|
},
|
|
38
|
-
|
|
38
|
+
undefined,
|
|
39
39
|
],
|
|
40
40
|
]
|
|
41
41
|
}
|
|
@@ -101,7 +101,7 @@ exports[`AnimatedFABIcon renders correctly when isActive is true 1`] = `
|
|
|
101
101
|
"textAlign": "center",
|
|
102
102
|
"textAlignVertical": "center",
|
|
103
103
|
},
|
|
104
|
-
|
|
104
|
+
undefined,
|
|
105
105
|
],
|
|
106
106
|
]
|
|
107
107
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ReactElement, ReactNode } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { StyleProp, ViewStyle } from 'react-native';
|
|
4
|
-
|
|
4
|
+
import type { IconName } from '../Icon';
|
|
5
5
|
import { Circle, InnerCircle, StyledRadio } from './StyledRadio';
|
|
6
6
|
|
|
7
7
|
export interface RadioProps {
|
|
@@ -37,6 +37,10 @@ export interface RadioProps {
|
|
|
37
37
|
* Children to be rendered inside the component.
|
|
38
38
|
*/
|
|
39
39
|
children?: ReactNode;
|
|
40
|
+
/**
|
|
41
|
+
* Prefix to be rendered before the radio text.
|
|
42
|
+
*/
|
|
43
|
+
prefix?: IconName | ReactElement;
|
|
40
44
|
}
|
|
41
45
|
|
|
42
46
|
const RadioCircle = ({
|
|
@@ -57,12 +61,14 @@ const Radio = ({
|
|
|
57
61
|
testID,
|
|
58
62
|
inactiveIntent = 'light',
|
|
59
63
|
children,
|
|
64
|
+
prefix,
|
|
60
65
|
}: RadioProps): ReactElement => (
|
|
61
66
|
<StyledRadio
|
|
62
67
|
onPress={onPress}
|
|
63
68
|
selected={checked}
|
|
64
69
|
title={text}
|
|
65
70
|
subtitle={subText}
|
|
71
|
+
prefix={prefix}
|
|
66
72
|
suffix={<RadioCircle checked={checked} text={text} />}
|
|
67
73
|
style={style}
|
|
68
74
|
testID={testID}
|
|
@@ -2,6 +2,7 @@ import { fireEvent } from '@testing-library/react-native';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import renderWithTheme from '../../../testHelpers/renderWithTheme';
|
|
4
4
|
import Radio from '../Radio';
|
|
5
|
+
import { Typography } from '../../..';
|
|
5
6
|
|
|
6
7
|
describe('rendering', () => {
|
|
7
8
|
it.each`
|
|
@@ -56,6 +57,20 @@ describe('rendering', () => {
|
|
|
56
57
|
expect(getByText('Option A')).toBeDefined();
|
|
57
58
|
expect(getByText('Option label')).toBeDefined();
|
|
58
59
|
});
|
|
60
|
+
|
|
61
|
+
it('allows rendering of prefix', () => {
|
|
62
|
+
const { getByText, getByTestId } = renderWithTheme(
|
|
63
|
+
<Radio
|
|
64
|
+
text="Option A"
|
|
65
|
+
prefix={<Typography.Body testID="prefix">🏢</Typography.Body>}
|
|
66
|
+
onPress={jest.fn()}
|
|
67
|
+
checked
|
|
68
|
+
/>
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
expect(getByText('Option A')).toBeVisible();
|
|
72
|
+
expect(getByTestId('prefix')).toBeVisible();
|
|
73
|
+
});
|
|
59
74
|
});
|
|
60
75
|
|
|
61
76
|
describe('behavior', () => {
|
|
@@ -2,6 +2,7 @@ import { fireEvent } from '@testing-library/react-native';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import renderWithTheme from '../../../testHelpers/renderWithTheme';
|
|
4
4
|
import RadioGroup from '../RadioGroup';
|
|
5
|
+
import { Typography } from '../../..';
|
|
5
6
|
|
|
6
7
|
const options = [
|
|
7
8
|
{ text: 'Everything', value: 'everything' },
|
|
@@ -14,6 +15,19 @@ const optionsWithSubtext = [
|
|
|
14
15
|
{ text: 'Daily', subText: 'InstaPay Daily', value: 'daily' },
|
|
15
16
|
];
|
|
16
17
|
|
|
18
|
+
const optionsWithPrefix = [
|
|
19
|
+
{
|
|
20
|
+
text: 'In the office',
|
|
21
|
+
prefix: <Typography.Body testID="prefix-office">🏢</Typography.Body>,
|
|
22
|
+
value: 'in_the_office',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
text: 'At home',
|
|
26
|
+
prefix: <Typography.Body testID="prefix-home">🏠</Typography.Body>,
|
|
27
|
+
value: 'at_home',
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
|
|
17
31
|
describe('rendering', () => {
|
|
18
32
|
it.each`
|
|
19
33
|
inactiveIntent
|
|
@@ -54,6 +68,19 @@ describe('rendering', () => {
|
|
|
54
68
|
expect(getByText('Daily')).toBeDefined();
|
|
55
69
|
expect(getByText('InstaPay Daily')).toBeDefined();
|
|
56
70
|
});
|
|
71
|
+
|
|
72
|
+
it('renders correctly with prefix', () => {
|
|
73
|
+
const { getByTestId } = renderWithTheme(
|
|
74
|
+
<RadioGroup
|
|
75
|
+
options={optionsWithPrefix}
|
|
76
|
+
value="in_the_office"
|
|
77
|
+
onPress={jest.fn()}
|
|
78
|
+
/>
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
expect(getByTestId('prefix-office')).toBeVisible();
|
|
82
|
+
expect(getByTestId('prefix-home')).toBeVisible();
|
|
83
|
+
});
|
|
57
84
|
});
|
|
58
85
|
|
|
59
86
|
describe('behavior', () => {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { IconName } from '../Icon';
|
|
2
3
|
|
|
3
4
|
export type OptionType<T> = {
|
|
4
5
|
value: T;
|
|
@@ -6,4 +7,5 @@ export type OptionType<T> = {
|
|
|
6
7
|
subText?: string;
|
|
7
8
|
key?: string;
|
|
8
9
|
children?: ReactNode;
|
|
10
|
+
prefix?: IconName | ReactElement;
|
|
9
11
|
};
|