@marianmeres/stuic 3.61.0 → 3.63.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.
@@ -3,7 +3,12 @@
3
3
  import type { TourStepDef, TourLabels, TourShellContext } from "./onboarding.svelte.js";
4
4
  import type { Props as ButtonProps } from "../../components/Button/Button.svelte";
5
5
 
6
- type ButtonOverrides = Pick<ButtonProps, "variant" | "intent" | "size" | "roundedFull">;
6
+ type ButtonOverrides = Pick<
7
+ ButtonProps,
8
+ "variant" | "intent" | "size" | "roundedFull" | "class"
9
+ >;
10
+
11
+ export type IconFn = (props?: Partial<{ size: number }>) => string;
7
12
 
8
13
  export interface Props {
9
14
  step: TourStepDef;
@@ -26,6 +31,12 @@
26
31
  prevButtonProps?: ButtonOverrides;
27
32
  /** Override props for the next/finish button */
28
33
  nextButtonProps?: ButtonOverrides;
34
+ /** Custom icon for the prev button. Default: iconChevronLeft */
35
+ iconPrev?: IconFn;
36
+ /** Custom icon for the next button. Default: iconChevronRight */
37
+ iconNext?: IconFn;
38
+ /** Custom icon for the finish (last step) button. Default: iconCheck */
39
+ iconFinish?: IconFn;
29
40
  }
30
41
  </script>
31
42
 
@@ -34,6 +45,7 @@
34
45
  import Button from "../../components/Button/Button.svelte";
35
46
  import { iconChevronLeft, iconChevronRight, iconCheck } from "../../icons/index.js";
36
47
  import { twMerge } from "../../utils/tw-merge.js";
48
+ import { omit } from "../../utils/omit-pick.js";
37
49
 
38
50
  let {
39
51
  step,
@@ -50,6 +62,9 @@
50
62
  showSteps = true,
51
63
  prevButtonProps,
52
64
  nextButtonProps,
65
+ iconPrev = iconChevronLeft,
66
+ iconNext = iconChevronRight,
67
+ iconFinish = iconCheck,
53
68
  }: Props = $props();
54
69
 
55
70
  const context: TourShellContext = $derived({
@@ -105,25 +120,30 @@
105
120
  {#if !isFirst}
106
121
  <Button
107
122
  onclick={prev}
108
- class={twMerge(BUTTON_CLS, classControls)}
123
+ class={twMerge(BUTTON_CLS, classControls, prevButtonProps?.class)}
109
124
  {...BUTTON_PROPS}
110
- {...prevButtonProps}
125
+ {...omit(prevButtonProps ?? {}, "class")}
111
126
  >
112
- {@html iconChevronLeft({ size: ICON_SIZE })}
127
+ {@html iconPrev({ size: ICON_SIZE })}
113
128
  </Button>
114
129
  {/if}
115
130
  <Button
116
131
  onclick={next}
117
- class={twMerge(BUTTON_CLS, _finishLabel && "pl-2 pr-3", classControls)}
132
+ class={twMerge(
133
+ BUTTON_CLS,
134
+ _finishLabel && "pl-2 pr-3",
135
+ classControls,
136
+ nextButtonProps?.class
137
+ )}
118
138
  {...BUTTON_PROPS}
119
139
  aspect1={!_finishLabel}
120
140
  intent="primary"
121
141
  variant="solid"
122
- {...nextButtonProps}
142
+ {...omit(nextButtonProps ?? {}, "class")}
123
143
  >
124
144
  {@html isLast
125
- ? iconCheck({ size: ICON_SIZE })
126
- : iconChevronRight({ size: ICON_SIZE })}
145
+ ? iconFinish({ size: ICON_SIZE })
146
+ : iconNext({ size: ICON_SIZE })}
127
147
  {#if _finishLabel}{_finishLabel}{/if}
128
148
  </Button>
129
149
  </div>
@@ -1,7 +1,10 @@
1
1
  import type { Snippet } from "svelte";
2
2
  import type { TourStepDef, TourLabels, TourShellContext } from "./onboarding.svelte.js";
3
3
  import type { Props as ButtonProps } from "../../components/Button/Button.svelte";
4
- type ButtonOverrides = Pick<ButtonProps, "variant" | "intent" | "size" | "roundedFull">;
4
+ type ButtonOverrides = Pick<ButtonProps, "variant" | "intent" | "size" | "roundedFull" | "class">;
5
+ export type IconFn = (props?: Partial<{
6
+ size: number;
7
+ }>) => string;
5
8
  export interface Props {
6
9
  step: TourStepDef;
7
10
  /** 0-based index of this step */
@@ -22,6 +25,12 @@ export interface Props {
22
25
  prevButtonProps?: ButtonOverrides;
23
26
  /** Override props for the next/finish button */
24
27
  nextButtonProps?: ButtonOverrides;
28
+ /** Custom icon for the prev button. Default: iconChevronLeft */
29
+ iconPrev?: IconFn;
30
+ /** Custom icon for the next button. Default: iconChevronRight */
31
+ iconNext?: IconFn;
32
+ /** Custom icon for the finish (last step) button. Default: iconCheck */
33
+ iconFinish?: IconFn;
25
34
  }
26
35
  declare const OnboardingShell: import("svelte").Component<Props, {}, "">;
27
36
  type OnboardingShell = ReturnType<typeof OnboardingShell>;
@@ -1,7 +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
+ import { type Props as ShellProps, type IconFn } from "./OnboardingShell.svelte";
5
5
  /**
6
6
  * Definition of a single step in an onboarding tour.
7
7
  */
@@ -103,6 +103,12 @@ export interface TourOptions {
103
103
  prevButtonProps?: ShellProps["prevButtonProps"];
104
104
  /** Override props (variant, intent, size, roundedFull) for the next/finish button */
105
105
  nextButtonProps?: ShellProps["nextButtonProps"];
106
+ /** Custom icon for the prev button */
107
+ iconPrev?: IconFn;
108
+ /** Custom icon for the next button */
109
+ iconNext?: IconFn;
110
+ /** Custom icon for the finish (last step) button */
111
+ iconFinish?: IconFn;
106
112
  }
107
113
  /**
108
114
  * Creates a multi-step onboarding tour on top of the spotlight primitive.
@@ -102,6 +102,9 @@ export function createTour(options) {
102
102
  showSteps: options.showSteps ?? true,
103
103
  prevButtonProps: options.prevButtonProps,
104
104
  nextButtonProps: options.nextButtonProps,
105
+ iconPrev: options.iconPrev,
106
+ iconNext: options.iconNext,
107
+ iconFinish: options.iconFinish,
105
108
  next,
106
109
  prev,
107
110
  skip,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marianmeres/stuic",
3
- "version": "3.61.0",
3
+ "version": "3.63.0",
4
4
  "files": [
5
5
  "dist",
6
6
  "!dist/**/*.test.*",