Skip to content

Commit 11bca00

Browse files
committed
feat(demo): Add MultiStep sample
1 parent 5eaeafc commit 11bca00

File tree

5 files changed

+122
-5
lines changed

5 files changed

+122
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ Some samples for common tasks are available
126126
- Checkbox
127127
- ColorPicker
128128
- DatePicker
129-
- Editor (HTML Editor)
129+
- Editor (HTML Editor - if you register the editor component, make sure to import quill)
130130
- InputMask
131131
- InputNumber
132132
- InputOtp

dev/App.scss

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,18 @@
88
--font-feature-settings: "cv02", "cv03", "cv04", "cv11";
99
}
1010

11+
:root {
12+
--multistep-color-border: var(--p-primary-color);
13+
--multistep-color-tab: var(--p-primary-active-color);
14+
--multistep-color-tab-active: var(--p-primary-color);
15+
--multistep-color-success: var(--p-primary-color);
16+
--multistep-color-danger: #ef9a9a;
17+
--multistep-color-tab-active-text: var(--p-button-primary-color);
18+
--multistep-color-tab-text: var(--p-button-primary-color);
19+
--multistep-radius: 0.4em;
20+
--multistep-shadow: 0.25em 0.25em 1em 0 rgb(0 0 0 / 10%);
21+
}
22+
1123
html {
1224
height: 100%;
1325
font-size: 16px;
@@ -18,4 +30,27 @@ a {
1830
color: var(--p-primary-color);
1931
}
2032

33+
.formkit-step-actions {
34+
button {
35+
display: inline-flex;
36+
cursor: pointer;
37+
user-select: none;
38+
align-items: center;
39+
justify-content: center;
40+
overflow: hidden;
41+
position: relative;
42+
color: var(--p-button-primary-color);
43+
background: var(--p-button-primary-background);
44+
border: 1px solid var(--p-button-primary-border-color);
45+
padding: var(--p-button-padding-y) var(--p-button-padding-x);
46+
font-size: 1rem;
47+
font-family: inherit;
48+
font-feature-settings: inherit;
49+
transition: background var(--p-button-transition-duration), color var(--p-button-transition-duration), border-color var(--p-button-transition-duration), outline-color var(--p-button-transition-duration), box-shadow var(--p-button-transition-duration);
50+
border-radius: var(--p-button-border-radius);
51+
outline-color: transparent;
52+
gap: var(--p-button-gap);
53+
}
54+
}
55+
2156

dev/components/app/AppTopbar.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ const items = ref([
126126
{ label: 'Repeater', icon: 'pi pi-fw pi-user-edit', route: '/samples/repeater' },
127127
{ label: 'Input Editor', icon: 'pi pi-fw pi-user-edit', route: '/samples/inputEditor' },
128128
{ label: 'Form Editor', icon: 'pi pi-fw pi-user-edit', route: '/samples/formEditor' },
129+
{ label: 'MultiStep', icon: 'pi pi-fw pi-user-edit', route: '/samples/multiStep' },
129130
],
130131
},
131132
],
@@ -145,8 +146,8 @@ const items = ref([
145146
</template> <template #center>
146147
<div class="text-lg">
147148
<span class="text-yellow-600 font-bold">New: </span>
148-
<router-link to="/outputs/outputList" class="">
149-
<span class="">Output List - listStyle</span>
149+
<router-link to="/samples/multiStep" class="">
150+
<span class="">MultiStep</span>
150151
</router-link>
151152
</div>
152153
</template> <template #end>

dev/modules/formkit.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import type { UserModule } from '@/types'
2-
import { createAutoAnimatePlugin } from '@formkit/addons'
3-
2+
import { createAutoAnimatePlugin, createMultiStepPlugin } from '@formkit/addons'
43
import { de, en } from '@formkit/i18n'
4+
55
import { defaultConfig, plugin } from '@formkit/vue'
66
import { primeInputs, primeOutputs } from 'my-library/definitions'
77
import { addPrimeAsteriskPlugin } from 'my-library/plugins'
8+
import '@formkit/addons/css/multistep'
89

910
export const install: UserModule = ({ app }) => {
1011
app.use(plugin, defaultConfig({
@@ -29,6 +30,7 @@ export const install: UserModule = ({ app }) => {
2930
},
3031
),
3132
addPrimeAsteriskPlugin,
33+
createMultiStepPlugin(),
3234
],
3335
}))
3436
}

dev/pages/samples/MultiStep.vue

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<script setup lang='ts'>
2+
const tab = ref(true)
3+
const key = ref(0)
4+
const mode = computed(() => {
5+
if (tab.value) {
6+
return 'tab'
7+
}
8+
else {
9+
return 'progress'
10+
}
11+
})
12+
13+
const schema = reactive([
14+
{
15+
$formkit: 'multi-step',
16+
tabStyle: mode,
17+
allowIncomplete: true,
18+
children: [
19+
{
20+
$formkit: 'step',
21+
name: 'step1',
22+
label: 'Step 1',
23+
nextAttrs: {
24+
'data-foo': 'bar',
25+
},
26+
children: [
27+
{
28+
$formkit: 'primeInputText',
29+
name: 'email',
30+
label: 'Email',
31+
help: 'This will be used for your account.',
32+
validation: 'required|email',
33+
outerClass: 'col-6',
34+
},
35+
],
36+
},
37+
{
38+
$formkit: 'step',
39+
name: 'step2',
40+
label: 'Step 2',
41+
children: [
42+
{
43+
$formkit: 'primeTextarea',
44+
name: 'myText',
45+
label: 'Text',
46+
validation: '',
47+
rows: '3',
48+
},
49+
],
50+
},
51+
],
52+
},
53+
])
54+
const data = ref({ })
55+
56+
function update() {
57+
data.value = {}
58+
key.value++
59+
}
60+
</script>
61+
62+
<template>
63+
<div class="ml-2">
64+
<PrimeInput
65+
:key="key"
66+
header="MultiStep" :schema="schema" :data="data"
67+
>
68+
<div class="flex gap-2 mb-4">
69+
<div>Use Tab</div>
70+
<div> <ToggleSwitch v-model="tab" @change="update" /></div>
71+
</div>
72+
<h4>Mode: {{ mode }} </h4>
73+
</PrimeInput>
74+
</div>
75+
</template>
76+
77+
<style lang='scss'>
78+
79+
</style>

0 commit comments

Comments
 (0)