@awell-health/ui-library 0.1.112 → 0.1.113

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 CHANGED
@@ -6696,6 +6696,7 @@ html {
6696
6696
  width: 100%;
6697
6697
  z-index: 1001;
6698
6698
  transition: opacity 0.3s ease-in-out;
6699
+ background-color: white;
6699
6700
  }
6700
6701
  @media (min-width: 640px) {
6701
6702
  .awell__hostedPageFooter_footer .awell__hostedPageFooter_scrollHint {
package/dist/index.js CHANGED
@@ -34850,8 +34850,22 @@ Check the top-level render call using <` + t + ">.");
34850
34850
  React.useEffect(function () {
34851
34851
  if (isOpen) {
34852
34852
  var container = document.getElementById('ahp_main_content_with_scroll_hint');
34853
- if (container) {
34854
- container.scrollTo({ top: container.scrollHeight, behavior: 'smooth' });
34853
+ if (container && selectWrapperRef.current) {
34854
+ var dropdownElement = selectWrapperRef.current.querySelector(".".concat(classes$h.dropdown_open));
34855
+ if (dropdownElement) {
34856
+ var containerRect = container.getBoundingClientRect();
34857
+ var dropdownRect = dropdownElement.getBoundingClientRect();
34858
+ var selectRect = selectWrapperRef.current.getBoundingClientRect();
34859
+ var dropdownBottom = selectRect.bottom + dropdownRect.height;
34860
+ var containerBottom = containerRect.bottom;
34861
+ if (dropdownBottom > containerBottom) {
34862
+ var scrollAmount = dropdownBottom - containerBottom + 20;
34863
+ container.scrollTo({
34864
+ top: container.scrollTop + scrollAmount,
34865
+ behavior: 'smooth' });
34866
+
34867
+ }
34868
+ }
34855
34869
  }
34856
34870
  }
34857
34871
  }, [isOpen]);
@@ -37337,18 +37351,27 @@ Check the top-level render call using <` + t + ">.");
37337
37351
 
37338
37352
  var PhoneInputField = function (_a) {
37339
37353
  var onChange = _a.onChange,id = _a.id,label = _a.label,mandatory = _a.mandatory,value = _a.value,placeholder = _a.placeholder,_b = _a.initialCountry,initialCountry = _b === void 0 ? 'us' : _b,availableCountries = _a.availableCountries,_c = _a.forceDialCode,forceDialCode = _c === void 0 ? false : _c,props = __rest(_a, ["onChange", "id", "label", "mandatory", "value", "placeholder", "initialCountry", "availableCountries", "forceDialCode"]);
37354
+ var _d = React.useState(false),touched = _d[0],setTouched = _d[1];
37340
37355
  var countries = getDefaultCountries(availableCountries, initialCountry);
37341
- var _d = build.exports.usePhoneInput({
37356
+ var _e = build.exports.usePhoneInput({
37342
37357
  initialCountry: initialCountry,
37343
37358
  value: value,
37344
37359
  hideSpaceAfterDialCode: true,
37345
37360
  countries: countries,
37346
37361
  forceDialCode: forceDialCode,
37347
37362
  onPhoneUpdate: function (phone) {
37348
- onChange({ target: { value: phone } });
37363
+ if (touched && phone.length > 3) {
37364
+ onChange({ target: { value: phone } });
37365
+ } else
37366
+ {
37367
+ onChange({ target: { value: undefined } });
37368
+ }
37349
37369
  } }),
37350
- phone = _d.phone,handlePhoneValueChange = _d.handlePhoneValueChange,inputRef = _d.inputRef,country = _d.country,setCountry = _d.setCountry;
37370
+ phone = _e.phone,handlePhoneValueChange = _e.handlePhoneValueChange,inputRef = _e.inputRef,country = _e.country,setCountry = _e.setCountry;
37351
37371
  var handleInputChange = function (e) {
37372
+ if (!touched) {
37373
+ setTouched(true);
37374
+ }
37352
37375
  handlePhoneValueChange(e);
37353
37376
  };
37354
37377
  var handleCountrySelect = function (_a) {
@@ -48352,14 +48375,14 @@ var Kr=[{
48352
48375
  var availableCountries_1 = ((_h = (_g = config === null || config === void 0 ? void 0 : config.phone) === null || _g === void 0 ? void 0 : _g.available_countries) !== null && _h !== void 0 ? _h : []).
48353
48376
  map(function (c) {return c === null || c === void 0 ? void 0 : c.toLocaleLowerCase();}).
48354
48377
  filter(function (x) {return !lodash.exports.isNil(x);});
48355
- var initialCountry_1 = (_l = (_k = (_j = config === null || config === void 0 ? void 0 : config.phone) === null || _j === void 0 ? void 0 : _j.default_country) === null || _k === void 0 ? void 0 : _k.toLocaleLowerCase()) !== null && _l !== void 0 ? _l : 'gb';
48378
+ var initialCountry_1 = (_l = (_k = (_j = config === null || config === void 0 ? void 0 : config.phone) === null || _j === void 0 ? void 0 : _j.default_country) === null || _k === void 0 ? void 0 : _k.toLocaleLowerCase()) !== null && _l !== void 0 ? _l : 'us';
48356
48379
  return jsxRuntime.exports.jsx(Controller, { name: question.id, control: control, defaultValue: "", render: function (_a) {
48357
48380
  var _b;
48358
48381
  var _c = _a.field,onChange = _c.onChange,value = _c.value;
48359
48382
  return jsxRuntime.exports.jsx(PhoneInputField, { autoFocus: inputAutoFocus, onChange: function (e) {
48360
48383
  onChange(e.target.value);
48361
48384
  onAnswerChange();
48362
- }, label: question.title, id: question.id, value: value, mandatory: (_b = question.questionConfig) === null || _b === void 0 ? void 0 : _b.mandatory, availableCountries: availableCountries_1, initialCountry: initialCountry_1, forceDialCode: true });
48385
+ }, label: question.title, id: question.id, value: value !== null && value !== void 0 ? value : '', mandatory: (_b = question.questionConfig) === null || _b === void 0 ? void 0 : _b.mandatory, availableCountries: availableCountries_1, initialCountry: initialCountry_1, forceDialCode: true });
48363
48386
  } });
48364
48387
  case exports.UserQuestionType.Slider:
48365
48388
  return jsxRuntime.exports.jsx(Controller, { name: question.id, control: control, rules: {
@@ -4,9 +4,9 @@ import { CountryIso2 } from 'react-international-phone';
4
4
  export interface PhoneInputFieldProps extends InputHTMLAttributes<HTMLInputElement> {
5
5
  label: string;
6
6
  id: string;
7
- onChange: ({ target: { value } }: {
7
+ onChange: ({ target: { value }, }: {
8
8
  target: {
9
- value: string;
9
+ value: string | undefined;
10
10
  };
11
11
  }) => void;
12
12
  onClick?: MouseEventHandler<HTMLInputElement>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awell-health/ui-library",
3
- "version": "0.1.112",
3
+ "version": "0.1.113",
4
4
  "description": "UI components to integrate with Awell Health",
5
5
  "repository": {
6
6
  "type": "git",