@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
package/dist/components/index.js
CHANGED
|
@@ -1558,7 +1558,7 @@ var MONTH_LABELS = {
|
|
|
1558
1558
|
};
|
|
1559
1559
|
|
|
1560
1560
|
// src/components/Calendar/Calendar.tsx
|
|
1561
|
-
import { jsx as jsx301, jsxs as jsxs193 } from "react/jsx-runtime";
|
|
1561
|
+
import { Fragment, jsx as jsx301, jsxs as jsxs193 } from "react/jsx-runtime";
|
|
1562
1562
|
var Calendar = (props) => {
|
|
1563
1563
|
const {
|
|
1564
1564
|
year: yearProp,
|
|
@@ -1586,6 +1586,10 @@ var Calendar = (props) => {
|
|
|
1586
1586
|
setYear,
|
|
1587
1587
|
setMonth
|
|
1588
1588
|
} = useCalendar(yearProp, monthProp);
|
|
1589
|
+
const [pickerMode, setPickerMode] = React3.useState("days");
|
|
1590
|
+
const [yearRangeStart, setYearRangeStart] = React3.useState(
|
|
1591
|
+
Math.floor(year / 12) * 12
|
|
1592
|
+
);
|
|
1589
1593
|
React3.useEffect(() => {
|
|
1590
1594
|
if (yearProp !== void 0) setYear(yearProp);
|
|
1591
1595
|
}, [yearProp, setYear]);
|
|
@@ -1593,22 +1597,54 @@ var Calendar = (props) => {
|
|
|
1593
1597
|
if (monthProp !== void 0) setMonth(monthProp);
|
|
1594
1598
|
}, [monthProp, setMonth]);
|
|
1595
1599
|
const handlePrev = () => {
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
+
if (pickerMode === "days") {
|
|
1601
|
+
goToPrevMonth();
|
|
1602
|
+
const prevMonth = month === 0 ? 11 : month - 1;
|
|
1603
|
+
const prevYear = month === 0 ? year - 1 : year;
|
|
1604
|
+
onMonthChange?.(prevYear, prevMonth);
|
|
1605
|
+
} else if (pickerMode === "months") {
|
|
1606
|
+
setYear(year - 1);
|
|
1607
|
+
onMonthChange?.(year - 1, month);
|
|
1608
|
+
} else {
|
|
1609
|
+
setYearRangeStart((s) => s - 12);
|
|
1610
|
+
}
|
|
1600
1611
|
};
|
|
1601
1612
|
const handleNext = () => {
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1613
|
+
if (pickerMode === "days") {
|
|
1614
|
+
goToNextMonth();
|
|
1615
|
+
const nextMonth = month === 11 ? 0 : month + 1;
|
|
1616
|
+
const nextYear = month === 11 ? year + 1 : year;
|
|
1617
|
+
onMonthChange?.(nextYear, nextMonth);
|
|
1618
|
+
} else if (pickerMode === "months") {
|
|
1619
|
+
setYear(year + 1);
|
|
1620
|
+
onMonthChange?.(year + 1, month);
|
|
1621
|
+
} else {
|
|
1622
|
+
setYearRangeStart((s) => s + 12);
|
|
1623
|
+
}
|
|
1606
1624
|
};
|
|
1607
1625
|
const handleToday = () => {
|
|
1608
1626
|
goToToday();
|
|
1627
|
+
setPickerMode("days");
|
|
1609
1628
|
const today = /* @__PURE__ */ new Date();
|
|
1610
1629
|
onMonthChange?.(today.getFullYear(), today.getMonth());
|
|
1611
1630
|
};
|
|
1631
|
+
const handleTitleClick = () => {
|
|
1632
|
+
if (pickerMode === "days") setPickerMode("months");
|
|
1633
|
+
else if (pickerMode === "months") {
|
|
1634
|
+
setYearRangeStart(Math.floor(year / 12) * 12);
|
|
1635
|
+
setPickerMode("years");
|
|
1636
|
+
}
|
|
1637
|
+
};
|
|
1638
|
+
const handleMonthSelect = (m) => {
|
|
1639
|
+
setMonth(m);
|
|
1640
|
+
setPickerMode("days");
|
|
1641
|
+
onMonthChange?.(year, m);
|
|
1642
|
+
};
|
|
1643
|
+
const handleYearSelect = (y) => {
|
|
1644
|
+
setYear(y);
|
|
1645
|
+
setPickerMode("months");
|
|
1646
|
+
onMonthChange?.(y, month);
|
|
1647
|
+
};
|
|
1612
1648
|
const isDisabled = (date) => {
|
|
1613
1649
|
if (minDate && date < new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate())) return true;
|
|
1614
1650
|
if (maxDate && date > new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate())) return true;
|
|
@@ -1616,6 +1652,8 @@ var Calendar = (props) => {
|
|
|
1616
1652
|
};
|
|
1617
1653
|
const getEventsForDay = (date) => events.filter((e) => isSameDay(e.date, date));
|
|
1618
1654
|
const weekdays = WEEKDAY_LABELS[locale];
|
|
1655
|
+
const monthLabels = MONTH_LABELS[locale];
|
|
1656
|
+
const titleText = pickerMode === "days" ? locale === "ko" ? `${year}\uB144 ${monthLabels[month]}` : `${monthLabels[month]} ${year}` : pickerMode === "months" ? `${year}` : `${yearRangeStart} - ${yearRangeStart + 11}`;
|
|
1619
1657
|
return /* @__PURE__ */ jsxs193(
|
|
1620
1658
|
"div",
|
|
1621
1659
|
{
|
|
@@ -1623,29 +1661,71 @@ var Calendar = (props) => {
|
|
|
1623
1661
|
style: selectedColor ? { "--calendar-selected-color": `var(--${selectedColor})` } : void 0,
|
|
1624
1662
|
children: [
|
|
1625
1663
|
/* @__PURE__ */ jsxs193("div", { className: "calendar-header", children: [
|
|
1626
|
-
/* @__PURE__ */ jsx301("button", { className: "calendar-nav", onClick: handlePrev, "aria-label": "\uC774\uC804
|
|
1627
|
-
/* @__PURE__ */ jsx301("
|
|
1628
|
-
/* @__PURE__ */ jsx301("button", { className: "calendar-nav", onClick: handleNext, "aria-label": "\uB2E4\uC74C
|
|
1664
|
+
/* @__PURE__ */ jsx301("button", { className: "calendar-nav", onClick: handlePrev, "aria-label": "\uC774\uC804", children: /* @__PURE__ */ jsx301(ChevronLeftIcon_default, {}) }),
|
|
1665
|
+
/* @__PURE__ */ jsx301("button", { className: "calendar-title", onClick: handleTitleClick, type: "button", children: titleText }),
|
|
1666
|
+
/* @__PURE__ */ jsx301("button", { className: "calendar-nav", onClick: handleNext, "aria-label": "\uB2E4\uC74C", children: /* @__PURE__ */ jsx301(ChevronRightIcon_default, {}) }),
|
|
1629
1667
|
showToday && /* @__PURE__ */ jsx301("button", { className: "calendar-today-btn", onClick: handleToday, children: locale === "ko" ? "\uC624\uB298" : "Today" })
|
|
1630
1668
|
] }),
|
|
1631
|
-
/* @__PURE__ */ jsx301("div", { className: "calendar-
|
|
1632
|
-
|
|
1669
|
+
pickerMode === "years" && /* @__PURE__ */ jsx301("div", { className: "calendar-picker-grid", children: Array.from({ length: 12 }, (_, i) => {
|
|
1670
|
+
const y = yearRangeStart + i;
|
|
1671
|
+
return /* @__PURE__ */ jsx301(
|
|
1672
|
+
"button",
|
|
1673
|
+
{
|
|
1674
|
+
type: "button",
|
|
1675
|
+
className: clsx_default("calendar-picker-cell", y === year && "active"),
|
|
1676
|
+
onClick: () => handleYearSelect(y),
|
|
1677
|
+
children: y
|
|
1678
|
+
},
|
|
1679
|
+
y
|
|
1680
|
+
);
|
|
1681
|
+
}) }),
|
|
1682
|
+
pickerMode === "months" && /* @__PURE__ */ jsx301("div", { className: "calendar-picker-grid", children: monthLabels.map((label, i) => /* @__PURE__ */ jsx301(
|
|
1683
|
+
"button",
|
|
1633
1684
|
{
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
i === 6 && "saturday"
|
|
1638
|
-
),
|
|
1685
|
+
type: "button",
|
|
1686
|
+
className: clsx_default("calendar-picker-cell", i === month && "active"),
|
|
1687
|
+
onClick: () => handleMonthSelect(i),
|
|
1639
1688
|
children: label
|
|
1640
1689
|
},
|
|
1641
|
-
|
|
1690
|
+
i
|
|
1642
1691
|
)) }),
|
|
1643
|
-
/* @__PURE__ */
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1692
|
+
pickerMode === "days" && /* @__PURE__ */ jsxs193(Fragment, { children: [
|
|
1693
|
+
/* @__PURE__ */ jsx301("div", { className: "calendar-weekdays", children: weekdays.map((label, i) => /* @__PURE__ */ jsx301(
|
|
1694
|
+
"div",
|
|
1695
|
+
{
|
|
1696
|
+
className: clsx_default(
|
|
1697
|
+
"calendar-weekday",
|
|
1698
|
+
i === 0 && "sunday",
|
|
1699
|
+
i === 6 && "saturday"
|
|
1700
|
+
),
|
|
1701
|
+
children: label
|
|
1702
|
+
},
|
|
1703
|
+
label
|
|
1704
|
+
)) }),
|
|
1705
|
+
/* @__PURE__ */ jsx301("div", { className: "calendar-grid", children: days.map((day, idx) => {
|
|
1706
|
+
const dayEvents = getEventsForDay(day.date);
|
|
1707
|
+
const disabled = isDisabled(day.date);
|
|
1708
|
+
const isSelected = selectedDate ? isSameDay(day.date, selectedDate) : false;
|
|
1709
|
+
if (renderDay) {
|
|
1710
|
+
return /* @__PURE__ */ jsx301(
|
|
1711
|
+
"div",
|
|
1712
|
+
{
|
|
1713
|
+
className: clsx_default(
|
|
1714
|
+
"calendar-day",
|
|
1715
|
+
!day.isCurrentMonth && "outside",
|
|
1716
|
+
disabled && "disabled",
|
|
1717
|
+
isSelected && "selected",
|
|
1718
|
+
day.isToday && "today"
|
|
1719
|
+
),
|
|
1720
|
+
onClick: () => {
|
|
1721
|
+
if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
|
|
1722
|
+
},
|
|
1723
|
+
children: renderDay(day, dayEvents)
|
|
1724
|
+
},
|
|
1725
|
+
idx
|
|
1726
|
+
);
|
|
1727
|
+
}
|
|
1728
|
+
return /* @__PURE__ */ jsxs193(
|
|
1649
1729
|
"div",
|
|
1650
1730
|
{
|
|
1651
1731
|
className: clsx_default(
|
|
@@ -1653,57 +1733,40 @@ var Calendar = (props) => {
|
|
|
1653
1733
|
!day.isCurrentMonth && "outside",
|
|
1654
1734
|
disabled && "disabled",
|
|
1655
1735
|
isSelected && "selected",
|
|
1656
|
-
day.isToday && "today"
|
|
1736
|
+
day.isToday && "today",
|
|
1737
|
+
day.isSunday && "sunday",
|
|
1738
|
+
day.isSaturday && "saturday"
|
|
1657
1739
|
),
|
|
1658
1740
|
onClick: () => {
|
|
1659
1741
|
if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
|
|
1660
1742
|
},
|
|
1661
|
-
children:
|
|
1743
|
+
children: [
|
|
1744
|
+
/* @__PURE__ */ jsx301("span", { className: "calendar-day-number", children: day.day }),
|
|
1745
|
+
dayEvents.length > 0 && /* @__PURE__ */ jsxs193("div", { className: "calendar-day-events", children: [
|
|
1746
|
+
dayEvents.slice(0, 3).map((event, ei) => /* @__PURE__ */ jsx301(
|
|
1747
|
+
"span",
|
|
1748
|
+
{
|
|
1749
|
+
className: "calendar-event-dot",
|
|
1750
|
+
style: { backgroundColor: event.color ?? "var(--xplat-blue-500)" },
|
|
1751
|
+
title: event.label,
|
|
1752
|
+
onClick: (e) => {
|
|
1753
|
+
e.stopPropagation();
|
|
1754
|
+
onEventClick?.(event);
|
|
1755
|
+
}
|
|
1756
|
+
},
|
|
1757
|
+
ei
|
|
1758
|
+
)),
|
|
1759
|
+
dayEvents.length > 3 && /* @__PURE__ */ jsxs193("span", { className: "calendar-event-more", children: [
|
|
1760
|
+
"+",
|
|
1761
|
+
dayEvents.length - 3
|
|
1762
|
+
] })
|
|
1763
|
+
] })
|
|
1764
|
+
]
|
|
1662
1765
|
},
|
|
1663
1766
|
idx
|
|
1664
1767
|
);
|
|
1665
|
-
}
|
|
1666
|
-
|
|
1667
|
-
"div",
|
|
1668
|
-
{
|
|
1669
|
-
className: clsx_default(
|
|
1670
|
-
"calendar-day",
|
|
1671
|
-
!day.isCurrentMonth && "outside",
|
|
1672
|
-
disabled && "disabled",
|
|
1673
|
-
isSelected && "selected",
|
|
1674
|
-
day.isToday && "today",
|
|
1675
|
-
day.isSunday && "sunday",
|
|
1676
|
-
day.isSaturday && "saturday"
|
|
1677
|
-
),
|
|
1678
|
-
onClick: () => {
|
|
1679
|
-
if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
|
|
1680
|
-
},
|
|
1681
|
-
children: [
|
|
1682
|
-
/* @__PURE__ */ jsx301("span", { className: "calendar-day-number", children: day.day }),
|
|
1683
|
-
dayEvents.length > 0 && /* @__PURE__ */ jsxs193("div", { className: "calendar-day-events", children: [
|
|
1684
|
-
dayEvents.slice(0, 3).map((event, ei) => /* @__PURE__ */ jsx301(
|
|
1685
|
-
"span",
|
|
1686
|
-
{
|
|
1687
|
-
className: "calendar-event-dot",
|
|
1688
|
-
style: { backgroundColor: event.color ?? "var(--xplat-blue-500)" },
|
|
1689
|
-
title: event.label,
|
|
1690
|
-
onClick: (e) => {
|
|
1691
|
-
e.stopPropagation();
|
|
1692
|
-
onEventClick?.(event);
|
|
1693
|
-
}
|
|
1694
|
-
},
|
|
1695
|
-
ei
|
|
1696
|
-
)),
|
|
1697
|
-
dayEvents.length > 3 && /* @__PURE__ */ jsxs193("span", { className: "calendar-event-more", children: [
|
|
1698
|
-
"+",
|
|
1699
|
-
dayEvents.length - 3
|
|
1700
|
-
] })
|
|
1701
|
-
] })
|
|
1702
|
-
]
|
|
1703
|
-
},
|
|
1704
|
-
idx
|
|
1705
|
-
);
|
|
1706
|
-
}) })
|
|
1768
|
+
}) })
|
|
1769
|
+
] })
|
|
1707
1770
|
]
|
|
1708
1771
|
}
|
|
1709
1772
|
);
|
|
@@ -16584,7 +16647,7 @@ var useClickOutside_default = useClickOutside;
|
|
|
16584
16647
|
|
|
16585
16648
|
// src/components/DatePicker/SingleDatePicker/index.tsx
|
|
16586
16649
|
import React9 from "react";
|
|
16587
|
-
import { jsx as jsx312, jsxs as jsxs199 } from "react/jsx-runtime";
|
|
16650
|
+
import { Fragment as Fragment2, jsx as jsx312, jsxs as jsxs199 } from "react/jsx-runtime";
|
|
16588
16651
|
var DayCell = React9.memo(
|
|
16589
16652
|
({
|
|
16590
16653
|
day,
|
|
@@ -16628,10 +16691,14 @@ var SingleDatePicker = (props) => {
|
|
|
16628
16691
|
} = props;
|
|
16629
16692
|
const initialYear = value?.getFullYear();
|
|
16630
16693
|
const initialMonth = value?.getMonth();
|
|
16631
|
-
const { year, month, days, goToPrevMonth, goToNextMonth } = useCalendar(
|
|
16694
|
+
const { year, month, days, goToPrevMonth, goToNextMonth, setYear, setMonth } = useCalendar(
|
|
16632
16695
|
initialYear,
|
|
16633
16696
|
initialMonth
|
|
16634
16697
|
);
|
|
16698
|
+
const [pickerMode, setPickerMode] = React9.useState("days");
|
|
16699
|
+
const [yearRangeStart, setYearRangeStart] = React9.useState(
|
|
16700
|
+
Math.floor((initialYear ?? (/* @__PURE__ */ new Date()).getFullYear()) / 12) * 12
|
|
16701
|
+
);
|
|
16635
16702
|
const minTime = React9.useMemo(
|
|
16636
16703
|
() => minDate ? new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate()).getTime() : -Infinity,
|
|
16637
16704
|
[minDate]
|
|
@@ -16653,7 +16720,34 @@ var SingleDatePicker = (props) => {
|
|
|
16653
16720
|
},
|
|
16654
16721
|
[onChange]
|
|
16655
16722
|
);
|
|
16723
|
+
const handlePrev = () => {
|
|
16724
|
+
if (pickerMode === "days") goToPrevMonth();
|
|
16725
|
+
else if (pickerMode === "months") setYear(year - 1);
|
|
16726
|
+
else setYearRangeStart((s) => s - 12);
|
|
16727
|
+
};
|
|
16728
|
+
const handleNext = () => {
|
|
16729
|
+
if (pickerMode === "days") goToNextMonth();
|
|
16730
|
+
else if (pickerMode === "months") setYear(year + 1);
|
|
16731
|
+
else setYearRangeStart((s) => s + 12);
|
|
16732
|
+
};
|
|
16733
|
+
const handleTitleClick = () => {
|
|
16734
|
+
if (pickerMode === "days") setPickerMode("months");
|
|
16735
|
+
else if (pickerMode === "months") {
|
|
16736
|
+
setYearRangeStart(Math.floor(year / 12) * 12);
|
|
16737
|
+
setPickerMode("years");
|
|
16738
|
+
}
|
|
16739
|
+
};
|
|
16740
|
+
const handleMonthSelect = (m) => {
|
|
16741
|
+
setMonth(m);
|
|
16742
|
+
setPickerMode("days");
|
|
16743
|
+
};
|
|
16744
|
+
const handleYearSelect = (y) => {
|
|
16745
|
+
setYear(y);
|
|
16746
|
+
setPickerMode("months");
|
|
16747
|
+
};
|
|
16656
16748
|
const weekdays = WEEKDAY_LABELS[locale];
|
|
16749
|
+
const monthLabels = MONTH_LABELS[locale];
|
|
16750
|
+
const titleText = pickerMode === "days" ? locale === "ko" ? `${year}\uB144 ${monthLabels[month]}` : `${monthLabels[month]} ${year}` : pickerMode === "months" ? `${year}` : `${yearRangeStart} - ${yearRangeStart + 11}`;
|
|
16657
16751
|
return /* @__PURE__ */ jsxs199(
|
|
16658
16752
|
"div",
|
|
16659
16753
|
{
|
|
@@ -16661,41 +16755,66 @@ var SingleDatePicker = (props) => {
|
|
|
16661
16755
|
style: { "--datepicker-active-color": `var(--${color2})` },
|
|
16662
16756
|
children: [
|
|
16663
16757
|
/* @__PURE__ */ jsxs199("div", { className: "datepicker-header", children: [
|
|
16664
|
-
/* @__PURE__ */ jsx312("button", { className: "datepicker-nav", onClick:
|
|
16665
|
-
/* @__PURE__ */ jsx312("
|
|
16666
|
-
/* @__PURE__ */ jsx312("button", { className: "datepicker-nav", onClick:
|
|
16758
|
+
/* @__PURE__ */ jsx312("button", { className: "datepicker-nav", onClick: handlePrev, type: "button", children: /* @__PURE__ */ jsx312(ChevronLeftIcon_default, {}) }),
|
|
16759
|
+
/* @__PURE__ */ jsx312("button", { className: "datepicker-title", onClick: handleTitleClick, type: "button", children: titleText }),
|
|
16760
|
+
/* @__PURE__ */ jsx312("button", { className: "datepicker-nav", onClick: handleNext, type: "button", children: /* @__PURE__ */ jsx312(ChevronRightIcon_default, {}) })
|
|
16667
16761
|
] }),
|
|
16668
|
-
/* @__PURE__ */ jsx312("div", { className: "datepicker-
|
|
16669
|
-
|
|
16762
|
+
pickerMode === "years" && /* @__PURE__ */ jsx312("div", { className: "datepicker-picker-grid", children: Array.from({ length: 12 }, (_, i) => {
|
|
16763
|
+
const y = yearRangeStart + i;
|
|
16764
|
+
return /* @__PURE__ */ jsx312(
|
|
16765
|
+
"button",
|
|
16766
|
+
{
|
|
16767
|
+
type: "button",
|
|
16768
|
+
className: clsx_default("datepicker-picker-cell", y === year && "active"),
|
|
16769
|
+
onClick: () => handleYearSelect(y),
|
|
16770
|
+
children: y
|
|
16771
|
+
},
|
|
16772
|
+
y
|
|
16773
|
+
);
|
|
16774
|
+
}) }),
|
|
16775
|
+
pickerMode === "months" && /* @__PURE__ */ jsx312("div", { className: "datepicker-picker-grid", children: monthLabels.map((label, i) => /* @__PURE__ */ jsx312(
|
|
16776
|
+
"button",
|
|
16670
16777
|
{
|
|
16671
|
-
|
|
16672
|
-
|
|
16673
|
-
|
|
16674
|
-
i === 6 && "saturday"
|
|
16675
|
-
),
|
|
16778
|
+
type: "button",
|
|
16779
|
+
className: clsx_default("datepicker-picker-cell", i === month && "active"),
|
|
16780
|
+
onClick: () => handleMonthSelect(i),
|
|
16676
16781
|
children: label
|
|
16677
16782
|
},
|
|
16678
|
-
|
|
16783
|
+
i
|
|
16679
16784
|
)) }),
|
|
16680
|
-
/* @__PURE__ */
|
|
16681
|
-
|
|
16682
|
-
|
|
16683
|
-
const selected = value ? isSameDay(day.date, value) : false;
|
|
16684
|
-
const highlighted = highlightSet.has(
|
|
16685
|
-
`${day.date.getFullYear()}-${day.date.getMonth()}-${day.date.getDate()}`
|
|
16686
|
-
);
|
|
16687
|
-
return /* @__PURE__ */ jsx312(
|
|
16688
|
-
DayCell,
|
|
16785
|
+
pickerMode === "days" && /* @__PURE__ */ jsxs199(Fragment2, { children: [
|
|
16786
|
+
/* @__PURE__ */ jsx312("div", { className: "datepicker-weekdays", children: weekdays.map((label, i) => /* @__PURE__ */ jsx312(
|
|
16787
|
+
"div",
|
|
16689
16788
|
{
|
|
16690
|
-
|
|
16691
|
-
|
|
16692
|
-
|
|
16693
|
-
|
|
16694
|
-
|
|
16789
|
+
className: clsx_default(
|
|
16790
|
+
"datepicker-weekday",
|
|
16791
|
+
i === 0 && "sunday",
|
|
16792
|
+
i === 6 && "saturday"
|
|
16793
|
+
),
|
|
16794
|
+
children: label
|
|
16695
16795
|
},
|
|
16696
|
-
|
|
16697
|
-
)
|
|
16698
|
-
|
|
16796
|
+
label
|
|
16797
|
+
)) }),
|
|
16798
|
+
/* @__PURE__ */ jsx312("div", { className: "datepicker-grid", children: days.map((day, idx) => {
|
|
16799
|
+
const t = day.date.getTime();
|
|
16800
|
+
const disabled = t < minTime || t > maxTime;
|
|
16801
|
+
const selected = value ? isSameDay(day.date, value) : false;
|
|
16802
|
+
const highlighted = highlightSet.has(
|
|
16803
|
+
`${day.date.getFullYear()}-${day.date.getMonth()}-${day.date.getDate()}`
|
|
16804
|
+
);
|
|
16805
|
+
return /* @__PURE__ */ jsx312(
|
|
16806
|
+
DayCell,
|
|
16807
|
+
{
|
|
16808
|
+
day,
|
|
16809
|
+
disabled,
|
|
16810
|
+
selected,
|
|
16811
|
+
highlighted,
|
|
16812
|
+
onSelect: handleSelect
|
|
16813
|
+
},
|
|
16814
|
+
idx
|
|
16815
|
+
);
|
|
16816
|
+
}) })
|
|
16817
|
+
] })
|
|
16699
16818
|
]
|
|
16700
16819
|
}
|
|
16701
16820
|
);
|
|
@@ -16810,9 +16929,24 @@ var RangePicker = (props) => {
|
|
|
16810
16929
|
} = props;
|
|
16811
16930
|
const startCal = useCalendar(startDate.getFullYear(), startDate.getMonth());
|
|
16812
16931
|
const endCal = useCalendar(endDate.getFullYear(), endDate.getMonth());
|
|
16813
|
-
const isDisabled = (date) => {
|
|
16814
|
-
|
|
16815
|
-
if (
|
|
16932
|
+
const isDisabled = (date, type) => {
|
|
16933
|
+
const d = date.getTime();
|
|
16934
|
+
if (minDate) {
|
|
16935
|
+
const min = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate()).getTime();
|
|
16936
|
+
if (d < min) return true;
|
|
16937
|
+
}
|
|
16938
|
+
if (maxDate) {
|
|
16939
|
+
const max = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate()).getTime();
|
|
16940
|
+
if (d > max) return true;
|
|
16941
|
+
}
|
|
16942
|
+
if (type === "end") {
|
|
16943
|
+
const start = new Date(startDate.getFullYear(), startDate.getMonth(), startDate.getDate()).getTime();
|
|
16944
|
+
if (d < start) return true;
|
|
16945
|
+
}
|
|
16946
|
+
if (type === "start") {
|
|
16947
|
+
const end = new Date(endDate.getFullYear(), endDate.getMonth(), endDate.getDate()).getTime();
|
|
16948
|
+
if (d > end) return true;
|
|
16949
|
+
}
|
|
16816
16950
|
return false;
|
|
16817
16951
|
};
|
|
16818
16952
|
const weekdays = WEEKDAY_LABELS[locale];
|
|
@@ -16821,9 +16955,25 @@ var RangePicker = (props) => {
|
|
|
16821
16955
|
return /* @__PURE__ */ jsxs201("div", { className: "datepicker-range-panel", children: [
|
|
16822
16956
|
/* @__PURE__ */ jsx315("span", { className: "datepicker-range-label", children: label }),
|
|
16823
16957
|
/* @__PURE__ */ jsxs201("div", { className: "datepicker-header", children: [
|
|
16824
|
-
/* @__PURE__ */ jsx315(
|
|
16958
|
+
/* @__PURE__ */ jsx315(
|
|
16959
|
+
"button",
|
|
16960
|
+
{
|
|
16961
|
+
className: "datepicker-nav",
|
|
16962
|
+
onClick: cal.goToPrevMonth,
|
|
16963
|
+
type: "button",
|
|
16964
|
+
children: /* @__PURE__ */ jsx315(ChevronLeftIcon_default, {})
|
|
16965
|
+
}
|
|
16966
|
+
),
|
|
16825
16967
|
/* @__PURE__ */ jsx315("span", { className: "datepicker-title", children: locale === "ko" ? `${cal.year}\uB144 ${MONTH_LABELS.ko[cal.month]}` : `${MONTH_LABELS.en[cal.month]} ${cal.year}` }),
|
|
16826
|
-
/* @__PURE__ */ jsx315(
|
|
16968
|
+
/* @__PURE__ */ jsx315(
|
|
16969
|
+
"button",
|
|
16970
|
+
{
|
|
16971
|
+
className: "datepicker-nav",
|
|
16972
|
+
onClick: cal.goToNextMonth,
|
|
16973
|
+
type: "button",
|
|
16974
|
+
children: /* @__PURE__ */ jsx315(ChevronRightIcon_default, {})
|
|
16975
|
+
}
|
|
16976
|
+
)
|
|
16827
16977
|
] }),
|
|
16828
16978
|
/* @__PURE__ */ jsx315("div", { className: "datepicker-weekdays", children: weekdays.map((w, i) => /* @__PURE__ */ jsx315(
|
|
16829
16979
|
"div",
|
|
@@ -16838,7 +16988,7 @@ var RangePicker = (props) => {
|
|
|
16838
16988
|
w
|
|
16839
16989
|
)) }),
|
|
16840
16990
|
/* @__PURE__ */ jsx315("div", { className: "datepicker-grid", children: cal.days.map((day, idx) => {
|
|
16841
|
-
const disabled = isDisabled(day.date);
|
|
16991
|
+
const disabled = isDisabled(day.date, type);
|
|
16842
16992
|
const isStart = isSameDay(day.date, startDate);
|
|
16843
16993
|
const isEnd = isSameDay(day.date, endDate);
|
|
16844
16994
|
const inRange2 = isInRange(day.date, startDate, endDate);
|
|
@@ -16879,7 +17029,9 @@ var RangePicker = (props) => {
|
|
|
16879
17029
|
"div",
|
|
16880
17030
|
{
|
|
16881
17031
|
className: clsx_default("lib-xplat-datepicker", "range"),
|
|
16882
|
-
style: {
|
|
17032
|
+
style: {
|
|
17033
|
+
"--datepicker-active-color": `var(--${color2})`
|
|
17034
|
+
},
|
|
16883
17035
|
children: [
|
|
16884
17036
|
renderCalendar(startCal, "start"),
|
|
16885
17037
|
renderCalendar(endCal, "end")
|
|
@@ -16904,7 +17056,7 @@ var PopupPicker = (props) => {
|
|
|
16904
17056
|
};
|
|
16905
17057
|
return /* @__PURE__ */ jsxs202("div", { className: "lib-xplat-popup-datepicker", children: [
|
|
16906
17058
|
React12.cloneElement(component, { onClick: handleClick }),
|
|
16907
|
-
/* @__PURE__ */ jsx316(Modal_default, { isOpen, onClose: handleClose, children: /* @__PURE__ */ jsxs202("div", { className: "lib-xplat-popup-datepicker-card", children: [
|
|
17059
|
+
/* @__PURE__ */ jsx316(Modal_default, { isOpen, onClose: handleClose, children: /* @__PURE__ */ jsxs202("div", { className: clsx_default("lib-xplat-popup-datepicker-card", type === "range" && "range-mode"), children: [
|
|
16908
17060
|
/* @__PURE__ */ jsxs202("div", { className: "popup-datepicker-content", children: [
|
|
16909
17061
|
type === "single" && /* @__PURE__ */ jsx316(
|
|
16910
17062
|
SingleDatePicker_default,
|
|
@@ -17832,10 +17984,10 @@ Radio.displayName = "Radio";
|
|
|
17832
17984
|
var Radio_default = Radio;
|
|
17833
17985
|
|
|
17834
17986
|
// src/components/Radio/RadioGroup.tsx
|
|
17835
|
-
import { Fragment, jsx as jsx330 } from "react/jsx-runtime";
|
|
17987
|
+
import { Fragment as Fragment3, jsx as jsx330 } from "react/jsx-runtime";
|
|
17836
17988
|
var RadioGroup = (props) => {
|
|
17837
17989
|
const { children, ...rest } = props;
|
|
17838
|
-
return /* @__PURE__ */ jsx330(
|
|
17990
|
+
return /* @__PURE__ */ jsx330(Fragment3, { children: /* @__PURE__ */ jsx330(RadioGroupContext_default.Provider, { value: rest, children }) });
|
|
17839
17991
|
};
|
|
17840
17992
|
RadioGroup.displayName = "RadioGroup";
|
|
17841
17993
|
var RadioGroup_default = RadioGroup;
|