ublo-lib 1.39.34 → 1.39.36
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/es/common/components/custom-contact-form/custom-contact-form.js +3 -3
- package/es/common/components/custom-contact-form/field.d.ts +2 -1
- package/es/common/components/custom-contact-form/field.d.ts.map +1 -1
- package/es/common/components/custom-contact-form/field.js +3 -3
- package/package.json +1 -1
|
@@ -66,13 +66,13 @@ function CustomContactForm({ site, kind, title, fields, presets, className, inne
|
|
|
66
66
|
setSettings({});
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
|
-
const formSettings = await getSettings(
|
|
69
|
+
const formSettings = await getSettings(target);
|
|
70
70
|
setSettings(formSettings);
|
|
71
71
|
setReady(true);
|
|
72
72
|
};
|
|
73
73
|
init();
|
|
74
74
|
}
|
|
75
|
-
}, [customSend, ready, settings,
|
|
75
|
+
}, [customSend, ready, settings, target]);
|
|
76
76
|
React.useEffect(() => {
|
|
77
77
|
setData((currentData) => getInitialFormState(fields, presets?.values, currentData.subject?.value));
|
|
78
78
|
}, [fields, presets?.values]);
|
|
@@ -87,5 +87,5 @@ function CustomContactForm({ site, kind, title, fields, presets, className, inne
|
|
|
87
87
|
return (_jsx("div", { className: css.root, children: Messages.get(lang, "NO_SETTINGS_FOUND") }));
|
|
88
88
|
}
|
|
89
89
|
const formKey = presets ? JSON.stringify(presets.values) : undefined;
|
|
90
|
-
return (_jsxs("div", { className: classes, children: [title && _jsx("div", { className: css.title, children: title }), _jsx("div", { className: innerClasses, children: Object.keys(fields).map((key) => (_jsx(Field, { kind: kind, name: key, field: fields[key], data: data, setData: setData, settings: settings, presets: presets }, key))) }), _jsxs("div", { className: css.bottom, children: [presets?.allowReset && (_jsx(Button, { className: css.resetButton, disabled: sending, onClick: resetForm, children: Messages.get(lang, "reset") })), _jsxs(Button, { className: css.submitButton, disabled: !isFormValid || sending, onClick: sendForm, onPointerEnter: blurForm, children: [sendButtonText || Messages.get(lang, "send"), _jsx(DTIcons.Mail, {})] })] }), showSendingOverlay && (_jsxs("div", { className: css.sendingOverlay, children: [_jsx(Icons.Spinner, { className: css.sendingIcon }), _jsx("span", { className: css.sendingMessage, children: Messages.get(lang, "sending") })] }))] }, formKey));
|
|
90
|
+
return (_jsxs("div", { className: classes, children: [title && _jsx("div", { className: css.title, children: title }), _jsx("div", { className: innerClasses, children: Object.keys(fields).map((key) => (_jsx(Field, { target: target, kind: kind, name: key, field: fields[key], data: data, setData: setData, settings: settings, presets: presets }, key))) }), _jsxs("div", { className: css.bottom, children: [presets?.allowReset && (_jsx(Button, { className: css.resetButton, disabled: sending, onClick: resetForm, children: Messages.get(lang, "reset") })), _jsxs(Button, { className: css.submitButton, disabled: !isFormValid || sending, onClick: sendForm, onPointerEnter: blurForm, children: [sendButtonText || Messages.get(lang, "send"), _jsx(DTIcons.Mail, {})] })] }), showSendingOverlay && (_jsxs("div", { className: css.sendingOverlay, children: [_jsx(Icons.Spinner, { className: css.sendingIcon }), _jsx("span", { className: css.sendingMessage, children: Messages.get(lang, "sending") })] }))] }, formKey));
|
|
91
91
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../../../src/common/components/custom-contact-form/field.js"],"names":[],"mappings":"AAeA
|
|
1
|
+
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../../../src/common/components/custom-contact-form/field.js"],"names":[],"mappings":"AAeA;;;;;;;;;4CA6DC"}
|
|
@@ -13,8 +13,8 @@ import * as Fetcher from "../../utils/fetcher";
|
|
|
13
13
|
import { FIELD_TESTS_ERROR_CODES, validate } from "./utils";
|
|
14
14
|
import * as Messages from "./messages";
|
|
15
15
|
import css from "./field.module.css";
|
|
16
|
-
export default function Field({ kind, name, field, data, setData, settings, presets, }) {
|
|
17
|
-
const { lang
|
|
16
|
+
export default function Field({ target, kind, name, field, data, setData, settings, presets, }) {
|
|
17
|
+
const { lang } = useUbloContext();
|
|
18
18
|
const { type, label, hidden, fullWidth, required } = field;
|
|
19
19
|
const [activated, setActivated] = React.useState(false);
|
|
20
20
|
const [valid, setValid] = React.useState(!required || false);
|
|
@@ -32,7 +32,7 @@ export default function Field({ kind, name, field, data, setData, settings, pres
|
|
|
32
32
|
if (type === "attachment") {
|
|
33
33
|
return (_jsx(Attachment, { lang: lang, name: name, label: label, data: data, setData: setData, settings: settings }));
|
|
34
34
|
}
|
|
35
|
-
return (_jsx(Inner, { site:
|
|
35
|
+
return (_jsx(Inner, { site: target, kind: kind, label: label, lang: lang, name: name, classes: classes, field: field, data: data, setData: setData, disabled: disablePresetedFields, activated: activated, setActivated: setActivated, valid: valid, setValid: setValid }));
|
|
36
36
|
}
|
|
37
37
|
function Inner({ site, lang, label, kind, name, classes, field, data, setData, disabled, activated, setActivated, valid, setValid, }) {
|
|
38
38
|
const { icon, type, className, options: fieldOptions = [], placeholder, required, autoSizing, min, max, } = field;
|