diff --git a/package-lock.json b/package-lock.json index f034470..a227deb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "svelte-steps", - "version": "1.0.3", + "version": "2.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "svelte-steps", - "version": "1.0.3", + "version": "2.0.0", "license": "BSD-2-Clause", "devDependencies": { "@sveltejs/adapter-static": "^1.0.0-next", diff --git a/package.json b/package.json index fe32063..4a25d42 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "svelte-steps", - "version": "1.1.0", + "version": "2.0.0", "description": "A customizable step component written in Svelte", "repository": { "type": "git", diff --git a/src/lib/Steps.svelte b/src/lib/Steps.svelte index 9b57bc5..48dc4fb 100644 --- a/src/lib/Steps.svelte +++ b/src/lib/Steps.svelte @@ -16,7 +16,7 @@ - `iconProps`: An object that will be passed as props to the `icon` component. - `current`: current step index. Number. Default `0` - `size`: size of the step buttons. String. Default `"3rem"` - - `lineHeight`: height of the connecting lines between the step buttons. String. Default `"0.3rem"` + - `line`: thickness of the connecting lines between the step buttons. String. Default `"0.3rem"` - `primary`: Primary color of passed and current steps. String. Default `'var(--bs-primary, #3a86ff)'` - `secondary`: Secondary color of future steps. String. Default `'var(--bs-secondary, #bbbbc0)'` - `light`: Primary color of text color in passed anc current steps. String. Default `'var(--bs-light, white)'` @@ -37,7 +37,8 @@ export let steps export let current = 0 export let size = '3rem' - export let lineHeight = '0.3rem' + export let lineHeight = undefined + export let line = '0.3rem' export let primary = 'var(--bs-primary, #3a86ff)' export let secondary = 'var(--bs-secondary, #bbbbc0)' export let light = 'var(--bs-light, white)' @@ -45,6 +46,10 @@ export let borderRadius = '50%' export let fontFamily = '' + // + if (lineHeight) { + line = lineHeight + } if (current > steps.length - 1) { current = steps.length - 1 } @@ -52,7 +57,7 @@ current = 0 } - const progress = tweened(current, { + $: progress = tweened(current, { duration: 400, }) @@ -80,11 +85,12 @@ >
+
+ + +
+ {#each steps as step, i} +
+
+
+ {#if i > 0} +
+ {:else} +
+ {/if} + {#if i < steps.length - 1} +
+ {:else} +
+ {/if} +
+
+
+
{ + onClick(i) + }} + > + {#if step.icon} + {#if i < current} + + {:else if step.iconProps} + + {:else} + + {/if} + {:else if i < current} + + {:else} + {i + 1} + {/if} +
+ +
+ {#if typeof step.text != 'undefined'} +
{ + onClick(i) + }} + > + {step.text} +
+ {:else} +
+ {/if} +
+
+
+ {/each} +
+ + diff --git a/src/lib/index.js b/src/lib/index.js index 82a9afa..db27aaa 100644 --- a/src/lib/index.js +++ b/src/lib/index.js @@ -1 +1,2 @@ export { default as Steps } from './Steps.svelte' +export { default as StepsVertical } from './StepsVertical.svelte' diff --git a/src/routes/index.svelte b/src/routes/index.svelte index 14550ea..c25b63f 100644 --- a/src/routes/index.svelte +++ b/src/routes/index.svelte @@ -1,5 +1,5 @@