@dmsi/wedgekit-react 0.0.854 → 0.0.856
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.
- package/dist/{chunk-T7NSOCGM.js → chunk-RESDUVMA.js} +76 -17
- package/dist/components/CalendarRange.cjs +77 -34
- package/dist/components/CalendarRange.js +3 -3
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.cjs +75 -34
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.js +3 -3
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.cjs +75 -34
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.js +3 -3
- package/dist/components/DataGrid/PinnedColumns.cjs +75 -34
- package/dist/components/DataGrid/PinnedColumns.js +3 -3
- package/dist/components/DataGrid/TableBody/LoadingCell.cjs +75 -34
- package/dist/components/DataGrid/TableBody/LoadingCell.js +3 -3
- package/dist/components/DataGrid/TableBody/TableBodyRow.cjs +75 -34
- package/dist/components/DataGrid/TableBody/TableBodyRow.js +3 -3
- package/dist/components/DataGrid/TableBody/index.cjs +75 -34
- package/dist/components/DataGrid/TableBody/index.js +3 -3
- package/dist/components/DataGrid/index.cjs +75 -34
- package/dist/components/DataGrid/index.js +3 -3
- package/dist/components/DataGrid/utils.cjs +75 -34
- package/dist/components/DataGrid/utils.js +3 -3
- package/dist/components/DateInput.cjs +75 -34
- package/dist/components/DateInput.js +3 -3
- package/dist/components/DateRangeInput.cjs +77 -14
- package/dist/components/DateRangeInput.js +3 -3
- package/dist/components/MobileDataGrid/ColumnSelector/index.cjs +75 -34
- package/dist/components/MobileDataGrid/ColumnSelector/index.js +3 -3
- package/dist/components/MobileDataGrid/MobileDataGridHeader.cjs +75 -34
- package/dist/components/MobileDataGrid/MobileDataGridHeader.js +3 -3
- package/dist/components/MobileDataGrid/index.cjs +75 -34
- package/dist/components/MobileDataGrid/index.js +3 -3
- package/dist/components/ProductImagePreview/index.js +2 -2
- package/dist/components/index.cjs +75 -34
- package/dist/components/index.js +3 -3
- package/package.json +1 -1
- package/dist/{chunk-C5DKGJ4E.js → chunk-Y75MQKNY.js} +3 -3
|
@@ -907,30 +907,10 @@ function formatCurrencyDisplay(value) {
|
|
|
907
907
|
}
|
|
908
908
|
|
|
909
909
|
// src/utils/date.ts
|
|
910
|
-
function parseInputDate(input) {
|
|
911
|
-
const match = input.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);
|
|
912
|
-
if (!match) {
|
|
913
|
-
return null;
|
|
914
|
-
}
|
|
915
|
-
const [, month, day, year] = match;
|
|
916
|
-
const paddedMonth = month.padStart(2, "0");
|
|
917
|
-
const paddedDay = day.padStart(2, "0");
|
|
918
|
-
return `${year}-${paddedMonth}-${paddedDay}`;
|
|
919
|
-
}
|
|
920
910
|
function isValidDate(dateString) {
|
|
921
911
|
const date = new Date(dateString);
|
|
922
912
|
return date instanceof Date && !isNaN(date.getTime()) && dateString === date.toISOString().split("T")[0];
|
|
923
913
|
}
|
|
924
|
-
function formatInputValue(value) {
|
|
925
|
-
const digits = value.replace(/\D/g, "");
|
|
926
|
-
if (digits.length < 2) {
|
|
927
|
-
return digits;
|
|
928
|
-
}
|
|
929
|
-
if (digits.length >= 4) {
|
|
930
|
-
return `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, 8)}`;
|
|
931
|
-
}
|
|
932
|
-
return `${digits.slice(0, 2)}/${digits.slice(2)}`;
|
|
933
|
-
}
|
|
934
914
|
function isDigit(character) {
|
|
935
915
|
return /\d/.test(character);
|
|
936
916
|
}
|
|
@@ -3924,6 +3904,10 @@ function DataGrid({
|
|
|
3924
3904
|
(0, import_core.useSensor)(import_core.KeyboardSensor)
|
|
3925
3905
|
);
|
|
3926
3906
|
const visibleColumns = table.getVisibleLeafColumns();
|
|
3907
|
+
const nonPinnedColumnIds = table.getCenterLeafColumns().map((col) => col.id);
|
|
3908
|
+
const sortableColumnOrder = columnOrder.filter(
|
|
3909
|
+
(id2) => nonPinnedColumnIds.includes(id2)
|
|
3910
|
+
);
|
|
3927
3911
|
const columnVirtualizer = (0, import_react_virtual2.useVirtualizer)({
|
|
3928
3912
|
count: visibleColumns.length,
|
|
3929
3913
|
estimateSize: (index) => visibleColumns[index].getSize(),
|
|
@@ -3952,7 +3936,7 @@ function DataGrid({
|
|
|
3952
3936
|
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3953
3937
|
import_sortable2.SortableContext,
|
|
3954
3938
|
{
|
|
3955
|
-
items:
|
|
3939
|
+
items: sortableColumnOrder,
|
|
3956
3940
|
strategy: import_sortable2.horizontalListSortingStrategy,
|
|
3957
3941
|
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
3958
3942
|
"div",
|
|
@@ -5187,6 +5171,60 @@ function CalendarPane({
|
|
|
5187
5171
|
] }, month.name + month.year);
|
|
5188
5172
|
}
|
|
5189
5173
|
|
|
5174
|
+
// src/utils/date-patch-dashes.ts
|
|
5175
|
+
function formatInputValueWithDashes(value, dateInDashes) {
|
|
5176
|
+
const digits = value.replace(/\D/g, "");
|
|
5177
|
+
if (dateInDashes) {
|
|
5178
|
+
if (digits.length <= 4) return digits;
|
|
5179
|
+
if (digits.length <= 6) return `${digits.slice(0, 4)}-${digits.slice(4)}`;
|
|
5180
|
+
return `${digits.slice(4, 6)}-${digits.slice(6, 8)}-${digits.slice(0, 4)}`;
|
|
5181
|
+
} else {
|
|
5182
|
+
if (digits.length <= 2) return digits;
|
|
5183
|
+
if (digits.length <= 4) return `${digits.slice(0, 2)}/${digits.slice(2)}`;
|
|
5184
|
+
return `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, 8)}`;
|
|
5185
|
+
}
|
|
5186
|
+
}
|
|
5187
|
+
function formatDateWithDashes(value, dateInDashes) {
|
|
5188
|
+
if (!value) return "";
|
|
5189
|
+
let year = "", month = "", day = "";
|
|
5190
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
5191
|
+
[year, month, day] = value.split("-");
|
|
5192
|
+
} else if (/^\d{2}-\d{2}-\d{4}$/.test(value)) {
|
|
5193
|
+
[month, day, year] = value.split("-");
|
|
5194
|
+
} else if (/^\d{2}\/\d{2}\/\d{4}$/.test(value)) {
|
|
5195
|
+
[month, day, year] = value.split("/");
|
|
5196
|
+
} else {
|
|
5197
|
+
return value;
|
|
5198
|
+
}
|
|
5199
|
+
if (!year || !month || !day) return value;
|
|
5200
|
+
if (dateInDashes) {
|
|
5201
|
+
return `${month}-${day}-${year}`;
|
|
5202
|
+
}
|
|
5203
|
+
return `${month}/${day}/${year}`;
|
|
5204
|
+
}
|
|
5205
|
+
function parseInputDateWithDashes(value, dateInDashes) {
|
|
5206
|
+
if (!value) return "";
|
|
5207
|
+
let year = "", month = "", day = "";
|
|
5208
|
+
if (dateInDashes) {
|
|
5209
|
+
let match = value.match(/^(\d{2})-(\d{2})-(\d{4})$/);
|
|
5210
|
+
if (match) {
|
|
5211
|
+
[, month, day, year] = match;
|
|
5212
|
+
} else {
|
|
5213
|
+
match = value.match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
|
5214
|
+
if (match) {
|
|
5215
|
+
[, year, month, day] = match;
|
|
5216
|
+
}
|
|
5217
|
+
}
|
|
5218
|
+
} else {
|
|
5219
|
+
const match = value.match(/^(\d{2})\/(\d{2})\/(\d{4})$/);
|
|
5220
|
+
if (match) {
|
|
5221
|
+
[, month, day, year] = match;
|
|
5222
|
+
}
|
|
5223
|
+
}
|
|
5224
|
+
if (!year || !month || !day) return "";
|
|
5225
|
+
return `${month}-${day}-${year}`;
|
|
5226
|
+
}
|
|
5227
|
+
|
|
5190
5228
|
// src/components/DateInput.tsx
|
|
5191
5229
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
5192
5230
|
var DateInput = (_a) => {
|
|
@@ -5200,7 +5238,8 @@ var DateInput = (_a) => {
|
|
|
5200
5238
|
readOnly = false,
|
|
5201
5239
|
label,
|
|
5202
5240
|
isDateAvailable,
|
|
5203
|
-
disableManualInput
|
|
5241
|
+
disableManualInput,
|
|
5242
|
+
dateInDashes = false
|
|
5204
5243
|
} = _b, props = __objRest(_b, [
|
|
5205
5244
|
"id",
|
|
5206
5245
|
"testid",
|
|
@@ -5211,7 +5250,8 @@ var DateInput = (_a) => {
|
|
|
5211
5250
|
"readOnly",
|
|
5212
5251
|
"label",
|
|
5213
5252
|
"isDateAvailable",
|
|
5214
|
-
"disableManualInput"
|
|
5253
|
+
"disableManualInput",
|
|
5254
|
+
"dateInDashes"
|
|
5215
5255
|
]);
|
|
5216
5256
|
const [visible, setVisible] = (0, import_react21.useState)(false);
|
|
5217
5257
|
const [inputValue, setInputValue] = (0, import_react21.useState)("");
|
|
@@ -5227,9 +5267,9 @@ var DateInput = (_a) => {
|
|
|
5227
5267
|
const [from, to] = [value, ""];
|
|
5228
5268
|
(0, import_react21.useEffect)(() => {
|
|
5229
5269
|
if (!isTyping) {
|
|
5230
|
-
setInputValue(formatDisplayValue(from));
|
|
5270
|
+
setInputValue(formatDisplayValue(from, dateInDashes));
|
|
5231
5271
|
}
|
|
5232
|
-
}, [from, isTyping]);
|
|
5272
|
+
}, [from, isTyping, dateInDashes]);
|
|
5233
5273
|
(0, import_react21.useLayoutEffect)(() => {
|
|
5234
5274
|
if (visible) {
|
|
5235
5275
|
updatePosition();
|
|
@@ -5292,7 +5332,7 @@ var DateInput = (_a) => {
|
|
|
5292
5332
|
const rawValue = event.target.value;
|
|
5293
5333
|
const cursorPosition = event.target.selectionStart || 0;
|
|
5294
5334
|
setIsTyping(true);
|
|
5295
|
-
const formattedValue =
|
|
5335
|
+
const formattedValue = formatInputValueWithDashes(rawValue, dateInDashes);
|
|
5296
5336
|
setInputValue(formattedValue);
|
|
5297
5337
|
requestAnimationFrame(() => {
|
|
5298
5338
|
if (triggerRef.current) {
|
|
@@ -5304,16 +5344,16 @@ var DateInput = (_a) => {
|
|
|
5304
5344
|
triggerRef.current.setSelectionRange(newPosition, newPosition);
|
|
5305
5345
|
}
|
|
5306
5346
|
});
|
|
5307
|
-
const parsedDate =
|
|
5347
|
+
const parsedDate = parseInputDateWithDashes(formattedValue, dateInDashes);
|
|
5308
5348
|
if (parsedDate && isValidDate(parsedDate)) {
|
|
5309
5349
|
onChange(parsedDate);
|
|
5310
5350
|
}
|
|
5311
5351
|
};
|
|
5312
5352
|
const handleBlur = () => {
|
|
5313
5353
|
setIsTyping(false);
|
|
5314
|
-
const parsedDate =
|
|
5354
|
+
const parsedDate = parseInputDateWithDashes(inputValue, dateInDashes);
|
|
5315
5355
|
if (!parsedDate || !isValidDate(parsedDate)) {
|
|
5316
|
-
setInputValue(formatDisplayValue(from));
|
|
5356
|
+
setInputValue(formatDisplayValue(from, dateInDashes));
|
|
5317
5357
|
}
|
|
5318
5358
|
};
|
|
5319
5359
|
const handleKeyDown = (event) => {
|
|
@@ -5321,10 +5361,11 @@ var DateInput = (_a) => {
|
|
|
5321
5361
|
const input = event.target;
|
|
5322
5362
|
const cursorPosition = input.selectionStart || 0;
|
|
5323
5363
|
const value2 = input.value;
|
|
5324
|
-
|
|
5364
|
+
const sep = dateInDashes ? "-" : "/";
|
|
5365
|
+
if (cursorPosition > 0 && value2[cursorPosition - 1] === sep) {
|
|
5325
5366
|
event.preventDefault();
|
|
5326
5367
|
const newValue = value2.slice(0, cursorPosition - 2) + value2.slice(cursorPosition);
|
|
5327
|
-
const formattedValue =
|
|
5368
|
+
const formattedValue = formatInputValueWithDashes(newValue, dateInDashes);
|
|
5328
5369
|
setInputValue(formattedValue);
|
|
5329
5370
|
requestAnimationFrame(() => {
|
|
5330
5371
|
if (triggerRef.current) {
|
|
@@ -5337,7 +5378,7 @@ var DateInput = (_a) => {
|
|
|
5337
5378
|
}
|
|
5338
5379
|
}
|
|
5339
5380
|
if (event.key === "Enter") {
|
|
5340
|
-
const parsedDate =
|
|
5381
|
+
const parsedDate = parseInputDateWithDashes(inputValue, dateInDashes);
|
|
5341
5382
|
if (parsedDate && isValidDate(parsedDate)) {
|
|
5342
5383
|
onChange(parsedDate);
|
|
5343
5384
|
setVisible(false);
|
|
@@ -5426,14 +5467,14 @@ var DateInput = (_a) => {
|
|
|
5426
5467
|
] });
|
|
5427
5468
|
};
|
|
5428
5469
|
DateInput.displayName = "DateInput";
|
|
5429
|
-
function formatDisplayValue(from) {
|
|
5470
|
+
function formatDisplayValue(from, dateInDashes) {
|
|
5430
5471
|
if (!from) {
|
|
5431
5472
|
return "";
|
|
5432
5473
|
}
|
|
5433
5474
|
if (!isValidDate(from)) {
|
|
5434
5475
|
return "";
|
|
5435
5476
|
}
|
|
5436
|
-
return
|
|
5477
|
+
return formatDateWithDashes(from, dateInDashes);
|
|
5437
5478
|
}
|
|
5438
5479
|
|
|
5439
5480
|
// src/components/Accordion.tsx
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MobileDataGrid
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-RESDUVMA.js";
|
|
4
4
|
import "../../chunk-WJJB7IJZ.js";
|
|
5
5
|
import "../../chunk-Q4YDNW7N.js";
|
|
6
6
|
import "../../chunk-M7INAUAJ.js";
|
|
7
|
-
import "../../chunk-
|
|
7
|
+
import "../../chunk-Y75MQKNY.js";
|
|
8
|
+
import "../../chunk-MBZ55T2D.js";
|
|
8
9
|
import "../../chunk-2IKT6IHB.js";
|
|
9
10
|
import "../../chunk-YCDDBSVU.js";
|
|
10
11
|
import "../../chunk-3X3Y4TMS.js";
|
|
11
12
|
import "../../chunk-BQNPOGD5.js";
|
|
12
13
|
import "../../chunk-Y5GD2FJA.js";
|
|
13
|
-
import "../../chunk-MBZ55T2D.js";
|
|
14
14
|
import "../../chunk-SZ47M32R.js";
|
|
15
15
|
import "../../chunk-B4AE3DCA.js";
|
|
16
16
|
import "../../chunk-FP3Y5JJN.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ProductImagePreview
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-Y75MQKNY.js";
|
|
4
|
+
import "../../chunk-MBZ55T2D.js";
|
|
4
5
|
import "../../chunk-2IKT6IHB.js";
|
|
5
6
|
import "../../chunk-YCDDBSVU.js";
|
|
6
7
|
import "../../chunk-3X3Y4TMS.js";
|
|
7
8
|
import "../../chunk-BQNPOGD5.js";
|
|
8
|
-
import "../../chunk-MBZ55T2D.js";
|
|
9
9
|
import "../../chunk-AT4AWD6B.js";
|
|
10
10
|
import "../../chunk-QVWYTQKL.js";
|
|
11
11
|
import "../../chunk-BWPNXY7T.js";
|
|
@@ -510,30 +510,10 @@ function formatCurrencyDisplay(value) {
|
|
|
510
510
|
}
|
|
511
511
|
|
|
512
512
|
// src/utils/date.ts
|
|
513
|
-
function parseInputDate(input) {
|
|
514
|
-
const match = input.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);
|
|
515
|
-
if (!match) {
|
|
516
|
-
return null;
|
|
517
|
-
}
|
|
518
|
-
const [, month, day, year] = match;
|
|
519
|
-
const paddedMonth = month.padStart(2, "0");
|
|
520
|
-
const paddedDay = day.padStart(2, "0");
|
|
521
|
-
return `${year}-${paddedMonth}-${paddedDay}`;
|
|
522
|
-
}
|
|
523
513
|
function isValidDate(dateString) {
|
|
524
514
|
const date = new Date(dateString);
|
|
525
515
|
return date instanceof Date && !isNaN(date.getTime()) && dateString === date.toISOString().split("T")[0];
|
|
526
516
|
}
|
|
527
|
-
function formatInputValue(value) {
|
|
528
|
-
const digits = value.replace(/\D/g, "");
|
|
529
|
-
if (digits.length < 2) {
|
|
530
|
-
return digits;
|
|
531
|
-
}
|
|
532
|
-
if (digits.length >= 4) {
|
|
533
|
-
return `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, 8)}`;
|
|
534
|
-
}
|
|
535
|
-
return `${digits.slice(0, 2)}/${digits.slice(2)}`;
|
|
536
|
-
}
|
|
537
517
|
function isDigit(character) {
|
|
538
518
|
return /\d/.test(character);
|
|
539
519
|
}
|
|
@@ -3527,6 +3507,10 @@ function DataGrid({
|
|
|
3527
3507
|
(0, import_core.useSensor)(import_core.KeyboardSensor)
|
|
3528
3508
|
);
|
|
3529
3509
|
const visibleColumns = table.getVisibleLeafColumns();
|
|
3510
|
+
const nonPinnedColumnIds = table.getCenterLeafColumns().map((col) => col.id);
|
|
3511
|
+
const sortableColumnOrder = columnOrder.filter(
|
|
3512
|
+
(id2) => nonPinnedColumnIds.includes(id2)
|
|
3513
|
+
);
|
|
3530
3514
|
const columnVirtualizer = (0, import_react_virtual2.useVirtualizer)({
|
|
3531
3515
|
count: visibleColumns.length,
|
|
3532
3516
|
estimateSize: (index) => visibleColumns[index].getSize(),
|
|
@@ -3555,7 +3539,7 @@ function DataGrid({
|
|
|
3555
3539
|
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3556
3540
|
import_sortable2.SortableContext,
|
|
3557
3541
|
{
|
|
3558
|
-
items:
|
|
3542
|
+
items: sortableColumnOrder,
|
|
3559
3543
|
strategy: import_sortable2.horizontalListSortingStrategy,
|
|
3560
3544
|
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
3561
3545
|
"div",
|
|
@@ -4914,6 +4898,60 @@ function CalendarPane({
|
|
|
4914
4898
|
] }, month.name + month.year);
|
|
4915
4899
|
}
|
|
4916
4900
|
|
|
4901
|
+
// src/utils/date-patch-dashes.ts
|
|
4902
|
+
function formatInputValueWithDashes(value, dateInDashes) {
|
|
4903
|
+
const digits = value.replace(/\D/g, "");
|
|
4904
|
+
if (dateInDashes) {
|
|
4905
|
+
if (digits.length <= 4) return digits;
|
|
4906
|
+
if (digits.length <= 6) return `${digits.slice(0, 4)}-${digits.slice(4)}`;
|
|
4907
|
+
return `${digits.slice(4, 6)}-${digits.slice(6, 8)}-${digits.slice(0, 4)}`;
|
|
4908
|
+
} else {
|
|
4909
|
+
if (digits.length <= 2) return digits;
|
|
4910
|
+
if (digits.length <= 4) return `${digits.slice(0, 2)}/${digits.slice(2)}`;
|
|
4911
|
+
return `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, 8)}`;
|
|
4912
|
+
}
|
|
4913
|
+
}
|
|
4914
|
+
function formatDateWithDashes(value, dateInDashes) {
|
|
4915
|
+
if (!value) return "";
|
|
4916
|
+
let year = "", month = "", day = "";
|
|
4917
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
4918
|
+
[year, month, day] = value.split("-");
|
|
4919
|
+
} else if (/^\d{2}-\d{2}-\d{4}$/.test(value)) {
|
|
4920
|
+
[month, day, year] = value.split("-");
|
|
4921
|
+
} else if (/^\d{2}\/\d{2}\/\d{4}$/.test(value)) {
|
|
4922
|
+
[month, day, year] = value.split("/");
|
|
4923
|
+
} else {
|
|
4924
|
+
return value;
|
|
4925
|
+
}
|
|
4926
|
+
if (!year || !month || !day) return value;
|
|
4927
|
+
if (dateInDashes) {
|
|
4928
|
+
return `${month}-${day}-${year}`;
|
|
4929
|
+
}
|
|
4930
|
+
return `${month}/${day}/${year}`;
|
|
4931
|
+
}
|
|
4932
|
+
function parseInputDateWithDashes(value, dateInDashes) {
|
|
4933
|
+
if (!value) return "";
|
|
4934
|
+
let year = "", month = "", day = "";
|
|
4935
|
+
if (dateInDashes) {
|
|
4936
|
+
let match = value.match(/^(\d{2})-(\d{2})-(\d{4})$/);
|
|
4937
|
+
if (match) {
|
|
4938
|
+
[, month, day, year] = match;
|
|
4939
|
+
} else {
|
|
4940
|
+
match = value.match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
|
4941
|
+
if (match) {
|
|
4942
|
+
[, year, month, day] = match;
|
|
4943
|
+
}
|
|
4944
|
+
}
|
|
4945
|
+
} else {
|
|
4946
|
+
const match = value.match(/^(\d{2})\/(\d{2})\/(\d{4})$/);
|
|
4947
|
+
if (match) {
|
|
4948
|
+
[, month, day, year] = match;
|
|
4949
|
+
}
|
|
4950
|
+
}
|
|
4951
|
+
if (!year || !month || !day) return "";
|
|
4952
|
+
return `${month}-${day}-${year}`;
|
|
4953
|
+
}
|
|
4954
|
+
|
|
4917
4955
|
// src/components/DateInput.tsx
|
|
4918
4956
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4919
4957
|
var DateInput = (_a) => {
|
|
@@ -4927,7 +4965,8 @@ var DateInput = (_a) => {
|
|
|
4927
4965
|
readOnly = false,
|
|
4928
4966
|
label,
|
|
4929
4967
|
isDateAvailable,
|
|
4930
|
-
disableManualInput
|
|
4968
|
+
disableManualInput,
|
|
4969
|
+
dateInDashes = false
|
|
4931
4970
|
} = _b, props = __objRest(_b, [
|
|
4932
4971
|
"id",
|
|
4933
4972
|
"testid",
|
|
@@ -4938,7 +4977,8 @@ var DateInput = (_a) => {
|
|
|
4938
4977
|
"readOnly",
|
|
4939
4978
|
"label",
|
|
4940
4979
|
"isDateAvailable",
|
|
4941
|
-
"disableManualInput"
|
|
4980
|
+
"disableManualInput",
|
|
4981
|
+
"dateInDashes"
|
|
4942
4982
|
]);
|
|
4943
4983
|
const [visible, setVisible] = (0, import_react21.useState)(false);
|
|
4944
4984
|
const [inputValue, setInputValue] = (0, import_react21.useState)("");
|
|
@@ -4954,9 +4994,9 @@ var DateInput = (_a) => {
|
|
|
4954
4994
|
const [from, to] = [value, ""];
|
|
4955
4995
|
(0, import_react21.useEffect)(() => {
|
|
4956
4996
|
if (!isTyping) {
|
|
4957
|
-
setInputValue(formatDisplayValue(from));
|
|
4997
|
+
setInputValue(formatDisplayValue(from, dateInDashes));
|
|
4958
4998
|
}
|
|
4959
|
-
}, [from, isTyping]);
|
|
4999
|
+
}, [from, isTyping, dateInDashes]);
|
|
4960
5000
|
(0, import_react21.useLayoutEffect)(() => {
|
|
4961
5001
|
if (visible) {
|
|
4962
5002
|
updatePosition();
|
|
@@ -5019,7 +5059,7 @@ var DateInput = (_a) => {
|
|
|
5019
5059
|
const rawValue = event.target.value;
|
|
5020
5060
|
const cursorPosition = event.target.selectionStart || 0;
|
|
5021
5061
|
setIsTyping(true);
|
|
5022
|
-
const formattedValue =
|
|
5062
|
+
const formattedValue = formatInputValueWithDashes(rawValue, dateInDashes);
|
|
5023
5063
|
setInputValue(formattedValue);
|
|
5024
5064
|
requestAnimationFrame(() => {
|
|
5025
5065
|
if (triggerRef.current) {
|
|
@@ -5031,16 +5071,16 @@ var DateInput = (_a) => {
|
|
|
5031
5071
|
triggerRef.current.setSelectionRange(newPosition, newPosition);
|
|
5032
5072
|
}
|
|
5033
5073
|
});
|
|
5034
|
-
const parsedDate =
|
|
5074
|
+
const parsedDate = parseInputDateWithDashes(formattedValue, dateInDashes);
|
|
5035
5075
|
if (parsedDate && isValidDate(parsedDate)) {
|
|
5036
5076
|
onChange(parsedDate);
|
|
5037
5077
|
}
|
|
5038
5078
|
};
|
|
5039
5079
|
const handleBlur = () => {
|
|
5040
5080
|
setIsTyping(false);
|
|
5041
|
-
const parsedDate =
|
|
5081
|
+
const parsedDate = parseInputDateWithDashes(inputValue, dateInDashes);
|
|
5042
5082
|
if (!parsedDate || !isValidDate(parsedDate)) {
|
|
5043
|
-
setInputValue(formatDisplayValue(from));
|
|
5083
|
+
setInputValue(formatDisplayValue(from, dateInDashes));
|
|
5044
5084
|
}
|
|
5045
5085
|
};
|
|
5046
5086
|
const handleKeyDown = (event) => {
|
|
@@ -5048,10 +5088,11 @@ var DateInput = (_a) => {
|
|
|
5048
5088
|
const input = event.target;
|
|
5049
5089
|
const cursorPosition = input.selectionStart || 0;
|
|
5050
5090
|
const value2 = input.value;
|
|
5051
|
-
|
|
5091
|
+
const sep = dateInDashes ? "-" : "/";
|
|
5092
|
+
if (cursorPosition > 0 && value2[cursorPosition - 1] === sep) {
|
|
5052
5093
|
event.preventDefault();
|
|
5053
5094
|
const newValue = value2.slice(0, cursorPosition - 2) + value2.slice(cursorPosition);
|
|
5054
|
-
const formattedValue =
|
|
5095
|
+
const formattedValue = formatInputValueWithDashes(newValue, dateInDashes);
|
|
5055
5096
|
setInputValue(formattedValue);
|
|
5056
5097
|
requestAnimationFrame(() => {
|
|
5057
5098
|
if (triggerRef.current) {
|
|
@@ -5064,7 +5105,7 @@ var DateInput = (_a) => {
|
|
|
5064
5105
|
}
|
|
5065
5106
|
}
|
|
5066
5107
|
if (event.key === "Enter") {
|
|
5067
|
-
const parsedDate =
|
|
5108
|
+
const parsedDate = parseInputDateWithDashes(inputValue, dateInDashes);
|
|
5068
5109
|
if (parsedDate && isValidDate(parsedDate)) {
|
|
5069
5110
|
onChange(parsedDate);
|
|
5070
5111
|
setVisible(false);
|
|
@@ -5153,14 +5194,14 @@ var DateInput = (_a) => {
|
|
|
5153
5194
|
] });
|
|
5154
5195
|
};
|
|
5155
5196
|
DateInput.displayName = "DateInput";
|
|
5156
|
-
function formatDisplayValue(from) {
|
|
5197
|
+
function formatDisplayValue(from, dateInDashes) {
|
|
5157
5198
|
if (!from) {
|
|
5158
5199
|
return "";
|
|
5159
5200
|
}
|
|
5160
5201
|
if (!isValidDate(from)) {
|
|
5161
5202
|
return "";
|
|
5162
5203
|
}
|
|
5163
|
-
return
|
|
5204
|
+
return formatDateWithDashes(from, dateInDashes);
|
|
5164
5205
|
}
|
|
5165
5206
|
|
|
5166
5207
|
// src/components/Accordion.tsx
|
package/dist/components/index.js
CHANGED
|
@@ -2,13 +2,14 @@ import {
|
|
|
2
2
|
DataGrid,
|
|
3
3
|
DateInput,
|
|
4
4
|
MobileDataGrid
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-RESDUVMA.js";
|
|
6
6
|
import "../chunk-WJJB7IJZ.js";
|
|
7
7
|
import "../chunk-Q4YDNW7N.js";
|
|
8
8
|
import "../chunk-M7INAUAJ.js";
|
|
9
9
|
import {
|
|
10
10
|
ProductImagePreview
|
|
11
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-Y75MQKNY.js";
|
|
12
|
+
import "../chunk-MBZ55T2D.js";
|
|
12
13
|
import "../chunk-2IKT6IHB.js";
|
|
13
14
|
import "../chunk-YCDDBSVU.js";
|
|
14
15
|
import "../chunk-3X3Y4TMS.js";
|
|
@@ -16,7 +17,6 @@ import "../chunk-BQNPOGD5.js";
|
|
|
16
17
|
import {
|
|
17
18
|
SearchResultImage
|
|
18
19
|
} from "../chunk-Y5GD2FJA.js";
|
|
19
|
-
import "../chunk-MBZ55T2D.js";
|
|
20
20
|
import {
|
|
21
21
|
EmblaCarousel
|
|
22
22
|
} from "../chunk-SZ47M32R.js";
|
package/package.json
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CarouselPagination
|
|
3
|
+
} from "./chunk-MBZ55T2D.js";
|
|
1
4
|
import {
|
|
2
5
|
MobileImageCarousel
|
|
3
6
|
} from "./chunk-2IKT6IHB.js";
|
|
@@ -10,9 +13,6 @@ import {
|
|
|
10
13
|
import {
|
|
11
14
|
ZoomWindow
|
|
12
15
|
} from "./chunk-BQNPOGD5.js";
|
|
13
|
-
import {
|
|
14
|
-
CarouselPagination
|
|
15
|
-
} from "./chunk-MBZ55T2D.js";
|
|
16
16
|
import {
|
|
17
17
|
Grid
|
|
18
18
|
} from "./chunk-BWPNXY7T.js";
|