@x-plat/design-system 0.3.9 → 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;
@@ -21207,7 +21215,7 @@ var DayCell = import_react11.default.memo(
21207
21215
  disabled,
21208
21216
  selected,
21209
21217
  highlighted,
21210
- onClick
21218
+ onSelect
21211
21219
  }) => /* @__PURE__ */ (0, import_jsx_runtime312.jsx)(
21212
21220
  "button",
21213
21221
  {
@@ -21223,10 +21231,13 @@ var DayCell = import_react11.default.memo(
21223
21231
  day.isSaturday && "saturday"
21224
21232
  ),
21225
21233
  disabled: disabled || !day.isCurrentMonth,
21226
- onClick,
21234
+ onClick: () => {
21235
+ if (!disabled && day.isCurrentMonth) onSelect(day.date);
21236
+ },
21227
21237
  children: day.day
21228
21238
  }
21229
- )
21239
+ ),
21240
+ (prev, next) => prev.selected === next.selected && prev.disabled === next.disabled && prev.highlighted === next.highlighted && prev.day === next.day
21230
21241
  );
21231
21242
  DayCell.displayName = "DayCell";
21232
21243
  var SingleDatePicker = (props) => {
@@ -21304,9 +21315,7 @@ var SingleDatePicker = (props) => {
21304
21315
  disabled,
21305
21316
  selected,
21306
21317
  highlighted,
21307
- onClick: () => {
21308
- if (!disabled && day.isCurrentMonth) handleSelect(day.date);
21309
- }
21318
+ onSelect: handleSelect
21310
21319
  },
21311
21320
  idx
21312
21321
  );
package/dist/index.css CHANGED
@@ -796,14 +796,14 @@
796
796
  background-color: var(--xplat-blue-600);
797
797
  }
798
798
  .lib-xplat-calendar .calendar-day.selected {
799
- background-color: var(--xplat-neutral-900);
799
+ background-color: var(--calendar-selected-color, var(--xplat-neutral-900));
800
800
  }
801
801
  .lib-xplat-calendar .calendar-day.selected .calendar-day-number {
802
802
  color: var(--xplat-white);
803
803
  font-weight: 600;
804
804
  }
805
805
  .lib-xplat-calendar .calendar-day.selected:hover {
806
- background-color: var(--xplat-neutral-800);
806
+ background-color: color-mix(in srgb, var(--calendar-selected-color, var(--xplat-neutral-900)), black 12%);
807
807
  }
808
808
  .lib-xplat-calendar .calendar-day.selected.today .calendar-day-number::before {
809
809
  background-color: var(--xplat-white);
@@ -1326,6 +1326,10 @@
1326
1326
  border-radius: 12px;
1327
1327
  background-color: #fff;
1328
1328
  padding: 24px;
1329
+ width: fit-content;
1330
+ max-width: calc(100vw - 2rem);
1331
+ max-height: calc(100vh - 2rem);
1332
+ overflow: auto;
1329
1333
  transform: translate(-50%, -50%) scale(0.9);
1330
1334
  opacity: 0;
1331
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;
@@ -20814,7 +20822,7 @@ var DayCell = React9.memo(
20814
20822
  disabled,
20815
20823
  selected,
20816
20824
  highlighted,
20817
- onClick
20825
+ onSelect
20818
20826
  }) => /* @__PURE__ */ jsx312(
20819
20827
  "button",
20820
20828
  {
@@ -20830,10 +20838,13 @@ var DayCell = React9.memo(
20830
20838
  day.isSaturday && "saturday"
20831
20839
  ),
20832
20840
  disabled: disabled || !day.isCurrentMonth,
20833
- onClick,
20841
+ onClick: () => {
20842
+ if (!disabled && day.isCurrentMonth) onSelect(day.date);
20843
+ },
20834
20844
  children: day.day
20835
20845
  }
20836
- )
20846
+ ),
20847
+ (prev, next) => prev.selected === next.selected && prev.disabled === next.disabled && prev.highlighted === next.highlighted && prev.day === next.day
20837
20848
  );
20838
20849
  DayCell.displayName = "DayCell";
20839
20850
  var SingleDatePicker = (props) => {
@@ -20911,9 +20922,7 @@ var SingleDatePicker = (props) => {
20911
20922
  disabled,
20912
20923
  selected,
20913
20924
  highlighted,
20914
- onClick: () => {
20915
- if (!disabled && day.isCurrentMonth) handleSelect(day.date);
20916
- }
20925
+ onSelect: handleSelect
20917
20926
  },
20918
20927
  idx
20919
20928
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@x-plat/design-system",
3
- "version": "0.3.9",
3
+ "version": "0.4.0",
4
4
  "description": "XPLAT UI Design System",
5
5
  "author": "XPLAT WOONG",
6
6
  "main": "dist/index.cjs",