hplx-react-elements-dev 1.0.29 → 1.0.30

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.
Files changed (2) hide show
  1. package/dist/esm/index.js +27 -10
  2. package/package.json +1 -1
package/dist/esm/index.js CHANGED
@@ -5222,7 +5222,7 @@ var AddSuggestion = function AddSuggestion(_a) {
5222
5222
 
5223
5223
  if (options && options.length > 0) {
5224
5224
  var sug = options.filter(function (options) {
5225
- return options.label.toLowerCase().includes(e.target.value.split(", ").pop().toLowerCase());
5225
+ return options.label.toLowerCase().includes(e.target.value.split(",").pop().toLowerCase());
5226
5226
  } // last keyboad input after ,
5227
5227
  );
5228
5228
  setSuggestionArr(sug);
@@ -5237,16 +5237,24 @@ var AddSuggestion = function AddSuggestion(_a) {
5237
5237
  }
5238
5238
  };
5239
5239
 
5240
- var handleSuggestionClick = function handleSuggestionClick(selectedValue) {
5241
- var debris = suggestionValue.split(", "); //explode string into array of strings indexed by /, |. |\s /
5240
+ var checkComma = function checkComma(val) {
5241
+ var lastEle = val.charAt(suggestionValue.length - 1);
5242
5242
 
5243
- debris.pop(); //pop last element off the array (which we didn't want)
5243
+ if (lastEle === ",") {
5244
+ return "";
5245
+ } else {
5246
+ return ", ";
5247
+ }
5248
+ };
5244
5249
 
5245
- var result = debris.join(", ");
5250
+ var handleSuggestionClick = function handleSuggestionClick(selectedValue) {
5251
+ // const debris = suggestionValue.split(", "); //explode string into array of strings indexed by /, |. |\s /
5252
+ // debris.pop(); //pop last element off the array (which we didn't want)
5253
+ // const result = debris.join(", ");
5246
5254
  var res;
5247
5255
 
5248
- if (result.length > 0) {
5249
- res = result + ", " + selectedValue.label;
5256
+ if (suggestionValue.length > 0) {
5257
+ res = suggestionValue + checkComma(suggestionValue) + selectedValue.label;
5250
5258
  } else {
5251
5259
  res = selectedValue.label;
5252
5260
  }
@@ -16883,8 +16891,18 @@ var DatePicker = function DatePicker(_a) {
16883
16891
  setClicked(!clicked);
16884
16892
  };
16885
16893
 
16894
+ useEffect(function () {
16895
+ var handleClickOutside = function handleClickOutside() {
16896
+ return setClicked(false);
16897
+ };
16898
+
16899
+ document.addEventListener("mouseup", handleClickOutside);
16900
+ return function () {
16901
+ document.removeEventListener("mouseup", handleClickOutside);
16902
+ };
16903
+ }, [clicked]);
16886
16904
  return jsxRuntime.exports.jsxs("div", __assign({
16887
- className: "px-[14px] py-[10px]"
16905
+ className: " px-[14px] py-[10px] "
16888
16906
  }, {
16889
16907
  children: [jsxRuntime.exports.jsx("div", __assign({
16890
16908
  className: "relative w-[189px]"
@@ -16899,12 +16917,11 @@ var DatePicker = function DatePicker(_a) {
16899
16917
  }
16900
16918
  })
16901
16919
  })), jsxRuntime.exports.jsx("div", __assign({
16902
- className: "absolute mt-1 z-10 "
16920
+ className: "absolute mt-1 z-10 "
16903
16921
  }, {
16904
16922
  children: clicked ? jsxRuntime.exports.jsx(dist.Calendar, {
16905
16923
  date: dayjs(date).isValid() ? date : new Date(),
16906
16924
  onChange: handleSelect,
16907
- dateDisplayFormat: "MMM d, yyyy",
16908
16925
  disabledDates: disabledDates
16909
16926
  }) : null
16910
16927
  }))]
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "frontend",
10
10
  "healthplix"
11
11
  ],
12
- "version": "1.0.29",
12
+ "version": "1.0.30",
13
13
  "main": "dist/esm/index.js",
14
14
  "module": "dist/esm/index.js",
15
15
  "types": "dist/esm/index.d.ts",