@korsolutions/guidon 1.0.16 → 1.0.17
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/README.md +72 -167
- package/dist/commonjs/components/GuidonOverlay.js +9 -20
- package/dist/commonjs/components/GuidonOverlay.js.map +1 -1
- package/dist/commonjs/components/GuidonProvider.js +11 -77
- package/dist/commonjs/components/GuidonProvider.js.map +1 -1
- package/dist/commonjs/components/GuidonTooltip.js +48 -55
- package/dist/commonjs/components/GuidonTooltip.js.map +1 -1
- package/dist/commonjs/components/index.js +2 -2
- package/dist/commonjs/components/index.js.map +1 -1
- package/dist/commonjs/hooks/useGuidonRef.js +7 -7
- package/dist/commonjs/hooks/useGuidonRef.js.map +1 -1
- package/dist/commonjs/store.js +27 -70
- package/dist/commonjs/store.js.map +1 -1
- package/dist/module/components/GuidonOverlay.js +14 -25
- package/dist/module/components/GuidonOverlay.js.map +1 -1
- package/dist/module/components/GuidonProvider.js +12 -78
- package/dist/module/components/GuidonProvider.js.map +1 -1
- package/dist/module/components/GuidonTooltip.js +53 -60
- package/dist/module/components/GuidonTooltip.js.map +1 -1
- package/dist/module/components/index.js +2 -2
- package/dist/module/components/index.js.map +1 -1
- package/dist/module/hooks/useGuidonRef.js +7 -7
- package/dist/module/hooks/useGuidonRef.js.map +1 -1
- package/dist/module/store.js +27 -70
- package/dist/module/store.js.map +1 -1
- package/dist/typescript/commonjs/components/GuidonOverlay.d.ts +1 -1
- package/dist/typescript/commonjs/components/GuidonOverlay.d.ts.map +1 -1
- package/dist/typescript/commonjs/components/GuidonProvider.d.ts +4 -4
- package/dist/typescript/commonjs/components/GuidonProvider.d.ts.map +1 -1
- package/dist/typescript/commonjs/components/GuidonTooltip.d.ts +1 -1
- package/dist/typescript/commonjs/components/GuidonTooltip.d.ts.map +1 -1
- package/dist/typescript/commonjs/components/index.d.ts +4 -4
- package/dist/typescript/commonjs/components/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/hooks/useGuidonRef.d.ts.map +1 -1
- package/dist/typescript/commonjs/store.d.ts +9 -21
- package/dist/typescript/commonjs/store.d.ts.map +1 -1
- package/dist/typescript/commonjs/types.d.ts +7 -14
- package/dist/typescript/commonjs/types.d.ts.map +1 -1
- package/dist/typescript/module/components/GuidonOverlay.d.ts +1 -1
- package/dist/typescript/module/components/GuidonOverlay.d.ts.map +1 -1
- package/dist/typescript/module/components/GuidonProvider.d.ts +4 -4
- package/dist/typescript/module/components/GuidonProvider.d.ts.map +1 -1
- package/dist/typescript/module/components/GuidonTooltip.d.ts +1 -1
- package/dist/typescript/module/components/GuidonTooltip.d.ts.map +1 -1
- package/dist/typescript/module/components/index.d.ts +4 -4
- package/dist/typescript/module/components/index.d.ts.map +1 -1
- package/dist/typescript/module/hooks/useGuidonRef.d.ts.map +1 -1
- package/dist/typescript/module/store.d.ts +9 -21
- package/dist/typescript/module/store.d.ts.map +1 -1
- package/dist/typescript/module/types.d.ts +7 -14
- package/dist/typescript/module/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/GuidonOverlay.tsx +28 -29
- package/src/components/GuidonProvider.tsx +46 -111
- package/src/components/GuidonTooltip.tsx +125 -91
- package/src/components/index.ts +4 -4
- package/src/hooks/useGuidonRef.ts +23 -8
- package/src/store.ts +44 -75
- package/src/types.ts +7 -14
|
@@ -1,43 +1,50 @@
|
|
|
1
|
-
import { useMemo } from
|
|
1
|
+
import { useMemo } from "react";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
Text,
|
|
5
|
-
StyleSheet,
|
|
3
|
+
ActivityIndicator,
|
|
6
4
|
Dimensions,
|
|
7
|
-
TouchableOpacity,
|
|
8
5
|
Platform,
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
StyleSheet,
|
|
7
|
+
Text,
|
|
8
|
+
TouchableOpacity,
|
|
9
|
+
View,
|
|
10
|
+
} from "react-native";
|
|
11
11
|
import Animated, {
|
|
12
|
+
Easing,
|
|
12
13
|
useAnimatedStyle,
|
|
13
|
-
withTiming,
|
|
14
14
|
withSpring,
|
|
15
|
-
|
|
16
|
-
} from
|
|
17
|
-
import { useSafeAreaInsets } from
|
|
18
|
-
import { useGuidonStore,
|
|
19
|
-
import type {
|
|
15
|
+
withTiming,
|
|
16
|
+
} from "react-native-reanimated";
|
|
17
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
18
|
+
import { useGuidonStore, useIsFloatingStep, useWaitingState } from "../store";
|
|
19
|
+
import type {
|
|
20
|
+
FloatingPosition,
|
|
21
|
+
GuidonStep,
|
|
22
|
+
GuidonStore,
|
|
23
|
+
GuidonTheme,
|
|
24
|
+
TargetMeasurements,
|
|
25
|
+
TooltipPosition,
|
|
26
|
+
} from "../types";
|
|
20
27
|
|
|
21
28
|
const DEFAULT_THEME: Required<
|
|
22
29
|
Pick<
|
|
23
30
|
GuidonTheme,
|
|
24
|
-
|
|
|
25
|
-
|
|
|
26
|
-
|
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
|
|
|
31
|
-
|
|
|
31
|
+
| "tooltipBackgroundColor"
|
|
32
|
+
| "tooltipBorderColor"
|
|
33
|
+
| "tooltipBorderRadius"
|
|
34
|
+
| "titleColor"
|
|
35
|
+
| "descriptionColor"
|
|
36
|
+
| "primaryColor"
|
|
37
|
+
| "mutedColor"
|
|
38
|
+
| "spotlightPadding"
|
|
32
39
|
>
|
|
33
40
|
> = {
|
|
34
|
-
tooltipBackgroundColor:
|
|
35
|
-
tooltipBorderColor:
|
|
41
|
+
tooltipBackgroundColor: "#ffffff",
|
|
42
|
+
tooltipBorderColor: "#e5e5e5",
|
|
36
43
|
tooltipBorderRadius: 12,
|
|
37
|
-
titleColor:
|
|
38
|
-
descriptionColor:
|
|
39
|
-
primaryColor:
|
|
40
|
-
mutedColor:
|
|
44
|
+
titleColor: "#1a1a1a",
|
|
45
|
+
descriptionColor: "#666666",
|
|
46
|
+
primaryColor: "#007AFF",
|
|
47
|
+
mutedColor: "#999999",
|
|
41
48
|
spotlightPadding: 8,
|
|
42
49
|
};
|
|
43
50
|
|
|
@@ -53,7 +60,7 @@ function calculateFloatingPosition(
|
|
|
53
60
|
screenWidth: number,
|
|
54
61
|
screenHeight: number,
|
|
55
62
|
tooltipWidth: number,
|
|
56
|
-
insets: { top: number; bottom: number; left: number; right: number }
|
|
63
|
+
insets: { top: number; bottom: number; left: number; right: number },
|
|
57
64
|
): { top: number; left: number } {
|
|
58
65
|
const MARGIN = 32;
|
|
59
66
|
|
|
@@ -61,40 +68,40 @@ function calculateFloatingPosition(
|
|
|
61
68
|
const centerY = (screenHeight - ESTIMATED_TOOLTIP_HEIGHT) / 2;
|
|
62
69
|
|
|
63
70
|
switch (floatingPosition) {
|
|
64
|
-
case
|
|
71
|
+
case "center":
|
|
65
72
|
return { top: centerY, left: centerX };
|
|
66
73
|
|
|
67
|
-
case
|
|
74
|
+
case "top":
|
|
68
75
|
return {
|
|
69
76
|
top: insets.top + MARGIN,
|
|
70
77
|
left: centerX,
|
|
71
78
|
};
|
|
72
79
|
|
|
73
|
-
case
|
|
80
|
+
case "bottom":
|
|
74
81
|
return {
|
|
75
82
|
top: screenHeight - ESTIMATED_TOOLTIP_HEIGHT - insets.bottom - MARGIN,
|
|
76
83
|
left: centerX,
|
|
77
84
|
};
|
|
78
85
|
|
|
79
|
-
case
|
|
86
|
+
case "top-left":
|
|
80
87
|
return {
|
|
81
88
|
top: insets.top + MARGIN,
|
|
82
89
|
left: MARGIN,
|
|
83
90
|
};
|
|
84
91
|
|
|
85
|
-
case
|
|
92
|
+
case "top-right":
|
|
86
93
|
return {
|
|
87
94
|
top: insets.top + MARGIN,
|
|
88
95
|
left: screenWidth - tooltipWidth - MARGIN,
|
|
89
96
|
};
|
|
90
97
|
|
|
91
|
-
case
|
|
98
|
+
case "bottom-left":
|
|
92
99
|
return {
|
|
93
100
|
top: screenHeight - ESTIMATED_TOOLTIP_HEIGHT - insets.bottom - MARGIN,
|
|
94
101
|
left: MARGIN,
|
|
95
102
|
};
|
|
96
103
|
|
|
97
|
-
case
|
|
104
|
+
case "bottom-right":
|
|
98
105
|
return {
|
|
99
106
|
top: screenHeight - ESTIMATED_TOOLTIP_HEIGHT - insets.bottom - MARGIN,
|
|
100
107
|
left: screenWidth - tooltipWidth - MARGIN,
|
|
@@ -133,27 +140,31 @@ export function GuidonTooltip({
|
|
|
133
140
|
labels = {},
|
|
134
141
|
}: GuidonTooltipProps) {
|
|
135
142
|
const insets = useSafeAreaInsets();
|
|
136
|
-
const { width: screenWidth, height: screenHeight } = Dimensions.get(
|
|
143
|
+
const { width: screenWidth, height: screenHeight } = Dimensions.get("window");
|
|
137
144
|
|
|
138
145
|
const isActive = useGuidonStore((state: GuidonStore) => state.isActive);
|
|
139
146
|
const config = useGuidonStore((state: GuidonStore) => state.config);
|
|
140
|
-
const currentStepIndex = useGuidonStore(
|
|
141
|
-
|
|
147
|
+
const currentStepIndex = useGuidonStore(
|
|
148
|
+
(state: GuidonStore) => state.currentStepIndex,
|
|
149
|
+
);
|
|
150
|
+
const targetMeasurements = useGuidonStore(
|
|
151
|
+
(state: GuidonStore) => state.targetMeasurements,
|
|
152
|
+
);
|
|
142
153
|
const storeNext = useGuidonStore((state: GuidonStore) => state.next);
|
|
143
154
|
const storePrevious = useGuidonStore((state: GuidonStore) => state.previous);
|
|
144
155
|
const storeSkip = useGuidonStore((state: GuidonStore) => state.skip);
|
|
145
156
|
|
|
146
157
|
// Wrap with logging
|
|
147
158
|
const next = () => {
|
|
148
|
-
console.log(
|
|
159
|
+
console.log("[GuidonTooltip] Next button pressed");
|
|
149
160
|
storeNext();
|
|
150
161
|
};
|
|
151
162
|
const previous = () => {
|
|
152
|
-
console.log(
|
|
163
|
+
console.log("[GuidonTooltip] Previous button pressed");
|
|
153
164
|
storePrevious();
|
|
154
165
|
};
|
|
155
166
|
const skip = () => {
|
|
156
|
-
console.log(
|
|
167
|
+
console.log("[GuidonTooltip] Skip button pressed");
|
|
157
168
|
storeSkip();
|
|
158
169
|
};
|
|
159
170
|
|
|
@@ -164,12 +175,12 @@ export function GuidonTooltip({
|
|
|
164
175
|
|
|
165
176
|
const mergedTheme = { ...DEFAULT_THEME, ...theme };
|
|
166
177
|
const mergedLabels = {
|
|
167
|
-
next: labels.next ??
|
|
168
|
-
previous: labels.previous ??
|
|
169
|
-
skip: labels.skip ??
|
|
170
|
-
finish: labels.finish ??
|
|
178
|
+
next: labels.next ?? "Next",
|
|
179
|
+
previous: labels.previous ?? "Back",
|
|
180
|
+
skip: labels.skip ?? "Skip",
|
|
181
|
+
finish: labels.finish ?? "Finish",
|
|
171
182
|
stepOf: labels.stepOf ?? ((c: number, t: number) => `${c} of ${t}`),
|
|
172
|
-
waitingDefault: labels.waitingDefault ??
|
|
183
|
+
waitingDefault: labels.waitingDefault ?? "Navigate to continue...",
|
|
173
184
|
};
|
|
174
185
|
|
|
175
186
|
const currentStep = config?.steps[currentStepIndex];
|
|
@@ -185,33 +196,37 @@ export function GuidonTooltip({
|
|
|
185
196
|
const tooltipPosition = useMemo(() => {
|
|
186
197
|
// Handle floating steps (no target element)
|
|
187
198
|
if (isFloatingStep) {
|
|
188
|
-
const floatingPos = currentStep?.floatingPosition ??
|
|
199
|
+
const floatingPos = currentStep?.floatingPosition ?? "center";
|
|
189
200
|
return calculateFloatingPosition(
|
|
190
201
|
floatingPos,
|
|
191
202
|
screenWidth,
|
|
192
203
|
screenHeight,
|
|
193
204
|
TOOLTIP_WIDTH,
|
|
194
|
-
insets
|
|
205
|
+
insets,
|
|
195
206
|
);
|
|
196
207
|
}
|
|
197
208
|
|
|
198
|
-
// Handle waiting state or no measurements - center the tooltip
|
|
199
209
|
if (!measurements) {
|
|
200
|
-
return {
|
|
210
|
+
return {
|
|
211
|
+
top: screenHeight / 2 - ESTIMATED_TOOLTIP_HEIGHT / 2,
|
|
212
|
+
left: screenWidth / 2 - TOOLTIP_WIDTH / 2,
|
|
213
|
+
};
|
|
201
214
|
}
|
|
202
215
|
|
|
203
|
-
const targetBottom =
|
|
216
|
+
const targetBottom =
|
|
217
|
+
measurements.y + measurements.height + mergedTheme.spotlightPadding;
|
|
204
218
|
const targetTop = measurements.y - mergedTheme.spotlightPadding;
|
|
205
219
|
|
|
206
220
|
// Determine preferred position
|
|
207
|
-
let position: TooltipPosition = currentStep?.tooltipPosition ??
|
|
221
|
+
let position: TooltipPosition = currentStep?.tooltipPosition ?? "auto";
|
|
208
222
|
|
|
209
|
-
if (position ===
|
|
223
|
+
if (position === "auto") {
|
|
210
224
|
// Auto-detect best position
|
|
211
225
|
const spaceAbove = targetTop - insets.top;
|
|
212
226
|
const spaceBelow = screenHeight - targetBottom - insets.bottom;
|
|
213
227
|
|
|
214
|
-
position =
|
|
228
|
+
position =
|
|
229
|
+
spaceBelow >= 200 ? "bottom" : spaceAbove >= 200 ? "top" : "bottom";
|
|
215
230
|
}
|
|
216
231
|
|
|
217
232
|
let top: number;
|
|
@@ -219,25 +234,36 @@ export function GuidonTooltip({
|
|
|
219
234
|
TOOLTIP_MARGIN,
|
|
220
235
|
Math.min(
|
|
221
236
|
measurements.x + measurements.width / 2 - TOOLTIP_WIDTH / 2,
|
|
222
|
-
screenWidth - TOOLTIP_WIDTH - TOOLTIP_MARGIN
|
|
223
|
-
)
|
|
237
|
+
screenWidth - TOOLTIP_WIDTH - TOOLTIP_MARGIN,
|
|
238
|
+
),
|
|
224
239
|
);
|
|
225
240
|
|
|
226
|
-
if (position ===
|
|
227
|
-
top = targetTop - TOOLTIP_MARGIN - 150; //
|
|
241
|
+
if (position === "top") {
|
|
242
|
+
top = targetTop - TOOLTIP_MARGIN - 150; // Estimated height
|
|
228
243
|
} else {
|
|
229
244
|
top = targetBottom + TOOLTIP_MARGIN;
|
|
230
245
|
}
|
|
231
246
|
|
|
232
247
|
// Ensure tooltip is within screen bounds
|
|
233
|
-
top = Math.max(
|
|
248
|
+
top = Math.max(
|
|
249
|
+
insets.top + TOOLTIP_MARGIN,
|
|
250
|
+
Math.min(top, screenHeight - 200 - insets.bottom),
|
|
251
|
+
);
|
|
234
252
|
|
|
235
253
|
return { top, left, position };
|
|
236
|
-
}, [
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
254
|
+
}, [
|
|
255
|
+
measurements,
|
|
256
|
+
screenWidth,
|
|
257
|
+
screenHeight,
|
|
258
|
+
insets,
|
|
259
|
+
currentStep?.tooltipPosition,
|
|
260
|
+
currentStep?.floatingPosition,
|
|
261
|
+
mergedTheme.spotlightPadding,
|
|
262
|
+
isFloatingStep,
|
|
263
|
+
]);
|
|
264
|
+
|
|
265
|
+
const shouldShowTooltip =
|
|
266
|
+
isActive && currentStep && (measurements || isFloatingStep || isWaiting);
|
|
241
267
|
|
|
242
268
|
// Animated styles
|
|
243
269
|
const animatedStyle = useAnimatedStyle(() => {
|
|
@@ -280,7 +306,12 @@ export function GuidonTooltip({
|
|
|
280
306
|
>
|
|
281
307
|
<View style={styles.waitingContainer}>
|
|
282
308
|
<ActivityIndicator color={mergedTheme.primaryColor} />
|
|
283
|
-
<Text
|
|
309
|
+
<Text
|
|
310
|
+
style={[
|
|
311
|
+
styles.waitingText,
|
|
312
|
+
{ color: mergedTheme.descriptionColor },
|
|
313
|
+
]}
|
|
314
|
+
>
|
|
284
315
|
{waitingState?.message || mergedLabels.waitingDefault}
|
|
285
316
|
</Text>
|
|
286
317
|
</View>
|
|
@@ -293,7 +324,6 @@ export function GuidonTooltip({
|
|
|
293
324
|
);
|
|
294
325
|
}
|
|
295
326
|
|
|
296
|
-
// For non-floating steps, we need measurements
|
|
297
327
|
if (!isFloatingStep && !measurements) {
|
|
298
328
|
return null;
|
|
299
329
|
}
|
|
@@ -340,7 +370,6 @@ export function GuidonTooltip({
|
|
|
340
370
|
animatedStyle,
|
|
341
371
|
]}
|
|
342
372
|
>
|
|
343
|
-
{/* Progress indicator */}
|
|
344
373
|
<View style={styles.progressContainer}>
|
|
345
374
|
<Text style={[styles.progressText, { color: mergedTheme.mutedColor }]}>
|
|
346
375
|
{mergedLabels.stepOf(currentStepIndex + 1, totalSteps)}
|
|
@@ -364,18 +393,18 @@ export function GuidonTooltip({
|
|
|
364
393
|
</View>
|
|
365
394
|
</View>
|
|
366
395
|
|
|
367
|
-
{/* Content */}
|
|
368
396
|
<View style={styles.content}>
|
|
369
397
|
<Text style={[styles.title, { color: mergedTheme.titleColor }]}>
|
|
370
398
|
{currentStep.title}
|
|
371
399
|
</Text>
|
|
372
|
-
<Text
|
|
400
|
+
<Text
|
|
401
|
+
style={[styles.description, { color: mergedTheme.descriptionColor }]}
|
|
402
|
+
>
|
|
373
403
|
{currentStep.description}
|
|
374
404
|
</Text>
|
|
375
405
|
{currentStep.customContent}
|
|
376
406
|
</View>
|
|
377
407
|
|
|
378
|
-
{/* Navigation buttons */}
|
|
379
408
|
<View style={styles.buttonContainer}>
|
|
380
409
|
<TouchableOpacity onPress={skip} style={styles.skipButton}>
|
|
381
410
|
<Text style={[styles.skipText, { color: mergedTheme.mutedColor }]}>
|
|
@@ -389,7 +418,12 @@ export function GuidonTooltip({
|
|
|
389
418
|
onPress={previous}
|
|
390
419
|
style={[styles.navButton, styles.backButton]}
|
|
391
420
|
>
|
|
392
|
-
<Text
|
|
421
|
+
<Text
|
|
422
|
+
style={[
|
|
423
|
+
styles.backButtonText,
|
|
424
|
+
{ color: mergedTheme.primaryColor },
|
|
425
|
+
]}
|
|
426
|
+
>
|
|
393
427
|
{mergedLabels.previous}
|
|
394
428
|
</Text>
|
|
395
429
|
</TouchableOpacity>
|
|
@@ -414,13 +448,13 @@ export function GuidonTooltip({
|
|
|
414
448
|
|
|
415
449
|
const styles = StyleSheet.create({
|
|
416
450
|
tooltipContainer: {
|
|
417
|
-
position:
|
|
451
|
+
position: "absolute",
|
|
418
452
|
zIndex: 1000,
|
|
419
453
|
borderWidth: 1,
|
|
420
454
|
padding: 16,
|
|
421
455
|
...Platform.select({
|
|
422
456
|
ios: {
|
|
423
|
-
shadowColor:
|
|
457
|
+
shadowColor: "#000",
|
|
424
458
|
shadowOffset: { width: 0, height: 4 },
|
|
425
459
|
shadowOpacity: 0.15,
|
|
426
460
|
shadowRadius: 12,
|
|
@@ -429,22 +463,22 @@ const styles = StyleSheet.create({
|
|
|
429
463
|
elevation: 8,
|
|
430
464
|
},
|
|
431
465
|
web: {
|
|
432
|
-
boxShadow:
|
|
466
|
+
boxShadow: "0 4px 12px rgba(0, 0, 0, 0.15)",
|
|
433
467
|
} as any,
|
|
434
468
|
}),
|
|
435
469
|
},
|
|
436
470
|
progressContainer: {
|
|
437
|
-
flexDirection:
|
|
438
|
-
alignItems:
|
|
439
|
-
justifyContent:
|
|
471
|
+
flexDirection: "row",
|
|
472
|
+
alignItems: "center",
|
|
473
|
+
justifyContent: "space-between",
|
|
440
474
|
marginBottom: 12,
|
|
441
475
|
},
|
|
442
476
|
progressText: {
|
|
443
477
|
fontSize: 12,
|
|
444
|
-
fontWeight:
|
|
478
|
+
fontWeight: "500",
|
|
445
479
|
},
|
|
446
480
|
progressDots: {
|
|
447
|
-
flexDirection:
|
|
481
|
+
flexDirection: "row",
|
|
448
482
|
gap: 4,
|
|
449
483
|
},
|
|
450
484
|
progressDot: {
|
|
@@ -457,7 +491,7 @@ const styles = StyleSheet.create({
|
|
|
457
491
|
},
|
|
458
492
|
title: {
|
|
459
493
|
fontSize: 18,
|
|
460
|
-
fontWeight:
|
|
494
|
+
fontWeight: "600",
|
|
461
495
|
marginBottom: 8,
|
|
462
496
|
},
|
|
463
497
|
description: {
|
|
@@ -465,9 +499,9 @@ const styles = StyleSheet.create({
|
|
|
465
499
|
lineHeight: 20,
|
|
466
500
|
},
|
|
467
501
|
buttonContainer: {
|
|
468
|
-
flexDirection:
|
|
469
|
-
alignItems:
|
|
470
|
-
justifyContent:
|
|
502
|
+
flexDirection: "row",
|
|
503
|
+
alignItems: "center",
|
|
504
|
+
justifyContent: "space-between",
|
|
471
505
|
},
|
|
472
506
|
skipButton: {
|
|
473
507
|
paddingVertical: 8,
|
|
@@ -477,7 +511,7 @@ const styles = StyleSheet.create({
|
|
|
477
511
|
fontSize: 14,
|
|
478
512
|
},
|
|
479
513
|
navButtons: {
|
|
480
|
-
flexDirection:
|
|
514
|
+
flexDirection: "row",
|
|
481
515
|
gap: 8,
|
|
482
516
|
},
|
|
483
517
|
navButton: {
|
|
@@ -486,22 +520,22 @@ const styles = StyleSheet.create({
|
|
|
486
520
|
borderRadius: 8,
|
|
487
521
|
},
|
|
488
522
|
backButton: {
|
|
489
|
-
backgroundColor:
|
|
523
|
+
backgroundColor: "transparent",
|
|
490
524
|
},
|
|
491
525
|
backButtonText: {
|
|
492
526
|
fontSize: 14,
|
|
493
|
-
fontWeight:
|
|
527
|
+
fontWeight: "600",
|
|
494
528
|
},
|
|
495
529
|
nextButton: {},
|
|
496
530
|
nextButtonText: {
|
|
497
|
-
color:
|
|
531
|
+
color: "#ffffff",
|
|
498
532
|
fontSize: 14,
|
|
499
|
-
fontWeight:
|
|
533
|
+
fontWeight: "600",
|
|
500
534
|
},
|
|
501
535
|
waitingContainer: {
|
|
502
|
-
flexDirection:
|
|
503
|
-
alignItems:
|
|
504
|
-
justifyContent:
|
|
536
|
+
flexDirection: "row",
|
|
537
|
+
alignItems: "center",
|
|
538
|
+
justifyContent: "center",
|
|
505
539
|
gap: 12,
|
|
506
540
|
paddingVertical: 8,
|
|
507
541
|
marginBottom: 12,
|
package/src/components/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
1
|
+
export { GuidonOverlay } from "./GuidonOverlay";
|
|
2
|
+
export { GuidonProvider, useGuidonContext } from "./GuidonProvider";
|
|
3
|
+
export { GuidonTarget } from "./GuidonTarget";
|
|
4
|
+
export { GuidonTooltip } from "./GuidonTooltip";
|
|
@@ -51,10 +51,16 @@ export function useGuidonRegister() {
|
|
|
51
51
|
|
|
52
52
|
const measure = useCallback(
|
|
53
53
|
(targetId: string, node: MeasurableElement | null) => {
|
|
54
|
-
console.log(
|
|
54
|
+
console.log("[useGuidon] measure() called for:", targetId, {
|
|
55
|
+
hasNode: !!node,
|
|
56
|
+
isActive,
|
|
57
|
+
hasConfig: !!config,
|
|
58
|
+
});
|
|
55
59
|
|
|
56
60
|
if (!node || !isActive || !config) {
|
|
57
|
-
console.log(
|
|
61
|
+
console.log(
|
|
62
|
+
"[useGuidon] measure() early return - missing node, inactive, or no config",
|
|
63
|
+
);
|
|
58
64
|
return;
|
|
59
65
|
}
|
|
60
66
|
|
|
@@ -63,11 +69,14 @@ export function useGuidonRegister() {
|
|
|
63
69
|
);
|
|
64
70
|
|
|
65
71
|
if (!isTargetUsed) {
|
|
66
|
-
console.log(
|
|
72
|
+
console.log(
|
|
73
|
+
"[useGuidon] measure() - target not in config steps:",
|
|
74
|
+
targetId,
|
|
75
|
+
);
|
|
67
76
|
return;
|
|
68
77
|
}
|
|
69
78
|
|
|
70
|
-
console.log(
|
|
79
|
+
console.log("[useGuidon] measure() - proceeding to measure:", targetId);
|
|
71
80
|
|
|
72
81
|
if (Platform.OS === "web") {
|
|
73
82
|
const el = node as unknown as HTMLElement;
|
|
@@ -95,7 +104,11 @@ export function useGuidonRegister() {
|
|
|
95
104
|
height:
|
|
96
105
|
rect.height - paddingTop - paddingBottom - borderTop - borderBottom,
|
|
97
106
|
};
|
|
98
|
-
console.log(
|
|
107
|
+
console.log(
|
|
108
|
+
"[useGuidon] Registering web target:",
|
|
109
|
+
targetId,
|
|
110
|
+
measurements,
|
|
111
|
+
);
|
|
99
112
|
registerTarget(targetId, measurements);
|
|
100
113
|
|
|
101
114
|
return;
|
|
@@ -144,12 +157,14 @@ export function useGuidonRegister() {
|
|
|
144
157
|
useEffect(() => {
|
|
145
158
|
if (!isActive || !config) return;
|
|
146
159
|
|
|
147
|
-
console.log(
|
|
148
|
-
|
|
160
|
+
console.log(
|
|
161
|
+
"[useGuidon] Effect triggered - measuring all targets in this instance:",
|
|
162
|
+
Array.from(elementsRef.current.keys()),
|
|
163
|
+
);
|
|
149
164
|
|
|
150
165
|
// Measure all targets registered in this hook instance
|
|
151
166
|
elementsRef.current.forEach((node, id) => {
|
|
152
|
-
console.log(
|
|
167
|
+
console.log("[useGuidon] Scheduling measurement for:", id);
|
|
153
168
|
requestAnimationFrame(() => {
|
|
154
169
|
measure(id, node);
|
|
155
170
|
});
|