@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/index.cjs CHANGED
@@ -6183,6 +6183,7 @@ var Calendar = (props) => {
6183
6183
  locale = "ko",
6184
6184
  minDate,
6185
6185
  maxDate,
6186
+ selectedColor,
6186
6187
  showToday = true,
6187
6188
  className
6188
6189
  } = props;
@@ -6226,90 +6227,97 @@ var Calendar = (props) => {
6226
6227
  };
6227
6228
  const getEventsForDay = (date) => events.filter((e) => isSameDay(e.date, date));
6228
6229
  const weekdays = WEEKDAY_LABELS[locale];
6229
- return /* @__PURE__ */ (0, import_jsx_runtime301.jsxs)("div", { className: clsx_default("lib-xplat-calendar", className), children: [
6230
- /* @__PURE__ */ (0, import_jsx_runtime301.jsxs)("div", { className: "calendar-header", children: [
6231
- /* @__PURE__ */ (0, import_jsx_runtime301.jsx)("button", { className: "calendar-nav", onClick: handlePrev, "aria-label": "\uC774\uC804 \uB2EC", children: /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(ChevronLeftIcon_default, {}) }),
6232
- /* @__PURE__ */ (0, import_jsx_runtime301.jsx)("span", { className: "calendar-title", children: locale === "ko" ? `${year}\uB144 ${MONTH_LABELS.ko[month]}` : `${MONTH_LABELS.en[month]} ${year}` }),
6233
- /* @__PURE__ */ (0, import_jsx_runtime301.jsx)("button", { className: "calendar-nav", onClick: handleNext, "aria-label": "\uB2E4\uC74C \uB2EC", children: /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(ChevronRightIcon_default, {}) }),
6234
- showToday && /* @__PURE__ */ (0, import_jsx_runtime301.jsx)("button", { className: "calendar-today-btn", onClick: handleToday, children: locale === "ko" ? "\uC624\uB298" : "Today" })
6235
- ] }),
6236
- /* @__PURE__ */ (0, import_jsx_runtime301.jsx)("div", { className: "calendar-weekdays", children: weekdays.map((label, i) => /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(
6237
- "div",
6238
- {
6239
- className: clsx_default(
6240
- "calendar-weekday",
6241
- i === 0 && "sunday",
6242
- i === 6 && "saturday"
6243
- ),
6244
- children: label
6245
- },
6246
- label
6247
- )) }),
6248
- /* @__PURE__ */ (0, import_jsx_runtime301.jsx)("div", { className: "calendar-grid", children: days.map((day, idx) => {
6249
- const dayEvents = getEventsForDay(day.date);
6250
- const disabled = isDisabled(day.date);
6251
- const isSelected = selectedDate ? isSameDay(day.date, selectedDate) : false;
6252
- if (renderDay) {
6253
- return /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(
6230
+ return /* @__PURE__ */ (0, import_jsx_runtime301.jsxs)(
6231
+ "div",
6232
+ {
6233
+ className: clsx_default("lib-xplat-calendar", className),
6234
+ style: selectedColor ? { "--calendar-selected-color": `var(--${selectedColor})` } : void 0,
6235
+ children: [
6236
+ /* @__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 \uB2EC", children: /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(ChevronLeftIcon_default, {}) }),
6238
+ /* @__PURE__ */ (0, import_jsx_runtime301.jsx)("span", { className: "calendar-title", children: locale === "ko" ? `${year}\uB144 ${MONTH_LABELS.ko[month]}` : `${MONTH_LABELS.en[month]} ${year}` }),
6239
+ /* @__PURE__ */ (0, import_jsx_runtime301.jsx)("button", { className: "calendar-nav", onClick: handleNext, "aria-label": "\uB2E4\uC74C \uB2EC", children: /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(ChevronRightIcon_default, {}) }),
6240
+ showToday && /* @__PURE__ */ (0, import_jsx_runtime301.jsx)("button", { className: "calendar-today-btn", onClick: handleToday, children: locale === "ko" ? "\uC624\uB298" : "Today" })
6241
+ ] }),
6242
+ /* @__PURE__ */ (0, import_jsx_runtime301.jsx)("div", { className: "calendar-weekdays", children: weekdays.map((label, i) => /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(
6254
6243
  "div",
6255
6244
  {
6256
6245
  className: clsx_default(
6257
- "calendar-day",
6258
- !day.isCurrentMonth && "outside",
6259
- disabled && "disabled",
6260
- isSelected && "selected",
6261
- day.isToday && "today"
6246
+ "calendar-weekday",
6247
+ i === 0 && "sunday",
6248
+ i === 6 && "saturday"
6262
6249
  ),
6263
- onClick: () => {
6264
- if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
6265
- },
6266
- children: renderDay(day, dayEvents)
6267
- },
6268
- idx
6269
- );
6270
- }
6271
- return /* @__PURE__ */ (0, import_jsx_runtime301.jsxs)(
6272
- "div",
6273
- {
6274
- className: clsx_default(
6275
- "calendar-day",
6276
- !day.isCurrentMonth && "outside",
6277
- disabled && "disabled",
6278
- isSelected && "selected",
6279
- day.isToday && "today",
6280
- day.isSunday && "sunday",
6281
- day.isSaturday && "saturday"
6282
- ),
6283
- onClick: () => {
6284
- if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
6250
+ children: label
6285
6251
  },
6286
- children: [
6287
- /* @__PURE__ */ (0, import_jsx_runtime301.jsx)("span", { className: "calendar-day-number", children: day.day }),
6288
- dayEvents.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime301.jsxs)("div", { className: "calendar-day-events", children: [
6289
- dayEvents.slice(0, 3).map((event, ei) => /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(
6290
- "span",
6291
- {
6292
- className: "calendar-event-dot",
6293
- style: { backgroundColor: event.color ?? "var(--xplat-blue-500)" },
6294
- title: event.label,
6295
- onClick: (e) => {
6296
- e.stopPropagation();
6297
- onEventClick?.(event);
6298
- }
6252
+ label
6253
+ )) }),
6254
+ /* @__PURE__ */ (0, import_jsx_runtime301.jsx)("div", { className: "calendar-grid", children: days.map((day, idx) => {
6255
+ const dayEvents = getEventsForDay(day.date);
6256
+ const disabled = isDisabled(day.date);
6257
+ const isSelected = selectedDate ? isSameDay(day.date, selectedDate) : false;
6258
+ if (renderDay) {
6259
+ return /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(
6260
+ "div",
6261
+ {
6262
+ className: clsx_default(
6263
+ "calendar-day",
6264
+ !day.isCurrentMonth && "outside",
6265
+ disabled && "disabled",
6266
+ isSelected && "selected",
6267
+ day.isToday && "today"
6268
+ ),
6269
+ onClick: () => {
6270
+ if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
6299
6271
  },
6300
- ei
6301
- )),
6302
- dayEvents.length > 3 && /* @__PURE__ */ (0, import_jsx_runtime301.jsxs)("span", { className: "calendar-event-more", children: [
6303
- "+",
6304
- dayEvents.length - 3
6305
- ] })
6306
- ] })
6307
- ]
6308
- },
6309
- idx
6310
- );
6311
- }) })
6312
- ] });
6272
+ children: renderDay(day, dayEvents)
6273
+ },
6274
+ idx
6275
+ );
6276
+ }
6277
+ return /* @__PURE__ */ (0, import_jsx_runtime301.jsxs)(
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
+ }) })
6318
+ ]
6319
+ }
6320
+ );
6313
6321
  };
6314
6322
  Calendar.displayName = "Calendar";
6315
6323
  var Calendar_default = Calendar;
@@ -21201,6 +21209,37 @@ var useClickOutside_default = useClickOutside;
21201
21209
  // src/components/DatePicker/SingleDatePicker/index.tsx
21202
21210
  var import_react11 = __toESM(require("react"), 1);
21203
21211
  var import_jsx_runtime312 = require("react/jsx-runtime");
21212
+ var DayCell = import_react11.default.memo(
21213
+ ({
21214
+ day,
21215
+ disabled,
21216
+ selected,
21217
+ highlighted,
21218
+ onSelect
21219
+ }) => /* @__PURE__ */ (0, import_jsx_runtime312.jsx)(
21220
+ "button",
21221
+ {
21222
+ type: "button",
21223
+ className: clsx_default(
21224
+ "datepicker-day",
21225
+ !day.isCurrentMonth && "outside",
21226
+ disabled && "disabled",
21227
+ selected && "selected",
21228
+ highlighted && !selected && "highlighted",
21229
+ day.isToday && "today",
21230
+ day.isSunday && "sunday",
21231
+ day.isSaturday && "saturday"
21232
+ ),
21233
+ disabled: disabled || !day.isCurrentMonth,
21234
+ onClick: () => {
21235
+ if (!disabled && day.isCurrentMonth) onSelect(day.date);
21236
+ },
21237
+ children: day.day
21238
+ }
21239
+ ),
21240
+ (prev, next) => prev.selected === next.selected && prev.disabled === next.disabled && prev.highlighted === next.highlighted && prev.day === next.day
21241
+ );
21242
+ DayCell.displayName = "DayCell";
21204
21243
  var SingleDatePicker = (props) => {
21205
21244
  const {
21206
21245
  value,
@@ -21232,6 +21271,12 @@ var SingleDatePicker = (props) => {
21232
21271
  }
21233
21272
  return set2;
21234
21273
  }, [highlightDates]);
21274
+ const handleSelect = import_react11.default.useCallback(
21275
+ (date) => {
21276
+ onChange?.(date);
21277
+ },
21278
+ [onChange]
21279
+ );
21235
21280
  const weekdays = WEEKDAY_LABELS[locale];
21236
21281
  return /* @__PURE__ */ (0, import_jsx_runtime312.jsxs)(
21237
21282
  "div",
@@ -21264,26 +21309,13 @@ var SingleDatePicker = (props) => {
21264
21309
  `${day.date.getFullYear()}-${day.date.getMonth()}-${day.date.getDate()}`
21265
21310
  );
21266
21311
  return /* @__PURE__ */ (0, import_jsx_runtime312.jsx)(
21267
- "button",
21312
+ DayCell,
21268
21313
  {
21269
- type: "button",
21270
- className: clsx_default(
21271
- "datepicker-day",
21272
- !day.isCurrentMonth && "outside",
21273
- disabled && "disabled",
21274
- selected && "selected",
21275
- highlighted && !selected && "highlighted",
21276
- day.isToday && "today",
21277
- day.isSunday && "sunday",
21278
- day.isSaturday && "saturday"
21279
- ),
21280
- disabled: disabled || !day.isCurrentMonth,
21281
- onClick: () => {
21282
- if (!disabled && day.isCurrentMonth) {
21283
- onChange?.(day.date);
21284
- }
21285
- },
21286
- children: day.day
21314
+ day,
21315
+ disabled,
21316
+ selected,
21317
+ highlighted,
21318
+ onSelect: handleSelect
21287
21319
  },
21288
21320
  idx
21289
21321
  );
package/dist/index.css CHANGED
@@ -767,6 +767,12 @@
767
767
  .lib-xplat-calendar .calendar-day.outside .calendar-day-number {
768
768
  color: var(--xplat-neutral-300);
769
769
  }
770
+ .lib-xplat-calendar .calendar-day.outside.sunday .calendar-day-number {
771
+ color: color-mix(in srgb, var(--xplat-red-500) 35%, transparent);
772
+ }
773
+ .lib-xplat-calendar .calendar-day.outside.saturday .calendar-day-number {
774
+ color: color-mix(in srgb, var(--xplat-blue-500) 35%, transparent);
775
+ }
770
776
  .lib-xplat-calendar .calendar-day.disabled {
771
777
  cursor: not-allowed;
772
778
  }
@@ -778,34 +784,34 @@
778
784
  font-weight: 700;
779
785
  color: var(--xplat-blue-600);
780
786
  }
781
- .lib-xplat-calendar .calendar-day.today .calendar-day-number::after {
787
+ .lib-xplat-calendar .calendar-day.today .calendar-day-number::before {
782
788
  content: "";
783
789
  position: absolute;
784
- bottom: -2px;
785
- left: 50%;
786
- transform: translateX(-50%);
790
+ top: 50%;
791
+ left: -6px;
792
+ transform: translateY(-50%);
787
793
  width: 4px;
788
794
  height: 4px;
789
795
  border-radius: 50%;
790
796
  background-color: var(--xplat-blue-600);
791
797
  }
792
798
  .lib-xplat-calendar .calendar-day.selected {
793
- background-color: var(--xplat-neutral-900);
799
+ background-color: var(--calendar-selected-color, var(--xplat-neutral-900));
794
800
  }
795
801
  .lib-xplat-calendar .calendar-day.selected .calendar-day-number {
796
802
  color: var(--xplat-white);
797
803
  font-weight: 600;
798
804
  }
799
805
  .lib-xplat-calendar .calendar-day.selected:hover {
800
- background-color: var(--xplat-neutral-800);
806
+ background-color: color-mix(in srgb, var(--calendar-selected-color, var(--xplat-neutral-900)), black 12%);
801
807
  }
802
- .lib-xplat-calendar .calendar-day.selected.today .calendar-day-number::after {
808
+ .lib-xplat-calendar .calendar-day.selected.today .calendar-day-number::before {
803
809
  background-color: var(--xplat-white);
804
810
  }
805
- .lib-xplat-calendar .calendar-day.sunday .calendar-day-number {
811
+ .lib-xplat-calendar .calendar-day.sunday:not(.outside) .calendar-day-number {
806
812
  color: var(--xplat-red-500);
807
813
  }
808
- .lib-xplat-calendar .calendar-day.saturday .calendar-day-number {
814
+ .lib-xplat-calendar .calendar-day.saturday:not(.outside) .calendar-day-number {
809
815
  color: var(--xplat-blue-500);
810
816
  }
811
817
  .lib-xplat-calendar .calendar-day.selected .calendar-day-number {
@@ -1230,6 +1236,12 @@
1230
1236
  color: var(--xplat-neutral-300);
1231
1237
  cursor: default;
1232
1238
  }
1239
+ .lib-xplat-datepicker .datepicker-day.outside.sunday {
1240
+ color: color-mix(in srgb, var(--xplat-red-500) 35%, transparent);
1241
+ }
1242
+ .lib-xplat-datepicker .datepicker-day.outside.saturday {
1243
+ color: color-mix(in srgb, var(--xplat-blue-500) 35%, transparent);
1244
+ }
1233
1245
  .lib-xplat-datepicker .datepicker-day.disabled {
1234
1246
  color: var(--xplat-neutral-300);
1235
1247
  cursor: not-allowed;
@@ -1314,6 +1326,10 @@
1314
1326
  border-radius: 12px;
1315
1327
  background-color: #fff;
1316
1328
  padding: 24px;
1329
+ width: fit-content;
1330
+ max-width: calc(100vw - 2rem);
1331
+ max-height: calc(100vh - 2rem);
1332
+ overflow: auto;
1317
1333
  transform: translate(-50%, -50%) scale(0.9);
1318
1334
  opacity: 0;
1319
1335
  transition: transform 0.2s ease, opacity 0.2s ease;
package/dist/index.js CHANGED
@@ -5790,6 +5790,7 @@ var Calendar = (props) => {
5790
5790
  locale = "ko",
5791
5791
  minDate,
5792
5792
  maxDate,
5793
+ selectedColor,
5793
5794
  showToday = true,
5794
5795
  className
5795
5796
  } = props;
@@ -5833,90 +5834,97 @@ var Calendar = (props) => {
5833
5834
  };
5834
5835
  const getEventsForDay = (date) => events.filter((e) => isSameDay(e.date, date));
5835
5836
  const weekdays = WEEKDAY_LABELS[locale];
5836
- return /* @__PURE__ */ jsxs193("div", { className: clsx_default("lib-xplat-calendar", className), children: [
5837
- /* @__PURE__ */ jsxs193("div", { className: "calendar-header", children: [
5838
- /* @__PURE__ */ jsx301("button", { className: "calendar-nav", onClick: handlePrev, "aria-label": "\uC774\uC804 \uB2EC", children: /* @__PURE__ */ jsx301(ChevronLeftIcon_default, {}) }),
5839
- /* @__PURE__ */ jsx301("span", { className: "calendar-title", children: locale === "ko" ? `${year}\uB144 ${MONTH_LABELS.ko[month]}` : `${MONTH_LABELS.en[month]} ${year}` }),
5840
- /* @__PURE__ */ jsx301("button", { className: "calendar-nav", onClick: handleNext, "aria-label": "\uB2E4\uC74C \uB2EC", children: /* @__PURE__ */ jsx301(ChevronRightIcon_default, {}) }),
5841
- showToday && /* @__PURE__ */ jsx301("button", { className: "calendar-today-btn", onClick: handleToday, children: locale === "ko" ? "\uC624\uB298" : "Today" })
5842
- ] }),
5843
- /* @__PURE__ */ jsx301("div", { className: "calendar-weekdays", children: weekdays.map((label, i) => /* @__PURE__ */ jsx301(
5844
- "div",
5845
- {
5846
- className: clsx_default(
5847
- "calendar-weekday",
5848
- i === 0 && "sunday",
5849
- i === 6 && "saturday"
5850
- ),
5851
- children: label
5852
- },
5853
- label
5854
- )) }),
5855
- /* @__PURE__ */ jsx301("div", { className: "calendar-grid", children: days.map((day, idx) => {
5856
- const dayEvents = getEventsForDay(day.date);
5857
- const disabled = isDisabled(day.date);
5858
- const isSelected = selectedDate ? isSameDay(day.date, selectedDate) : false;
5859
- if (renderDay) {
5860
- return /* @__PURE__ */ jsx301(
5837
+ return /* @__PURE__ */ jsxs193(
5838
+ "div",
5839
+ {
5840
+ className: clsx_default("lib-xplat-calendar", className),
5841
+ style: selectedColor ? { "--calendar-selected-color": `var(--${selectedColor})` } : void 0,
5842
+ children: [
5843
+ /* @__PURE__ */ jsxs193("div", { className: "calendar-header", children: [
5844
+ /* @__PURE__ */ jsx301("button", { className: "calendar-nav", onClick: handlePrev, "aria-label": "\uC774\uC804 \uB2EC", children: /* @__PURE__ */ jsx301(ChevronLeftIcon_default, {}) }),
5845
+ /* @__PURE__ */ jsx301("span", { className: "calendar-title", children: locale === "ko" ? `${year}\uB144 ${MONTH_LABELS.ko[month]}` : `${MONTH_LABELS.en[month]} ${year}` }),
5846
+ /* @__PURE__ */ jsx301("button", { className: "calendar-nav", onClick: handleNext, "aria-label": "\uB2E4\uC74C \uB2EC", children: /* @__PURE__ */ jsx301(ChevronRightIcon_default, {}) }),
5847
+ showToday && /* @__PURE__ */ jsx301("button", { className: "calendar-today-btn", onClick: handleToday, children: locale === "ko" ? "\uC624\uB298" : "Today" })
5848
+ ] }),
5849
+ /* @__PURE__ */ jsx301("div", { className: "calendar-weekdays", children: weekdays.map((label, i) => /* @__PURE__ */ jsx301(
5861
5850
  "div",
5862
5851
  {
5863
5852
  className: clsx_default(
5864
- "calendar-day",
5865
- !day.isCurrentMonth && "outside",
5866
- disabled && "disabled",
5867
- isSelected && "selected",
5868
- day.isToday && "today"
5853
+ "calendar-weekday",
5854
+ i === 0 && "sunday",
5855
+ i === 6 && "saturday"
5869
5856
  ),
5870
- onClick: () => {
5871
- if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
5872
- },
5873
- children: renderDay(day, dayEvents)
5874
- },
5875
- idx
5876
- );
5877
- }
5878
- return /* @__PURE__ */ jsxs193(
5879
- "div",
5880
- {
5881
- className: clsx_default(
5882
- "calendar-day",
5883
- !day.isCurrentMonth && "outside",
5884
- disabled && "disabled",
5885
- isSelected && "selected",
5886
- day.isToday && "today",
5887
- day.isSunday && "sunday",
5888
- day.isSaturday && "saturday"
5889
- ),
5890
- onClick: () => {
5891
- if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
5857
+ children: label
5892
5858
  },
5893
- children: [
5894
- /* @__PURE__ */ jsx301("span", { className: "calendar-day-number", children: day.day }),
5895
- dayEvents.length > 0 && /* @__PURE__ */ jsxs193("div", { className: "calendar-day-events", children: [
5896
- dayEvents.slice(0, 3).map((event, ei) => /* @__PURE__ */ jsx301(
5897
- "span",
5898
- {
5899
- className: "calendar-event-dot",
5900
- style: { backgroundColor: event.color ?? "var(--xplat-blue-500)" },
5901
- title: event.label,
5902
- onClick: (e) => {
5903
- e.stopPropagation();
5904
- onEventClick?.(event);
5905
- }
5859
+ label
5860
+ )) }),
5861
+ /* @__PURE__ */ jsx301("div", { className: "calendar-grid", children: days.map((day, idx) => {
5862
+ const dayEvents = getEventsForDay(day.date);
5863
+ const disabled = isDisabled(day.date);
5864
+ const isSelected = selectedDate ? isSameDay(day.date, selectedDate) : false;
5865
+ if (renderDay) {
5866
+ return /* @__PURE__ */ jsx301(
5867
+ "div",
5868
+ {
5869
+ className: clsx_default(
5870
+ "calendar-day",
5871
+ !day.isCurrentMonth && "outside",
5872
+ disabled && "disabled",
5873
+ isSelected && "selected",
5874
+ day.isToday && "today"
5875
+ ),
5876
+ onClick: () => {
5877
+ if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
5906
5878
  },
5907
- ei
5908
- )),
5909
- dayEvents.length > 3 && /* @__PURE__ */ jsxs193("span", { className: "calendar-event-more", children: [
5910
- "+",
5911
- dayEvents.length - 3
5912
- ] })
5913
- ] })
5914
- ]
5915
- },
5916
- idx
5917
- );
5918
- }) })
5919
- ] });
5879
+ children: renderDay(day, dayEvents)
5880
+ },
5881
+ idx
5882
+ );
5883
+ }
5884
+ return /* @__PURE__ */ jsxs193(
5885
+ "div",
5886
+ {
5887
+ className: clsx_default(
5888
+ "calendar-day",
5889
+ !day.isCurrentMonth && "outside",
5890
+ disabled && "disabled",
5891
+ isSelected && "selected",
5892
+ day.isToday && "today",
5893
+ day.isSunday && "sunday",
5894
+ day.isSaturday && "saturday"
5895
+ ),
5896
+ onClick: () => {
5897
+ if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
5898
+ },
5899
+ children: [
5900
+ /* @__PURE__ */ jsx301("span", { className: "calendar-day-number", children: day.day }),
5901
+ dayEvents.length > 0 && /* @__PURE__ */ jsxs193("div", { className: "calendar-day-events", children: [
5902
+ dayEvents.slice(0, 3).map((event, ei) => /* @__PURE__ */ jsx301(
5903
+ "span",
5904
+ {
5905
+ className: "calendar-event-dot",
5906
+ style: { backgroundColor: event.color ?? "var(--xplat-blue-500)" },
5907
+ title: event.label,
5908
+ onClick: (e) => {
5909
+ e.stopPropagation();
5910
+ onEventClick?.(event);
5911
+ }
5912
+ },
5913
+ ei
5914
+ )),
5915
+ dayEvents.length > 3 && /* @__PURE__ */ jsxs193("span", { className: "calendar-event-more", children: [
5916
+ "+",
5917
+ dayEvents.length - 3
5918
+ ] })
5919
+ ] })
5920
+ ]
5921
+ },
5922
+ idx
5923
+ );
5924
+ }) })
5925
+ ]
5926
+ }
5927
+ );
5920
5928
  };
5921
5929
  Calendar.displayName = "Calendar";
5922
5930
  var Calendar_default = Calendar;
@@ -20808,6 +20816,37 @@ var useClickOutside_default = useClickOutside;
20808
20816
  // src/components/DatePicker/SingleDatePicker/index.tsx
20809
20817
  import React9 from "react";
20810
20818
  import { jsx as jsx312, jsxs as jsxs199 } from "react/jsx-runtime";
20819
+ var DayCell = React9.memo(
20820
+ ({
20821
+ day,
20822
+ disabled,
20823
+ selected,
20824
+ highlighted,
20825
+ onSelect
20826
+ }) => /* @__PURE__ */ jsx312(
20827
+ "button",
20828
+ {
20829
+ type: "button",
20830
+ className: clsx_default(
20831
+ "datepicker-day",
20832
+ !day.isCurrentMonth && "outside",
20833
+ disabled && "disabled",
20834
+ selected && "selected",
20835
+ highlighted && !selected && "highlighted",
20836
+ day.isToday && "today",
20837
+ day.isSunday && "sunday",
20838
+ day.isSaturday && "saturday"
20839
+ ),
20840
+ disabled: disabled || !day.isCurrentMonth,
20841
+ onClick: () => {
20842
+ if (!disabled && day.isCurrentMonth) onSelect(day.date);
20843
+ },
20844
+ children: day.day
20845
+ }
20846
+ ),
20847
+ (prev, next) => prev.selected === next.selected && prev.disabled === next.disabled && prev.highlighted === next.highlighted && prev.day === next.day
20848
+ );
20849
+ DayCell.displayName = "DayCell";
20811
20850
  var SingleDatePicker = (props) => {
20812
20851
  const {
20813
20852
  value,
@@ -20839,6 +20878,12 @@ var SingleDatePicker = (props) => {
20839
20878
  }
20840
20879
  return set2;
20841
20880
  }, [highlightDates]);
20881
+ const handleSelect = React9.useCallback(
20882
+ (date) => {
20883
+ onChange?.(date);
20884
+ },
20885
+ [onChange]
20886
+ );
20842
20887
  const weekdays = WEEKDAY_LABELS[locale];
20843
20888
  return /* @__PURE__ */ jsxs199(
20844
20889
  "div",
@@ -20871,26 +20916,13 @@ var SingleDatePicker = (props) => {
20871
20916
  `${day.date.getFullYear()}-${day.date.getMonth()}-${day.date.getDate()}`
20872
20917
  );
20873
20918
  return /* @__PURE__ */ jsx312(
20874
- "button",
20919
+ DayCell,
20875
20920
  {
20876
- type: "button",
20877
- className: clsx_default(
20878
- "datepicker-day",
20879
- !day.isCurrentMonth && "outside",
20880
- disabled && "disabled",
20881
- selected && "selected",
20882
- highlighted && !selected && "highlighted",
20883
- day.isToday && "today",
20884
- day.isSunday && "sunday",
20885
- day.isSaturday && "saturday"
20886
- ),
20887
- disabled: disabled || !day.isCurrentMonth,
20888
- onClick: () => {
20889
- if (!disabled && day.isCurrentMonth) {
20890
- onChange?.(day.date);
20891
- }
20892
- },
20893
- children: day.day
20921
+ day,
20922
+ disabled,
20923
+ selected,
20924
+ highlighted,
20925
+ onSelect: handleSelect
20894
20926
  },
20895
20927
  idx
20896
20928
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@x-plat/design-system",
3
- "version": "0.3.8",
3
+ "version": "0.4.0",
4
4
  "description": "XPLAT UI Design System",
5
5
  "author": "XPLAT WOONG",
6
6
  "main": "dist/index.cjs",