@dmsi/wedgekit-react 0.0.29 → 0.0.30

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 (43) hide show
  1. package/dist/{chunk-57WRM337.js → chunk-5POWRPIO.js} +3 -2
  2. package/dist/{chunk-S5KPS4IQ.js → chunk-HXEPUO5W.js} +189 -95
  3. package/dist/chunk-KHQX42T7.js +127 -0
  4. package/dist/{chunk-OUSNH76S.js → chunk-PCCJ7L3N.js} +29 -6
  5. package/dist/{chunk-PDDZ5PMY.js → chunk-S46RZBT4.js} +3 -2
  6. package/dist/components/CalendarRange.cjs +28 -5
  7. package/dist/components/CalendarRange.js +1 -1
  8. package/dist/components/DataGrid.cjs +490 -217
  9. package/dist/components/DataGrid.js +303 -122
  10. package/dist/components/DataGridCell.cjs +192 -96
  11. package/dist/components/DataGridCell.js +4 -2
  12. package/dist/components/DateInput.cjs +231 -30
  13. package/dist/components/DateInput.js +101 -27
  14. package/dist/components/DateRangeInput.cjs +550 -37
  15. package/dist/components/DateRangeInput.js +413 -34
  16. package/dist/components/MenuOption.cjs +3 -2
  17. package/dist/components/MenuOption.js +1 -1
  18. package/dist/components/MobileDataGrid.cjs +3 -2
  19. package/dist/components/MobileDataGrid.js +1 -1
  20. package/dist/components/NestedMenu.cjs +3 -2
  21. package/dist/components/NestedMenu.js +1 -1
  22. package/dist/components/Notification.cjs +3 -2
  23. package/dist/components/Notification.js +1 -1
  24. package/dist/components/SideMenuGroup.cjs +3 -2
  25. package/dist/components/SideMenuGroup.js +1 -1
  26. package/dist/components/SideMenuItem.cjs +3 -2
  27. package/dist/components/SideMenuItem.js +1 -1
  28. package/dist/components/Stack.cjs +3 -2
  29. package/dist/components/Stack.js +1 -1
  30. package/dist/components/Swatch.cjs +3 -2
  31. package/dist/components/Swatch.js +1 -1
  32. package/dist/components/Time.cjs +3 -2
  33. package/dist/components/Time.js +1 -1
  34. package/dist/index.css +9 -0
  35. package/package.json +1 -1
  36. package/src/components/CalendarRange.tsx +37 -6
  37. package/src/components/DataGrid.tsx +284 -48
  38. package/src/components/DataGridCell.tsx +122 -35
  39. package/src/components/DateInput.tsx +118 -25
  40. package/src/components/DateRangeInput.tsx +544 -30
  41. package/src/components/MenuOption.tsx +18 -14
  42. package/src/components/Stack.tsx +4 -2
  43. package/src/utils/date.ts +206 -0
@@ -238,7 +238,7 @@ Label.displayName = "Label";
238
238
  // src/components/Stack.tsx
239
239
  var import_clsx3 = __toESM(require("clsx"), 1);
240
240
  var import_jsx_runtime2 = require("react/jsx-runtime");
241
- var useFlexClassNames = ({ items, justify, grow }) => (0, import_clsx3.default)(
241
+ var getFlexClassNames = ({ items, justify, grow }) => (0, import_clsx3.default)(
242
242
  "flex",
243
243
  items === "start" && "items-start",
244
244
  grow && "grow",
@@ -311,7 +311,7 @@ var Stack = (_a) => {
311
311
  "left",
312
312
  "id"
313
313
  ]);
314
- const flexClassNames = useFlexClassNames({ items, justify, grow });
314
+ const flexClassNames = getFlexClassNames({ items, justify, grow });
315
315
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
316
316
  "div",
317
317
  __spreadProps(__spreadValues({
@@ -333,6 +333,7 @@ var Stack = (_a) => {
333
333
  },
334
334
  className: (0, import_clsx3.default)(
335
335
  "scrollbar-thin",
336
+ "max-w-screen",
336
337
  width !== "fit" && "w-full",
337
338
  width === "full" && "w-full",
338
339
  centered && "mx-auto",
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  Stack
4
- } from "../chunk-57WRM337.js";
4
+ } from "../chunk-5POWRPIO.js";
5
5
  import {
6
6
  Label
7
7
  } from "../chunk-S5K22XTH.js";
@@ -193,7 +193,7 @@ var gapUsingContainerPadding = (0, import_clsx.default)(
193
193
  // src/components/Stack.tsx
194
194
  var import_clsx2 = __toESM(require("clsx"), 1);
195
195
  var import_jsx_runtime = require("react/jsx-runtime");
196
- var useFlexClassNames = ({ items, justify, grow }) => (0, import_clsx2.default)(
196
+ var getFlexClassNames = ({ items, justify, grow }) => (0, import_clsx2.default)(
197
197
  "flex",
198
198
  items === "start" && "items-start",
199
199
  grow && "grow",
@@ -266,7 +266,7 @@ var Stack = (_a) => {
266
266
  "left",
267
267
  "id"
268
268
  ]);
269
- const flexClassNames = useFlexClassNames({ items, justify, grow });
269
+ const flexClassNames = getFlexClassNames({ items, justify, grow });
270
270
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
271
271
  "div",
272
272
  __spreadProps(__spreadValues({
@@ -288,6 +288,7 @@ var Stack = (_a) => {
288
288
  },
289
289
  className: (0, import_clsx2.default)(
290
290
  "scrollbar-thin",
291
+ "max-w-screen",
291
292
  width !== "fit" && "w-full",
292
293
  width === "full" && "w-full",
293
294
  centered && "mx-auto",
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Stack
3
- } from "../chunk-57WRM337.js";
3
+ } from "../chunk-5POWRPIO.js";
4
4
  import {
5
5
  Paragraph
6
6
  } from "../chunk-VG4EPHJA.js";
@@ -64,7 +64,7 @@ __export(Stack_exports, {
64
64
  module.exports = __toCommonJS(Stack_exports);
65
65
  var import_clsx = __toESM(require("clsx"), 1);
66
66
  var import_jsx_runtime = require("react/jsx-runtime");
67
- var useFlexClassNames = ({ items, justify, grow }) => (0, import_clsx.default)(
67
+ var getFlexClassNames = ({ items, justify, grow }) => (0, import_clsx.default)(
68
68
  "flex",
69
69
  items === "start" && "items-start",
70
70
  grow && "grow",
@@ -137,7 +137,7 @@ var Stack = (_a) => {
137
137
  "left",
138
138
  "id"
139
139
  ]);
140
- const flexClassNames = useFlexClassNames({ items, justify, grow });
140
+ const flexClassNames = getFlexClassNames({ items, justify, grow });
141
141
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
142
142
  "div",
143
143
  __spreadProps(__spreadValues({
@@ -159,6 +159,7 @@ var Stack = (_a) => {
159
159
  },
160
160
  className: (0, import_clsx.default)(
161
161
  "scrollbar-thin",
162
+ "max-w-screen",
162
163
  width !== "fit" && "w-full",
163
164
  width === "full" && "w-full",
164
165
  centered && "mx-auto",
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Stack
3
- } from "../chunk-57WRM337.js";
3
+ } from "../chunk-5POWRPIO.js";
4
4
  import "../chunk-ORMEWXMH.js";
5
5
  export {
6
6
  Stack
@@ -243,7 +243,7 @@ Display2.displayName = "Display2";
243
243
  // src/components/Stack.tsx
244
244
  var import_clsx3 = __toESM(require("clsx"), 1);
245
245
  var import_jsx_runtime2 = require("react/jsx-runtime");
246
- var useFlexClassNames = ({ items, justify, grow }) => (0, import_clsx3.default)(
246
+ var getFlexClassNames = ({ items, justify, grow }) => (0, import_clsx3.default)(
247
247
  "flex",
248
248
  items === "start" && "items-start",
249
249
  grow && "grow",
@@ -316,7 +316,7 @@ var Stack = (_a) => {
316
316
  "left",
317
317
  "id"
318
318
  ]);
319
- const flexClassNames = useFlexClassNames({ items, justify, grow });
319
+ const flexClassNames = getFlexClassNames({ items, justify, grow });
320
320
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
321
321
  "div",
322
322
  __spreadProps(__spreadValues({
@@ -338,6 +338,7 @@ var Stack = (_a) => {
338
338
  },
339
339
  className: (0, import_clsx3.default)(
340
340
  "scrollbar-thin",
341
+ "max-w-screen",
341
342
  width !== "fit" && "w-full",
342
343
  width === "full" && "w-full",
343
344
  centered && "mx-auto",
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Stack
3
- } from "../chunk-57WRM337.js";
3
+ } from "../chunk-5POWRPIO.js";
4
4
  import {
5
5
  Display1
6
6
  } from "../chunk-AY7ELVQY.js";
@@ -712,7 +712,7 @@ function findDocumentRoot(element) {
712
712
  // src/components/Stack.tsx
713
713
  var import_clsx5 = __toESM(require("clsx"), 1);
714
714
  var import_jsx_runtime4 = require("react/jsx-runtime");
715
- var useFlexClassNames = ({ items, justify, grow }) => (0, import_clsx5.default)(
715
+ var getFlexClassNames = ({ items, justify, grow }) => (0, import_clsx5.default)(
716
716
  "flex",
717
717
  items === "start" && "items-start",
718
718
  grow && "grow",
@@ -785,7 +785,7 @@ var Stack = (_a) => {
785
785
  "left",
786
786
  "id"
787
787
  ]);
788
- const flexClassNames = useFlexClassNames({ items, justify, grow });
788
+ const flexClassNames = getFlexClassNames({ items, justify, grow });
789
789
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
790
790
  "div",
791
791
  __spreadProps(__spreadValues({
@@ -807,6 +807,7 @@ var Stack = (_a) => {
807
807
  },
808
808
  className: (0, import_clsx5.default)(
809
809
  "scrollbar-thin",
810
+ "max-w-screen",
810
811
  width !== "fit" && "w-full",
811
812
  width === "full" && "w-full",
812
813
  centered && "mx-auto",
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Stack
3
- } from "../chunk-57WRM337.js";
3
+ } from "../chunk-5POWRPIO.js";
4
4
  import {
5
5
  findDocumentRoot
6
6
  } from "../chunk-4T7F5BZZ.js";
package/dist/index.css CHANGED
@@ -560,6 +560,9 @@
560
560
  .z-10 {
561
561
  z-index: 10;
562
562
  }
563
+ .z-20 {
564
+ z-index: 20;
565
+ }
563
566
  .z-40 {
564
567
  z-index: 40;
565
568
  }
@@ -746,6 +749,9 @@
746
749
  .min-h-\[34px\] {
747
750
  min-height: 34px;
748
751
  }
752
+ .min-h-min {
753
+ min-height: min-content;
754
+ }
749
755
  .min-h-mobile-container-padding {
750
756
  min-height: var(--spacing-mobile-container-padding);
751
757
  }
@@ -821,6 +827,9 @@
821
827
  .max-w-full {
822
828
  max-width: 100%;
823
829
  }
830
+ .max-w-screen {
831
+ max-width: 100vw;
832
+ }
824
833
  .max-w-xl {
825
834
  max-width: var(--container-xl);
826
835
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dmsi/wedgekit-react",
3
3
  "private": false,
4
- "version": "0.0.29",
4
+ "version": "0.0.30",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "build": "tsup",
@@ -7,7 +7,7 @@ import {
7
7
  layoutGap,
8
8
  } from "../classNames";
9
9
  import { Icon } from "./Icon";
10
- import React, { useState } from "react";
10
+ import React, { useEffect, useState } from "react";
11
11
  import { Temporal } from "@js-temporal/polyfill";
12
12
 
13
13
  export interface CalendarRangeProps {
@@ -146,11 +146,24 @@ export function CalendarRange({
146
146
  const weekDays = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
147
147
  // Parse from/to props
148
148
  const parseDate = (d?: string | number) => {
149
- if (!d) return undefined;
150
- if (typeof d === "number")
151
- return Temporal.PlainDate.from(new Date(d).toISOString().slice(0, 10));
152
- if (typeof d === "string") return Temporal.PlainDate.from(d);
153
- return undefined;
149
+ if (!d) {
150
+ return undefined;
151
+ }
152
+
153
+ try {
154
+ if (typeof d === "number") {
155
+ return Temporal.PlainDate.from(new Date(d).toISOString().slice(0, 10));
156
+ }
157
+
158
+ if (typeof d === "string") {
159
+ return Temporal.PlainDate.from(d);
160
+ }
161
+
162
+ return undefined;
163
+ } catch (error) {
164
+ // If parsing fails, return current date instead of throwing
165
+ return Temporal.Now.plainDateISO();
166
+ }
154
167
  };
155
168
  const fromDate = parseDate(from);
156
169
  const toDate = parseDate(to);
@@ -168,6 +181,24 @@ export function CalendarRange({
168
181
  Temporal.PlainDate | undefined
169
182
  >(undefined);
170
183
 
184
+ // Update base month when from/to props change
185
+ useEffect(() => {
186
+ if (fromDate) {
187
+ setBaseMonth(fromDate.with({ day: 1 }));
188
+ } else if (toDate) {
189
+ setBaseMonth(toDate.with({ day: 1 }));
190
+ }
191
+ }, [from, to]);
192
+
193
+ // Reset selection state when from/to props change externally
194
+ useEffect(() => {
195
+ if (fromDate && toDate) {
196
+ setSelecting("from");
197
+ setPendingFrom(undefined);
198
+ setHoveredDate(undefined);
199
+ }
200
+ }, [from, to]);
201
+
171
202
  // Helper to get month data
172
203
  function getMonthData(monthOffset: number) {
173
204
  const monthDate = baseMonth.add({ months: monthOffset }).with({ day: 1 });