hplx-react-elements-dev 1.0.52 → 1.0.53

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.
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { DoubleInputProps } from "../types";
3
+ declare const DoubleInput: ({ input1value, input2value, errorMsg, prefix, start_icon, end_icon, hint_text_icon, hint_text, className, suffixClassName, dropdownClassName, suffixDropdownClassName, options, suffixOptions, handleValChange, handleSuffixValChange, onDropdownClick, onSuffixDropdownClick, onlyDropdownItemsAllowed, onlySuffixDropdownItemsAllowed, inputProps, suffixInputProps, }: DoubleInputProps) => JSX.Element;
4
+ export default DoubleInput;
@@ -25,3 +25,4 @@ export { default as AddSuggestion } from "./addSuggestion/AddSuggestion";
25
25
  export { default as MessageToast } from "./messageToast/MessageToast";
26
26
  export { default as NestedDropdown } from "./nestedDropdown/NestedDropdown";
27
27
  export { default as DatePicker } from "./datePicker/DatePicker";
28
+ export { default as DoubleInput } from "./doubleInput/DoubleInput";
package/dist/esm/index.js CHANGED
@@ -17167,4 +17167,290 @@ var DatePicker = function DatePicker(_a) {
17167
17167
  }));
17168
17168
  };
17169
17169
 
17170
- export { AddSuggestion, Avatar, Badge, BadgeGroup, Button, ButtonGroups, Card, Checkbox, CheckboxGroup, CheckboxGroupItem, CollapsibleCard, DatePicker, DropdownField, DropdownItems as DropdownItem, InputField, InputFieldSplit, MessageToast, NestedDropdown, OtpField, ProgressBar, ProgressCircle, RadioBtn, Slider, TextAreaField, ToggleSwitch, Tooltip, Typography };
17170
+ var DoubleInput = function DoubleInput(_a) {
17171
+ var _b = _a.input1value,
17172
+ input1value = _b === void 0 ? "" : _b,
17173
+ _c = _a.input2value,
17174
+ input2value = _c === void 0 ? "" : _c,
17175
+ _d = _a.errorMsg,
17176
+ errorMsg = _d === void 0 ? "" : _d,
17177
+ prefix = _a.prefix,
17178
+ _e = _a.start_icon,
17179
+ start_icon = _e === void 0 ? "" : _e,
17180
+ _f = _a.end_icon,
17181
+ end_icon = _f === void 0 ? "" : _f,
17182
+ _g = _a.hint_text_icon,
17183
+ hint_text_icon = _g === void 0 ? "" : _g,
17184
+ hint_text = _a.hint_text,
17185
+ className = _a.className,
17186
+ suffixClassName = _a.suffixClassName,
17187
+ dropdownClassName = _a.dropdownClassName,
17188
+ suffixDropdownClassName = _a.suffixDropdownClassName,
17189
+ _h = _a.options,
17190
+ options = _h === void 0 ? [] : _h,
17191
+ _j = _a.suffixOptions,
17192
+ suffixOptions = _j === void 0 ? [] : _j,
17193
+ _k = _a.handleValChange,
17194
+ handleValChange = _k === void 0 ? function (_) {} : _k,
17195
+ _l = _a.handleSuffixValChange,
17196
+ handleSuffixValChange = _l === void 0 ? function (_) {} : _l,
17197
+ _m = _a.onDropdownClick,
17198
+ onDropdownClick = _m === void 0 ? function (_) {} : _m,
17199
+ _o = _a.onSuffixDropdownClick,
17200
+ onSuffixDropdownClick = _o === void 0 ? function (_) {} : _o,
17201
+ _p = _a.onlyDropdownItemsAllowed,
17202
+ onlyDropdownItemsAllowed = _p === void 0 ? false : _p,
17203
+ _q = _a.onlySuffixDropdownItemsAllowed,
17204
+ onlySuffixDropdownItemsAllowed = _q === void 0 ? true : _q,
17205
+ inputProps = _a.inputProps,
17206
+ suffixInputProps = _a.suffixInputProps;
17207
+
17208
+ var _r = inputProps || {},
17209
+ disabled = _r.disabled,
17210
+ onFocus = _r.onFocus,
17211
+ onBlur = _r.onBlur;
17212
+
17213
+ var _s = useState(""),
17214
+ value = _s[0],
17215
+ setValue = _s[1];
17216
+
17217
+ var _t = useState(""),
17218
+ suffixValue = _t[0],
17219
+ setSuffixValue = _t[1];
17220
+
17221
+ var _u = useState(true),
17222
+ showDropdown = _u[0],
17223
+ setShowDropdown = _u[1];
17224
+
17225
+ var _v = useState(false),
17226
+ showSuffixDropdown = _v[0],
17227
+ setShowSuffixDropdown = _v[1];
17228
+
17229
+ var _w = useState(),
17230
+ dropdownArr = _w[0],
17231
+ setDropdownArr = _w[1];
17232
+
17233
+ var _x = useState(),
17234
+ suffixDropdownArr = _x[0],
17235
+ setSuffixDropdownArr = _x[1];
17236
+
17237
+ var wrapperRef = useRef(null);
17238
+ var suffixWrapperRef = useRef(null);
17239
+
17240
+ var _y = useState(false),
17241
+ valueChanged = _y[0],
17242
+ setValueChanged = _y[1];
17243
+
17244
+ var _z = useState(false),
17245
+ suffixValueChanged = _z[0],
17246
+ setSuffixValueChanged = _z[1];
17247
+
17248
+ var _0 = useState(false),
17249
+ active = _0[0],
17250
+ setActive = _0[1];
17251
+
17252
+ var _1 = useState(false),
17253
+ suffixActive = _1[0],
17254
+ setSuffixActive = _1[1];
17255
+
17256
+ var handleFocus = function handleFocus(event) {
17257
+ setActive(true);
17258
+ setShowDropdown(true);
17259
+ onFocus && onFocus(event);
17260
+ };
17261
+
17262
+ var handleBlur = function handleBlur(event) {
17263
+ setActive(false);
17264
+ setShowDropdown(false);
17265
+ onBlur && onBlur(event);
17266
+ };
17267
+
17268
+ var handleClickOutside = function handleClickOutside(e) {
17269
+ if (wrapperRef.current && !wrapperRef.current.contains(e.target)) {
17270
+ !active && valueChanged && onlyDropdownItemsAllowed && setValue("");
17271
+ setShowDropdown(false);
17272
+ }
17273
+
17274
+ if (suffixWrapperRef.current && !suffixWrapperRef.current.contains(e.target)) {
17275
+ !suffixActive && suffixValueChanged && onlySuffixDropdownItemsAllowed && setSuffixValue("");
17276
+ setShowSuffixDropdown(false);
17277
+ }
17278
+ };
17279
+
17280
+ var handleValueChange = function handleValueChange(e) {
17281
+ setValueChanged(true);
17282
+ var sug = dropdownArr || [];
17283
+ setShowDropdown(true);
17284
+
17285
+ if (options && options.length > 0) {
17286
+ sug = options === null || options === void 0 ? void 0 : options.filter(function (options) {
17287
+ return options.label.toLowerCase().includes(e.target.value.toLowerCase());
17288
+ });
17289
+ setDropdownArr(sug);
17290
+ } // if (sug.length === 0 || e.target.value.length === 0) {
17291
+
17292
+
17293
+ handleValChange && handleValChange(e.target.value); // }
17294
+
17295
+ setValue(e.target.value);
17296
+ };
17297
+
17298
+ var handleSuffixValueChange = function handleSuffixValueChange(e) {
17299
+ setSuffixValueChanged(true);
17300
+ var sug = suffixDropdownArr || [];
17301
+ setShowSuffixDropdown(true);
17302
+
17303
+ if (suffixOptions && suffixOptions.length > 0) {
17304
+ sug = suffixOptions === null || suffixOptions === void 0 ? void 0 : suffixOptions.filter(function (suffixOption) {
17305
+ return suffixOption.label.toLowerCase().includes(e.target.value.toLowerCase());
17306
+ });
17307
+ setSuffixDropdownArr(sug);
17308
+ } // if (sug.length === 0 || e.target.value.length === 0) {
17309
+
17310
+
17311
+ handleSuffixValChange && handleSuffixValChange(e.target.value); // }
17312
+
17313
+ setSuffixValue(e.target.value);
17314
+ };
17315
+
17316
+ var handleDropdownClick = function handleDropdownClick(selectedItem) {
17317
+ setSuffixValueChanged(false);
17318
+ setValue(selectedItem.value);
17319
+ onDropdownClick && onDropdownClick(selectedItem);
17320
+ setShowDropdown(false);
17321
+ };
17322
+
17323
+ var handleSuffixDropdownClick = function handleSuffixDropdownClick(selectedItem) {
17324
+ setSuffixValueChanged(false);
17325
+ setSuffixValue(selectedItem.value);
17326
+ onSuffixDropdownClick && onSuffixDropdownClick(selectedItem);
17327
+ setShowSuffixDropdown(false);
17328
+ };
17329
+
17330
+ useEffect(function () {
17331
+ document.addEventListener("mousedown", handleClickOutside);
17332
+ return function () {
17333
+ document.removeEventListener("mousedown", handleClickOutside);
17334
+ };
17335
+ });
17336
+ useEffect(function () {
17337
+ setValue(input1value);
17338
+ }, [input1value]);
17339
+ useEffect(function () {
17340
+ setSuffixValue(input2value);
17341
+ }, [input2value]);
17342
+ return jsxRuntime.exports.jsx("div", __assign({
17343
+ className: "inputfield hplxt-flex "
17344
+ }, {
17345
+ children: jsxRuntime.exports.jsxs(Typography, __assign({
17346
+ variant: "Regular",
17347
+ type: "Text md"
17348
+ }, {
17349
+ children: [jsxRuntime.exports.jsxs("div", __assign({
17350
+ "data-setid": "error-msg",
17351
+ className: "hplxt-flex hplxt-shadow-xs hplxt-border-1 hplxt-border-Blue_gray-100 hplxt-rounded-lg hover:hplxt-border-Primary-300 hover:hplxt-shadow-xs-primary\n hplxt-overflow-hidden placeholder:hplxt-text-Gray-500 hplxt-bg-White hplxt-h-10\n ".concat(errorMsg ? "hplxt-border-Error-300" : '', " \n ").concat(disabled ? "hplxt-bg-Gray-50" : "".concat("hplxt-bg-White", " \n ").concat(errorMsg ? "hover:hplxt-shadow-xs-error" : "hover:hplxt-border-Primary-300 hover:hplxt-shadow-xs-primary "))
17352
+ }, {
17353
+ children: [Boolean(prefix) && jsxRuntime.exports.jsx("div", __assign({
17354
+ "data-testid": "input-prefix",
17355
+ className: "hplxt-bg-Gray-50 hplxt-border-r-1 hplxt-border-r-Gray-300 hplxt-text-Gray-500 hplxt-flex hplxt-items-center hplxt-px-3"
17356
+ }, {
17357
+ children: jsxRuntime.exports.jsx(Typography, __assign({
17358
+ type: "Text md",
17359
+ variant: "Regular"
17360
+ }, {
17361
+ children: prefix
17362
+ }))
17363
+ })), Boolean(start_icon) && jsxRuntime.exports.jsx("div", __assign({
17364
+ className: "hplxt-text-Gray-500 hplxt-flex hplxt-items-center hplxt-pl-2"
17365
+ }, {
17366
+ children: jsxRuntime.exports.jsx("span", {
17367
+ className: start_icon
17368
+ })
17369
+ })), jsxRuntime.exports.jsx("input", __assign({
17370
+ type: "text",
17371
+ className: "hplxt-flex-1 hplxt-pl-[14px] placeholder:hplxt-text-Indigo-500 placeholder:hplxt-opacity-50 hplxt-pr-[12px] hplxt-py-1 focus-visible:hplxt-outline-0 hplxt-border-0 focus:hplxt-border-0 ".concat(className),
17372
+ value: value,
17373
+ onChange: function onChange(e) {
17374
+ return handleValueChange(e);
17375
+ }
17376
+ }, inputProps, {
17377
+ onFocus: handleFocus,
17378
+ onBlur: handleBlur
17379
+ })), jsxRuntime.exports.jsx("input", __assign({
17380
+ type: "text",
17381
+ className: "hplxt-flex-1 hplxt-border-l-1 hplxt-border-Blue_gray-100 hplxt-pl-[14px] focus-visible:hplxt-outline-0 hplxt-bg-Gray-50 ".concat(suffixClassName),
17382
+ value: suffixValue,
17383
+ onChange: function onChange(e) {
17384
+ return handleSuffixValueChange(e);
17385
+ },
17386
+ onFocus: function onFocus() {
17387
+ setSuffixActive(true);
17388
+ setShowSuffixDropdown(true);
17389
+ },
17390
+ onBlur: function onBlur() {
17391
+ setSuffixActive(false);
17392
+ setShowSuffixDropdown(false);
17393
+ }
17394
+ }, suffixInputProps)), Boolean(end_icon) && jsxRuntime.exports.jsx("div", __assign({
17395
+ className: "hplxt-text-Gray-500 hplxt-bg-Gray-50 hplxt-flex hplxt-items-center hplxt-pr-2",
17396
+ onClick: function onClick() {
17397
+ return setShowSuffixDropdown(true);
17398
+ }
17399
+ }, {
17400
+ children: jsxRuntime.exports.jsx("span", {
17401
+ className: end_icon
17402
+ })
17403
+ }))]
17404
+ })), (Boolean(hint_text) || Boolean(errorMsg)) && jsxRuntime.exports.jsx("div", __assign({
17405
+ className: "".concat(errorMsg ? "hplxt-text-Error-500" : "hplxt-text-Gray-500 hplxt-mt-1")
17406
+ }, {
17407
+ children: jsxRuntime.exports.jsx(Typography, __assign({
17408
+ type: "Text sm",
17409
+ variant: "Regular"
17410
+ }, {
17411
+ children: errorMsg ? String(errorMsg) : jsxRuntime.exports.jsxs(jsxRuntime.exports.Fragment, {
17412
+ children: [Boolean(hint_text_icon) && jsxRuntime.exports.jsx("span", {
17413
+ className: hint_text_icon
17414
+ }), hint_text]
17415
+ })
17416
+ }))
17417
+ })), showDropdown && jsxRuntime.exports.jsx("div", __assign({
17418
+ ref: wrapperRef,
17419
+ className: "hplxt-absolute hplxt-border hplxt-border-Gray-300 hplxt-mt-1 hplxt-min-w-max hplxt-rounded-lg hplxt-bg-Indigo-25 hplxt-overflow-y-auto hplxt-shadow-md hplxt-z-10 hplxt-max-h-80 ".concat(dropdownClassName)
17420
+ }, {
17421
+ children: dropdownArr && dropdownArr.length > 0 && jsxRuntime.exports.jsx("div", {
17422
+ children: dropdownArr.map(function (option) {
17423
+ var restOptions = __rest(option || {}, []);
17424
+
17425
+ return jsxRuntime.exports.jsx(DropdownItems, __assign({
17426
+ className: "hplxt-text-Primary-700"
17427
+ }, restOptions, {
17428
+ onSelect: function onSelect() {
17429
+ return handleDropdownClick(restOptions);
17430
+ }
17431
+ }));
17432
+ })
17433
+ })
17434
+ })), showSuffixDropdown && jsxRuntime.exports.jsx("div", __assign({
17435
+ ref: suffixWrapperRef,
17436
+ className: "hplxt-absolute hplxt-border hplxt-border-Gray-300 hplxt-mt-1 hplxt-min-w-max hplxt-rounded-lg hplxt-bg-Indigo-25 hplxt-overflow-y-auto hplxt-shadow-md hplxt-z-10 hplxt-max-h-80 ".concat(suffixDropdownClassName)
17437
+ }, {
17438
+ children: suffixDropdownArr && suffixDropdownArr.length > 0 && jsxRuntime.exports.jsx("div", {
17439
+ children: suffixDropdownArr.map(function (option) {
17440
+ var restOptions = __rest(option || {}, []);
17441
+
17442
+ return jsxRuntime.exports.jsx(DropdownItems, __assign({
17443
+ className: "hplxt-text-Primary-700"
17444
+ }, restOptions, {
17445
+ onSelect: function onSelect() {
17446
+ return handleSuffixDropdownClick(restOptions);
17447
+ }
17448
+ }));
17449
+ })
17450
+ })
17451
+ }))]
17452
+ }))
17453
+ }));
17454
+ };
17455
+
17456
+ export { AddSuggestion, Avatar, Badge, BadgeGroup, Button, ButtonGroups, Card, Checkbox, CheckboxGroup, CheckboxGroupItem, CollapsibleCard, DatePicker, DoubleInput, DropdownField, DropdownItems as DropdownItem, InputField, InputFieldSplit, MessageToast, NestedDropdown, OtpField, ProgressBar, ProgressCircle, RadioBtn, Slider, TextAreaField, ToggleSwitch, Tooltip, Typography };
@@ -391,4 +391,28 @@ export interface AddSuggestionProps {
391
391
  handleSuffixValChange?: (value: any) => void;
392
392
  isborderRequired?: boolean;
393
393
  }
394
+ export interface DoubleInputProps {
395
+ prefix?: ReactNode;
396
+ start_icon?: string;
397
+ end_icon?: string;
398
+ errorMsg?: string;
399
+ inputProps?: React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
400
+ suffixInputProps?: React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
401
+ className?: string;
402
+ suffixClassName?: string;
403
+ options?: Array<DropdownItemsProps>;
404
+ suffixOptions?: Array<DropdownItemsProps>;
405
+ handleValChange?: (value: any) => void;
406
+ handleSuffixValChange?: (value: any) => void;
407
+ onDropdownClick?: (value: any) => void;
408
+ onSuffixDropdownClick?: (value: any) => void;
409
+ dropdownClassName?: string;
410
+ suffixDropdownClassName?: string;
411
+ input1value?: string;
412
+ input2value?: string;
413
+ onlySuffixDropdownItemsAllowed?: boolean;
414
+ onlyDropdownItemsAllowed?: boolean;
415
+ hint_text_icon?: string;
416
+ hint_text?: string;
417
+ }
394
418
  export {};
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "frontend",
10
10
  "healthplix"
11
11
  ],
12
- "version": "1.0.52",
12
+ "version": "1.0.53",
13
13
  "main": "dist/esm/index.js",
14
14
  "module": "dist/esm/index.js",
15
15
  "types": "dist/esm/index.d.ts",