svelte-stepper icon indicating copy to clipboard operation
svelte-stepper copied to clipboard

Feature Requests

Open ogrotten opened this issue 1 year ago • 1 comments

I have a couple of suggestions/ideas. I'm going to try to dig into it soon and see what I can find and maybe do a PR.

stepName prop

	makeStep({
		component: Page6,
		props: undefined,
		stepName: "Location"
	}),

and then do like

	on:stepChange={e => {
		const { newIndex, of, direction, stepName } = e.detail
	}}

This would offer some flexibility in finding steps for conditionals. If I move Page6 to Page8, I wouldn't have to change if (e.detail.stepName === "Location")

Nice To Have

As a "nice to have", if the component emitted on:next and on:prev events. It could be argued that you can already do those functions by looking at forward vs backward etc. The suggestion tho would just take some of the tedium off of it.

Using dispatch

Also, if I dispatch from say the Page6 component, it doesn't get passed up to be caught on the <Stepper /> call. Right now, if I do a thing in there that I'd normally dispatch, unless I've missed something I would instead have to use a separate store or context to go around the component level and pass events up. That could be hairy to detect and pass as the same name. I don't know how it'd be done. An attribute like on:custom (with your dispatches in the detail) would be a simple workaround, but it kinda gets outside of being Svelte-Like.

api section

Docs could use this to explicitly state what the available functions are.

ogrotten avatar Aug 17 '23 16:08 ogrotten