diff --git a/docs/src/pages/components/ProgressBar.svx b/docs/src/pages/components/ProgressBar.svx index d296ae47..d944d771 100644 --- a/docs/src/pages/components/ProgressBar.svx +++ b/docs/src/pages/components/ProgressBar.svx @@ -21,6 +21,18 @@ Specify a `value` for the progress bar to be determinate. +## Finished status + +Specify `status="finished"` for the progress bar. + + + +## Error status + +Specify `status="error"` for the progress bar. + + + ## Custom max value The default `max` value is `100`. @@ -45,6 +57,10 @@ The inline variant visually hides the `helperText`. +## Indented status variant + + + ## UX example This example shows how to animate the progress bar from 0 to 100% with start and end states. diff --git a/src/ProgressBar/ProgressBar.svelte b/src/ProgressBar/ProgressBar.svelte index 21ab66db..8cea35af 100644 --- a/src/ProgressBar/ProgressBar.svelte +++ b/src/ProgressBar/ProgressBar.svelte @@ -14,6 +14,12 @@ */ export let kind = "default"; + /** + * Specify the status of progress bar + * @type {"active" | "finished" | "error"} + */ + export let status = "active"; + /** * Specify the size * @type {"sm" | "md"} @@ -32,6 +38,14 @@ /** Set an id for the progress bar element */ export let id = "ccs-" + Math.random().toString(36); + import CheckmarkFilled from "../icons/CheckmarkFilled.svelte"; + import ErrorFilled from "../icons/ErrorFilled.svelte"; + + const statusIcons = { + error: ErrorFilled, + finished: CheckmarkFilled, + }; + let helperId = "ccs-" + Math.random().toString(36); $: indeterminate = value === undefined; @@ -45,6 +59,8 @@ class:bx--progress-bar--small="{size === 'sm'}" class:bx--progress-bar--inline="{kind === 'inline'}" class:bx--progress-bar--indented="{kind === 'indented'}" + class:bx--progress-bar--error="{status === 'error'}" + class:bx--progress-bar--finished="{status === 'finished'}" {...$$restProps} >
{/if}
+ +