hplx-react-elements-dev 1.0.28 → 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.
@@ -4,7 +4,7 @@ import "react-date-range/dist/theme/default.css";
4
4
  import "../datePicker/DatePickerCSS.css";
5
5
  export interface DatePickerProps {
6
6
  disabledDates: Date[];
7
- selectDate?: Date;
7
+ selectDate?: any;
8
8
  dateVar: (val: Date) => void;
9
9
  isborderRequired: boolean;
10
10
  }
package/dist/esm/index.js CHANGED
@@ -2256,20 +2256,28 @@ var InputField = function InputField(_a) {
2256
2256
  children: jsxRuntime.exports.jsx("span", {
2257
2257
  className: end_icon
2258
2258
  })
2259
- })), Boolean(suffix || suffixPlaceholder) && jsxRuntime.exports.jsxs("div", {
2260
- children: [jsxRuntime.exports.jsxs("div", __assign({
2259
+ })), Boolean(suffix) && !isSuffixEditable && jsxRuntime.exports.jsx("div", __assign({
2260
+ "data-testid": "input-suffix",
2261
+ className: "bg-Gray-50 border-l-1 border-l-Gray-300 text-Gray-500 flex items-center pr-3 pl-[14px]",
2262
+ onClick: function onClick() {
2263
+ return setShowSuffixDropdown(true);
2264
+ }
2265
+ }, {
2266
+ children: !isSuffixEditable && jsxRuntime.exports.jsx(Typography, __assign({
2267
+ type: "Text md",
2268
+ variant: "Regular"
2269
+ }, {
2270
+ children: suffix
2271
+ }))
2272
+ })), Boolean(suffix) && isSuffixEditable && jsxRuntime.exports.jsxs("div", {
2273
+ children: [jsxRuntime.exports.jsx("div", __assign({
2261
2274
  "data-testid": "input-suffix",
2262
2275
  className: "bg-Gray-50 border-l-1 border-l-Gray-300 text-Gray-500 flex items-center pr-3 pl-[14px]",
2263
2276
  onClick: function onClick() {
2264
2277
  return setShowSuffixDropdown(true);
2265
2278
  }
2266
2279
  }, {
2267
- children: [!isSuffixEditable && jsxRuntime.exports.jsx(Typography, __assign({
2268
- type: "Text md",
2269
- variant: "Regular"
2270
- }, {
2271
- children: suffix
2272
- })), isSuffixEditable && jsxRuntime.exports.jsx("input", {
2280
+ children: isSuffixEditable && jsxRuntime.exports.jsx("input", {
2273
2281
  type: "text",
2274
2282
  className: "flex-1 pl-[4px] w-36 pr-[1px] bg-Gray-50 py-2 focus-visible:outline-0 border-0 focus:border-0",
2275
2283
  "data-testid": "text-input",
@@ -2279,7 +2287,7 @@ var InputField = function InputField(_a) {
2279
2287
  onChange: function onChange(e) {
2280
2288
  return handleSuffixValueChange(e);
2281
2289
  }
2282
- })]
2290
+ })
2283
2291
  })), showSuffixDropdown && jsxRuntime.exports.jsx("div", __assign({
2284
2292
  ref: wrapperRef,
2285
2293
  className: "absolute mt-1 min-w-max rounded-lg bg-White overflow-y-auto shadow-md z-10 max-h-80 "
@@ -4335,7 +4343,7 @@ var CollapsibleCard = function CollapsibleCard(props) {
4335
4343
  onAnimationEnd: function onAnimationEnd() {
4336
4344
  console.log("onAnimationEnd called");
4337
4345
  },
4338
- className: "".concat(active ? "max-h-[1000px]" : "max-h-0", " ").concat(active ? "p-5" : "p-0", " transition-all duration-500 ease-in-out overflow-hidden mt-5 ").concat(getWidth(width), " ").concat(getHeight(height), " text-ellipsis")
4346
+ className: "".concat(active ? "max-h-[1000px] overflow-visible" : "max-h-0 overflow-hidden", " ").concat(active ? "p-5" : "p-0", " transition-all duration-500 ease-in-out mt-5 ").concat(getWidth(width), " ").concat(getHeight(height), " text-ellipsis")
4339
4347
  }, {
4340
4348
  children: [header && jsxRuntime.exports.jsx("div", __assign({
4341
4349
  className: "flex flex-1 m-1 p-4"
@@ -5214,7 +5222,7 @@ var AddSuggestion = function AddSuggestion(_a) {
5214
5222
 
5215
5223
  if (options && options.length > 0) {
5216
5224
  var sug = options.filter(function (options) {
5217
- return options.label.toLowerCase().includes(e.target.value.split(", ").pop().toLowerCase());
5225
+ return options.label.toLowerCase().includes(e.target.value.split(",").pop().toLowerCase());
5218
5226
  } // last keyboad input after ,
5219
5227
  );
5220
5228
  setSuggestionArr(sug);
@@ -5229,16 +5237,24 @@ var AddSuggestion = function AddSuggestion(_a) {
5229
5237
  }
5230
5238
  };
5231
5239
 
5232
- var handleSuggestionClick = function handleSuggestionClick(selectedValue) {
5233
- 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);
5234
5242
 
5235
- debris.pop(); //pop last element off the array (which we didn't want)
5243
+ if (lastEle === ",") {
5244
+ return "";
5245
+ } else {
5246
+ return ", ";
5247
+ }
5248
+ };
5236
5249
 
5237
- 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(", ");
5238
5254
  var res;
5239
5255
 
5240
- if (result.length > 0) {
5241
- res = result + ", " + selectedValue.label;
5256
+ if (suggestionValue.length > 0) {
5257
+ res = suggestionValue + checkComma(suggestionValue) + selectedValue.label;
5242
5258
  } else {
5243
5259
  res = selectedValue.label;
5244
5260
  }
@@ -16850,36 +16866,43 @@ DateRangePicker$1.default = _default;
16850
16866
 
16851
16867
  var DatePicker = function DatePicker(_a) {
16852
16868
  var disabledDates = _a.disabledDates,
16853
- selectDate = _a.selectDate,
16869
+ _b = _a.selectDate,
16870
+ selectDate = _b === void 0 ? undefined : _b,
16854
16871
  dateVar = _a.dateVar,
16855
- _b = _a.isborderRequired,
16856
- isborderRequired = _b === void 0 ? true : _b;
16872
+ _c = _a.isborderRequired,
16873
+ isborderRequired = _c === void 0 ? true : _c;
16857
16874
 
16858
- var _c = useState(new Date(selectDate ? selectDate : new Date())),
16859
- date = _c[0],
16860
- setDate = _c[1];
16875
+ var _d = useState(),
16876
+ date = _d[0],
16877
+ setDate = _d[1];
16861
16878
 
16862
- var _d = useState(false),
16863
- selected = _d[0],
16864
- setSelected = _d[1];
16865
-
16866
- useEffect(function () {
16867
- if (selectDate) setDate(selectDate);
16868
- }, [selectDate]);
16879
+ var _e = useState(false),
16880
+ clicked = _e[0],
16881
+ setClicked = _e[1];
16869
16882
 
16870
16883
  var handleSelect = function handleSelect(date) {
16871
16884
  setDate(date);
16872
- setSelected(!selected);
16885
+ setClicked(!clicked);
16873
16886
  console.log(dayjs().format("MMM DD, YYYY"));
16874
16887
  dateVar(date);
16875
16888
  };
16876
16889
 
16877
16890
  var inputClick = function inputClick() {
16878
- setSelected(!selected);
16891
+ setClicked(!clicked);
16879
16892
  };
16880
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]);
16881
16904
  return jsxRuntime.exports.jsxs("div", __assign({
16882
- className: "px-[14px] py-[10px]"
16905
+ className: " px-[14px] py-[10px] "
16883
16906
  }, {
16884
16907
  children: [jsxRuntime.exports.jsx("div", __assign({
16885
16908
  className: "relative w-[189px]"
@@ -16888,20 +16911,19 @@ var DatePicker = function DatePicker(_a) {
16888
16911
  isborderRequired: isborderRequired,
16889
16912
  start_icon: "hx_calendar",
16890
16913
  inputProps: {
16891
- placeholder: date ? dayjs(date).format("MMM DD, YYYY") : "select dates",
16892
- value: dayjs(date).format("MMM DD, YYYY"),
16893
- onClick: inputClick
16914
+ placeholder: "Select date",
16915
+ onClick: inputClick,
16916
+ value: date ? dayjs(date).format("MMM DD, YYYY") : selectDate === null || selectDate === void 0 ? void 0 : selectDate.toString()
16894
16917
  }
16895
16918
  })
16896
16919
  })), jsxRuntime.exports.jsx("div", __assign({
16897
- className: "absolute ".concat(selected ? "block" : "hidden", " mt-1 z-10 ")
16920
+ className: "absolute mt-1 z-10 "
16898
16921
  }, {
16899
- children: jsxRuntime.exports.jsx(dist.Calendar, {
16922
+ children: clicked ? jsxRuntime.exports.jsx(dist.Calendar, {
16900
16923
  date: dayjs(date).isValid() ? date : new Date(),
16901
16924
  onChange: handleSelect,
16902
- dateDisplayFormat: "MMM d, yyyy",
16903
16925
  disabledDates: disabledDates
16904
- })
16926
+ }) : null
16905
16927
  }))]
16906
16928
  }));
16907
16929
  };
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "frontend",
10
10
  "healthplix"
11
11
  ],
12
- "version": "1.0.28",
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",