@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/index.cjs
CHANGED
|
@@ -6197,6 +6197,10 @@ var Calendar = (props) => {
|
|
|
6197
6197
|
setYear,
|
|
6198
6198
|
setMonth
|
|
6199
6199
|
} = useCalendar(yearProp, monthProp);
|
|
6200
|
+
const [pickerMode, setPickerMode] = import_react3.default.useState("days");
|
|
6201
|
+
const [yearRangeStart, setYearRangeStart] = import_react3.default.useState(
|
|
6202
|
+
Math.floor(year / 12) * 12
|
|
6203
|
+
);
|
|
6200
6204
|
import_react3.default.useEffect(() => {
|
|
6201
6205
|
if (yearProp !== void 0) setYear(yearProp);
|
|
6202
6206
|
}, [yearProp, setYear]);
|
|
@@ -6204,22 +6208,54 @@ var Calendar = (props) => {
|
|
|
6204
6208
|
if (monthProp !== void 0) setMonth(monthProp);
|
|
6205
6209
|
}, [monthProp, setMonth]);
|
|
6206
6210
|
const handlePrev = () => {
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
+
if (pickerMode === "days") {
|
|
6212
|
+
goToPrevMonth();
|
|
6213
|
+
const prevMonth = month === 0 ? 11 : month - 1;
|
|
6214
|
+
const prevYear = month === 0 ? year - 1 : year;
|
|
6215
|
+
onMonthChange?.(prevYear, prevMonth);
|
|
6216
|
+
} else if (pickerMode === "months") {
|
|
6217
|
+
setYear(year - 1);
|
|
6218
|
+
onMonthChange?.(year - 1, month);
|
|
6219
|
+
} else {
|
|
6220
|
+
setYearRangeStart((s) => s - 12);
|
|
6221
|
+
}
|
|
6211
6222
|
};
|
|
6212
6223
|
const handleNext = () => {
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6224
|
+
if (pickerMode === "days") {
|
|
6225
|
+
goToNextMonth();
|
|
6226
|
+
const nextMonth = month === 11 ? 0 : month + 1;
|
|
6227
|
+
const nextYear = month === 11 ? year + 1 : year;
|
|
6228
|
+
onMonthChange?.(nextYear, nextMonth);
|
|
6229
|
+
} else if (pickerMode === "months") {
|
|
6230
|
+
setYear(year + 1);
|
|
6231
|
+
onMonthChange?.(year + 1, month);
|
|
6232
|
+
} else {
|
|
6233
|
+
setYearRangeStart((s) => s + 12);
|
|
6234
|
+
}
|
|
6217
6235
|
};
|
|
6218
6236
|
const handleToday = () => {
|
|
6219
6237
|
goToToday();
|
|
6238
|
+
setPickerMode("days");
|
|
6220
6239
|
const today = /* @__PURE__ */ new Date();
|
|
6221
6240
|
onMonthChange?.(today.getFullYear(), today.getMonth());
|
|
6222
6241
|
};
|
|
6242
|
+
const handleTitleClick = () => {
|
|
6243
|
+
if (pickerMode === "days") setPickerMode("months");
|
|
6244
|
+
else if (pickerMode === "months") {
|
|
6245
|
+
setYearRangeStart(Math.floor(year / 12) * 12);
|
|
6246
|
+
setPickerMode("years");
|
|
6247
|
+
}
|
|
6248
|
+
};
|
|
6249
|
+
const handleMonthSelect = (m) => {
|
|
6250
|
+
setMonth(m);
|
|
6251
|
+
setPickerMode("days");
|
|
6252
|
+
onMonthChange?.(year, m);
|
|
6253
|
+
};
|
|
6254
|
+
const handleYearSelect = (y) => {
|
|
6255
|
+
setYear(y);
|
|
6256
|
+
setPickerMode("months");
|
|
6257
|
+
onMonthChange?.(y, month);
|
|
6258
|
+
};
|
|
6223
6259
|
const isDisabled = (date) => {
|
|
6224
6260
|
if (minDate && date < new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate())) return true;
|
|
6225
6261
|
if (maxDate && date > new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate())) return true;
|
|
@@ -6227,6 +6263,8 @@ var Calendar = (props) => {
|
|
|
6227
6263
|
};
|
|
6228
6264
|
const getEventsForDay = (date) => events.filter((e) => isSameDay(e.date, date));
|
|
6229
6265
|
const weekdays = WEEKDAY_LABELS[locale];
|
|
6266
|
+
const monthLabels = MONTH_LABELS[locale];
|
|
6267
|
+
const titleText = pickerMode === "days" ? locale === "ko" ? `${year}\uB144 ${monthLabels[month]}` : `${monthLabels[month]} ${year}` : pickerMode === "months" ? `${year}` : `${yearRangeStart} - ${yearRangeStart + 11}`;
|
|
6230
6268
|
return /* @__PURE__ */ (0, import_jsx_runtime301.jsxs)(
|
|
6231
6269
|
"div",
|
|
6232
6270
|
{
|
|
@@ -6234,29 +6272,71 @@ var Calendar = (props) => {
|
|
|
6234
6272
|
style: selectedColor ? { "--calendar-selected-color": `var(--${selectedColor})` } : void 0,
|
|
6235
6273
|
children: [
|
|
6236
6274
|
/* @__PURE__ */ (0, import_jsx_runtime301.jsxs)("div", { className: "calendar-header", children: [
|
|
6237
|
-
/* @__PURE__ */ (0, import_jsx_runtime301.jsx)("button", { className: "calendar-nav", onClick: handlePrev, "aria-label": "\uC774\uC804
|
|
6238
|
-
/* @__PURE__ */ (0, import_jsx_runtime301.jsx)("
|
|
6239
|
-
/* @__PURE__ */ (0, import_jsx_runtime301.jsx)("button", { className: "calendar-nav", onClick: handleNext, "aria-label": "\uB2E4\uC74C
|
|
6275
|
+
/* @__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, {}) }),
|
|
6276
|
+
/* @__PURE__ */ (0, import_jsx_runtime301.jsx)("button", { className: "calendar-title", onClick: handleTitleClick, type: "button", children: titleText }),
|
|
6277
|
+
/* @__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, {}) }),
|
|
6240
6278
|
showToday && /* @__PURE__ */ (0, import_jsx_runtime301.jsx)("button", { className: "calendar-today-btn", onClick: handleToday, children: locale === "ko" ? "\uC624\uB298" : "Today" })
|
|
6241
6279
|
] }),
|
|
6242
|
-
/* @__PURE__ */ (0, import_jsx_runtime301.jsx)("div", { className: "calendar-
|
|
6243
|
-
|
|
6280
|
+
pickerMode === "years" && /* @__PURE__ */ (0, import_jsx_runtime301.jsx)("div", { className: "calendar-picker-grid", children: Array.from({ length: 12 }, (_, i) => {
|
|
6281
|
+
const y = yearRangeStart + i;
|
|
6282
|
+
return /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(
|
|
6283
|
+
"button",
|
|
6284
|
+
{
|
|
6285
|
+
type: "button",
|
|
6286
|
+
className: clsx_default("calendar-picker-cell", y === year && "active"),
|
|
6287
|
+
onClick: () => handleYearSelect(y),
|
|
6288
|
+
children: y
|
|
6289
|
+
},
|
|
6290
|
+
y
|
|
6291
|
+
);
|
|
6292
|
+
}) }),
|
|
6293
|
+
pickerMode === "months" && /* @__PURE__ */ (0, import_jsx_runtime301.jsx)("div", { className: "calendar-picker-grid", children: monthLabels.map((label, i) => /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(
|
|
6294
|
+
"button",
|
|
6244
6295
|
{
|
|
6245
|
-
|
|
6246
|
-
|
|
6247
|
-
|
|
6248
|
-
i === 6 && "saturday"
|
|
6249
|
-
),
|
|
6296
|
+
type: "button",
|
|
6297
|
+
className: clsx_default("calendar-picker-cell", i === month && "active"),
|
|
6298
|
+
onClick: () => handleMonthSelect(i),
|
|
6250
6299
|
children: label
|
|
6251
6300
|
},
|
|
6252
|
-
|
|
6301
|
+
i
|
|
6253
6302
|
)) }),
|
|
6254
|
-
/* @__PURE__ */ (0, import_jsx_runtime301.
|
|
6255
|
-
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6303
|
+
pickerMode === "days" && /* @__PURE__ */ (0, import_jsx_runtime301.jsxs)(import_jsx_runtime301.Fragment, { children: [
|
|
6304
|
+
/* @__PURE__ */ (0, import_jsx_runtime301.jsx)("div", { className: "calendar-weekdays", children: weekdays.map((label, i) => /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(
|
|
6305
|
+
"div",
|
|
6306
|
+
{
|
|
6307
|
+
className: clsx_default(
|
|
6308
|
+
"calendar-weekday",
|
|
6309
|
+
i === 0 && "sunday",
|
|
6310
|
+
i === 6 && "saturday"
|
|
6311
|
+
),
|
|
6312
|
+
children: label
|
|
6313
|
+
},
|
|
6314
|
+
label
|
|
6315
|
+
)) }),
|
|
6316
|
+
/* @__PURE__ */ (0, import_jsx_runtime301.jsx)("div", { className: "calendar-grid", children: days.map((day, idx) => {
|
|
6317
|
+
const dayEvents = getEventsForDay(day.date);
|
|
6318
|
+
const disabled = isDisabled(day.date);
|
|
6319
|
+
const isSelected = selectedDate ? isSameDay(day.date, selectedDate) : false;
|
|
6320
|
+
if (renderDay) {
|
|
6321
|
+
return /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(
|
|
6322
|
+
"div",
|
|
6323
|
+
{
|
|
6324
|
+
className: clsx_default(
|
|
6325
|
+
"calendar-day",
|
|
6326
|
+
!day.isCurrentMonth && "outside",
|
|
6327
|
+
disabled && "disabled",
|
|
6328
|
+
isSelected && "selected",
|
|
6329
|
+
day.isToday && "today"
|
|
6330
|
+
),
|
|
6331
|
+
onClick: () => {
|
|
6332
|
+
if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
|
|
6333
|
+
},
|
|
6334
|
+
children: renderDay(day, dayEvents)
|
|
6335
|
+
},
|
|
6336
|
+
idx
|
|
6337
|
+
);
|
|
6338
|
+
}
|
|
6339
|
+
return /* @__PURE__ */ (0, import_jsx_runtime301.jsxs)(
|
|
6260
6340
|
"div",
|
|
6261
6341
|
{
|
|
6262
6342
|
className: clsx_default(
|
|
@@ -6264,57 +6344,40 @@ var Calendar = (props) => {
|
|
|
6264
6344
|
!day.isCurrentMonth && "outside",
|
|
6265
6345
|
disabled && "disabled",
|
|
6266
6346
|
isSelected && "selected",
|
|
6267
|
-
day.isToday && "today"
|
|
6347
|
+
day.isToday && "today",
|
|
6348
|
+
day.isSunday && "sunday",
|
|
6349
|
+
day.isSaturday && "saturday"
|
|
6268
6350
|
),
|
|
6269
6351
|
onClick: () => {
|
|
6270
6352
|
if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
|
|
6271
6353
|
},
|
|
6272
|
-
children:
|
|
6354
|
+
children: [
|
|
6355
|
+
/* @__PURE__ */ (0, import_jsx_runtime301.jsx)("span", { className: "calendar-day-number", children: day.day }),
|
|
6356
|
+
dayEvents.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime301.jsxs)("div", { className: "calendar-day-events", children: [
|
|
6357
|
+
dayEvents.slice(0, 3).map((event, ei) => /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(
|
|
6358
|
+
"span",
|
|
6359
|
+
{
|
|
6360
|
+
className: "calendar-event-dot",
|
|
6361
|
+
style: { backgroundColor: event.color ?? "var(--xplat-blue-500)" },
|
|
6362
|
+
title: event.label,
|
|
6363
|
+
onClick: (e) => {
|
|
6364
|
+
e.stopPropagation();
|
|
6365
|
+
onEventClick?.(event);
|
|
6366
|
+
}
|
|
6367
|
+
},
|
|
6368
|
+
ei
|
|
6369
|
+
)),
|
|
6370
|
+
dayEvents.length > 3 && /* @__PURE__ */ (0, import_jsx_runtime301.jsxs)("span", { className: "calendar-event-more", children: [
|
|
6371
|
+
"+",
|
|
6372
|
+
dayEvents.length - 3
|
|
6373
|
+
] })
|
|
6374
|
+
] })
|
|
6375
|
+
]
|
|
6273
6376
|
},
|
|
6274
6377
|
idx
|
|
6275
6378
|
);
|
|
6276
|
-
}
|
|
6277
|
-
|
|
6278
|
-
"div",
|
|
6279
|
-
{
|
|
6280
|
-
className: clsx_default(
|
|
6281
|
-
"calendar-day",
|
|
6282
|
-
!day.isCurrentMonth && "outside",
|
|
6283
|
-
disabled && "disabled",
|
|
6284
|
-
isSelected && "selected",
|
|
6285
|
-
day.isToday && "today",
|
|
6286
|
-
day.isSunday && "sunday",
|
|
6287
|
-
day.isSaturday && "saturday"
|
|
6288
|
-
),
|
|
6289
|
-
onClick: () => {
|
|
6290
|
-
if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
|
|
6291
|
-
},
|
|
6292
|
-
children: [
|
|
6293
|
-
/* @__PURE__ */ (0, import_jsx_runtime301.jsx)("span", { className: "calendar-day-number", children: day.day }),
|
|
6294
|
-
dayEvents.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime301.jsxs)("div", { className: "calendar-day-events", children: [
|
|
6295
|
-
dayEvents.slice(0, 3).map((event, ei) => /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(
|
|
6296
|
-
"span",
|
|
6297
|
-
{
|
|
6298
|
-
className: "calendar-event-dot",
|
|
6299
|
-
style: { backgroundColor: event.color ?? "var(--xplat-blue-500)" },
|
|
6300
|
-
title: event.label,
|
|
6301
|
-
onClick: (e) => {
|
|
6302
|
-
e.stopPropagation();
|
|
6303
|
-
onEventClick?.(event);
|
|
6304
|
-
}
|
|
6305
|
-
},
|
|
6306
|
-
ei
|
|
6307
|
-
)),
|
|
6308
|
-
dayEvents.length > 3 && /* @__PURE__ */ (0, import_jsx_runtime301.jsxs)("span", { className: "calendar-event-more", children: [
|
|
6309
|
-
"+",
|
|
6310
|
-
dayEvents.length - 3
|
|
6311
|
-
] })
|
|
6312
|
-
] })
|
|
6313
|
-
]
|
|
6314
|
-
},
|
|
6315
|
-
idx
|
|
6316
|
-
);
|
|
6317
|
-
}) })
|
|
6379
|
+
}) })
|
|
6380
|
+
] })
|
|
6318
6381
|
]
|
|
6319
6382
|
}
|
|
6320
6383
|
);
|
|
@@ -21252,10 +21315,14 @@ var SingleDatePicker = (props) => {
|
|
|
21252
21315
|
} = props;
|
|
21253
21316
|
const initialYear = value?.getFullYear();
|
|
21254
21317
|
const initialMonth = value?.getMonth();
|
|
21255
|
-
const { year, month, days, goToPrevMonth, goToNextMonth } = useCalendar(
|
|
21318
|
+
const { year, month, days, goToPrevMonth, goToNextMonth, setYear, setMonth } = useCalendar(
|
|
21256
21319
|
initialYear,
|
|
21257
21320
|
initialMonth
|
|
21258
21321
|
);
|
|
21322
|
+
const [pickerMode, setPickerMode] = import_react11.default.useState("days");
|
|
21323
|
+
const [yearRangeStart, setYearRangeStart] = import_react11.default.useState(
|
|
21324
|
+
Math.floor((initialYear ?? (/* @__PURE__ */ new Date()).getFullYear()) / 12) * 12
|
|
21325
|
+
);
|
|
21259
21326
|
const minTime = import_react11.default.useMemo(
|
|
21260
21327
|
() => minDate ? new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate()).getTime() : -Infinity,
|
|
21261
21328
|
[minDate]
|
|
@@ -21277,7 +21344,34 @@ var SingleDatePicker = (props) => {
|
|
|
21277
21344
|
},
|
|
21278
21345
|
[onChange]
|
|
21279
21346
|
);
|
|
21347
|
+
const handlePrev = () => {
|
|
21348
|
+
if (pickerMode === "days") goToPrevMonth();
|
|
21349
|
+
else if (pickerMode === "months") setYear(year - 1);
|
|
21350
|
+
else setYearRangeStart((s) => s - 12);
|
|
21351
|
+
};
|
|
21352
|
+
const handleNext = () => {
|
|
21353
|
+
if (pickerMode === "days") goToNextMonth();
|
|
21354
|
+
else if (pickerMode === "months") setYear(year + 1);
|
|
21355
|
+
else setYearRangeStart((s) => s + 12);
|
|
21356
|
+
};
|
|
21357
|
+
const handleTitleClick = () => {
|
|
21358
|
+
if (pickerMode === "days") setPickerMode("months");
|
|
21359
|
+
else if (pickerMode === "months") {
|
|
21360
|
+
setYearRangeStart(Math.floor(year / 12) * 12);
|
|
21361
|
+
setPickerMode("years");
|
|
21362
|
+
}
|
|
21363
|
+
};
|
|
21364
|
+
const handleMonthSelect = (m) => {
|
|
21365
|
+
setMonth(m);
|
|
21366
|
+
setPickerMode("days");
|
|
21367
|
+
};
|
|
21368
|
+
const handleYearSelect = (y) => {
|
|
21369
|
+
setYear(y);
|
|
21370
|
+
setPickerMode("months");
|
|
21371
|
+
};
|
|
21280
21372
|
const weekdays = WEEKDAY_LABELS[locale];
|
|
21373
|
+
const monthLabels = MONTH_LABELS[locale];
|
|
21374
|
+
const titleText = pickerMode === "days" ? locale === "ko" ? `${year}\uB144 ${monthLabels[month]}` : `${monthLabels[month]} ${year}` : pickerMode === "months" ? `${year}` : `${yearRangeStart} - ${yearRangeStart + 11}`;
|
|
21281
21375
|
return /* @__PURE__ */ (0, import_jsx_runtime312.jsxs)(
|
|
21282
21376
|
"div",
|
|
21283
21377
|
{
|
|
@@ -21285,41 +21379,66 @@ var SingleDatePicker = (props) => {
|
|
|
21285
21379
|
style: { "--datepicker-active-color": `var(--${color2})` },
|
|
21286
21380
|
children: [
|
|
21287
21381
|
/* @__PURE__ */ (0, import_jsx_runtime312.jsxs)("div", { className: "datepicker-header", children: [
|
|
21288
|
-
/* @__PURE__ */ (0, import_jsx_runtime312.jsx)("button", { className: "datepicker-nav", onClick:
|
|
21289
|
-
/* @__PURE__ */ (0, import_jsx_runtime312.jsx)("
|
|
21290
|
-
/* @__PURE__ */ (0, import_jsx_runtime312.jsx)("button", { className: "datepicker-nav", onClick:
|
|
21382
|
+
/* @__PURE__ */ (0, import_jsx_runtime312.jsx)("button", { className: "datepicker-nav", onClick: handlePrev, type: "button", children: /* @__PURE__ */ (0, import_jsx_runtime312.jsx)(ChevronLeftIcon_default, {}) }),
|
|
21383
|
+
/* @__PURE__ */ (0, import_jsx_runtime312.jsx)("button", { className: "datepicker-title", onClick: handleTitleClick, type: "button", children: titleText }),
|
|
21384
|
+
/* @__PURE__ */ (0, import_jsx_runtime312.jsx)("button", { className: "datepicker-nav", onClick: handleNext, type: "button", children: /* @__PURE__ */ (0, import_jsx_runtime312.jsx)(ChevronRightIcon_default, {}) })
|
|
21291
21385
|
] }),
|
|
21292
|
-
/* @__PURE__ */ (0, import_jsx_runtime312.jsx)("div", { className: "datepicker-
|
|
21293
|
-
|
|
21386
|
+
pickerMode === "years" && /* @__PURE__ */ (0, import_jsx_runtime312.jsx)("div", { className: "datepicker-picker-grid", children: Array.from({ length: 12 }, (_, i) => {
|
|
21387
|
+
const y = yearRangeStart + i;
|
|
21388
|
+
return /* @__PURE__ */ (0, import_jsx_runtime312.jsx)(
|
|
21389
|
+
"button",
|
|
21390
|
+
{
|
|
21391
|
+
type: "button",
|
|
21392
|
+
className: clsx_default("datepicker-picker-cell", y === year && "active"),
|
|
21393
|
+
onClick: () => handleYearSelect(y),
|
|
21394
|
+
children: y
|
|
21395
|
+
},
|
|
21396
|
+
y
|
|
21397
|
+
);
|
|
21398
|
+
}) }),
|
|
21399
|
+
pickerMode === "months" && /* @__PURE__ */ (0, import_jsx_runtime312.jsx)("div", { className: "datepicker-picker-grid", children: monthLabels.map((label, i) => /* @__PURE__ */ (0, import_jsx_runtime312.jsx)(
|
|
21400
|
+
"button",
|
|
21294
21401
|
{
|
|
21295
|
-
|
|
21296
|
-
|
|
21297
|
-
|
|
21298
|
-
i === 6 && "saturday"
|
|
21299
|
-
),
|
|
21402
|
+
type: "button",
|
|
21403
|
+
className: clsx_default("datepicker-picker-cell", i === month && "active"),
|
|
21404
|
+
onClick: () => handleMonthSelect(i),
|
|
21300
21405
|
children: label
|
|
21301
21406
|
},
|
|
21302
|
-
|
|
21407
|
+
i
|
|
21303
21408
|
)) }),
|
|
21304
|
-
/* @__PURE__ */ (0, import_jsx_runtime312.
|
|
21305
|
-
|
|
21306
|
-
|
|
21307
|
-
const selected = value ? isSameDay(day.date, value) : false;
|
|
21308
|
-
const highlighted = highlightSet.has(
|
|
21309
|
-
`${day.date.getFullYear()}-${day.date.getMonth()}-${day.date.getDate()}`
|
|
21310
|
-
);
|
|
21311
|
-
return /* @__PURE__ */ (0, import_jsx_runtime312.jsx)(
|
|
21312
|
-
DayCell,
|
|
21409
|
+
pickerMode === "days" && /* @__PURE__ */ (0, import_jsx_runtime312.jsxs)(import_jsx_runtime312.Fragment, { children: [
|
|
21410
|
+
/* @__PURE__ */ (0, import_jsx_runtime312.jsx)("div", { className: "datepicker-weekdays", children: weekdays.map((label, i) => /* @__PURE__ */ (0, import_jsx_runtime312.jsx)(
|
|
21411
|
+
"div",
|
|
21313
21412
|
{
|
|
21314
|
-
|
|
21315
|
-
|
|
21316
|
-
|
|
21317
|
-
|
|
21318
|
-
|
|
21413
|
+
className: clsx_default(
|
|
21414
|
+
"datepicker-weekday",
|
|
21415
|
+
i === 0 && "sunday",
|
|
21416
|
+
i === 6 && "saturday"
|
|
21417
|
+
),
|
|
21418
|
+
children: label
|
|
21319
21419
|
},
|
|
21320
|
-
|
|
21321
|
-
)
|
|
21322
|
-
|
|
21420
|
+
label
|
|
21421
|
+
)) }),
|
|
21422
|
+
/* @__PURE__ */ (0, import_jsx_runtime312.jsx)("div", { className: "datepicker-grid", children: days.map((day, idx) => {
|
|
21423
|
+
const t = day.date.getTime();
|
|
21424
|
+
const disabled = t < minTime || t > maxTime;
|
|
21425
|
+
const selected = value ? isSameDay(day.date, value) : false;
|
|
21426
|
+
const highlighted = highlightSet.has(
|
|
21427
|
+
`${day.date.getFullYear()}-${day.date.getMonth()}-${day.date.getDate()}`
|
|
21428
|
+
);
|
|
21429
|
+
return /* @__PURE__ */ (0, import_jsx_runtime312.jsx)(
|
|
21430
|
+
DayCell,
|
|
21431
|
+
{
|
|
21432
|
+
day,
|
|
21433
|
+
disabled,
|
|
21434
|
+
selected,
|
|
21435
|
+
highlighted,
|
|
21436
|
+
onSelect: handleSelect
|
|
21437
|
+
},
|
|
21438
|
+
idx
|
|
21439
|
+
);
|
|
21440
|
+
}) })
|
|
21441
|
+
] })
|
|
21323
21442
|
]
|
|
21324
21443
|
}
|
|
21325
21444
|
);
|
|
@@ -21434,9 +21553,24 @@ var RangePicker = (props) => {
|
|
|
21434
21553
|
} = props;
|
|
21435
21554
|
const startCal = useCalendar(startDate.getFullYear(), startDate.getMonth());
|
|
21436
21555
|
const endCal = useCalendar(endDate.getFullYear(), endDate.getMonth());
|
|
21437
|
-
const isDisabled = (date) => {
|
|
21438
|
-
|
|
21439
|
-
if (
|
|
21556
|
+
const isDisabled = (date, type) => {
|
|
21557
|
+
const d = date.getTime();
|
|
21558
|
+
if (minDate) {
|
|
21559
|
+
const min = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate()).getTime();
|
|
21560
|
+
if (d < min) return true;
|
|
21561
|
+
}
|
|
21562
|
+
if (maxDate) {
|
|
21563
|
+
const max = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate()).getTime();
|
|
21564
|
+
if (d > max) return true;
|
|
21565
|
+
}
|
|
21566
|
+
if (type === "end") {
|
|
21567
|
+
const start = new Date(startDate.getFullYear(), startDate.getMonth(), startDate.getDate()).getTime();
|
|
21568
|
+
if (d < start) return true;
|
|
21569
|
+
}
|
|
21570
|
+
if (type === "start") {
|
|
21571
|
+
const end = new Date(endDate.getFullYear(), endDate.getMonth(), endDate.getDate()).getTime();
|
|
21572
|
+
if (d > end) return true;
|
|
21573
|
+
}
|
|
21440
21574
|
return false;
|
|
21441
21575
|
};
|
|
21442
21576
|
const weekdays = WEEKDAY_LABELS[locale];
|
|
@@ -21445,9 +21579,25 @@ var RangePicker = (props) => {
|
|
|
21445
21579
|
return /* @__PURE__ */ (0, import_jsx_runtime315.jsxs)("div", { className: "datepicker-range-panel", children: [
|
|
21446
21580
|
/* @__PURE__ */ (0, import_jsx_runtime315.jsx)("span", { className: "datepicker-range-label", children: label }),
|
|
21447
21581
|
/* @__PURE__ */ (0, import_jsx_runtime315.jsxs)("div", { className: "datepicker-header", children: [
|
|
21448
|
-
/* @__PURE__ */ (0, import_jsx_runtime315.jsx)(
|
|
21582
|
+
/* @__PURE__ */ (0, import_jsx_runtime315.jsx)(
|
|
21583
|
+
"button",
|
|
21584
|
+
{
|
|
21585
|
+
className: "datepicker-nav",
|
|
21586
|
+
onClick: cal.goToPrevMonth,
|
|
21587
|
+
type: "button",
|
|
21588
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime315.jsx)(ChevronLeftIcon_default, {})
|
|
21589
|
+
}
|
|
21590
|
+
),
|
|
21449
21591
|
/* @__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}` }),
|
|
21450
|
-
/* @__PURE__ */ (0, import_jsx_runtime315.jsx)(
|
|
21592
|
+
/* @__PURE__ */ (0, import_jsx_runtime315.jsx)(
|
|
21593
|
+
"button",
|
|
21594
|
+
{
|
|
21595
|
+
className: "datepicker-nav",
|
|
21596
|
+
onClick: cal.goToNextMonth,
|
|
21597
|
+
type: "button",
|
|
21598
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime315.jsx)(ChevronRightIcon_default, {})
|
|
21599
|
+
}
|
|
21600
|
+
)
|
|
21451
21601
|
] }),
|
|
21452
21602
|
/* @__PURE__ */ (0, import_jsx_runtime315.jsx)("div", { className: "datepicker-weekdays", children: weekdays.map((w, i) => /* @__PURE__ */ (0, import_jsx_runtime315.jsx)(
|
|
21453
21603
|
"div",
|
|
@@ -21462,7 +21612,7 @@ var RangePicker = (props) => {
|
|
|
21462
21612
|
w
|
|
21463
21613
|
)) }),
|
|
21464
21614
|
/* @__PURE__ */ (0, import_jsx_runtime315.jsx)("div", { className: "datepicker-grid", children: cal.days.map((day, idx) => {
|
|
21465
|
-
const disabled = isDisabled(day.date);
|
|
21615
|
+
const disabled = isDisabled(day.date, type);
|
|
21466
21616
|
const isStart = isSameDay(day.date, startDate);
|
|
21467
21617
|
const isEnd = isSameDay(day.date, endDate);
|
|
21468
21618
|
const inRange2 = isInRange(day.date, startDate, endDate);
|
|
@@ -21503,7 +21653,9 @@ var RangePicker = (props) => {
|
|
|
21503
21653
|
"div",
|
|
21504
21654
|
{
|
|
21505
21655
|
className: clsx_default("lib-xplat-datepicker", "range"),
|
|
21506
|
-
style: {
|
|
21656
|
+
style: {
|
|
21657
|
+
"--datepicker-active-color": `var(--${color2})`
|
|
21658
|
+
},
|
|
21507
21659
|
children: [
|
|
21508
21660
|
renderCalendar(startCal, "start"),
|
|
21509
21661
|
renderCalendar(endCal, "end")
|
|
@@ -21528,7 +21680,7 @@ var PopupPicker = (props) => {
|
|
|
21528
21680
|
};
|
|
21529
21681
|
return /* @__PURE__ */ (0, import_jsx_runtime316.jsxs)("div", { className: "lib-xplat-popup-datepicker", children: [
|
|
21530
21682
|
import_react14.default.cloneElement(component, { onClick: handleClick }),
|
|
21531
|
-
/* @__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: [
|
|
21683
|
+
/* @__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: [
|
|
21532
21684
|
/* @__PURE__ */ (0, import_jsx_runtime316.jsxs)("div", { className: "popup-datepicker-content", children: [
|
|
21533
21685
|
type === "single" && /* @__PURE__ */ (0, import_jsx_runtime316.jsx)(
|
|
21534
21686
|
SingleDatePicker_default,
|