@bookinglab/booking-ui-react 1.8.0 → 1.9.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/README.md +1 -0
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +14 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -828,6 +828,7 @@ var ContactDetailsForm = forwardRef(
|
|
|
828
828
|
}, [fieldSettings]);
|
|
829
829
|
const validateQuestionField = useCallback((question, value) => {
|
|
830
830
|
if (question.detail_type === "heading") return null;
|
|
831
|
+
if (question.disabled) return null;
|
|
831
832
|
if (question.required) {
|
|
832
833
|
if (value === void 0 || value === "" || value === null) {
|
|
833
834
|
return `${question.name} is required`;
|
|
@@ -1038,6 +1039,7 @@ var ContactDetailsForm = forwardRef(
|
|
|
1038
1039
|
const value = questionValues[question.id];
|
|
1039
1040
|
const error = questionTouched[question.id] ? questionErrors[question.id] : void 0;
|
|
1040
1041
|
const hasError = !!error;
|
|
1042
|
+
const isDisabled = !!question.disabled;
|
|
1041
1043
|
const ariaProps = {
|
|
1042
1044
|
"aria-invalid": hasError ? true : void 0,
|
|
1043
1045
|
"aria-describedby": hasError ? errorId : void 0,
|
|
@@ -1058,10 +1060,11 @@ var ContactDetailsForm = forwardRef(
|
|
|
1058
1060
|
id: fieldId,
|
|
1059
1061
|
type: "text",
|
|
1060
1062
|
value: value || "",
|
|
1063
|
+
disabled: isDisabled,
|
|
1061
1064
|
onChange: (e) => handleQuestionChange(question.id, e.target.value),
|
|
1062
1065
|
onBlur: () => handleQuestionBlur(question.id),
|
|
1063
1066
|
placeholder: question.settings?.placeholder,
|
|
1064
|
-
className: inputClasses(hasError),
|
|
1067
|
+
className: cx2(inputClasses(hasError), isDisabled ? "opacity-50 cursor-not-allowed" : ""),
|
|
1065
1068
|
...ariaProps
|
|
1066
1069
|
}
|
|
1067
1070
|
),
|
|
@@ -1079,11 +1082,12 @@ var ContactDetailsForm = forwardRef(
|
|
|
1079
1082
|
{
|
|
1080
1083
|
id: fieldId,
|
|
1081
1084
|
value: value || "",
|
|
1085
|
+
disabled: isDisabled,
|
|
1082
1086
|
onChange: (e) => handleQuestionChange(question.id, e.target.value),
|
|
1083
1087
|
onBlur: () => handleQuestionBlur(question.id),
|
|
1084
1088
|
placeholder: question.settings?.placeholder,
|
|
1085
1089
|
rows: 4,
|
|
1086
|
-
className: inputClasses(hasError),
|
|
1090
|
+
className: cx2(inputClasses(hasError), isDisabled ? "opacity-50 cursor-not-allowed" : ""),
|
|
1087
1091
|
...ariaProps
|
|
1088
1092
|
}
|
|
1089
1093
|
),
|
|
@@ -1101,9 +1105,10 @@ var ContactDetailsForm = forwardRef(
|
|
|
1101
1105
|
{
|
|
1102
1106
|
id: fieldId,
|
|
1103
1107
|
value: value ?? "",
|
|
1108
|
+
disabled: isDisabled,
|
|
1104
1109
|
onChange: (e) => handleQuestionChange(question.id, e.target.value),
|
|
1105
1110
|
onBlur: () => handleQuestionBlur(question.id),
|
|
1106
|
-
className: inputClasses(hasError),
|
|
1111
|
+
className: cx2(inputClasses(hasError), isDisabled ? "opacity-50 cursor-not-allowed" : ""),
|
|
1107
1112
|
...ariaProps,
|
|
1108
1113
|
children: [
|
|
1109
1114
|
/* @__PURE__ */ jsx("option", { value: "", children: "Select an option" }),
|
|
@@ -1126,12 +1131,13 @@ var ContactDetailsForm = forwardRef(
|
|
|
1126
1131
|
id: fieldId,
|
|
1127
1132
|
type: "number",
|
|
1128
1133
|
value: value ?? "",
|
|
1134
|
+
disabled: isDisabled,
|
|
1129
1135
|
onChange: (e) => handleQuestionChange(question.id, e.target.value ? Number(e.target.value) : ""),
|
|
1130
1136
|
onBlur: () => handleQuestionBlur(question.id),
|
|
1131
1137
|
min: question.settings?.min,
|
|
1132
1138
|
max: question.settings?.max,
|
|
1133
1139
|
placeholder: question.settings?.placeholder,
|
|
1134
|
-
className: inputClasses(hasError),
|
|
1140
|
+
className: cx2(inputClasses(hasError), isDisabled ? "opacity-50 cursor-not-allowed" : ""),
|
|
1135
1141
|
...ariaProps
|
|
1136
1142
|
}
|
|
1137
1143
|
),
|
|
@@ -1150,9 +1156,10 @@ var ContactDetailsForm = forwardRef(
|
|
|
1150
1156
|
id: fieldId,
|
|
1151
1157
|
type: "date",
|
|
1152
1158
|
value: value || "",
|
|
1159
|
+
disabled: isDisabled,
|
|
1153
1160
|
onChange: (e) => handleQuestionChange(question.id, e.target.value),
|
|
1154
1161
|
onBlur: () => handleQuestionBlur(question.id),
|
|
1155
|
-
className: inputClasses(hasError),
|
|
1162
|
+
className: cx2(inputClasses(hasError), isDisabled ? "opacity-50 cursor-not-allowed" : ""),
|
|
1156
1163
|
...ariaProps
|
|
1157
1164
|
}
|
|
1158
1165
|
),
|
|
@@ -1168,9 +1175,10 @@ var ContactDetailsForm = forwardRef(
|
|
|
1168
1175
|
id: fieldId,
|
|
1169
1176
|
type: "checkbox",
|
|
1170
1177
|
checked: !!value,
|
|
1178
|
+
disabled: isDisabled,
|
|
1171
1179
|
onChange: (e) => handleQuestionChange(question.id, e.target.checked),
|
|
1172
1180
|
onBlur: () => handleQuestionBlur(question.id),
|
|
1173
|
-
className: styles.checkbox,
|
|
1181
|
+
className: cx2(styles.checkbox, isDisabled ? "opacity-50 cursor-not-allowed" : ""),
|
|
1174
1182
|
...ariaProps
|
|
1175
1183
|
}
|
|
1176
1184
|
),
|