@rehagro/ui 1.0.47 → 1.0.49

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
@@ -1118,6 +1118,7 @@ var TextInput = React9.forwardRef(function TextInput2({
1118
1118
  className = "",
1119
1119
  wrapperClassName = "",
1120
1120
  borderColor,
1121
+ backgroundColor,
1121
1122
  borderWidth = "sm",
1122
1123
  id,
1123
1124
  ...rest
@@ -1127,6 +1128,10 @@ var TextInput = React9.forwardRef(function TextInput2({
1127
1128
  const [isHelperDismissed, setIsHelperDismissed] = React9__default.default.useState(false);
1128
1129
  const { onChange, ...inputProps } = rest;
1129
1130
  const visualStatus = helperText && isHelperDismissed ? "default" : status;
1131
+ const containerStyle = {
1132
+ ...borderColor ? { borderColor } : {},
1133
+ ...!disabled && backgroundColor ? { backgroundColor } : {}
1134
+ };
1130
1135
  return /* @__PURE__ */ jsxRuntime.jsxs(
1131
1136
  "div",
1132
1137
  {
@@ -1146,7 +1151,7 @@ var TextInput = React9.forwardRef(function TextInput2({
1146
1151
  /* @__PURE__ */ jsxRuntime.jsxs(
1147
1152
  "div",
1148
1153
  {
1149
- style: borderColor ? { borderColor } : void 0,
1154
+ style: containerStyle,
1150
1155
  className: [
1151
1156
  "rh-flex rh-items-center rh-gap-2",
1152
1157
  "rh-bg-surface rh-font-body",
@@ -1594,7 +1599,8 @@ var Select = React9.forwardRef(function Select2(props, ref) {
1594
1599
  disabled = false,
1595
1600
  className = "",
1596
1601
  wrapperClassName = "",
1597
- multiple = false
1602
+ multiple = false,
1603
+ backgroundColor
1598
1604
  } = props;
1599
1605
  const triggerId = React9__default.default.useId();
1600
1606
  const listboxId = React9__default.default.useId();
@@ -1773,9 +1779,11 @@ var Select = React9.forwardRef(function Select2(props, ref) {
1773
1779
  disabled,
1774
1780
  onClick: () => !disabled && setIsOpen((o) => !o),
1775
1781
  onKeyDown: handleKeyDown,
1782
+ style: backgroundColor ? { backgroundColor } : void 0,
1776
1783
  className: [
1777
1784
  "rh-group rh-flex rh-items-center rh-justify-between rh-gap-2",
1778
- "rh-border rh-bg-surface rh-font-body",
1785
+ "rh-border rh-font-body",
1786
+ !backgroundColor && "rh-bg-surface",
1779
1787
  "rh-transition-colors rh-duration-150",
1780
1788
  "rh-text-left rh-w-full",
1781
1789
  statusClasses2[visualStatus],
@@ -1799,7 +1807,7 @@ var Select = React9.forwardRef(function Select2(props, ref) {
1799
1807
  ChevronIcon,
1800
1808
  {
1801
1809
  className: [
1802
- "rh-w-5 rh-h-5 rh-shrink-0 rh-text-text-muted rh-transition-transform rh-duration-150",
1810
+ "rh-w-4 rh-h-4 rh-shrink-0 rh-text-text-muted rh-transition-transform rh-duration-150 rh-bg-surface rh-rounded-xl",
1803
1811
  isOpen ? "rh-rotate-180" : ""
1804
1812
  ].filter(Boolean).join(" ")
1805
1813
  }
@@ -1889,6 +1897,776 @@ var Select = React9.forwardRef(function Select2(props, ref) {
1889
1897
  }
1890
1898
  );
1891
1899
  });
1900
+ var MONTHS = [
1901
+ "Janeiro",
1902
+ "Fevereiro",
1903
+ "Mar\xE7o",
1904
+ "Abril",
1905
+ "Maio",
1906
+ "Junho",
1907
+ "Julho",
1908
+ "Agosto",
1909
+ "Setembro",
1910
+ "Outubro",
1911
+ "Novembro",
1912
+ "Dezembro"
1913
+ ];
1914
+ var MONTHS_SHORT = [
1915
+ "Jan",
1916
+ "Fev",
1917
+ "Mar",
1918
+ "Abr",
1919
+ "Mai",
1920
+ "Jun",
1921
+ "Jul",
1922
+ "Ago",
1923
+ "Set",
1924
+ "Out",
1925
+ "Nov",
1926
+ "Dez"
1927
+ ];
1928
+ var MODE_OPTIONS = [
1929
+ { value: "interval", label: "Intervalo" },
1930
+ { value: "day", label: "Dia" },
1931
+ { value: "month", label: "M\xEAs" },
1932
+ { value: "year", label: "Ano" }
1933
+ ];
1934
+ var statusClasses3 = {
1935
+ default: "rh-border-border focus-within:rh-border-primary focus-within:rh-ring-2 focus-within:rh-ring-gray-200",
1936
+ error: "rh-border-danger focus-within:rh-border-danger focus-within:rh-ring-2 focus-within:rh-ring-red-100"
1937
+ };
1938
+ var sizeClasses6 = {
1939
+ sm: "rh-min-h-[32px] rh-text-sm rh-px-input-x-sm",
1940
+ md: "rh-min-h-[40px] rh-text-sm rh-px-input-x-md",
1941
+ lg: "rh-min-h-[48px] rh-text-base rh-px-input-x-lg"
1942
+ };
1943
+ var radiusClasses5 = {
1944
+ none: "rh-rounded-none",
1945
+ xxs: "rh-rounded-xxs",
1946
+ xs: "rh-rounded-xs",
1947
+ sm: "rh-rounded-sm",
1948
+ md: "rh-rounded-md",
1949
+ lg: "rh-rounded-lg",
1950
+ xl: "rh-rounded-xl",
1951
+ full: "rh-rounded-full"
1952
+ };
1953
+ var dropdownRadiusClasses2 = {
1954
+ none: "rh-rounded-none",
1955
+ xxs: "rh-rounded-xxs",
1956
+ xs: "rh-rounded-xs",
1957
+ sm: "rh-rounded-xs",
1958
+ md: "rh-rounded-xs",
1959
+ lg: "rh-rounded-xs",
1960
+ xl: "rh-rounded-xs",
1961
+ full: "rh-rounded-xs"
1962
+ };
1963
+ var helperStatusClasses3 = {
1964
+ default: "rh-text-text-muted",
1965
+ error: "rh-text-danger"
1966
+ };
1967
+ var getSubtitleClassName3 = (subtitle) => subtitle.trim() === "*" ? "rh-text-danger" : "rh-text-text-muted";
1968
+ var ChevronIcon2 = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx(
1969
+ "svg",
1970
+ {
1971
+ className,
1972
+ viewBox: "0 0 20 20",
1973
+ fill: "currentColor",
1974
+ xmlns: "http://www.w3.org/2000/svg",
1975
+ "aria-hidden": "true",
1976
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1977
+ "path",
1978
+ {
1979
+ fillRule: "evenodd",
1980
+ d: "M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",
1981
+ clipRule: "evenodd"
1982
+ }
1983
+ )
1984
+ }
1985
+ );
1986
+ var ChevronLeftIcon = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx(
1987
+ "svg",
1988
+ {
1989
+ className,
1990
+ viewBox: "0 0 20 20",
1991
+ fill: "currentColor",
1992
+ xmlns: "http://www.w3.org/2000/svg",
1993
+ "aria-hidden": "true",
1994
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1995
+ "path",
1996
+ {
1997
+ fillRule: "evenodd",
1998
+ d: "M12.79 5.23a.75.75 0 01-.02 1.06L8.832 10l3.938 3.71a.75.75 0 11-1.04 1.08l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 011.06.02z",
1999
+ clipRule: "evenodd"
2000
+ }
2001
+ )
2002
+ }
2003
+ );
2004
+ var ChevronRightIcon = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx(
2005
+ "svg",
2006
+ {
2007
+ className,
2008
+ viewBox: "0 0 20 20",
2009
+ fill: "currentColor",
2010
+ xmlns: "http://www.w3.org/2000/svg",
2011
+ "aria-hidden": "true",
2012
+ children: /* @__PURE__ */ jsxRuntime.jsx(
2013
+ "path",
2014
+ {
2015
+ fillRule: "evenodd",
2016
+ d: "M7.21 14.77a.75.75 0 010-1.06L11.168 10 7.23 6.29a.75.75 0 011.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z",
2017
+ clipRule: "evenodd"
2018
+ }
2019
+ )
2020
+ }
2021
+ );
2022
+ var EraserIcon = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "17", height: "16", viewBox: "0 0 17 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxRuntime.jsx(
2023
+ "path",
2024
+ {
2025
+ d: "M15.3134 13.7509H9.45406L16.2384 6.96656C16.4416 6.76343 16.6027 6.52227 16.7127 6.25686C16.8226 5.99145 16.8792 5.70697 16.8792 5.41969C16.8792 5.1324 16.8226 4.84793 16.7127 4.58252C16.6027 4.3171 16.4416 4.07594 16.2384 3.87281L13.0033 0.640783C12.8002 0.437631 12.559 0.276481 12.2936 0.166535C12.0282 0.0565888 11.7437 0 11.4564 0C11.1691 0 10.8846 0.0565888 10.6192 0.166535C10.3538 0.276481 10.1127 0.437631 9.90953 0.640783L0.640783 9.90875C0.437631 10.1119 0.276481 10.353 0.166535 10.6185C0.0565888 10.8839 0 11.1683 0 11.4556C0 11.7429 0.0565888 12.0274 0.166535 12.2928C0.276481 12.5582 0.437631 12.7994 0.640783 13.0025L2.98922 15.3517C3.07635 15.4388 3.17977 15.5078 3.29358 15.5548C3.40739 15.6019 3.52935 15.626 3.6525 15.6259H15.3134C15.5621 15.6259 15.8005 15.5272 15.9763 15.3514C16.1522 15.1755 16.2509 14.9371 16.2509 14.6884C16.2509 14.4398 16.1522 14.2013 15.9763 14.0255C15.8005 13.8497 15.5621 13.7509 15.3134 13.7509ZM11.2353 1.96656C11.2643 1.93751 11.2988 1.91446 11.3367 1.89873C11.3747 1.88301 11.4153 1.87491 11.4564 1.87491C11.4975 1.87491 11.5381 1.88301 11.5761 1.89873C11.614 1.91446 11.6485 1.93751 11.6775 1.96656L14.9103 5.19938C14.9688 5.25796 15.0016 5.33733 15.0016 5.42008C15.0016 5.50283 14.9688 5.5822 14.9103 5.64078L10.9384 9.61031L7.26656 5.93844L11.2353 1.96656ZM4.04078 13.7509L1.96656 11.6767C1.90812 11.6181 1.8753 11.5388 1.8753 11.456C1.8753 11.3733 1.90812 11.2939 1.96656 11.2353L5.93844 7.26656L9.61031 10.9384L6.79781 13.7509H4.04078Z",
2026
+ fill: "#374151"
2027
+ }
2028
+ ) });
2029
+ var DateSelect = React9.forwardRef(
2030
+ function DateSelect2(props, ref) {
2031
+ const {
2032
+ label,
2033
+ subtitle,
2034
+ placeholder = "Selecione",
2035
+ status = "default",
2036
+ size = "md",
2037
+ radius = "xs",
2038
+ helperText,
2039
+ disabled = false,
2040
+ className = "",
2041
+ wrapperClassName = "",
2042
+ startYear,
2043
+ endYear,
2044
+ backgroundColor
2045
+ } = props;
2046
+ const triggerId = React9__default.default.useId();
2047
+ const helperId = React9__default.default.useId();
2048
+ const [isOpen, setIsOpen] = React9.useState(false);
2049
+ const [isHelperDismissed, setIsHelperDismissed] = React9.useState(false);
2050
+ const [internalValue, setInternalValue] = React9.useState(
2051
+ props.defaultValue ?? { mode: "day" }
2052
+ );
2053
+ const isControlled = props.value !== void 0;
2054
+ const value = isControlled ? props.value ?? internalValue : internalValue;
2055
+ const [activeMode, setActiveMode] = React9.useState(value.mode ?? "day");
2056
+ const [selectedYear, setSelectedYear] = React9.useState((/* @__PURE__ */ new Date()).getFullYear());
2057
+ const [selectedMonth, setSelectedMonth] = React9.useState((/* @__PURE__ */ new Date()).getMonth());
2058
+ const rightMonth = selectedMonth === 11 ? 0 : selectedMonth + 1;
2059
+ const rightYear = selectedMonth === 11 ? selectedYear + 1 : selectedYear;
2060
+ const [intervalStart, setIntervalStart] = React9.useState(value.startDate);
2061
+ const [intervalEnd, setIntervalEnd] = React9.useState(value.endDate);
2062
+ const [hoverDate, setHoverDate] = React9.useState();
2063
+ const [yearGridStart, setYearGridStart] = React9.useState(
2064
+ Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 12) * 12
2065
+ );
2066
+ const wrapperRef = React9__default.default.useRef(null);
2067
+ const innerRef = React9__default.default.useRef(null);
2068
+ React9__default.default.useImperativeHandle(ref, () => innerRef.current);
2069
+ const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
2070
+ const yearStart = startYear ?? currentYear - 10;
2071
+ const yearEnd = endYear ?? currentYear + 10;
2072
+ const visualStatus = helperText && isHelperDismissed ? "default" : status;
2073
+ const handleChange = (newValue) => {
2074
+ if (helperText) setIsHelperDismissed(true);
2075
+ if (!isControlled) setInternalValue(newValue);
2076
+ props.onChange?.(newValue);
2077
+ if (newValue.mode !== "interval") {
2078
+ setIsOpen(false);
2079
+ }
2080
+ };
2081
+ const handleIntervalApply = () => {
2082
+ if (!intervalStart || !intervalEnd) return;
2083
+ const newValue = {
2084
+ mode: "interval",
2085
+ startDate: intervalStart,
2086
+ endDate: intervalEnd
2087
+ };
2088
+ if (helperText) setIsHelperDismissed(true);
2089
+ if (!isControlled) setInternalValue(newValue);
2090
+ props.onChange?.(newValue);
2091
+ setIsOpen(false);
2092
+ };
2093
+ const handleIntervalClear = () => {
2094
+ setIntervalStart(void 0);
2095
+ setIntervalEnd(void 0);
2096
+ setHoverDate(void 0);
2097
+ const newValue = { mode: "interval" };
2098
+ if (!isControlled) setInternalValue(newValue);
2099
+ props.onChange?.(newValue);
2100
+ };
2101
+ const displayText = React9__default.default.useMemo(() => {
2102
+ if (value.mode === "year" && value.year) return value.year.toString();
2103
+ if (value.mode === "month" && value.year != null)
2104
+ return `${MONTHS_SHORT[value.month || 0]} ${value.year}`;
2105
+ if (value.mode === "day" && value.year != null)
2106
+ return `${value.day}/${(value.month ?? 0) + 1}/${value.year}`;
2107
+ if (value.mode === "interval" && value.startDate && value.endDate) {
2108
+ return `${value.startDate.toLocaleDateString("pt-BR")} - ${value.endDate.toLocaleDateString("pt-BR")}`;
2109
+ }
2110
+ return null;
2111
+ }, [value]);
2112
+ React9__default.default.useEffect(() => {
2113
+ if (!isOpen) return;
2114
+ const handleClickOutside = (e) => {
2115
+ if (wrapperRef.current && !wrapperRef.current.contains(e.target)) {
2116
+ setIsOpen(false);
2117
+ }
2118
+ };
2119
+ document.addEventListener("mousedown", handleClickOutside);
2120
+ return () => document.removeEventListener("mousedown", handleClickOutside);
2121
+ }, [isOpen]);
2122
+ React9__default.default.useEffect(() => {
2123
+ if (!isOpen) return;
2124
+ const handleEscape = (e) => {
2125
+ if (e.key === "Escape") {
2126
+ setIsOpen(false);
2127
+ innerRef.current?.focus();
2128
+ }
2129
+ };
2130
+ document.addEventListener("keydown", handleEscape);
2131
+ return () => document.removeEventListener("keydown", handleEscape);
2132
+ }, [isOpen]);
2133
+ const getDaysInMonth2 = (year, month) => new Date(year, month + 1, 0).getDate();
2134
+ const getFirstDayOfMonth2 = (year, month) => new Date(year, month, 1).getDay();
2135
+ const isSameDay = (a, b) => a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
2136
+ const isInRange = (date, start, end) => {
2137
+ if (!start) return false;
2138
+ const ref2 = end ?? hoverDate;
2139
+ if (!ref2) return false;
2140
+ const [lo, hi] = start <= ref2 ? [start, ref2] : [ref2, start];
2141
+ return date > lo && date < hi;
2142
+ };
2143
+ const renderModeTabs = () => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rh-flex rh-border-b rh-border-border rh-bg-transparent", children: MODE_OPTIONS.map((option) => /* @__PURE__ */ jsxRuntime.jsx(
2144
+ "button",
2145
+ {
2146
+ onClick: () => setActiveMode(option.value),
2147
+ className: [
2148
+ "rh-flex-1 rh-py-2 rh-px-4 rh-text-sm rh-transition-colors rh-duration-150 rh-text-text rh-font-bold",
2149
+ "rh-border-b-2 -rh-mb-px",
2150
+ activeMode === option.value ? "rh-border-primary" : "rh-border-transparent hover:rh-border-border"
2151
+ ].join(" "),
2152
+ children: option.label
2153
+ },
2154
+ option.value
2155
+ )) });
2156
+ const renderYearGrid = () => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rh-p-1", children: [
2157
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rh-flex rh-items-center rh-justify-between", children: [
2158
+ /* @__PURE__ */ jsxRuntime.jsx(
2159
+ "button",
2160
+ {
2161
+ onClick: () => setYearGridStart((s) => s - 12),
2162
+ className: "rh-p-1 hover:rh-bg-background rh-rounded",
2163
+ children: /* @__PURE__ */ jsxRuntime.jsx(ChevronLeftIcon, { className: "rh-w-5 rh-h-5" })
2164
+ }
2165
+ ),
2166
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "rh-text-sm rh-font-medium rh-text-text", children: [
2167
+ yearGridStart,
2168
+ " \u2013 ",
2169
+ yearGridStart + 11
2170
+ ] }),
2171
+ /* @__PURE__ */ jsxRuntime.jsx(
2172
+ "button",
2173
+ {
2174
+ onClick: () => setYearGridStart((s) => s + 12),
2175
+ className: "rh-p-1 hover:rh-bg-background rh-rounded",
2176
+ children: /* @__PURE__ */ jsxRuntime.jsx(ChevronRightIcon, { className: "rh-w-5 rh-h-5" })
2177
+ }
2178
+ )
2179
+ ] }),
2180
+ /* @__PURE__ */ jsxRuntime.jsx(
2181
+ "svg",
2182
+ {
2183
+ xmlns: "http://www.w3.org/2000/svg",
2184
+ width: "100%",
2185
+ height: "1",
2186
+ viewBox: "0 0 350 1",
2187
+ fill: "none",
2188
+ className: "rh-mb-3",
2189
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0 0.5H350", stroke: "#F5F5F5" })
2190
+ }
2191
+ ),
2192
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rh-grid rh-grid-cols-4 rh-gap-2", children: Array.from({ length: 12 }, (_, i) => yearGridStart + i).map((year) => {
2193
+ const isSelected = value.mode === "year" && value.year === year;
2194
+ const outOfRange = year < yearStart || year > yearEnd;
2195
+ return /* @__PURE__ */ jsxRuntime.jsx(
2196
+ "button",
2197
+ {
2198
+ disabled: outOfRange,
2199
+ onClick: () => handleChange({ mode: "year", year }),
2200
+ className: [
2201
+ "rh-rounded-sm rh-py-4 rh-w-auto rh-text-sm rh-transition-colors rh-duration-150 rh-border-border rh-border",
2202
+ isSelected ? "rh-bg-primary rh-text-surface" : "rh-text-text hover:rh-bg-background",
2203
+ outOfRange ? "rh-opacity-30 rh-cursor-not-allowed" : ""
2204
+ ].join(" "),
2205
+ children: year
2206
+ },
2207
+ year
2208
+ );
2209
+ }) })
2210
+ ] });
2211
+ const renderMonthGrid = () => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rh-p-1", children: [
2212
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rh-flex rh-items-center rh-justify-between", children: [
2213
+ /* @__PURE__ */ jsxRuntime.jsx(
2214
+ "button",
2215
+ {
2216
+ onClick: () => setSelectedYear((y) => y - 1),
2217
+ className: "rh-p-1 hover:rh-bg-background rh-rounded",
2218
+ children: /* @__PURE__ */ jsxRuntime.jsx(ChevronLeftIcon, { className: "rh-w-5 rh-h-5" })
2219
+ }
2220
+ ),
2221
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rh-text-sm rh-font-medium rh-text-text", children: selectedYear }),
2222
+ /* @__PURE__ */ jsxRuntime.jsx(
2223
+ "button",
2224
+ {
2225
+ onClick: () => setSelectedYear((y) => y + 1),
2226
+ className: "rh-p-1 hover:rh-bg-background rh-rounded",
2227
+ children: /* @__PURE__ */ jsxRuntime.jsx(ChevronRightIcon, { className: "rh-w-5 rh-h-5" })
2228
+ }
2229
+ )
2230
+ ] }),
2231
+ /* @__PURE__ */ jsxRuntime.jsx(
2232
+ "svg",
2233
+ {
2234
+ xmlns: "http://www.w3.org/2000/svg",
2235
+ width: "100%",
2236
+ height: "1",
2237
+ viewBox: "0 0 350 1",
2238
+ fill: "none",
2239
+ className: "rh-mb-3",
2240
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0 0.5H350", stroke: "#F5F5F5" })
2241
+ }
2242
+ ),
2243
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rh-grid rh-grid-cols-4 rh-gap-2", children: MONTHS.map((month, index) => {
2244
+ const isSelected = value.mode === "month" && value.year === selectedYear && value.month === index;
2245
+ return /* @__PURE__ */ jsxRuntime.jsx(
2246
+ "button",
2247
+ {
2248
+ onClick: () => handleChange({ mode: "month", year: selectedYear, month: index }),
2249
+ className: [
2250
+ "rh-rounded-sm rh-py-4 rh-w-auto rh-text-sm rh-transition-colors rh-duration-150 rh-border-border rh-border",
2251
+ isSelected ? "rh-bg-primary rh-text-surface" : "rh-text-text hover:rh-bg-background"
2252
+ ].join(" "),
2253
+ children: month
2254
+ },
2255
+ month
2256
+ );
2257
+ }) })
2258
+ ] });
2259
+ const renderIntervalNav = () => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
2260
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rh-flex rh-gap-4 rh-p-1", children: [
2261
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rh-flex-1", children: [
2262
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rh-flex rh-items-center rh-justify-between", children: [
2263
+ /* @__PURE__ */ jsxRuntime.jsx(
2264
+ "button",
2265
+ {
2266
+ onClick: () => {
2267
+ if (selectedMonth === 0) {
2268
+ setSelectedMonth(11);
2269
+ setSelectedYear((y) => y - 1);
2270
+ } else setSelectedMonth((m) => m - 1);
2271
+ },
2272
+ className: "rh-p-1 hover:rh-bg-background rh-rounded",
2273
+ children: /* @__PURE__ */ jsxRuntime.jsx(ChevronLeftIcon, { className: "rh-w-5 rh-h-5" })
2274
+ }
2275
+ ),
2276
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "rh-text-sm rh-font-medium rh-text-text", children: [
2277
+ MONTHS[selectedMonth],
2278
+ " - ",
2279
+ selectedYear
2280
+ ] }),
2281
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rh-w-7" })
2282
+ ] }),
2283
+ /* @__PURE__ */ jsxRuntime.jsx(
2284
+ "svg",
2285
+ {
2286
+ xmlns: "http://www.w3.org/2000/svg",
2287
+ width: "100%",
2288
+ height: "1",
2289
+ viewBox: "0 0 350 1",
2290
+ fill: "none",
2291
+ className: "rh-mb-3",
2292
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0 0.5H350", stroke: "#F5F5F5" })
2293
+ }
2294
+ ),
2295
+ /* @__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(
2296
+ "div",
2297
+ {
2298
+ className: "rh-text-center rh-text-xs rh-text-text-muted rh-font-medium rh-py-1",
2299
+ children: d
2300
+ },
2301
+ i
2302
+ )) }),
2303
+ renderIntervalDays(selectedYear, selectedMonth)
2304
+ ] }),
2305
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rh-w-px rh-bg-border/30 rh-self-stretch" }),
2306
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rh-flex-1", children: [
2307
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rh-flex rh-items-center rh-justify-between", children: [
2308
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rh-w-7" }),
2309
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "rh-text-sm rh-font-medium rh-text-text", children: [
2310
+ MONTHS[rightMonth],
2311
+ " - ",
2312
+ rightYear
2313
+ ] }),
2314
+ /* @__PURE__ */ jsxRuntime.jsx(
2315
+ "button",
2316
+ {
2317
+ onClick: () => {
2318
+ if (selectedMonth === 11) {
2319
+ setSelectedMonth(0);
2320
+ setSelectedYear((y) => y + 1);
2321
+ } else setSelectedMonth((m) => m + 1);
2322
+ },
2323
+ className: "rh-p-1 hover:rh-bg-background rh-rounded",
2324
+ children: /* @__PURE__ */ jsxRuntime.jsx(ChevronRightIcon, { className: "rh-w-5 rh-h-5" })
2325
+ }
2326
+ )
2327
+ ] }),
2328
+ /* @__PURE__ */ jsxRuntime.jsx(
2329
+ "svg",
2330
+ {
2331
+ xmlns: "http://www.w3.org/2000/svg",
2332
+ width: "100%",
2333
+ height: "1",
2334
+ viewBox: "0 0 350 1",
2335
+ fill: "none",
2336
+ className: "rh-mb-3",
2337
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0 0.5H350", stroke: "#F5F5F5" })
2338
+ }
2339
+ ),
2340
+ /* @__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(
2341
+ "div",
2342
+ {
2343
+ className: "rh-text-center rh-text-xs rh-text-text-muted rh-font-medium rh-py-1",
2344
+ children: d
2345
+ },
2346
+ i
2347
+ )) }),
2348
+ renderIntervalDays(rightYear, rightMonth)
2349
+ ] })
2350
+ ] }),
2351
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rh-flex rh-items-center rh-justify-between rh-pt-3 rh-mt-3 rh-border-t rh-border-border/30", children: [
2352
+ /* @__PURE__ */ jsxRuntime.jsxs(
2353
+ "button",
2354
+ {
2355
+ onClick: handleIntervalClear,
2356
+ 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",
2357
+ children: [
2358
+ /* @__PURE__ */ jsxRuntime.jsx(EraserIcon, { className: "rh-w-4 rh-h-4" }),
2359
+ "Limpar"
2360
+ ]
2361
+ }
2362
+ ),
2363
+ /* @__PURE__ */ jsxRuntime.jsx(
2364
+ "button",
2365
+ {
2366
+ onClick: handleIntervalApply,
2367
+ disabled: !intervalStart || !intervalEnd,
2368
+ style: {
2369
+ backgroundColor: intervalStart && intervalEnd ? "#87A851" : "#87A85180",
2370
+ pointerEvents: !intervalStart || !intervalEnd ? "none" : "auto"
2371
+ },
2372
+ className: [
2373
+ "rh-text-sm rh-font-medium rh-px-4 rh-py-1.5 rh-rounded-lg rh-transition-colors rh-duration-150",
2374
+ intervalStart && intervalEnd ? "rh-text-surface hover:rh-opacity-90" : " rh-text-surface"
2375
+ ].join(" "),
2376
+ children: "Aplicar"
2377
+ }
2378
+ )
2379
+ ] })
2380
+ ] });
2381
+ const renderIntervalDays = (calYear, calMonth) => {
2382
+ const daysInMonth = getDaysInMonth2(calYear, calMonth);
2383
+ const firstDay = getFirstDayOfMonth2(calYear, calMonth);
2384
+ const days = Array.from({ length: daysInMonth }, (_, i) => i + 1);
2385
+ const prevMonth = calMonth === 0 ? 11 : calMonth - 1;
2386
+ const prevYear = calMonth === 0 ? calYear - 1 : calYear;
2387
+ const daysInPrevMonth = getDaysInMonth2(prevYear, prevMonth);
2388
+ const prevDays = Array.from(
2389
+ { length: firstDay },
2390
+ (_, i) => daysInPrevMonth - firstDay + i + 1
2391
+ );
2392
+ const totalCells = firstDay + daysInMonth;
2393
+ const nextDaysCount = totalCells % 7 === 0 ? 0 : 7 - totalCells % 7;
2394
+ const nextDays = Array.from({ length: nextDaysCount }, (_, i) => i + 1);
2395
+ const handleDayClick = (day) => {
2396
+ const clicked = new Date(calYear, calMonth, day);
2397
+ if (!intervalStart || intervalStart && intervalEnd) {
2398
+ setIntervalStart(clicked);
2399
+ setIntervalEnd(void 0);
2400
+ } else {
2401
+ const [lo, hi] = clicked >= intervalStart ? [intervalStart, clicked] : [clicked, intervalStart];
2402
+ setIntervalStart(lo);
2403
+ setIntervalEnd(hi);
2404
+ }
2405
+ };
2406
+ const getDayClasses = (day) => {
2407
+ const date = new Date(calYear, calMonth, day);
2408
+ const isStart = intervalStart && isSameDay(date, intervalStart);
2409
+ const isEnd = intervalEnd && isSameDay(date, intervalEnd);
2410
+ const isHoverEnd = !intervalEnd && hoverDate && isSameDay(date, hoverDate) && intervalStart;
2411
+ const inRange = isInRange(date, intervalStart, intervalEnd);
2412
+ const inHoverRange = !intervalEnd && isInRange(date, intervalStart, hoverDate);
2413
+ return [
2414
+ "rh-w-7 rh-h-7 rh-flex rh-items-center rh-justify-center rh-text-sm rh-transition-colors rh-duration-150 ",
2415
+ "rh-rounded-lg",
2416
+ isStart || isEnd ? "rh-bg-primary rh-text-surface" : "",
2417
+ isHoverEnd && !isStart ? "rh-bg-primary/70 rh-text-surface" : "",
2418
+ inRange || inHoverRange ? "rh-bg-primary/10 rh-text-text" : "",
2419
+ !isStart && !isEnd && !inRange && !inHoverRange && !isHoverEnd ? "rh-text-text hover:rh-ring-1 hover:rh-ring-[#15607A]" : ""
2420
+ ].join(" ");
2421
+ };
2422
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rh-grid rh-grid-cols-7 rh-gap-0 rh-text-center", children: [
2423
+ prevDays.map((d, i) => /* @__PURE__ */ jsxRuntime.jsx(
2424
+ "div",
2425
+ {
2426
+ 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",
2427
+ children: d
2428
+ },
2429
+ `prev-${i}`
2430
+ )),
2431
+ days.map((day) => /* @__PURE__ */ jsxRuntime.jsx(
2432
+ "button",
2433
+ {
2434
+ onClick: () => handleDayClick(day),
2435
+ onMouseEnter: () => {
2436
+ if (intervalStart && !intervalEnd) {
2437
+ setHoverDate(new Date(calYear, calMonth, day));
2438
+ }
2439
+ },
2440
+ onMouseLeave: () => setHoverDate(void 0),
2441
+ className: getDayClasses(day),
2442
+ children: day
2443
+ },
2444
+ day
2445
+ )),
2446
+ nextDays.map((d, i) => /* @__PURE__ */ jsxRuntime.jsx(
2447
+ "div",
2448
+ {
2449
+ 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",
2450
+ children: d
2451
+ },
2452
+ `next-${i}`
2453
+ ))
2454
+ ] });
2455
+ };
2456
+ const renderContent = () => {
2457
+ switch (activeMode) {
2458
+ case "interval":
2459
+ return renderIntervalNav();
2460
+ case "day":
2461
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rh-p-1", children: [
2462
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rh-flex rh-items-center rh-justify-between", children: [
2463
+ /* @__PURE__ */ jsxRuntime.jsx(
2464
+ "button",
2465
+ {
2466
+ onClick: () => {
2467
+ if (selectedMonth === 0) {
2468
+ setSelectedMonth(11);
2469
+ setSelectedYear((y) => y - 1);
2470
+ } else setSelectedMonth((m) => m - 1);
2471
+ },
2472
+ className: "rh-p-1 hover:rh-bg-background rh-rounded",
2473
+ children: /* @__PURE__ */ jsxRuntime.jsx(ChevronLeftIcon, { className: "rh-w-5 rh-h-5" })
2474
+ }
2475
+ ),
2476
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "rh-text-sm rh-font-medium rh-text-text", children: [
2477
+ MONTHS[selectedMonth],
2478
+ " - ",
2479
+ selectedYear
2480
+ ] }),
2481
+ /* @__PURE__ */ jsxRuntime.jsx(
2482
+ "button",
2483
+ {
2484
+ onClick: () => {
2485
+ if (selectedMonth === 11) {
2486
+ setSelectedMonth(0);
2487
+ setSelectedYear((y) => y + 1);
2488
+ } else setSelectedMonth((m) => m + 1);
2489
+ },
2490
+ className: "rh-p-1 hover:rh-bg-background rh-rounded",
2491
+ children: /* @__PURE__ */ jsxRuntime.jsx(ChevronRightIcon, { className: "rh-w-5 rh-h-5" })
2492
+ }
2493
+ )
2494
+ ] }),
2495
+ /* @__PURE__ */ jsxRuntime.jsx(
2496
+ "svg",
2497
+ {
2498
+ xmlns: "http://www.w3.org/2000/svg",
2499
+ width: "100%",
2500
+ height: "1",
2501
+ viewBox: "0 0 350 1",
2502
+ fill: "none",
2503
+ className: "rh-mb-3",
2504
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0 0.5H350", stroke: "#F5F5F5" })
2505
+ }
2506
+ ),
2507
+ /* @__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(
2508
+ "div",
2509
+ {
2510
+ className: "rh-text-center rh-text-xs rh-text-text-muted rh-font-medium rh-py-1",
2511
+ children: d
2512
+ },
2513
+ i
2514
+ )) }),
2515
+ renderDayGrid(selectedYear, selectedMonth)
2516
+ ] });
2517
+ case "month":
2518
+ return renderMonthGrid();
2519
+ case "year":
2520
+ return renderYearGrid();
2521
+ }
2522
+ };
2523
+ const renderDayGrid = (calYear, calMonth) => {
2524
+ const daysInMonth = getDaysInMonth2(calYear, calMonth);
2525
+ const firstDay = getFirstDayOfMonth2(calYear, calMonth);
2526
+ const days = Array.from({ length: daysInMonth }, (_, i) => i + 1);
2527
+ const prevMonth = calMonth === 0 ? 11 : calMonth - 1;
2528
+ const prevYear = calMonth === 0 ? calYear - 1 : calYear;
2529
+ const daysInPrevMonth = getDaysInMonth2(prevYear, prevMonth);
2530
+ const prevDays = Array.from(
2531
+ { length: firstDay },
2532
+ (_, i) => daysInPrevMonth - firstDay + i + 1
2533
+ );
2534
+ const totalCells = firstDay + daysInMonth;
2535
+ const nextDaysCount = totalCells % 7 === 0 ? 0 : 7 - totalCells % 7;
2536
+ const nextDays = Array.from({ length: nextDaysCount }, (_, i) => i + 1);
2537
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rh-grid rh-grid-cols-7 rh-gap-0", children: [
2538
+ prevDays.map((d, i) => /* @__PURE__ */ jsxRuntime.jsx(
2539
+ "div",
2540
+ {
2541
+ 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",
2542
+ children: d
2543
+ },
2544
+ `prev-${i}`
2545
+ )),
2546
+ days.map((day) => {
2547
+ const isSelected = value.mode === "day" && value.year === calYear && value.month === calMonth && value.day === day;
2548
+ return /* @__PURE__ */ jsxRuntime.jsx(
2549
+ "button",
2550
+ {
2551
+ onClick: () => handleChange({ mode: "day", year: calYear, month: calMonth, day }),
2552
+ className: [
2553
+ "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",
2554
+ isSelected ? "rh-bg-primary rh-text-surface" : "rh-text-text hover:rh-ring-1 hover:rh-ring-[#15607A]"
2555
+ ].join(" "),
2556
+ children: day
2557
+ },
2558
+ day
2559
+ );
2560
+ }),
2561
+ nextDays.map((d, i) => /* @__PURE__ */ jsxRuntime.jsx(
2562
+ "div",
2563
+ {
2564
+ 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",
2565
+ children: d
2566
+ },
2567
+ `next-${i}`
2568
+ ))
2569
+ ] });
2570
+ };
2571
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2572
+ "div",
2573
+ {
2574
+ ref: wrapperRef,
2575
+ className: ["rh-relative rh-flex rh-flex-col rh-gap-1 rh-font-body", wrapperClassName].filter(Boolean).join(" "),
2576
+ children: [
2577
+ label && /* @__PURE__ */ jsxRuntime.jsxs("label", { id: `${triggerId}-label`, className: "rh-flex rh-items-baseline rh-gap-1", children: [
2578
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rh-text-sm rh-font-medium rh-text-text", children: label }),
2579
+ subtitle && /* @__PURE__ */ jsxRuntime.jsx("span", { className: `rh-text-sm ${getSubtitleClassName3(subtitle)}`, children: subtitle })
2580
+ ] }),
2581
+ /* @__PURE__ */ jsxRuntime.jsxs(
2582
+ "button",
2583
+ {
2584
+ ref: innerRef,
2585
+ id: triggerId,
2586
+ type: "button",
2587
+ role: "combobox",
2588
+ "aria-expanded": isOpen,
2589
+ "aria-haspopup": "dialog",
2590
+ "aria-labelledby": label ? `${triggerId}-label` : void 0,
2591
+ "aria-describedby": helperText ? helperId : void 0,
2592
+ "aria-invalid": visualStatus === "error" || void 0,
2593
+ "aria-disabled": disabled || void 0,
2594
+ disabled,
2595
+ onClick: () => !disabled && setIsOpen((o) => !o),
2596
+ style: backgroundColor ? { backgroundColor } : void 0,
2597
+ className: [
2598
+ "rh-group rh-flex rh-items-center rh-justify-between rh-gap-2",
2599
+ "rh-border rh-font-body",
2600
+ !backgroundColor && "rh-bg-surface",
2601
+ "rh-transition-colors rh-duration-150",
2602
+ "rh-text-left rh-w-full",
2603
+ statusClasses3[visualStatus],
2604
+ radiusClasses5[radius],
2605
+ sizeClasses6[size],
2606
+ disabled ? "rh-opacity-50 rh-cursor-not-allowed rh-bg-background" : "rh-cursor-pointer",
2607
+ className
2608
+ ].filter(Boolean).join(" "),
2609
+ children: [
2610
+ /* @__PURE__ */ jsxRuntime.jsx(
2611
+ "span",
2612
+ {
2613
+ className: [
2614
+ "rh-flex-1 rh-truncate",
2615
+ displayText ? "rh-text-text" : "rh-text-text-muted group-hover:rh-text-text"
2616
+ ].join(" "),
2617
+ children: displayText ?? placeholder
2618
+ }
2619
+ ),
2620
+ /* @__PURE__ */ jsxRuntime.jsx(
2621
+ ChevronIcon2,
2622
+ {
2623
+ className: [
2624
+ "rh-w-4 rh-h-4 rh-shrink-0 rh-text-text-muted rh-transition-transform rh-duration-150 rh-bg-surface rh-rounded-xl",
2625
+ isOpen ? "rh-rotate-180" : ""
2626
+ ].filter(Boolean).join(" ")
2627
+ }
2628
+ )
2629
+ ]
2630
+ }
2631
+ ),
2632
+ isOpen && /* @__PURE__ */ jsxRuntime.jsxs(
2633
+ "div",
2634
+ {
2635
+ className: [
2636
+ "rh-absolute rh-z-50 rh-mt-1 rh-p-5",
2637
+ "rh-bg-surface rh-rounded-md",
2638
+ dropdownRadiusClasses2[radius],
2639
+ activeMode === "interval" ? "rh-w-[720px]" : "rh-w-[385px]"
2640
+ ].filter(Boolean).join(" "),
2641
+ style: {
2642
+ top: "100%",
2643
+ boxShadow: "0 0 9.6px 0 rgba(8, 11, 18, 0.08)"
2644
+ },
2645
+ children: [
2646
+ renderModeTabs(),
2647
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rh-mt-2", children: renderContent() })
2648
+ ]
2649
+ }
2650
+ ),
2651
+ helperText && !isHelperDismissed && /* @__PURE__ */ jsxRuntime.jsxs(
2652
+ "span",
2653
+ {
2654
+ id: helperId,
2655
+ className: [
2656
+ "rh-flex rh-items-center rh-gap-1 rh-text-xs",
2657
+ helperStatusClasses3[visualStatus]
2658
+ ].join(" "),
2659
+ children: [
2660
+ /* @__PURE__ */ jsxRuntime.jsx(WarningCircleIcon, {}),
2661
+ helperText
2662
+ ]
2663
+ }
2664
+ )
2665
+ ]
2666
+ }
2667
+ );
2668
+ }
2669
+ );
1892
2670
  var variantClasses = {
1893
2671
  light: "rh-bg-surface rh-text-text rh-border rh-border-border rh-shadow-md",
1894
2672
  default: "rh-bg-primary/10 rh-text-text rh-border rh-border-primary/20 rh-shadow-md",
@@ -1899,7 +2677,7 @@ var arrowVariantClasses = {
1899
2677
  default: "rh-border-primary/20 rh-bg-primary/10",
1900
2678
  dark: "rh-bg-primary"
1901
2679
  };
1902
- var sizeClasses6 = {
2680
+ var sizeClasses7 = {
1903
2681
  sm: "rh-px-3 rh-py-1.5 rh-text-xs",
1904
2682
  md: "rh-px-4 rh-py-3 rh-text-sm"
1905
2683
  };
@@ -2030,7 +2808,7 @@ var Tooltip = React9.forwardRef(
2030
2808
  "rh-absolute rh-z-50 rh-w-max rh-max-w-xs rh-rounded-xs",
2031
2809
  tooltipPlacementClasses[placement],
2032
2810
  variantClasses[variant],
2033
- sizeClasses6[size],
2811
+ sizeClasses7[size],
2034
2812
  className
2035
2813
  ].filter(Boolean).join(" "),
2036
2814
  children: [
@@ -2131,7 +2909,7 @@ function getAvatarColors(name) {
2131
2909
  const index = hash % AVATAR_COLORS.length;
2132
2910
  return AVATAR_COLORS[index];
2133
2911
  }
2134
- var sizeClasses7 = {
2912
+ var sizeClasses8 = {
2135
2913
  sm: "rh-w-8 rh-h-8 rh-text-xs",
2136
2914
  md: "rh-w-10 rh-h-10 rh-text-sm",
2137
2915
  lg: "rh-w-12 rh-h-12 rh-text-base",
@@ -2166,7 +2944,7 @@ var Avatar = React9.forwardRef(function Avatar2({ src, alt = "", initials, size
2166
2944
  "rh-inline-flex rh-items-center rh-justify-center rh-shrink-0 rh-overflow-hidden",
2167
2945
  avatarColors ? "" : "rh-bg-primary rh-text-surface",
2168
2946
  "rh-font-display rh-font-medium rh-select-none",
2169
- sizeClasses7[size],
2947
+ sizeClasses8[size],
2170
2948
  variantClasses2[variant],
2171
2949
  className
2172
2950
  ].filter(Boolean).join(" "),
@@ -2233,7 +3011,7 @@ var hoverInactivePresetClasses = {
2233
3011
  info: "hover:rh-bg-info/20 hover:rh-border-info/50",
2234
3012
  neutral: "hover:rh-bg-neutral/20 hover:rh-border-neutral/50"
2235
3013
  };
2236
- var sizeClasses8 = {
3014
+ var sizeClasses9 = {
2237
3015
  sm: "rh-text-xs rh-px-2 rh-py-0.5 rh-gap-1",
2238
3016
  md: "rh-text-sm rh-px-2.5 rh-py-1 rh-gap-1.5",
2239
3017
  lg: "rh-text-sm rh-px-3 rh-py-1.5 rh-gap-1.5"
@@ -2280,7 +3058,7 @@ var Tag = React9.forwardRef(function Tag2({
2280
3058
  "rh-transition-colors rh-duration-150",
2281
3059
  "rh-cursor-pointer",
2282
3060
  clickable ? "rh-cursor-pointer" : "",
2283
- sizeClasses8[size],
3061
+ sizeClasses9[size],
2284
3062
  colorClasses3,
2285
3063
  hoverClasses,
2286
3064
  disabled ? "rh-opacity-50 rh-cursor-not-allowed rh-pointer-events-none" : "",
@@ -2297,16 +3075,16 @@ var Tag = React9.forwardRef(function Tag2({
2297
3075
  }
2298
3076
  );
2299
3077
  });
2300
- var statusClasses3 = {
3078
+ var statusClasses4 = {
2301
3079
  default: "rh-border-border focus-within:rh-ring-2 focus-within:rh-ring-ring focus-within:rh-ring-offset-2",
2302
3080
  error: "rh-border-danger focus-within:rh-ring-2 focus-within:rh-ring-danger focus-within:rh-ring-offset-2"
2303
3081
  };
2304
- var sizeClasses9 = {
3082
+ var sizeClasses10 = {
2305
3083
  sm: "rh-min-h-[36px] rh-text-sm rh-px-2 rh-py-1",
2306
3084
  md: "rh-h-[44px] rh-text-sm rh-px-2 rh-py-[6px]",
2307
3085
  lg: "rh-min-h-[52px] rh-text-base rh-px-3 rh-py-2"
2308
3086
  };
2309
- var radiusClasses5 = {
3087
+ var radiusClasses6 = {
2310
3088
  none: "rh-rounded-none",
2311
3089
  xxs: "rh-rounded-xxs",
2312
3090
  xs: "rh-rounded-xs",
@@ -2316,7 +3094,7 @@ var radiusClasses5 = {
2316
3094
  xl: "rh-rounded-xl",
2317
3095
  full: "rh-rounded-full"
2318
3096
  };
2319
- var helperStatusClasses3 = {
3097
+ var helperStatusClasses4 = {
2320
3098
  default: "rh-text-text-muted",
2321
3099
  error: "rh-text-danger"
2322
3100
  };
@@ -2335,7 +3113,7 @@ var addButtonSizeClasses = {
2335
3113
  md: "rh-w-5 rh-h-5",
2336
3114
  lg: "rh-w-5 rh-h-5"
2337
3115
  };
2338
- var getSubtitleClassName3 = (subtitle) => subtitle.trim() === "*" ? "rh-text-danger" : "rh-text-text-muted";
3116
+ var getSubtitleClassName4 = (subtitle) => subtitle.trim() === "*" ? "rh-text-danger" : "rh-text-text-muted";
2339
3117
  var TagInput = React9.forwardRef(function TagInput2({
2340
3118
  label,
2341
3119
  subtitle,
@@ -2392,7 +3170,7 @@ var TagInput = React9.forwardRef(function TagInput2({
2392
3170
  children: [
2393
3171
  label && /* @__PURE__ */ jsxRuntime.jsxs("label", { htmlFor: inputId, className: "rh-flex rh-items-baseline rh-gap-1", children: [
2394
3172
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rh-text-sm rh-font-semibold rh-text-text", children: label }),
2395
- subtitle && /* @__PURE__ */ jsxRuntime.jsx("span", { className: `rh-text-sm ${getSubtitleClassName3(subtitle)}`, children: subtitle })
3173
+ subtitle && /* @__PURE__ */ jsxRuntime.jsx("span", { className: `rh-text-sm ${getSubtitleClassName4(subtitle)}`, children: subtitle })
2396
3174
  ] }),
2397
3175
  /* @__PURE__ */ jsxRuntime.jsxs(
2398
3176
  "div",
@@ -2402,9 +3180,9 @@ var TagInput = React9.forwardRef(function TagInput2({
2402
3180
  "rh-flex rh-flex-row rh-items-center rh-justify-between rh-gap-2",
2403
3181
  "rh-border rh-bg-surface rh-font-body",
2404
3182
  "rh-transition-colors rh-duration-150",
2405
- statusClasses3[status],
2406
- radiusClasses5[radius],
2407
- sizeClasses9[size],
3183
+ statusClasses4[status],
3184
+ radiusClasses6[radius],
3185
+ sizeClasses10[size],
2408
3186
  disabled ? "rh-opacity-50 rh-cursor-not-allowed rh-bg-background" : "rh-cursor-pointer",
2409
3187
  className
2410
3188
  ].filter(Boolean).join(" "),
@@ -2567,7 +3345,7 @@ var TagInput = React9.forwardRef(function TagInput2({
2567
3345
  id: `${inputId}-helper`,
2568
3346
  className: [
2569
3347
  "rh-flex rh-items-center rh-gap-1 rh-text-xs",
2570
- helperStatusClasses3[status]
3348
+ helperStatusClasses4[status]
2571
3349
  ].join(" "),
2572
3350
  children: helperText
2573
3351
  }
@@ -2674,12 +3452,12 @@ var PRESET_COLORS5 = /* @__PURE__ */ new Set([
2674
3452
  "info"
2675
3453
  ]);
2676
3454
  var isPresetColor5 = (color) => PRESET_COLORS5.has(color);
2677
- var sizeClasses10 = {
3455
+ var sizeClasses11 = {
2678
3456
  sm: { container: "rh-h-8", button: "rh-px-2 rh-text-xs" },
2679
3457
  md: { container: "rh-h-9", button: "rh-px-3 rh-text-sm" },
2680
3458
  lg: { container: "rh-h-10", button: "rh-px-4 rh-text-sm" }
2681
3459
  };
2682
- var radiusClasses6 = {
3460
+ var radiusClasses7 = {
2683
3461
  none: "rh-rounded-none",
2684
3462
  xs: "rh-rounded-xs",
2685
3463
  sm: "rh-rounded-sm",
@@ -2712,8 +3490,8 @@ function ToggleGroupInner({
2712
3490
  className: [
2713
3491
  "rh-inline-flex rh-items-center rh-bg-muted rh-overflow-hidden",
2714
3492
  "rh-p-1 rh-gap-0.5",
2715
- radiusClasses6[radius],
2716
- sizeClasses10[size].container,
3493
+ radiusClasses7[radius],
3494
+ sizeClasses11[size].container,
2717
3495
  disabled ? "rh-opacity-50 rh-cursor-not-allowed" : "",
2718
3496
  className
2719
3497
  ].filter(Boolean).join(" "),
@@ -2735,8 +3513,8 @@ function ToggleGroupInner({
2735
3513
  "rh-border-0 rh-font-display rh-font-medium",
2736
3514
  "rh-transition-all rh-duration-150",
2737
3515
  "focus-visible:rh-outline-none focus-visible:rh-ring-2 focus-visible:rh-ring-ring",
2738
- radiusClasses6[radius],
2739
- sizeClasses10[size].button,
3516
+ radiusClasses7[radius],
3517
+ sizeClasses11[size].button,
2740
3518
  isActive ? "rh-bg-surface rh-text-text rh-shadow-sm" : "rh-bg-transparent rh-text-text-muted",
2741
3519
  !isActive && !isDisabled ? "hover:rh-bg-surface/50" : "",
2742
3520
  isDisabled ? "rh-cursor-not-allowed rh-pointer-events-none" : "rh-cursor-pointer"
@@ -2759,7 +3537,7 @@ var variantClasses3 = {
2759
3537
  outlined: "rh-bg-surface rh-border rh-border-border rh-shadow-none",
2760
3538
  filled: "rh-bg-background rh-border-0 rh-shadow-none"
2761
3539
  };
2762
- var radiusClasses7 = {
3540
+ var radiusClasses8 = {
2763
3541
  none: "rh-rounded-none",
2764
3542
  xs: "rh-rounded-xs",
2765
3543
  sm: "rh-rounded-sm",
@@ -2794,7 +3572,7 @@ var CardRoot = React9.forwardRef(function Card({
2794
3572
  className: [
2795
3573
  "rh-font-body rh-transition-all rh-duration-150",
2796
3574
  variantClasses3[variant],
2797
- radiusClasses7[radius],
3575
+ radiusClasses8[radius],
2798
3576
  paddingClasses[padding],
2799
3577
  isInteractive ? "rh-cursor-pointer hover:rh-shadow-lg hover:rh-scale-[1.01] active:rh-scale-[0.99]" : "",
2800
3578
  disabled ? "rh-opacity-50 rh-cursor-not-allowed rh-pointer-events-none" : "",
@@ -2847,7 +3625,7 @@ var PRESET_COLORS6 = /* @__PURE__ */ new Set([
2847
3625
  "info"
2848
3626
  ]);
2849
3627
  var isPresetColor6 = (color) => PRESET_COLORS6.has(color);
2850
- var sizeClasses11 = {
3628
+ var sizeClasses12 = {
2851
3629
  xs: "rh-w-3 rh-h-3",
2852
3630
  sm: "rh-w-4 rh-h-4",
2853
3631
  md: "rh-w-6 rh-h-6",
@@ -2875,7 +3653,7 @@ var Spinner = React9.forwardRef(function Spinner2({ size = "md", color = "primar
2875
3653
  "aria-label": label,
2876
3654
  className: [
2877
3655
  "rh-inline-flex rh-items-center rh-justify-center",
2878
- sizeClasses11[size],
3656
+ sizeClasses12[size],
2879
3657
  colorClass,
2880
3658
  className
2881
3659
  ].filter(Boolean).join(" "),
@@ -2918,24 +3696,282 @@ var Spinner = React9.forwardRef(function Spinner2({ size = "md", color = "primar
2918
3696
  }
2919
3697
  );
2920
3698
  });
2921
- var CustomSelect = ({ options, value, onChange, className = "" }) => {
3699
+ var DAYS_SHORT = ["D", "S", "T", "Q", "Q", "S", "S"];
3700
+ var MONTHS_PT = [
3701
+ "Janeiro",
3702
+ "Fevereiro",
3703
+ "Mar\xE7o",
3704
+ "Abril",
3705
+ "Maio",
3706
+ "Junho",
3707
+ "Julho",
3708
+ "Agosto",
3709
+ "Setembro",
3710
+ "Outubro",
3711
+ "Novembro",
3712
+ "Dezembro"
3713
+ ];
3714
+ function parseDate(value) {
3715
+ if (!value) return null;
3716
+ if (/^\d{4}-\d{2}-\d{2}$/.test(value)) {
3717
+ const [y, m, d] = value.split("-").map(Number);
3718
+ return new Date(y, m - 1, d);
3719
+ }
3720
+ if (/^\d{2}\/\d{2}\/\d{4}$/.test(value)) {
3721
+ const [d, m, y] = value.split("/").map(Number);
3722
+ return new Date(y, m - 1, d);
3723
+ }
3724
+ return null;
3725
+ }
3726
+ function formatISO(date) {
3727
+ const y = date.getFullYear();
3728
+ const m = String(date.getMonth() + 1).padStart(2, "0");
3729
+ const d = String(date.getDate()).padStart(2, "0");
3730
+ return `${y}-${m}-${d}`;
3731
+ }
3732
+ function formatDisplay(date) {
3733
+ const d = String(date.getDate()).padStart(2, "0");
3734
+ const m = String(date.getMonth() + 1).padStart(2, "0");
3735
+ const y = date.getFullYear();
3736
+ return `${d}/${m}/${y}`;
3737
+ }
3738
+ function getDaysInMonth(year, month) {
3739
+ return new Date(year, month + 1, 0).getDate();
3740
+ }
3741
+ function getFirstDayOfMonth(year, month) {
3742
+ return new Date(year, month, 1).getDay();
3743
+ }
3744
+ var ChevronLeftIcon2 = () => /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 20 20", fill: "currentColor", className: "rh-w-5 rh-h-5", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(
3745
+ "path",
3746
+ {
3747
+ fillRule: "evenodd",
3748
+ d: "M12.79 5.23a.75.75 0 01-.02 1.06L8.832 10l3.938 3.71a.75.75 0 11-1.04 1.08l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 011.06.02z",
3749
+ clipRule: "evenodd"
3750
+ }
3751
+ ) });
3752
+ var ChevronRightIcon2 = () => /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 20 20", fill: "currentColor", className: "rh-w-5 rh-h-5", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(
3753
+ "path",
3754
+ {
3755
+ fillRule: "evenodd",
3756
+ d: "M7.21 14.77a.75.75 0 010-1.06L11.168 10 7.23 6.29a.75.75 0 011.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z",
3757
+ clipRule: "evenodd"
3758
+ }
3759
+ ) });
3760
+ var DatePickerDropdown = ({
3761
+ style,
3762
+ selectedDate,
3763
+ onSelect,
3764
+ onClose,
3765
+ containerRef
3766
+ }) => {
3767
+ const today = /* @__PURE__ */ new Date();
3768
+ const [viewYear, setViewYear] = React9.useState(
3769
+ selectedDate ? selectedDate.getFullYear() : today.getFullYear()
3770
+ );
3771
+ const [viewMonth, setViewMonth] = React9.useState(
3772
+ selectedDate ? selectedDate.getMonth() : today.getMonth()
3773
+ );
3774
+ const [tempDate, setTempDate] = React9.useState(selectedDate);
3775
+ const dropdownRef = React9.useRef(null);
3776
+ React9.useEffect(() => {
3777
+ const handleClickOutside = (e) => {
3778
+ const target = e.target;
3779
+ if (dropdownRef.current && !dropdownRef.current.contains(target) && containerRef.current && !containerRef.current.contains(target)) {
3780
+ onClose();
3781
+ }
3782
+ };
3783
+ document.addEventListener("mousedown", handleClickOutside);
3784
+ return () => document.removeEventListener("mousedown", handleClickOutside);
3785
+ }, [onClose, containerRef]);
3786
+ const prevMonth = () => {
3787
+ if (viewMonth === 0) {
3788
+ setViewMonth(11);
3789
+ setViewYear((y) => y - 1);
3790
+ } else {
3791
+ setViewMonth((m) => m - 1);
3792
+ }
3793
+ };
3794
+ const nextMonth = () => {
3795
+ if (viewMonth === 11) {
3796
+ setViewMonth(0);
3797
+ setViewYear((y) => y + 1);
3798
+ } else {
3799
+ setViewMonth((m) => m + 1);
3800
+ }
3801
+ };
3802
+ const daysInMonth = getDaysInMonth(viewYear, viewMonth);
3803
+ const firstDay = getFirstDayOfMonth(viewYear, viewMonth);
3804
+ const prevMonthDays = getDaysInMonth(
3805
+ viewMonth === 0 ? viewYear - 1 : viewYear,
3806
+ viewMonth === 0 ? 11 : viewMonth - 1
3807
+ );
3808
+ const totalCells = firstDay + daysInMonth;
3809
+ const trailingCount = totalCells % 7 === 0 ? 0 : 7 - totalCells % 7;
3810
+ const isSelected = (day) => !!tempDate && tempDate.getFullYear() === viewYear && tempDate.getMonth() === viewMonth && tempDate.getDate() === day;
3811
+ return reactDom.createPortal(
3812
+ /* @__PURE__ */ jsxRuntime.jsxs(
3813
+ "div",
3814
+ {
3815
+ ref: dropdownRef,
3816
+ style: {
3817
+ ...style,
3818
+ boxShadow: "0 0 9.6px 0 rgba(8, 11, 18, 0.08)",
3819
+ width: 260
3820
+ },
3821
+ className: "rh-bg-surface rh-rounded-xs rh-p-5 rh-select-none rh-font-body",
3822
+ children: [
3823
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rh-flex rh-items-center rh-justify-between", children: [
3824
+ /* @__PURE__ */ jsxRuntime.jsx(
3825
+ "button",
3826
+ {
3827
+ type: "button",
3828
+ onMouseDown: (e) => {
3829
+ e.preventDefault();
3830
+ prevMonth();
3831
+ },
3832
+ className: "rh-p-1 hover:rh-bg-background rh-rounded rh-cursor-pointer rh-text-text",
3833
+ children: /* @__PURE__ */ jsxRuntime.jsx(ChevronLeftIcon2, {})
3834
+ }
3835
+ ),
3836
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "rh-text-sm rh-font-medium rh-text-text", children: [
3837
+ MONTHS_PT[viewMonth],
3838
+ " - ",
3839
+ viewYear
3840
+ ] }),
3841
+ /* @__PURE__ */ jsxRuntime.jsx(
3842
+ "button",
3843
+ {
3844
+ type: "button",
3845
+ onMouseDown: (e) => {
3846
+ e.preventDefault();
3847
+ nextMonth();
3848
+ },
3849
+ className: "rh-p-1 hover:rh-bg-background rh-rounded rh-cursor-pointer rh-text-text",
3850
+ children: /* @__PURE__ */ jsxRuntime.jsx(ChevronRightIcon2, {})
3851
+ }
3852
+ )
3853
+ ] }),
3854
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rh-grid rh-grid-cols-7", children: DAYS_SHORT.map((d, i) => /* @__PURE__ */ jsxRuntime.jsx(
3855
+ "div",
3856
+ {
3857
+ className: "rh-text-center rh-text-xs rh-text-text-muted rh-font-medium rh-py-1",
3858
+ children: d
3859
+ },
3860
+ i
3861
+ )) }),
3862
+ /* @__PURE__ */ jsxRuntime.jsx(
3863
+ "svg",
3864
+ {
3865
+ xmlns: "http://www.w3.org/2000/svg",
3866
+ width: "100%",
3867
+ height: "1",
3868
+ viewBox: "0 0 350 1",
3869
+ fill: "none",
3870
+ className: "rh-mb-3",
3871
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0 0.5H350", stroke: "#F5F5F5" })
3872
+ }
3873
+ ),
3874
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rh-grid rh-grid-cols-7 rh-gap-0", children: [
3875
+ Array.from({ length: firstDay }).map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(
3876
+ "div",
3877
+ {
3878
+ 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",
3879
+ children: prevMonthDays - firstDay + i + 1
3880
+ },
3881
+ `prev-${i}`
3882
+ )),
3883
+ Array.from({ length: daysInMonth }).map((_, i) => {
3884
+ const day = i + 1;
3885
+ const selected = isSelected(day);
3886
+ return /* @__PURE__ */ jsxRuntime.jsx(
3887
+ "button",
3888
+ {
3889
+ type: "button",
3890
+ style: { backgroundColor: selected ? "#15607A" : "transparent" },
3891
+ onMouseDown: (e) => {
3892
+ e.preventDefault();
3893
+ setTempDate(new Date(viewYear, viewMonth, day));
3894
+ },
3895
+ className: [
3896
+ "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",
3897
+ selected ? "rh-text-surface" : "rh-text-text hover:rh-ring-1 hover:rh-ring-[#15607A] hover:rh-bg-transparent"
3898
+ ].join(" "),
3899
+ children: day
3900
+ },
3901
+ day
3902
+ );
3903
+ }),
3904
+ Array.from({ length: trailingCount }).map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(
3905
+ "div",
3906
+ {
3907
+ 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",
3908
+ children: i + 1
3909
+ },
3910
+ `next-${i}`
3911
+ ))
3912
+ ] }),
3913
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rh-flex rh-justify-end rh-gap-2 rh-mt-4", children: /* @__PURE__ */ jsxRuntime.jsx(
3914
+ "button",
3915
+ {
3916
+ type: "button",
3917
+ style: { backgroundColor: "#87A851" },
3918
+ onClick: () => {
3919
+ if (tempDate) {
3920
+ onSelect(tempDate);
3921
+ }
3922
+ onClose();
3923
+ },
3924
+ 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",
3925
+ children: "Aplicar"
3926
+ }
3927
+ ) })
3928
+ ]
3929
+ }
3930
+ ),
3931
+ document.body
3932
+ );
3933
+ };
3934
+ var CustomSelect = ({
3935
+ options = [],
3936
+ value,
3937
+ onChange,
3938
+ className = "",
3939
+ type = "select"
3940
+ }) => {
2922
3941
  const [isOpen, setIsOpen] = React9.useState(false);
2923
3942
  const [dropdownStyle, setDropdownStyle] = React9.useState({});
2924
3943
  const containerRef = React9.useRef(null);
2925
- const selectedOption = options.find((opt) => opt.value === value);
2926
- const handleOpen = () => {
2927
- if (!isOpen && containerRef.current) {
2928
- const rect = containerRef.current.getBoundingClientRect();
2929
- setDropdownStyle({
2930
- position: "fixed",
2931
- top: rect.bottom + 4,
2932
- left: rect.left,
2933
- zIndex: 2
2934
- });
2935
- }
3944
+ const calcPosition = () => {
3945
+ if (!containerRef.current) return {};
3946
+ const rect = containerRef.current.getBoundingClientRect();
3947
+ const spaceBelow = window.innerHeight - rect.bottom;
3948
+ const spaceAbove = rect.top;
3949
+ const DROPDOWN_HEIGHT = 320;
3950
+ const openUpward = spaceBelow < DROPDOWN_HEIGHT && spaceAbove > spaceBelow;
3951
+ return {
3952
+ position: "fixed",
3953
+ ...openUpward ? { bottom: window.innerHeight - rect.top + 4 } : { top: rect.bottom + 4 },
3954
+ left: rect.left,
3955
+ zIndex: 2
3956
+ };
3957
+ };
3958
+ const openDropdown = () => {
3959
+ if (!isOpen) setDropdownStyle(calcPosition());
2936
3960
  setIsOpen((prev) => !prev);
2937
3961
  };
2938
3962
  React9.useEffect(() => {
3963
+ if (!isOpen) return;
3964
+ const close = () => setIsOpen(false);
3965
+ window.addEventListener("scroll", close, { capture: true, passive: true });
3966
+ window.addEventListener("resize", close, { passive: true });
3967
+ return () => {
3968
+ window.removeEventListener("scroll", close, { capture: true });
3969
+ window.removeEventListener("resize", close);
3970
+ };
3971
+ }, [isOpen]);
3972
+ const selectedOption = options.find((opt) => opt.value === value);
3973
+ React9.useEffect(() => {
3974
+ if (type !== "select") return;
2939
3975
  const handleClickOutside = (e) => {
2940
3976
  if (containerRef.current && !containerRef.current.contains(e.target)) {
2941
3977
  setIsOpen(false);
@@ -2945,29 +3981,38 @@ var CustomSelect = ({ options, value, onChange, className = "" }) => {
2945
3981
  document.addEventListener("mousedown", handleClickOutside);
2946
3982
  return () => document.removeEventListener("mousedown", handleClickOutside);
2947
3983
  }
2948
- }, [isOpen]);
3984
+ }, [isOpen, type]);
3985
+ const selectedDate = type === "date" ? parseDate(value) : null;
3986
+ const handleDateSelect = (date) => {
3987
+ if (date) {
3988
+ onChange(formatISO(date));
3989
+ }
3990
+ setIsOpen(false);
3991
+ };
3992
+ const displayLabel = type === "date" ? selectedDate ? formatDisplay(selectedDate) : value || "\u2014" : selectedOption?.label || value;
3993
+ const displayBg = type === "date" ? void 0 : selectedOption?.backgroundColor;
2949
3994
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: containerRef, className: `rh-relative ${className}`, children: [
2950
3995
  /* @__PURE__ */ jsxRuntime.jsx(
2951
3996
  "button",
2952
3997
  {
2953
3998
  type: "button",
2954
- onClick: handleOpen,
3999
+ onClick: openDropdown,
2955
4000
  className: "rh-w-full rh-h-full rh-flex rh-items-center rh-justify-between rh-py-1 rh-bg-transparent hover:rh-bg-background/50 rh-cursor-pointer rh-text-left",
2956
4001
  children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rh-flex rh-items-center rh-gap-2 rh-flex-1 rh-truncate", children: /* @__PURE__ */ jsxRuntime.jsx(
2957
4002
  "span",
2958
4003
  {
2959
4004
  className: "rh-truncate rh-text-[14px] rh-px-2 rh-py-1 rh-rounded-xl",
2960
4005
  style: {
2961
- backgroundColor: selectedOption?.backgroundColor || "transparent",
4006
+ backgroundColor: displayBg || "transparent",
2962
4007
  fontFamily: "Inter, sans-serif",
2963
- color: selectedOption?.backgroundColor ? "white" : "inherit"
4008
+ color: displayBg ? "white" : "inherit"
2964
4009
  },
2965
- children: selectedOption?.label || value
4010
+ children: displayLabel
2966
4011
  }
2967
4012
  ) })
2968
4013
  }
2969
4014
  ),
2970
- isOpen && reactDom.createPortal(
4015
+ type === "select" && isOpen && reactDom.createPortal(
2971
4016
  /* @__PURE__ */ jsxRuntime.jsx(
2972
4017
  "div",
2973
4018
  {
@@ -2987,13 +4032,23 @@ var CustomSelect = ({ options, value, onChange, className = "" }) => {
2987
4032
  },
2988
4033
  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",
2989
4034
  children: [
2990
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rh-w-4 rh-h-4", children: option.value === value && /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "13", height: "10", viewBox: "0 0 13 10", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxRuntime.jsx(
2991
- "path",
4035
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rh-w-4 rh-h-4", children: option.value === value && /* @__PURE__ */ jsxRuntime.jsx(
4036
+ "svg",
2992
4037
  {
2993
- 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",
2994
- fill: "#374151"
4038
+ width: "13",
4039
+ height: "10",
4040
+ viewBox: "0 0 13 10",
4041
+ fill: "none",
4042
+ xmlns: "http://www.w3.org/2000/svg",
4043
+ children: /* @__PURE__ */ jsxRuntime.jsx(
4044
+ "path",
4045
+ {
4046
+ 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",
4047
+ fill: "#374151"
4048
+ }
4049
+ )
2995
4050
  }
2996
- ) }) }),
4051
+ ) }),
2997
4052
  /* @__PURE__ */ jsxRuntime.jsx(
2998
4053
  "span",
2999
4054
  {
@@ -3012,10 +4067,20 @@ var CustomSelect = ({ options, value, onChange, className = "" }) => {
3012
4067
  }
3013
4068
  ),
3014
4069
  document.body
4070
+ ),
4071
+ type === "date" && isOpen && /* @__PURE__ */ jsxRuntime.jsx(
4072
+ DatePickerDropdown,
4073
+ {
4074
+ style: dropdownStyle,
4075
+ selectedDate,
4076
+ onSelect: handleDateSelect,
4077
+ onClose: () => setIsOpen(false),
4078
+ containerRef
4079
+ }
3015
4080
  )
3016
4081
  ] });
3017
4082
  };
3018
- var sizeClasses12 = {
4083
+ var sizeClasses13 = {
3019
4084
  sm: { cell: "rh-px-2 rh-py-2 rh-text-xs", header: "rh-px-2 rh-py-2 rh-text-xs" },
3020
4085
  md: { cell: "rh-px-3 rh-py-3 rh-text-sm", header: "rh-px-3 rh-py-3 rh-text-xs" },
3021
4086
  lg: { cell: "rh-px-4 rh-py-4 rh-text-sm", header: "rh-px-4 rh-py-3 rh-text-sm" }
@@ -3117,6 +4182,11 @@ function TableInner({
3117
4182
  return {};
3118
4183
  };
3119
4184
  const rowPaddingStyle = getRowPaddingStyle();
4185
+ const isEditableCell = (column) => {
4186
+ if (!column.editable || !column.editableValue) return false;
4187
+ if (column.type === "date") return true;
4188
+ return !!column.choices;
4189
+ };
3120
4190
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rh-w-full rh-rounded rh-overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsxs(
3121
4191
  "table",
3122
4192
  {
@@ -3144,7 +4214,7 @@ function TableInner({
3144
4214
  ...rowPaddingStyle
3145
4215
  },
3146
4216
  className: [
3147
- rowPadding ? "" : sizeClasses12[size].header,
4217
+ rowPadding ? "" : sizeClasses13[size].header,
3148
4218
  alignClasses[column.align || "left"],
3149
4219
  `rh-font-semibold rh-whitespace-nowrap ${headerTextClassName || "rh-text-text-muted"}`,
3150
4220
  stickyHeader ? "rh-sticky rh-top-0 rh-bg-surface rh-z-10" : "",
@@ -3209,14 +4279,15 @@ function TableInner({
3209
4279
  {
3210
4280
  style: { width: column.width, maxWidth: column.maxWidth, ...rowPaddingStyle },
3211
4281
  className: [
3212
- rowPadding ? "" : sizeClasses12[size].cell,
4282
+ rowPadding ? "" : sizeClasses13[size].cell,
3213
4283
  alignClasses[column.align || "left"],
3214
4284
  "rh-text-text"
3215
4285
  ].filter(Boolean).join(" "),
3216
4286
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rh-flex rh-items-center rh-justify-between rh-gap-2", children: [
3217
- column.editable && column.choices && column.editableValue ? /* @__PURE__ */ jsxRuntime.jsx(
4287
+ isEditableCell(column) ? /* @__PURE__ */ jsxRuntime.jsx(
3218
4288
  CustomSelect,
3219
4289
  {
4290
+ type: column.type ?? "select",
3220
4291
  options: column.choices,
3221
4292
  value: column.editableValue(row),
3222
4293
  onChange: (value) => column.onEditChange?.(row, index, value),
@@ -3247,7 +4318,7 @@ function TableInner({
3247
4318
  colSpan,
3248
4319
  style: rowPaddingStyle,
3249
4320
  className: [
3250
- rowPadding ? "" : sizeClasses12[size].cell,
4321
+ rowPadding ? "" : sizeClasses13[size].cell,
3251
4322
  "rh-text-center rh-cursor-pointer rh-text-[#9CA3AF] rh-font-medium"
3252
4323
  ].filter(Boolean).join(" "),
3253
4324
  onClick: onAddRow,
@@ -3711,6 +4782,7 @@ exports.CaretRightIcon = CaretRightIcon;
3711
4782
  exports.Checkbox = Checkbox;
3712
4783
  exports.CloseIcon = CloseIcon;
3713
4784
  exports.Container = Container;
4785
+ exports.DateSelect = DateSelect;
3714
4786
  exports.DeleteIcon = DeleteIcon;
3715
4787
  exports.EditIcon = EditIcon;
3716
4788
  exports.ErrorIcon = ErrorIcon;