@elogroup-sereduc/portal-aluno-tour 1.0.1 → 1.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elogroup-sereduc/portal-aluno-tour",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Componente de tour guiado customizado usando HeroUI para o Portal do Aluno",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -31,6 +31,19 @@ export function Tour({
31
31
  exitOnEsc = true,
32
32
  } = options;
33
33
 
34
+ // Garante que o overlay seja renderizado quando enabled for true
35
+ useEffect(() => {
36
+ if (enabled) {
37
+ // Força o body a não ter scroll quando o tour está ativo
38
+ document.body.style.overflow = "hidden";
39
+ } else {
40
+ document.body.style.overflow = "";
41
+ }
42
+ return () => {
43
+ document.body.style.overflow = "";
44
+ };
45
+ }, [enabled]);
46
+
34
47
  // Calcula a posição da tooltip baseado no elemento destacado
35
48
  const calculateTooltipPosition = useCallback((element: HTMLElement, position: string = "bottom") => {
36
49
  const rect = element.getBoundingClientRect();
@@ -103,11 +116,14 @@ export function Tour({
103
116
  return;
104
117
  }
105
118
 
106
- // Adiciona classe de highlight
119
+ // Adiciona classe de highlight e z-index alto
107
120
  highlightedElement.classList.add("tour-highlight");
121
+ const originalZIndex = highlightedElement.style.zIndex;
122
+ highlightedElement.style.zIndex = "10000";
108
123
 
109
124
  return () => {
110
125
  highlightedElement.classList.remove("tour-highlight");
126
+ highlightedElement.style.zIndex = originalZIndex;
111
127
  };
112
128
  }, [highlightedElement]);
113
129
 
@@ -179,20 +195,29 @@ export function Tour({
179
195
 
180
196
  return (
181
197
  <>
182
- {/* Overlay escuro */}
198
+ {/* Overlay escuro - sempre visível quando tour está ativo */}
183
199
  <div
184
200
  ref={overlayRef}
185
- className="fixed inset-0 bg-black/60 z-[9998]"
186
201
  onClick={handleOverlayClick}
187
- style={{ pointerEvents: exitOnOverlayClick ? "auto" : "none" }}
202
+ style={{
203
+ position: "fixed",
204
+ top: 0,
205
+ left: 0,
206
+ right: 0,
207
+ bottom: 0,
208
+ backgroundColor: "rgba(0, 0, 0, 0.6)",
209
+ zIndex: 9998,
210
+ pointerEvents: exitOnOverlayClick ? "auto" : "none",
211
+ }}
188
212
  />
189
213
 
190
214
  {/* Tooltip */}
191
215
  {tooltipPosition && currentStepData && highlightedElement && (
192
216
  <div
193
217
  ref={tooltipRef}
194
- className="fixed z-[9999] max-w-sm"
218
+ className="max-w-sm"
195
219
  style={{
220
+ position: "fixed",
196
221
  top: currentStepData.position === "bottom" ? `${tooltipPosition.top}px` : undefined,
197
222
  bottom: currentStepData.position === "top" ? `${window.innerHeight - tooltipPosition.top}px` : undefined,
198
223
  left: currentStepData.position === "left" || currentStepData.position === "right"
@@ -201,6 +226,7 @@ export function Tour({
201
226
  transform: currentStepData.position === "left" || currentStepData.position === "right"
202
227
  ? "translate(0, -50%)"
203
228
  : "translate(-50%, 0)",
229
+ zIndex: 10001,
204
230
  }}
205
231
  >
206
232
  <div className="bg-white rounded-lg shadow-xl p-6 relative">
@@ -336,11 +362,12 @@ export function Tour({
336
362
  {/* Estilos inline para highlight */}
337
363
  <style>{`
338
364
  .tour-highlight {
339
- position: relative;
340
- z-index: 9999 !important;
365
+ position: relative !important;
366
+ z-index: 10000 !important;
341
367
  outline: 3px solid var(--brand-primary, #0056b0) !important;
342
368
  outline-offset: 2px;
343
369
  border-radius: 4px;
370
+ box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6) !important;
344
371
  }
345
372
  `}</style>
346
373
  </>