@rehagro/ui 1.0.48 → 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.d.mts +32 -1
- package/dist/index.d.ts +32 -1
- package/dist/index.js +805 -34
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +805 -35
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1891,6 +1891,776 @@ var Select = forwardRef(function Select2(props, ref) {
|
|
|
1891
1891
|
}
|
|
1892
1892
|
);
|
|
1893
1893
|
});
|
|
1894
|
+
var MONTHS = [
|
|
1895
|
+
"Janeiro",
|
|
1896
|
+
"Fevereiro",
|
|
1897
|
+
"Mar\xE7o",
|
|
1898
|
+
"Abril",
|
|
1899
|
+
"Maio",
|
|
1900
|
+
"Junho",
|
|
1901
|
+
"Julho",
|
|
1902
|
+
"Agosto",
|
|
1903
|
+
"Setembro",
|
|
1904
|
+
"Outubro",
|
|
1905
|
+
"Novembro",
|
|
1906
|
+
"Dezembro"
|
|
1907
|
+
];
|
|
1908
|
+
var MONTHS_SHORT = [
|
|
1909
|
+
"Jan",
|
|
1910
|
+
"Fev",
|
|
1911
|
+
"Mar",
|
|
1912
|
+
"Abr",
|
|
1913
|
+
"Mai",
|
|
1914
|
+
"Jun",
|
|
1915
|
+
"Jul",
|
|
1916
|
+
"Ago",
|
|
1917
|
+
"Set",
|
|
1918
|
+
"Out",
|
|
1919
|
+
"Nov",
|
|
1920
|
+
"Dez"
|
|
1921
|
+
];
|
|
1922
|
+
var MODE_OPTIONS = [
|
|
1923
|
+
{ value: "interval", label: "Intervalo" },
|
|
1924
|
+
{ value: "day", label: "Dia" },
|
|
1925
|
+
{ value: "month", label: "M\xEAs" },
|
|
1926
|
+
{ value: "year", label: "Ano" }
|
|
1927
|
+
];
|
|
1928
|
+
var statusClasses3 = {
|
|
1929
|
+
default: "rh-border-border focus-within:rh-border-primary focus-within:rh-ring-2 focus-within:rh-ring-gray-200",
|
|
1930
|
+
error: "rh-border-danger focus-within:rh-border-danger focus-within:rh-ring-2 focus-within:rh-ring-red-100"
|
|
1931
|
+
};
|
|
1932
|
+
var sizeClasses6 = {
|
|
1933
|
+
sm: "rh-min-h-[32px] rh-text-sm rh-px-input-x-sm",
|
|
1934
|
+
md: "rh-min-h-[40px] rh-text-sm rh-px-input-x-md",
|
|
1935
|
+
lg: "rh-min-h-[48px] rh-text-base rh-px-input-x-lg"
|
|
1936
|
+
};
|
|
1937
|
+
var radiusClasses5 = {
|
|
1938
|
+
none: "rh-rounded-none",
|
|
1939
|
+
xxs: "rh-rounded-xxs",
|
|
1940
|
+
xs: "rh-rounded-xs",
|
|
1941
|
+
sm: "rh-rounded-sm",
|
|
1942
|
+
md: "rh-rounded-md",
|
|
1943
|
+
lg: "rh-rounded-lg",
|
|
1944
|
+
xl: "rh-rounded-xl",
|
|
1945
|
+
full: "rh-rounded-full"
|
|
1946
|
+
};
|
|
1947
|
+
var dropdownRadiusClasses2 = {
|
|
1948
|
+
none: "rh-rounded-none",
|
|
1949
|
+
xxs: "rh-rounded-xxs",
|
|
1950
|
+
xs: "rh-rounded-xs",
|
|
1951
|
+
sm: "rh-rounded-xs",
|
|
1952
|
+
md: "rh-rounded-xs",
|
|
1953
|
+
lg: "rh-rounded-xs",
|
|
1954
|
+
xl: "rh-rounded-xs",
|
|
1955
|
+
full: "rh-rounded-xs"
|
|
1956
|
+
};
|
|
1957
|
+
var helperStatusClasses3 = {
|
|
1958
|
+
default: "rh-text-text-muted",
|
|
1959
|
+
error: "rh-text-danger"
|
|
1960
|
+
};
|
|
1961
|
+
var getSubtitleClassName3 = (subtitle) => subtitle.trim() === "*" ? "rh-text-danger" : "rh-text-text-muted";
|
|
1962
|
+
var ChevronIcon2 = ({ className }) => /* @__PURE__ */ jsx(
|
|
1963
|
+
"svg",
|
|
1964
|
+
{
|
|
1965
|
+
className,
|
|
1966
|
+
viewBox: "0 0 20 20",
|
|
1967
|
+
fill: "currentColor",
|
|
1968
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1969
|
+
"aria-hidden": "true",
|
|
1970
|
+
children: /* @__PURE__ */ jsx(
|
|
1971
|
+
"path",
|
|
1972
|
+
{
|
|
1973
|
+
fillRule: "evenodd",
|
|
1974
|
+
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",
|
|
1975
|
+
clipRule: "evenodd"
|
|
1976
|
+
}
|
|
1977
|
+
)
|
|
1978
|
+
}
|
|
1979
|
+
);
|
|
1980
|
+
var ChevronLeftIcon = ({ className }) => /* @__PURE__ */ jsx(
|
|
1981
|
+
"svg",
|
|
1982
|
+
{
|
|
1983
|
+
className,
|
|
1984
|
+
viewBox: "0 0 20 20",
|
|
1985
|
+
fill: "currentColor",
|
|
1986
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1987
|
+
"aria-hidden": "true",
|
|
1988
|
+
children: /* @__PURE__ */ jsx(
|
|
1989
|
+
"path",
|
|
1990
|
+
{
|
|
1991
|
+
fillRule: "evenodd",
|
|
1992
|
+
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",
|
|
1993
|
+
clipRule: "evenodd"
|
|
1994
|
+
}
|
|
1995
|
+
)
|
|
1996
|
+
}
|
|
1997
|
+
);
|
|
1998
|
+
var ChevronRightIcon = ({ className }) => /* @__PURE__ */ jsx(
|
|
1999
|
+
"svg",
|
|
2000
|
+
{
|
|
2001
|
+
className,
|
|
2002
|
+
viewBox: "0 0 20 20",
|
|
2003
|
+
fill: "currentColor",
|
|
2004
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2005
|
+
"aria-hidden": "true",
|
|
2006
|
+
children: /* @__PURE__ */ jsx(
|
|
2007
|
+
"path",
|
|
2008
|
+
{
|
|
2009
|
+
fillRule: "evenodd",
|
|
2010
|
+
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",
|
|
2011
|
+
clipRule: "evenodd"
|
|
2012
|
+
}
|
|
2013
|
+
)
|
|
2014
|
+
}
|
|
2015
|
+
);
|
|
2016
|
+
var EraserIcon = ({ className }) => /* @__PURE__ */ jsx("svg", { width: "17", height: "16", viewBox: "0 0 17 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx(
|
|
2017
|
+
"path",
|
|
2018
|
+
{
|
|
2019
|
+
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",
|
|
2020
|
+
fill: "#374151"
|
|
2021
|
+
}
|
|
2022
|
+
) });
|
|
2023
|
+
var DateSelect = forwardRef(
|
|
2024
|
+
function DateSelect2(props, ref) {
|
|
2025
|
+
const {
|
|
2026
|
+
label,
|
|
2027
|
+
subtitle,
|
|
2028
|
+
placeholder = "Selecione",
|
|
2029
|
+
status = "default",
|
|
2030
|
+
size = "md",
|
|
2031
|
+
radius = "xs",
|
|
2032
|
+
helperText,
|
|
2033
|
+
disabled = false,
|
|
2034
|
+
className = "",
|
|
2035
|
+
wrapperClassName = "",
|
|
2036
|
+
startYear,
|
|
2037
|
+
endYear,
|
|
2038
|
+
backgroundColor
|
|
2039
|
+
} = props;
|
|
2040
|
+
const triggerId = React9.useId();
|
|
2041
|
+
const helperId = React9.useId();
|
|
2042
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
2043
|
+
const [isHelperDismissed, setIsHelperDismissed] = useState(false);
|
|
2044
|
+
const [internalValue, setInternalValue] = useState(
|
|
2045
|
+
props.defaultValue ?? { mode: "day" }
|
|
2046
|
+
);
|
|
2047
|
+
const isControlled = props.value !== void 0;
|
|
2048
|
+
const value = isControlled ? props.value ?? internalValue : internalValue;
|
|
2049
|
+
const [activeMode, setActiveMode] = useState(value.mode ?? "day");
|
|
2050
|
+
const [selectedYear, setSelectedYear] = useState((/* @__PURE__ */ new Date()).getFullYear());
|
|
2051
|
+
const [selectedMonth, setSelectedMonth] = useState((/* @__PURE__ */ new Date()).getMonth());
|
|
2052
|
+
const rightMonth = selectedMonth === 11 ? 0 : selectedMonth + 1;
|
|
2053
|
+
const rightYear = selectedMonth === 11 ? selectedYear + 1 : selectedYear;
|
|
2054
|
+
const [intervalStart, setIntervalStart] = useState(value.startDate);
|
|
2055
|
+
const [intervalEnd, setIntervalEnd] = useState(value.endDate);
|
|
2056
|
+
const [hoverDate, setHoverDate] = useState();
|
|
2057
|
+
const [yearGridStart, setYearGridStart] = useState(
|
|
2058
|
+
Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 12) * 12
|
|
2059
|
+
);
|
|
2060
|
+
const wrapperRef = React9.useRef(null);
|
|
2061
|
+
const innerRef = React9.useRef(null);
|
|
2062
|
+
React9.useImperativeHandle(ref, () => innerRef.current);
|
|
2063
|
+
const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
|
|
2064
|
+
const yearStart = startYear ?? currentYear - 10;
|
|
2065
|
+
const yearEnd = endYear ?? currentYear + 10;
|
|
2066
|
+
const visualStatus = helperText && isHelperDismissed ? "default" : status;
|
|
2067
|
+
const handleChange = (newValue) => {
|
|
2068
|
+
if (helperText) setIsHelperDismissed(true);
|
|
2069
|
+
if (!isControlled) setInternalValue(newValue);
|
|
2070
|
+
props.onChange?.(newValue);
|
|
2071
|
+
if (newValue.mode !== "interval") {
|
|
2072
|
+
setIsOpen(false);
|
|
2073
|
+
}
|
|
2074
|
+
};
|
|
2075
|
+
const handleIntervalApply = () => {
|
|
2076
|
+
if (!intervalStart || !intervalEnd) return;
|
|
2077
|
+
const newValue = {
|
|
2078
|
+
mode: "interval",
|
|
2079
|
+
startDate: intervalStart,
|
|
2080
|
+
endDate: intervalEnd
|
|
2081
|
+
};
|
|
2082
|
+
if (helperText) setIsHelperDismissed(true);
|
|
2083
|
+
if (!isControlled) setInternalValue(newValue);
|
|
2084
|
+
props.onChange?.(newValue);
|
|
2085
|
+
setIsOpen(false);
|
|
2086
|
+
};
|
|
2087
|
+
const handleIntervalClear = () => {
|
|
2088
|
+
setIntervalStart(void 0);
|
|
2089
|
+
setIntervalEnd(void 0);
|
|
2090
|
+
setHoverDate(void 0);
|
|
2091
|
+
const newValue = { mode: "interval" };
|
|
2092
|
+
if (!isControlled) setInternalValue(newValue);
|
|
2093
|
+
props.onChange?.(newValue);
|
|
2094
|
+
};
|
|
2095
|
+
const displayText = React9.useMemo(() => {
|
|
2096
|
+
if (value.mode === "year" && value.year) return value.year.toString();
|
|
2097
|
+
if (value.mode === "month" && value.year != null)
|
|
2098
|
+
return `${MONTHS_SHORT[value.month || 0]} ${value.year}`;
|
|
2099
|
+
if (value.mode === "day" && value.year != null)
|
|
2100
|
+
return `${value.day}/${(value.month ?? 0) + 1}/${value.year}`;
|
|
2101
|
+
if (value.mode === "interval" && value.startDate && value.endDate) {
|
|
2102
|
+
return `${value.startDate.toLocaleDateString("pt-BR")} - ${value.endDate.toLocaleDateString("pt-BR")}`;
|
|
2103
|
+
}
|
|
2104
|
+
return null;
|
|
2105
|
+
}, [value]);
|
|
2106
|
+
React9.useEffect(() => {
|
|
2107
|
+
if (!isOpen) return;
|
|
2108
|
+
const handleClickOutside = (e) => {
|
|
2109
|
+
if (wrapperRef.current && !wrapperRef.current.contains(e.target)) {
|
|
2110
|
+
setIsOpen(false);
|
|
2111
|
+
}
|
|
2112
|
+
};
|
|
2113
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
2114
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
2115
|
+
}, [isOpen]);
|
|
2116
|
+
React9.useEffect(() => {
|
|
2117
|
+
if (!isOpen) return;
|
|
2118
|
+
const handleEscape = (e) => {
|
|
2119
|
+
if (e.key === "Escape") {
|
|
2120
|
+
setIsOpen(false);
|
|
2121
|
+
innerRef.current?.focus();
|
|
2122
|
+
}
|
|
2123
|
+
};
|
|
2124
|
+
document.addEventListener("keydown", handleEscape);
|
|
2125
|
+
return () => document.removeEventListener("keydown", handleEscape);
|
|
2126
|
+
}, [isOpen]);
|
|
2127
|
+
const getDaysInMonth2 = (year, month) => new Date(year, month + 1, 0).getDate();
|
|
2128
|
+
const getFirstDayOfMonth2 = (year, month) => new Date(year, month, 1).getDay();
|
|
2129
|
+
const isSameDay = (a, b) => a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
2130
|
+
const isInRange = (date, start, end) => {
|
|
2131
|
+
if (!start) return false;
|
|
2132
|
+
const ref2 = end ?? hoverDate;
|
|
2133
|
+
if (!ref2) return false;
|
|
2134
|
+
const [lo, hi] = start <= ref2 ? [start, ref2] : [ref2, start];
|
|
2135
|
+
return date > lo && date < hi;
|
|
2136
|
+
};
|
|
2137
|
+
const renderModeTabs = () => /* @__PURE__ */ jsx("div", { className: "rh-flex rh-border-b rh-border-border rh-bg-transparent", children: MODE_OPTIONS.map((option) => /* @__PURE__ */ jsx(
|
|
2138
|
+
"button",
|
|
2139
|
+
{
|
|
2140
|
+
onClick: () => setActiveMode(option.value),
|
|
2141
|
+
className: [
|
|
2142
|
+
"rh-flex-1 rh-py-2 rh-px-4 rh-text-sm rh-transition-colors rh-duration-150 rh-text-text rh-font-bold",
|
|
2143
|
+
"rh-border-b-2 -rh-mb-px",
|
|
2144
|
+
activeMode === option.value ? "rh-border-primary" : "rh-border-transparent hover:rh-border-border"
|
|
2145
|
+
].join(" "),
|
|
2146
|
+
children: option.label
|
|
2147
|
+
},
|
|
2148
|
+
option.value
|
|
2149
|
+
)) });
|
|
2150
|
+
const renderYearGrid = () => /* @__PURE__ */ jsxs("div", { className: "rh-p-1", children: [
|
|
2151
|
+
/* @__PURE__ */ jsxs("div", { className: "rh-flex rh-items-center rh-justify-between", children: [
|
|
2152
|
+
/* @__PURE__ */ jsx(
|
|
2153
|
+
"button",
|
|
2154
|
+
{
|
|
2155
|
+
onClick: () => setYearGridStart((s) => s - 12),
|
|
2156
|
+
className: "rh-p-1 hover:rh-bg-background rh-rounded",
|
|
2157
|
+
children: /* @__PURE__ */ jsx(ChevronLeftIcon, { className: "rh-w-5 rh-h-5" })
|
|
2158
|
+
}
|
|
2159
|
+
),
|
|
2160
|
+
/* @__PURE__ */ jsxs("span", { className: "rh-text-sm rh-font-medium rh-text-text", children: [
|
|
2161
|
+
yearGridStart,
|
|
2162
|
+
" \u2013 ",
|
|
2163
|
+
yearGridStart + 11
|
|
2164
|
+
] }),
|
|
2165
|
+
/* @__PURE__ */ jsx(
|
|
2166
|
+
"button",
|
|
2167
|
+
{
|
|
2168
|
+
onClick: () => setYearGridStart((s) => s + 12),
|
|
2169
|
+
className: "rh-p-1 hover:rh-bg-background rh-rounded",
|
|
2170
|
+
children: /* @__PURE__ */ jsx(ChevronRightIcon, { className: "rh-w-5 rh-h-5" })
|
|
2171
|
+
}
|
|
2172
|
+
)
|
|
2173
|
+
] }),
|
|
2174
|
+
/* @__PURE__ */ jsx(
|
|
2175
|
+
"svg",
|
|
2176
|
+
{
|
|
2177
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2178
|
+
width: "100%",
|
|
2179
|
+
height: "1",
|
|
2180
|
+
viewBox: "0 0 350 1",
|
|
2181
|
+
fill: "none",
|
|
2182
|
+
className: "rh-mb-3",
|
|
2183
|
+
children: /* @__PURE__ */ jsx("path", { d: "M0 0.5H350", stroke: "#F5F5F5" })
|
|
2184
|
+
}
|
|
2185
|
+
),
|
|
2186
|
+
/* @__PURE__ */ jsx("div", { className: "rh-grid rh-grid-cols-4 rh-gap-2", children: Array.from({ length: 12 }, (_, i) => yearGridStart + i).map((year) => {
|
|
2187
|
+
const isSelected = value.mode === "year" && value.year === year;
|
|
2188
|
+
const outOfRange = year < yearStart || year > yearEnd;
|
|
2189
|
+
return /* @__PURE__ */ jsx(
|
|
2190
|
+
"button",
|
|
2191
|
+
{
|
|
2192
|
+
disabled: outOfRange,
|
|
2193
|
+
onClick: () => handleChange({ mode: "year", year }),
|
|
2194
|
+
className: [
|
|
2195
|
+
"rh-rounded-sm rh-py-4 rh-w-auto rh-text-sm rh-transition-colors rh-duration-150 rh-border-border rh-border",
|
|
2196
|
+
isSelected ? "rh-bg-primary rh-text-surface" : "rh-text-text hover:rh-bg-background",
|
|
2197
|
+
outOfRange ? "rh-opacity-30 rh-cursor-not-allowed" : ""
|
|
2198
|
+
].join(" "),
|
|
2199
|
+
children: year
|
|
2200
|
+
},
|
|
2201
|
+
year
|
|
2202
|
+
);
|
|
2203
|
+
}) })
|
|
2204
|
+
] });
|
|
2205
|
+
const renderMonthGrid = () => /* @__PURE__ */ jsxs("div", { className: "rh-p-1", children: [
|
|
2206
|
+
/* @__PURE__ */ jsxs("div", { className: "rh-flex rh-items-center rh-justify-between", children: [
|
|
2207
|
+
/* @__PURE__ */ jsx(
|
|
2208
|
+
"button",
|
|
2209
|
+
{
|
|
2210
|
+
onClick: () => setSelectedYear((y) => y - 1),
|
|
2211
|
+
className: "rh-p-1 hover:rh-bg-background rh-rounded",
|
|
2212
|
+
children: /* @__PURE__ */ jsx(ChevronLeftIcon, { className: "rh-w-5 rh-h-5" })
|
|
2213
|
+
}
|
|
2214
|
+
),
|
|
2215
|
+
/* @__PURE__ */ jsx("span", { className: "rh-text-sm rh-font-medium rh-text-text", children: selectedYear }),
|
|
2216
|
+
/* @__PURE__ */ jsx(
|
|
2217
|
+
"button",
|
|
2218
|
+
{
|
|
2219
|
+
onClick: () => setSelectedYear((y) => y + 1),
|
|
2220
|
+
className: "rh-p-1 hover:rh-bg-background rh-rounded",
|
|
2221
|
+
children: /* @__PURE__ */ jsx(ChevronRightIcon, { className: "rh-w-5 rh-h-5" })
|
|
2222
|
+
}
|
|
2223
|
+
)
|
|
2224
|
+
] }),
|
|
2225
|
+
/* @__PURE__ */ jsx(
|
|
2226
|
+
"svg",
|
|
2227
|
+
{
|
|
2228
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2229
|
+
width: "100%",
|
|
2230
|
+
height: "1",
|
|
2231
|
+
viewBox: "0 0 350 1",
|
|
2232
|
+
fill: "none",
|
|
2233
|
+
className: "rh-mb-3",
|
|
2234
|
+
children: /* @__PURE__ */ jsx("path", { d: "M0 0.5H350", stroke: "#F5F5F5" })
|
|
2235
|
+
}
|
|
2236
|
+
),
|
|
2237
|
+
/* @__PURE__ */ jsx("div", { className: "rh-grid rh-grid-cols-4 rh-gap-2", children: MONTHS.map((month, index) => {
|
|
2238
|
+
const isSelected = value.mode === "month" && value.year === selectedYear && value.month === index;
|
|
2239
|
+
return /* @__PURE__ */ jsx(
|
|
2240
|
+
"button",
|
|
2241
|
+
{
|
|
2242
|
+
onClick: () => handleChange({ mode: "month", year: selectedYear, month: index }),
|
|
2243
|
+
className: [
|
|
2244
|
+
"rh-rounded-sm rh-py-4 rh-w-auto rh-text-sm rh-transition-colors rh-duration-150 rh-border-border rh-border",
|
|
2245
|
+
isSelected ? "rh-bg-primary rh-text-surface" : "rh-text-text hover:rh-bg-background"
|
|
2246
|
+
].join(" "),
|
|
2247
|
+
children: month
|
|
2248
|
+
},
|
|
2249
|
+
month
|
|
2250
|
+
);
|
|
2251
|
+
}) })
|
|
2252
|
+
] });
|
|
2253
|
+
const renderIntervalNav = () => /* @__PURE__ */ jsxs("div", { children: [
|
|
2254
|
+
/* @__PURE__ */ jsxs("div", { className: "rh-flex rh-gap-4 rh-p-1", children: [
|
|
2255
|
+
/* @__PURE__ */ jsxs("div", { className: "rh-flex-1", children: [
|
|
2256
|
+
/* @__PURE__ */ jsxs("div", { className: "rh-flex rh-items-center rh-justify-between", children: [
|
|
2257
|
+
/* @__PURE__ */ jsx(
|
|
2258
|
+
"button",
|
|
2259
|
+
{
|
|
2260
|
+
onClick: () => {
|
|
2261
|
+
if (selectedMonth === 0) {
|
|
2262
|
+
setSelectedMonth(11);
|
|
2263
|
+
setSelectedYear((y) => y - 1);
|
|
2264
|
+
} else setSelectedMonth((m) => m - 1);
|
|
2265
|
+
},
|
|
2266
|
+
className: "rh-p-1 hover:rh-bg-background rh-rounded",
|
|
2267
|
+
children: /* @__PURE__ */ jsx(ChevronLeftIcon, { className: "rh-w-5 rh-h-5" })
|
|
2268
|
+
}
|
|
2269
|
+
),
|
|
2270
|
+
/* @__PURE__ */ jsxs("span", { className: "rh-text-sm rh-font-medium rh-text-text", children: [
|
|
2271
|
+
MONTHS[selectedMonth],
|
|
2272
|
+
" - ",
|
|
2273
|
+
selectedYear
|
|
2274
|
+
] }),
|
|
2275
|
+
/* @__PURE__ */ jsx("div", { className: "rh-w-7" })
|
|
2276
|
+
] }),
|
|
2277
|
+
/* @__PURE__ */ jsx(
|
|
2278
|
+
"svg",
|
|
2279
|
+
{
|
|
2280
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2281
|
+
width: "100%",
|
|
2282
|
+
height: "1",
|
|
2283
|
+
viewBox: "0 0 350 1",
|
|
2284
|
+
fill: "none",
|
|
2285
|
+
className: "rh-mb-3",
|
|
2286
|
+
children: /* @__PURE__ */ jsx("path", { d: "M0 0.5H350", stroke: "#F5F5F5" })
|
|
2287
|
+
}
|
|
2288
|
+
),
|
|
2289
|
+
/* @__PURE__ */ jsx("div", { className: "rh-grid rh-grid-cols-7 rh-mb-1", children: ["D", "S", "T", "Q", "Q", "S", "S"].map((d, i) => /* @__PURE__ */ jsx(
|
|
2290
|
+
"div",
|
|
2291
|
+
{
|
|
2292
|
+
className: "rh-text-center rh-text-xs rh-text-text-muted rh-font-medium rh-py-1",
|
|
2293
|
+
children: d
|
|
2294
|
+
},
|
|
2295
|
+
i
|
|
2296
|
+
)) }),
|
|
2297
|
+
renderIntervalDays(selectedYear, selectedMonth)
|
|
2298
|
+
] }),
|
|
2299
|
+
/* @__PURE__ */ jsx("div", { className: "rh-w-px rh-bg-border/30 rh-self-stretch" }),
|
|
2300
|
+
/* @__PURE__ */ jsxs("div", { className: "rh-flex-1", children: [
|
|
2301
|
+
/* @__PURE__ */ jsxs("div", { className: "rh-flex rh-items-center rh-justify-between", children: [
|
|
2302
|
+
/* @__PURE__ */ jsx("div", { className: "rh-w-7" }),
|
|
2303
|
+
/* @__PURE__ */ jsxs("span", { className: "rh-text-sm rh-font-medium rh-text-text", children: [
|
|
2304
|
+
MONTHS[rightMonth],
|
|
2305
|
+
" - ",
|
|
2306
|
+
rightYear
|
|
2307
|
+
] }),
|
|
2308
|
+
/* @__PURE__ */ jsx(
|
|
2309
|
+
"button",
|
|
2310
|
+
{
|
|
2311
|
+
onClick: () => {
|
|
2312
|
+
if (selectedMonth === 11) {
|
|
2313
|
+
setSelectedMonth(0);
|
|
2314
|
+
setSelectedYear((y) => y + 1);
|
|
2315
|
+
} else setSelectedMonth((m) => m + 1);
|
|
2316
|
+
},
|
|
2317
|
+
className: "rh-p-1 hover:rh-bg-background rh-rounded",
|
|
2318
|
+
children: /* @__PURE__ */ jsx(ChevronRightIcon, { className: "rh-w-5 rh-h-5" })
|
|
2319
|
+
}
|
|
2320
|
+
)
|
|
2321
|
+
] }),
|
|
2322
|
+
/* @__PURE__ */ jsx(
|
|
2323
|
+
"svg",
|
|
2324
|
+
{
|
|
2325
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2326
|
+
width: "100%",
|
|
2327
|
+
height: "1",
|
|
2328
|
+
viewBox: "0 0 350 1",
|
|
2329
|
+
fill: "none",
|
|
2330
|
+
className: "rh-mb-3",
|
|
2331
|
+
children: /* @__PURE__ */ jsx("path", { d: "M0 0.5H350", stroke: "#F5F5F5" })
|
|
2332
|
+
}
|
|
2333
|
+
),
|
|
2334
|
+
/* @__PURE__ */ jsx("div", { className: "rh-grid rh-grid-cols-7 rh-mb-1", children: ["D", "S", "T", "Q", "Q", "S", "S"].map((d, i) => /* @__PURE__ */ jsx(
|
|
2335
|
+
"div",
|
|
2336
|
+
{
|
|
2337
|
+
className: "rh-text-center rh-text-xs rh-text-text-muted rh-font-medium rh-py-1",
|
|
2338
|
+
children: d
|
|
2339
|
+
},
|
|
2340
|
+
i
|
|
2341
|
+
)) }),
|
|
2342
|
+
renderIntervalDays(rightYear, rightMonth)
|
|
2343
|
+
] })
|
|
2344
|
+
] }),
|
|
2345
|
+
/* @__PURE__ */ 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: [
|
|
2346
|
+
/* @__PURE__ */ jsxs(
|
|
2347
|
+
"button",
|
|
2348
|
+
{
|
|
2349
|
+
onClick: handleIntervalClear,
|
|
2350
|
+
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",
|
|
2351
|
+
children: [
|
|
2352
|
+
/* @__PURE__ */ jsx(EraserIcon, { className: "rh-w-4 rh-h-4" }),
|
|
2353
|
+
"Limpar"
|
|
2354
|
+
]
|
|
2355
|
+
}
|
|
2356
|
+
),
|
|
2357
|
+
/* @__PURE__ */ jsx(
|
|
2358
|
+
"button",
|
|
2359
|
+
{
|
|
2360
|
+
onClick: handleIntervalApply,
|
|
2361
|
+
disabled: !intervalStart || !intervalEnd,
|
|
2362
|
+
style: {
|
|
2363
|
+
backgroundColor: intervalStart && intervalEnd ? "#87A851" : "#87A85180",
|
|
2364
|
+
pointerEvents: !intervalStart || !intervalEnd ? "none" : "auto"
|
|
2365
|
+
},
|
|
2366
|
+
className: [
|
|
2367
|
+
"rh-text-sm rh-font-medium rh-px-4 rh-py-1.5 rh-rounded-lg rh-transition-colors rh-duration-150",
|
|
2368
|
+
intervalStart && intervalEnd ? "rh-text-surface hover:rh-opacity-90" : " rh-text-surface"
|
|
2369
|
+
].join(" "),
|
|
2370
|
+
children: "Aplicar"
|
|
2371
|
+
}
|
|
2372
|
+
)
|
|
2373
|
+
] })
|
|
2374
|
+
] });
|
|
2375
|
+
const renderIntervalDays = (calYear, calMonth) => {
|
|
2376
|
+
const daysInMonth = getDaysInMonth2(calYear, calMonth);
|
|
2377
|
+
const firstDay = getFirstDayOfMonth2(calYear, calMonth);
|
|
2378
|
+
const days = Array.from({ length: daysInMonth }, (_, i) => i + 1);
|
|
2379
|
+
const prevMonth = calMonth === 0 ? 11 : calMonth - 1;
|
|
2380
|
+
const prevYear = calMonth === 0 ? calYear - 1 : calYear;
|
|
2381
|
+
const daysInPrevMonth = getDaysInMonth2(prevYear, prevMonth);
|
|
2382
|
+
const prevDays = Array.from(
|
|
2383
|
+
{ length: firstDay },
|
|
2384
|
+
(_, i) => daysInPrevMonth - firstDay + i + 1
|
|
2385
|
+
);
|
|
2386
|
+
const totalCells = firstDay + daysInMonth;
|
|
2387
|
+
const nextDaysCount = totalCells % 7 === 0 ? 0 : 7 - totalCells % 7;
|
|
2388
|
+
const nextDays = Array.from({ length: nextDaysCount }, (_, i) => i + 1);
|
|
2389
|
+
const handleDayClick = (day) => {
|
|
2390
|
+
const clicked = new Date(calYear, calMonth, day);
|
|
2391
|
+
if (!intervalStart || intervalStart && intervalEnd) {
|
|
2392
|
+
setIntervalStart(clicked);
|
|
2393
|
+
setIntervalEnd(void 0);
|
|
2394
|
+
} else {
|
|
2395
|
+
const [lo, hi] = clicked >= intervalStart ? [intervalStart, clicked] : [clicked, intervalStart];
|
|
2396
|
+
setIntervalStart(lo);
|
|
2397
|
+
setIntervalEnd(hi);
|
|
2398
|
+
}
|
|
2399
|
+
};
|
|
2400
|
+
const getDayClasses = (day) => {
|
|
2401
|
+
const date = new Date(calYear, calMonth, day);
|
|
2402
|
+
const isStart = intervalStart && isSameDay(date, intervalStart);
|
|
2403
|
+
const isEnd = intervalEnd && isSameDay(date, intervalEnd);
|
|
2404
|
+
const isHoverEnd = !intervalEnd && hoverDate && isSameDay(date, hoverDate) && intervalStart;
|
|
2405
|
+
const inRange = isInRange(date, intervalStart, intervalEnd);
|
|
2406
|
+
const inHoverRange = !intervalEnd && isInRange(date, intervalStart, hoverDate);
|
|
2407
|
+
return [
|
|
2408
|
+
"rh-w-7 rh-h-7 rh-flex rh-items-center rh-justify-center rh-text-sm rh-transition-colors rh-duration-150 ",
|
|
2409
|
+
"rh-rounded-lg",
|
|
2410
|
+
isStart || isEnd ? "rh-bg-primary rh-text-surface" : "",
|
|
2411
|
+
isHoverEnd && !isStart ? "rh-bg-primary/70 rh-text-surface" : "",
|
|
2412
|
+
inRange || inHoverRange ? "rh-bg-primary/10 rh-text-text" : "",
|
|
2413
|
+
!isStart && !isEnd && !inRange && !inHoverRange && !isHoverEnd ? "rh-text-text hover:rh-ring-1 hover:rh-ring-[#15607A]" : ""
|
|
2414
|
+
].join(" ");
|
|
2415
|
+
};
|
|
2416
|
+
return /* @__PURE__ */ jsxs("div", { className: "rh-grid rh-grid-cols-7 rh-gap-0 rh-text-center", children: [
|
|
2417
|
+
prevDays.map((d, i) => /* @__PURE__ */ jsx(
|
|
2418
|
+
"div",
|
|
2419
|
+
{
|
|
2420
|
+
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",
|
|
2421
|
+
children: d
|
|
2422
|
+
},
|
|
2423
|
+
`prev-${i}`
|
|
2424
|
+
)),
|
|
2425
|
+
days.map((day) => /* @__PURE__ */ jsx(
|
|
2426
|
+
"button",
|
|
2427
|
+
{
|
|
2428
|
+
onClick: () => handleDayClick(day),
|
|
2429
|
+
onMouseEnter: () => {
|
|
2430
|
+
if (intervalStart && !intervalEnd) {
|
|
2431
|
+
setHoverDate(new Date(calYear, calMonth, day));
|
|
2432
|
+
}
|
|
2433
|
+
},
|
|
2434
|
+
onMouseLeave: () => setHoverDate(void 0),
|
|
2435
|
+
className: getDayClasses(day),
|
|
2436
|
+
children: day
|
|
2437
|
+
},
|
|
2438
|
+
day
|
|
2439
|
+
)),
|
|
2440
|
+
nextDays.map((d, i) => /* @__PURE__ */ jsx(
|
|
2441
|
+
"div",
|
|
2442
|
+
{
|
|
2443
|
+
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",
|
|
2444
|
+
children: d
|
|
2445
|
+
},
|
|
2446
|
+
`next-${i}`
|
|
2447
|
+
))
|
|
2448
|
+
] });
|
|
2449
|
+
};
|
|
2450
|
+
const renderContent = () => {
|
|
2451
|
+
switch (activeMode) {
|
|
2452
|
+
case "interval":
|
|
2453
|
+
return renderIntervalNav();
|
|
2454
|
+
case "day":
|
|
2455
|
+
return /* @__PURE__ */ jsxs("div", { className: "rh-p-1", children: [
|
|
2456
|
+
/* @__PURE__ */ jsxs("div", { className: "rh-flex rh-items-center rh-justify-between", children: [
|
|
2457
|
+
/* @__PURE__ */ jsx(
|
|
2458
|
+
"button",
|
|
2459
|
+
{
|
|
2460
|
+
onClick: () => {
|
|
2461
|
+
if (selectedMonth === 0) {
|
|
2462
|
+
setSelectedMonth(11);
|
|
2463
|
+
setSelectedYear((y) => y - 1);
|
|
2464
|
+
} else setSelectedMonth((m) => m - 1);
|
|
2465
|
+
},
|
|
2466
|
+
className: "rh-p-1 hover:rh-bg-background rh-rounded",
|
|
2467
|
+
children: /* @__PURE__ */ jsx(ChevronLeftIcon, { className: "rh-w-5 rh-h-5" })
|
|
2468
|
+
}
|
|
2469
|
+
),
|
|
2470
|
+
/* @__PURE__ */ jsxs("span", { className: "rh-text-sm rh-font-medium rh-text-text", children: [
|
|
2471
|
+
MONTHS[selectedMonth],
|
|
2472
|
+
" - ",
|
|
2473
|
+
selectedYear
|
|
2474
|
+
] }),
|
|
2475
|
+
/* @__PURE__ */ jsx(
|
|
2476
|
+
"button",
|
|
2477
|
+
{
|
|
2478
|
+
onClick: () => {
|
|
2479
|
+
if (selectedMonth === 11) {
|
|
2480
|
+
setSelectedMonth(0);
|
|
2481
|
+
setSelectedYear((y) => y + 1);
|
|
2482
|
+
} else setSelectedMonth((m) => m + 1);
|
|
2483
|
+
},
|
|
2484
|
+
className: "rh-p-1 hover:rh-bg-background rh-rounded",
|
|
2485
|
+
children: /* @__PURE__ */ jsx(ChevronRightIcon, { className: "rh-w-5 rh-h-5" })
|
|
2486
|
+
}
|
|
2487
|
+
)
|
|
2488
|
+
] }),
|
|
2489
|
+
/* @__PURE__ */ jsx(
|
|
2490
|
+
"svg",
|
|
2491
|
+
{
|
|
2492
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2493
|
+
width: "100%",
|
|
2494
|
+
height: "1",
|
|
2495
|
+
viewBox: "0 0 350 1",
|
|
2496
|
+
fill: "none",
|
|
2497
|
+
className: "rh-mb-3",
|
|
2498
|
+
children: /* @__PURE__ */ jsx("path", { d: "M0 0.5H350", stroke: "#F5F5F5" })
|
|
2499
|
+
}
|
|
2500
|
+
),
|
|
2501
|
+
/* @__PURE__ */ jsx("div", { className: "rh-grid rh-grid-cols-7 rh-mb-1", children: ["D", "S", "T", "Q", "Q", "S", "S"].map((d, i) => /* @__PURE__ */ jsx(
|
|
2502
|
+
"div",
|
|
2503
|
+
{
|
|
2504
|
+
className: "rh-text-center rh-text-xs rh-text-text-muted rh-font-medium rh-py-1",
|
|
2505
|
+
children: d
|
|
2506
|
+
},
|
|
2507
|
+
i
|
|
2508
|
+
)) }),
|
|
2509
|
+
renderDayGrid(selectedYear, selectedMonth)
|
|
2510
|
+
] });
|
|
2511
|
+
case "month":
|
|
2512
|
+
return renderMonthGrid();
|
|
2513
|
+
case "year":
|
|
2514
|
+
return renderYearGrid();
|
|
2515
|
+
}
|
|
2516
|
+
};
|
|
2517
|
+
const renderDayGrid = (calYear, calMonth) => {
|
|
2518
|
+
const daysInMonth = getDaysInMonth2(calYear, calMonth);
|
|
2519
|
+
const firstDay = getFirstDayOfMonth2(calYear, calMonth);
|
|
2520
|
+
const days = Array.from({ length: daysInMonth }, (_, i) => i + 1);
|
|
2521
|
+
const prevMonth = calMonth === 0 ? 11 : calMonth - 1;
|
|
2522
|
+
const prevYear = calMonth === 0 ? calYear - 1 : calYear;
|
|
2523
|
+
const daysInPrevMonth = getDaysInMonth2(prevYear, prevMonth);
|
|
2524
|
+
const prevDays = Array.from(
|
|
2525
|
+
{ length: firstDay },
|
|
2526
|
+
(_, i) => daysInPrevMonth - firstDay + i + 1
|
|
2527
|
+
);
|
|
2528
|
+
const totalCells = firstDay + daysInMonth;
|
|
2529
|
+
const nextDaysCount = totalCells % 7 === 0 ? 0 : 7 - totalCells % 7;
|
|
2530
|
+
const nextDays = Array.from({ length: nextDaysCount }, (_, i) => i + 1);
|
|
2531
|
+
return /* @__PURE__ */ jsxs("div", { className: "rh-grid rh-grid-cols-7 rh-gap-0", children: [
|
|
2532
|
+
prevDays.map((d, i) => /* @__PURE__ */ jsx(
|
|
2533
|
+
"div",
|
|
2534
|
+
{
|
|
2535
|
+
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",
|
|
2536
|
+
children: d
|
|
2537
|
+
},
|
|
2538
|
+
`prev-${i}`
|
|
2539
|
+
)),
|
|
2540
|
+
days.map((day) => {
|
|
2541
|
+
const isSelected = value.mode === "day" && value.year === calYear && value.month === calMonth && value.day === day;
|
|
2542
|
+
return /* @__PURE__ */ jsx(
|
|
2543
|
+
"button",
|
|
2544
|
+
{
|
|
2545
|
+
onClick: () => handleChange({ mode: "day", year: calYear, month: calMonth, day }),
|
|
2546
|
+
className: [
|
|
2547
|
+
"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",
|
|
2548
|
+
isSelected ? "rh-bg-primary rh-text-surface" : "rh-text-text hover:rh-ring-1 hover:rh-ring-[#15607A]"
|
|
2549
|
+
].join(" "),
|
|
2550
|
+
children: day
|
|
2551
|
+
},
|
|
2552
|
+
day
|
|
2553
|
+
);
|
|
2554
|
+
}),
|
|
2555
|
+
nextDays.map((d, i) => /* @__PURE__ */ jsx(
|
|
2556
|
+
"div",
|
|
2557
|
+
{
|
|
2558
|
+
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",
|
|
2559
|
+
children: d
|
|
2560
|
+
},
|
|
2561
|
+
`next-${i}`
|
|
2562
|
+
))
|
|
2563
|
+
] });
|
|
2564
|
+
};
|
|
2565
|
+
return /* @__PURE__ */ jsxs(
|
|
2566
|
+
"div",
|
|
2567
|
+
{
|
|
2568
|
+
ref: wrapperRef,
|
|
2569
|
+
className: ["rh-relative rh-flex rh-flex-col rh-gap-1 rh-font-body", wrapperClassName].filter(Boolean).join(" "),
|
|
2570
|
+
children: [
|
|
2571
|
+
label && /* @__PURE__ */ jsxs("label", { id: `${triggerId}-label`, className: "rh-flex rh-items-baseline rh-gap-1", children: [
|
|
2572
|
+
/* @__PURE__ */ jsx("span", { className: "rh-text-sm rh-font-medium rh-text-text", children: label }),
|
|
2573
|
+
subtitle && /* @__PURE__ */ jsx("span", { className: `rh-text-sm ${getSubtitleClassName3(subtitle)}`, children: subtitle })
|
|
2574
|
+
] }),
|
|
2575
|
+
/* @__PURE__ */ jsxs(
|
|
2576
|
+
"button",
|
|
2577
|
+
{
|
|
2578
|
+
ref: innerRef,
|
|
2579
|
+
id: triggerId,
|
|
2580
|
+
type: "button",
|
|
2581
|
+
role: "combobox",
|
|
2582
|
+
"aria-expanded": isOpen,
|
|
2583
|
+
"aria-haspopup": "dialog",
|
|
2584
|
+
"aria-labelledby": label ? `${triggerId}-label` : void 0,
|
|
2585
|
+
"aria-describedby": helperText ? helperId : void 0,
|
|
2586
|
+
"aria-invalid": visualStatus === "error" || void 0,
|
|
2587
|
+
"aria-disabled": disabled || void 0,
|
|
2588
|
+
disabled,
|
|
2589
|
+
onClick: () => !disabled && setIsOpen((o) => !o),
|
|
2590
|
+
style: backgroundColor ? { backgroundColor } : void 0,
|
|
2591
|
+
className: [
|
|
2592
|
+
"rh-group rh-flex rh-items-center rh-justify-between rh-gap-2",
|
|
2593
|
+
"rh-border rh-font-body",
|
|
2594
|
+
!backgroundColor && "rh-bg-surface",
|
|
2595
|
+
"rh-transition-colors rh-duration-150",
|
|
2596
|
+
"rh-text-left rh-w-full",
|
|
2597
|
+
statusClasses3[visualStatus],
|
|
2598
|
+
radiusClasses5[radius],
|
|
2599
|
+
sizeClasses6[size],
|
|
2600
|
+
disabled ? "rh-opacity-50 rh-cursor-not-allowed rh-bg-background" : "rh-cursor-pointer",
|
|
2601
|
+
className
|
|
2602
|
+
].filter(Boolean).join(" "),
|
|
2603
|
+
children: [
|
|
2604
|
+
/* @__PURE__ */ jsx(
|
|
2605
|
+
"span",
|
|
2606
|
+
{
|
|
2607
|
+
className: [
|
|
2608
|
+
"rh-flex-1 rh-truncate",
|
|
2609
|
+
displayText ? "rh-text-text" : "rh-text-text-muted group-hover:rh-text-text"
|
|
2610
|
+
].join(" "),
|
|
2611
|
+
children: displayText ?? placeholder
|
|
2612
|
+
}
|
|
2613
|
+
),
|
|
2614
|
+
/* @__PURE__ */ jsx(
|
|
2615
|
+
ChevronIcon2,
|
|
2616
|
+
{
|
|
2617
|
+
className: [
|
|
2618
|
+
"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",
|
|
2619
|
+
isOpen ? "rh-rotate-180" : ""
|
|
2620
|
+
].filter(Boolean).join(" ")
|
|
2621
|
+
}
|
|
2622
|
+
)
|
|
2623
|
+
]
|
|
2624
|
+
}
|
|
2625
|
+
),
|
|
2626
|
+
isOpen && /* @__PURE__ */ jsxs(
|
|
2627
|
+
"div",
|
|
2628
|
+
{
|
|
2629
|
+
className: [
|
|
2630
|
+
"rh-absolute rh-z-50 rh-mt-1 rh-p-5",
|
|
2631
|
+
"rh-bg-surface rh-rounded-md",
|
|
2632
|
+
dropdownRadiusClasses2[radius],
|
|
2633
|
+
activeMode === "interval" ? "rh-w-[720px]" : "rh-w-[385px]"
|
|
2634
|
+
].filter(Boolean).join(" "),
|
|
2635
|
+
style: {
|
|
2636
|
+
top: "100%",
|
|
2637
|
+
boxShadow: "0 0 9.6px 0 rgba(8, 11, 18, 0.08)"
|
|
2638
|
+
},
|
|
2639
|
+
children: [
|
|
2640
|
+
renderModeTabs(),
|
|
2641
|
+
/* @__PURE__ */ jsx("div", { className: "rh-mt-2", children: renderContent() })
|
|
2642
|
+
]
|
|
2643
|
+
}
|
|
2644
|
+
),
|
|
2645
|
+
helperText && !isHelperDismissed && /* @__PURE__ */ jsxs(
|
|
2646
|
+
"span",
|
|
2647
|
+
{
|
|
2648
|
+
id: helperId,
|
|
2649
|
+
className: [
|
|
2650
|
+
"rh-flex rh-items-center rh-gap-1 rh-text-xs",
|
|
2651
|
+
helperStatusClasses3[visualStatus]
|
|
2652
|
+
].join(" "),
|
|
2653
|
+
children: [
|
|
2654
|
+
/* @__PURE__ */ jsx(WarningCircleIcon, {}),
|
|
2655
|
+
helperText
|
|
2656
|
+
]
|
|
2657
|
+
}
|
|
2658
|
+
)
|
|
2659
|
+
]
|
|
2660
|
+
}
|
|
2661
|
+
);
|
|
2662
|
+
}
|
|
2663
|
+
);
|
|
1894
2664
|
var variantClasses = {
|
|
1895
2665
|
light: "rh-bg-surface rh-text-text rh-border rh-border-border rh-shadow-md",
|
|
1896
2666
|
default: "rh-bg-primary/10 rh-text-text rh-border rh-border-primary/20 rh-shadow-md",
|
|
@@ -1901,7 +2671,7 @@ var arrowVariantClasses = {
|
|
|
1901
2671
|
default: "rh-border-primary/20 rh-bg-primary/10",
|
|
1902
2672
|
dark: "rh-bg-primary"
|
|
1903
2673
|
};
|
|
1904
|
-
var
|
|
2674
|
+
var sizeClasses7 = {
|
|
1905
2675
|
sm: "rh-px-3 rh-py-1.5 rh-text-xs",
|
|
1906
2676
|
md: "rh-px-4 rh-py-3 rh-text-sm"
|
|
1907
2677
|
};
|
|
@@ -2032,7 +2802,7 @@ var Tooltip = forwardRef(
|
|
|
2032
2802
|
"rh-absolute rh-z-50 rh-w-max rh-max-w-xs rh-rounded-xs",
|
|
2033
2803
|
tooltipPlacementClasses[placement],
|
|
2034
2804
|
variantClasses[variant],
|
|
2035
|
-
|
|
2805
|
+
sizeClasses7[size],
|
|
2036
2806
|
className
|
|
2037
2807
|
].filter(Boolean).join(" "),
|
|
2038
2808
|
children: [
|
|
@@ -2133,7 +2903,7 @@ function getAvatarColors(name) {
|
|
|
2133
2903
|
const index = hash % AVATAR_COLORS.length;
|
|
2134
2904
|
return AVATAR_COLORS[index];
|
|
2135
2905
|
}
|
|
2136
|
-
var
|
|
2906
|
+
var sizeClasses8 = {
|
|
2137
2907
|
sm: "rh-w-8 rh-h-8 rh-text-xs",
|
|
2138
2908
|
md: "rh-w-10 rh-h-10 rh-text-sm",
|
|
2139
2909
|
lg: "rh-w-12 rh-h-12 rh-text-base",
|
|
@@ -2168,7 +2938,7 @@ var Avatar = forwardRef(function Avatar2({ src, alt = "", initials, size = "md",
|
|
|
2168
2938
|
"rh-inline-flex rh-items-center rh-justify-center rh-shrink-0 rh-overflow-hidden",
|
|
2169
2939
|
avatarColors ? "" : "rh-bg-primary rh-text-surface",
|
|
2170
2940
|
"rh-font-display rh-font-medium rh-select-none",
|
|
2171
|
-
|
|
2941
|
+
sizeClasses8[size],
|
|
2172
2942
|
variantClasses2[variant],
|
|
2173
2943
|
className
|
|
2174
2944
|
].filter(Boolean).join(" "),
|
|
@@ -2235,7 +3005,7 @@ var hoverInactivePresetClasses = {
|
|
|
2235
3005
|
info: "hover:rh-bg-info/20 hover:rh-border-info/50",
|
|
2236
3006
|
neutral: "hover:rh-bg-neutral/20 hover:rh-border-neutral/50"
|
|
2237
3007
|
};
|
|
2238
|
-
var
|
|
3008
|
+
var sizeClasses9 = {
|
|
2239
3009
|
sm: "rh-text-xs rh-px-2 rh-py-0.5 rh-gap-1",
|
|
2240
3010
|
md: "rh-text-sm rh-px-2.5 rh-py-1 rh-gap-1.5",
|
|
2241
3011
|
lg: "rh-text-sm rh-px-3 rh-py-1.5 rh-gap-1.5"
|
|
@@ -2282,7 +3052,7 @@ var Tag = forwardRef(function Tag2({
|
|
|
2282
3052
|
"rh-transition-colors rh-duration-150",
|
|
2283
3053
|
"rh-cursor-pointer",
|
|
2284
3054
|
clickable ? "rh-cursor-pointer" : "",
|
|
2285
|
-
|
|
3055
|
+
sizeClasses9[size],
|
|
2286
3056
|
colorClasses3,
|
|
2287
3057
|
hoverClasses,
|
|
2288
3058
|
disabled ? "rh-opacity-50 rh-cursor-not-allowed rh-pointer-events-none" : "",
|
|
@@ -2299,16 +3069,16 @@ var Tag = forwardRef(function Tag2({
|
|
|
2299
3069
|
}
|
|
2300
3070
|
);
|
|
2301
3071
|
});
|
|
2302
|
-
var
|
|
3072
|
+
var statusClasses4 = {
|
|
2303
3073
|
default: "rh-border-border focus-within:rh-ring-2 focus-within:rh-ring-ring focus-within:rh-ring-offset-2",
|
|
2304
3074
|
error: "rh-border-danger focus-within:rh-ring-2 focus-within:rh-ring-danger focus-within:rh-ring-offset-2"
|
|
2305
3075
|
};
|
|
2306
|
-
var
|
|
3076
|
+
var sizeClasses10 = {
|
|
2307
3077
|
sm: "rh-min-h-[36px] rh-text-sm rh-px-2 rh-py-1",
|
|
2308
3078
|
md: "rh-h-[44px] rh-text-sm rh-px-2 rh-py-[6px]",
|
|
2309
3079
|
lg: "rh-min-h-[52px] rh-text-base rh-px-3 rh-py-2"
|
|
2310
3080
|
};
|
|
2311
|
-
var
|
|
3081
|
+
var radiusClasses6 = {
|
|
2312
3082
|
none: "rh-rounded-none",
|
|
2313
3083
|
xxs: "rh-rounded-xxs",
|
|
2314
3084
|
xs: "rh-rounded-xs",
|
|
@@ -2318,7 +3088,7 @@ var radiusClasses5 = {
|
|
|
2318
3088
|
xl: "rh-rounded-xl",
|
|
2319
3089
|
full: "rh-rounded-full"
|
|
2320
3090
|
};
|
|
2321
|
-
var
|
|
3091
|
+
var helperStatusClasses4 = {
|
|
2322
3092
|
default: "rh-text-text-muted",
|
|
2323
3093
|
error: "rh-text-danger"
|
|
2324
3094
|
};
|
|
@@ -2337,7 +3107,7 @@ var addButtonSizeClasses = {
|
|
|
2337
3107
|
md: "rh-w-5 rh-h-5",
|
|
2338
3108
|
lg: "rh-w-5 rh-h-5"
|
|
2339
3109
|
};
|
|
2340
|
-
var
|
|
3110
|
+
var getSubtitleClassName4 = (subtitle) => subtitle.trim() === "*" ? "rh-text-danger" : "rh-text-text-muted";
|
|
2341
3111
|
var TagInput = forwardRef(function TagInput2({
|
|
2342
3112
|
label,
|
|
2343
3113
|
subtitle,
|
|
@@ -2394,7 +3164,7 @@ var TagInput = forwardRef(function TagInput2({
|
|
|
2394
3164
|
children: [
|
|
2395
3165
|
label && /* @__PURE__ */ jsxs("label", { htmlFor: inputId, className: "rh-flex rh-items-baseline rh-gap-1", children: [
|
|
2396
3166
|
/* @__PURE__ */ jsx("span", { className: "rh-text-sm rh-font-semibold rh-text-text", children: label }),
|
|
2397
|
-
subtitle && /* @__PURE__ */ jsx("span", { className: `rh-text-sm ${
|
|
3167
|
+
subtitle && /* @__PURE__ */ jsx("span", { className: `rh-text-sm ${getSubtitleClassName4(subtitle)}`, children: subtitle })
|
|
2398
3168
|
] }),
|
|
2399
3169
|
/* @__PURE__ */ jsxs(
|
|
2400
3170
|
"div",
|
|
@@ -2404,9 +3174,9 @@ var TagInput = forwardRef(function TagInput2({
|
|
|
2404
3174
|
"rh-flex rh-flex-row rh-items-center rh-justify-between rh-gap-2",
|
|
2405
3175
|
"rh-border rh-bg-surface rh-font-body",
|
|
2406
3176
|
"rh-transition-colors rh-duration-150",
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
3177
|
+
statusClasses4[status],
|
|
3178
|
+
radiusClasses6[radius],
|
|
3179
|
+
sizeClasses10[size],
|
|
2410
3180
|
disabled ? "rh-opacity-50 rh-cursor-not-allowed rh-bg-background" : "rh-cursor-pointer",
|
|
2411
3181
|
className
|
|
2412
3182
|
].filter(Boolean).join(" "),
|
|
@@ -2569,7 +3339,7 @@ var TagInput = forwardRef(function TagInput2({
|
|
|
2569
3339
|
id: `${inputId}-helper`,
|
|
2570
3340
|
className: [
|
|
2571
3341
|
"rh-flex rh-items-center rh-gap-1 rh-text-xs",
|
|
2572
|
-
|
|
3342
|
+
helperStatusClasses4[status]
|
|
2573
3343
|
].join(" "),
|
|
2574
3344
|
children: helperText
|
|
2575
3345
|
}
|
|
@@ -2676,12 +3446,12 @@ var PRESET_COLORS5 = /* @__PURE__ */ new Set([
|
|
|
2676
3446
|
"info"
|
|
2677
3447
|
]);
|
|
2678
3448
|
var isPresetColor5 = (color) => PRESET_COLORS5.has(color);
|
|
2679
|
-
var
|
|
3449
|
+
var sizeClasses11 = {
|
|
2680
3450
|
sm: { container: "rh-h-8", button: "rh-px-2 rh-text-xs" },
|
|
2681
3451
|
md: { container: "rh-h-9", button: "rh-px-3 rh-text-sm" },
|
|
2682
3452
|
lg: { container: "rh-h-10", button: "rh-px-4 rh-text-sm" }
|
|
2683
3453
|
};
|
|
2684
|
-
var
|
|
3454
|
+
var radiusClasses7 = {
|
|
2685
3455
|
none: "rh-rounded-none",
|
|
2686
3456
|
xs: "rh-rounded-xs",
|
|
2687
3457
|
sm: "rh-rounded-sm",
|
|
@@ -2714,8 +3484,8 @@ function ToggleGroupInner({
|
|
|
2714
3484
|
className: [
|
|
2715
3485
|
"rh-inline-flex rh-items-center rh-bg-muted rh-overflow-hidden",
|
|
2716
3486
|
"rh-p-1 rh-gap-0.5",
|
|
2717
|
-
|
|
2718
|
-
|
|
3487
|
+
radiusClasses7[radius],
|
|
3488
|
+
sizeClasses11[size].container,
|
|
2719
3489
|
disabled ? "rh-opacity-50 rh-cursor-not-allowed" : "",
|
|
2720
3490
|
className
|
|
2721
3491
|
].filter(Boolean).join(" "),
|
|
@@ -2737,8 +3507,8 @@ function ToggleGroupInner({
|
|
|
2737
3507
|
"rh-border-0 rh-font-display rh-font-medium",
|
|
2738
3508
|
"rh-transition-all rh-duration-150",
|
|
2739
3509
|
"focus-visible:rh-outline-none focus-visible:rh-ring-2 focus-visible:rh-ring-ring",
|
|
2740
|
-
|
|
2741
|
-
|
|
3510
|
+
radiusClasses7[radius],
|
|
3511
|
+
sizeClasses11[size].button,
|
|
2742
3512
|
isActive ? "rh-bg-surface rh-text-text rh-shadow-sm" : "rh-bg-transparent rh-text-text-muted",
|
|
2743
3513
|
!isActive && !isDisabled ? "hover:rh-bg-surface/50" : "",
|
|
2744
3514
|
isDisabled ? "rh-cursor-not-allowed rh-pointer-events-none" : "rh-cursor-pointer"
|
|
@@ -2761,7 +3531,7 @@ var variantClasses3 = {
|
|
|
2761
3531
|
outlined: "rh-bg-surface rh-border rh-border-border rh-shadow-none",
|
|
2762
3532
|
filled: "rh-bg-background rh-border-0 rh-shadow-none"
|
|
2763
3533
|
};
|
|
2764
|
-
var
|
|
3534
|
+
var radiusClasses8 = {
|
|
2765
3535
|
none: "rh-rounded-none",
|
|
2766
3536
|
xs: "rh-rounded-xs",
|
|
2767
3537
|
sm: "rh-rounded-sm",
|
|
@@ -2796,7 +3566,7 @@ var CardRoot = forwardRef(function Card({
|
|
|
2796
3566
|
className: [
|
|
2797
3567
|
"rh-font-body rh-transition-all rh-duration-150",
|
|
2798
3568
|
variantClasses3[variant],
|
|
2799
|
-
|
|
3569
|
+
radiusClasses8[radius],
|
|
2800
3570
|
paddingClasses[padding],
|
|
2801
3571
|
isInteractive ? "rh-cursor-pointer hover:rh-shadow-lg hover:rh-scale-[1.01] active:rh-scale-[0.99]" : "",
|
|
2802
3572
|
disabled ? "rh-opacity-50 rh-cursor-not-allowed rh-pointer-events-none" : "",
|
|
@@ -2849,7 +3619,7 @@ var PRESET_COLORS6 = /* @__PURE__ */ new Set([
|
|
|
2849
3619
|
"info"
|
|
2850
3620
|
]);
|
|
2851
3621
|
var isPresetColor6 = (color) => PRESET_COLORS6.has(color);
|
|
2852
|
-
var
|
|
3622
|
+
var sizeClasses12 = {
|
|
2853
3623
|
xs: "rh-w-3 rh-h-3",
|
|
2854
3624
|
sm: "rh-w-4 rh-h-4",
|
|
2855
3625
|
md: "rh-w-6 rh-h-6",
|
|
@@ -2877,7 +3647,7 @@ var Spinner = forwardRef(function Spinner2({ size = "md", color = "primary", lab
|
|
|
2877
3647
|
"aria-label": label,
|
|
2878
3648
|
className: [
|
|
2879
3649
|
"rh-inline-flex rh-items-center rh-justify-center",
|
|
2880
|
-
|
|
3650
|
+
sizeClasses12[size],
|
|
2881
3651
|
colorClass,
|
|
2882
3652
|
className
|
|
2883
3653
|
].filter(Boolean).join(" "),
|
|
@@ -2965,7 +3735,7 @@ function getDaysInMonth(year, month) {
|
|
|
2965
3735
|
function getFirstDayOfMonth(year, month) {
|
|
2966
3736
|
return new Date(year, month, 1).getDay();
|
|
2967
3737
|
}
|
|
2968
|
-
var
|
|
3738
|
+
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(
|
|
2969
3739
|
"path",
|
|
2970
3740
|
{
|
|
2971
3741
|
fillRule: "evenodd",
|
|
@@ -2973,7 +3743,7 @@ var ChevronLeftIcon = () => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 20 20", f
|
|
|
2973
3743
|
clipRule: "evenodd"
|
|
2974
3744
|
}
|
|
2975
3745
|
) });
|
|
2976
|
-
var
|
|
3746
|
+
var ChevronRightIcon2 = () => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 20 20", fill: "currentColor", className: "rh-w-5 rh-h-5", "aria-hidden": "true", children: /* @__PURE__ */ jsx(
|
|
2977
3747
|
"path",
|
|
2978
3748
|
{
|
|
2979
3749
|
fillRule: "evenodd",
|
|
@@ -3054,7 +3824,7 @@ var DatePickerDropdown = ({
|
|
|
3054
3824
|
prevMonth();
|
|
3055
3825
|
},
|
|
3056
3826
|
className: "rh-p-1 hover:rh-bg-background rh-rounded rh-cursor-pointer rh-text-text",
|
|
3057
|
-
children: /* @__PURE__ */ jsx(
|
|
3827
|
+
children: /* @__PURE__ */ jsx(ChevronLeftIcon2, {})
|
|
3058
3828
|
}
|
|
3059
3829
|
),
|
|
3060
3830
|
/* @__PURE__ */ jsxs("span", { className: "rh-text-sm rh-font-medium rh-text-text", children: [
|
|
@@ -3071,7 +3841,7 @@ var DatePickerDropdown = ({
|
|
|
3071
3841
|
nextMonth();
|
|
3072
3842
|
},
|
|
3073
3843
|
className: "rh-p-1 hover:rh-bg-background rh-rounded rh-cursor-pointer rh-text-text",
|
|
3074
|
-
children: /* @__PURE__ */ jsx(
|
|
3844
|
+
children: /* @__PURE__ */ jsx(ChevronRightIcon2, {})
|
|
3075
3845
|
}
|
|
3076
3846
|
)
|
|
3077
3847
|
] }),
|
|
@@ -3304,7 +4074,7 @@ var CustomSelect = ({
|
|
|
3304
4074
|
)
|
|
3305
4075
|
] });
|
|
3306
4076
|
};
|
|
3307
|
-
var
|
|
4077
|
+
var sizeClasses13 = {
|
|
3308
4078
|
sm: { cell: "rh-px-2 rh-py-2 rh-text-xs", header: "rh-px-2 rh-py-2 rh-text-xs" },
|
|
3309
4079
|
md: { cell: "rh-px-3 rh-py-3 rh-text-sm", header: "rh-px-3 rh-py-3 rh-text-xs" },
|
|
3310
4080
|
lg: { cell: "rh-px-4 rh-py-4 rh-text-sm", header: "rh-px-4 rh-py-3 rh-text-sm" }
|
|
@@ -3438,7 +4208,7 @@ function TableInner({
|
|
|
3438
4208
|
...rowPaddingStyle
|
|
3439
4209
|
},
|
|
3440
4210
|
className: [
|
|
3441
|
-
rowPadding ? "" :
|
|
4211
|
+
rowPadding ? "" : sizeClasses13[size].header,
|
|
3442
4212
|
alignClasses[column.align || "left"],
|
|
3443
4213
|
`rh-font-semibold rh-whitespace-nowrap ${headerTextClassName || "rh-text-text-muted"}`,
|
|
3444
4214
|
stickyHeader ? "rh-sticky rh-top-0 rh-bg-surface rh-z-10" : "",
|
|
@@ -3503,7 +4273,7 @@ function TableInner({
|
|
|
3503
4273
|
{
|
|
3504
4274
|
style: { width: column.width, maxWidth: column.maxWidth, ...rowPaddingStyle },
|
|
3505
4275
|
className: [
|
|
3506
|
-
rowPadding ? "" :
|
|
4276
|
+
rowPadding ? "" : sizeClasses13[size].cell,
|
|
3507
4277
|
alignClasses[column.align || "left"],
|
|
3508
4278
|
"rh-text-text"
|
|
3509
4279
|
].filter(Boolean).join(" "),
|
|
@@ -3542,7 +4312,7 @@ function TableInner({
|
|
|
3542
4312
|
colSpan,
|
|
3543
4313
|
style: rowPaddingStyle,
|
|
3544
4314
|
className: [
|
|
3545
|
-
rowPadding ? "" :
|
|
4315
|
+
rowPadding ? "" : sizeClasses13[size].cell,
|
|
3546
4316
|
"rh-text-center rh-cursor-pointer rh-text-[#9CA3AF] rh-font-medium"
|
|
3547
4317
|
].filter(Boolean).join(" "),
|
|
3548
4318
|
onClick: onAddRow,
|
|
@@ -3995,6 +4765,6 @@ var GridItem = forwardRef(
|
|
|
3995
4765
|
}
|
|
3996
4766
|
);
|
|
3997
4767
|
|
|
3998
|
-
export { Avatar, Button, Card2 as Card, CardContent, CardFooter, CardHeader, CaretLeftIcon, CaretRightIcon, Checkbox, CloseIcon, Container, DeleteIcon, EditIcon, ErrorIcon, GridContainer, GridItem, IconButton, InfoIcon, NeutralIcon, Pagination, PlusIcon, ProgressBar, Radio, RadioGroup, RadioOption, RehagroProvider, SearchIcon, Select, Spinner, SuccessIcon, Table, Tag, TagInput, TextInput, Toast, ToastContainer, ToastProvider, ToggleGroup, Tooltip, Typography, WarningIcon, useToast };
|
|
4768
|
+
export { Avatar, Button, Card2 as Card, CardContent, CardFooter, CardHeader, CaretLeftIcon, CaretRightIcon, Checkbox, CloseIcon, Container, DateSelect, DeleteIcon, EditIcon, ErrorIcon, GridContainer, GridItem, IconButton, InfoIcon, NeutralIcon, Pagination, PlusIcon, ProgressBar, Radio, RadioGroup, RadioOption, RehagroProvider, SearchIcon, Select, Spinner, SuccessIcon, Table, Tag, TagInput, TextInput, Toast, ToastContainer, ToastProvider, ToggleGroup, Tooltip, Typography, WarningIcon, useToast };
|
|
3999
4769
|
//# sourceMappingURL=index.mjs.map
|
|
4000
4770
|
//# sourceMappingURL=index.mjs.map
|