@marianmeres/stuic 3.59.0 → 3.61.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.
- package/dist/actions/onboarding/OnboardingShell.svelte +33 -9
- package/dist/actions/onboarding/OnboardingShell.svelte.d.ts +8 -0
- package/dist/actions/onboarding/index.css +8 -0
- package/dist/actions/onboarding/onboarding.svelte.d.ts +7 -0
- package/dist/actions/onboarding/onboarding.svelte.js +5 -2
- package/package.json +1 -1
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import type { Snippet } from "svelte";
|
|
3
3
|
import type { TourStepDef, TourLabels, TourShellContext } from "./onboarding.svelte.js";
|
|
4
|
+
import type { Props as ButtonProps } from "../../components/Button/Button.svelte";
|
|
5
|
+
|
|
6
|
+
type ButtonOverrides = Pick<ButtonProps, "variant" | "intent" | "size" | "roundedFull">;
|
|
4
7
|
|
|
5
8
|
export interface Props {
|
|
6
9
|
step: TourStepDef;
|
|
@@ -17,6 +20,12 @@
|
|
|
17
20
|
skip: () => void;
|
|
18
21
|
//
|
|
19
22
|
classControls?: string;
|
|
23
|
+
/** Whether to show the step counter (e.g. "1 / 3"). Default: true */
|
|
24
|
+
showSteps?: boolean;
|
|
25
|
+
/** Override props for the prev button */
|
|
26
|
+
prevButtonProps?: ButtonOverrides;
|
|
27
|
+
/** Override props for the next/finish button */
|
|
28
|
+
nextButtonProps?: ButtonOverrides;
|
|
20
29
|
}
|
|
21
30
|
</script>
|
|
22
31
|
|
|
@@ -38,6 +47,9 @@
|
|
|
38
47
|
prev,
|
|
39
48
|
skip,
|
|
40
49
|
classControls,
|
|
50
|
+
showSteps = true,
|
|
51
|
+
prevButtonProps,
|
|
52
|
+
nextButtonProps,
|
|
41
53
|
}: Props = $props();
|
|
42
54
|
|
|
43
55
|
const context: TourShellContext = $derived({
|
|
@@ -60,14 +72,23 @@
|
|
|
60
72
|
};
|
|
61
73
|
|
|
62
74
|
const ICON_SIZE = 24;
|
|
75
|
+
|
|
76
|
+
const _finishLabel = $derived(isLast ? (step.finishLabel ?? labels.finish) : "");
|
|
63
77
|
</script>
|
|
64
78
|
|
|
65
79
|
{#if shell}
|
|
66
80
|
{@render shell(context)}
|
|
67
81
|
{:else}
|
|
68
82
|
<div class="stuic-onboarding-shell">
|
|
69
|
-
{#if step.title}
|
|
70
|
-
<div class="stuic-onboarding-
|
|
83
|
+
{#if step.title || showSteps}
|
|
84
|
+
<div class="stuic-onboarding-header">
|
|
85
|
+
{#if step.title}
|
|
86
|
+
<div class="stuic-onboarding-title">{step.title}</div>
|
|
87
|
+
{/if}
|
|
88
|
+
{#if showSteps}
|
|
89
|
+
<span class="stuic-onboarding-steps">{index + 1} / {total}</span>
|
|
90
|
+
{/if}
|
|
91
|
+
</div>
|
|
71
92
|
{/if}
|
|
72
93
|
{#if step.content}
|
|
73
94
|
<div class="stuic-onboarding-content">
|
|
@@ -75,32 +96,35 @@
|
|
|
75
96
|
</div>
|
|
76
97
|
{/if}
|
|
77
98
|
<div class="stuic-onboarding-footer">
|
|
78
|
-
|
|
99
|
+
{#if !isLast}
|
|
100
|
+
<button class="stuic-onboarding-btn-skip" onclick={skip}>
|
|
101
|
+
{step.skipLabel ?? labels.skip}
|
|
102
|
+
</button>
|
|
103
|
+
{/if}
|
|
79
104
|
<div class="stuic-onboarding-actions">
|
|
80
|
-
{#if !isLast}
|
|
81
|
-
<button class="stuic-onboarding-btn-skip" onclick={skip}>
|
|
82
|
-
{step.skipLabel ?? labels.skip}
|
|
83
|
-
</button>
|
|
84
|
-
{/if}
|
|
85
105
|
{#if !isFirst}
|
|
86
106
|
<Button
|
|
87
107
|
onclick={prev}
|
|
88
108
|
class={twMerge(BUTTON_CLS, classControls)}
|
|
89
109
|
{...BUTTON_PROPS}
|
|
110
|
+
{...prevButtonProps}
|
|
90
111
|
>
|
|
91
112
|
{@html iconChevronLeft({ size: ICON_SIZE })}
|
|
92
113
|
</Button>
|
|
93
114
|
{/if}
|
|
94
115
|
<Button
|
|
95
116
|
onclick={next}
|
|
96
|
-
class={twMerge(BUTTON_CLS, classControls)}
|
|
117
|
+
class={twMerge(BUTTON_CLS, _finishLabel && "pl-2 pr-3", classControls)}
|
|
97
118
|
{...BUTTON_PROPS}
|
|
119
|
+
aspect1={!_finishLabel}
|
|
98
120
|
intent="primary"
|
|
99
121
|
variant="solid"
|
|
122
|
+
{...nextButtonProps}
|
|
100
123
|
>
|
|
101
124
|
{@html isLast
|
|
102
125
|
? iconCheck({ size: ICON_SIZE })
|
|
103
126
|
: iconChevronRight({ size: ICON_SIZE })}
|
|
127
|
+
{#if _finishLabel}{_finishLabel}{/if}
|
|
104
128
|
</Button>
|
|
105
129
|
</div>
|
|
106
130
|
</div>
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
2
|
import type { TourStepDef, TourLabels, TourShellContext } from "./onboarding.svelte.js";
|
|
3
|
+
import type { Props as ButtonProps } from "../../components/Button/Button.svelte";
|
|
4
|
+
type ButtonOverrides = Pick<ButtonProps, "variant" | "intent" | "size" | "roundedFull">;
|
|
3
5
|
export interface Props {
|
|
4
6
|
step: TourStepDef;
|
|
5
7
|
/** 0-based index of this step */
|
|
@@ -14,6 +16,12 @@ export interface Props {
|
|
|
14
16
|
prev: () => void;
|
|
15
17
|
skip: () => void;
|
|
16
18
|
classControls?: string;
|
|
19
|
+
/** Whether to show the step counter (e.g. "1 / 3"). Default: true */
|
|
20
|
+
showSteps?: boolean;
|
|
21
|
+
/** Override props for the prev button */
|
|
22
|
+
prevButtonProps?: ButtonOverrides;
|
|
23
|
+
/** Override props for the next/finish button */
|
|
24
|
+
nextButtonProps?: ButtonOverrides;
|
|
17
25
|
}
|
|
18
26
|
declare const OnboardingShell: import("svelte").Component<Props, {}, "">;
|
|
19
27
|
type OnboardingShell = ReturnType<typeof OnboardingShell>;
|
|
@@ -23,6 +23,13 @@
|
|
|
23
23
|
border-radius: var(--stuic-onboarding-shell-radius, var(--stuic-radius));
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
.stuic-onboarding-header {
|
|
27
|
+
display: flex;
|
|
28
|
+
align-items: baseline;
|
|
29
|
+
justify-content: space-between;
|
|
30
|
+
gap: calc(var(--spacing) * 2);
|
|
31
|
+
}
|
|
32
|
+
|
|
26
33
|
.stuic-onboarding-title {
|
|
27
34
|
font-weight: 600;
|
|
28
35
|
font-size: var(--stuic-onboarding-title-size);
|
|
@@ -50,6 +57,7 @@
|
|
|
50
57
|
display: flex;
|
|
51
58
|
align-items: center;
|
|
52
59
|
gap: var(--stuic-onboarding-footer-gap);
|
|
60
|
+
margin-left: auto;
|
|
53
61
|
}
|
|
54
62
|
|
|
55
63
|
.stuic-onboarding-btn-skip {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
2
|
import type { SpotlightPosition } from "../spotlight/spotlight.svelte.js";
|
|
3
3
|
import type { THC } from "../../components/Thc/Thc.svelte";
|
|
4
|
+
import { type Props as ShellProps } from "./OnboardingShell.svelte";
|
|
4
5
|
/**
|
|
5
6
|
* Definition of a single step in an onboarding tour.
|
|
6
7
|
*/
|
|
@@ -96,6 +97,12 @@ export interface TourOptions {
|
|
|
96
97
|
indexOffset?: number;
|
|
97
98
|
/** Overrides steps.length for display purposes (the `total` value passed to the shell) */
|
|
98
99
|
totalSteps?: number;
|
|
100
|
+
/** Whether to show the step counter (e.g. "1 / 3") in the default shell. Default: true */
|
|
101
|
+
showSteps?: boolean;
|
|
102
|
+
/** Override props (variant, intent, size, roundedFull) for the prev button */
|
|
103
|
+
prevButtonProps?: ShellProps["prevButtonProps"];
|
|
104
|
+
/** Override props (variant, intent, size, roundedFull) for the next/finish button */
|
|
105
|
+
nextButtonProps?: ShellProps["nextButtonProps"];
|
|
99
106
|
}
|
|
100
107
|
/**
|
|
101
108
|
* Creates a multi-step onboarding tour on top of the spotlight primitive.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { spotlight } from "../spotlight/spotlight.svelte.js";
|
|
2
|
-
import OnboardingShell from "./OnboardingShell.svelte";
|
|
2
|
+
import OnboardingShell, {} from "./OnboardingShell.svelte";
|
|
3
3
|
import { StorageAbstraction } from "../../utils/storage-abstraction.js";
|
|
4
4
|
/**
|
|
5
5
|
* Creates a multi-step onboarding tour on top of the spotlight primitive.
|
|
@@ -45,7 +45,7 @@ export function createTour(options) {
|
|
|
45
45
|
next: "Next",
|
|
46
46
|
prev: "Back",
|
|
47
47
|
skip: "Skip",
|
|
48
|
-
finish: "
|
|
48
|
+
finish: "",
|
|
49
49
|
...options.labels,
|
|
50
50
|
};
|
|
51
51
|
// Escape key listener — active only while tour is running
|
|
@@ -99,6 +99,9 @@ export function createTour(options) {
|
|
|
99
99
|
isLast: displayIndex === displayTotal - 1,
|
|
100
100
|
labels: resolvedLabels,
|
|
101
101
|
shell: options.shell,
|
|
102
|
+
showSteps: options.showSteps ?? true,
|
|
103
|
+
prevButtonProps: options.prevButtonProps,
|
|
104
|
+
nextButtonProps: options.nextButtonProps,
|
|
102
105
|
next,
|
|
103
106
|
prev,
|
|
104
107
|
skip,
|