@marianmeres/stuic 3.60.0 → 3.62.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.
@@ -1,6 +1,12 @@
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<
7
+ ButtonProps,
8
+ "variant" | "intent" | "size" | "roundedFull" | "class"
9
+ >;
4
10
 
5
11
  export interface Props {
6
12
  step: TourStepDef;
@@ -19,6 +25,10 @@
19
25
  classControls?: string;
20
26
  /** Whether to show the step counter (e.g. "1 / 3"). Default: true */
21
27
  showSteps?: boolean;
28
+ /** Override props for the prev button */
29
+ prevButtonProps?: ButtonOverrides;
30
+ /** Override props for the next/finish button */
31
+ nextButtonProps?: ButtonOverrides;
22
32
  }
23
33
  </script>
24
34
 
@@ -27,6 +37,7 @@
27
37
  import Button from "../../components/Button/Button.svelte";
28
38
  import { iconChevronLeft, iconChevronRight, iconCheck } from "../../icons/index.js";
29
39
  import { twMerge } from "../../utils/tw-merge.js";
40
+ import { omit } from "../../utils/omit-pick.js";
30
41
 
31
42
  let {
32
43
  step,
@@ -41,6 +52,8 @@
41
52
  skip,
42
53
  classControls,
43
54
  showSteps = true,
55
+ prevButtonProps,
56
+ nextButtonProps,
44
57
  }: Props = $props();
45
58
 
46
59
  const context: TourShellContext = $derived({
@@ -96,19 +109,26 @@
96
109
  {#if !isFirst}
97
110
  <Button
98
111
  onclick={prev}
99
- class={twMerge(BUTTON_CLS, classControls)}
112
+ class={twMerge(BUTTON_CLS, classControls, prevButtonProps?.class)}
100
113
  {...BUTTON_PROPS}
114
+ {...omit(prevButtonProps ?? {}, "class")}
101
115
  >
102
116
  {@html iconChevronLeft({ size: ICON_SIZE })}
103
117
  </Button>
104
118
  {/if}
105
119
  <Button
106
120
  onclick={next}
107
- class={twMerge(BUTTON_CLS, _finishLabel && "pl-2 pr-3", classControls)}
121
+ class={twMerge(
122
+ BUTTON_CLS,
123
+ _finishLabel && "pl-2 pr-3",
124
+ classControls,
125
+ nextButtonProps?.class
126
+ )}
108
127
  {...BUTTON_PROPS}
109
128
  aspect1={!_finishLabel}
110
129
  intent="primary"
111
130
  variant="solid"
131
+ {...omit(nextButtonProps ?? {}, "class")}
112
132
  >
113
133
  {@html isLast
114
134
  ? iconCheck({ size: ICON_SIZE })
@@ -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" | "class">;
3
5
  export interface Props {
4
6
  step: TourStepDef;
5
7
  /** 0-based index of this step */
@@ -16,6 +18,10 @@ export interface Props {
16
18
  classControls?: string;
17
19
  /** Whether to show the step counter (e.g. "1 / 3"). Default: true */
18
20
  showSteps?: boolean;
21
+ /** Override props for the prev button */
22
+ prevButtonProps?: ButtonOverrides;
23
+ /** Override props for the next/finish button */
24
+ nextButtonProps?: ButtonOverrides;
19
25
  }
20
26
  declare const OnboardingShell: import("svelte").Component<Props, {}, "">;
21
27
  type OnboardingShell = ReturnType<typeof OnboardingShell>;
@@ -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
  */
@@ -98,6 +99,10 @@ export interface TourOptions {
98
99
  totalSteps?: number;
99
100
  /** Whether to show the step counter (e.g. "1 / 3") in the default shell. Default: true */
100
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"];
101
106
  }
102
107
  /**
103
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.
@@ -100,6 +100,8 @@ export function createTour(options) {
100
100
  labels: resolvedLabels,
101
101
  shell: options.shell,
102
102
  showSteps: options.showSteps ?? true,
103
+ prevButtonProps: options.prevButtonProps,
104
+ nextButtonProps: options.nextButtonProps,
103
105
  next,
104
106
  prev,
105
107
  skip,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marianmeres/stuic",
3
- "version": "3.60.0",
3
+ "version": "3.62.0",
4
4
  "files": [
5
5
  "dist",
6
6
  "!dist/**/*.test.*",