@verbb/formie-browser 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/chunks/{address-finder-CQW81kY0.js → address-finder-BU4roxT6.js} +2 -2
- package/dist/chunks/{bpoint-D8OjLmsn.js → bpoint-uNg5j6rt.js} +1 -1
- package/dist/chunks/{calculations-BqZsENCq.js → calculations-C9t6Zop9.js} +2 -2
- package/dist/chunks/{captcha-eu-DIa6aUWz.js → captcha-eu-BAPzHNts.js} +2 -2
- package/dist/chunks/{checkbox-radio-BI-UjgMF.js → checkbox-radio-CHeLNVIK.js} +39 -34
- package/dist/chunks/{conditions-BVl6jTYo.js → conditions-DKxVCsjD.js} +189 -163
- package/dist/chunks/{date-picker-69TgvErA.js → date-picker-B3iQ797Z.js} +2 -2
- package/dist/chunks/{eway-1GPxH6DU.js → eway-DCielIML.js} +2 -2
- package/dist/chunks/file-upload-DP2TOUYV.js +316 -0
- package/dist/chunks/{friendly-captcha-v1-DA2QPKA3.js → friendly-captcha-v1-DdlcGiFY.js} +1 -1
- package/dist/chunks/{friendly-captcha-v2-BorOWiz_.js → friendly-captcha-v2-76w-YnFm.js} +1 -1
- package/dist/chunks/{go-cardless-DwBgERcA.js → go-cardless-rwCkzbNK.js} +1 -1
- package/dist/chunks/{google-address-BcTBncyS.js → google-address-BD8IZ86V.js} +77 -58
- package/dist/chunks/{hcaptcha-BchdVCqq.js → hcaptcha-BNNTL6uf.js} +2 -2
- package/dist/chunks/{hidden-D8RqSPt7.js → hidden-CW6Rcf1N.js} +1 -1
- package/dist/chunks/{index-C1ZOKiAi.js → index-D6npYxvr.js} +1372 -1178
- package/dist/chunks/{loqate-nXuTX7In.js → loqate-B-ZNS65B.js} +2 -2
- package/dist/chunks/{mollie-qdCynQCd.js → mollie-BDAZ-1X4.js} +1 -1
- package/dist/chunks/{moneris-BNEA-laO.js → moneris-B1b0uEtY.js} +1 -1
- package/dist/chunks/{opayo-BJtXOkuK.js → opayo-CC5hraHo.js} +2 -2
- package/dist/chunks/{paddle-D72Pa8kr.js → paddle-B4GmrDsq.js} +2 -2
- package/dist/chunks/{paypal-Cqt2bned.js → paypal-BFS6XsIS.js} +2 -2
- package/dist/chunks/{payway-BjCqsc0H.js → payway-DekoJead.js} +2 -2
- package/dist/chunks/{phone-country-K9pYAlzM.js → phone-country-Cm5YUeXI.js} +2 -2
- package/dist/chunks/{place-kit-Dg6f_UoM.js → place-kit-DizZWV_e.js} +1 -1
- package/dist/chunks/{recaptcha-enterprise--VYAeeqz.js → recaptcha-enterprise-BbOvO7JZ.js} +2 -2
- package/dist/chunks/{recaptcha-shared-PSIEEEe1.js → recaptcha-shared-Dwg1eVFS.js} +2 -2
- package/dist/chunks/{recaptcha-v2-checkbox-atBNe5ml.js → recaptcha-v2-checkbox-SY3ti5iQ.js} +2 -2
- package/dist/chunks/{recaptcha-v2-invisible-DnBufNPT.js → recaptcha-v2-invisible-DSmQnn6c.js} +2 -2
- package/dist/chunks/{recaptcha-v3-CF6O8rDj.js → recaptcha-v3-DNh7YCnR.js} +2 -2
- package/dist/chunks/{repeater-CB7Yojvx.js → repeater-DM0vuFNQ.js} +2 -2
- package/dist/chunks/{rich-text-nAV_SQZo.js → rich-text-C8aGYp70.js} +1 -1
- package/dist/chunks/{scripts-BkAAux0i.js → scripts-CKTFtxPO.js} +1 -1
- package/dist/chunks/{shared-DGqeMvcJ.js → shared--BU5CFoL.js} +4 -4
- package/dist/chunks/{signature-BT6CsQ6n.js → signature-pFhZfH7d.js} +1 -1
- package/dist/chunks/{snaptcha-C7qQo02f.js → snaptcha-VuOUOaLj.js} +1 -1
- package/dist/chunks/{square-C5AH3trb.js → square-BR9pvToy.js} +4 -4
- package/dist/chunks/{stripe-EJK0RyUv.js → stripe-OHUwoV9g.js} +2 -2
- package/dist/chunks/{summary-DC_ipXCU.js → summary-Da7Ktg3N.js} +2 -2
- package/dist/chunks/{table-BEAI99qo.js → table-C0PmR9bI.js} +2 -2
- package/dist/chunks/text-limit-mLEwZDIa.js +144 -0
- package/dist/chunks/{turnstile-_uCRwnU-.js → turnstile-9tM7q_LK.js} +2 -2
- package/dist/css/theme/forms/_form.css +28 -0
- package/dist/index.js +9 -9
- package/dist/js/core/create-formie-client.d.ts.map +1 -1
- package/dist/js/core/field-error-container.d.ts +4 -0
- package/dist/js/core/field-error-container.d.ts.map +1 -0
- package/dist/js/core/submit-result-state.d.ts.map +1 -1
- package/dist/js/core/submit-result-ui.d.ts.map +1 -1
- package/dist/js/modules/address/google-address.d.ts +7 -0
- package/dist/js/modules/address/google-address.d.ts.map +1 -1
- package/dist/js/modules/fields/checkbox-radio.d.ts.map +1 -1
- package/dist/js/modules/fields/conditions/effects.d.ts +3 -1
- package/dist/js/modules/fields/conditions/effects.d.ts.map +1 -1
- package/dist/js/modules/fields/conditions.d.ts.map +1 -1
- package/dist/js/modules/fields/file-upload.d.ts.map +1 -1
- package/dist/js/modules/fields/text-limit.d.ts.map +1 -1
- package/dist/js/submit/pipeline.d.ts.map +1 -1
- package/dist/js/utils/i18n.d.ts.map +1 -1
- package/dist/js/validation/rules/email.d.ts.map +1 -1
- package/dist/js/validation/rules/number.d.ts.map +1 -1
- package/dist/js/validation/scope.d.ts +6 -0
- package/dist/js/validation/scope.d.ts.map +1 -0
- package/dist/js/validation/submit-readiness.d.ts +4 -0
- package/dist/js/validation/submit-readiness.d.ts.map +1 -0
- package/dist/js/validation/validator.d.ts +1 -0
- package/dist/js/validation/validator.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/css/theme/forms/_form.css +28 -0
- package/src/js/core/create-formie-client.ts +6 -0
- package/src/js/core/field-error-container.ts +39 -0
- package/src/js/core/submit-result-state.ts +29 -2
- package/src/js/core/submit-result-ui.ts +3 -9
- package/src/js/modules/address/google-address.ts +33 -1
- package/src/js/modules/fields/checkbox-radio.ts +21 -15
- package/src/js/modules/fields/conditions/effects.ts +79 -2
- package/src/js/modules/fields/conditions.ts +53 -11
- package/src/js/modules/fields/file-upload.ts +200 -105
- package/src/js/modules/fields/text-limit.ts +87 -22
- package/src/js/submit/pipeline.ts +3 -28
- package/src/js/utils/i18n.ts +184 -5
- package/src/js/validation/rules/email.ts +3 -2
- package/src/js/validation/rules/match.ts +2 -2
- package/src/js/validation/rules/minmax.ts +4 -4
- package/src/js/validation/rules/number.ts +9 -5
- package/src/js/validation/rules/pattern.ts +4 -4
- package/src/js/validation/rules/required.ts +1 -1
- package/src/js/validation/rules/url.ts +1 -1
- package/src/js/validation/scope.ts +25 -0
- package/src/js/validation/submit-readiness.ts +157 -0
- package/src/js/validation/validator.ts +11 -7
- package/dist/chunks/file-upload-BDZZftgL.js +0 -281
- package/dist/chunks/text-limit-Blgq5G-G.js +0 -135
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../../src/js/utils/i18n.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;AA4DtE,wBAAgB,qBAAqB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAE9D;AAED,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAIlG;AAED,wBAAgB,uBAAuB,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CASpG;
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../../src/js/utils/i18n.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;AA4DtE,wBAAgB,qBAAqB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAE9D;AAED,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAIlG;AAED,wBAAgB,uBAAuB,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CASpG;AA2LD,wBAAgB,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,GAAE,uBAA4B,GAAG,MAAM,CAQrF;AAED,eAAO,MAAM,SAAS,UAAI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../../../../src/js/validation/rules/email.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAElE,QAAA,MAAM,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../../../../src/js/validation/rules/email.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAElE,QAAA,MAAM,KAAK,EAAE,wBAcZ,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../../../src/js/validation/rules/number.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAElE,QAAA,MAAM,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../../../src/js/validation/rules/number.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAElE,QAAA,MAAM,MAAM,EAAE,wBAsDb,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../../src/js/validation/scope.ts"],"names":[],"mappings":"AAAA,wBAAgB,YAAY,CAAC,IAAI,EAAE,eAAe,GAAG,WAAW,EAAE,CAEjE;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,eAAe,GAAG;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAoB5F"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { FormieValidator } from '#validation/validator';
|
|
2
|
+
export declare function syncSubmitReadiness(form: HTMLFormElement, validator: FormieValidator): void;
|
|
3
|
+
export declare function bindSubmitReadiness(form: HTMLFormElement, validator: FormieValidator, target: Element): () => void;
|
|
4
|
+
//# sourceMappingURL=submit-readiness.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"submit-readiness.d.ts","sourceRoot":"","sources":["../../../src/js/validation/submit-readiness.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAqB7D,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,eAAe,EAAE,SAAS,EAAE,eAAe,GAAG,IAAI,CA+C3F;AAED,wBAAgB,mBAAmB,CAC/B,IAAI,EAAE,eAAe,EACrB,SAAS,EAAE,eAAe,EAC1B,MAAM,EAAE,OAAO,GAChB,MAAM,IAAI,CAiFZ"}
|
|
@@ -24,6 +24,7 @@ export declare class FormieValidator {
|
|
|
24
24
|
getInputValue(input: ValidationInput): string | boolean;
|
|
25
25
|
isDirty(input: ValidationInput): boolean;
|
|
26
26
|
shouldShowError(input: ValidationInput): boolean;
|
|
27
|
+
isValid(inputOrSelector?: Element | null, options?: ValidateOptions): boolean;
|
|
27
28
|
validate(inputOrSelector?: Element | null, options?: ValidateOptions): ValidationError[];
|
|
28
29
|
removeAllErrors(): void;
|
|
29
30
|
removeError(input: ValidationInput): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../src/js/validation/validator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../src/js/validation/validator.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verbb/formie-browser",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"vite": "^8.0.10"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@verbb/formie-core": "1.0.
|
|
68
|
+
"@verbb/formie-core": "1.0.4",
|
|
69
69
|
"@friendlycaptcha/sdk": "^1.0.0",
|
|
70
70
|
"@placekit/autocomplete-js": "^2.2.1",
|
|
71
71
|
"expression-language": "^2.5.4",
|
|
@@ -101,6 +101,34 @@
|
|
|
101
101
|
.formie-row[data-formie-field-count="4"] {
|
|
102
102
|
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
103
103
|
}
|
|
104
|
+
|
|
105
|
+
.formie-row[data-formie-field-count="5"] {
|
|
106
|
+
grid-template-columns: repeat(5, minmax(0, 1fr));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.formie-row[data-formie-row-submit-inline] > .formie-row-submit {
|
|
111
|
+
display: flex;
|
|
112
|
+
flex-direction: column;
|
|
113
|
+
justify-content: flex-end;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
@media (min-width: 40rem) {
|
|
117
|
+
.formie-row[data-formie-row-submit-inline] {
|
|
118
|
+
display: flex;
|
|
119
|
+
flex-wrap: nowrap;
|
|
120
|
+
align-items: stretch;
|
|
121
|
+
gap: var(--formie-gap-row);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.formie-row[data-formie-row-submit-inline] > [data-formie-field] {
|
|
125
|
+
flex: 1 1 0;
|
|
126
|
+
min-width: 0;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.formie-row[data-formie-row-submit-inline] > .formie-row-submit {
|
|
130
|
+
flex: 0 0 auto;
|
|
131
|
+
}
|
|
104
132
|
}
|
|
105
133
|
|
|
106
134
|
.formie-errors {
|
|
@@ -25,6 +25,7 @@ import { clearSubmissionOnUnload, requestGraphqlRender, requestRefreshTokens, re
|
|
|
25
25
|
import { createDebug } from '#utils/debug';
|
|
26
26
|
import { createFormUnloadWarningGuard } from '#utils/unload-warning';
|
|
27
27
|
import { FormieValidator } from '#validation/validator';
|
|
28
|
+
import { bindSubmitReadiness } from '#validation/submit-readiness';
|
|
28
29
|
|
|
29
30
|
type InternalInstanceState = {
|
|
30
31
|
options: FormMountOptions;
|
|
@@ -1135,6 +1136,11 @@ export function createFormieClient(): FormieClient {
|
|
|
1135
1136
|
|
|
1136
1137
|
if (form) {
|
|
1137
1138
|
bindFormEvents(target, form, normalizedOptions, bus, validator, unbinds);
|
|
1139
|
+
|
|
1140
|
+
if (validator) {
|
|
1141
|
+
unbinds.push(bindSubmitReadiness(form, validator, target));
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1138
1144
|
await refreshTokensIfNeeded(target, normalizedOptions, form);
|
|
1139
1145
|
}
|
|
1140
1146
|
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export type FieldErrorPosition = 'above' | 'below';
|
|
2
|
+
|
|
3
|
+
export function getFieldErrorPosition(fieldNode: Element): FieldErrorPosition {
|
|
4
|
+
const layout = fieldNode.querySelector('[data-formie-field-layout]');
|
|
5
|
+
const position = layout?.getAttribute('data-formie-error-position')?.trim();
|
|
6
|
+
|
|
7
|
+
return position === 'above' ? 'above' : 'below';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function ensureFieldErrorContainer(
|
|
11
|
+
fieldNode: Element,
|
|
12
|
+
applyTheme?: (container: HTMLElement) => void,
|
|
13
|
+
): HTMLElement {
|
|
14
|
+
const existing = fieldNode.querySelector('[data-formie-field-errors]') as HTMLElement | null;
|
|
15
|
+
|
|
16
|
+
if (existing) {
|
|
17
|
+
return existing;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const content = fieldNode.querySelector('[data-formie-field-content]') as HTMLElement | null;
|
|
21
|
+
const control = fieldNode.querySelector('[data-formie-field-control]') as HTMLElement | null;
|
|
22
|
+
const position = getFieldErrorPosition(fieldNode);
|
|
23
|
+
const container = document.createElement('div');
|
|
24
|
+
|
|
25
|
+
container.setAttribute('data-formie-field-errors', 'true');
|
|
26
|
+
applyTheme?.(container);
|
|
27
|
+
|
|
28
|
+
if (content && control) {
|
|
29
|
+
if (position === 'above') {
|
|
30
|
+
content.insertBefore(container, control);
|
|
31
|
+
} else {
|
|
32
|
+
content.appendChild(container);
|
|
33
|
+
}
|
|
34
|
+
} else {
|
|
35
|
+
fieldNode.appendChild(container);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return container;
|
|
39
|
+
}
|
|
@@ -6,6 +6,7 @@ import { addThemeClasses, removeThemeClasses, toggleThemeClasses } from '#theme/
|
|
|
6
6
|
import { createDebug } from '#utils/debug';
|
|
7
7
|
import { getFormStateEventName, normalizeFormieEventName } from '#utils/event-names';
|
|
8
8
|
import type { FormieValidator } from '#validation/validator';
|
|
9
|
+
import { syncSubmitReadiness } from '#validation/submit-readiness';
|
|
9
10
|
|
|
10
11
|
type FormWithValidationApi = HTMLFormElement & {
|
|
11
12
|
formieValidation?: FormieValidator;
|
|
@@ -101,6 +102,16 @@ function getConfiguredSubmitAction(form: HTMLFormElement): string {
|
|
|
101
102
|
return (form.dataset.formieSubmitAction || '').trim();
|
|
102
103
|
}
|
|
103
104
|
|
|
105
|
+
function getResolvedSubmitAction(form: HTMLFormElement, result: FormSubmitResult): string {
|
|
106
|
+
const fromResponse = result.meta?.effectiveSubmitAction;
|
|
107
|
+
|
|
108
|
+
if (typeof fromResponse === 'string' && fromResponse.trim() !== '') {
|
|
109
|
+
return fromResponse.trim();
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return getConfiguredSubmitAction(form);
|
|
113
|
+
}
|
|
114
|
+
|
|
104
115
|
function shouldHideFormOnSuccess(form: HTMLFormElement): boolean {
|
|
105
116
|
const rawValue = form.dataset.formieSubmitActionFormHide;
|
|
106
117
|
|
|
@@ -287,6 +298,14 @@ export function clearSubmitLoading(form: HTMLFormElement): void {
|
|
|
287
298
|
button.removeAttribute('data-formie-loading-indicator');
|
|
288
299
|
button.removeAttribute('data-formie-loading-text');
|
|
289
300
|
});
|
|
301
|
+
|
|
302
|
+
if (form.dataset.formieDisableSubmitUntilValid === 'true') {
|
|
303
|
+
const formWithValidation = form as FormWithValidationApi;
|
|
304
|
+
|
|
305
|
+
if (formWithValidation.formieValidation) {
|
|
306
|
+
syncSubmitReadiness(form, formWithValidation.formieValidation);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
290
309
|
}
|
|
291
310
|
|
|
292
311
|
export function applyPageState(form: HTMLFormElement, nextPageId: string): void {
|
|
@@ -337,6 +356,14 @@ export function applyPageState(form: HTMLFormElement, nextPageId: string): void
|
|
|
337
356
|
// follow-up submits, and server recovery land on the same page.
|
|
338
357
|
setHiddenInputValue(form, 'pageId', nextPageId);
|
|
339
358
|
syncPageTabErrors(form);
|
|
359
|
+
|
|
360
|
+
if (form.dataset.formieDisableSubmitUntilValid === 'true') {
|
|
361
|
+
const formWithValidation = form as FormWithValidationApi;
|
|
362
|
+
|
|
363
|
+
if (formWithValidation.formieValidation) {
|
|
364
|
+
syncSubmitReadiness(form, formWithValidation.formieValidation);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
340
367
|
}
|
|
341
368
|
|
|
342
369
|
function syncSubmissionIdentity(form: HTMLFormElement, result: FormSubmitResult): void {
|
|
@@ -563,7 +590,7 @@ export function applySubmitResultState(form: HTMLFormElement, result: FormSubmit
|
|
|
563
590
|
}
|
|
564
591
|
|
|
565
592
|
if (action === 'submit' && !result.redirect?.url) {
|
|
566
|
-
const configuredSubmitAction =
|
|
593
|
+
const configuredSubmitAction = getResolvedSubmitAction(form, result);
|
|
567
594
|
const preserveHiddenState = configuredSubmitAction === 'message' && shouldHideFormOnSuccess(form);
|
|
568
595
|
|
|
569
596
|
if (configuredSubmitAction === 'reload') {
|
|
@@ -586,7 +613,7 @@ export function applySubmitResultState(form: HTMLFormElement, result: FormSubmit
|
|
|
586
613
|
}
|
|
587
614
|
|
|
588
615
|
if (action === 'submit' && result.redirect?.url && result.redirect.target === 'new-tab') {
|
|
589
|
-
const configuredSubmitAction =
|
|
616
|
+
const configuredSubmitAction = getResolvedSubmitAction(form, result);
|
|
590
617
|
const preserveHiddenState = configuredSubmitAction === 'message' && shouldHideFormOnSuccess(form);
|
|
591
618
|
clearPendingFinalSubmitReset(form);
|
|
592
619
|
resetSubmissionState(form, { preserveHiddenState });
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { FormSubmitResult } from '#contracts/schema';
|
|
2
|
+
import { ensureFieldErrorContainer as resolveFieldErrorContainer } from '#core/field-error-container';
|
|
2
3
|
import { syncPageTabErrors } from '#core/page-tab-errors';
|
|
3
4
|
import { setFormHiddenState } from '#core/submit-result-state';
|
|
4
5
|
import { addThemeClasses, removeThemeClasses } from '#theme/theme-classes';
|
|
@@ -150,16 +151,9 @@ function ensureFormSuccessContainer(form: HTMLFormElement, position: string): HT
|
|
|
150
151
|
}
|
|
151
152
|
|
|
152
153
|
function ensureFieldErrorContainer(fieldNode: Element): HTMLElement {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
if (!container) {
|
|
156
|
-
container = document.createElement('div');
|
|
157
|
-
container.setAttribute('data-formie-field-errors', 'true');
|
|
154
|
+
return resolveFieldErrorContainer(fieldNode, (container) => {
|
|
158
155
|
addThemeClasses(container, fieldNode, 'fieldErrors');
|
|
159
|
-
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
return container;
|
|
156
|
+
});
|
|
163
157
|
}
|
|
164
158
|
|
|
165
159
|
function removeDescribedBy(input: HTMLElement, describedById: string): void {
|
|
@@ -8,6 +8,7 @@ type GoogleMaps = typeof google;
|
|
|
8
8
|
type GoogleAddressProviderOptions = {
|
|
9
9
|
apiKey?: string;
|
|
10
10
|
options?: Record<string, unknown>;
|
|
11
|
+
countryDefaultValue?: string;
|
|
11
12
|
};
|
|
12
13
|
|
|
13
14
|
const SCRIPT_ID = 'FORMIE_GOOGLE_ADDRESS_SCRIPT';
|
|
@@ -194,6 +195,37 @@ function buildAddressFromComponents(formData: Record<string, string>): {
|
|
|
194
195
|
};
|
|
195
196
|
}
|
|
196
197
|
|
|
198
|
+
function hasCountryRestriction(options: Record<string, unknown>): boolean {
|
|
199
|
+
const componentRestrictions = options.componentRestrictions;
|
|
200
|
+
|
|
201
|
+
if (componentRestrictions && typeof componentRestrictions === 'object') {
|
|
202
|
+
const country = (componentRestrictions as { country?: unknown }).country;
|
|
203
|
+
|
|
204
|
+
if (Array.isArray(country) ? country.length > 0 : Boolean(country)) {
|
|
205
|
+
return true;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
const includedRegionCodes = options.includedRegionCodes;
|
|
210
|
+
|
|
211
|
+
return Array.isArray(includedRegionCodes) && includedRegionCodes.length > 0;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export function buildGoogleAutocompleteOptions(provider: GoogleAddressProviderOptions): Record<string, unknown> {
|
|
215
|
+
const options = { types: ['geocode'], ...(provider.options || {}) };
|
|
216
|
+
const country = provider.countryDefaultValue?.trim().toLowerCase();
|
|
217
|
+
|
|
218
|
+
if (!country || hasCountryRestriction(options)) {
|
|
219
|
+
return options;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
return {
|
|
223
|
+
...options,
|
|
224
|
+
componentRestrictions: { country },
|
|
225
|
+
includedRegionCodes: [country.toUpperCase()],
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
|
|
197
229
|
export const googleAddressModule = defineAddressModule<
|
|
198
230
|
GoogleAddressProviderOptions,
|
|
199
231
|
GoogleMaps,
|
|
@@ -218,7 +250,7 @@ export const googleAddressModule = defineAddressModule<
|
|
|
218
250
|
return null;
|
|
219
251
|
}
|
|
220
252
|
|
|
221
|
-
const options =
|
|
253
|
+
const options = buildGoogleAutocompleteOptions(provider);
|
|
222
254
|
const autocomplete = new PlaceAutocompleteElement(options);
|
|
223
255
|
const inputHeight = window.getComputedStyle(input).height;
|
|
224
256
|
|
|
@@ -31,6 +31,14 @@ function getMinMaxRule(getRule: (rule: string) => unknown): { min: number | null
|
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
function getSelectedOptionCount(field: HTMLElement): number {
|
|
35
|
+
return Array.from(field.querySelectorAll('input[type="checkbox"]')).filter((input): input is HTMLInputElement => {
|
|
36
|
+
return input instanceof HTMLInputElement && !isToggleCheckbox(input);
|
|
37
|
+
}).filter((input) => {
|
|
38
|
+
return input.checked;
|
|
39
|
+
}).length;
|
|
40
|
+
}
|
|
41
|
+
|
|
34
42
|
function registerValidators(form: HTMLFormElement | null): void {
|
|
35
43
|
// Several checkbox/radio module instances can exist in one form, but the
|
|
36
44
|
// custom validator should only be registered once per form lifecycle.
|
|
@@ -42,12 +50,7 @@ function registerValidators(form: HTMLFormElement | null): void {
|
|
|
42
50
|
return true;
|
|
43
51
|
}
|
|
44
52
|
|
|
45
|
-
const
|
|
46
|
-
return input instanceof HTMLInputElement && !isToggleCheckbox(input);
|
|
47
|
-
});
|
|
48
|
-
const selected = inputs.filter((input) => {
|
|
49
|
-
return input.checked;
|
|
50
|
-
}).length;
|
|
53
|
+
const selected = getSelectedOptionCount(field);
|
|
51
54
|
const { min, max } = getMinMaxRule(getRule);
|
|
52
55
|
|
|
53
56
|
if (min !== null && selected < min) {
|
|
@@ -61,21 +64,24 @@ function registerValidators(form: HTMLFormElement | null): void {
|
|
|
61
64
|
return true;
|
|
62
65
|
},
|
|
63
66
|
({ field, label, t, getRule }) => {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
if (min !== null && max !== null) {
|
|
67
|
-
return t('{attribute} must select between {min} and {max}.', { attribute: label, min, max });
|
|
67
|
+
if (!field) {
|
|
68
|
+
return t('{label} has an invalid value.', { label });
|
|
68
69
|
}
|
|
69
70
|
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
const selected = getSelectedOptionCount(field);
|
|
72
|
+
const { min, max } = getMinMaxRule(getRule);
|
|
73
|
+
|
|
74
|
+
if (min !== null && selected < min) {
|
|
75
|
+
return field.getAttribute('data-formie-validation-min-options-message')
|
|
76
|
+
?? t('{label} should contain at least {min, number} {min, plural, one{option} other{options}}.', { label, min });
|
|
72
77
|
}
|
|
73
78
|
|
|
74
|
-
if (max !== null) {
|
|
75
|
-
return
|
|
79
|
+
if (max !== null && selected > max) {
|
|
80
|
+
return field.getAttribute('data-formie-validation-max-options-message')
|
|
81
|
+
?? t('{label} should contain at most {max, number} {max, plural, one{option} other{options}}.', { label, max });
|
|
76
82
|
}
|
|
77
83
|
|
|
78
|
-
return t('{
|
|
84
|
+
return t('{label} has an invalid value.', { label });
|
|
79
85
|
},
|
|
80
86
|
);
|
|
81
87
|
});
|
|
@@ -3,6 +3,9 @@ const PRESERVED_DISABLED_ATTR = 'data-formie-preserve-disabled';
|
|
|
3
3
|
const CONDITIONAL_HIDDEN_ATTR = 'data-formie-conditionally-hidden';
|
|
4
4
|
const PAGE_HIDDEN_ATTR = 'data-formie-page-hidden';
|
|
5
5
|
const CONDITIONAL_HIDDEN_CLASS = 'formie-conditionally-hidden';
|
|
6
|
+
const CP_MUTED_CLASS = 'fui-cp-muted-conditional-field';
|
|
7
|
+
const CP_MUTED_EXPANDED_CLASS = 'fui-cp-muted-conditional-field--expanded';
|
|
8
|
+
const CP_MUTED_ATTR = 'data-formie-cp-muted';
|
|
6
9
|
const PAGE_HIDDEN_CLASS = 'formie-page-hidden';
|
|
7
10
|
const ROW_HIDDEN_ATTR = 'data-formie-row-hidden';
|
|
8
11
|
const ROW_HIDDEN_CLASS = 'formie-row-hidden';
|
|
@@ -143,6 +146,19 @@ function syncRowState(row: Element): void {
|
|
|
143
146
|
}
|
|
144
147
|
}
|
|
145
148
|
|
|
149
|
+
function clearCpMutedState(node: Element): void {
|
|
150
|
+
node.removeAttribute(CP_MUTED_ATTR);
|
|
151
|
+
node.classList.remove(CP_MUTED_CLASS);
|
|
152
|
+
node.classList.remove(CP_MUTED_EXPANDED_CLASS);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function clearHideState(node: Element): void {
|
|
156
|
+
node.removeAttribute(CONDITIONAL_HIDDEN_ATTR);
|
|
157
|
+
node.removeAttribute(PAGE_HIDDEN_ATTR);
|
|
158
|
+
node.classList.remove(CONDITIONAL_HIDDEN_CLASS);
|
|
159
|
+
node.classList.remove(PAGE_HIDDEN_CLASS);
|
|
160
|
+
}
|
|
161
|
+
|
|
146
162
|
function syncAncestorRows(node: Element): void {
|
|
147
163
|
let currentRow = node.closest(ROW_SELECTOR);
|
|
148
164
|
|
|
@@ -152,8 +168,26 @@ function syncAncestorRows(node: Element): void {
|
|
|
152
168
|
}
|
|
153
169
|
}
|
|
154
170
|
|
|
155
|
-
export function applyConditionVisibility(
|
|
156
|
-
|
|
171
|
+
export function applyConditionVisibility(
|
|
172
|
+
node: Element,
|
|
173
|
+
hidden: boolean,
|
|
174
|
+
clearOnHide: boolean,
|
|
175
|
+
options: { displayMode?: 'hide' | 'muted' } = {},
|
|
176
|
+
): boolean {
|
|
177
|
+
if (options.displayMode === 'muted') {
|
|
178
|
+
return applyMutedConditionVisibility(node, hidden);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
let stateChanged = false;
|
|
182
|
+
|
|
183
|
+
if (node.hasAttribute(CP_MUTED_ATTR)
|
|
184
|
+
|| node.classList.contains(CP_MUTED_CLASS)
|
|
185
|
+
|| node.classList.contains(CP_MUTED_EXPANDED_CLASS)) {
|
|
186
|
+
clearCpMutedState(node);
|
|
187
|
+
stateChanged = true;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
stateChanged = setVisibilityState(node, hidden) || stateChanged;
|
|
157
191
|
|
|
158
192
|
syncDisabledState(node, hidden);
|
|
159
193
|
syncAncestorRows(node);
|
|
@@ -164,3 +198,46 @@ export function applyConditionVisibility(node: Element, hidden: boolean, clearOn
|
|
|
164
198
|
|
|
165
199
|
return stateChanged;
|
|
166
200
|
}
|
|
201
|
+
|
|
202
|
+
function applyMutedConditionVisibility(node: Element, hidden: boolean): boolean {
|
|
203
|
+
let stateChanged = false;
|
|
204
|
+
|
|
205
|
+
if (hidden) {
|
|
206
|
+
if (node.hasAttribute(CONDITIONAL_HIDDEN_ATTR)
|
|
207
|
+
|| node.hasAttribute(PAGE_HIDDEN_ATTR)
|
|
208
|
+
|| node.classList.contains(CONDITIONAL_HIDDEN_CLASS)
|
|
209
|
+
|| node.classList.contains(PAGE_HIDDEN_CLASS)) {
|
|
210
|
+
clearHideState(node);
|
|
211
|
+
stateChanged = true;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (!node.hasAttribute(CP_MUTED_ATTR)) {
|
|
215
|
+
node.setAttribute(CP_MUTED_ATTR, 'true');
|
|
216
|
+
stateChanged = true;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
if (!node.classList.contains(CP_MUTED_CLASS)) {
|
|
220
|
+
node.classList.add(CP_MUTED_CLASS);
|
|
221
|
+
stateChanged = true;
|
|
222
|
+
}
|
|
223
|
+
} else {
|
|
224
|
+
if (node.hasAttribute(CP_MUTED_ATTR)
|
|
225
|
+
|| node.classList.contains(CP_MUTED_CLASS)
|
|
226
|
+
|| node.classList.contains(CP_MUTED_EXPANDED_CLASS)) {
|
|
227
|
+
clearCpMutedState(node);
|
|
228
|
+
stateChanged = true;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
if (node.hasAttribute(CONDITIONAL_HIDDEN_ATTR)
|
|
232
|
+
|| node.hasAttribute(PAGE_HIDDEN_ATTR)
|
|
233
|
+
|| node.classList.contains(CONDITIONAL_HIDDEN_CLASS)
|
|
234
|
+
|| node.classList.contains(PAGE_HIDDEN_CLASS)) {
|
|
235
|
+
clearHideState(node);
|
|
236
|
+
stateChanged = true;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
syncAncestorRows(node);
|
|
241
|
+
|
|
242
|
+
return stateChanged;
|
|
243
|
+
}
|
|
@@ -72,6 +72,9 @@ export const conditionsModule: FormieModuleDefinition = {
|
|
|
72
72
|
});
|
|
73
73
|
};
|
|
74
74
|
|
|
75
|
+
const cpDisplayMode = ctx.options?.cpDisplayMode === 'muted' ? 'muted' : 'hide';
|
|
76
|
+
let isApplyingConditions = false;
|
|
77
|
+
|
|
75
78
|
const runEvaluationPass = (): boolean => {
|
|
76
79
|
let hasStateChanges = false;
|
|
77
80
|
|
|
@@ -80,7 +83,16 @@ export const conditionsModule: FormieModuleDefinition = {
|
|
|
80
83
|
return queryConditionInputs(scopeRoot, entry.node, condition);
|
|
81
84
|
});
|
|
82
85
|
|
|
83
|
-
const
|
|
86
|
+
const displayMode = entry.node.hasAttribute('data-formie-page')
|
|
87
|
+
? 'hide'
|
|
88
|
+
: cpDisplayMode;
|
|
89
|
+
|
|
90
|
+
const stateChanged = applyConditionVisibility(
|
|
91
|
+
entry.node,
|
|
92
|
+
result.shouldHide,
|
|
93
|
+
entry.settings.clearOnHide,
|
|
94
|
+
{ displayMode },
|
|
95
|
+
);
|
|
84
96
|
hasStateChanges = hasStateChanges || stateChanged;
|
|
85
97
|
debug.log('Condition evaluated.', {
|
|
86
98
|
shouldHide: result.shouldHide,
|
|
@@ -100,26 +112,45 @@ export const conditionsModule: FormieModuleDefinition = {
|
|
|
100
112
|
};
|
|
101
113
|
|
|
102
114
|
const evaluateAll = (): void => {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
115
|
+
if (isApplyingConditions) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
isApplyingConditions = true;
|
|
107
120
|
|
|
108
|
-
|
|
109
|
-
|
|
121
|
+
try {
|
|
122
|
+
for (let pass = 0; pass < MAX_EVALUATION_PASSES; pass += 1) {
|
|
123
|
+
if (!runEvaluationPass()) {
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (pass === MAX_EVALUATION_PASSES - 1) {
|
|
128
|
+
debug.warn('Reached max evaluation passes.', { maxPasses: MAX_EVALUATION_PASSES });
|
|
129
|
+
}
|
|
110
130
|
}
|
|
131
|
+
} finally {
|
|
132
|
+
isApplyingConditions = false;
|
|
111
133
|
}
|
|
112
134
|
};
|
|
113
135
|
|
|
114
136
|
const scheduleEvaluateAll = (): void => {
|
|
137
|
+
if (isApplyingConditions) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
|
|
115
141
|
if (evaluationQueued) {
|
|
116
142
|
return;
|
|
117
143
|
}
|
|
118
144
|
|
|
119
145
|
evaluationQueued = true;
|
|
120
146
|
|
|
121
|
-
|
|
147
|
+
requestAnimationFrame(() => {
|
|
122
148
|
evaluationQueued = false;
|
|
149
|
+
|
|
150
|
+
if (isApplyingConditions) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
|
|
123
154
|
evaluateAll();
|
|
124
155
|
});
|
|
125
156
|
};
|
|
@@ -168,19 +199,32 @@ export const conditionsModule: FormieModuleDefinition = {
|
|
|
168
199
|
};
|
|
169
200
|
|
|
170
201
|
const scheduleRebuild = (): void => {
|
|
202
|
+
if (isApplyingConditions) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
|
|
171
206
|
if (rebuildQueued) {
|
|
172
207
|
return;
|
|
173
208
|
}
|
|
174
209
|
|
|
175
210
|
rebuildQueued = true;
|
|
176
211
|
|
|
177
|
-
|
|
212
|
+
requestAnimationFrame(() => {
|
|
178
213
|
rebuildQueued = false;
|
|
214
|
+
|
|
215
|
+
if (isApplyingConditions) {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
|
|
179
219
|
rebuild();
|
|
180
220
|
});
|
|
181
221
|
};
|
|
182
222
|
|
|
183
223
|
const observer = new MutationObserver((mutations) => {
|
|
224
|
+
if (isApplyingConditions) {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
|
|
184
228
|
const shouldRebuild = mutations.some((mutation) => {
|
|
185
229
|
return mutation.type === 'childList' && (mutation.addedNodes.length > 0 || mutation.removedNodes.length > 0);
|
|
186
230
|
});
|
|
@@ -200,8 +244,6 @@ export const conditionsModule: FormieModuleDefinition = {
|
|
|
200
244
|
subtree: true,
|
|
201
245
|
attributes: true,
|
|
202
246
|
attributeFilter: [
|
|
203
|
-
'class',
|
|
204
|
-
'style',
|
|
205
247
|
'hidden',
|
|
206
248
|
'aria-hidden',
|
|
207
249
|
'data-formie-conditionally-hidden',
|