@rehagro/ui 1.0.52 → 1.0.54
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.d.mts +11 -2
- package/dist/index.d.ts +11 -2
- package/dist/index.js +181 -92
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +181 -92
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2108,6 +2108,21 @@ var DateSelect = forwardRef(
|
|
|
2108
2108
|
if (!isControlled) setInternalValue(newValue);
|
|
2109
2109
|
props.onChange?.(newValue);
|
|
2110
2110
|
};
|
|
2111
|
+
const handleMonthClear = () => {
|
|
2112
|
+
const newValue = { mode: "month" };
|
|
2113
|
+
if (!isControlled) setInternalValue(newValue);
|
|
2114
|
+
props.onChange?.(newValue);
|
|
2115
|
+
};
|
|
2116
|
+
const handleDayClear = () => {
|
|
2117
|
+
const newValue = { mode: "day" };
|
|
2118
|
+
if (!isControlled) setInternalValue(newValue);
|
|
2119
|
+
props.onChange?.(newValue);
|
|
2120
|
+
};
|
|
2121
|
+
const handleYearClear = () => {
|
|
2122
|
+
const newValue = { mode: "year" };
|
|
2123
|
+
if (!isControlled) setInternalValue(newValue);
|
|
2124
|
+
props.onChange?.(newValue);
|
|
2125
|
+
};
|
|
2111
2126
|
const displayText = useMemo(() => {
|
|
2112
2127
|
if (value.mode === "year" && value.year) return value.year.toString();
|
|
2113
2128
|
if (value.mode === "month" && value.year != null)
|
|
@@ -2228,7 +2243,18 @@ var DateSelect = forwardRef(
|
|
|
2228
2243
|
},
|
|
2229
2244
|
year
|
|
2230
2245
|
);
|
|
2231
|
-
}) })
|
|
2246
|
+
}) }),
|
|
2247
|
+
/* @__PURE__ */ jsx("div", { className: "rh-flex rh-items-center rh-justify-between rh-pt-3 rh-mt-3 rh-border-t rh-border-border/30", children: /* @__PURE__ */ jsxs(
|
|
2248
|
+
"button",
|
|
2249
|
+
{
|
|
2250
|
+
onClick: handleYearClear,
|
|
2251
|
+
className: "rh-flex rh-items-center rh-gap-1.5 rh-text-sm rh-text-text rh-font-medium rh-px-2 rh-py-1.5 rh-rounded-sm hover:rh-bg-background rh-transition-colors rh-duration-150",
|
|
2252
|
+
children: [
|
|
2253
|
+
/* @__PURE__ */ jsx(EraserIcon, { className: "rh-w-4 rh-h-4" }),
|
|
2254
|
+
"Limpar"
|
|
2255
|
+
]
|
|
2256
|
+
}
|
|
2257
|
+
) })
|
|
2232
2258
|
] });
|
|
2233
2259
|
const renderMonthGrid = () => /* @__PURE__ */ jsxs("div", { className: "rh-p-1", children: [
|
|
2234
2260
|
/* @__PURE__ */ jsxs("div", { className: "rh-flex rh-items-center rh-justify-between", children: [
|
|
@@ -2276,7 +2302,18 @@ var DateSelect = forwardRef(
|
|
|
2276
2302
|
},
|
|
2277
2303
|
month
|
|
2278
2304
|
);
|
|
2279
|
-
}) })
|
|
2305
|
+
}) }),
|
|
2306
|
+
/* @__PURE__ */ jsx("div", { className: "rh-flex rh-items-center rh-justify-between rh-pt-3 rh-mt-3 rh-border-t rh-border-border/30", children: /* @__PURE__ */ jsxs(
|
|
2307
|
+
"button",
|
|
2308
|
+
{
|
|
2309
|
+
onClick: handleMonthClear,
|
|
2310
|
+
className: "rh-flex rh-items-center rh-gap-1.5 rh-text-sm rh-text-text rh-font-medium rh-px-2 rh-py-1.5 rh-rounded-sm hover:rh-bg-background rh-transition-colors rh-duration-150",
|
|
2311
|
+
children: [
|
|
2312
|
+
/* @__PURE__ */ jsx(EraserIcon, { className: "rh-w-4 rh-h-4" }),
|
|
2313
|
+
"Limpar"
|
|
2314
|
+
]
|
|
2315
|
+
}
|
|
2316
|
+
) })
|
|
2280
2317
|
] });
|
|
2281
2318
|
const renderIntervalNav = () => /* @__PURE__ */ jsxs("div", { children: [
|
|
2282
2319
|
/* @__PURE__ */ jsxs("div", { className: "rh-flex rh-gap-4 rh-p-1", children: [
|
|
@@ -2534,7 +2571,18 @@ var DateSelect = forwardRef(
|
|
|
2534
2571
|
},
|
|
2535
2572
|
i
|
|
2536
2573
|
)) }),
|
|
2537
|
-
renderDayGrid(selectedYear, selectedMonth)
|
|
2574
|
+
renderDayGrid(selectedYear, selectedMonth),
|
|
2575
|
+
/* @__PURE__ */ jsx("div", { className: "rh-flex rh-items-center rh-justify-between rh-pt-3 rh-mt-3 rh-border-t rh-border-border/30", children: /* @__PURE__ */ jsxs(
|
|
2576
|
+
"button",
|
|
2577
|
+
{
|
|
2578
|
+
onClick: handleDayClear,
|
|
2579
|
+
className: "rh-flex rh-items-center rh-gap-1.5 rh-text-sm rh-text-text rh-font-medium rh-px-2 rh-py-1.5 rh-rounded-sm hover:rh-bg-background rh-transition-colors rh-duration-150",
|
|
2580
|
+
children: [
|
|
2581
|
+
/* @__PURE__ */ jsx(EraserIcon, { className: "rh-w-4 rh-h-4" }),
|
|
2582
|
+
"Limpar"
|
|
2583
|
+
]
|
|
2584
|
+
}
|
|
2585
|
+
) })
|
|
2538
2586
|
] });
|
|
2539
2587
|
case "month":
|
|
2540
2588
|
return renderMonthGrid();
|
|
@@ -3724,7 +3772,7 @@ var DAYS_SHORT = ["D", "S", "T", "Q", "Q", "S", "S"];
|
|
|
3724
3772
|
var MONTHS_PT = [
|
|
3725
3773
|
"Janeiro",
|
|
3726
3774
|
"Fevereiro",
|
|
3727
|
-
"
|
|
3775
|
+
"Marco",
|
|
3728
3776
|
"Abril",
|
|
3729
3777
|
"Maio",
|
|
3730
3778
|
"Junho",
|
|
@@ -3765,6 +3813,17 @@ function getDaysInMonth(year, month) {
|
|
|
3765
3813
|
function getFirstDayOfMonth(year, month) {
|
|
3766
3814
|
return new Date(year, month, 1).getDay();
|
|
3767
3815
|
}
|
|
3816
|
+
function removeHexAlpha(color) {
|
|
3817
|
+
if (!color) return color;
|
|
3818
|
+
if (/^#[0-9a-fA-F]{4}$/.test(color)) {
|
|
3819
|
+
const [, r, g, b] = color;
|
|
3820
|
+
return `#${r}${r}${g}${g}${b}${b}`;
|
|
3821
|
+
}
|
|
3822
|
+
if (/^#[0-9a-fA-F]{8}$/.test(color)) {
|
|
3823
|
+
return color.slice(0, 7);
|
|
3824
|
+
}
|
|
3825
|
+
return color;
|
|
3826
|
+
}
|
|
3768
3827
|
var ChevronLeftIcon2 = () => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 20 20", fill: "currentColor", className: "rh-w-5 rh-h-5", "aria-hidden": "true", children: /* @__PURE__ */ jsx(
|
|
3769
3828
|
"path",
|
|
3770
3829
|
{
|
|
@@ -3786,15 +3845,17 @@ var DatePickerDropdown = ({
|
|
|
3786
3845
|
selectedDate,
|
|
3787
3846
|
onSelect,
|
|
3788
3847
|
onClose,
|
|
3789
|
-
containerRef
|
|
3848
|
+
containerRef,
|
|
3849
|
+
backgroundColor,
|
|
3850
|
+
textColor
|
|
3790
3851
|
}) => {
|
|
3791
3852
|
const today = /* @__PURE__ */ new Date();
|
|
3853
|
+
const opaqueBackgroundColor = removeHexAlpha(backgroundColor);
|
|
3854
|
+
const calendarTextStyle = textColor ? { color: textColor } : void 0;
|
|
3792
3855
|
const [viewYear, setViewYear] = useState(
|
|
3793
3856
|
selectedDate ? selectedDate.getFullYear() : today.getFullYear()
|
|
3794
3857
|
);
|
|
3795
|
-
const [viewMonth, setViewMonth] = useState(
|
|
3796
|
-
selectedDate ? selectedDate.getMonth() : today.getMonth()
|
|
3797
|
-
);
|
|
3858
|
+
const [viewMonth, setViewMonth] = useState(selectedDate ? selectedDate.getMonth() : today.getMonth());
|
|
3798
3859
|
const [tempDate, setTempDate] = useState(selectedDate);
|
|
3799
3860
|
const dropdownRef = useRef(null);
|
|
3800
3861
|
useEffect(() => {
|
|
@@ -3825,12 +3886,8 @@ var DatePickerDropdown = ({
|
|
|
3825
3886
|
};
|
|
3826
3887
|
const daysInMonth = getDaysInMonth(viewYear, viewMonth);
|
|
3827
3888
|
const firstDay = getFirstDayOfMonth(viewYear, viewMonth);
|
|
3828
|
-
const prevMonthDays = getDaysInMonth(
|
|
3829
|
-
|
|
3830
|
-
viewMonth === 0 ? 11 : viewMonth - 1
|
|
3831
|
-
);
|
|
3832
|
-
const totalCells = firstDay + daysInMonth;
|
|
3833
|
-
const trailingCount = totalCells % 7 === 0 ? 0 : 7 - totalCells % 7;
|
|
3889
|
+
const prevMonthDays = getDaysInMonth(viewMonth === 0 ? viewYear - 1 : viewYear, viewMonth === 0 ? 11 : viewMonth - 1);
|
|
3890
|
+
const trailingCount = (firstDay + daysInMonth) % 7 === 0 ? 0 : 7 - (firstDay + daysInMonth) % 7;
|
|
3834
3891
|
const isSelected = (day) => !!tempDate && tempDate.getFullYear() === viewYear && tempDate.getMonth() === viewMonth && tempDate.getDate() === day;
|
|
3835
3892
|
return createPortal(
|
|
3836
3893
|
/* @__PURE__ */ jsxs(
|
|
@@ -3839,6 +3896,8 @@ var DatePickerDropdown = ({
|
|
|
3839
3896
|
ref: dropdownRef,
|
|
3840
3897
|
style: {
|
|
3841
3898
|
...style,
|
|
3899
|
+
backgroundColor: opaqueBackgroundColor,
|
|
3900
|
+
color: textColor,
|
|
3842
3901
|
boxShadow: "0 0 9.6px 0 rgba(8, 11, 18, 0.08)",
|
|
3843
3902
|
width: 260
|
|
3844
3903
|
},
|
|
@@ -3849,6 +3908,7 @@ var DatePickerDropdown = ({
|
|
|
3849
3908
|
"button",
|
|
3850
3909
|
{
|
|
3851
3910
|
type: "button",
|
|
3911
|
+
style: calendarTextStyle,
|
|
3852
3912
|
onMouseDown: (e) => {
|
|
3853
3913
|
e.preventDefault();
|
|
3854
3914
|
prevMonth();
|
|
@@ -3857,7 +3917,7 @@ var DatePickerDropdown = ({
|
|
|
3857
3917
|
children: /* @__PURE__ */ jsx(ChevronLeftIcon2, {})
|
|
3858
3918
|
}
|
|
3859
3919
|
),
|
|
3860
|
-
/* @__PURE__ */ jsxs("span", { className: "rh-text-sm rh-font-medium rh-text-text", children: [
|
|
3920
|
+
/* @__PURE__ */ jsxs("span", { className: "rh-text-sm rh-font-medium rh-text-text", style: calendarTextStyle, children: [
|
|
3861
3921
|
MONTHS_PT[viewMonth],
|
|
3862
3922
|
" - ",
|
|
3863
3923
|
viewYear
|
|
@@ -3866,6 +3926,7 @@ var DatePickerDropdown = ({
|
|
|
3866
3926
|
"button",
|
|
3867
3927
|
{
|
|
3868
3928
|
type: "button",
|
|
3929
|
+
style: calendarTextStyle,
|
|
3869
3930
|
onMouseDown: (e) => {
|
|
3870
3931
|
e.preventDefault();
|
|
3871
3932
|
nextMonth();
|
|
@@ -3879,31 +3940,14 @@ var DatePickerDropdown = ({
|
|
|
3879
3940
|
"div",
|
|
3880
3941
|
{
|
|
3881
3942
|
className: "rh-text-center rh-text-xs rh-text-text-muted rh-font-medium rh-py-1",
|
|
3943
|
+
style: calendarTextStyle,
|
|
3882
3944
|
children: d
|
|
3883
3945
|
},
|
|
3884
3946
|
i
|
|
3885
3947
|
)) }),
|
|
3886
|
-
/* @__PURE__ */ jsx(
|
|
3887
|
-
"svg",
|
|
3888
|
-
{
|
|
3889
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
3890
|
-
width: "100%",
|
|
3891
|
-
height: "1",
|
|
3892
|
-
viewBox: "0 0 350 1",
|
|
3893
|
-
fill: "none",
|
|
3894
|
-
className: "rh-mb-3",
|
|
3895
|
-
children: /* @__PURE__ */ jsx("path", { d: "M0 0.5H350", stroke: "#F5F5F5" })
|
|
3896
|
-
}
|
|
3897
|
-
),
|
|
3948
|
+
/* @__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" }) }),
|
|
3898
3949
|
/* @__PURE__ */ jsxs("div", { className: "rh-grid rh-grid-cols-7 rh-gap-0", children: [
|
|
3899
|
-
Array.from({ length: firstDay }).map((_, i) => /* @__PURE__ */ jsx(
|
|
3900
|
-
"div",
|
|
3901
|
-
{
|
|
3902
|
-
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",
|
|
3903
|
-
children: prevMonthDays - firstDay + i + 1
|
|
3904
|
-
},
|
|
3905
|
-
`prev-${i}`
|
|
3906
|
-
)),
|
|
3950
|
+
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}`)),
|
|
3907
3951
|
Array.from({ length: daysInMonth }).map((_, i) => {
|
|
3908
3952
|
const day = i + 1;
|
|
3909
3953
|
const selected = isSelected(day);
|
|
@@ -3911,7 +3955,7 @@ var DatePickerDropdown = ({
|
|
|
3911
3955
|
"button",
|
|
3912
3956
|
{
|
|
3913
3957
|
type: "button",
|
|
3914
|
-
style: { backgroundColor: selected ? "#15607A" : "transparent" },
|
|
3958
|
+
style: { backgroundColor: selected ? "#15607A" : "transparent", ...calendarTextStyle },
|
|
3915
3959
|
onMouseDown: (e) => {
|
|
3916
3960
|
e.preventDefault();
|
|
3917
3961
|
setTempDate(new Date(viewYear, viewMonth, day));
|
|
@@ -3925,14 +3969,7 @@ var DatePickerDropdown = ({
|
|
|
3925
3969
|
day
|
|
3926
3970
|
);
|
|
3927
3971
|
}),
|
|
3928
|
-
Array.from({ length: trailingCount }).map((_, i) => /* @__PURE__ */ jsx(
|
|
3929
|
-
"div",
|
|
3930
|
-
{
|
|
3931
|
-
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",
|
|
3932
|
-
children: i + 1
|
|
3933
|
-
},
|
|
3934
|
-
`next-${i}`
|
|
3935
|
-
))
|
|
3972
|
+
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}`))
|
|
3936
3973
|
] }),
|
|
3937
3974
|
/* @__PURE__ */ jsx("div", { className: "rh-flex rh-justify-end rh-gap-2 rh-mt-4", children: /* @__PURE__ */ jsx(
|
|
3938
3975
|
"button",
|
|
@@ -3940,9 +3977,7 @@ var DatePickerDropdown = ({
|
|
|
3940
3977
|
type: "button",
|
|
3941
3978
|
style: { backgroundColor: "#87A851" },
|
|
3942
3979
|
onClick: () => {
|
|
3943
|
-
if (tempDate)
|
|
3944
|
-
onSelect(tempDate);
|
|
3945
|
-
}
|
|
3980
|
+
if (tempDate) onSelect(tempDate);
|
|
3946
3981
|
onClose();
|
|
3947
3982
|
},
|
|
3948
3983
|
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",
|
|
@@ -3960,11 +3995,29 @@ var CustomSelect = ({
|
|
|
3960
3995
|
value,
|
|
3961
3996
|
onChange,
|
|
3962
3997
|
className = "",
|
|
3998
|
+
placeholder,
|
|
3999
|
+
textColor,
|
|
4000
|
+
placeholderColor,
|
|
4001
|
+
backgroundColor,
|
|
3963
4002
|
type = "select"
|
|
3964
4003
|
}) => {
|
|
3965
4004
|
const [isOpen, setIsOpen] = useState(false);
|
|
3966
4005
|
const [dropdownStyle, setDropdownStyle] = useState({});
|
|
3967
4006
|
const containerRef = useRef(null);
|
|
4007
|
+
const textAreaRef = useRef(null);
|
|
4008
|
+
const resizeTextArea = React9.useCallback(() => {
|
|
4009
|
+
if (type !== "textInput" || !textAreaRef.current) return;
|
|
4010
|
+
const textarea = textAreaRef.current;
|
|
4011
|
+
textarea.style.height = "auto";
|
|
4012
|
+
if (textarea.value) {
|
|
4013
|
+
textarea.style.height = `${textarea.scrollHeight}px`;
|
|
4014
|
+
return;
|
|
4015
|
+
}
|
|
4016
|
+
const previousValue = textarea.value;
|
|
4017
|
+
textarea.value = placeholder || "";
|
|
4018
|
+
textarea.style.height = `${textarea.scrollHeight}px`;
|
|
4019
|
+
textarea.value = previousValue;
|
|
4020
|
+
}, [type, placeholder]);
|
|
3968
4021
|
const calcPosition = () => {
|
|
3969
4022
|
if (!containerRef.current) return {};
|
|
3970
4023
|
const rect = containerRef.current.getBoundingClientRect();
|
|
@@ -3993,6 +4046,9 @@ var CustomSelect = ({
|
|
|
3993
4046
|
window.removeEventListener("resize", close);
|
|
3994
4047
|
};
|
|
3995
4048
|
}, [isOpen]);
|
|
4049
|
+
useEffect(() => {
|
|
4050
|
+
resizeTextArea();
|
|
4051
|
+
}, [resizeTextArea, value]);
|
|
3996
4052
|
const selectedOption = options.find((opt) => opt.value === value);
|
|
3997
4053
|
useEffect(() => {
|
|
3998
4054
|
if (type !== "select") return;
|
|
@@ -4008,29 +4064,52 @@ var CustomSelect = ({
|
|
|
4008
4064
|
}, [isOpen, type]);
|
|
4009
4065
|
const selectedDate = type === "date" ? parseDate(value) : null;
|
|
4010
4066
|
const handleDateSelect = (date) => {
|
|
4011
|
-
if (date)
|
|
4012
|
-
onChange(formatISO(date));
|
|
4013
|
-
}
|
|
4067
|
+
if (date) onChange(formatISO(date));
|
|
4014
4068
|
setIsOpen(false);
|
|
4015
4069
|
};
|
|
4016
|
-
const
|
|
4017
|
-
const
|
|
4070
|
+
const hasValue = value != null && value !== "";
|
|
4071
|
+
const displayLabel = type === "date" ? selectedDate ? formatDisplay(selectedDate) : hasValue ? value : placeholder || "-" : selectedOption?.label || (hasValue ? value : placeholder || "");
|
|
4072
|
+
const displayBg = type === "date" ? backgroundColor : selectedOption?.backgroundColor || backgroundColor;
|
|
4073
|
+
const displayTextColor = type === "date" ? textColor : selectedOption?.textColor || (hasValue ? textColor : placeholderColor) || (displayBg ? "white" : "inherit");
|
|
4074
|
+
if (type === "textInput") {
|
|
4075
|
+
const inputTextColor = textColor || "#111827";
|
|
4076
|
+
const inputPlaceholderColor = placeholderColor || "#9CA3AF";
|
|
4077
|
+
const textInputWrapperClassName = className.replace(/\brh-h-full\b/g, "").trim();
|
|
4078
|
+
return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: `rh-relative rh-h-full rh-flex rh-items-center ${textInputWrapperClassName}`, children: [
|
|
4079
|
+
/* @__PURE__ */ jsx(
|
|
4080
|
+
"textarea",
|
|
4081
|
+
{
|
|
4082
|
+
ref: textAreaRef,
|
|
4083
|
+
value,
|
|
4084
|
+
placeholder,
|
|
4085
|
+
rows: 1,
|
|
4086
|
+
onInput: (e) => {
|
|
4087
|
+
onChange(e.currentTarget.value);
|
|
4088
|
+
resizeTextArea();
|
|
4089
|
+
},
|
|
4090
|
+
style: {
|
|
4091
|
+
color: inputTextColor,
|
|
4092
|
+
backgroundColor: backgroundColor || "transparent"
|
|
4093
|
+
},
|
|
4094
|
+
className: "rh-table-textarea rh-flex rh-items-center rh-leading-[20px] rh-py-[7px] rh-w-full rh-min-h-[40px] rh-text-sm rh-px-1 rh-border rh-bg-surface rh-rounded-xs rh-border-transparent rh-line-height-[20px] rh-outline-none rh-resize-none rh-overflow-hidden hover:rh-border-primary focus:rh-border-primary focus:rh-ring-2 focus:rh-ring-gray-200"
|
|
4095
|
+
}
|
|
4096
|
+
),
|
|
4097
|
+
/* @__PURE__ */ jsx("style", { children: `.rh-table-textarea::placeholder { color: ${inputPlaceholderColor}; }` })
|
|
4098
|
+
] });
|
|
4099
|
+
}
|
|
4018
4100
|
return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: `rh-relative ${className}`, children: [
|
|
4019
4101
|
/* @__PURE__ */ jsx(
|
|
4020
4102
|
"button",
|
|
4021
4103
|
{
|
|
4022
4104
|
type: "button",
|
|
4023
4105
|
onClick: openDropdown,
|
|
4024
|
-
|
|
4025
|
-
|
|
4106
|
+
style: { backgroundColor: backgroundColor || void 0 },
|
|
4107
|
+
className: "rh-w-full rh-min-h-[40px] rh-flex rh-items-center rh-border rh-bg-surface rh-rounded-sm rh-border-transparent rh-justify-between rh-py-2 hover:rh-border-primary hover:rh-ring-2 hover:rh-ring-gray-200 rh-cursor-pointer rh-text-left",
|
|
4108
|
+
children: /* @__PURE__ */ jsx("div", { className: "rh-flex rh-items-center rh-gap-2 rh-flex-1 rh-px-0.5", children: /* @__PURE__ */ jsx(
|
|
4026
4109
|
"span",
|
|
4027
4110
|
{
|
|
4028
|
-
className: "rh-
|
|
4029
|
-
style: {
|
|
4030
|
-
backgroundColor: displayBg || "transparent",
|
|
4031
|
-
fontFamily: "Inter, sans-serif",
|
|
4032
|
-
color: displayBg ? "white" : "inherit"
|
|
4033
|
-
},
|
|
4111
|
+
className: "rh-text-[14px] rh-px-2 rh-py-0.5 rh-rounded-xl rh-whitespace-normal rh-break-words",
|
|
4112
|
+
style: { backgroundColor: displayBg || "transparent", fontFamily: "Inter, sans-serif", color: displayTextColor },
|
|
4034
4113
|
children: displayLabel
|
|
4035
4114
|
}
|
|
4036
4115
|
) })
|
|
@@ -4040,11 +4119,8 @@ var CustomSelect = ({
|
|
|
4040
4119
|
/* @__PURE__ */ jsx(
|
|
4041
4120
|
"div",
|
|
4042
4121
|
{
|
|
4043
|
-
style: {
|
|
4044
|
-
|
|
4045
|
-
boxShadow: "0 10px 20px 0 rgba(0, 0, 0, 0.05)"
|
|
4046
|
-
},
|
|
4047
|
-
className: "rh-bg-surface rh-border rh-border-border rh-rounded-xs rh-max-h-60 rh-overflow-auto rh-pr-3",
|
|
4122
|
+
style: { ...dropdownStyle, backgroundColor: backgroundColor || void 0, boxShadow: "0 10px 20px 0 rgba(0, 0, 0, 0.05)" },
|
|
4123
|
+
className: "rh-border rh-border-border rh-rounded-xs rh-max-h-60 rh-overflow-auto",
|
|
4048
4124
|
children: options.map((option) => /* @__PURE__ */ jsxs(
|
|
4049
4125
|
"button",
|
|
4050
4126
|
{
|
|
@@ -4054,32 +4130,23 @@ var CustomSelect = ({
|
|
|
4054
4130
|
onChange(option.value);
|
|
4055
4131
|
setIsOpen(false);
|
|
4056
4132
|
},
|
|
4057
|
-
className: "rh-flex rh-items-center rh-gap-2 rh-px-3 rh-py-2 rh-text-left hover:rh-bg-background/50 rh-cursor-pointer",
|
|
4133
|
+
className: "rh-flex rh-items-center rh-gap-2 rh-px-3 rh-py-2 rh-text-left hover:rh-bg-background/50 rh-w-full rh-cursor-pointer",
|
|
4058
4134
|
children: [
|
|
4059
|
-
/* @__PURE__ */ jsx("div", { className: "rh-w-4
|
|
4060
|
-
"
|
|
4135
|
+
/* @__PURE__ */ jsx("div", { className: "rh-w-4", children: option.value === value && /* @__PURE__ */ jsx("svg", { width: "13", height: "10", viewBox: "0 0 13 10", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx(
|
|
4136
|
+
"path",
|
|
4061
4137
|
{
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
viewBox: "0 0 13 10",
|
|
4065
|
-
fill: "none",
|
|
4066
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
4067
|
-
children: /* @__PURE__ */ jsx(
|
|
4068
|
-
"path",
|
|
4069
|
-
{
|
|
4070
|
-
d: "M12.7826 1.2813L4.78255 9.2813C4.71287 9.35122 4.63008 9.4067 4.53891 9.44455C4.44775 9.48241 4.35001 9.50189 4.2513 9.50189C4.15259 9.50189 4.05485 9.48241 3.96369 9.44455C3.87252 9.4067 3.78973 9.35122 3.72005 9.2813L0.220051 5.7813C0.150286 5.71154 0.0949458 5.62871 0.0571893 5.53756C0.0194329 5.44641 1.03958e-09 5.34871 0 5.25005C-1.03958e-09 5.15139 0.0194329 5.05369 0.0571893 4.96254C0.0949458 4.87139 0.150286 4.78857 0.220051 4.7188C0.289816 4.64904 0.372638 4.5937 0.46379 4.55594C0.554942 4.51818 0.652639 4.49875 0.751301 4.49875C0.849963 4.49875 0.947659 4.51818 1.03881 4.55594C1.12996 4.5937 1.21279 4.64904 1.28255 4.7188L4.25193 7.68818L11.7213 0.220051C11.8622 0.0791546 12.0533 0 12.2526 0C12.4518 0 12.6429 0.0791546 12.7838 0.220051C12.9247 0.360947 13.0039 0.552044 13.0039 0.751301C13.0039 0.950559 12.9247 1.14165 12.7838 1.28255L12.7826 1.2813Z",
|
|
4071
|
-
fill: "#374151"
|
|
4072
|
-
}
|
|
4073
|
-
)
|
|
4138
|
+
d: "M12.7826 1.2813L4.78255 9.2813C4.71287 9.35122 4.63008 9.4067 4.53891 9.44455C4.44775 9.48241 4.35001 9.50189 4.2513 9.50189C4.15259 9.50189 4.05485 9.48241 3.96369 9.44455C3.87252 9.4067 3.78973 9.35122 3.72005 9.2813L0.220051 5.7813C0.150286 5.71154 0.0949458 5.62871 0.0571893 5.53756C0.0194329 5.44641 1.03958e-09 5.34871 0 5.25005C-1.03958e-09 5.15139 0.0194329 5.05369 0.0571893 4.96254C0.0949458 4.87139 0.150286 4.78857 0.220051 4.7188C0.289816 4.64904 0.372638 4.5937 0.46379 4.55594C0.554942 4.51818 0.652639 4.49875 0.751301 4.49875C0.849963 4.49875 0.947659 4.51818 1.03881 4.55594C1.12996 4.5937 1.21279 4.64904 1.28255 4.7188L4.25193 7.68818L11.7213 0.220051C11.8622 0.0791546 12.0533 0 12.2526 0C12.4518 0 12.6429 0.0791546 12.7838 0.220051C12.9247 0.360947 13.0039 0.552044 13.0039 0.751301C13.0039 0.950559 12.9247 1.14165 12.7838 1.28255L12.7826 1.2813Z",
|
|
4139
|
+
fill: "#374151"
|
|
4074
4140
|
}
|
|
4075
|
-
) }),
|
|
4141
|
+
) }) }),
|
|
4076
4142
|
/* @__PURE__ */ jsx(
|
|
4077
4143
|
"span",
|
|
4078
4144
|
{
|
|
4079
|
-
className: "rh-
|
|
4145
|
+
className: "rh-p-0.5 rh-px-2 rh-rounded-xl rh-text-white rh-text-[14px] rh-whitespace-normal rh-break-words",
|
|
4080
4146
|
style: {
|
|
4081
|
-
backgroundColor: option.backgroundColor || "transparent",
|
|
4082
|
-
fontFamily: "Inter, sans-serif"
|
|
4147
|
+
backgroundColor: option.backgroundColor || backgroundColor || "transparent",
|
|
4148
|
+
fontFamily: "Inter, sans-serif",
|
|
4149
|
+
color: option.textColor || textColor || (option.backgroundColor || backgroundColor ? "white" : "inherit")
|
|
4083
4150
|
},
|
|
4084
4151
|
children: option.label
|
|
4085
4152
|
}
|
|
@@ -4099,7 +4166,9 @@ var CustomSelect = ({
|
|
|
4099
4166
|
selectedDate,
|
|
4100
4167
|
onSelect: handleDateSelect,
|
|
4101
4168
|
onClose: () => setIsOpen(false),
|
|
4102
|
-
containerRef
|
|
4169
|
+
containerRef,
|
|
4170
|
+
backgroundColor,
|
|
4171
|
+
textColor
|
|
4103
4172
|
}
|
|
4104
4173
|
)
|
|
4105
4174
|
] });
|
|
@@ -4208,9 +4277,27 @@ function TableInner({
|
|
|
4208
4277
|
const rowPaddingStyle = getRowPaddingStyle();
|
|
4209
4278
|
const isEditableCell = (column) => {
|
|
4210
4279
|
if (!column.editable || !column.editableValue) return false;
|
|
4211
|
-
if (column.type === "date") return true;
|
|
4280
|
+
if (column.type === "date" || column.type === "textInput") return true;
|
|
4212
4281
|
return !!column.choices;
|
|
4213
4282
|
};
|
|
4283
|
+
const getEditableTextColor = (column, row, index) => {
|
|
4284
|
+
if (typeof column.editableTextColor === "function") {
|
|
4285
|
+
return column.editableTextColor(row, index);
|
|
4286
|
+
}
|
|
4287
|
+
return column.editableTextColor;
|
|
4288
|
+
};
|
|
4289
|
+
const getEditableBackgroundColor = (column, row, index) => {
|
|
4290
|
+
if (typeof column.editableBackgroundColor === "function") {
|
|
4291
|
+
return column.editableBackgroundColor(row, index);
|
|
4292
|
+
}
|
|
4293
|
+
return column.editableBackgroundColor;
|
|
4294
|
+
};
|
|
4295
|
+
const getEditablePlaceholderColor = (column, row, index) => {
|
|
4296
|
+
if (typeof column.editablePlaceholderColor === "function") {
|
|
4297
|
+
return column.editablePlaceholderColor(row, index);
|
|
4298
|
+
}
|
|
4299
|
+
return column.editablePlaceholderColor;
|
|
4300
|
+
};
|
|
4214
4301
|
return /* @__PURE__ */ jsx("div", { className: "rh-w-full rh-rounded rh-overflow-hidden", children: /* @__PURE__ */ jsxs(
|
|
4215
4302
|
"table",
|
|
4216
4303
|
{
|
|
@@ -4295,7 +4382,7 @@ function TableInner({
|
|
|
4295
4382
|
style: bodyStyleInline,
|
|
4296
4383
|
className: [
|
|
4297
4384
|
"rh-border-b rh-border-border rh-transition-colors",
|
|
4298
|
-
"hover:rh-bg-background",
|
|
4385
|
+
"hover:rh-bg-background/50",
|
|
4299
4386
|
variant === "striped" && index % 2 === 1 ? "rh-bg-background/50" : ""
|
|
4300
4387
|
].filter(Boolean).join(" "),
|
|
4301
4388
|
children: columns.map((column) => /* @__PURE__ */ jsx(
|
|
@@ -4314,10 +4401,14 @@ function TableInner({
|
|
|
4314
4401
|
type: column.type ?? "select",
|
|
4315
4402
|
options: column.choices,
|
|
4316
4403
|
value: column.editableValue(row),
|
|
4404
|
+
placeholder: column.editablePlaceholder,
|
|
4405
|
+
textColor: getEditableTextColor(column, row, index),
|
|
4406
|
+
placeholderColor: getEditablePlaceholderColor(column, row, index),
|
|
4407
|
+
backgroundColor: getEditableBackgroundColor(column, row, index),
|
|
4317
4408
|
onChange: (value) => column.onEditChange?.(row, index, value),
|
|
4318
4409
|
className: "rh-w-full rh-h-full"
|
|
4319
4410
|
}
|
|
4320
|
-
) : /* @__PURE__ */ jsx("span", { children: column.render(row, index) }),
|
|
4411
|
+
) : /* @__PURE__ */ jsx("span", { style: { width: "100%" }, children: column.render(row, index) }),
|
|
4321
4412
|
column.actionIcon && /* @__PURE__ */ jsx(
|
|
4322
4413
|
"span",
|
|
4323
4414
|
{
|
|
@@ -4336,14 +4427,12 @@ function TableInner({
|
|
|
4336
4427
|
},
|
|
4337
4428
|
rowKey(row, index)
|
|
4338
4429
|
)),
|
|
4339
|
-
addRowButton && !loading && /* @__PURE__ */ jsx("tr", { className: "rh-border-border hover:rh-bg-background/50 rh-
|
|
4430
|
+
addRowButton && !loading && /* @__PURE__ */ jsx("tr", { className: "rh-border-border hover:rh-bg-background/50 rh-cursor-pointer rh-py-3", children: /* @__PURE__ */ jsx(
|
|
4340
4431
|
"td",
|
|
4341
4432
|
{
|
|
4342
4433
|
colSpan,
|
|
4343
|
-
style: rowPaddingStyle,
|
|
4344
4434
|
className: [
|
|
4345
|
-
|
|
4346
|
-
"rh-text-center rh-cursor-pointer rh-text-[#9CA3AF] rh-font-medium"
|
|
4435
|
+
"rh-text-center rh-cursor-pointer rh-text-[#9CA3AF] rh-font-medium rh-px-4 rh-py-3 rh-rounded-b"
|
|
4347
4436
|
].filter(Boolean).join(" "),
|
|
4348
4437
|
onClick: onAddRow,
|
|
4349
4438
|
children: /* @__PURE__ */ jsxs("div", { className: "rh-flex rh-items-center rh-justify-center rh-gap-2 rh-h-6 rh-font-bold rh-text-sm", children: [
|