@hero-design/rn 8.63.2 → 8.64.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 (56) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/CHANGELOG.md +15 -0
  3. package/es/index.js +86 -38
  4. package/eslint.config.js +42 -0
  5. package/lib/index.js +86 -38
  6. package/package.json +9 -5
  7. package/rollup.config.js +13 -0
  8. package/sonar-project.properties +1 -1
  9. package/src/components/BottomSheet/__tests__/__snapshots__/index.spec.tsx.snap +5 -0
  10. package/src/components/BottomSheet/__tests__/index.spec.tsx +17 -0
  11. package/src/components/BottomSheet/index.tsx +6 -0
  12. package/src/components/Calendar/CalendarRowItem.tsx +3 -1
  13. package/src/components/Calendar/StyledCalendar.tsx +21 -8
  14. package/src/components/Calendar/__tests__/CalendarRowItem.spec.tsx +1 -0
  15. package/src/components/Calendar/__tests__/__snapshots__/CalendarRowItem.spec.tsx.snap +4 -2
  16. package/src/components/Calendar/__tests__/index.spec.tsx +7 -1
  17. package/src/components/Calendar/index.tsx +30 -8
  18. package/src/components/DatePicker/DatePickerCalendar.tsx +14 -10
  19. package/src/components/DatePicker/DatePickerIOS.tsx +2 -0
  20. package/src/components/DatePicker/__tests__/DatePickerCalendar.spec.tsx +37 -0
  21. package/src/components/DatePicker/__tests__/DatePickerIOS.spec.tsx +34 -0
  22. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +5 -0
  23. package/src/components/DatePicker/types.ts +4 -0
  24. package/src/components/FAB/ActionGroup/__tests__/__snapshots__/index.spec.tsx.snap +5 -0
  25. package/src/components/FAB/ActionGroup/__tests__/index.spec.tsx +45 -24
  26. package/src/components/FAB/ActionGroup/index.tsx +6 -0
  27. package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +20 -0
  28. package/src/components/Select/MultiSelect/__tests__/index.spec.tsx +28 -0
  29. package/src/components/Select/MultiSelect/index.tsx +6 -0
  30. package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +15 -0
  31. package/src/components/Select/SingleSelect/__tests__/index.spec.tsx +25 -0
  32. package/src/components/Select/SingleSelect/index.tsx +6 -0
  33. package/src/components/TimePicker/TimePickerIOS.tsx +2 -0
  34. package/src/components/TimePicker/__tests__/TimePickerIOS.spec.tsx +31 -0
  35. package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +5 -0
  36. package/src/components/TimePicker/types.ts +4 -0
  37. package/src/components/Toast/Toast.tsx +1 -0
  38. package/src/components/Toast/__tests__/__snapshots__/Toast.spec.tsx.snap +7 -0
  39. package/src/testHelpers/utils.ts +21 -0
  40. package/stats/8.63.3/rn-stats.html +4844 -0
  41. package/stats/8.64.0/rn-stats.html +4842 -0
  42. package/types/components/BottomSheet/index.d.ts +5 -1
  43. package/types/components/Calendar/CalendarRowItem.d.ts +2 -1
  44. package/types/components/Calendar/StyledCalendar.d.ts +7 -0
  45. package/types/components/DatePicker/DatePickerCalendar.d.ts +1 -1
  46. package/types/components/DatePicker/DatePickerIOS.d.ts +1 -1
  47. package/types/components/DatePicker/types.d.ts +4 -0
  48. package/types/components/FAB/ActionGroup/index.d.ts +4 -0
  49. package/types/components/Select/MultiSelect/index.d.ts +5 -1
  50. package/types/components/Select/SingleSelect/index.d.ts +5 -1
  51. package/types/components/Select/index.d.ts +1 -1
  52. package/types/components/TimePicker/TimePickerIOS.d.ts +1 -1
  53. package/types/components/TimePicker/types.d.ts +4 -0
  54. package/types/testHelpers/utils.d.ts +1 -0
  55. package/.eslintrc.js +0 -13
  56. package/src/theme/components/.eslintrc.json +0 -10
@@ -3,6 +3,7 @@ import React from 'react';
3
3
  import type { ModalProps } from 'react-native';
4
4
  import renderWithTheme from '../../../testHelpers/renderWithTheme';
5
5
  import TimePickerIOS from '../TimePickerIOS';
6
+ import { setOrientation } from '../../../testHelpers/utils';
6
7
 
7
8
  jest.mock('react-native/Libraries/Modal/Modal', () => {
8
9
  const Modal = jest.requireActual('react-native/Libraries/Modal/Modal');
@@ -43,6 +44,36 @@ describe('TimePickerIOS', () => {
43
44
  expect(onChange).toBeCalledWith(new Date('December 17, 1995 05:30:00'));
44
45
  });
45
46
 
47
+ it('renders correctly in landscape mode', () => {
48
+ setOrientation('landscape');
49
+
50
+ const onChange = jest.fn();
51
+ const { getByText, queryByTestId } = renderWithTheme(
52
+ <TimePickerIOS
53
+ value={new Date('December 17, 1995 03:24:00')}
54
+ label="Break time"
55
+ confirmLabel="Confirm"
56
+ onChange={onChange}
57
+ supportedOrientations={['landscape']}
58
+ />
59
+ );
60
+
61
+ // Open time picker
62
+ fireEvent.press(getByText('Break time'));
63
+ expect(queryByTestId('timePickerIOS')).toBeTruthy();
64
+
65
+ // Change time
66
+ fireEvent(
67
+ queryByTestId('timePickerIOS'),
68
+ 'onChange',
69
+ null,
70
+ new Date('December 17, 1995 05:30:00')
71
+ );
72
+ fireEvent.press(getByText('Confirm'));
73
+
74
+ expect(onChange).toBeCalledWith(new Date('December 17, 1995 05:30:00'));
75
+ });
76
+
46
77
  it('renders correct help text', () => {
47
78
  const { getByText } = renderWithTheme(
48
79
  <TimePickerIOS
@@ -556,6 +556,11 @@ exports[`TimePickerIOS renders correctly 1`] = `
556
556
  "position": "absolute",
557
557
  }
558
558
  }
559
+ supportedOrientations={
560
+ [
561
+ "portrait",
562
+ ]
563
+ }
559
564
  transparent={true}
560
565
  visible={true}
561
566
  >
@@ -56,4 +56,8 @@ export interface TimePickerProps {
56
56
  * Testing id of the component.
57
57
  */
58
58
  testID?: string;
59
+ /**
60
+ * Supported orientations for the TimePicker modal, iOS only.
61
+ */
62
+ supportedOrientations?: ('portrait' | 'landscape')[];
59
63
  }
@@ -92,6 +92,7 @@ const Toast = ({
92
92
 
93
93
  return (
94
94
  <Container
95
+ testID="toast-container"
95
96
  themeVariant={variant}
96
97
  themeIntent={intent}
97
98
  style={[
@@ -32,6 +32,7 @@ exports[`Toast Icon render custom icon correctly 1`] = `
32
32
  ],
33
33
  }
34
34
  }
35
+ testID="toast-container"
35
36
  themeIntent="info"
36
37
  themeVariant="default"
37
38
  >
@@ -166,6 +167,7 @@ exports[`Toast renders correctly when intent is error 1`] = `
166
167
  ],
167
168
  }
168
169
  }
170
+ testID="toast-container"
169
171
  themeIntent="error"
170
172
  themeVariant="default"
171
173
  >
@@ -358,6 +360,7 @@ exports[`Toast renders correctly when intent is info 1`] = `
358
360
  ],
359
361
  }
360
362
  }
363
+ testID="toast-container"
361
364
  themeIntent="info"
362
365
  themeVariant="default"
363
366
  >
@@ -550,6 +553,7 @@ exports[`Toast renders correctly when intent is notification 1`] = `
550
553
  ],
551
554
  }
552
555
  }
556
+ testID="toast-container"
553
557
  themeIntent="notification"
554
558
  themeVariant="default"
555
559
  >
@@ -715,6 +719,7 @@ exports[`Toast renders correctly when intent is snackbar 1`] = `
715
719
  ],
716
720
  }
717
721
  }
722
+ testID="toast-container"
718
723
  themeIntent="snackbar"
719
724
  themeVariant="default"
720
725
  >
@@ -880,6 +885,7 @@ exports[`Toast renders correctly when intent is success 1`] = `
880
885
  ],
881
886
  }
882
887
  }
888
+ testID="toast-container"
883
889
  themeIntent="success"
884
890
  themeVariant="default"
885
891
  >
@@ -1072,6 +1078,7 @@ exports[`Toast renders correctly when intent is warning 1`] = `
1072
1078
  ],
1073
1079
  }
1074
1080
  }
1081
+ testID="toast-container"
1075
1082
  themeIntent="warning"
1076
1083
  themeVariant="default"
1077
1084
  >
@@ -0,0 +1,21 @@
1
+ import { Dimensions } from 'react-native';
2
+
3
+ const DEFAULT_DIMENSIONS = {
4
+ width: 390,
5
+ height: 844,
6
+ };
7
+
8
+ export const setOrientation = (orientation: 'portrait' | 'landscape') => {
9
+ jest.spyOn(Dimensions, 'get').mockImplementation(() => ({
10
+ width:
11
+ orientation === 'landscape'
12
+ ? DEFAULT_DIMENSIONS.height
13
+ : DEFAULT_DIMENSIONS.width,
14
+ height:
15
+ orientation === 'landscape'
16
+ ? DEFAULT_DIMENSIONS.width
17
+ : DEFAULT_DIMENSIONS.height,
18
+ scale: 1,
19
+ fontScale: 1,
20
+ }));
21
+ };