@deepnoid/ui 0.1.202 → 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.
@@ -642,53 +642,31 @@ function TableCell({
642
642
  }) {
643
643
  var _a, _b;
644
644
  const value = row[column.field];
645
- const formattedValue = ((_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) || value;
645
+ const formattedValue = (_b = (_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) != null ? _b : value;
646
646
  const content = column.renderCell ? column.renderCell({ id: row.id, field: column.field, value, formattedValue, row }) : formattedValue;
647
+ const isTextContent = ["string", "number"].includes(typeof content) || content === null || content === void 0;
647
648
  const tdRef = (0, import_react2.useRef)(null);
648
649
  const [showTitle, setShowTitle] = (0, import_react2.useState)(false);
649
- const isTextContent = ["string", "number"].includes(typeof content) || content === null || content === void 0;
650
- const checkOverflow = (el) => {
651
- if (el.scrollWidth > el.clientWidth) {
652
- return true;
653
- }
654
- const children = Array.from(el.children);
655
- for (const child of children) {
656
- if (child.scrollWidth > child.clientWidth) {
657
- return true;
658
- }
659
- }
660
- return false;
661
- };
662
- (0, import_react2.useEffect)(() => {
650
+ (0, import_react2.useLayoutEffect)(() => {
663
651
  if (tdRef.current && isTextContent) {
664
- setTimeout(() => {
665
- if (tdRef.current) {
666
- setShowTitle(checkOverflow(tdRef.current));
667
- }
668
- }, 0);
652
+ const el = tdRef.current;
653
+ setShowTitle(el.scrollWidth > el.clientWidth);
669
654
  }
670
655
  }, [content, isTextContent]);
671
656
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
672
657
  "td",
673
658
  {
674
659
  ref: tdRef,
675
- className: clsx(
676
- slots.td(),
677
- classNames == null ? void 0 : classNames.td,
678
- column.className,
679
- isTextContent && "truncate",
680
- isTextContent && "[&>*]:inline-block [&>*]:max-w-full [&>*]:truncate [&>*]:align-middle"
681
- ),
660
+ className: clsx(slots.td(), classNames == null ? void 0 : classNames.td, column.className, isTextContent && "truncate"),
682
661
  style: {
683
662
  ...getCellStyle(column),
684
663
  maxWidth: column.width || "150px",
685
664
  textAlign: column.align || "center",
686
- ...!isTextContent && {
687
- overflow: "visible",
688
- whiteSpace: "normal"
689
- }
665
+ whiteSpace: isTextContent ? "nowrap" : "normal",
666
+ overflow: isTextContent ? "hidden" : "visible",
667
+ textOverflow: isTextContent ? "ellipsis" : void 0
690
668
  },
691
- title: showTitle ? String(((_b = value == null ? void 0 : value.props) == null ? void 0 : _b.children) || content || "") : void 0,
669
+ title: showTitle && isTextContent ? String(content != null ? content : "") : void 0,
692
670
  children: content
693
671
  },
694
672
  `${row.id}-${column.field}-${colIdx}-${rowIndex}`
@@ -6744,37 +6722,13 @@ function TableHeaderCell({
6744
6722
  }) {
6745
6723
  const thRef = (0, import_react7.useRef)(null);
6746
6724
  const [showTitle, setShowTitle] = (0, import_react7.useState)(false);
6747
- const checkOverflow = (el) => {
6748
- if (el.scrollWidth > el.clientWidth) {
6749
- return true;
6750
- }
6751
- const children = Array.from(el.children);
6752
- for (const child of children) {
6753
- if (child.scrollWidth > child.clientWidth) {
6754
- return true;
6755
- }
6756
- }
6757
- return false;
6758
- };
6759
- const extractTextFromContent = (node) => {
6760
- if (typeof node === "string" || typeof node === "number") {
6761
- return String(node);
6762
- }
6763
- if ((0, import_react7.isValidElement)(node)) {
6764
- return String(node.props.children || "");
6765
- }
6766
- return "";
6767
- };
6768
- (0, import_react7.useEffect)(() => {
6769
- if (thRef.current && !isCheckbox) {
6770
- setTimeout(() => {
6771
- if (thRef.current) {
6772
- setShowTitle(checkOverflow(thRef.current));
6773
- }
6774
- }, 0);
6725
+ (0, import_react7.useLayoutEffect)(() => {
6726
+ if (!isCheckbox && thRef.current) {
6727
+ const el = thRef.current;
6728
+ setShowTitle(el.scrollWidth > el.clientWidth);
6775
6729
  }
6776
6730
  }, [content, isCheckbox]);
6777
- const titleText = !isCheckbox && showTitle ? extractTextFromContent(content) : void 0;
6731
+ const titleText = !isCheckbox && showTitle ? typeof content === "string" || typeof content === "number" ? String(content) : "" : void 0;
6778
6732
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
6779
6733
  "th",
6780
6734
  {
@@ -6787,7 +6741,10 @@ function TableHeaderCell({
6787
6741
  flexShrink: 0,
6788
6742
  flexGrow: 0,
6789
6743
  boxSizing: "border-box"
6790
- } : column ? { ...getCellStyle(column), textAlign: "center" } : void 0,
6744
+ } : column ? {
6745
+ ...getCellStyle(column),
6746
+ textAlign: "center"
6747
+ } : void 0,
6791
6748
  title: titleText,
6792
6749
  children: content
6793
6750
  }
@@ -6796,7 +6753,6 @@ function TableHeaderCell({
6796
6753
  var TableHead = ({
6797
6754
  slots,
6798
6755
  columns,
6799
- color,
6800
6756
  size,
6801
6757
  rowCheckbox = false,
6802
6758
  hasCheckedRows,
@@ -1,13 +1,13 @@
1
1
  "use client";
2
2
  import {
3
3
  table_head_default
4
- } from "../../chunk-KYWCJIXI.mjs";
4
+ } from "../../chunk-W3V4SZV5.mjs";
5
5
  import "../../chunk-7B7LRG5J.mjs";
6
6
  import "../../chunk-VVCSY7DG.mjs";
7
7
  import "../../chunk-F3HENRVM.mjs";
8
+ import "../../chunk-QZ3LVYJW.mjs";
8
9
  import "../../chunk-2GCSFWHD.mjs";
9
10
  import "../../chunk-3RTVVQA3.mjs";
10
- import "../../chunk-QZ3LVYJW.mjs";
11
11
  import "../../chunk-DQRAFUDA.mjs";
12
12
  import "../../chunk-EWS3FESG.mjs";
13
13
  import "../../chunk-OEIEALIP.mjs";
@@ -639,37 +639,13 @@ function TableHeaderCell({
639
639
  }) {
640
640
  const thRef = (0, import_react2.useRef)(null);
641
641
  const [showTitle, setShowTitle] = (0, import_react2.useState)(false);
642
- const checkOverflow = (el) => {
643
- if (el.scrollWidth > el.clientWidth) {
644
- return true;
645
- }
646
- const children = Array.from(el.children);
647
- for (const child of children) {
648
- if (child.scrollWidth > child.clientWidth) {
649
- return true;
650
- }
651
- }
652
- return false;
653
- };
654
- const extractTextFromContent = (node) => {
655
- if (typeof node === "string" || typeof node === "number") {
656
- return String(node);
657
- }
658
- if ((0, import_react2.isValidElement)(node)) {
659
- return String(node.props.children || "");
660
- }
661
- return "";
662
- };
663
- (0, import_react2.useEffect)(() => {
664
- if (thRef.current && !isCheckbox) {
665
- setTimeout(() => {
666
- if (thRef.current) {
667
- setShowTitle(checkOverflow(thRef.current));
668
- }
669
- }, 0);
642
+ (0, import_react2.useLayoutEffect)(() => {
643
+ if (!isCheckbox && thRef.current) {
644
+ const el = thRef.current;
645
+ setShowTitle(el.scrollWidth > el.clientWidth);
670
646
  }
671
647
  }, [content, isCheckbox]);
672
- const titleText = !isCheckbox && showTitle ? extractTextFromContent(content) : void 0;
648
+ const titleText = !isCheckbox && showTitle ? typeof content === "string" || typeof content === "number" ? String(content) : "" : void 0;
673
649
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
674
650
  "th",
675
651
  {
@@ -682,7 +658,10 @@ function TableHeaderCell({
682
658
  flexShrink: 0,
683
659
  flexGrow: 0,
684
660
  boxSizing: "border-box"
685
- } : column ? { ...getCellStyle(column), textAlign: "center" } : void 0,
661
+ } : column ? {
662
+ ...getCellStyle(column),
663
+ textAlign: "center"
664
+ } : void 0,
686
665
  title: titleText,
687
666
  children: content
688
667
  }
@@ -691,7 +670,6 @@ function TableHeaderCell({
691
670
  var TableHead = ({
692
671
  slots,
693
672
  columns,
694
- color,
695
673
  size,
696
674
  rowCheckbox = false,
697
675
  hasCheckedRows,
@@ -743,53 +721,31 @@ function TableCell({
743
721
  }) {
744
722
  var _a, _b;
745
723
  const value = row[column.field];
746
- const formattedValue = ((_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) || value;
724
+ const formattedValue = (_b = (_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) != null ? _b : value;
747
725
  const content = column.renderCell ? column.renderCell({ id: row.id, field: column.field, value, formattedValue, row }) : formattedValue;
726
+ const isTextContent = ["string", "number"].includes(typeof content) || content === null || content === void 0;
748
727
  const tdRef = (0, import_react3.useRef)(null);
749
728
  const [showTitle, setShowTitle] = (0, import_react3.useState)(false);
750
- const isTextContent = ["string", "number"].includes(typeof content) || content === null || content === void 0;
751
- const checkOverflow = (el) => {
752
- if (el.scrollWidth > el.clientWidth) {
753
- return true;
754
- }
755
- const children = Array.from(el.children);
756
- for (const child of children) {
757
- if (child.scrollWidth > child.clientWidth) {
758
- return true;
759
- }
760
- }
761
- return false;
762
- };
763
- (0, import_react3.useEffect)(() => {
729
+ (0, import_react3.useLayoutEffect)(() => {
764
730
  if (tdRef.current && isTextContent) {
765
- setTimeout(() => {
766
- if (tdRef.current) {
767
- setShowTitle(checkOverflow(tdRef.current));
768
- }
769
- }, 0);
731
+ const el = tdRef.current;
732
+ setShowTitle(el.scrollWidth > el.clientWidth);
770
733
  }
771
734
  }, [content, isTextContent]);
772
735
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
773
736
  "td",
774
737
  {
775
738
  ref: tdRef,
776
- className: clsx(
777
- slots.td(),
778
- classNames == null ? void 0 : classNames.td,
779
- column.className,
780
- isTextContent && "truncate",
781
- isTextContent && "[&>*]:inline-block [&>*]:max-w-full [&>*]:truncate [&>*]:align-middle"
782
- ),
739
+ className: clsx(slots.td(), classNames == null ? void 0 : classNames.td, column.className, isTextContent && "truncate"),
783
740
  style: {
784
741
  ...getCellStyle(column),
785
742
  maxWidth: column.width || "150px",
786
743
  textAlign: column.align || "center",
787
- ...!isTextContent && {
788
- overflow: "visible",
789
- whiteSpace: "normal"
790
- }
744
+ whiteSpace: isTextContent ? "nowrap" : "normal",
745
+ overflow: isTextContent ? "hidden" : "visible",
746
+ textOverflow: isTextContent ? "ellipsis" : void 0
791
747
  },
792
- title: showTitle ? String(((_b = value == null ? void 0 : value.props) == null ? void 0 : _b.children) || content || "") : void 0,
748
+ title: showTitle && isTextContent ? String(content != null ? content : "") : void 0,
793
749
  children: content
794
750
  },
795
751
  `${row.id}-${column.field}-${colIdx}-${rowIndex}`
@@ -2,13 +2,13 @@
2
2
  import {
3
3
  getCellStyle,
4
4
  table_default
5
- } from "../../chunk-KYWCJIXI.mjs";
5
+ } from "../../chunk-W3V4SZV5.mjs";
6
6
  import "../../chunk-7B7LRG5J.mjs";
7
7
  import "../../chunk-VVCSY7DG.mjs";
8
8
  import "../../chunk-F3HENRVM.mjs";
9
+ import "../../chunk-QZ3LVYJW.mjs";
9
10
  import "../../chunk-2GCSFWHD.mjs";
10
11
  import "../../chunk-3RTVVQA3.mjs";
11
- import "../../chunk-QZ3LVYJW.mjs";
12
12
  import "../../chunk-DQRAFUDA.mjs";
13
13
  import "../../chunk-EWS3FESG.mjs";
14
14
  import "../../chunk-OEIEALIP.mjs";
@@ -3,11 +3,11 @@ import "../../chunk-LUWGOKLG.mjs";
3
3
  import {
4
4
  ToastProvider,
5
5
  useToast
6
- } from "../../chunk-SSGCTWWW.mjs";
7
- import "../../chunk-ZOTHPHXA.mjs";
6
+ } from "../../chunk-L3A3IEKZ.mjs";
8
7
  import {
9
8
  toast_default
10
9
  } from "../../chunk-4F7SIDZB.mjs";
10
+ import "../../chunk-ZOTHPHXA.mjs";
11
11
  import "../../chunk-ZYIIXWVY.mjs";
12
12
  import "../../chunk-YEYUS6DW.mjs";
13
13
  import "../../chunk-E3G5QXSH.mjs";
@@ -2,9 +2,9 @@
2
2
  import {
3
3
  ToastProvider,
4
4
  useToast
5
- } from "../../chunk-SSGCTWWW.mjs";
6
- import "../../chunk-ZOTHPHXA.mjs";
5
+ } from "../../chunk-L3A3IEKZ.mjs";
7
6
  import "../../chunk-4F7SIDZB.mjs";
7
+ import "../../chunk-ZOTHPHXA.mjs";
8
8
  import "../../chunk-ZYIIXWVY.mjs";
9
9
  import "../../chunk-YEYUS6DW.mjs";
10
10
  import "../../chunk-E3G5QXSH.mjs";
package/dist/index.js CHANGED
@@ -8197,37 +8197,13 @@ function TableHeaderCell({
8197
8197
  }) {
8198
8198
  const thRef = (0, import_react15.useRef)(null);
8199
8199
  const [showTitle, setShowTitle] = (0, import_react15.useState)(false);
8200
- const checkOverflow = (el) => {
8201
- if (el.scrollWidth > el.clientWidth) {
8202
- return true;
8203
- }
8204
- const children = Array.from(el.children);
8205
- for (const child of children) {
8206
- if (child.scrollWidth > child.clientWidth) {
8207
- return true;
8208
- }
8209
- }
8210
- return false;
8211
- };
8212
- const extractTextFromContent = (node) => {
8213
- if (typeof node === "string" || typeof node === "number") {
8214
- return String(node);
8215
- }
8216
- if ((0, import_react15.isValidElement)(node)) {
8217
- return String(node.props.children || "");
8218
- }
8219
- return "";
8220
- };
8221
- (0, import_react15.useEffect)(() => {
8222
- if (thRef.current && !isCheckbox) {
8223
- setTimeout(() => {
8224
- if (thRef.current) {
8225
- setShowTitle(checkOverflow(thRef.current));
8226
- }
8227
- }, 0);
8200
+ (0, import_react15.useLayoutEffect)(() => {
8201
+ if (!isCheckbox && thRef.current) {
8202
+ const el = thRef.current;
8203
+ setShowTitle(el.scrollWidth > el.clientWidth);
8228
8204
  }
8229
8205
  }, [content, isCheckbox]);
8230
- const titleText = !isCheckbox && showTitle ? extractTextFromContent(content) : void 0;
8206
+ const titleText = !isCheckbox && showTitle ? typeof content === "string" || typeof content === "number" ? String(content) : "" : void 0;
8231
8207
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
8232
8208
  "th",
8233
8209
  {
@@ -8240,7 +8216,10 @@ function TableHeaderCell({
8240
8216
  flexShrink: 0,
8241
8217
  flexGrow: 0,
8242
8218
  boxSizing: "border-box"
8243
- } : column ? { ...getCellStyle(column), textAlign: "center" } : void 0,
8219
+ } : column ? {
8220
+ ...getCellStyle(column),
8221
+ textAlign: "center"
8222
+ } : void 0,
8244
8223
  title: titleText,
8245
8224
  children: content
8246
8225
  }
@@ -8249,7 +8228,6 @@ function TableHeaderCell({
8249
8228
  var TableHead = ({
8250
8229
  slots,
8251
8230
  columns,
8252
- color,
8253
8231
  size,
8254
8232
  rowCheckbox = false,
8255
8233
  hasCheckedRows,
@@ -8301,53 +8279,31 @@ function TableCell({
8301
8279
  }) {
8302
8280
  var _a, _b;
8303
8281
  const value = row[column.field];
8304
- const formattedValue = ((_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) || value;
8282
+ const formattedValue = (_b = (_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) != null ? _b : value;
8305
8283
  const content = column.renderCell ? column.renderCell({ id: row.id, field: column.field, value, formattedValue, row }) : formattedValue;
8284
+ const isTextContent = ["string", "number"].includes(typeof content) || content === null || content === void 0;
8306
8285
  const tdRef = (0, import_react16.useRef)(null);
8307
8286
  const [showTitle, setShowTitle] = (0, import_react16.useState)(false);
8308
- const isTextContent = ["string", "number"].includes(typeof content) || content === null || content === void 0;
8309
- const checkOverflow = (el) => {
8310
- if (el.scrollWidth > el.clientWidth) {
8311
- return true;
8312
- }
8313
- const children = Array.from(el.children);
8314
- for (const child of children) {
8315
- if (child.scrollWidth > child.clientWidth) {
8316
- return true;
8317
- }
8318
- }
8319
- return false;
8320
- };
8321
- (0, import_react16.useEffect)(() => {
8287
+ (0, import_react16.useLayoutEffect)(() => {
8322
8288
  if (tdRef.current && isTextContent) {
8323
- setTimeout(() => {
8324
- if (tdRef.current) {
8325
- setShowTitle(checkOverflow(tdRef.current));
8326
- }
8327
- }, 0);
8289
+ const el = tdRef.current;
8290
+ setShowTitle(el.scrollWidth > el.clientWidth);
8328
8291
  }
8329
8292
  }, [content, isTextContent]);
8330
8293
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
8331
8294
  "td",
8332
8295
  {
8333
8296
  ref: tdRef,
8334
- className: clsx(
8335
- slots.td(),
8336
- classNames == null ? void 0 : classNames.td,
8337
- column.className,
8338
- isTextContent && "truncate",
8339
- isTextContent && "[&>*]:inline-block [&>*]:max-w-full [&>*]:truncate [&>*]:align-middle"
8340
- ),
8297
+ className: clsx(slots.td(), classNames == null ? void 0 : classNames.td, column.className, isTextContent && "truncate"),
8341
8298
  style: {
8342
8299
  ...getCellStyle(column),
8343
8300
  maxWidth: column.width || "150px",
8344
8301
  textAlign: column.align || "center",
8345
- ...!isTextContent && {
8346
- overflow: "visible",
8347
- whiteSpace: "normal"
8348
- }
8302
+ whiteSpace: isTextContent ? "nowrap" : "normal",
8303
+ overflow: isTextContent ? "hidden" : "visible",
8304
+ textOverflow: isTextContent ? "ellipsis" : void 0
8349
8305
  },
8350
- title: showTitle ? String(((_b = value == null ? void 0 : value.props) == null ? void 0 : _b.children) || content || "") : void 0,
8306
+ title: showTitle && isTextContent ? String(content != null ? content : "") : void 0,
8351
8307
  children: content
8352
8308
  },
8353
8309
  `${row.id}-${column.field}-${colIdx}-${rowIndex}`
@@ -11472,6 +11428,8 @@ var DatePicker = (0, import_react34.forwardRef)((originalProps, ref) => {
11472
11428
  confirmTitle,
11473
11429
  range = false,
11474
11430
  dualCalendar = false,
11431
+ disabledDates,
11432
+ enabledDates,
11475
11433
  ...inputProps
11476
11434
  } = { ...props, ...variantProps };
11477
11435
  const [selectedDate, setSelectedDate] = (0, import_react34.useState)(range ? "" : typeof value === "string" ? value || "" : "");
@@ -11593,29 +11551,18 @@ var DatePicker = (0, import_react34.forwardRef)((originalProps, ref) => {
11593
11551
  for (let i = 0; i < dates.length; i += 7) weeks.push(dates.slice(i, i + 7));
11594
11552
  return weeks;
11595
11553
  }, []);
11596
- const handleLeftPrevMonth = () => {
11597
- const newLeftDate = new Date(leftCurrentDate.getFullYear(), leftCurrentDate.getMonth() - 1);
11598
- setLeftCurrentDate(newLeftDate);
11599
- if (dualCalendar) {
11600
- setRightCurrentDate(new Date(newLeftDate.getFullYear(), newLeftDate.getMonth() + 1));
11601
- }
11602
- };
11603
- const handleLeftNextMonth = () => {
11604
- const newLeftDate = new Date(leftCurrentDate.getFullYear(), leftCurrentDate.getMonth() + 1);
11605
- setLeftCurrentDate(newLeftDate);
11606
- if (dualCalendar) {
11607
- setRightCurrentDate(new Date(newLeftDate.getFullYear(), newLeftDate.getMonth() + 1));
11608
- }
11609
- };
11610
- const handleRightNextMonth = () => {
11611
- if (!dualCalendar) return;
11612
- const newRightDate = new Date(rightCurrentDate.getFullYear(), rightCurrentDate.getMonth() + 1);
11613
- setRightCurrentDate(newRightDate);
11614
- setLeftCurrentDate(new Date(newRightDate.getFullYear(), newRightDate.getMonth() - 1));
11615
- };
11554
+ const isDateDisabled = (0, import_react34.useCallback)(
11555
+ (date) => {
11556
+ if (enabledDates) return !enabledDates(date);
11557
+ if (disabledDates) return disabledDates(date);
11558
+ return false;
11559
+ },
11560
+ [disabledDates, enabledDates]
11561
+ );
11616
11562
  const handleDateSelect = (date, isCurrentMonth, currentDate) => {
11617
11563
  if (!isCurrentMonth) return;
11618
11564
  const selected = new Date(currentDate.getFullYear(), currentDate.getMonth(), date);
11565
+ if (isDateDisabled(selected)) return;
11619
11566
  const formatted = formatDateToString(selected);
11620
11567
  if (range) {
11621
11568
  if (rangeSelection === "start") {
@@ -11626,7 +11573,10 @@ var DatePicker = (0, import_react34.forwardRef)((originalProps, ref) => {
11626
11573
  if (selected >= startDate) {
11627
11574
  setTempSelectedRange({ ...tempSelectedRange, endDate: formatted });
11628
11575
  } else {
11629
- setTempSelectedRange({ startDate: formatted, endDate: tempSelectedRange.startDate });
11576
+ setTempSelectedRange({
11577
+ startDate: formatted,
11578
+ endDate: tempSelectedRange.startDate
11579
+ });
11630
11580
  }
11631
11581
  }
11632
11582
  } else {
@@ -11635,6 +11585,7 @@ var DatePicker = (0, import_react34.forwardRef)((originalProps, ref) => {
11635
11585
  };
11636
11586
  const handleSetToday = () => {
11637
11587
  const today = /* @__PURE__ */ new Date();
11588
+ if (isDateDisabled(today)) return;
11638
11589
  const formatted = formatDateToString(today);
11639
11590
  if (range) {
11640
11591
  if (rangeSelection === "start") {
@@ -11645,7 +11596,10 @@ var DatePicker = (0, import_react34.forwardRef)((originalProps, ref) => {
11645
11596
  if (today >= startDate) {
11646
11597
  setTempSelectedRange({ ...tempSelectedRange, endDate: formatted });
11647
11598
  } else {
11648
- setTempSelectedRange({ startDate: formatted, endDate: tempSelectedRange.startDate });
11599
+ setTempSelectedRange({
11600
+ startDate: formatted,
11601
+ endDate: tempSelectedRange.startDate
11602
+ });
11649
11603
  }
11650
11604
  }
11651
11605
  } else {
@@ -11657,11 +11611,11 @@ var DatePicker = (0, import_react34.forwardRef)((originalProps, ref) => {
11657
11611
  const handleConfirmDate = () => {
11658
11612
  if (isConfirmDisabled) return;
11659
11613
  if (range) {
11660
- setSelectedRange(tempSelectedRange);
11661
11614
  onChange == null ? void 0 : onChange(tempSelectedRange);
11615
+ setSelectedRange(tempSelectedRange);
11662
11616
  } else {
11663
- setSelectedDate(tempSelectedDate);
11664
11617
  onChange == null ? void 0 : onChange(tempSelectedDate);
11618
+ setSelectedDate(tempSelectedDate);
11665
11619
  }
11666
11620
  setIsPanelOpen(false);
11667
11621
  };
@@ -11676,31 +11630,29 @@ var DatePicker = (0, import_react34.forwardRef)((originalProps, ref) => {
11676
11630
  };
11677
11631
  const getDayProps = (0, import_react34.useCallback)(
11678
11632
  (dateObj, currentDate) => {
11633
+ const date = new Date(currentDate.getFullYear(), currentDate.getMonth(), dateObj.date);
11634
+ if (isDateDisabled(date)) return "disabled";
11679
11635
  const today = /* @__PURE__ */ new Date();
11680
11636
  const isToday = today.getDate() === dateObj.date && today.getMonth() === currentDate.getMonth() && today.getFullYear() === currentDate.getFullYear();
11681
11637
  if (range) {
11682
- const startFormatted = tempSelectedRange.startDate ? formatStringToDate(tempSelectedRange.startDate) : null;
11683
- const endFormatted = tempSelectedRange.endDate ? formatStringToDate(tempSelectedRange.endDate) : null;
11684
- const currentFormatted = new Date(currentDate.getFullYear(), currentDate.getMonth(), dateObj.date);
11685
- const isStartSelected = startFormatted && startFormatted.getDate() === dateObj.date && startFormatted.getMonth() === currentDate.getMonth() && startFormatted.getFullYear() === currentDate.getFullYear();
11686
- const isEndSelected = endFormatted && endFormatted.getDate() === dateObj.date && endFormatted.getMonth() === currentDate.getMonth() && endFormatted.getFullYear() === currentDate.getFullYear();
11687
- const isInRange = startFormatted && endFormatted && currentFormatted > startFormatted && currentFormatted < endFormatted;
11688
- if (dateObj.currentMonth && (isStartSelected || isEndSelected)) return "selected";
11689
- if (dateObj.currentMonth && isInRange) return "period";
11690
- if (dateObj.currentMonth && isToday) return "today";
11691
- if (!dateObj.currentMonth) return "disabled";
11692
- return "default";
11693
- } else {
11694
- const formatted = tempSelectedDate ? formatStringToDate(tempSelectedDate) : null;
11695
- const isSelected = (formatted == null ? void 0 : formatted.getDate()) === dateObj.date && formatted.getMonth() === currentDate.getMonth() && formatted.getFullYear() === currentDate.getFullYear();
11696
- return dateObj.currentMonth && isSelected ? "selected" : dateObj.currentMonth && isToday ? "today" : !dateObj.currentMonth ? "disabled" : "default";
11697
- }
11698
- },
11699
- [tempSelectedDate, tempSelectedRange, range]
11638
+ const start = tempSelectedRange.startDate ? formatStringToDate(tempSelectedRange.startDate) : null;
11639
+ const end = tempSelectedRange.endDate ? formatStringToDate(tempSelectedRange.endDate) : null;
11640
+ const current = date;
11641
+ const isStart = start && start.getFullYear() === current.getFullYear() && start.getMonth() === current.getMonth() && start.getDate() === current.getDate();
11642
+ const isEnd = end && end.getFullYear() === current.getFullYear() && end.getMonth() === current.getMonth() && end.getDate() === current.getDate();
11643
+ const isInRange = start && end && current > start && current < end;
11644
+ if (isStart || isEnd) return "selected";
11645
+ if (isInRange) return "period";
11646
+ if (isToday) return "today";
11647
+ return dateObj.currentMonth ? "default" : "disabled";
11648
+ }
11649
+ const selected = tempSelectedDate ? formatStringToDate(tempSelectedDate) : null;
11650
+ const isSelected = selected && selected.getFullYear() === date.getFullYear() && selected.getMonth() === date.getMonth() && selected.getDate() === date.getDate();
11651
+ return isSelected ? "selected" : isToday ? "today" : dateObj.currentMonth ? "default" : "disabled";
11652
+ },
11653
+ [tempSelectedDate, tempSelectedRange, range, isDateDisabled]
11700
11654
  );
11701
- const getPlaceholderText = () => {
11702
- return placeholder;
11703
- };
11655
+ const getPlaceholderText = () => placeholder;
11704
11656
  (0, import_react34.useEffect)(() => {
11705
11657
  if (range && typeof value === "object") {
11706
11658
  setSelectedRange(value || { startDate: "", endDate: "" });
@@ -11721,17 +11673,63 @@ var DatePicker = (0, import_react34.forwardRef)((originalProps, ref) => {
11721
11673
  const endContent = /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Icon_default, { name: "calendar", size, className: "cursor-pointer", fill: true, onClick: handleCalendarIconClick });
11722
11674
  const renderCalendar = (currentDate, isLeft) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-col gap-[5px]", children: [
11723
11675
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: slots.calendarHead({ class: classNames == null ? void 0 : classNames.calendarHead }), children: dualCalendar ? isLeft ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
11724
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(icon_button_default, { name: "left", variant: "soft", color: "neutral", onClick: handleLeftPrevMonth }),
11676
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
11677
+ icon_button_default,
11678
+ {
11679
+ name: "left",
11680
+ variant: "soft",
11681
+ color: "neutral",
11682
+ onClick: () => {
11683
+ const newLeft = new Date(leftCurrentDate.getFullYear(), leftCurrentDate.getMonth() - 1);
11684
+ setLeftCurrentDate(newLeft);
11685
+ setRightCurrentDate(new Date(newLeft.getFullYear(), newLeft.getMonth() + 1));
11686
+ }
11687
+ }
11688
+ ),
11725
11689
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "text-xl font-extrabold", children: monthYearFormat(currentDate.getFullYear(), currentDate.getMonth()) }),
11726
11690
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "w-8" })
11727
11691
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
11728
11692
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "w-8" }),
11729
11693
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "text-xl font-extrabold", children: monthYearFormat(currentDate.getFullYear(), currentDate.getMonth()) }),
11730
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(icon_button_default, { name: "right", variant: "soft", color: "neutral", onClick: handleRightNextMonth })
11694
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
11695
+ icon_button_default,
11696
+ {
11697
+ name: "right",
11698
+ variant: "soft",
11699
+ color: "neutral",
11700
+ onClick: () => {
11701
+ const newRight = new Date(rightCurrentDate.getFullYear(), rightCurrentDate.getMonth() + 1);
11702
+ setRightCurrentDate(newRight);
11703
+ setLeftCurrentDate(new Date(newRight.getFullYear(), newRight.getMonth() - 1));
11704
+ }
11705
+ }
11706
+ )
11731
11707
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
11732
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(icon_button_default, { name: "left", variant: "soft", color: "neutral", onClick: handleLeftPrevMonth }),
11708
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
11709
+ icon_button_default,
11710
+ {
11711
+ name: "left",
11712
+ variant: "soft",
11713
+ color: "neutral",
11714
+ onClick: () => {
11715
+ const newLeft = new Date(leftCurrentDate.getFullYear(), leftCurrentDate.getMonth() - 1);
11716
+ setLeftCurrentDate(newLeft);
11717
+ }
11718
+ }
11719
+ ),
11733
11720
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "text-xl font-extrabold", children: monthYearFormat(currentDate.getFullYear(), currentDate.getMonth()) }),
11734
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(icon_button_default, { name: "right", variant: "soft", color: "neutral", onClick: handleLeftNextMonth })
11721
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
11722
+ icon_button_default,
11723
+ {
11724
+ name: "right",
11725
+ variant: "soft",
11726
+ color: "neutral",
11727
+ onClick: () => {
11728
+ const newLeft = new Date(leftCurrentDate.getFullYear(), leftCurrentDate.getMonth() + 1);
11729
+ setLeftCurrentDate(newLeft);
11730
+ }
11731
+ }
11732
+ )
11735
11733
  ] }) }),
11736
11734
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "grid grid-cols-7", children: daysOfWeek.map((day, index) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(day_default, { variant: "text", children: day }, `${day}-${index}`)) }),
11737
11735
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "grid grid-cols-7 gap-y-[5px] text-center", children: getCalendarDates(currentDate).map((week, weekIndex) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react34.Fragment, { children: week.map((dateObj, index) => {