@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
@@ -51,6 +51,108 @@ exports[`AppCue renders icon bottom correctly 1`] = `
51
51
  </View>
52
52
  `;
53
53
 
54
+ exports[`AppCue renders icon bottom-left correctly 1`] = `
55
+ <View
56
+ style={
57
+ {
58
+ "flex": 1,
59
+ }
60
+ }
61
+ >
62
+ <View
63
+ collapsable={false}
64
+ style={
65
+ {
66
+ "alignItems": "center",
67
+ "color": "#001f23",
68
+ "display": "flex",
69
+ "justifyContent": "center",
70
+ "position": "absolute",
71
+ "right": 12,
72
+ "top": -12,
73
+ "transform": [
74
+ {
75
+ "rotate": "180deg",
76
+ },
77
+ ],
78
+ }
79
+ }
80
+ themePlacement="bottom-left"
81
+ />
82
+ <View
83
+ pointerEvents="box-none"
84
+ position="bottom"
85
+ style={
86
+ [
87
+ {
88
+ "bottom": 0,
89
+ "elevation": 9999,
90
+ "flexDirection": "column-reverse",
91
+ "left": 0,
92
+ "paddingHorizontal": 24,
93
+ "paddingVertical": 16,
94
+ "position": "absolute",
95
+ "right": 0,
96
+ "top": 0,
97
+ },
98
+ undefined,
99
+ ]
100
+ }
101
+ />
102
+ </View>
103
+ `;
104
+
105
+ exports[`AppCue renders icon bottom-right correctly 1`] = `
106
+ <View
107
+ style={
108
+ {
109
+ "flex": 1,
110
+ }
111
+ }
112
+ >
113
+ <View
114
+ collapsable={false}
115
+ style={
116
+ {
117
+ "alignItems": "center",
118
+ "color": "#001f23",
119
+ "display": "flex",
120
+ "justifyContent": "center",
121
+ "left": 12,
122
+ "position": "absolute",
123
+ "top": -12,
124
+ "transform": [
125
+ {
126
+ "rotate": "180deg",
127
+ },
128
+ ],
129
+ }
130
+ }
131
+ themePlacement="bottom-right"
132
+ />
133
+ <View
134
+ pointerEvents="box-none"
135
+ position="bottom"
136
+ style={
137
+ [
138
+ {
139
+ "bottom": 0,
140
+ "elevation": 9999,
141
+ "flexDirection": "column-reverse",
142
+ "left": 0,
143
+ "paddingHorizontal": 24,
144
+ "paddingVertical": 16,
145
+ "position": "absolute",
146
+ "right": 0,
147
+ "top": 0,
148
+ },
149
+ undefined,
150
+ ]
151
+ }
152
+ />
153
+ </View>
154
+ `;
155
+
54
156
  exports[`AppCue renders icon left correctly 1`] = `
55
157
  <View
56
158
  style={
@@ -198,3 +300,95 @@ exports[`AppCue renders icon top correctly 1`] = `
198
300
  />
199
301
  </View>
200
302
  `;
303
+
304
+ exports[`AppCue renders icon top-left correctly 1`] = `
305
+ <View
306
+ style={
307
+ {
308
+ "flex": 1,
309
+ }
310
+ }
311
+ >
312
+ <View
313
+ collapsable={false}
314
+ style={
315
+ {
316
+ "alignItems": "center",
317
+ "bottom": -12,
318
+ "color": "#001f23",
319
+ "display": "flex",
320
+ "justifyContent": "center",
321
+ "position": "absolute",
322
+ "right": 12,
323
+ }
324
+ }
325
+ themePlacement="top-left"
326
+ />
327
+ <View
328
+ pointerEvents="box-none"
329
+ position="bottom"
330
+ style={
331
+ [
332
+ {
333
+ "bottom": 0,
334
+ "elevation": 9999,
335
+ "flexDirection": "column-reverse",
336
+ "left": 0,
337
+ "paddingHorizontal": 24,
338
+ "paddingVertical": 16,
339
+ "position": "absolute",
340
+ "right": 0,
341
+ "top": 0,
342
+ },
343
+ undefined,
344
+ ]
345
+ }
346
+ />
347
+ </View>
348
+ `;
349
+
350
+ exports[`AppCue renders icon top-right correctly 1`] = `
351
+ <View
352
+ style={
353
+ {
354
+ "flex": 1,
355
+ }
356
+ }
357
+ >
358
+ <View
359
+ collapsable={false}
360
+ style={
361
+ {
362
+ "alignItems": "center",
363
+ "bottom": -12,
364
+ "color": "#001f23",
365
+ "display": "flex",
366
+ "justifyContent": "center",
367
+ "left": 12,
368
+ "position": "absolute",
369
+ }
370
+ }
371
+ themePlacement="top-right"
372
+ />
373
+ <View
374
+ pointerEvents="box-none"
375
+ position="bottom"
376
+ style={
377
+ [
378
+ {
379
+ "bottom": 0,
380
+ "elevation": 9999,
381
+ "flexDirection": "column-reverse",
382
+ "left": 0,
383
+ "paddingHorizontal": 24,
384
+ "paddingVertical": 16,
385
+ "position": "absolute",
386
+ "right": 0,
387
+ "top": 0,
388
+ },
389
+ undefined,
390
+ ]
391
+ }
392
+ />
393
+ </View>
394
+ `;
@@ -130,6 +130,136 @@ exports[`AppCue renders placement bottom correctly 1`] = `
130
130
  </View>
131
131
  `;
132
132
 
133
+ exports[`AppCue renders placement bottom-left correctly 1`] = `
134
+ <View
135
+ style={
136
+ {
137
+ "flex": 1,
138
+ }
139
+ }
140
+ >
141
+ <View
142
+ accessibilityState={
143
+ {
144
+ "busy": undefined,
145
+ "checked": undefined,
146
+ "disabled": undefined,
147
+ "expanded": undefined,
148
+ "selected": undefined,
149
+ }
150
+ }
151
+ accessible={true}
152
+ collapsable={false}
153
+ focusable={true}
154
+ onClick={[Function]}
155
+ onResponderGrant={[Function]}
156
+ onResponderMove={[Function]}
157
+ onResponderRelease={[Function]}
158
+ onResponderTerminate={[Function]}
159
+ onResponderTerminationRequest={[Function]}
160
+ onStartShouldSetResponder={[Function]}
161
+ style={
162
+ {
163
+ "alignSelf": "center",
164
+ }
165
+ }
166
+ >
167
+ <View
168
+ onPress={[Function]}
169
+ >
170
+ <Text>
171
+ Target
172
+ </Text>
173
+ </View>
174
+ </View>
175
+ <View
176
+ pointerEvents="box-none"
177
+ position="bottom"
178
+ style={
179
+ [
180
+ {
181
+ "bottom": 0,
182
+ "elevation": 9999,
183
+ "flexDirection": "column-reverse",
184
+ "left": 0,
185
+ "paddingHorizontal": 24,
186
+ "paddingVertical": 16,
187
+ "position": "absolute",
188
+ "right": 0,
189
+ "top": 0,
190
+ },
191
+ undefined,
192
+ ]
193
+ }
194
+ />
195
+ </View>
196
+ `;
197
+
198
+ exports[`AppCue renders placement bottom-right correctly 1`] = `
199
+ <View
200
+ style={
201
+ {
202
+ "flex": 1,
203
+ }
204
+ }
205
+ >
206
+ <View
207
+ accessibilityState={
208
+ {
209
+ "busy": undefined,
210
+ "checked": undefined,
211
+ "disabled": undefined,
212
+ "expanded": undefined,
213
+ "selected": undefined,
214
+ }
215
+ }
216
+ accessible={true}
217
+ collapsable={false}
218
+ focusable={true}
219
+ onClick={[Function]}
220
+ onResponderGrant={[Function]}
221
+ onResponderMove={[Function]}
222
+ onResponderRelease={[Function]}
223
+ onResponderTerminate={[Function]}
224
+ onResponderTerminationRequest={[Function]}
225
+ onStartShouldSetResponder={[Function]}
226
+ style={
227
+ {
228
+ "alignSelf": "center",
229
+ }
230
+ }
231
+ >
232
+ <View
233
+ onPress={[Function]}
234
+ >
235
+ <Text>
236
+ Target
237
+ </Text>
238
+ </View>
239
+ </View>
240
+ <View
241
+ pointerEvents="box-none"
242
+ position="bottom"
243
+ style={
244
+ [
245
+ {
246
+ "bottom": 0,
247
+ "elevation": 9999,
248
+ "flexDirection": "column-reverse",
249
+ "left": 0,
250
+ "paddingHorizontal": 24,
251
+ "paddingVertical": 16,
252
+ "position": "absolute",
253
+ "right": 0,
254
+ "top": 0,
255
+ },
256
+ undefined,
257
+ ]
258
+ }
259
+ />
260
+ </View>
261
+ `;
262
+
133
263
  exports[`AppCue renders placement left correctly 1`] = `
134
264
  <View
135
265
  style={
@@ -325,6 +455,136 @@ exports[`AppCue renders placement top correctly 1`] = `
325
455
  </View>
326
456
  `;
327
457
 
458
+ exports[`AppCue renders placement top-left correctly 1`] = `
459
+ <View
460
+ style={
461
+ {
462
+ "flex": 1,
463
+ }
464
+ }
465
+ >
466
+ <View
467
+ accessibilityState={
468
+ {
469
+ "busy": undefined,
470
+ "checked": undefined,
471
+ "disabled": undefined,
472
+ "expanded": undefined,
473
+ "selected": undefined,
474
+ }
475
+ }
476
+ accessible={true}
477
+ collapsable={false}
478
+ focusable={true}
479
+ onClick={[Function]}
480
+ onResponderGrant={[Function]}
481
+ onResponderMove={[Function]}
482
+ onResponderRelease={[Function]}
483
+ onResponderTerminate={[Function]}
484
+ onResponderTerminationRequest={[Function]}
485
+ onStartShouldSetResponder={[Function]}
486
+ style={
487
+ {
488
+ "alignSelf": "center",
489
+ }
490
+ }
491
+ >
492
+ <View
493
+ onPress={[Function]}
494
+ >
495
+ <Text>
496
+ Target
497
+ </Text>
498
+ </View>
499
+ </View>
500
+ <View
501
+ pointerEvents="box-none"
502
+ position="bottom"
503
+ style={
504
+ [
505
+ {
506
+ "bottom": 0,
507
+ "elevation": 9999,
508
+ "flexDirection": "column-reverse",
509
+ "left": 0,
510
+ "paddingHorizontal": 24,
511
+ "paddingVertical": 16,
512
+ "position": "absolute",
513
+ "right": 0,
514
+ "top": 0,
515
+ },
516
+ undefined,
517
+ ]
518
+ }
519
+ />
520
+ </View>
521
+ `;
522
+
523
+ exports[`AppCue renders placement top-right correctly 1`] = `
524
+ <View
525
+ style={
526
+ {
527
+ "flex": 1,
528
+ }
529
+ }
530
+ >
531
+ <View
532
+ accessibilityState={
533
+ {
534
+ "busy": undefined,
535
+ "checked": undefined,
536
+ "disabled": undefined,
537
+ "expanded": undefined,
538
+ "selected": undefined,
539
+ }
540
+ }
541
+ accessible={true}
542
+ collapsable={false}
543
+ focusable={true}
544
+ onClick={[Function]}
545
+ onResponderGrant={[Function]}
546
+ onResponderMove={[Function]}
547
+ onResponderRelease={[Function]}
548
+ onResponderTerminate={[Function]}
549
+ onResponderTerminationRequest={[Function]}
550
+ onStartShouldSetResponder={[Function]}
551
+ style={
552
+ {
553
+ "alignSelf": "center",
554
+ }
555
+ }
556
+ >
557
+ <View
558
+ onPress={[Function]}
559
+ >
560
+ <Text>
561
+ Target
562
+ </Text>
563
+ </View>
564
+ </View>
565
+ <View
566
+ pointerEvents="box-none"
567
+ position="bottom"
568
+ style={
569
+ [
570
+ {
571
+ "bottom": 0,
572
+ "elevation": 9999,
573
+ "flexDirection": "column-reverse",
574
+ "left": 0,
575
+ "paddingHorizontal": 24,
576
+ "paddingVertical": 16,
577
+ "position": "absolute",
578
+ "right": 0,
579
+ "top": 0,
580
+ },
581
+ undefined,
582
+ ]
583
+ }
584
+ />
585
+ </View>
586
+ `;
587
+
328
588
  exports[`AppCue renders placement undefined correctly 1`] = `
329
589
  <View
330
590
  style={
@@ -12,6 +12,10 @@ describe('AppCue', () => {
12
12
  ${'bottom'}
13
13
  ${'left'}
14
14
  ${'right'}
15
+ ${'top-left'}
16
+ ${'top-right'}
17
+ ${'bottom-left'}
18
+ ${'bottom-right'}
15
19
  `('renders placement $placement correctly', ({ placement }) => {
16
20
  const { toJSON, getByText, getByTestId } = renderWithTheme(
17
21
  <AppCue
@@ -8,28 +8,56 @@ describe('utils', () => {
8
8
  position: { pageX: 100, pageY: 200, width: 50, height: 50 },
9
9
  contentSize: { width: 30, height: 20 },
10
10
  offset: 10,
11
- expected: { x: 110, y: 170 },
11
+ expected: { left: 110, top: 170, bottom: undefined, right: undefined },
12
12
  },
13
13
  {
14
14
  placement: 'bottom' as const,
15
15
  position: { pageX: 100, pageY: 200, width: 50, height: 50 },
16
16
  contentSize: { width: 30, height: 20 },
17
17
  offset: 10,
18
- expected: { x: 110, y: 260 },
18
+ expected: { left: 110, top: 260, bottom: undefined, right: undefined },
19
19
  },
20
20
  {
21
21
  placement: 'right' as const,
22
22
  position: { pageX: 100, pageY: 200, width: 50, height: 50 },
23
23
  contentSize: { width: 30, height: 20 },
24
24
  offset: 10,
25
- expected: { x: 160, y: 215 },
25
+ expected: { left: 160, top: 215, bottom: undefined, right: undefined },
26
26
  },
27
27
  {
28
28
  placement: 'left' as const,
29
29
  position: { pageX: 100, pageY: 200, width: 50, height: 50 },
30
30
  contentSize: { width: 30, height: 20 },
31
31
  offset: 10,
32
- expected: { x: 60, y: 215 },
32
+ expected: { left: 60, top: 215, bottom: undefined, right: undefined },
33
+ },
34
+ {
35
+ placement: 'top-left' as const,
36
+ position: { pageX: 100, pageY: 200, width: 50, height: 50 },
37
+ contentSize: { width: 30, height: 20 },
38
+ offset: 10,
39
+ expected: { right: 874, top: 170, bottom: undefined },
40
+ },
41
+ {
42
+ placement: 'top-right' as const,
43
+ position: { pageX: 100, pageY: 200, width: 50, height: 50 },
44
+ contentSize: { width: 30, height: 20 },
45
+ offset: 10,
46
+ expected: { left: 100, top: 170, bottom: undefined, right: undefined },
47
+ },
48
+ {
49
+ placement: 'bottom-left' as const,
50
+ position: { pageX: 100, pageY: 200, width: 50, height: 50 },
51
+ contentSize: { width: 30, height: 20 },
52
+ offset: 10,
53
+ expected: { right: 874, top: 260, bottom: undefined },
54
+ },
55
+ {
56
+ placement: 'bottom-right' as const,
57
+ position: { pageX: 100, pageY: 200, width: 50, height: 50 },
58
+ contentSize: { width: 30, height: 20 },
59
+ offset: 10,
60
+ expected: { left: 100, top: 260, bottom: undefined, right: undefined },
33
61
  },
34
62
  ];
35
63
  it.each(testCases)(
@@ -40,6 +68,7 @@ describe('utils', () => {
40
68
  position,
41
69
  contentSize,
42
70
  offset,
71
+ windowWidth: 1024,
43
72
  });
44
73
  expect(result).toEqual(expected);
45
74
  }
@@ -73,6 +102,30 @@ describe('utils', () => {
73
102
  offset: 10,
74
103
  expected: 100 - 10,
75
104
  },
105
+ {
106
+ placement: 'top-left' as const,
107
+ position: { pageX: 100, pageY: 200, width: 50, height: 50 },
108
+ offset: 10,
109
+ expected: 150,
110
+ },
111
+ {
112
+ placement: 'top-right' as const,
113
+ position: { pageX: 100, pageY: 200, width: 50, height: 50 },
114
+ offset: 10,
115
+ expected: 924,
116
+ },
117
+ {
118
+ placement: 'bottom-left' as const,
119
+ position: { pageX: 100, pageY: 200, width: 50, height: 50 },
120
+ offset: 10,
121
+ expected: 150,
122
+ },
123
+ {
124
+ placement: 'bottom-right' as const,
125
+ position: { pageX: 100, pageY: 200, width: 50, height: 50 },
126
+ offset: 10,
127
+ expected: 924,
128
+ },
76
129
  ];
77
130
  it.each(testCases)(
78
131
  'should calculate the correct max width for placement $placement',
@@ -106,15 +106,16 @@ const AppCue = ({
106
106
  });
107
107
  };
108
108
 
109
+ const { width: windowWidth } = useWindowDimensions();
110
+
109
111
  const pos = calculatePosition({
110
112
  position,
111
113
  contentSize,
112
114
  placement,
113
115
  offset,
116
+ windowWidth,
114
117
  });
115
118
 
116
- const { width: windowWidth } = useWindowDimensions();
117
-
118
119
  const maxWidth = calulateContentMaxWidth({
119
120
  position,
120
121
  offset,
@@ -157,8 +158,10 @@ const AppCue = ({
157
158
  style={StyleSheet.flatten([
158
159
  {
159
160
  position: 'absolute',
160
- top: pos.y,
161
- left: pos.x,
161
+ top: pos.top,
162
+ left: pos.left,
163
+ bottom: pos.bottom,
164
+ right: pos.right,
162
165
  },
163
166
  style,
164
167
  ])}