@vesture/react 0.2.0 → 0.2.1
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.css +323 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +78 -1
- package/dist/index.js +911 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1712,6 +1712,914 @@ function DataGrid({
|
|
|
1712
1712
|
] });
|
|
1713
1713
|
}
|
|
1714
1714
|
|
|
1715
|
+
// src/components/Calendar/Calendar.tsx
|
|
1716
|
+
import { useEffect as useEffect2, useMemo as useMemo3, useRef as useRef4, useState as useState9 } from "react";
|
|
1717
|
+
|
|
1718
|
+
// src/components/Calendar/Calendar.css.ts
|
|
1719
|
+
var dayButton = "Calendar_dayButton__1uy43my8";
|
|
1720
|
+
var dayCell = "Calendar_dayCell__1uy43my7";
|
|
1721
|
+
var grid = "Calendar_grid__1uy43my4";
|
|
1722
|
+
var header = "Calendar_header__1uy43my1";
|
|
1723
|
+
var monthLabel = "Calendar_monthLabel__1uy43my2";
|
|
1724
|
+
var navButton = "Calendar_navButton__1uy43my3";
|
|
1725
|
+
var root2 = "Calendar_root__1uy43my0";
|
|
1726
|
+
var weekRow = "Calendar_weekRow__1uy43my5";
|
|
1727
|
+
var weekdayCell = "Calendar_weekdayCell__1uy43my6";
|
|
1728
|
+
|
|
1729
|
+
// src/components/Calendar/Calendar.tsx
|
|
1730
|
+
import { jsx as jsx35, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1731
|
+
function startOfMonth(date) {
|
|
1732
|
+
return new Date(date.getFullYear(), date.getMonth(), 1);
|
|
1733
|
+
}
|
|
1734
|
+
function endOfMonth(date) {
|
|
1735
|
+
return new Date(date.getFullYear(), date.getMonth() + 1, 0);
|
|
1736
|
+
}
|
|
1737
|
+
function addDays(date, amount) {
|
|
1738
|
+
const next = new Date(date);
|
|
1739
|
+
next.setDate(next.getDate() + amount);
|
|
1740
|
+
return next;
|
|
1741
|
+
}
|
|
1742
|
+
function addMonths(date, amount) {
|
|
1743
|
+
const next = new Date(date);
|
|
1744
|
+
next.setMonth(next.getMonth() + amount);
|
|
1745
|
+
return next;
|
|
1746
|
+
}
|
|
1747
|
+
function isSameDay(a, b) {
|
|
1748
|
+
return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
1749
|
+
}
|
|
1750
|
+
function isSameMonth(a, b) {
|
|
1751
|
+
return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth();
|
|
1752
|
+
}
|
|
1753
|
+
function clampToMidnight(date) {
|
|
1754
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
|
1755
|
+
}
|
|
1756
|
+
function startOfWeek(date, weekStartsOn) {
|
|
1757
|
+
const diff = (date.getDay() - weekStartsOn + 7) % 7;
|
|
1758
|
+
return addDays(date, -diff);
|
|
1759
|
+
}
|
|
1760
|
+
function endOfWeek(date, weekStartsOn) {
|
|
1761
|
+
return addDays(startOfWeek(date, weekStartsOn), 6);
|
|
1762
|
+
}
|
|
1763
|
+
function dateKey(date) {
|
|
1764
|
+
return `${date.getFullYear()}-${date.getMonth()}-${date.getDate()}`;
|
|
1765
|
+
}
|
|
1766
|
+
function getCalendarWeeks(month, weekStartsOn) {
|
|
1767
|
+
const gridStart = startOfWeek(startOfMonth(month), weekStartsOn);
|
|
1768
|
+
const gridEnd = endOfWeek(endOfMonth(month), weekStartsOn);
|
|
1769
|
+
const weeks = [];
|
|
1770
|
+
let cursor = gridStart;
|
|
1771
|
+
while (cursor <= gridEnd) {
|
|
1772
|
+
const week = [];
|
|
1773
|
+
for (let i = 0; i < 7; i++) {
|
|
1774
|
+
week.push(cursor);
|
|
1775
|
+
cursor = addDays(cursor, 1);
|
|
1776
|
+
}
|
|
1777
|
+
weeks.push(week);
|
|
1778
|
+
}
|
|
1779
|
+
return weeks;
|
|
1780
|
+
}
|
|
1781
|
+
function isDateDisabledBy(date, minDate, maxDate, isDateDisabled) {
|
|
1782
|
+
const target = clampToMidnight(date);
|
|
1783
|
+
if (minDate && target < clampToMidnight(minDate)) return true;
|
|
1784
|
+
if (maxDate && target > clampToMidnight(maxDate)) return true;
|
|
1785
|
+
if (isDateDisabled?.(target)) return true;
|
|
1786
|
+
return false;
|
|
1787
|
+
}
|
|
1788
|
+
function findEnabledDate(date, direction2, minDate, maxDate, isDateDisabled) {
|
|
1789
|
+
let cursor = date;
|
|
1790
|
+
for (let i = 0; i < 366; i++) {
|
|
1791
|
+
if (!isDateDisabledBy(cursor, minDate, maxDate, isDateDisabled)) {
|
|
1792
|
+
return cursor;
|
|
1793
|
+
}
|
|
1794
|
+
cursor = addDays(cursor, direction2);
|
|
1795
|
+
}
|
|
1796
|
+
return null;
|
|
1797
|
+
}
|
|
1798
|
+
function getFocusableDate(month, value, minDate, maxDate, isDateDisabled) {
|
|
1799
|
+
if (value && isSameMonth(value, month) && !isDateDisabledBy(value, minDate, maxDate, isDateDisabled)) {
|
|
1800
|
+
return clampToMidnight(value);
|
|
1801
|
+
}
|
|
1802
|
+
const today = clampToMidnight(/* @__PURE__ */ new Date());
|
|
1803
|
+
if (isSameMonth(today, month) && !isDateDisabledBy(today, minDate, maxDate, isDateDisabled)) {
|
|
1804
|
+
return today;
|
|
1805
|
+
}
|
|
1806
|
+
const firstEnabled = findEnabledDate(
|
|
1807
|
+
startOfMonth(month),
|
|
1808
|
+
1,
|
|
1809
|
+
minDate,
|
|
1810
|
+
maxDate,
|
|
1811
|
+
isDateDisabled
|
|
1812
|
+
);
|
|
1813
|
+
if (firstEnabled && isSameMonth(firstEnabled, month)) {
|
|
1814
|
+
return firstEnabled;
|
|
1815
|
+
}
|
|
1816
|
+
return startOfMonth(month);
|
|
1817
|
+
}
|
|
1818
|
+
function Calendar({
|
|
1819
|
+
value: controlledValue,
|
|
1820
|
+
defaultValue = null,
|
|
1821
|
+
onChange,
|
|
1822
|
+
month: controlledMonth,
|
|
1823
|
+
onMonthChange,
|
|
1824
|
+
minDate,
|
|
1825
|
+
maxDate,
|
|
1826
|
+
isDateDisabled,
|
|
1827
|
+
weekStartsOn = 1,
|
|
1828
|
+
locale = "en-US",
|
|
1829
|
+
rangeEnd
|
|
1830
|
+
}) {
|
|
1831
|
+
const [uncontrolledValue, setUncontrolledValue] = useState9(
|
|
1832
|
+
defaultValue
|
|
1833
|
+
);
|
|
1834
|
+
const value = controlledValue !== void 0 ? controlledValue : uncontrolledValue;
|
|
1835
|
+
const setValue = (next) => {
|
|
1836
|
+
if (controlledValue === void 0) {
|
|
1837
|
+
setUncontrolledValue(next);
|
|
1838
|
+
}
|
|
1839
|
+
onChange?.(next);
|
|
1840
|
+
};
|
|
1841
|
+
const [uncontrolledMonth, setUncontrolledMonth] = useState9(
|
|
1842
|
+
() => startOfMonth(controlledMonth ?? value ?? /* @__PURE__ */ new Date())
|
|
1843
|
+
);
|
|
1844
|
+
const month = controlledMonth !== void 0 ? startOfMonth(controlledMonth) : uncontrolledMonth;
|
|
1845
|
+
const setMonth = (next) => {
|
|
1846
|
+
const normalized = startOfMonth(next);
|
|
1847
|
+
if (controlledMonth === void 0) {
|
|
1848
|
+
setUncontrolledMonth(normalized);
|
|
1849
|
+
}
|
|
1850
|
+
onMonthChange?.(normalized);
|
|
1851
|
+
};
|
|
1852
|
+
const [rovingDate, setRovingDate] = useState9(
|
|
1853
|
+
() => getFocusableDate(month, value, minDate, maxDate, isDateDisabled)
|
|
1854
|
+
);
|
|
1855
|
+
const shouldFocusRef = useRef4(false);
|
|
1856
|
+
const dayRefs = useRef4(/* @__PURE__ */ new Map());
|
|
1857
|
+
useEffect2(() => {
|
|
1858
|
+
setRovingDate((prev) => {
|
|
1859
|
+
if (isSameMonth(prev, month)) return prev;
|
|
1860
|
+
return getFocusableDate(month, value, minDate, maxDate, isDateDisabled);
|
|
1861
|
+
});
|
|
1862
|
+
}, [month]);
|
|
1863
|
+
useEffect2(() => {
|
|
1864
|
+
if (!shouldFocusRef.current) return;
|
|
1865
|
+
shouldFocusRef.current = false;
|
|
1866
|
+
dayRefs.current.get(dateKey(rovingDate))?.focus();
|
|
1867
|
+
}, [rovingDate, month]);
|
|
1868
|
+
const weeks = useMemo3(
|
|
1869
|
+
() => getCalendarWeeks(month, weekStartsOn),
|
|
1870
|
+
[month, weekStartsOn]
|
|
1871
|
+
);
|
|
1872
|
+
const today = useMemo3(() => clampToMidnight(/* @__PURE__ */ new Date()), []);
|
|
1873
|
+
const monthLabelFormatter = useMemo3(
|
|
1874
|
+
() => new Intl.DateTimeFormat(locale, { month: "long", year: "numeric" }),
|
|
1875
|
+
[locale]
|
|
1876
|
+
);
|
|
1877
|
+
const weekdayFormatter = useMemo3(
|
|
1878
|
+
() => new Intl.DateTimeFormat(locale, { weekday: "short" }),
|
|
1879
|
+
[locale]
|
|
1880
|
+
);
|
|
1881
|
+
const handleDayClick = (date, disabled, inMonth) => {
|
|
1882
|
+
if (disabled) return;
|
|
1883
|
+
if (!inMonth) {
|
|
1884
|
+
setMonth(startOfMonth(date));
|
|
1885
|
+
return;
|
|
1886
|
+
}
|
|
1887
|
+
const normalized = clampToMidnight(date);
|
|
1888
|
+
setValue(normalized);
|
|
1889
|
+
setRovingDate(normalized);
|
|
1890
|
+
};
|
|
1891
|
+
const handleKeyDown = (event, date) => {
|
|
1892
|
+
let targetRaw;
|
|
1893
|
+
let direction2;
|
|
1894
|
+
switch (event.key) {
|
|
1895
|
+
case "ArrowLeft":
|
|
1896
|
+
targetRaw = addDays(date, -1);
|
|
1897
|
+
direction2 = -1;
|
|
1898
|
+
break;
|
|
1899
|
+
case "ArrowRight":
|
|
1900
|
+
targetRaw = addDays(date, 1);
|
|
1901
|
+
direction2 = 1;
|
|
1902
|
+
break;
|
|
1903
|
+
case "ArrowUp":
|
|
1904
|
+
targetRaw = addDays(date, -7);
|
|
1905
|
+
direction2 = -1;
|
|
1906
|
+
break;
|
|
1907
|
+
case "ArrowDown":
|
|
1908
|
+
targetRaw = addDays(date, 7);
|
|
1909
|
+
direction2 = 1;
|
|
1910
|
+
break;
|
|
1911
|
+
case "Home":
|
|
1912
|
+
targetRaw = startOfWeek(date, weekStartsOn);
|
|
1913
|
+
direction2 = -1;
|
|
1914
|
+
break;
|
|
1915
|
+
case "End":
|
|
1916
|
+
targetRaw = endOfWeek(date, weekStartsOn);
|
|
1917
|
+
direction2 = 1;
|
|
1918
|
+
break;
|
|
1919
|
+
case "PageUp":
|
|
1920
|
+
targetRaw = addMonths(date, -1);
|
|
1921
|
+
direction2 = -1;
|
|
1922
|
+
break;
|
|
1923
|
+
case "PageDown":
|
|
1924
|
+
targetRaw = addMonths(date, 1);
|
|
1925
|
+
direction2 = 1;
|
|
1926
|
+
break;
|
|
1927
|
+
default:
|
|
1928
|
+
return;
|
|
1929
|
+
}
|
|
1930
|
+
event.preventDefault();
|
|
1931
|
+
const target = findEnabledDate(
|
|
1932
|
+
targetRaw,
|
|
1933
|
+
direction2,
|
|
1934
|
+
minDate,
|
|
1935
|
+
maxDate,
|
|
1936
|
+
isDateDisabled
|
|
1937
|
+
);
|
|
1938
|
+
if (!target) return;
|
|
1939
|
+
shouldFocusRef.current = true;
|
|
1940
|
+
setRovingDate(target);
|
|
1941
|
+
if (!isSameMonth(target, month)) {
|
|
1942
|
+
setMonth(startOfMonth(target));
|
|
1943
|
+
}
|
|
1944
|
+
};
|
|
1945
|
+
const monthLabelText = monthLabelFormatter.format(month);
|
|
1946
|
+
const clampedValue = value ? clampToMidnight(value) : null;
|
|
1947
|
+
const clampedRangeEnd = rangeEnd ? clampToMidnight(rangeEnd) : null;
|
|
1948
|
+
return /* @__PURE__ */ jsxs18("div", { className: root2, role: "application", "aria-label": monthLabelText, children: [
|
|
1949
|
+
/* @__PURE__ */ jsxs18("div", { className: header, children: [
|
|
1950
|
+
/* @__PURE__ */ jsx35(
|
|
1951
|
+
"button",
|
|
1952
|
+
{
|
|
1953
|
+
type: "button",
|
|
1954
|
+
className: navButton,
|
|
1955
|
+
onClick: () => setMonth(addMonths(month, -1)),
|
|
1956
|
+
"aria-label": "Previous month",
|
|
1957
|
+
children: "\u2039"
|
|
1958
|
+
}
|
|
1959
|
+
),
|
|
1960
|
+
/* @__PURE__ */ jsx35("span", { className: monthLabel, children: monthLabelText }),
|
|
1961
|
+
/* @__PURE__ */ jsx35(
|
|
1962
|
+
"button",
|
|
1963
|
+
{
|
|
1964
|
+
type: "button",
|
|
1965
|
+
className: navButton,
|
|
1966
|
+
onClick: () => setMonth(addMonths(month, 1)),
|
|
1967
|
+
"aria-label": "Next month",
|
|
1968
|
+
children: "\u203A"
|
|
1969
|
+
}
|
|
1970
|
+
)
|
|
1971
|
+
] }),
|
|
1972
|
+
/* @__PURE__ */ jsxs18("div", { className: grid, role: "grid", "aria-label": monthLabelText, children: [
|
|
1973
|
+
/* @__PURE__ */ jsx35("div", { className: weekRow, role: "row", children: weeks[0].map((date) => /* @__PURE__ */ jsx35(
|
|
1974
|
+
"div",
|
|
1975
|
+
{
|
|
1976
|
+
className: weekdayCell,
|
|
1977
|
+
role: "columnheader",
|
|
1978
|
+
children: weekdayFormatter.format(date)
|
|
1979
|
+
},
|
|
1980
|
+
dateKey(date)
|
|
1981
|
+
)) }),
|
|
1982
|
+
weeks.map((week, weekIndex) => /* @__PURE__ */ jsx35("div", { className: weekRow, role: "row", children: week.map((date) => {
|
|
1983
|
+
const inMonth = isSameMonth(date, month);
|
|
1984
|
+
const disabled = isDateDisabledBy(
|
|
1985
|
+
date,
|
|
1986
|
+
minDate,
|
|
1987
|
+
maxDate,
|
|
1988
|
+
isDateDisabled
|
|
1989
|
+
);
|
|
1990
|
+
const isRangeEndDay = clampedRangeEnd ? isSameDay(date, clampedRangeEnd) : false;
|
|
1991
|
+
const selected = (clampedValue ? isSameDay(date, clampedValue) : false) || isRangeEndDay;
|
|
1992
|
+
const inRange = Boolean(
|
|
1993
|
+
clampedValue && clampedRangeEnd && date > clampedValue && date < clampedRangeEnd
|
|
1994
|
+
);
|
|
1995
|
+
const isToday = isSameDay(date, today);
|
|
1996
|
+
const tabIndex = inMonth && !disabled && isSameDay(date, rovingDate) ? 0 : -1;
|
|
1997
|
+
return /* @__PURE__ */ jsx35("div", { className: dayCell, role: "gridcell", children: /* @__PURE__ */ jsx35(
|
|
1998
|
+
"button",
|
|
1999
|
+
{
|
|
2000
|
+
type: "button",
|
|
2001
|
+
ref: (el) => {
|
|
2002
|
+
if (el) {
|
|
2003
|
+
dayRefs.current.set(dateKey(date), el);
|
|
2004
|
+
} else {
|
|
2005
|
+
dayRefs.current.delete(dateKey(date));
|
|
2006
|
+
}
|
|
2007
|
+
},
|
|
2008
|
+
className: dayButton,
|
|
2009
|
+
"data-outside": !inMonth || void 0,
|
|
2010
|
+
"data-today": isToday || void 0,
|
|
2011
|
+
"data-selected": selected || void 0,
|
|
2012
|
+
"data-in-range": inRange || void 0,
|
|
2013
|
+
disabled,
|
|
2014
|
+
tabIndex,
|
|
2015
|
+
"aria-selected": selected || void 0,
|
|
2016
|
+
"aria-current": isToday ? "date" : void 0,
|
|
2017
|
+
"aria-disabled": disabled || void 0,
|
|
2018
|
+
"aria-label": date.toDateString(),
|
|
2019
|
+
onClick: () => handleDayClick(date, disabled, inMonth),
|
|
2020
|
+
onKeyDown: inMonth ? (e) => handleKeyDown(e, date) : void 0,
|
|
2021
|
+
children: date.getDate()
|
|
2022
|
+
}
|
|
2023
|
+
) }, dateKey(date));
|
|
2024
|
+
}) }, weekIndex))
|
|
2025
|
+
] })
|
|
2026
|
+
] });
|
|
2027
|
+
}
|
|
2028
|
+
|
|
2029
|
+
// src/components/DatePicker/DatePicker.tsx
|
|
2030
|
+
import { useEffect as useEffect3, useRef as useRef5, useState as useState10 } from "react";
|
|
2031
|
+
import {
|
|
2032
|
+
FloatingFocusManager as FloatingFocusManager4,
|
|
2033
|
+
FloatingPortal as FloatingPortal5,
|
|
2034
|
+
autoUpdate as autoUpdate4,
|
|
2035
|
+
flip as flip4,
|
|
2036
|
+
offset as offset4,
|
|
2037
|
+
shift as shift4,
|
|
2038
|
+
useDismiss as useDismiss5,
|
|
2039
|
+
useFloating as useFloating5,
|
|
2040
|
+
useInteractions as useInteractions5,
|
|
2041
|
+
useRole as useRole5
|
|
2042
|
+
} from "@floating-ui/react";
|
|
2043
|
+
|
|
2044
|
+
// src/components/DatePicker/DatePicker.css.ts
|
|
2045
|
+
var dateInput = "DatePicker_dateInput__d7uy1a1";
|
|
2046
|
+
var iconButton2 = "DatePicker_iconButton__d7uy1a2";
|
|
2047
|
+
var popover2 = "DatePicker_popover__d7uy1a3";
|
|
2048
|
+
var wrapper6 = "DatePicker_wrapper__d7uy1a0";
|
|
2049
|
+
|
|
2050
|
+
// src/components/DatePicker/DatePicker.tsx
|
|
2051
|
+
import { jsx as jsx36, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2052
|
+
function startOfMonth2(date) {
|
|
2053
|
+
return new Date(date.getFullYear(), date.getMonth(), 1);
|
|
2054
|
+
}
|
|
2055
|
+
function clampToMidnight2(date) {
|
|
2056
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
|
2057
|
+
}
|
|
2058
|
+
function isDisabled(date, minDate, maxDate, isDateDisabled) {
|
|
2059
|
+
const target = clampToMidnight2(date);
|
|
2060
|
+
if (minDate && target < clampToMidnight2(minDate)) return true;
|
|
2061
|
+
if (maxDate && target > clampToMidnight2(maxDate)) return true;
|
|
2062
|
+
if (isDateDisabled?.(target)) return true;
|
|
2063
|
+
return false;
|
|
2064
|
+
}
|
|
2065
|
+
function getDatePartOrder(locale) {
|
|
2066
|
+
const parts = new Intl.DateTimeFormat(locale).formatToParts(
|
|
2067
|
+
new Date(2e3, 0, 2)
|
|
2068
|
+
);
|
|
2069
|
+
return parts.filter(
|
|
2070
|
+
(part) => part.type === "month" || part.type === "day" || part.type === "year"
|
|
2071
|
+
).map((part) => part.type);
|
|
2072
|
+
}
|
|
2073
|
+
function getDatePlaceholder(locale) {
|
|
2074
|
+
const parts = new Intl.DateTimeFormat(locale).formatToParts(
|
|
2075
|
+
new Date(2e3, 0, 2)
|
|
2076
|
+
);
|
|
2077
|
+
return parts.map((part) => {
|
|
2078
|
+
switch (part.type) {
|
|
2079
|
+
case "month":
|
|
2080
|
+
return "MM";
|
|
2081
|
+
case "day":
|
|
2082
|
+
return "DD";
|
|
2083
|
+
case "year":
|
|
2084
|
+
return "YYYY";
|
|
2085
|
+
default:
|
|
2086
|
+
return part.value;
|
|
2087
|
+
}
|
|
2088
|
+
}).join("");
|
|
2089
|
+
}
|
|
2090
|
+
function formatDate(date, locale) {
|
|
2091
|
+
return new Intl.DateTimeFormat(locale).format(date);
|
|
2092
|
+
}
|
|
2093
|
+
function parseDate(text, locale) {
|
|
2094
|
+
const numbers = text.match(/\d+/g);
|
|
2095
|
+
if (!numbers || numbers.length < 3) return null;
|
|
2096
|
+
const order = getDatePartOrder(locale);
|
|
2097
|
+
if (order.length < 3) return null;
|
|
2098
|
+
const values = {};
|
|
2099
|
+
order.forEach((type, i) => {
|
|
2100
|
+
values[type] = Number.parseInt(numbers[i], 10);
|
|
2101
|
+
});
|
|
2102
|
+
const { month, day, year } = values;
|
|
2103
|
+
if (!month || !day || !year) return null;
|
|
2104
|
+
const fullYear = year < 100 ? 2e3 + year : year;
|
|
2105
|
+
const date = new Date(fullYear, month - 1, day);
|
|
2106
|
+
if (date.getFullYear() !== fullYear || date.getMonth() !== month - 1 || date.getDate() !== day) {
|
|
2107
|
+
return null;
|
|
2108
|
+
}
|
|
2109
|
+
return date;
|
|
2110
|
+
}
|
|
2111
|
+
function DatePicker({
|
|
2112
|
+
value: controlledValue,
|
|
2113
|
+
defaultValue = null,
|
|
2114
|
+
onChange,
|
|
2115
|
+
minDate,
|
|
2116
|
+
maxDate,
|
|
2117
|
+
isDateDisabled,
|
|
2118
|
+
weekStartsOn = 1,
|
|
2119
|
+
locale = "en-US",
|
|
2120
|
+
placeholder,
|
|
2121
|
+
disabled = false,
|
|
2122
|
+
open: controlledOpen,
|
|
2123
|
+
onOpenChange
|
|
2124
|
+
}) {
|
|
2125
|
+
const [uncontrolledValue, setUncontrolledValue] = useState10(
|
|
2126
|
+
defaultValue
|
|
2127
|
+
);
|
|
2128
|
+
const value = controlledValue !== void 0 ? controlledValue : uncontrolledValue;
|
|
2129
|
+
const setValue = (next) => {
|
|
2130
|
+
if (controlledValue === void 0) {
|
|
2131
|
+
setUncontrolledValue(next);
|
|
2132
|
+
}
|
|
2133
|
+
onChange?.(next);
|
|
2134
|
+
};
|
|
2135
|
+
const [uncontrolledOpen, setUncontrolledOpen] = useState10(false);
|
|
2136
|
+
const open = controlledOpen ?? uncontrolledOpen;
|
|
2137
|
+
const setOpen = onOpenChange ?? setUncontrolledOpen;
|
|
2138
|
+
const [month, setMonth] = useState10(
|
|
2139
|
+
() => startOfMonth2(value ?? /* @__PURE__ */ new Date())
|
|
2140
|
+
);
|
|
2141
|
+
const [inputText, setInputText] = useState10(
|
|
2142
|
+
() => value ? formatDate(value, locale) : ""
|
|
2143
|
+
);
|
|
2144
|
+
const inputRef = useRef5(null);
|
|
2145
|
+
useEffect3(() => {
|
|
2146
|
+
setInputText(value ? formatDate(value, locale) : "");
|
|
2147
|
+
}, [value, locale]);
|
|
2148
|
+
useEffect3(() => {
|
|
2149
|
+
if (open && value) {
|
|
2150
|
+
setMonth(startOfMonth2(value));
|
|
2151
|
+
}
|
|
2152
|
+
}, [open]);
|
|
2153
|
+
const { refs, floatingStyles, context } = useFloating5({
|
|
2154
|
+
open,
|
|
2155
|
+
onOpenChange: setOpen,
|
|
2156
|
+
placement: "bottom-start",
|
|
2157
|
+
whileElementsMounted: autoUpdate4,
|
|
2158
|
+
middleware: [offset4(8), flip4(), shift4({ padding: 8 })]
|
|
2159
|
+
});
|
|
2160
|
+
const { getReferenceProps, getFloatingProps } = useInteractions5([
|
|
2161
|
+
useDismiss5(context),
|
|
2162
|
+
useRole5(context, { role: "dialog" })
|
|
2163
|
+
]);
|
|
2164
|
+
const revertInputText = () => {
|
|
2165
|
+
setInputText(value ? formatDate(value, locale) : "");
|
|
2166
|
+
};
|
|
2167
|
+
const commitTypedValue = () => {
|
|
2168
|
+
const trimmed = inputText.trim();
|
|
2169
|
+
if (!trimmed) {
|
|
2170
|
+
if (value !== null) {
|
|
2171
|
+
setValue(null);
|
|
2172
|
+
}
|
|
2173
|
+
return;
|
|
2174
|
+
}
|
|
2175
|
+
const parsed = parseDate(trimmed, locale);
|
|
2176
|
+
if (!parsed || isDisabled(parsed, minDate, maxDate, isDateDisabled)) {
|
|
2177
|
+
revertInputText();
|
|
2178
|
+
return;
|
|
2179
|
+
}
|
|
2180
|
+
setValue(parsed);
|
|
2181
|
+
setMonth(startOfMonth2(parsed));
|
|
2182
|
+
setInputText(formatDate(parsed, locale));
|
|
2183
|
+
};
|
|
2184
|
+
const handleInputKeyDown = (event) => {
|
|
2185
|
+
if (event.key === "Enter") {
|
|
2186
|
+
event.preventDefault();
|
|
2187
|
+
commitTypedValue();
|
|
2188
|
+
}
|
|
2189
|
+
};
|
|
2190
|
+
const handleCalendarChange = (date) => {
|
|
2191
|
+
setValue(date);
|
|
2192
|
+
setMonth(startOfMonth2(date));
|
|
2193
|
+
setOpen(false);
|
|
2194
|
+
};
|
|
2195
|
+
const placeholderText = placeholder ?? getDatePlaceholder(locale);
|
|
2196
|
+
return /* @__PURE__ */ jsxs19("div", { className: wrapper6, ref: refs.setReference, children: [
|
|
2197
|
+
/* @__PURE__ */ jsx36(
|
|
2198
|
+
"input",
|
|
2199
|
+
{
|
|
2200
|
+
ref: inputRef,
|
|
2201
|
+
type: "text",
|
|
2202
|
+
className: dateInput,
|
|
2203
|
+
value: inputText,
|
|
2204
|
+
placeholder: placeholderText,
|
|
2205
|
+
disabled,
|
|
2206
|
+
onChange: (e) => setInputText(e.target.value),
|
|
2207
|
+
onBlur: commitTypedValue,
|
|
2208
|
+
onKeyDown: handleInputKeyDown,
|
|
2209
|
+
"aria-label": "Date"
|
|
2210
|
+
}
|
|
2211
|
+
),
|
|
2212
|
+
/* @__PURE__ */ jsx36(
|
|
2213
|
+
"button",
|
|
2214
|
+
{
|
|
2215
|
+
type: "button",
|
|
2216
|
+
className: iconButton2,
|
|
2217
|
+
disabled,
|
|
2218
|
+
"aria-label": open ? "Close calendar" : "Open calendar",
|
|
2219
|
+
...getReferenceProps({
|
|
2220
|
+
onClick: () => {
|
|
2221
|
+
if (disabled) return;
|
|
2222
|
+
setOpen(!open);
|
|
2223
|
+
}
|
|
2224
|
+
}),
|
|
2225
|
+
children: /* @__PURE__ */ jsxs19(
|
|
2226
|
+
"svg",
|
|
2227
|
+
{
|
|
2228
|
+
width: "16",
|
|
2229
|
+
height: "16",
|
|
2230
|
+
viewBox: "0 0 16 16",
|
|
2231
|
+
fill: "none",
|
|
2232
|
+
"aria-hidden": "true",
|
|
2233
|
+
children: [
|
|
2234
|
+
/* @__PURE__ */ jsx36(
|
|
2235
|
+
"rect",
|
|
2236
|
+
{
|
|
2237
|
+
x: "1.5",
|
|
2238
|
+
y: "2.5",
|
|
2239
|
+
width: "13",
|
|
2240
|
+
height: "12",
|
|
2241
|
+
rx: "1.5",
|
|
2242
|
+
stroke: "currentColor",
|
|
2243
|
+
strokeWidth: "1.3"
|
|
2244
|
+
}
|
|
2245
|
+
),
|
|
2246
|
+
/* @__PURE__ */ jsx36("path", { d: "M1.5 6h13", stroke: "currentColor", strokeWidth: "1.3" }),
|
|
2247
|
+
/* @__PURE__ */ jsx36(
|
|
2248
|
+
"path",
|
|
2249
|
+
{
|
|
2250
|
+
d: "M4.5 1v3M11.5 1v3",
|
|
2251
|
+
stroke: "currentColor",
|
|
2252
|
+
strokeWidth: "1.3",
|
|
2253
|
+
strokeLinecap: "round"
|
|
2254
|
+
}
|
|
2255
|
+
)
|
|
2256
|
+
]
|
|
2257
|
+
}
|
|
2258
|
+
)
|
|
2259
|
+
}
|
|
2260
|
+
),
|
|
2261
|
+
open ? /* @__PURE__ */ jsx36(FloatingPortal5, { children: /* @__PURE__ */ jsx36(
|
|
2262
|
+
FloatingFocusManager4,
|
|
2263
|
+
{
|
|
2264
|
+
context,
|
|
2265
|
+
modal: false,
|
|
2266
|
+
returnFocus: inputRef,
|
|
2267
|
+
children: /* @__PURE__ */ jsx36(
|
|
2268
|
+
"div",
|
|
2269
|
+
{
|
|
2270
|
+
ref: refs.setFloating,
|
|
2271
|
+
className: popover2,
|
|
2272
|
+
style: floatingStyles,
|
|
2273
|
+
...getFloatingProps(),
|
|
2274
|
+
children: /* @__PURE__ */ jsx36(
|
|
2275
|
+
Calendar,
|
|
2276
|
+
{
|
|
2277
|
+
value,
|
|
2278
|
+
onChange: handleCalendarChange,
|
|
2279
|
+
month,
|
|
2280
|
+
onMonthChange: setMonth,
|
|
2281
|
+
minDate,
|
|
2282
|
+
maxDate,
|
|
2283
|
+
isDateDisabled,
|
|
2284
|
+
weekStartsOn,
|
|
2285
|
+
locale
|
|
2286
|
+
}
|
|
2287
|
+
)
|
|
2288
|
+
}
|
|
2289
|
+
)
|
|
2290
|
+
}
|
|
2291
|
+
) }) : null
|
|
2292
|
+
] });
|
|
2293
|
+
}
|
|
2294
|
+
|
|
2295
|
+
// src/components/DateRangePicker/DateRangePicker.tsx
|
|
2296
|
+
import { useEffect as useEffect4, useState as useState11 } from "react";
|
|
2297
|
+
import {
|
|
2298
|
+
FloatingFocusManager as FloatingFocusManager5,
|
|
2299
|
+
FloatingPortal as FloatingPortal6,
|
|
2300
|
+
autoUpdate as autoUpdate5,
|
|
2301
|
+
flip as flip5,
|
|
2302
|
+
offset as offset5,
|
|
2303
|
+
shift as shift5,
|
|
2304
|
+
useDismiss as useDismiss6,
|
|
2305
|
+
useFloating as useFloating6,
|
|
2306
|
+
useInteractions as useInteractions6,
|
|
2307
|
+
useRole as useRole6
|
|
2308
|
+
} from "@floating-ui/react";
|
|
2309
|
+
|
|
2310
|
+
// src/components/DateRangePicker/DateRangePicker.css.ts
|
|
2311
|
+
var dateInput2 = "DateRangePicker_dateInput__11t25r41";
|
|
2312
|
+
var iconButton3 = "DateRangePicker_iconButton__11t25r43";
|
|
2313
|
+
var popover3 = "DateRangePicker_popover__11t25r44";
|
|
2314
|
+
var separator2 = "DateRangePicker_separator__11t25r42";
|
|
2315
|
+
var wrapper7 = "DateRangePicker_wrapper__11t25r40";
|
|
2316
|
+
|
|
2317
|
+
// src/components/DateRangePicker/DateRangePicker.tsx
|
|
2318
|
+
import { jsx as jsx37, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2319
|
+
function startOfMonth3(date) {
|
|
2320
|
+
return new Date(date.getFullYear(), date.getMonth(), 1);
|
|
2321
|
+
}
|
|
2322
|
+
function clampToMidnight3(date) {
|
|
2323
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
|
2324
|
+
}
|
|
2325
|
+
function compareDates(a, b) {
|
|
2326
|
+
const x = clampToMidnight3(a).getTime();
|
|
2327
|
+
const y = clampToMidnight3(b).getTime();
|
|
2328
|
+
if (x < y) return -1;
|
|
2329
|
+
if (x > y) return 1;
|
|
2330
|
+
return 0;
|
|
2331
|
+
}
|
|
2332
|
+
function isDisabled2(date, minDate, maxDate, isDateDisabled) {
|
|
2333
|
+
const target = clampToMidnight3(date);
|
|
2334
|
+
if (minDate && target < clampToMidnight3(minDate)) return true;
|
|
2335
|
+
if (maxDate && target > clampToMidnight3(maxDate)) return true;
|
|
2336
|
+
if (isDateDisabled?.(target)) return true;
|
|
2337
|
+
return false;
|
|
2338
|
+
}
|
|
2339
|
+
function getDatePartOrder2(locale) {
|
|
2340
|
+
const parts = new Intl.DateTimeFormat(locale).formatToParts(
|
|
2341
|
+
new Date(2e3, 0, 2)
|
|
2342
|
+
);
|
|
2343
|
+
return parts.filter(
|
|
2344
|
+
(part) => part.type === "month" || part.type === "day" || part.type === "year"
|
|
2345
|
+
).map((part) => part.type);
|
|
2346
|
+
}
|
|
2347
|
+
function getDatePlaceholder2(locale) {
|
|
2348
|
+
const parts = new Intl.DateTimeFormat(locale).formatToParts(
|
|
2349
|
+
new Date(2e3, 0, 2)
|
|
2350
|
+
);
|
|
2351
|
+
return parts.map((part) => {
|
|
2352
|
+
switch (part.type) {
|
|
2353
|
+
case "month":
|
|
2354
|
+
return "MM";
|
|
2355
|
+
case "day":
|
|
2356
|
+
return "DD";
|
|
2357
|
+
case "year":
|
|
2358
|
+
return "YYYY";
|
|
2359
|
+
default:
|
|
2360
|
+
return part.value;
|
|
2361
|
+
}
|
|
2362
|
+
}).join("");
|
|
2363
|
+
}
|
|
2364
|
+
function formatDate2(date, locale) {
|
|
2365
|
+
return new Intl.DateTimeFormat(locale).format(date);
|
|
2366
|
+
}
|
|
2367
|
+
function parseDate2(text, locale) {
|
|
2368
|
+
const numbers = text.match(/\d+/g);
|
|
2369
|
+
if (!numbers || numbers.length < 3) return null;
|
|
2370
|
+
const order = getDatePartOrder2(locale);
|
|
2371
|
+
if (order.length < 3) return null;
|
|
2372
|
+
const values = {};
|
|
2373
|
+
order.forEach((type, i) => {
|
|
2374
|
+
values[type] = Number.parseInt(numbers[i], 10);
|
|
2375
|
+
});
|
|
2376
|
+
const { month, day, year } = values;
|
|
2377
|
+
if (!month || !day || !year) return null;
|
|
2378
|
+
const fullYear = year < 100 ? 2e3 + year : year;
|
|
2379
|
+
const date = new Date(fullYear, month - 1, day);
|
|
2380
|
+
if (date.getFullYear() !== fullYear || date.getMonth() !== month - 1 || date.getDate() !== day) {
|
|
2381
|
+
return null;
|
|
2382
|
+
}
|
|
2383
|
+
return date;
|
|
2384
|
+
}
|
|
2385
|
+
var EMPTY_RANGE = { start: null, end: null };
|
|
2386
|
+
function DateRangePicker({
|
|
2387
|
+
value: controlledValue,
|
|
2388
|
+
defaultValue = EMPTY_RANGE,
|
|
2389
|
+
onChange,
|
|
2390
|
+
minDate,
|
|
2391
|
+
maxDate,
|
|
2392
|
+
isDateDisabled,
|
|
2393
|
+
weekStartsOn = 1,
|
|
2394
|
+
locale = "en-US",
|
|
2395
|
+
startPlaceholder,
|
|
2396
|
+
endPlaceholder,
|
|
2397
|
+
disabled = false,
|
|
2398
|
+
open: controlledOpen,
|
|
2399
|
+
onOpenChange
|
|
2400
|
+
}) {
|
|
2401
|
+
const [uncontrolledValue, setUncontrolledValue] = useState11(defaultValue);
|
|
2402
|
+
const value = controlledValue !== void 0 ? controlledValue : uncontrolledValue;
|
|
2403
|
+
const setValue = (next) => {
|
|
2404
|
+
if (controlledValue === void 0) {
|
|
2405
|
+
setUncontrolledValue(next);
|
|
2406
|
+
}
|
|
2407
|
+
onChange?.(next);
|
|
2408
|
+
};
|
|
2409
|
+
const [uncontrolledOpen, setUncontrolledOpen] = useState11(false);
|
|
2410
|
+
const open = controlledOpen ?? uncontrolledOpen;
|
|
2411
|
+
const setOpen = onOpenChange ?? setUncontrolledOpen;
|
|
2412
|
+
const [month, setMonth] = useState11(
|
|
2413
|
+
() => startOfMonth3(value.start ?? /* @__PURE__ */ new Date())
|
|
2414
|
+
);
|
|
2415
|
+
const [startText, setStartText] = useState11(
|
|
2416
|
+
() => value.start ? formatDate2(value.start, locale) : ""
|
|
2417
|
+
);
|
|
2418
|
+
const [endText, setEndText] = useState11(
|
|
2419
|
+
() => value.end ? formatDate2(value.end, locale) : ""
|
|
2420
|
+
);
|
|
2421
|
+
useEffect4(() => {
|
|
2422
|
+
setStartText(value.start ? formatDate2(value.start, locale) : "");
|
|
2423
|
+
}, [value.start, locale]);
|
|
2424
|
+
useEffect4(() => {
|
|
2425
|
+
setEndText(value.end ? formatDate2(value.end, locale) : "");
|
|
2426
|
+
}, [value.end, locale]);
|
|
2427
|
+
useEffect4(() => {
|
|
2428
|
+
if (open && value.start) {
|
|
2429
|
+
setMonth(startOfMonth3(value.start));
|
|
2430
|
+
}
|
|
2431
|
+
}, [open]);
|
|
2432
|
+
const { refs, floatingStyles, context } = useFloating6({
|
|
2433
|
+
open,
|
|
2434
|
+
onOpenChange: setOpen,
|
|
2435
|
+
placement: "bottom-start",
|
|
2436
|
+
whileElementsMounted: autoUpdate5,
|
|
2437
|
+
middleware: [offset5(8), flip5(), shift5({ padding: 8 })]
|
|
2438
|
+
});
|
|
2439
|
+
const { getReferenceProps, getFloatingProps } = useInteractions6([
|
|
2440
|
+
useDismiss6(context),
|
|
2441
|
+
useRole6(context, { role: "dialog" })
|
|
2442
|
+
]);
|
|
2443
|
+
const revertStartText = () => {
|
|
2444
|
+
setStartText(value.start ? formatDate2(value.start, locale) : "");
|
|
2445
|
+
};
|
|
2446
|
+
const revertEndText = () => {
|
|
2447
|
+
setEndText(value.end ? formatDate2(value.end, locale) : "");
|
|
2448
|
+
};
|
|
2449
|
+
const commitStartText = () => {
|
|
2450
|
+
const trimmed = startText.trim();
|
|
2451
|
+
if (!trimmed) {
|
|
2452
|
+
if (value.start !== null) {
|
|
2453
|
+
setValue({ start: null, end: value.end });
|
|
2454
|
+
}
|
|
2455
|
+
return;
|
|
2456
|
+
}
|
|
2457
|
+
const parsed = parseDate2(trimmed, locale);
|
|
2458
|
+
if (!parsed || isDisabled2(parsed, minDate, maxDate, isDateDisabled) || value.end && compareDates(parsed, value.end) > 0) {
|
|
2459
|
+
revertStartText();
|
|
2460
|
+
return;
|
|
2461
|
+
}
|
|
2462
|
+
setValue({ start: parsed, end: value.end });
|
|
2463
|
+
setMonth(startOfMonth3(parsed));
|
|
2464
|
+
};
|
|
2465
|
+
const commitEndText = () => {
|
|
2466
|
+
const trimmed = endText.trim();
|
|
2467
|
+
if (!trimmed) {
|
|
2468
|
+
if (value.end !== null) {
|
|
2469
|
+
setValue({ start: value.start, end: null });
|
|
2470
|
+
}
|
|
2471
|
+
return;
|
|
2472
|
+
}
|
|
2473
|
+
const parsed = parseDate2(trimmed, locale);
|
|
2474
|
+
if (!parsed || isDisabled2(parsed, minDate, maxDate, isDateDisabled) || value.start && compareDates(parsed, value.start) < 0) {
|
|
2475
|
+
revertEndText();
|
|
2476
|
+
return;
|
|
2477
|
+
}
|
|
2478
|
+
setValue({ start: value.start, end: parsed });
|
|
2479
|
+
setMonth(startOfMonth3(parsed));
|
|
2480
|
+
};
|
|
2481
|
+
const handleStartKeyDown = (event) => {
|
|
2482
|
+
if (event.key === "Enter") {
|
|
2483
|
+
event.preventDefault();
|
|
2484
|
+
commitStartText();
|
|
2485
|
+
}
|
|
2486
|
+
};
|
|
2487
|
+
const handleEndKeyDown = (event) => {
|
|
2488
|
+
if (event.key === "Enter") {
|
|
2489
|
+
event.preventDefault();
|
|
2490
|
+
commitEndText();
|
|
2491
|
+
}
|
|
2492
|
+
};
|
|
2493
|
+
const handleCalendarChange = (date) => {
|
|
2494
|
+
const { start, end } = value;
|
|
2495
|
+
if (!start || start && end) {
|
|
2496
|
+
setValue({ start: date, end: null });
|
|
2497
|
+
setMonth(startOfMonth3(date));
|
|
2498
|
+
return;
|
|
2499
|
+
}
|
|
2500
|
+
if (compareDates(date, start) < 0) {
|
|
2501
|
+
setValue({ start: date, end: start });
|
|
2502
|
+
} else {
|
|
2503
|
+
setValue({ start, end: date });
|
|
2504
|
+
}
|
|
2505
|
+
setOpen(false);
|
|
2506
|
+
};
|
|
2507
|
+
const startPlaceholderText = startPlaceholder ?? getDatePlaceholder2(locale);
|
|
2508
|
+
const endPlaceholderText = endPlaceholder ?? getDatePlaceholder2(locale);
|
|
2509
|
+
return /* @__PURE__ */ jsxs20(
|
|
2510
|
+
"div",
|
|
2511
|
+
{
|
|
2512
|
+
className: wrapper7,
|
|
2513
|
+
"data-disabled": disabled || void 0,
|
|
2514
|
+
ref: refs.setReference,
|
|
2515
|
+
children: [
|
|
2516
|
+
/* @__PURE__ */ jsx37(
|
|
2517
|
+
"input",
|
|
2518
|
+
{
|
|
2519
|
+
type: "text",
|
|
2520
|
+
className: dateInput2,
|
|
2521
|
+
value: startText,
|
|
2522
|
+
placeholder: startPlaceholderText,
|
|
2523
|
+
disabled,
|
|
2524
|
+
onChange: (e) => setStartText(e.target.value),
|
|
2525
|
+
onBlur: commitStartText,
|
|
2526
|
+
onKeyDown: handleStartKeyDown,
|
|
2527
|
+
"aria-label": "Start date"
|
|
2528
|
+
}
|
|
2529
|
+
),
|
|
2530
|
+
/* @__PURE__ */ jsx37("span", { className: separator2, "aria-hidden": "true", children: "\u2013" }),
|
|
2531
|
+
/* @__PURE__ */ jsx37(
|
|
2532
|
+
"input",
|
|
2533
|
+
{
|
|
2534
|
+
type: "text",
|
|
2535
|
+
className: dateInput2,
|
|
2536
|
+
value: endText,
|
|
2537
|
+
placeholder: endPlaceholderText,
|
|
2538
|
+
disabled,
|
|
2539
|
+
onChange: (e) => setEndText(e.target.value),
|
|
2540
|
+
onBlur: commitEndText,
|
|
2541
|
+
onKeyDown: handleEndKeyDown,
|
|
2542
|
+
"aria-label": "End date"
|
|
2543
|
+
}
|
|
2544
|
+
),
|
|
2545
|
+
/* @__PURE__ */ jsx37(
|
|
2546
|
+
"button",
|
|
2547
|
+
{
|
|
2548
|
+
type: "button",
|
|
2549
|
+
className: iconButton3,
|
|
2550
|
+
disabled,
|
|
2551
|
+
"aria-label": open ? "Close calendar" : "Open calendar",
|
|
2552
|
+
...getReferenceProps({
|
|
2553
|
+
onClick: () => {
|
|
2554
|
+
if (disabled) return;
|
|
2555
|
+
setOpen(!open);
|
|
2556
|
+
}
|
|
2557
|
+
}),
|
|
2558
|
+
children: /* @__PURE__ */ jsxs20(
|
|
2559
|
+
"svg",
|
|
2560
|
+
{
|
|
2561
|
+
width: "16",
|
|
2562
|
+
height: "16",
|
|
2563
|
+
viewBox: "0 0 16 16",
|
|
2564
|
+
fill: "none",
|
|
2565
|
+
"aria-hidden": "true",
|
|
2566
|
+
children: [
|
|
2567
|
+
/* @__PURE__ */ jsx37(
|
|
2568
|
+
"rect",
|
|
2569
|
+
{
|
|
2570
|
+
x: "1.5",
|
|
2571
|
+
y: "2.5",
|
|
2572
|
+
width: "13",
|
|
2573
|
+
height: "12",
|
|
2574
|
+
rx: "1.5",
|
|
2575
|
+
stroke: "currentColor",
|
|
2576
|
+
strokeWidth: "1.3"
|
|
2577
|
+
}
|
|
2578
|
+
),
|
|
2579
|
+
/* @__PURE__ */ jsx37("path", { d: "M1.5 6h13", stroke: "currentColor", strokeWidth: "1.3" }),
|
|
2580
|
+
/* @__PURE__ */ jsx37(
|
|
2581
|
+
"path",
|
|
2582
|
+
{
|
|
2583
|
+
d: "M4.5 1v3M11.5 1v3",
|
|
2584
|
+
stroke: "currentColor",
|
|
2585
|
+
strokeWidth: "1.3",
|
|
2586
|
+
strokeLinecap: "round"
|
|
2587
|
+
}
|
|
2588
|
+
)
|
|
2589
|
+
]
|
|
2590
|
+
}
|
|
2591
|
+
)
|
|
2592
|
+
}
|
|
2593
|
+
),
|
|
2594
|
+
open ? /* @__PURE__ */ jsx37(FloatingPortal6, { children: /* @__PURE__ */ jsx37(FloatingFocusManager5, { context, modal: false, children: /* @__PURE__ */ jsx37(
|
|
2595
|
+
"div",
|
|
2596
|
+
{
|
|
2597
|
+
ref: refs.setFloating,
|
|
2598
|
+
className: popover3,
|
|
2599
|
+
style: floatingStyles,
|
|
2600
|
+
...getFloatingProps(),
|
|
2601
|
+
children: /* @__PURE__ */ jsx37(
|
|
2602
|
+
Calendar,
|
|
2603
|
+
{
|
|
2604
|
+
value: value.start,
|
|
2605
|
+
rangeEnd: value.end,
|
|
2606
|
+
onChange: handleCalendarChange,
|
|
2607
|
+
month,
|
|
2608
|
+
onMonthChange: setMonth,
|
|
2609
|
+
minDate,
|
|
2610
|
+
maxDate,
|
|
2611
|
+
isDateDisabled,
|
|
2612
|
+
weekStartsOn,
|
|
2613
|
+
locale
|
|
2614
|
+
}
|
|
2615
|
+
)
|
|
2616
|
+
}
|
|
2617
|
+
) }) }) : null
|
|
2618
|
+
]
|
|
2619
|
+
}
|
|
2620
|
+
);
|
|
2621
|
+
}
|
|
2622
|
+
|
|
1715
2623
|
// src/index.ts
|
|
1716
2624
|
import { vars as vars2, defaultThemeClass, defaultThemeVars } from "@vesture/tokens";
|
|
1717
2625
|
export {
|
|
@@ -1725,9 +2633,12 @@ export {
|
|
|
1725
2633
|
Breadcrumbs2 as Breadcrumbs,
|
|
1726
2634
|
BreadcrumbsItem,
|
|
1727
2635
|
Button,
|
|
2636
|
+
Calendar,
|
|
1728
2637
|
Card,
|
|
1729
2638
|
Checkbox,
|
|
1730
2639
|
DataGrid,
|
|
2640
|
+
DatePicker,
|
|
2641
|
+
DateRangePicker,
|
|
1731
2642
|
Divider,
|
|
1732
2643
|
DropdownMenu2 as DropdownMenu,
|
|
1733
2644
|
DropdownMenuItem,
|