@marianmeres/stuic 3.44.1 → 3.45.0
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.
|
@@ -92,6 +92,10 @@ export interface TourOptions {
|
|
|
92
92
|
storageKey?: string;
|
|
93
93
|
/** Storage backend for persistence. Default: 'local' */
|
|
94
94
|
storage?: "local" | "session";
|
|
95
|
+
/** Added to the current step index for display purposes. Default: 0 */
|
|
96
|
+
indexOffset?: number;
|
|
97
|
+
/** Overrides steps.length for display purposes (the `total` value passed to the shell) */
|
|
98
|
+
totalSteps?: number;
|
|
95
99
|
}
|
|
96
100
|
/**
|
|
97
101
|
* Creates a multi-step onboarding tour on top of the spotlight primitive.
|
|
@@ -87,15 +87,16 @@ export function createTour(options) {
|
|
|
87
87
|
function _getShellContent(id) {
|
|
88
88
|
const step = options.steps.find((s) => s.id === id);
|
|
89
89
|
const index = options.steps.indexOf(step);
|
|
90
|
-
const
|
|
90
|
+
const displayIndex = index + (options.indexOffset ?? 0);
|
|
91
|
+
const displayTotal = options.totalSteps ?? options.steps.length;
|
|
91
92
|
return {
|
|
92
93
|
component: OnboardingShell,
|
|
93
94
|
props: {
|
|
94
95
|
step,
|
|
95
|
-
index,
|
|
96
|
-
total,
|
|
96
|
+
index: displayIndex,
|
|
97
|
+
total: displayTotal,
|
|
97
98
|
isFirst: index === 0,
|
|
98
|
-
isLast:
|
|
99
|
+
isLast: displayIndex === displayTotal - 1,
|
|
99
100
|
labels: resolvedLabels,
|
|
100
101
|
shell: options.shell,
|
|
101
102
|
next,
|