@dmsi/wedgekit-react 0.0.884 → 0.0.886

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 (53) hide show
  1. package/dist/{chunk-E7XBOMT4.js → chunk-ZXP2GIWZ.js} +81 -22
  2. package/dist/components/CalendarRange.cjs +133 -77
  3. package/dist/components/CalendarRange.css +0 -3
  4. package/dist/components/CalendarRange.js +3 -3
  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 +3 -3
  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 +3 -3
  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 +3 -3
  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 +3 -3
  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 +3 -3
  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 +3 -3
  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 +3 -3
  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 +3 -3
  29. package/dist/components/DateInput.cjs +73 -17
  30. package/dist/components/DateInput.css +0 -3
  31. package/dist/components/DateInput.js +3 -3
  32. package/dist/components/DateRangeInput.cjs +133 -77
  33. package/dist/components/DateRangeInput.css +0 -3
  34. package/dist/components/DateRangeInput.js +3 -3
  35. package/dist/components/MobileDataGrid/ColumnList.css +0 -3
  36. package/dist/components/MobileDataGrid/ColumnList.js +1 -1
  37. package/dist/components/MobileDataGrid/ColumnSelector/index.cjs +119 -63
  38. package/dist/components/MobileDataGrid/ColumnSelector/index.css +0 -3
  39. package/dist/components/MobileDataGrid/ColumnSelector/index.js +3 -3
  40. package/dist/components/MobileDataGrid/MobileDataGridCard/index.js +1 -1
  41. package/dist/components/MobileDataGrid/MobileDataGridHeader.cjs +116 -60
  42. package/dist/components/MobileDataGrid/MobileDataGridHeader.css +0 -3
  43. package/dist/components/MobileDataGrid/MobileDataGridHeader.js +3 -3
  44. package/dist/components/MobileDataGrid/RowDetailModalProvider/ModalContent.js +1 -1
  45. package/dist/components/MobileDataGrid/RowDetailModalProvider/index.js +1 -1
  46. package/dist/components/MobileDataGrid/index.cjs +120 -64
  47. package/dist/components/MobileDataGrid/index.css +0 -3
  48. package/dist/components/MobileDataGrid/index.js +3 -3
  49. package/dist/components/index.cjs +152 -96
  50. package/dist/components/index.css +0 -3
  51. package/dist/components/index.js +3 -3
  52. package/dist/index.css +0 -3
  53. package/package.json +1 -1
@@ -64,6 +64,7 @@ __export(DateInput_exports, {
64
64
  module.exports = __toCommonJS(DateInput_exports);
65
65
  var import_react43 = require("react");
66
66
  var import_react_dom4 = require("react-dom");
67
+ var import_clsx44 = __toESM(require("clsx"), 1);
67
68
 
68
69
  // src/components/Input.tsx
69
70
  var import_react = require("react");
@@ -5920,10 +5921,12 @@ var DateInput = (_a) => {
5920
5921
  const popoverRef = (0, import_react43.useRef)(null);
5921
5922
  const triggerRef = (0, import_react43.useRef)(null);
5922
5923
  const rootRef = (0, import_react43.useRef)(null);
5924
+ const isMobile = useMatchesMobile();
5923
5925
  const [calendarPosition, setCalendarPosition] = (0, import_react43.useState)({
5924
5926
  top: 0,
5925
5927
  left: 0,
5926
- width: 0
5928
+ width: 0,
5929
+ openAbove: false
5927
5930
  });
5928
5931
  const [from, to] = [value, ""];
5929
5932
  (0, import_react43.useEffect)(() => {
@@ -5939,11 +5942,28 @@ var DateInput = (_a) => {
5939
5942
  const updatePosition = () => {
5940
5943
  if (rootRef.current) {
5941
5944
  const rect = rootRef.current.getBoundingClientRect();
5942
- setCalendarPosition({
5943
- top: rect.bottom + window.scrollY,
5944
- left: rect.left + window.scrollX,
5945
- width: rect.width
5946
- });
5945
+ const viewportWidth = window.innerWidth;
5946
+ const viewportHeight = window.innerHeight;
5947
+ const calendarWidth = 340;
5948
+ const calendarHeight = 400;
5949
+ let viewportLeft = rect.left;
5950
+ if (viewportLeft + calendarWidth > viewportWidth) {
5951
+ viewportLeft = rect.right - calendarWidth;
5952
+ if (viewportLeft < 0) {
5953
+ viewportLeft = Math.max(0, (viewportWidth - calendarWidth) / 2);
5954
+ }
5955
+ }
5956
+ const left = viewportLeft + window.scrollX;
5957
+ const spaceBelow = viewportHeight - rect.bottom;
5958
+ const spaceAbove = rect.top;
5959
+ const openAbove = spaceBelow < calendarHeight && spaceAbove > spaceBelow;
5960
+ let top;
5961
+ if (openAbove) {
5962
+ top = rect.top + window.scrollY - calendarHeight - 4;
5963
+ } else {
5964
+ top = rect.bottom + window.scrollY + 4;
5965
+ }
5966
+ setCalendarPosition({ top, left, width: rect.width, openAbove });
5947
5967
  }
5948
5968
  };
5949
5969
  (0, import_react43.useEffect)(() => {
@@ -6026,7 +6046,10 @@ var DateInput = (_a) => {
6026
6046
  if (cursorPosition > 0 && value2[cursorPosition - 1] === sep) {
6027
6047
  event.preventDefault();
6028
6048
  const newValue = value2.slice(0, cursorPosition - 2) + value2.slice(cursorPosition);
6029
- const formattedValue = formatInputValueWithDashes(newValue, dateInDashes);
6049
+ const formattedValue = formatInputValueWithDashes(
6050
+ newValue,
6051
+ dateInDashes
6052
+ );
6030
6053
  setInputValue(formattedValue);
6031
6054
  requestAnimationFrame(() => {
6032
6055
  if (triggerRef.current) {
@@ -6077,25 +6100,58 @@ var DateInput = (_a) => {
6077
6100
  /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
6078
6101
  "div",
6079
6102
  {
6080
- className: "fixed inset-0 z-30",
6103
+ className: (0, import_clsx44.default)(
6104
+ "fixed inset-0 z-50",
6105
+ isMobile && "overflow-y-auto bg-neutral-600/50"
6106
+ ),
6081
6107
  onClick: () => setVisible(false),
6082
6108
  onMouseDown: (e) => {
6083
- e.preventDefault();
6109
+ if (!isMobile) {
6110
+ e.preventDefault();
6111
+ }
6084
6112
  },
6085
6113
  onWheel: (e) => {
6086
6114
  var _a2;
6087
- const scrollableParent = (_a2 = document.scrollingElement) != null ? _a2 : document.documentElement;
6088
- scrollableParent.scrollTop += e.deltaY;
6089
- scrollableParent.scrollLeft += e.deltaX;
6115
+ if (!isMobile) {
6116
+ const scrollableParent = (_a2 = document.scrollingElement) != null ? _a2 : document.documentElement;
6117
+ scrollableParent.scrollTop += e.deltaY;
6118
+ scrollableParent.scrollLeft += e.deltaX;
6119
+ }
6090
6120
  },
6091
6121
  onTouchMove: (e) => {
6092
- e.stopPropagation();
6122
+ if (!isMobile) {
6123
+ e.stopPropagation();
6124
+ }
6093
6125
  },
6094
- style: { touchAction: "pan-y pan-x" },
6095
- "aria-hidden": "true"
6126
+ style: { touchAction: isMobile ? "auto" : "pan-y pan-x" },
6127
+ "aria-hidden": "true",
6128
+ children: isMobile && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "min-h-full flex items-start justify-center py-4 px-2", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
6129
+ "div",
6130
+ {
6131
+ ref: (el) => {
6132
+ popoverRef.current = el;
6133
+ },
6134
+ className: "bg-white rounded-base shadow-4 max-w-full",
6135
+ onClick: (e) => e.stopPropagation(),
6136
+ children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
6137
+ CalendarRange,
6138
+ {
6139
+ id: id ? `${id}-calendar` : void 0,
6140
+ testid: testid ? `${testid}-calendar` : void 0,
6141
+ from,
6142
+ to: to || from,
6143
+ onChange: handleDateChange,
6144
+ cardStyle: true,
6145
+ mode: "single",
6146
+ disableRange: true,
6147
+ isDateAvailable
6148
+ }
6149
+ )
6150
+ }
6151
+ ) })
6096
6152
  }
6097
6153
  ),
6098
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
6154
+ !isMobile && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
6099
6155
  "div",
6100
6156
  {
6101
6157
  ref: (el) => {
@@ -6103,7 +6159,7 @@ var DateInput = (_a) => {
6103
6159
  },
6104
6160
  className: "absolute z-50 bg-white",
6105
6161
  style: {
6106
- top: `${calendarPosition.top + 4}px`,
6162
+ top: `${calendarPosition.top}px`,
6107
6163
  left: `${calendarPosition.left}px`
6108
6164
  },
6109
6165
  children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
@@ -599,9 +599,6 @@
599
599
  .z-20 {
600
600
  z-index: 20;
601
601
  }
602
- .z-30 {
603
- z-index: 30;
604
- }
605
602
  .z-40 {
606
603
  z-index: 40;
607
604
  }
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  DateInput
3
- } from "../chunk-E7XBOMT4.js";
3
+ } from "../chunk-ZXP2GIWZ.js";
4
+ import "../chunk-M7INAUAJ.js";
4
5
  import "../chunk-4DPSNQCM.js";
5
6
  import "../chunk-Q4YDNW7N.js";
6
- import "../chunk-M7INAUAJ.js";
7
7
  import "../chunk-KOKA2IJC.js";
8
8
  import "../chunk-MBZ55T2D.js";
9
9
  import "../chunk-2IKT6IHB.js";
@@ -15,8 +15,8 @@ import "../chunk-3N34VVYD.js";
15
15
  import "../chunk-B4AE3DCA.js";
16
16
  import "../chunk-FP3Y5JJN.js";
17
17
  import "../chunk-5IFPG6TS.js";
18
- import "../chunk-6EYMKEJ6.js";
19
18
  import "../chunk-AJ5M6MVX.js";
19
+ import "../chunk-6EYMKEJ6.js";
20
20
  import "../chunk-YV5FS7NV.js";
21
21
  import "../chunk-Z2HPSFEQ.js";
22
22
  import "../chunk-AT4AWD6B.js";