@rehagro/ui 1.0.65 → 1.0.66

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.mjs CHANGED
@@ -1785,9 +1785,10 @@ var Select = forwardRef(function Select2(props, ref) {
1785
1785
  if (!isControlled) setInternalValue(next);
1786
1786
  props.onChange?.(next);
1787
1787
  } else {
1788
- const next = [optionValue];
1788
+ const isDeselecting = selectedValues.includes(optionValue);
1789
+ const next = isDeselecting ? [] : [optionValue];
1789
1790
  if (!isControlled) setInternalValue(next);
1790
- props.onChange?.(optionValue);
1791
+ props.onChange?.(isDeselecting ? "" : optionValue);
1791
1792
  setIsOpen(false);
1792
1793
  innerRef.current?.focus();
1793
1794
  }
@@ -2509,7 +2510,7 @@ var DateSelect = forwardRef(
2509
2510
  children: /* @__PURE__ */ jsx("path", { d: "M0 0.5H350", stroke: "#F5F5F5" })
2510
2511
  }
2511
2512
  ),
2512
- /* @__PURE__ */ jsx("div", { className: "rh-grid rh-grid-cols-7 rh-mb-1", children: ["D", "S", "T", "Q", "Q", "S", "S"].map((d, i) => /* @__PURE__ */ jsx(
2513
+ /* @__PURE__ */ jsx("div", { className: "rh-grid rh-grid-cols-7 rh-mb-1 rh-justify-items-center", children: ["D", "S", "T", "Q", "Q", "S", "S"].map((d, i) => /* @__PURE__ */ jsx(
2513
2514
  "div",
2514
2515
  {
2515
2516
  className: "rh-text-center rh-text-xs rh-text-text-muted rh-font-medium rh-py-1",
@@ -2554,7 +2555,7 @@ var DateSelect = forwardRef(
2554
2555
  children: /* @__PURE__ */ jsx("path", { d: "M0 0.5H350", stroke: "#F5F5F5" })
2555
2556
  }
2556
2557
  ),
2557
- /* @__PURE__ */ jsx("div", { className: "rh-grid rh-grid-cols-7 rh-mb-1", children: ["D", "S", "T", "Q", "Q", "S", "S"].map((d, i) => /* @__PURE__ */ jsx(
2558
+ /* @__PURE__ */ jsx("div", { className: "rh-grid rh-grid-cols-7 rh-mb-1 rh-justify-items-center", children: ["D", "S", "T", "Q", "Q", "S", "S"].map((d, i) => /* @__PURE__ */ jsx(
2558
2559
  "div",
2559
2560
  {
2560
2561
  className: "rh-text-center rh-text-xs rh-text-text-muted rh-font-medium rh-py-1",
@@ -2636,7 +2637,7 @@ var DateSelect = forwardRef(
2636
2637
  !isStart && !isEnd && !inRange && !inHoverRange && !isHoverEnd ? "rh-text-text hover:rh-ring-1 hover:rh-ring-[#15607A]" : ""
2637
2638
  ].join(" ");
2638
2639
  };
2639
- return /* @__PURE__ */ jsxs("div", { className: "rh-grid rh-grid-cols-7 rh-gap-0 rh-text-center", children: [
2640
+ return /* @__PURE__ */ jsxs("div", { className: "rh-grid rh-grid-cols-7 rh-gap-0 rh-justify-items-center rh-text-center", children: [
2640
2641
  prevDays.map((d, i) => /* @__PURE__ */ jsx(
2641
2642
  "div",
2642
2643
  {
@@ -2721,7 +2722,7 @@ var DateSelect = forwardRef(
2721
2722
  children: /* @__PURE__ */ jsx("path", { d: "M0 0.5H350", stroke: "#F5F5F5" })
2722
2723
  }
2723
2724
  ),
2724
- /* @__PURE__ */ jsx("div", { className: "rh-grid rh-grid-cols-7 rh-mb-1", children: ["D", "S", "T", "Q", "Q", "S", "S"].map((d, i) => /* @__PURE__ */ jsx(
2725
+ /* @__PURE__ */ jsx("div", { className: "rh-grid rh-grid-cols-7 rh-mb-1 rh-justify-items-center", children: ["D", "S", "T", "Q", "Q", "S", "S"].map((d, i) => /* @__PURE__ */ jsx(
2725
2726
  "div",
2726
2727
  {
2727
2728
  className: "rh-text-center rh-text-xs rh-text-text-muted rh-font-medium rh-py-1",
@@ -2762,7 +2763,7 @@ var DateSelect = forwardRef(
2762
2763
  const totalCells = firstDay + daysInMonth;
2763
2764
  const nextDaysCount = totalCells % 7 === 0 ? 0 : 7 - totalCells % 7;
2764
2765
  const nextDays = Array.from({ length: nextDaysCount }, (_, i) => i + 1);
2765
- return /* @__PURE__ */ jsxs("div", { className: "rh-grid rh-grid-cols-7 rh-gap-0", children: [
2766
+ return /* @__PURE__ */ jsxs("div", { className: "rh-grid rh-grid-cols-7 rh-gap-0 rh-justify-items-center", children: [
2766
2767
  prevDays.map((d, i) => /* @__PURE__ */ jsx(
2767
2768
  "div",
2768
2769
  {
@@ -2773,13 +2774,18 @@ var DateSelect = forwardRef(
2773
2774
  )),
2774
2775
  days.map((day) => {
2775
2776
  const isSelected = value.mode === "day" && value.year === calYear && value.month === calMonth && value.day === day;
2777
+ const today = /* @__PURE__ */ new Date();
2778
+ const isCurrentDay = today.getFullYear() === calYear && today.getMonth() === calMonth && today.getDate() === day;
2776
2779
  return /* @__PURE__ */ jsx(
2777
2780
  "button",
2778
2781
  {
2779
2782
  onClick: () => handleChange({ mode: "day", year: calYear, month: calMonth, day }),
2783
+ style: {
2784
+ borderColor: !isSelected && isCurrentDay ? "#15607A" : "transparent"
2785
+ },
2780
2786
  className: [
2781
- "rh-w-7 rh-h-7 rh-flex rh-items-center rh-justify-center rh-text-sm rh-rounded-lg rh-transition-colors rh-duration-150",
2782
- isSelected ? "rh-bg-primary rh-text-surface" : "rh-text-text hover:rh-ring-1 hover:rh-ring-[#15607A]"
2787
+ "rh-w-7 rh-h-7 rh-flex rh-items-center rh-justify-center rh-text-sm rh-rounded-full rh-border rh-transition-colors rh-duration-150",
2788
+ isSelected ? "rh-bg-primary rh-text-surface" : "rh-text-text rh-bg-transparent hover:rh-bg-[#D1D5DB]"
2783
2789
  ].join(" "),
2784
2790
  children: day
2785
2791
  },
@@ -4571,7 +4577,6 @@ var DatePickerDropdown = ({
4571
4577
  selectedDate ? selectedDate.getFullYear() : today.getFullYear()
4572
4578
  );
4573
4579
  const [viewMonth, setViewMonth] = useState(selectedDate ? selectedDate.getMonth() : today.getMonth());
4574
- const [tempDate, setTempDate] = useState(selectedDate);
4575
4580
  const dropdownRef = useRef(null);
4576
4581
  useEffect(() => {
4577
4582
  const handleClickOutside = (e) => {
@@ -4603,7 +4608,9 @@ var DatePickerDropdown = ({
4603
4608
  const firstDay = getFirstDayOfMonth(viewYear, viewMonth);
4604
4609
  const prevMonthDays = getDaysInMonth(viewMonth === 0 ? viewYear - 1 : viewYear, viewMonth === 0 ? 11 : viewMonth - 1);
4605
4610
  const trailingCount = (firstDay + daysInMonth) % 7 === 0 ? 0 : 7 - (firstDay + daysInMonth) % 7;
4606
- const isSelected = (day) => !!tempDate && tempDate.getFullYear() === viewYear && tempDate.getMonth() === viewMonth && tempDate.getDate() === day;
4611
+ const effectiveSelectedDate = selectedDate ?? today;
4612
+ const isSelected = (day) => effectiveSelectedDate.getFullYear() === viewYear && effectiveSelectedDate.getMonth() === viewMonth && effectiveSelectedDate.getDate() === day;
4613
+ const isToday = (day) => today.getFullYear() === viewYear && today.getMonth() === viewMonth && today.getDate() === day;
4607
4614
  return createPortal(
4608
4615
  /* @__PURE__ */ jsxs(
4609
4616
  "div",
@@ -4614,7 +4621,8 @@ var DatePickerDropdown = ({
4614
4621
  backgroundColor: opaqueBackgroundColor,
4615
4622
  color: textColor,
4616
4623
  boxShadow: "0 0 9.6px 0 rgba(8, 11, 18, 0.08)",
4617
- width: 260
4624
+ width: 260,
4625
+ minHeight: 275
4618
4626
  },
4619
4627
  className: "rh-bg-surface rh-rounded-xs rh-p-5 rh-select-none rh-font-body",
4620
4628
  children: [
@@ -4654,33 +4662,35 @@ var DatePickerDropdown = ({
4654
4662
  /* @__PURE__ */ jsx("div", { className: "rh-grid rh-grid-cols-7", children: DAYS_SHORT.map((d, i) => /* @__PURE__ */ jsx(
4655
4663
  "div",
4656
4664
  {
4657
- className: "rh-text-center rh-text-xs rh-text-text-muted rh-font-medium rh-py-1",
4665
+ className: "rh-text-center rh-text-xs rh-text-text-muted rh-font-medium rh-py-1 rh-pt-4",
4658
4666
  style: calendarTextStyle,
4659
4667
  children: d
4660
4668
  },
4661
4669
  i
4662
4670
  )) }),
4663
- /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "100%", height: "1", viewBox: "0 0 350 1", fill: "none", className: "rh-mb-3", children: /* @__PURE__ */ jsx("path", { d: "M0 0.5H350", stroke: "#F5F5F5" }) }),
4671
+ /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "100%", height: "1", viewBox: "0 0 350 1", fill: "none", className: "rh-mb-3 rh-mt-1", children: /* @__PURE__ */ jsx("path", { d: "M0 0.5H350", stroke: "#F5F5F5" }) }),
4664
4672
  /* @__PURE__ */ jsxs("div", { className: "rh-grid rh-grid-cols-7 rh-gap-0", children: [
4665
4673
  Array.from({ length: firstDay }).map((_, i) => /* @__PURE__ */ jsx("div", { className: "rh-w-7 rh-h-7 rh-flex rh-items-center rh-justify-center rh-text-sm rh-text-text-muted rh-opacity-40", style: calendarTextStyle, children: prevMonthDays - firstDay + i + 1 }, `prev-${i}`)),
4666
4674
  Array.from({ length: daysInMonth }).map((_, i) => {
4667
4675
  const day = i + 1;
4668
4676
  const selected = isSelected(day);
4677
+ const isCurrentDay = isToday(day);
4669
4678
  return /* @__PURE__ */ jsx(
4670
4679
  "button",
4671
4680
  {
4672
4681
  type: "button",
4673
4682
  style: {
4674
- backgroundColor: selected ? "#15607A" : "transparent",
4675
- color: selected ? "#FFFFFF" : textColor
4683
+ backgroundColor: selected ? "#15607A" : void 0,
4684
+ color: selected ? "#FFFFFF" : textColor,
4685
+ borderColor: !selected && isCurrentDay ? "#15607A" : "transparent"
4676
4686
  },
4677
4687
  onMouseDown: (e) => {
4678
4688
  e.preventDefault();
4679
- setTempDate(new Date(viewYear, viewMonth, day));
4689
+ onSelect(new Date(viewYear, viewMonth, day));
4680
4690
  },
4681
4691
  className: [
4682
- "rh-w-7 rh-h-7 rh-flex rh-items-center rh-justify-center rh-text-sm rh-rounded-lg rh-transition-colors rh-duration-150 rh-cursor-pointer",
4683
- selected ? "rh-text-surface" : "rh-text-text hover:rh-ring-1 hover:rh-ring-[#15607A] hover:rh-bg-transparent"
4692
+ "rh-w-7 rh-h-7 rh-flex rh-items-center rh-justify-center rh-text-sm rh-rounded-full rh-border rh-transition-colors rh-duration-150 rh-cursor-pointer",
4693
+ selected ? "rh-text-surface rh-bg-[#15607A]" : "rh-text-text rh-bg-transparent hover:rh-bg-[#D1D5DB]"
4684
4694
  ].join(" "),
4685
4695
  children: day
4686
4696
  },
@@ -4688,20 +4698,7 @@ var DatePickerDropdown = ({
4688
4698
  );
4689
4699
  }),
4690
4700
  Array.from({ length: trailingCount }).map((_, i) => /* @__PURE__ */ jsx("div", { className: "rh-w-7 rh-h-7 rh-flex rh-items-center rh-justify-center rh-text-sm rh-text-text-muted rh-opacity-40", style: calendarTextStyle, children: i + 1 }, `next-${i}`))
4691
- ] }),
4692
- /* @__PURE__ */ jsx("div", { className: "rh-flex rh-justify-end rh-gap-2 rh-mt-4", children: /* @__PURE__ */ jsx(
4693
- "button",
4694
- {
4695
- type: "button",
4696
- style: { backgroundColor: "#87A851" },
4697
- onClick: () => {
4698
- if (tempDate) onSelect(tempDate);
4699
- onClose();
4700
- },
4701
- className: "rh-text-sm rh-font-medium rh-px-4 rh-py-1.5 rh-rounded-lg rh-transition-colors rh-duration-150 rh-bg-success rh-text-surface",
4702
- children: "Aplicar"
4703
- }
4704
- ) })
4701
+ ] })
4705
4702
  ]
4706
4703
  }
4707
4704
  ),
@@ -4788,7 +4785,7 @@ var CustomSelect = ({
4788
4785
  setIsOpen(false);
4789
4786
  };
4790
4787
  const hasValue = value != null && value !== "";
4791
- const displayLabel = type === "date" ? selectedDate ? formatDisplay(selectedDate) : hasValue ? value : placeholder || "-" : selectedOption?.label || (hasValue ? value : placeholder || "");
4788
+ const displayLabel = type === "date" ? selectedDate ? formatDisplay(selectedDate) : hasValue ? value : formatDisplay(/* @__PURE__ */ new Date()) : selectedOption?.label || (hasValue ? value : placeholder || "");
4792
4789
  const displayBg = type === "date" ? backgroundColor : selectedOption?.backgroundColor || backgroundColor;
4793
4790
  const displayTextColor = type === "date" ? textColor : selectedOption?.textColor || (hasValue ? textColor : placeholderColor) || (displayBg ? "white" : "inherit");
4794
4791
  if (type === "textInput") {