@korsolutions/guidon 1.0.1 → 1.0.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.
Files changed (143) hide show
  1. package/dist/commonjs/babel.config.js +15 -0
  2. package/dist/commonjs/babel.config.js.map +1 -0
  3. package/dist/commonjs/bob.config.js +11 -0
  4. package/dist/commonjs/bob.config.js.map +1 -0
  5. package/dist/commonjs/components/GuidonOverlay.js +206 -0
  6. package/dist/commonjs/components/GuidonOverlay.js.map +1 -0
  7. package/dist/commonjs/components/GuidonProvider.js +157 -0
  8. package/dist/commonjs/components/GuidonProvider.js.map +1 -0
  9. package/dist/commonjs/components/GuidonTarget.js +110 -0
  10. package/dist/commonjs/components/GuidonTarget.js.map +1 -0
  11. package/dist/commonjs/components/GuidonTooltip.js +422 -0
  12. package/dist/commonjs/components/GuidonTooltip.js.map +1 -0
  13. package/dist/commonjs/components/index.js +40 -0
  14. package/dist/commonjs/components/index.js.map +1 -0
  15. package/dist/commonjs/hooks/index.js +13 -0
  16. package/dist/commonjs/hooks/index.js.map +1 -0
  17. package/dist/commonjs/hooks/useGuidonRef.js +132 -0
  18. package/dist/commonjs/hooks/useGuidonRef.js.map +1 -0
  19. package/dist/commonjs/index.js +143 -0
  20. package/dist/commonjs/index.js.map +1 -0
  21. package/dist/commonjs/package.json +1 -0
  22. package/dist/commonjs/persistence/adapters.js +213 -0
  23. package/dist/commonjs/persistence/adapters.js.map +1 -0
  24. package/dist/commonjs/persistence/hooks.js +153 -0
  25. package/dist/commonjs/persistence/hooks.js.map +1 -0
  26. package/dist/commonjs/persistence/index.js +28 -0
  27. package/dist/commonjs/persistence/index.js.map +1 -0
  28. package/dist/commonjs/store.js +314 -0
  29. package/dist/commonjs/store.js.map +1 -0
  30. package/dist/commonjs/tsconfig.json +32 -0
  31. package/dist/commonjs/types.js +6 -0
  32. package/dist/commonjs/types.js.map +1 -0
  33. package/dist/module/babel.config.js +15 -0
  34. package/dist/module/babel.config.js.map +1 -0
  35. package/dist/module/bob.config.js +11 -0
  36. package/dist/module/bob.config.js.map +1 -0
  37. package/dist/module/components/GuidonOverlay.js +201 -0
  38. package/dist/module/components/GuidonOverlay.js.map +1 -0
  39. package/dist/module/components/GuidonProvider.js +152 -0
  40. package/dist/module/components/GuidonProvider.js.map +1 -0
  41. package/dist/module/components/GuidonTarget.js +106 -0
  42. package/dist/module/components/GuidonTarget.js.map +1 -0
  43. package/dist/module/components/GuidonTooltip.js +417 -0
  44. package/dist/module/components/GuidonTooltip.js.map +1 -0
  45. package/dist/module/components/index.js +7 -0
  46. package/dist/module/components/index.js.map +1 -0
  47. package/dist/module/hooks/index.js +4 -0
  48. package/dist/module/hooks/index.js.map +1 -0
  49. package/dist/module/hooks/useGuidonRef.js +129 -0
  50. package/dist/module/hooks/useGuidonRef.js.map +1 -0
  51. package/dist/module/index.js +17 -0
  52. package/dist/module/index.js.map +1 -0
  53. package/dist/module/package.json +1 -0
  54. package/dist/module/persistence/adapters.js +203 -0
  55. package/dist/module/persistence/adapters.js.map +1 -0
  56. package/dist/module/persistence/hooks.js +148 -0
  57. package/dist/module/persistence/hooks.js.map +1 -0
  58. package/dist/module/persistence/index.js +5 -0
  59. package/dist/module/persistence/index.js.map +1 -0
  60. package/dist/module/store.js +304 -0
  61. package/dist/module/store.js.map +1 -0
  62. package/dist/module/tsconfig.json +32 -0
  63. package/dist/module/types.js +4 -0
  64. package/dist/module/types.js.map +1 -0
  65. package/dist/typescript/commonjs/components/GuidonOverlay.d.ts +9 -0
  66. package/dist/typescript/commonjs/components/GuidonOverlay.d.ts.map +1 -0
  67. package/dist/typescript/commonjs/components/GuidonProvider.d.ts +14 -0
  68. package/dist/typescript/commonjs/components/GuidonProvider.d.ts.map +1 -0
  69. package/dist/typescript/commonjs/components/GuidonTarget.d.ts +7 -0
  70. package/dist/typescript/commonjs/components/GuidonTarget.d.ts.map +1 -0
  71. package/dist/typescript/commonjs/components/GuidonTooltip.d.ts +24 -0
  72. package/dist/typescript/commonjs/components/GuidonTooltip.d.ts.map +1 -0
  73. package/dist/typescript/commonjs/components/index.d.ts +5 -0
  74. package/dist/typescript/commonjs/components/index.d.ts.map +1 -0
  75. package/dist/typescript/commonjs/hooks/index.d.ts +2 -0
  76. package/dist/typescript/commonjs/hooks/index.d.ts.map +1 -0
  77. package/dist/typescript/commonjs/hooks/useGuidonRef.d.ts +35 -0
  78. package/dist/typescript/commonjs/hooks/useGuidonRef.d.ts.map +1 -0
  79. package/dist/typescript/commonjs/index.d.ts +7 -0
  80. package/dist/typescript/commonjs/index.d.ts.map +1 -0
  81. package/dist/typescript/commonjs/package.json +1 -0
  82. package/dist/typescript/commonjs/persistence/adapters.d.ts +57 -0
  83. package/dist/typescript/commonjs/persistence/adapters.d.ts.map +1 -0
  84. package/dist/typescript/commonjs/persistence/hooks.d.ts +29 -0
  85. package/dist/typescript/commonjs/persistence/hooks.d.ts.map +1 -0
  86. package/dist/typescript/commonjs/persistence/index.d.ts +3 -0
  87. package/dist/typescript/commonjs/persistence/index.d.ts.map +1 -0
  88. package/dist/typescript/commonjs/store.d.ts +89 -0
  89. package/dist/typescript/commonjs/store.d.ts.map +1 -0
  90. package/dist/{index-D_JFvCIg.d.mts → typescript/commonjs/types.d.ts} +40 -104
  91. package/dist/typescript/commonjs/types.d.ts.map +1 -0
  92. package/dist/typescript/module/components/GuidonOverlay.d.ts +9 -0
  93. package/dist/typescript/module/components/GuidonOverlay.d.ts.map +1 -0
  94. package/dist/typescript/module/components/GuidonProvider.d.ts +14 -0
  95. package/dist/typescript/module/components/GuidonProvider.d.ts.map +1 -0
  96. package/dist/typescript/module/components/GuidonTarget.d.ts +7 -0
  97. package/dist/typescript/module/components/GuidonTarget.d.ts.map +1 -0
  98. package/dist/typescript/module/components/GuidonTooltip.d.ts +24 -0
  99. package/dist/typescript/module/components/GuidonTooltip.d.ts.map +1 -0
  100. package/dist/typescript/module/components/index.d.ts +5 -0
  101. package/dist/typescript/module/components/index.d.ts.map +1 -0
  102. package/dist/typescript/module/hooks/index.d.ts +2 -0
  103. package/dist/typescript/module/hooks/index.d.ts.map +1 -0
  104. package/dist/typescript/module/hooks/useGuidonRef.d.ts +35 -0
  105. package/dist/typescript/module/hooks/useGuidonRef.d.ts.map +1 -0
  106. package/dist/typescript/module/index.d.ts +7 -0
  107. package/dist/typescript/module/index.d.ts.map +1 -0
  108. package/dist/typescript/module/package.json +1 -0
  109. package/dist/typescript/module/persistence/adapters.d.ts +57 -0
  110. package/dist/typescript/module/persistence/adapters.d.ts.map +1 -0
  111. package/dist/typescript/module/persistence/hooks.d.ts +29 -0
  112. package/dist/typescript/module/persistence/hooks.d.ts.map +1 -0
  113. package/dist/typescript/module/persistence/index.d.ts +3 -0
  114. package/dist/typescript/module/persistence/index.d.ts.map +1 -0
  115. package/dist/typescript/module/store.d.ts +89 -0
  116. package/dist/typescript/module/store.d.ts.map +1 -0
  117. package/dist/{index-D_JFvCIg.d.ts → typescript/module/types.d.ts} +40 -104
  118. package/dist/typescript/module/types.d.ts.map +1 -0
  119. package/package.json +25 -13
  120. package/src/babel.config.js +18 -0
  121. package/src/bob.config.js +14 -0
  122. package/src/components/GuidonOverlay.tsx +60 -4
  123. package/src/components/GuidonProvider.tsx +29 -1
  124. package/src/components/GuidonTarget.tsx +41 -25
  125. package/src/components/GuidonTooltip.tsx +143 -9
  126. package/src/hooks/index.ts +1 -0
  127. package/src/hooks/useGuidonRef.ts +154 -0
  128. package/src/index.ts +6 -0
  129. package/src/store.ts +68 -15
  130. package/src/tsconfig.json +32 -0
  131. package/src/types.ts +32 -2
  132. package/dist/index.d.mts +0 -128
  133. package/dist/index.d.ts +0 -128
  134. package/dist/index.js +0 -1097
  135. package/dist/index.js.map +0 -1
  136. package/dist/index.mjs +0 -1072
  137. package/dist/index.mjs.map +0 -1
  138. package/dist/persistence/index.d.mts +0 -2
  139. package/dist/persistence/index.d.ts +0 -2
  140. package/dist/persistence/index.js +0 -300
  141. package/dist/persistence/index.js.map +0 -1
  142. package/dist/persistence/index.mjs +0 -291
  143. package/dist/persistence/index.mjs.map +0 -1
@@ -0,0 +1,32 @@
1
+ {
2
+ "compilerOptions": {
3
+ "customConditions": ["dev-source", "react-native", "react-native-strict-api"],
4
+ "allowJs": true,
5
+ "esModuleInterop": true,
6
+ "jsx": "react-native",
7
+ "lib": ["DOM", "ESNext"],
8
+ "module": "preserve",
9
+ "moduleDetection": "force",
10
+ "moduleResolution": "bundler",
11
+ "noEmit": true,
12
+ "resolveJsonModule": true,
13
+ "skipLibCheck": true,
14
+ "target": "ESNext",
15
+ "strict": true,
16
+ "verbatimModuleSyntax": true,
17
+ "allowUnreachableCode": false,
18
+ "allowUnusedLabels": false,
19
+ "forceConsistentCasingInFileNames": true,
20
+ "noFallthroughCasesInSwitch": true,
21
+ "noImplicitReturns": true,
22
+ "noImplicitUseStrict": false,
23
+ "noStrictGenericChecks": false,
24
+ "noUncheckedIndexedAccess": true,
25
+ "noUnusedLocals": true,
26
+ "noUnusedParameters": true,
27
+ "paths": {
28
+ "@/*": ["./src/*"]
29
+ }
30
+ },
31
+ "exclude": ["node_modules", "dist"]
32
+ }
package/src/types.ts CHANGED
@@ -5,6 +5,18 @@ import type { ReactNode } from 'react';
5
5
  */
6
6
  export type TooltipPosition = 'top' | 'bottom' | 'left' | 'right' | 'auto';
7
7
 
8
+ /**
9
+ * Position for floating tooltips (steps without a target element)
10
+ */
11
+ export type FloatingPosition =
12
+ | 'center'
13
+ | 'top'
14
+ | 'bottom'
15
+ | 'top-left'
16
+ | 'top-right'
17
+ | 'bottom-left'
18
+ | 'bottom-right';
19
+
8
20
  /**
9
21
  * Defines the measurements of a target element
10
22
  */
@@ -21,20 +33,32 @@ export interface TargetMeasurements {
21
33
  export interface GuidonStep {
22
34
  /** Unique identifier for this step */
23
35
  id: string;
24
- /** ID of the target element to highlight */
25
- targetId: string;
36
+ /**
37
+ * ID of the target element to highlight.
38
+ * If omitted, this becomes a floating tooltip step.
39
+ */
40
+ targetId?: string;
26
41
  /** Title displayed in the tooltip */
27
42
  title: string;
28
43
  /** Description/content displayed in the tooltip */
29
44
  description: string;
30
45
  /** Preferred position of the tooltip */
31
46
  tooltipPosition?: TooltipPosition;
47
+ /**
48
+ * Position for floating tooltips (only used when targetId is not provided)
49
+ * @default 'center'
50
+ */
51
+ floatingPosition?: FloatingPosition;
32
52
  /** Custom content to render in the tooltip */
33
53
  customContent?: ReactNode;
34
54
  /** Called when this step becomes active */
35
55
  onStepEnter?: () => void;
36
56
  /** Called when leaving this step */
37
57
  onStepExit?: () => void;
58
+ /** Optional message to display while waiting for target to mount */
59
+ waitingMessage?: string;
60
+ /** Timeout in ms before auto-skipping this step (0 = no timeout) */
61
+ waitTimeout?: number;
38
62
  }
39
63
 
40
64
  /**
@@ -141,6 +165,8 @@ export interface GuidonTooltipLabels {
141
165
  skip?: string;
142
166
  finish?: string;
143
167
  stepOf?: (current: number, total: number) => string;
168
+ /** Default message when waiting for target to mount */
169
+ waitingDefault?: string;
144
170
  }
145
171
 
146
172
  /**
@@ -207,6 +233,10 @@ export interface GuidonState {
207
233
  isLoading: boolean;
208
234
  /** Error from persistence operations */
209
235
  error: string | null;
236
+ /** Whether the guide is waiting for a target element to mount */
237
+ waitingForTarget: boolean;
238
+ /** The targetId currently being waited for */
239
+ waitingTargetId: string | null;
210
240
  }
211
241
 
212
242
  /**
package/dist/index.d.mts DELETED
@@ -1,128 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { G as GuidonTargetProps, a as GuidonTheme, b as GuidonStep, c as GuidonProviderProps, d as GuidonStore, e as GuidonConfig, T as TargetMeasurements } from './index-D_JFvCIg.mjs';
3
- export { l as GuidonActions, g as GuidonPersistenceAdapter, f as GuidonProgress, k as GuidonState, h as GuidonTooltipLabels, i as GuidonTooltipRenderProps, j as TooltipPosition, q as createApiAdapter, p as createAsyncStorageAdapter, r as createCompositeAdapter, o as createLocalStorageAdapter, n as createMemoryAdapter, m as createNoopAdapter, u as useGuidonPersistence, s as useShouldShowGuidon } from './index-D_JFvCIg.mjs';
4
- import * as zustand from 'zustand';
5
- import 'react';
6
-
7
- /**
8
- * Wrapper component that marks an element as a walkthrough target
9
- * Automatically measures and reports its position to the walkthrough store
10
- */
11
- declare function GuidonTarget({ children, targetId, active, }: GuidonTargetProps): react_jsx_runtime.JSX.Element;
12
-
13
- interface GuidonOverlayProps {
14
- theme?: GuidonTheme;
15
- animationDuration?: number;
16
- onBackdropPress?: () => void;
17
- }
18
- declare function GuidonOverlay({ theme, animationDuration, onBackdropPress, }: GuidonOverlayProps): react_jsx_runtime.JSX.Element | null;
19
-
20
- interface GuidonTooltipProps {
21
- theme?: GuidonTheme;
22
- animationDuration?: number;
23
- renderCustomTooltip?: (props: {
24
- step: GuidonStep;
25
- currentIndex: number;
26
- totalSteps: number;
27
- onNext: () => void;
28
- onPrevious: () => void;
29
- onSkip: () => void;
30
- }) => React.ReactNode;
31
- labels?: {
32
- next?: string;
33
- previous?: string;
34
- skip?: string;
35
- finish?: string;
36
- stepOf?: (current: number, total: number) => string;
37
- };
38
- }
39
- declare function GuidonTooltip({ theme, animationDuration, renderCustomTooltip, labels, }: GuidonTooltipProps): react_jsx_runtime.JSX.Element | null;
40
-
41
- interface GuidonContextValue {
42
- start: () => void;
43
- skip: () => void;
44
- reset: () => void;
45
- replay: () => Promise<void>;
46
- isActive: boolean;
47
- isCompleted: boolean;
48
- isLoading: boolean;
49
- }
50
- declare function useGuidonContext(): GuidonContextValue;
51
- declare function GuidonProvider({ children, config, autoStart, shouldStart, persistenceAdapter, portalComponent: Portal, renderTooltip, tooltipLabels, onBackdropPress, }: GuidonProviderProps): react_jsx_runtime.JSX.Element;
52
-
53
- declare const useGuidonStore: zustand.UseBoundStore<zustand.StoreApi<GuidonStore>>;
54
- /**
55
- * Guidon API for external control
56
- * Can be used outside of React components
57
- */
58
- declare const Guidon: {
59
- /**
60
- * Configure the walkthrough with steps and options
61
- */
62
- configure: (config: GuidonConfig) => void;
63
- /**
64
- * Start the walkthrough
65
- */
66
- start: () => void;
67
- /**
68
- * Go to the next step
69
- */
70
- next: () => void;
71
- /**
72
- * Go to the previous step
73
- */
74
- previous: () => void;
75
- /**
76
- * Go to a specific step by index
77
- */
78
- goToStep: (index: number) => void;
79
- /**
80
- * Skip the walkthrough
81
- */
82
- skip: () => void;
83
- /**
84
- * Complete the walkthrough
85
- */
86
- complete: () => void;
87
- /**
88
- * Reset the walkthrough to initial state
89
- */
90
- reset: () => void;
91
- /**
92
- * Check if the walkthrough is currently active
93
- */
94
- isActive: () => boolean;
95
- /**
96
- * Check if the walkthrough has been completed
97
- */
98
- isCompleted: () => boolean;
99
- /**
100
- * Get the current step index
101
- */
102
- getCurrentStepIndex: () => number;
103
- /**
104
- * Get the current step
105
- */
106
- getCurrentStep: () => GuidonStep | null;
107
- /**
108
- * Get all steps
109
- */
110
- getSteps: () => GuidonStep[];
111
- /**
112
- * Subscribe to store changes
113
- */
114
- subscribe: (listener: (state: GuidonStore, prevState: GuidonStore) => void) => () => void;
115
- };
116
- /**
117
- * Hook selectors for common use cases
118
- */
119
- declare const useGuidonActive: () => boolean;
120
- declare const useGuidonStep: () => GuidonStep | null;
121
- declare const useGuidonProgress: () => {
122
- currentStep: number;
123
- totalSteps: number;
124
- percentage: number;
125
- };
126
- declare const useTargetMeasurements: (targetId: string) => TargetMeasurements;
127
-
128
- export { Guidon, GuidonConfig, GuidonOverlay, GuidonProvider, GuidonProviderProps, GuidonStep, GuidonStore, GuidonTarget, GuidonTargetProps, GuidonTheme, GuidonTooltip, TargetMeasurements, useGuidonActive, useGuidonContext, useGuidonProgress, useGuidonStep, useGuidonStore, useTargetMeasurements };
package/dist/index.d.ts DELETED
@@ -1,128 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { G as GuidonTargetProps, a as GuidonTheme, b as GuidonStep, c as GuidonProviderProps, d as GuidonStore, e as GuidonConfig, T as TargetMeasurements } from './index-D_JFvCIg.js';
3
- export { l as GuidonActions, g as GuidonPersistenceAdapter, f as GuidonProgress, k as GuidonState, h as GuidonTooltipLabels, i as GuidonTooltipRenderProps, j as TooltipPosition, q as createApiAdapter, p as createAsyncStorageAdapter, r as createCompositeAdapter, o as createLocalStorageAdapter, n as createMemoryAdapter, m as createNoopAdapter, u as useGuidonPersistence, s as useShouldShowGuidon } from './index-D_JFvCIg.js';
4
- import * as zustand from 'zustand';
5
- import 'react';
6
-
7
- /**
8
- * Wrapper component that marks an element as a walkthrough target
9
- * Automatically measures and reports its position to the walkthrough store
10
- */
11
- declare function GuidonTarget({ children, targetId, active, }: GuidonTargetProps): react_jsx_runtime.JSX.Element;
12
-
13
- interface GuidonOverlayProps {
14
- theme?: GuidonTheme;
15
- animationDuration?: number;
16
- onBackdropPress?: () => void;
17
- }
18
- declare function GuidonOverlay({ theme, animationDuration, onBackdropPress, }: GuidonOverlayProps): react_jsx_runtime.JSX.Element | null;
19
-
20
- interface GuidonTooltipProps {
21
- theme?: GuidonTheme;
22
- animationDuration?: number;
23
- renderCustomTooltip?: (props: {
24
- step: GuidonStep;
25
- currentIndex: number;
26
- totalSteps: number;
27
- onNext: () => void;
28
- onPrevious: () => void;
29
- onSkip: () => void;
30
- }) => React.ReactNode;
31
- labels?: {
32
- next?: string;
33
- previous?: string;
34
- skip?: string;
35
- finish?: string;
36
- stepOf?: (current: number, total: number) => string;
37
- };
38
- }
39
- declare function GuidonTooltip({ theme, animationDuration, renderCustomTooltip, labels, }: GuidonTooltipProps): react_jsx_runtime.JSX.Element | null;
40
-
41
- interface GuidonContextValue {
42
- start: () => void;
43
- skip: () => void;
44
- reset: () => void;
45
- replay: () => Promise<void>;
46
- isActive: boolean;
47
- isCompleted: boolean;
48
- isLoading: boolean;
49
- }
50
- declare function useGuidonContext(): GuidonContextValue;
51
- declare function GuidonProvider({ children, config, autoStart, shouldStart, persistenceAdapter, portalComponent: Portal, renderTooltip, tooltipLabels, onBackdropPress, }: GuidonProviderProps): react_jsx_runtime.JSX.Element;
52
-
53
- declare const useGuidonStore: zustand.UseBoundStore<zustand.StoreApi<GuidonStore>>;
54
- /**
55
- * Guidon API for external control
56
- * Can be used outside of React components
57
- */
58
- declare const Guidon: {
59
- /**
60
- * Configure the walkthrough with steps and options
61
- */
62
- configure: (config: GuidonConfig) => void;
63
- /**
64
- * Start the walkthrough
65
- */
66
- start: () => void;
67
- /**
68
- * Go to the next step
69
- */
70
- next: () => void;
71
- /**
72
- * Go to the previous step
73
- */
74
- previous: () => void;
75
- /**
76
- * Go to a specific step by index
77
- */
78
- goToStep: (index: number) => void;
79
- /**
80
- * Skip the walkthrough
81
- */
82
- skip: () => void;
83
- /**
84
- * Complete the walkthrough
85
- */
86
- complete: () => void;
87
- /**
88
- * Reset the walkthrough to initial state
89
- */
90
- reset: () => void;
91
- /**
92
- * Check if the walkthrough is currently active
93
- */
94
- isActive: () => boolean;
95
- /**
96
- * Check if the walkthrough has been completed
97
- */
98
- isCompleted: () => boolean;
99
- /**
100
- * Get the current step index
101
- */
102
- getCurrentStepIndex: () => number;
103
- /**
104
- * Get the current step
105
- */
106
- getCurrentStep: () => GuidonStep | null;
107
- /**
108
- * Get all steps
109
- */
110
- getSteps: () => GuidonStep[];
111
- /**
112
- * Subscribe to store changes
113
- */
114
- subscribe: (listener: (state: GuidonStore, prevState: GuidonStore) => void) => () => void;
115
- };
116
- /**
117
- * Hook selectors for common use cases
118
- */
119
- declare const useGuidonActive: () => boolean;
120
- declare const useGuidonStep: () => GuidonStep | null;
121
- declare const useGuidonProgress: () => {
122
- currentStep: number;
123
- totalSteps: number;
124
- percentage: number;
125
- };
126
- declare const useTargetMeasurements: (targetId: string) => TargetMeasurements;
127
-
128
- export { Guidon, GuidonConfig, GuidonOverlay, GuidonProvider, GuidonProviderProps, GuidonStep, GuidonStore, GuidonTarget, GuidonTargetProps, GuidonTheme, GuidonTooltip, TargetMeasurements, useGuidonActive, useGuidonContext, useGuidonProgress, useGuidonStep, useGuidonStore, useTargetMeasurements };