@skeletonlabs/skeleton 2.6.1-dev.21f83326 → 2.6.1-dev.a9b3905f
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.
|
@@ -6,10 +6,12 @@ export let regionHeader = "";
|
|
|
6
6
|
export let regionContent = "";
|
|
7
7
|
export let regionNavigation = "";
|
|
8
8
|
export let state = getContext("state");
|
|
9
|
-
export let dispatchParent = getContext("dispatchParent");
|
|
10
9
|
export let stepTerm = getContext("stepTerm");
|
|
11
10
|
export let gap = getContext("gap");
|
|
12
11
|
export let justify = getContext("justify");
|
|
12
|
+
export let onNext = getContext("onNext");
|
|
13
|
+
export let onBack = getContext("onBack");
|
|
14
|
+
export let onComplete = getContext("onComplete");
|
|
13
15
|
export let buttonBack = getContext("buttonBack");
|
|
14
16
|
export let buttonBackType = getContext("buttonBackType");
|
|
15
17
|
export let buttonBackLabel = getContext("buttonBackLabel");
|
|
@@ -30,22 +32,6 @@ const cBase = "space-y-4";
|
|
|
30
32
|
const cHeader = "text-2xl font-bold";
|
|
31
33
|
const cContent = "space-y-4";
|
|
32
34
|
const cNavigation = "flex";
|
|
33
|
-
async function onNext() {
|
|
34
|
-
await new Promise((resolve) => setTimeout(resolve));
|
|
35
|
-
if (locked)
|
|
36
|
-
return;
|
|
37
|
-
$state.current++;
|
|
38
|
-
dispatchParent("next", { step: stepIndex, state: $state });
|
|
39
|
-
dispatchParent("step", { step: stepIndex, state: $state });
|
|
40
|
-
}
|
|
41
|
-
function onBack() {
|
|
42
|
-
$state.current--;
|
|
43
|
-
dispatchParent("back", { step: stepIndex, state: $state });
|
|
44
|
-
dispatchParent("step", { step: stepIndex, state: $state });
|
|
45
|
-
}
|
|
46
|
-
function onComplete() {
|
|
47
|
-
dispatchParent("complete", { step: stepIndex, state: $state });
|
|
48
|
-
}
|
|
49
35
|
$:
|
|
50
36
|
classesBase = `${cBase} ${$$props.class ?? ""}`;
|
|
51
37
|
$:
|
|
@@ -83,13 +69,13 @@ onDestroy(() => {
|
|
|
83
69
|
</div>
|
|
84
70
|
{:else}
|
|
85
71
|
<!-- Button: Back -->
|
|
86
|
-
<button type={buttonBackType} class="btn {buttonBack}" on:click={onBack} disabled={$state.current === 0}>
|
|
72
|
+
<button type={buttonBackType} class="btn {buttonBack}" on:click={() => onBack(stepIndex)} disabled={$state.current === 0}>
|
|
87
73
|
{@html buttonBackLabel}
|
|
88
74
|
</button>
|
|
89
75
|
{/if}
|
|
90
76
|
{#if stepIndex < $state.total - 1}
|
|
91
77
|
<!-- Button: Next -->
|
|
92
|
-
<button type={buttonNextType} class="btn {buttonNext}" on:click={onNext} disabled={locked}>
|
|
78
|
+
<button type={buttonNextType} class="btn {buttonNext}" on:click={() => onNext(locked, stepIndex)} disabled={locked}>
|
|
93
79
|
{#if locked}
|
|
94
80
|
<svg class="w-3 aspect-square fill-current" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
|
|
95
81
|
<path
|
|
@@ -101,7 +87,7 @@ onDestroy(() => {
|
|
|
101
87
|
</button>
|
|
102
88
|
{:else}
|
|
103
89
|
<!-- Button: Complete -->
|
|
104
|
-
<button type={buttonCompleteType} class="btn {buttonComplete}" on:click={onComplete} disabled={locked}>
|
|
90
|
+
<button type={buttonCompleteType} class="btn {buttonComplete}" on:click={() => onComplete(stepIndex)} disabled={locked}>
|
|
105
91
|
{@html buttonCompleteLabel}
|
|
106
92
|
</button>
|
|
107
93
|
{/if}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
2
|
import type { Writable } from 'svelte/store';
|
|
3
|
-
import type {
|
|
3
|
+
import type { StepperState } from './types.js';
|
|
4
4
|
import type { Transition, TransitionParams } from '../../index.js';
|
|
5
5
|
declare class __sveltets_Render<TransitionIn extends Transition, TransitionOut extends Transition> {
|
|
6
6
|
props(): {
|
|
@@ -13,10 +13,12 @@ declare class __sveltets_Render<TransitionIn extends Transition, TransitionOut e
|
|
|
13
13
|
/** Provide arbitrary classes to the step navigation region.*/
|
|
14
14
|
regionNavigation?: string | undefined;
|
|
15
15
|
state?: Writable<StepperState> | undefined;
|
|
16
|
-
dispatchParent?: StepperEventDispatcher | undefined;
|
|
17
16
|
stepTerm?: string | undefined;
|
|
18
17
|
gap?: string | undefined;
|
|
19
18
|
justify?: string | undefined;
|
|
19
|
+
onNext?: ((locked: boolean, stepIndex: number) => void) | undefined;
|
|
20
|
+
onBack?: ((stepIndex: number) => void) | undefined;
|
|
21
|
+
onComplete?: ((stepIndex: number) => void) | undefined;
|
|
20
22
|
buttonBack?: string | undefined;
|
|
21
23
|
buttonBackType?: "button" | "reset" | "submit" | undefined;
|
|
22
24
|
buttonBackLabel?: string | undefined;
|
|
@@ -30,11 +30,29 @@ export let transitionInParams = { duration: 100 };
|
|
|
30
30
|
export let transitionOut = fade;
|
|
31
31
|
export let transitionOutParams = { duration: 100 };
|
|
32
32
|
let state = writable({ current: start, total: 0 });
|
|
33
|
+
async function onNext(locked, stepIndex) {
|
|
34
|
+
await new Promise((resolve) => setTimeout(resolve));
|
|
35
|
+
if (locked)
|
|
36
|
+
return;
|
|
37
|
+
$state.current++;
|
|
38
|
+
dispatch("next", { step: stepIndex, state: $state });
|
|
39
|
+
dispatch("step", { step: stepIndex, state: $state });
|
|
40
|
+
}
|
|
41
|
+
function onBack(stepIndex) {
|
|
42
|
+
$state.current--;
|
|
43
|
+
dispatch("back", { step: stepIndex, state: $state });
|
|
44
|
+
dispatch("step", { step: stepIndex, state: $state });
|
|
45
|
+
}
|
|
46
|
+
function onComplete(stepIndex) {
|
|
47
|
+
dispatch("complete", { step: stepIndex, state: $state });
|
|
48
|
+
}
|
|
33
49
|
setContext("state", state);
|
|
34
|
-
setContext("dispatchParent", dispatch);
|
|
35
50
|
setContext("stepTerm", stepTerm);
|
|
36
51
|
setContext("gap", gap);
|
|
37
52
|
setContext("justify", justify);
|
|
53
|
+
setContext("onNext", onNext);
|
|
54
|
+
setContext("onBack", onBack);
|
|
55
|
+
setContext("onComplete", onComplete);
|
|
38
56
|
setContext("buttonBack", buttonBack);
|
|
39
57
|
setContext("buttonBackType", buttonBackType);
|
|
40
58
|
setContext("buttonBackLabel", buttonBackLabel);
|