@awell-health/ui-library 0.1.145 → 0.1.147

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
@@ -47352,29 +47352,36 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
47352
47352
  });
47353
47353
 
47354
47354
  var optionsToSelectItems = function (options) {
47355
- return options.map(function (option) {return {
47356
- value: String(option.value),
47355
+ return options.map(function (option) {
47356
+ var _a;
47357
+ return {
47358
+ value: String((_a = option.id) !== null && _a !== void 0 ? _a : option.value),
47357
47359
  label: option.label,
47358
47360
  metadata: option };
47361
+
47359
47362
  });
47360
47363
  };
47361
47364
  var multiValueToSelectItems = function (value) {
47362
47365
  if (!value || !Array.isArray(value))
47363
47366
  return [];
47364
- return value.map(function (option) {return {
47365
- value: String(option.value),
47367
+ return value.map(function (option) {
47368
+ var _a;
47369
+ return {
47370
+ value: String((_a = option.id) !== null && _a !== void 0 ? _a : option.value),
47366
47371
  label: option.label,
47367
47372
  metadata: option };
47373
+
47368
47374
  });
47369
47375
  };
47370
47376
  var singleValueToSelectItem = function (value, options) {
47377
+ var _a;
47371
47378
  if (value === undefined || value === '')
47372
47379
  return undefined;
47373
47380
  var option = options.find(function (opt) {return opt.value === value;});
47374
47381
  if (!option)
47375
47382
  return undefined;
47376
47383
  return {
47377
- value: String(option.value),
47384
+ value: String((_a = option.id) !== null && _a !== void 0 ? _a : option.value),
47378
47385
  label: option.label,
47379
47386
  metadata: option };
47380
47387
 
@@ -51376,8 +51383,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
51376
51383
 
51377
51384
  var SingleFileInputField = function (_a) {
51378
51385
  var _b, _c, _d, _e, _f;
51379
- var id = _a.id,label = _a.label,accept = _a.accept,error = _a.error,onChange = _a.onChange,onError = _a.onError,_g = _a.className,className = _g === void 0 ? '' : _g,dataCy = _a.dataCy,onFileUpload = _a.onFileUpload,configSlug = _a.configSlug,value = _a.value,mandatory = _a.mandatory,disabled = _a.disabled;
51380
- var _h = React.useState(!lodash.exports.isNil(value) && !lodash.exports.isEmpty(value) ?
51386
+ var id = _a.id,label = _a.label,accept = _a.accept,error = _a.error,onChange = _a.onChange,onError = _a.onError,_g = _a.className,className = _g === void 0 ? '' : _g,dataCy = _a.dataCy,onFileUpload = _a.onFileUpload,configSlug = _a.configSlug,value = _a.value,mandatory = _a.mandatory,disabled = _a.disabled,_h = _a.maxFileSizeMb,maxFileSizeMb = _h === void 0 ? 30 : _h;
51387
+ var _j = React.useState(!lodash.exports.isNil(value) && !lodash.exports.isEmpty(value) ?
51381
51388
  {
51382
51389
  id: (_b = value.filename) !== null && _b !== void 0 ? _b : 'untitled',
51383
51390
  name: (_c = value.filename) !== null && _c !== void 0 ? _c : 'untitled',
@@ -51387,7 +51394,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
51387
51394
  progress: 100,
51388
51395
  error: undefined } :
51389
51396
 
51390
- undefined),selectedFile = _h[0],setSelectedFile = _h[1];
51397
+ undefined),selectedFile = _j[0],setSelectedFile = _j[1];
51391
51398
  React.useEffect(function () {
51392
51399
  var _a, _b, _c, _d, _e;
51393
51400
  if (!lodash.exports.isNil(value) && !lodash.exports.isEmpty(value) && !selectedFile) {
@@ -51496,7 +51503,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
51496
51503
  if (value && disabled === true) {
51497
51504
  return jsxRuntime.exports.jsxs("div", __assign({ className: "".concat(classes$9.file_input_field_container, " ").concat(className), "data-cy": dataCy }, { children: [label && jsxRuntime.exports.jsx(QuestionLabel, { htmlFor: id, label: label, mandatory: mandatory }), !value.url ? jsxRuntime.exports.jsx("div", { children: "No file uploaded" }) : jsxRuntime.exports.jsxs("div", __assign({ className: classes$9.read_only_file }, { children: [value.filename, " (", value.contentType, ")"] }))] }), id);
51498
51505
  }
51499
- return jsxRuntime.exports.jsxs("div", __assign({ className: "".concat(classes$9.file_input_field_container, " ").concat(className), "data-cy": dataCy }, { children: [label && jsxRuntime.exports.jsx(QuestionLabel, { htmlFor: id, label: label, mandatory: mandatory }), error && jsxRuntime.exports.jsx("div", __assign({ className: classes$9.error_message }, { children: error })), jsxRuntime.exports.jsx("div", __assign({ className: classes$9.file_upload_wrapper }, { children: jsxRuntime.exports.jsx(df, { onChange: handleFilesChange, onError: onError, isMultiple: false, accept: accept, error: error, maxSizeMb: 5 }) })), selectedFile && jsxRuntime.exports.jsx("div", __assign({ className: "".concat(classes$9.file_list_wrapper, " ").concat(classes$9.custom_file_list_container) }, { children: jsxRuntime.exports.jsx(uf, { files: [selectedFile], onDelete: function () {return handleRemoveFile();}, generalProgress: selectedFile.progress !== undefined && selectedFile.progress < 100 ?
51506
+ return jsxRuntime.exports.jsxs("div", __assign({ className: "".concat(classes$9.file_input_field_container, " ").concat(className), "data-cy": dataCy }, { children: [label && jsxRuntime.exports.jsx(QuestionLabel, { htmlFor: id, label: label, mandatory: mandatory }), error && jsxRuntime.exports.jsx("div", __assign({ className: classes$9.error_message }, { children: error })), jsxRuntime.exports.jsx("div", __assign({ className: classes$9.file_upload_wrapper }, { children: jsxRuntime.exports.jsx(df, { onChange: handleFilesChange, onError: onError, isMultiple: false, accept: accept, error: error, maxSizeMb: maxFileSizeMb }) })), selectedFile && jsxRuntime.exports.jsx("div", __assign({ className: "".concat(classes$9.file_list_wrapper, " ").concat(classes$9.custom_file_list_container) }, { children: jsxRuntime.exports.jsx(uf, { files: [selectedFile], onDelete: function () {return handleRemoveFile();}, generalProgress: selectedFile.progress !== undefined && selectedFile.progress < 100 ?
51500
51507
  selectedFile.progress :
51501
51508
  undefined }) }))] }), id);
51502
51509
  };
@@ -51528,11 +51535,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
51528
51535
  var AUTO_PROGRESS_DELAY = 850;
51529
51536
  var QuestionData = function (_a) {
51530
51537
  var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
51531
- var question = _a.question,control = _a.control,getValues = _a.getValues,labels = _a.labels,_m = _a.inputAutoFocus,inputAutoFocus = _m === void 0 ? false : _m,_o = _a.submitAndMoveToNextQuestion,submitAndMoveToNextQuestion = _o === void 0 ? lodash.exports.noop : _o,_p = _a.onAnswerChange,onAnswerChange = _p === void 0 ? lodash.exports.noop : _p,_q = _a.shouldAutoProgress,shouldAutoProgress = _q === void 0 ? function () {return false;} : _q,onFileUpload = _a.onFileUpload;
51538
+ var question = _a.question,control = _a.control,getValues = _a.getValues,labels = _a.labels,_m = _a.inputAutoFocus,inputAutoFocus = _m === void 0 ? false : _m,_o = _a.submitAndMoveToNextQuestion,submitAndMoveToNextQuestion = _o === void 0 ? lodash.exports.noop : _o,_p = _a.onAnswerChange,onAnswerChange = _p === void 0 ? lodash.exports.noop : _p,_q = _a.shouldAutoProgress,shouldAutoProgress = _q === void 0 ? function () {return false;} : _q,onFileUpload = _a.onFileUpload,maxFileSizeMb = _a.maxFileSizeMb;
51532
51539
  var config = question === null || question === void 0 ? void 0 : question.questionConfig;
51533
51540
  var notifyAnswerChange = function (value) {
51534
51541
  onAnswerChange({ questionId: question.id, value: value });
51535
51542
  };
51543
+ var lastSingleSelectRef = React.useRef(undefined);
51536
51544
  var _r = useICDClassificationList(question.id),icdClassificationOptions = _r.options,optionsLoading = _r.loading,onIcdClassificationSearchChange = _r.onIcdClassificationSearchChange;
51537
51545
  var getAcceptedFileTypes = function () {
51538
51546
  var _a, _b, _c, _d;
@@ -51592,14 +51600,24 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
51592
51600
  } });
51593
51601
  case exports.UserQuestionType.MultipleChoice:
51594
51602
  return jsxRuntime.exports.jsx(Controller, { name: question.id, control: control, rules: { required: config === null || config === void 0 ? void 0 : config.mandatory }, render: function (_a) {
51595
- var _b, _c, _d;
51596
- var _e = _a.field,onChange = _e.onChange,value = _e.value;
51603
+ var _b, _c, _d, _e;
51604
+ var _f = _a.field,onChange = _f.onChange,value = _f.value;
51597
51605
  if ((config === null || config === void 0 ? void 0 : config.use_select) === true) {
51598
- return jsxRuntime.exports.jsx(hf, { label: question.title, value: singleValueToSelectItem(value, (_b = question.options) !== null && _b !== void 0 ? _b : []), placeholder: (_c = labels.select) === null || _c === void 0 ? void 0 : _c.search_placeholder, onChange: function (selected) {
51606
+ var lastSelected = lastSingleSelectRef.current;
51607
+ var displayValue = !lodash.exports.isNil(value) &&
51608
+ value !== '' &&
51609
+ ((_b = lastSelected === null || lastSelected === void 0 ? void 0 : lastSelected.metadata) === null || _b === void 0 ? void 0 : _b.value) === value ?
51610
+ lastSelected :
51611
+ singleValueToSelectItem(value, (_c = question.options) !== null && _c !== void 0 ? _c : []);
51612
+ return jsxRuntime.exports.jsx(hf, { label: question.title, value: displayValue, placeholder: (_d = labels.select) === null || _d === void 0 ? void 0 : _d.search_placeholder, onChange: function (selected) {
51613
+ var _a;
51614
+ lastSingleSelectRef.current = Array.isArray(selected) ?
51615
+ undefined :
51616
+ (_a = selected) !== null && _a !== void 0 ? _a : undefined;
51599
51617
  var mapped = selectValueToSingleValue(selected);
51600
51618
  onChange(mapped);
51601
51619
  notifyAnswerChange(mapped);
51602
- }, options: optionsToSelectItems((_d = question.options) !== null && _d !== void 0 ? _d : []), required: config === null || config === void 0 ? void 0 : config.mandatory, isSearchable: true, menuPosition: "fixed" });
51620
+ }, options: optionsToSelectItems((_e = question.options) !== null && _e !== void 0 ? _e : []), required: config === null || config === void 0 ? void 0 : config.mandatory, isSearchable: true, menuPosition: "fixed" });
51603
51621
  }
51604
51622
  return jsxRuntime.exports.jsx(SingleChoiceQuestion, { label: question.title, options: question.options || [], onChange: function (data) {
51605
51623
  onChange(data);
@@ -51736,7 +51754,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
51736
51754
  '';
51737
51755
  onControllerChange(attachmentValue);
51738
51756
  notifyAnswerChange(attachmentValue);
51739
- }, 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 });
51757
+ }, 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, maxFileSizeMb: maxFileSizeMb, label: question.title, mandatory: config === null || config === void 0 ? void 0 : config.mandatory, error: fieldError === null || fieldError === void 0 ? void 0 : fieldError.message });
51740
51758
  } });
51741
51759
  case exports.UserQuestionType.Image:
51742
51760
  return jsxRuntime.exports.jsx(Controller, { name: question.id, control: control, defaultValue: [], rules: {
@@ -51758,7 +51776,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
51758
51776
  '';
51759
51777
  onControllerChange(attachmentValue);
51760
51778
  notifyAnswerChange(attachmentValue);
51761
- }, 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 });
51779
+ }, 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, maxFileSizeMb: maxFileSizeMb, label: question.title, mandatory: config === null || config === void 0 ? void 0 : config.mandatory, error: fieldError === null || fieldError === void 0 ? void 0 : fieldError.message });
51762
51780
  } });
51763
51781
  case exports.UserQuestionType.Description:
51764
51782
  return jsxRuntime.exports.jsx(Description, { content: question.title });
@@ -51773,7 +51791,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
51773
51791
  slider: {
51774
51792
  tooltip_guide: 'Touch to select a value' } } :
51775
51793
 
51776
- _b,_c = _a.inputAutoFocus,inputAutoFocus = _c === void 0 ? false : _c,submitAndMoveToNextQuestion = _a.submitAndMoveToNextQuestion,onAnswerChange = _a.onAnswerChange,shouldAutoProgress = _a.shouldAutoProgress,onFileUpload = _a.onFileUpload;
51794
+ _b,_c = _a.inputAutoFocus,inputAutoFocus = _c === void 0 ? false : _c,submitAndMoveToNextQuestion = _a.submitAndMoveToNextQuestion,onAnswerChange = _a.onAnswerChange,shouldAutoProgress = _a.shouldAutoProgress,onFileUpload = _a.onFileUpload,maxFileSizeMb = _a.maxFileSizeMb;
51777
51795
  var _d = React.useState(0),isVisible = _d[0],setVisible = _d[1];
51778
51796
  var style = { '--awell-question-opacity': isVisible };
51779
51797
  React.useLayoutEffect(function () {
@@ -51785,7 +51803,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
51785
51803
  var id = _a.id;
51786
51804
  return id === question.id;
51787
51805
  });
51788
- return jsxRuntime.exports.jsxs("div", __assign({ style: style, className: classes$b.awell_question }, { children: [jsxRuntime.exports.jsx(QuestionData, { question: question, control: control, getValues: getValues, labels: labels, inputAutoFocus: inputAutoFocus, submitAndMoveToNextQuestion: submitAndMoveToNextQuestion, onAnswerChange: onAnswerChange, shouldAutoProgress: shouldAutoProgress, onFileUpload: onFileUpload }), currentError && jsxRuntime.exports.jsx("div", __assign({ className: classes$b.error }, { children: jsxRuntime.exports.jsx(Text, __assign({ variant: "textSmall", color: "var(--awell-signalError100)" }, { children: currentError.error })) }))] }));
51806
+ return jsxRuntime.exports.jsxs("div", __assign({ style: style, className: classes$b.awell_question }, { children: [jsxRuntime.exports.jsx(QuestionData, { question: question, control: control, getValues: getValues, labels: labels, inputAutoFocus: inputAutoFocus, submitAndMoveToNextQuestion: submitAndMoveToNextQuestion, onAnswerChange: onAnswerChange, shouldAutoProgress: shouldAutoProgress, onFileUpload: onFileUpload, maxFileSizeMb: maxFileSizeMb }), currentError && jsxRuntime.exports.jsx("div", __assign({ className: classes$b.error }, { children: jsxRuntime.exports.jsx(Text, __assign({ variant: "textSmall", color: "var(--awell-signalError100)" }, { children: currentError.error })) }))] }));
51789
51807
  };
51790
51808
 
51791
51809
  var classes$8 = {"awell_attachment_list":"awell__attachmentList_awell_attachment_list"};
@@ -52861,7 +52879,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
52861
52879
  };
52862
52880
 
52863
52881
  var ConversationalForm = function (_a) {
52864
- var form = _a.form,onSubmit = _a.onSubmit,buttonLabels = _a.buttonLabels,evaluateDisplayConditions = _a.evaluateDisplayConditions,errorLabels = _a.errorLabels,questionLabels = _a.questionLabels,storedAnswers = _a.storedAnswers,onAnswersChange = _a.onAnswersChange,_b = _a.autoProgress,autoProgress = _b === void 0 ? false : _b,_c = _a.autosaveAnswers,autosaveAnswers = _c === void 0 ? true : _c,_d = _a.showProgressBar,showProgressBar = _d === void 0 ? true : _d,onFileUpload = _a.onFileUpload;
52882
+ var form = _a.form,onSubmit = _a.onSubmit,buttonLabels = _a.buttonLabels,evaluateDisplayConditions = _a.evaluateDisplayConditions,errorLabels = _a.errorLabels,questionLabels = _a.questionLabels,storedAnswers = _a.storedAnswers,onAnswersChange = _a.onAnswersChange,_b = _a.autoProgress,autoProgress = _b === void 0 ? false : _b,_c = _a.autosaveAnswers,autosaveAnswers = _c === void 0 ? true : _c,_d = _a.showProgressBar,showProgressBar = _d === void 0 ? true : _d,onFileUpload = _a.onFileUpload,maxFileSizeMb = _a.maxFileSizeMb;
52865
52883
  var _e = useConversationalForm({
52866
52884
  questions: form.questions,
52867
52885
  onSubmit: onSubmit,
@@ -52889,13 +52907,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
52889
52907
  form.questions.length === 1 ||
52890
52908
  showProgressBar === false;
52891
52909
  return jsxRuntime.exports.jsxs(jsxRuntime.exports.Fragment, { children: [jsxRuntime.exports.jsx("main", __assign({ id: "ahp_main_content_with_scroll_hint", className: layoutClasses.main_content }, { children: jsxRuntime.exports.jsxs("div", __assign({ className: "".concat(classes$4.awell_wizard_form, " ").concat(classes$4.container) }, { children: [!hideProgressIndicator && jsxRuntime.exports.jsx("div", __assign({ className: classes$4.form_progress }, { children: jsxRuntime.exports.jsx(ProgressIndicator, { percentageCompleted: percentageCompleted }) })), isEvaluatingQuestionVisibility ||
52892
- (currentQuestion === null || currentQuestion === void 0 ? void 0 : currentQuestion.id) === undefined ? jsxRuntime.exports.jsx("div", __assign({ className: classes$4.loadingContainer }, { children: jsxRuntime.exports.jsx(LoadActivityPlaceholder, {}) })) : jsxRuntime.exports.jsx(jsxRuntime.exports.Fragment, { children: jsxRuntime.exports.jsxs("div", __assign({ className: classes$4.wizard_form }, { children: [jsxRuntime.exports.jsx(Question, { question: currentQuestion, control: control, getValues: getValues, errors: errors, labels: questionLabels, submitAndMoveToNextQuestion: submitAndMoveToNextQuestion, inputAutoFocus: true, shouldAutoProgress: shouldAutoProgress, onFileUpload: onFileUpload }, currentQuestion.id), (form === null || form === void 0 ? void 0 : form.trademark) && jsxRuntime.exports.jsx("div", __assign({ className: "".concat(classes$4.trademark, " ").concat(classes$4.conversational) }, { children: form.trademark }))] })) })] })) })), jsxRuntime.exports.jsx(HostedPageFooter, { children: !isEvaluatingQuestionVisibility && jsxRuntime.exports.jsxs("div", __assign({ className: "".concat(classes$4.conversational_button_wrapper, " ").concat(classes$4.container) }, { children: [jsxRuntime.exports.jsx("div", { children: !isFirstQuestion && jsxRuntime.exports.jsx(Button, __assign({ variant: "tertiary", onClick: handleGoToPrevQuestion, "data-cy": "navigateToPrevQuestionButton" }, { children: buttonLabels.prev })) }), isLastQuestion ? jsxRuntime.exports.jsx(Button, __assign({ onClick: submitForm, type: "submit", "data-cy": "submitFormButton", disabled: isSubmittingForm }, { children: buttonLabels.submit })) : jsxRuntime.exports.jsx(Button, __assign({ variant: "secondary", onClick: handleGoToNextQuestion, "data-cy": "navigateToNextQuestionButton" }, { children: buttonLabels.next }))] })) })] });
52910
+ (currentQuestion === null || currentQuestion === void 0 ? void 0 : currentQuestion.id) === undefined ? jsxRuntime.exports.jsx("div", __assign({ className: classes$4.loadingContainer }, { children: jsxRuntime.exports.jsx(LoadActivityPlaceholder, {}) })) : jsxRuntime.exports.jsx(jsxRuntime.exports.Fragment, { children: jsxRuntime.exports.jsxs("div", __assign({ className: classes$4.wizard_form }, { children: [jsxRuntime.exports.jsx(Question, { question: currentQuestion, control: control, getValues: getValues, errors: errors, labels: questionLabels, submitAndMoveToNextQuestion: submitAndMoveToNextQuestion, inputAutoFocus: true, shouldAutoProgress: shouldAutoProgress, onFileUpload: onFileUpload, maxFileSizeMb: maxFileSizeMb }, currentQuestion.id), (form === null || form === void 0 ? void 0 : form.trademark) && jsxRuntime.exports.jsx("div", __assign({ className: "".concat(classes$4.trademark, " ").concat(classes$4.conversational) }, { children: form.trademark }))] })) })] })) })), jsxRuntime.exports.jsx(HostedPageFooter, { children: !isEvaluatingQuestionVisibility && jsxRuntime.exports.jsxs("div", __assign({ className: "".concat(classes$4.conversational_button_wrapper, " ").concat(classes$4.container) }, { children: [jsxRuntime.exports.jsx("div", { children: !isFirstQuestion && jsxRuntime.exports.jsx(Button, __assign({ variant: "tertiary", onClick: handleGoToPrevQuestion, "data-cy": "navigateToPrevQuestionButton" }, { children: buttonLabels.prev })) }), isLastQuestion ? jsxRuntime.exports.jsx(Button, __assign({ onClick: submitForm, type: "submit", "data-cy": "submitFormButton", disabled: isSubmittingForm }, { children: buttonLabels.submit })) : jsxRuntime.exports.jsx(Button, __assign({ variant: "secondary", onClick: handleGoToNextQuestion, "data-cy": "navigateToNextQuestionButton" }, { children: buttonLabels.next }))] })) })] });
52893
52911
  };
52894
52912
 
52895
52913
  function r(e) {var t,f,n = "";if ("string" == typeof e || "number" == typeof e) n += e;else if ("object" == typeof e) if (Array.isArray(e)) {var o = e.length;for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);} else for (f in e) e[f] && (n && (n += " "), n += f);return n;}function clsx() {for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);return n;}
52896
52914
 
52897
52915
  var TraditionalForm = function (_a) {
52898
- 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;
52916
+ 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,maxFileSizeMb = _a.maxFileSizeMb;
52899
52917
  var _c = useTraditionalForm({
52900
52918
  questions: form.questions,
52901
52919
  onSubmit: onSubmit,
@@ -52907,7 +52925,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
52907
52925
  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;
52908
52926
  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.
52909
52927
  filter(function (vb) {return vb.visible;}).
52910
- 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 }))] })) }))] });
52928
+ 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, maxFileSizeMb: maxFileSizeMb }, 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 }))] })) }))] });
52911
52929
  };
52912
52930
 
52913
52931
  var WizardForm = ConversationalForm;
@@ -16,6 +16,7 @@ interface Props {
16
16
  configSlug?: string;
17
17
  value?: Array<Attachment>;
18
18
  mandatory?: boolean;
19
+ maxFileSizeMb?: number;
19
20
  }
20
21
  export declare const FileInputField: React.FC<Props>;
21
22
  export {};
@@ -16,6 +16,7 @@ interface Props {
16
16
  value?: Attachment | null;
17
17
  mandatory?: boolean;
18
18
  disabled?: boolean;
19
+ maxFileSizeMb?: number;
19
20
  }
20
21
  export declare const SingleFileInputField: React.FC<Props>;
21
22
  export {};
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  import { FormProps } from '../../../types/form';
3
- export declare const ConversationalForm: ({ form, onSubmit, buttonLabels, evaluateDisplayConditions, errorLabels, questionLabels, storedAnswers, onAnswersChange, autoProgress, autosaveAnswers, showProgressBar, onFileUpload, }: FormProps) => JSX.Element;
3
+ export declare const ConversationalForm: ({ form, onSubmit, buttonLabels, evaluateDisplayConditions, errorLabels, questionLabels, storedAnswers, onAnswersChange, autoProgress, autosaveAnswers, showProgressBar, onFileUpload, maxFileSizeMb, }: FormProps) => JSX.Element;
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  import { FormProps } from '../../../types/form';
3
- export declare const TraditionalForm: ({ form, onSubmit, buttonLabels, evaluateDisplayConditions, errorLabels, storedAnswers, onAnswersChange, autosaveAnswers, questionLabels, onFileUpload, }: FormProps) => JSX.Element;
3
+ export declare const TraditionalForm: ({ form, onSubmit, buttonLabels, evaluateDisplayConditions, errorLabels, storedAnswers, onAnswersChange, autosaveAnswers, questionLabels, onFileUpload, maxFileSizeMb, }: FormProps) => JSX.Element;
@@ -1,2 +1,2 @@
1
1
  /// <reference types="react" />
2
- export declare const WizardForm: ({ form, onSubmit, buttonLabels, evaluateDisplayConditions, errorLabels, questionLabels, storedAnswers, onAnswersChange, autoProgress, autosaveAnswers, showProgressBar, onFileUpload, }: import("../../..").FormProps) => JSX.Element;
2
+ export declare const WizardForm: ({ form, onSubmit, buttonLabels, evaluateDisplayConditions, errorLabels, questionLabels, storedAnswers, onAnswersChange, autoProgress, autosaveAnswers, showProgressBar, onFileUpload, maxFileSizeMb, }: import("../../..").FormProps) => JSX.Element;
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import { QuestionDataProps, QuestionProps } from './types';
3
- export declare const QuestionData: ({ question, control, getValues, labels, inputAutoFocus, submitAndMoveToNextQuestion, onAnswerChange, shouldAutoProgress, onFileUpload, }: QuestionDataProps) => JSX.Element;
4
- export declare const Question: ({ question, control, getValues, errors, labels, inputAutoFocus, submitAndMoveToNextQuestion, onAnswerChange, shouldAutoProgress, onFileUpload, }: QuestionProps) => JSX.Element;
3
+ export declare const QuestionData: ({ question, control, getValues, labels, inputAutoFocus, submitAndMoveToNextQuestion, onAnswerChange, shouldAutoProgress, onFileUpload, maxFileSizeMb, }: QuestionDataProps) => JSX.Element;
4
+ export declare const Question: ({ question, control, getValues, errors, labels, inputAutoFocus, submitAndMoveToNextQuestion, onAnswerChange, shouldAutoProgress, onFileUpload, maxFileSizeMb, }: QuestionProps) => JSX.Element;
@@ -29,6 +29,7 @@ export interface QuestionDataProps {
29
29
  onAnswerChange?: (change?: AnswerChange) => void;
30
30
  shouldAutoProgress?: (question: Question) => boolean;
31
31
  onFileUpload?: (file: File, configSlug?: string) => Promise<string>;
32
+ maxFileSizeMb?: number;
32
33
  }
33
34
  export interface QuestionProps {
34
35
  question: Question;
@@ -41,6 +42,7 @@ export interface QuestionProps {
41
42
  onAnswerChange?: (change?: AnswerChange) => void;
42
43
  shouldAutoProgress?: (question: Question) => boolean;
43
44
  onFileUpload?: (file: File, configSlug?: string) => Promise<string>;
45
+ maxFileSizeMb?: number;
44
46
  }
45
47
  export interface Attachment {
46
48
  url?: string;
@@ -25,4 +25,5 @@ export interface FormProps {
25
25
  autosaveAnswers?: boolean;
26
26
  showProgressBar?: boolean;
27
27
  onFileUpload?: (file: File, configSlug?: string) => Promise<string>;
28
+ maxFileSizeMb?: number;
28
29
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awell-health/ui-library",
3
- "version": "0.1.145",
3
+ "version": "0.1.147",
4
4
  "description": "UI components to integrate with Awell Health",
5
5
  "repository": {
6
6
  "type": "git",