@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.js +31 -34
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -34
- package/dist/index.mjs.map +1 -1
- package/dist/native.js.map +1 -1
- package/dist/native.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1791,9 +1791,10 @@ var Select = React10.forwardRef(function Select2(props, ref) {
|
|
|
1791
1791
|
if (!isControlled) setInternalValue(next);
|
|
1792
1792
|
props.onChange?.(next);
|
|
1793
1793
|
} else {
|
|
1794
|
-
const
|
|
1794
|
+
const isDeselecting = selectedValues.includes(optionValue);
|
|
1795
|
+
const next = isDeselecting ? [] : [optionValue];
|
|
1795
1796
|
if (!isControlled) setInternalValue(next);
|
|
1796
|
-
props.onChange?.(optionValue);
|
|
1797
|
+
props.onChange?.(isDeselecting ? "" : optionValue);
|
|
1797
1798
|
setIsOpen(false);
|
|
1798
1799
|
innerRef.current?.focus();
|
|
1799
1800
|
}
|
|
@@ -2515,7 +2516,7 @@ var DateSelect = React10.forwardRef(
|
|
|
2515
2516
|
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0 0.5H350", stroke: "#F5F5F5" })
|
|
2516
2517
|
}
|
|
2517
2518
|
),
|
|
2518
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "rh-grid rh-grid-cols-7 rh-mb-1", children: ["D", "S", "T", "Q", "Q", "S", "S"].map((d, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2519
|
+
/* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx(
|
|
2519
2520
|
"div",
|
|
2520
2521
|
{
|
|
2521
2522
|
className: "rh-text-center rh-text-xs rh-text-text-muted rh-font-medium rh-py-1",
|
|
@@ -2560,7 +2561,7 @@ var DateSelect = React10.forwardRef(
|
|
|
2560
2561
|
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0 0.5H350", stroke: "#F5F5F5" })
|
|
2561
2562
|
}
|
|
2562
2563
|
),
|
|
2563
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "rh-grid rh-grid-cols-7 rh-mb-1", children: ["D", "S", "T", "Q", "Q", "S", "S"].map((d, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2564
|
+
/* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx(
|
|
2564
2565
|
"div",
|
|
2565
2566
|
{
|
|
2566
2567
|
className: "rh-text-center rh-text-xs rh-text-text-muted rh-font-medium rh-py-1",
|
|
@@ -2642,7 +2643,7 @@ var DateSelect = React10.forwardRef(
|
|
|
2642
2643
|
!isStart && !isEnd && !inRange && !inHoverRange && !isHoverEnd ? "rh-text-text hover:rh-ring-1 hover:rh-ring-[#15607A]" : ""
|
|
2643
2644
|
].join(" ");
|
|
2644
2645
|
};
|
|
2645
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rh-grid rh-grid-cols-7 rh-gap-0 rh-text-center", children: [
|
|
2646
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rh-grid rh-grid-cols-7 rh-gap-0 rh-justify-items-center rh-text-center", children: [
|
|
2646
2647
|
prevDays.map((d, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2647
2648
|
"div",
|
|
2648
2649
|
{
|
|
@@ -2727,7 +2728,7 @@ var DateSelect = React10.forwardRef(
|
|
|
2727
2728
|
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0 0.5H350", stroke: "#F5F5F5" })
|
|
2728
2729
|
}
|
|
2729
2730
|
),
|
|
2730
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "rh-grid rh-grid-cols-7 rh-mb-1", children: ["D", "S", "T", "Q", "Q", "S", "S"].map((d, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2731
|
+
/* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx(
|
|
2731
2732
|
"div",
|
|
2732
2733
|
{
|
|
2733
2734
|
className: "rh-text-center rh-text-xs rh-text-text-muted rh-font-medium rh-py-1",
|
|
@@ -2768,7 +2769,7 @@ var DateSelect = React10.forwardRef(
|
|
|
2768
2769
|
const totalCells = firstDay + daysInMonth;
|
|
2769
2770
|
const nextDaysCount = totalCells % 7 === 0 ? 0 : 7 - totalCells % 7;
|
|
2770
2771
|
const nextDays = Array.from({ length: nextDaysCount }, (_, i) => i + 1);
|
|
2771
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rh-grid rh-grid-cols-7 rh-gap-0", children: [
|
|
2772
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rh-grid rh-grid-cols-7 rh-gap-0 rh-justify-items-center", children: [
|
|
2772
2773
|
prevDays.map((d, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2773
2774
|
"div",
|
|
2774
2775
|
{
|
|
@@ -2779,13 +2780,18 @@ var DateSelect = React10.forwardRef(
|
|
|
2779
2780
|
)),
|
|
2780
2781
|
days.map((day) => {
|
|
2781
2782
|
const isSelected = value.mode === "day" && value.year === calYear && value.month === calMonth && value.day === day;
|
|
2783
|
+
const today = /* @__PURE__ */ new Date();
|
|
2784
|
+
const isCurrentDay = today.getFullYear() === calYear && today.getMonth() === calMonth && today.getDate() === day;
|
|
2782
2785
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2783
2786
|
"button",
|
|
2784
2787
|
{
|
|
2785
2788
|
onClick: () => handleChange({ mode: "day", year: calYear, month: calMonth, day }),
|
|
2789
|
+
style: {
|
|
2790
|
+
borderColor: !isSelected && isCurrentDay ? "#15607A" : "transparent"
|
|
2791
|
+
},
|
|
2786
2792
|
className: [
|
|
2787
|
-
"rh-w-7 rh-h-7 rh-flex rh-items-center rh-justify-center rh-text-sm rh-rounded-
|
|
2788
|
-
isSelected ? "rh-bg-primary rh-text-surface" : "rh-text-text
|
|
2793
|
+
"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",
|
|
2794
|
+
isSelected ? "rh-bg-primary rh-text-surface" : "rh-text-text rh-bg-transparent hover:rh-bg-[#D1D5DB]"
|
|
2789
2795
|
].join(" "),
|
|
2790
2796
|
children: day
|
|
2791
2797
|
},
|
|
@@ -4577,7 +4583,6 @@ var DatePickerDropdown = ({
|
|
|
4577
4583
|
selectedDate ? selectedDate.getFullYear() : today.getFullYear()
|
|
4578
4584
|
);
|
|
4579
4585
|
const [viewMonth, setViewMonth] = React10.useState(selectedDate ? selectedDate.getMonth() : today.getMonth());
|
|
4580
|
-
const [tempDate, setTempDate] = React10.useState(selectedDate);
|
|
4581
4586
|
const dropdownRef = React10.useRef(null);
|
|
4582
4587
|
React10.useEffect(() => {
|
|
4583
4588
|
const handleClickOutside = (e) => {
|
|
@@ -4609,7 +4614,9 @@ var DatePickerDropdown = ({
|
|
|
4609
4614
|
const firstDay = getFirstDayOfMonth(viewYear, viewMonth);
|
|
4610
4615
|
const prevMonthDays = getDaysInMonth(viewMonth === 0 ? viewYear - 1 : viewYear, viewMonth === 0 ? 11 : viewMonth - 1);
|
|
4611
4616
|
const trailingCount = (firstDay + daysInMonth) % 7 === 0 ? 0 : 7 - (firstDay + daysInMonth) % 7;
|
|
4612
|
-
const
|
|
4617
|
+
const effectiveSelectedDate = selectedDate ?? today;
|
|
4618
|
+
const isSelected = (day) => effectiveSelectedDate.getFullYear() === viewYear && effectiveSelectedDate.getMonth() === viewMonth && effectiveSelectedDate.getDate() === day;
|
|
4619
|
+
const isToday = (day) => today.getFullYear() === viewYear && today.getMonth() === viewMonth && today.getDate() === day;
|
|
4613
4620
|
return reactDom.createPortal(
|
|
4614
4621
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4615
4622
|
"div",
|
|
@@ -4620,7 +4627,8 @@ var DatePickerDropdown = ({
|
|
|
4620
4627
|
backgroundColor: opaqueBackgroundColor,
|
|
4621
4628
|
color: textColor,
|
|
4622
4629
|
boxShadow: "0 0 9.6px 0 rgba(8, 11, 18, 0.08)",
|
|
4623
|
-
width: 260
|
|
4630
|
+
width: 260,
|
|
4631
|
+
minHeight: 275
|
|
4624
4632
|
},
|
|
4625
4633
|
className: "rh-bg-surface rh-rounded-xs rh-p-5 rh-select-none rh-font-body",
|
|
4626
4634
|
children: [
|
|
@@ -4660,33 +4668,35 @@ var DatePickerDropdown = ({
|
|
|
4660
4668
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "rh-grid rh-grid-cols-7", children: DAYS_SHORT.map((d, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4661
4669
|
"div",
|
|
4662
4670
|
{
|
|
4663
|
-
className: "rh-text-center rh-text-xs rh-text-text-muted rh-font-medium rh-py-1",
|
|
4671
|
+
className: "rh-text-center rh-text-xs rh-text-text-muted rh-font-medium rh-py-1 rh-pt-4",
|
|
4664
4672
|
style: calendarTextStyle,
|
|
4665
4673
|
children: d
|
|
4666
4674
|
},
|
|
4667
4675
|
i
|
|
4668
4676
|
)) }),
|
|
4669
|
-
/* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx("path", { d: "M0 0.5H350", stroke: "#F5F5F5" }) }),
|
|
4677
|
+
/* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx("path", { d: "M0 0.5H350", stroke: "#F5F5F5" }) }),
|
|
4670
4678
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rh-grid rh-grid-cols-7 rh-gap-0", children: [
|
|
4671
4679
|
Array.from({ length: firstDay }).map((_, i) => /* @__PURE__ */ jsxRuntime.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}`)),
|
|
4672
4680
|
Array.from({ length: daysInMonth }).map((_, i) => {
|
|
4673
4681
|
const day = i + 1;
|
|
4674
4682
|
const selected = isSelected(day);
|
|
4683
|
+
const isCurrentDay = isToday(day);
|
|
4675
4684
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4676
4685
|
"button",
|
|
4677
4686
|
{
|
|
4678
4687
|
type: "button",
|
|
4679
4688
|
style: {
|
|
4680
|
-
backgroundColor: selected ? "#15607A" :
|
|
4681
|
-
color: selected ? "#FFFFFF" : textColor
|
|
4689
|
+
backgroundColor: selected ? "#15607A" : void 0,
|
|
4690
|
+
color: selected ? "#FFFFFF" : textColor,
|
|
4691
|
+
borderColor: !selected && isCurrentDay ? "#15607A" : "transparent"
|
|
4682
4692
|
},
|
|
4683
4693
|
onMouseDown: (e) => {
|
|
4684
4694
|
e.preventDefault();
|
|
4685
|
-
|
|
4695
|
+
onSelect(new Date(viewYear, viewMonth, day));
|
|
4686
4696
|
},
|
|
4687
4697
|
className: [
|
|
4688
|
-
"rh-w-7 rh-h-7 rh-flex rh-items-center rh-justify-center rh-text-sm rh-rounded-
|
|
4689
|
-
selected ? "rh-text-surface" : "rh-text-text
|
|
4698
|
+
"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",
|
|
4699
|
+
selected ? "rh-text-surface rh-bg-[#15607A]" : "rh-text-text rh-bg-transparent hover:rh-bg-[#D1D5DB]"
|
|
4690
4700
|
].join(" "),
|
|
4691
4701
|
children: day
|
|
4692
4702
|
},
|
|
@@ -4694,20 +4704,7 @@ var DatePickerDropdown = ({
|
|
|
4694
4704
|
);
|
|
4695
4705
|
}),
|
|
4696
4706
|
Array.from({ length: trailingCount }).map((_, i) => /* @__PURE__ */ jsxRuntime.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}`))
|
|
4697
|
-
] })
|
|
4698
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "rh-flex rh-justify-end rh-gap-2 rh-mt-4", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4699
|
-
"button",
|
|
4700
|
-
{
|
|
4701
|
-
type: "button",
|
|
4702
|
-
style: { backgroundColor: "#87A851" },
|
|
4703
|
-
onClick: () => {
|
|
4704
|
-
if (tempDate) onSelect(tempDate);
|
|
4705
|
-
onClose();
|
|
4706
|
-
},
|
|
4707
|
-
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",
|
|
4708
|
-
children: "Aplicar"
|
|
4709
|
-
}
|
|
4710
|
-
) })
|
|
4707
|
+
] })
|
|
4711
4708
|
]
|
|
4712
4709
|
}
|
|
4713
4710
|
),
|
|
@@ -4794,7 +4791,7 @@ var CustomSelect = ({
|
|
|
4794
4791
|
setIsOpen(false);
|
|
4795
4792
|
};
|
|
4796
4793
|
const hasValue = value != null && value !== "";
|
|
4797
|
-
const displayLabel = type === "date" ? selectedDate ? formatDisplay(selectedDate) : hasValue ? value :
|
|
4794
|
+
const displayLabel = type === "date" ? selectedDate ? formatDisplay(selectedDate) : hasValue ? value : formatDisplay(/* @__PURE__ */ new Date()) : selectedOption?.label || (hasValue ? value : placeholder || "");
|
|
4798
4795
|
const displayBg = type === "date" ? backgroundColor : selectedOption?.backgroundColor || backgroundColor;
|
|
4799
4796
|
const displayTextColor = type === "date" ? textColor : selectedOption?.textColor || (hasValue ? textColor : placeholderColor) || (displayBg ? "white" : "inherit");
|
|
4800
4797
|
if (type === "textInput") {
|