From c9bb1a4bbb1dcdde99e36ff850745365deb1f690 Mon Sep 17 00:00:00 2001 From: Craig Howell Date: Fri, 14 Oct 2022 20:16:03 -0400 Subject: [PATCH] fix(Steps): forward all events including child components --- src/lib/components/steps/Description.svelte | 47 +++++++-- src/lib/components/steps/Step.svelte | 101 +++++++++++++++++--- src/lib/components/steps/Summary.svelte | 14 ++- src/lib/components/steps/Title.svelte | 89 ++++++++++++++--- 4 files changed, 220 insertions(+), 31 deletions(-) diff --git a/src/lib/components/steps/Description.svelte b/src/lib/components/steps/Description.svelte index eeb73057..a2baf34d 100644 --- a/src/lib/components/steps/Description.svelte +++ b/src/lib/components/steps/Description.svelte @@ -5,6 +5,11 @@ import { getContext } from 'svelte'; import { twMerge } from 'tailwind-merge'; import type { Writable } from 'svelte/store'; + import { get_current_component } from 'svelte/internal'; + import { forwardEventsBuilder, useActions, type ActionArray } from '../../actions'; + export let use: ActionArray = []; + import { exclude } from '../../utils/exclude'; + const forwardEvents = forwardEventsBuilder(get_current_component()); useContext({ context_id: STEPS_CONTEXT_ID, @@ -51,18 +56,48 @@ {#if variant === 'simple'} {#if $currentStep > step} - + {:else if $currentStep === step} - + {:else} - + {/if} {:else if variant === 'circles-text'} {#if $currentStep > step} - + {:else if $currentStep === step} - + {:else} - + {/if} {/if} diff --git a/src/lib/components/steps/Step.svelte b/src/lib/components/steps/Step.svelte index adb4c988..b9ebae6a 100644 --- a/src/lib/components/steps/Step.svelte +++ b/src/lib/components/steps/Step.svelte @@ -8,6 +8,11 @@ import { STEPS_CONTEXT_ID } from './Steps.svelte'; import { twMerge } from 'tailwind-merge'; import type { Writable } from 'svelte/store'; + import { get_current_component } from 'svelte/internal'; + import { forwardEventsBuilder, useActions, type ActionArray } from '../../actions'; + export let use: ActionArray = []; + import { exclude } from '../../utils/exclude'; + const forwardEvents = forwardEventsBuilder(get_current_component()); export let href: string; export let step: number; @@ -59,7 +64,13 @@ {#if $currentStep > step}
  • - + @@ -67,7 +78,13 @@ {:else if $currentStep === step}
  • - + @@ -75,7 +92,13 @@ {:else}
  • - + @@ -85,14 +108,26 @@ {#if $currentStep > step}
  • - +
  • {:else if $currentStep === step}
  • - + @@ -103,7 +138,13 @@ {:else}
  • - +
  • @@ -112,7 +153,13 @@ {#if $currentStep > step}
  • - + - + @@ -146,7 +199,13 @@ {:else}
  • - +