@awell-health/ui-library 0.1.111 → 0.1.112
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.js
CHANGED
|
@@ -48498,29 +48498,20 @@ var Kr=[{
|
|
|
48498
48498
|
}) }));
|
|
48499
48499
|
};
|
|
48500
48500
|
|
|
48501
|
-
var useScrollHint = function (
|
|
48502
|
-
if (fixPosition === void 0) {fixPosition = false;}
|
|
48501
|
+
var useScrollHint = function () {
|
|
48503
48502
|
var _a = React.useState(false),showScrollHint = _a[0],setShowScrollHint = _a[1];
|
|
48504
48503
|
var rafIdRef = React.useRef();
|
|
48505
48504
|
var checkScrollHint = React.useCallback(function () {
|
|
48506
|
-
|
|
48507
|
-
|
|
48508
|
-
|
|
48509
|
-
|
|
48510
|
-
setShowScrollHint(isPageScrollable && !isAtBottom);
|
|
48511
|
-
} else
|
|
48512
|
-
{
|
|
48513
|
-
var mainContentEl = document.getElementById('ahp_main_content_with_scroll_hint');
|
|
48514
|
-
if (!mainContentEl) {
|
|
48515
|
-
setShowScrollHint(false);
|
|
48516
|
-
return;
|
|
48517
|
-
}
|
|
48518
|
-
var isScrollable = mainContentEl.scrollHeight > mainContentEl.offsetHeight;
|
|
48519
|
-
var isAtBottom = Math.ceil(mainContentEl.scrollTop + mainContentEl.offsetHeight) >=
|
|
48520
|
-
mainContentEl.scrollHeight - 5;
|
|
48521
|
-
setShowScrollHint(isScrollable && !isAtBottom);
|
|
48505
|
+
var mainContentEl = document.getElementById('ahp_main_content_with_scroll_hint');
|
|
48506
|
+
if (!mainContentEl) {
|
|
48507
|
+
setShowScrollHint(false);
|
|
48508
|
+
return;
|
|
48522
48509
|
}
|
|
48523
|
-
|
|
48510
|
+
var isScrollable = mainContentEl.scrollHeight > mainContentEl.offsetHeight;
|
|
48511
|
+
var isAtBottom = Math.ceil(mainContentEl.scrollTop + mainContentEl.offsetHeight) >=
|
|
48512
|
+
mainContentEl.scrollHeight - 5;
|
|
48513
|
+
setShowScrollHint(isScrollable && !isAtBottom);
|
|
48514
|
+
}, []);
|
|
48524
48515
|
var debouncedCheckScrollHint = React.useCallback(function () {
|
|
48525
48516
|
if (rafIdRef.current) {
|
|
48526
48517
|
cancelAnimationFrame(rafIdRef.current);
|
|
@@ -48532,52 +48523,31 @@ var Kr=[{
|
|
|
48532
48523
|
var rafCheck = requestAnimationFrame(function () {
|
|
48533
48524
|
checkScrollHint();
|
|
48534
48525
|
});
|
|
48535
|
-
|
|
48536
|
-
|
|
48537
|
-
|
|
48538
|
-
|
|
48539
|
-
|
|
48526
|
+
var mainContentEl = document.getElementById('ahp_main_content_with_scroll_hint');
|
|
48527
|
+
window.addEventListener('resize', checkScrollHint);
|
|
48528
|
+
if (mainContentEl) {
|
|
48529
|
+
mainContentEl.addEventListener('scroll', checkScrollHint);
|
|
48530
|
+
}
|
|
48531
|
+
var mutationObserver = new MutationObserver(debouncedCheckScrollHint);
|
|
48532
|
+
if (mainContentEl) {
|
|
48533
|
+
mutationObserver.observe(mainContentEl, {
|
|
48540
48534
|
childList: true,
|
|
48541
48535
|
subtree: true,
|
|
48542
48536
|
attributes: false });
|
|
48543
48537
|
|
|
48544
|
-
|
|
48545
|
-
|
|
48546
|
-
|
|
48547
|
-
|
|
48548
|
-
|
|
48549
|
-
window.removeEventListener('resize', checkScrollHint);
|
|
48550
|
-
window.removeEventListener('scroll', checkScrollHint);
|
|
48551
|
-
mutationObserver_1.disconnect();
|
|
48552
|
-
};
|
|
48553
|
-
} else
|
|
48554
|
-
{
|
|
48555
|
-
var mainContentEl_1 = document.getElementById('ahp_main_content_with_scroll_hint');
|
|
48556
|
-
window.addEventListener('resize', checkScrollHint);
|
|
48557
|
-
if (mainContentEl_1) {
|
|
48558
|
-
mainContentEl_1.addEventListener('scroll', checkScrollHint);
|
|
48538
|
+
}
|
|
48539
|
+
return function () {
|
|
48540
|
+
cancelAnimationFrame(rafCheck);
|
|
48541
|
+
if (rafIdRef.current) {
|
|
48542
|
+
cancelAnimationFrame(rafIdRef.current);
|
|
48559
48543
|
}
|
|
48560
|
-
|
|
48561
|
-
if (
|
|
48562
|
-
|
|
48563
|
-
childList: true,
|
|
48564
|
-
subtree: true,
|
|
48565
|
-
attributes: false });
|
|
48566
|
-
|
|
48544
|
+
window.removeEventListener('resize', checkScrollHint);
|
|
48545
|
+
if (mainContentEl) {
|
|
48546
|
+
mainContentEl.removeEventListener('scroll', checkScrollHint);
|
|
48567
48547
|
}
|
|
48568
|
-
|
|
48569
|
-
|
|
48570
|
-
|
|
48571
|
-
cancelAnimationFrame(rafIdRef.current);
|
|
48572
|
-
}
|
|
48573
|
-
window.removeEventListener('resize', checkScrollHint);
|
|
48574
|
-
if (mainContentEl_1) {
|
|
48575
|
-
mainContentEl_1.removeEventListener('scroll', checkScrollHint);
|
|
48576
|
-
}
|
|
48577
|
-
mutationObserver_2.disconnect();
|
|
48578
|
-
};
|
|
48579
|
-
}
|
|
48580
|
-
}, [fixPosition, checkScrollHint, debouncedCheckScrollHint]);
|
|
48548
|
+
mutationObserver.disconnect();
|
|
48549
|
+
};
|
|
48550
|
+
}, [checkScrollHint, debouncedCheckScrollHint]);
|
|
48581
48551
|
return {
|
|
48582
48552
|
showScrollHint: showScrollHint };
|
|
48583
48553
|
|
|
@@ -48587,7 +48557,7 @@ var Kr=[{
|
|
|
48587
48557
|
|
|
48588
48558
|
var HostedPageFooter = function (_a) {
|
|
48589
48559
|
var children = _a.children,_b = _a.hideScrollHint,hideScrollHint = _b === void 0 ? false : _b,_c = _a.fixPosition,fixPosition = _c === void 0 ? false : _c;
|
|
48590
|
-
var showScrollHint = useScrollHint(
|
|
48560
|
+
var showScrollHint = useScrollHint().showScrollHint;
|
|
48591
48561
|
var footerClass = fixPosition ?
|
|
48592
48562
|
"".concat(classes$7.footer, " ").concat(classes$7.fixed) :
|
|
48593
48563
|
classes$7.footer;
|
|
@@ -49451,8 +49421,7 @@ var Kr=[{
|
|
|
49451
49421
|
|
|
49452
49422
|
var TraditionalForm = function (_a) {
|
|
49453
49423
|
var form = _a.form,onSubmit = _a.onSubmit,buttonLabels = _a.buttonLabels,evaluateDisplayConditions = _a.evaluateDisplayConditions,errorLabels = _a.errorLabels,storedAnswers = _a.storedAnswers,onAnswersChange = _a.onAnswersChange,_b = _a.autosaveAnswers,autosaveAnswers = _b === void 0 ? true : _b,questionLabels = _a.questionLabels,onFileUpload = _a.onFileUpload;
|
|
49454
|
-
var _c =
|
|
49455
|
-
var _d = useTraditionalForm({
|
|
49424
|
+
var _c = useTraditionalForm({
|
|
49456
49425
|
questions: form.questions,
|
|
49457
49426
|
onSubmit: onSubmit,
|
|
49458
49427
|
evaluateDisplayConditions: evaluateDisplayConditions,
|
|
@@ -49460,13 +49429,7 @@ var Kr=[{
|
|
|
49460
49429
|
storedAnswers: storedAnswers,
|
|
49461
49430
|
autosaveAnswers: autosaveAnswers,
|
|
49462
49431
|
onAnswersChange: onAnswersChange }),
|
|
49463
|
-
updateQuestionVisibility =
|
|
49464
|
-
React.useEffect(function () {
|
|
49465
|
-
updateLayoutMode('flexible');
|
|
49466
|
-
return function () {
|
|
49467
|
-
resetLayoutMode();
|
|
49468
|
-
};
|
|
49469
|
-
});
|
|
49432
|
+
updateQuestionVisibility = _c.updateQuestionVisibility,submitForm = _c.submitForm,isSubmittingForm = _c.isSubmittingForm,_d = _c.formMethods,control = _d.control,getValues = _d.getValues,errors = _c.errors,questionWithVisiblity = _c.questionWithVisiblity,formHasErrors = _c.formHasErrors;
|
|
49470
49433
|
return jsxRuntime.exports.jsxs(jsxRuntime.exports.Fragment, { children: [jsxRuntime.exports.jsx("main", __assign({ id: "ahp_main_content_with_scroll_hint", className: clsx(layoutClasses.main_content, classes$4.traditional_form) }, { children: jsxRuntime.exports.jsxs("div", __assign({ className: clsx(classes$4.container, classes$4.traditional_container) }, { children: [!questionWithVisiblity ? jsxRuntime.exports.jsx("div", __assign({ className: classes$4.loadingContainer }, { children: jsxRuntime.exports.jsx(LoadActivityPlaceholder, {}) })) : jsxRuntime.exports.jsx("div", { children: jsxRuntime.exports.jsx("div", { children: questionWithVisiblity.
|
|
49471
49434
|
filter(function (vb) {return vb.visible;}).
|
|
49472
49435
|
map(function (visibleQuestion) {return jsxRuntime.exports.jsx("div", __assign({ className: classes$4.traditional_form_question }, { children: jsxRuntime.exports.jsx(Question, { question: visibleQuestion, control: control, getValues: getValues, errors: errors, inputAutoFocus: false, onAnswerChange: updateQuestionVisibility, labels: questionLabels, onFileUpload: onFileUpload }, visibleQuestion.id) }), visibleQuestion.id);}) }) }), (form === null || form === void 0 ? void 0 : form.trademark) && jsxRuntime.exports.jsx("div", __assign({ className: classes$4.trademark }, { children: form.trademark }))] })) })), jsxRuntime.exports.jsx(HostedPageFooter, __assign({ fixPosition: true }, { children: jsxRuntime.exports.jsxs("div", __assign({ className: classes$4.traditional_button_wrapper }, { children: [formHasErrors && jsxRuntime.exports.jsx("div", { children: jsxRuntime.exports.jsx(Text, __assign({ variant: "textSmall", color: "var(--awell-signalError100)" }, { children: errorLabels.formHasErrors })) }), jsxRuntime.exports.jsx("div", {}), jsxRuntime.exports.jsx(Button, __assign({ onClick: submitForm, type: "submit", "data-cy": "submitFormButton", disabled: isSubmittingForm }, { children: buttonLabels.submit }))] })) }))] });
|