@dmsi/wedgekit-react 0.0.475 → 0.0.477
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-IG2YUDHI.js → chunk-24K4HHV5.js} +4 -4
- package/dist/{chunk-OEMLNGE2.js → chunk-4Q7T4GJ2.js} +2 -2
- package/dist/chunk-4UH72JT2.js +104 -0
- package/dist/{chunk-KJNK7KEV.js → chunk-QMSPTD6L.js} +1 -1
- package/dist/{chunk-GTPSPGSJ.js → chunk-WIDUWFLX.js} +761 -47
- package/dist/components/Accordion.js +2 -2
- package/dist/components/Alert.cjs +787 -0
- package/dist/components/Alert.js +13 -0
- package/dist/components/CalendarRange.cjs +465 -160
- package/dist/components/CalendarRange.css +3 -0
- package/dist/components/CalendarRange.js +19 -19
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.cjs +918 -148
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.css +3 -0
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.js +19 -18
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.cjs +928 -158
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.css +3 -0
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.js +19 -18
- package/dist/components/DataGrid/PinnedColumns.cjs +943 -173
- package/dist/components/DataGrid/PinnedColumns.css +3 -0
- package/dist/components/DataGrid/PinnedColumns.js +19 -18
- package/dist/components/DataGrid/TableBody/LoadingCell.cjs +919 -149
- package/dist/components/DataGrid/TableBody/LoadingCell.css +3 -0
- package/dist/components/DataGrid/TableBody/LoadingCell.js +19 -18
- package/dist/components/DataGrid/TableBody/TableBodyRow.cjs +925 -155
- package/dist/components/DataGrid/TableBody/TableBodyRow.css +3 -0
- package/dist/components/DataGrid/TableBody/TableBodyRow.js +19 -18
- package/dist/components/DataGrid/TableBody/index.cjs +940 -170
- package/dist/components/DataGrid/TableBody/index.css +3 -0
- package/dist/components/DataGrid/TableBody/index.js +19 -18
- package/dist/components/DataGrid/index.cjs +1029 -259
- package/dist/components/DataGrid/index.css +3 -0
- package/dist/components/DataGrid/index.js +19 -18
- package/dist/components/DataGrid/utils.cjs +919 -149
- package/dist/components/DataGrid/utils.css +3 -0
- package/dist/components/DataGrid/utils.js +19 -18
- package/dist/components/DataGridCell.js +2 -2
- package/dist/components/DateInput.cjs +70 -65
- package/dist/components/DateInput.css +3 -0
- package/dist/components/DateInput.js +25 -271
- package/dist/components/DateRangeInput.cjs +419 -184
- package/dist/components/DateRangeInput.css +3 -0
- package/dist/components/DateRangeInput.js +19 -19
- package/dist/components/FilterGroup.js +6 -6
- package/dist/components/MobileDataGrid/ColumnList.js +3 -3
- package/dist/components/MobileDataGrid/ColumnSelector/index.cjs +925 -155
- package/dist/components/MobileDataGrid/ColumnSelector/index.css +3 -0
- package/dist/components/MobileDataGrid/ColumnSelector/index.js +19 -18
- package/dist/components/MobileDataGrid/MobileDataGridCard/index.js +2 -2
- package/dist/components/MobileDataGrid/MobileDataGridHeader.cjs +923 -153
- package/dist/components/MobileDataGrid/MobileDataGridHeader.css +3 -0
- package/dist/components/MobileDataGrid/MobileDataGridHeader.js +19 -18
- package/dist/components/MobileDataGrid/RowDetailModalProvider/ModalContent.js +2 -2
- package/dist/components/MobileDataGrid/RowDetailModalProvider/index.js +6 -6
- package/dist/components/MobileDataGrid/index.cjs +973 -203
- package/dist/components/MobileDataGrid/index.css +3 -0
- package/dist/components/MobileDataGrid/index.js +19 -18
- package/dist/components/Modal.js +3 -3
- package/dist/components/Notification.js +3 -3
- package/dist/components/PDFViewer/PDFNavigation.js +2 -2
- package/dist/components/PDFViewer/index.js +6 -6
- package/dist/components/SideMenuItem.js +3 -3
- package/dist/components/Swatch.js +3 -3
- package/dist/components/Upload.js +3 -3
- package/dist/components/index.cjs +1212 -363
- package/dist/components/index.css +3 -0
- package/dist/components/index.js +34 -28
- package/dist/index.css +3 -0
- package/package.json +1 -1
- package/src/components/Alert.tsx +81 -0
- package/src/components/index.ts +2 -0
- package/dist/chunk-X35NLL3N.js +0 -493
- package/dist/{chunk-IT4VFU6T.js → chunk-3DEYCNUE.js} +3 -3
- package/dist/{chunk-GTBGPBH6.js → chunk-B53XDCLO.js} +3 -3
- package/dist/{chunk-ZQSD74IJ.js → chunk-IY7SXEVY.js} +3 -3
- package/dist/{chunk-BFFNSUNS.js → chunk-QBSEKZWX.js} +3 -3
- package/dist/{chunk-NIWXVOBW.js → chunk-X67L3NZI.js} +3 -3
- package/dist/{chunk-TVXBP5CW.js → chunk-XIXQUEYC.js} +3 -3
|
@@ -62,7 +62,7 @@ __export(utils_exports, {
|
|
|
62
62
|
getSortIcon: () => getSortIcon
|
|
63
63
|
});
|
|
64
64
|
module.exports = __toCommonJS(utils_exports);
|
|
65
|
-
var
|
|
65
|
+
var import_clsx39 = __toESM(require("clsx"), 1);
|
|
66
66
|
|
|
67
67
|
// src/components/DataGridCell.tsx
|
|
68
68
|
var import_sortable = require("@dnd-kit/sortable");
|
|
@@ -473,6 +473,76 @@ function formatCurrencyDisplay(value) {
|
|
|
473
473
|
}
|
|
474
474
|
|
|
475
475
|
// src/utils/date.ts
|
|
476
|
+
function parseInputDate(input) {
|
|
477
|
+
const match = input.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);
|
|
478
|
+
if (!match) {
|
|
479
|
+
return null;
|
|
480
|
+
}
|
|
481
|
+
const [, month, day, year] = match;
|
|
482
|
+
const paddedMonth = month.padStart(2, "0");
|
|
483
|
+
const paddedDay = day.padStart(2, "0");
|
|
484
|
+
return `${year}-${paddedMonth}-${paddedDay}`;
|
|
485
|
+
}
|
|
486
|
+
function isValidDate(dateString) {
|
|
487
|
+
const date = new Date(dateString);
|
|
488
|
+
return date instanceof Date && !isNaN(date.getTime()) && dateString === date.toISOString().split("T")[0];
|
|
489
|
+
}
|
|
490
|
+
function formatInputValue(value) {
|
|
491
|
+
const digits = value.replace(/\D/g, "");
|
|
492
|
+
if (digits.length < 2) {
|
|
493
|
+
return digits;
|
|
494
|
+
}
|
|
495
|
+
if (digits.length >= 4) {
|
|
496
|
+
return `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, 8)}`;
|
|
497
|
+
}
|
|
498
|
+
return `${digits.slice(0, 2)}/${digits.slice(2)}`;
|
|
499
|
+
}
|
|
500
|
+
function isDigit(character) {
|
|
501
|
+
return /\d/.test(character);
|
|
502
|
+
}
|
|
503
|
+
function isSlash(character) {
|
|
504
|
+
return character === "/";
|
|
505
|
+
}
|
|
506
|
+
function countDigitsUpToCursor(value, cursorPosition) {
|
|
507
|
+
let digitCount = 0;
|
|
508
|
+
for (let i = 0; i < cursorPosition && i < value.length; i++) {
|
|
509
|
+
if (!isDigit(value[i])) {
|
|
510
|
+
continue;
|
|
511
|
+
}
|
|
512
|
+
digitCount++;
|
|
513
|
+
}
|
|
514
|
+
return digitCount;
|
|
515
|
+
}
|
|
516
|
+
function findPositionAfterDigitCount(formattedValue, targetDigitCount) {
|
|
517
|
+
let currentDigitCount = 0;
|
|
518
|
+
for (let i = 0; i < formattedValue.length; i++) {
|
|
519
|
+
if (!isDigit(formattedValue[i])) {
|
|
520
|
+
continue;
|
|
521
|
+
}
|
|
522
|
+
currentDigitCount++;
|
|
523
|
+
if (currentDigitCount !== targetDigitCount) {
|
|
524
|
+
continue;
|
|
525
|
+
}
|
|
526
|
+
const positionAfterDigit = i + 1;
|
|
527
|
+
const nextCharacter = formattedValue[positionAfterDigit];
|
|
528
|
+
if (nextCharacter && isSlash(nextCharacter)) {
|
|
529
|
+
return positionAfterDigit + 1;
|
|
530
|
+
}
|
|
531
|
+
return positionAfterDigit;
|
|
532
|
+
}
|
|
533
|
+
return formattedValue.length;
|
|
534
|
+
}
|
|
535
|
+
function calculateCursorPosition(originalValue, formattedValue, originalPosition) {
|
|
536
|
+
const targetDigitCount = countDigitsUpToCursor(
|
|
537
|
+
originalValue,
|
|
538
|
+
originalPosition
|
|
539
|
+
);
|
|
540
|
+
const newPosition = findPositionAfterDigitCount(
|
|
541
|
+
formattedValue,
|
|
542
|
+
targetDigitCount
|
|
543
|
+
);
|
|
544
|
+
return Math.min(newPosition, formattedValue.length);
|
|
545
|
+
}
|
|
476
546
|
function parseDateParts(dateString) {
|
|
477
547
|
const [yearStr, monthStr, dayStr] = dateString.split("-");
|
|
478
548
|
if (!yearStr || !monthStr || !dayStr) {
|
|
@@ -4040,23 +4110,718 @@ var Tooltip = ({
|
|
|
4040
4110
|
};
|
|
4041
4111
|
Tooltip.displayName = "Tooltip";
|
|
4042
4112
|
|
|
4043
|
-
// src/components/
|
|
4044
|
-
var
|
|
4113
|
+
// src/components/DateInput.tsx
|
|
4114
|
+
var import_react20 = require("react");
|
|
4115
|
+
var import_react_dom3 = require("react-dom");
|
|
4045
4116
|
|
|
4046
|
-
// src/components/
|
|
4117
|
+
// src/components/CalendarRange.tsx
|
|
4047
4118
|
var import_clsx18 = __toESM(require("clsx"), 1);
|
|
4119
|
+
var import_react19 = __toESM(require("react"), 1);
|
|
4120
|
+
var import_polyfill = require("@js-temporal/polyfill");
|
|
4048
4121
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
4122
|
+
function DateCell(_a) {
|
|
4123
|
+
var _b = _a, {
|
|
4124
|
+
date,
|
|
4125
|
+
isInMonth,
|
|
4126
|
+
isToday,
|
|
4127
|
+
isSelected,
|
|
4128
|
+
inRange,
|
|
4129
|
+
isDisabled,
|
|
4130
|
+
isRangeStart,
|
|
4131
|
+
isRangeEnd,
|
|
4132
|
+
onClick,
|
|
4133
|
+
onMouseEnter,
|
|
4134
|
+
onMouseLeave,
|
|
4135
|
+
cellPadding = "",
|
|
4136
|
+
isRangeDisabled = false,
|
|
4137
|
+
id,
|
|
4138
|
+
testid
|
|
4139
|
+
} = _b, props = __objRest(_b, [
|
|
4140
|
+
"date",
|
|
4141
|
+
"isInMonth",
|
|
4142
|
+
"isToday",
|
|
4143
|
+
"isSelected",
|
|
4144
|
+
"inRange",
|
|
4145
|
+
"isDisabled",
|
|
4146
|
+
"isRangeStart",
|
|
4147
|
+
"isRangeEnd",
|
|
4148
|
+
"onClick",
|
|
4149
|
+
"onMouseEnter",
|
|
4150
|
+
"onMouseLeave",
|
|
4151
|
+
"cellPadding",
|
|
4152
|
+
"isRangeDisabled",
|
|
4153
|
+
"id",
|
|
4154
|
+
"testid"
|
|
4155
|
+
]);
|
|
4156
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4157
|
+
"span",
|
|
4158
|
+
__spreadProps(__spreadValues({}, props), {
|
|
4159
|
+
id,
|
|
4160
|
+
"data-testid": testid,
|
|
4161
|
+
className: (0, import_clsx18.default)(
|
|
4162
|
+
"flex items-center justify-center aspect-square select-none transition-colors border duration-100 font-medium",
|
|
4163
|
+
typography.caption,
|
|
4164
|
+
cellPadding,
|
|
4165
|
+
!isToday && !isSelected && !inRange && !isDisabled && !isRangeStart && !isRangeEnd && "border-transparent",
|
|
4166
|
+
!isInMonth && "border-transparent",
|
|
4167
|
+
// Today: subtle border ring
|
|
4168
|
+
isToday && !isSelected && !inRange && "rounded-full border-border-primary-normal ",
|
|
4169
|
+
// Selected: Figma blue, white text, strong shadow
|
|
4170
|
+
isSelected && "bg-action-400 text-white border-action-400 z-10",
|
|
4171
|
+
!isSelected && !inRange && "rounded-base",
|
|
4172
|
+
// When range is disabled OR when only 'from' is selected (no range yet), apply rounded corners
|
|
4173
|
+
(isRangeDisabled || !inRange && isSelected) && "rounded-base",
|
|
4174
|
+
inRange && isSelected && "hover:border-action-500",
|
|
4175
|
+
// In range: Figma light blue background
|
|
4176
|
+
inRange && !isSelected && "bg-action-100 text-text-primary-normal border-y-action-400 border-x-0 ",
|
|
4177
|
+
// Disabled: Figma gray, no pointer, no hover
|
|
4178
|
+
isDisabled && !inRange ? "text-text-primary-disabled bg-transparent pointer-events-none opacity-40 border-transparent" : [
|
|
4179
|
+
"text-text-primary-normal cursor-pointer",
|
|
4180
|
+
// Figma hover: blue bg, blue text (or red text if selected)
|
|
4181
|
+
isSelected ? "hover:bg-background-action-primary-hover hover:text-white" : "hover:bg-action-100 hover:text-text-action-primary-hover",
|
|
4182
|
+
// Figma active: darker blue bg, white text
|
|
4183
|
+
"active:bg-action-300 active:text-white",
|
|
4184
|
+
// Figma focus: ring
|
|
4185
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-action-400"
|
|
4186
|
+
],
|
|
4187
|
+
isRangeStart && "rounded-l",
|
|
4188
|
+
isRangeEnd && "rounded-r"
|
|
4189
|
+
),
|
|
4190
|
+
tabIndex: isDisabled ? -1 : 0,
|
|
4191
|
+
"aria-disabled": isDisabled,
|
|
4192
|
+
onClick: () => !isDisabled && isInMonth && onClick(),
|
|
4193
|
+
onMouseEnter: () => isInMonth && onMouseEnter(),
|
|
4194
|
+
onMouseLeave: () => isInMonth && onMouseLeave(),
|
|
4195
|
+
children: isInMonth ? date.day : ""
|
|
4196
|
+
})
|
|
4197
|
+
);
|
|
4198
|
+
}
|
|
4199
|
+
function CalendarRange({
|
|
4200
|
+
from,
|
|
4201
|
+
to,
|
|
4202
|
+
onChange,
|
|
4203
|
+
isDateAvailable,
|
|
4204
|
+
mode = "double",
|
|
4205
|
+
cardStyle = false,
|
|
4206
|
+
disableRange = false,
|
|
4207
|
+
id,
|
|
4208
|
+
testid
|
|
4209
|
+
}) {
|
|
4210
|
+
const weekDays = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
|
|
4211
|
+
const parseDate = (d) => {
|
|
4212
|
+
if (!d) {
|
|
4213
|
+
return void 0;
|
|
4214
|
+
}
|
|
4215
|
+
try {
|
|
4216
|
+
if (typeof d === "number") {
|
|
4217
|
+
return import_polyfill.Temporal.PlainDate.from(new Date(d).toISOString().slice(0, 10));
|
|
4218
|
+
}
|
|
4219
|
+
if (typeof d === "string") {
|
|
4220
|
+
return import_polyfill.Temporal.PlainDate.from(d);
|
|
4221
|
+
}
|
|
4222
|
+
return void 0;
|
|
4223
|
+
} catch (error) {
|
|
4224
|
+
console.error("Invalid date format:", d, error);
|
|
4225
|
+
return import_polyfill.Temporal.Now.plainDateISO();
|
|
4226
|
+
}
|
|
4227
|
+
};
|
|
4228
|
+
const fromDate = parseDate(from);
|
|
4229
|
+
const toDate = parseDate(to);
|
|
4230
|
+
const today = import_polyfill.Temporal.Now.plainDateISO();
|
|
4231
|
+
const [baseMonth, setBaseMonth] = (0, import_react19.useState)(
|
|
4232
|
+
fromDate != null ? fromDate : today.with({ day: 1 })
|
|
4233
|
+
);
|
|
4234
|
+
const [selecting, setSelecting] = (0, import_react19.useState)("from");
|
|
4235
|
+
const [pendingFrom, setPendingFrom] = (0, import_react19.useState)(void 0);
|
|
4236
|
+
const [hoveredDate, setHoveredDate] = (0, import_react19.useState)(void 0);
|
|
4237
|
+
(0, import_react19.useEffect)(() => {
|
|
4238
|
+
if (fromDate) {
|
|
4239
|
+
setBaseMonth(fromDate.with({ day: 1 }));
|
|
4240
|
+
} else if (toDate) {
|
|
4241
|
+
setBaseMonth(toDate.with({ day: 1 }));
|
|
4242
|
+
}
|
|
4243
|
+
}, [from, to]);
|
|
4244
|
+
(0, import_react19.useEffect)(() => {
|
|
4245
|
+
if (fromDate && toDate) {
|
|
4246
|
+
setSelecting("from");
|
|
4247
|
+
setPendingFrom(void 0);
|
|
4248
|
+
setHoveredDate(void 0);
|
|
4249
|
+
}
|
|
4250
|
+
}, [from, to]);
|
|
4251
|
+
function getMonthData(monthOffset) {
|
|
4252
|
+
const monthDate = baseMonth.add({ months: monthOffset }).with({ day: 1 });
|
|
4253
|
+
const days = monthDate.daysInMonth;
|
|
4254
|
+
const firstDayOffset = monthDate.dayOfWeek % 7;
|
|
4255
|
+
return {
|
|
4256
|
+
name: monthDate.toLocaleString("en-US", { month: "long" }),
|
|
4257
|
+
year: monthDate.year,
|
|
4258
|
+
days,
|
|
4259
|
+
firstDayOffset,
|
|
4260
|
+
date: monthDate
|
|
4261
|
+
};
|
|
4262
|
+
}
|
|
4263
|
+
function getMonthDataWith(monthOffset) {
|
|
4264
|
+
const monthDate = baseMonth.with({ month: monthOffset }).with({ day: 1 });
|
|
4265
|
+
const days = monthDate.daysInMonth;
|
|
4266
|
+
const firstDayOffset = monthDate.dayOfWeek % 7;
|
|
4267
|
+
return {
|
|
4268
|
+
name: monthDate.toLocaleString("en-US", { month: "long" }),
|
|
4269
|
+
year: monthDate.year,
|
|
4270
|
+
days,
|
|
4271
|
+
firstDayOffset,
|
|
4272
|
+
date: monthDate
|
|
4273
|
+
};
|
|
4274
|
+
}
|
|
4275
|
+
function handleDayClick(date) {
|
|
4276
|
+
if (isDateAvailable && !isDateAvailable(date)) return;
|
|
4277
|
+
if (mode === "single" && disableRange) {
|
|
4278
|
+
if (onChange) {
|
|
4279
|
+
onChange(date.toString(), date.toString());
|
|
4280
|
+
}
|
|
4281
|
+
return;
|
|
4282
|
+
}
|
|
4283
|
+
if (selecting === "from") {
|
|
4284
|
+
setPendingFrom(date);
|
|
4285
|
+
setSelecting("to");
|
|
4286
|
+
setHoveredDate(void 0);
|
|
4287
|
+
} else if (pendingFrom) {
|
|
4288
|
+
if (onChange) {
|
|
4289
|
+
const [start, end] = import_polyfill.Temporal.PlainDate.compare(date, pendingFrom) < 0 ? [date, pendingFrom] : [pendingFrom, date];
|
|
4290
|
+
onChange(start.toString(), end.toString());
|
|
4291
|
+
}
|
|
4292
|
+
setPendingFrom(void 0);
|
|
4293
|
+
setSelecting("from");
|
|
4294
|
+
setHoveredDate(void 0);
|
|
4295
|
+
}
|
|
4296
|
+
}
|
|
4297
|
+
function isInRange(date) {
|
|
4298
|
+
if (mode === "single" && disableRange) {
|
|
4299
|
+
return false;
|
|
4300
|
+
}
|
|
4301
|
+
if (pendingFrom && selecting === "to" && hoveredDate) {
|
|
4302
|
+
const [start, end] = import_polyfill.Temporal.PlainDate.compare(hoveredDate, pendingFrom) < 0 ? [hoveredDate, pendingFrom] : [pendingFrom, hoveredDate];
|
|
4303
|
+
return import_polyfill.Temporal.PlainDate.compare(date, start) >= 0 && import_polyfill.Temporal.PlainDate.compare(date, end) <= 0;
|
|
4304
|
+
}
|
|
4305
|
+
if (!pendingFrom && fromDate && toDate) {
|
|
4306
|
+
return import_polyfill.Temporal.PlainDate.compare(date, fromDate) >= 0 && import_polyfill.Temporal.PlainDate.compare(date, toDate) <= 0;
|
|
4307
|
+
}
|
|
4308
|
+
return false;
|
|
4309
|
+
}
|
|
4310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4311
|
+
"div",
|
|
4312
|
+
{
|
|
4313
|
+
id,
|
|
4314
|
+
"data-testid": testid,
|
|
4315
|
+
className: (0, import_clsx18.default)(
|
|
4316
|
+
"relative bg-background-grouped-primary-normal rounded-base w-fit",
|
|
4317
|
+
layoutPaddding,
|
|
4318
|
+
layoutGap,
|
|
4319
|
+
cardStyle && "shadow-4",
|
|
4320
|
+
// baseTransition,
|
|
4321
|
+
"overflow-hidden"
|
|
4322
|
+
),
|
|
4323
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4324
|
+
"div",
|
|
4325
|
+
{
|
|
4326
|
+
className: (0, import_clsx18.default)(
|
|
4327
|
+
"flex flex-row items-start justify-start bg-background-primary-normal overflow-clip",
|
|
4328
|
+
layoutGap
|
|
4329
|
+
),
|
|
4330
|
+
children: (mode === "double" ? [0, 1] : [0]).map((offset, idx) => {
|
|
4331
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4332
|
+
CalendarPane,
|
|
4333
|
+
{
|
|
4334
|
+
getMonthData,
|
|
4335
|
+
getMonthDataWith,
|
|
4336
|
+
offset,
|
|
4337
|
+
idx,
|
|
4338
|
+
id,
|
|
4339
|
+
testid,
|
|
4340
|
+
baseMonth,
|
|
4341
|
+
setBaseMonth,
|
|
4342
|
+
mode,
|
|
4343
|
+
pendingFrom,
|
|
4344
|
+
weekDays,
|
|
4345
|
+
fromDate,
|
|
4346
|
+
toDate,
|
|
4347
|
+
isDateAvailable,
|
|
4348
|
+
disableRange,
|
|
4349
|
+
hoveredDate,
|
|
4350
|
+
isInRange,
|
|
4351
|
+
today,
|
|
4352
|
+
setHoveredDate,
|
|
4353
|
+
handleDayClick
|
|
4354
|
+
},
|
|
4355
|
+
idx
|
|
4356
|
+
);
|
|
4357
|
+
})
|
|
4358
|
+
}
|
|
4359
|
+
)
|
|
4360
|
+
}
|
|
4361
|
+
);
|
|
4362
|
+
}
|
|
4363
|
+
function CalendarPane({
|
|
4364
|
+
getMonthData,
|
|
4365
|
+
getMonthDataWith,
|
|
4366
|
+
offset,
|
|
4367
|
+
idx,
|
|
4368
|
+
id,
|
|
4369
|
+
testid,
|
|
4370
|
+
baseMonth,
|
|
4371
|
+
setBaseMonth,
|
|
4372
|
+
mode,
|
|
4373
|
+
pendingFrom,
|
|
4374
|
+
weekDays,
|
|
4375
|
+
fromDate,
|
|
4376
|
+
toDate,
|
|
4377
|
+
isDateAvailable,
|
|
4378
|
+
disableRange,
|
|
4379
|
+
hoveredDate,
|
|
4380
|
+
isInRange,
|
|
4381
|
+
today,
|
|
4382
|
+
setHoveredDate,
|
|
4383
|
+
handleDayClick
|
|
4384
|
+
}) {
|
|
4385
|
+
const months = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
|
|
4386
|
+
const years = Array.from({ length: 100 }).map(
|
|
4387
|
+
(_, i) => baseMonth.year - 50 + i
|
|
4388
|
+
);
|
|
4389
|
+
const [monthMenuOpen, setMonthMenuOpen] = (0, import_react19.useState)(false);
|
|
4390
|
+
const [yearMenuOpen, setYearMenuOpen] = (0, import_react19.useState)(false);
|
|
4391
|
+
const monthMenuRef = (0, import_react19.useRef)(null);
|
|
4392
|
+
const yearMenuRef = (0, import_react19.useRef)(null);
|
|
4393
|
+
const month = getMonthData(offset);
|
|
4394
|
+
const totalCells = 42;
|
|
4395
|
+
const emptyCells = month.firstDayOffset;
|
|
4396
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react19.default.Fragment, { children: [
|
|
4397
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
4398
|
+
"div",
|
|
4399
|
+
{
|
|
4400
|
+
className: (0, import_clsx18.default)("flex flex-col"),
|
|
4401
|
+
children: [
|
|
4402
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
4403
|
+
"div",
|
|
4404
|
+
{
|
|
4405
|
+
className: (0, import_clsx18.default)(
|
|
4406
|
+
"flex flex-row items-center justify-between",
|
|
4407
|
+
typography.label,
|
|
4408
|
+
"text-text-action-primary-normal"
|
|
4409
|
+
),
|
|
4410
|
+
children: [
|
|
4411
|
+
idx === 0 ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4412
|
+
"button",
|
|
4413
|
+
{
|
|
4414
|
+
id: id ? `${id}-prev-month-button` : void 0,
|
|
4415
|
+
"data-testid": testid ? `${testid}-prev-month-button` : void 0,
|
|
4416
|
+
type: "button",
|
|
4417
|
+
className: (0, import_clsx18.default)(
|
|
4418
|
+
"flex items-center justify-center rounded-base hover:bg-action-100 active:bg-action-300 text-icon-action-primary-normal",
|
|
4419
|
+
componentPadding
|
|
4420
|
+
),
|
|
4421
|
+
"aria-label": "Previous month",
|
|
4422
|
+
onClick: () => setBaseMonth(baseMonth.subtract({ months: 1 })),
|
|
4423
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Icon, { name: "chevron_left", size: 24 })
|
|
4424
|
+
}
|
|
4425
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: (0, import_clsx18.default)(componentPadding, "mr-1") }),
|
|
4426
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex gap-desktop-compact-component-padding", children: [
|
|
4427
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4428
|
+
"button",
|
|
4429
|
+
{
|
|
4430
|
+
ref: (el) => {
|
|
4431
|
+
monthMenuRef.current = el;
|
|
4432
|
+
},
|
|
4433
|
+
type: "button",
|
|
4434
|
+
onClick: () => {
|
|
4435
|
+
setMonthMenuOpen(true);
|
|
4436
|
+
setYearMenuOpen(false);
|
|
4437
|
+
},
|
|
4438
|
+
className: "font-semibold text-text-action-primary-normal text-[14px] py-[2px] truncate",
|
|
4439
|
+
children: month.name
|
|
4440
|
+
}
|
|
4441
|
+
),
|
|
4442
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4443
|
+
Menu,
|
|
4444
|
+
{
|
|
4445
|
+
show: monthMenuOpen,
|
|
4446
|
+
positionTo: monthMenuRef,
|
|
4447
|
+
setShow: () => setMonthMenuOpen(false),
|
|
4448
|
+
children: months.map((x) => [x, getMonthDataWith(x + 1)]).map(([x, m]) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4449
|
+
MenuOption,
|
|
4450
|
+
{
|
|
4451
|
+
selected: baseMonth.month === x + 1,
|
|
4452
|
+
onClick: () => {
|
|
4453
|
+
setBaseMonth(baseMonth.with({ month: x + 1 }));
|
|
4454
|
+
setMonthMenuOpen(false);
|
|
4455
|
+
},
|
|
4456
|
+
children: m.name
|
|
4457
|
+
},
|
|
4458
|
+
m.name
|
|
4459
|
+
))
|
|
4460
|
+
}
|
|
4461
|
+
),
|
|
4462
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4463
|
+
"button",
|
|
4464
|
+
{
|
|
4465
|
+
ref: (el) => {
|
|
4466
|
+
yearMenuRef.current = el;
|
|
4467
|
+
},
|
|
4468
|
+
type: "button",
|
|
4469
|
+
onClick: () => {
|
|
4470
|
+
setYearMenuOpen(true);
|
|
4471
|
+
setMonthMenuOpen(false);
|
|
4472
|
+
},
|
|
4473
|
+
className: "font-semibold text-text-action-primary-normal text-[14px] py-[2px] truncate",
|
|
4474
|
+
children: month.year
|
|
4475
|
+
}
|
|
4476
|
+
),
|
|
4477
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4478
|
+
Menu,
|
|
4479
|
+
{
|
|
4480
|
+
show: yearMenuOpen,
|
|
4481
|
+
positionTo: yearMenuRef,
|
|
4482
|
+
setShow: () => setYearMenuOpen(false),
|
|
4483
|
+
children: years.map((y) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4484
|
+
MenuOption,
|
|
4485
|
+
{
|
|
4486
|
+
selected: baseMonth.year === y,
|
|
4487
|
+
onClick: () => {
|
|
4488
|
+
setBaseMonth(baseMonth.with({ year: y }));
|
|
4489
|
+
setYearMenuOpen(false);
|
|
4490
|
+
},
|
|
4491
|
+
children: y
|
|
4492
|
+
},
|
|
4493
|
+
y
|
|
4494
|
+
))
|
|
4495
|
+
}
|
|
4496
|
+
)
|
|
4497
|
+
] }),
|
|
4498
|
+
(mode === "double" ? idx === 1 : true) ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4499
|
+
"button",
|
|
4500
|
+
{
|
|
4501
|
+
id: id ? `${id}-next-month-button` : void 0,
|
|
4502
|
+
"data-testid": testid ? `${testid}-next-month-button` : void 0,
|
|
4503
|
+
type: "button",
|
|
4504
|
+
className: (0, import_clsx18.default)(
|
|
4505
|
+
"flex items-center justify-center rounded-base hover:bg-action-100 active:bg-action-300 text-icon-action-primary-normal",
|
|
4506
|
+
componentPadding
|
|
4507
|
+
),
|
|
4508
|
+
"aria-label": "Next month",
|
|
4509
|
+
onClick: () => setBaseMonth(baseMonth.add({ months: 1 })),
|
|
4510
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Icon, { name: "chevron_right", size: 24 })
|
|
4511
|
+
}
|
|
4512
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: (0, import_clsx18.default)(componentPadding, "ml-1") })
|
|
4513
|
+
]
|
|
4514
|
+
}
|
|
4515
|
+
),
|
|
4516
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: (0, import_clsx18.default)("grid grid-cols-7"), children: weekDays.map((d) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4517
|
+
"span",
|
|
4518
|
+
{
|
|
4519
|
+
className: (0, import_clsx18.default)(
|
|
4520
|
+
typography.caption,
|
|
4521
|
+
"text-text-secondary-normal text-center",
|
|
4522
|
+
"w-10"
|
|
4523
|
+
),
|
|
4524
|
+
children: d
|
|
4525
|
+
},
|
|
4526
|
+
d
|
|
4527
|
+
)) }),
|
|
4528
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: (0, import_clsx18.default)("grid grid-cols-7"), children: Array.from({ length: totalCells }).map((_, i) => {
|
|
4529
|
+
const day = i - emptyCells + 1;
|
|
4530
|
+
const date = month.date.with({ day: 1 }).add({
|
|
4531
|
+
days: i - emptyCells
|
|
4532
|
+
});
|
|
4533
|
+
const isInMonth = day > 0 && day <= month.days;
|
|
4534
|
+
const isToday = isInMonth && date.equals(today);
|
|
4535
|
+
const isSelected = isInMonth && (!pendingFrom && fromDate && date.equals(fromDate) || !pendingFrom && toDate && date.equals(toDate) || pendingFrom && date.equals(pendingFrom));
|
|
4536
|
+
const inRange = isInMonth && isInRange(date);
|
|
4537
|
+
const isDisabled = !isInMonth || (isDateAvailable ? !isDateAvailable(date) : false);
|
|
4538
|
+
const hoverDateIsBeforePendingFrom = hoveredDate && pendingFrom && import_polyfill.Temporal.PlainDate.compare(hoveredDate, pendingFrom) < 0;
|
|
4539
|
+
const hoverDateIsAfterPendingFrom = hoveredDate && pendingFrom && import_polyfill.Temporal.PlainDate.compare(hoveredDate, pendingFrom) >= 0;
|
|
4540
|
+
const isRangeStart = mode === "single" && disableRange ? false : !pendingFrom && isInMonth && fromDate && date.equals(fromDate) || hoverDateIsAfterPendingFrom && date.equals(pendingFrom);
|
|
4541
|
+
const isRangeEnd = mode === "single" && disableRange ? false : !pendingFrom && isInMonth && toDate && date.equals(toDate) || hoverDateIsBeforePendingFrom && date.equals(pendingFrom);
|
|
4542
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4543
|
+
DateCell,
|
|
4544
|
+
{
|
|
4545
|
+
id: id ? `${id}-date-${date.toString()}` : void 0,
|
|
4546
|
+
testid: testid ? `${testid}-date-${date.toString()}` : void 0,
|
|
4547
|
+
date,
|
|
4548
|
+
isInMonth: !!isInMonth,
|
|
4549
|
+
isToday: !!isToday,
|
|
4550
|
+
isSelected: !!isSelected,
|
|
4551
|
+
inRange: !!inRange,
|
|
4552
|
+
isDisabled: !!isDisabled,
|
|
4553
|
+
onClick: () => handleDayClick(date),
|
|
4554
|
+
onMouseEnter: () => setHoveredDate(date),
|
|
4555
|
+
onMouseLeave: () => setHoveredDate(void 0),
|
|
4556
|
+
isRangeStart: !!isRangeStart,
|
|
4557
|
+
isRangeEnd: !!isRangeEnd,
|
|
4558
|
+
isRangeDisabled: mode === "single" && disableRange,
|
|
4559
|
+
cellPadding: componentPadding
|
|
4560
|
+
},
|
|
4561
|
+
i
|
|
4562
|
+
);
|
|
4563
|
+
}) })
|
|
4564
|
+
]
|
|
4565
|
+
}
|
|
4566
|
+
),
|
|
4567
|
+
mode === "double" && idx === 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4568
|
+
"div",
|
|
4569
|
+
{
|
|
4570
|
+
className: (0, import_clsx18.default)(
|
|
4571
|
+
"self-stretch bg-border-primary-normal rounded-base",
|
|
4572
|
+
// 1px width, full height, matches Figma divider
|
|
4573
|
+
"w-px"
|
|
4574
|
+
)
|
|
4575
|
+
}
|
|
4576
|
+
)
|
|
4577
|
+
] }, month.name + month.year);
|
|
4578
|
+
}
|
|
4049
4579
|
|
|
4050
|
-
// src/components/
|
|
4051
|
-
var import_clsx19 = __toESM(require("clsx"), 1);
|
|
4580
|
+
// src/components/DateInput.tsx
|
|
4052
4581
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
4582
|
+
var DateInput = (_a) => {
|
|
4583
|
+
var _b = _a, {
|
|
4584
|
+
id,
|
|
4585
|
+
testid,
|
|
4586
|
+
value,
|
|
4587
|
+
onChange,
|
|
4588
|
+
placeholder = "MM/DD/YYYY",
|
|
4589
|
+
disabled,
|
|
4590
|
+
readOnly = false,
|
|
4591
|
+
label
|
|
4592
|
+
} = _b, props = __objRest(_b, [
|
|
4593
|
+
"id",
|
|
4594
|
+
"testid",
|
|
4595
|
+
"value",
|
|
4596
|
+
"onChange",
|
|
4597
|
+
"placeholder",
|
|
4598
|
+
"disabled",
|
|
4599
|
+
"readOnly",
|
|
4600
|
+
"label"
|
|
4601
|
+
]);
|
|
4602
|
+
const [visible, setVisible] = (0, import_react20.useState)(false);
|
|
4603
|
+
const [inputValue, setInputValue] = (0, import_react20.useState)("");
|
|
4604
|
+
const [isTyping, setIsTyping] = (0, import_react20.useState)(false);
|
|
4605
|
+
const popoverRef = (0, import_react20.useRef)(null);
|
|
4606
|
+
const triggerRef = (0, import_react20.useRef)(null);
|
|
4607
|
+
const rootRef = (0, import_react20.useRef)(null);
|
|
4608
|
+
const [calendarPosition, setCalendarPosition] = (0, import_react20.useState)({
|
|
4609
|
+
top: 0,
|
|
4610
|
+
left: 0,
|
|
4611
|
+
width: 0
|
|
4612
|
+
});
|
|
4613
|
+
const [from, to] = [value, ""];
|
|
4614
|
+
(0, import_react20.useEffect)(() => {
|
|
4615
|
+
if (!isTyping) {
|
|
4616
|
+
setInputValue(formatDisplayValue(from));
|
|
4617
|
+
}
|
|
4618
|
+
}, [from, isTyping]);
|
|
4619
|
+
(0, import_react20.useLayoutEffect)(() => {
|
|
4620
|
+
if (visible) {
|
|
4621
|
+
updatePosition();
|
|
4622
|
+
}
|
|
4623
|
+
}, [visible]);
|
|
4624
|
+
const updatePosition = () => {
|
|
4625
|
+
if (rootRef.current) {
|
|
4626
|
+
const rect = rootRef.current.getBoundingClientRect();
|
|
4627
|
+
setCalendarPosition({
|
|
4628
|
+
top: rect.bottom + window.scrollY,
|
|
4629
|
+
left: rect.left + window.scrollX,
|
|
4630
|
+
width: rect.width
|
|
4631
|
+
});
|
|
4632
|
+
}
|
|
4633
|
+
};
|
|
4634
|
+
(0, import_react20.useEffect)(() => {
|
|
4635
|
+
updatePosition();
|
|
4636
|
+
const resizeObserver = new ResizeObserver(updatePosition);
|
|
4637
|
+
if (triggerRef.current) {
|
|
4638
|
+
resizeObserver.observe(triggerRef.current);
|
|
4639
|
+
}
|
|
4640
|
+
window.addEventListener("scroll", updatePosition);
|
|
4641
|
+
return () => {
|
|
4642
|
+
resizeObserver.disconnect();
|
|
4643
|
+
window.removeEventListener("scroll", updatePosition);
|
|
4644
|
+
};
|
|
4645
|
+
}, []);
|
|
4646
|
+
(0, import_react20.useEffect)(() => {
|
|
4647
|
+
const handleKeyDown2 = (event) => {
|
|
4648
|
+
var _a2;
|
|
4649
|
+
if (event.key === "Escape" && popoverRef.current) {
|
|
4650
|
+
setVisible(false);
|
|
4651
|
+
(_a2 = triggerRef.current) == null ? void 0 : _a2.blur();
|
|
4652
|
+
}
|
|
4653
|
+
};
|
|
4654
|
+
document.addEventListener("keydown", handleKeyDown2);
|
|
4655
|
+
return () => {
|
|
4656
|
+
document.removeEventListener("keydown", handleKeyDown2);
|
|
4657
|
+
};
|
|
4658
|
+
});
|
|
4659
|
+
(0, import_react20.useEffect)(() => {
|
|
4660
|
+
const handleClickOutside = (event) => {
|
|
4661
|
+
if (popoverRef.current && !popoverRef.current.contains(event.target) && triggerRef.current && !triggerRef.current.contains(event.target)) {
|
|
4662
|
+
setVisible(false);
|
|
4663
|
+
}
|
|
4664
|
+
};
|
|
4665
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
4666
|
+
return () => {
|
|
4667
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
4668
|
+
};
|
|
4669
|
+
}, []);
|
|
4670
|
+
function handleDateChange(fromValue) {
|
|
4671
|
+
onChange(fromValue);
|
|
4672
|
+
setVisible(false);
|
|
4673
|
+
setIsTyping(false);
|
|
4674
|
+
}
|
|
4675
|
+
const handleFocus = () => {
|
|
4676
|
+
if (readOnly) return;
|
|
4677
|
+
setVisible(true);
|
|
4678
|
+
};
|
|
4679
|
+
const handleClick = () => {
|
|
4680
|
+
handleFocus();
|
|
4681
|
+
};
|
|
4682
|
+
const handleInputChange = (event) => {
|
|
4683
|
+
if (readOnly) return;
|
|
4684
|
+
const rawValue = event.target.value;
|
|
4685
|
+
const cursorPosition = event.target.selectionStart || 0;
|
|
4686
|
+
setIsTyping(true);
|
|
4687
|
+
const formattedValue = formatInputValue(rawValue);
|
|
4688
|
+
setInputValue(formattedValue);
|
|
4689
|
+
requestAnimationFrame(() => {
|
|
4690
|
+
if (triggerRef.current) {
|
|
4691
|
+
const newPosition = calculateCursorPosition(
|
|
4692
|
+
rawValue,
|
|
4693
|
+
formattedValue,
|
|
4694
|
+
cursorPosition
|
|
4695
|
+
);
|
|
4696
|
+
triggerRef.current.setSelectionRange(newPosition, newPosition);
|
|
4697
|
+
}
|
|
4698
|
+
});
|
|
4699
|
+
const parsedDate = parseInputDate(formattedValue);
|
|
4700
|
+
if (parsedDate && isValidDate(parsedDate)) {
|
|
4701
|
+
onChange(parsedDate);
|
|
4702
|
+
}
|
|
4703
|
+
};
|
|
4704
|
+
const handleBlur = () => {
|
|
4705
|
+
setIsTyping(false);
|
|
4706
|
+
const parsedDate = parseInputDate(inputValue);
|
|
4707
|
+
if (!parsedDate || !isValidDate(parsedDate)) {
|
|
4708
|
+
setInputValue(formatDisplayValue(from));
|
|
4709
|
+
}
|
|
4710
|
+
};
|
|
4711
|
+
const handleKeyDown = (event) => {
|
|
4712
|
+
if (event.key === "Backspace") {
|
|
4713
|
+
const input = event.target;
|
|
4714
|
+
const cursorPosition = input.selectionStart || 0;
|
|
4715
|
+
const value2 = input.value;
|
|
4716
|
+
if (cursorPosition > 0 && value2[cursorPosition - 1] === "/") {
|
|
4717
|
+
event.preventDefault();
|
|
4718
|
+
const newValue = value2.slice(0, cursorPosition - 2) + value2.slice(cursorPosition);
|
|
4719
|
+
const formattedValue = formatInputValue(newValue);
|
|
4720
|
+
setInputValue(formattedValue);
|
|
4721
|
+
requestAnimationFrame(() => {
|
|
4722
|
+
if (triggerRef.current) {
|
|
4723
|
+
const newPosition = Math.max(0, cursorPosition - 2);
|
|
4724
|
+
triggerRef.current.setSelectionRange(newPosition, newPosition);
|
|
4725
|
+
}
|
|
4726
|
+
});
|
|
4727
|
+
setIsTyping(true);
|
|
4728
|
+
return;
|
|
4729
|
+
}
|
|
4730
|
+
}
|
|
4731
|
+
if (event.key === "Enter") {
|
|
4732
|
+
const parsedDate = parseInputDate(inputValue);
|
|
4733
|
+
if (parsedDate && isValidDate(parsedDate)) {
|
|
4734
|
+
onChange(parsedDate);
|
|
4735
|
+
setVisible(false);
|
|
4736
|
+
setIsTyping(false);
|
|
4737
|
+
}
|
|
4738
|
+
}
|
|
4739
|
+
};
|
|
4740
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "relative", children: [
|
|
4741
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4742
|
+
InputBase,
|
|
4743
|
+
__spreadProps(__spreadValues({
|
|
4744
|
+
id,
|
|
4745
|
+
testid,
|
|
4746
|
+
ref: (el) => {
|
|
4747
|
+
triggerRef.current = el;
|
|
4748
|
+
}
|
|
4749
|
+
}, props), {
|
|
4750
|
+
wrapperRef: rootRef,
|
|
4751
|
+
value: inputValue,
|
|
4752
|
+
placeholder,
|
|
4753
|
+
disabled,
|
|
4754
|
+
readOnly,
|
|
4755
|
+
after: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Icon, { name: "calendar_month" }),
|
|
4756
|
+
onFocus: handleFocus,
|
|
4757
|
+
onClick: handleClick,
|
|
4758
|
+
onChange: handleInputChange,
|
|
4759
|
+
onBlur: handleBlur,
|
|
4760
|
+
onKeyDown: handleKeyDown,
|
|
4761
|
+
label,
|
|
4762
|
+
secondaryIconColor: true
|
|
4763
|
+
})
|
|
4764
|
+
),
|
|
4765
|
+
visible && !readOnly && (0, import_react_dom3.createPortal)(
|
|
4766
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4767
|
+
"div",
|
|
4768
|
+
{
|
|
4769
|
+
ref: (el) => {
|
|
4770
|
+
popoverRef.current = el;
|
|
4771
|
+
},
|
|
4772
|
+
className: "absolute z-40 bg-white",
|
|
4773
|
+
style: {
|
|
4774
|
+
top: `${calendarPosition.top + 4}px`,
|
|
4775
|
+
left: `${calendarPosition.left}px`,
|
|
4776
|
+
minWidth: `${calendarPosition.width}px`
|
|
4777
|
+
},
|
|
4778
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4779
|
+
CalendarRange,
|
|
4780
|
+
{
|
|
4781
|
+
id: id ? `${id}-calendar` : void 0,
|
|
4782
|
+
testid: testid ? `${testid}-calendar` : void 0,
|
|
4783
|
+
from,
|
|
4784
|
+
to: to || from,
|
|
4785
|
+
onChange: handleDateChange,
|
|
4786
|
+
cardStyle: true,
|
|
4787
|
+
mode: "single",
|
|
4788
|
+
disableRange: true
|
|
4789
|
+
}
|
|
4790
|
+
)
|
|
4791
|
+
}
|
|
4792
|
+
),
|
|
4793
|
+
findDocumentRoot(popoverRef.current)
|
|
4794
|
+
)
|
|
4795
|
+
] });
|
|
4796
|
+
};
|
|
4797
|
+
DateInput.displayName = "DateInput";
|
|
4798
|
+
function formatDisplayValue(from) {
|
|
4799
|
+
if (!from) {
|
|
4800
|
+
return "";
|
|
4801
|
+
}
|
|
4802
|
+
if (!isValidDate(from)) {
|
|
4803
|
+
return "";
|
|
4804
|
+
}
|
|
4805
|
+
return formatDate(from);
|
|
4806
|
+
}
|
|
4053
4807
|
|
|
4054
4808
|
// src/components/Accordion.tsx
|
|
4809
|
+
var import_clsx21 = __toESM(require("clsx"), 1);
|
|
4810
|
+
|
|
4811
|
+
// src/components/Card.tsx
|
|
4812
|
+
var import_clsx19 = __toESM(require("clsx"), 1);
|
|
4055
4813
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
4056
4814
|
|
|
4057
|
-
// src/components/
|
|
4058
|
-
var
|
|
4815
|
+
// src/components/Stack.tsx
|
|
4816
|
+
var import_clsx20 = __toESM(require("clsx"), 1);
|
|
4059
4817
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
4818
|
+
|
|
4819
|
+
// src/components/Accordion.tsx
|
|
4820
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4821
|
+
|
|
4822
|
+
// src/components/Heading.tsx
|
|
4823
|
+
var import_clsx22 = __toESM(require("clsx"), 1);
|
|
4824
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
4060
4825
|
var Heading = (_a) => {
|
|
4061
4826
|
var _b = _a, {
|
|
4062
4827
|
className,
|
|
@@ -4079,12 +4844,12 @@ var Heading = (_a) => {
|
|
|
4079
4844
|
]);
|
|
4080
4845
|
const defaultElement = variant === "heading1" ? "h1" : variant === "heading2" ? "h2" : "h3";
|
|
4081
4846
|
const Element = as != null ? as : defaultElement;
|
|
4082
|
-
return /* @__PURE__ */ (0,
|
|
4847
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4083
4848
|
Element,
|
|
4084
4849
|
__spreadProps(__spreadValues({
|
|
4085
4850
|
id,
|
|
4086
4851
|
"data-testid": testid,
|
|
4087
|
-
className: (0,
|
|
4852
|
+
className: (0, import_clsx22.default)(
|
|
4088
4853
|
typography[variant],
|
|
4089
4854
|
className,
|
|
4090
4855
|
align === "left" && "text-left",
|
|
@@ -4100,43 +4865,43 @@ var Heading = (_a) => {
|
|
|
4100
4865
|
);
|
|
4101
4866
|
};
|
|
4102
4867
|
Heading.displayName = "Heading";
|
|
4103
|
-
var Heading1 = (props) => /* @__PURE__ */ (0,
|
|
4104
|
-
var Heading2 = (props) => /* @__PURE__ */ (0,
|
|
4105
|
-
var Heading3 = (props) => /* @__PURE__ */ (0,
|
|
4868
|
+
var Heading1 = (props) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Heading, __spreadProps(__spreadValues({}, props), { variant: "heading1" }));
|
|
4869
|
+
var Heading2 = (props) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Heading, __spreadProps(__spreadValues({}, props), { variant: "heading2" }));
|
|
4870
|
+
var Heading3 = (props) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Heading, __spreadProps(__spreadValues({}, props), { variant: "heading3" }));
|
|
4106
4871
|
Heading1.displayName = "Heading1";
|
|
4107
4872
|
Heading2.displayName = "Heading2";
|
|
4108
4873
|
Heading3.displayName = "Heading3";
|
|
4109
4874
|
|
|
4110
4875
|
// src/components/Theme.tsx
|
|
4111
|
-
var
|
|
4876
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
4112
4877
|
|
|
4113
4878
|
// src/components/MobileDataGrid/ColumnSelector/index.tsx
|
|
4114
|
-
var
|
|
4879
|
+
var import_react23 = require("react");
|
|
4115
4880
|
|
|
4116
4881
|
// src/components/MobileDataGrid/GridContextProvider/useGridContext.ts
|
|
4117
|
-
var
|
|
4882
|
+
var import_react22 = require("react");
|
|
4118
4883
|
|
|
4119
4884
|
// src/components/MobileDataGrid/GridContextProvider/GridContext.tsx
|
|
4120
|
-
var
|
|
4121
|
-
var GridContext = (0,
|
|
4885
|
+
var import_react21 = require("react");
|
|
4886
|
+
var GridContext = (0, import_react21.createContext)(null);
|
|
4122
4887
|
|
|
4123
4888
|
// src/components/MobileDataGrid/ColumnSelector/index.tsx
|
|
4124
|
-
var
|
|
4889
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
4125
4890
|
|
|
4126
4891
|
// src/components/MobileDataGrid/MobileDataGridHeader.tsx
|
|
4127
|
-
var
|
|
4892
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
4128
4893
|
|
|
4129
4894
|
// src/components/MobileDataGrid/GridContextProvider/index.tsx
|
|
4130
|
-
var
|
|
4131
|
-
var
|
|
4895
|
+
var import_react24 = require("react");
|
|
4896
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
4132
4897
|
|
|
4133
4898
|
// src/components/Modal.tsx
|
|
4134
|
-
var
|
|
4135
|
-
var
|
|
4899
|
+
var import_clsx27 = __toESM(require("clsx"), 1);
|
|
4900
|
+
var import_react26 = require("react");
|
|
4136
4901
|
|
|
4137
4902
|
// src/components/ModalHeader.tsx
|
|
4138
|
-
var
|
|
4139
|
-
var
|
|
4903
|
+
var import_clsx23 = __toESM(require("clsx"), 1);
|
|
4904
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
4140
4905
|
var ModalHeader = ({
|
|
4141
4906
|
title,
|
|
4142
4907
|
hideCloseIcon,
|
|
@@ -4147,12 +4912,12 @@ var ModalHeader = ({
|
|
|
4147
4912
|
testid,
|
|
4148
4913
|
headerClassname
|
|
4149
4914
|
}) => {
|
|
4150
|
-
return /* @__PURE__ */ (0,
|
|
4915
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
4151
4916
|
"div",
|
|
4152
4917
|
{
|
|
4153
4918
|
id,
|
|
4154
4919
|
"data-testid": testid,
|
|
4155
|
-
className: (0,
|
|
4920
|
+
className: (0, import_clsx23.default)(
|
|
4156
4921
|
"flex justify-between items-center",
|
|
4157
4922
|
headerIconAlign === "center" && "justify-center",
|
|
4158
4923
|
headerIconAlign === "right" && "justify-end",
|
|
@@ -4162,9 +4927,9 @@ var ModalHeader = ({
|
|
|
4162
4927
|
headerClassname
|
|
4163
4928
|
),
|
|
4164
4929
|
children: [
|
|
4165
|
-
/* @__PURE__ */ (0,
|
|
4930
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: (0, import_clsx23.default)("flex items-center flex-1", layoutGroupGap), children: [
|
|
4166
4931
|
headerIcon,
|
|
4167
|
-
title && /* @__PURE__ */ (0,
|
|
4932
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4168
4933
|
Heading2,
|
|
4169
4934
|
{
|
|
4170
4935
|
id: id ? `${id}-title` : void 0,
|
|
@@ -4174,7 +4939,7 @@ var ModalHeader = ({
|
|
|
4174
4939
|
}
|
|
4175
4940
|
)
|
|
4176
4941
|
] }),
|
|
4177
|
-
!hideCloseIcon && /* @__PURE__ */ (0,
|
|
4942
|
+
!hideCloseIcon && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4178
4943
|
Button,
|
|
4179
4944
|
{
|
|
4180
4945
|
id: id ? `${id}-close-button` : void 0,
|
|
@@ -4182,7 +4947,7 @@ var ModalHeader = ({
|
|
|
4182
4947
|
iconOnly: true,
|
|
4183
4948
|
variant: "tertiary",
|
|
4184
4949
|
onClick: onClose,
|
|
4185
|
-
leftIcon: /* @__PURE__ */ (0,
|
|
4950
|
+
leftIcon: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-brand-text-action-primary-normal desktop:text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Icon, { name: "close", size: 24 }) })
|
|
4186
4951
|
}
|
|
4187
4952
|
)
|
|
4188
4953
|
]
|
|
@@ -4192,20 +4957,20 @@ var ModalHeader = ({
|
|
|
4192
4957
|
ModalHeader.displayName = "ModalHeader";
|
|
4193
4958
|
|
|
4194
4959
|
// src/components/ModalContent.tsx
|
|
4195
|
-
var
|
|
4196
|
-
var
|
|
4960
|
+
var import_clsx24 = __toESM(require("clsx"), 1);
|
|
4961
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
4197
4962
|
function ModalContent({
|
|
4198
4963
|
fixedHeightScrolling,
|
|
4199
4964
|
children,
|
|
4200
4965
|
id,
|
|
4201
4966
|
testid
|
|
4202
4967
|
}) {
|
|
4203
|
-
return /* @__PURE__ */ (0,
|
|
4968
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4204
4969
|
"div",
|
|
4205
4970
|
{
|
|
4206
4971
|
id,
|
|
4207
4972
|
"data-testid": testid,
|
|
4208
|
-
className: (0,
|
|
4973
|
+
className: (0, import_clsx24.default)(
|
|
4209
4974
|
"flex-grow desktop:flex-grow-0",
|
|
4210
4975
|
layoutPaddding,
|
|
4211
4976
|
fixedHeightScrolling && "overflow-auto"
|
|
@@ -4217,8 +4982,8 @@ function ModalContent({
|
|
|
4217
4982
|
ModalContent.displayName = "ModalContent";
|
|
4218
4983
|
|
|
4219
4984
|
// src/components/ModalButtons.tsx
|
|
4220
|
-
var
|
|
4221
|
-
var
|
|
4985
|
+
var import_clsx25 = __toESM(require("clsx"), 1);
|
|
4986
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
4222
4987
|
var ModalButtons = ({
|
|
4223
4988
|
onClose,
|
|
4224
4989
|
onContinue,
|
|
@@ -4226,36 +4991,36 @@ var ModalButtons = ({
|
|
|
4226
4991
|
id,
|
|
4227
4992
|
testid
|
|
4228
4993
|
}) => {
|
|
4229
|
-
return /* @__PURE__ */ (0,
|
|
4994
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4230
4995
|
"div",
|
|
4231
4996
|
{
|
|
4232
4997
|
id,
|
|
4233
4998
|
"data-testid": testid,
|
|
4234
|
-
className: (0,
|
|
4999
|
+
className: (0, import_clsx25.default)(
|
|
4235
5000
|
"border-t border-neutral-300 flex justify-end",
|
|
4236
5001
|
layoutPaddding,
|
|
4237
5002
|
layoutGroupGap
|
|
4238
5003
|
),
|
|
4239
|
-
children: customActions != null ? customActions : /* @__PURE__ */ (0,
|
|
4240
|
-
/* @__PURE__ */ (0,
|
|
5004
|
+
children: customActions != null ? customActions : /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
5005
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4241
5006
|
Button,
|
|
4242
5007
|
{
|
|
4243
5008
|
id: id ? `${id}-close-button` : void 0,
|
|
4244
5009
|
testid: testid ? `${testid}-close-button` : void 0,
|
|
4245
5010
|
variant: "secondary",
|
|
4246
|
-
leftIcon: /* @__PURE__ */ (0,
|
|
5011
|
+
leftIcon: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Icon, { name: "close", size: 24 }),
|
|
4247
5012
|
onClick: onClose,
|
|
4248
5013
|
className: "max-sm:w-full",
|
|
4249
5014
|
children: "Close"
|
|
4250
5015
|
}
|
|
4251
5016
|
),
|
|
4252
|
-
/* @__PURE__ */ (0,
|
|
5017
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4253
5018
|
Button,
|
|
4254
5019
|
{
|
|
4255
5020
|
id: id ? `${id}-continue-button` : void 0,
|
|
4256
5021
|
testid: testid ? `${testid}-continue-button` : void 0,
|
|
4257
5022
|
variant: "primary",
|
|
4258
|
-
leftIcon: /* @__PURE__ */ (0,
|
|
5023
|
+
leftIcon: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Icon, { name: "check", size: 24 }),
|
|
4259
5024
|
className: "max-sm:w-full",
|
|
4260
5025
|
onClick: onContinue,
|
|
4261
5026
|
children: "Continue"
|
|
@@ -4268,8 +5033,8 @@ var ModalButtons = ({
|
|
|
4268
5033
|
ModalButtons.displayName = "ModalButtons";
|
|
4269
5034
|
|
|
4270
5035
|
// src/components/ModalScrim.tsx
|
|
4271
|
-
var
|
|
4272
|
-
var
|
|
5036
|
+
var import_clsx26 = __toESM(require("clsx"), 1);
|
|
5037
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
4273
5038
|
var ModalScrim = ({
|
|
4274
5039
|
show = false,
|
|
4275
5040
|
size = "small",
|
|
@@ -4279,12 +5044,12 @@ var ModalScrim = ({
|
|
|
4279
5044
|
id,
|
|
4280
5045
|
testid
|
|
4281
5046
|
}) => {
|
|
4282
|
-
return /* @__PURE__ */ (0,
|
|
5047
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4283
5048
|
"div",
|
|
4284
5049
|
{
|
|
4285
5050
|
id,
|
|
4286
5051
|
"data-testid": testid,
|
|
4287
|
-
className: (0,
|
|
5052
|
+
className: (0, import_clsx26.default)(
|
|
4288
5053
|
"overflow-y-auto h-screen transition-[visibility,opacity,background] ease-in-out duration-100 grid place-content-center group bg-neutral-600/50 fixed opacity-0",
|
|
4289
5054
|
!show && " pointer-events-none",
|
|
4290
5055
|
size === "small" && "p-4",
|
|
@@ -4300,14 +5065,14 @@ var ModalScrim = ({
|
|
|
4300
5065
|
ModalScrim.displayName = "ModalScrim";
|
|
4301
5066
|
|
|
4302
5067
|
// src/components/Modal.tsx
|
|
4303
|
-
var
|
|
5068
|
+
var import_react_dom4 = require("react-dom");
|
|
4304
5069
|
var import_react_use = require("react-use");
|
|
4305
5070
|
|
|
4306
5071
|
// src/components/useMounted.tsx
|
|
4307
|
-
var
|
|
5072
|
+
var import_react25 = require("react");
|
|
4308
5073
|
var useMounted = () => {
|
|
4309
|
-
const [isMounted, setIsMounted] = (0,
|
|
4310
|
-
(0,
|
|
5074
|
+
const [isMounted, setIsMounted] = (0, import_react25.useState)(false);
|
|
5075
|
+
(0, import_react25.useEffect)(() => {
|
|
4311
5076
|
setIsMounted(true);
|
|
4312
5077
|
return () => setIsMounted(false);
|
|
4313
5078
|
}, []);
|
|
@@ -4315,7 +5080,7 @@ var useMounted = () => {
|
|
|
4315
5080
|
};
|
|
4316
5081
|
|
|
4317
5082
|
// src/components/Modal.tsx
|
|
4318
|
-
var
|
|
5083
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
4319
5084
|
var fadeInScale = (element, duration = 300) => element.animate(
|
|
4320
5085
|
[
|
|
4321
5086
|
{ opacity: 0, transform: "scale(0.95)" },
|
|
@@ -4399,12 +5164,12 @@ var Modal = ({
|
|
|
4399
5164
|
}) => {
|
|
4400
5165
|
var _a;
|
|
4401
5166
|
const mounted = useMounted();
|
|
4402
|
-
const modalRef = (0,
|
|
4403
|
-
const bgRef = (0,
|
|
5167
|
+
const modalRef = (0, import_react26.useRef)(null);
|
|
5168
|
+
const bgRef = (0, import_react26.useRef)(null);
|
|
4404
5169
|
const wasOpen = (0, import_react_use.usePrevious)(open);
|
|
4405
5170
|
const isMobile = useMatchesMobile();
|
|
4406
5171
|
const computedFixedHeightScrolling = isMobile || fixedHeightScrolling;
|
|
4407
|
-
(0,
|
|
5172
|
+
(0, import_react26.useEffect)(() => {
|
|
4408
5173
|
if (!mounted) return;
|
|
4409
5174
|
if (!modalRef.current || !bgRef.current) {
|
|
4410
5175
|
console.error("Modal or background reference is not set.");
|
|
@@ -4424,7 +5189,7 @@ var Modal = ({
|
|
|
4424
5189
|
bgFadeIn(bgRef.current);
|
|
4425
5190
|
}
|
|
4426
5191
|
}, [mounted, onClose, open, wasOpen]);
|
|
4427
|
-
const handleKeyDown = (0,
|
|
5192
|
+
const handleKeyDown = (0, import_react26.useCallback)(
|
|
4428
5193
|
(e) => {
|
|
4429
5194
|
if (e.key === "Escape") {
|
|
4430
5195
|
if (onClose) {
|
|
@@ -4435,12 +5200,12 @@ var Modal = ({
|
|
|
4435
5200
|
},
|
|
4436
5201
|
[onClose]
|
|
4437
5202
|
);
|
|
4438
|
-
const handleClose = (0,
|
|
5203
|
+
const handleClose = (0, import_react26.useCallback)(() => {
|
|
4439
5204
|
if (onClose) {
|
|
4440
5205
|
onClose();
|
|
4441
5206
|
}
|
|
4442
5207
|
}, [onClose]);
|
|
4443
|
-
(0,
|
|
5208
|
+
(0, import_react26.useEffect)(() => {
|
|
4444
5209
|
if (open) {
|
|
4445
5210
|
document.addEventListener("keyup", handleKeyDown);
|
|
4446
5211
|
}
|
|
@@ -4448,7 +5213,7 @@ var Modal = ({
|
|
|
4448
5213
|
document.removeEventListener("keyup", handleKeyDown);
|
|
4449
5214
|
};
|
|
4450
5215
|
}, [open, handleKeyDown]);
|
|
4451
|
-
(0,
|
|
5216
|
+
(0, import_react26.useEffect)(() => {
|
|
4452
5217
|
if (!open) return;
|
|
4453
5218
|
const scrollY = window.scrollY;
|
|
4454
5219
|
const body = document.body;
|
|
@@ -4469,7 +5234,7 @@ var Modal = ({
|
|
|
4469
5234
|
};
|
|
4470
5235
|
}, [open]);
|
|
4471
5236
|
const { sizeClass } = (_a = sizes[size]) != null ? _a : sizes.small;
|
|
4472
|
-
const backgroundClickHandler = (0,
|
|
5237
|
+
const backgroundClickHandler = (0, import_react26.useCallback)(
|
|
4473
5238
|
(e) => {
|
|
4474
5239
|
const target = e.target;
|
|
4475
5240
|
const currentTarget = e.currentTarget;
|
|
@@ -4486,8 +5251,8 @@ var Modal = ({
|
|
|
4486
5251
|
if (!mounted) {
|
|
4487
5252
|
return null;
|
|
4488
5253
|
}
|
|
4489
|
-
return (0,
|
|
4490
|
-
/* @__PURE__ */ (0,
|
|
5254
|
+
return (0, import_react_dom4.createPortal)(
|
|
5255
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4491
5256
|
ModalScrim,
|
|
4492
5257
|
{
|
|
4493
5258
|
id: id ? `${id}-scrim` : void 0,
|
|
@@ -4496,13 +5261,13 @@ var Modal = ({
|
|
|
4496
5261
|
ref: bgRef,
|
|
4497
5262
|
show: open,
|
|
4498
5263
|
onClick: backgroundClickHandler,
|
|
4499
|
-
children: /* @__PURE__ */ (0,
|
|
5264
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
4500
5265
|
"div",
|
|
4501
5266
|
{
|
|
4502
5267
|
id,
|
|
4503
5268
|
"data-testid": testid,
|
|
4504
5269
|
ref: modalRef,
|
|
4505
|
-
className: (0,
|
|
5270
|
+
className: (0, import_clsx27.default)(
|
|
4506
5271
|
"shadow-md rounded-sm flex flex-col overflow-hidden w-full opacity-0 h-fit",
|
|
4507
5272
|
computedFixedHeightScrolling && size !== "screen" && "desktop:max-h-[calc(100vh-32px)] desktop:h-auto",
|
|
4508
5273
|
className,
|
|
@@ -4511,7 +5276,7 @@ var Modal = ({
|
|
|
4511
5276
|
),
|
|
4512
5277
|
onClick: (e) => e.stopPropagation(),
|
|
4513
5278
|
children: [
|
|
4514
|
-
/* @__PURE__ */ (0,
|
|
5279
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4515
5280
|
ModalHeader,
|
|
4516
5281
|
{
|
|
4517
5282
|
id: id ? `${id}-header` : void 0,
|
|
@@ -4524,7 +5289,7 @@ var Modal = ({
|
|
|
4524
5289
|
headerClassname
|
|
4525
5290
|
}
|
|
4526
5291
|
),
|
|
4527
|
-
children && (size !== "screen" || noWrapper) ? /* @__PURE__ */ (0,
|
|
5292
|
+
children && (size !== "screen" || noWrapper) ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4528
5293
|
ModalContent,
|
|
4529
5294
|
{
|
|
4530
5295
|
id: id ? `${id}-content` : void 0,
|
|
@@ -4533,7 +5298,7 @@ var Modal = ({
|
|
|
4533
5298
|
children
|
|
4534
5299
|
}
|
|
4535
5300
|
) : children,
|
|
4536
|
-
showButtons ? customFooter ? customActions : /* @__PURE__ */ (0,
|
|
5301
|
+
showButtons ? customFooter ? customActions : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4537
5302
|
ModalButtons,
|
|
4538
5303
|
{
|
|
4539
5304
|
id: id ? `${id}-buttons` : void 0,
|
|
@@ -4554,51 +5319,51 @@ var Modal = ({
|
|
|
4554
5319
|
Modal.displayName = "Modal";
|
|
4555
5320
|
|
|
4556
5321
|
// src/components/MobileDataGrid/MobileDataGridCard/MobileDataGridColumn.tsx
|
|
4557
|
-
var
|
|
5322
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
4558
5323
|
|
|
4559
5324
|
// src/components/MobileDataGrid/RowDetailModalProvider/ModalContent.tsx
|
|
4560
|
-
var
|
|
5325
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
4561
5326
|
|
|
4562
5327
|
// src/components/MobileDataGrid/RowDetailModalProvider/index.tsx
|
|
4563
|
-
var
|
|
5328
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
4564
5329
|
|
|
4565
5330
|
// src/components/MobileDataGrid/ColumnList.tsx
|
|
4566
|
-
var
|
|
5331
|
+
var import_clsx29 = __toESM(require("clsx"), 1);
|
|
4567
5332
|
|
|
4568
5333
|
// src/components/MobileDataGrid/MobileDataGridCard/index.tsx
|
|
4569
|
-
var
|
|
4570
|
-
var
|
|
5334
|
+
var import_clsx28 = __toESM(require("clsx"), 1);
|
|
5335
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
4571
5336
|
|
|
4572
5337
|
// src/components/MobileDataGrid/ColumnList.tsx
|
|
4573
|
-
var
|
|
5338
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
4574
5339
|
|
|
4575
5340
|
// src/components/MobileDataGrid/index.tsx
|
|
4576
|
-
var
|
|
5341
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
4577
5342
|
|
|
4578
5343
|
// src/components/ProductImagePreview/Thumbnail.tsx
|
|
4579
|
-
var
|
|
5344
|
+
var import_react28 = require("react");
|
|
4580
5345
|
|
|
4581
5346
|
// src/components/ImagePlaceholder.tsx
|
|
4582
|
-
var
|
|
4583
|
-
var
|
|
5347
|
+
var import_react27 = require("react");
|
|
5348
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
4584
5349
|
|
|
4585
5350
|
// src/components/ProductImagePreview/Thumbnail.tsx
|
|
4586
|
-
var
|
|
5351
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
4587
5352
|
|
|
4588
5353
|
// src/components/Grid.tsx
|
|
4589
|
-
var
|
|
4590
|
-
var
|
|
5354
|
+
var import_clsx30 = __toESM(require("clsx"), 1);
|
|
5355
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
4591
5356
|
|
|
4592
5357
|
// src/components/ProductImagePreview/ProductPrimaryImage.tsx
|
|
4593
|
-
var
|
|
4594
|
-
var
|
|
5358
|
+
var import_react29 = require("react");
|
|
5359
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
4595
5360
|
|
|
4596
5361
|
// src/components/ProductImagePreview/ZoomWindow.tsx
|
|
4597
|
-
var
|
|
5362
|
+
var import_react30 = require("react");
|
|
4598
5363
|
|
|
4599
5364
|
// src/components/Surface.tsx
|
|
4600
|
-
var
|
|
4601
|
-
var
|
|
5365
|
+
var import_clsx31 = __toESM(require("clsx"), 1);
|
|
5366
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
4602
5367
|
var Surface = (_a) => {
|
|
4603
5368
|
var _b = _a, {
|
|
4604
5369
|
children,
|
|
@@ -4611,11 +5376,11 @@ var Surface = (_a) => {
|
|
|
4611
5376
|
"elevation",
|
|
4612
5377
|
"id"
|
|
4613
5378
|
]);
|
|
4614
|
-
return /* @__PURE__ */ (0,
|
|
5379
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
4615
5380
|
"div",
|
|
4616
5381
|
__spreadProps(__spreadValues({
|
|
4617
5382
|
id,
|
|
4618
|
-
className: (0,
|
|
5383
|
+
className: (0, import_clsx31.default)(
|
|
4619
5384
|
"rounded-base",
|
|
4620
5385
|
{
|
|
4621
5386
|
"shadow-2": elevation === 2,
|
|
@@ -4632,43 +5397,43 @@ var Surface = (_a) => {
|
|
|
4632
5397
|
Surface.displayName = "Surface";
|
|
4633
5398
|
|
|
4634
5399
|
// src/components/ProductImagePreview/ZoomWindow.tsx
|
|
4635
|
-
var
|
|
5400
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
4636
5401
|
|
|
4637
5402
|
// src/components/ProductImagePreview/CarouselPagination.tsx
|
|
4638
|
-
var
|
|
4639
|
-
var
|
|
5403
|
+
var import_clsx32 = require("clsx");
|
|
5404
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
4640
5405
|
|
|
4641
5406
|
// src/components/ProductImagePreview/MobileImageCarousel.tsx
|
|
4642
|
-
var
|
|
4643
|
-
var
|
|
5407
|
+
var import_react31 = require("react");
|
|
5408
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
4644
5409
|
|
|
4645
5410
|
// src/components/ProductImagePreview/useProductImagePreview.ts
|
|
4646
|
-
var
|
|
5411
|
+
var import_react32 = require("react");
|
|
4647
5412
|
|
|
4648
5413
|
// src/components/ProductImagePreview/index.tsx
|
|
4649
|
-
var
|
|
5414
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
4650
5415
|
|
|
4651
5416
|
// src/components/CompactImagesPreview.tsx
|
|
4652
|
-
var
|
|
4653
|
-
var
|
|
4654
|
-
var
|
|
5417
|
+
var import_react33 = require("react");
|
|
5418
|
+
var import_clsx33 = __toESM(require("clsx"), 1);
|
|
5419
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
4655
5420
|
|
|
4656
5421
|
// src/components/SimpleTable.tsx
|
|
4657
|
-
var
|
|
4658
|
-
var
|
|
5422
|
+
var import_clsx34 = __toESM(require("clsx"), 1);
|
|
5423
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
4659
5424
|
|
|
4660
5425
|
// src/components/PDFViewer/index.tsx
|
|
4661
|
-
var
|
|
5426
|
+
var import_react36 = require("react");
|
|
4662
5427
|
|
|
4663
5428
|
// src/components/PDFViewer/PDFElement.tsx
|
|
4664
5429
|
var import_react_pdf2 = require("@mikecousins/react-pdf");
|
|
4665
|
-
var
|
|
5430
|
+
var import_react35 = require("react");
|
|
4666
5431
|
|
|
4667
5432
|
// src/components/Spinner.tsx
|
|
4668
|
-
var
|
|
5433
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
4669
5434
|
var Spinner = ({ size = "small", testid }) => {
|
|
4670
5435
|
const dimension = size === "large" ? 48 : 24;
|
|
4671
|
-
return /* @__PURE__ */ (0,
|
|
5436
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
4672
5437
|
"svg",
|
|
4673
5438
|
{
|
|
4674
5439
|
"data-testid": testid,
|
|
@@ -4680,14 +5445,14 @@ var Spinner = ({ size = "small", testid }) => {
|
|
|
4680
5445
|
className: "spinner",
|
|
4681
5446
|
"aria-label": "Loading",
|
|
4682
5447
|
children: [
|
|
4683
|
-
/* @__PURE__ */ (0,
|
|
4684
|
-
/* @__PURE__ */ (0,
|
|
4685
|
-
/* @__PURE__ */ (0,
|
|
4686
|
-
/* @__PURE__ */ (0,
|
|
4687
|
-
/* @__PURE__ */ (0,
|
|
4688
|
-
/* @__PURE__ */ (0,
|
|
4689
|
-
/* @__PURE__ */ (0,
|
|
4690
|
-
/* @__PURE__ */ (0,
|
|
5448
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("circle", { cx: "12", cy: "4", r: "2", opacity: "1" }),
|
|
5449
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("circle", { cx: "17.666", cy: "6.334", r: "2", opacity: "0.125" }),
|
|
5450
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("circle", { cx: "20", cy: "12", r: "2", opacity: "0.25" }),
|
|
5451
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("circle", { cx: "17.666", cy: "17.666", r: "2", opacity: "0.375" }),
|
|
5452
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("circle", { cx: "12", cy: "20", r: "2", opacity: "0.5" }),
|
|
5453
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("circle", { cx: "6.334", cy: "17.666", r: "2", opacity: "0.625" }),
|
|
5454
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("circle", { cx: "4", cy: "12", r: "2", opacity: "0.75" }),
|
|
5455
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("circle", { cx: "6.334", cy: "6.334", r: "2", opacity: "0.875" })
|
|
4691
5456
|
]
|
|
4692
5457
|
}
|
|
4693
5458
|
);
|
|
@@ -4696,31 +5461,31 @@ Spinner.displayName = "Spinner";
|
|
|
4696
5461
|
|
|
4697
5462
|
// src/components/PDFViewer/PDFPage.tsx
|
|
4698
5463
|
var import_react_pdf = require("@mikecousins/react-pdf");
|
|
4699
|
-
var
|
|
4700
|
-
var
|
|
5464
|
+
var import_react34 = require("react");
|
|
5465
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
4701
5466
|
|
|
4702
5467
|
// src/components/PDFViewer/PDFElement.tsx
|
|
4703
|
-
var
|
|
4704
|
-
var
|
|
5468
|
+
var import_clsx35 = __toESM(require("clsx"), 1);
|
|
5469
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
4705
5470
|
|
|
4706
5471
|
// src/components/PDFViewer/DownloadIcon.tsx
|
|
4707
|
-
var
|
|
5472
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
4708
5473
|
|
|
4709
5474
|
// src/components/PDFViewer/PDFNavigation.tsx
|
|
4710
|
-
var
|
|
5475
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
4711
5476
|
|
|
4712
5477
|
// src/components/PDFViewer/index.tsx
|
|
4713
|
-
var
|
|
5478
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
4714
5479
|
|
|
4715
5480
|
// src/components/ListGroup.tsx
|
|
4716
|
-
var
|
|
4717
|
-
var
|
|
4718
|
-
var
|
|
5481
|
+
var import_react37 = require("react");
|
|
5482
|
+
var import_clsx36 = __toESM(require("clsx"), 1);
|
|
5483
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
4719
5484
|
|
|
4720
5485
|
// src/components/Pagination.tsx
|
|
4721
|
-
var
|
|
4722
|
-
var
|
|
4723
|
-
var
|
|
5486
|
+
var import_react38 = require("react");
|
|
5487
|
+
var import_clsx37 = __toESM(require("clsx"), 1);
|
|
5488
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
4724
5489
|
var Pagination = ({
|
|
4725
5490
|
totalPages,
|
|
4726
5491
|
currentPage,
|
|
@@ -4730,7 +5495,7 @@ var Pagination = ({
|
|
|
4730
5495
|
className,
|
|
4731
5496
|
disabled
|
|
4732
5497
|
}) => {
|
|
4733
|
-
const goTo = (0,
|
|
5498
|
+
const goTo = (0, import_react38.useCallback)(
|
|
4734
5499
|
(page) => {
|
|
4735
5500
|
if (disabled) return;
|
|
4736
5501
|
onPageChange(page);
|
|
@@ -4747,7 +5512,7 @@ var Pagination = ({
|
|
|
4747
5512
|
goTo(currentPage + 1);
|
|
4748
5513
|
}
|
|
4749
5514
|
};
|
|
4750
|
-
const pageTokens = (0,
|
|
5515
|
+
const pageTokens = (0, import_react38.useMemo)(() => {
|
|
4751
5516
|
if (totalPages <= 5) {
|
|
4752
5517
|
return Array.from({ length: totalPages }, (_, i) => i + 1);
|
|
4753
5518
|
}
|
|
@@ -4784,7 +5549,7 @@ var Pagination = ({
|
|
|
4784
5549
|
return tokens;
|
|
4785
5550
|
}, [totalPages, currentPage]);
|
|
4786
5551
|
if (totalPages <= 1) return null;
|
|
4787
|
-
const buttonClass = (0,
|
|
5552
|
+
const buttonClass = (0, import_clsx37.default)(
|
|
4788
5553
|
"cursor-pointer disabled:cursor-default",
|
|
4789
5554
|
paddingUsingComponentGap,
|
|
4790
5555
|
"w-8 h-8",
|
|
@@ -4795,14 +5560,14 @@ var Pagination = ({
|
|
|
4795
5560
|
"focus:bg-background-grouped-secondary-normal focus:outline-0",
|
|
4796
5561
|
"disabled:bg-transparent disabled:text-text-action-primary-disabled"
|
|
4797
5562
|
);
|
|
4798
|
-
return /* @__PURE__ */ (0,
|
|
5563
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
4799
5564
|
"nav",
|
|
4800
5565
|
{
|
|
4801
5566
|
id,
|
|
4802
5567
|
"data-testid": testid,
|
|
4803
5568
|
"aria-label": "Pagination",
|
|
4804
5569
|
onKeyDown: handleKey,
|
|
4805
|
-
className: (0,
|
|
5570
|
+
className: (0, import_clsx37.default)(
|
|
4806
5571
|
"flex items-center",
|
|
4807
5572
|
"border border-border-primary-normal",
|
|
4808
5573
|
"bg-background-grouped-primary-normal",
|
|
@@ -4810,19 +5575,19 @@ var Pagination = ({
|
|
|
4810
5575
|
className
|
|
4811
5576
|
),
|
|
4812
5577
|
children: [
|
|
4813
|
-
/* @__PURE__ */ (0,
|
|
5578
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4814
5579
|
"button",
|
|
4815
5580
|
{
|
|
4816
5581
|
disabled: disabled || currentPage <= 1,
|
|
4817
5582
|
"aria-label": "Previous page",
|
|
4818
5583
|
onClick: () => goTo(currentPage - 1),
|
|
4819
|
-
className: (0,
|
|
4820
|
-
children: /* @__PURE__ */ (0,
|
|
5584
|
+
className: (0, import_clsx37.default)(buttonClass, "border-r-1 border-border-primary-normal"),
|
|
5585
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Icon, { name: "keyboard_arrow_left" })
|
|
4821
5586
|
}
|
|
4822
5587
|
),
|
|
4823
|
-
/* @__PURE__ */ (0,
|
|
5588
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("ul", { className: (0, import_clsx37.default)("flex items-center"), children: pageTokens.map((token, index) => {
|
|
4824
5589
|
if (token === "ellipsis") {
|
|
4825
|
-
return /* @__PURE__ */ (0,
|
|
5590
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4826
5591
|
"li",
|
|
4827
5592
|
{
|
|
4828
5593
|
className: "w-8 h-8 select-none text-text-action-primary-disabled",
|
|
@@ -4832,29 +5597,29 @@ var Pagination = ({
|
|
|
4832
5597
|
);
|
|
4833
5598
|
}
|
|
4834
5599
|
const selected = token === currentPage;
|
|
4835
|
-
return /* @__PURE__ */ (0,
|
|
5600
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4836
5601
|
"button",
|
|
4837
5602
|
{
|
|
4838
5603
|
"aria-label": `Page ${token}`,
|
|
4839
5604
|
"aria-current": selected ? "page" : void 0,
|
|
4840
5605
|
disabled,
|
|
4841
5606
|
onClick: () => goTo(token),
|
|
4842
|
-
className: (0,
|
|
5607
|
+
className: (0, import_clsx37.default)(
|
|
4843
5608
|
buttonClass,
|
|
4844
5609
|
selected && "border-x-1 bg-background-grouped-secondary-normal border-border-primary-normal"
|
|
4845
5610
|
),
|
|
4846
|
-
children: /* @__PURE__ */ (0,
|
|
5611
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Subheader, { align: "center", weight: "bold", children: token })
|
|
4847
5612
|
}
|
|
4848
5613
|
) }, token);
|
|
4849
5614
|
}) }),
|
|
4850
|
-
/* @__PURE__ */ (0,
|
|
5615
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4851
5616
|
"button",
|
|
4852
5617
|
{
|
|
4853
5618
|
disabled: disabled || currentPage >= totalPages,
|
|
4854
5619
|
"aria-label": "Next page",
|
|
4855
5620
|
onClick: () => goTo(currentPage + 1),
|
|
4856
|
-
className: (0,
|
|
4857
|
-
children: /* @__PURE__ */ (0,
|
|
5621
|
+
className: (0, import_clsx37.default)(buttonClass, "border-l-1 border-border-primary-normal"),
|
|
5622
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Icon, { name: "keyboard_arrow_right" })
|
|
4858
5623
|
}
|
|
4859
5624
|
)
|
|
4860
5625
|
]
|
|
@@ -4864,22 +5629,27 @@ var Pagination = ({
|
|
|
4864
5629
|
Pagination.displayName = "Pagination";
|
|
4865
5630
|
|
|
4866
5631
|
// src/components/SkeletonParagraph.tsx
|
|
4867
|
-
var
|
|
5632
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
4868
5633
|
|
|
4869
5634
|
// src/components/EmptyCartIcon.tsx
|
|
4870
|
-
var
|
|
5635
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
5636
|
+
|
|
5637
|
+
// src/components/Alert.tsx
|
|
5638
|
+
var import_clsx38 = __toESM(require("clsx"), 1);
|
|
5639
|
+
var import_react39 = require("react");
|
|
5640
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
4871
5641
|
|
|
4872
5642
|
// src/components/DataGrid/utils.tsx
|
|
4873
|
-
var
|
|
5643
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
4874
5644
|
function getSortIcon(sort, nextSort = false) {
|
|
4875
|
-
const iconClassName = (0,
|
|
5645
|
+
const iconClassName = (0, import_clsx39.default)(
|
|
4876
5646
|
"text-icon-on-action-primary-normal",
|
|
4877
5647
|
nextSort && "hidden group-hover:block"
|
|
4878
5648
|
);
|
|
4879
5649
|
if (sort === "asc")
|
|
4880
|
-
return /* @__PURE__ */ (0,
|
|
5650
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Icon, { size: 16, className: iconClassName, name: "arrow_upward" });
|
|
4881
5651
|
if (sort === "desc")
|
|
4882
|
-
return /* @__PURE__ */ (0,
|
|
5652
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Icon, { size: 16, className: iconClassName, name: "arrow_downward" });
|
|
4883
5653
|
return null;
|
|
4884
5654
|
}
|
|
4885
5655
|
// Annotate the CommonJS export names for ESM import in node:
|