@robertlinde/react-tour-kit 0.8.1 → 0.8.3
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
CHANGED
|
@@ -20,6 +20,16 @@ Cross-platform guided tour library for React and React Native. Build interactive
|
|
|
20
20
|
npm install @robertlinde/react-tour-kit
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
+
For React Native, the default overlay also requires `react-native-svg`:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install react-native-svg
|
|
27
|
+
# or, with Expo:
|
|
28
|
+
npx expo install react-native-svg
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
(Not needed if you're using web only, or if you provide a custom `OverlayComponent`.)
|
|
32
|
+
|
|
23
33
|
## Live Demos
|
|
24
34
|
|
|
25
35
|
Try the demos locally:
|
|
@@ -1,116 +1,26 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo } from 'react';
|
|
3
2
|
const { View, StyleSheet, TouchableWithoutFeedback } = require('react-native');
|
|
3
|
+
const { default: Svg, Defs, Mask, Rect } = require('react-native-svg');
|
|
4
4
|
const highlightPadding = 8;
|
|
5
5
|
const highlightBorderRadius = 8;
|
|
6
6
|
export function TourOverlay({ highlightRect, onClose, theme, closeOnOverlayClick }) {
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
themedStyles.overlay,
|
|
22
|
-
{
|
|
23
|
-
top: 0,
|
|
24
|
-
left: 0,
|
|
25
|
-
right: 0,
|
|
26
|
-
height: cutoutTop,
|
|
27
|
-
},
|
|
28
|
-
] }), _jsx(View, { style: [
|
|
29
|
-
styles.overlay,
|
|
30
|
-
themedStyles.overlay,
|
|
31
|
-
{
|
|
32
|
-
top: cutoutTop,
|
|
33
|
-
left: 0,
|
|
34
|
-
width: cutoutLeft,
|
|
35
|
-
height: cutoutHeight,
|
|
36
|
-
},
|
|
37
|
-
] }), _jsx(View, { style: [
|
|
38
|
-
styles.overlay,
|
|
39
|
-
themedStyles.overlay,
|
|
40
|
-
{
|
|
41
|
-
top: cutoutTop,
|
|
42
|
-
left: cutoutLeft + cutoutWidth,
|
|
43
|
-
right: 0,
|
|
44
|
-
height: cutoutHeight,
|
|
45
|
-
},
|
|
46
|
-
] }), _jsx(View, { style: [
|
|
47
|
-
styles.overlay,
|
|
48
|
-
themedStyles.overlay,
|
|
49
|
-
{
|
|
50
|
-
top: cutoutTop + cutoutHeight,
|
|
51
|
-
left: 0,
|
|
52
|
-
right: 0,
|
|
53
|
-
bottom: 0,
|
|
54
|
-
},
|
|
55
|
-
] }), [
|
|
56
|
-
{
|
|
57
|
-
top: cutoutTop,
|
|
58
|
-
left: cutoutLeft,
|
|
59
|
-
childStyle: { bottom: 0, right: 0, borderBottomRightRadius: highlightBorderRadius },
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
top: cutoutTop,
|
|
63
|
-
left: cutoutLeft + cutoutWidth - highlightBorderRadius,
|
|
64
|
-
childStyle: { bottom: 0, left: 0, borderBottomLeftRadius: highlightBorderRadius },
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
top: cutoutTop + cutoutHeight - highlightBorderRadius,
|
|
68
|
-
left: cutoutLeft,
|
|
69
|
-
childStyle: { top: 0, right: 0, borderTopRightRadius: highlightBorderRadius },
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
top: cutoutTop + cutoutHeight - highlightBorderRadius,
|
|
73
|
-
left: cutoutLeft + cutoutWidth - highlightBorderRadius,
|
|
74
|
-
childStyle: { top: 0, left: 0, borderTopLeftRadius: highlightBorderRadius },
|
|
75
|
-
},
|
|
76
|
-
].map((corner, i) => (_jsx(View, { style: [styles.cornerPatch, { top: corner.top, left: corner.left }], children: _jsx(View, { style: [styles.cornerFill, themedStyles.overlay, corner.childStyle] }) }, i))), _jsx(View, { style: [
|
|
77
|
-
styles.highlightBorder,
|
|
78
|
-
themedStyles.highlightBorder,
|
|
79
|
-
{
|
|
80
|
-
top: cutoutTop,
|
|
81
|
-
left: cutoutLeft,
|
|
82
|
-
width: cutoutWidth,
|
|
83
|
-
height: cutoutHeight,
|
|
84
|
-
borderRadius: highlightBorderRadius,
|
|
85
|
-
},
|
|
86
|
-
] })] }));
|
|
7
|
+
const x = highlightRect.left - highlightPadding;
|
|
8
|
+
const y = highlightRect.top - highlightPadding;
|
|
9
|
+
const width = highlightRect.width + highlightPadding * 2;
|
|
10
|
+
const height = highlightRect.height + highlightPadding * 2;
|
|
11
|
+
const overlayContent = (_jsxs(View, { style: StyleSheet.absoluteFill, pointerEvents: closeOnOverlayClick ? 'auto' : 'none', children: [_jsxs(Svg, { style: StyleSheet.absoluteFill, children: [_jsx(Defs, { children: _jsxs(Mask, { id: "tour-mask", children: [_jsx(Rect, { x: "0", y: "0", width: "100%", height: "100%", fill: "white" }), _jsx(Rect, { x: x, y: y, width: width, height: height, rx: highlightBorderRadius, fill: "black" })] }) }), _jsx(Rect, { x: "0", y: "0", width: "100%", height: "100%", fill: theme.overlayColor, mask: "url(#tour-mask)" })] }), _jsx(View, { pointerEvents: "none", style: {
|
|
12
|
+
position: 'absolute',
|
|
13
|
+
top: y,
|
|
14
|
+
left: x,
|
|
15
|
+
width,
|
|
16
|
+
height,
|
|
17
|
+
borderRadius: highlightBorderRadius,
|
|
18
|
+
borderWidth: 2,
|
|
19
|
+
borderColor: theme.primaryColor,
|
|
20
|
+
} })] }));
|
|
87
21
|
if (closeOnOverlayClick) {
|
|
88
22
|
return _jsx(TouchableWithoutFeedback, { onPress: onClose, children: overlayContent });
|
|
89
23
|
}
|
|
90
24
|
return overlayContent;
|
|
91
25
|
}
|
|
92
|
-
const styles = StyleSheet.create({
|
|
93
|
-
container: {
|
|
94
|
-
...StyleSheet.absoluteFill,
|
|
95
|
-
},
|
|
96
|
-
overlay: {
|
|
97
|
-
position: 'absolute',
|
|
98
|
-
},
|
|
99
|
-
highlightBorder: {
|
|
100
|
-
position: 'absolute',
|
|
101
|
-
borderWidth: 2,
|
|
102
|
-
backgroundColor: 'transparent',
|
|
103
|
-
},
|
|
104
|
-
cornerPatch: {
|
|
105
|
-
position: 'absolute',
|
|
106
|
-
width: highlightBorderRadius,
|
|
107
|
-
height: highlightBorderRadius,
|
|
108
|
-
overflow: 'hidden',
|
|
109
|
-
},
|
|
110
|
-
cornerFill: {
|
|
111
|
-
position: 'absolute',
|
|
112
|
-
width: highlightBorderRadius * 2,
|
|
113
|
-
height: highlightBorderRadius * 2,
|
|
114
|
-
},
|
|
115
|
-
});
|
|
116
26
|
//# sourceMappingURL=tour-overlay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tour-overlay.js","sourceRoot":"","sources":["../../../src/react-native-platform/components/tour-overlay.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"tour-overlay.js","sourceRoot":"","sources":["../../../src/react-native-platform/components/tour-overlay.tsx"],"names":[],"mappings":";AAGA,MAAM,EAAC,IAAI,EAAE,UAAU,EAAE,wBAAwB,EAAC,GAAG,OAAO,CAAC,cAAc,CAAkC,CAAC;AAC9G,MAAM,EAAC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAC,GAAG,OAAO,CAAC,kBAAkB,CAAsC,CAAC;AAE1G,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAC3B,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAMhC,MAAM,UAAU,WAAW,CAAC,EAAC,aAAa,EAAE,OAAO,EAAE,KAAK,EAAE,mBAAmB,EAAmB;IAChG,MAAM,CAAC,GAAG,aAAa,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAChD,MAAM,CAAC,GAAG,aAAa,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ACR,CAAC;IAEF,IAAI,mBAAmB,EAAE,CAAC;QACxB,OAAO,KAAC,wBAAwB,IAAC,OAAO,EAAE,OAAO,YAAG,cAAc,GAA4B,CAAC;IACjG,CAAC;IAED,OAAO,cAAc,CAAC;AACxB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@robertlinde/react-tour-kit",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Cross-platform guided tour library for React and React Native. Build interactive onboarding experiences with customizable tooltips, smart positioning, cross-page navigation, and async step actions. Fully themeable with TypeScript support.",
|
|
6
6
|
"author": "Robert Linde",
|
|
@@ -49,7 +49,8 @@
|
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"react": "^18.0.0 || ^19.0.0",
|
|
51
51
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
52
|
-
"react-native": ">=0.70.0"
|
|
52
|
+
"react-native": ">=0.70.0",
|
|
53
|
+
"react-native-svg": ">=13.0.0"
|
|
53
54
|
},
|
|
54
55
|
"peerDependenciesMeta": {
|
|
55
56
|
"react-dom": {
|
|
@@ -57,21 +58,25 @@
|
|
|
57
58
|
},
|
|
58
59
|
"react-native": {
|
|
59
60
|
"optional": true
|
|
61
|
+
},
|
|
62
|
+
"react-native-svg": {
|
|
63
|
+
"optional": true
|
|
60
64
|
}
|
|
61
65
|
},
|
|
62
66
|
"devDependencies": {
|
|
63
|
-
"@commitlint/cli": "20.5.
|
|
64
|
-
"@commitlint/config-conventional": "20.5.
|
|
65
|
-
"@estruyf/github-actions-reporter": "1.
|
|
67
|
+
"@commitlint/cli": "20.5.3",
|
|
68
|
+
"@commitlint/config-conventional": "20.5.3",
|
|
69
|
+
"@estruyf/github-actions-reporter": "1.12.0",
|
|
66
70
|
"@playwright/test": "1.59.1",
|
|
67
71
|
"@types/react": "19.2.14",
|
|
68
72
|
"@types/react-dom": "19.2.3",
|
|
69
73
|
"@types/react-native": "0.73.0",
|
|
70
74
|
"husky": "9.1.7",
|
|
71
|
-
"lint-staged": "
|
|
75
|
+
"lint-staged": "17.0.2",
|
|
72
76
|
"prettier": "3.8.3",
|
|
73
|
-
"react": "19.2.
|
|
74
|
-
"react-dom": "19.2.
|
|
77
|
+
"react": "19.2.6",
|
|
78
|
+
"react-dom": "19.2.6",
|
|
79
|
+
"react-native-svg": "^15.15.4",
|
|
75
80
|
"typescript": "6.0.3",
|
|
76
81
|
"xo": "2.0.2"
|
|
77
82
|
},
|