From 67e86538bb5199fac3335e1f838ce7ba404239b1 Mon Sep 17 00:00:00 2001 From: Sergei Ogorelkov Date: Tue, 31 Jan 2023 23:15:20 +0600 Subject: [PATCH] Add wizard (#2571) Signed-off-by: Sergei Ogorelkov --- .../ui/src/components/wizard/Wizard.svelte | 59 ++++++++ .../src/components/wizard/WizardStep.svelte | 142 ++++++++++++++++++ packages/ui/src/index.ts | 1 + packages/ui/src/types.ts | 8 + 4 files changed, 210 insertions(+) create mode 100644 packages/ui/src/components/wizard/Wizard.svelte create mode 100644 packages/ui/src/components/wizard/WizardStep.svelte diff --git a/packages/ui/src/components/wizard/Wizard.svelte b/packages/ui/src/components/wizard/Wizard.svelte new file mode 100644 index 0000000000..1a4c05c576 --- /dev/null +++ b/packages/ui/src/components/wizard/Wizard.svelte @@ -0,0 +1,59 @@ + + + + + {#each items as item, i} + + {/each} + + +{#if selectedItem} + {#if typeof selectedItem.component === 'string'} + + {:else} + + {/if} +{/if} diff --git a/packages/ui/src/components/wizard/WizardStep.svelte b/packages/ui/src/components/wizard/WizardStep.svelte new file mode 100644 index 0000000000..2918a72241 --- /dev/null +++ b/packages/ui/src/components/wizard/WizardStep.svelte @@ -0,0 +1,142 @@ + + + +{#if translation} +
{translation}
+ {#if lenght > 0} +
+ +
+ + {#if position === 'start'} + + {:else if position === 'middle'} + + {:else if position === 'end'} + + {:else} + + {/if} + +
{translation}
+
+
+ {/if} +{/if} + + diff --git a/packages/ui/src/index.ts b/packages/ui/src/index.ts index 3eb4057c3d..f53a409612 100644 --- a/packages/ui/src/index.ts +++ b/packages/ui/src/index.ts @@ -163,6 +163,7 @@ export { default as notificationsStore } from './components/notifications/store' export { NotificationPosition } from './components/notifications/NotificationPosition' export { NotificationSeverity } from './components/notifications/NotificationSeverity' export { Notification } from './components/notifications/Notification' +export { default as Wizard } from './components/wizard/Wizard.svelte' export * from './types' export * from './location' diff --git a/packages/ui/src/types.ts b/packages/ui/src/types.ts index 48141a44e5..5d0a34d67d 100644 --- a/packages/ui/src/types.ts +++ b/packages/ui/src/types.ts @@ -281,3 +281,11 @@ export interface TimelineState { timelineBox: DOMRect viewBox: DOMRect } + +export interface WizardModel { + label: IntlString + component: AnyComponent | AnySvelteComponent + props?: any +} +export type WizardItemPosition = 'start' | 'middle' | 'end' +export type WizardItemPositionState = 'current' | 'prev' | 'next'