@awell-health/ui-library 0.1.129 → 0.1.131
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.css +4 -0
- package/dist/index.js +76 -49
- package/package.json +1 -1
package/dist/index.css
CHANGED
|
@@ -1625,6 +1625,10 @@ html {
|
|
|
1625
1625
|
margin-bottom: var(--awell-spacing-4);
|
|
1626
1626
|
line-height: var(--awell-leading-normal);
|
|
1627
1627
|
}
|
|
1628
|
+
.awell__richTextViewer_content ul,
|
|
1629
|
+
.awell__richTextViewer_content ol {
|
|
1630
|
+
line-height: var(--awell-leading-tight);
|
|
1631
|
+
}
|
|
1628
1632
|
.awell__richTextViewer_content ul li,
|
|
1629
1633
|
.awell__richTextViewer_content ol li {
|
|
1630
1634
|
margin-top: var(--awell-spacing-2);
|
package/dist/index.js
CHANGED
|
@@ -48471,12 +48471,11 @@ var Kr=[{
|
|
|
48471
48471
|
} },
|
|
48472
48472
|
render: function (_a) {
|
|
48473
48473
|
var _b, _c, _d;
|
|
48474
|
-
var _e = _a.field,onControllerChange = _e.onChange,onBlur = _e.onBlur,value = _e.value;
|
|
48474
|
+
var _e = _a.field,onControllerChange = _e.onChange,onBlur = _e.onBlur,value = _e.value,fieldError = _a.fieldState.error;
|
|
48475
48475
|
return jsxRuntime.exports.jsx(SingleFileInputField, { id: question.id, value: custom_json_parser(value, ''), onChange: function (attachment) {
|
|
48476
|
-
|
|
48477
|
-
onControllerChange(JSON.stringify(attachment));
|
|
48476
|
+
onControllerChange(attachment ? JSON.stringify(attachment) : '');
|
|
48478
48477
|
onAnswerChange();
|
|
48479
|
-
}, onBlur: onBlur, accept: (_c = (_b = config === null || config === void 0 ? void 0 : config.file_storage) === null || _b === void 0 ? void 0 : _b.accepted_file_types) !== null && _c !== void 0 ? _c : undefined, configSlug: (_d = config === null || config === void 0 ? void 0 : config.file_storage) === null || _d === void 0 ? void 0 : _d.file_storage_config_slug, onFileUpload: onFileUpload, label: question.title, mandatory: config === null || config === void 0 ? void 0 : config.mandatory });
|
|
48478
|
+
}, onBlur: onBlur, accept: (_c = (_b = config === null || config === void 0 ? void 0 : config.file_storage) === null || _b === void 0 ? void 0 : _b.accepted_file_types) !== null && _c !== void 0 ? _c : undefined, configSlug: (_d = config === null || config === void 0 ? void 0 : config.file_storage) === null || _d === void 0 ? void 0 : _d.file_storage_config_slug, onFileUpload: onFileUpload, label: question.title, mandatory: config === null || config === void 0 ? void 0 : config.mandatory, error: fieldError === null || fieldError === void 0 ? void 0 : fieldError.message });
|
|
48480
48479
|
} });
|
|
48481
48480
|
case exports.UserQuestionType.Image:
|
|
48482
48481
|
return jsxRuntime.exports.jsx(Controller, { name: question.id, control: control, defaultValue: [], rules: {
|
|
@@ -48491,11 +48490,11 @@ var Kr=[{
|
|
|
48491
48490
|
} },
|
|
48492
48491
|
render: function (_a) {
|
|
48493
48492
|
var _b, _c, _d;
|
|
48494
|
-
var _e = _a.field,onControllerChange = _e.onChange,onBlur = _e.onBlur,value = _e.value;
|
|
48493
|
+
var _e = _a.field,onControllerChange = _e.onChange,onBlur = _e.onBlur,value = _e.value,fieldError = _a.fieldState.error;
|
|
48495
48494
|
return jsxRuntime.exports.jsx(SingleFileInputField, { id: question.id, value: custom_json_parser(value, ''), onChange: function (attachment) {
|
|
48496
|
-
onControllerChange(JSON.stringify(attachment));
|
|
48495
|
+
onControllerChange(attachment ? JSON.stringify(attachment) : '');
|
|
48497
48496
|
onAnswerChange();
|
|
48498
|
-
}, onBlur: onBlur, accept: (_c = (_b = config === null || config === void 0 ? void 0 : config.file_storage) === null || _b === void 0 ? void 0 : _b.accepted_file_types) !== null && _c !== void 0 ? _c : ['image/*'], configSlug: (_d = config === null || config === void 0 ? void 0 : config.file_storage) === null || _d === void 0 ? void 0 : _d.file_storage_config_slug, onFileUpload: onFileUpload, label: question.title, mandatory: config === null || config === void 0 ? void 0 : config.mandatory });
|
|
48497
|
+
}, onBlur: onBlur, accept: (_c = (_b = config === null || config === void 0 ? void 0 : config.file_storage) === null || _b === void 0 ? void 0 : _b.accepted_file_types) !== null && _c !== void 0 ? _c : ['image/*'], configSlug: (_d = config === null || config === void 0 ? void 0 : config.file_storage) === null || _d === void 0 ? void 0 : _d.file_storage_config_slug, onFileUpload: onFileUpload, label: question.title, mandatory: config === null || config === void 0 ? void 0 : config.mandatory, error: fieldError === null || fieldError === void 0 ? void 0 : fieldError.message });
|
|
48499
48498
|
} });
|
|
48500
48499
|
case exports.UserQuestionType.Description:
|
|
48501
48500
|
return jsxRuntime.exports.jsx(Description, { content: question.title });
|
|
@@ -48816,29 +48815,11 @@ var Kr=[{
|
|
|
48816
48815
|
};
|
|
48817
48816
|
var validateAttachmentsResponse = function (questionConfig, value) {
|
|
48818
48817
|
var inputRequired = questionConfig === null || questionConfig === void 0 ? void 0 : questionConfig.mandatory;
|
|
48819
|
-
var
|
|
48820
|
-
|
|
48821
|
-
|
|
48822
|
-
}
|
|
48823
|
-
catch (error) {
|
|
48824
|
-
return [];
|
|
48825
|
-
}
|
|
48826
|
-
};
|
|
48827
|
-
var attachments = parseAttachments(value);
|
|
48828
|
-
if (inputRequired === false && lodash.exports.isEmpty(attachments)) {
|
|
48829
|
-
return {
|
|
48830
|
-
isValid: true };
|
|
48831
|
-
|
|
48818
|
+
var hasValue = !lodash.exports.isNil(value) && !lodash.exports.isEmpty(value);
|
|
48819
|
+
if (inputRequired && !hasValue) {
|
|
48820
|
+
return { isValid: false, errorType: 'REQUIRED' };
|
|
48832
48821
|
}
|
|
48833
|
-
|
|
48834
|
-
return {
|
|
48835
|
-
isValid: false,
|
|
48836
|
-
errorType: 'REQUIRED' };
|
|
48837
|
-
|
|
48838
|
-
}
|
|
48839
|
-
return {
|
|
48840
|
-
isValid: true };
|
|
48841
|
-
|
|
48822
|
+
return { isValid: true };
|
|
48842
48823
|
};
|
|
48843
48824
|
var validateInputValidationResponse = function (questionConfig, value) {
|
|
48844
48825
|
if (!questionConfig || !questionConfig.input_validation) {
|
|
@@ -49181,6 +49162,7 @@ var Kr=[{
|
|
|
49181
49162
|
}
|
|
49182
49163
|
}, []);
|
|
49183
49164
|
var handleConvertAndSubmitForm = function (formResponse) {return __awaiter(void 0, void 0, void 0, function () {
|
|
49165
|
+
var error_1;
|
|
49184
49166
|
return __generator(this, function (_a) {
|
|
49185
49167
|
switch (_a.label) {
|
|
49186
49168
|
case 0:
|
|
@@ -49188,28 +49170,51 @@ var Kr=[{
|
|
|
49188
49170
|
return [2];
|
|
49189
49171
|
}
|
|
49190
49172
|
setIsSubmittingForm(true);
|
|
49191
|
-
|
|
49173
|
+
_a.label = 1;
|
|
49192
49174
|
case 1:
|
|
49175
|
+
_a.trys.push([1, 3, 4, 5]);
|
|
49176
|
+
return [4, onSubmit(convertToAwellInput(formResponse))];
|
|
49177
|
+
case 2:
|
|
49193
49178
|
_a.sent();
|
|
49179
|
+
return [3, 5];
|
|
49180
|
+
case 3:
|
|
49181
|
+
error_1 = _a.sent();
|
|
49182
|
+
console.error('Form submission failed:', error_1);
|
|
49183
|
+
setFormHasErrors(true);
|
|
49184
|
+
return [3, 5];
|
|
49185
|
+
case 4:
|
|
49194
49186
|
setIsSubmittingForm(false);
|
|
49195
|
-
return [
|
|
49187
|
+
return [7];
|
|
49188
|
+
case 5:return [2];}
|
|
49196
49189
|
|
|
49197
49190
|
});
|
|
49198
49191
|
});};
|
|
49199
49192
|
var submitForm = function () {return __awaiter(void 0, void 0, void 0, function () {
|
|
49200
|
-
var formErrors;
|
|
49193
|
+
var error_2, formErrors;
|
|
49201
49194
|
return __generator(this, function (_a) {
|
|
49202
49195
|
switch (_a.label) {
|
|
49203
|
-
case 0:
|
|
49196
|
+
case 0:
|
|
49197
|
+
_a.trys.push([0, 2,, 3]);
|
|
49198
|
+
return [4, updateQuestionVisibility()];
|
|
49204
49199
|
case 1:
|
|
49205
49200
|
_a.sent();
|
|
49201
|
+
return [3, 3];
|
|
49202
|
+
case 2:
|
|
49203
|
+
error_2 = _a.sent();
|
|
49204
|
+
console.error('Failed to evaluate display conditions:', error_2);
|
|
49205
|
+
setFormHasErrors(true);
|
|
49206
|
+
return [2];
|
|
49207
|
+
case 3:
|
|
49206
49208
|
formErrors = visibleQuestions.flatMap(function (vq) {
|
|
49207
49209
|
return getErrorsForQuestion(vq, formMethods, errorLabels, isValidE164Number, validateDateResponse, validateNumberResponse, validateEmailResponse, validateAttachmentsResponse, validateInputValidationResponse);
|
|
49208
49210
|
});
|
|
49209
49211
|
setErrors(formErrors);
|
|
49210
49212
|
if (formErrors.length === 0) {
|
|
49211
49213
|
setFormHasErrors(false);
|
|
49212
|
-
formMethods.handleSubmit(handleConvertAndSubmitForm
|
|
49214
|
+
formMethods.handleSubmit(handleConvertAndSubmitForm, function (rhfErrors) {
|
|
49215
|
+
console.error('Form validation errors:', rhfErrors);
|
|
49216
|
+
setFormHasErrors(true);
|
|
49217
|
+
})();
|
|
49213
49218
|
} else
|
|
49214
49219
|
{
|
|
49215
49220
|
setFormHasErrors(true);
|
|
@@ -49320,7 +49325,9 @@ var Kr=[{
|
|
|
49320
49325
|
updatedQuestions = _a.sent();
|
|
49321
49326
|
isLastVisibleQuestion = current === updatedQuestions.length - 1;
|
|
49322
49327
|
if (isLastVisibleQuestion) {
|
|
49323
|
-
formMethods.handleSubmit(handleConvertAndSubmitForm
|
|
49328
|
+
formMethods.handleSubmit(handleConvertAndSubmitForm, function (rhfErrors) {
|
|
49329
|
+
console.error('Form validation errors:', rhfErrors);
|
|
49330
|
+
})();
|
|
49324
49331
|
return [2];
|
|
49325
49332
|
}
|
|
49326
49333
|
return [3, 4];
|
|
@@ -49361,6 +49368,7 @@ var Kr=[{
|
|
|
49361
49368
|
});
|
|
49362
49369
|
});};
|
|
49363
49370
|
var handleConvertAndSubmitForm = function (formResponse) {return __awaiter(void 0, void 0, void 0, function () {
|
|
49371
|
+
var error_1;
|
|
49364
49372
|
return __generator(this, function (_a) {
|
|
49365
49373
|
switch (_a.label) {
|
|
49366
49374
|
case 0:
|
|
@@ -49368,30 +49376,49 @@ var Kr=[{
|
|
|
49368
49376
|
return [2];
|
|
49369
49377
|
}
|
|
49370
49378
|
setIsSubmittingForm(true);
|
|
49371
|
-
|
|
49379
|
+
_a.label = 1;
|
|
49372
49380
|
case 1:
|
|
49381
|
+
_a.trys.push([1, 3, 4, 5]);
|
|
49382
|
+
return [4, onSubmit(convertToAwellInput(formResponse))];
|
|
49383
|
+
case 2:
|
|
49373
49384
|
_a.sent();
|
|
49385
|
+
return [3, 5];
|
|
49386
|
+
case 3:
|
|
49387
|
+
error_1 = _a.sent();
|
|
49388
|
+
console.error('Form submission failed:', error_1);
|
|
49389
|
+
return [3, 5];
|
|
49390
|
+
case 4:
|
|
49374
49391
|
setIsSubmittingForm(false);
|
|
49375
|
-
return [
|
|
49392
|
+
return [7];
|
|
49393
|
+
case 5:return [2];}
|
|
49376
49394
|
|
|
49377
49395
|
});
|
|
49378
49396
|
});};
|
|
49379
49397
|
var submitForm = function () {return __awaiter(void 0, void 0, void 0, function () {
|
|
49398
|
+
var updatedQuestions, doNextQuestionExist, hasErrors, error_2;
|
|
49380
49399
|
return __generator(this, function (_a) {
|
|
49381
49400
|
switch (_a.label) {
|
|
49382
|
-
case 0:
|
|
49383
|
-
|
|
49384
|
-
|
|
49385
|
-
return handleGoToNextQuestion();
|
|
49386
|
-
}
|
|
49387
|
-
var hasErrors = handleCheckForErrors(visibleQuestions === null || visibleQuestions === void 0 ? void 0 : visibleQuestions[current]);
|
|
49388
|
-
if (!hasErrors) {
|
|
49389
|
-
formMethods.handleSubmit(handleConvertAndSubmitForm)();
|
|
49390
|
-
}
|
|
49391
|
-
})];
|
|
49401
|
+
case 0:
|
|
49402
|
+
_a.trys.push([0, 2,, 3]);
|
|
49403
|
+
return [4, updateQuestionVisibility()];
|
|
49392
49404
|
case 1:
|
|
49393
|
-
_a.sent();
|
|
49394
|
-
|
|
49405
|
+
updatedQuestions = _a.sent();
|
|
49406
|
+
doNextQuestionExist = current !== updatedQuestions.length - 1;
|
|
49407
|
+
if (doNextQuestionExist) {
|
|
49408
|
+
return [2, handleGoToNextQuestion()];
|
|
49409
|
+
}
|
|
49410
|
+
hasErrors = handleCheckForErrors(visibleQuestions === null || visibleQuestions === void 0 ? void 0 : visibleQuestions[current]);
|
|
49411
|
+
if (!hasErrors) {
|
|
49412
|
+
formMethods.handleSubmit(handleConvertAndSubmitForm, function (rhfErrors) {
|
|
49413
|
+
console.error('Form validation errors:', rhfErrors);
|
|
49414
|
+
})();
|
|
49415
|
+
}
|
|
49416
|
+
return [3, 3];
|
|
49417
|
+
case 2:
|
|
49418
|
+
error_2 = _a.sent();
|
|
49419
|
+
console.error('Failed to evaluate display conditions:', error_2);
|
|
49420
|
+
return [3, 3];
|
|
49421
|
+
case 3:return [2];}
|
|
49395
49422
|
|
|
49396
49423
|
});
|
|
49397
49424
|
});};
|