fds-vue-core 4.5.2 → 4.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -30
- package/dist/fds-vue-core.cjs.js +183 -199
- package/dist/fds-vue-core.cjs.js.map +1 -1
- package/dist/fds-vue-core.css +1 -1
- package/dist/fds-vue-core.es.js +183 -199
- package/dist/fds-vue-core.es.js.map +1 -1
- package/package.json +5 -2
- package/src/components/FdsWizard/FdsWizard.stories.ts +6 -33
- package/src/components/FdsWizard/FdsWizard.vue +46 -103
- package/src/components/FdsWizard/types.ts +3 -15
- package/src/index.ts +1 -1
- package/src/.DS_Store +0 -0
package/README.md
CHANGED
|
@@ -87,30 +87,22 @@ After registration, you can use components directly in your templates:
|
|
|
87
87
|
|
|
88
88
|
### FdsWizard (Route-Based)
|
|
89
89
|
|
|
90
|
-
`FdsWizard` is a route-based step component
|
|
90
|
+
`FdsWizard` is a route-based step component. It only renders the step indicator and emits navigation; **all data lives in the consumer**. Listen to `@go`, call `router.push({ name: payload.route.routeName, params, query })`, and pass the current route name via `activeRouteName` (or rely on vue-router so the component reads `currentRoute.name`).
|
|
91
91
|
|
|
92
92
|
```vue
|
|
93
93
|
<script setup lang="ts">
|
|
94
94
|
import { ref } from 'vue'
|
|
95
95
|
|
|
96
|
-
const activeRoutePath = ref('/wizard/start')
|
|
97
|
-
|
|
98
96
|
const activeRouteName = ref('wizard-start')
|
|
99
97
|
|
|
100
98
|
const wizardRoutes = [
|
|
101
|
-
{ id: 'start', name: 'Start', routeName: 'wizard-start'
|
|
102
|
-
{ id: 'details', name: 'Details', routeName: 'wizard-details'
|
|
103
|
-
{ id: 'review', name: 'Review', routeName: 'wizard-review'
|
|
99
|
+
{ id: 'start', name: 'Start', routeName: 'wizard-start' },
|
|
100
|
+
{ id: 'details', name: 'Details', routeName: 'wizard-details' },
|
|
101
|
+
{ id: 'review', name: 'Review', routeName: 'wizard-review' },
|
|
104
102
|
]
|
|
105
103
|
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
const handleGo = (payload: { route: { routeName?: string; to?: string } }) => {
|
|
111
|
-
// Useful in environments without vue-router
|
|
112
|
-
activeRouteName.value = payload.route.routeName ?? activeRouteName.value
|
|
113
|
-
activeRoutePath.value = payload.route.to ?? activeRoutePath.value
|
|
104
|
+
const handleGo = (payload: { route: { routeName: string } }) => {
|
|
105
|
+
activeRouteName.value = payload.route.routeName
|
|
114
106
|
}
|
|
115
107
|
</script>
|
|
116
108
|
|
|
@@ -118,17 +110,11 @@ const handleGo = (payload: { route: { routeName?: string; to?: string } }) => {
|
|
|
118
110
|
<FdsWizard
|
|
119
111
|
:routes="wizardRoutes"
|
|
120
112
|
:activeRouteName="activeRouteName"
|
|
121
|
-
:activeRoutePath="activeRoutePath"
|
|
122
|
-
:initialState="initialWizardState"
|
|
123
113
|
:completedTo="0"
|
|
124
114
|
@go="handleGo"
|
|
125
|
-
@stateChange="(payload) => console.log(payload.state)"
|
|
126
115
|
>
|
|
127
|
-
<template #default="{
|
|
116
|
+
<template #default="{ currentRoute, currentStepIndex, nextStep, previousStep }">
|
|
128
117
|
<p>Current step: {{ currentRoute?.name }}</p>
|
|
129
|
-
<p>Wizard state: {{ state }}</p>
|
|
130
|
-
|
|
131
|
-
<button @click="setState({ acceptedTerms: true })">Update state</button>
|
|
132
118
|
<button @click="previousStep">Previous</button>
|
|
133
119
|
<button @click="nextStep">Next</button>
|
|
134
120
|
</template>
|
|
@@ -136,15 +122,7 @@ const handleGo = (payload: { route: { routeName?: string; to?: string } }) => {
|
|
|
136
122
|
</template>
|
|
137
123
|
```
|
|
138
124
|
|
|
139
|
-
`routes` items
|
|
140
|
-
|
|
141
|
-
- `id`, `name` (required)
|
|
142
|
-
- `routeName` (recommended, used first when matching and navigating)
|
|
143
|
-
- `to` (path fallback, optional when `routeName` is used)
|
|
144
|
-
- `params` (incoming route params)
|
|
145
|
-
- `query` (incoming query values)
|
|
146
|
-
- `prefillData` (merged into local state on step activation)
|
|
147
|
-
- `disabled` (disables specific step)
|
|
125
|
+
`routes` items: `id`, `name`, `routeName` (required); `to`, `params`, `query` (optional, for your router); `disabled` (optional).
|
|
148
126
|
|
|
149
127
|
### Individual Component Import
|
|
150
128
|
|