@verbb/formie-browser 1.0.7 → 1.0.9
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/CHANGELOG.md +24 -0
- package/dist/chunks/_survey-presentations-RbSqcQph.js +4 -0
- package/dist/chunks/{address-state-BQ0xGV9n.js → address-state-BwE01m2_.js} +1 -1
- package/dist/chunks/{api-DztsCJ4r.js → api-BYe9YPko.js} +194 -153
- package/dist/chunks/{bpoint-2qDxlKD9.js → bpoint-C0VOftX9.js} +1 -1
- package/dist/chunks/{combobox-D-2b42wn.js → combobox-C0EuExSI.js} +1 -1
- package/dist/chunks/{eway-CImXrB4g.js → eway-CS6Y1Yvo.js} +1 -1
- package/dist/chunks/{file-upload-D49m8-DR.js → file-upload-rqfZNqlH.js} +1 -1
- package/dist/chunks/{go-cardless-Bz7HHtH0.js → go-cardless-BTPD668l.js} +1 -1
- package/dist/chunks/{mollie-BtnB3KGh.js → mollie-CXgBwvo6.js} +1 -1
- package/dist/chunks/{moneris-Bd4vUk8b.js → moneris-B6oLu7nj.js} +1 -1
- package/dist/chunks/{opayo-B-eRIXo-.js → opayo-DPUA5CKr.js} +1 -1
- package/dist/chunks/{paddle-BUFeEU4d.js → paddle-GRlsm5mm.js} +1 -1
- package/dist/chunks/{paypal-8Euw7Hrn.js → paypal-CdcZnf6r.js} +2 -2
- package/dist/chunks/{payway-dV0SzJxy.js → payway-CfmYOS__.js} +2 -2
- package/dist/chunks/{repeater-B5leVxZU.js → repeater-BVnPUqTj.js} +1 -1
- package/dist/chunks/rich-text-Bg_--4TG.js +349 -0
- package/dist/chunks/{square-reyJukb7.js → square-BY--5M-X.js} +1 -1
- package/dist/chunks/{stripe-BC-2PBvY.js → stripe-uusYjWty.js} +2 -2
- package/dist/chunks/{summary-D3AjxpYN.js → summary-Dks0gXS3.js} +42 -38
- package/dist/chunks/survey-likert-DkE6bR7B.js +20 -0
- package/dist/chunks/survey-rank-DN6x4IZM.js +127 -0
- package/dist/chunks/survey-rating-BnsNL9U5.js +88 -0
- package/dist/chunks/{table-C-lkQN6I.js → table-CAjCJHrL.js} +1 -1
- package/dist/chunks/{upload-manager-BpqWSHmU.js → upload-manager-W-QDgxKD.js} +1 -1
- package/dist/css/formie-theme.css +1 -0
- package/dist/css/theme/_tokens.css +10 -5
- package/dist/css/theme/fields/_check-radio.css +1 -1
- package/dist/css/theme/fields/_combobox.css +1 -1
- package/dist/css/theme/fields/_file.css +3 -3
- package/dist/css/theme/fields/_input.css +1 -1
- package/dist/css/theme/fields/_repeater.css +1 -1
- package/dist/css/theme/fields/_rich-text.css +1 -1
- package/dist/css/theme/fields/_select.css +1 -1
- package/dist/css/theme/fields/_survey-presentations.css +396 -0
- package/dist/css/theme/fields/_table.css +1 -1
- package/dist/css/theme/fields/_upload-manager.css +3 -3
- package/dist/css/theme/integrations/_paypal.css +1 -1
- package/dist/css/theme/integrations/_payway.css +1 -1
- package/dist/css/theme/integrations/_stripe.css +1 -1
- package/dist/index.js +398 -376
- package/dist/js/contracts/schema.d.ts +5 -0
- package/dist/js/contracts/schema.d.ts.map +1 -1
- package/dist/js/core/create-formie-client.d.ts.map +1 -1
- package/dist/js/core/page-client-event.d.ts +8 -4
- package/dist/js/core/page-client-event.d.ts.map +1 -1
- package/dist/js/core/submit-flow.d.ts.map +1 -1
- package/dist/js/core/submit-result-state.d.ts.map +1 -1
- package/dist/js/core/submit-result-ui.d.ts +1 -0
- package/dist/js/core/submit-result-ui.d.ts.map +1 -1
- package/dist/js/modules/fields/index.d.ts.map +1 -1
- package/dist/js/modules/fields/summary.d.ts.map +1 -1
- package/dist/js/modules/fields/survey-likert.d.ts +3 -0
- package/dist/js/modules/fields/survey-likert.d.ts.map +1 -0
- package/dist/js/modules/fields/survey-rank.d.ts +3 -0
- package/dist/js/modules/fields/survey-rank.d.ts.map +1 -0
- package/dist/js/modules/fields/survey-rating.d.ts +3 -0
- package/dist/js/modules/fields/survey-rating.d.ts.map +1 -0
- package/dist/js/transport/forms-api.d.ts.map +1 -1
- package/dist/js/utils/fields.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/css/formie-theme.css +1 -0
- package/src/css/theme/_tokens.css +10 -5
- package/src/css/theme/fields/_check-radio.css +1 -1
- package/src/css/theme/fields/_combobox.css +1 -1
- package/src/css/theme/fields/_file.css +3 -3
- package/src/css/theme/fields/_input.css +1 -1
- package/src/css/theme/fields/_repeater.css +1 -1
- package/src/css/theme/fields/_rich-text.css +1 -1
- package/src/css/theme/fields/_select.css +1 -1
- package/src/css/theme/fields/_survey-presentations.css +396 -0
- package/src/css/theme/fields/_table.css +1 -1
- package/src/css/theme/fields/_upload-manager.css +3 -3
- package/src/css/theme/integrations/_paypal.css +1 -1
- package/src/css/theme/integrations/_payway.css +1 -1
- package/src/css/theme/integrations/_stripe.css +1 -1
- package/src/js/contracts/schema.ts +6 -0
- package/src/js/core/create-formie-client.ts +14 -1
- package/src/js/core/page-client-event.ts +86 -18
- package/src/js/core/submit-flow.ts +3 -1
- package/src/js/core/submit-result-state.ts +18 -2
- package/src/js/core/submit-result-ui.ts +47 -9
- package/src/js/modules/fields/index.ts +3 -0
- package/src/js/modules/fields/summary.ts +17 -3
- package/src/js/modules/fields/survey-likert.ts +50 -0
- package/src/js/modules/fields/survey-rank.ts +385 -0
- package/src/js/modules/fields/survey-rating.ts +182 -0
- package/src/js/transport/forms-api.ts +1 -0
- package/src/js/utils/fields.ts +14 -2
- package/dist/chunks/rich-text-D0sb8bmX.js +0 -349
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
@layer formie-theme {
|
|
2
|
+
|
|
3
|
+
.formie-likert-field-layout {
|
|
4
|
+
display: table;
|
|
5
|
+
width: 100%;
|
|
6
|
+
table-layout: fixed;
|
|
7
|
+
border-collapse: collapse;
|
|
8
|
+
border-spacing: 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.formie-likert-field-layout thead {
|
|
12
|
+
display: table-header-group;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.formie-likert-field-layout tbody {
|
|
16
|
+
display: table-row-group;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.formie-likert-field-layout tr {
|
|
20
|
+
display: table-row;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.formie-likert-field-layout th,
|
|
24
|
+
.formie-likert-field-layout td {
|
|
25
|
+
display: table-cell;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.formie-likert-column-label {
|
|
29
|
+
text-align: center;
|
|
30
|
+
color: var(--formie-survey-likert-label-color, var(--formie-color-heading));
|
|
31
|
+
word-break: break-word;
|
|
32
|
+
padding: 0 0.35rem 0.5rem;
|
|
33
|
+
vertical-align: bottom;
|
|
34
|
+
font-size: var(--formie-survey-likert-column-label-font-size, 0.875rem);
|
|
35
|
+
line-height: 1.3;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
[data-formie-field-control]:has(> [data-formie-likert-multiple-rows]) {
|
|
39
|
+
overflow-x: auto;
|
|
40
|
+
-webkit-overflow-scrolling: touch;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@media (min-width: 40rem) {
|
|
44
|
+
.formie-likert-field-layout[data-formie-likert-multiple-rows] {
|
|
45
|
+
width: max-content;
|
|
46
|
+
min-width: 100%;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.formie-likert-field-layout[data-formie-likert-multiple-rows] .formie-likert-column-label {
|
|
50
|
+
min-width: var(--formie-survey-likert-column-min-width, 5.5rem);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.formie-likert-field-layout[data-formie-likert-multiple-rows] .formie-likert-option {
|
|
54
|
+
min-width: var(--formie-survey-likert-column-min-width, 5.5rem);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.formie-likert-row-label-header,
|
|
59
|
+
.formie-likert-row-label {
|
|
60
|
+
text-align: left;
|
|
61
|
+
color: var(--formie-survey-likert-label-color, var(--formie-color-heading));
|
|
62
|
+
word-break: break-word;
|
|
63
|
+
padding: 0.65rem 0.75rem 0.65rem 0;
|
|
64
|
+
vertical-align: middle;
|
|
65
|
+
font-weight: var(--formie-font-weight-medium);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.formie-likert-row-label-header {
|
|
69
|
+
padding-bottom: 0.5rem;
|
|
70
|
+
font-weight: var(--formie-font-weight-normal);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.formie-likert-field-layout[data-formie-likert-multiple-rows] {
|
|
74
|
+
table-layout: auto;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.formie-likert-field-layout[data-formie-likert-multiple-rows] .formie-likert-row-label-header,
|
|
78
|
+
.formie-likert-field-layout[data-formie-likert-multiple-rows] .formie-likert-row-label {
|
|
79
|
+
width: 1%;
|
|
80
|
+
white-space: nowrap;
|
|
81
|
+
padding-right: 1rem;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.formie-likert-field-layout[data-formie-likert-multiple-rows] .formie-likert-inputs-row .formie-likert-row-label {
|
|
85
|
+
border-top-left-radius: var(--formie-border-radius);
|
|
86
|
+
border-bottom-left-radius: var(--formie-border-radius);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.formie-likert-field-layout[data-formie-likert-multiple-rows] .formie-likert-inputs-row .formie-likert-option:first-child {
|
|
90
|
+
border-top-left-radius: 0;
|
|
91
|
+
border-bottom-left-radius: 0;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.formie-likert-inputs-row--alt .formie-likert-row-label,
|
|
95
|
+
.formie-likert-inputs-row--alt .formie-likert-option {
|
|
96
|
+
background-color: var(--formie-survey-likert-option-background-alt, var(--formie-color-surface));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.formie-likert-option {
|
|
100
|
+
text-align: center;
|
|
101
|
+
vertical-align: middle;
|
|
102
|
+
padding: 0.65rem 0.35rem;
|
|
103
|
+
background-color: var(--formie-survey-likert-option-background, var(--formie-color-surface-muted));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.formie-likert-inputs-row .formie-likert-option:first-child {
|
|
107
|
+
border-top-left-radius: var(--formie-border-radius);
|
|
108
|
+
border-bottom-left-radius: var(--formie-border-radius);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.formie-likert-inputs-row .formie-likert-option:last-child {
|
|
112
|
+
border-top-right-radius: var(--formie-border-radius);
|
|
113
|
+
border-bottom-right-radius: var(--formie-border-radius);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.formie-likert-option .formie-radio-option-label {
|
|
117
|
+
padding-left: 0;
|
|
118
|
+
width: var(--formie-check-size);
|
|
119
|
+
height: var(--formie-check-size);
|
|
120
|
+
line-height: var(--formie-check-size);
|
|
121
|
+
overflow: hidden;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.formie-likert-option .formie-likert-option-label-text {
|
|
125
|
+
display: none;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.formie-likert-option .formie-radio-option-label::before {
|
|
129
|
+
top: 0;
|
|
130
|
+
left: 0;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
@media (max-width: 39.999rem) {
|
|
134
|
+
[data-formie-field-control]:has(> [data-formie-likert-field-layout]) {
|
|
135
|
+
overflow-x: visible;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.formie-likert-field-layout {
|
|
139
|
+
display: block;
|
|
140
|
+
width: 100%;
|
|
141
|
+
table-layout: auto;
|
|
142
|
+
border-radius: 0;
|
|
143
|
+
background-color: transparent;
|
|
144
|
+
padding: 0;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.formie-likert-column-labels {
|
|
148
|
+
position: absolute;
|
|
149
|
+
width: 1px;
|
|
150
|
+
height: 1px;
|
|
151
|
+
margin: -1px;
|
|
152
|
+
padding: 0;
|
|
153
|
+
overflow: hidden;
|
|
154
|
+
clip: rect(0, 0, 0, 0);
|
|
155
|
+
clip-path: inset(50%);
|
|
156
|
+
white-space: nowrap;
|
|
157
|
+
border: 0;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.formie-likert-field-layout thead,
|
|
161
|
+
.formie-likert-field-layout tbody,
|
|
162
|
+
.formie-likert-field-layout tr,
|
|
163
|
+
.formie-likert-field-layout th,
|
|
164
|
+
.formie-likert-field-layout td {
|
|
165
|
+
display: block;
|
|
166
|
+
width: 100%;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.formie-likert-inputs-row {
|
|
170
|
+
margin: 0 0 var(--formie-space-2);
|
|
171
|
+
padding: var(--formie-space-2) var(--formie-space-3);
|
|
172
|
+
border-radius: var(--formie-border-radius);
|
|
173
|
+
background-color: var(--formie-survey-likert-option-background, var(--formie-color-surface-muted));
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.formie-likert-inputs-row:last-child {
|
|
177
|
+
margin-bottom: 0;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.formie-likert-inputs-row--alt {
|
|
181
|
+
background-color: var(--formie-survey-likert-option-background-alt, var(--formie-color-surface));
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.formie-likert-option {
|
|
185
|
+
display: block;
|
|
186
|
+
padding: var(--formie-space-2) 0;
|
|
187
|
+
text-align: left;
|
|
188
|
+
background-color: transparent;
|
|
189
|
+
border-radius: 0;
|
|
190
|
+
min-width: 0;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.formie-likert-option:first-child {
|
|
194
|
+
padding-top: 0;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.formie-likert-option:last-child {
|
|
198
|
+
padding-bottom: 0;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.formie-likert-option .formie-radio-option-label {
|
|
202
|
+
width: auto;
|
|
203
|
+
height: auto;
|
|
204
|
+
overflow: visible;
|
|
205
|
+
padding-left: var(--formie-check-label-padding-left);
|
|
206
|
+
line-height: var(--formie-check-line-height);
|
|
207
|
+
font-weight: var(--formie-font-weight-normal);
|
|
208
|
+
color: var(--formie-color-text);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.formie-likert-option .formie-likert-option-label-text {
|
|
212
|
+
display: inline;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.formie-likert-field-layout[data-formie-likert-multiple-rows] .formie-likert-row-label {
|
|
216
|
+
display: block;
|
|
217
|
+
width: 100%;
|
|
218
|
+
padding: 0 0 var(--formie-space-2);
|
|
219
|
+
font-weight: var(--formie-font-weight-medium);
|
|
220
|
+
background-color: transparent;
|
|
221
|
+
white-space: normal;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.formie-likert-field-layout[data-formie-likert-multiple-rows] .formie-likert-inputs-row {
|
|
225
|
+
border-top: 0;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.formie-likert-field-layout[data-formie-likert-multiple-rows] .formie-likert-inputs-row .formie-likert-row-label {
|
|
229
|
+
border-radius: 0;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.formie-likert-field-layout[data-formie-likert-multiple-rows] .formie-likert-inputs-row .formie-likert-option:first-child {
|
|
233
|
+
border-radius: 0;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.formie-likert-field-layout[data-formie-likert-multiple-rows] .formie-likert-inputs-row .formie-likert-option:last-child {
|
|
237
|
+
border-radius: 0;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.formie-rank-field-layout {
|
|
242
|
+
width: 100%;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.formie-rank-list,
|
|
246
|
+
.formie-rank-field-layout .formie-rank-list.formie-field-options {
|
|
247
|
+
list-style: none;
|
|
248
|
+
margin: var(--formie-space-1) 0 0;
|
|
249
|
+
padding: 0;
|
|
250
|
+
display: flex;
|
|
251
|
+
flex-direction: column;
|
|
252
|
+
flex-wrap: nowrap;
|
|
253
|
+
gap: var(--formie-survey-rank-list-gap, var(--formie-space-2));
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.formie-rank-list[data-formie-rank-sorting="true"] {
|
|
257
|
+
user-select: none;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.formie-rank-item {
|
|
261
|
+
display: flex;
|
|
262
|
+
align-items: center;
|
|
263
|
+
gap: var(--formie-space-2);
|
|
264
|
+
margin: 0;
|
|
265
|
+
padding: var(--formie-space-2) var(--formie-space-3);
|
|
266
|
+
border: var(--formie-border-width) solid var(--formie-survey-rank-item-border-color, var(--formie-color-border-control));
|
|
267
|
+
border-radius: var(--formie-border-radius);
|
|
268
|
+
background: var(--formie-survey-rank-item-background, var(--formie-color-surface));
|
|
269
|
+
cursor: move;
|
|
270
|
+
touch-action: none;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.formie-rank-placeholder {
|
|
274
|
+
box-sizing: border-box;
|
|
275
|
+
margin: 0;
|
|
276
|
+
padding: 0;
|
|
277
|
+
list-style: none;
|
|
278
|
+
border: 0;
|
|
279
|
+
background: transparent;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.formie-rank-handle {
|
|
283
|
+
display: inline-flex;
|
|
284
|
+
align-items: center;
|
|
285
|
+
justify-content: center;
|
|
286
|
+
width: 0.875rem;
|
|
287
|
+
height: 1.125rem;
|
|
288
|
+
padding: 0;
|
|
289
|
+
border: 0;
|
|
290
|
+
background: transparent;
|
|
291
|
+
color: var(--formie-survey-rank-handle-color, var(--formie-color-text-muted));
|
|
292
|
+
opacity: 0.6;
|
|
293
|
+
cursor: move;
|
|
294
|
+
flex-shrink: 0;
|
|
295
|
+
pointer-events: none;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
.formie-rank-handle::before {
|
|
299
|
+
display: block;
|
|
300
|
+
width: 13px;
|
|
301
|
+
height: 0.875rem;
|
|
302
|
+
content: "";
|
|
303
|
+
background: currentColor;
|
|
304
|
+
mask: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 640'%3E%3Cpath d='M288 128C288 92.7 259.3 64 224 64C188.7 64 160 92.7 160 128C160 163.3 188.7 192 224 192C259.3 192 288 163.3 288 128zM288 320C288 284.7 259.3 256 224 256C188.7 256 160 284.7 160 320C160 355.3 188.7 384 224 384C259.3 384 288 355.3 288 320zM160 512C160 547.3 188.7 576 224 576C259.3 576 288 547.3 288 512C288 476.7 259.3 448 224 448C188.7 448 160 476.7 160 512zM480 128C480 92.7 451.3 64 416 64C380.7 64 352 92.7 352 128C352 163.3 380.7 192 416 192C451.3 192 480 163.3 480 128zM352 320C352 355.3 380.7 384 416 384C451.3 384 480 355.3 480 320C480 284.7 451.3 256 416 256C380.7 256 352 284.7 352 320zM480 512C480 476.7 451.3 448 416 448C380.7 448 352 476.7 352 512C352 547.3 380.7 576 416 576C451.3 576 480 547.3 480 512z'/%3E%3C/svg%3E") center / contain no-repeat;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.formie-rank-option-label {
|
|
308
|
+
flex: 1 1 auto;
|
|
309
|
+
font-size: var(--formie-check-font-size);
|
|
310
|
+
line-height: var(--formie-check-line-height);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.formie-rank-input {
|
|
314
|
+
display: none;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.formie-rating-field-layout {
|
|
318
|
+
width: 100%;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.formie-rating-stars,
|
|
322
|
+
.formie-rating-field-layout .formie-rating-stars.formie-field-options {
|
|
323
|
+
display: inline-flex;
|
|
324
|
+
flex-wrap: nowrap;
|
|
325
|
+
align-items: center;
|
|
326
|
+
padding: var(--formie-space-2) 0;
|
|
327
|
+
gap: 0;
|
|
328
|
+
--formie-survey-rating-star-size: 26px;
|
|
329
|
+
--formie-survey-rating-star-spacing: var(--formie-space-1);
|
|
330
|
+
--formie-survey-rating-star-outline: url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2023%22%20fill%3D%22none%22%3E%3Cpath%20d%3D%22M22.2%208.05333L15.7466%207.49333L13.2266%201.56C12.7733%200.48%2011.2266%200.48%2010.7733%201.56L8.25331%207.50667L1.81331%208.05333C0.639975%208.14667%200.159975%209.61333%201.05331%2010.3867L5.94664%2014.6267L4.47998%2020.92C4.21331%2022.0667%205.45331%2022.9733%206.46664%2022.36L12%2019.0267L17.5333%2022.3733C18.5466%2022.9867%2019.7866%2022.08%2019.52%2020.9333L18.0533%2014.6267L22.9466%2010.3867C23.84%209.61333%2023.3733%208.14667%2022.2%208.05333ZM12%2016.5333L6.98664%2019.56L8.31998%2013.8533L3.89331%2010.0133L9.73331%209.50667L12%204.13333L14.28%209.52L20.12%2010.0267L15.6933%2013.8667L17.0266%2019.5733L12%2016.5333Z%22%20fill%3D%22%23E27730%22%2F%3E%3C%2Fsvg%3E");
|
|
331
|
+
--formie-survey-rating-star-filled: url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2023%22%20fill%3D%22none%22%3E%3Cpath%20d%3D%22M12%2019.0267L17.5333%2022.3733C18.5466%2022.9867%2019.7866%2022.08%2019.52%2020.9333L18.0533%2014.64L22.9466%2010.4C23.84%209.62667%2023.36%208.16%2022.1866%208.06667L15.7466%207.52L13.2266%201.57334C12.7733%200.493336%2011.2266%200.493336%2010.7733%201.57334L8.25331%207.50667L1.81331%208.05334C0.639975%208.14667%200.159975%209.61334%201.05331%2010.3867L5.94664%2014.6267L4.47997%2020.92C4.21331%2022.0667%205.45331%2022.9733%206.46664%2022.36L12%2019.0267Z%22%20fill%3D%22%23E27730%22%2F%3E%3C%2Fsvg%3E");
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.formie-rating-option {
|
|
335
|
+
position: relative;
|
|
336
|
+
margin: 0;
|
|
337
|
+
gap: 0;
|
|
338
|
+
align-items: center;
|
|
339
|
+
cursor: pointer;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.formie-rating-input {
|
|
343
|
+
position: absolute;
|
|
344
|
+
width: 1px;
|
|
345
|
+
height: 1px;
|
|
346
|
+
margin: -1px;
|
|
347
|
+
padding: 0;
|
|
348
|
+
overflow: hidden;
|
|
349
|
+
clip: rect(0, 0, 0, 0);
|
|
350
|
+
clip-path: inset(50%);
|
|
351
|
+
white-space: nowrap;
|
|
352
|
+
border: 0;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
.formie-rating-option-label {
|
|
356
|
+
display: inline-flex;
|
|
357
|
+
cursor: pointer;
|
|
358
|
+
padding-inline: calc(var(--formie-survey-rating-star-spacing, var(--formie-space-1)) / 2);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
.formie-rating-star {
|
|
362
|
+
display: block;
|
|
363
|
+
width: var(--formie-survey-rating-star-size, 26px);
|
|
364
|
+
height: var(--formie-survey-rating-star-size, 26px);
|
|
365
|
+
background: center / contain no-repeat;
|
|
366
|
+
background-image: var(--formie-survey-rating-star-outline);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
.formie-rating-stars:not([data-formie-rating-hover])[data-formie-rating-value="1"] .formie-rating-option:nth-child(-n+1) .formie-rating-star,
|
|
370
|
+
.formie-rating-stars:not([data-formie-rating-hover])[data-formie-rating-value="2"] .formie-rating-option:nth-child(-n+2) .formie-rating-star,
|
|
371
|
+
.formie-rating-stars:not([data-formie-rating-hover])[data-formie-rating-value="3"] .formie-rating-option:nth-child(-n+3) .formie-rating-star,
|
|
372
|
+
.formie-rating-stars:not([data-formie-rating-hover])[data-formie-rating-value="4"] .formie-rating-option:nth-child(-n+4) .formie-rating-star,
|
|
373
|
+
.formie-rating-stars:not([data-formie-rating-hover])[data-formie-rating-value="5"] .formie-rating-option:nth-child(-n+5) .formie-rating-star,
|
|
374
|
+
.formie-rating-stars:not([data-formie-rating-hover])[data-formie-rating-value="6"] .formie-rating-option:nth-child(-n+6) .formie-rating-star,
|
|
375
|
+
.formie-rating-stars:not([data-formie-rating-hover])[data-formie-rating-value="7"] .formie-rating-option:nth-child(-n+7) .formie-rating-star,
|
|
376
|
+
.formie-rating-stars:not([data-formie-rating-hover])[data-formie-rating-value="8"] .formie-rating-option:nth-child(-n+8) .formie-rating-star,
|
|
377
|
+
.formie-rating-stars:not([data-formie-rating-hover])[data-formie-rating-value="9"] .formie-rating-option:nth-child(-n+9) .formie-rating-star,
|
|
378
|
+
.formie-rating-stars:not([data-formie-rating-hover])[data-formie-rating-value="10"] .formie-rating-option:nth-child(-n+10) .formie-rating-star,
|
|
379
|
+
.formie-rating-stars[data-formie-rating-hover="1"] .formie-rating-option:nth-child(-n+1) .formie-rating-star,
|
|
380
|
+
.formie-rating-stars[data-formie-rating-hover="2"] .formie-rating-option:nth-child(-n+2) .formie-rating-star,
|
|
381
|
+
.formie-rating-stars[data-formie-rating-hover="3"] .formie-rating-option:nth-child(-n+3) .formie-rating-star,
|
|
382
|
+
.formie-rating-stars[data-formie-rating-hover="4"] .formie-rating-option:nth-child(-n+4) .formie-rating-star,
|
|
383
|
+
.formie-rating-stars[data-formie-rating-hover="5"] .formie-rating-option:nth-child(-n+5) .formie-rating-star,
|
|
384
|
+
.formie-rating-stars[data-formie-rating-hover="6"] .formie-rating-option:nth-child(-n+6) .formie-rating-star,
|
|
385
|
+
.formie-rating-stars[data-formie-rating-hover="7"] .formie-rating-option:nth-child(-n+7) .formie-rating-star,
|
|
386
|
+
.formie-rating-stars[data-formie-rating-hover="8"] .formie-rating-option:nth-child(-n+8) .formie-rating-star,
|
|
387
|
+
.formie-rating-stars[data-formie-rating-hover="9"] .formie-rating-option:nth-child(-n+9) .formie-rating-star,
|
|
388
|
+
.formie-rating-stars[data-formie-rating-hover="10"] .formie-rating-option:nth-child(-n+10) .formie-rating-star {
|
|
389
|
+
background-image: var(--formie-survey-rating-star-filled);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
.formie-rating-input:focus-visible+.formie-rating-option-label .formie-rating-star {
|
|
393
|
+
outline: 2px solid var(--formie-color-focus-ring);
|
|
394
|
+
outline-offset: 2px;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
text-align: var(--formie-table-th-text-align);
|
|
18
18
|
font-size: var(--formie-table-th-font-size);
|
|
19
19
|
font-weight: var(--formie-table-th-font-weight);
|
|
20
|
-
color: var(--formie-table-th-color, var(--formie-
|
|
20
|
+
color: var(--formie-table-th-color, var(--formie-color-text-muted));
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
.formie-table th,
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
gap: var(--formie-space-2);
|
|
14
14
|
padding: var(--formie-space-4);
|
|
15
15
|
min-height: calc(var(--formie-control-height) * 3);
|
|
16
|
-
border: var(--formie-border-width) dashed var(--formie-color-border);
|
|
16
|
+
border: var(--formie-border-width) dashed var(--formie-color-border-control);
|
|
17
17
|
border-radius: var(--formie-radius-sm);
|
|
18
18
|
background: var(--formie-color-surface-subtle);
|
|
19
19
|
color: var(--formie-color-text);
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
align-items: center;
|
|
62
62
|
gap: var(--formie-space-2);
|
|
63
63
|
padding: var(--formie-space-2) var(--formie-space-3);
|
|
64
|
-
border: var(--formie-border-width) solid var(--formie-color-border);
|
|
64
|
+
border: var(--formie-border-width) solid var(--formie-color-border-control);
|
|
65
65
|
border-radius: var(--formie-radius-sm);
|
|
66
66
|
background: var(--formie-color-surface);
|
|
67
67
|
}
|
|
@@ -150,7 +150,7 @@
|
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
.formie-upload-manager-item.is-upload-complete .formie-upload-manager-progress-label {
|
|
153
|
-
color: var(--formie-color-success, var(--formie-color-primary));
|
|
153
|
+
color: var(--formie-color-success-dark, var(--formie-color-primary));
|
|
154
154
|
font-weight: var(--formie-font-weight-medium);
|
|
155
155
|
}
|
|
156
156
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
@layer formie-theme {
|
|
2
2
|
.formie-paypal-button {
|
|
3
|
-
border: var(--formie-border-width) solid var(--formie-color-border);
|
|
3
|
+
border: var(--formie-border-width) solid var(--formie-color-border-control);
|
|
4
4
|
border-radius: var(--formie-radius-sm);
|
|
5
5
|
background: var(--formie-color-surface);
|
|
6
6
|
box-sizing: border-box;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
@layer formie-theme {
|
|
2
2
|
.formie-payway-button {
|
|
3
|
-
border: var(--formie-border-width) solid var(--formie-color-border);
|
|
3
|
+
border: var(--formie-border-width) solid var(--formie-color-border-control);
|
|
4
4
|
border-radius: var(--formie-radius-sm);
|
|
5
5
|
background: var(--formie-color-surface);
|
|
6
6
|
box-sizing: border-box;
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
min-height: 12rem;
|
|
11
11
|
width: 100%;
|
|
12
12
|
padding: var(--formie-space-4);
|
|
13
|
-
border: var(--formie-border-width) solid var(--formie-color-border);
|
|
13
|
+
border: var(--formie-border-width) solid var(--formie-color-border-control);
|
|
14
14
|
border-radius: var(--formie-radius-sm);
|
|
15
15
|
background: var(--formie-color-surface);
|
|
16
16
|
color: var(--formie-color-text-muted);
|
|
@@ -43,6 +43,11 @@ export type FormRedirect = {
|
|
|
43
43
|
target?: 'same-tab' | 'new-tab';
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
+
export type FormClientEvent = {
|
|
47
|
+
event: string;
|
|
48
|
+
payload: Record<string, string>;
|
|
49
|
+
};
|
|
50
|
+
|
|
46
51
|
export type FormSubmitResult = {
|
|
47
52
|
ok: boolean;
|
|
48
53
|
action?: FormAction;
|
|
@@ -56,6 +61,7 @@ export type FormSubmitResult = {
|
|
|
56
61
|
nextPage?: { id: string } | null;
|
|
57
62
|
redirect?: FormRedirect | null;
|
|
58
63
|
submitData?: unknown[];
|
|
64
|
+
clientEvents?: FormClientEvent[];
|
|
59
65
|
meta?: Record<string, unknown>;
|
|
60
66
|
};
|
|
61
67
|
|
|
@@ -12,7 +12,7 @@ import type { FormEndpointPayload, FormModuleManifest, FormSubmitResult } from '
|
|
|
12
12
|
import type { ThemeClassMap } from '#contracts/theme';
|
|
13
13
|
import { dispatchFormieDomEvent } from '#core/dom-events';
|
|
14
14
|
import { getErrorAriaLivePreference } from '#core/error-aria-live';
|
|
15
|
-
import { dispatchPageClientEventForSubmit } from '#core/page-client-event';
|
|
15
|
+
import { dispatchPageClientEventForSubmit, dispatchPendingClientEventsFromForm } from '#core/page-client-event';
|
|
16
16
|
import { syncPageTabErrors } from '#core/page-tab-errors';
|
|
17
17
|
import {
|
|
18
18
|
enhanceServerRenderedFieldErrors,
|
|
@@ -1020,6 +1020,14 @@ export function createFormieClient(): FormieClient {
|
|
|
1020
1020
|
if (form) {
|
|
1021
1021
|
ensureFormStartedAt(form);
|
|
1022
1022
|
|
|
1023
|
+
if (normalizedOptions.themeConfig && typeof normalizedOptions.themeConfig === 'object') {
|
|
1024
|
+
form.setAttribute('data-formie-theme-config', JSON.stringify(normalizedOptions.themeConfig));
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
if (normalizedOptions.theme && normalizedOptions.theme !== 'formie') {
|
|
1028
|
+
form.setAttribute('data-formie-frontend-theme', normalizedOptions.theme);
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1023
1031
|
if (renderPayload || normalizedOptions.endpoint || (target as HTMLElement).dataset.formieEndpoint) {
|
|
1024
1032
|
normalizeHeadlessManagedUrls(target, form, normalizedOptions);
|
|
1025
1033
|
}
|
|
@@ -1249,6 +1257,11 @@ export function createFormieClient(): FormieClient {
|
|
|
1249
1257
|
id,
|
|
1250
1258
|
mode: normalizedOptions.mode as FormMode,
|
|
1251
1259
|
});
|
|
1260
|
+
|
|
1261
|
+
if (form instanceof HTMLFormElement) {
|
|
1262
|
+
dispatchPendingClientEventsFromForm(form);
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1252
1265
|
debug.log('Mount complete.', {
|
|
1253
1266
|
id,
|
|
1254
1267
|
target: getTargetDebugLabel(target),
|
|
@@ -3,11 +3,17 @@ import { createDebug } from '#utils/debug';
|
|
|
3
3
|
const debug = createDebug('general', 'page-client-event');
|
|
4
4
|
|
|
5
5
|
const CLIENT_EVENT_ATTR = 'data-formie-client-event';
|
|
6
|
+
const PENDING_CLIENT_EVENTS_ATTR = 'data-formie-pending-client-events';
|
|
6
7
|
|
|
7
8
|
type ClientEventPayload = {
|
|
8
9
|
fields?: Array<{ label?: string; value?: string }>;
|
|
9
10
|
};
|
|
10
11
|
|
|
12
|
+
export type ResolvedClientEvent = {
|
|
13
|
+
event: string;
|
|
14
|
+
payload: Record<string, string>;
|
|
15
|
+
};
|
|
16
|
+
|
|
11
17
|
function escapePageIdForSelector(pageId: string): string {
|
|
12
18
|
if (typeof window !== 'undefined' && window.CSS?.escape) {
|
|
13
19
|
return window.CSS.escape(pageId);
|
|
@@ -70,11 +76,83 @@ function buildPayloadObject(fields: Array<{ label?: string; value?: string }>):
|
|
|
70
76
|
return out;
|
|
71
77
|
}
|
|
72
78
|
|
|
79
|
+
function normalizeResolvedClientEvents(events: unknown): ResolvedClientEvent[] {
|
|
80
|
+
if (!Array.isArray(events)) {
|
|
81
|
+
return [];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return events
|
|
85
|
+
.map((item) => {
|
|
86
|
+
if (!item || typeof item !== 'object') {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const record = item as ResolvedClientEvent;
|
|
91
|
+
const eventName = typeof record.event === 'string' ? record.event.trim() : '';
|
|
92
|
+
const payload = record.payload && typeof record.payload === 'object' ? record.payload : null;
|
|
93
|
+
|
|
94
|
+
if (!eventName || !payload) {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return {
|
|
99
|
+
event: eventName,
|
|
100
|
+
payload,
|
|
101
|
+
};
|
|
102
|
+
})
|
|
103
|
+
.filter((item): item is ResolvedClientEvent => item !== null);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export function dispatchResolvedClientEvents(form: HTMLFormElement, events: ResolvedClientEvent[]): void {
|
|
107
|
+
if (!events.length) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const win = window as Window & { dataLayer?: unknown[] };
|
|
112
|
+
win.dataLayer = win.dataLayer || [];
|
|
113
|
+
|
|
114
|
+
events.forEach((item) => {
|
|
115
|
+
win.dataLayer!.push(item.payload);
|
|
116
|
+
|
|
117
|
+
form.dispatchEvent(new CustomEvent('formie:client-event', {
|
|
118
|
+
bubbles: true,
|
|
119
|
+
detail: {
|
|
120
|
+
event: item.event,
|
|
121
|
+
payload: item.payload,
|
|
122
|
+
},
|
|
123
|
+
}));
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
debug.log('Dispatched resolved client events.', {
|
|
127
|
+
count: events.length,
|
|
128
|
+
events: events.map((item) => item.event),
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export function dispatchPendingClientEventsFromForm(form: HTMLFormElement): void {
|
|
133
|
+
const rawAttr = form.getAttribute(PENDING_CLIENT_EVENTS_ATTR);
|
|
134
|
+
|
|
135
|
+
if (!rawAttr?.trim()) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
try {
|
|
140
|
+
const parsed = JSON.parse(rawAttr) as unknown;
|
|
141
|
+
const events = normalizeResolvedClientEvents(parsed);
|
|
142
|
+
|
|
143
|
+
if (events.length) {
|
|
144
|
+
dispatchResolvedClientEvents(form, events);
|
|
145
|
+
}
|
|
146
|
+
} catch {
|
|
147
|
+
debug.warn('Invalid pending client events JSON on form element.');
|
|
148
|
+
} finally {
|
|
149
|
+
form.removeAttribute(PENDING_CLIENT_EVENTS_ATTR);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
73
153
|
/**
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* **submit** (not back/save), push the configured key/value object to
|
|
77
|
-
* `window.dataLayer` (when present) and dispatch `formie:client-event`.
|
|
154
|
+
* Legacy static page attribute dispatch. Prefer server-resolved `clientEvents`
|
|
155
|
+
* from the submit response when available.
|
|
78
156
|
*/
|
|
79
157
|
export function dispatchPageClientEventForSubmit(form: HTMLFormElement, action: string): void {
|
|
80
158
|
if (action !== 'submit') {
|
|
@@ -112,18 +190,8 @@ export function dispatchPageClientEventForSubmit(form: HTMLFormElement, action:
|
|
|
112
190
|
}
|
|
113
191
|
|
|
114
192
|
const payload = buildPayloadObject(config.fields);
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
form.dispatchEvent(new CustomEvent('formie:client-event', {
|
|
121
|
-
bubbles: true,
|
|
122
|
-
detail: { payload },
|
|
123
|
-
}));
|
|
124
|
-
|
|
125
|
-
debug.log('Dispatched page client event.', {
|
|
126
|
-
pageId,
|
|
127
|
-
keys: Object.keys(payload),
|
|
128
|
-
});
|
|
193
|
+
dispatchResolvedClientEvents(form, [{
|
|
194
|
+
event: typeof payload.event === 'string' && payload.event !== '' ? payload.event : 'formPageSubmission',
|
|
195
|
+
payload,
|
|
196
|
+
}]);
|
|
129
197
|
}
|
|
@@ -90,11 +90,13 @@ export async function executeAjaxSubmitFlow(params: {
|
|
|
90
90
|
validateOnSubmit,
|
|
91
91
|
});
|
|
92
92
|
applySubmitResultUi(form, result);
|
|
93
|
+
// Let captcha modules refresh one-time tokens before payment follow-up
|
|
94
|
+
// handlers (e.g. Stripe confirm) trigger an internal resubmit.
|
|
95
|
+
dispatchSubmitResult(result);
|
|
93
96
|
applySubmitResultState(form, result, action);
|
|
94
97
|
if (shouldRefreshTokensAfterSubmit(result)) {
|
|
95
98
|
await onRefreshTokensAfterSubmit(result);
|
|
96
99
|
}
|
|
97
|
-
dispatchSubmitResult(result);
|
|
98
100
|
} catch (error) {
|
|
99
101
|
result = {
|
|
100
102
|
ok: false,
|