@hero-design/rn 8.98.0 → 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.
Files changed (53) hide show
  1. package/.turbo/turbo-build.log +3 -3
  2. package/CHANGELOG.md +12 -0
  3. package/babel.config.js +4 -1
  4. package/es/index.js +50 -69
  5. package/lib/index.js +50 -69
  6. package/package.json +39 -19
  7. package/src/components/AnimatedScroller/__tests__/__snapshots__/ScrollablesWithFAB.spec.tsx.snap +0 -3
  8. package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/index.spec.tsx.snap +52 -52
  9. package/src/components/Button/__tests__/__snapshots__/Button.spec.tsx.snap +87 -87
  10. package/src/components/ContentNavigator/__tests__/__snapshots__/index.spec.tsx.snap +2 -2
  11. package/src/components/FAB/ActionGroup/__tests__/__snapshots__/index.spec.tsx.snap +2 -4
  12. package/src/components/FAB/__tests__/__snapshots__/AnimatedFABIcon.spec.tsx.snap +2 -2
  13. package/src/components/FAB/__tests__/__snapshots__/index.spec.tsx.snap +1 -1
  14. package/src/components/Radio/Radio.tsx +7 -1
  15. package/src/components/Radio/RadioGroup.tsx +1 -0
  16. package/src/components/Radio/__tests__/Radio.spec.tsx +15 -0
  17. package/src/components/Radio/__tests__/RadioGroup.spec.tsx +27 -0
  18. package/src/components/Radio/types.ts +3 -1
  19. package/src/components/Select/MultiSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +1472 -1496
  20. package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +2992 -3040
  21. package/src/components/Select/SingleSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +1644 -1672
  22. package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +2512 -2554
  23. package/src/components/Spinner/__tests__/__snapshots__/AnimatedSpinner.spec.tsx.snap +6 -6
  24. package/src/components/Spinner/__tests__/__snapshots__/StyledSpinner.spec.tsx.snap +24 -24
  25. package/src/components/Spinner/__tests__/__snapshots__/index.spec.tsx.snap +6 -6
  26. package/src/components/Tabs/ScrollableTabs.tsx +0 -1
  27. package/src/components/Tabs/StyledScrollableTabs.tsx +8 -2
  28. package/src/components/Tabs/index.tsx +0 -1
  29. package/src/components/Toolbar/__tests__/__snapshots__/ToolbarItem.spec.tsx.snap +2 -2
  30. package/stats/8.98.1/rn-stats.html +4844 -0
  31. package/stats/8.99.0/rn-stats.html +4842 -0
  32. package/testUtils/setup.tsx +0 -1
  33. package/types/components/Accordion/StyledAccordion.d.ts +3 -5
  34. package/types/components/Alert/StyledAlert.d.ts +3 -5
  35. package/types/components/Attachment/StyledAttachment.d.ts +3 -5
  36. package/types/components/Avatar/StyledAvatar.d.ts +3 -5
  37. package/types/components/BottomSheet/StyledBottomSheet.d.ts +3 -5
  38. package/types/components/Button/StyledButton.d.ts +3 -5
  39. package/types/components/Button/UtilityButton/StyledUtilityButton.d.ts +3 -5
  40. package/types/components/Calendar/StyledCalendar.d.ts +3 -5
  41. package/types/components/Checkbox/StyledCheckbox.d.ts +3 -5
  42. package/types/components/Chip/StyledChip.d.ts +2 -5
  43. package/types/components/FAB/ActionGroup/StyledActionItem.d.ts +2 -5
  44. package/types/components/FAB/StyledFAB.d.ts +2 -2
  45. package/types/components/FloatingIsland/StyledFloatingIsland.d.ts +2 -2
  46. package/types/components/List/StyledBasicListItem.d.ts +3 -5
  47. package/types/components/List/StyledListItem.d.ts +3 -5
  48. package/types/components/Radio/Radio.d.ts +6 -1
  49. package/types/components/Radio/types.d.ts +3 -1
  50. package/types/components/RichTextEditor/StyledToolbar.d.ts +3 -5
  51. package/types/components/Swipeable/StyledSwipeable.d.ts +2 -5
  52. package/types/components/Toast/StyledToast.d.ts +3 -5
  53. 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={true}
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={true}
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
  }
@@ -256,7 +256,7 @@ exports[`FAB when animated is true renders animatedFABIcon 1`] = `
256
256
  "textAlign": "center",
257
257
  "textAlignVertical": "center",
258
258
  },
259
- {},
259
+ undefined,
260
260
  ],
261
261
  ]
262
262
  }
@@ -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}
@@ -74,6 +74,7 @@ const RadioGroup = <T,>({
74
74
  checked={option.value === value}
75
75
  onPress={() => onPress(option.value)}
76
76
  inactiveIntent={inactiveIntent}
77
+ prefix={option.prefix}
77
78
  >
78
79
  {option.children}
79
80
  </Radio>
@@ -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
  };