|
1 | 1 | <script> |
2 | | - import { onMount, afterUpdate } from "svelte"; |
3 | | - import { currentStep } from "./stores.js"; |
| 2 | + import { |
| 3 | + onMount, |
| 4 | + afterUpdate |
| 5 | + } from "svelte"; |
| 6 | + import { |
| 7 | + currentStep |
| 8 | + } from "./stores.js"; |
4 | 9 | import { |
5 | 10 | uuidv4, |
6 | 11 | formHasError, |
|
12 | 17 | export let resetSteps; |
13 | 18 |
|
14 | 19 | let defaultStepOptions = { |
15 | | - formTitle : 'Hello world', |
16 | | - formSubtitle : 'Welcome to our world', |
17 | | - formMethodType : 'POST', |
18 | | - prevMessageText : 'Previous', |
19 | | - nextMessageText : 'Next', |
20 | | - formActionURL:'/', |
21 | | - formID : 's-multistep-form', |
22 | | - displayIndex : true, |
23 | | - svgCircleColor : "#48DB71", |
24 | | - selectCircleColor : "red", |
25 | | - selectboxShadowCircleColor : "#48DB71", |
26 | | - unselectboxShadowCircleColor : "#48DB71", |
27 | | - indexblanckColor : 'black', |
28 | | - indexColor : 'black', |
29 | | - stepsDescription: [ |
30 | | - { title: "STEP 1", subtitle: "All the details to perform on this step" }, |
31 | | - { title: "STEP 2", subtitle: "All the details to perform on this step" } |
| 20 | + formTitle: 'Hello world', |
| 21 | + formSubtitle: 'Welcome to our world', |
| 22 | + formMethodType: 'POST', |
| 23 | + prevMessageText: 'Previous', |
| 24 | + nextMessageText: 'Next', |
| 25 | + formActionURL: '/', |
| 26 | + formID: 's-multistep-form', |
| 27 | + displayIndex: true, |
| 28 | + svgCircleColor: "#48DB71", |
| 29 | + selectCircleColor: "red", |
| 30 | + selectboxShadowCircleColor: "#48DB71", |
| 31 | + unselectboxShadowCircleColor: "#48DB71", |
| 32 | + indexblanckColor: 'black', |
| 33 | + indexColor: 'black', |
| 34 | + stepsDescription: [{ |
| 35 | + title: "STEP 1", |
| 36 | + subtitle: "All the details to perform on this step" |
| 37 | + }, |
| 38 | + { |
| 39 | + title: "STEP 2", |
| 40 | + subtitle: "All the details to perform on this step" |
| 41 | + } |
32 | 42 | ] |
33 | 43 | } |
34 | 44 |
|
35 | | - multiStepOptions = Object.assign({}, defaultStepOptions, multiStepOptions) |
| 45 | + multiStepOptions = Object.assign({}, defaultStepOptions, multiStepOptions) |
36 | 46 |
|
37 | 47 | /* |
38 | 48 | Lifecycle Hooks |
|
48 | 58 | step.classList.add("step-is-active"); |
49 | 59 | } |
50 | 60 | }); |
51 | | - |
| 61 | +
|
52 | 62 | updateButtonVisibility(); |
53 | 63 | }); |
54 | 64 |
|
|
77 | 87 | updateStepStatus(currentStep.decrement); |
78 | 88 | } |
79 | 89 | }; |
| 90 | +
|
80 | 91 | </script> |
81 | 92 |
|
82 | 93 | <style> |
83 | 94 | .name { |
84 | 95 | color: #848383; |
85 | 96 | } |
| 97 | +
|
86 | 98 | .subtitle { |
87 | 99 | color: rgb(223, 219, 219); |
88 | 100 | display: block; |
89 | 101 | } |
| 102 | +
|
90 | 103 | .multistep-form { |
91 | 104 | display: flex; |
92 | 105 | } |
| 106 | +
|
93 | 107 | .separator, |
94 | 108 | .multistep-left-sidebar { |
95 | 109 | flex: 1; |
96 | 110 | } |
| 111 | +
|
97 | 112 | .multistep-right-sidebar { |
98 | 113 | flex: 3; |
99 | 114 | text-align: left; |
100 | 115 | } |
| 116 | +
|
101 | 117 | .multistep-continue-button { |
102 | 118 | float: right; |
103 | 119 | } |
| 120 | +
|
104 | 121 | .separator-check { |
105 | 122 | width: 15px; |
106 | 123 | height: 20px; |
|
110 | 127 | padding: 11px 10px 2px; |
111 | 128 | z-index: 10; |
112 | 129 | } |
| 130 | +
|
113 | 131 | .separator-check-pending { |
114 | 132 | width: 15px; |
115 | 133 | height: 20px; |
|
119 | 137 | padding: 11px 10px 2px; |
120 | 138 | z-index: 10; |
121 | 139 | } |
| 140 | +
|
122 | 141 | .separator-check-current { |
123 | 142 | width: 15px; |
124 | 143 | height: 20px; |
|
129 | 148 | z-index: 10; |
130 | 149 | box-shadow: 0px 1px 8px #5e40db; |
131 | 150 | } |
| 151 | +
|
132 | 152 | .separator-check-number { |
133 | 153 | color: white; |
134 | 154 | text-align: center; |
135 | 155 | margin-top: -3px; |
136 | 156 | } |
| 157 | +
|
137 | 158 | .separator-check-number-blank { |
138 | 159 | text-align: center; |
139 | 160 | margin-top: -3px; |
140 | 161 | } |
| 162 | +
|
141 | 163 | .separator-line { |
142 | 164 | border-right: 2px solid #ccc; |
143 | 165 | margin: 0 auto; |
144 | 166 | position: relative; |
145 | | - height: 40px; /* placeholder, should be displayed dynamically*/ |
| 167 | + height: 40px; |
| 168 | + /* placeholder, should be displayed dynamically*/ |
146 | 169 | width: 1px; |
147 | 170 | margin-bottom: 2px; |
148 | 171 | margin-top: 2px; |
149 | 172 | } |
| 173 | +
|
150 | 174 | .multistep-master-form { |
151 | 175 | padding: 30px; |
152 | 176 | height: 100%; |
153 | 177 | } |
| 178 | +
|
154 | 179 | #multistep-prev { |
155 | 180 | cursor: pointer; |
156 | 181 | margin-right: 20px; |
157 | 182 | } |
| 183 | +
|
158 | 184 | #multistep-next { |
159 | 185 | cursor: pointer; |
160 | 186 | margin-left: 20px; |
161 | 187 | } |
| 188 | +
|
162 | 189 | .dot { |
163 | 190 | height: 8px; |
164 | 191 | width: 8px; |
|
168 | 195 | margin-left: -2px; |
169 | 196 | margin-top: 18px; |
170 | 197 | } |
| 198 | +
|
171 | 199 | .multistep-title-side { |
172 | 200 | margin-top: 40px; |
173 | 201 | text-align: right; |
174 | 202 | } |
| 203 | +
|
175 | 204 | .multistep-form-title { |
176 | 205 | text-align: left; |
177 | 206 | color: #636262; |
178 | 207 | font-weight: bold; |
179 | 208 | } |
| 209 | +
|
180 | 210 | .multistep-form-subtitle { |
181 | 211 | text-align: left; |
182 | 212 | color: rgb(223, 219, 219); |
183 | 213 | margin-bottom: 30px; |
184 | 214 | font-weight: lighter; |
185 | 215 | } |
| 216 | +
|
186 | 217 | #multistep-error-messages { |
187 | 218 | position: absolute; |
188 | 219 | right: 0; |
|
196 | 227 | opacity: 0; |
197 | 228 | transition: visibility 0s, opacity 0.2s linear; |
198 | 229 | } |
| 230 | +
|
199 | 231 | </style> |
200 | 232 |
|
201 | 233 | <div class="multistep-master-form"> |
202 | 234 | <div id="multistep-error-messages" /> |
203 | 235 | <h1 class="multistep-form-title">{multiStepOptions.formTitle}</h1> |
204 | 236 | <h5 class="multistep-form-subtitle">{multiStepOptions.formSubtitle}</h5> |
205 | | - <form class="multistep-form" id="{multiStepOptions.formID}" method="{multiStepOptions.formMethodType}" action="{multiStepOptions.formActionURL}"> |
| 237 | + <form class="multistep-form" id="{multiStepOptions.formID}" method="{multiStepOptions.formMethodType}" |
| 238 | + action="{multiStepOptions.formActionURL}"> |
206 | 239 | <div class="multistep-left-sidebar"> |
207 | 240 | {#each multiStepOptions.stepsDescription as step} |
208 | 241 | <div class="multistep-title-side"> |
|
0 commit comments