@deepnoid/ui 0.1.203 → 0.1.204

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.
@@ -66,6 +66,8 @@ var DatePicker = forwardRef((originalProps, ref) => {
66
66
  confirmTitle,
67
67
  range = false,
68
68
  dualCalendar = false,
69
+ disabledDates,
70
+ enabledDates,
69
71
  ...inputProps
70
72
  } = { ...props, ...variantProps };
71
73
  const [selectedDate, setSelectedDate] = useState(range ? "" : typeof value === "string" ? value || "" : "");
@@ -187,29 +189,18 @@ var DatePicker = forwardRef((originalProps, ref) => {
187
189
  for (let i = 0; i < dates.length; i += 7) weeks.push(dates.slice(i, i + 7));
188
190
  return weeks;
189
191
  }, []);
190
- const handleLeftPrevMonth = () => {
191
- const newLeftDate = new Date(leftCurrentDate.getFullYear(), leftCurrentDate.getMonth() - 1);
192
- setLeftCurrentDate(newLeftDate);
193
- if (dualCalendar) {
194
- setRightCurrentDate(new Date(newLeftDate.getFullYear(), newLeftDate.getMonth() + 1));
195
- }
196
- };
197
- const handleLeftNextMonth = () => {
198
- const newLeftDate = new Date(leftCurrentDate.getFullYear(), leftCurrentDate.getMonth() + 1);
199
- setLeftCurrentDate(newLeftDate);
200
- if (dualCalendar) {
201
- setRightCurrentDate(new Date(newLeftDate.getFullYear(), newLeftDate.getMonth() + 1));
202
- }
203
- };
204
- const handleRightNextMonth = () => {
205
- if (!dualCalendar) return;
206
- const newRightDate = new Date(rightCurrentDate.getFullYear(), rightCurrentDate.getMonth() + 1);
207
- setRightCurrentDate(newRightDate);
208
- setLeftCurrentDate(new Date(newRightDate.getFullYear(), newRightDate.getMonth() - 1));
209
- };
192
+ const isDateDisabled = useCallback(
193
+ (date) => {
194
+ if (enabledDates) return !enabledDates(date);
195
+ if (disabledDates) return disabledDates(date);
196
+ return false;
197
+ },
198
+ [disabledDates, enabledDates]
199
+ );
210
200
  const handleDateSelect = (date, isCurrentMonth, currentDate) => {
211
201
  if (!isCurrentMonth) return;
212
202
  const selected = new Date(currentDate.getFullYear(), currentDate.getMonth(), date);
203
+ if (isDateDisabled(selected)) return;
213
204
  const formatted = formatDateToString(selected);
214
205
  if (range) {
215
206
  if (rangeSelection === "start") {
@@ -220,7 +211,10 @@ var DatePicker = forwardRef((originalProps, ref) => {
220
211
  if (selected >= startDate) {
221
212
  setTempSelectedRange({ ...tempSelectedRange, endDate: formatted });
222
213
  } else {
223
- setTempSelectedRange({ startDate: formatted, endDate: tempSelectedRange.startDate });
214
+ setTempSelectedRange({
215
+ startDate: formatted,
216
+ endDate: tempSelectedRange.startDate
217
+ });
224
218
  }
225
219
  }
226
220
  } else {
@@ -229,6 +223,7 @@ var DatePicker = forwardRef((originalProps, ref) => {
229
223
  };
230
224
  const handleSetToday = () => {
231
225
  const today = /* @__PURE__ */ new Date();
226
+ if (isDateDisabled(today)) return;
232
227
  const formatted = formatDateToString(today);
233
228
  if (range) {
234
229
  if (rangeSelection === "start") {
@@ -239,7 +234,10 @@ var DatePicker = forwardRef((originalProps, ref) => {
239
234
  if (today >= startDate) {
240
235
  setTempSelectedRange({ ...tempSelectedRange, endDate: formatted });
241
236
  } else {
242
- setTempSelectedRange({ startDate: formatted, endDate: tempSelectedRange.startDate });
237
+ setTempSelectedRange({
238
+ startDate: formatted,
239
+ endDate: tempSelectedRange.startDate
240
+ });
243
241
  }
244
242
  }
245
243
  } else {
@@ -251,11 +249,11 @@ var DatePicker = forwardRef((originalProps, ref) => {
251
249
  const handleConfirmDate = () => {
252
250
  if (isConfirmDisabled) return;
253
251
  if (range) {
254
- setSelectedRange(tempSelectedRange);
255
252
  onChange == null ? void 0 : onChange(tempSelectedRange);
253
+ setSelectedRange(tempSelectedRange);
256
254
  } else {
257
- setSelectedDate(tempSelectedDate);
258
255
  onChange == null ? void 0 : onChange(tempSelectedDate);
256
+ setSelectedDate(tempSelectedDate);
259
257
  }
260
258
  setIsPanelOpen(false);
261
259
  };
@@ -270,31 +268,29 @@ var DatePicker = forwardRef((originalProps, ref) => {
270
268
  };
271
269
  const getDayProps = useCallback(
272
270
  (dateObj, currentDate) => {
271
+ const date = new Date(currentDate.getFullYear(), currentDate.getMonth(), dateObj.date);
272
+ if (isDateDisabled(date)) return "disabled";
273
273
  const today = /* @__PURE__ */ new Date();
274
274
  const isToday = today.getDate() === dateObj.date && today.getMonth() === currentDate.getMonth() && today.getFullYear() === currentDate.getFullYear();
275
275
  if (range) {
276
- const startFormatted = tempSelectedRange.startDate ? formatStringToDate(tempSelectedRange.startDate) : null;
277
- const endFormatted = tempSelectedRange.endDate ? formatStringToDate(tempSelectedRange.endDate) : null;
278
- const currentFormatted = new Date(currentDate.getFullYear(), currentDate.getMonth(), dateObj.date);
279
- const isStartSelected = startFormatted && startFormatted.getDate() === dateObj.date && startFormatted.getMonth() === currentDate.getMonth() && startFormatted.getFullYear() === currentDate.getFullYear();
280
- const isEndSelected = endFormatted && endFormatted.getDate() === dateObj.date && endFormatted.getMonth() === currentDate.getMonth() && endFormatted.getFullYear() === currentDate.getFullYear();
281
- const isInRange = startFormatted && endFormatted && currentFormatted > startFormatted && currentFormatted < endFormatted;
282
- if (dateObj.currentMonth && (isStartSelected || isEndSelected)) return "selected";
283
- if (dateObj.currentMonth && isInRange) return "period";
284
- if (dateObj.currentMonth && isToday) return "today";
285
- if (!dateObj.currentMonth) return "disabled";
286
- return "default";
287
- } else {
288
- const formatted = tempSelectedDate ? formatStringToDate(tempSelectedDate) : null;
289
- const isSelected = (formatted == null ? void 0 : formatted.getDate()) === dateObj.date && formatted.getMonth() === currentDate.getMonth() && formatted.getFullYear() === currentDate.getFullYear();
290
- return dateObj.currentMonth && isSelected ? "selected" : dateObj.currentMonth && isToday ? "today" : !dateObj.currentMonth ? "disabled" : "default";
276
+ const start = tempSelectedRange.startDate ? formatStringToDate(tempSelectedRange.startDate) : null;
277
+ const end = tempSelectedRange.endDate ? formatStringToDate(tempSelectedRange.endDate) : null;
278
+ const current = date;
279
+ const isStart = start && start.getFullYear() === current.getFullYear() && start.getMonth() === current.getMonth() && start.getDate() === current.getDate();
280
+ const isEnd = end && end.getFullYear() === current.getFullYear() && end.getMonth() === current.getMonth() && end.getDate() === current.getDate();
281
+ const isInRange = start && end && current > start && current < end;
282
+ if (isStart || isEnd) return "selected";
283
+ if (isInRange) return "period";
284
+ if (isToday) return "today";
285
+ return dateObj.currentMonth ? "default" : "disabled";
291
286
  }
287
+ const selected = tempSelectedDate ? formatStringToDate(tempSelectedDate) : null;
288
+ const isSelected = selected && selected.getFullYear() === date.getFullYear() && selected.getMonth() === date.getMonth() && selected.getDate() === date.getDate();
289
+ return isSelected ? "selected" : isToday ? "today" : dateObj.currentMonth ? "default" : "disabled";
292
290
  },
293
- [tempSelectedDate, tempSelectedRange, range]
291
+ [tempSelectedDate, tempSelectedRange, range, isDateDisabled]
294
292
  );
295
- const getPlaceholderText = () => {
296
- return placeholder;
297
- };
293
+ const getPlaceholderText = () => placeholder;
298
294
  useEffect(() => {
299
295
  if (range && typeof value === "object") {
300
296
  setSelectedRange(value || { startDate: "", endDate: "" });
@@ -315,17 +311,63 @@ var DatePicker = forwardRef((originalProps, ref) => {
315
311
  const endContent = /* @__PURE__ */ jsx(Icon_default, { name: "calendar", size, className: "cursor-pointer", fill: true, onClick: handleCalendarIconClick });
316
312
  const renderCalendar = (currentDate, isLeft) => /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-[5px]", children: [
317
313
  /* @__PURE__ */ jsx("div", { className: slots.calendarHead({ class: classNames == null ? void 0 : classNames.calendarHead }), children: dualCalendar ? isLeft ? /* @__PURE__ */ jsxs(Fragment2, { children: [
318
- /* @__PURE__ */ jsx(icon_button_default, { name: "left", variant: "soft", color: "neutral", onClick: handleLeftPrevMonth }),
314
+ /* @__PURE__ */ jsx(
315
+ icon_button_default,
316
+ {
317
+ name: "left",
318
+ variant: "soft",
319
+ color: "neutral",
320
+ onClick: () => {
321
+ const newLeft = new Date(leftCurrentDate.getFullYear(), leftCurrentDate.getMonth() - 1);
322
+ setLeftCurrentDate(newLeft);
323
+ setRightCurrentDate(new Date(newLeft.getFullYear(), newLeft.getMonth() + 1));
324
+ }
325
+ }
326
+ ),
319
327
  /* @__PURE__ */ jsx("span", { className: "text-xl font-extrabold", children: monthYearFormat(currentDate.getFullYear(), currentDate.getMonth()) }),
320
328
  /* @__PURE__ */ jsx("div", { className: "w-8" })
321
329
  ] }) : /* @__PURE__ */ jsxs(Fragment2, { children: [
322
330
  /* @__PURE__ */ jsx("div", { className: "w-8" }),
323
331
  /* @__PURE__ */ jsx("span", { className: "text-xl font-extrabold", children: monthYearFormat(currentDate.getFullYear(), currentDate.getMonth()) }),
324
- /* @__PURE__ */ jsx(icon_button_default, { name: "right", variant: "soft", color: "neutral", onClick: handleRightNextMonth })
332
+ /* @__PURE__ */ jsx(
333
+ icon_button_default,
334
+ {
335
+ name: "right",
336
+ variant: "soft",
337
+ color: "neutral",
338
+ onClick: () => {
339
+ const newRight = new Date(rightCurrentDate.getFullYear(), rightCurrentDate.getMonth() + 1);
340
+ setRightCurrentDate(newRight);
341
+ setLeftCurrentDate(new Date(newRight.getFullYear(), newRight.getMonth() - 1));
342
+ }
343
+ }
344
+ )
325
345
  ] }) : /* @__PURE__ */ jsxs(Fragment2, { children: [
326
- /* @__PURE__ */ jsx(icon_button_default, { name: "left", variant: "soft", color: "neutral", onClick: handleLeftPrevMonth }),
346
+ /* @__PURE__ */ jsx(
347
+ icon_button_default,
348
+ {
349
+ name: "left",
350
+ variant: "soft",
351
+ color: "neutral",
352
+ onClick: () => {
353
+ const newLeft = new Date(leftCurrentDate.getFullYear(), leftCurrentDate.getMonth() - 1);
354
+ setLeftCurrentDate(newLeft);
355
+ }
356
+ }
357
+ ),
327
358
  /* @__PURE__ */ jsx("span", { className: "text-xl font-extrabold", children: monthYearFormat(currentDate.getFullYear(), currentDate.getMonth()) }),
328
- /* @__PURE__ */ jsx(icon_button_default, { name: "right", variant: "soft", color: "neutral", onClick: handleLeftNextMonth })
359
+ /* @__PURE__ */ jsx(
360
+ icon_button_default,
361
+ {
362
+ name: "right",
363
+ variant: "soft",
364
+ color: "neutral",
365
+ onClick: () => {
366
+ const newLeft = new Date(leftCurrentDate.getFullYear(), leftCurrentDate.getMonth() + 1);
367
+ setLeftCurrentDate(newLeft);
368
+ }
369
+ }
370
+ )
329
371
  ] }) }),
330
372
  /* @__PURE__ */ jsx("div", { className: "grid grid-cols-7", children: daysOfWeek.map((day, index) => /* @__PURE__ */ jsx(day_default, { variant: "text", children: day }, `${day}-${index}`)) }),
331
373
  /* @__PURE__ */ jsx("div", { className: "grid grid-cols-7 gap-y-[5px] text-center", children: getCalendarDates(currentDate).map((week, weekIndex) => /* @__PURE__ */ jsx(Fragment, { children: week.map((dateObj, index) => {
@@ -31,6 +31,8 @@ interface DatePickerProps extends Omit<ComponentProps<"input">, "size" | "color"
31
31
  confirmTitle: string;
32
32
  range?: boolean;
33
33
  dualCalendar?: boolean;
34
+ disabledDates?: (date: Date) => boolean;
35
+ enabledDates?: (date: Date) => boolean;
34
36
  }
35
37
  declare const DatePicker: react.ForwardRefExoticComponent<Omit<DatePickerProps, "ref"> & react.RefAttributes<HTMLInputElement>>;
36
38
 
@@ -31,6 +31,8 @@ interface DatePickerProps extends Omit<ComponentProps<"input">, "size" | "color"
31
31
  confirmTitle: string;
32
32
  range?: boolean;
33
33
  dualCalendar?: boolean;
34
+ disabledDates?: (date: Date) => boolean;
35
+ enabledDates?: (date: Date) => boolean;
34
36
  }
35
37
  declare const DatePicker: react.ForwardRefExoticComponent<Omit<DatePickerProps, "ref"> & react.RefAttributes<HTMLInputElement>>;
36
38
 
@@ -6711,6 +6711,8 @@ var DatePicker = (0, import_react7.forwardRef)((originalProps, ref) => {
6711
6711
  confirmTitle,
6712
6712
  range = false,
6713
6713
  dualCalendar = false,
6714
+ disabledDates,
6715
+ enabledDates,
6714
6716
  ...inputProps
6715
6717
  } = { ...props, ...variantProps };
6716
6718
  const [selectedDate, setSelectedDate] = (0, import_react7.useState)(range ? "" : typeof value === "string" ? value || "" : "");
@@ -6832,29 +6834,18 @@ var DatePicker = (0, import_react7.forwardRef)((originalProps, ref) => {
6832
6834
  for (let i = 0; i < dates.length; i += 7) weeks.push(dates.slice(i, i + 7));
6833
6835
  return weeks;
6834
6836
  }, []);
6835
- const handleLeftPrevMonth = () => {
6836
- const newLeftDate = new Date(leftCurrentDate.getFullYear(), leftCurrentDate.getMonth() - 1);
6837
- setLeftCurrentDate(newLeftDate);
6838
- if (dualCalendar) {
6839
- setRightCurrentDate(new Date(newLeftDate.getFullYear(), newLeftDate.getMonth() + 1));
6840
- }
6841
- };
6842
- const handleLeftNextMonth = () => {
6843
- const newLeftDate = new Date(leftCurrentDate.getFullYear(), leftCurrentDate.getMonth() + 1);
6844
- setLeftCurrentDate(newLeftDate);
6845
- if (dualCalendar) {
6846
- setRightCurrentDate(new Date(newLeftDate.getFullYear(), newLeftDate.getMonth() + 1));
6847
- }
6848
- };
6849
- const handleRightNextMonth = () => {
6850
- if (!dualCalendar) return;
6851
- const newRightDate = new Date(rightCurrentDate.getFullYear(), rightCurrentDate.getMonth() + 1);
6852
- setRightCurrentDate(newRightDate);
6853
- setLeftCurrentDate(new Date(newRightDate.getFullYear(), newRightDate.getMonth() - 1));
6854
- };
6837
+ const isDateDisabled = (0, import_react7.useCallback)(
6838
+ (date) => {
6839
+ if (enabledDates) return !enabledDates(date);
6840
+ if (disabledDates) return disabledDates(date);
6841
+ return false;
6842
+ },
6843
+ [disabledDates, enabledDates]
6844
+ );
6855
6845
  const handleDateSelect = (date, isCurrentMonth, currentDate) => {
6856
6846
  if (!isCurrentMonth) return;
6857
6847
  const selected = new Date(currentDate.getFullYear(), currentDate.getMonth(), date);
6848
+ if (isDateDisabled(selected)) return;
6858
6849
  const formatted = formatDateToString(selected);
6859
6850
  if (range) {
6860
6851
  if (rangeSelection === "start") {
@@ -6865,7 +6856,10 @@ var DatePicker = (0, import_react7.forwardRef)((originalProps, ref) => {
6865
6856
  if (selected >= startDate) {
6866
6857
  setTempSelectedRange({ ...tempSelectedRange, endDate: formatted });
6867
6858
  } else {
6868
- setTempSelectedRange({ startDate: formatted, endDate: tempSelectedRange.startDate });
6859
+ setTempSelectedRange({
6860
+ startDate: formatted,
6861
+ endDate: tempSelectedRange.startDate
6862
+ });
6869
6863
  }
6870
6864
  }
6871
6865
  } else {
@@ -6874,6 +6868,7 @@ var DatePicker = (0, import_react7.forwardRef)((originalProps, ref) => {
6874
6868
  };
6875
6869
  const handleSetToday = () => {
6876
6870
  const today = /* @__PURE__ */ new Date();
6871
+ if (isDateDisabled(today)) return;
6877
6872
  const formatted = formatDateToString(today);
6878
6873
  if (range) {
6879
6874
  if (rangeSelection === "start") {
@@ -6884,7 +6879,10 @@ var DatePicker = (0, import_react7.forwardRef)((originalProps, ref) => {
6884
6879
  if (today >= startDate) {
6885
6880
  setTempSelectedRange({ ...tempSelectedRange, endDate: formatted });
6886
6881
  } else {
6887
- setTempSelectedRange({ startDate: formatted, endDate: tempSelectedRange.startDate });
6882
+ setTempSelectedRange({
6883
+ startDate: formatted,
6884
+ endDate: tempSelectedRange.startDate
6885
+ });
6888
6886
  }
6889
6887
  }
6890
6888
  } else {
@@ -6896,11 +6894,11 @@ var DatePicker = (0, import_react7.forwardRef)((originalProps, ref) => {
6896
6894
  const handleConfirmDate = () => {
6897
6895
  if (isConfirmDisabled) return;
6898
6896
  if (range) {
6899
- setSelectedRange(tempSelectedRange);
6900
6897
  onChange == null ? void 0 : onChange(tempSelectedRange);
6898
+ setSelectedRange(tempSelectedRange);
6901
6899
  } else {
6902
- setSelectedDate(tempSelectedDate);
6903
6900
  onChange == null ? void 0 : onChange(tempSelectedDate);
6901
+ setSelectedDate(tempSelectedDate);
6904
6902
  }
6905
6903
  setIsPanelOpen(false);
6906
6904
  };
@@ -6915,31 +6913,29 @@ var DatePicker = (0, import_react7.forwardRef)((originalProps, ref) => {
6915
6913
  };
6916
6914
  const getDayProps = (0, import_react7.useCallback)(
6917
6915
  (dateObj, currentDate) => {
6916
+ const date = new Date(currentDate.getFullYear(), currentDate.getMonth(), dateObj.date);
6917
+ if (isDateDisabled(date)) return "disabled";
6918
6918
  const today = /* @__PURE__ */ new Date();
6919
6919
  const isToday = today.getDate() === dateObj.date && today.getMonth() === currentDate.getMonth() && today.getFullYear() === currentDate.getFullYear();
6920
6920
  if (range) {
6921
- const startFormatted = tempSelectedRange.startDate ? formatStringToDate(tempSelectedRange.startDate) : null;
6922
- const endFormatted = tempSelectedRange.endDate ? formatStringToDate(tempSelectedRange.endDate) : null;
6923
- const currentFormatted = new Date(currentDate.getFullYear(), currentDate.getMonth(), dateObj.date);
6924
- const isStartSelected = startFormatted && startFormatted.getDate() === dateObj.date && startFormatted.getMonth() === currentDate.getMonth() && startFormatted.getFullYear() === currentDate.getFullYear();
6925
- const isEndSelected = endFormatted && endFormatted.getDate() === dateObj.date && endFormatted.getMonth() === currentDate.getMonth() && endFormatted.getFullYear() === currentDate.getFullYear();
6926
- const isInRange = startFormatted && endFormatted && currentFormatted > startFormatted && currentFormatted < endFormatted;
6927
- if (dateObj.currentMonth && (isStartSelected || isEndSelected)) return "selected";
6928
- if (dateObj.currentMonth && isInRange) return "period";
6929
- if (dateObj.currentMonth && isToday) return "today";
6930
- if (!dateObj.currentMonth) return "disabled";
6931
- return "default";
6932
- } else {
6933
- const formatted = tempSelectedDate ? formatStringToDate(tempSelectedDate) : null;
6934
- const isSelected = (formatted == null ? void 0 : formatted.getDate()) === dateObj.date && formatted.getMonth() === currentDate.getMonth() && formatted.getFullYear() === currentDate.getFullYear();
6935
- return dateObj.currentMonth && isSelected ? "selected" : dateObj.currentMonth && isToday ? "today" : !dateObj.currentMonth ? "disabled" : "default";
6936
- }
6921
+ const start = tempSelectedRange.startDate ? formatStringToDate(tempSelectedRange.startDate) : null;
6922
+ const end = tempSelectedRange.endDate ? formatStringToDate(tempSelectedRange.endDate) : null;
6923
+ const current = date;
6924
+ const isStart = start && start.getFullYear() === current.getFullYear() && start.getMonth() === current.getMonth() && start.getDate() === current.getDate();
6925
+ const isEnd = end && end.getFullYear() === current.getFullYear() && end.getMonth() === current.getMonth() && end.getDate() === current.getDate();
6926
+ const isInRange = start && end && current > start && current < end;
6927
+ if (isStart || isEnd) return "selected";
6928
+ if (isInRange) return "period";
6929
+ if (isToday) return "today";
6930
+ return dateObj.currentMonth ? "default" : "disabled";
6931
+ }
6932
+ const selected = tempSelectedDate ? formatStringToDate(tempSelectedDate) : null;
6933
+ const isSelected = selected && selected.getFullYear() === date.getFullYear() && selected.getMonth() === date.getMonth() && selected.getDate() === date.getDate();
6934
+ return isSelected ? "selected" : isToday ? "today" : dateObj.currentMonth ? "default" : "disabled";
6937
6935
  },
6938
- [tempSelectedDate, tempSelectedRange, range]
6936
+ [tempSelectedDate, tempSelectedRange, range, isDateDisabled]
6939
6937
  );
6940
- const getPlaceholderText = () => {
6941
- return placeholder;
6942
- };
6938
+ const getPlaceholderText = () => placeholder;
6943
6939
  (0, import_react7.useEffect)(() => {
6944
6940
  if (range && typeof value === "object") {
6945
6941
  setSelectedRange(value || { startDate: "", endDate: "" });
@@ -6960,17 +6956,63 @@ var DatePicker = (0, import_react7.forwardRef)((originalProps, ref) => {
6960
6956
  const endContent = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon_default, { name: "calendar", size, className: "cursor-pointer", fill: true, onClick: handleCalendarIconClick });
6961
6957
  const renderCalendar = (currentDate, isLeft) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col gap-[5px]", children: [
6962
6958
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: slots.calendarHead({ class: classNames == null ? void 0 : classNames.calendarHead }), children: dualCalendar ? isLeft ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
6963
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(icon_button_default, { name: "left", variant: "soft", color: "neutral", onClick: handleLeftPrevMonth }),
6959
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
6960
+ icon_button_default,
6961
+ {
6962
+ name: "left",
6963
+ variant: "soft",
6964
+ color: "neutral",
6965
+ onClick: () => {
6966
+ const newLeft = new Date(leftCurrentDate.getFullYear(), leftCurrentDate.getMonth() - 1);
6967
+ setLeftCurrentDate(newLeft);
6968
+ setRightCurrentDate(new Date(newLeft.getFullYear(), newLeft.getMonth() + 1));
6969
+ }
6970
+ }
6971
+ ),
6964
6972
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-xl font-extrabold", children: monthYearFormat(currentDate.getFullYear(), currentDate.getMonth()) }),
6965
6973
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "w-8" })
6966
6974
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
6967
6975
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "w-8" }),
6968
6976
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-xl font-extrabold", children: monthYearFormat(currentDate.getFullYear(), currentDate.getMonth()) }),
6969
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(icon_button_default, { name: "right", variant: "soft", color: "neutral", onClick: handleRightNextMonth })
6977
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
6978
+ icon_button_default,
6979
+ {
6980
+ name: "right",
6981
+ variant: "soft",
6982
+ color: "neutral",
6983
+ onClick: () => {
6984
+ const newRight = new Date(rightCurrentDate.getFullYear(), rightCurrentDate.getMonth() + 1);
6985
+ setRightCurrentDate(newRight);
6986
+ setLeftCurrentDate(new Date(newRight.getFullYear(), newRight.getMonth() - 1));
6987
+ }
6988
+ }
6989
+ )
6970
6990
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
6971
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(icon_button_default, { name: "left", variant: "soft", color: "neutral", onClick: handleLeftPrevMonth }),
6991
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
6992
+ icon_button_default,
6993
+ {
6994
+ name: "left",
6995
+ variant: "soft",
6996
+ color: "neutral",
6997
+ onClick: () => {
6998
+ const newLeft = new Date(leftCurrentDate.getFullYear(), leftCurrentDate.getMonth() - 1);
6999
+ setLeftCurrentDate(newLeft);
7000
+ }
7001
+ }
7002
+ ),
6972
7003
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-xl font-extrabold", children: monthYearFormat(currentDate.getFullYear(), currentDate.getMonth()) }),
6973
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(icon_button_default, { name: "right", variant: "soft", color: "neutral", onClick: handleLeftNextMonth })
7004
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
7005
+ icon_button_default,
7006
+ {
7007
+ name: "right",
7008
+ variant: "soft",
7009
+ color: "neutral",
7010
+ onClick: () => {
7011
+ const newLeft = new Date(leftCurrentDate.getFullYear(), leftCurrentDate.getMonth() + 1);
7012
+ setLeftCurrentDate(newLeft);
7013
+ }
7014
+ }
7015
+ )
6974
7016
  ] }) }),
6975
7017
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "grid grid-cols-7", children: daysOfWeek.map((day, index) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(day_default, { variant: "text", children: day }, `${day}-${index}`)) }),
6976
7018
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "grid grid-cols-7 gap-y-[5px] text-center", children: getCalendarDates(currentDate).map((week, weekIndex) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react7.Fragment, { children: week.map((dateObj, index) => {
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  datePickerStyle,
4
4
  datePicker_default
5
- } from "../../chunk-2EUKWA4W.mjs";
5
+ } from "../../chunk-AUGYJPCS.mjs";
6
6
  import "../../chunk-FWFEKWWD.mjs";
7
7
  import "../../chunk-XZYQFBCT.mjs";
8
8
  import "../../chunk-2GCSFWHD.mjs";