@x-plat/design-system 0.4.2 → 0.4.4
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/PopOver/index.css +1 -0
- package/dist/components/index.cjs +258 -106
- package/dist/components/index.css +93 -31
- package/dist/components/index.js +262 -110
- package/dist/index.cjs +258 -106
- package/dist/index.css +93 -31
- package/dist/index.js +264 -112
- package/package.json +1 -1
|
@@ -1024,7 +1024,7 @@ var MONTH_LABELS = {
|
|
|
1024
1024
|
};
|
|
1025
1025
|
|
|
1026
1026
|
// src/components/Calendar/Calendar.tsx
|
|
1027
|
-
import { jsx as jsx295, jsxs as jsxs189 } from "react/jsx-runtime";
|
|
1027
|
+
import { Fragment, jsx as jsx295, jsxs as jsxs189 } from "react/jsx-runtime";
|
|
1028
1028
|
var Calendar = (props) => {
|
|
1029
1029
|
const {
|
|
1030
1030
|
year: yearProp,
|
|
@@ -1052,6 +1052,10 @@ var Calendar = (props) => {
|
|
|
1052
1052
|
setYear,
|
|
1053
1053
|
setMonth
|
|
1054
1054
|
} = useCalendar(yearProp, monthProp);
|
|
1055
|
+
const [pickerMode, setPickerMode] = React2.useState("days");
|
|
1056
|
+
const [yearRangeStart, setYearRangeStart] = React2.useState(
|
|
1057
|
+
Math.floor(year / 12) * 12
|
|
1058
|
+
);
|
|
1055
1059
|
React2.useEffect(() => {
|
|
1056
1060
|
if (yearProp !== void 0) setYear(yearProp);
|
|
1057
1061
|
}, [yearProp, setYear]);
|
|
@@ -1059,22 +1063,54 @@ var Calendar = (props) => {
|
|
|
1059
1063
|
if (monthProp !== void 0) setMonth(monthProp);
|
|
1060
1064
|
}, [monthProp, setMonth]);
|
|
1061
1065
|
const handlePrev = () => {
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
+
if (pickerMode === "days") {
|
|
1067
|
+
goToPrevMonth();
|
|
1068
|
+
const prevMonth = month === 0 ? 11 : month - 1;
|
|
1069
|
+
const prevYear = month === 0 ? year - 1 : year;
|
|
1070
|
+
onMonthChange?.(prevYear, prevMonth);
|
|
1071
|
+
} else if (pickerMode === "months") {
|
|
1072
|
+
setYear(year - 1);
|
|
1073
|
+
onMonthChange?.(year - 1, month);
|
|
1074
|
+
} else {
|
|
1075
|
+
setYearRangeStart((s) => s - 12);
|
|
1076
|
+
}
|
|
1066
1077
|
};
|
|
1067
1078
|
const handleNext = () => {
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1079
|
+
if (pickerMode === "days") {
|
|
1080
|
+
goToNextMonth();
|
|
1081
|
+
const nextMonth = month === 11 ? 0 : month + 1;
|
|
1082
|
+
const nextYear = month === 11 ? year + 1 : year;
|
|
1083
|
+
onMonthChange?.(nextYear, nextMonth);
|
|
1084
|
+
} else if (pickerMode === "months") {
|
|
1085
|
+
setYear(year + 1);
|
|
1086
|
+
onMonthChange?.(year + 1, month);
|
|
1087
|
+
} else {
|
|
1088
|
+
setYearRangeStart((s) => s + 12);
|
|
1089
|
+
}
|
|
1072
1090
|
};
|
|
1073
1091
|
const handleToday = () => {
|
|
1074
1092
|
goToToday();
|
|
1093
|
+
setPickerMode("days");
|
|
1075
1094
|
const today = /* @__PURE__ */ new Date();
|
|
1076
1095
|
onMonthChange?.(today.getFullYear(), today.getMonth());
|
|
1077
1096
|
};
|
|
1097
|
+
const handleTitleClick = () => {
|
|
1098
|
+
if (pickerMode === "days") setPickerMode("months");
|
|
1099
|
+
else if (pickerMode === "months") {
|
|
1100
|
+
setYearRangeStart(Math.floor(year / 12) * 12);
|
|
1101
|
+
setPickerMode("years");
|
|
1102
|
+
}
|
|
1103
|
+
};
|
|
1104
|
+
const handleMonthSelect = (m) => {
|
|
1105
|
+
setMonth(m);
|
|
1106
|
+
setPickerMode("days");
|
|
1107
|
+
onMonthChange?.(year, m);
|
|
1108
|
+
};
|
|
1109
|
+
const handleYearSelect = (y) => {
|
|
1110
|
+
setYear(y);
|
|
1111
|
+
setPickerMode("months");
|
|
1112
|
+
onMonthChange?.(y, month);
|
|
1113
|
+
};
|
|
1078
1114
|
const isDisabled = (date) => {
|
|
1079
1115
|
if (minDate && date < new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate())) return true;
|
|
1080
1116
|
if (maxDate && date > new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate())) return true;
|
|
@@ -1082,6 +1118,8 @@ var Calendar = (props) => {
|
|
|
1082
1118
|
};
|
|
1083
1119
|
const getEventsForDay = (date) => events.filter((e) => isSameDay(e.date, date));
|
|
1084
1120
|
const weekdays = WEEKDAY_LABELS[locale];
|
|
1121
|
+
const monthLabels = MONTH_LABELS[locale];
|
|
1122
|
+
const titleText = pickerMode === "days" ? locale === "ko" ? `${year}\uB144 ${monthLabels[month]}` : `${monthLabels[month]} ${year}` : pickerMode === "months" ? `${year}` : `${yearRangeStart} - ${yearRangeStart + 11}`;
|
|
1085
1123
|
return /* @__PURE__ */ jsxs189(
|
|
1086
1124
|
"div",
|
|
1087
1125
|
{
|
|
@@ -1089,29 +1127,71 @@ var Calendar = (props) => {
|
|
|
1089
1127
|
style: selectedColor ? { "--calendar-selected-color": `var(--${selectedColor})` } : void 0,
|
|
1090
1128
|
children: [
|
|
1091
1129
|
/* @__PURE__ */ jsxs189("div", { className: "calendar-header", children: [
|
|
1092
|
-
/* @__PURE__ */ jsx295("button", { className: "calendar-nav", onClick: handlePrev, "aria-label": "\uC774\uC804
|
|
1093
|
-
/* @__PURE__ */ jsx295("
|
|
1094
|
-
/* @__PURE__ */ jsx295("button", { className: "calendar-nav", onClick: handleNext, "aria-label": "\uB2E4\uC74C
|
|
1130
|
+
/* @__PURE__ */ jsx295("button", { className: "calendar-nav", onClick: handlePrev, "aria-label": "\uC774\uC804", children: /* @__PURE__ */ jsx295(ChevronLeftIcon_default, {}) }),
|
|
1131
|
+
/* @__PURE__ */ jsx295("button", { className: "calendar-title", onClick: handleTitleClick, type: "button", children: titleText }),
|
|
1132
|
+
/* @__PURE__ */ jsx295("button", { className: "calendar-nav", onClick: handleNext, "aria-label": "\uB2E4\uC74C", children: /* @__PURE__ */ jsx295(ChevronRightIcon_default, {}) }),
|
|
1095
1133
|
showToday && /* @__PURE__ */ jsx295("button", { className: "calendar-today-btn", onClick: handleToday, children: locale === "ko" ? "\uC624\uB298" : "Today" })
|
|
1096
1134
|
] }),
|
|
1097
|
-
/* @__PURE__ */ jsx295("div", { className: "calendar-
|
|
1098
|
-
|
|
1135
|
+
pickerMode === "years" && /* @__PURE__ */ jsx295("div", { className: "calendar-picker-grid", children: Array.from({ length: 12 }, (_, i) => {
|
|
1136
|
+
const y = yearRangeStart + i;
|
|
1137
|
+
return /* @__PURE__ */ jsx295(
|
|
1138
|
+
"button",
|
|
1139
|
+
{
|
|
1140
|
+
type: "button",
|
|
1141
|
+
className: clsx_default("calendar-picker-cell", y === year && "active"),
|
|
1142
|
+
onClick: () => handleYearSelect(y),
|
|
1143
|
+
children: y
|
|
1144
|
+
},
|
|
1145
|
+
y
|
|
1146
|
+
);
|
|
1147
|
+
}) }),
|
|
1148
|
+
pickerMode === "months" && /* @__PURE__ */ jsx295("div", { className: "calendar-picker-grid", children: monthLabels.map((label, i) => /* @__PURE__ */ jsx295(
|
|
1149
|
+
"button",
|
|
1099
1150
|
{
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
i === 6 && "saturday"
|
|
1104
|
-
),
|
|
1151
|
+
type: "button",
|
|
1152
|
+
className: clsx_default("calendar-picker-cell", i === month && "active"),
|
|
1153
|
+
onClick: () => handleMonthSelect(i),
|
|
1105
1154
|
children: label
|
|
1106
1155
|
},
|
|
1107
|
-
|
|
1156
|
+
i
|
|
1108
1157
|
)) }),
|
|
1109
|
-
/* @__PURE__ */
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1158
|
+
pickerMode === "days" && /* @__PURE__ */ jsxs189(Fragment, { children: [
|
|
1159
|
+
/* @__PURE__ */ jsx295("div", { className: "calendar-weekdays", children: weekdays.map((label, i) => /* @__PURE__ */ jsx295(
|
|
1160
|
+
"div",
|
|
1161
|
+
{
|
|
1162
|
+
className: clsx_default(
|
|
1163
|
+
"calendar-weekday",
|
|
1164
|
+
i === 0 && "sunday",
|
|
1165
|
+
i === 6 && "saturday"
|
|
1166
|
+
),
|
|
1167
|
+
children: label
|
|
1168
|
+
},
|
|
1169
|
+
label
|
|
1170
|
+
)) }),
|
|
1171
|
+
/* @__PURE__ */ jsx295("div", { className: "calendar-grid", children: days.map((day, idx) => {
|
|
1172
|
+
const dayEvents = getEventsForDay(day.date);
|
|
1173
|
+
const disabled = isDisabled(day.date);
|
|
1174
|
+
const isSelected = selectedDate ? isSameDay(day.date, selectedDate) : false;
|
|
1175
|
+
if (renderDay) {
|
|
1176
|
+
return /* @__PURE__ */ jsx295(
|
|
1177
|
+
"div",
|
|
1178
|
+
{
|
|
1179
|
+
className: clsx_default(
|
|
1180
|
+
"calendar-day",
|
|
1181
|
+
!day.isCurrentMonth && "outside",
|
|
1182
|
+
disabled && "disabled",
|
|
1183
|
+
isSelected && "selected",
|
|
1184
|
+
day.isToday && "today"
|
|
1185
|
+
),
|
|
1186
|
+
onClick: () => {
|
|
1187
|
+
if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
|
|
1188
|
+
},
|
|
1189
|
+
children: renderDay(day, dayEvents)
|
|
1190
|
+
},
|
|
1191
|
+
idx
|
|
1192
|
+
);
|
|
1193
|
+
}
|
|
1194
|
+
return /* @__PURE__ */ jsxs189(
|
|
1115
1195
|
"div",
|
|
1116
1196
|
{
|
|
1117
1197
|
className: clsx_default(
|
|
@@ -1119,57 +1199,40 @@ var Calendar = (props) => {
|
|
|
1119
1199
|
!day.isCurrentMonth && "outside",
|
|
1120
1200
|
disabled && "disabled",
|
|
1121
1201
|
isSelected && "selected",
|
|
1122
|
-
day.isToday && "today"
|
|
1202
|
+
day.isToday && "today",
|
|
1203
|
+
day.isSunday && "sunday",
|
|
1204
|
+
day.isSaturday && "saturday"
|
|
1123
1205
|
),
|
|
1124
1206
|
onClick: () => {
|
|
1125
1207
|
if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
|
|
1126
1208
|
},
|
|
1127
|
-
children:
|
|
1209
|
+
children: [
|
|
1210
|
+
/* @__PURE__ */ jsx295("span", { className: "calendar-day-number", children: day.day }),
|
|
1211
|
+
dayEvents.length > 0 && /* @__PURE__ */ jsxs189("div", { className: "calendar-day-events", children: [
|
|
1212
|
+
dayEvents.slice(0, 3).map((event, ei) => /* @__PURE__ */ jsx295(
|
|
1213
|
+
"span",
|
|
1214
|
+
{
|
|
1215
|
+
className: "calendar-event-dot",
|
|
1216
|
+
style: { backgroundColor: event.color ?? "var(--xplat-blue-500)" },
|
|
1217
|
+
title: event.label,
|
|
1218
|
+
onClick: (e) => {
|
|
1219
|
+
e.stopPropagation();
|
|
1220
|
+
onEventClick?.(event);
|
|
1221
|
+
}
|
|
1222
|
+
},
|
|
1223
|
+
ei
|
|
1224
|
+
)),
|
|
1225
|
+
dayEvents.length > 3 && /* @__PURE__ */ jsxs189("span", { className: "calendar-event-more", children: [
|
|
1226
|
+
"+",
|
|
1227
|
+
dayEvents.length - 3
|
|
1228
|
+
] })
|
|
1229
|
+
] })
|
|
1230
|
+
]
|
|
1128
1231
|
},
|
|
1129
1232
|
idx
|
|
1130
1233
|
);
|
|
1131
|
-
}
|
|
1132
|
-
|
|
1133
|
-
"div",
|
|
1134
|
-
{
|
|
1135
|
-
className: clsx_default(
|
|
1136
|
-
"calendar-day",
|
|
1137
|
-
!day.isCurrentMonth && "outside",
|
|
1138
|
-
disabled && "disabled",
|
|
1139
|
-
isSelected && "selected",
|
|
1140
|
-
day.isToday && "today",
|
|
1141
|
-
day.isSunday && "sunday",
|
|
1142
|
-
day.isSaturday && "saturday"
|
|
1143
|
-
),
|
|
1144
|
-
onClick: () => {
|
|
1145
|
-
if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
|
|
1146
|
-
},
|
|
1147
|
-
children: [
|
|
1148
|
-
/* @__PURE__ */ jsx295("span", { className: "calendar-day-number", children: day.day }),
|
|
1149
|
-
dayEvents.length > 0 && /* @__PURE__ */ jsxs189("div", { className: "calendar-day-events", children: [
|
|
1150
|
-
dayEvents.slice(0, 3).map((event, ei) => /* @__PURE__ */ jsx295(
|
|
1151
|
-
"span",
|
|
1152
|
-
{
|
|
1153
|
-
className: "calendar-event-dot",
|
|
1154
|
-
style: { backgroundColor: event.color ?? "var(--xplat-blue-500)" },
|
|
1155
|
-
title: event.label,
|
|
1156
|
-
onClick: (e) => {
|
|
1157
|
-
e.stopPropagation();
|
|
1158
|
-
onEventClick?.(event);
|
|
1159
|
-
}
|
|
1160
|
-
},
|
|
1161
|
-
ei
|
|
1162
|
-
)),
|
|
1163
|
-
dayEvents.length > 3 && /* @__PURE__ */ jsxs189("span", { className: "calendar-event-more", children: [
|
|
1164
|
-
"+",
|
|
1165
|
-
dayEvents.length - 3
|
|
1166
|
-
] })
|
|
1167
|
-
] })
|
|
1168
|
-
]
|
|
1169
|
-
},
|
|
1170
|
-
idx
|
|
1171
|
-
);
|
|
1172
|
-
}) })
|
|
1234
|
+
}) })
|
|
1235
|
+
] })
|
|
1173
1236
|
]
|
|
1174
1237
|
}
|
|
1175
1238
|
);
|
|
@@ -1493,10 +1493,14 @@ var SingleDatePicker = (props) => {
|
|
|
1493
1493
|
} = props;
|
|
1494
1494
|
const initialYear = value?.getFullYear();
|
|
1495
1495
|
const initialMonth = value?.getMonth();
|
|
1496
|
-
const { year, month, days, goToPrevMonth, goToNextMonth } = useCalendar(
|
|
1496
|
+
const { year, month, days, goToPrevMonth, goToNextMonth, setYear, setMonth } = useCalendar(
|
|
1497
1497
|
initialYear,
|
|
1498
1498
|
initialMonth
|
|
1499
1499
|
);
|
|
1500
|
+
const [pickerMode, setPickerMode] = import_react6.default.useState("days");
|
|
1501
|
+
const [yearRangeStart, setYearRangeStart] = import_react6.default.useState(
|
|
1502
|
+
Math.floor((initialYear ?? (/* @__PURE__ */ new Date()).getFullYear()) / 12) * 12
|
|
1503
|
+
);
|
|
1500
1504
|
const minTime = import_react6.default.useMemo(
|
|
1501
1505
|
() => minDate ? new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate()).getTime() : -Infinity,
|
|
1502
1506
|
[minDate]
|
|
@@ -1518,7 +1522,34 @@ var SingleDatePicker = (props) => {
|
|
|
1518
1522
|
},
|
|
1519
1523
|
[onChange]
|
|
1520
1524
|
);
|
|
1525
|
+
const handlePrev = () => {
|
|
1526
|
+
if (pickerMode === "days") goToPrevMonth();
|
|
1527
|
+
else if (pickerMode === "months") setYear(year - 1);
|
|
1528
|
+
else setYearRangeStart((s) => s - 12);
|
|
1529
|
+
};
|
|
1530
|
+
const handleNext = () => {
|
|
1531
|
+
if (pickerMode === "days") goToNextMonth();
|
|
1532
|
+
else if (pickerMode === "months") setYear(year + 1);
|
|
1533
|
+
else setYearRangeStart((s) => s + 12);
|
|
1534
|
+
};
|
|
1535
|
+
const handleTitleClick = () => {
|
|
1536
|
+
if (pickerMode === "days") setPickerMode("months");
|
|
1537
|
+
else if (pickerMode === "months") {
|
|
1538
|
+
setYearRangeStart(Math.floor(year / 12) * 12);
|
|
1539
|
+
setPickerMode("years");
|
|
1540
|
+
}
|
|
1541
|
+
};
|
|
1542
|
+
const handleMonthSelect = (m) => {
|
|
1543
|
+
setMonth(m);
|
|
1544
|
+
setPickerMode("days");
|
|
1545
|
+
};
|
|
1546
|
+
const handleYearSelect = (y) => {
|
|
1547
|
+
setYear(y);
|
|
1548
|
+
setPickerMode("months");
|
|
1549
|
+
};
|
|
1521
1550
|
const weekdays = WEEKDAY_LABELS[locale];
|
|
1551
|
+
const monthLabels = MONTH_LABELS[locale];
|
|
1552
|
+
const titleText = pickerMode === "days" ? locale === "ko" ? `${year}\uB144 ${monthLabels[month]}` : `${monthLabels[month]} ${year}` : pickerMode === "months" ? `${year}` : `${yearRangeStart} - ${yearRangeStart + 11}`;
|
|
1522
1553
|
return /* @__PURE__ */ (0, import_jsx_runtime298.jsxs)(
|
|
1523
1554
|
"div",
|
|
1524
1555
|
{
|
|
@@ -1526,41 +1557,66 @@ var SingleDatePicker = (props) => {
|
|
|
1526
1557
|
style: { "--datepicker-active-color": `var(--${color})` },
|
|
1527
1558
|
children: [
|
|
1528
1559
|
/* @__PURE__ */ (0, import_jsx_runtime298.jsxs)("div", { className: "datepicker-header", children: [
|
|
1529
|
-
/* @__PURE__ */ (0, import_jsx_runtime298.jsx)("button", { className: "datepicker-nav", onClick:
|
|
1530
|
-
/* @__PURE__ */ (0, import_jsx_runtime298.jsx)("
|
|
1531
|
-
/* @__PURE__ */ (0, import_jsx_runtime298.jsx)("button", { className: "datepicker-nav", onClick:
|
|
1560
|
+
/* @__PURE__ */ (0, import_jsx_runtime298.jsx)("button", { className: "datepicker-nav", onClick: handlePrev, type: "button", children: /* @__PURE__ */ (0, import_jsx_runtime298.jsx)(ChevronLeftIcon_default, {}) }),
|
|
1561
|
+
/* @__PURE__ */ (0, import_jsx_runtime298.jsx)("button", { className: "datepicker-title", onClick: handleTitleClick, type: "button", children: titleText }),
|
|
1562
|
+
/* @__PURE__ */ (0, import_jsx_runtime298.jsx)("button", { className: "datepicker-nav", onClick: handleNext, type: "button", children: /* @__PURE__ */ (0, import_jsx_runtime298.jsx)(ChevronRightIcon_default, {}) })
|
|
1532
1563
|
] }),
|
|
1533
|
-
/* @__PURE__ */ (0, import_jsx_runtime298.jsx)("div", { className: "datepicker-
|
|
1534
|
-
|
|
1564
|
+
pickerMode === "years" && /* @__PURE__ */ (0, import_jsx_runtime298.jsx)("div", { className: "datepicker-picker-grid", children: Array.from({ length: 12 }, (_, i) => {
|
|
1565
|
+
const y = yearRangeStart + i;
|
|
1566
|
+
return /* @__PURE__ */ (0, import_jsx_runtime298.jsx)(
|
|
1567
|
+
"button",
|
|
1568
|
+
{
|
|
1569
|
+
type: "button",
|
|
1570
|
+
className: clsx_default("datepicker-picker-cell", y === year && "active"),
|
|
1571
|
+
onClick: () => handleYearSelect(y),
|
|
1572
|
+
children: y
|
|
1573
|
+
},
|
|
1574
|
+
y
|
|
1575
|
+
);
|
|
1576
|
+
}) }),
|
|
1577
|
+
pickerMode === "months" && /* @__PURE__ */ (0, import_jsx_runtime298.jsx)("div", { className: "datepicker-picker-grid", children: monthLabels.map((label, i) => /* @__PURE__ */ (0, import_jsx_runtime298.jsx)(
|
|
1578
|
+
"button",
|
|
1535
1579
|
{
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
i === 6 && "saturday"
|
|
1540
|
-
),
|
|
1580
|
+
type: "button",
|
|
1581
|
+
className: clsx_default("datepicker-picker-cell", i === month && "active"),
|
|
1582
|
+
onClick: () => handleMonthSelect(i),
|
|
1541
1583
|
children: label
|
|
1542
1584
|
},
|
|
1543
|
-
|
|
1585
|
+
i
|
|
1544
1586
|
)) }),
|
|
1545
|
-
/* @__PURE__ */ (0, import_jsx_runtime298.
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
const selected = value ? isSameDay(day.date, value) : false;
|
|
1549
|
-
const highlighted = highlightSet.has(
|
|
1550
|
-
`${day.date.getFullYear()}-${day.date.getMonth()}-${day.date.getDate()}`
|
|
1551
|
-
);
|
|
1552
|
-
return /* @__PURE__ */ (0, import_jsx_runtime298.jsx)(
|
|
1553
|
-
DayCell,
|
|
1587
|
+
pickerMode === "days" && /* @__PURE__ */ (0, import_jsx_runtime298.jsxs)(import_jsx_runtime298.Fragment, { children: [
|
|
1588
|
+
/* @__PURE__ */ (0, import_jsx_runtime298.jsx)("div", { className: "datepicker-weekdays", children: weekdays.map((label, i) => /* @__PURE__ */ (0, import_jsx_runtime298.jsx)(
|
|
1589
|
+
"div",
|
|
1554
1590
|
{
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1591
|
+
className: clsx_default(
|
|
1592
|
+
"datepicker-weekday",
|
|
1593
|
+
i === 0 && "sunday",
|
|
1594
|
+
i === 6 && "saturday"
|
|
1595
|
+
),
|
|
1596
|
+
children: label
|
|
1560
1597
|
},
|
|
1561
|
-
|
|
1562
|
-
)
|
|
1563
|
-
|
|
1598
|
+
label
|
|
1599
|
+
)) }),
|
|
1600
|
+
/* @__PURE__ */ (0, import_jsx_runtime298.jsx)("div", { className: "datepicker-grid", children: days.map((day, idx) => {
|
|
1601
|
+
const t = day.date.getTime();
|
|
1602
|
+
const disabled = t < minTime || t > maxTime;
|
|
1603
|
+
const selected = value ? isSameDay(day.date, value) : false;
|
|
1604
|
+
const highlighted = highlightSet.has(
|
|
1605
|
+
`${day.date.getFullYear()}-${day.date.getMonth()}-${day.date.getDate()}`
|
|
1606
|
+
);
|
|
1607
|
+
return /* @__PURE__ */ (0, import_jsx_runtime298.jsx)(
|
|
1608
|
+
DayCell,
|
|
1609
|
+
{
|
|
1610
|
+
day,
|
|
1611
|
+
disabled,
|
|
1612
|
+
selected,
|
|
1613
|
+
highlighted,
|
|
1614
|
+
onSelect: handleSelect
|
|
1615
|
+
},
|
|
1616
|
+
idx
|
|
1617
|
+
);
|
|
1618
|
+
}) })
|
|
1619
|
+
] })
|
|
1564
1620
|
]
|
|
1565
1621
|
}
|
|
1566
1622
|
);
|
|
@@ -1701,9 +1757,24 @@ var RangePicker = (props) => {
|
|
|
1701
1757
|
} = props;
|
|
1702
1758
|
const startCal = useCalendar(startDate.getFullYear(), startDate.getMonth());
|
|
1703
1759
|
const endCal = useCalendar(endDate.getFullYear(), endDate.getMonth());
|
|
1704
|
-
const isDisabled = (date) => {
|
|
1705
|
-
|
|
1706
|
-
if (
|
|
1760
|
+
const isDisabled = (date, type) => {
|
|
1761
|
+
const d = date.getTime();
|
|
1762
|
+
if (minDate) {
|
|
1763
|
+
const min = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate()).getTime();
|
|
1764
|
+
if (d < min) return true;
|
|
1765
|
+
}
|
|
1766
|
+
if (maxDate) {
|
|
1767
|
+
const max = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate()).getTime();
|
|
1768
|
+
if (d > max) return true;
|
|
1769
|
+
}
|
|
1770
|
+
if (type === "end") {
|
|
1771
|
+
const start = new Date(startDate.getFullYear(), startDate.getMonth(), startDate.getDate()).getTime();
|
|
1772
|
+
if (d < start) return true;
|
|
1773
|
+
}
|
|
1774
|
+
if (type === "start") {
|
|
1775
|
+
const end = new Date(endDate.getFullYear(), endDate.getMonth(), endDate.getDate()).getTime();
|
|
1776
|
+
if (d > end) return true;
|
|
1777
|
+
}
|
|
1707
1778
|
return false;
|
|
1708
1779
|
};
|
|
1709
1780
|
const weekdays = WEEKDAY_LABELS[locale];
|
|
@@ -1712,9 +1783,25 @@ var RangePicker = (props) => {
|
|
|
1712
1783
|
return /* @__PURE__ */ (0, import_jsx_runtime302.jsxs)("div", { className: "datepicker-range-panel", children: [
|
|
1713
1784
|
/* @__PURE__ */ (0, import_jsx_runtime302.jsx)("span", { className: "datepicker-range-label", children: label }),
|
|
1714
1785
|
/* @__PURE__ */ (0, import_jsx_runtime302.jsxs)("div", { className: "datepicker-header", children: [
|
|
1715
|
-
/* @__PURE__ */ (0, import_jsx_runtime302.jsx)(
|
|
1786
|
+
/* @__PURE__ */ (0, import_jsx_runtime302.jsx)(
|
|
1787
|
+
"button",
|
|
1788
|
+
{
|
|
1789
|
+
className: "datepicker-nav",
|
|
1790
|
+
onClick: cal.goToPrevMonth,
|
|
1791
|
+
type: "button",
|
|
1792
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime302.jsx)(ChevronLeftIcon_default, {})
|
|
1793
|
+
}
|
|
1794
|
+
),
|
|
1716
1795
|
/* @__PURE__ */ (0, import_jsx_runtime302.jsx)("span", { className: "datepicker-title", children: locale === "ko" ? `${cal.year}\uB144 ${MONTH_LABELS.ko[cal.month]}` : `${MONTH_LABELS.en[cal.month]} ${cal.year}` }),
|
|
1717
|
-
/* @__PURE__ */ (0, import_jsx_runtime302.jsx)(
|
|
1796
|
+
/* @__PURE__ */ (0, import_jsx_runtime302.jsx)(
|
|
1797
|
+
"button",
|
|
1798
|
+
{
|
|
1799
|
+
className: "datepicker-nav",
|
|
1800
|
+
onClick: cal.goToNextMonth,
|
|
1801
|
+
type: "button",
|
|
1802
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime302.jsx)(ChevronRightIcon_default, {})
|
|
1803
|
+
}
|
|
1804
|
+
)
|
|
1718
1805
|
] }),
|
|
1719
1806
|
/* @__PURE__ */ (0, import_jsx_runtime302.jsx)("div", { className: "datepicker-weekdays", children: weekdays.map((w, i) => /* @__PURE__ */ (0, import_jsx_runtime302.jsx)(
|
|
1720
1807
|
"div",
|
|
@@ -1729,7 +1816,7 @@ var RangePicker = (props) => {
|
|
|
1729
1816
|
w
|
|
1730
1817
|
)) }),
|
|
1731
1818
|
/* @__PURE__ */ (0, import_jsx_runtime302.jsx)("div", { className: "datepicker-grid", children: cal.days.map((day, idx) => {
|
|
1732
|
-
const disabled = isDisabled(day.date);
|
|
1819
|
+
const disabled = isDisabled(day.date, type);
|
|
1733
1820
|
const isStart = isSameDay(day.date, startDate);
|
|
1734
1821
|
const isEnd = isSameDay(day.date, endDate);
|
|
1735
1822
|
const inRange = isInRange(day.date, startDate, endDate);
|
|
@@ -1770,7 +1857,9 @@ var RangePicker = (props) => {
|
|
|
1770
1857
|
"div",
|
|
1771
1858
|
{
|
|
1772
1859
|
className: clsx_default("lib-xplat-datepicker", "range"),
|
|
1773
|
-
style: {
|
|
1860
|
+
style: {
|
|
1861
|
+
"--datepicker-active-color": `var(--${color})`
|
|
1862
|
+
},
|
|
1774
1863
|
children: [
|
|
1775
1864
|
renderCalendar(startCal, "start"),
|
|
1776
1865
|
renderCalendar(endCal, "end")
|
|
@@ -1795,7 +1884,7 @@ var PopupPicker = (props) => {
|
|
|
1795
1884
|
};
|
|
1796
1885
|
return /* @__PURE__ */ (0, import_jsx_runtime303.jsxs)("div", { className: "lib-xplat-popup-datepicker", children: [
|
|
1797
1886
|
import_react9.default.cloneElement(component, { onClick: handleClick }),
|
|
1798
|
-
/* @__PURE__ */ (0, import_jsx_runtime303.jsx)(Modal_default, { isOpen, onClose: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime303.jsxs)("div", { className: "lib-xplat-popup-datepicker-card", children: [
|
|
1887
|
+
/* @__PURE__ */ (0, import_jsx_runtime303.jsx)(Modal_default, { isOpen, onClose: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime303.jsxs)("div", { className: clsx_default("lib-xplat-popup-datepicker-card", type === "range" && "range-mode"), children: [
|
|
1799
1888
|
/* @__PURE__ */ (0, import_jsx_runtime303.jsxs)("div", { className: "popup-datepicker-content", children: [
|
|
1800
1889
|
type === "single" && /* @__PURE__ */ (0, import_jsx_runtime303.jsx)(
|
|
1801
1890
|
SingleDatePicker_default,
|
|
@@ -88,7 +88,8 @@
|
|
|
88
88
|
.lib-xplat-datepicker {
|
|
89
89
|
user-select: none;
|
|
90
90
|
container-type: inline-size;
|
|
91
|
-
width:
|
|
91
|
+
min-width: 200px;
|
|
92
|
+
width: 100%;
|
|
92
93
|
}
|
|
93
94
|
.lib-xplat-datepicker .datepicker-header {
|
|
94
95
|
display: flex;
|
|
@@ -98,12 +99,48 @@
|
|
|
98
99
|
margin-bottom: 0.75rem;
|
|
99
100
|
}
|
|
100
101
|
.lib-xplat-datepicker .datepicker-title {
|
|
102
|
+
background: none;
|
|
103
|
+
border: none;
|
|
104
|
+
cursor: pointer;
|
|
105
|
+
padding: 0.25rem 0.5rem;
|
|
106
|
+
border-radius: 0.375rem;
|
|
107
|
+
transition: background-color 0.15s;
|
|
101
108
|
font-size: clamp(0.8125rem, 3cqi, 1.125rem);
|
|
102
109
|
font-weight: 600;
|
|
103
110
|
color: var(--xplat-neutral-900);
|
|
104
111
|
min-width: 110px;
|
|
105
112
|
text-align: center;
|
|
106
113
|
}
|
|
114
|
+
.lib-xplat-datepicker .datepicker-title:hover {
|
|
115
|
+
background-color: var(--xplat-neutral-100);
|
|
116
|
+
}
|
|
117
|
+
.lib-xplat-datepicker .datepicker-picker-grid {
|
|
118
|
+
display: grid;
|
|
119
|
+
grid-template-columns: repeat(3, 1fr);
|
|
120
|
+
gap: 0.25rem;
|
|
121
|
+
padding: 0.25rem 0;
|
|
122
|
+
}
|
|
123
|
+
.lib-xplat-datepicker .datepicker-picker-cell {
|
|
124
|
+
display: flex;
|
|
125
|
+
align-items: center;
|
|
126
|
+
justify-content: center;
|
|
127
|
+
padding: 0.375rem;
|
|
128
|
+
border: none;
|
|
129
|
+
border-radius: 0.375rem;
|
|
130
|
+
background: none;
|
|
131
|
+
font-size: clamp(0.6875rem, 2cqi, 0.8125rem);
|
|
132
|
+
color: var(--xplat-neutral-700);
|
|
133
|
+
cursor: pointer;
|
|
134
|
+
transition: background-color 0.15s;
|
|
135
|
+
}
|
|
136
|
+
.lib-xplat-datepicker .datepicker-picker-cell:hover {
|
|
137
|
+
background-color: var(--xplat-neutral-100);
|
|
138
|
+
}
|
|
139
|
+
.lib-xplat-datepicker .datepicker-picker-cell.active {
|
|
140
|
+
background-color: var(--datepicker-active-color, var(--xplat-blue-500));
|
|
141
|
+
color: var(--xplat-white);
|
|
142
|
+
font-weight: 600;
|
|
143
|
+
}
|
|
107
144
|
.lib-xplat-datepicker .datepicker-nav {
|
|
108
145
|
display: flex;
|
|
109
146
|
align-items: center;
|
|
@@ -197,20 +234,27 @@
|
|
|
197
234
|
background-color: color-mix(in srgb, var(--datepicker-active-color, var(--xplat-blue-500)) 12%, transparent);
|
|
198
235
|
border-radius: 0;
|
|
199
236
|
}
|
|
200
|
-
.lib-xplat-datepicker .datepicker-day.sunday:not(.selected):not(.outside) {
|
|
237
|
+
.lib-xplat-datepicker .datepicker-day.sunday:not(.selected):not(.outside):not(.disabled) {
|
|
201
238
|
color: var(--xplat-red-500);
|
|
202
239
|
}
|
|
203
|
-
.lib-xplat-datepicker .datepicker-day.saturday:not(.selected):not(.outside) {
|
|
240
|
+
.lib-xplat-datepicker .datepicker-day.saturday:not(.selected):not(.outside):not(.disabled) {
|
|
204
241
|
color: var(--xplat-blue-500);
|
|
205
242
|
}
|
|
243
|
+
.lib-xplat-datepicker .datepicker-day.outside.sunday,
|
|
244
|
+
.lib-xplat-datepicker .datepicker-day.disabled.sunday {
|
|
245
|
+
color: color-mix(in srgb, var(--xplat-red-500) 35%, transparent);
|
|
246
|
+
}
|
|
247
|
+
.lib-xplat-datepicker .datepicker-day.outside.saturday,
|
|
248
|
+
.lib-xplat-datepicker .datepicker-day.disabled.saturday {
|
|
249
|
+
color: color-mix(in srgb, var(--xplat-blue-500) 35%, transparent);
|
|
250
|
+
}
|
|
206
251
|
.lib-xplat-datepicker.range {
|
|
207
252
|
display: flex;
|
|
208
253
|
gap: 1.5rem;
|
|
209
|
-
width: auto;
|
|
210
254
|
}
|
|
211
255
|
.lib-xplat-datepicker .datepicker-range-panel {
|
|
212
|
-
|
|
213
|
-
|
|
256
|
+
flex: 1;
|
|
257
|
+
min-width: 200px;
|
|
214
258
|
}
|
|
215
259
|
.lib-xplat-datepicker .datepicker-range-label {
|
|
216
260
|
display: block;
|
|
@@ -222,7 +266,6 @@
|
|
|
222
266
|
}
|
|
223
267
|
.lib-xplat-datepicker.input-datepicker {
|
|
224
268
|
position: relative;
|
|
225
|
-
width: auto;
|
|
226
269
|
}
|
|
227
270
|
.lib-xplat-datepicker.input-datepicker .input-datepicker-dropdown {
|
|
228
271
|
position: absolute;
|
|
@@ -304,7 +347,7 @@
|
|
|
304
347
|
padding: 24px;
|
|
305
348
|
max-width: calc(100vw - 2rem);
|
|
306
349
|
max-height: calc(100vh - 2rem);
|
|
307
|
-
overflow:
|
|
350
|
+
overflow: visible;
|
|
308
351
|
transform: scale(0.9);
|
|
309
352
|
opacity: 0;
|
|
310
353
|
transition: transform 0.2s ease, opacity 0.2s ease;
|