@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
|
@@ -1077,6 +1077,7 @@ var Calendar = (props) => {
|
|
|
1077
1077
|
locale = "ko",
|
|
1078
1078
|
minDate,
|
|
1079
1079
|
maxDate,
|
|
1080
|
+
selectedColor,
|
|
1080
1081
|
showToday = true,
|
|
1081
1082
|
className
|
|
1082
1083
|
} = props;
|
|
@@ -1120,90 +1121,97 @@ var Calendar = (props) => {
|
|
|
1120
1121
|
};
|
|
1121
1122
|
const getEventsForDay = (date) => events.filter((e) => isSameDay(e.date, date));
|
|
1122
1123
|
const weekdays = WEEKDAY_LABELS[locale];
|
|
1123
|
-
return /* @__PURE__ */ (0, import_jsx_runtime295.jsxs)(
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
i === 6 && "saturday"
|
|
1137
|
-
),
|
|
1138
|
-
children: label
|
|
1139
|
-
},
|
|
1140
|
-
label
|
|
1141
|
-
)) }),
|
|
1142
|
-
/* @__PURE__ */ (0, import_jsx_runtime295.jsx)("div", { className: "calendar-grid", children: days.map((day, idx) => {
|
|
1143
|
-
const dayEvents = getEventsForDay(day.date);
|
|
1144
|
-
const disabled = isDisabled(day.date);
|
|
1145
|
-
const isSelected = selectedDate ? isSameDay(day.date, selectedDate) : false;
|
|
1146
|
-
if (renderDay) {
|
|
1147
|
-
return /* @__PURE__ */ (0, import_jsx_runtime295.jsx)(
|
|
1124
|
+
return /* @__PURE__ */ (0, import_jsx_runtime295.jsxs)(
|
|
1125
|
+
"div",
|
|
1126
|
+
{
|
|
1127
|
+
className: clsx_default("lib-xplat-calendar", className),
|
|
1128
|
+
style: selectedColor ? { "--calendar-selected-color": `var(--${selectedColor})` } : void 0,
|
|
1129
|
+
children: [
|
|
1130
|
+
/* @__PURE__ */ (0, import_jsx_runtime295.jsxs)("div", { className: "calendar-header", children: [
|
|
1131
|
+
/* @__PURE__ */ (0, import_jsx_runtime295.jsx)("button", { className: "calendar-nav", onClick: handlePrev, "aria-label": "\uC774\uC804 \uB2EC", children: /* @__PURE__ */ (0, import_jsx_runtime295.jsx)(ChevronLeftIcon_default, {}) }),
|
|
1132
|
+
/* @__PURE__ */ (0, import_jsx_runtime295.jsx)("span", { className: "calendar-title", children: locale === "ko" ? `${year}\uB144 ${MONTH_LABELS.ko[month]}` : `${MONTH_LABELS.en[month]} ${year}` }),
|
|
1133
|
+
/* @__PURE__ */ (0, import_jsx_runtime295.jsx)("button", { className: "calendar-nav", onClick: handleNext, "aria-label": "\uB2E4\uC74C \uB2EC", children: /* @__PURE__ */ (0, import_jsx_runtime295.jsx)(ChevronRightIcon_default, {}) }),
|
|
1134
|
+
showToday && /* @__PURE__ */ (0, import_jsx_runtime295.jsx)("button", { className: "calendar-today-btn", onClick: handleToday, children: locale === "ko" ? "\uC624\uB298" : "Today" })
|
|
1135
|
+
] }),
|
|
1136
|
+
/* @__PURE__ */ (0, import_jsx_runtime295.jsx)("div", { className: "calendar-weekdays", children: weekdays.map((label, i) => /* @__PURE__ */ (0, import_jsx_runtime295.jsx)(
|
|
1148
1137
|
"div",
|
|
1149
1138
|
{
|
|
1150
1139
|
className: clsx_default(
|
|
1151
|
-
"calendar-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
isSelected && "selected",
|
|
1155
|
-
day.isToday && "today"
|
|
1140
|
+
"calendar-weekday",
|
|
1141
|
+
i === 0 && "sunday",
|
|
1142
|
+
i === 6 && "saturday"
|
|
1156
1143
|
),
|
|
1157
|
-
|
|
1158
|
-
if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
|
|
1159
|
-
},
|
|
1160
|
-
children: renderDay(day, dayEvents)
|
|
1161
|
-
},
|
|
1162
|
-
idx
|
|
1163
|
-
);
|
|
1164
|
-
}
|
|
1165
|
-
return /* @__PURE__ */ (0, import_jsx_runtime295.jsxs)(
|
|
1166
|
-
"div",
|
|
1167
|
-
{
|
|
1168
|
-
className: clsx_default(
|
|
1169
|
-
"calendar-day",
|
|
1170
|
-
!day.isCurrentMonth && "outside",
|
|
1171
|
-
disabled && "disabled",
|
|
1172
|
-
isSelected && "selected",
|
|
1173
|
-
day.isToday && "today",
|
|
1174
|
-
day.isSunday && "sunday",
|
|
1175
|
-
day.isSaturday && "saturday"
|
|
1176
|
-
),
|
|
1177
|
-
onClick: () => {
|
|
1178
|
-
if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
|
|
1144
|
+
children: label
|
|
1179
1145
|
},
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1146
|
+
label
|
|
1147
|
+
)) }),
|
|
1148
|
+
/* @__PURE__ */ (0, import_jsx_runtime295.jsx)("div", { className: "calendar-grid", children: days.map((day, idx) => {
|
|
1149
|
+
const dayEvents = getEventsForDay(day.date);
|
|
1150
|
+
const disabled = isDisabled(day.date);
|
|
1151
|
+
const isSelected = selectedDate ? isSameDay(day.date, selectedDate) : false;
|
|
1152
|
+
if (renderDay) {
|
|
1153
|
+
return /* @__PURE__ */ (0, import_jsx_runtime295.jsx)(
|
|
1154
|
+
"div",
|
|
1155
|
+
{
|
|
1156
|
+
className: clsx_default(
|
|
1157
|
+
"calendar-day",
|
|
1158
|
+
!day.isCurrentMonth && "outside",
|
|
1159
|
+
disabled && "disabled",
|
|
1160
|
+
isSelected && "selected",
|
|
1161
|
+
day.isToday && "today"
|
|
1162
|
+
),
|
|
1163
|
+
onClick: () => {
|
|
1164
|
+
if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
|
|
1193
1165
|
},
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1166
|
+
children: renderDay(day, dayEvents)
|
|
1167
|
+
},
|
|
1168
|
+
idx
|
|
1169
|
+
);
|
|
1170
|
+
}
|
|
1171
|
+
return /* @__PURE__ */ (0, import_jsx_runtime295.jsxs)(
|
|
1172
|
+
"div",
|
|
1173
|
+
{
|
|
1174
|
+
className: clsx_default(
|
|
1175
|
+
"calendar-day",
|
|
1176
|
+
!day.isCurrentMonth && "outside",
|
|
1177
|
+
disabled && "disabled",
|
|
1178
|
+
isSelected && "selected",
|
|
1179
|
+
day.isToday && "today",
|
|
1180
|
+
day.isSunday && "sunday",
|
|
1181
|
+
day.isSaturday && "saturday"
|
|
1182
|
+
),
|
|
1183
|
+
onClick: () => {
|
|
1184
|
+
if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
|
|
1185
|
+
},
|
|
1186
|
+
children: [
|
|
1187
|
+
/* @__PURE__ */ (0, import_jsx_runtime295.jsx)("span", { className: "calendar-day-number", children: day.day }),
|
|
1188
|
+
dayEvents.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime295.jsxs)("div", { className: "calendar-day-events", children: [
|
|
1189
|
+
dayEvents.slice(0, 3).map((event, ei) => /* @__PURE__ */ (0, import_jsx_runtime295.jsx)(
|
|
1190
|
+
"span",
|
|
1191
|
+
{
|
|
1192
|
+
className: "calendar-event-dot",
|
|
1193
|
+
style: { backgroundColor: event.color ?? "var(--xplat-blue-500)" },
|
|
1194
|
+
title: event.label,
|
|
1195
|
+
onClick: (e) => {
|
|
1196
|
+
e.stopPropagation();
|
|
1197
|
+
onEventClick?.(event);
|
|
1198
|
+
}
|
|
1199
|
+
},
|
|
1200
|
+
ei
|
|
1201
|
+
)),
|
|
1202
|
+
dayEvents.length > 3 && /* @__PURE__ */ (0, import_jsx_runtime295.jsxs)("span", { className: "calendar-event-more", children: [
|
|
1203
|
+
"+",
|
|
1204
|
+
dayEvents.length - 3
|
|
1205
|
+
] })
|
|
1206
|
+
] })
|
|
1207
|
+
]
|
|
1208
|
+
},
|
|
1209
|
+
idx
|
|
1210
|
+
);
|
|
1211
|
+
}) })
|
|
1212
|
+
]
|
|
1213
|
+
}
|
|
1214
|
+
);
|
|
1207
1215
|
};
|
|
1208
1216
|
Calendar.displayName = "Calendar";
|
|
1209
1217
|
var Calendar_default = Calendar;
|
|
@@ -92,6 +92,12 @@
|
|
|
92
92
|
.lib-xplat-calendar .calendar-day.outside .calendar-day-number {
|
|
93
93
|
color: var(--xplat-neutral-300);
|
|
94
94
|
}
|
|
95
|
+
.lib-xplat-calendar .calendar-day.outside.sunday .calendar-day-number {
|
|
96
|
+
color: color-mix(in srgb, var(--xplat-red-500) 35%, transparent);
|
|
97
|
+
}
|
|
98
|
+
.lib-xplat-calendar .calendar-day.outside.saturday .calendar-day-number {
|
|
99
|
+
color: color-mix(in srgb, var(--xplat-blue-500) 35%, transparent);
|
|
100
|
+
}
|
|
95
101
|
.lib-xplat-calendar .calendar-day.disabled {
|
|
96
102
|
cursor: not-allowed;
|
|
97
103
|
}
|
|
@@ -103,34 +109,34 @@
|
|
|
103
109
|
font-weight: 700;
|
|
104
110
|
color: var(--xplat-blue-600);
|
|
105
111
|
}
|
|
106
|
-
.lib-xplat-calendar .calendar-day.today .calendar-day-number::
|
|
112
|
+
.lib-xplat-calendar .calendar-day.today .calendar-day-number::before {
|
|
107
113
|
content: "";
|
|
108
114
|
position: absolute;
|
|
109
|
-
|
|
110
|
-
left:
|
|
111
|
-
transform:
|
|
115
|
+
top: 50%;
|
|
116
|
+
left: -6px;
|
|
117
|
+
transform: translateY(-50%);
|
|
112
118
|
width: 4px;
|
|
113
119
|
height: 4px;
|
|
114
120
|
border-radius: 50%;
|
|
115
121
|
background-color: var(--xplat-blue-600);
|
|
116
122
|
}
|
|
117
123
|
.lib-xplat-calendar .calendar-day.selected {
|
|
118
|
-
background-color: var(--xplat-neutral-900);
|
|
124
|
+
background-color: var(--calendar-selected-color, var(--xplat-neutral-900));
|
|
119
125
|
}
|
|
120
126
|
.lib-xplat-calendar .calendar-day.selected .calendar-day-number {
|
|
121
127
|
color: var(--xplat-white);
|
|
122
128
|
font-weight: 600;
|
|
123
129
|
}
|
|
124
130
|
.lib-xplat-calendar .calendar-day.selected:hover {
|
|
125
|
-
background-color: var(--xplat-neutral-
|
|
131
|
+
background-color: color-mix(in srgb, var(--calendar-selected-color, var(--xplat-neutral-900)), black 12%);
|
|
126
132
|
}
|
|
127
|
-
.lib-xplat-calendar .calendar-day.selected.today .calendar-day-number::
|
|
133
|
+
.lib-xplat-calendar .calendar-day.selected.today .calendar-day-number::before {
|
|
128
134
|
background-color: var(--xplat-white);
|
|
129
135
|
}
|
|
130
|
-
.lib-xplat-calendar .calendar-day.sunday .calendar-day-number {
|
|
136
|
+
.lib-xplat-calendar .calendar-day.sunday:not(.outside) .calendar-day-number {
|
|
131
137
|
color: var(--xplat-red-500);
|
|
132
138
|
}
|
|
133
|
-
.lib-xplat-calendar .calendar-day.saturday .calendar-day-number {
|
|
139
|
+
.lib-xplat-calendar .calendar-day.saturday:not(.outside) .calendar-day-number {
|
|
134
140
|
color: var(--xplat-blue-500);
|
|
135
141
|
}
|
|
136
142
|
.lib-xplat-calendar .calendar-day.selected .calendar-day-number {
|
|
@@ -1038,6 +1038,7 @@ var Calendar = (props) => {
|
|
|
1038
1038
|
locale = "ko",
|
|
1039
1039
|
minDate,
|
|
1040
1040
|
maxDate,
|
|
1041
|
+
selectedColor,
|
|
1041
1042
|
showToday = true,
|
|
1042
1043
|
className
|
|
1043
1044
|
} = props;
|
|
@@ -1081,90 +1082,97 @@ var Calendar = (props) => {
|
|
|
1081
1082
|
};
|
|
1082
1083
|
const getEventsForDay = (date) => events.filter((e) => isSameDay(e.date, date));
|
|
1083
1084
|
const weekdays = WEEKDAY_LABELS[locale];
|
|
1084
|
-
return /* @__PURE__ */ jsxs189(
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
i === 6 && "saturday"
|
|
1098
|
-
),
|
|
1099
|
-
children: label
|
|
1100
|
-
},
|
|
1101
|
-
label
|
|
1102
|
-
)) }),
|
|
1103
|
-
/* @__PURE__ */ jsx295("div", { className: "calendar-grid", children: days.map((day, idx) => {
|
|
1104
|
-
const dayEvents = getEventsForDay(day.date);
|
|
1105
|
-
const disabled = isDisabled(day.date);
|
|
1106
|
-
const isSelected = selectedDate ? isSameDay(day.date, selectedDate) : false;
|
|
1107
|
-
if (renderDay) {
|
|
1108
|
-
return /* @__PURE__ */ jsx295(
|
|
1085
|
+
return /* @__PURE__ */ jsxs189(
|
|
1086
|
+
"div",
|
|
1087
|
+
{
|
|
1088
|
+
className: clsx_default("lib-xplat-calendar", className),
|
|
1089
|
+
style: selectedColor ? { "--calendar-selected-color": `var(--${selectedColor})` } : void 0,
|
|
1090
|
+
children: [
|
|
1091
|
+
/* @__PURE__ */ jsxs189("div", { className: "calendar-header", children: [
|
|
1092
|
+
/* @__PURE__ */ jsx295("button", { className: "calendar-nav", onClick: handlePrev, "aria-label": "\uC774\uC804 \uB2EC", children: /* @__PURE__ */ jsx295(ChevronLeftIcon_default, {}) }),
|
|
1093
|
+
/* @__PURE__ */ jsx295("span", { className: "calendar-title", children: locale === "ko" ? `${year}\uB144 ${MONTH_LABELS.ko[month]}` : `${MONTH_LABELS.en[month]} ${year}` }),
|
|
1094
|
+
/* @__PURE__ */ jsx295("button", { className: "calendar-nav", onClick: handleNext, "aria-label": "\uB2E4\uC74C \uB2EC", children: /* @__PURE__ */ jsx295(ChevronRightIcon_default, {}) }),
|
|
1095
|
+
showToday && /* @__PURE__ */ jsx295("button", { className: "calendar-today-btn", onClick: handleToday, children: locale === "ko" ? "\uC624\uB298" : "Today" })
|
|
1096
|
+
] }),
|
|
1097
|
+
/* @__PURE__ */ jsx295("div", { className: "calendar-weekdays", children: weekdays.map((label, i) => /* @__PURE__ */ jsx295(
|
|
1109
1098
|
"div",
|
|
1110
1099
|
{
|
|
1111
1100
|
className: clsx_default(
|
|
1112
|
-
"calendar-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
isSelected && "selected",
|
|
1116
|
-
day.isToday && "today"
|
|
1101
|
+
"calendar-weekday",
|
|
1102
|
+
i === 0 && "sunday",
|
|
1103
|
+
i === 6 && "saturday"
|
|
1117
1104
|
),
|
|
1118
|
-
|
|
1119
|
-
if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
|
|
1120
|
-
},
|
|
1121
|
-
children: renderDay(day, dayEvents)
|
|
1122
|
-
},
|
|
1123
|
-
idx
|
|
1124
|
-
);
|
|
1125
|
-
}
|
|
1126
|
-
return /* @__PURE__ */ jsxs189(
|
|
1127
|
-
"div",
|
|
1128
|
-
{
|
|
1129
|
-
className: clsx_default(
|
|
1130
|
-
"calendar-day",
|
|
1131
|
-
!day.isCurrentMonth && "outside",
|
|
1132
|
-
disabled && "disabled",
|
|
1133
|
-
isSelected && "selected",
|
|
1134
|
-
day.isToday && "today",
|
|
1135
|
-
day.isSunday && "sunday",
|
|
1136
|
-
day.isSaturday && "saturday"
|
|
1137
|
-
),
|
|
1138
|
-
onClick: () => {
|
|
1139
|
-
if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
|
|
1105
|
+
children: label
|
|
1140
1106
|
},
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1107
|
+
label
|
|
1108
|
+
)) }),
|
|
1109
|
+
/* @__PURE__ */ jsx295("div", { className: "calendar-grid", children: days.map((day, idx) => {
|
|
1110
|
+
const dayEvents = getEventsForDay(day.date);
|
|
1111
|
+
const disabled = isDisabled(day.date);
|
|
1112
|
+
const isSelected = selectedDate ? isSameDay(day.date, selectedDate) : false;
|
|
1113
|
+
if (renderDay) {
|
|
1114
|
+
return /* @__PURE__ */ jsx295(
|
|
1115
|
+
"div",
|
|
1116
|
+
{
|
|
1117
|
+
className: clsx_default(
|
|
1118
|
+
"calendar-day",
|
|
1119
|
+
!day.isCurrentMonth && "outside",
|
|
1120
|
+
disabled && "disabled",
|
|
1121
|
+
isSelected && "selected",
|
|
1122
|
+
day.isToday && "today"
|
|
1123
|
+
),
|
|
1124
|
+
onClick: () => {
|
|
1125
|
+
if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
|
|
1154
1126
|
},
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1127
|
+
children: renderDay(day, dayEvents)
|
|
1128
|
+
},
|
|
1129
|
+
idx
|
|
1130
|
+
);
|
|
1131
|
+
}
|
|
1132
|
+
return /* @__PURE__ */ jsxs189(
|
|
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
|
+
}) })
|
|
1173
|
+
]
|
|
1174
|
+
}
|
|
1175
|
+
);
|
|
1168
1176
|
};
|
|
1169
1177
|
Calendar.displayName = "Calendar";
|
|
1170
1178
|
var Calendar_default = Calendar;
|
|
@@ -1450,6 +1450,37 @@ var MONTH_LABELS = {
|
|
|
1450
1450
|
|
|
1451
1451
|
// src/components/DatePicker/SingleDatePicker/index.tsx
|
|
1452
1452
|
var import_jsx_runtime298 = require("react/jsx-runtime");
|
|
1453
|
+
var DayCell = import_react6.default.memo(
|
|
1454
|
+
({
|
|
1455
|
+
day,
|
|
1456
|
+
disabled,
|
|
1457
|
+
selected,
|
|
1458
|
+
highlighted,
|
|
1459
|
+
onSelect
|
|
1460
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime298.jsx)(
|
|
1461
|
+
"button",
|
|
1462
|
+
{
|
|
1463
|
+
type: "button",
|
|
1464
|
+
className: clsx_default(
|
|
1465
|
+
"datepicker-day",
|
|
1466
|
+
!day.isCurrentMonth && "outside",
|
|
1467
|
+
disabled && "disabled",
|
|
1468
|
+
selected && "selected",
|
|
1469
|
+
highlighted && !selected && "highlighted",
|
|
1470
|
+
day.isToday && "today",
|
|
1471
|
+
day.isSunday && "sunday",
|
|
1472
|
+
day.isSaturday && "saturday"
|
|
1473
|
+
),
|
|
1474
|
+
disabled: disabled || !day.isCurrentMonth,
|
|
1475
|
+
onClick: () => {
|
|
1476
|
+
if (!disabled && day.isCurrentMonth) onSelect(day.date);
|
|
1477
|
+
},
|
|
1478
|
+
children: day.day
|
|
1479
|
+
}
|
|
1480
|
+
),
|
|
1481
|
+
(prev, next) => prev.selected === next.selected && prev.disabled === next.disabled && prev.highlighted === next.highlighted && prev.day === next.day
|
|
1482
|
+
);
|
|
1483
|
+
DayCell.displayName = "DayCell";
|
|
1453
1484
|
var SingleDatePicker = (props) => {
|
|
1454
1485
|
const {
|
|
1455
1486
|
value,
|
|
@@ -1481,6 +1512,12 @@ var SingleDatePicker = (props) => {
|
|
|
1481
1512
|
}
|
|
1482
1513
|
return set;
|
|
1483
1514
|
}, [highlightDates]);
|
|
1515
|
+
const handleSelect = import_react6.default.useCallback(
|
|
1516
|
+
(date) => {
|
|
1517
|
+
onChange?.(date);
|
|
1518
|
+
},
|
|
1519
|
+
[onChange]
|
|
1520
|
+
);
|
|
1484
1521
|
const weekdays = WEEKDAY_LABELS[locale];
|
|
1485
1522
|
return /* @__PURE__ */ (0, import_jsx_runtime298.jsxs)(
|
|
1486
1523
|
"div",
|
|
@@ -1513,26 +1550,13 @@ var SingleDatePicker = (props) => {
|
|
|
1513
1550
|
`${day.date.getFullYear()}-${day.date.getMonth()}-${day.date.getDate()}`
|
|
1514
1551
|
);
|
|
1515
1552
|
return /* @__PURE__ */ (0, import_jsx_runtime298.jsx)(
|
|
1516
|
-
|
|
1553
|
+
DayCell,
|
|
1517
1554
|
{
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
selected && "selected",
|
|
1524
|
-
highlighted && !selected && "highlighted",
|
|
1525
|
-
day.isToday && "today",
|
|
1526
|
-
day.isSunday && "sunday",
|
|
1527
|
-
day.isSaturday && "saturday"
|
|
1528
|
-
),
|
|
1529
|
-
disabled: disabled || !day.isCurrentMonth,
|
|
1530
|
-
onClick: () => {
|
|
1531
|
-
if (!disabled && day.isCurrentMonth) {
|
|
1532
|
-
onChange?.(day.date);
|
|
1533
|
-
}
|
|
1534
|
-
},
|
|
1535
|
-
children: day.day
|
|
1555
|
+
day,
|
|
1556
|
+
disabled,
|
|
1557
|
+
selected,
|
|
1558
|
+
highlighted,
|
|
1559
|
+
onSelect: handleSelect
|
|
1536
1560
|
},
|
|
1537
1561
|
idx
|
|
1538
1562
|
);
|
|
@@ -167,6 +167,12 @@
|
|
|
167
167
|
color: var(--xplat-neutral-300);
|
|
168
168
|
cursor: default;
|
|
169
169
|
}
|
|
170
|
+
.lib-xplat-datepicker .datepicker-day.outside.sunday {
|
|
171
|
+
color: color-mix(in srgb, var(--xplat-red-500) 35%, transparent);
|
|
172
|
+
}
|
|
173
|
+
.lib-xplat-datepicker .datepicker-day.outside.saturday {
|
|
174
|
+
color: color-mix(in srgb, var(--xplat-blue-500) 35%, transparent);
|
|
175
|
+
}
|
|
170
176
|
.lib-xplat-datepicker .datepicker-day.disabled {
|
|
171
177
|
color: var(--xplat-neutral-300);
|
|
172
178
|
cursor: not-allowed;
|
|
@@ -295,6 +301,10 @@
|
|
|
295
301
|
border-radius: 12px;
|
|
296
302
|
background-color: #fff;
|
|
297
303
|
padding: 24px;
|
|
304
|
+
width: fit-content;
|
|
305
|
+
max-width: calc(100vw - 2rem);
|
|
306
|
+
max-height: calc(100vh - 2rem);
|
|
307
|
+
overflow: auto;
|
|
298
308
|
transform: translate(-50%, -50%) scale(0.9);
|
|
299
309
|
opacity: 0;
|
|
300
310
|
transition: transform 0.2s ease, opacity 0.2s ease;
|
|
@@ -1411,6 +1411,37 @@ var MONTH_LABELS = {
|
|
|
1411
1411
|
|
|
1412
1412
|
// src/components/DatePicker/SingleDatePicker/index.tsx
|
|
1413
1413
|
import { jsx as jsx298, jsxs as jsxs191 } from "react/jsx-runtime";
|
|
1414
|
+
var DayCell = React5.memo(
|
|
1415
|
+
({
|
|
1416
|
+
day,
|
|
1417
|
+
disabled,
|
|
1418
|
+
selected,
|
|
1419
|
+
highlighted,
|
|
1420
|
+
onSelect
|
|
1421
|
+
}) => /* @__PURE__ */ jsx298(
|
|
1422
|
+
"button",
|
|
1423
|
+
{
|
|
1424
|
+
type: "button",
|
|
1425
|
+
className: clsx_default(
|
|
1426
|
+
"datepicker-day",
|
|
1427
|
+
!day.isCurrentMonth && "outside",
|
|
1428
|
+
disabled && "disabled",
|
|
1429
|
+
selected && "selected",
|
|
1430
|
+
highlighted && !selected && "highlighted",
|
|
1431
|
+
day.isToday && "today",
|
|
1432
|
+
day.isSunday && "sunday",
|
|
1433
|
+
day.isSaturday && "saturday"
|
|
1434
|
+
),
|
|
1435
|
+
disabled: disabled || !day.isCurrentMonth,
|
|
1436
|
+
onClick: () => {
|
|
1437
|
+
if (!disabled && day.isCurrentMonth) onSelect(day.date);
|
|
1438
|
+
},
|
|
1439
|
+
children: day.day
|
|
1440
|
+
}
|
|
1441
|
+
),
|
|
1442
|
+
(prev, next) => prev.selected === next.selected && prev.disabled === next.disabled && prev.highlighted === next.highlighted && prev.day === next.day
|
|
1443
|
+
);
|
|
1444
|
+
DayCell.displayName = "DayCell";
|
|
1414
1445
|
var SingleDatePicker = (props) => {
|
|
1415
1446
|
const {
|
|
1416
1447
|
value,
|
|
@@ -1442,6 +1473,12 @@ var SingleDatePicker = (props) => {
|
|
|
1442
1473
|
}
|
|
1443
1474
|
return set;
|
|
1444
1475
|
}, [highlightDates]);
|
|
1476
|
+
const handleSelect = React5.useCallback(
|
|
1477
|
+
(date) => {
|
|
1478
|
+
onChange?.(date);
|
|
1479
|
+
},
|
|
1480
|
+
[onChange]
|
|
1481
|
+
);
|
|
1445
1482
|
const weekdays = WEEKDAY_LABELS[locale];
|
|
1446
1483
|
return /* @__PURE__ */ jsxs191(
|
|
1447
1484
|
"div",
|
|
@@ -1474,26 +1511,13 @@ var SingleDatePicker = (props) => {
|
|
|
1474
1511
|
`${day.date.getFullYear()}-${day.date.getMonth()}-${day.date.getDate()}`
|
|
1475
1512
|
);
|
|
1476
1513
|
return /* @__PURE__ */ jsx298(
|
|
1477
|
-
|
|
1514
|
+
DayCell,
|
|
1478
1515
|
{
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
selected && "selected",
|
|
1485
|
-
highlighted && !selected && "highlighted",
|
|
1486
|
-
day.isToday && "today",
|
|
1487
|
-
day.isSunday && "sunday",
|
|
1488
|
-
day.isSaturday && "saturday"
|
|
1489
|
-
),
|
|
1490
|
-
disabled: disabled || !day.isCurrentMonth,
|
|
1491
|
-
onClick: () => {
|
|
1492
|
-
if (!disabled && day.isCurrentMonth) {
|
|
1493
|
-
onChange?.(day.date);
|
|
1494
|
-
}
|
|
1495
|
-
},
|
|
1496
|
-
children: day.day
|
|
1516
|
+
day,
|
|
1517
|
+
disabled,
|
|
1518
|
+
selected,
|
|
1519
|
+
highlighted,
|
|
1520
|
+
onSelect: handleSelect
|
|
1497
1521
|
},
|
|
1498
1522
|
idx
|
|
1499
1523
|
);
|
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
border-radius: 12px;
|
|
10
10
|
background-color: #fff;
|
|
11
11
|
padding: 24px;
|
|
12
|
+
width: fit-content;
|
|
13
|
+
max-width: calc(100vw - 2rem);
|
|
14
|
+
max-height: calc(100vh - 2rem);
|
|
15
|
+
overflow: auto;
|
|
12
16
|
transform: translate(-50%, -50%) scale(0.9);
|
|
13
17
|
opacity: 0;
|
|
14
18
|
transition: transform 0.2s ease, opacity 0.2s ease;
|