@robertlinde/react-tour-kit 0.8.2 → 0.8.4

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 cutoutTop = highlightRect.top - highlightPadding;
8
- const cutoutLeft = highlightRect.left - highlightPadding;
9
- const cutoutWidth = highlightRect.width + highlightPadding * 2;
10
- const cutoutHeight = highlightRect.height + highlightPadding * 2;
11
- const themedStyles = useMemo(() => ({
12
- overlay: {
13
- backgroundColor: theme.overlayColor,
14
- },
15
- highlightBorder: {
16
- borderColor: theme.primaryColor,
17
- },
18
- }), [theme]);
19
- const overlayContent = (_jsxs(View, { style: styles.container, children: [_jsx(View, { style: [
20
- styles.overlay,
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":";AAAA,OAAO,EAAiB,OAAO,EAAC,MAAM,OAAO,CAAC;AAI9C,MAAM,EAAC,IAAI,EAAE,UAAU,EAAE,wBAAwB,EAAC,GAAG,OAAO,CAAC,cAAc,CAAkC,CAAC;AAE9G,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAC3B,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAMhC,MAAM,UAAU,WAAW,CAAC,E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CAAC,YAC7E,KAAC,IAAI,IAAC,KAAK,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,GAAI,IADpE,CAAC,CAEL,CACR,CAAC,EAGF,KAAC,IAAI,IACH,KAAK,EAAE;oBACL,MAAM,CAAC,eAAe;oBACtB,YAAY,CAAC,eAAe;oBAC5B;wBACE,GAAG,EAAE,SAAS;wBACd,IAAI,EAAE,UAAU;wBAChB,KAAK,EAAE,WAAW;wBAClB,MAAM,EAAE,YAAY;wBACpB,YAAY,EAAE,qBAAqB;qBACpC;iBACF,GACD,IACG,CACR,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;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,GAAG,UAAU,CAAC,YAAY;KAC3B;IACD,OAAO,EAAE;QACP,QAAQ,EAAE,UAAU;KACrB;IACD,eAAe,EAAE;QACf,QAAQ,EAAE,UAAU;QACpB,WAAW,EAAE,CAAC;QACd,eAAe,EAAE,aAAa;KAC/B;IACD,WAAW,EAAE;QACX,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,qBAAqB;QAC5B,MAAM,EAAE,qBAAqB;QAC7B,QAAQ,EAAE,QAAQ;KACnB;IACD,UAAU,EAAE;QACV,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,qBAAqB,GAAG,CAAC;QAChC,MAAM,EAAE,qBAAqB,GAAG,CAAC;KAClC;CACF,CAAC,CAAC"}
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,O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AAC,CAAC,EAAC,GAAG,EAAC,KAAK,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,EAAC,IAAI,EAAE,KAAK,CAAC,YAAY,EAAE,IAAI,EAAC,iBAAiB,GAAG,IAC5F,EAEN,KAAC,IAAI,IACH,aAAa,EAAC,MAAM,EACpB,KAAK,EAAE;oBACL,QAAQ,EAAE,UAAU;oBACpB,GAAG,EAAE,CAAC;oBACN,IAAI,EAAE,CAAC;oBACP,KAAK;oBACL,MAAM;oBACN,YAAY,EAAE,qBAAqB;oBACnC,WAAW,EAAE,CAAC;oBACd,WAAW,EAAE,KAAK,CAAC,YAAY;iBAChC,GACD,IACG,CACR,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.2",
3
+ "version": "0.8.4",
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.3",
64
- "@commitlint/config-conventional": "20.5.3",
67
+ "@commitlint/cli": "21.0.0",
68
+ "@commitlint/config-conventional": "21.0.0",
65
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": "17.0.2",
75
+ "lint-staged": "17.0.3",
72
76
  "prettier": "3.8.3",
73
- "react": "19.2.5",
74
- "react-dom": "19.2.5",
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
  },