@hero-design/rn 8.87.1 → 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.
- package/.turbo/turbo-build.log +2 -2
- package/CHANGELOG.md +18 -0
- package/es/index.js +119 -59
- package/lib/index.js +119 -59
- package/package.json +2 -2
- package/src/components/AppCue/StyledAppCue.tsx +27 -1
- package/src/components/AppCue/__tests__/StyledAppCue.tsx +4 -0
- package/src/components/AppCue/__tests__/__snapshots__/StyledAppCue.tsx.snap +194 -0
- package/src/components/AppCue/__tests__/__snapshots__/index.spec.tsx.snap +260 -0
- package/src/components/AppCue/__tests__/index.spec.tsx +4 -0
- package/src/components/AppCue/__tests__/utils.spec.ts +57 -4
- package/src/components/AppCue/index.tsx +7 -4
- package/src/components/AppCue/utils.ts +60 -9
- package/src/components/DatePicker/__tests__/__snapshots__/DatePicker.spec.tsx.snap +18 -15
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerAndroid.spec.tsx.snap +6 -5
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerCalendar.spec.tsx.snap +6 -5
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +12 -10
- package/src/components/Empty/__tests__/__snapshots__/index.spec.tsx.snap +12 -12
- package/src/components/Empty/index.tsx +1 -1
- package/src/components/RichTextEditor/__tests__/__snapshots__/RichTextEditor.spec.tsx.snap +8 -0
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +42 -35
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +36 -30
- package/src/components/TextInput/StyledTextInput.tsx +4 -0
- package/src/components/TextInput/__tests__/__snapshots__/StyledTextInput.spec.tsx.snap +20 -0
- package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +446 -432
- package/src/components/TextInput/index.tsx +13 -32
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerAndroid.spec.tsx.snap +12 -10
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +12 -10
- package/stats/8.87.2/rn-stats.html +4844 -0
- package/stats/8.88.0/rn-stats.html +4844 -0
- package/types/components/AppCue/StyledAppCue.d.ts +1 -1
- package/types/components/AppCue/utils.d.ts +6 -3
|
@@ -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: {
|
|
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: {
|
|
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: {
|
|
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: {
|
|
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.
|
|
161
|
-
left: pos.
|
|
161
|
+
top: pos.top,
|
|
162
|
+
left: pos.left,
|
|
163
|
+
bottom: pos.bottom,
|
|
164
|
+
right: pos.right,
|
|
162
165
|
},
|
|
163
166
|
style,
|
|
164
167
|
])}
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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":
|
|
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":
|
|
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":
|
|
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":
|
|
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",
|