hplx-react-elements-dev 1.0.34 → 1.0.36

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: ({ isInputField, label, labelColor, labelSize, start_icon, end_icon, prefix, suffixButton, suffix, suffixDropdown, isSuffixEditable, suffixPlaceholder, handleSuggestionValChange, handleSuffixValChange, handleSuffixClick, char_count, onSuggestionClick, height, hint_text_icon, hint_text, errorMsg, inputProps, inputFieldInputProps, options, suggestionValue, isborderRequired, }: AddSuggestionProps) => JSX.Element;
3
+ declare const AddSuggestion: ({ isInputField, label, labelColor, labelSize, start_icon, end_icon, prefix, suffixButton, suffix, suffixDropdown, isSuffixEditable, suffixInputProps, suffixPlaceholder, handleSuggestionValChange, handleSuffixValChange, handleSuffixClick, char_count, onSuggestionClick, height, hint_text_icon, hint_text, errorMsg, inputProps, inputFieldInputProps, options, suggestionValue, isborderRequired, }: AddSuggestionProps) => JSX.Element;
4
4
  export default AddSuggestion;
@@ -9,6 +9,7 @@ export interface DatePickerProps {
9
9
  isborderRequired?: boolean;
10
10
  minDate?: Date;
11
11
  maxDate?: Date;
12
+ fieldColor?: string;
12
13
  }
13
- declare const DatePicker: ({ disabledDates, selectDate, dateVar, minDate, maxDate, isborderRequired, }: DatePickerProps) => JSX.Element;
14
+ declare const DatePicker: ({ disabledDates, selectDate, dateVar, minDate, maxDate, fieldColor, isborderRequired, }: DatePickerProps) => JSX.Element;
14
15
  export default DatePicker;
package/dist/esm/index.js CHANGED
@@ -2126,31 +2126,30 @@ var InputField = function InputField(_a) {
2126
2126
  _g = _a.isSuffixEditable,
2127
2127
  isSuffixEditable = _g === void 0 ? false : _g,
2128
2128
  suffixPlaceholder = _a.suffixPlaceholder,
2129
+ fieldColor = _a.fieldColor,
2129
2130
  _h = _a.handleSuffixClick,
2130
- handleSuffixClick = _h === void 0 ? function (_) {} : _h,
2131
- _j = _a.handleSuffixValChange,
2132
- handleSuffixValChange = _j === void 0 ? function (_) {} : _j;
2131
+ handleSuffixClick = _h === void 0 ? function (_) {} : _h;
2133
2132
 
2134
- var _k = inputProps || {},
2135
- disabled = _k.disabled,
2136
- onFocus = _k.onFocus,
2137
- onBlur = _k.onBlur;
2133
+ var _j = inputProps || {},
2134
+ disabled = _j.disabled,
2135
+ onFocus = _j.onFocus,
2136
+ onBlur = _j.onBlur;
2138
2137
 
2139
- var _l = useState(false),
2140
- active = _l[0],
2141
- setActive = _l[1];
2138
+ var _k = useState(false),
2139
+ active = _k[0],
2140
+ setActive = _k[1];
2142
2141
 
2143
- var _m = useState(false),
2144
- showSuffixDropdown = _m[0],
2145
- setShowSuffixDropdown = _m[1];
2142
+ var _l = useState(false),
2143
+ showSuffixDropdown = _l[0],
2144
+ setShowSuffixDropdown = _l[1];
2146
2145
 
2147
- var _o = useState(""),
2148
- suffixValue = _o[0],
2149
- setSuffixValue = _o[1];
2146
+ var _m = useState(""),
2147
+ suffixValue = _m[0],
2148
+ setSuffixValue = _m[1];
2150
2149
 
2151
- var _p = useState([]),
2152
- suffixFilterList = _p[0],
2153
- setSuffixFilterList = _p[1];
2150
+ var _o = useState([]),
2151
+ suffixFilterList = _o[0],
2152
+ setSuffixFilterList = _o[1];
2154
2153
 
2155
2154
  var wrapperRef = useRef(null);
2156
2155
  useEffect(function () {
@@ -2179,13 +2178,13 @@ var InputField = function InputField(_a) {
2179
2178
  setSuffixFilterList(sug);
2180
2179
  }
2181
2180
 
2182
- setSuffixValue && setSuffixValue(e.target.value);
2183
- handleSuffixValChange(e.target.value);
2181
+ setSuffixValue && setSuffixValue(e.target.value); // handleSuffixValChange(e.target.value);
2184
2182
  };
2185
2183
 
2186
2184
  var handleClickOutside = function handleClickOutside(e) {
2187
2185
  if (wrapperRef.current && !wrapperRef.current.contains(e.target)) {
2188
2186
  setShowSuffixDropdown(false);
2187
+ setSuffixValue("");
2189
2188
  }
2190
2189
  };
2191
2190
 
@@ -2199,7 +2198,7 @@ var InputField = function InputField(_a) {
2199
2198
  }); // console.log("Input Field",suffixDropdown)
2200
2199
 
2201
2200
  return jsxRuntime.exports.jsxs("div", __assign({
2202
- className: "inputfield "
2201
+ className: "inputfield "
2203
2202
  }, {
2204
2203
  children: [jsxRuntime.exports.jsxs("div", __assign({
2205
2204
  className: "flex justify-between"
@@ -2229,11 +2228,11 @@ var InputField = function InputField(_a) {
2229
2228
  }, {
2230
2229
  children: jsxRuntime.exports.jsxs("div", __assign({
2231
2230
  "data-setid": "error-msg",
2232
- className: "flex ".concat(isborderRequired ? "border-1 shadow-xs rounded-lg" : "", " overflow-hidden placeholder:text-Gray-500 ").concat(errorMsg ? "border-Error-300" : "border-Gray-300", " ").concat(height ? height : "h-10", " ").concat(disabled ? "bg-Gray-50" : "bg-White ".concat(errorMsg ? "hover:shadow-xs-error ".concat(active && "shadow-xs-error") : " ".concat(isborderRequired ? "hover:border-Primary-300 hover:shadow-xs-primary ".concat(active && "border-Primary-300 shadow-xs-primary") : " ")))
2231
+ className: "flex ".concat(isborderRequired ? "border-1 shadow-xs rounded-lg" : "", " overflow-hidden placeholder:text-Gray-500 ").concat(errorMsg ? "border-Error-300" : "border-Gray-300", " ").concat(height ? height : "h-10", " ").concat(disabled ? "bg-Gray-50" : "".concat(fieldColor ? fieldColor : "bg-White", " ").concat(errorMsg ? "hover:shadow-xs-error ".concat(active && "shadow-xs-error") : " ".concat(isborderRequired ? "hover:border-Primary-300 hover:shadow-xs-primary ".concat(active && "border-Primary-300 shadow-xs-primary") : " ")))
2233
2232
  }, {
2234
2233
  children: [Boolean(prefix) && jsxRuntime.exports.jsx("div", __assign({
2235
2234
  "data-testid": "input-prefix",
2236
- className: "bg-Gray-50 border-r-1 border-r-Gray-300 text-Gray-500 flex items-center px-3"
2235
+ className: "".concat(fieldColor ? fieldColor : "bg-Gray-50", " border-r-1 border-r-Gray-300 text-Gray-500 flex items-center px-3")
2237
2236
  }, {
2238
2237
  children: jsxRuntime.exports.jsx(Typography, __assign({
2239
2238
  type: "Text md",
@@ -2249,7 +2248,10 @@ var InputField = function InputField(_a) {
2249
2248
  })
2250
2249
  })), jsxRuntime.exports.jsx("input", __assign({
2251
2250
  type: "text",
2252
- className: "flex-1 pl-[14px] pr-[12px] py-1 focus-visible:outline-0 border-0 focus:border-0",
2251
+ style: {
2252
+ background: "".concat(fieldColor === null || fieldColor === void 0 ? void 0 : fieldColor.split("-")[1])
2253
+ },
2254
+ className: "flex-1 pl-[14px] ".concat(fieldColor, " pr-[12px] py-1 focus-visible:outline-0 border-0 focus:border-0"),
2253
2255
  "data-testid": "text-input"
2254
2256
  }, inputProps, {
2255
2257
  onFocus: handleFocus,
@@ -2262,7 +2264,7 @@ var InputField = function InputField(_a) {
2262
2264
  })
2263
2265
  })), Boolean(suffix) && !isSuffixEditable && jsxRuntime.exports.jsx("div", __assign({
2264
2266
  "data-testid": "input-suffix",
2265
- className: "bg-Gray-50 border-l-1 border-l-Gray-300 text-Gray-500 flex items-center pr-3 pl-[14px]",
2267
+ className: "".concat(fieldColor ? fieldColor : "bg-Gray-50", " border-l-1 border-l-Gray-300 text-Gray-500 flex items-center pr-3 pl-[14px]"),
2266
2268
  onClick: function onClick() {
2267
2269
  return setShowSuffixDropdown(true);
2268
2270
  }
@@ -2276,7 +2278,7 @@ var InputField = function InputField(_a) {
2276
2278
  })), isSuffixEditable && jsxRuntime.exports.jsxs("div", {
2277
2279
  children: [jsxRuntime.exports.jsx("div", __assign({
2278
2280
  "data-testid": "input-suffix",
2279
- className: "bg-Gray-50 border-l-1 border-l-Gray-300 text-Gray-500 flex items-center pr-3 pl-[14px]",
2281
+ className: "".concat(fieldColor ? fieldColor : "bg-Gray-50", " bg-none border-l-1 border-l-Gray-300 text-Gray-500 flex items-center pr-3 pl-[14px]"),
2280
2282
  onClick: function onClick() {
2281
2283
  return setShowSuffixDropdown(true);
2282
2284
  }
@@ -2294,20 +2296,19 @@ var InputField = function InputField(_a) {
2294
2296
  }))
2295
2297
  })), showSuffixDropdown && jsxRuntime.exports.jsx("div", __assign({
2296
2298
  ref: wrapperRef,
2297
- className: "absolute mt-1 min-w-max rounded-lg bg-White overflow-y-auto shadow-md z-10 max-h-80 "
2299
+ className: "absolute mt-1 min-w-max rounded-lg ".concat(fieldColor ? fieldColor : "bg-White", " overflow-y-auto shadow-md z-10 max-h-80 ")
2298
2300
  }, {
2299
2301
  children: suffixFilterList && suffixFilterList.length > 0 && jsxRuntime.exports.jsx("div", {
2300
2302
  children: (suffixFilterList === null || suffixFilterList === void 0 ? void 0 : suffixFilterList.constructor) === Array && suffixFilterList.length ? suffixFilterList.map(function (option) {
2301
- var restOptions = __rest(option || {}, []);
2302
-
2303
+ // const { ...restOptions } = option || {}
2303
2304
  return jsxRuntime.exports.jsx(DropdownItems, __assign({
2304
- label: option["label"],
2305
2305
  className: "text-Primary-700"
2306
- }, restOptions, {
2306
+ }, option, {
2307
+ label: option["label"],
2307
2308
  onSelect: function onSelect() {
2308
- setSuffixValue(restOptions.label);
2309
+ setSuffixValue(option.label);
2309
2310
  setShowSuffixDropdown(false);
2310
- handleSuffixClick(restOptions);
2311
+ handleSuffixClick(option);
2311
2312
  }
2312
2313
  }));
2313
2314
  }) : null
@@ -5190,6 +5191,7 @@ var AddSuggestion = function AddSuggestion(_a) {
5190
5191
  suffixDropdown = _e === void 0 ? [] : _e,
5191
5192
  _f = _a.isSuffixEditable,
5192
5193
  isSuffixEditable = _f === void 0 ? false : _f,
5194
+ suffixInputProps = _a.suffixInputProps,
5193
5195
  _g = _a.suffixPlaceholder,
5194
5196
  suffixPlaceholder = _g === void 0 ? "" : _g,
5195
5197
  _h = _a.handleSuggestionValChange,
@@ -5304,6 +5306,7 @@ var AddSuggestion = function AddSuggestion(_a) {
5304
5306
  suffixPlaceholder: suffixPlaceholder,
5305
5307
  isborderRequired: isborderRequired,
5306
5308
  isSuffixEditable: isSuffixEditable,
5309
+ suffixInputProps: suffixInputProps,
5307
5310
  inputProps: __assign(__assign({}, inputFieldInputProps), {
5308
5311
  onChange: changeHandler,
5309
5312
  value: suggestionValue
@@ -16882,6 +16885,7 @@ var DatePicker = function DatePicker(_a) {
16882
16885
  dateVar = _a.dateVar,
16883
16886
  minDate = _a.minDate,
16884
16887
  maxDate = _a.maxDate,
16888
+ fieldColor = _a.fieldColor,
16885
16889
  _c = _a.isborderRequired,
16886
16890
  isborderRequired = _c === void 0 ? true : _c;
16887
16891
 
@@ -16918,22 +16922,23 @@ var DatePicker = function DatePicker(_a) {
16918
16922
  };
16919
16923
  }, [clicked]);
16920
16924
  return jsxRuntime.exports.jsxs("div", __assign({
16921
- className: " px-[14px] py-[10px]"
16925
+ className: ""
16922
16926
  }, {
16923
16927
  children: [jsxRuntime.exports.jsx("div", __assign({
16924
16928
  className: "relative w-[189px]"
16925
16929
  }, {
16926
16930
  children: jsxRuntime.exports.jsx(InputField, {
16927
16931
  isborderRequired: isborderRequired,
16928
- start_icon: "hx_calendar",
16932
+ start_icon: "hx_calendar text-4",
16929
16933
  inputProps: {
16930
16934
  placeholder: "Select date",
16931
16935
  onClick: inputClick,
16932
16936
  value: date ? dayjs(date).format("MMM DD, YYYY") : selectDate === null || selectDate === void 0 ? void 0 : selectDate.toString()
16933
- }
16937
+ },
16938
+ fieldColor: fieldColor
16934
16939
  })
16935
16940
  })), jsxRuntime.exports.jsx("div", __assign({
16936
- className: "absolute mt-1 z-10 "
16941
+ className: "absolute mt-1 z-10"
16937
16942
  }, {
16938
16943
  children: clicked ? jsxRuntime.exports.jsx(dist.Calendar, {
16939
16944
  date: dayjs(date).isValid() ? date : new Date(),
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import { InputFieldProps } from "../types";
3
- declare const InputField: ({ label, labelColor, labelSize, height, start_icon, end_icon, hint_text_icon, prefix, suffixButton, suffix, hint_text, char_count, errorMsg, inputProps, suffixInputProps, isborderRequired, suffixDropdown, isSuffixEditable, suffixPlaceholder, handleSuffixClick, handleSuffixValChange, }: InputFieldProps) => JSX.Element;
3
+ declare const InputField: ({ label, labelColor, labelSize, height, start_icon, end_icon, hint_text_icon, prefix, suffixButton, suffix, hint_text, char_count, errorMsg, inputProps, suffixInputProps, isborderRequired, suffixDropdown, isSuffixEditable, suffixPlaceholder, fieldColor, handleSuffixClick, }: InputFieldProps) => JSX.Element;
4
4
  export default InputField;
@@ -1,6 +1,7 @@
1
1
  import { ReactNode } from "react";
2
2
  export interface InputFieldProps {
3
3
  label?: string;
4
+ fieldColor?: string;
4
5
  labelSize?: typographyTextType;
5
6
  labelColor?: string;
6
7
  height?: string;
@@ -317,6 +318,7 @@ export interface AddSuggestionProps {
317
318
  errorMsg?: string;
318
319
  inputProps?: React.DetailedHTMLProps<React.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>;
319
320
  inputFieldInputProps?: React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
321
+ suffixInputProps?: React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
320
322
  onSuggestionClick?: (selectedValue: any) => void;
321
323
  options?: Array<DropdownItemsProps>;
322
324
  suggestionValue?: string;
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "frontend",
10
10
  "healthplix"
11
11
  ],
12
- "version": "1.0.34",
12
+ "version": "1.0.36",
13
13
  "main": "dist/esm/index.js",
14
14
  "module": "dist/esm/index.js",
15
15
  "types": "dist/esm/index.d.ts",