@hero-design/rn 8.63.3 → 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 (54) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/CHANGELOG.md +6 -0
  3. package/es/index.js +85 -38
  4. package/eslint.config.js +42 -0
  5. package/lib/index.js +85 -38
  6. package/package.json +7 -3
  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/testHelpers/utils.ts +21 -0
  38. package/stats/8.63.3/rn-stats.html +4844 -0
  39. package/stats/8.64.0/rn-stats.html +4842 -0
  40. package/types/components/BottomSheet/index.d.ts +5 -1
  41. package/types/components/Calendar/CalendarRowItem.d.ts +2 -1
  42. package/types/components/Calendar/StyledCalendar.d.ts +7 -0
  43. package/types/components/DatePicker/DatePickerCalendar.d.ts +1 -1
  44. package/types/components/DatePicker/DatePickerIOS.d.ts +1 -1
  45. package/types/components/DatePicker/types.d.ts +4 -0
  46. package/types/components/FAB/ActionGroup/index.d.ts +4 -0
  47. package/types/components/Select/MultiSelect/index.d.ts +5 -1
  48. package/types/components/Select/SingleSelect/index.d.ts +5 -1
  49. package/types/components/Select/index.d.ts +1 -1
  50. package/types/components/TimePicker/TimePickerIOS.d.ts +1 -1
  51. package/types/components/TimePicker/types.d.ts +4 -0
  52. package/types/testHelpers/utils.d.ts +1 -0
  53. package/.eslintrc.js +0 -13
  54. 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
  }
@@ -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
+ };