fds-vue-core 4.4.4 → 4.5.2

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 CHANGED
@@ -85,6 +85,67 @@ After registration, you can use components directly in your templates:
85
85
  </template>
86
86
  ```
87
87
 
88
+ ### FdsWizard (Route-Based)
89
+
90
+ `FdsWizard` is a route-based step component that accepts a `routes` array, supports incoming route params/prefill data, and keeps a local wizard state.
91
+
92
+ ```vue
93
+ <script setup lang="ts">
94
+ import { ref } from 'vue'
95
+
96
+ const activeRoutePath = ref('/wizard/start')
97
+
98
+ const activeRouteName = ref('wizard-start')
99
+
100
+ const wizardRoutes = [
101
+ { id: 'start', name: 'Start', routeName: 'wizard-start', to: '/wizard/start', prefillData: { source: 'campaign' } },
102
+ { id: 'details', name: 'Details', routeName: 'wizard-details', to: '/wizard/details', params: { personId: '191212121212' } },
103
+ { id: 'review', name: 'Review', routeName: 'wizard-review', to: '/wizard/review' },
104
+ ]
105
+
106
+ const initialWizardState = {
107
+ channel: 'web',
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
114
+ }
115
+ </script>
116
+
117
+ <template>
118
+ <FdsWizard
119
+ :routes="wizardRoutes"
120
+ :activeRouteName="activeRouteName"
121
+ :activeRoutePath="activeRoutePath"
122
+ :initialState="initialWizardState"
123
+ :completedTo="0"
124
+ @go="handleGo"
125
+ @stateChange="(payload) => console.log(payload.state)"
126
+ >
127
+ <template #default="{ state, setState, nextStep, previousStep, currentRoute }">
128
+ <p>Current step: {{ currentRoute?.name }}</p>
129
+ <p>Wizard state: {{ state }}</p>
130
+
131
+ <button @click="setState({ acceptedTerms: true })">Update state</button>
132
+ <button @click="previousStep">Previous</button>
133
+ <button @click="nextStep">Next</button>
134
+ </template>
135
+ </FdsWizard>
136
+ </template>
137
+ ```
138
+
139
+ `routes` items support:
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)
148
+
88
149
  ### Individual Component Import
89
150
 
90
151
  You can also import specific components:
package/components.d.ts CHANGED
@@ -22,6 +22,7 @@ import type { FdsSpinnerProps } from './src/components/FdsSpinner/types'
22
22
  import type { FdsStickerProps } from './src/components/FdsSticker/types'
23
23
  import type { WrapperProps } from './src/components/FdsTreeView/types'
24
24
  import type { FdsTruncatedTextProps } from './src/components/FdsTruncatedText/types'
25
+ import type { FdsWizardProps } from './src/components/FdsWizard/types'
25
26
  import type { FdsCheckboxProps } from './src/components/Form/FdsCheckbox/types'
26
27
  import type { FdsInputProps } from './src/components/Form/FdsInput/types'
27
28
  import type { FdsRadioProps } from './src/components/Form/FdsRadio/types'
@@ -72,6 +73,7 @@ declare module '@vue/runtime-core' {
72
73
  FdsPagination: DefineComponent<FdsPaginationProps>
73
74
  FdsSearchSelect: DefineComponent<FdsSearchSelectProps>
74
75
  FdsTruncatedText: DefineComponent<FdsTruncatedTextProps>
76
+ FdsWizard: DefineComponent<FdsWizardProps>
75
77
  FdsH1: DefineComponent<FdsH1Props>
76
78
  FdsH2: DefineComponent<FdsH2Props>
77
79
  FdsH3: DefineComponent<FdsH3Props>