@archbase/components 3.0.25 → 4.0.1
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/dist/buttons/ArchbaseSpeedDial.d.ts +59 -0
- package/dist/buttons/index.d.ts +2 -0
- package/dist/charts/ArchbaseArcGauge.d.ts +55 -0
- package/dist/charts/ArchbaseGantt.d.ts +70 -0
- package/dist/charts/ArchbaseLinearGauge.d.ts +55 -0
- package/dist/charts/ArchbaseResourceTimeline.d.ts +61 -0
- package/dist/charts/ArchbaseSparkline.d.ts +45 -0
- package/dist/charts/index.d.ts +10 -0
- package/dist/containers/ArchbaseExpansionPanel.d.ts +60 -0
- package/dist/containers/ArchbaseFloatingPanel.d.ts +91 -0
- package/dist/containers/index.d.ts +4 -0
- package/dist/datagrid/export/ArchbaseDataGridExcelExport.d.ts +67 -0
- package/dist/datagrid/export/index.d.ts +2 -0
- package/dist/datagrid/index.d.ts +1 -0
- package/dist/display/ArchbaseAnimationWrapper.d.ts +73 -0
- package/dist/display/ArchbaseBarcodeGenerator.d.ts +50 -0
- package/dist/display/ArchbaseCarousel.d.ts +100 -0
- package/dist/display/ArchbaseCodeViewer.d.ts +63 -0
- package/dist/display/ArchbaseDiffViewer.d.ts +41 -0
- package/dist/display/ArchbaseJsonTree.d.ts +34 -0
- package/dist/display/ArchbaseLightbox.d.ts +89 -0
- package/dist/display/ArchbaseMarquee.d.ts +46 -0
- package/dist/display/ArchbasePhotoAlbum.d.ts +58 -0
- package/dist/display/ArchbaseQRCode.d.ts +44 -0
- package/dist/display/ArchbaseTooltipRich.d.ts +82 -0
- package/dist/display/ArchbaseVirtualList.d.ts +116 -0
- package/dist/display/index.d.ts +24 -0
- package/dist/editors/ArchbaseAIPromptInput.d.ts +69 -0
- package/dist/editors/ArchbaseAsyncMultiSelect.d.ts +1 -1
- package/dist/editors/ArchbaseAsyncSelect.d.ts +1 -1
- package/dist/editors/ArchbaseBarcodeScanner.d.ts +63 -0
- package/dist/editors/ArchbaseCepInput.d.ts +26 -0
- package/dist/editors/ArchbaseColorGradientPicker.d.ts +80 -0
- package/dist/editors/ArchbaseCpfCnpjInput.d.ts +21 -0
- package/dist/editors/ArchbaseCurrencyInput.d.ts +25 -0
- package/dist/editors/ArchbaseDualListbox.d.ts +61 -0
- package/dist/editors/ArchbaseInPlaceEditor.d.ts +67 -0
- package/dist/editors/ArchbaseLightGrid.d.ts +56 -0
- package/dist/editors/ArchbaseMentionInput.d.ts +75 -0
- package/dist/editors/ArchbaseMultiEmail.d.ts +53 -0
- package/dist/editors/ArchbaseMultiViewCalendar.d.ts +47 -0
- package/dist/editors/ArchbaseNumberStepper.d.ts +66 -0
- package/dist/editors/ArchbaseOTPInput.d.ts +27 -0
- package/dist/editors/ArchbasePhoneInput.d.ts +52 -0
- package/dist/editors/ArchbaseRangeSlider.d.ts +22 -0
- package/dist/editors/ArchbaseSignaturePad.d.ts +60 -0
- package/dist/editors/ArchbaseSpeechToTextInput.d.ts +106 -0
- package/dist/editors/ArchbaseSpreadsheet.d.ts +56 -0
- package/dist/editors/ArchbaseTagInput.d.ts +55 -0
- package/dist/editors/index.d.ts +40 -0
- package/dist/feedback/ArchbaseChunkProgressBar.d.ts +35 -0
- package/dist/feedback/ArchbaseRipple.d.ts +43 -0
- package/dist/feedback/ArchbaseSkeleton.d.ts +115 -0
- package/dist/feedback/index.d.ts +6 -0
- package/dist/filters/ArchbaseColumnSelector.d.ts +38 -0
- package/dist/filters/index.d.ts +2 -0
- package/dist/forms/ArchbaseFieldArray.d.ts +80 -0
- package/dist/forms/ArchbaseFormWizard.d.ts +73 -0
- package/dist/forms/ArchbaseStepper.d.ts +51 -0
- package/dist/forms/index.d.ts +8 -0
- package/dist/forms/useArchbaseFormWizard.d.ts +74 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/useArchbaseConfirm.d.ts +59 -0
- package/dist/image/editor/index.d.ts +43 -4
- package/dist/image/index.d.ts +1 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +22510 -13820
- package/dist/list/ArchbaseTreeList.d.ts +76 -0
- package/dist/list/index.d.ts +2 -0
- package/dist/navigation/ArchbaseActionSheet.d.ts +70 -0
- package/dist/navigation/ArchbaseAppBar.d.ts +63 -0
- package/dist/navigation/ArchbaseBottomNavigation.d.ts +61 -0
- package/dist/navigation/ArchbaseContextMenu.d.ts +76 -0
- package/dist/navigation/ArchbaseKeyboardShortcuts.d.ts +85 -0
- package/dist/navigation/ArchbaseSpotlight.d.ts +69 -0
- package/dist/navigation/index.d.ts +12 -0
- package/dist/notification/ArchbaseNotificationCenter.d.ts +56 -0
- package/dist/notification/index.d.ts +2 -0
- package/dist/onboarding/ArchbaseOnboardingTour.d.ts +27 -76
- package/dist/viewers/ArchbaseDocViewer.d.ts +40 -0
- package/dist/viewers/ArchbasePdfBuilder.d.ts +53 -0
- package/dist/viewers/ArchbaseXmlViewer.d.ts +36 -0
- package/dist/viewers/index.d.ts +6 -0
- package/package.json +41 -18
- package/src/buttons/ArchbaseSpeedDial.tsx +282 -0
- package/src/buttons/index.ts +3 -0
- package/src/charts/ArchbaseArcGauge.tsx +325 -0
- package/src/charts/ArchbaseGantt.tsx +494 -0
- package/src/charts/ArchbaseLinearGauge.tsx +288 -0
- package/src/charts/ArchbaseResourceTimeline.tsx +433 -0
- package/src/charts/ArchbaseSparkline.tsx +193 -0
- package/src/charts/index.ts +20 -1
- package/src/containers/ArchbaseExpansionPanel.tsx +208 -0
- package/src/containers/ArchbaseFloatingPanel.tsx +448 -0
- package/src/containers/index.ts +17 -0
- package/src/datagrid/components/pagination/grid-pagination.tsx +2 -2
- package/src/datagrid/export/ArchbaseDataGridExcelExport.tsx +293 -0
- package/src/datagrid/export/index.ts +8 -0
- package/src/datagrid/index.tsx +2 -0
- package/src/display/ArchbaseAnimationWrapper.tsx +272 -0
- package/src/display/ArchbaseBarcodeGenerator.tsx +303 -0
- package/src/display/ArchbaseCarousel.tsx +679 -0
- package/src/display/ArchbaseCodeViewer.tsx +271 -0
- package/src/display/ArchbaseDiffViewer.tsx +108 -0
- package/src/display/ArchbaseJsonTree.tsx +150 -0
- package/src/display/ArchbaseLightbox.tsx +279 -0
- package/src/display/ArchbaseMarquee.tsx +268 -0
- package/src/display/ArchbasePhotoAlbum.tsx +415 -0
- package/src/display/ArchbaseQRCode.tsx +137 -0
- package/src/display/ArchbaseTooltipRich.tsx +317 -0
- package/src/display/ArchbaseVirtualList.tsx +618 -0
- package/src/display/index.ts +94 -1
- package/src/editors/ArchbaseAIPromptInput.tsx +432 -0
- package/src/editors/ArchbaseBarcodeScanner.tsx +570 -0
- package/src/editors/ArchbaseCepInput.tsx +173 -0
- package/src/editors/ArchbaseColorGradientPicker.tsx +460 -0
- package/src/editors/ArchbaseCpfCnpjInput.tsx +193 -0
- package/src/editors/ArchbaseCurrencyInput.tsx +100 -0
- package/src/editors/ArchbaseDualListbox.tsx +671 -0
- package/src/editors/ArchbaseInPlaceEditor.tsx +406 -0
- package/src/editors/ArchbaseLightGrid.tsx +538 -0
- package/src/editors/ArchbaseMentionInput.tsx +384 -0
- package/src/editors/ArchbaseMultiEmail.tsx +367 -0
- package/src/editors/ArchbaseMultiViewCalendar.tsx +439 -0
- package/src/editors/ArchbaseNumberStepper.tsx +219 -0
- package/src/editors/ArchbaseOTPInput.tsx +133 -0
- package/src/editors/ArchbaseOperationHoursEditor.tsx +1 -1
- package/src/editors/ArchbasePhoneInput.tsx +355 -0
- package/src/editors/ArchbaseRangeSlider.tsx +109 -0
- package/src/editors/ArchbaseSignaturePad.tsx +425 -0
- package/src/editors/ArchbaseSpeechToTextInput.tsx +444 -0
- package/src/editors/ArchbaseSpreadsheet.tsx +388 -0
- package/src/editors/ArchbaseTagInput.tsx +326 -0
- package/src/editors/index.tsx +92 -0
- package/src/feedback/ArchbaseChunkProgressBar.tsx +156 -0
- package/src/feedback/ArchbaseRipple.tsx +278 -0
- package/src/feedback/ArchbaseSkeleton.tsx +419 -0
- package/src/feedback/index.ts +22 -1
- package/src/filters/ArchbaseColumnSelector.tsx +268 -0
- package/src/filters/index.ts +2 -0
- package/src/forms/ArchbaseFieldArray.tsx +305 -0
- package/src/forms/ArchbaseFormWizard.tsx +284 -0
- package/src/forms/ArchbaseStepper.tsx +137 -0
- package/src/forms/index.ts +24 -2
- package/src/forms/useArchbaseFormWizard.ts +283 -0
- package/src/hooks/index.ts +12 -0
- package/src/hooks/useArchbaseConfirm.ts +293 -0
- package/src/image/editor/functions/image-processing.ts +5 -0
- package/src/image/editor/index.tsx +305 -391
- package/src/image/index.ts +1 -0
- package/src/index.ts +3 -0
- package/src/list/ArchbaseTreeList.tsx +422 -0
- package/src/list/index.ts +3 -0
- package/src/navigation/ArchbaseActionSheet.tsx +301 -0
- package/src/navigation/ArchbaseAppBar.tsx +233 -0
- package/src/navigation/ArchbaseBottomNavigation.tsx +243 -0
- package/src/navigation/ArchbaseContextMenu.tsx +298 -0
- package/src/navigation/ArchbaseKeyboardShortcuts.tsx +472 -0
- package/src/navigation/ArchbaseSpotlight.tsx +483 -0
- package/src/navigation/index.ts +48 -1
- package/src/notification/ArchbaseNotificationCenter.tsx +502 -0
- package/src/notification/index.ts +2 -0
- package/src/onboarding/ArchbaseOnboardingTour.tsx +229 -102
- package/src/viewers/ArchbaseDocViewer.tsx +584 -0
- package/src/viewers/ArchbasePdfBuilder.tsx +291 -0
- package/src/viewers/ArchbaseXmlViewer.tsx +142 -0
- package/src/viewers/index.ts +12 -0
|
@@ -1,94 +1,59 @@
|
|
|
1
|
-
import React, { ReactNode, useState, useEffect } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import React, { ReactNode, useState, useEffect, useCallback, useRef } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Box,
|
|
4
|
+
Button,
|
|
5
|
+
Group,
|
|
6
|
+
Overlay,
|
|
7
|
+
Paper,
|
|
8
|
+
Portal,
|
|
9
|
+
Text,
|
|
10
|
+
Title,
|
|
11
|
+
Transition,
|
|
12
|
+
useMantineTheme,
|
|
13
|
+
} from '@mantine/core';
|
|
14
|
+
import { IconArrowLeft, IconArrowRight, IconX } from '@tabler/icons-react';
|
|
4
15
|
|
|
5
16
|
export interface ArchbaseOnboardingTourStep {
|
|
6
|
-
/**
|
|
7
|
-
* ID único do step
|
|
8
|
-
*/
|
|
17
|
+
/** ID único do step */
|
|
9
18
|
id: string;
|
|
10
|
-
/**
|
|
11
|
-
* Seletor CSS do elemento a ser destacado
|
|
12
|
-
*/
|
|
19
|
+
/** Seletor CSS do elemento a ser destacado */
|
|
13
20
|
target?: string;
|
|
14
|
-
/**
|
|
15
|
-
* Título do step
|
|
16
|
-
*/
|
|
21
|
+
/** Título do step */
|
|
17
22
|
title?: ReactNode;
|
|
18
|
-
/**
|
|
19
|
-
* Conteúdo/descrição do step
|
|
20
|
-
*/
|
|
23
|
+
/** Conteúdo/descrição do step */
|
|
21
24
|
content?: ReactNode;
|
|
22
25
|
}
|
|
23
26
|
|
|
24
27
|
export interface ArchbaseOnboardingTourProps {
|
|
25
|
-
/**
|
|
26
|
-
* Array de steps do tour
|
|
27
|
-
*/
|
|
28
|
+
/** Array de steps do tour */
|
|
28
29
|
steps: ArchbaseOnboardingTourStep[];
|
|
29
|
-
/**
|
|
30
|
-
* Callback quando o tour é iniciado
|
|
31
|
-
*/
|
|
30
|
+
/** Callback quando o tour é iniciado */
|
|
32
31
|
onStart?: () => void;
|
|
33
|
-
/**
|
|
34
|
-
* Callback quando o tour é finalizado
|
|
35
|
-
*/
|
|
32
|
+
/** Callback quando o tour é finalizado */
|
|
36
33
|
onEnd?: () => void;
|
|
37
|
-
/**
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
onChange?: (step: OnboardingTourStep) => void;
|
|
41
|
-
/**
|
|
42
|
-
* Iniciar o tour automaticamente ao montar o componente
|
|
43
|
-
* @default false
|
|
44
|
-
*/
|
|
34
|
+
/** Callback quando o step muda */
|
|
35
|
+
onChange?: (step: ArchbaseOnboardingTourStep) => void;
|
|
36
|
+
/** Iniciar o tour automaticamente ao montar o componente */
|
|
45
37
|
autoStart?: boolean;
|
|
46
|
-
/**
|
|
47
|
-
* Se o tour deve ser repetido (loop)
|
|
48
|
-
*/
|
|
38
|
+
/** Se o tour deve ser repetido (loop) */
|
|
49
39
|
loop?: boolean;
|
|
50
|
-
/**
|
|
51
|
-
* Conteúdo da aplicação (children é obrigatório no componente base)
|
|
52
|
-
*/
|
|
40
|
+
/** Conteúdo da aplicação */
|
|
53
41
|
children: ReactNode;
|
|
42
|
+
/** Label do botão próximo */
|
|
43
|
+
nextLabel?: string;
|
|
44
|
+
/** Label do botão anterior */
|
|
45
|
+
prevLabel?: string;
|
|
46
|
+
/** Label do botão finalizar */
|
|
47
|
+
finishLabel?: string;
|
|
48
|
+
/** Label do botão pular */
|
|
49
|
+
skipLabel?: string;
|
|
50
|
+
/** Mostrar botão pular */
|
|
51
|
+
showSkip?: boolean;
|
|
54
52
|
}
|
|
55
53
|
|
|
56
54
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* Wrapper sobre @gfazioli/mantine-onboarding-tour para criar tours interativos
|
|
60
|
-
* de onboarding em aplicações React. Ideal para introduzir novos usuários às
|
|
61
|
-
* funcionalidades do sistema.
|
|
62
|
-
*
|
|
63
|
-
* @example
|
|
64
|
-
* ```tsx
|
|
65
|
-
* function App() {
|
|
66
|
-
* const tourSteps: ArchbaseOnboardingTourStep[] = [
|
|
67
|
-
* {
|
|
68
|
-
* id: 'welcome',
|
|
69
|
-
* target: '#dashboard',
|
|
70
|
-
* title: 'Bem-vindo ao Dashboard',
|
|
71
|
-
* content: 'Aqui você pode ver todas as suas métricas.',
|
|
72
|
-
* },
|
|
73
|
-
* {
|
|
74
|
-
* id: 'settings',
|
|
75
|
-
* target: '#settings',
|
|
76
|
-
* title: 'Configurações',
|
|
77
|
-
* content: 'Ajuste suas preferências aqui.',
|
|
78
|
-
* },
|
|
79
|
-
* ];
|
|
80
|
-
*
|
|
81
|
-
* return (
|
|
82
|
-
* <ArchbaseOnboardingTour
|
|
83
|
-
* steps={tourSteps}
|
|
84
|
-
* autoStart={true}
|
|
85
|
-
* onEnd={() => console.log('Tour finalizado!')}
|
|
86
|
-
* >
|
|
87
|
-
* <YourAppContent />
|
|
88
|
-
* </ArchbaseOnboardingTour>
|
|
89
|
-
* );
|
|
90
|
-
* }
|
|
91
|
-
* ```
|
|
55
|
+
* ArchbaseOnboardingTour — Tour interativo de onboarding sem dependências externas.
|
|
56
|
+
* Usa Mantine Overlay + Portal para destacar elementos e exibir tooltips.
|
|
92
57
|
*/
|
|
93
58
|
export function ArchbaseOnboardingTour({
|
|
94
59
|
steps,
|
|
@@ -98,50 +63,212 @@ export function ArchbaseOnboardingTour({
|
|
|
98
63
|
autoStart = false,
|
|
99
64
|
loop = false,
|
|
100
65
|
children,
|
|
66
|
+
nextLabel = 'Próximo',
|
|
67
|
+
prevLabel = 'Anterior',
|
|
68
|
+
finishLabel = 'Finalizar',
|
|
69
|
+
skipLabel = 'Pular',
|
|
70
|
+
showSkip = true,
|
|
101
71
|
}: ArchbaseOnboardingTourProps) {
|
|
102
|
-
const
|
|
72
|
+
const theme = useMantineTheme();
|
|
73
|
+
const [active, setActive] = useState(false);
|
|
74
|
+
const [currentIndex, setCurrentIndex] = useState(0);
|
|
75
|
+
const [targetRect, setTargetRect] = useState<DOMRect | null>(null);
|
|
76
|
+
const rafRef = useRef<number>(0);
|
|
77
|
+
|
|
78
|
+
const currentStep = steps[currentIndex];
|
|
79
|
+
const isLast = currentIndex === steps.length - 1;
|
|
80
|
+
const isFirst = currentIndex === 0;
|
|
81
|
+
|
|
82
|
+
// Measure target element position
|
|
83
|
+
const measureTarget = useCallback(() => {
|
|
84
|
+
if (!active || !currentStep?.target) {
|
|
85
|
+
setTargetRect(null);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const el = document.querySelector(currentStep.target);
|
|
89
|
+
if (el) {
|
|
90
|
+
const rect = el.getBoundingClientRect();
|
|
91
|
+
setTargetRect(rect);
|
|
92
|
+
// Scroll into view if needed
|
|
93
|
+
el.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
|
94
|
+
} else {
|
|
95
|
+
setTargetRect(null);
|
|
96
|
+
}
|
|
97
|
+
}, [active, currentStep]);
|
|
103
98
|
|
|
104
99
|
useEffect(() => {
|
|
105
|
-
if (
|
|
106
|
-
|
|
100
|
+
if (!active) return;
|
|
101
|
+
measureTarget();
|
|
102
|
+
// Re-measure on scroll/resize
|
|
103
|
+
const handler = () => {
|
|
104
|
+
cancelAnimationFrame(rafRef.current);
|
|
105
|
+
rafRef.current = requestAnimationFrame(measureTarget);
|
|
106
|
+
};
|
|
107
|
+
window.addEventListener('scroll', handler, true);
|
|
108
|
+
window.addEventListener('resize', handler);
|
|
109
|
+
return () => {
|
|
110
|
+
window.removeEventListener('scroll', handler, true);
|
|
111
|
+
window.removeEventListener('resize', handler);
|
|
112
|
+
cancelAnimationFrame(rafRef.current);
|
|
113
|
+
};
|
|
114
|
+
}, [active, currentIndex, measureTarget]);
|
|
115
|
+
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
if (autoStart && steps.length > 0) {
|
|
118
|
+
setActive(true);
|
|
119
|
+
onStart?.();
|
|
107
120
|
}
|
|
108
121
|
}, [autoStart]);
|
|
109
122
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
123
|
+
const goNext = useCallback(() => {
|
|
124
|
+
if (isLast) {
|
|
125
|
+
if (loop) {
|
|
126
|
+
setCurrentIndex(0);
|
|
127
|
+
onChange?.(steps[0]);
|
|
128
|
+
} else {
|
|
129
|
+
setActive(false);
|
|
130
|
+
onEnd?.();
|
|
131
|
+
}
|
|
132
|
+
} else {
|
|
133
|
+
const next = currentIndex + 1;
|
|
134
|
+
setCurrentIndex(next);
|
|
135
|
+
onChange?.(steps[next]);
|
|
136
|
+
}
|
|
137
|
+
}, [currentIndex, isLast, loop, steps, onChange, onEnd]);
|
|
138
|
+
|
|
139
|
+
const goPrev = useCallback(() => {
|
|
140
|
+
if (!isFirst) {
|
|
141
|
+
const prev = currentIndex - 1;
|
|
142
|
+
setCurrentIndex(prev);
|
|
143
|
+
onChange?.(steps[prev]);
|
|
144
|
+
}
|
|
145
|
+
}, [currentIndex, isFirst, steps, onChange]);
|
|
146
|
+
|
|
147
|
+
const skip = useCallback(() => {
|
|
148
|
+
setActive(false);
|
|
149
|
+
onEnd?.();
|
|
150
|
+
}, [onEnd]);
|
|
151
|
+
|
|
152
|
+
// Tooltip position: below the target, or centered if no target
|
|
153
|
+
const getTooltipStyle = (): React.CSSProperties => {
|
|
154
|
+
if (!targetRect) {
|
|
155
|
+
return {
|
|
156
|
+
position: 'fixed',
|
|
157
|
+
top: '50%',
|
|
158
|
+
left: '50%',
|
|
159
|
+
transform: 'translate(-50%, -50%)',
|
|
160
|
+
zIndex: 10001,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
const top = targetRect.bottom + 12;
|
|
164
|
+
const left = targetRect.left + targetRect.width / 2;
|
|
165
|
+
// Clamp to viewport
|
|
166
|
+
return {
|
|
167
|
+
position: 'fixed',
|
|
168
|
+
top: Math.min(top, window.innerHeight - 220),
|
|
169
|
+
left: Math.min(Math.max(left - 175, 16), window.innerWidth - 366),
|
|
170
|
+
zIndex: 10001,
|
|
171
|
+
width: 350,
|
|
172
|
+
};
|
|
173
|
+
};
|
|
116
174
|
|
|
117
175
|
return (
|
|
118
|
-
|
|
119
|
-
tour={tourSteps}
|
|
120
|
-
started={started}
|
|
121
|
-
onOnboardingTourStart={onStart}
|
|
122
|
-
onOnboardingTourEnd={onEnd}
|
|
123
|
-
onOnboardingTourChange={onChange}
|
|
124
|
-
loop={loop}
|
|
125
|
-
>
|
|
176
|
+
<>
|
|
126
177
|
{children}
|
|
127
|
-
|
|
178
|
+
{active && (
|
|
179
|
+
<Portal>
|
|
180
|
+
{/* Overlay */}
|
|
181
|
+
<Overlay fixed opacity={0.5} zIndex={9999} />
|
|
182
|
+
|
|
183
|
+
{/* Highlight cutout */}
|
|
184
|
+
{targetRect && (
|
|
185
|
+
<Box
|
|
186
|
+
style={{
|
|
187
|
+
position: 'fixed',
|
|
188
|
+
top: targetRect.top - 4,
|
|
189
|
+
left: targetRect.left - 4,
|
|
190
|
+
width: targetRect.width + 8,
|
|
191
|
+
height: targetRect.height + 8,
|
|
192
|
+
border: `2px solid ${theme.colors.blue[5]}`,
|
|
193
|
+
borderRadius: theme.radius.sm,
|
|
194
|
+
zIndex: 10000,
|
|
195
|
+
boxShadow: `0 0 0 9999px rgba(0, 0, 0, 0.5)`,
|
|
196
|
+
pointerEvents: 'none',
|
|
197
|
+
backgroundColor: 'transparent',
|
|
198
|
+
}}
|
|
199
|
+
/>
|
|
200
|
+
)}
|
|
201
|
+
|
|
202
|
+
{/* Tooltip */}
|
|
203
|
+
<Transition mounted transition="pop" duration={200}>
|
|
204
|
+
{(transitionStyles) => (
|
|
205
|
+
<Paper
|
|
206
|
+
shadow="lg"
|
|
207
|
+
p="md"
|
|
208
|
+
radius="md"
|
|
209
|
+
style={{
|
|
210
|
+
...getTooltipStyle(),
|
|
211
|
+
...transitionStyles,
|
|
212
|
+
}}
|
|
213
|
+
>
|
|
214
|
+
{currentStep?.title && (
|
|
215
|
+
<Title order={5} mb="xs">
|
|
216
|
+
{currentStep.title}
|
|
217
|
+
</Title>
|
|
218
|
+
)}
|
|
219
|
+
{currentStep?.content && (
|
|
220
|
+
<Text size="sm" c="dimmed" mb="md">
|
|
221
|
+
{currentStep.content}
|
|
222
|
+
</Text>
|
|
223
|
+
)}
|
|
224
|
+
<Text size="xs" c="dimmed" mb="sm">
|
|
225
|
+
{currentIndex + 1} / {steps.length}
|
|
226
|
+
</Text>
|
|
227
|
+
<Group justify="space-between">
|
|
228
|
+
<Group gap="xs">
|
|
229
|
+
{showSkip && (
|
|
230
|
+
<Button variant="subtle" size="xs" onClick={skip}>
|
|
231
|
+
{skipLabel}
|
|
232
|
+
</Button>
|
|
233
|
+
)}
|
|
234
|
+
</Group>
|
|
235
|
+
<Group gap="xs">
|
|
236
|
+
{!isFirst && (
|
|
237
|
+
<Button
|
|
238
|
+
variant="default"
|
|
239
|
+
size="xs"
|
|
240
|
+
leftSection={<IconArrowLeft size={14} />}
|
|
241
|
+
onClick={goPrev}
|
|
242
|
+
>
|
|
243
|
+
{prevLabel}
|
|
244
|
+
</Button>
|
|
245
|
+
)}
|
|
246
|
+
<Button
|
|
247
|
+
size="xs"
|
|
248
|
+
rightSection={!isLast ? <IconArrowRight size={14} /> : undefined}
|
|
249
|
+
onClick={goNext}
|
|
250
|
+
>
|
|
251
|
+
{isLast ? finishLabel : nextLabel}
|
|
252
|
+
</Button>
|
|
253
|
+
</Group>
|
|
254
|
+
</Group>
|
|
255
|
+
</Paper>
|
|
256
|
+
)}
|
|
257
|
+
</Transition>
|
|
258
|
+
</Portal>
|
|
259
|
+
)}
|
|
260
|
+
</>
|
|
128
261
|
);
|
|
129
262
|
}
|
|
130
263
|
|
|
131
264
|
/**
|
|
132
|
-
* Hook
|
|
133
|
-
*
|
|
134
|
-
* Para controle programático completo, use o hook `useOnboardingTour`
|
|
135
|
-
* diretamente de @gfazioli/mantine-onboarding-tour
|
|
265
|
+
* Hook para controlar o tour programaticamente
|
|
136
266
|
*/
|
|
137
267
|
export function useArchbaseOnboarding() {
|
|
138
|
-
|
|
268
|
+
const [started, setStarted] = useState(false);
|
|
139
269
|
return {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
stop: () => {
|
|
144
|
-
console.warn('Para controle completo do tour, use o hook useOnboardingTour de @gfazioli/mantine-onboarding-tour');
|
|
145
|
-
},
|
|
270
|
+
started,
|
|
271
|
+
start: () => setStarted(true),
|
|
272
|
+
stop: () => setStarted(false),
|
|
146
273
|
};
|
|
147
274
|
}
|