@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
@@ -1,3 +1,11 @@
1
+ import {
2
+ calculateCursorPosition,
3
+ formatDate,
4
+ formatInputValue,
5
+ isValidDate,
6
+ isValidDateRangeOrder,
7
+ parseInputDate
8
+ } from "../chunk-KHQX42T7.js";
1
9
  import {
2
10
  findDocumentRoot
3
11
  } from "../chunk-4T7F5BZZ.js";
@@ -7,7 +15,7 @@ import {
7
15
  import "../chunk-S5K22XTH.js";
8
16
  import {
9
17
  CalendarRange
10
- } from "../chunk-OUSNH76S.js";
18
+ } from "../chunk-PCCJ7L3N.js";
11
19
  import {
12
20
  Icon
13
21
  } from "../chunk-IGQVA7SC.js";
@@ -19,7 +27,7 @@ import {
19
27
  } from "../chunk-ORMEWXMH.js";
20
28
 
21
29
  // src/components/DateRangeInput.tsx
22
- import { useRef, useEffect, useState } from "react";
30
+ import { useRef, useEffect, useState, useLayoutEffect } from "react";
23
31
  import { createPortal } from "react-dom";
24
32
  import { jsx, jsxs } from "react/jsx-runtime";
25
33
  var DateRangeInput = (_a) => {
@@ -31,7 +39,8 @@ var DateRangeInput = (_a) => {
31
39
  disabled,
32
40
  readOnly = false,
33
41
  single = false,
34
- label: label
42
+ disableRange = false,
43
+ label
35
44
  } = _b, props = __objRest(_b, [
36
45
  "id",
37
46
  "value",
@@ -40,10 +49,12 @@ var DateRangeInput = (_a) => {
40
49
  "disabled",
41
50
  "readOnly",
42
51
  "single",
43
- // Enables single date selection instead of range
52
+ "disableRange",
44
53
  "label"
45
54
  ]);
46
55
  const [visible, setVisible] = useState(false);
56
+ const [inputValue, setInputValue] = useState("");
57
+ const [isTyping, setIsTyping] = useState(false);
47
58
  const popoverRef = useRef(null);
48
59
  const triggerRef = useRef(null);
49
60
  const [calendarPosition, setCalendarPosition] = useState({
@@ -52,15 +63,23 @@ var DateRangeInput = (_a) => {
52
63
  width: 0
53
64
  });
54
65
  const [from, to] = value.split("|");
66
+ useEffect(() => {
67
+ if (!isTyping) {
68
+ setInputValue(formatDisplayValue(from, to));
69
+ }
70
+ }, [from, to, isTyping, disableRange]);
71
+ useLayoutEffect(() => {
72
+ if (visible) {
73
+ updatePosition();
74
+ }
75
+ }, [visible]);
55
76
  const updatePosition = () => {
56
77
  if (triggerRef.current) {
57
- requestAnimationFrame(() => {
58
- const rect = triggerRef.current.getBoundingClientRect();
59
- setCalendarPosition({
60
- top: rect.bottom + window.scrollY,
61
- left: rect.left + window.scrollX,
62
- width: rect.width
63
- });
78
+ const rect = triggerRef.current.getBoundingClientRect();
79
+ setCalendarPosition({
80
+ top: rect.bottom + window.scrollY,
81
+ left: rect.left + window.scrollX,
82
+ width: rect.width
64
83
  });
65
84
  }
66
85
  };
@@ -77,18 +96,18 @@ var DateRangeInput = (_a) => {
77
96
  };
78
97
  }, []);
79
98
  useEffect(() => {
80
- const handleKeyDown = (event) => {
99
+ const handleKeyDown2 = (event) => {
81
100
  var _a2;
82
101
  if (event.key === "Escape" && popoverRef.current) {
83
102
  setVisible(false);
84
103
  (_a2 = triggerRef.current) == null ? void 0 : _a2.blur();
85
104
  }
86
105
  };
87
- document.addEventListener("keydown", handleKeyDown);
106
+ document.addEventListener("keydown", handleKeyDown2);
88
107
  return () => {
89
- document.removeEventListener("keydown", handleKeyDown);
108
+ document.removeEventListener("keydown", handleKeyDown2);
90
109
  };
91
- });
110
+ }, []);
92
111
  useEffect(() => {
93
112
  const handleClickOutside = (event) => {
94
113
  if (popoverRef.current && !popoverRef.current.contains(event.target) && triggerRef.current && !triggerRef.current.contains(event.target)) {
@@ -101,24 +120,312 @@ var DateRangeInput = (_a) => {
101
120
  };
102
121
  }, []);
103
122
  function handleRangeChange(fromValue, toValue) {
104
- onChange(`${fromValue}|${toValue}`);
123
+ if (disableRange) {
124
+ onChange(`${fromValue}|${fromValue}`);
125
+ } else {
126
+ onChange(`${fromValue}|${toValue}`);
127
+ }
105
128
  setVisible(false);
129
+ setIsTyping(false);
106
130
  }
107
131
  const handleFocus = () => {
108
132
  if (readOnly) return;
109
133
  setVisible(true);
110
- updatePosition();
111
134
  };
112
- function formatDisplayValue(from2, to2) {
113
- if (!from2 && !to2) return "";
114
- if (from2 && to2) return `${formatDate(from2)} - ${formatDate(to2)}`;
115
- if (from2) return `${formatDate(from2)} -`;
116
- return "";
117
- }
118
- function formatDate(date) {
119
- const [y, m, d] = date.split("-");
120
- return `${m}/${d}/${y}`;
121
- }
135
+ const handleClick = () => {
136
+ handleFocus();
137
+ };
138
+ const handleInputChange = (event) => {
139
+ if (readOnly) return;
140
+ const rawValue = event.target.value;
141
+ const cursorPosition = event.target.selectionStart || 0;
142
+ if (shouldPreventManualDash(rawValue)) {
143
+ handleManualDashRemoval(rawValue, cursorPosition);
144
+ return;
145
+ }
146
+ setIsTyping(true);
147
+ const formattedValue = formatInputValue2(rawValue);
148
+ const finalValue = shouldAutoInsertDash(formattedValue, rawValue) ? `${formattedValue} - ` : formattedValue;
149
+ setInputValue(finalValue);
150
+ const newCursorPosition = calculateNewCursorPosition(
151
+ rawValue,
152
+ formattedValue,
153
+ finalValue,
154
+ cursorPosition
155
+ );
156
+ requestAnimationFrame(() => {
157
+ setCursorPosition(newCursorPosition);
158
+ });
159
+ updateParentValue(finalValue);
160
+ };
161
+ const shouldPreventManualDash = (value2) => {
162
+ return !disableRange && value2.includes("-") && !value2.includes(" - ");
163
+ };
164
+ const handleManualDashRemoval = (rawValue, cursorPosition) => {
165
+ const cleanValue = rawValue.replace(/-/g, "");
166
+ const formattedCleanValue = formatInputValue2(cleanValue);
167
+ setInputValue(formattedCleanValue);
168
+ requestAnimationFrame(() => {
169
+ const newPosition = Math.min(cursorPosition - 1, formattedCleanValue.length);
170
+ setCursorPosition(newPosition);
171
+ });
172
+ };
173
+ const shouldAutoInsertDash = (formattedValue, rawValue) => {
174
+ if (disableRange || formattedValue.includes(" - ")) {
175
+ return false;
176
+ }
177
+ const completeDate = formattedValue.match(/^(\d{2})\/(\d{2})\/(\d{4})$/);
178
+ if (!completeDate || rawValue.length !== formattedValue.length) {
179
+ return false;
180
+ }
181
+ const prevLength = rawValue.length - 1;
182
+ const prevFormatted = formatInputValue2(rawValue.slice(0, prevLength));
183
+ return !prevFormatted.match(/^(\d{2})\/(\d{2})\/(\d{4})$/);
184
+ };
185
+ const calculateNewCursorPosition = (rawValue, formattedValue, finalValue, originalPosition) => {
186
+ if (finalValue !== formattedValue) {
187
+ return finalValue.length;
188
+ }
189
+ return calculateCursorPositionHelper(rawValue, finalValue, originalPosition, disableRange);
190
+ };
191
+ const setCursorPosition = (position) => {
192
+ if (triggerRef.current) {
193
+ triggerRef.current.setSelectionRange(position, position);
194
+ }
195
+ };
196
+ const updateParentValue = (value2) => {
197
+ if (disableRange) {
198
+ updateSingleDateValue(value2);
199
+ } else {
200
+ updateRangeValue(value2);
201
+ }
202
+ };
203
+ const updateSingleDateValue = (value2) => {
204
+ const parsedDate = parseInputDate(value2);
205
+ if (parsedDate && isValidDate(parsedDate)) {
206
+ onChange(`${parsedDate}|${parsedDate}`);
207
+ }
208
+ };
209
+ const updateRangeValue = (value2) => {
210
+ if (value2 === "") {
211
+ onChange("");
212
+ return;
213
+ }
214
+ const rangeMatch = value2.match(/^(.+?)\s*-\s*(.+)$/);
215
+ if (rangeMatch) {
216
+ updateCompleteRange(rangeMatch);
217
+ } else {
218
+ updatePartialRange(value2);
219
+ }
220
+ };
221
+ const updateCompleteRange = (rangeMatch) => {
222
+ const [, fromStr, toStr] = rangeMatch;
223
+ const fromDate = parseInputDate(fromStr.trim());
224
+ const toDate = parseInputDate(toStr.trim());
225
+ if (fromDate && toDate && isValidDateRange(fromDate, toDate)) {
226
+ onChange(`${fromDate}|${toDate}`);
227
+ }
228
+ };
229
+ const updatePartialRange = (value2) => {
230
+ const singleDate = parseInputDate(value2);
231
+ if (singleDate && isValidDate(singleDate)) {
232
+ onChange(`${singleDate}|`);
233
+ }
234
+ };
235
+ const handleBlur = () => {
236
+ setIsTyping(false);
237
+ if (disableRange) {
238
+ const parsedDate = parseInputDate(inputValue);
239
+ if (!parsedDate || !isValidDate(parsedDate)) {
240
+ const lastValidValue = formatDisplayValue(from, to);
241
+ setInputValue(lastValidValue || "");
242
+ }
243
+ } else {
244
+ const rangeMatch = inputValue.match(/^(.+?)\s*-\s*(.+)$/);
245
+ if (rangeMatch) {
246
+ const [, fromStr, toStr] = rangeMatch;
247
+ const fromDate = parseInputDate(fromStr.trim());
248
+ const toDate = parseInputDate(toStr.trim());
249
+ if (!fromDate || !toDate || !isValidDateRange(fromDate, toDate)) {
250
+ setInputValue("");
251
+ onChange("");
252
+ }
253
+ } else {
254
+ if (inputValue.includes(" - ")) {
255
+ setInputValue("");
256
+ onChange("");
257
+ } else {
258
+ const singleDate = parseInputDate(inputValue);
259
+ if (!singleDate || !isValidDate(singleDate)) {
260
+ setInputValue("");
261
+ onChange("");
262
+ } else {
263
+ setInputValue("");
264
+ onChange("");
265
+ }
266
+ }
267
+ }
268
+ }
269
+ };
270
+ const handleKeyDown = (event) => {
271
+ if (!disableRange && event.key === "-") {
272
+ event.preventDefault();
273
+ return;
274
+ }
275
+ if (event.key === "Backspace") {
276
+ const input = event.target;
277
+ const cursorPosition = input.selectionStart || 0;
278
+ const value2 = input.value;
279
+ if (cursorPosition > 0 && value2[cursorPosition - 1] === "/") {
280
+ event.preventDefault();
281
+ const newValue = value2.slice(0, cursorPosition - 2) + value2.slice(cursorPosition);
282
+ const formattedValue = formatInputValue2(newValue);
283
+ setInputValue(formattedValue);
284
+ requestAnimationFrame(() => {
285
+ if (triggerRef.current) {
286
+ const newPosition = Math.max(0, cursorPosition - 2);
287
+ triggerRef.current.setSelectionRange(newPosition, newPosition);
288
+ }
289
+ });
290
+ setIsTyping(true);
291
+ return;
292
+ }
293
+ if (!disableRange && value2.includes(" - ")) {
294
+ const dashIndex = value2.indexOf(" - ");
295
+ const dashStart = dashIndex;
296
+ const dashEnd = dashIndex + 3;
297
+ if (cursorPosition >= dashStart && cursorPosition <= dashEnd) {
298
+ event.preventDefault();
299
+ const beforeDash = value2.slice(0, dashStart).trim();
300
+ const yearMatch = beforeDash.match(/^(\d{2})\/(\d{2})\/(\d{4})$/);
301
+ if (yearMatch) {
302
+ const [, month, day, year] = yearMatch;
303
+ const truncatedYear = year.slice(0, -1);
304
+ const newValue = `${month}/${day}/${truncatedYear}`;
305
+ const formattedValue = formatInputValue2(newValue);
306
+ setInputValue(formattedValue);
307
+ onChange("");
308
+ requestAnimationFrame(() => {
309
+ if (triggerRef.current) {
310
+ triggerRef.current.setSelectionRange(formattedValue.length, formattedValue.length);
311
+ }
312
+ });
313
+ } else {
314
+ const formattedValue = formatInputValue2(beforeDash);
315
+ setInputValue(formattedValue);
316
+ const singleDate = parseInputDate(beforeDash);
317
+ if (singleDate && isValidDate(singleDate)) {
318
+ onChange(`${singleDate}|`);
319
+ } else {
320
+ onChange("");
321
+ }
322
+ requestAnimationFrame(() => {
323
+ if (triggerRef.current) {
324
+ const newPosition = formattedValue.length;
325
+ triggerRef.current.setSelectionRange(newPosition, newPosition);
326
+ }
327
+ });
328
+ }
329
+ setIsTyping(true);
330
+ return;
331
+ }
332
+ if (cursorPosition === dashEnd) {
333
+ event.preventDefault();
334
+ const beforeDash = value2.slice(0, dashStart).trim();
335
+ const newValue = `${beforeDash} - `;
336
+ setInputValue(newValue);
337
+ const singleDate = parseInputDate(beforeDash);
338
+ if (singleDate && isValidDate(singleDate)) {
339
+ onChange(`${singleDate}|`);
340
+ }
341
+ requestAnimationFrame(() => {
342
+ if (triggerRef.current) {
343
+ triggerRef.current.setSelectionRange(newValue.length, newValue.length);
344
+ }
345
+ });
346
+ setIsTyping(true);
347
+ return;
348
+ }
349
+ }
350
+ }
351
+ if (event.key === "Delete") {
352
+ const input = event.target;
353
+ const cursorPosition = input.selectionStart || 0;
354
+ const value2 = input.value;
355
+ if (!disableRange && value2.includes(" - ")) {
356
+ const dashIndex = value2.indexOf(" - ");
357
+ const dashStart = dashIndex;
358
+ const dashEnd = dashIndex + 3;
359
+ if (cursorPosition >= dashStart && cursorPosition <= dashEnd) {
360
+ event.preventDefault();
361
+ const beforeDash = value2.slice(0, dashStart).trim();
362
+ const yearMatch = beforeDash.match(/^(\d{2})\/(\d{2})\/(\d{4})$/);
363
+ if (yearMatch) {
364
+ const [, month, day, year] = yearMatch;
365
+ const truncatedYear = year.slice(0, -1);
366
+ const newValue = `${month}/${day}/${truncatedYear}`;
367
+ const formattedValue = formatInputValue2(newValue);
368
+ setInputValue(formattedValue);
369
+ onChange("");
370
+ requestAnimationFrame(() => {
371
+ if (triggerRef.current) {
372
+ triggerRef.current.setSelectionRange(formattedValue.length, formattedValue.length);
373
+ }
374
+ });
375
+ } else {
376
+ const formattedValue = formatInputValue2(beforeDash);
377
+ setInputValue(formattedValue);
378
+ const singleDate = parseInputDate(beforeDash);
379
+ if (singleDate && isValidDate(singleDate)) {
380
+ onChange(`${singleDate}|`);
381
+ } else {
382
+ onChange("");
383
+ }
384
+ requestAnimationFrame(() => {
385
+ if (triggerRef.current) {
386
+ const newPosition = formattedValue.length;
387
+ triggerRef.current.setSelectionRange(newPosition, newPosition);
388
+ }
389
+ });
390
+ }
391
+ setIsTyping(true);
392
+ return;
393
+ }
394
+ }
395
+ }
396
+ if (event.key === "Enter") {
397
+ if (disableRange) {
398
+ const parsedDate = parseInputDate(inputValue);
399
+ if (parsedDate && isValidDate(parsedDate)) {
400
+ onChange(`${parsedDate}|${parsedDate}`);
401
+ setVisible(false);
402
+ setIsTyping(false);
403
+ }
404
+ } else {
405
+ const rangeMatch = inputValue.match(/^(.+?)\s*-\s*(.+)$/);
406
+ if (rangeMatch) {
407
+ const [, fromStr, toStr] = rangeMatch;
408
+ const fromDate = parseInputDate(fromStr.trim());
409
+ const toDate = parseInputDate(toStr.trim());
410
+ if (fromDate && toDate && isValidDateRange(fromDate, toDate)) {
411
+ onChange(`${fromDate}|${toDate}`);
412
+ setVisible(false);
413
+ setIsTyping(false);
414
+ } else {
415
+ setInputValue("");
416
+ onChange("");
417
+ setVisible(false);
418
+ setIsTyping(false);
419
+ }
420
+ } else {
421
+ setInputValue("");
422
+ onChange("");
423
+ setVisible(false);
424
+ setIsTyping(false);
425
+ }
426
+ }
427
+ }
428
+ };
122
429
  return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
123
430
  /* @__PURE__ */ jsx(
124
431
  InputBase,
@@ -128,15 +435,17 @@ var DateRangeInput = (_a) => {
128
435
  triggerRef.current = el;
129
436
  }
130
437
  }, props), {
131
- value: formatDisplayValue(from, to),
132
- placeholder,
438
+ value: inputValue,
439
+ placeholder: disableRange ? "MM/DD/YYYY" : placeholder,
133
440
  disabled,
441
+ readOnly,
134
442
  after: /* @__PURE__ */ jsx(Icon, { name: "calendar_month" }),
135
443
  onFocus: handleFocus,
136
- readOnly,
137
- label,
138
- onChange: () => {
139
- }
444
+ onClick: handleClick,
445
+ onChange: handleInputChange,
446
+ onBlur: handleBlur,
447
+ onKeyDown: handleKeyDown,
448
+ label
140
449
  })
141
450
  ),
142
451
  visible && !readOnly && createPortal(
@@ -160,7 +469,8 @@ var DateRangeInput = (_a) => {
160
469
  to,
161
470
  onChange: handleRangeChange,
162
471
  cardStyle: true,
163
- mode: single ? "single" : "double"
472
+ mode: single ? "single" : "double",
473
+ disableRange
164
474
  }
165
475
  )
166
476
  }
@@ -168,8 +478,77 @@ var DateRangeInput = (_a) => {
168
478
  findDocumentRoot(popoverRef.current)
169
479
  )
170
480
  ] });
481
+ function formatInputValue2(value2) {
482
+ return formatInputValueHelper(value2, disableRange);
483
+ }
484
+ function formatDisplayValue(from2, to2) {
485
+ return formatDisplayValueHelper(from2, to2, disableRange);
486
+ }
171
487
  };
172
488
  DateRangeInput.displayName = "DateRangeInput";
489
+ function isValidDateRange(fromDate, toDate) {
490
+ return isValidDateRangeOrder(fromDate, toDate);
491
+ }
492
+ function formatInputValueHelper(value, disableRange) {
493
+ if (disableRange) {
494
+ return formatInputValue(value);
495
+ }
496
+ if (value.includes(" - ")) {
497
+ const [from, to] = value.split(" - ");
498
+ const fromFormatted = formatInputValue(from);
499
+ const toFormatted = formatInputValue(to || "");
500
+ return `${fromFormatted} - ${toFormatted}`;
501
+ }
502
+ const cleanValue = value.replace(/-/g, "");
503
+ return formatInputValue(cleanValue);
504
+ }
505
+ function calculateCursorPositionHelper(originalValue, formattedValue, originalPosition, disableRange) {
506
+ if (!disableRange && formattedValue.includes(" - ")) {
507
+ const dashPosition = formattedValue.indexOf(" - ");
508
+ const originalDashPosition = originalValue.indexOf("-");
509
+ if (originalDashPosition !== -1 && originalPosition > originalDashPosition) {
510
+ const afterDashDigits = originalValue.slice(originalDashPosition + 1).replace(/\D/g, "").length;
511
+ const formattedAfterDash = formattedValue.slice(dashPosition + 3);
512
+ let newPosition = dashPosition + 3;
513
+ let digitCount = 0;
514
+ for (let i = 0; i < formattedAfterDash.length; i++) {
515
+ if (/\d/.test(formattedAfterDash[i])) {
516
+ digitCount++;
517
+ if (digitCount >= afterDashDigits) {
518
+ if (i + 1 < formattedAfterDash.length && formattedAfterDash[i + 1] === "/") {
519
+ newPosition = dashPosition + 3 + i + 2;
520
+ } else {
521
+ newPosition = dashPosition + 3 + i + 1;
522
+ }
523
+ break;
524
+ }
525
+ }
526
+ if (digitCount < afterDashDigits) {
527
+ newPosition = dashPosition + 3 + i + 1;
528
+ }
529
+ }
530
+ return Math.min(newPosition, formattedValue.length);
531
+ }
532
+ }
533
+ return calculateCursorPosition(originalValue, formattedValue, originalPosition);
534
+ }
535
+ function formatDisplayValueHelper(from, to, disableRange) {
536
+ if (!from && !to) {
537
+ return "";
538
+ }
539
+ const fromValid = from ? isValidDate(from) : false;
540
+ const toValid = to ? isValidDate(to) : false;
541
+ if (disableRange) {
542
+ return fromValid && from ? formatDate(from) : "";
543
+ }
544
+ if (fromValid && toValid && from && to && isValidDateRange(from, to)) {
545
+ return `${formatDate(from)} - ${formatDate(to)}`;
546
+ }
547
+ if (fromValid && !to && from) {
548
+ return `${formatDate(from)} - `;
549
+ }
550
+ return "";
551
+ }
173
552
  export {
174
553
  DateRangeInput
175
554
  };
@@ -409,7 +409,8 @@ var MenuOption = ({
409
409
  );
410
410
  const actionDisabledStyles = variant === "action" && disabled && (0, import_clsx5.default)("text-text-action-disabled");
411
411
  const disabledStyles = disabled && (0, import_clsx5.default)("bg-transparent cursor-default pointer-events-none");
412
- const renderChildren = typeof children === "string" && highlightMatchingText ? highlightMatch(children, menuValue) : children;
412
+ const processChildren = typeof children === "string" && highlightMatchingText ? highlightMatch(children, menuValue) : children;
413
+ const renderChildren = typeof children === "object" ? children : variant === "action" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Label, { padded: true, className: textLabelStyles, children: processChildren }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Paragraph, { padded: true, className: textLabelStyles, children: processChildren });
413
414
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
414
415
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
415
416
  "div",
@@ -443,7 +444,7 @@ var MenuOption = ({
443
444
  "aria-haspopup": subMenu ? "menu" : void 0,
444
445
  children: [
445
446
  before && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "shrink-0 flex items-center", children: before }),
446
- variant === "action" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Label, { padded: true, className: textLabelStyles, children: renderChildren }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Paragraph, { padded: true, className: textLabelStyles, children: renderChildren }),
447
+ renderChildren,
447
448
  renderAfterProp()
448
449
  ]
449
450
  })
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  MenuOption
4
- } from "../chunk-PDDZ5PMY.js";
4
+ } from "../chunk-S46RZBT4.js";
5
5
  import "../chunk-SEKKGFM6.js";
6
6
  import "../chunk-S5K22XTH.js";
7
7
  import "../chunk-VG4EPHJA.js";
@@ -99,7 +99,7 @@ function Icon(_a) {
99
99
  // src/components/Stack.tsx
100
100
  var import_clsx2 = __toESM(require("clsx"), 1);
101
101
  var import_jsx_runtime2 = require("react/jsx-runtime");
102
- var useFlexClassNames = ({ items, justify, grow }) => (0, import_clsx2.default)(
102
+ var getFlexClassNames = ({ items, justify, grow }) => (0, import_clsx2.default)(
103
103
  "flex",
104
104
  items === "start" && "items-start",
105
105
  grow && "grow",
@@ -172,7 +172,7 @@ var Stack = (_a) => {
172
172
  "left",
173
173
  "id"
174
174
  ]);
175
- const flexClassNames = useFlexClassNames({ items, justify, grow });
175
+ const flexClassNames = getFlexClassNames({ items, justify, grow });
176
176
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
177
177
  "div",
178
178
  __spreadProps(__spreadValues({
@@ -194,6 +194,7 @@ var Stack = (_a) => {
194
194
  },
195
195
  className: (0, import_clsx2.default)(
196
196
  "scrollbar-thin",
197
+ "max-w-screen",
197
198
  width !== "fit" && "w-full",
198
199
  width === "full" && "w-full",
199
200
  centered && "mx-auto",
@@ -3,7 +3,7 @@ import {
3
3
  } from "../chunk-CHTO7PW4.js";
4
4
  import {
5
5
  Stack
6
- } from "../chunk-57WRM337.js";
6
+ } from "../chunk-5POWRPIO.js";
7
7
  import {
8
8
  Heading3
9
9
  } from "../chunk-J6LETUNM.js";
@@ -412,7 +412,8 @@ var MenuOption = ({
412
412
  );
413
413
  const actionDisabledStyles = variant === "action" && disabled && (0, import_clsx5.default)("text-text-action-disabled");
414
414
  const disabledStyles = disabled && (0, import_clsx5.default)("bg-transparent cursor-default pointer-events-none");
415
- const renderChildren = typeof children === "string" && highlightMatchingText ? highlightMatch(children, menuValue) : children;
415
+ const processChildren = typeof children === "string" && highlightMatchingText ? highlightMatch(children, menuValue) : children;
416
+ const renderChildren = typeof children === "object" ? children : variant === "action" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Label, { padded: true, className: textLabelStyles, children: processChildren }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Paragraph, { padded: true, className: textLabelStyles, children: processChildren });
416
417
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
417
418
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
418
419
  "div",
@@ -446,7 +447,7 @@ var MenuOption = ({
446
447
  "aria-haspopup": subMenu ? "menu" : void 0,
447
448
  children: [
448
449
  before && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "shrink-0 flex items-center", children: before }),
449
- variant === "action" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Label, { padded: true, className: textLabelStyles, children: renderChildren }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Paragraph, { padded: true, className: textLabelStyles, children: renderChildren }),
450
+ renderChildren,
450
451
  renderAfterProp()
451
452
  ]
452
453
  })
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  MenuOption
4
- } from "../chunk-PDDZ5PMY.js";
4
+ } from "../chunk-S46RZBT4.js";
5
5
  import "../chunk-SEKKGFM6.js";
6
6
  import "../chunk-S5K22XTH.js";
7
7
  import "../chunk-VG4EPHJA.js";
@@ -466,7 +466,7 @@ function Icon(_a) {
466
466
  // src/components/Stack.tsx
467
467
  var import_clsx6 = __toESM(require("clsx"), 1);
468
468
  var import_jsx_runtime5 = require("react/jsx-runtime");
469
- var useFlexClassNames = ({ items, justify, grow }) => (0, import_clsx6.default)(
469
+ var getFlexClassNames = ({ items, justify, grow }) => (0, import_clsx6.default)(
470
470
  "flex",
471
471
  items === "start" && "items-start",
472
472
  grow && "grow",
@@ -539,7 +539,7 @@ var Stack = (_a) => {
539
539
  "left",
540
540
  "id"
541
541
  ]);
542
- const flexClassNames = useFlexClassNames({ items, justify, grow });
542
+ const flexClassNames = getFlexClassNames({ items, justify, grow });
543
543
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
544
544
  "div",
545
545
  __spreadProps(__spreadValues({
@@ -561,6 +561,7 @@ var Stack = (_a) => {
561
561
  },
562
562
  className: (0, import_clsx6.default)(
563
563
  "scrollbar-thin",
564
+ "max-w-screen",
564
565
  width !== "fit" && "w-full",
565
566
  width === "full" && "w-full",
566
567
  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
  Heading3
7
7
  } from "../chunk-J6LETUNM.js";