@dmsi/wedgekit-react 0.0.883 → 0.0.885

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 (49) hide show
  1. package/dist/{chunk-E7XBOMT4.js → chunk-4MF6JSE7.js} +78 -19
  2. package/dist/components/CalendarRange.cjs +133 -77
  3. package/dist/components/CalendarRange.css +0 -3
  4. package/dist/components/CalendarRange.js +1 -1
  5. package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.cjs +119 -63
  6. package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.css +0 -3
  7. package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.js +1 -1
  8. package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.cjs +119 -63
  9. package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.css +0 -3
  10. package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.js +1 -1
  11. package/dist/components/DataGrid/PinnedColumns.cjs +122 -66
  12. package/dist/components/DataGrid/PinnedColumns.css +0 -3
  13. package/dist/components/DataGrid/PinnedColumns.js +1 -1
  14. package/dist/components/DataGrid/TableBody/LoadingCell.cjs +119 -63
  15. package/dist/components/DataGrid/TableBody/LoadingCell.css +0 -3
  16. package/dist/components/DataGrid/TableBody/LoadingCell.js +1 -1
  17. package/dist/components/DataGrid/TableBody/TableBodyRow.cjs +122 -66
  18. package/dist/components/DataGrid/TableBody/TableBodyRow.css +0 -3
  19. package/dist/components/DataGrid/TableBody/TableBodyRow.js +1 -1
  20. package/dist/components/DataGrid/TableBody/index.cjs +124 -68
  21. package/dist/components/DataGrid/TableBody/index.css +0 -3
  22. package/dist/components/DataGrid/TableBody/index.js +1 -1
  23. package/dist/components/DataGrid/index.cjs +133 -77
  24. package/dist/components/DataGrid/index.css +0 -3
  25. package/dist/components/DataGrid/index.js +1 -1
  26. package/dist/components/DataGrid/utils.cjs +121 -65
  27. package/dist/components/DataGrid/utils.css +0 -3
  28. package/dist/components/DataGrid/utils.js +1 -1
  29. package/dist/components/DateInput.cjs +73 -17
  30. package/dist/components/DateInput.css +0 -3
  31. package/dist/components/DateInput.js +1 -1
  32. package/dist/components/DateRangeInput.cjs +133 -77
  33. package/dist/components/DateRangeInput.css +0 -3
  34. package/dist/components/DateRangeInput.js +1 -1
  35. package/dist/components/MobileDataGrid/ColumnList.css +0 -3
  36. package/dist/components/MobileDataGrid/ColumnSelector/index.cjs +119 -63
  37. package/dist/components/MobileDataGrid/ColumnSelector/index.css +0 -3
  38. package/dist/components/MobileDataGrid/ColumnSelector/index.js +1 -1
  39. package/dist/components/MobileDataGrid/MobileDataGridHeader.cjs +116 -60
  40. package/dist/components/MobileDataGrid/MobileDataGridHeader.css +0 -3
  41. package/dist/components/MobileDataGrid/MobileDataGridHeader.js +1 -1
  42. package/dist/components/MobileDataGrid/index.cjs +120 -64
  43. package/dist/components/MobileDataGrid/index.css +0 -3
  44. package/dist/components/MobileDataGrid/index.js +1 -1
  45. package/dist/components/index.cjs +152 -96
  46. package/dist/components/index.css +0 -3
  47. package/dist/components/index.js +1 -1
  48. package/dist/index.css +0 -3
  49. package/package.json +1 -1
@@ -49,6 +49,9 @@ import {
49
49
  useInfiniteScroll,
50
50
  useTableLayout
51
51
  } from "./chunk-KLH67DTH.js";
52
+ import {
53
+ useMatchesMobile
54
+ } from "./chunk-WVGXD7HT.js";
52
55
  import {
53
56
  findDocumentRoot
54
57
  } from "./chunk-VXWSAIB5.js";
@@ -92,7 +95,7 @@ import {
92
95
  } from "./chunk-ORMEWXMH.js";
93
96
 
94
97
  // src/components/DataGrid/utils.tsx
95
- import clsx6 from "clsx";
98
+ import clsx7 from "clsx";
96
99
 
97
100
  // src/components/DataGrid/index.tsx
98
101
  import React3, {
@@ -1272,6 +1275,7 @@ var DataGrid_default = DataGrid;
1272
1275
  // src/components/DateInput.tsx
1273
1276
  import { useRef as useRef3, useEffect as useEffect3, useState as useState5, useLayoutEffect } from "react";
1274
1277
  import { createPortal } from "react-dom";
1278
+ import clsx6 from "clsx";
1275
1279
 
1276
1280
  // src/components/CalendarRange.tsx
1277
1281
  import clsx5 from "clsx";
@@ -1830,10 +1834,12 @@ var DateInput = (_a) => {
1830
1834
  const popoverRef = useRef3(null);
1831
1835
  const triggerRef = useRef3(null);
1832
1836
  const rootRef = useRef3(null);
1837
+ const isMobile = useMatchesMobile();
1833
1838
  const [calendarPosition, setCalendarPosition] = useState5({
1834
1839
  top: 0,
1835
1840
  left: 0,
1836
- width: 0
1841
+ width: 0,
1842
+ openAbove: false
1837
1843
  });
1838
1844
  const [from, to] = [value, ""];
1839
1845
  useEffect3(() => {
@@ -1849,11 +1855,28 @@ var DateInput = (_a) => {
1849
1855
  const updatePosition = () => {
1850
1856
  if (rootRef.current) {
1851
1857
  const rect = rootRef.current.getBoundingClientRect();
1852
- setCalendarPosition({
1853
- top: rect.bottom + window.scrollY,
1854
- left: rect.left + window.scrollX,
1855
- width: rect.width
1856
- });
1858
+ const viewportWidth = window.innerWidth;
1859
+ const viewportHeight = window.innerHeight;
1860
+ const calendarWidth = 340;
1861
+ const calendarHeight = 400;
1862
+ let viewportLeft = rect.left;
1863
+ if (viewportLeft + calendarWidth > viewportWidth) {
1864
+ viewportLeft = rect.right - calendarWidth;
1865
+ if (viewportLeft < 0) {
1866
+ viewportLeft = Math.max(0, (viewportWidth - calendarWidth) / 2);
1867
+ }
1868
+ }
1869
+ const left = viewportLeft + window.scrollX;
1870
+ const spaceBelow = viewportHeight - rect.bottom;
1871
+ const spaceAbove = rect.top;
1872
+ const openAbove = spaceBelow < calendarHeight && spaceAbove > spaceBelow;
1873
+ let top;
1874
+ if (openAbove) {
1875
+ top = rect.top + window.scrollY - calendarHeight - 4;
1876
+ } else {
1877
+ top = rect.bottom + window.scrollY + 4;
1878
+ }
1879
+ setCalendarPosition({ top, left, width: rect.width, openAbove });
1857
1880
  }
1858
1881
  };
1859
1882
  useEffect3(() => {
@@ -1936,7 +1959,10 @@ var DateInput = (_a) => {
1936
1959
  if (cursorPosition > 0 && value2[cursorPosition - 1] === sep) {
1937
1960
  event.preventDefault();
1938
1961
  const newValue = value2.slice(0, cursorPosition - 2) + value2.slice(cursorPosition);
1939
- const formattedValue = formatInputValueWithDashes(newValue, dateInDashes);
1962
+ const formattedValue = formatInputValueWithDashes(
1963
+ newValue,
1964
+ dateInDashes
1965
+ );
1940
1966
  setInputValue(formattedValue);
1941
1967
  requestAnimationFrame(() => {
1942
1968
  if (triggerRef.current) {
@@ -1987,25 +2013,58 @@ var DateInput = (_a) => {
1987
2013
  /* @__PURE__ */ jsx9(
1988
2014
  "div",
1989
2015
  {
1990
- className: "fixed inset-0 z-30",
2016
+ className: clsx6(
2017
+ "fixed inset-0 z-50",
2018
+ isMobile && "overflow-y-auto bg-neutral-600/50"
2019
+ ),
1991
2020
  onClick: () => setVisible(false),
1992
2021
  onMouseDown: (e) => {
1993
- e.preventDefault();
2022
+ if (!isMobile) {
2023
+ e.preventDefault();
2024
+ }
1994
2025
  },
1995
2026
  onWheel: (e) => {
1996
2027
  var _a2;
1997
- const scrollableParent = (_a2 = document.scrollingElement) != null ? _a2 : document.documentElement;
1998
- scrollableParent.scrollTop += e.deltaY;
1999
- scrollableParent.scrollLeft += e.deltaX;
2028
+ if (!isMobile) {
2029
+ const scrollableParent = (_a2 = document.scrollingElement) != null ? _a2 : document.documentElement;
2030
+ scrollableParent.scrollTop += e.deltaY;
2031
+ scrollableParent.scrollLeft += e.deltaX;
2032
+ }
2000
2033
  },
2001
2034
  onTouchMove: (e) => {
2002
- e.stopPropagation();
2035
+ if (!isMobile) {
2036
+ e.stopPropagation();
2037
+ }
2003
2038
  },
2004
- style: { touchAction: "pan-y pan-x" },
2005
- "aria-hidden": "true"
2039
+ style: { touchAction: isMobile ? "auto" : "pan-y pan-x" },
2040
+ "aria-hidden": "true",
2041
+ children: isMobile && /* @__PURE__ */ jsx9("div", { className: "min-h-full flex items-start justify-center py-4 px-2", children: /* @__PURE__ */ jsx9(
2042
+ "div",
2043
+ {
2044
+ ref: (el) => {
2045
+ popoverRef.current = el;
2046
+ },
2047
+ className: "bg-white rounded-base shadow-4 max-w-full",
2048
+ onClick: (e) => e.stopPropagation(),
2049
+ children: /* @__PURE__ */ jsx9(
2050
+ CalendarRange,
2051
+ {
2052
+ id: id ? `${id}-calendar` : void 0,
2053
+ testid: testid ? `${testid}-calendar` : void 0,
2054
+ from,
2055
+ to: to || from,
2056
+ onChange: handleDateChange,
2057
+ cardStyle: true,
2058
+ mode: "single",
2059
+ disableRange: true,
2060
+ isDateAvailable
2061
+ }
2062
+ )
2063
+ }
2064
+ ) })
2006
2065
  }
2007
2066
  ),
2008
- /* @__PURE__ */ jsx9(
2067
+ !isMobile && /* @__PURE__ */ jsx9(
2009
2068
  "div",
2010
2069
  {
2011
2070
  ref: (el) => {
@@ -2013,7 +2072,7 @@ var DateInput = (_a) => {
2013
2072
  },
2014
2073
  className: "absolute z-50 bg-white",
2015
2074
  style: {
2016
- top: `${calendarPosition.top + 4}px`,
2075
+ top: `${calendarPosition.top}px`,
2017
2076
  left: `${calendarPosition.left}px`
2018
2077
  },
2019
2078
  children: /* @__PURE__ */ jsx9(
@@ -2293,7 +2352,7 @@ function MobileDataGrid(props) {
2293
2352
  // src/components/DataGrid/utils.tsx
2294
2353
  import { jsx as jsx13 } from "react/jsx-runtime";
2295
2354
  function getSortIcon(sort, nextSort = false) {
2296
- const iconClassName = clsx6(
2355
+ const iconClassName = clsx7(
2297
2356
  "text-icon-on-action-primary-normal",
2298
2357
  nextSort && "hidden group-hover:block"
2299
2358
  );