@formhaus/core 0.13.1 → 0.14.0
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/dist/{check-definition-DuLExofm.d.ts → check-definition-DyiWqhEV.d.ts} +3 -3
- package/dist/chunk-5WADJMJJ.js +2 -0
- package/dist/chunk-5WADJMJJ.js.map +1 -0
- package/dist/chunk-5YPOS62Y.js +3 -0
- package/dist/chunk-5YPOS62Y.js.map +1 -0
- package/dist/chunk-CW5ZWCSD.js +2 -0
- package/dist/chunk-CW5ZWCSD.js.map +1 -0
- package/dist/chunk-QMT7RJ4T.js +3 -0
- package/dist/chunk-QMT7RJ4T.js.map +1 -0
- package/dist/chunk-QVA6DLYS.js +2 -0
- package/dist/chunk-QVA6DLYS.js.map +1 -0
- package/dist/chunk-REIX6ART.js +2 -0
- package/dist/chunk-REIX6ART.js.map +1 -0
- package/dist/chunk-TMO47L42.js +5 -0
- package/dist/chunk-TMO47L42.js.map +1 -0
- package/dist/cloud.d.ts +3 -3
- package/dist/cloud.js +1 -1
- package/dist/{controller-Ds_kbXSU.d.ts → controller-BJVYkMHT.d.ts} +1 -1
- package/dist/default-messages-E-nZe4Tc.d.ts +10 -0
- package/dist/{definition-B4OIy_wH.d.ts → definition-o4Y0OY6y.d.ts} +53 -6
- package/dist/fix.d.ts +38 -0
- package/dist/fix.js +3 -0
- package/dist/fix.js.map +1 -0
- package/dist/i18n.d.ts +4 -3
- package/dist/i18n.js +1 -1
- package/dist/i18n.js.map +1 -1
- package/dist/{runtime-BN2PuKD7.d.ts → index-BNGgMIbC.d.ts} +20 -6
- package/dist/index.d.ts +67 -11
- package/dist/index.js +1 -1
- package/dist/internal.d.ts +28 -8
- package/dist/internal.js +1 -1
- package/dist/internal.js.map +1 -1
- package/dist/issues-Dua58e1J.d.ts +14 -0
- package/dist/server.d.ts +5 -5
- package/dist/server.iife.js +3 -3
- package/dist/server.iife.js.map +1 -1
- package/dist/server.js +1 -1
- package/dist/server.js.map +1 -1
- package/dist/{validate-field-ND_UxoJU.d.ts → validate-field-CRR6GQBA.d.ts} +2 -2
- package/fixtures/submissions/choices.json +6 -26
- package/fixtures/submissions/groups.json +649 -0
- package/fixtures/submissions/messages.json +4 -16
- package/fixtures/submissions/show-conditions.json +2 -7
- package/fixtures/submissions/skip-routes.json +1 -3
- package/fixtures/submissions/skip.json +3 -9
- package/fixtures/submissions/special-types.json +2 -6
- package/package.json +10 -6
- package/schema/form-definition.schema.json +380 -19
- package/schema/form-translation.schema.json +79 -1
- package/style.css +103 -82
- package/dist/chunk-35SAVPYL.js +0 -2
- package/dist/chunk-35SAVPYL.js.map +0 -1
- package/dist/chunk-76YV4J3Q.js +0 -3
- package/dist/chunk-76YV4J3Q.js.map +0 -1
- package/dist/chunk-PBTYUSZR.js +0 -2
- package/dist/chunk-PBTYUSZR.js.map +0 -1
- package/dist/chunk-PZEBYRGE.js +0 -2
- package/dist/chunk-PZEBYRGE.js.map +0 -1
- package/dist/chunk-RN5GQHKN.js +0 -5
- package/dist/chunk-RN5GQHKN.js.map +0 -1
- package/dist/chunk-YTUVSJUF.js +0 -3
- package/dist/chunk-YTUVSJUF.js.map +0 -1
- package/dist/default-messages-yS4QtrYi.d.ts +0 -23
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
3
|
"$id": "https://formhaus.dev/schema/form-translation.json",
|
|
4
4
|
"title": "Formhaus translation overlay",
|
|
5
|
-
"description": "Translated texts of one form in one language, keyed by step id, field key and option value. Every leaf is a string; empty strings fall back to the source text.",
|
|
5
|
+
"description": "Translated texts of one form in one language, keyed by step id, section key, field key and option value. Every leaf is a string; empty strings fall back to the source text.",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"properties": {
|
|
8
8
|
"title": {
|
|
@@ -71,6 +71,9 @@
|
|
|
71
71
|
"datetime": {
|
|
72
72
|
"type": "string"
|
|
73
73
|
},
|
|
74
|
+
"time": {
|
|
75
|
+
"type": "string"
|
|
76
|
+
},
|
|
74
77
|
"option": {
|
|
75
78
|
"type": "string"
|
|
76
79
|
},
|
|
@@ -88,6 +91,9 @@
|
|
|
88
91
|
},
|
|
89
92
|
"value": {
|
|
90
93
|
"type": "string"
|
|
94
|
+
},
|
|
95
|
+
"hidden": {
|
|
96
|
+
"type": "string"
|
|
91
97
|
}
|
|
92
98
|
},
|
|
93
99
|
"additionalProperties": false
|
|
@@ -106,10 +112,52 @@
|
|
|
106
112
|
},
|
|
107
113
|
"errorSummary": {
|
|
108
114
|
"type": "string"
|
|
115
|
+
},
|
|
116
|
+
"addItem": {
|
|
117
|
+
"type": "string"
|
|
118
|
+
},
|
|
119
|
+
"removeItem": {
|
|
120
|
+
"type": "string"
|
|
121
|
+
},
|
|
122
|
+
"itemLabel": {
|
|
123
|
+
"type": "string"
|
|
124
|
+
},
|
|
125
|
+
"itemAdded": {
|
|
126
|
+
"type": "string"
|
|
127
|
+
},
|
|
128
|
+
"itemRemoved": {
|
|
129
|
+
"type": "string"
|
|
130
|
+
},
|
|
131
|
+
"removeItemNamed": {
|
|
132
|
+
"type": "string"
|
|
133
|
+
},
|
|
134
|
+
"removeItemPrompt": {
|
|
135
|
+
"type": "string"
|
|
136
|
+
},
|
|
137
|
+
"removeItemBody": {
|
|
138
|
+
"type": "string"
|
|
139
|
+
},
|
|
140
|
+
"cancel": {
|
|
141
|
+
"type": "string"
|
|
109
142
|
}
|
|
110
143
|
},
|
|
111
144
|
"additionalProperties": false
|
|
112
145
|
},
|
|
146
|
+
"sections": {
|
|
147
|
+
"type": "object",
|
|
148
|
+
"additionalProperties": {
|
|
149
|
+
"type": "object",
|
|
150
|
+
"properties": {
|
|
151
|
+
"title": {
|
|
152
|
+
"type": "string"
|
|
153
|
+
},
|
|
154
|
+
"description": {
|
|
155
|
+
"type": "string"
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
"additionalProperties": false
|
|
159
|
+
}
|
|
160
|
+
},
|
|
113
161
|
"fields": {
|
|
114
162
|
"type": "object",
|
|
115
163
|
"additionalProperties": {
|
|
@@ -137,6 +185,15 @@
|
|
|
137
185
|
"helperText": {
|
|
138
186
|
"type": "string"
|
|
139
187
|
},
|
|
188
|
+
"itemLabel": {
|
|
189
|
+
"type": "string"
|
|
190
|
+
},
|
|
191
|
+
"addLabel": {
|
|
192
|
+
"type": "string"
|
|
193
|
+
},
|
|
194
|
+
"removeLabel": {
|
|
195
|
+
"type": "string"
|
|
196
|
+
},
|
|
140
197
|
"options": {
|
|
141
198
|
"type": "object",
|
|
142
199
|
"additionalProperties": {
|
|
@@ -169,6 +226,12 @@
|
|
|
169
226
|
}
|
|
170
227
|
},
|
|
171
228
|
"additionalProperties": false
|
|
229
|
+
},
|
|
230
|
+
"fields": {
|
|
231
|
+
"type": "object",
|
|
232
|
+
"additionalProperties": {
|
|
233
|
+
"$ref": "#/definitions/field"
|
|
234
|
+
}
|
|
172
235
|
}
|
|
173
236
|
},
|
|
174
237
|
"additionalProperties": false
|
|
@@ -209,6 +272,21 @@
|
|
|
209
272
|
},
|
|
210
273
|
"additionalProperties": false
|
|
211
274
|
},
|
|
275
|
+
"sections": {
|
|
276
|
+
"type": "object",
|
|
277
|
+
"additionalProperties": {
|
|
278
|
+
"type": "object",
|
|
279
|
+
"properties": {
|
|
280
|
+
"title": {
|
|
281
|
+
"type": "string"
|
|
282
|
+
},
|
|
283
|
+
"description": {
|
|
284
|
+
"type": "string"
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
"additionalProperties": false
|
|
288
|
+
}
|
|
289
|
+
},
|
|
212
290
|
"fields": {
|
|
213
291
|
"type": "object",
|
|
214
292
|
"additionalProperties": {
|
package/style.css
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
--fh-color-control-hover: #71717a;
|
|
7
7
|
--fh-color-border-focus: var(--fh-color-primary);
|
|
8
8
|
--fh-color-error: #c0352d;
|
|
9
|
+
--fh-color-error-soft: #fdf1f0;
|
|
10
|
+
--fh-color-error-hover: #9e2a23;
|
|
9
11
|
--fh-color-bg: #ffffff;
|
|
10
12
|
--fh-color-bg-disabled: #f4f4f5;
|
|
11
13
|
--fh-color-bg-hover: #f6f6f7;
|
|
@@ -14,22 +16,32 @@
|
|
|
14
16
|
--fh-color-primary-text: #ffffff;
|
|
15
17
|
--fh-color-primary-soft: #f5f0ff;
|
|
16
18
|
--fh-color-secondary-border: #d4d4d8;
|
|
19
|
+
--fh-color-scrim: rgba(20, 20, 22, 0.32);
|
|
20
|
+
--fh-color-shadow: rgba(20, 20, 22, 0.2);
|
|
17
21
|
--fh-radius: 10px;
|
|
22
|
+
--fh-space-1: 4px; --fh-space-2: 6px; --fh-space-3: 8px; --fh-space-4: 10px; --fh-space-5: 12px;
|
|
23
|
+
--fh-space-6: 14px; --fh-space-7: 16px; --fh-space-8: 18px; --fh-space-9: 20px; --fh-space-10: 24px;
|
|
18
24
|
--fh-gap: 28px;
|
|
19
|
-
--fh-input-padding:
|
|
25
|
+
--fh-input-padding: var(--fh-space-4) var(--fh-space-6);
|
|
20
26
|
--fh-control-height: 46px;
|
|
21
27
|
--fh-font-size: 15px;
|
|
22
28
|
--fh-font-size-small: 13px;
|
|
29
|
+
--fh-font-size-heading: calc(var(--fh-font-size) + 2px);
|
|
30
|
+
--fh-font-size-title: calc(var(--fh-font-size) + 5px);
|
|
31
|
+
--fh-card-padding: var(--fh-space-10);
|
|
23
32
|
}
|
|
24
33
|
|
|
25
34
|
:where([data-fh-theme="dark"] .fh-form, .fh-form[data-fh-theme="dark"]) {
|
|
26
35
|
color-scheme: dark;
|
|
36
|
+
|
|
27
37
|
--fh-color-text: #ececee;
|
|
28
38
|
--fh-color-text-muted: #a8a8b3;
|
|
29
39
|
--fh-color-border: #3a3a41;
|
|
30
40
|
--fh-color-border-hover: #5a5a63;
|
|
31
41
|
--fh-color-control-hover: #80808b;
|
|
32
42
|
--fh-color-error: #f2736a;
|
|
43
|
+
--fh-color-error-soft: #2c1c1d;
|
|
44
|
+
--fh-color-error-hover: #f6958e;
|
|
33
45
|
--fh-color-bg: #18181c;
|
|
34
46
|
--fh-color-bg-disabled: #232328;
|
|
35
47
|
--fh-color-bg-hover: #212126;
|
|
@@ -38,67 +50,69 @@
|
|
|
38
50
|
--fh-color-primary-text: #ffffff;
|
|
39
51
|
--fh-color-primary-soft: #241a3d;
|
|
40
52
|
--fh-color-secondary-border: #3a3a41;
|
|
53
|
+
--fh-color-scrim: rgba(0, 0, 0, 0.55);
|
|
54
|
+
--fh-color-shadow: rgba(0, 0, 0, 0.6);
|
|
41
55
|
}
|
|
42
56
|
|
|
43
57
|
@supports (color: color-mix(in srgb, red, blue)) {
|
|
44
58
|
:where(.fh-form) {
|
|
45
59
|
--fh-color-primary-hover: color-mix(in srgb, var(--fh-color-primary) 82%, #000000);
|
|
46
60
|
--fh-color-primary-soft: color-mix(in srgb, var(--fh-color-primary) 9%, var(--fh-color-bg));
|
|
61
|
+
--fh-color-error-soft: color-mix(in srgb, var(--fh-color-error) 8%, var(--fh-color-bg));
|
|
47
62
|
}
|
|
48
63
|
:where([data-fh-theme="dark"] .fh-form, .fh-form[data-fh-theme="dark"]) { --fh-color-primary-hover: color-mix(in srgb, var(--fh-color-primary) 85%, #ffffff); }
|
|
49
64
|
}
|
|
50
65
|
|
|
51
66
|
.fh-form, .fh-form__fields { display: grid; grid-template-columns: 100%; gap: var(--fh-gap); }
|
|
52
|
-
|
|
53
67
|
.fh-form { color: var(--fh-color-text); font-size: var(--fh-font-size); line-height: 1.5; }
|
|
54
|
-
|
|
55
|
-
.fh-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; margin: 0; padding: 0; border: 0; }
|
|
56
|
-
|
|
68
|
+
.fh-field { display: flex; flex-direction: column; gap: var(--fh-space-3); min-width: 0; margin: 0; padding: 0; border: 0; }
|
|
57
69
|
.fh-field__label { font-size: var(--fh-font-size); font-weight: 600; line-height: 1.4; }
|
|
58
|
-
legend.fh-field__label { padding: 0; margin-bottom:
|
|
70
|
+
legend.fh-field__label { padding: 0; margin-bottom: var(--fh-space-3); }
|
|
59
71
|
.fh-field__required { color: var(--fh-color-error); }
|
|
60
72
|
|
|
61
|
-
.fh-field__helper { margin: -
|
|
62
|
-
|
|
63
|
-
.fh-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.fh-
|
|
73
|
+
.fh-field__helper { margin: calc(-1 * var(--fh-space-1)) 0 0; color: var(--fh-color-text-muted); font-size: var(--fh-font-size-small); line-height: 1.45; text-wrap: pretty; }
|
|
74
|
+
:is(.fh-field--checkbox, .fh-field--switch) > :is(.fh-field__helper, .fh-field__error) { margin: 0; padding-left: calc(var(--fh-space-8) + var(--fh-space-5)); }
|
|
75
|
+
.fh-field--switch > :is(.fh-field__helper, .fh-field__error) { padding-left: calc(2 * var(--fh-space-8) + var(--fh-space-5)); }
|
|
76
|
+
|
|
77
|
+
.fh-section, .fh-group { display: block; min-width: 0; margin: 0; padding: 0; border: 0; }
|
|
78
|
+
* + :is(.fh-section, .fh-group), :is(.fh-section, .fh-group) + * { margin-top: var(--fh-space-5); }
|
|
79
|
+
.fh-form__fields > :is(.fh-section, .fh-group):last-child { margin-bottom: var(--fh-space-5); }
|
|
80
|
+
.fh-section > legend, .fh-group > legend { margin: 0; padding: 0; }
|
|
81
|
+
.fh-section__title { font-size: var(--fh-font-size-heading); font-weight: 600; line-height: 1.35; letter-spacing: -0.01em; text-wrap: balance; }
|
|
82
|
+
.fh-group > legend { text-wrap: balance; }
|
|
83
|
+
.fh-section__description, .fh-group__helper, .fh-group__error { margin: var(--fh-space-1) 0 0; }
|
|
84
|
+
.fh-section__body, .fh-group__body, .fh-group__fields { display: grid; grid-template-columns: 100%; gap: var(--fh-gap); margin-top: var(--fh-space-7); }
|
|
85
|
+
.fh-section__description + .fh-section__body { margin-top: var(--fh-space-9); }
|
|
86
|
+
.fh-group__body { gap: var(--fh-space-7); }
|
|
87
|
+
.fh-group__item { padding: var(--fh-space-7) var(--fh-card-padding) var(--fh-card-padding); border: 1px solid var(--fh-color-border); border-radius: var(--fh-radius); transition: border-color 140ms; }
|
|
88
|
+
.fh-group__item:focus-within { border-color: var(--fh-color-border-hover); }
|
|
89
|
+
.fh-group__header { display: flex; flex-wrap: wrap; align-items: center; gap: var(--fh-space-1) var(--fh-space-3); min-height: 32px; }
|
|
90
|
+
.fh-group__title { min-width: 0; color: var(--fh-color-text-muted); font-size: var(--fh-font-size-small); font-weight: 600; line-height: 1.4; letter-spacing: 0.01em; font-variant-numeric: tabular-nums; }
|
|
91
|
+
.fh-group__title:focus-visible { outline: 2px solid var(--fh-color-border-focus); outline-offset: 2px; }
|
|
92
|
+
.fh-group .fh-group__remove { flex: none; min-height: 32px; margin: 0 calc(-1 * var(--fh-space-4)) 0 auto; padding: 0 var(--fh-space-4); font-size: var(--fh-font-size-small); font-weight: 500; color: var(--fh-color-error); }
|
|
93
|
+
.fh-group__add { display: inline-flex; align-items: center; gap: var(--fh-space-3); justify-self: start; }
|
|
94
|
+
.fh-group__add::before { content: ""; width: 14px; height: 14px; background: currentColor; --fh-plus: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M7 2v10M2 7h10' stroke='black' stroke-width='1.75' stroke-linecap='round'/%3E%3C/svg%3E"); -webkit-mask: var(--fh-plus) center / 14px no-repeat; mask: var(--fh-plus) center / 14px no-repeat; }
|
|
95
|
+
.fh-group__status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
96
|
+
|
|
97
|
+
.fh-field__input { width: 100%; min-height: var(--fh-control-height); box-sizing: border-box; padding: var(--fh-input-padding); border: 1px solid var(--fh-color-border); border-radius: var(--fh-radius); background: var(--fh-color-bg); color: inherit; font: inherit; font-size: var(--fh-font-size); transition: border-color 140ms; }
|
|
98
|
+
|
|
99
|
+
.fh-field__input::placeholder { color: var(--fh-color-control-hover); opacity: 1; }
|
|
78
100
|
.fh-field__input:focus { outline: 2px solid var(--fh-color-border-focus); outline-offset: 1px; border-color: var(--fh-color-border-focus); }
|
|
79
101
|
.fh-field__input:disabled { background: var(--fh-color-bg-disabled); cursor: not-allowed; }
|
|
80
102
|
.fh-field__input--textarea { min-height: 112px; resize: vertical; }
|
|
81
103
|
|
|
82
|
-
.fh-field__input--select {
|
|
83
|
-
padding-right: 44px;
|
|
84
|
-
text-overflow: ellipsis;
|
|
85
|
-
appearance: none;
|
|
86
|
-
background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
|
|
87
|
-
background-position: right 21px center, right 16px center;
|
|
88
|
-
background-size: 5px 5px;
|
|
89
|
-
background-repeat: no-repeat;
|
|
90
|
-
}
|
|
104
|
+
.fh-field__input--select { padding-right: calc(var(--fh-space-10) + var(--fh-space-9)); text-overflow: ellipsis; appearance: none; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: right 21px center, right 16px center; background-size: 5px 5px; background-repeat: no-repeat; }
|
|
91
105
|
|
|
92
|
-
.fh-field__error, .fh-form__top-error { margin: 0; color: var(--fh-color-error); font-size: var(--fh-font-size-small); font-weight: 500; }
|
|
93
|
-
.fh-form__top-errors, .fh-error-summary { display: flex; flex-direction: column; gap:
|
|
94
|
-
.fh-error-summary { padding:
|
|
95
|
-
.fh-error-summary__list { margin: 0; padding-left:
|
|
106
|
+
.fh-field__error, .fh-form__top-error { margin: 0; color: var(--fh-color-error); font-size: var(--fh-font-size-small); font-weight: 500; line-height: 1.45; text-wrap: pretty; }
|
|
107
|
+
.fh-form__top-errors, .fh-error-summary { display: flex; flex-direction: column; gap: var(--fh-space-1); }
|
|
108
|
+
.fh-error-summary { padding: var(--fh-space-5) var(--fh-space-6); border: 1px solid var(--fh-color-error); border-radius: var(--fh-radius); }
|
|
109
|
+
.fh-error-summary__list { margin: 0; padding-left: var(--fh-space-8); }
|
|
96
110
|
|
|
97
|
-
.fh-field__radio-group, .fh-field__multiselect-group { display: flex; flex-direction: column; gap:
|
|
111
|
+
.fh-field__radio-group, .fh-field__multiselect-group { display: flex; flex-direction: column; gap: var(--fh-space-3); }
|
|
98
112
|
.fh-field__radio-group--inline, .fh-field__multiselect-group--inline { flex-flow: row wrap; }
|
|
99
113
|
|
|
100
114
|
.fh-field__radio-option, .fh-field__multiselect-option {
|
|
101
|
-
position: relative; display: flex; align-items: flex-start; gap:
|
|
115
|
+
position: relative; display: flex; align-items: flex-start; gap: var(--fh-space-5); padding: var(--fh-space-5) var(--fh-space-6);
|
|
102
116
|
border: 1px solid var(--fh-color-border); border-radius: var(--fh-radius); background: var(--fh-color-bg);
|
|
103
117
|
transition: border-color 140ms, background-color 140ms;
|
|
104
118
|
}
|
|
@@ -106,29 +120,16 @@ legend.fh-field__label { padding: 0; margin-bottom: 8px; }
|
|
|
106
120
|
:is(.fh-field__radio-option, .fh-field__multiselect-option):has(:checked) { border-color: var(--fh-color-primary); background: var(--fh-color-primary-soft); }
|
|
107
121
|
:is(.fh-field__radio-option, .fh-field__multiselect-option):has(:disabled) { opacity: 0.6; }
|
|
108
122
|
:is(.fh-field__radio-option, .fh-field__multiselect-option):has(:focus-visible) { outline: 2px solid var(--fh-color-border-focus); outline-offset: 2px; }
|
|
123
|
+
|
|
109
124
|
@supports selector(:has(*)) { :is(.fh-field__radio-option, .fh-field__multiselect-option) input:focus-visible { outline: none; } }
|
|
110
|
-
:is(.fh-field__radio-label, .fh-field__multiselect-label) { flex: 1 1 auto; cursor: pointer; }
|
|
125
|
+
:is(.fh-field__radio-label, .fh-field__multiselect-label) { flex: 1 1 auto; cursor: pointer; text-wrap: pretty; }
|
|
111
126
|
:is(.fh-field__radio-label, .fh-field__multiselect-label, .fh-field__checkbox-wrapper .fh-field__label, .fh-field__switch-wrapper .fh-field__label)::before { content: ""; position: absolute; inset: 0; border-radius: inherit; }
|
|
112
127
|
|
|
113
|
-
.fh-field__checkbox-wrapper, .fh-field__switch-wrapper { position: relative; display: flex; align-items: flex-start; gap:
|
|
114
|
-
|
|
115
|
-
:is(.fh-field__checkbox-wrapper, .fh-field__switch-wrapper) .fh-field__label { font-weight: 400; line-height: 1.5; cursor: pointer; }
|
|
116
|
-
|
|
117
|
-
.fh-field__radio,
|
|
118
|
-
.fh-field__checkbox,
|
|
119
|
-
.fh-field__switch {
|
|
120
|
-
position: relative;
|
|
121
|
-
z-index: 1;
|
|
122
|
-
flex: none;
|
|
123
|
-
width: 18px;
|
|
124
|
-
height: 18px;
|
|
125
|
-
margin: 2px 0 0;
|
|
126
|
-
border: 1.5px solid var(--fh-color-border-hover);
|
|
127
|
-
background: var(--fh-color-bg);
|
|
128
|
-
appearance: none;
|
|
129
|
-
cursor: pointer;
|
|
130
|
-
transition: background-color 140ms, border-color 140ms;
|
|
131
|
-
}
|
|
128
|
+
.fh-field__checkbox-wrapper, .fh-field__switch-wrapper { position: relative; display: flex; align-items: flex-start; gap: var(--fh-space-5); }
|
|
129
|
+
|
|
130
|
+
:is(.fh-field__checkbox-wrapper, .fh-field__switch-wrapper) .fh-field__label { font-weight: 400; line-height: 1.5; cursor: pointer; text-wrap: pretty; }
|
|
131
|
+
|
|
132
|
+
.fh-field__radio, .fh-field__checkbox, .fh-field__switch { position: relative; z-index: 1; flex: none; width: 18px; height: 18px; margin: calc((1.5em - 18px) / 2) 0 0; border: 1.5px solid var(--fh-color-control-hover); background: var(--fh-color-bg); font: inherit; appearance: none; cursor: pointer; transition: background-color 140ms, border-color 140ms; }
|
|
132
133
|
|
|
133
134
|
.fh-field__radio { border-width: 2px; border-radius: 50%; }
|
|
134
135
|
.fh-field__radio:checked { border-color: var(--fh-color-primary); background: radial-gradient(circle closest-side, var(--fh-color-primary) 4px, var(--fh-color-bg) 4.5px); }
|
|
@@ -138,12 +139,14 @@ legend.fh-field__label { padding: 0; margin-bottom: 8px; }
|
|
|
138
139
|
.fh-field__checkbox:checked::after {
|
|
139
140
|
content: ""; position: absolute; inset: 0;
|
|
140
141
|
background: var(--fh-color-primary-text);
|
|
142
|
+
|
|
141
143
|
--fh-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
|
|
144
|
+
|
|
142
145
|
-webkit-mask: var(--fh-check) center / 14px no-repeat;
|
|
143
146
|
mask: var(--fh-check) center / 14px no-repeat;
|
|
144
147
|
}
|
|
145
148
|
|
|
146
|
-
.fh-field__switch { width: 36px; height: 22px; margin:
|
|
149
|
+
.fh-field__switch { width: 36px; height: 22px; margin: calc((1.5em - 22px) / 2) 0 0; border: 0; border-radius: 999px; background: var(--fh-color-border); }
|
|
147
150
|
.fh-field__switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--fh-color-primary-text); transition: transform 150ms; }
|
|
148
151
|
.fh-field__switch:checked { background: var(--fh-color-primary); }
|
|
149
152
|
.fh-field__switch:checked::after { transform: translateX(14px); }
|
|
@@ -152,39 +155,57 @@ legend.fh-field__label { padding: 0; margin-bottom: 8px; }
|
|
|
152
155
|
|
|
153
156
|
@media (hover: hover) and (pointer: fine) {
|
|
154
157
|
.fh-field__input:hover:not(:disabled, :focus, [aria-invalid="true"]) { border-color: var(--fh-color-border-hover); }
|
|
155
|
-
:is(.fh-field__input--select, .fh-field__input--date, .fh-field__input--datetime):not(:disabled) { cursor: pointer; }
|
|
158
|
+
:is(.fh-field__input--select, .fh-field__input--date, .fh-field__input--datetime, .fh-field__input--time):not(:disabled) { cursor: pointer; }
|
|
156
159
|
:is(.fh-field__radio-option, .fh-field__multiselect-option):hover:not(:has(:checked, :disabled)) { border-color: var(--fh-color-border-hover); background: var(--fh-color-bg-hover); }
|
|
157
|
-
:is(.fh-field__checkbox-wrapper, .fh-field__radio-option, .fh-field__multiselect-option):hover :is(.fh-field__radio, .fh-field__checkbox):not(:checked, :disabled, [aria-invalid="true"]) { border-color: var(--fh-color-
|
|
160
|
+
:is(.fh-field__checkbox-wrapper, .fh-field__radio-option, .fh-field__multiselect-option):hover :is(.fh-field__radio, .fh-field__checkbox):not(:checked, :disabled, [aria-invalid="true"]) { border-color: var(--fh-color-text-muted); }
|
|
158
161
|
.fh-field__switch-wrapper:hover .fh-field__switch:not(:disabled) { background-color: var(--fh-color-border-hover); }
|
|
159
162
|
.fh-field__switch-wrapper:hover .fh-field__switch:checked:not(:disabled) { background-color: var(--fh-color-primary-hover); }
|
|
160
163
|
.fh-form-actions__button--primary:hover:not(:disabled) { background: var(--fh-color-primary-hover); }
|
|
161
164
|
.fh-form-actions__button--secondary:hover:not(:disabled) { border-color: var(--fh-color-border-hover); background: var(--fh-color-bg-hover); }
|
|
162
165
|
.fh-form-actions__button--text:hover:not(:disabled) { background: var(--fh-color-bg-hover); color: var(--fh-color-text); }
|
|
166
|
+
.fh-group .fh-group__remove:hover:not(:disabled) { background: var(--fh-color-error-soft); color: var(--fh-color-error-hover); }
|
|
167
|
+
.fh-dialog .fh-dialog__danger:hover { background: var(--fh-color-error-soft); }
|
|
168
|
+
.fh-dialog__close:hover { background: var(--fh-color-bg-hover); color: var(--fh-color-text); }
|
|
163
169
|
}
|
|
164
170
|
|
|
165
|
-
.fh-field__input[aria-invalid="true"],
|
|
166
|
-
.fh-field__checkbox[aria-invalid="true"],
|
|
167
|
-
.fh-field[aria-invalid="true"] :is(.fh-field__radio-option, .fh-field__multiselect-option) {
|
|
168
|
-
border-color: var(--fh-color-error);
|
|
169
|
-
}
|
|
171
|
+
.fh-field__input[aria-invalid="true"], .fh-field__checkbox[aria-invalid="true"], .fh-field[aria-invalid="true"] :is(.fh-field__radio-option, .fh-field__multiselect-option) { border-color: var(--fh-color-error); }
|
|
170
172
|
|
|
171
|
-
.fh-form-actions { display: flex; flex-wrap: wrap; align-items: center; gap:
|
|
172
|
-
.fh-form-actions__secondary { display: flex; gap:
|
|
173
|
+
.fh-form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--fh-space-3); padding-top: var(--fh-space-1); }
|
|
174
|
+
.fh-form-actions__secondary { display: flex; gap: var(--fh-space-3); margin-right: auto; }
|
|
173
175
|
.fh-form-actions__secondary:empty { display: none; }
|
|
174
176
|
|
|
175
|
-
.fh-form-actions__button {
|
|
176
|
-
min-height: var(--fh-control-height); padding: 0 20px; border: 1px solid transparent; border-radius: var(--fh-radius);
|
|
177
|
-
background: transparent; color: inherit; font: inherit; font-size: var(--fh-font-size); font-weight: 600; cursor: pointer;
|
|
178
|
-
transition: background-color 140ms, border-color 140ms, color 140ms;
|
|
179
|
-
}
|
|
177
|
+
.fh-form-actions__button { min-height: var(--fh-control-height); padding: 0 var(--fh-space-9); border: 1px solid transparent; border-radius: var(--fh-radius); background: transparent; color: inherit; font: inherit; font-size: var(--fh-font-size); font-weight: 600; line-height: 1.2; cursor: pointer; transition: background-color 140ms, border-color 140ms, color 140ms; }
|
|
180
178
|
|
|
181
179
|
.fh-form-actions__button:focus-visible { outline: 2px solid var(--fh-color-border-focus); outline-offset: 2px; }
|
|
182
180
|
.fh-form-actions__button:disabled { opacity: 0.5; cursor: not-allowed; }
|
|
183
181
|
.fh-form-actions__button--primary { margin-left: auto; background: var(--fh-color-primary); color: var(--fh-color-primary-text); }
|
|
184
182
|
.fh-form-actions__button--secondary { border-color: var(--fh-color-secondary-border); background: var(--fh-color-bg); }
|
|
185
|
-
.fh-form-actions__button--text { padding: 0
|
|
183
|
+
.fh-form-actions__button--text { padding: 0 var(--fh-space-4); color: var(--fh-color-text-muted); font-weight: 500; }
|
|
184
|
+
|
|
185
|
+
.fh-dialog { box-sizing: border-box; width: min(480px, calc(100vw - 2 * var(--fh-space-7))); max-width: none; max-height: calc(100dvh - 2 * var(--fh-space-9)); margin: auto; padding: 0; border: 1px solid var(--fh-color-border); border-radius: var(--fh-radius); background: var(--fh-color-bg); color: var(--fh-color-text); font: inherit; line-height: 1.5; box-shadow: 0 24px 64px var(--fh-color-shadow); }
|
|
186
|
+
.fh-dialog[open] { display: flex; flex-direction: column; animation: fh-rise 200ms ease-out; }
|
|
187
|
+
.fh-dialog::backdrop { background: var(--fh-color-scrim); animation: fh-fade 200ms ease-out; }
|
|
188
|
+
.fh-dialog__header { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--fh-space-1) var(--fh-space-5); padding: var(--fh-space-7) var(--fh-space-5) var(--fh-space-7) var(--fh-space-9); }
|
|
189
|
+
.fh-dialog__title { grid-column: 1; margin: 0; padding-top: var(--fh-space-1); font-size: var(--fh-font-size-heading); font-weight: 600; line-height: 1.35; text-wrap: balance; }
|
|
190
|
+
.fh-dialog__description { grid-column: 1; margin: 0; color: var(--fh-color-text-muted); }
|
|
191
|
+
.fh-dialog__close { grid-area: 1 / 2 / span 2; align-self: start; width: 32px; height: 32px; padding: 0; border: 0; border-radius: var(--fh-radius); background: transparent; color: var(--fh-color-text-muted); cursor: pointer; transition: background-color 140ms, color 140ms; }
|
|
192
|
+
.fh-dialog__close::before { content: ""; display: block; width: 16px; height: 16px; margin: auto; background: currentColor; --fh-x: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 4l8 8M12 4l-8 8' stroke='black' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); -webkit-mask: var(--fh-x) center / 16px no-repeat; mask: var(--fh-x) center / 16px no-repeat; }
|
|
193
|
+
.fh-dialog__close:focus-visible { outline: 2px solid var(--fh-color-border-focus); outline-offset: 2px; }
|
|
194
|
+
.fh-dialog__footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--fh-space-3); padding: var(--fh-space-5) var(--fh-space-9); border-top: 1px solid var(--fh-color-border); }
|
|
195
|
+
.fh-dialog .fh-form-actions__button { min-height: 40px; padding: 0 var(--fh-space-7); font-weight: 500; }
|
|
196
|
+
.fh-dialog .fh-dialog__danger { border-color: var(--fh-color-error); background: var(--fh-color-bg); color: var(--fh-color-error); }
|
|
197
|
+
|
|
198
|
+
@keyframes fh-rise { from { opacity: 0; transform: translateY(var(--fh-space-3)); } }
|
|
199
|
+
|
|
200
|
+
@keyframes fh-fade { from { opacity: 0; } }
|
|
186
201
|
|
|
187
202
|
@media (max-width: 480px) {
|
|
203
|
+
:where(.fh-form) { --fh-card-padding: var(--fh-space-7); }
|
|
204
|
+
.fh-dialog { width: 100%; max-height: calc(100dvh - var(--fh-space-10)); margin: auto 0 0; padding-bottom: env(safe-area-inset-bottom); border-width: 1px 0 0; border-radius: var(--fh-radius) var(--fh-radius) 0 0; }
|
|
205
|
+
.fh-dialog__header { padding-inline-start: var(--fh-space-7); }
|
|
206
|
+
.fh-dialog__footer { flex-direction: column-reverse; padding-inline: var(--fh-space-7); }
|
|
207
|
+
.fh-group__item { padding-top: var(--fh-space-5); }
|
|
208
|
+
.fh-group__add { justify-content: center; justify-self: stretch; }
|
|
188
209
|
.fh-form-actions__button--primary, .fh-form-actions__secondary { flex: 1 0 100%; }
|
|
189
210
|
.fh-form-actions__secondary { justify-content: space-between; }
|
|
190
211
|
}
|
|
@@ -192,17 +213,17 @@ legend.fh-field__label { padding: 0; margin-bottom: 8px; }
|
|
|
192
213
|
@media (pointer: coarse) {
|
|
193
214
|
:where(.fh-form) { --fh-font-size: 17px; --fh-font-size-small: 15px; }
|
|
194
215
|
.fh-field__input { font-size: max(16px, var(--fh-font-size)); }
|
|
195
|
-
:is(.fh-field__checkbox-wrapper, .fh-field__switch-wrapper) { padding-block:
|
|
196
|
-
.fh-
|
|
216
|
+
:is(.fh-field__checkbox-wrapper, .fh-field__switch-wrapper) { padding-block: var(--fh-space-4); }
|
|
217
|
+
.fh-group .fh-group__remove, .fh-dialog .fh-form-actions__button { min-height: 44px; }
|
|
197
218
|
}
|
|
198
219
|
|
|
199
|
-
.fh-step-progress { display: flex; flex-direction: column; gap:
|
|
200
|
-
.fh-step-progress__counter { color: var(--fh-color-text-muted); font-size: var(--fh-font-size-small); }
|
|
201
|
-
.fh-step-progress__title { margin:
|
|
220
|
+
.fh-step-progress { display: flex; flex-direction: column; gap: var(--fh-space-2); }
|
|
221
|
+
.fh-step-progress__counter { color: var(--fh-color-text-muted); font-size: var(--fh-font-size-small); font-variant-numeric: tabular-nums; }
|
|
222
|
+
.fh-step-progress__title { margin: var(--fh-space-1) 0 0; font-size: var(--fh-font-size-title); font-weight: 600; line-height: 1.3; letter-spacing: -0.015em; text-wrap: balance; }
|
|
202
223
|
.fh-step-progress__description { margin: 0; color: var(--fh-color-text-muted); }
|
|
203
224
|
.fh-step-progress__bar { height: 4px; border-radius: 999px; background: var(--fh-color-bg-disabled); overflow: hidden; }
|
|
204
225
|
.fh-step-progress__fill { height: 100%; background: var(--fh-color-primary); transition: width 200ms ease-out; }
|
|
205
|
-
.fh-step-progress__steps { display: flex; flex-wrap: wrap; gap:
|
|
226
|
+
.fh-step-progress__steps { display: flex; flex-wrap: wrap; gap: var(--fh-space-1) var(--fh-space-7); margin: 0; padding: 0; list-style: none; color: var(--fh-color-text-muted); font-size: var(--fh-font-size-small); }
|
|
206
227
|
.fh-error-summary__link, .fh-step-progress__step--invalid { color: var(--fh-color-error); }
|
|
207
228
|
|
|
208
229
|
@media (forced-colors: active) {
|
|
@@ -213,8 +234,8 @@ legend.fh-field__label { padding: 0; margin-bottom: 8px; }
|
|
|
213
234
|
:is(.fh-field__radio-option, .fh-field__multiselect-option):has(:focus-visible), .fh-form-actions__button:focus-visible, .fh-field__input:focus, :is(.fh-field__radio, .fh-field__checkbox, .fh-field__switch):focus-visible { outline: 2px solid CanvasText; }
|
|
214
235
|
}
|
|
215
236
|
|
|
216
|
-
.fh-form__notice { display: grid; gap:
|
|
237
|
+
.fh-form__notice { display: grid; gap: var(--fh-space-3); justify-items: start; margin-bottom: var(--fh-gap); padding: var(--fh-space-5) var(--fh-space-6); border: 1px solid var(--fh-color-error); border-radius: var(--fh-radius); color: var(--fh-color-text); }
|
|
217
238
|
.fh-form__notice--info { border-color: var(--fh-color-border-focus); }
|
|
218
239
|
.fh-form__notice > p, .fh-form__notice > ul { margin: 0; }
|
|
219
240
|
|
|
220
|
-
@media (prefers-reduced-motion: reduce) { .fh-form *, .fh-form ::after { transition: none; } }
|
|
241
|
+
@media (prefers-reduced-motion: reduce) { .fh-form *, .fh-form ::after { transition: none; } .fh-dialog, .fh-dialog::backdrop { animation: none; } }
|
package/dist/chunk-35SAVPYL.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var u=Object.freeze({required:"This field is required",minLength:"Must be at least {min} characters",maxLength:"Must be at most {max} characters",minItems:"Must be at least {min} items",maxItems:"Must be at most {max} items",min:"Must be at least {min}",max:"Must be at most {max}",pattern:"Invalid format",matchField:"Fields must match",email:"Enter a valid email",number:"Enter a number",date:"Enter a valid date",datetime:"Enter a valid date and time",option:"Select one of the available options",options:"Must be a list of available options",boolean:"Must be true or false",string:"Must be text",file:"Must be a file reference",value:"Invalid value"});function p(e,t){return e.replace(/\{(\w+)\}/g,(n,r)=>Object.prototype.hasOwnProperty.call(t,r)?String(t[r]):n)}function w(e,t,n,r,...o){for(let s of r){let i=typeof s=="function"?s(t,n,...o):s?.[t];if(i&&typeof i=="string")return typeof s=="function"?i:p(i,n)}return p(e[t],n)}function g(...e){return (t,n,r)=>w(u,t,n,e,r)}function q(e,t={}){let n=Object.prototype.hasOwnProperty.call(u,e)?u[e]:u.value,r=t.unit!==void 0&&(e==="minLength"||e==="maxLength");return p(r?n.replace("characters","{unit}"):n,t)}var V=["eq","neq","in","notIn","notEmpty","gt","gte","lt","lte"];function E(e){return e==null||e===""||Array.isArray(e)&&!e.length}function k(e){let t=typeof e=="string"&&e.trim()!==""?Number(e):e;return typeof t=="number"&&Number.isFinite(t)?t:void 0}function l(e,t,n){let r=k(e);return r!==void 0&&n(r,t)}function Y(e,t){let n=t[e.field];return e.eq!==void 0?n===e.eq:e.neq!==void 0?n!==e.neq:e.in!==void 0?e.in.includes(n):e.notIn!==void 0?!e.notIn.includes(n):e.notEmpty!==void 0?!e.notEmpty||!E(n):e.gt!==void 0?l(n,e.gt,(r,o)=>r>o):e.gte!==void 0?l(n,e.gte,(r,o)=>r>=o):e.lt!==void 0?l(n,e.lt,(r,o)=>r<o):e.lte!==void 0?l(n,e.lte,(r,o)=>r<=o):false}function U(e){return [...e.show??[],...e.showAny??[]].map(t=>t.field)}function B(e){return e.steps?.length?e.steps.flatMap(t=>t.fields):e.fields??[]}function G(e,t){let n={};for(let o of e)o.defaultValue!==void 0&&(n[o.key]=o.defaultValue);let r=t??{};for(let o of Object.keys(r))o!=="__proto__"&&(n[o]=r[o]);return n}function X(e,t){let n=new Set([...Object.keys(e),...Object.keys(t)]);return new Set([...n].filter(r=>!Object.is(e[r],t[r])))}var c=["checkbox","switch"],f=["text","email","phone","number","password","select","autocomplete","multiselect","checkbox","radio","switch","file","date","datetime","textarea"],a=1e4,R=254,T=1e3,d=/^[^\s@]+@[^\s@.]+(?:\.[^\s@.]+)+$/,A=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/,y="\\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\\d|3[01])",S=new RegExp(`^${y}$`),L=new RegExp(`^${y}T(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d{1,3})?)?(?:Z|[+-](?:[01]\\d|2[0-3]):[0-5]\\d)?$`),F=new Set(["text","phone","password","textarea","autocomplete"]),b=new Map([["email",[d,"email",R]],["date",[S,"date",a]],["datetime",[L,"datetime",a]]]);function K(e){let[t,n,r]=e.split(/\D/).map(Number);return r<=new Date(new Date(0).setUTCFullYear(t,n,0)).getUTCDate()}var O=new Set(["password","number","select","radio","file"]);function I(e,t){return typeof t=="string"&&!O.has(e.type)?t.trim():t}function v(e,t){if(Array.isArray(t)&&t.length===0&&e.type!=="multiselect"&&f.includes(e.type))return;let n=I(e,t);if(e.type!=="number"||typeof n!="string"||!A.test(n))return n;let r=Number(n);return Number.isFinite(r)?r:n}var x=e=>e.optionsFrom?void 0:e.options;function M(e,t){let n=x(e);return !n||n.some(r=>r.value===t)}function h(e,t,n){let r=Math.min(a,e.validation?.maxLength??a);return t.length<=r?null:e.validation?.maxLengthMessage??n("maxLength",{max:r})}function _(e,t,n){return Array.isArray(t)?t.length>(x(e)?.length??T)?n("option"):t.every(o=>typeof o=="string"&&o.length<=a&&M(e,o))?null:n("option"):n("options")}function m(e,t,n,r){return typeof t=="string"?h(e,t,r):r(n)}function N(e,t,[n,r,o],s){return typeof t!="string"?s(r):h(e,t,s)??(t.length<=o&&n.test(t)&&(n===d||K(t))?null:s(r))}function D(e,t,n){return typeof t=="boolean"||typeof t=="number"&&Number.isFinite(t)?null:m(e,t,"value",n)}function P(e,t){return t==null||t===""||e.type==="multiselect"&&Array.isArray(t)&&!t.length}function C(e,t,n=g()){if(P(e,t))return null;let r=(s,i={})=>n(s,i,e);if(c.includes(e.type))return typeof t=="boolean"?null:r("boolean");if(e.type==="number")return typeof t=="number"&&Number.isFinite(t)?null:r("number");if(e.type==="multiselect")return _(e,t,r);if(e.type==="file")return m(e,t,"file",r);let o=b.get(e.type);return o?N(e,t,o,r):e.type==="select"||e.type==="radio"?m(e,t,"option",r)??(M(e,t)?null:r("option")):F.has(e.type)?m(e,t,"string",r):D(e,t,r)}function Z(e){if(c.includes(e.type))return ["boolean"];if(e.type==="number")return ["number"];if(e.type==="multiselect")return ["options","option"];let t=b.get(e.type)?.[1];return t?[t,"maxLength"]:e.type==="file"?["file","maxLength"]:e.type==="select"||e.type==="radio"?["option","maxLength"]:[F.has(e.type)?"string":"value","maxLength"]}function J(e,t,n){return e.type==="file"||!f.includes(e.type)?null:C(e,t,n)}export{u as a,p as b,w as c,g as d,q as e,U as f,B as g,G as h,X as i,V as j,E as k,Y as l,c as m,f as n,I as o,v as p,C as q,Z as r,J as s};//# sourceMappingURL=chunk-35SAVPYL.js.map
|
|
2
|
-
//# sourceMappingURL=chunk-35SAVPYL.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/validation/default-messages.ts","../src/visibility/evaluate-condition.ts","../src/engine/engine-utils.ts","../src/validation/type-checks.ts"],"names":["DEFAULT_MESSAGES","formatText","template","params","match","name","resolveText","defaults","key","sources","context","source","text","messageResolver","field","getDefaultMessage","rule","custom","CONDITION_OPERATORS","isBlank","value","toNumber","number","compare","operand","test","evaluateCondition","condition","values","a","b","conditionFields","getAllFields","definition","step","createValues","fields","initialValues","getChangedKeys","previous","next","keys","BOOLEAN_TYPES","BUILT_IN_TYPES","MAX_STRING_LENGTH","MAX_EMAIL_LENGTH","MAX_ITEMS","EMAIL","DECIMAL","DATE","DATE_ONLY","DATE_TIME","TEXT_TYPES","FORMATS","isCalendarDate","year","month","day","UNTRIMMED_TYPES","trimValue","normalizeValue","input","parsed","staticOptions","isOption","options","option","lengthError","fail","max","multiselectError","item","stringError","formatError","format","primitiveError","typeError","resolve","typeMessageKeys","clientTypeError"],"mappings":"AAQO,IAAMA,CAAAA,CAAyD,MAAA,CAAO,MAAA,CAAO,CAClF,QAAA,CAAU,wBAAA,CACV,SAAA,CAAW,mCAAA,CACX,SAAA,CAAW,kCAAA,CACX,QAAA,CAAU,8BAAA,CACV,SAAU,6BAAA,CACV,GAAA,CAAK,wBAAA,CACL,GAAA,CAAK,uBAAA,CACL,OAAA,CAAS,gBAAA,CACT,UAAA,CAAY,oBACZ,KAAA,CAAO,qBAAA,CACP,MAAA,CAAQ,gBAAA,CACR,IAAA,CAAM,oBAAA,CACN,QAAA,CAAU,6BAAA,CACV,OAAQ,qCAAA,CACR,OAAA,CAAS,qCAAA,CACT,OAAA,CAAS,uBAAA,CACT,MAAA,CAAQ,cAAA,CACR,IAAA,CAAM,2BACN,KAAA,CAAO,eACT,CAAC,EAIM,SA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C,CAAAA,CAAM,IAAI,CAAA,GAAI,CAAC,CAAA,CAC1C,OAAI4D,CAAAA,CAAe,CAACA,CAAAA,CAAQ,WAAW,CAAA,CACnC5D,CAAAA,CAAM,IAAA,GAAS,MAAA,CAAe,CAAC,MAAA,CAAQ,WAAW,CAAA,CAClDA,CAAAA,CAAM,IAAA,GAAS,QAAA,EAAYA,CAAAA,CAAM,IAAA,GAAS,QAAgB,CAAC,QAAA,CAAU,WAAW,CAAA,CAC7E,CAACsC,CAAAA,CAAW,GAAA,CAAItC,CAAAA,CAAM,IAAI,CAAA,CAAI,QAAA,CAAW,OAAA,CAAS,WAAW,CACtE,CAEO,SAASiE,CAAAA,CAAgBjE,EAAkBM,CAAAA,CAAgByD,CAAAA,CAAyC,CACzG,OAAI/D,CAAAA,CAAM,IAAA,GAAS,MAAA,EAAU,CAAC6B,EAAe,QAAA,CAAS7B,CAAAA,CAAM,IAAI,CAAA,CAAU,IAAA,CACnE8D,CAAAA,CAAU9D,CAAAA,CAAOM,CAAAA,CAAOyD,CAAO,CACxC","file":"chunk-35SAVPYL.js","sourcesContent":["import type { FormField, MessageCatalog, MessageKey } from '../types';\n\nexport type { MessageCatalog, MessageKey };\nexport type MessageParams = Record<string, unknown>;\nexport type MessageFn = (key: MessageKey, params: MessageParams, field: FormField) => string | undefined;\nexport type MessageSource = MessageCatalog | MessageFn;\nexport type ResolveMessage = (key: MessageKey, params: MessageParams, field: FormField) => string;\n\nexport const DEFAULT_MESSAGES: Readonly<Record<MessageKey, string>> = Object.freeze({\n required: 'This field is required',\n minLength: 'Must be at least {min} characters',\n maxLength: 'Must be at most {max} characters',\n minItems: 'Must be at least {min} items',\n maxItems: 'Must be at most {max} items',\n min: 'Must be at least {min}',\n max: 'Must be at most {max}',\n pattern: 'Invalid format',\n matchField: 'Fields must match',\n email: 'Enter a valid email',\n number: 'Enter a number',\n date: 'Enter a valid date',\n datetime: 'Enter a valid date and time',\n option: 'Select one of the available options',\n options: 'Must be a list of available options',\n boolean: 'Must be true or false',\n string: 'Must be text',\n file: 'Must be a file reference',\n value: 'Invalid value',\n});\n\nexport type ValidationRule = 'required' | 'minLength' | 'maxLength' | 'min' | 'max' | 'pattern' | 'matchField';\n\nexport function formatText(template: string, params: Record<string, unknown>): string {\n return template.replace(/\\{(\\w+)\\}/g, (match, name: string) => (Object.prototype.hasOwnProperty.call(params, name) ? String(params[name]) : match));\n}\n\ntype TextSource<K extends string> = Partial<Record<K, string>> | ((key: K, params: MessageParams, ...context: never[]) => string | undefined);\n\nexport function resolveText<K extends string>(defaults: Record<K, string>, key: K, params: MessageParams, sources: (TextSource<K> | undefined)[], ...context: unknown[]): string {\n for (const source of sources) {\n const text = typeof source === 'function' ? (source as (...args: unknown[]) => unknown)(key, params, ...context) : source?.[key];\n if (text && typeof text === 'string') return typeof source === 'function' ? text : formatText(text, params);\n }\n return formatText(defaults[key], params);\n}\n\nexport function messageResolver(...sources: (MessageSource | undefined)[]): ResolveMessage {\n return (key, params, field) => resolveText(DEFAULT_MESSAGES, key, params, sources, field);\n}\n\nexport function getDefaultMessage(rule: ValidationRule | MessageKey, params: Record<string, unknown> = {}): string {\n const template = Object.prototype.hasOwnProperty.call(DEFAULT_MESSAGES, rule) ? DEFAULT_MESSAGES[rule] : DEFAULT_MESSAGES.value;\n const custom = params.unit !== undefined && (rule === 'minLength' || rule === 'maxLength');\n return formatText(custom ? template.replace('characters', '{unit}') : template, params);\n}\n","import type { ShowCondition } from '../types';\n\nexport const CONDITION_OPERATORS = ['eq', 'neq', 'in', 'notIn', 'notEmpty', 'gt', 'gte', 'lt', 'lte'] as const;\n\nexport function isBlank(value: unknown): boolean {\n return value == null || value === '' || (Array.isArray(value) && !value.length);\n}\n\nfunction toNumber(value: unknown): number | undefined {\n const number = typeof value === 'string' && value.trim() !== '' ? Number(value) : value;\n return typeof number === 'number' && Number.isFinite(number) ? number : undefined;\n}\n\nfunction compare(value: unknown, operand: number, test: (value: number, operand: number) => boolean): boolean {\n const number = toNumber(value);\n return number !== undefined && test(number, operand);\n}\n\nexport function evaluateCondition(\n condition: ShowCondition,\n values: Record<string, unknown>,\n): boolean {\n const value = values[condition.field];\n if (condition.eq !== undefined) return value === condition.eq;\n if (condition.neq !== undefined) return value !== condition.neq;\n if (condition.in !== undefined) return condition.in.includes(value as string | number);\n if (condition.notIn !== undefined) return !condition.notIn.includes(value as string | number);\n if (condition.notEmpty !== undefined) return !condition.notEmpty || !isBlank(value);\n if (condition.gt !== undefined) return compare(value, condition.gt, (a, b) => a > b);\n if (condition.gte !== undefined) return compare(value, condition.gte, (a, b) => a >= b);\n if (condition.lt !== undefined) return compare(value, condition.lt, (a, b) => a < b);\n if (condition.lte !== undefined) return compare(value, condition.lte, (a, b) => a <= b);\n return false;\n}\n","import type { FormDefinition, FormField } from '../types';\n\nexport function conditionFields(source: Pick<FormField, 'show' | 'showAny'>): string[] {\n return [...(source.show ?? []), ...(source.showAny ?? [])].map((condition) => condition.field);\n}\n\nexport function getAllFields(definition: FormDefinition): FormField[] {\n return definition.steps?.length ? definition.steps.flatMap((step) => step.fields) : definition.fields ?? [];\n}\n\nexport function createValues(\n fields: FormField[],\n initialValues?: Record<string, unknown>,\n): Record<string, unknown> {\n const values: Record<string, unknown> = {};\n for (const field of fields) {\n if (field.defaultValue !== undefined) values[field.key] = field.defaultValue;\n }\n const source = initialValues ?? {};\n for (const key of Object.keys(source)) {\n if (key !== '__proto__') values[key] = source[key];\n }\n return values;\n}\n\nexport function getChangedKeys(\n previous: Record<string, unknown>,\n next: Record<string, unknown>,\n): Set<string> {\n const keys = new Set([...Object.keys(previous), ...Object.keys(next)]);\n return new Set([...keys].filter((key) => !Object.is(previous[key], next[key])));\n}\n","import type { FormField } from '../types';\nimport { type MessageKey, messageResolver, type ResolveMessage } from './default-messages';\n\nexport const BOOLEAN_TYPES = ['checkbox', 'switch'];\nexport const BUILT_IN_TYPES = ['text', 'email', 'phone', 'number', 'password', 'select', 'autocomplete', 'multiselect', 'checkbox', 'radio', 'switch', 'file', 'date', 'datetime', 'textarea'];\n\nexport const MAX_STRING_LENGTH = 10000;\nconst MAX_EMAIL_LENGTH = 254;\nconst MAX_ITEMS = 1000;\nconst EMAIL = /^[^\\s@]+@[^\\s@.]+(?:\\.[^\\s@.]+)+$/;\nconst DECIMAL = /^[+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?$/;\nconst DATE = '\\\\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\\\\d|3[01])';\nconst DATE_ONLY = new RegExp(`^${DATE}$`);\nconst DATE_TIME = new RegExp(`^${DATE}T(?:[01]\\\\d|2[0-3]):[0-5]\\\\d(?::[0-5]\\\\d(?:\\\\.\\\\d{1,3})?)?(?:Z|[+-](?:[01]\\\\d|2[0-3]):[0-5]\\\\d)?$`);\nconst TEXT_TYPES = new Set(['text', 'phone', 'password', 'textarea', 'autocomplete']);\nconst FORMATS = new Map<string, [RegExp, MessageKey, number]>([\n ['email', [EMAIL, 'email', MAX_EMAIL_LENGTH]],\n ['date', [DATE_ONLY, 'date', MAX_STRING_LENGTH]],\n ['datetime', [DATE_TIME, 'datetime', MAX_STRING_LENGTH]],\n]);\n\ntype Fail = (key: MessageKey, params?: Record<string, unknown>) => string;\n\nfunction isCalendarDate(value: string): boolean {\n const [year, month, day] = value.split(/\\D/).map(Number);\n return day <= new Date(new Date(0).setUTCFullYear(year, month, 0)).getUTCDate();\n}\n\nconst UNTRIMMED_TYPES = new Set(['password', 'number', 'select', 'radio', 'file']);\n\nexport function trimValue(field: FormField, value: unknown): unknown {\n return typeof value === 'string' && !UNTRIMMED_TYPES.has(field.type) ? value.trim() : value;\n}\n\nexport function normalizeValue(field: FormField, input: unknown): unknown {\n if (Array.isArray(input) && input.length === 0 && field.type !== 'multiselect' && BUILT_IN_TYPES.includes(field.type)) return undefined;\n const value = trimValue(field, input);\n if (field.type !== 'number' || typeof value !== 'string' || !DECIMAL.test(value)) return value;\n const parsed = Number(value);\n return Number.isFinite(parsed) ? parsed : value;\n}\n\nconst staticOptions = (field: FormField) => (field.optionsFrom ? undefined : field.options);\n\nfunction isOption(field: FormField, value: unknown): boolean {\n const options = staticOptions(field);\n return !options || options.some((option) => option.value === value);\n}\n\nfunction lengthError(field: FormField, value: string, fail: Fail): string | null {\n const max = Math.min(MAX_STRING_LENGTH, field.validation?.maxLength ?? MAX_STRING_LENGTH);\n if (value.length <= max) return null;\n return field.validation?.maxLengthMessage ?? fail('maxLength', { max });\n}\n\nfunction multiselectError(field: FormField, value: unknown, fail: Fail): string | null {\n if (!Array.isArray(value)) return fail('options');\n if (value.length > (staticOptions(field)?.length ?? MAX_ITEMS)) return fail('option');\n const valid = value.every((item) => typeof item === 'string' && item.length <= MAX_STRING_LENGTH && isOption(field, item));\n return valid ? null : fail('option');\n}\n\nfunction stringError(field: FormField, value: unknown, key: MessageKey, fail: Fail): string | null {\n return typeof value === 'string' ? lengthError(field, value, fail) : fail(key);\n}\n\nfunction formatError(field: FormField, value: unknown, [format, key, max]: [RegExp, MessageKey, number], fail: Fail): string | null {\n if (typeof value !== 'string') return fail(key);\n return lengthError(field, value, fail) ?? (value.length <= max && format.test(value) && (format === EMAIL || isCalendarDate(value)) ? null : fail(key));\n}\n\nfunction primitiveError(field: FormField, value: unknown, fail: Fail): string | null {\n if (typeof value === 'boolean' || (typeof value === 'number' && Number.isFinite(value))) return null;\n return stringError(field, value, 'value', fail);\n}\n\nfunction isBlank(field: FormField, value: unknown): boolean {\n return value == null || value === '' || (field.type === 'multiselect' && Array.isArray(value) && !value.length);\n}\n\nexport function typeError(field: FormField, value: unknown, resolve: ResolveMessage = messageResolver()): string | null {\n if (isBlank(field, value)) return null;\n const fail: Fail = (key, params = {}) => resolve(key, params, field);\n if (BOOLEAN_TYPES.includes(field.type)) return typeof value === 'boolean' ? null : fail('boolean');\n if (field.type === 'number') return typeof value === 'number' && Number.isFinite(value) ? null : fail('number');\n if (field.type === 'multiselect') return multiselectError(field, value, fail);\n if (field.type === 'file') return stringError(field, value, 'file', fail);\n const format = FORMATS.get(field.type);\n if (format) return formatError(field, value, format, fail);\n if (field.type === 'select' || field.type === 'radio') return stringError(field, value, 'option', fail) ?? (isOption(field, value) ? null : fail('option'));\n return TEXT_TYPES.has(field.type) ? stringError(field, value, 'string', fail) : primitiveError(field, value, fail);\n}\n\nexport function typeMessageKeys(field: FormField): MessageKey[] {\n if (BOOLEAN_TYPES.includes(field.type)) return ['boolean'];\n if (field.type === 'number') return ['number'];\n if (field.type === 'multiselect') return ['options', 'option'];\n const format = FORMATS.get(field.type)?.[1];\n if (format) return [format, 'maxLength'];\n if (field.type === 'file') return ['file', 'maxLength'];\n if (field.type === 'select' || field.type === 'radio') return ['option', 'maxLength'];\n return [TEXT_TYPES.has(field.type) ? 'string' : 'value', 'maxLength'];\n}\n\nexport function clientTypeError(field: FormField, value: unknown, resolve?: ResolveMessage): string | null {\n if (field.type === 'file' || !BUILT_IN_TYPES.includes(field.type)) return null;\n return typeError(field, value, resolve);\n}\n"]}
|
package/dist/chunk-76YV4J3Q.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import {l,o,d,k as k$1,s,i,h,m}from'./chunk-35SAVPYL.js';var L=class extends Error{constructor(e,o){super(`The action completed, but ${e} failed: ${o instanceof Error?o.message:String(o)}`);this.phase=e;this.committed=true;this.name="FormLifecycleError",this.cause=o;}};async function C(t,r){try{await r();}catch(e){throw new L(t,e)}}function v(t,r){let e=o=>l(o,r);return (t.show??[]).every(e)&&(!t.showAny?.length||t.showAny.some(e))}function et(t,r){return !!t&&!!t.disabled?.length&&t.disabled.every(e=>l(e,r))}function ot(t,r){return k$1(t)||t===false&&m.includes(r.type)}function z(t,r,e,o){let n=e[`min${r}`],s=e[`max${r}`];if(n!==void 0&&t<n)return e[`min${r}Message`]??o("min",{min:n});if(s!==void 0&&t>s)return e[`max${r}Message`]??o("max",{max:s})}function st(t,r,e){if(r.pattern!==void 0)try{return new RegExp(r.pattern).test(String(t))?void 0:r.patternMessage??e()}catch{return}}function nt(t,r,e,o){if(typeof t=="number")return z(t,"",r,(s,i)=>o(s,i,e));if(typeof t!="string"&&!Array.isArray(t))return;let n=Array.isArray(t)?"Items":"Length";return z(t.length,"Length",r,(s,i)=>o(`${s}${n}`,i,e))}function b(t,r,e,o$1,n){let s$1=o(t,r),i=t.validation??{},a=d(n),u=()=>i.matchFieldMessage??a("matchField",{},t);if(ot(s$1,t))return i.required?typeof i.required=="string"?i.required:a("required",{},t):i.matchField!==void 0&&!k$1(e[i.matchField])?u():null;let l=s(t,s$1,a);return l||(nt(s$1,i,t,a)??st(s$1,i,()=>a("pattern",{},t))??(i.matchField!==void 0&&s$1!==e[i.matchField]?u():void 0)??(i.validator?o$1?.[i.validator]?.(s$1,e):void 0))||null}function w(t,r,e,o){return O(t.fields,r,e,o)}function O(t,r,e,o){let n={};for(let s of t){if(!v(s,r))continue;let i=b(s,r[s.key],r,e,o);i&&(n[s.key]=i);}return n}function N(t){return t.visibleSteps.map(r=>r.id).join(`
|
|
2
|
-
`)}function j(t,r){let e=N(t),o=Object.keys(r).filter(n=>r[n]!==void 0).map(n=>[n,t.values[n]]);return ()=>N(t)!==e||o.some(([n,s])=>!Object.is(t.values[n],s))}function W(t,r){let e={...r};return ()=>i(e,t.values)}function I(t,r,e=false,o=[]){let{state:n}=t,s=t.errors,i$1={},a=[...o];for(let[l,d]of Object.entries(r))t.visibility.activeField(l,t.values)?i$1[l]=d:a.push(d);e&&(n.serverErrors=i$1,n.serverFormErrors=a),n.errors={...n.serverErrors,...i$1},n.topLevelErrors=e?a:[...n.serverFormErrors,...a];let u=e&&Y(t,i$1);t.notify({fieldKeys:i(s,t.errors),structureChanged:u});}function Y(t,r){let e=t.visibleSteps.findIndex(o=>o.fields.some(n=>r[n.key]!==void 0));return e<0||e===t.currentStepIndex?false:(t.state.currentStepIndex=e,true)}function _(t,r,e=false){e&&delete t.state.serverErrors[r];let o=t.state.serverErrors[r];o===void 0?delete t.errors[r]:t.errors[r]=o;}function k(t,r){for(let e of r)delete t.state.serverErrors[e];}function Kt(t,r){let e=[];for(let o of t.visibility.allFields)o.validation?.matchField!==r||t.errors[o.key]===void 0||b(o,t.values[o.key],E(t),t.validators,t.messages)||(_(t,o.key),e.push(o.key));return e}function M(t){let r=new Set(t.visibleSteps.flatMap(o=>o.fields.map(n=>n.key))),e=Object.keys(t.errors).filter(o=>!r.has(o));for(let o of e)delete t.errors[o];return k(t,e),e}function E(t){return g(t)}function it(t,r){for(let e of [...t.skipped.values()].flat())delete r[e];return r}function B(t,r=false){let e=t.errors,o={};if(t.isMultiStep)for(let s of t.visibleSteps)t.skipped.has(s.id)||Object.assign(o,w(s,E(t),t.validators,t.messages));else Object.assign(o,O(t.definition.fields??[],E(t),t.validators,t.messages));t.state.errors={...t.state.serverErrors,...o};let n=r&&Y(t,o);return t.notify({fieldKeys:i(e,o),structureChanged:n}),o}function Lt(t,r){let e=t.visibility.activeField(r,t.values);if(!e)return null;let o=t.errors[r],n=b(e,t.values[r],E(t),t.validators,t.messages);n?t.errors[r]=n:_(t,r,true);let s=Object.is(o,t.errors[r])?[]:[r];return t.notify({fieldKeys:s}),n}function g(t){let r={...t.visibility.conditionValues(t.values)};for(let e of Object.keys(r)){let o$1=t.visibility.activeField(e,t.values);o$1&&(r[e]=o(o$1,r[e]));}return it(t,r)}function Bt(t,r){let e=t.values,o=t.errors,n=Object.keys(t.fieldLoading);t.validationEpoch++,t.operationEpoch++,t.state.submitting=false,t.state.values=h(t.visibility.allFields,r),t.state.errors={},t.state.topLevelErrors=[],t.state.serverErrors={},t.state.serverFormErrors=[],t.state.fieldLoading={},t.state.stepValidating=false,t.state.currentStepIndex=0,t.skipped.clear(),t.visibility.reconcileHidden(t.values,t.errors);let s=i(e,t.values),i$1=new Set([...s,...i(o,t.errors),...n]);t.notify({fieldKeys:i$1,structureChanged:true,valuesChanged:s.size>0});}function J(t,r){return Q(t,r).steps}function Q(t,r){let e=t.steps??[],o=new Map(e.map((i,a)=>[i.id,a])),n=[],s={};e.length||G({fields:t.fields??[]},r,s);for(let i=0;i<e.length;){let a=e[i];if(!v(a,s)){i++;continue}n.push(a),G(a,r,s);let u=a.routes?.find(l=>v(l,s)&&(l.to===null||(o.get(l.to)??-1)>i&&v(e[o.get(l.to)],s)));if(u?.to===null)break;i=u?o.get(u.to):i+1;}return {steps:n,values:s}}function U(t,r,e){let o=t[e]??t[t.length-1],n=r.findIndex(i=>i.id===o?.id);if(n!==-1)return n;let s=new Map(r.map((i,a)=>[i.id,a]));for(let i=Math.min(e-1,t.length-1);i>=0;i--){let a=s.get(t[i].id);if(a!==void 0)return a}return 0}function G(t,r,e){let o$1=t.fields.map(({key:s})=>[s,Object.prototype.hasOwnProperty.call(e,s),e[s]]);for(let s of t.fields)e[s.key]=o(s,r[s.key]);let n=t.fields.filter(s=>v(s,e)&&r[s.key]!==void 0);for(let[s,i,a]of o$1)i?e[s]=a:delete e[s];for(let s of n)e[s.key]=o(s,r[s.key]);}function Ht(t){let r=null,e=[],o={},n=s=>{r!==s&&(r=s,{steps:e,values:o}=Q(t,s));};return {invalidate(){r=null;},steps(s){return n(s),e},values(s){return n(s),o}}}function X(t){let r=t.currentStep?.fields??[],e={...t.values};for(let{key:o}of r)delete e[o];return Object.assign(e,h(r))}function T(t){return J(t.definition,X(t))[t.currentStepIndex+1]}function A(t){let r=t.currentStep,e=r.fields.map(({key:n})=>n);t.state.values=X(t);for(let n of e)delete t.errors[n];k(t,e),t.skipped.set(r.id,e),k(t,t.visibility.reconcileHidden(t.values,t.errors)),t.visibility.markChanged(true,true);let o=M(t);return t.notify({fieldKeys:[...e,...o],structureChanged:true,valuesChanged:true}),e}function P(t){let r=t.currentStep;r&&t.skipped.delete(r.id);}function Yt(t,r){return t.state.currentStepIndex=r,t.notify({structureChanged:true}),A(t)}function $(t){return !!t&&Object.getPrototypeOf(t)===Object.prototype&&t.ok===false}function at(t,r,e){let o={},n=typeof r.errors=="object"&&r.errors?r.errors:{};for(let[i,a]of Object.entries(n)){let u=Array.isArray(a)?a.join(" "):a;typeof u=="string"&&Object.is(t.values[i],e[i])&&(o[i]=u);}let s=Array.isArray(r.formErrors)?r.formErrors.filter(i=>typeof i=="string"):[];I(t,o,true,s);}async function Z(t,r,e=false){if(t.submitting||t.stepValidating)return false;e||P(t);let o={...t.lifecycle},n=false,s=t.validationEpoch,i=t.latestOperation=++t.operationEpoch,a=g(t),u=j(t,a),l=()=>s!==t.validationEpoch||i!==t.operationEpoch||u();t.state.submitting=true,t.notify();try{if(l()||Object.keys(B(t,!0)).length>0||l())return !1;if(o.onBeforeSubmit){let K=await o.onBeforeSubmit(a);if(l()||K===!1)return !1}if(l())return !1;if(o.onBeforeSubmit){if(Object.keys(B(t,!0)).length>0||l())return !1;a=g(t);}n=!0;let d=[...t.skipped.keys()],y={...t.values},p=t.state.serverErrors,f=await r(a,[...d]),c=$(f);return i!==t.operationEpoch?!c:c?(at(t,f,y),!1):(t.state.serverErrors===p&&I(t,{},!0),await C("afterSubmit",()=>o.onAfterSubmit?.(a,d)),!0)}catch(d){if(!n&&l())return false;throw d}finally{i===t.operationEpoch&&(t.state.submitting=false,t.notify());}}function tt(t){let r=t.currentStep;if(!r)return true;let e=w(r,E(t),t.validators,t.messages);if(Object.keys(e).length===0)return false;let o=t.errors;return t.state.errors={...o,...e},t.notify({fieldKeys:i(o,t.errors)}),true}function rt(t,r){t.validationEpoch++,t.state.currentStepIndex=r,t.notify({structureChanged:true});}async function ar(t,r){if(!t.isMultiStep||t.stepValidating||t.submitting||!t.currentStep?.skip)return false;if(T(t))return lt(t,"next","skip");let e=t.currentStep;if(!r||!e)return false;let o=t.values,n={...t.errors},s={...t.state.serverErrors},i;A(t);let a=t.values,u=W(t,a),l=Z(t,async(y,p)=>{let f=await r(y,p),c=$(f);return (!c||d===t.operationEpoch)&&(i=c),f},true),d=t.latestOperation;try{return await l}finally{if(i!==false&&d===t.latestOperation&&t.values===a){let y=t.visibleSteps,p=u(),f=t.values;t.state.values={...o};for(let c of p)delete t.values[c],delete n[c],delete s[c],c in f&&(t.values[c]=f[c]);i===void 0&&(t.state.serverErrors=s),t.state.errors={...i?{}:n,...t.errors},t.skipped.delete(e.id),k(t,t.visibility.reconcileHidden(t.values,t.errors)),t.visibility.markChanged(true,true),t.state.currentStepIndex=U(y,t.visibleSteps,t.currentStepIndex),M(t),t.notify({fieldKeys:Object.keys({...o,...f,...n}),structureChanged:true,valuesChanged:true});}}}async function lt(t,r,e=r){let o=e==="skip";if(!t.isMultiStep||t.stepValidating||t.submitting||!o&&(r==="next"?t.isLastStep:t.isFirstStep))return false;let n=t.currentStep,s=r==="next"&&!o;if(s&&P(t),s&&tt(t))return false;let i={...t.lifecycle},a=t.onStepValidate,u=false,d=t.currentStepIndex+(r==="next"?1:-1),y=o?T(t):t.visibleSteps[d];if(!y)return false;let p={fromStepId:n.id,toStepId:y.id,reason:e,values:{...E(t)}},f=t.validationEpoch,c=t.latestOperation=++t.operationEpoch,K=j(t,p.values),F=()=>f!==t.validationEpoch||c!==t.operationEpoch||t.currentStep?.id!==n.id||K();t.state.stepValidating=true,t.notify();try{if(F())return !1;if(s&&a){let h=await a(n.id,p.values);if(F())return !1;if(h&&Object.keys(h).length>0)return I(t,h),!1}if(i.onBeforeStepChange){let h=await i.onBeforeStepChange(p);if(F()||h===!1)return !1}return F()||s&&tt(t)?!1:(u=!0,o&&A(t),rt(t,d),await C("afterStepChange",()=>i.onAfterStepChange?.(p)),!0)}catch(h){if(!u&&F())return false;throw h}finally{c===t.operationEpoch&&(t.state.stepValidating=false,t.notify());}}function lr(t,r){if(!t.isMultiStep)return;let e=t.visibility.findStepIndex(r,t.values,t.currentStepIndex);e===t.currentStepIndex?t.notify():e!==null&&rt(t,e);}export{L as a,v as b,et as c,b as d,w as e,O as f,I as g,_ as h,k as i,Kt as j,M as k,B as l,Lt as m,g as n,Bt as o,U as p,Ht as q,Yt as r,Z as s,ar as t,lt as u,lr as v};//# sourceMappingURL=chunk-76YV4J3Q.js.map
|
|
3
|
-
//# sourceMappingURL=chunk-76YV4J3Q.js.map
|