hplx-react-elements-dev 1.0.14 → 1.0.15

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.
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import { AddSuggestionProps } from "../types";
3
- declare const AddSuggestion: ({ label, hint_text_icon, hint_text, errorMsg, inputProps, options }: AddSuggestionProps) => JSX.Element;
3
+ declare const AddSuggestion: ({ isInputField, label, start_icon, end_icon, prefix, suffixButton, suffix, char_count, onSuggestionClick, height, hint_text_icon, hint_text, errorMsg, inputProps, inputFieldInputProps, options }: AddSuggestionProps) => JSX.Element;
4
4
  export default AddSuggestion;
@@ -2,13 +2,14 @@ import { __assign, __rest } from "tslib";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useState, useRef, useEffect } from "react";
4
4
  import DropdownItem from "../dropdownField/DropdownItem";
5
+ import InputField from "../inputField/InputField";
5
6
  import TextAreaField from "../textAreaField/TextAreaField";
6
7
  var AddSuggestion = function (_a) {
7
- var label = _a.label, _b = _a.hint_text_icon, hint_text_icon = _b === void 0 ? "" : _b, hint_text = _a.hint_text, _c = _a.errorMsg, errorMsg = _c === void 0 ? "" : _c, inputProps = _a.inputProps, options = _a.options;
8
- var _d = useState(""), value = _d[0], setValue = _d[1];
9
- var _e = useState(false), showDropdown = _e[0], setShowDropdown = _e[1];
8
+ var _b = _a.isInputField, isInputField = _b === void 0 ? false : _b, label = _a.label, _c = _a.start_icon, start_icon = _c === void 0 ? "" : _c, _d = _a.end_icon, end_icon = _d === void 0 ? "" : _d, prefix = _a.prefix, suffixButton = _a.suffixButton, suffix = _a.suffix, char_count = _a.char_count, _e = _a.onSuggestionClick, onSuggestionClick = _e === void 0 ? function () { } : _e, _f = _a.height, height = _f === void 0 ? 'h-32' : _f, _g = _a.hint_text_icon, hint_text_icon = _g === void 0 ? "" : _g, hint_text = _a.hint_text, _h = _a.errorMsg, errorMsg = _h === void 0 ? "" : _h, inputProps = _a.inputProps, inputFieldInputProps = _a.inputFieldInputProps, options = _a.options;
9
+ var _j = useState(inputProps && typeof (inputProps.value) === "string" ? inputProps.value : ""), value = _j[0], setValue = _j[1];
10
+ var _k = useState(false), showDropdown = _k[0], setShowDropdown = _k[1];
10
11
  var wrapperRef = useRef(null);
11
- var _f = useState(), suggestionArr = _f[0], setSuggestionArr = _f[1];
12
+ var _l = useState(), suggestionArr = _l[0], setSuggestionArr = _l[1];
12
13
  var changeHandler = function (e) {
13
14
  if (options && options.length > 0) {
14
15
  var sug = options.filter(function (options) {
@@ -38,6 +39,7 @@ var AddSuggestion = function (_a) {
38
39
  res = selectedValue;
39
40
  }
40
41
  setValue(res);
42
+ onSuggestionClick();
41
43
  };
42
44
  // Attaching the previous event with UseEffect hook
43
45
  useEffect(function () {
@@ -48,7 +50,10 @@ var AddSuggestion = function (_a) {
48
50
  document.removeEventListener("mousedown", handleClickOutside);
49
51
  };
50
52
  });
51
- return (_jsxs("div", __assign({ className: "input__wrapper relative" }, { children: [_jsx(TextAreaField, { label: label, hint_text: hint_text, hint_text_icon: hint_text_icon, errorMsg: errorMsg, inputProps: __assign(__assign({}, inputProps), { onChange: changeHandler, value: value, onFocus: function () { return setShowDropdown(true); } }) }), showDropdown && (_jsx("div", __assign({ ref: wrapperRef, className: "absolute mt-1 min-w-max rounded-lg bg-White overflow-y-auto shadow-md z-10 max-h-80 " }, { children: suggestionArr && suggestionArr.length > 0 && (_jsx("div", { children: (suggestionArr === null || suggestionArr === void 0 ? void 0 : suggestionArr.constructor) === Array && suggestionArr.length
53
+ return (_jsxs("div", __assign({ className: "input__wrapper relative" }, { children: [isInputField ?
54
+ _jsx(InputField, { label: label, start_icon: start_icon, end_icon: end_icon, prefix: prefix, suffixButton: suffixButton, suffix: suffix, char_count: char_count, hint_text: hint_text, hint_text_icon: hint_text_icon, errorMsg: errorMsg, inputProps: __assign(__assign({}, inputFieldInputProps), { onChange: changeHandler, value: value, onFocus: function () { return setShowDropdown(true); } }) })
55
+ :
56
+ _jsx(TextAreaField, { label: label, hint_text: hint_text, hint_text_icon: hint_text_icon, errorMsg: errorMsg, height: height, inputProps: __assign(__assign({}, inputProps), { onChange: changeHandler, value: value, onFocus: function () { return setShowDropdown(true); } }) }), showDropdown && (_jsx("div", __assign({ ref: wrapperRef, className: "absolute mt-1 min-w-max rounded-lg bg-White overflow-y-auto shadow-md z-10 max-h-80 " }, { children: suggestionArr && suggestionArr.length > 0 && (_jsx("div", { children: (suggestionArr === null || suggestionArr === void 0 ? void 0 : suggestionArr.constructor) === Array && suggestionArr.length
52
57
  ? suggestionArr.map(function (option) {
53
58
  var restOptions = __rest(option || {}, []);
54
59
  return (_jsx(DropdownItem, __assign({ className: "text-Primary-700" }, restOptions, { onSelect: function () {
@@ -1 +1 @@
1
- {"version":3,"file":"AddSuggestion.js","sourceRoot":"","sources":["../../../../src/components/addSuggestion/AddSuggestion.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,YAAY,MAAM,+BAA+B,CAAC;AACzD,OAAO,aAAa,MAAM,gCAAgC,CAAC;AAG3D,IAAM,aAAa,GAAG,UAAC,EAKQ;QALN,KAAK,WAAA,EAC5B,sBAAmB,EAAnB,cAAc,mBAAG,EAAE,KAAA,EACnB,SAAS,eAAA,EACT,gBAAa,EAAb,QAAQ,mBAAG,EAAE,KAAA,EACb,UAAU,gBAAA,EACV,OAAO,aAAA;IACD,IAAA,KAAoB,QAAQ,CAAC,EAAE,CAAC,EAA/B,KAAK,QAAA,EAAE,QAAQ,QAAgB,CAAC;IACjC,IAAA,KAAkC,QAAQ,CAAC,KAAK,CAAC,EAAhD,YAAY,QAAA,EAAE,eAAe,QAAmB,CAAC;IACxD,IAAM,UAAU,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAC1C,IAAA,KAAoC,QAAQ,EAAwB,EAAnE,aAAa,QAAA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AK,MAAM,IAAI,EAAE,EAAjC,EAAkB,CAAe,CAAC;4BACxC,OAAO,CACL,KAAC,YAAY,aACX,SAAS,EAAC,kBAAkB,IACxB,WAAW,IACf,QAAQ,EAAE;oCACR,OAAA,qBAAqB,CAAC,WAAW,CAAC,KAAK,CAAC;gCAAxC,CAAwC,IAE1C,CACH,CAAC;wBACJ,CAAC,CAAC;wBACJ,CAAC,CAAC,IAAI,GACJ,CACP,IACG,CACP,KACG,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -285,10 +285,20 @@ export interface NestedDropdownItemsProps {
285
285
  }
286
286
  export interface AddSuggestionProps {
287
287
  label?: string;
288
+ isInputField?: boolean;
289
+ height?: string;
290
+ prefix?: ReactNode;
291
+ suffixButton?: ReactNode;
292
+ suffix?: ReactNode;
293
+ start_icon?: string;
294
+ end_icon?: string;
288
295
  hint_text?: string;
289
296
  hint_text_icon?: string;
297
+ char_count?: string;
290
298
  errorMsg?: string;
291
299
  inputProps?: React.DetailedHTMLProps<React.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>;
300
+ inputFieldInputProps?: React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
301
+ onSuggestionClick?: () => void;
292
302
  options?: Array<DropdownItemsProps>;
293
303
  }
294
304
  export {};
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "frontend",
10
10
  "healthplix"
11
11
  ],
12
- "version": "1.0.14",
12
+ "version": "1.0.15",
13
13
  "main": "dist/esm/components/index.js",
14
14
  "module": "dist/esm/components/index.d.ts",
15
15
  "files": [