@x-plat/design-system 0.4.2 → 0.4.3
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/components/Calendar/index.cjs +132 -69
- package/dist/components/Calendar/index.css +40 -23
- package/dist/components/Calendar/index.d.cts +0 -13
- package/dist/components/Calendar/index.d.ts +0 -13
- package/dist/components/Calendar/index.js +133 -70
- package/dist/components/DatePicker/index.cjs +126 -37
- package/dist/components/DatePicker/index.css +51 -8
- package/dist/components/DatePicker/index.js +127 -38
- package/dist/components/ImageSelector/index.css +1 -0
- package/dist/components/Modal/index.css +1 -1
- package/dist/components/index.cjs +258 -106
- package/dist/components/index.css +92 -31
- package/dist/components/index.js +262 -110
- package/dist/index.cjs +258 -106
- package/dist/index.css +92 -31
- package/dist/index.js +264 -112
- package/package.json +1 -1
|
@@ -1672,6 +1672,10 @@ var Calendar = (props) => {
|
|
|
1672
1672
|
setYear,
|
|
1673
1673
|
setMonth
|
|
1674
1674
|
} = useCalendar(yearProp, monthProp);
|
|
1675
|
+
const [pickerMode, setPickerMode] = import_react3.default.useState("days");
|
|
1676
|
+
const [yearRangeStart, setYearRangeStart] = import_react3.default.useState(
|
|
1677
|
+
Math.floor(year / 12) * 12
|
|
1678
|
+
);
|
|
1675
1679
|
import_react3.default.useEffect(() => {
|
|
1676
1680
|
if (yearProp !== void 0) setYear(yearProp);
|
|
1677
1681
|
}, [yearProp, setYear]);
|
|
@@ -1679,22 +1683,54 @@ var Calendar = (props) => {
|
|
|
1679
1683
|
if (monthProp !== void 0) setMonth(monthProp);
|
|
1680
1684
|
}, [monthProp, setMonth]);
|
|
1681
1685
|
const handlePrev = () => {
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
+
if (pickerMode === "days") {
|
|
1687
|
+
goToPrevMonth();
|
|
1688
|
+
const prevMonth = month === 0 ? 11 : month - 1;
|
|
1689
|
+
const prevYear = month === 0 ? year - 1 : year;
|
|
1690
|
+
onMonthChange?.(prevYear, prevMonth);
|
|
1691
|
+
} else if (pickerMode === "months") {
|
|
1692
|
+
setYear(year - 1);
|
|
1693
|
+
onMonthChange?.(year - 1, month);
|
|
1694
|
+
} else {
|
|
1695
|
+
setYearRangeStart((s) => s - 12);
|
|
1696
|
+
}
|
|
1686
1697
|
};
|
|
1687
1698
|
const handleNext = () => {
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1699
|
+
if (pickerMode === "days") {
|
|
1700
|
+
goToNextMonth();
|
|
1701
|
+
const nextMonth = month === 11 ? 0 : month + 1;
|
|
1702
|
+
const nextYear = month === 11 ? year + 1 : year;
|
|
1703
|
+
onMonthChange?.(nextYear, nextMonth);
|
|
1704
|
+
} else if (pickerMode === "months") {
|
|
1705
|
+
setYear(year + 1);
|
|
1706
|
+
onMonthChange?.(year + 1, month);
|
|
1707
|
+
} else {
|
|
1708
|
+
setYearRangeStart((s) => s + 12);
|
|
1709
|
+
}
|
|
1692
1710
|
};
|
|
1693
1711
|
const handleToday = () => {
|
|
1694
1712
|
goToToday();
|
|
1713
|
+
setPickerMode("days");
|
|
1695
1714
|
const today = /* @__PURE__ */ new Date();
|
|
1696
1715
|
onMonthChange?.(today.getFullYear(), today.getMonth());
|
|
1697
1716
|
};
|
|
1717
|
+
const handleTitleClick = () => {
|
|
1718
|
+
if (pickerMode === "days") setPickerMode("months");
|
|
1719
|
+
else if (pickerMode === "months") {
|
|
1720
|
+
setYearRangeStart(Math.floor(year / 12) * 12);
|
|
1721
|
+
setPickerMode("years");
|
|
1722
|
+
}
|
|
1723
|
+
};
|
|
1724
|
+
const handleMonthSelect = (m) => {
|
|
1725
|
+
setMonth(m);
|
|
1726
|
+
setPickerMode("days");
|
|
1727
|
+
onMonthChange?.(year, m);
|
|
1728
|
+
};
|
|
1729
|
+
const handleYearSelect = (y) => {
|
|
1730
|
+
setYear(y);
|
|
1731
|
+
setPickerMode("months");
|
|
1732
|
+
onMonthChange?.(y, month);
|
|
1733
|
+
};
|
|
1698
1734
|
const isDisabled = (date) => {
|
|
1699
1735
|
if (minDate && date < new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate())) return true;
|
|
1700
1736
|
if (maxDate && date > new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate())) return true;
|
|
@@ -1702,6 +1738,8 @@ var Calendar = (props) => {
|
|
|
1702
1738
|
};
|
|
1703
1739
|
const getEventsForDay = (date) => events.filter((e) => isSameDay(e.date, date));
|
|
1704
1740
|
const weekdays = WEEKDAY_LABELS[locale];
|
|
1741
|
+
const monthLabels = MONTH_LABELS[locale];
|
|
1742
|
+
const titleText = pickerMode === "days" ? locale === "ko" ? `${year}\uB144 ${monthLabels[month]}` : `${monthLabels[month]} ${year}` : pickerMode === "months" ? `${year}` : `${yearRangeStart} - ${yearRangeStart + 11}`;
|
|
1705
1743
|
return /* @__PURE__ */ (0, import_jsx_runtime301.jsxs)(
|
|
1706
1744
|
"div",
|
|
1707
1745
|
{
|
|
@@ -1709,29 +1747,71 @@ var Calendar = (props) => {
|
|
|
1709
1747
|
style: selectedColor ? { "--calendar-selected-color": `var(--${selectedColor})` } : void 0,
|
|
1710
1748
|
children: [
|
|
1711
1749
|
/* @__PURE__ */ (0, import_jsx_runtime301.jsxs)("div", { className: "calendar-header", children: [
|
|
1712
|
-
/* @__PURE__ */ (0, import_jsx_runtime301.jsx)("button", { className: "calendar-nav", onClick: handlePrev, "aria-label": "\uC774\uC804
|
|
1713
|
-
/* @__PURE__ */ (0, import_jsx_runtime301.jsx)("
|
|
1714
|
-
/* @__PURE__ */ (0, import_jsx_runtime301.jsx)("button", { className: "calendar-nav", onClick: handleNext, "aria-label": "\uB2E4\uC74C
|
|
1750
|
+
/* @__PURE__ */ (0, import_jsx_runtime301.jsx)("button", { className: "calendar-nav", onClick: handlePrev, "aria-label": "\uC774\uC804", children: /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(ChevronLeftIcon_default, {}) }),
|
|
1751
|
+
/* @__PURE__ */ (0, import_jsx_runtime301.jsx)("button", { className: "calendar-title", onClick: handleTitleClick, type: "button", children: titleText }),
|
|
1752
|
+
/* @__PURE__ */ (0, import_jsx_runtime301.jsx)("button", { className: "calendar-nav", onClick: handleNext, "aria-label": "\uB2E4\uC74C", children: /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(ChevronRightIcon_default, {}) }),
|
|
1715
1753
|
showToday && /* @__PURE__ */ (0, import_jsx_runtime301.jsx)("button", { className: "calendar-today-btn", onClick: handleToday, children: locale === "ko" ? "\uC624\uB298" : "Today" })
|
|
1716
1754
|
] }),
|
|
1717
|
-
/* @__PURE__ */ (0, import_jsx_runtime301.jsx)("div", { className: "calendar-
|
|
1718
|
-
|
|
1755
|
+
pickerMode === "years" && /* @__PURE__ */ (0, import_jsx_runtime301.jsx)("div", { className: "calendar-picker-grid", children: Array.from({ length: 12 }, (_, i) => {
|
|
1756
|
+
const y = yearRangeStart + i;
|
|
1757
|
+
return /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(
|
|
1758
|
+
"button",
|
|
1759
|
+
{
|
|
1760
|
+
type: "button",
|
|
1761
|
+
className: clsx_default("calendar-picker-cell", y === year && "active"),
|
|
1762
|
+
onClick: () => handleYearSelect(y),
|
|
1763
|
+
children: y
|
|
1764
|
+
},
|
|
1765
|
+
y
|
|
1766
|
+
);
|
|
1767
|
+
}) }),
|
|
1768
|
+
pickerMode === "months" && /* @__PURE__ */ (0, import_jsx_runtime301.jsx)("div", { className: "calendar-picker-grid", children: monthLabels.map((label, i) => /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(
|
|
1769
|
+
"button",
|
|
1719
1770
|
{
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
i === 6 && "saturday"
|
|
1724
|
-
),
|
|
1771
|
+
type: "button",
|
|
1772
|
+
className: clsx_default("calendar-picker-cell", i === month && "active"),
|
|
1773
|
+
onClick: () => handleMonthSelect(i),
|
|
1725
1774
|
children: label
|
|
1726
1775
|
},
|
|
1727
|
-
|
|
1776
|
+
i
|
|
1728
1777
|
)) }),
|
|
1729
|
-
/* @__PURE__ */ (0, import_jsx_runtime301.
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1778
|
+
pickerMode === "days" && /* @__PURE__ */ (0, import_jsx_runtime301.jsxs)(import_jsx_runtime301.Fragment, { children: [
|
|
1779
|
+
/* @__PURE__ */ (0, import_jsx_runtime301.jsx)("div", { className: "calendar-weekdays", children: weekdays.map((label, i) => /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(
|
|
1780
|
+
"div",
|
|
1781
|
+
{
|
|
1782
|
+
className: clsx_default(
|
|
1783
|
+
"calendar-weekday",
|
|
1784
|
+
i === 0 && "sunday",
|
|
1785
|
+
i === 6 && "saturday"
|
|
1786
|
+
),
|
|
1787
|
+
children: label
|
|
1788
|
+
},
|
|
1789
|
+
label
|
|
1790
|
+
)) }),
|
|
1791
|
+
/* @__PURE__ */ (0, import_jsx_runtime301.jsx)("div", { className: "calendar-grid", children: days.map((day, idx) => {
|
|
1792
|
+
const dayEvents = getEventsForDay(day.date);
|
|
1793
|
+
const disabled = isDisabled(day.date);
|
|
1794
|
+
const isSelected = selectedDate ? isSameDay(day.date, selectedDate) : false;
|
|
1795
|
+
if (renderDay) {
|
|
1796
|
+
return /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(
|
|
1797
|
+
"div",
|
|
1798
|
+
{
|
|
1799
|
+
className: clsx_default(
|
|
1800
|
+
"calendar-day",
|
|
1801
|
+
!day.isCurrentMonth && "outside",
|
|
1802
|
+
disabled && "disabled",
|
|
1803
|
+
isSelected && "selected",
|
|
1804
|
+
day.isToday && "today"
|
|
1805
|
+
),
|
|
1806
|
+
onClick: () => {
|
|
1807
|
+
if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
|
|
1808
|
+
},
|
|
1809
|
+
children: renderDay(day, dayEvents)
|
|
1810
|
+
},
|
|
1811
|
+
idx
|
|
1812
|
+
);
|
|
1813
|
+
}
|
|
1814
|
+
return /* @__PURE__ */ (0, import_jsx_runtime301.jsxs)(
|
|
1735
1815
|
"div",
|
|
1736
1816
|
{
|
|
1737
1817
|
className: clsx_default(
|
|
@@ -1739,57 +1819,40 @@ var Calendar = (props) => {
|
|
|
1739
1819
|
!day.isCurrentMonth && "outside",
|
|
1740
1820
|
disabled && "disabled",
|
|
1741
1821
|
isSelected && "selected",
|
|
1742
|
-
day.isToday && "today"
|
|
1822
|
+
day.isToday && "today",
|
|
1823
|
+
day.isSunday && "sunday",
|
|
1824
|
+
day.isSaturday && "saturday"
|
|
1743
1825
|
),
|
|
1744
1826
|
onClick: () => {
|
|
1745
1827
|
if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
|
|
1746
1828
|
},
|
|
1747
|
-
children:
|
|
1829
|
+
children: [
|
|
1830
|
+
/* @__PURE__ */ (0, import_jsx_runtime301.jsx)("span", { className: "calendar-day-number", children: day.day }),
|
|
1831
|
+
dayEvents.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime301.jsxs)("div", { className: "calendar-day-events", children: [
|
|
1832
|
+
dayEvents.slice(0, 3).map((event, ei) => /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(
|
|
1833
|
+
"span",
|
|
1834
|
+
{
|
|
1835
|
+
className: "calendar-event-dot",
|
|
1836
|
+
style: { backgroundColor: event.color ?? "var(--xplat-blue-500)" },
|
|
1837
|
+
title: event.label,
|
|
1838
|
+
onClick: (e) => {
|
|
1839
|
+
e.stopPropagation();
|
|
1840
|
+
onEventClick?.(event);
|
|
1841
|
+
}
|
|
1842
|
+
},
|
|
1843
|
+
ei
|
|
1844
|
+
)),
|
|
1845
|
+
dayEvents.length > 3 && /* @__PURE__ */ (0, import_jsx_runtime301.jsxs)("span", { className: "calendar-event-more", children: [
|
|
1846
|
+
"+",
|
|
1847
|
+
dayEvents.length - 3
|
|
1848
|
+
] })
|
|
1849
|
+
] })
|
|
1850
|
+
]
|
|
1748
1851
|
},
|
|
1749
1852
|
idx
|
|
1750
1853
|
);
|
|
1751
|
-
}
|
|
1752
|
-
|
|
1753
|
-
"div",
|
|
1754
|
-
{
|
|
1755
|
-
className: clsx_default(
|
|
1756
|
-
"calendar-day",
|
|
1757
|
-
!day.isCurrentMonth && "outside",
|
|
1758
|
-
disabled && "disabled",
|
|
1759
|
-
isSelected && "selected",
|
|
1760
|
-
day.isToday && "today",
|
|
1761
|
-
day.isSunday && "sunday",
|
|
1762
|
-
day.isSaturday && "saturday"
|
|
1763
|
-
),
|
|
1764
|
-
onClick: () => {
|
|
1765
|
-
if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
|
|
1766
|
-
},
|
|
1767
|
-
children: [
|
|
1768
|
-
/* @__PURE__ */ (0, import_jsx_runtime301.jsx)("span", { className: "calendar-day-number", children: day.day }),
|
|
1769
|
-
dayEvents.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime301.jsxs)("div", { className: "calendar-day-events", children: [
|
|
1770
|
-
dayEvents.slice(0, 3).map((event, ei) => /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(
|
|
1771
|
-
"span",
|
|
1772
|
-
{
|
|
1773
|
-
className: "calendar-event-dot",
|
|
1774
|
-
style: { backgroundColor: event.color ?? "var(--xplat-blue-500)" },
|
|
1775
|
-
title: event.label,
|
|
1776
|
-
onClick: (e) => {
|
|
1777
|
-
e.stopPropagation();
|
|
1778
|
-
onEventClick?.(event);
|
|
1779
|
-
}
|
|
1780
|
-
},
|
|
1781
|
-
ei
|
|
1782
|
-
)),
|
|
1783
|
-
dayEvents.length > 3 && /* @__PURE__ */ (0, import_jsx_runtime301.jsxs)("span", { className: "calendar-event-more", children: [
|
|
1784
|
-
"+",
|
|
1785
|
-
dayEvents.length - 3
|
|
1786
|
-
] })
|
|
1787
|
-
] })
|
|
1788
|
-
]
|
|
1789
|
-
},
|
|
1790
|
-
idx
|
|
1791
|
-
);
|
|
1792
|
-
}) })
|
|
1854
|
+
}) })
|
|
1855
|
+
] })
|
|
1793
1856
|
]
|
|
1794
1857
|
}
|
|
1795
1858
|
);
|
|
@@ -16714,10 +16777,14 @@ var SingleDatePicker = (props) => {
|
|
|
16714
16777
|
} = props;
|
|
16715
16778
|
const initialYear = value?.getFullYear();
|
|
16716
16779
|
const initialMonth = value?.getMonth();
|
|
16717
|
-
const { year, month, days, goToPrevMonth, goToNextMonth } = useCalendar(
|
|
16780
|
+
const { year, month, days, goToPrevMonth, goToNextMonth, setYear, setMonth } = useCalendar(
|
|
16718
16781
|
initialYear,
|
|
16719
16782
|
initialMonth
|
|
16720
16783
|
);
|
|
16784
|
+
const [pickerMode, setPickerMode] = import_react11.default.useState("days");
|
|
16785
|
+
const [yearRangeStart, setYearRangeStart] = import_react11.default.useState(
|
|
16786
|
+
Math.floor((initialYear ?? (/* @__PURE__ */ new Date()).getFullYear()) / 12) * 12
|
|
16787
|
+
);
|
|
16721
16788
|
const minTime = import_react11.default.useMemo(
|
|
16722
16789
|
() => minDate ? new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate()).getTime() : -Infinity,
|
|
16723
16790
|
[minDate]
|
|
@@ -16739,7 +16806,34 @@ var SingleDatePicker = (props) => {
|
|
|
16739
16806
|
},
|
|
16740
16807
|
[onChange]
|
|
16741
16808
|
);
|
|
16809
|
+
const handlePrev = () => {
|
|
16810
|
+
if (pickerMode === "days") goToPrevMonth();
|
|
16811
|
+
else if (pickerMode === "months") setYear(year - 1);
|
|
16812
|
+
else setYearRangeStart((s) => s - 12);
|
|
16813
|
+
};
|
|
16814
|
+
const handleNext = () => {
|
|
16815
|
+
if (pickerMode === "days") goToNextMonth();
|
|
16816
|
+
else if (pickerMode === "months") setYear(year + 1);
|
|
16817
|
+
else setYearRangeStart((s) => s + 12);
|
|
16818
|
+
};
|
|
16819
|
+
const handleTitleClick = () => {
|
|
16820
|
+
if (pickerMode === "days") setPickerMode("months");
|
|
16821
|
+
else if (pickerMode === "months") {
|
|
16822
|
+
setYearRangeStart(Math.floor(year / 12) * 12);
|
|
16823
|
+
setPickerMode("years");
|
|
16824
|
+
}
|
|
16825
|
+
};
|
|
16826
|
+
const handleMonthSelect = (m) => {
|
|
16827
|
+
setMonth(m);
|
|
16828
|
+
setPickerMode("days");
|
|
16829
|
+
};
|
|
16830
|
+
const handleYearSelect = (y) => {
|
|
16831
|
+
setYear(y);
|
|
16832
|
+
setPickerMode("months");
|
|
16833
|
+
};
|
|
16742
16834
|
const weekdays = WEEKDAY_LABELS[locale];
|
|
16835
|
+
const monthLabels = MONTH_LABELS[locale];
|
|
16836
|
+
const titleText = pickerMode === "days" ? locale === "ko" ? `${year}\uB144 ${monthLabels[month]}` : `${monthLabels[month]} ${year}` : pickerMode === "months" ? `${year}` : `${yearRangeStart} - ${yearRangeStart + 11}`;
|
|
16743
16837
|
return /* @__PURE__ */ (0, import_jsx_runtime312.jsxs)(
|
|
16744
16838
|
"div",
|
|
16745
16839
|
{
|
|
@@ -16747,41 +16841,66 @@ var SingleDatePicker = (props) => {
|
|
|
16747
16841
|
style: { "--datepicker-active-color": `var(--${color2})` },
|
|
16748
16842
|
children: [
|
|
16749
16843
|
/* @__PURE__ */ (0, import_jsx_runtime312.jsxs)("div", { className: "datepicker-header", children: [
|
|
16750
|
-
/* @__PURE__ */ (0, import_jsx_runtime312.jsx)("button", { className: "datepicker-nav", onClick:
|
|
16751
|
-
/* @__PURE__ */ (0, import_jsx_runtime312.jsx)("
|
|
16752
|
-
/* @__PURE__ */ (0, import_jsx_runtime312.jsx)("button", { className: "datepicker-nav", onClick:
|
|
16844
|
+
/* @__PURE__ */ (0, import_jsx_runtime312.jsx)("button", { className: "datepicker-nav", onClick: handlePrev, type: "button", children: /* @__PURE__ */ (0, import_jsx_runtime312.jsx)(ChevronLeftIcon_default, {}) }),
|
|
16845
|
+
/* @__PURE__ */ (0, import_jsx_runtime312.jsx)("button", { className: "datepicker-title", onClick: handleTitleClick, type: "button", children: titleText }),
|
|
16846
|
+
/* @__PURE__ */ (0, import_jsx_runtime312.jsx)("button", { className: "datepicker-nav", onClick: handleNext, type: "button", children: /* @__PURE__ */ (0, import_jsx_runtime312.jsx)(ChevronRightIcon_default, {}) })
|
|
16753
16847
|
] }),
|
|
16754
|
-
/* @__PURE__ */ (0, import_jsx_runtime312.jsx)("div", { className: "datepicker-
|
|
16755
|
-
|
|
16848
|
+
pickerMode === "years" && /* @__PURE__ */ (0, import_jsx_runtime312.jsx)("div", { className: "datepicker-picker-grid", children: Array.from({ length: 12 }, (_, i) => {
|
|
16849
|
+
const y = yearRangeStart + i;
|
|
16850
|
+
return /* @__PURE__ */ (0, import_jsx_runtime312.jsx)(
|
|
16851
|
+
"button",
|
|
16852
|
+
{
|
|
16853
|
+
type: "button",
|
|
16854
|
+
className: clsx_default("datepicker-picker-cell", y === year && "active"),
|
|
16855
|
+
onClick: () => handleYearSelect(y),
|
|
16856
|
+
children: y
|
|
16857
|
+
},
|
|
16858
|
+
y
|
|
16859
|
+
);
|
|
16860
|
+
}) }),
|
|
16861
|
+
pickerMode === "months" && /* @__PURE__ */ (0, import_jsx_runtime312.jsx)("div", { className: "datepicker-picker-grid", children: monthLabels.map((label, i) => /* @__PURE__ */ (0, import_jsx_runtime312.jsx)(
|
|
16862
|
+
"button",
|
|
16756
16863
|
{
|
|
16757
|
-
|
|
16758
|
-
|
|
16759
|
-
|
|
16760
|
-
i === 6 && "saturday"
|
|
16761
|
-
),
|
|
16864
|
+
type: "button",
|
|
16865
|
+
className: clsx_default("datepicker-picker-cell", i === month && "active"),
|
|
16866
|
+
onClick: () => handleMonthSelect(i),
|
|
16762
16867
|
children: label
|
|
16763
16868
|
},
|
|
16764
|
-
|
|
16869
|
+
i
|
|
16765
16870
|
)) }),
|
|
16766
|
-
/* @__PURE__ */ (0, import_jsx_runtime312.
|
|
16767
|
-
|
|
16768
|
-
|
|
16769
|
-
const selected = value ? isSameDay(day.date, value) : false;
|
|
16770
|
-
const highlighted = highlightSet.has(
|
|
16771
|
-
`${day.date.getFullYear()}-${day.date.getMonth()}-${day.date.getDate()}`
|
|
16772
|
-
);
|
|
16773
|
-
return /* @__PURE__ */ (0, import_jsx_runtime312.jsx)(
|
|
16774
|
-
DayCell,
|
|
16871
|
+
pickerMode === "days" && /* @__PURE__ */ (0, import_jsx_runtime312.jsxs)(import_jsx_runtime312.Fragment, { children: [
|
|
16872
|
+
/* @__PURE__ */ (0, import_jsx_runtime312.jsx)("div", { className: "datepicker-weekdays", children: weekdays.map((label, i) => /* @__PURE__ */ (0, import_jsx_runtime312.jsx)(
|
|
16873
|
+
"div",
|
|
16775
16874
|
{
|
|
16776
|
-
|
|
16777
|
-
|
|
16778
|
-
|
|
16779
|
-
|
|
16780
|
-
|
|
16875
|
+
className: clsx_default(
|
|
16876
|
+
"datepicker-weekday",
|
|
16877
|
+
i === 0 && "sunday",
|
|
16878
|
+
i === 6 && "saturday"
|
|
16879
|
+
),
|
|
16880
|
+
children: label
|
|
16781
16881
|
},
|
|
16782
|
-
|
|
16783
|
-
)
|
|
16784
|
-
|
|
16882
|
+
label
|
|
16883
|
+
)) }),
|
|
16884
|
+
/* @__PURE__ */ (0, import_jsx_runtime312.jsx)("div", { className: "datepicker-grid", children: days.map((day, idx) => {
|
|
16885
|
+
const t = day.date.getTime();
|
|
16886
|
+
const disabled = t < minTime || t > maxTime;
|
|
16887
|
+
const selected = value ? isSameDay(day.date, value) : false;
|
|
16888
|
+
const highlighted = highlightSet.has(
|
|
16889
|
+
`${day.date.getFullYear()}-${day.date.getMonth()}-${day.date.getDate()}`
|
|
16890
|
+
);
|
|
16891
|
+
return /* @__PURE__ */ (0, import_jsx_runtime312.jsx)(
|
|
16892
|
+
DayCell,
|
|
16893
|
+
{
|
|
16894
|
+
day,
|
|
16895
|
+
disabled,
|
|
16896
|
+
selected,
|
|
16897
|
+
highlighted,
|
|
16898
|
+
onSelect: handleSelect
|
|
16899
|
+
},
|
|
16900
|
+
idx
|
|
16901
|
+
);
|
|
16902
|
+
}) })
|
|
16903
|
+
] })
|
|
16785
16904
|
]
|
|
16786
16905
|
}
|
|
16787
16906
|
);
|
|
@@ -16896,9 +17015,24 @@ var RangePicker = (props) => {
|
|
|
16896
17015
|
} = props;
|
|
16897
17016
|
const startCal = useCalendar(startDate.getFullYear(), startDate.getMonth());
|
|
16898
17017
|
const endCal = useCalendar(endDate.getFullYear(), endDate.getMonth());
|
|
16899
|
-
const isDisabled = (date) => {
|
|
16900
|
-
|
|
16901
|
-
if (
|
|
17018
|
+
const isDisabled = (date, type) => {
|
|
17019
|
+
const d = date.getTime();
|
|
17020
|
+
if (minDate) {
|
|
17021
|
+
const min = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate()).getTime();
|
|
17022
|
+
if (d < min) return true;
|
|
17023
|
+
}
|
|
17024
|
+
if (maxDate) {
|
|
17025
|
+
const max = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate()).getTime();
|
|
17026
|
+
if (d > max) return true;
|
|
17027
|
+
}
|
|
17028
|
+
if (type === "end") {
|
|
17029
|
+
const start = new Date(startDate.getFullYear(), startDate.getMonth(), startDate.getDate()).getTime();
|
|
17030
|
+
if (d < start) return true;
|
|
17031
|
+
}
|
|
17032
|
+
if (type === "start") {
|
|
17033
|
+
const end = new Date(endDate.getFullYear(), endDate.getMonth(), endDate.getDate()).getTime();
|
|
17034
|
+
if (d > end) return true;
|
|
17035
|
+
}
|
|
16902
17036
|
return false;
|
|
16903
17037
|
};
|
|
16904
17038
|
const weekdays = WEEKDAY_LABELS[locale];
|
|
@@ -16907,9 +17041,25 @@ var RangePicker = (props) => {
|
|
|
16907
17041
|
return /* @__PURE__ */ (0, import_jsx_runtime315.jsxs)("div", { className: "datepicker-range-panel", children: [
|
|
16908
17042
|
/* @__PURE__ */ (0, import_jsx_runtime315.jsx)("span", { className: "datepicker-range-label", children: label }),
|
|
16909
17043
|
/* @__PURE__ */ (0, import_jsx_runtime315.jsxs)("div", { className: "datepicker-header", children: [
|
|
16910
|
-
/* @__PURE__ */ (0, import_jsx_runtime315.jsx)(
|
|
17044
|
+
/* @__PURE__ */ (0, import_jsx_runtime315.jsx)(
|
|
17045
|
+
"button",
|
|
17046
|
+
{
|
|
17047
|
+
className: "datepicker-nav",
|
|
17048
|
+
onClick: cal.goToPrevMonth,
|
|
17049
|
+
type: "button",
|
|
17050
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime315.jsx)(ChevronLeftIcon_default, {})
|
|
17051
|
+
}
|
|
17052
|
+
),
|
|
16911
17053
|
/* @__PURE__ */ (0, import_jsx_runtime315.jsx)("span", { className: "datepicker-title", children: locale === "ko" ? `${cal.year}\uB144 ${MONTH_LABELS.ko[cal.month]}` : `${MONTH_LABELS.en[cal.month]} ${cal.year}` }),
|
|
16912
|
-
/* @__PURE__ */ (0, import_jsx_runtime315.jsx)(
|
|
17054
|
+
/* @__PURE__ */ (0, import_jsx_runtime315.jsx)(
|
|
17055
|
+
"button",
|
|
17056
|
+
{
|
|
17057
|
+
className: "datepicker-nav",
|
|
17058
|
+
onClick: cal.goToNextMonth,
|
|
17059
|
+
type: "button",
|
|
17060
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime315.jsx)(ChevronRightIcon_default, {})
|
|
17061
|
+
}
|
|
17062
|
+
)
|
|
16913
17063
|
] }),
|
|
16914
17064
|
/* @__PURE__ */ (0, import_jsx_runtime315.jsx)("div", { className: "datepicker-weekdays", children: weekdays.map((w, i) => /* @__PURE__ */ (0, import_jsx_runtime315.jsx)(
|
|
16915
17065
|
"div",
|
|
@@ -16924,7 +17074,7 @@ var RangePicker = (props) => {
|
|
|
16924
17074
|
w
|
|
16925
17075
|
)) }),
|
|
16926
17076
|
/* @__PURE__ */ (0, import_jsx_runtime315.jsx)("div", { className: "datepicker-grid", children: cal.days.map((day, idx) => {
|
|
16927
|
-
const disabled = isDisabled(day.date);
|
|
17077
|
+
const disabled = isDisabled(day.date, type);
|
|
16928
17078
|
const isStart = isSameDay(day.date, startDate);
|
|
16929
17079
|
const isEnd = isSameDay(day.date, endDate);
|
|
16930
17080
|
const inRange2 = isInRange(day.date, startDate, endDate);
|
|
@@ -16965,7 +17115,9 @@ var RangePicker = (props) => {
|
|
|
16965
17115
|
"div",
|
|
16966
17116
|
{
|
|
16967
17117
|
className: clsx_default("lib-xplat-datepicker", "range"),
|
|
16968
|
-
style: {
|
|
17118
|
+
style: {
|
|
17119
|
+
"--datepicker-active-color": `var(--${color2})`
|
|
17120
|
+
},
|
|
16969
17121
|
children: [
|
|
16970
17122
|
renderCalendar(startCal, "start"),
|
|
16971
17123
|
renderCalendar(endCal, "end")
|
|
@@ -16990,7 +17142,7 @@ var PopupPicker = (props) => {
|
|
|
16990
17142
|
};
|
|
16991
17143
|
return /* @__PURE__ */ (0, import_jsx_runtime316.jsxs)("div", { className: "lib-xplat-popup-datepicker", children: [
|
|
16992
17144
|
import_react14.default.cloneElement(component, { onClick: handleClick }),
|
|
16993
|
-
/* @__PURE__ */ (0, import_jsx_runtime316.jsx)(Modal_default, { isOpen, onClose: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime316.jsxs)("div", { className: "lib-xplat-popup-datepicker-card", children: [
|
|
17145
|
+
/* @__PURE__ */ (0, import_jsx_runtime316.jsx)(Modal_default, { isOpen, onClose: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime316.jsxs)("div", { className: clsx_default("lib-xplat-popup-datepicker-card", type === "range" && "range-mode"), children: [
|
|
16994
17146
|
/* @__PURE__ */ (0, import_jsx_runtime316.jsxs)("div", { className: "popup-datepicker-content", children: [
|
|
16995
17147
|
type === "single" && /* @__PURE__ */ (0, import_jsx_runtime316.jsx)(
|
|
16996
17148
|
SingleDatePicker_default,
|