hplx-react-elements-dev 1.0.85 → 1.0.87

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/esm/index.js CHANGED
@@ -2681,26 +2681,30 @@ var TextAreaField = function TextAreaField(_a) {
2681
2681
  _d = _a.rows,
2682
2682
  rows = _d === void 0 ? 2 : _d,
2683
2683
  _e = _a.isDynamicHeight,
2684
- isDynamicHeight = _e === void 0 ? false : _e;
2684
+ isDynamicHeight = _e === void 0 ? false : _e,
2685
+ _f = _a.isFocus,
2686
+ isFocus = _f === void 0 ? false : _f;
2685
2687
 
2686
- var _f = inputProps || {},
2687
- disabled = _f.disabled,
2688
- onFocus = _f.onFocus,
2689
- onBlur = _f.onBlur;
2688
+ var _g = inputProps || {},
2689
+ disabled = _g.disabled,
2690
+ onFocus = _g.onFocus,
2691
+ onBlur = _g.onBlur;
2690
2692
 
2691
- var _g = useState(false),
2692
- active = _g[0],
2693
- setActive = _g[1];
2693
+ var _h = useState(false),
2694
+ active = _h[0],
2695
+ setActive = _h[1];
2694
2696
 
2695
- var _h = useState(rows),
2696
- row = _h[0],
2697
- setRow = _h[1];
2697
+ var _j = useState(rows),
2698
+ row = _j[0],
2699
+ setRow = _j[1];
2698
2700
 
2699
2701
  var ref = useRef(null);
2700
2702
 
2701
2703
  var handleHeight = function handleHeight() {
2702
- var element = ref.current;
2703
- isDynamicHeight && setRow(element.scrollHeight / 32);
2704
+ if (isFocus = true) {
2705
+ var element = ref === null || ref === void 0 ? void 0 : ref.current;
2706
+ isDynamicHeight && setRow((element === null || element === void 0 ? void 0 : element.scrollHeight) / 32);
2707
+ }
2704
2708
  };
2705
2709
 
2706
2710
  var handleFocus = function handleFocus(event) {
@@ -2712,7 +2716,7 @@ var TextAreaField = function TextAreaField(_a) {
2712
2716
  var handleBlur = function handleBlur(event) {
2713
2717
  setActive(false);
2714
2718
  onBlur && onBlur(event);
2715
- isDynamicHeight && setRow(rows);
2719
+ isDynamicHeight && !isFocus && setRow(rows);
2716
2720
  };
2717
2721
 
2718
2722
  return jsxRuntime.exports.jsxs("div", __assign({
@@ -2738,7 +2742,7 @@ var TextAreaField = function TextAreaField(_a) {
2738
2742
  ref: ref,
2739
2743
  className: "hplxt-flex-1 hplxt-px-2 hplxt-py-2 focus-visible:hplxt-outline-0 hplxt-border-0 focus:hplxt-border-0",
2740
2744
  style: {
2741
- height: row * 32 + 'px'
2745
+ height: row * 32 + "px"
2742
2746
  }
2743
2747
  }, inputProps, {
2744
2748
  onInput: handleHeight,
@@ -18155,8 +18159,11 @@ var InputTag = function InputTag(_a) {
18155
18159
 
18156
18160
  if (Boolean(tagInputValue) && tagInputValue.trim() && tagInputValue.trim().length > 1 && (allowDuplicates || !tags.includes(tagInputValue.trim())) // check if allowDuplicates flag is true or tagInputValue is not already in tags
18157
18161
  ) {
18158
- setTags(__spreadArray(__spreadArray([], tags, true), [tagInputValue.trim()], false));
18162
+ var res = __spreadArray(__spreadArray([], tags, true), [tagInputValue.trim()], false);
18163
+
18164
+ setTags(res);
18159
18165
  setValue(tags.filter(Boolean).join(", "));
18166
+ handleValChange && handleValChange(res.filter(Boolean).join(", "));
18160
18167
  } // reset tag input value and focus index
18161
18168
 
18162
18169
 
@@ -18188,6 +18195,7 @@ var InputTag = function InputTag(_a) {
18188
18195
  setEditInputValue("");
18189
18196
  inputRef.current && inputRef.current.focus();
18190
18197
  setdropdownOffset("".concat((_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.offsetLeft, "px"));
18198
+ handleValChange && handleValChange(newArr.filter(Boolean).join(", "));
18191
18199
  } //on backspace
18192
18200
 
18193
18201
 
@@ -18260,10 +18268,13 @@ var InputTag = function InputTag(_a) {
18260
18268
 
18261
18269
  if (e.keyCode === 13) {
18262
18270
  if (focusIndex >= 0) {
18263
- setTags(__spreadArray(__spreadArray([], tags, true), [dropdownArr[focusIndex].value.trim()], false));
18271
+ var res = __spreadArray(__spreadArray([], tags, true), [dropdownArr[focusIndex].value.trim()], false);
18272
+
18273
+ setTags(res);
18264
18274
  setValue(tags.filter(Boolean).join(", "));
18265
18275
  setTagInputValue("");
18266
18276
  setFocusIndex(-1);
18277
+ handleValChange && handleValChange(res.filter(Boolean).join(", "));
18267
18278
  }
18268
18279
  }
18269
18280
  };
@@ -18273,12 +18284,12 @@ var InputTag = function InputTag(_a) {
18273
18284
  return del_index !== index;
18274
18285
  });
18275
18286
  setTags(remainingTags);
18276
- setValue(tags.filter(Boolean).join(", "));
18287
+ handleValChange && handleValChange(remainingTags.filter(Boolean).join(", "));
18288
+ setValue(remainingTags.filter(Boolean).join(", "));
18277
18289
  };
18278
18290
 
18279
18291
  useEffect(function () {
18280
18292
  setValue(tags.filter(Boolean).join(", "));
18281
- handleValChange && handleValChange(tags.filter(Boolean).join(", "));
18282
18293
  }, [tags]);
18283
18294
  useEffect(function () {
18284
18295
  var _a;
@@ -18314,7 +18325,10 @@ var InputTag = function InputTag(_a) {
18314
18325
  newArr[index] = editInputValue.trim();
18315
18326
  setTags(newArr);
18316
18327
  setValue(tags.filter(Boolean).join(", "));
18317
- } else deleteTag("", editIndex);
18328
+ handleValChange && handleValChange(newArr.filter(Boolean).join(", "));
18329
+ } else {
18330
+ deleteTag("", editIndex);
18331
+ }
18318
18332
 
18319
18333
  setEditIndex(-1);
18320
18334
  setEditInputValue("");
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import { TextAreaFieldProps } from "../types";
3
- declare const TextAreaField: ({ label, hint_text_icon, hint_text, errorMsg, inputProps, className, rows, isDynamicHeight, }: TextAreaFieldProps) => JSX.Element;
3
+ declare const TextAreaField: ({ label, hint_text_icon, hint_text, errorMsg, inputProps, className, rows, isDynamicHeight, isFocus, }: TextAreaFieldProps) => JSX.Element;
4
4
  export default TextAreaField;
@@ -120,6 +120,7 @@ export interface TextAreaFieldProps {
120
120
  className?: string;
121
121
  rows?: number;
122
122
  isDynamicHeight?: boolean;
123
+ isFocus?: boolean;
123
124
  }
124
125
  type badgesizeType = "sm" | "md" | "lg";
125
126
  type badgeiconType = "Left" | "Right" | "Only";
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "frontend",
10
10
  "healthplix"
11
11
  ],
12
- "version": "1.0.85",
12
+ "version": "1.0.87",
13
13
  "main": "dist/esm/index.js",
14
14
  "module": "dist/esm/index.js",
15
15
  "types": "dist/esm/index.d.ts",