@x-plat/design-system 0.5.2 → 0.5.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/Accordion/index.cjs +38 -31
- package/dist/components/Accordion/index.css +2 -0
- package/dist/components/Accordion/index.js +38 -31
- package/dist/components/Alert/index.css +1 -0
- package/dist/components/Breadcrumb/index.css +3 -0
- package/dist/components/Button/index.css +1 -0
- package/dist/components/Calendar/index.cjs +103 -62
- package/dist/components/Calendar/index.css +2 -0
- package/dist/components/Calendar/index.js +103 -62
- package/dist/components/Card/index.css +3 -1
- package/dist/components/CardTab/index.css +1 -0
- package/dist/components/Chart/index.cjs +106 -83
- package/dist/components/Chart/index.css +2 -0
- package/dist/components/Chart/index.js +106 -83
- package/dist/components/DatePicker/index.cjs +36 -15
- package/dist/components/DatePicker/index.css +2 -0
- package/dist/components/DatePicker/index.js +36 -15
- package/dist/components/Dropdown/index.css +1 -0
- package/dist/components/EmptyState/index.css +2 -0
- package/dist/components/FileUpload/index.css +3 -0
- package/dist/components/HtmlTypeWriter/index.css +1 -0
- package/dist/components/Pagination/index.css +8 -8
- package/dist/components/Select/index.css +1 -0
- package/dist/components/Spinner/index.css +7 -2
- package/dist/components/Steps/index.cjs +1 -4
- package/dist/components/Steps/index.css +15 -36
- package/dist/components/Steps/index.js +1 -4
- package/dist/components/Swiper/index.cjs +16 -12
- package/dist/components/Swiper/index.css +2 -0
- package/dist/components/Swiper/index.js +16 -12
- package/dist/components/Switch/index.css +20 -19
- package/dist/components/Tab/index.css +16 -2
- package/dist/components/Table/index.cjs +4 -4
- package/dist/components/Table/index.css +2 -0
- package/dist/components/Table/index.d.cts +2 -5
- package/dist/components/Table/index.d.ts +2 -5
- package/dist/components/Table/index.js +4 -4
- package/dist/components/Video/index.cjs +32 -43
- package/dist/components/Video/index.css +5 -4
- package/dist/components/Video/index.d.cts +1 -5
- package/dist/components/Video/index.d.ts +1 -5
- package/dist/components/Video/index.js +32 -43
- package/dist/components/index.cjs +339 -257
- package/dist/components/index.css +99 -72
- package/dist/components/index.js +339 -257
- package/dist/index.cjs +339 -257
- package/dist/index.css +99 -72
- package/dist/index.js +339 -257
- package/guidelines/Guidelines.md +11 -4
- package/package.json +1 -2
|
@@ -955,38 +955,45 @@ var clsx_default = clsx;
|
|
|
955
955
|
|
|
956
956
|
// src/components/Accordion/Accordion.tsx
|
|
957
957
|
var import_jsx_runtime295 = require("react/jsx-runtime");
|
|
958
|
-
var AccordionItem = (
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
{
|
|
970
|
-
className: "accordion-header",
|
|
971
|
-
onClick: onToggle,
|
|
972
|
-
"aria-expanded": isOpen,
|
|
973
|
-
children: [
|
|
974
|
-
/* @__PURE__ */ (0, import_jsx_runtime295.jsx)("span", { className: "title", children: item.title }),
|
|
975
|
-
/* @__PURE__ */ (0, import_jsx_runtime295.jsx)("span", { className: "chevron", children: /* @__PURE__ */ (0, import_jsx_runtime295.jsx)(ChevronDownIcon_default, {}) })
|
|
976
|
-
]
|
|
977
|
-
}
|
|
978
|
-
),
|
|
979
|
-
/* @__PURE__ */ (0, import_jsx_runtime295.jsx)(
|
|
980
|
-
"div",
|
|
981
|
-
{
|
|
982
|
-
ref: bodyRef,
|
|
983
|
-
className: "accordion-body",
|
|
984
|
-
style: { maxHeight: isOpen ? height : 0 },
|
|
985
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime295.jsx)("div", { className: "accordion-content", children: item.content })
|
|
958
|
+
var AccordionItem = import_react.default.memo(
|
|
959
|
+
({
|
|
960
|
+
item,
|
|
961
|
+
isOpen,
|
|
962
|
+
onToggle
|
|
963
|
+
}) => {
|
|
964
|
+
const bodyRef = import_react.default.useRef(null);
|
|
965
|
+
const [height, setHeight] = import_react.default.useState(0);
|
|
966
|
+
import_react.default.useEffect(() => {
|
|
967
|
+
if (bodyRef.current) {
|
|
968
|
+
setHeight(bodyRef.current.scrollHeight);
|
|
986
969
|
}
|
|
987
|
-
)
|
|
988
|
-
|
|
989
|
-
|
|
970
|
+
}, [isOpen, item.content]);
|
|
971
|
+
return /* @__PURE__ */ (0, import_jsx_runtime295.jsxs)("div", { className: clsx_default("accordion-item", { open: isOpen }), children: [
|
|
972
|
+
/* @__PURE__ */ (0, import_jsx_runtime295.jsxs)(
|
|
973
|
+
"button",
|
|
974
|
+
{
|
|
975
|
+
className: "accordion-header",
|
|
976
|
+
onClick: onToggle,
|
|
977
|
+
"aria-expanded": isOpen,
|
|
978
|
+
children: [
|
|
979
|
+
/* @__PURE__ */ (0, import_jsx_runtime295.jsx)("span", { className: "title", children: item.title }),
|
|
980
|
+
/* @__PURE__ */ (0, import_jsx_runtime295.jsx)("span", { className: "chevron", children: /* @__PURE__ */ (0, import_jsx_runtime295.jsx)(ChevronDownIcon_default, {}) })
|
|
981
|
+
]
|
|
982
|
+
}
|
|
983
|
+
),
|
|
984
|
+
/* @__PURE__ */ (0, import_jsx_runtime295.jsx)(
|
|
985
|
+
"div",
|
|
986
|
+
{
|
|
987
|
+
ref: bodyRef,
|
|
988
|
+
className: "accordion-body",
|
|
989
|
+
style: { maxHeight: isOpen ? height : 0 },
|
|
990
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime295.jsx)("div", { className: "accordion-content", children: item.content })
|
|
991
|
+
}
|
|
992
|
+
)
|
|
993
|
+
] });
|
|
994
|
+
}
|
|
995
|
+
);
|
|
996
|
+
AccordionItem.displayName = "AccordionItem";
|
|
990
997
|
var Accordion = (props) => {
|
|
991
998
|
const { items } = props;
|
|
992
999
|
const isMultiple = props.multiple === true;
|
|
@@ -919,38 +919,45 @@ var clsx_default = clsx;
|
|
|
919
919
|
|
|
920
920
|
// src/components/Accordion/Accordion.tsx
|
|
921
921
|
import { jsx as jsx295, jsxs as jsxs189 } from "react/jsx-runtime";
|
|
922
|
-
var AccordionItem = (
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
{
|
|
934
|
-
className: "accordion-header",
|
|
935
|
-
onClick: onToggle,
|
|
936
|
-
"aria-expanded": isOpen,
|
|
937
|
-
children: [
|
|
938
|
-
/* @__PURE__ */ jsx295("span", { className: "title", children: item.title }),
|
|
939
|
-
/* @__PURE__ */ jsx295("span", { className: "chevron", children: /* @__PURE__ */ jsx295(ChevronDownIcon_default, {}) })
|
|
940
|
-
]
|
|
941
|
-
}
|
|
942
|
-
),
|
|
943
|
-
/* @__PURE__ */ jsx295(
|
|
944
|
-
"div",
|
|
945
|
-
{
|
|
946
|
-
ref: bodyRef,
|
|
947
|
-
className: "accordion-body",
|
|
948
|
-
style: { maxHeight: isOpen ? height : 0 },
|
|
949
|
-
children: /* @__PURE__ */ jsx295("div", { className: "accordion-content", children: item.content })
|
|
922
|
+
var AccordionItem = React.memo(
|
|
923
|
+
({
|
|
924
|
+
item,
|
|
925
|
+
isOpen,
|
|
926
|
+
onToggle
|
|
927
|
+
}) => {
|
|
928
|
+
const bodyRef = React.useRef(null);
|
|
929
|
+
const [height, setHeight] = React.useState(0);
|
|
930
|
+
React.useEffect(() => {
|
|
931
|
+
if (bodyRef.current) {
|
|
932
|
+
setHeight(bodyRef.current.scrollHeight);
|
|
950
933
|
}
|
|
951
|
-
)
|
|
952
|
-
|
|
953
|
-
|
|
934
|
+
}, [isOpen, item.content]);
|
|
935
|
+
return /* @__PURE__ */ jsxs189("div", { className: clsx_default("accordion-item", { open: isOpen }), children: [
|
|
936
|
+
/* @__PURE__ */ jsxs189(
|
|
937
|
+
"button",
|
|
938
|
+
{
|
|
939
|
+
className: "accordion-header",
|
|
940
|
+
onClick: onToggle,
|
|
941
|
+
"aria-expanded": isOpen,
|
|
942
|
+
children: [
|
|
943
|
+
/* @__PURE__ */ jsx295("span", { className: "title", children: item.title }),
|
|
944
|
+
/* @__PURE__ */ jsx295("span", { className: "chevron", children: /* @__PURE__ */ jsx295(ChevronDownIcon_default, {}) })
|
|
945
|
+
]
|
|
946
|
+
}
|
|
947
|
+
),
|
|
948
|
+
/* @__PURE__ */ jsx295(
|
|
949
|
+
"div",
|
|
950
|
+
{
|
|
951
|
+
ref: bodyRef,
|
|
952
|
+
className: "accordion-body",
|
|
953
|
+
style: { maxHeight: isOpen ? height : 0 },
|
|
954
|
+
children: /* @__PURE__ */ jsx295("div", { className: "accordion-content", children: item.content })
|
|
955
|
+
}
|
|
956
|
+
)
|
|
957
|
+
] });
|
|
958
|
+
}
|
|
959
|
+
);
|
|
960
|
+
AccordionItem.displayName = "AccordionItem";
|
|
954
961
|
var Accordion = (props) => {
|
|
955
962
|
const { items } = props;
|
|
956
963
|
const isMultiple = props.multiple === true;
|
|
@@ -1064,6 +1064,76 @@ var MONTH_LABELS = {
|
|
|
1064
1064
|
|
|
1065
1065
|
// src/components/Calendar/Calendar.tsx
|
|
1066
1066
|
var import_jsx_runtime295 = require("react/jsx-runtime");
|
|
1067
|
+
var DayCell = import_react2.default.memo(
|
|
1068
|
+
({
|
|
1069
|
+
day,
|
|
1070
|
+
disabled,
|
|
1071
|
+
selected,
|
|
1072
|
+
dayEvents,
|
|
1073
|
+
renderDay,
|
|
1074
|
+
onSelect,
|
|
1075
|
+
onEventClick
|
|
1076
|
+
}) => {
|
|
1077
|
+
if (renderDay) {
|
|
1078
|
+
return /* @__PURE__ */ (0, import_jsx_runtime295.jsx)(
|
|
1079
|
+
"div",
|
|
1080
|
+
{
|
|
1081
|
+
className: clsx_default(
|
|
1082
|
+
"calendar-day",
|
|
1083
|
+
!day.isCurrentMonth && "outside",
|
|
1084
|
+
disabled && "disabled",
|
|
1085
|
+
selected && "selected",
|
|
1086
|
+
day.isToday && "today"
|
|
1087
|
+
),
|
|
1088
|
+
onClick: () => {
|
|
1089
|
+
if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
|
|
1090
|
+
},
|
|
1091
|
+
children: renderDay(day, dayEvents)
|
|
1092
|
+
}
|
|
1093
|
+
);
|
|
1094
|
+
}
|
|
1095
|
+
return /* @__PURE__ */ (0, import_jsx_runtime295.jsxs)(
|
|
1096
|
+
"div",
|
|
1097
|
+
{
|
|
1098
|
+
className: clsx_default(
|
|
1099
|
+
"calendar-day",
|
|
1100
|
+
!day.isCurrentMonth && "outside",
|
|
1101
|
+
disabled && "disabled",
|
|
1102
|
+
selected && "selected",
|
|
1103
|
+
day.isToday && "today",
|
|
1104
|
+
day.isSunday && "sunday",
|
|
1105
|
+
day.isSaturday && "saturday"
|
|
1106
|
+
),
|
|
1107
|
+
onClick: () => {
|
|
1108
|
+
if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
|
|
1109
|
+
},
|
|
1110
|
+
children: [
|
|
1111
|
+
/* @__PURE__ */ (0, import_jsx_runtime295.jsx)("span", { className: "calendar-day-number", children: day.day }),
|
|
1112
|
+
dayEvents.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime295.jsxs)("div", { className: "calendar-day-events", children: [
|
|
1113
|
+
dayEvents.slice(0, 3).map((event, ei) => /* @__PURE__ */ (0, import_jsx_runtime295.jsx)(
|
|
1114
|
+
"span",
|
|
1115
|
+
{
|
|
1116
|
+
className: "calendar-event-dot",
|
|
1117
|
+
style: { backgroundColor: event.color ?? "var(--xplat-blue-500)" },
|
|
1118
|
+
title: event.label,
|
|
1119
|
+
onClick: (e) => {
|
|
1120
|
+
e.stopPropagation();
|
|
1121
|
+
onEventClick?.(event);
|
|
1122
|
+
}
|
|
1123
|
+
},
|
|
1124
|
+
ei
|
|
1125
|
+
)),
|
|
1126
|
+
dayEvents.length > 3 && /* @__PURE__ */ (0, import_jsx_runtime295.jsxs)("span", { className: "calendar-event-more", children: [
|
|
1127
|
+
"+",
|
|
1128
|
+
dayEvents.length - 3
|
|
1129
|
+
] })
|
|
1130
|
+
] })
|
|
1131
|
+
]
|
|
1132
|
+
}
|
|
1133
|
+
);
|
|
1134
|
+
}
|
|
1135
|
+
);
|
|
1136
|
+
DayCell.displayName = "DayCell";
|
|
1067
1137
|
var Calendar = (props) => {
|
|
1068
1138
|
const {
|
|
1069
1139
|
year: yearProp,
|
|
@@ -1149,12 +1219,28 @@ var Calendar = (props) => {
|
|
|
1149
1219
|
setPickerMode("months");
|
|
1150
1220
|
onMonthChange?.(y, month);
|
|
1151
1221
|
};
|
|
1152
|
-
const
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1222
|
+
const minTime = import_react2.default.useMemo(
|
|
1223
|
+
() => minDate ? new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate()).getTime() : -Infinity,
|
|
1224
|
+
[minDate]
|
|
1225
|
+
);
|
|
1226
|
+
const maxTime = import_react2.default.useMemo(
|
|
1227
|
+
() => maxDate ? new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate()).getTime() : Infinity,
|
|
1228
|
+
[maxDate]
|
|
1229
|
+
);
|
|
1230
|
+
const eventsMap = import_react2.default.useMemo(() => {
|
|
1231
|
+
const map = /* @__PURE__ */ new Map();
|
|
1232
|
+
for (const e of events) {
|
|
1233
|
+
const key = `${e.date.getFullYear()}-${e.date.getMonth()}-${e.date.getDate()}`;
|
|
1234
|
+
const arr = map.get(key);
|
|
1235
|
+
if (arr) arr.push(e);
|
|
1236
|
+
else map.set(key, [e]);
|
|
1237
|
+
}
|
|
1238
|
+
return map;
|
|
1239
|
+
}, [events]);
|
|
1240
|
+
const getEventsForDay = import_react2.default.useCallback(
|
|
1241
|
+
(date) => eventsMap.get(`${date.getFullYear()}-${date.getMonth()}-${date.getDate()}`) ?? [],
|
|
1242
|
+
[eventsMap]
|
|
1243
|
+
);
|
|
1158
1244
|
const weekdays = WEEKDAY_LABELS[locale];
|
|
1159
1245
|
const monthLabels = MONTH_LABELS[locale];
|
|
1160
1246
|
const titleText = pickerMode === "days" ? locale === "ko" ? `${year}\uB144 ${monthLabels[month]}` : `${monthLabels[month]} ${year}` : pickerMode === "months" ? `${year}` : `${yearRangeStart} - ${yearRangeStart + 11}`;
|
|
@@ -1208,64 +1294,19 @@ var Calendar = (props) => {
|
|
|
1208
1294
|
)) }),
|
|
1209
1295
|
/* @__PURE__ */ (0, import_jsx_runtime295.jsx)("div", { className: "calendar-grid", children: days.map((day, idx) => {
|
|
1210
1296
|
const dayEvents = getEventsForDay(day.date);
|
|
1211
|
-
const
|
|
1297
|
+
const t = day.date.getTime();
|
|
1298
|
+
const disabled = t < minTime || t > maxTime;
|
|
1212
1299
|
const isSelected = selectedDate ? isSameDay(day.date, selectedDate) : false;
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
"div",
|
|
1216
|
-
{
|
|
1217
|
-
className: clsx_default(
|
|
1218
|
-
"calendar-day",
|
|
1219
|
-
!day.isCurrentMonth && "outside",
|
|
1220
|
-
disabled && "disabled",
|
|
1221
|
-
isSelected && "selected",
|
|
1222
|
-
day.isToday && "today"
|
|
1223
|
-
),
|
|
1224
|
-
onClick: () => {
|
|
1225
|
-
if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
|
|
1226
|
-
},
|
|
1227
|
-
children: renderDay(day, dayEvents)
|
|
1228
|
-
},
|
|
1229
|
-
idx
|
|
1230
|
-
);
|
|
1231
|
-
}
|
|
1232
|
-
return /* @__PURE__ */ (0, import_jsx_runtime295.jsxs)(
|
|
1233
|
-
"div",
|
|
1300
|
+
return /* @__PURE__ */ (0, import_jsx_runtime295.jsx)(
|
|
1301
|
+
DayCell,
|
|
1234
1302
|
{
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
day.isSaturday && "saturday"
|
|
1243
|
-
),
|
|
1244
|
-
onClick: () => {
|
|
1245
|
-
if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
|
|
1246
|
-
},
|
|
1247
|
-
children: [
|
|
1248
|
-
/* @__PURE__ */ (0, import_jsx_runtime295.jsx)("span", { className: "calendar-day-number", children: day.day }),
|
|
1249
|
-
dayEvents.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime295.jsxs)("div", { className: "calendar-day-events", children: [
|
|
1250
|
-
dayEvents.slice(0, 3).map((event, ei) => /* @__PURE__ */ (0, import_jsx_runtime295.jsx)(
|
|
1251
|
-
"span",
|
|
1252
|
-
{
|
|
1253
|
-
className: "calendar-event-dot",
|
|
1254
|
-
style: { backgroundColor: event.color ?? "var(--xplat-blue-500)" },
|
|
1255
|
-
title: event.label,
|
|
1256
|
-
onClick: (e) => {
|
|
1257
|
-
e.stopPropagation();
|
|
1258
|
-
onEventClick?.(event);
|
|
1259
|
-
}
|
|
1260
|
-
},
|
|
1261
|
-
ei
|
|
1262
|
-
)),
|
|
1263
|
-
dayEvents.length > 3 && /* @__PURE__ */ (0, import_jsx_runtime295.jsxs)("span", { className: "calendar-event-more", children: [
|
|
1264
|
-
"+",
|
|
1265
|
-
dayEvents.length - 3
|
|
1266
|
-
] })
|
|
1267
|
-
] })
|
|
1268
|
-
]
|
|
1303
|
+
day,
|
|
1304
|
+
disabled,
|
|
1305
|
+
selected: isSelected,
|
|
1306
|
+
dayEvents,
|
|
1307
|
+
renderDay,
|
|
1308
|
+
onSelect,
|
|
1309
|
+
onEventClick
|
|
1269
1310
|
},
|
|
1270
1311
|
idx
|
|
1271
1312
|
);
|
|
@@ -1025,6 +1025,76 @@ var MONTH_LABELS = {
|
|
|
1025
1025
|
|
|
1026
1026
|
// src/components/Calendar/Calendar.tsx
|
|
1027
1027
|
import { Fragment, jsx as jsx295, jsxs as jsxs189 } from "react/jsx-runtime";
|
|
1028
|
+
var DayCell = React2.memo(
|
|
1029
|
+
({
|
|
1030
|
+
day,
|
|
1031
|
+
disabled,
|
|
1032
|
+
selected,
|
|
1033
|
+
dayEvents,
|
|
1034
|
+
renderDay,
|
|
1035
|
+
onSelect,
|
|
1036
|
+
onEventClick
|
|
1037
|
+
}) => {
|
|
1038
|
+
if (renderDay) {
|
|
1039
|
+
return /* @__PURE__ */ jsx295(
|
|
1040
|
+
"div",
|
|
1041
|
+
{
|
|
1042
|
+
className: clsx_default(
|
|
1043
|
+
"calendar-day",
|
|
1044
|
+
!day.isCurrentMonth && "outside",
|
|
1045
|
+
disabled && "disabled",
|
|
1046
|
+
selected && "selected",
|
|
1047
|
+
day.isToday && "today"
|
|
1048
|
+
),
|
|
1049
|
+
onClick: () => {
|
|
1050
|
+
if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
|
|
1051
|
+
},
|
|
1052
|
+
children: renderDay(day, dayEvents)
|
|
1053
|
+
}
|
|
1054
|
+
);
|
|
1055
|
+
}
|
|
1056
|
+
return /* @__PURE__ */ jsxs189(
|
|
1057
|
+
"div",
|
|
1058
|
+
{
|
|
1059
|
+
className: clsx_default(
|
|
1060
|
+
"calendar-day",
|
|
1061
|
+
!day.isCurrentMonth && "outside",
|
|
1062
|
+
disabled && "disabled",
|
|
1063
|
+
selected && "selected",
|
|
1064
|
+
day.isToday && "today",
|
|
1065
|
+
day.isSunday && "sunday",
|
|
1066
|
+
day.isSaturday && "saturday"
|
|
1067
|
+
),
|
|
1068
|
+
onClick: () => {
|
|
1069
|
+
if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
|
|
1070
|
+
},
|
|
1071
|
+
children: [
|
|
1072
|
+
/* @__PURE__ */ jsx295("span", { className: "calendar-day-number", children: day.day }),
|
|
1073
|
+
dayEvents.length > 0 && /* @__PURE__ */ jsxs189("div", { className: "calendar-day-events", children: [
|
|
1074
|
+
dayEvents.slice(0, 3).map((event, ei) => /* @__PURE__ */ jsx295(
|
|
1075
|
+
"span",
|
|
1076
|
+
{
|
|
1077
|
+
className: "calendar-event-dot",
|
|
1078
|
+
style: { backgroundColor: event.color ?? "var(--xplat-blue-500)" },
|
|
1079
|
+
title: event.label,
|
|
1080
|
+
onClick: (e) => {
|
|
1081
|
+
e.stopPropagation();
|
|
1082
|
+
onEventClick?.(event);
|
|
1083
|
+
}
|
|
1084
|
+
},
|
|
1085
|
+
ei
|
|
1086
|
+
)),
|
|
1087
|
+
dayEvents.length > 3 && /* @__PURE__ */ jsxs189("span", { className: "calendar-event-more", children: [
|
|
1088
|
+
"+",
|
|
1089
|
+
dayEvents.length - 3
|
|
1090
|
+
] })
|
|
1091
|
+
] })
|
|
1092
|
+
]
|
|
1093
|
+
}
|
|
1094
|
+
);
|
|
1095
|
+
}
|
|
1096
|
+
);
|
|
1097
|
+
DayCell.displayName = "DayCell";
|
|
1028
1098
|
var Calendar = (props) => {
|
|
1029
1099
|
const {
|
|
1030
1100
|
year: yearProp,
|
|
@@ -1110,12 +1180,28 @@ var Calendar = (props) => {
|
|
|
1110
1180
|
setPickerMode("months");
|
|
1111
1181
|
onMonthChange?.(y, month);
|
|
1112
1182
|
};
|
|
1113
|
-
const
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1183
|
+
const minTime = React2.useMemo(
|
|
1184
|
+
() => minDate ? new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate()).getTime() : -Infinity,
|
|
1185
|
+
[minDate]
|
|
1186
|
+
);
|
|
1187
|
+
const maxTime = React2.useMemo(
|
|
1188
|
+
() => maxDate ? new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate()).getTime() : Infinity,
|
|
1189
|
+
[maxDate]
|
|
1190
|
+
);
|
|
1191
|
+
const eventsMap = React2.useMemo(() => {
|
|
1192
|
+
const map = /* @__PURE__ */ new Map();
|
|
1193
|
+
for (const e of events) {
|
|
1194
|
+
const key = `${e.date.getFullYear()}-${e.date.getMonth()}-${e.date.getDate()}`;
|
|
1195
|
+
const arr = map.get(key);
|
|
1196
|
+
if (arr) arr.push(e);
|
|
1197
|
+
else map.set(key, [e]);
|
|
1198
|
+
}
|
|
1199
|
+
return map;
|
|
1200
|
+
}, [events]);
|
|
1201
|
+
const getEventsForDay = React2.useCallback(
|
|
1202
|
+
(date) => eventsMap.get(`${date.getFullYear()}-${date.getMonth()}-${date.getDate()}`) ?? [],
|
|
1203
|
+
[eventsMap]
|
|
1204
|
+
);
|
|
1119
1205
|
const weekdays = WEEKDAY_LABELS[locale];
|
|
1120
1206
|
const monthLabels = MONTH_LABELS[locale];
|
|
1121
1207
|
const titleText = pickerMode === "days" ? locale === "ko" ? `${year}\uB144 ${monthLabels[month]}` : `${monthLabels[month]} ${year}` : pickerMode === "months" ? `${year}` : `${yearRangeStart} - ${yearRangeStart + 11}`;
|
|
@@ -1169,64 +1255,19 @@ var Calendar = (props) => {
|
|
|
1169
1255
|
)) }),
|
|
1170
1256
|
/* @__PURE__ */ jsx295("div", { className: "calendar-grid", children: days.map((day, idx) => {
|
|
1171
1257
|
const dayEvents = getEventsForDay(day.date);
|
|
1172
|
-
const
|
|
1258
|
+
const t = day.date.getTime();
|
|
1259
|
+
const disabled = t < minTime || t > maxTime;
|
|
1173
1260
|
const isSelected = selectedDate ? isSameDay(day.date, selectedDate) : false;
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
"div",
|
|
1177
|
-
{
|
|
1178
|
-
className: clsx_default(
|
|
1179
|
-
"calendar-day",
|
|
1180
|
-
!day.isCurrentMonth && "outside",
|
|
1181
|
-
disabled && "disabled",
|
|
1182
|
-
isSelected && "selected",
|
|
1183
|
-
day.isToday && "today"
|
|
1184
|
-
),
|
|
1185
|
-
onClick: () => {
|
|
1186
|
-
if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
|
|
1187
|
-
},
|
|
1188
|
-
children: renderDay(day, dayEvents)
|
|
1189
|
-
},
|
|
1190
|
-
idx
|
|
1191
|
-
);
|
|
1192
|
-
}
|
|
1193
|
-
return /* @__PURE__ */ jsxs189(
|
|
1194
|
-
"div",
|
|
1261
|
+
return /* @__PURE__ */ jsx295(
|
|
1262
|
+
DayCell,
|
|
1195
1263
|
{
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
day.isSaturday && "saturday"
|
|
1204
|
-
),
|
|
1205
|
-
onClick: () => {
|
|
1206
|
-
if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
|
|
1207
|
-
},
|
|
1208
|
-
children: [
|
|
1209
|
-
/* @__PURE__ */ jsx295("span", { className: "calendar-day-number", children: day.day }),
|
|
1210
|
-
dayEvents.length > 0 && /* @__PURE__ */ jsxs189("div", { className: "calendar-day-events", children: [
|
|
1211
|
-
dayEvents.slice(0, 3).map((event, ei) => /* @__PURE__ */ jsx295(
|
|
1212
|
-
"span",
|
|
1213
|
-
{
|
|
1214
|
-
className: "calendar-event-dot",
|
|
1215
|
-
style: { backgroundColor: event.color ?? "var(--xplat-blue-500)" },
|
|
1216
|
-
title: event.label,
|
|
1217
|
-
onClick: (e) => {
|
|
1218
|
-
e.stopPropagation();
|
|
1219
|
-
onEventClick?.(event);
|
|
1220
|
-
}
|
|
1221
|
-
},
|
|
1222
|
-
ei
|
|
1223
|
-
)),
|
|
1224
|
-
dayEvents.length > 3 && /* @__PURE__ */ jsxs189("span", { className: "calendar-event-more", children: [
|
|
1225
|
-
"+",
|
|
1226
|
-
dayEvents.length - 3
|
|
1227
|
-
] })
|
|
1228
|
-
] })
|
|
1229
|
-
]
|
|
1264
|
+
day,
|
|
1265
|
+
disabled,
|
|
1266
|
+
selected: isSelected,
|
|
1267
|
+
dayEvents,
|
|
1268
|
+
renderDay,
|
|
1269
|
+
onSelect,
|
|
1270
|
+
onEventClick
|
|
1230
1271
|
},
|
|
1231
1272
|
idx
|
|
1232
1273
|
);
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/* src/components/Card/card.scss */
|
|
2
2
|
.lib-xplat-card {
|
|
3
|
+
contain: content;
|
|
4
|
+
width: 100%;
|
|
3
5
|
display: flex;
|
|
4
6
|
flex-direction: column;
|
|
5
7
|
flex: 1;
|
|
6
8
|
min-width: 0;
|
|
7
|
-
height:
|
|
9
|
+
height: 100%;
|
|
8
10
|
border-radius: var(--spacing-radius-xl);
|
|
9
11
|
border: 1px solid var(--semantic-border-strong);
|
|
10
12
|
background-color: var(--semantic-surface-neutral-default);
|