@hero-design/rn 8.87.2 → 8.88.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 (31) hide show
  1. package/.turbo/turbo-build.log +2 -2
  2. package/CHANGELOG.md +12 -0
  3. package/es/index.js +109 -50
  4. package/lib/index.js +109 -50
  5. package/package.json +1 -1
  6. package/src/components/AppCue/StyledAppCue.tsx +27 -1
  7. package/src/components/AppCue/__tests__/StyledAppCue.tsx +4 -0
  8. package/src/components/AppCue/__tests__/__snapshots__/StyledAppCue.tsx.snap +194 -0
  9. package/src/components/AppCue/__tests__/__snapshots__/index.spec.tsx.snap +260 -0
  10. package/src/components/AppCue/__tests__/index.spec.tsx +4 -0
  11. package/src/components/AppCue/__tests__/utils.spec.ts +57 -4
  12. package/src/components/AppCue/index.tsx +7 -4
  13. package/src/components/AppCue/utils.ts +60 -9
  14. package/src/components/DatePicker/__tests__/__snapshots__/DatePicker.spec.tsx.snap +18 -15
  15. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerAndroid.spec.tsx.snap +6 -5
  16. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerCalendar.spec.tsx.snap +6 -5
  17. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +12 -10
  18. package/src/components/Empty/__tests__/__snapshots__/index.spec.tsx.snap +12 -12
  19. package/src/components/Empty/index.tsx +1 -1
  20. package/src/components/RichTextEditor/__tests__/__snapshots__/RichTextEditor.spec.tsx.snap +8 -0
  21. package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +42 -35
  22. package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +36 -30
  23. package/src/components/TextInput/StyledTextInput.tsx +4 -0
  24. package/src/components/TextInput/__tests__/__snapshots__/StyledTextInput.spec.tsx.snap +20 -0
  25. package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +446 -432
  26. package/src/components/TextInput/index.tsx +13 -32
  27. package/src/components/TimePicker/__tests__/__snapshots__/TimePickerAndroid.spec.tsx.snap +12 -10
  28. package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +12 -10
  29. package/stats/8.88.0/rn-stats.html +4844 -0
  30. package/types/components/AppCue/StyledAppCue.d.ts +1 -1
  31. package/types/components/AppCue/utils.d.ts +6 -3
@@ -24,6 +24,7 @@ export const calculatePosition = ({
24
24
  position,
25
25
  contentSize,
26
26
  offset,
27
+ windowWidth,
27
28
  }: {
28
29
  position: {
29
30
  pageX: number;
@@ -37,38 +38,76 @@ export const calculatePosition = ({
37
38
  };
38
39
  placement: Placement;
39
40
  offset: number;
40
- }) => {
41
+ windowWidth: number;
42
+ }): {
43
+ left?: number;
44
+ top?: number;
45
+ bottom?: number;
46
+ right?: number;
47
+ } => {
41
48
  switch (placement) {
42
49
  case 'top': {
43
50
  return {
44
51
  // The X coordinate is calculated by adding the half of the width of the target element to the X coordinate of the target element.
45
- x: position.pageX + (position.width - contentSize.width) / 2,
52
+ left: position.pageX + (position.width - contentSize.width) / 2,
46
53
  // The Y coordinate is calculated by subtracting the height of the content and the offset from the Y coordinate of the target element
47
- y: position.pageY - contentSize.height - offset,
54
+ top: position.pageY - contentSize.height - offset,
48
55
  };
49
56
  }
50
57
  case 'bottom': {
51
58
  return {
52
59
  // The X coordinate is calculated by adding the half of the width of the target element to the X coordinate of the target element.
53
- x: position.pageX + (position.width - contentSize.width) / 2,
60
+ left: position.pageX + (position.width - contentSize.width) / 2,
54
61
  // The Y coordinate is calculated by adding the height of the target element and the offset to the Y coordinate of the target element.
55
- y: position.pageY + position.height + offset,
62
+ top: position.pageY + position.height + offset,
56
63
  };
57
64
  }
58
65
  case 'right': {
59
66
  return {
60
67
  // The X coordinate is calculated by adding the width of the target element and the offset to the X coordinate of the target element.
61
- x: position.pageX + position.width + offset,
68
+ left: position.pageX + position.width + offset,
62
69
  // The Y coordinate is calculated by adding half of the height of the target element to the Y coordinate of the target element.
63
- y: position.pageY + (position.height - contentSize.height) / 2,
70
+ top: position.pageY + (position.height - contentSize.height) / 2,
64
71
  };
65
72
  }
66
73
  case 'left': {
67
74
  return {
68
75
  // The X coordinate is calculated by subtracting the width of the content and the offset from the X coordinate of the target element.
69
- x: position.pageX - contentSize.width - offset,
76
+ left: position.pageX - contentSize.width - offset,
70
77
  // The Y coordinate is calculated by adding half of the height of the target element to the Y coordinate of the target element.
71
- y: position.pageY + (position.height - contentSize.height) / 2,
78
+ top: position.pageY + (position.height - contentSize.height) / 2,
79
+ };
80
+ }
81
+ case 'top-left': {
82
+ return {
83
+ // The X coordinate is calculated by subtracting the width of the content from the X coordinate of the target element.
84
+ right: windowWidth - position.pageX - position.width,
85
+ // The Y coordinate is calculated by subtracting the height of the content and the offset from the Y coordinate of the target element
86
+ top: position.pageY - contentSize.height - offset,
87
+ };
88
+ }
89
+ case 'top-right': {
90
+ return {
91
+ // The X coordinate is calculated by adding the width of the target element to the X coordinate of the target element.
92
+ left: position.pageX,
93
+ // The Y coordinate is calculated by subtracting the height of the content and the offset from the Y coordinate of the target element.
94
+ top: position.pageY - contentSize.height - offset,
95
+ };
96
+ }
97
+ case 'bottom-left': {
98
+ return {
99
+ // The X coordinate is calculated by subtracting the width of the content from the X coordinate of the target element.
100
+ right: windowWidth - position.pageX - position.width,
101
+ // The Y coordinate is calculated by adding the height of the target element and the offset to the Y coordinate of the target element.
102
+ top: position.pageY + position.height + offset,
103
+ };
104
+ }
105
+ case 'bottom-right': {
106
+ return {
107
+ // The X coordinate is calculated by adding the width of the target element to the X coordinate of the target element.
108
+ left: position.pageX,
109
+ // The Y coordinate is calculated by adding the height of the target element and the offset to the Y coordinate of the target element.
110
+ top: position.pageY + position.height + offset,
72
111
  };
73
112
  }
74
113
  }
@@ -118,5 +157,17 @@ export const calulateContentMaxWidth = ({
118
157
  case 'left': {
119
158
  return position.pageX - offset;
120
159
  }
160
+ case 'top-left': {
161
+ return position.pageX + position.width;
162
+ }
163
+ case 'top-right': {
164
+ return windowWidth - position.pageX;
165
+ }
166
+ case 'bottom-left': {
167
+ return position.pageX + position.width;
168
+ }
169
+ case 'bottom-right': {
170
+ return windowWidth - position.pageX;
171
+ }
121
172
  }
122
173
  };
@@ -98,9 +98,7 @@ exports[`DatePicker renders DatePickerAndroid when OS is android 1`] = `
98
98
  themeFocused={false}
99
99
  themeState="filled"
100
100
  />
101
- <View
102
- onLayout={[Function]}
103
- />
101
+ <View />
104
102
  <View
105
103
  collapsable={false}
106
104
  pointerEvents="none"
@@ -118,7 +116,7 @@ exports[`DatePicker renders DatePickerAndroid when OS is android 1`] = `
118
116
  "translateY": 0,
119
117
  },
120
118
  {
121
- "translateX": 24,
119
+ "translateX": 16,
122
120
  },
123
121
  {
124
122
  "scale": 1,
@@ -131,7 +129,6 @@ exports[`DatePicker renders DatePickerAndroid when OS is android 1`] = `
131
129
  >
132
130
  <Text
133
131
  allowFontScaling={false}
134
- onLayout={[Function]}
135
132
  style={
136
133
  [
137
134
  {
@@ -146,8 +143,12 @@ exports[`DatePicker renders DatePickerAndroid when OS is android 1`] = `
146
143
  "alignContent": "center",
147
144
  "alignItems": "center",
148
145
  "color": "#001f23",
146
+ "left": 0,
149
147
  "marginTop": -2,
148
+ "position": "absolute",
150
149
  "textAlignVertical": "center",
150
+ "top": "50%",
151
+ "zIndex": 1,
151
152
  },
152
153
  {
153
154
  "backgroundColor": "#ffffff",
@@ -379,9 +380,7 @@ exports[`DatePicker renders DatePickerIOS when OS is iOS 1`] = `
379
380
  themeFocused={false}
380
381
  themeState="filled"
381
382
  />
382
- <View
383
- onLayout={[Function]}
384
- />
383
+ <View />
385
384
  <View
386
385
  collapsable={false}
387
386
  pointerEvents="none"
@@ -399,7 +398,7 @@ exports[`DatePicker renders DatePickerIOS when OS is iOS 1`] = `
399
398
  "translateY": 0,
400
399
  },
401
400
  {
402
- "translateX": 24,
401
+ "translateX": 16,
403
402
  },
404
403
  {
405
404
  "scale": 1,
@@ -412,7 +411,6 @@ exports[`DatePicker renders DatePickerIOS when OS is iOS 1`] = `
412
411
  >
413
412
  <Text
414
413
  allowFontScaling={false}
415
- onLayout={[Function]}
416
414
  style={
417
415
  [
418
416
  {
@@ -427,8 +425,12 @@ exports[`DatePicker renders DatePickerIOS when OS is iOS 1`] = `
427
425
  "alignContent": "center",
428
426
  "alignItems": "center",
429
427
  "color": "#001f23",
428
+ "left": 0,
430
429
  "marginTop": -2,
430
+ "position": "absolute",
431
431
  "textAlignVertical": "center",
432
+ "top": "50%",
433
+ "zIndex": 1,
432
434
  },
433
435
  {
434
436
  "backgroundColor": "#ffffff",
@@ -660,9 +662,7 @@ exports[`DatePicker renders variant Calendar 1`] = `
660
662
  themeFocused={false}
661
663
  themeState="filled"
662
664
  />
663
- <View
664
- onLayout={[Function]}
665
- />
665
+ <View />
666
666
  <View
667
667
  collapsable={false}
668
668
  pointerEvents="none"
@@ -680,7 +680,7 @@ exports[`DatePicker renders variant Calendar 1`] = `
680
680
  "translateY": 0,
681
681
  },
682
682
  {
683
- "translateX": 24,
683
+ "translateX": 16,
684
684
  },
685
685
  {
686
686
  "scale": 1,
@@ -693,7 +693,6 @@ exports[`DatePicker renders variant Calendar 1`] = `
693
693
  >
694
694
  <Text
695
695
  allowFontScaling={false}
696
- onLayout={[Function]}
697
696
  style={
698
697
  [
699
698
  {
@@ -708,8 +707,12 @@ exports[`DatePicker renders variant Calendar 1`] = `
708
707
  "alignContent": "center",
709
708
  "alignItems": "center",
710
709
  "color": "#001f23",
710
+ "left": 0,
711
711
  "marginTop": -2,
712
+ "position": "absolute",
712
713
  "textAlignVertical": "center",
714
+ "top": "50%",
715
+ "zIndex": 1,
713
716
  },
714
717
  {
715
718
  "backgroundColor": "#ffffff",
@@ -98,9 +98,7 @@ exports[`DatePickerAndroid renders correctly 1`] = `
98
98
  themeFocused={false}
99
99
  themeState="filled"
100
100
  />
101
- <View
102
- onLayout={[Function]}
103
- />
101
+ <View />
104
102
  <View
105
103
  collapsable={false}
106
104
  pointerEvents="none"
@@ -118,7 +116,7 @@ exports[`DatePickerAndroid renders correctly 1`] = `
118
116
  "translateY": 0,
119
117
  },
120
118
  {
121
- "translateX": 24,
119
+ "translateX": 16,
122
120
  },
123
121
  {
124
122
  "scale": 1,
@@ -131,7 +129,6 @@ exports[`DatePickerAndroid renders correctly 1`] = `
131
129
  >
132
130
  <Text
133
131
  allowFontScaling={false}
134
- onLayout={[Function]}
135
132
  style={
136
133
  [
137
134
  {
@@ -146,8 +143,12 @@ exports[`DatePickerAndroid renders correctly 1`] = `
146
143
  "alignContent": "center",
147
144
  "alignItems": "center",
148
145
  "color": "#001f23",
146
+ "left": 0,
149
147
  "marginTop": -2,
148
+ "position": "absolute",
150
149
  "textAlignVertical": "center",
150
+ "top": "50%",
151
+ "zIndex": 1,
151
152
  },
152
153
  {
153
154
  "backgroundColor": "#ffffff",
@@ -98,9 +98,7 @@ exports[`DatePickerCalendar renders correctly 1`] = `
98
98
  themeFocused={false}
99
99
  themeState="filled"
100
100
  />
101
- <View
102
- onLayout={[Function]}
103
- />
101
+ <View />
104
102
  <View
105
103
  collapsable={false}
106
104
  pointerEvents="none"
@@ -118,7 +116,7 @@ exports[`DatePickerCalendar renders correctly 1`] = `
118
116
  "translateY": 0,
119
117
  },
120
118
  {
121
- "translateX": 24,
119
+ "translateX": 16,
122
120
  },
123
121
  {
124
122
  "scale": 1,
@@ -131,7 +129,6 @@ exports[`DatePickerCalendar renders correctly 1`] = `
131
129
  >
132
130
  <Text
133
131
  allowFontScaling={false}
134
- onLayout={[Function]}
135
132
  style={
136
133
  [
137
134
  {
@@ -146,8 +143,12 @@ exports[`DatePickerCalendar renders correctly 1`] = `
146
143
  "alignContent": "center",
147
144
  "alignItems": "center",
148
145
  "color": "#001f23",
146
+ "left": 0,
149
147
  "marginTop": -2,
148
+ "position": "absolute",
150
149
  "textAlignVertical": "center",
150
+ "top": "50%",
151
+ "zIndex": 1,
151
152
  },
152
153
  {
153
154
  "backgroundColor": "#ffffff",
@@ -98,9 +98,7 @@ exports[`DatePickerIOS renders correctly 1`] = `
98
98
  themeFocused={false}
99
99
  themeState="filled"
100
100
  />
101
- <View
102
- onLayout={[Function]}
103
- />
101
+ <View />
104
102
  <View
105
103
  collapsable={false}
106
104
  pointerEvents="none"
@@ -118,7 +116,7 @@ exports[`DatePickerIOS renders correctly 1`] = `
118
116
  "translateY": 0,
119
117
  },
120
118
  {
121
- "translateX": 24,
119
+ "translateX": 16,
122
120
  },
123
121
  {
124
122
  "scale": 1,
@@ -131,7 +129,6 @@ exports[`DatePickerIOS renders correctly 1`] = `
131
129
  >
132
130
  <Text
133
131
  allowFontScaling={false}
134
- onLayout={[Function]}
135
132
  style={
136
133
  [
137
134
  {
@@ -146,8 +143,12 @@ exports[`DatePickerIOS renders correctly 1`] = `
146
143
  "alignContent": "center",
147
144
  "alignItems": "center",
148
145
  "color": "#001f23",
146
+ "left": 0,
149
147
  "marginTop": -2,
148
+ "position": "absolute",
150
149
  "textAlignVertical": "center",
150
+ "top": "50%",
151
+ "zIndex": 1,
151
152
  },
152
153
  {
153
154
  "backgroundColor": "#ffffff",
@@ -766,9 +767,7 @@ exports[`DatePickerIOS renders correctly with custom locale 1`] = `
766
767
  themeFocused={false}
767
768
  themeState="filled"
768
769
  />
769
- <View
770
- onLayout={[Function]}
771
- />
770
+ <View />
772
771
  <View
773
772
  collapsable={false}
774
773
  pointerEvents="none"
@@ -786,7 +785,7 @@ exports[`DatePickerIOS renders correctly with custom locale 1`] = `
786
785
  "translateY": 0,
787
786
  },
788
787
  {
789
- "translateX": 24,
788
+ "translateX": 16,
790
789
  },
791
790
  {
792
791
  "scale": 1,
@@ -799,7 +798,6 @@ exports[`DatePickerIOS renders correctly with custom locale 1`] = `
799
798
  >
800
799
  <Text
801
800
  allowFontScaling={false}
802
- onLayout={[Function]}
803
801
  style={
804
802
  [
805
803
  {
@@ -814,8 +812,12 @@ exports[`DatePickerIOS renders correctly with custom locale 1`] = `
814
812
  "alignContent": "center",
815
813
  "alignItems": "center",
816
814
  "color": "#001f23",
815
+ "left": 0,
817
816
  "marginTop": -2,
817
+ "position": "absolute",
818
818
  "textAlignVertical": "center",
819
+ "top": "50%",
820
+ "zIndex": 1,
819
821
  },
820
822
  {
821
823
  "backgroundColor": "#ffffff",
@@ -57,10 +57,10 @@ exports[`Empty renders empty state content correctly 1`] = `
57
57
  [
58
58
  {
59
59
  "color": "#001f23",
60
- "fontFamily": "Saiga-Regular",
61
- "fontSize": 18,
62
- "letterSpacing": 0.54,
63
- "lineHeight": 26,
60
+ "fontFamily": "BeVietnamPro-Regular",
61
+ "fontSize": 14,
62
+ "letterSpacing": 0.48,
63
+ "lineHeight": 22,
64
64
  },
65
65
  [
66
66
  {
@@ -72,8 +72,8 @@ exports[`Empty renders empty state content correctly 1`] = `
72
72
  ]
73
73
  }
74
74
  themeIntent="body"
75
- themeTypeface="playful"
76
- themeVariant="regular"
75
+ themeTypeface="neutral"
76
+ themeVariant="small"
77
77
  >
78
78
  We'll notify you later.
79
79
  </Text>
@@ -173,10 +173,10 @@ exports[`Empty renders empty state with image correctly 1`] = `
173
173
  [
174
174
  {
175
175
  "color": "#001f23",
176
- "fontFamily": "Saiga-Regular",
177
- "fontSize": 18,
178
- "letterSpacing": 0.54,
179
- "lineHeight": 26,
176
+ "fontFamily": "BeVietnamPro-Regular",
177
+ "fontSize": 14,
178
+ "letterSpacing": 0.48,
179
+ "lineHeight": 22,
180
180
  },
181
181
  [
182
182
  {
@@ -188,8 +188,8 @@ exports[`Empty renders empty state with image correctly 1`] = `
188
188
  ]
189
189
  }
190
190
  themeIntent="body"
191
- themeTypeface="playful"
192
- themeVariant="regular"
191
+ themeTypeface="neutral"
192
+ themeVariant="small"
193
193
  >
194
194
  We'll notify you later.
195
195
  </Text>
@@ -62,7 +62,7 @@ const Empty = ({
62
62
  {title}
63
63
  </StyledTitle>
64
64
  {!!description && (
65
- <StyledDescription themeVariant={variant} typeface="playful">
65
+ <StyledDescription variant="small" themeVariant={variant}>
66
66
  {description}
67
67
  </StyledDescription>
68
68
  )}
@@ -65,8 +65,12 @@ exports[`RichTextEditor onMessage recevied event editor-layout should update hei
65
65
  "alignContent": "center",
66
66
  "alignItems": "center",
67
67
  "color": "#001f23",
68
+ "left": 0,
68
69
  "marginTop": -2,
70
+ "position": "absolute",
69
71
  "textAlignVertical": "center",
72
+ "top": "50%",
73
+ "zIndex": 1,
70
74
  },
71
75
  {
72
76
  "backgroundColor": "#ffffff",
@@ -384,8 +388,12 @@ exports[`RichTextEditor should render correctly 1`] = `
384
388
  "alignContent": "center",
385
389
  "alignItems": "center",
386
390
  "color": "#001f23",
391
+ "left": 0,
387
392
  "marginTop": -2,
393
+ "position": "absolute",
388
394
  "textAlignVertical": "center",
395
+ "top": "50%",
396
+ "zIndex": 1,
389
397
  },
390
398
  {
391
399
  "backgroundColor": "#ffffff",