@bookinglab/booking-ui-react 1.9.0 → 1.10.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/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +10 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -787,7 +787,8 @@ var ContactDetailsForm = forwardRef(
|
|
|
787
787
|
className = "",
|
|
788
788
|
classNames = {},
|
|
789
789
|
fieldSettings = {},
|
|
790
|
-
hideSubmitButton = false
|
|
790
|
+
hideSubmitButton = false,
|
|
791
|
+
isSubmitted = false
|
|
791
792
|
}, ref) => {
|
|
792
793
|
const formId = useId();
|
|
793
794
|
const [firstName, setFirstName] = useState(initialValues?.firstName || "");
|
|
@@ -1007,7 +1008,7 @@ var ContactDetailsForm = forwardRef(
|
|
|
1007
1008
|
const errorId = `${fieldId}-error`;
|
|
1008
1009
|
const isDisabled = getFieldDisabled(name);
|
|
1009
1010
|
const isRequired = getFieldRequired(name);
|
|
1010
|
-
const error = contactTouched[name] ? contactErrors[name] : void 0;
|
|
1011
|
+
const error = contactTouched[name] || isSubmitted ? contactErrors[name] : void 0;
|
|
1011
1012
|
const hasError = !!error;
|
|
1012
1013
|
return /* @__PURE__ */ jsxs("div", { className: styles.fieldWrapper, children: [
|
|
1013
1014
|
/* @__PURE__ */ jsxs("label", { htmlFor: fieldId, className: styles.label, children: [
|
|
@@ -1037,7 +1038,7 @@ var ContactDetailsForm = forwardRef(
|
|
|
1037
1038
|
const fieldId = `${formId}-q-${question.id}`;
|
|
1038
1039
|
const errorId = `${fieldId}-error`;
|
|
1039
1040
|
const value = questionValues[question.id];
|
|
1040
|
-
const error = questionTouched[question.id] ? questionErrors[question.id] : void 0;
|
|
1041
|
+
const error = questionTouched[question.id] || isSubmitted ? questionErrors[question.id] : void 0;
|
|
1041
1042
|
const hasError = !!error;
|
|
1042
1043
|
const isDisabled = !!question.disabled;
|
|
1043
1044
|
const ariaProps = {
|
|
@@ -1194,6 +1195,12 @@ var ContactDetailsForm = forwardRef(
|
|
|
1194
1195
|
return null;
|
|
1195
1196
|
}
|
|
1196
1197
|
};
|
|
1198
|
+
useEffect(() => {
|
|
1199
|
+
if (isSubmitted) {
|
|
1200
|
+
validateAllContacts();
|
|
1201
|
+
validateAllQuestions();
|
|
1202
|
+
}
|
|
1203
|
+
}, [isSubmitted]);
|
|
1197
1204
|
useEffect(() => {
|
|
1198
1205
|
if (hideSubmitButton && _onChange) {
|
|
1199
1206
|
const contactValid = !contactFields.some((f) => {
|