cr-ui-lib 1.1.22 → 1.1.24

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/index.js CHANGED
@@ -2670,7 +2670,7 @@ var MultipleAutoSuggestionInput = ({
2670
2670
  React.useEffect(() => {
2671
2671
  const handleClickOutside = (event) => {
2672
2672
  if (containerRef.current && !containerRef.current.contains(event.target)) {
2673
- setIsDropdownOpen(false);
2673
+ setTimeout(() => setIsDropdownOpen(false), 150);
2674
2674
  }
2675
2675
  };
2676
2676
  document.addEventListener("mousedown", handleClickOutside);
@@ -3510,6 +3510,14 @@ var CommonInputSingle = ({
3510
3510
  className = "",
3511
3511
  inputClass = ""
3512
3512
  }) => {
3513
+ const [showAll, setShowAll] = React.useState(hasAll);
3514
+ React.useEffect(() => {
3515
+ setShowAll(hasAll);
3516
+ }, [hasAll]);
3517
+ const handleRemoveAll = (e) => {
3518
+ e.stopPropagation();
3519
+ setShowAll(false);
3520
+ };
3513
3521
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
3514
3522
  /* @__PURE__ */ jsxRuntime.jsx(
3515
3523
  "label",
@@ -3525,11 +3533,11 @@ var CommonInputSingle = ({
3525
3533
  "div",
3526
3534
  {
3527
3535
  className: tailwindMerge.twMerge(
3528
- `border ${error ? "border-red-500" : " border-[#E2E2E2]"} rounded-lg p-1.5 bg-custom-gray cursor-pointer flex flex-wrap items-center gap-2`,
3536
+ `border ${error ? "border-red-500" : "border-[#E2E2E2]"} rounded-lg p-1.5 bg-custom-gray cursor-pointer flex flex-wrap items-center gap-2`,
3529
3537
  className
3530
3538
  ),
3531
3539
  children: [
3532
- hasAll && inputValue === "" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex border-custom-gray items-center px-2 py-1 bg-white text-gray-700 rounded-md text-xs font-medium", children: [
3540
+ showAll && inputValue === "" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex border-custom-gray items-center px-2 py-1 bg-white text-gray-700 rounded-md text-xs font-medium", children: [
3533
3541
  /* @__PURE__ */ jsxRuntime.jsx("p", { children: "All" }),
3534
3542
  /* @__PURE__ */ jsxRuntime.jsx(
3535
3543
  "svg",
@@ -3539,7 +3547,8 @@ var CommonInputSingle = ({
3539
3547
  height: "14",
3540
3548
  viewBox: "0 0 14 14",
3541
3549
  fill: "none",
3542
- className: "ml-1",
3550
+ className: "ml-1 cursor-pointer hover:opacity-70",
3551
+ onClick: handleRemoveAll,
3543
3552
  children: /* @__PURE__ */ jsxRuntime.jsx(
3544
3553
  "path",
3545
3554
  {
@@ -3555,7 +3564,12 @@ var CommonInputSingle = ({
3555
3564
  {
3556
3565
  type: "text",
3557
3566
  value: inputValue,
3558
- onChange,
3567
+ onChange: (e) => {
3568
+ onChange(e);
3569
+ if (inputValue === "") {
3570
+ setShowAll(true);
3571
+ }
3572
+ },
3559
3573
  onKeyDown: keyDown,
3560
3574
  className: tailwindMerge.twMerge(
3561
3575
  "flex-grow px-0 py-1 bg-custom-gray text-xs border-none outline-none focus:ring-0",
@@ -3566,7 +3580,7 @@ var CommonInputSingle = ({
3566
3580
  ]
3567
3581
  }
3568
3582
  ),
3569
- error && /* @__PURE__ */ jsxRuntime.jsx("span", { className: " text-[12px] text-red-500", children: error })
3583
+ error && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[12px] text-red-500", children: error })
3570
3584
  ] });
3571
3585
  };
3572
3586
  var CommonInputSingle_default = CommonInputSingle;