@dmsi/wedgekit-react 0.0.853 → 0.0.855

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.
Files changed (34) hide show
  1. package/dist/{chunk-T7NSOCGM.js → chunk-IUJIB7Y2.js} +71 -16
  2. package/dist/components/CalendarRange.cjs +72 -33
  3. package/dist/components/CalendarRange.js +1 -1
  4. package/dist/components/ContentTabs.cjs +3 -3
  5. package/dist/components/ContentTabs.js +3 -3
  6. package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.cjs +70 -33
  7. package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.js +1 -1
  8. package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.cjs +70 -33
  9. package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.js +1 -1
  10. package/dist/components/DataGrid/PinnedColumns.cjs +70 -33
  11. package/dist/components/DataGrid/PinnedColumns.js +1 -1
  12. package/dist/components/DataGrid/TableBody/LoadingCell.cjs +70 -33
  13. package/dist/components/DataGrid/TableBody/LoadingCell.js +1 -1
  14. package/dist/components/DataGrid/TableBody/TableBodyRow.cjs +70 -33
  15. package/dist/components/DataGrid/TableBody/TableBodyRow.js +1 -1
  16. package/dist/components/DataGrid/TableBody/index.cjs +70 -33
  17. package/dist/components/DataGrid/TableBody/index.js +1 -1
  18. package/dist/components/DataGrid/index.cjs +70 -33
  19. package/dist/components/DataGrid/index.js +1 -1
  20. package/dist/components/DataGrid/utils.cjs +70 -33
  21. package/dist/components/DataGrid/utils.js +1 -1
  22. package/dist/components/DateInput.cjs +70 -33
  23. package/dist/components/DateInput.js +1 -1
  24. package/dist/components/DateRangeInput.cjs +72 -13
  25. package/dist/components/DateRangeInput.js +1 -1
  26. package/dist/components/MobileDataGrid/ColumnSelector/index.cjs +70 -33
  27. package/dist/components/MobileDataGrid/ColumnSelector/index.js +1 -1
  28. package/dist/components/MobileDataGrid/MobileDataGridHeader.cjs +70 -33
  29. package/dist/components/MobileDataGrid/MobileDataGridHeader.js +1 -1
  30. package/dist/components/MobileDataGrid/index.cjs +70 -33
  31. package/dist/components/MobileDataGrid/index.js +1 -1
  32. package/dist/components/index.cjs +70 -33
  33. package/dist/components/index.js +1 -1
  34. package/package.json +1 -1
@@ -55,9 +55,7 @@ import {
55
55
  import {
56
56
  calculateCursorPosition,
57
57
  formatDate,
58
- formatInputValue,
59
- isValidDate,
60
- parseInputDate
58
+ isValidDate
61
59
  } from "./chunk-MMZTPVYB.js";
62
60
  import {
63
61
  formatCurrencyDisplay
@@ -1740,6 +1738,60 @@ function CalendarPane({
1740
1738
  }
1741
1739
  var CalendarRange_default = CalendarRange;
1742
1740
 
1741
+ // src/utils/date-patch-dashes.ts
1742
+ function formatInputValueWithDashes(value, dateInDashes) {
1743
+ const digits = value.replace(/\D/g, "");
1744
+ if (dateInDashes) {
1745
+ if (digits.length <= 4) return digits;
1746
+ if (digits.length <= 6) return `${digits.slice(0, 4)}-${digits.slice(4)}`;
1747
+ return `${digits.slice(4, 6)}-${digits.slice(6, 8)}-${digits.slice(0, 4)}`;
1748
+ } else {
1749
+ if (digits.length <= 2) return digits;
1750
+ if (digits.length <= 4) return `${digits.slice(0, 2)}/${digits.slice(2)}`;
1751
+ return `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, 8)}`;
1752
+ }
1753
+ }
1754
+ function formatDateWithDashes(value, dateInDashes) {
1755
+ if (!value) return "";
1756
+ let year = "", month = "", day = "";
1757
+ if (/^\d{4}-\d{2}-\d{2}$/.test(value)) {
1758
+ [year, month, day] = value.split("-");
1759
+ } else if (/^\d{2}-\d{2}-\d{4}$/.test(value)) {
1760
+ [month, day, year] = value.split("-");
1761
+ } else if (/^\d{2}\/\d{2}\/\d{4}$/.test(value)) {
1762
+ [month, day, year] = value.split("/");
1763
+ } else {
1764
+ return value;
1765
+ }
1766
+ if (!year || !month || !day) return value;
1767
+ if (dateInDashes) {
1768
+ return `${month}-${day}-${year}`;
1769
+ }
1770
+ return `${month}/${day}/${year}`;
1771
+ }
1772
+ function parseInputDateWithDashes(value, dateInDashes) {
1773
+ if (!value) return "";
1774
+ let year = "", month = "", day = "";
1775
+ if (dateInDashes) {
1776
+ let match = value.match(/^(\d{2})-(\d{2})-(\d{4})$/);
1777
+ if (match) {
1778
+ [, month, day, year] = match;
1779
+ } else {
1780
+ match = value.match(/^(\d{4})-(\d{2})-(\d{2})$/);
1781
+ if (match) {
1782
+ [, year, month, day] = match;
1783
+ }
1784
+ }
1785
+ } else {
1786
+ const match = value.match(/^(\d{2})\/(\d{2})\/(\d{4})$/);
1787
+ if (match) {
1788
+ [, month, day, year] = match;
1789
+ }
1790
+ }
1791
+ if (!year || !month || !day) return "";
1792
+ return `${month}-${day}-${year}`;
1793
+ }
1794
+
1743
1795
  // src/components/DateInput.tsx
1744
1796
  import { Fragment, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
1745
1797
  var DateInput = (_a) => {
@@ -1753,7 +1805,8 @@ var DateInput = (_a) => {
1753
1805
  readOnly = false,
1754
1806
  label,
1755
1807
  isDateAvailable,
1756
- disableManualInput
1808
+ disableManualInput,
1809
+ dateInDashes = false
1757
1810
  } = _b, props = __objRest(_b, [
1758
1811
  "id",
1759
1812
  "testid",
@@ -1764,7 +1817,8 @@ var DateInput = (_a) => {
1764
1817
  "readOnly",
1765
1818
  "label",
1766
1819
  "isDateAvailable",
1767
- "disableManualInput"
1820
+ "disableManualInput",
1821
+ "dateInDashes"
1768
1822
  ]);
1769
1823
  const [visible, setVisible] = useState5(false);
1770
1824
  const [inputValue, setInputValue] = useState5("");
@@ -1780,9 +1834,9 @@ var DateInput = (_a) => {
1780
1834
  const [from, to] = [value, ""];
1781
1835
  useEffect3(() => {
1782
1836
  if (!isTyping) {
1783
- setInputValue(formatDisplayValue(from));
1837
+ setInputValue(formatDisplayValue(from, dateInDashes));
1784
1838
  }
1785
- }, [from, isTyping]);
1839
+ }, [from, isTyping, dateInDashes]);
1786
1840
  useLayoutEffect(() => {
1787
1841
  if (visible) {
1788
1842
  updatePosition();
@@ -1845,7 +1899,7 @@ var DateInput = (_a) => {
1845
1899
  const rawValue = event.target.value;
1846
1900
  const cursorPosition = event.target.selectionStart || 0;
1847
1901
  setIsTyping(true);
1848
- const formattedValue = formatInputValue(rawValue);
1902
+ const formattedValue = formatInputValueWithDashes(rawValue, dateInDashes);
1849
1903
  setInputValue(formattedValue);
1850
1904
  requestAnimationFrame(() => {
1851
1905
  if (triggerRef.current) {
@@ -1857,16 +1911,16 @@ var DateInput = (_a) => {
1857
1911
  triggerRef.current.setSelectionRange(newPosition, newPosition);
1858
1912
  }
1859
1913
  });
1860
- const parsedDate = parseInputDate(formattedValue);
1914
+ const parsedDate = parseInputDateWithDashes(formattedValue, dateInDashes);
1861
1915
  if (parsedDate && isValidDate(parsedDate)) {
1862
1916
  onChange(parsedDate);
1863
1917
  }
1864
1918
  };
1865
1919
  const handleBlur = () => {
1866
1920
  setIsTyping(false);
1867
- const parsedDate = parseInputDate(inputValue);
1921
+ const parsedDate = parseInputDateWithDashes(inputValue, dateInDashes);
1868
1922
  if (!parsedDate || !isValidDate(parsedDate)) {
1869
- setInputValue(formatDisplayValue(from));
1923
+ setInputValue(formatDisplayValue(from, dateInDashes));
1870
1924
  }
1871
1925
  };
1872
1926
  const handleKeyDown = (event) => {
@@ -1874,10 +1928,11 @@ var DateInput = (_a) => {
1874
1928
  const input = event.target;
1875
1929
  const cursorPosition = input.selectionStart || 0;
1876
1930
  const value2 = input.value;
1877
- if (cursorPosition > 0 && value2[cursorPosition - 1] === "/") {
1931
+ const sep = dateInDashes ? "-" : "/";
1932
+ if (cursorPosition > 0 && value2[cursorPosition - 1] === sep) {
1878
1933
  event.preventDefault();
1879
1934
  const newValue = value2.slice(0, cursorPosition - 2) + value2.slice(cursorPosition);
1880
- const formattedValue = formatInputValue(newValue);
1935
+ const formattedValue = formatInputValueWithDashes(newValue, dateInDashes);
1881
1936
  setInputValue(formattedValue);
1882
1937
  requestAnimationFrame(() => {
1883
1938
  if (triggerRef.current) {
@@ -1890,7 +1945,7 @@ var DateInput = (_a) => {
1890
1945
  }
1891
1946
  }
1892
1947
  if (event.key === "Enter") {
1893
- const parsedDate = parseInputDate(inputValue);
1948
+ const parsedDate = parseInputDateWithDashes(inputValue, dateInDashes);
1894
1949
  if (parsedDate && isValidDate(parsedDate)) {
1895
1950
  onChange(parsedDate);
1896
1951
  setVisible(false);
@@ -1979,14 +2034,14 @@ var DateInput = (_a) => {
1979
2034
  ] });
1980
2035
  };
1981
2036
  DateInput.displayName = "DateInput";
1982
- function formatDisplayValue(from) {
2037
+ function formatDisplayValue(from, dateInDashes) {
1983
2038
  if (!from) {
1984
2039
  return "";
1985
2040
  }
1986
2041
  if (!isValidDate(from)) {
1987
2042
  return "";
1988
2043
  }
1989
- return formatDate(from);
2044
+ return formatDateWithDashes(from, dateInDashes);
1990
2045
  }
1991
2046
 
1992
2047
  // src/components/MobileDataGrid/ColumnSelector/index.tsx
@@ -482,30 +482,10 @@ function formatCurrencyDisplay(value) {
482
482
  }
483
483
 
484
484
  // src/utils/date.ts
485
- function parseInputDate(input) {
486
- const match = input.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);
487
- if (!match) {
488
- return null;
489
- }
490
- const [, month, day, year] = match;
491
- const paddedMonth = month.padStart(2, "0");
492
- const paddedDay = day.padStart(2, "0");
493
- return `${year}-${paddedMonth}-${paddedDay}`;
494
- }
495
485
  function isValidDate(dateString) {
496
486
  const date = new Date(dateString);
497
487
  return date instanceof Date && !isNaN(date.getTime()) && dateString === date.toISOString().split("T")[0];
498
488
  }
499
- function formatInputValue(value) {
500
- const digits = value.replace(/\D/g, "");
501
- if (digits.length < 2) {
502
- return digits;
503
- }
504
- if (digits.length >= 4) {
505
- return `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, 8)}`;
506
- }
507
- return `${digits.slice(0, 2)}/${digits.slice(2)}`;
508
- }
509
489
  function isDigit(character) {
510
490
  return /\d/.test(character);
511
491
  }
@@ -4420,6 +4400,62 @@ Tooltip.displayName = "Tooltip";
4420
4400
  // src/components/DateInput.tsx
4421
4401
  var import_react20 = require("react");
4422
4402
  var import_react_dom3 = require("react-dom");
4403
+
4404
+ // src/utils/date-patch-dashes.ts
4405
+ function formatInputValueWithDashes(value, dateInDashes) {
4406
+ const digits = value.replace(/\D/g, "");
4407
+ if (dateInDashes) {
4408
+ if (digits.length <= 4) return digits;
4409
+ if (digits.length <= 6) return `${digits.slice(0, 4)}-${digits.slice(4)}`;
4410
+ return `${digits.slice(4, 6)}-${digits.slice(6, 8)}-${digits.slice(0, 4)}`;
4411
+ } else {
4412
+ if (digits.length <= 2) return digits;
4413
+ if (digits.length <= 4) return `${digits.slice(0, 2)}/${digits.slice(2)}`;
4414
+ return `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, 8)}`;
4415
+ }
4416
+ }
4417
+ function formatDateWithDashes(value, dateInDashes) {
4418
+ if (!value) return "";
4419
+ let year = "", month = "", day = "";
4420
+ if (/^\d{4}-\d{2}-\d{2}$/.test(value)) {
4421
+ [year, month, day] = value.split("-");
4422
+ } else if (/^\d{2}-\d{2}-\d{4}$/.test(value)) {
4423
+ [month, day, year] = value.split("-");
4424
+ } else if (/^\d{2}\/\d{2}\/\d{4}$/.test(value)) {
4425
+ [month, day, year] = value.split("/");
4426
+ } else {
4427
+ return value;
4428
+ }
4429
+ if (!year || !month || !day) return value;
4430
+ if (dateInDashes) {
4431
+ return `${month}-${day}-${year}`;
4432
+ }
4433
+ return `${month}/${day}/${year}`;
4434
+ }
4435
+ function parseInputDateWithDashes(value, dateInDashes) {
4436
+ if (!value) return "";
4437
+ let year = "", month = "", day = "";
4438
+ if (dateInDashes) {
4439
+ let match = value.match(/^(\d{2})-(\d{2})-(\d{4})$/);
4440
+ if (match) {
4441
+ [, month, day, year] = match;
4442
+ } else {
4443
+ match = value.match(/^(\d{4})-(\d{2})-(\d{2})$/);
4444
+ if (match) {
4445
+ [, year, month, day] = match;
4446
+ }
4447
+ }
4448
+ } else {
4449
+ const match = value.match(/^(\d{2})\/(\d{2})\/(\d{4})$/);
4450
+ if (match) {
4451
+ [, month, day, year] = match;
4452
+ }
4453
+ }
4454
+ if (!year || !month || !day) return "";
4455
+ return `${month}-${day}-${year}`;
4456
+ }
4457
+
4458
+ // src/components/DateInput.tsx
4423
4459
  var import_jsx_runtime24 = require("react/jsx-runtime");
4424
4460
  var DateInput = (_a) => {
4425
4461
  var _b = _a, {
@@ -4432,7 +4468,8 @@ var DateInput = (_a) => {
4432
4468
  readOnly = false,
4433
4469
  label,
4434
4470
  isDateAvailable,
4435
- disableManualInput
4471
+ disableManualInput,
4472
+ dateInDashes = false
4436
4473
  } = _b, props = __objRest(_b, [
4437
4474
  "id",
4438
4475
  "testid",
@@ -4443,7 +4480,8 @@ var DateInput = (_a) => {
4443
4480
  "readOnly",
4444
4481
  "label",
4445
4482
  "isDateAvailable",
4446
- "disableManualInput"
4483
+ "disableManualInput",
4484
+ "dateInDashes"
4447
4485
  ]);
4448
4486
  const [visible, setVisible] = (0, import_react20.useState)(false);
4449
4487
  const [inputValue, setInputValue] = (0, import_react20.useState)("");
@@ -4459,9 +4497,9 @@ var DateInput = (_a) => {
4459
4497
  const [from, to] = [value, ""];
4460
4498
  (0, import_react20.useEffect)(() => {
4461
4499
  if (!isTyping) {
4462
- setInputValue(formatDisplayValue(from));
4500
+ setInputValue(formatDisplayValue(from, dateInDashes));
4463
4501
  }
4464
- }, [from, isTyping]);
4502
+ }, [from, isTyping, dateInDashes]);
4465
4503
  (0, import_react20.useLayoutEffect)(() => {
4466
4504
  if (visible) {
4467
4505
  updatePosition();
@@ -4524,7 +4562,7 @@ var DateInput = (_a) => {
4524
4562
  const rawValue = event.target.value;
4525
4563
  const cursorPosition = event.target.selectionStart || 0;
4526
4564
  setIsTyping(true);
4527
- const formattedValue = formatInputValue(rawValue);
4565
+ const formattedValue = formatInputValueWithDashes(rawValue, dateInDashes);
4528
4566
  setInputValue(formattedValue);
4529
4567
  requestAnimationFrame(() => {
4530
4568
  if (triggerRef.current) {
@@ -4536,16 +4574,16 @@ var DateInput = (_a) => {
4536
4574
  triggerRef.current.setSelectionRange(newPosition, newPosition);
4537
4575
  }
4538
4576
  });
4539
- const parsedDate = parseInputDate(formattedValue);
4577
+ const parsedDate = parseInputDateWithDashes(formattedValue, dateInDashes);
4540
4578
  if (parsedDate && isValidDate(parsedDate)) {
4541
4579
  onChange(parsedDate);
4542
4580
  }
4543
4581
  };
4544
4582
  const handleBlur = () => {
4545
4583
  setIsTyping(false);
4546
- const parsedDate = parseInputDate(inputValue);
4584
+ const parsedDate = parseInputDateWithDashes(inputValue, dateInDashes);
4547
4585
  if (!parsedDate || !isValidDate(parsedDate)) {
4548
- setInputValue(formatDisplayValue(from));
4586
+ setInputValue(formatDisplayValue(from, dateInDashes));
4549
4587
  }
4550
4588
  };
4551
4589
  const handleKeyDown = (event) => {
@@ -4553,10 +4591,11 @@ var DateInput = (_a) => {
4553
4591
  const input = event.target;
4554
4592
  const cursorPosition = input.selectionStart || 0;
4555
4593
  const value2 = input.value;
4556
- if (cursorPosition > 0 && value2[cursorPosition - 1] === "/") {
4594
+ const sep = dateInDashes ? "-" : "/";
4595
+ if (cursorPosition > 0 && value2[cursorPosition - 1] === sep) {
4557
4596
  event.preventDefault();
4558
4597
  const newValue = value2.slice(0, cursorPosition - 2) + value2.slice(cursorPosition);
4559
- const formattedValue = formatInputValue(newValue);
4598
+ const formattedValue = formatInputValueWithDashes(newValue, dateInDashes);
4560
4599
  setInputValue(formattedValue);
4561
4600
  requestAnimationFrame(() => {
4562
4601
  if (triggerRef.current) {
@@ -4569,7 +4608,7 @@ var DateInput = (_a) => {
4569
4608
  }
4570
4609
  }
4571
4610
  if (event.key === "Enter") {
4572
- const parsedDate = parseInputDate(inputValue);
4611
+ const parsedDate = parseInputDateWithDashes(inputValue, dateInDashes);
4573
4612
  if (parsedDate && isValidDate(parsedDate)) {
4574
4613
  onChange(parsedDate);
4575
4614
  setVisible(false);
@@ -4658,14 +4697,14 @@ var DateInput = (_a) => {
4658
4697
  ] });
4659
4698
  };
4660
4699
  DateInput.displayName = "DateInput";
4661
- function formatDisplayValue(from) {
4700
+ function formatDisplayValue(from, dateInDashes) {
4662
4701
  if (!from) {
4663
4702
  return "";
4664
4703
  }
4665
4704
  if (!isValidDate(from)) {
4666
4705
  return "";
4667
4706
  }
4668
- return formatDate(from);
4707
+ return formatDateWithDashes(from, dateInDashes);
4669
4708
  }
4670
4709
 
4671
4710
  // src/components/Accordion.tsx
@@ -2,7 +2,7 @@ import {
2
2
  CalendarRange,
3
3
  CalendarRange_default,
4
4
  isWeekend
5
- } from "../chunk-T7NSOCGM.js";
5
+ } from "../chunk-IUJIB7Y2.js";
6
6
  import "../chunk-WJJB7IJZ.js";
7
7
  import "../chunk-Q4YDNW7N.js";
8
8
  import "../chunk-M7INAUAJ.js";
@@ -487,8 +487,8 @@ var ContentTabs = ({
487
487
  const [focusedTabIndex, setFocusedTabIndex] = (0, import_react2.useState)(0);
488
488
  const tabRefs = (0, import_react2.useRef)([]);
489
489
  const handleTabClick = (0, import_react2.useCallback)(
490
- (id2, index) => {
491
- if (disabledWithColor) return;
490
+ (id2, index, forced) => {
491
+ if (disabledWithColor && !forced) return;
492
492
  setSelectedTabId(id2);
493
493
  setFocusedTabIndex(index);
494
494
  onTabChange == null ? void 0 : onTabChange(id2);
@@ -497,7 +497,7 @@ var ContentTabs = ({
497
497
  );
498
498
  (0, import_react2.useEffect)(() => {
499
499
  if (selectedTab) {
500
- handleTabClick(selectedTab.id, selectedTab.index);
500
+ handleTabClick(selectedTab.id, selectedTab.index, true);
501
501
  }
502
502
  }, [selectedTab, handleTabClick]);
503
503
  const handleKeyDown = (0, import_react2.useCallback)(
@@ -27,8 +27,8 @@ var ContentTabs = ({
27
27
  const [focusedTabIndex, setFocusedTabIndex] = useState(0);
28
28
  const tabRefs = useRef([]);
29
29
  const handleTabClick = useCallback(
30
- (id2, index) => {
31
- if (disabledWithColor) return;
30
+ (id2, index, forced) => {
31
+ if (disabledWithColor && !forced) return;
32
32
  setSelectedTabId(id2);
33
33
  setFocusedTabIndex(index);
34
34
  onTabChange == null ? void 0 : onTabChange(id2);
@@ -37,7 +37,7 @@ var ContentTabs = ({
37
37
  );
38
38
  useEffect(() => {
39
39
  if (selectedTab) {
40
- handleTabClick(selectedTab.id, selectedTab.index);
40
+ handleTabClick(selectedTab.id, selectedTab.index, true);
41
41
  }
42
42
  }, [selectedTab, handleTabClick]);
43
43
  const handleKeyDown = useCallback(
@@ -476,30 +476,10 @@ function formatCurrencyDisplay(value) {
476
476
  }
477
477
 
478
478
  // src/utils/date.ts
479
- function parseInputDate(input) {
480
- const match = input.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);
481
- if (!match) {
482
- return null;
483
- }
484
- const [, month, day, year] = match;
485
- const paddedMonth = month.padStart(2, "0");
486
- const paddedDay = day.padStart(2, "0");
487
- return `${year}-${paddedMonth}-${paddedDay}`;
488
- }
489
479
  function isValidDate(dateString) {
490
480
  const date = new Date(dateString);
491
481
  return date instanceof Date && !isNaN(date.getTime()) && dateString === date.toISOString().split("T")[0];
492
482
  }
493
- function formatInputValue(value) {
494
- const digits = value.replace(/\D/g, "");
495
- if (digits.length < 2) {
496
- return digits;
497
- }
498
- if (digits.length >= 4) {
499
- return `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, 8)}`;
500
- }
501
- return `${digits.slice(0, 2)}/${digits.slice(2)}`;
502
- }
503
483
  function isDigit(character) {
504
484
  return /\d/.test(character);
505
485
  }
@@ -4852,6 +4832,60 @@ function CalendarPane({
4852
4832
  ] }, month.name + month.year);
4853
4833
  }
4854
4834
 
4835
+ // src/utils/date-patch-dashes.ts
4836
+ function formatInputValueWithDashes(value, dateInDashes) {
4837
+ const digits = value.replace(/\D/g, "");
4838
+ if (dateInDashes) {
4839
+ if (digits.length <= 4) return digits;
4840
+ if (digits.length <= 6) return `${digits.slice(0, 4)}-${digits.slice(4)}`;
4841
+ return `${digits.slice(4, 6)}-${digits.slice(6, 8)}-${digits.slice(0, 4)}`;
4842
+ } else {
4843
+ if (digits.length <= 2) return digits;
4844
+ if (digits.length <= 4) return `${digits.slice(0, 2)}/${digits.slice(2)}`;
4845
+ return `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, 8)}`;
4846
+ }
4847
+ }
4848
+ function formatDateWithDashes(value, dateInDashes) {
4849
+ if (!value) return "";
4850
+ let year = "", month = "", day = "";
4851
+ if (/^\d{4}-\d{2}-\d{2}$/.test(value)) {
4852
+ [year, month, day] = value.split("-");
4853
+ } else if (/^\d{2}-\d{2}-\d{4}$/.test(value)) {
4854
+ [month, day, year] = value.split("-");
4855
+ } else if (/^\d{2}\/\d{2}\/\d{4}$/.test(value)) {
4856
+ [month, day, year] = value.split("/");
4857
+ } else {
4858
+ return value;
4859
+ }
4860
+ if (!year || !month || !day) return value;
4861
+ if (dateInDashes) {
4862
+ return `${month}-${day}-${year}`;
4863
+ }
4864
+ return `${month}/${day}/${year}`;
4865
+ }
4866
+ function parseInputDateWithDashes(value, dateInDashes) {
4867
+ if (!value) return "";
4868
+ let year = "", month = "", day = "";
4869
+ if (dateInDashes) {
4870
+ let match = value.match(/^(\d{2})-(\d{2})-(\d{4})$/);
4871
+ if (match) {
4872
+ [, month, day, year] = match;
4873
+ } else {
4874
+ match = value.match(/^(\d{4})-(\d{2})-(\d{2})$/);
4875
+ if (match) {
4876
+ [, year, month, day] = match;
4877
+ }
4878
+ }
4879
+ } else {
4880
+ const match = value.match(/^(\d{2})\/(\d{2})\/(\d{4})$/);
4881
+ if (match) {
4882
+ [, month, day, year] = match;
4883
+ }
4884
+ }
4885
+ if (!year || !month || !day) return "";
4886
+ return `${month}-${day}-${year}`;
4887
+ }
4888
+
4855
4889
  // src/components/DateInput.tsx
4856
4890
  var import_jsx_runtime24 = require("react/jsx-runtime");
4857
4891
  var DateInput = (_a) => {
@@ -4865,7 +4899,8 @@ var DateInput = (_a) => {
4865
4899
  readOnly = false,
4866
4900
  label,
4867
4901
  isDateAvailable,
4868
- disableManualInput
4902
+ disableManualInput,
4903
+ dateInDashes = false
4869
4904
  } = _b, props = __objRest(_b, [
4870
4905
  "id",
4871
4906
  "testid",
@@ -4876,7 +4911,8 @@ var DateInput = (_a) => {
4876
4911
  "readOnly",
4877
4912
  "label",
4878
4913
  "isDateAvailable",
4879
- "disableManualInput"
4914
+ "disableManualInput",
4915
+ "dateInDashes"
4880
4916
  ]);
4881
4917
  const [visible, setVisible] = (0, import_react20.useState)(false);
4882
4918
  const [inputValue, setInputValue] = (0, import_react20.useState)("");
@@ -4892,9 +4928,9 @@ var DateInput = (_a) => {
4892
4928
  const [from, to] = [value, ""];
4893
4929
  (0, import_react20.useEffect)(() => {
4894
4930
  if (!isTyping) {
4895
- setInputValue(formatDisplayValue(from));
4931
+ setInputValue(formatDisplayValue(from, dateInDashes));
4896
4932
  }
4897
- }, [from, isTyping]);
4933
+ }, [from, isTyping, dateInDashes]);
4898
4934
  (0, import_react20.useLayoutEffect)(() => {
4899
4935
  if (visible) {
4900
4936
  updatePosition();
@@ -4957,7 +4993,7 @@ var DateInput = (_a) => {
4957
4993
  const rawValue = event.target.value;
4958
4994
  const cursorPosition = event.target.selectionStart || 0;
4959
4995
  setIsTyping(true);
4960
- const formattedValue = formatInputValue(rawValue);
4996
+ const formattedValue = formatInputValueWithDashes(rawValue, dateInDashes);
4961
4997
  setInputValue(formattedValue);
4962
4998
  requestAnimationFrame(() => {
4963
4999
  if (triggerRef.current) {
@@ -4969,16 +5005,16 @@ var DateInput = (_a) => {
4969
5005
  triggerRef.current.setSelectionRange(newPosition, newPosition);
4970
5006
  }
4971
5007
  });
4972
- const parsedDate = parseInputDate(formattedValue);
5008
+ const parsedDate = parseInputDateWithDashes(formattedValue, dateInDashes);
4973
5009
  if (parsedDate && isValidDate(parsedDate)) {
4974
5010
  onChange(parsedDate);
4975
5011
  }
4976
5012
  };
4977
5013
  const handleBlur = () => {
4978
5014
  setIsTyping(false);
4979
- const parsedDate = parseInputDate(inputValue);
5015
+ const parsedDate = parseInputDateWithDashes(inputValue, dateInDashes);
4980
5016
  if (!parsedDate || !isValidDate(parsedDate)) {
4981
- setInputValue(formatDisplayValue(from));
5017
+ setInputValue(formatDisplayValue(from, dateInDashes));
4982
5018
  }
4983
5019
  };
4984
5020
  const handleKeyDown = (event) => {
@@ -4986,10 +5022,11 @@ var DateInput = (_a) => {
4986
5022
  const input = event.target;
4987
5023
  const cursorPosition = input.selectionStart || 0;
4988
5024
  const value2 = input.value;
4989
- if (cursorPosition > 0 && value2[cursorPosition - 1] === "/") {
5025
+ const sep = dateInDashes ? "-" : "/";
5026
+ if (cursorPosition > 0 && value2[cursorPosition - 1] === sep) {
4990
5027
  event.preventDefault();
4991
5028
  const newValue = value2.slice(0, cursorPosition - 2) + value2.slice(cursorPosition);
4992
- const formattedValue = formatInputValue(newValue);
5029
+ const formattedValue = formatInputValueWithDashes(newValue, dateInDashes);
4993
5030
  setInputValue(formattedValue);
4994
5031
  requestAnimationFrame(() => {
4995
5032
  if (triggerRef.current) {
@@ -5002,7 +5039,7 @@ var DateInput = (_a) => {
5002
5039
  }
5003
5040
  }
5004
5041
  if (event.key === "Enter") {
5005
- const parsedDate = parseInputDate(inputValue);
5042
+ const parsedDate = parseInputDateWithDashes(inputValue, dateInDashes);
5006
5043
  if (parsedDate && isValidDate(parsedDate)) {
5007
5044
  onChange(parsedDate);
5008
5045
  setVisible(false);
@@ -5091,14 +5128,14 @@ var DateInput = (_a) => {
5091
5128
  ] });
5092
5129
  };
5093
5130
  DateInput.displayName = "DateInput";
5094
- function formatDisplayValue(from) {
5131
+ function formatDisplayValue(from, dateInDashes) {
5095
5132
  if (!from) {
5096
5133
  return "";
5097
5134
  }
5098
5135
  if (!isValidDate(from)) {
5099
5136
  return "";
5100
5137
  }
5101
- return formatDate(from);
5138
+ return formatDateWithDashes(from, dateInDashes);
5102
5139
  }
5103
5140
 
5104
5141
  // src/components/Accordion.tsx
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ColumnSelectorMenuOption
3
- } from "../../../chunk-T7NSOCGM.js";
3
+ } from "../../../chunk-IUJIB7Y2.js";
4
4
  import "../../../chunk-WJJB7IJZ.js";
5
5
  import "../../../chunk-Q4YDNW7N.js";
6
6
  import "../../../chunk-M7INAUAJ.js";