@x-plat/design-system 0.3.8 → 0.4.0
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 +86 -78
- package/dist/components/Calendar/index.css +15 -9
- package/dist/components/Calendar/index.d.cts +2 -0
- package/dist/components/Calendar/index.d.ts +2 -0
- package/dist/components/Calendar/index.js +86 -78
- package/dist/components/DatePicker/index.cjs +43 -19
- package/dist/components/DatePicker/index.css +10 -0
- package/dist/components/DatePicker/index.js +43 -19
- package/dist/components/Modal/index.css +4 -0
- package/dist/components/index.cjs +129 -97
- package/dist/components/index.css +25 -9
- package/dist/components/index.js +129 -97
- package/dist/index.cjs +129 -97
- package/dist/index.css +25 -9
- package/dist/index.js +129 -97
- package/package.json +1 -1
|
@@ -1658,6 +1658,7 @@ var Calendar = (props) => {
|
|
|
1658
1658
|
locale = "ko",
|
|
1659
1659
|
minDate,
|
|
1660
1660
|
maxDate,
|
|
1661
|
+
selectedColor,
|
|
1661
1662
|
showToday = true,
|
|
1662
1663
|
className
|
|
1663
1664
|
} = props;
|
|
@@ -1701,90 +1702,97 @@ var Calendar = (props) => {
|
|
|
1701
1702
|
};
|
|
1702
1703
|
const getEventsForDay = (date) => events.filter((e) => isSameDay(e.date, date));
|
|
1703
1704
|
const weekdays = WEEKDAY_LABELS[locale];
|
|
1704
|
-
return /* @__PURE__ */ (0, import_jsx_runtime301.jsxs)(
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
i === 6 && "saturday"
|
|
1718
|
-
),
|
|
1719
|
-
children: label
|
|
1720
|
-
},
|
|
1721
|
-
label
|
|
1722
|
-
)) }),
|
|
1723
|
-
/* @__PURE__ */ (0, import_jsx_runtime301.jsx)("div", { className: "calendar-grid", children: days.map((day, idx) => {
|
|
1724
|
-
const dayEvents = getEventsForDay(day.date);
|
|
1725
|
-
const disabled = isDisabled(day.date);
|
|
1726
|
-
const isSelected = selectedDate ? isSameDay(day.date, selectedDate) : false;
|
|
1727
|
-
if (renderDay) {
|
|
1728
|
-
return /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(
|
|
1705
|
+
return /* @__PURE__ */ (0, import_jsx_runtime301.jsxs)(
|
|
1706
|
+
"div",
|
|
1707
|
+
{
|
|
1708
|
+
className: clsx_default("lib-xplat-calendar", className),
|
|
1709
|
+
style: selectedColor ? { "--calendar-selected-color": `var(--${selectedColor})` } : void 0,
|
|
1710
|
+
children: [
|
|
1711
|
+
/* @__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 \uB2EC", children: /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(ChevronLeftIcon_default, {}) }),
|
|
1713
|
+
/* @__PURE__ */ (0, import_jsx_runtime301.jsx)("span", { className: "calendar-title", children: locale === "ko" ? `${year}\uB144 ${MONTH_LABELS.ko[month]}` : `${MONTH_LABELS.en[month]} ${year}` }),
|
|
1714
|
+
/* @__PURE__ */ (0, import_jsx_runtime301.jsx)("button", { className: "calendar-nav", onClick: handleNext, "aria-label": "\uB2E4\uC74C \uB2EC", children: /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(ChevronRightIcon_default, {}) }),
|
|
1715
|
+
showToday && /* @__PURE__ */ (0, import_jsx_runtime301.jsx)("button", { className: "calendar-today-btn", onClick: handleToday, children: locale === "ko" ? "\uC624\uB298" : "Today" })
|
|
1716
|
+
] }),
|
|
1717
|
+
/* @__PURE__ */ (0, import_jsx_runtime301.jsx)("div", { className: "calendar-weekdays", children: weekdays.map((label, i) => /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(
|
|
1729
1718
|
"div",
|
|
1730
1719
|
{
|
|
1731
1720
|
className: clsx_default(
|
|
1732
|
-
"calendar-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
isSelected && "selected",
|
|
1736
|
-
day.isToday && "today"
|
|
1721
|
+
"calendar-weekday",
|
|
1722
|
+
i === 0 && "sunday",
|
|
1723
|
+
i === 6 && "saturday"
|
|
1737
1724
|
),
|
|
1738
|
-
|
|
1739
|
-
if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
|
|
1740
|
-
},
|
|
1741
|
-
children: renderDay(day, dayEvents)
|
|
1742
|
-
},
|
|
1743
|
-
idx
|
|
1744
|
-
);
|
|
1745
|
-
}
|
|
1746
|
-
return /* @__PURE__ */ (0, import_jsx_runtime301.jsxs)(
|
|
1747
|
-
"div",
|
|
1748
|
-
{
|
|
1749
|
-
className: clsx_default(
|
|
1750
|
-
"calendar-day",
|
|
1751
|
-
!day.isCurrentMonth && "outside",
|
|
1752
|
-
disabled && "disabled",
|
|
1753
|
-
isSelected && "selected",
|
|
1754
|
-
day.isToday && "today",
|
|
1755
|
-
day.isSunday && "sunday",
|
|
1756
|
-
day.isSaturday && "saturday"
|
|
1757
|
-
),
|
|
1758
|
-
onClick: () => {
|
|
1759
|
-
if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
|
|
1725
|
+
children: label
|
|
1760
1726
|
},
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1727
|
+
label
|
|
1728
|
+
)) }),
|
|
1729
|
+
/* @__PURE__ */ (0, import_jsx_runtime301.jsx)("div", { className: "calendar-grid", children: days.map((day, idx) => {
|
|
1730
|
+
const dayEvents = getEventsForDay(day.date);
|
|
1731
|
+
const disabled = isDisabled(day.date);
|
|
1732
|
+
const isSelected = selectedDate ? isSameDay(day.date, selectedDate) : false;
|
|
1733
|
+
if (renderDay) {
|
|
1734
|
+
return /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(
|
|
1735
|
+
"div",
|
|
1736
|
+
{
|
|
1737
|
+
className: clsx_default(
|
|
1738
|
+
"calendar-day",
|
|
1739
|
+
!day.isCurrentMonth && "outside",
|
|
1740
|
+
disabled && "disabled",
|
|
1741
|
+
isSelected && "selected",
|
|
1742
|
+
day.isToday && "today"
|
|
1743
|
+
),
|
|
1744
|
+
onClick: () => {
|
|
1745
|
+
if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
|
|
1774
1746
|
},
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1747
|
+
children: renderDay(day, dayEvents)
|
|
1748
|
+
},
|
|
1749
|
+
idx
|
|
1750
|
+
);
|
|
1751
|
+
}
|
|
1752
|
+
return /* @__PURE__ */ (0, import_jsx_runtime301.jsxs)(
|
|
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
|
+
}) })
|
|
1793
|
+
]
|
|
1794
|
+
}
|
|
1795
|
+
);
|
|
1788
1796
|
};
|
|
1789
1797
|
Calendar.displayName = "Calendar";
|
|
1790
1798
|
var Calendar_default = Calendar;
|
|
@@ -16663,6 +16671,37 @@ var useClickOutside_default = useClickOutside;
|
|
|
16663
16671
|
// src/components/DatePicker/SingleDatePicker/index.tsx
|
|
16664
16672
|
var import_react11 = __toESM(require("react"), 1);
|
|
16665
16673
|
var import_jsx_runtime312 = require("react/jsx-runtime");
|
|
16674
|
+
var DayCell = import_react11.default.memo(
|
|
16675
|
+
({
|
|
16676
|
+
day,
|
|
16677
|
+
disabled,
|
|
16678
|
+
selected,
|
|
16679
|
+
highlighted,
|
|
16680
|
+
onSelect
|
|
16681
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime312.jsx)(
|
|
16682
|
+
"button",
|
|
16683
|
+
{
|
|
16684
|
+
type: "button",
|
|
16685
|
+
className: clsx_default(
|
|
16686
|
+
"datepicker-day",
|
|
16687
|
+
!day.isCurrentMonth && "outside",
|
|
16688
|
+
disabled && "disabled",
|
|
16689
|
+
selected && "selected",
|
|
16690
|
+
highlighted && !selected && "highlighted",
|
|
16691
|
+
day.isToday && "today",
|
|
16692
|
+
day.isSunday && "sunday",
|
|
16693
|
+
day.isSaturday && "saturday"
|
|
16694
|
+
),
|
|
16695
|
+
disabled: disabled || !day.isCurrentMonth,
|
|
16696
|
+
onClick: () => {
|
|
16697
|
+
if (!disabled && day.isCurrentMonth) onSelect(day.date);
|
|
16698
|
+
},
|
|
16699
|
+
children: day.day
|
|
16700
|
+
}
|
|
16701
|
+
),
|
|
16702
|
+
(prev, next) => prev.selected === next.selected && prev.disabled === next.disabled && prev.highlighted === next.highlighted && prev.day === next.day
|
|
16703
|
+
);
|
|
16704
|
+
DayCell.displayName = "DayCell";
|
|
16666
16705
|
var SingleDatePicker = (props) => {
|
|
16667
16706
|
const {
|
|
16668
16707
|
value,
|
|
@@ -16694,6 +16733,12 @@ var SingleDatePicker = (props) => {
|
|
|
16694
16733
|
}
|
|
16695
16734
|
return set2;
|
|
16696
16735
|
}, [highlightDates]);
|
|
16736
|
+
const handleSelect = import_react11.default.useCallback(
|
|
16737
|
+
(date) => {
|
|
16738
|
+
onChange?.(date);
|
|
16739
|
+
},
|
|
16740
|
+
[onChange]
|
|
16741
|
+
);
|
|
16697
16742
|
const weekdays = WEEKDAY_LABELS[locale];
|
|
16698
16743
|
return /* @__PURE__ */ (0, import_jsx_runtime312.jsxs)(
|
|
16699
16744
|
"div",
|
|
@@ -16726,26 +16771,13 @@ var SingleDatePicker = (props) => {
|
|
|
16726
16771
|
`${day.date.getFullYear()}-${day.date.getMonth()}-${day.date.getDate()}`
|
|
16727
16772
|
);
|
|
16728
16773
|
return /* @__PURE__ */ (0, import_jsx_runtime312.jsx)(
|
|
16729
|
-
|
|
16774
|
+
DayCell,
|
|
16730
16775
|
{
|
|
16731
|
-
|
|
16732
|
-
|
|
16733
|
-
|
|
16734
|
-
|
|
16735
|
-
|
|
16736
|
-
selected && "selected",
|
|
16737
|
-
highlighted && !selected && "highlighted",
|
|
16738
|
-
day.isToday && "today",
|
|
16739
|
-
day.isSunday && "sunday",
|
|
16740
|
-
day.isSaturday && "saturday"
|
|
16741
|
-
),
|
|
16742
|
-
disabled: disabled || !day.isCurrentMonth,
|
|
16743
|
-
onClick: () => {
|
|
16744
|
-
if (!disabled && day.isCurrentMonth) {
|
|
16745
|
-
onChange?.(day.date);
|
|
16746
|
-
}
|
|
16747
|
-
},
|
|
16748
|
-
children: day.day
|
|
16776
|
+
day,
|
|
16777
|
+
disabled,
|
|
16778
|
+
selected,
|
|
16779
|
+
highlighted,
|
|
16780
|
+
onSelect: handleSelect
|
|
16749
16781
|
},
|
|
16750
16782
|
idx
|
|
16751
16783
|
);
|
|
@@ -767,6 +767,12 @@
|
|
|
767
767
|
.lib-xplat-calendar .calendar-day.outside .calendar-day-number {
|
|
768
768
|
color: var(--xplat-neutral-300);
|
|
769
769
|
}
|
|
770
|
+
.lib-xplat-calendar .calendar-day.outside.sunday .calendar-day-number {
|
|
771
|
+
color: color-mix(in srgb, var(--xplat-red-500) 35%, transparent);
|
|
772
|
+
}
|
|
773
|
+
.lib-xplat-calendar .calendar-day.outside.saturday .calendar-day-number {
|
|
774
|
+
color: color-mix(in srgb, var(--xplat-blue-500) 35%, transparent);
|
|
775
|
+
}
|
|
770
776
|
.lib-xplat-calendar .calendar-day.disabled {
|
|
771
777
|
cursor: not-allowed;
|
|
772
778
|
}
|
|
@@ -778,34 +784,34 @@
|
|
|
778
784
|
font-weight: 700;
|
|
779
785
|
color: var(--xplat-blue-600);
|
|
780
786
|
}
|
|
781
|
-
.lib-xplat-calendar .calendar-day.today .calendar-day-number::
|
|
787
|
+
.lib-xplat-calendar .calendar-day.today .calendar-day-number::before {
|
|
782
788
|
content: "";
|
|
783
789
|
position: absolute;
|
|
784
|
-
|
|
785
|
-
left:
|
|
786
|
-
transform:
|
|
790
|
+
top: 50%;
|
|
791
|
+
left: -6px;
|
|
792
|
+
transform: translateY(-50%);
|
|
787
793
|
width: 4px;
|
|
788
794
|
height: 4px;
|
|
789
795
|
border-radius: 50%;
|
|
790
796
|
background-color: var(--xplat-blue-600);
|
|
791
797
|
}
|
|
792
798
|
.lib-xplat-calendar .calendar-day.selected {
|
|
793
|
-
background-color: var(--xplat-neutral-900);
|
|
799
|
+
background-color: var(--calendar-selected-color, var(--xplat-neutral-900));
|
|
794
800
|
}
|
|
795
801
|
.lib-xplat-calendar .calendar-day.selected .calendar-day-number {
|
|
796
802
|
color: var(--xplat-white);
|
|
797
803
|
font-weight: 600;
|
|
798
804
|
}
|
|
799
805
|
.lib-xplat-calendar .calendar-day.selected:hover {
|
|
800
|
-
background-color: var(--xplat-neutral-
|
|
806
|
+
background-color: color-mix(in srgb, var(--calendar-selected-color, var(--xplat-neutral-900)), black 12%);
|
|
801
807
|
}
|
|
802
|
-
.lib-xplat-calendar .calendar-day.selected.today .calendar-day-number::
|
|
808
|
+
.lib-xplat-calendar .calendar-day.selected.today .calendar-day-number::before {
|
|
803
809
|
background-color: var(--xplat-white);
|
|
804
810
|
}
|
|
805
|
-
.lib-xplat-calendar .calendar-day.sunday .calendar-day-number {
|
|
811
|
+
.lib-xplat-calendar .calendar-day.sunday:not(.outside) .calendar-day-number {
|
|
806
812
|
color: var(--xplat-red-500);
|
|
807
813
|
}
|
|
808
|
-
.lib-xplat-calendar .calendar-day.saturday .calendar-day-number {
|
|
814
|
+
.lib-xplat-calendar .calendar-day.saturday:not(.outside) .calendar-day-number {
|
|
809
815
|
color: var(--xplat-blue-500);
|
|
810
816
|
}
|
|
811
817
|
.lib-xplat-calendar .calendar-day.selected .calendar-day-number {
|
|
@@ -1230,6 +1236,12 @@
|
|
|
1230
1236
|
color: var(--xplat-neutral-300);
|
|
1231
1237
|
cursor: default;
|
|
1232
1238
|
}
|
|
1239
|
+
.lib-xplat-datepicker .datepicker-day.outside.sunday {
|
|
1240
|
+
color: color-mix(in srgb, var(--xplat-red-500) 35%, transparent);
|
|
1241
|
+
}
|
|
1242
|
+
.lib-xplat-datepicker .datepicker-day.outside.saturday {
|
|
1243
|
+
color: color-mix(in srgb, var(--xplat-blue-500) 35%, transparent);
|
|
1244
|
+
}
|
|
1233
1245
|
.lib-xplat-datepicker .datepicker-day.disabled {
|
|
1234
1246
|
color: var(--xplat-neutral-300);
|
|
1235
1247
|
cursor: not-allowed;
|
|
@@ -1314,6 +1326,10 @@
|
|
|
1314
1326
|
border-radius: 12px;
|
|
1315
1327
|
background-color: #fff;
|
|
1316
1328
|
padding: 24px;
|
|
1329
|
+
width: fit-content;
|
|
1330
|
+
max-width: calc(100vw - 2rem);
|
|
1331
|
+
max-height: calc(100vh - 2rem);
|
|
1332
|
+
overflow: auto;
|
|
1317
1333
|
transform: translate(-50%, -50%) scale(0.9);
|
|
1318
1334
|
opacity: 0;
|
|
1319
1335
|
transition: transform 0.2s ease, opacity 0.2s ease;
|
package/dist/components/index.js
CHANGED
|
@@ -1572,6 +1572,7 @@ var Calendar = (props) => {
|
|
|
1572
1572
|
locale = "ko",
|
|
1573
1573
|
minDate,
|
|
1574
1574
|
maxDate,
|
|
1575
|
+
selectedColor,
|
|
1575
1576
|
showToday = true,
|
|
1576
1577
|
className
|
|
1577
1578
|
} = props;
|
|
@@ -1615,90 +1616,97 @@ var Calendar = (props) => {
|
|
|
1615
1616
|
};
|
|
1616
1617
|
const getEventsForDay = (date) => events.filter((e) => isSameDay(e.date, date));
|
|
1617
1618
|
const weekdays = WEEKDAY_LABELS[locale];
|
|
1618
|
-
return /* @__PURE__ */ jsxs193(
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
i === 6 && "saturday"
|
|
1632
|
-
),
|
|
1633
|
-
children: label
|
|
1634
|
-
},
|
|
1635
|
-
label
|
|
1636
|
-
)) }),
|
|
1637
|
-
/* @__PURE__ */ jsx301("div", { className: "calendar-grid", children: days.map((day, idx) => {
|
|
1638
|
-
const dayEvents = getEventsForDay(day.date);
|
|
1639
|
-
const disabled = isDisabled(day.date);
|
|
1640
|
-
const isSelected = selectedDate ? isSameDay(day.date, selectedDate) : false;
|
|
1641
|
-
if (renderDay) {
|
|
1642
|
-
return /* @__PURE__ */ jsx301(
|
|
1619
|
+
return /* @__PURE__ */ jsxs193(
|
|
1620
|
+
"div",
|
|
1621
|
+
{
|
|
1622
|
+
className: clsx_default("lib-xplat-calendar", className),
|
|
1623
|
+
style: selectedColor ? { "--calendar-selected-color": `var(--${selectedColor})` } : void 0,
|
|
1624
|
+
children: [
|
|
1625
|
+
/* @__PURE__ */ jsxs193("div", { className: "calendar-header", children: [
|
|
1626
|
+
/* @__PURE__ */ jsx301("button", { className: "calendar-nav", onClick: handlePrev, "aria-label": "\uC774\uC804 \uB2EC", children: /* @__PURE__ */ jsx301(ChevronLeftIcon_default, {}) }),
|
|
1627
|
+
/* @__PURE__ */ jsx301("span", { className: "calendar-title", children: locale === "ko" ? `${year}\uB144 ${MONTH_LABELS.ko[month]}` : `${MONTH_LABELS.en[month]} ${year}` }),
|
|
1628
|
+
/* @__PURE__ */ jsx301("button", { className: "calendar-nav", onClick: handleNext, "aria-label": "\uB2E4\uC74C \uB2EC", children: /* @__PURE__ */ jsx301(ChevronRightIcon_default, {}) }),
|
|
1629
|
+
showToday && /* @__PURE__ */ jsx301("button", { className: "calendar-today-btn", onClick: handleToday, children: locale === "ko" ? "\uC624\uB298" : "Today" })
|
|
1630
|
+
] }),
|
|
1631
|
+
/* @__PURE__ */ jsx301("div", { className: "calendar-weekdays", children: weekdays.map((label, i) => /* @__PURE__ */ jsx301(
|
|
1643
1632
|
"div",
|
|
1644
1633
|
{
|
|
1645
1634
|
className: clsx_default(
|
|
1646
|
-
"calendar-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
isSelected && "selected",
|
|
1650
|
-
day.isToday && "today"
|
|
1635
|
+
"calendar-weekday",
|
|
1636
|
+
i === 0 && "sunday",
|
|
1637
|
+
i === 6 && "saturday"
|
|
1651
1638
|
),
|
|
1652
|
-
|
|
1653
|
-
if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
|
|
1654
|
-
},
|
|
1655
|
-
children: renderDay(day, dayEvents)
|
|
1656
|
-
},
|
|
1657
|
-
idx
|
|
1658
|
-
);
|
|
1659
|
-
}
|
|
1660
|
-
return /* @__PURE__ */ jsxs193(
|
|
1661
|
-
"div",
|
|
1662
|
-
{
|
|
1663
|
-
className: clsx_default(
|
|
1664
|
-
"calendar-day",
|
|
1665
|
-
!day.isCurrentMonth && "outside",
|
|
1666
|
-
disabled && "disabled",
|
|
1667
|
-
isSelected && "selected",
|
|
1668
|
-
day.isToday && "today",
|
|
1669
|
-
day.isSunday && "sunday",
|
|
1670
|
-
day.isSaturday && "saturday"
|
|
1671
|
-
),
|
|
1672
|
-
onClick: () => {
|
|
1673
|
-
if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
|
|
1639
|
+
children: label
|
|
1674
1640
|
},
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1641
|
+
label
|
|
1642
|
+
)) }),
|
|
1643
|
+
/* @__PURE__ */ jsx301("div", { className: "calendar-grid", children: days.map((day, idx) => {
|
|
1644
|
+
const dayEvents = getEventsForDay(day.date);
|
|
1645
|
+
const disabled = isDisabled(day.date);
|
|
1646
|
+
const isSelected = selectedDate ? isSameDay(day.date, selectedDate) : false;
|
|
1647
|
+
if (renderDay) {
|
|
1648
|
+
return /* @__PURE__ */ jsx301(
|
|
1649
|
+
"div",
|
|
1650
|
+
{
|
|
1651
|
+
className: clsx_default(
|
|
1652
|
+
"calendar-day",
|
|
1653
|
+
!day.isCurrentMonth && "outside",
|
|
1654
|
+
disabled && "disabled",
|
|
1655
|
+
isSelected && "selected",
|
|
1656
|
+
day.isToday && "today"
|
|
1657
|
+
),
|
|
1658
|
+
onClick: () => {
|
|
1659
|
+
if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
|
|
1688
1660
|
},
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1661
|
+
children: renderDay(day, dayEvents)
|
|
1662
|
+
},
|
|
1663
|
+
idx
|
|
1664
|
+
);
|
|
1665
|
+
}
|
|
1666
|
+
return /* @__PURE__ */ jsxs193(
|
|
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
|
+
}) })
|
|
1707
|
+
]
|
|
1708
|
+
}
|
|
1709
|
+
);
|
|
1702
1710
|
};
|
|
1703
1711
|
Calendar.displayName = "Calendar";
|
|
1704
1712
|
var Calendar_default = Calendar;
|
|
@@ -16577,6 +16585,37 @@ var useClickOutside_default = useClickOutside;
|
|
|
16577
16585
|
// src/components/DatePicker/SingleDatePicker/index.tsx
|
|
16578
16586
|
import React9 from "react";
|
|
16579
16587
|
import { jsx as jsx312, jsxs as jsxs199 } from "react/jsx-runtime";
|
|
16588
|
+
var DayCell = React9.memo(
|
|
16589
|
+
({
|
|
16590
|
+
day,
|
|
16591
|
+
disabled,
|
|
16592
|
+
selected,
|
|
16593
|
+
highlighted,
|
|
16594
|
+
onSelect
|
|
16595
|
+
}) => /* @__PURE__ */ jsx312(
|
|
16596
|
+
"button",
|
|
16597
|
+
{
|
|
16598
|
+
type: "button",
|
|
16599
|
+
className: clsx_default(
|
|
16600
|
+
"datepicker-day",
|
|
16601
|
+
!day.isCurrentMonth && "outside",
|
|
16602
|
+
disabled && "disabled",
|
|
16603
|
+
selected && "selected",
|
|
16604
|
+
highlighted && !selected && "highlighted",
|
|
16605
|
+
day.isToday && "today",
|
|
16606
|
+
day.isSunday && "sunday",
|
|
16607
|
+
day.isSaturday && "saturday"
|
|
16608
|
+
),
|
|
16609
|
+
disabled: disabled || !day.isCurrentMonth,
|
|
16610
|
+
onClick: () => {
|
|
16611
|
+
if (!disabled && day.isCurrentMonth) onSelect(day.date);
|
|
16612
|
+
},
|
|
16613
|
+
children: day.day
|
|
16614
|
+
}
|
|
16615
|
+
),
|
|
16616
|
+
(prev, next) => prev.selected === next.selected && prev.disabled === next.disabled && prev.highlighted === next.highlighted && prev.day === next.day
|
|
16617
|
+
);
|
|
16618
|
+
DayCell.displayName = "DayCell";
|
|
16580
16619
|
var SingleDatePicker = (props) => {
|
|
16581
16620
|
const {
|
|
16582
16621
|
value,
|
|
@@ -16608,6 +16647,12 @@ var SingleDatePicker = (props) => {
|
|
|
16608
16647
|
}
|
|
16609
16648
|
return set2;
|
|
16610
16649
|
}, [highlightDates]);
|
|
16650
|
+
const handleSelect = React9.useCallback(
|
|
16651
|
+
(date) => {
|
|
16652
|
+
onChange?.(date);
|
|
16653
|
+
},
|
|
16654
|
+
[onChange]
|
|
16655
|
+
);
|
|
16611
16656
|
const weekdays = WEEKDAY_LABELS[locale];
|
|
16612
16657
|
return /* @__PURE__ */ jsxs199(
|
|
16613
16658
|
"div",
|
|
@@ -16640,26 +16685,13 @@ var SingleDatePicker = (props) => {
|
|
|
16640
16685
|
`${day.date.getFullYear()}-${day.date.getMonth()}-${day.date.getDate()}`
|
|
16641
16686
|
);
|
|
16642
16687
|
return /* @__PURE__ */ jsx312(
|
|
16643
|
-
|
|
16688
|
+
DayCell,
|
|
16644
16689
|
{
|
|
16645
|
-
|
|
16646
|
-
|
|
16647
|
-
|
|
16648
|
-
|
|
16649
|
-
|
|
16650
|
-
selected && "selected",
|
|
16651
|
-
highlighted && !selected && "highlighted",
|
|
16652
|
-
day.isToday && "today",
|
|
16653
|
-
day.isSunday && "sunday",
|
|
16654
|
-
day.isSaturday && "saturday"
|
|
16655
|
-
),
|
|
16656
|
-
disabled: disabled || !day.isCurrentMonth,
|
|
16657
|
-
onClick: () => {
|
|
16658
|
-
if (!disabled && day.isCurrentMonth) {
|
|
16659
|
-
onChange?.(day.date);
|
|
16660
|
-
}
|
|
16661
|
-
},
|
|
16662
|
-
children: day.day
|
|
16690
|
+
day,
|
|
16691
|
+
disabled,
|
|
16692
|
+
selected,
|
|
16693
|
+
highlighted,
|
|
16694
|
+
onSelect: handleSelect
|
|
16663
16695
|
},
|
|
16664
16696
|
idx
|
|
16665
16697
|
);
|