@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(ColumnSelectorMenuOption_exports, {
|
|
|
62
62
|
ColumnSelectorMenuOption: () => ColumnSelectorMenuOption
|
|
63
63
|
});
|
|
64
64
|
module.exports = __toCommonJS(ColumnSelectorMenuOption_exports);
|
|
65
|
-
var
|
|
65
|
+
var import_react39 = require("react");
|
|
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) {
|
|
@@ -4029,23 +4099,718 @@ var Tooltip = ({
|
|
|
4029
4099
|
};
|
|
4030
4100
|
Tooltip.displayName = "Tooltip";
|
|
4031
4101
|
|
|
4032
|
-
// src/components/
|
|
4033
|
-
var
|
|
4102
|
+
// src/components/DateInput.tsx
|
|
4103
|
+
var import_react19 = require("react");
|
|
4104
|
+
var import_react_dom3 = require("react-dom");
|
|
4034
4105
|
|
|
4035
|
-
// src/components/
|
|
4106
|
+
// src/components/CalendarRange.tsx
|
|
4036
4107
|
var import_clsx19 = __toESM(require("clsx"), 1);
|
|
4108
|
+
var import_react18 = __toESM(require("react"), 1);
|
|
4109
|
+
var import_polyfill = require("@js-temporal/polyfill");
|
|
4037
4110
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
4111
|
+
function DateCell(_a) {
|
|
4112
|
+
var _b = _a, {
|
|
4113
|
+
date,
|
|
4114
|
+
isInMonth,
|
|
4115
|
+
isToday,
|
|
4116
|
+
isSelected,
|
|
4117
|
+
inRange,
|
|
4118
|
+
isDisabled,
|
|
4119
|
+
isRangeStart,
|
|
4120
|
+
isRangeEnd,
|
|
4121
|
+
onClick,
|
|
4122
|
+
onMouseEnter,
|
|
4123
|
+
onMouseLeave,
|
|
4124
|
+
cellPadding = "",
|
|
4125
|
+
isRangeDisabled = false,
|
|
4126
|
+
id,
|
|
4127
|
+
testid
|
|
4128
|
+
} = _b, props = __objRest(_b, [
|
|
4129
|
+
"date",
|
|
4130
|
+
"isInMonth",
|
|
4131
|
+
"isToday",
|
|
4132
|
+
"isSelected",
|
|
4133
|
+
"inRange",
|
|
4134
|
+
"isDisabled",
|
|
4135
|
+
"isRangeStart",
|
|
4136
|
+
"isRangeEnd",
|
|
4137
|
+
"onClick",
|
|
4138
|
+
"onMouseEnter",
|
|
4139
|
+
"onMouseLeave",
|
|
4140
|
+
"cellPadding",
|
|
4141
|
+
"isRangeDisabled",
|
|
4142
|
+
"id",
|
|
4143
|
+
"testid"
|
|
4144
|
+
]);
|
|
4145
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4146
|
+
"span",
|
|
4147
|
+
__spreadProps(__spreadValues({}, props), {
|
|
4148
|
+
id,
|
|
4149
|
+
"data-testid": testid,
|
|
4150
|
+
className: (0, import_clsx19.default)(
|
|
4151
|
+
"flex items-center justify-center aspect-square select-none transition-colors border duration-100 font-medium",
|
|
4152
|
+
typography.caption,
|
|
4153
|
+
cellPadding,
|
|
4154
|
+
!isToday && !isSelected && !inRange && !isDisabled && !isRangeStart && !isRangeEnd && "border-transparent",
|
|
4155
|
+
!isInMonth && "border-transparent",
|
|
4156
|
+
// Today: subtle border ring
|
|
4157
|
+
isToday && !isSelected && !inRange && "rounded-full border-border-primary-normal ",
|
|
4158
|
+
// Selected: Figma blue, white text, strong shadow
|
|
4159
|
+
isSelected && "bg-action-400 text-white border-action-400 z-10",
|
|
4160
|
+
!isSelected && !inRange && "rounded-base",
|
|
4161
|
+
// When range is disabled OR when only 'from' is selected (no range yet), apply rounded corners
|
|
4162
|
+
(isRangeDisabled || !inRange && isSelected) && "rounded-base",
|
|
4163
|
+
inRange && isSelected && "hover:border-action-500",
|
|
4164
|
+
// In range: Figma light blue background
|
|
4165
|
+
inRange && !isSelected && "bg-action-100 text-text-primary-normal border-y-action-400 border-x-0 ",
|
|
4166
|
+
// Disabled: Figma gray, no pointer, no hover
|
|
4167
|
+
isDisabled && !inRange ? "text-text-primary-disabled bg-transparent pointer-events-none opacity-40 border-transparent" : [
|
|
4168
|
+
"text-text-primary-normal cursor-pointer",
|
|
4169
|
+
// Figma hover: blue bg, blue text (or red text if selected)
|
|
4170
|
+
isSelected ? "hover:bg-background-action-primary-hover hover:text-white" : "hover:bg-action-100 hover:text-text-action-primary-hover",
|
|
4171
|
+
// Figma active: darker blue bg, white text
|
|
4172
|
+
"active:bg-action-300 active:text-white",
|
|
4173
|
+
// Figma focus: ring
|
|
4174
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-action-400"
|
|
4175
|
+
],
|
|
4176
|
+
isRangeStart && "rounded-l",
|
|
4177
|
+
isRangeEnd && "rounded-r"
|
|
4178
|
+
),
|
|
4179
|
+
tabIndex: isDisabled ? -1 : 0,
|
|
4180
|
+
"aria-disabled": isDisabled,
|
|
4181
|
+
onClick: () => !isDisabled && isInMonth && onClick(),
|
|
4182
|
+
onMouseEnter: () => isInMonth && onMouseEnter(),
|
|
4183
|
+
onMouseLeave: () => isInMonth && onMouseLeave(),
|
|
4184
|
+
children: isInMonth ? date.day : ""
|
|
4185
|
+
})
|
|
4186
|
+
);
|
|
4187
|
+
}
|
|
4188
|
+
function CalendarRange({
|
|
4189
|
+
from,
|
|
4190
|
+
to,
|
|
4191
|
+
onChange,
|
|
4192
|
+
isDateAvailable,
|
|
4193
|
+
mode = "double",
|
|
4194
|
+
cardStyle = false,
|
|
4195
|
+
disableRange = false,
|
|
4196
|
+
id,
|
|
4197
|
+
testid
|
|
4198
|
+
}) {
|
|
4199
|
+
const weekDays = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
|
|
4200
|
+
const parseDate = (d) => {
|
|
4201
|
+
if (!d) {
|
|
4202
|
+
return void 0;
|
|
4203
|
+
}
|
|
4204
|
+
try {
|
|
4205
|
+
if (typeof d === "number") {
|
|
4206
|
+
return import_polyfill.Temporal.PlainDate.from(new Date(d).toISOString().slice(0, 10));
|
|
4207
|
+
}
|
|
4208
|
+
if (typeof d === "string") {
|
|
4209
|
+
return import_polyfill.Temporal.PlainDate.from(d);
|
|
4210
|
+
}
|
|
4211
|
+
return void 0;
|
|
4212
|
+
} catch (error) {
|
|
4213
|
+
console.error("Invalid date format:", d, error);
|
|
4214
|
+
return import_polyfill.Temporal.Now.plainDateISO();
|
|
4215
|
+
}
|
|
4216
|
+
};
|
|
4217
|
+
const fromDate = parseDate(from);
|
|
4218
|
+
const toDate = parseDate(to);
|
|
4219
|
+
const today = import_polyfill.Temporal.Now.plainDateISO();
|
|
4220
|
+
const [baseMonth, setBaseMonth] = (0, import_react18.useState)(
|
|
4221
|
+
fromDate != null ? fromDate : today.with({ day: 1 })
|
|
4222
|
+
);
|
|
4223
|
+
const [selecting, setSelecting] = (0, import_react18.useState)("from");
|
|
4224
|
+
const [pendingFrom, setPendingFrom] = (0, import_react18.useState)(void 0);
|
|
4225
|
+
const [hoveredDate, setHoveredDate] = (0, import_react18.useState)(void 0);
|
|
4226
|
+
(0, import_react18.useEffect)(() => {
|
|
4227
|
+
if (fromDate) {
|
|
4228
|
+
setBaseMonth(fromDate.with({ day: 1 }));
|
|
4229
|
+
} else if (toDate) {
|
|
4230
|
+
setBaseMonth(toDate.with({ day: 1 }));
|
|
4231
|
+
}
|
|
4232
|
+
}, [from, to]);
|
|
4233
|
+
(0, import_react18.useEffect)(() => {
|
|
4234
|
+
if (fromDate && toDate) {
|
|
4235
|
+
setSelecting("from");
|
|
4236
|
+
setPendingFrom(void 0);
|
|
4237
|
+
setHoveredDate(void 0);
|
|
4238
|
+
}
|
|
4239
|
+
}, [from, to]);
|
|
4240
|
+
function getMonthData(monthOffset) {
|
|
4241
|
+
const monthDate = baseMonth.add({ months: monthOffset }).with({ day: 1 });
|
|
4242
|
+
const days = monthDate.daysInMonth;
|
|
4243
|
+
const firstDayOffset = monthDate.dayOfWeek % 7;
|
|
4244
|
+
return {
|
|
4245
|
+
name: monthDate.toLocaleString("en-US", { month: "long" }),
|
|
4246
|
+
year: monthDate.year,
|
|
4247
|
+
days,
|
|
4248
|
+
firstDayOffset,
|
|
4249
|
+
date: monthDate
|
|
4250
|
+
};
|
|
4251
|
+
}
|
|
4252
|
+
function getMonthDataWith(monthOffset) {
|
|
4253
|
+
const monthDate = baseMonth.with({ month: monthOffset }).with({ day: 1 });
|
|
4254
|
+
const days = monthDate.daysInMonth;
|
|
4255
|
+
const firstDayOffset = monthDate.dayOfWeek % 7;
|
|
4256
|
+
return {
|
|
4257
|
+
name: monthDate.toLocaleString("en-US", { month: "long" }),
|
|
4258
|
+
year: monthDate.year,
|
|
4259
|
+
days,
|
|
4260
|
+
firstDayOffset,
|
|
4261
|
+
date: monthDate
|
|
4262
|
+
};
|
|
4263
|
+
}
|
|
4264
|
+
function handleDayClick(date) {
|
|
4265
|
+
if (isDateAvailable && !isDateAvailable(date)) return;
|
|
4266
|
+
if (mode === "single" && disableRange) {
|
|
4267
|
+
if (onChange) {
|
|
4268
|
+
onChange(date.toString(), date.toString());
|
|
4269
|
+
}
|
|
4270
|
+
return;
|
|
4271
|
+
}
|
|
4272
|
+
if (selecting === "from") {
|
|
4273
|
+
setPendingFrom(date);
|
|
4274
|
+
setSelecting("to");
|
|
4275
|
+
setHoveredDate(void 0);
|
|
4276
|
+
} else if (pendingFrom) {
|
|
4277
|
+
if (onChange) {
|
|
4278
|
+
const [start, end] = import_polyfill.Temporal.PlainDate.compare(date, pendingFrom) < 0 ? [date, pendingFrom] : [pendingFrom, date];
|
|
4279
|
+
onChange(start.toString(), end.toString());
|
|
4280
|
+
}
|
|
4281
|
+
setPendingFrom(void 0);
|
|
4282
|
+
setSelecting("from");
|
|
4283
|
+
setHoveredDate(void 0);
|
|
4284
|
+
}
|
|
4285
|
+
}
|
|
4286
|
+
function isInRange(date) {
|
|
4287
|
+
if (mode === "single" && disableRange) {
|
|
4288
|
+
return false;
|
|
4289
|
+
}
|
|
4290
|
+
if (pendingFrom && selecting === "to" && hoveredDate) {
|
|
4291
|
+
const [start, end] = import_polyfill.Temporal.PlainDate.compare(hoveredDate, pendingFrom) < 0 ? [hoveredDate, pendingFrom] : [pendingFrom, hoveredDate];
|
|
4292
|
+
return import_polyfill.Temporal.PlainDate.compare(date, start) >= 0 && import_polyfill.Temporal.PlainDate.compare(date, end) <= 0;
|
|
4293
|
+
}
|
|
4294
|
+
if (!pendingFrom && fromDate && toDate) {
|
|
4295
|
+
return import_polyfill.Temporal.PlainDate.compare(date, fromDate) >= 0 && import_polyfill.Temporal.PlainDate.compare(date, toDate) <= 0;
|
|
4296
|
+
}
|
|
4297
|
+
return false;
|
|
4298
|
+
}
|
|
4299
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4300
|
+
"div",
|
|
4301
|
+
{
|
|
4302
|
+
id,
|
|
4303
|
+
"data-testid": testid,
|
|
4304
|
+
className: (0, import_clsx19.default)(
|
|
4305
|
+
"relative bg-background-grouped-primary-normal rounded-base w-fit",
|
|
4306
|
+
layoutPaddding,
|
|
4307
|
+
layoutGap,
|
|
4308
|
+
cardStyle && "shadow-4",
|
|
4309
|
+
// baseTransition,
|
|
4310
|
+
"overflow-hidden"
|
|
4311
|
+
),
|
|
4312
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4313
|
+
"div",
|
|
4314
|
+
{
|
|
4315
|
+
className: (0, import_clsx19.default)(
|
|
4316
|
+
"flex flex-row items-start justify-start bg-background-primary-normal overflow-clip",
|
|
4317
|
+
layoutGap
|
|
4318
|
+
),
|
|
4319
|
+
children: (mode === "double" ? [0, 1] : [0]).map((offset, idx) => {
|
|
4320
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4321
|
+
CalendarPane,
|
|
4322
|
+
{
|
|
4323
|
+
getMonthData,
|
|
4324
|
+
getMonthDataWith,
|
|
4325
|
+
offset,
|
|
4326
|
+
idx,
|
|
4327
|
+
id,
|
|
4328
|
+
testid,
|
|
4329
|
+
baseMonth,
|
|
4330
|
+
setBaseMonth,
|
|
4331
|
+
mode,
|
|
4332
|
+
pendingFrom,
|
|
4333
|
+
weekDays,
|
|
4334
|
+
fromDate,
|
|
4335
|
+
toDate,
|
|
4336
|
+
isDateAvailable,
|
|
4337
|
+
disableRange,
|
|
4338
|
+
hoveredDate,
|
|
4339
|
+
isInRange,
|
|
4340
|
+
today,
|
|
4341
|
+
setHoveredDate,
|
|
4342
|
+
handleDayClick
|
|
4343
|
+
},
|
|
4344
|
+
idx
|
|
4345
|
+
);
|
|
4346
|
+
})
|
|
4347
|
+
}
|
|
4348
|
+
)
|
|
4349
|
+
}
|
|
4350
|
+
);
|
|
4351
|
+
}
|
|
4352
|
+
function CalendarPane({
|
|
4353
|
+
getMonthData,
|
|
4354
|
+
getMonthDataWith,
|
|
4355
|
+
offset,
|
|
4356
|
+
idx,
|
|
4357
|
+
id,
|
|
4358
|
+
testid,
|
|
4359
|
+
baseMonth,
|
|
4360
|
+
setBaseMonth,
|
|
4361
|
+
mode,
|
|
4362
|
+
pendingFrom,
|
|
4363
|
+
weekDays,
|
|
4364
|
+
fromDate,
|
|
4365
|
+
toDate,
|
|
4366
|
+
isDateAvailable,
|
|
4367
|
+
disableRange,
|
|
4368
|
+
hoveredDate,
|
|
4369
|
+
isInRange,
|
|
4370
|
+
today,
|
|
4371
|
+
setHoveredDate,
|
|
4372
|
+
handleDayClick
|
|
4373
|
+
}) {
|
|
4374
|
+
const months = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
|
|
4375
|
+
const years = Array.from({ length: 100 }).map(
|
|
4376
|
+
(_, i) => baseMonth.year - 50 + i
|
|
4377
|
+
);
|
|
4378
|
+
const [monthMenuOpen, setMonthMenuOpen] = (0, import_react18.useState)(false);
|
|
4379
|
+
const [yearMenuOpen, setYearMenuOpen] = (0, import_react18.useState)(false);
|
|
4380
|
+
const monthMenuRef = (0, import_react18.useRef)(null);
|
|
4381
|
+
const yearMenuRef = (0, import_react18.useRef)(null);
|
|
4382
|
+
const month = getMonthData(offset);
|
|
4383
|
+
const totalCells = 42;
|
|
4384
|
+
const emptyCells = month.firstDayOffset;
|
|
4385
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react18.default.Fragment, { children: [
|
|
4386
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
4387
|
+
"div",
|
|
4388
|
+
{
|
|
4389
|
+
className: (0, import_clsx19.default)("flex flex-col"),
|
|
4390
|
+
children: [
|
|
4391
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
4392
|
+
"div",
|
|
4393
|
+
{
|
|
4394
|
+
className: (0, import_clsx19.default)(
|
|
4395
|
+
"flex flex-row items-center justify-between",
|
|
4396
|
+
typography.label,
|
|
4397
|
+
"text-text-action-primary-normal"
|
|
4398
|
+
),
|
|
4399
|
+
children: [
|
|
4400
|
+
idx === 0 ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4401
|
+
"button",
|
|
4402
|
+
{
|
|
4403
|
+
id: id ? `${id}-prev-month-button` : void 0,
|
|
4404
|
+
"data-testid": testid ? `${testid}-prev-month-button` : void 0,
|
|
4405
|
+
type: "button",
|
|
4406
|
+
className: (0, import_clsx19.default)(
|
|
4407
|
+
"flex items-center justify-center rounded-base hover:bg-action-100 active:bg-action-300 text-icon-action-primary-normal",
|
|
4408
|
+
componentPadding
|
|
4409
|
+
),
|
|
4410
|
+
"aria-label": "Previous month",
|
|
4411
|
+
onClick: () => setBaseMonth(baseMonth.subtract({ months: 1 })),
|
|
4412
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Icon, { name: "chevron_left", size: 24 })
|
|
4413
|
+
}
|
|
4414
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: (0, import_clsx19.default)(componentPadding, "mr-1") }),
|
|
4415
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex gap-desktop-compact-component-padding", children: [
|
|
4416
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4417
|
+
"button",
|
|
4418
|
+
{
|
|
4419
|
+
ref: (el) => {
|
|
4420
|
+
monthMenuRef.current = el;
|
|
4421
|
+
},
|
|
4422
|
+
type: "button",
|
|
4423
|
+
onClick: () => {
|
|
4424
|
+
setMonthMenuOpen(true);
|
|
4425
|
+
setYearMenuOpen(false);
|
|
4426
|
+
},
|
|
4427
|
+
className: "font-semibold text-text-action-primary-normal text-[14px] py-[2px] truncate",
|
|
4428
|
+
children: month.name
|
|
4429
|
+
}
|
|
4430
|
+
),
|
|
4431
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4432
|
+
Menu,
|
|
4433
|
+
{
|
|
4434
|
+
show: monthMenuOpen,
|
|
4435
|
+
positionTo: monthMenuRef,
|
|
4436
|
+
setShow: () => setMonthMenuOpen(false),
|
|
4437
|
+
children: months.map((x) => [x, getMonthDataWith(x + 1)]).map(([x, m]) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4438
|
+
MenuOption,
|
|
4439
|
+
{
|
|
4440
|
+
selected: baseMonth.month === x + 1,
|
|
4441
|
+
onClick: () => {
|
|
4442
|
+
setBaseMonth(baseMonth.with({ month: x + 1 }));
|
|
4443
|
+
setMonthMenuOpen(false);
|
|
4444
|
+
},
|
|
4445
|
+
children: m.name
|
|
4446
|
+
},
|
|
4447
|
+
m.name
|
|
4448
|
+
))
|
|
4449
|
+
}
|
|
4450
|
+
),
|
|
4451
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4452
|
+
"button",
|
|
4453
|
+
{
|
|
4454
|
+
ref: (el) => {
|
|
4455
|
+
yearMenuRef.current = el;
|
|
4456
|
+
},
|
|
4457
|
+
type: "button",
|
|
4458
|
+
onClick: () => {
|
|
4459
|
+
setYearMenuOpen(true);
|
|
4460
|
+
setMonthMenuOpen(false);
|
|
4461
|
+
},
|
|
4462
|
+
className: "font-semibold text-text-action-primary-normal text-[14px] py-[2px] truncate",
|
|
4463
|
+
children: month.year
|
|
4464
|
+
}
|
|
4465
|
+
),
|
|
4466
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4467
|
+
Menu,
|
|
4468
|
+
{
|
|
4469
|
+
show: yearMenuOpen,
|
|
4470
|
+
positionTo: yearMenuRef,
|
|
4471
|
+
setShow: () => setYearMenuOpen(false),
|
|
4472
|
+
children: years.map((y) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4473
|
+
MenuOption,
|
|
4474
|
+
{
|
|
4475
|
+
selected: baseMonth.year === y,
|
|
4476
|
+
onClick: () => {
|
|
4477
|
+
setBaseMonth(baseMonth.with({ year: y }));
|
|
4478
|
+
setYearMenuOpen(false);
|
|
4479
|
+
},
|
|
4480
|
+
children: y
|
|
4481
|
+
},
|
|
4482
|
+
y
|
|
4483
|
+
))
|
|
4484
|
+
}
|
|
4485
|
+
)
|
|
4486
|
+
] }),
|
|
4487
|
+
(mode === "double" ? idx === 1 : true) ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4488
|
+
"button",
|
|
4489
|
+
{
|
|
4490
|
+
id: id ? `${id}-next-month-button` : void 0,
|
|
4491
|
+
"data-testid": testid ? `${testid}-next-month-button` : void 0,
|
|
4492
|
+
type: "button",
|
|
4493
|
+
className: (0, import_clsx19.default)(
|
|
4494
|
+
"flex items-center justify-center rounded-base hover:bg-action-100 active:bg-action-300 text-icon-action-primary-normal",
|
|
4495
|
+
componentPadding
|
|
4496
|
+
),
|
|
4497
|
+
"aria-label": "Next month",
|
|
4498
|
+
onClick: () => setBaseMonth(baseMonth.add({ months: 1 })),
|
|
4499
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Icon, { name: "chevron_right", size: 24 })
|
|
4500
|
+
}
|
|
4501
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: (0, import_clsx19.default)(componentPadding, "ml-1") })
|
|
4502
|
+
]
|
|
4503
|
+
}
|
|
4504
|
+
),
|
|
4505
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: (0, import_clsx19.default)("grid grid-cols-7"), children: weekDays.map((d) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4506
|
+
"span",
|
|
4507
|
+
{
|
|
4508
|
+
className: (0, import_clsx19.default)(
|
|
4509
|
+
typography.caption,
|
|
4510
|
+
"text-text-secondary-normal text-center",
|
|
4511
|
+
"w-10"
|
|
4512
|
+
),
|
|
4513
|
+
children: d
|
|
4514
|
+
},
|
|
4515
|
+
d
|
|
4516
|
+
)) }),
|
|
4517
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: (0, import_clsx19.default)("grid grid-cols-7"), children: Array.from({ length: totalCells }).map((_, i) => {
|
|
4518
|
+
const day = i - emptyCells + 1;
|
|
4519
|
+
const date = month.date.with({ day: 1 }).add({
|
|
4520
|
+
days: i - emptyCells
|
|
4521
|
+
});
|
|
4522
|
+
const isInMonth = day > 0 && day <= month.days;
|
|
4523
|
+
const isToday = isInMonth && date.equals(today);
|
|
4524
|
+
const isSelected = isInMonth && (!pendingFrom && fromDate && date.equals(fromDate) || !pendingFrom && toDate && date.equals(toDate) || pendingFrom && date.equals(pendingFrom));
|
|
4525
|
+
const inRange = isInMonth && isInRange(date);
|
|
4526
|
+
const isDisabled = !isInMonth || (isDateAvailable ? !isDateAvailable(date) : false);
|
|
4527
|
+
const hoverDateIsBeforePendingFrom = hoveredDate && pendingFrom && import_polyfill.Temporal.PlainDate.compare(hoveredDate, pendingFrom) < 0;
|
|
4528
|
+
const hoverDateIsAfterPendingFrom = hoveredDate && pendingFrom && import_polyfill.Temporal.PlainDate.compare(hoveredDate, pendingFrom) >= 0;
|
|
4529
|
+
const isRangeStart = mode === "single" && disableRange ? false : !pendingFrom && isInMonth && fromDate && date.equals(fromDate) || hoverDateIsAfterPendingFrom && date.equals(pendingFrom);
|
|
4530
|
+
const isRangeEnd = mode === "single" && disableRange ? false : !pendingFrom && isInMonth && toDate && date.equals(toDate) || hoverDateIsBeforePendingFrom && date.equals(pendingFrom);
|
|
4531
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4532
|
+
DateCell,
|
|
4533
|
+
{
|
|
4534
|
+
id: id ? `${id}-date-${date.toString()}` : void 0,
|
|
4535
|
+
testid: testid ? `${testid}-date-${date.toString()}` : void 0,
|
|
4536
|
+
date,
|
|
4537
|
+
isInMonth: !!isInMonth,
|
|
4538
|
+
isToday: !!isToday,
|
|
4539
|
+
isSelected: !!isSelected,
|
|
4540
|
+
inRange: !!inRange,
|
|
4541
|
+
isDisabled: !!isDisabled,
|
|
4542
|
+
onClick: () => handleDayClick(date),
|
|
4543
|
+
onMouseEnter: () => setHoveredDate(date),
|
|
4544
|
+
onMouseLeave: () => setHoveredDate(void 0),
|
|
4545
|
+
isRangeStart: !!isRangeStart,
|
|
4546
|
+
isRangeEnd: !!isRangeEnd,
|
|
4547
|
+
isRangeDisabled: mode === "single" && disableRange,
|
|
4548
|
+
cellPadding: componentPadding
|
|
4549
|
+
},
|
|
4550
|
+
i
|
|
4551
|
+
);
|
|
4552
|
+
}) })
|
|
4553
|
+
]
|
|
4554
|
+
}
|
|
4555
|
+
),
|
|
4556
|
+
mode === "double" && idx === 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4557
|
+
"div",
|
|
4558
|
+
{
|
|
4559
|
+
className: (0, import_clsx19.default)(
|
|
4560
|
+
"self-stretch bg-border-primary-normal rounded-base",
|
|
4561
|
+
// 1px width, full height, matches Figma divider
|
|
4562
|
+
"w-px"
|
|
4563
|
+
)
|
|
4564
|
+
}
|
|
4565
|
+
)
|
|
4566
|
+
] }, month.name + month.year);
|
|
4567
|
+
}
|
|
4038
4568
|
|
|
4039
|
-
// src/components/
|
|
4040
|
-
var import_clsx20 = __toESM(require("clsx"), 1);
|
|
4569
|
+
// src/components/DateInput.tsx
|
|
4041
4570
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
4571
|
+
var DateInput = (_a) => {
|
|
4572
|
+
var _b = _a, {
|
|
4573
|
+
id,
|
|
4574
|
+
testid,
|
|
4575
|
+
value,
|
|
4576
|
+
onChange,
|
|
4577
|
+
placeholder = "MM/DD/YYYY",
|
|
4578
|
+
disabled,
|
|
4579
|
+
readOnly = false,
|
|
4580
|
+
label
|
|
4581
|
+
} = _b, props = __objRest(_b, [
|
|
4582
|
+
"id",
|
|
4583
|
+
"testid",
|
|
4584
|
+
"value",
|
|
4585
|
+
"onChange",
|
|
4586
|
+
"placeholder",
|
|
4587
|
+
"disabled",
|
|
4588
|
+
"readOnly",
|
|
4589
|
+
"label"
|
|
4590
|
+
]);
|
|
4591
|
+
const [visible, setVisible] = (0, import_react19.useState)(false);
|
|
4592
|
+
const [inputValue, setInputValue] = (0, import_react19.useState)("");
|
|
4593
|
+
const [isTyping, setIsTyping] = (0, import_react19.useState)(false);
|
|
4594
|
+
const popoverRef = (0, import_react19.useRef)(null);
|
|
4595
|
+
const triggerRef = (0, import_react19.useRef)(null);
|
|
4596
|
+
const rootRef = (0, import_react19.useRef)(null);
|
|
4597
|
+
const [calendarPosition, setCalendarPosition] = (0, import_react19.useState)({
|
|
4598
|
+
top: 0,
|
|
4599
|
+
left: 0,
|
|
4600
|
+
width: 0
|
|
4601
|
+
});
|
|
4602
|
+
const [from, to] = [value, ""];
|
|
4603
|
+
(0, import_react19.useEffect)(() => {
|
|
4604
|
+
if (!isTyping) {
|
|
4605
|
+
setInputValue(formatDisplayValue(from));
|
|
4606
|
+
}
|
|
4607
|
+
}, [from, isTyping]);
|
|
4608
|
+
(0, import_react19.useLayoutEffect)(() => {
|
|
4609
|
+
if (visible) {
|
|
4610
|
+
updatePosition();
|
|
4611
|
+
}
|
|
4612
|
+
}, [visible]);
|
|
4613
|
+
const updatePosition = () => {
|
|
4614
|
+
if (rootRef.current) {
|
|
4615
|
+
const rect = rootRef.current.getBoundingClientRect();
|
|
4616
|
+
setCalendarPosition({
|
|
4617
|
+
top: rect.bottom + window.scrollY,
|
|
4618
|
+
left: rect.left + window.scrollX,
|
|
4619
|
+
width: rect.width
|
|
4620
|
+
});
|
|
4621
|
+
}
|
|
4622
|
+
};
|
|
4623
|
+
(0, import_react19.useEffect)(() => {
|
|
4624
|
+
updatePosition();
|
|
4625
|
+
const resizeObserver = new ResizeObserver(updatePosition);
|
|
4626
|
+
if (triggerRef.current) {
|
|
4627
|
+
resizeObserver.observe(triggerRef.current);
|
|
4628
|
+
}
|
|
4629
|
+
window.addEventListener("scroll", updatePosition);
|
|
4630
|
+
return () => {
|
|
4631
|
+
resizeObserver.disconnect();
|
|
4632
|
+
window.removeEventListener("scroll", updatePosition);
|
|
4633
|
+
};
|
|
4634
|
+
}, []);
|
|
4635
|
+
(0, import_react19.useEffect)(() => {
|
|
4636
|
+
const handleKeyDown2 = (event) => {
|
|
4637
|
+
var _a2;
|
|
4638
|
+
if (event.key === "Escape" && popoverRef.current) {
|
|
4639
|
+
setVisible(false);
|
|
4640
|
+
(_a2 = triggerRef.current) == null ? void 0 : _a2.blur();
|
|
4641
|
+
}
|
|
4642
|
+
};
|
|
4643
|
+
document.addEventListener("keydown", handleKeyDown2);
|
|
4644
|
+
return () => {
|
|
4645
|
+
document.removeEventListener("keydown", handleKeyDown2);
|
|
4646
|
+
};
|
|
4647
|
+
});
|
|
4648
|
+
(0, import_react19.useEffect)(() => {
|
|
4649
|
+
const handleClickOutside = (event) => {
|
|
4650
|
+
if (popoverRef.current && !popoverRef.current.contains(event.target) && triggerRef.current && !triggerRef.current.contains(event.target)) {
|
|
4651
|
+
setVisible(false);
|
|
4652
|
+
}
|
|
4653
|
+
};
|
|
4654
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
4655
|
+
return () => {
|
|
4656
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
4657
|
+
};
|
|
4658
|
+
}, []);
|
|
4659
|
+
function handleDateChange(fromValue) {
|
|
4660
|
+
onChange(fromValue);
|
|
4661
|
+
setVisible(false);
|
|
4662
|
+
setIsTyping(false);
|
|
4663
|
+
}
|
|
4664
|
+
const handleFocus = () => {
|
|
4665
|
+
if (readOnly) return;
|
|
4666
|
+
setVisible(true);
|
|
4667
|
+
};
|
|
4668
|
+
const handleClick = () => {
|
|
4669
|
+
handleFocus();
|
|
4670
|
+
};
|
|
4671
|
+
const handleInputChange = (event) => {
|
|
4672
|
+
if (readOnly) return;
|
|
4673
|
+
const rawValue = event.target.value;
|
|
4674
|
+
const cursorPosition = event.target.selectionStart || 0;
|
|
4675
|
+
setIsTyping(true);
|
|
4676
|
+
const formattedValue = formatInputValue(rawValue);
|
|
4677
|
+
setInputValue(formattedValue);
|
|
4678
|
+
requestAnimationFrame(() => {
|
|
4679
|
+
if (triggerRef.current) {
|
|
4680
|
+
const newPosition = calculateCursorPosition(
|
|
4681
|
+
rawValue,
|
|
4682
|
+
formattedValue,
|
|
4683
|
+
cursorPosition
|
|
4684
|
+
);
|
|
4685
|
+
triggerRef.current.setSelectionRange(newPosition, newPosition);
|
|
4686
|
+
}
|
|
4687
|
+
});
|
|
4688
|
+
const parsedDate = parseInputDate(formattedValue);
|
|
4689
|
+
if (parsedDate && isValidDate(parsedDate)) {
|
|
4690
|
+
onChange(parsedDate);
|
|
4691
|
+
}
|
|
4692
|
+
};
|
|
4693
|
+
const handleBlur = () => {
|
|
4694
|
+
setIsTyping(false);
|
|
4695
|
+
const parsedDate = parseInputDate(inputValue);
|
|
4696
|
+
if (!parsedDate || !isValidDate(parsedDate)) {
|
|
4697
|
+
setInputValue(formatDisplayValue(from));
|
|
4698
|
+
}
|
|
4699
|
+
};
|
|
4700
|
+
const handleKeyDown = (event) => {
|
|
4701
|
+
if (event.key === "Backspace") {
|
|
4702
|
+
const input = event.target;
|
|
4703
|
+
const cursorPosition = input.selectionStart || 0;
|
|
4704
|
+
const value2 = input.value;
|
|
4705
|
+
if (cursorPosition > 0 && value2[cursorPosition - 1] === "/") {
|
|
4706
|
+
event.preventDefault();
|
|
4707
|
+
const newValue = value2.slice(0, cursorPosition - 2) + value2.slice(cursorPosition);
|
|
4708
|
+
const formattedValue = formatInputValue(newValue);
|
|
4709
|
+
setInputValue(formattedValue);
|
|
4710
|
+
requestAnimationFrame(() => {
|
|
4711
|
+
if (triggerRef.current) {
|
|
4712
|
+
const newPosition = Math.max(0, cursorPosition - 2);
|
|
4713
|
+
triggerRef.current.setSelectionRange(newPosition, newPosition);
|
|
4714
|
+
}
|
|
4715
|
+
});
|
|
4716
|
+
setIsTyping(true);
|
|
4717
|
+
return;
|
|
4718
|
+
}
|
|
4719
|
+
}
|
|
4720
|
+
if (event.key === "Enter") {
|
|
4721
|
+
const parsedDate = parseInputDate(inputValue);
|
|
4722
|
+
if (parsedDate && isValidDate(parsedDate)) {
|
|
4723
|
+
onChange(parsedDate);
|
|
4724
|
+
setVisible(false);
|
|
4725
|
+
setIsTyping(false);
|
|
4726
|
+
}
|
|
4727
|
+
}
|
|
4728
|
+
};
|
|
4729
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "relative", children: [
|
|
4730
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4731
|
+
InputBase,
|
|
4732
|
+
__spreadProps(__spreadValues({
|
|
4733
|
+
id,
|
|
4734
|
+
testid,
|
|
4735
|
+
ref: (el) => {
|
|
4736
|
+
triggerRef.current = el;
|
|
4737
|
+
}
|
|
4738
|
+
}, props), {
|
|
4739
|
+
wrapperRef: rootRef,
|
|
4740
|
+
value: inputValue,
|
|
4741
|
+
placeholder,
|
|
4742
|
+
disabled,
|
|
4743
|
+
readOnly,
|
|
4744
|
+
after: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Icon, { name: "calendar_month" }),
|
|
4745
|
+
onFocus: handleFocus,
|
|
4746
|
+
onClick: handleClick,
|
|
4747
|
+
onChange: handleInputChange,
|
|
4748
|
+
onBlur: handleBlur,
|
|
4749
|
+
onKeyDown: handleKeyDown,
|
|
4750
|
+
label,
|
|
4751
|
+
secondaryIconColor: true
|
|
4752
|
+
})
|
|
4753
|
+
),
|
|
4754
|
+
visible && !readOnly && (0, import_react_dom3.createPortal)(
|
|
4755
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4756
|
+
"div",
|
|
4757
|
+
{
|
|
4758
|
+
ref: (el) => {
|
|
4759
|
+
popoverRef.current = el;
|
|
4760
|
+
},
|
|
4761
|
+
className: "absolute z-40 bg-white",
|
|
4762
|
+
style: {
|
|
4763
|
+
top: `${calendarPosition.top + 4}px`,
|
|
4764
|
+
left: `${calendarPosition.left}px`,
|
|
4765
|
+
minWidth: `${calendarPosition.width}px`
|
|
4766
|
+
},
|
|
4767
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4768
|
+
CalendarRange,
|
|
4769
|
+
{
|
|
4770
|
+
id: id ? `${id}-calendar` : void 0,
|
|
4771
|
+
testid: testid ? `${testid}-calendar` : void 0,
|
|
4772
|
+
from,
|
|
4773
|
+
to: to || from,
|
|
4774
|
+
onChange: handleDateChange,
|
|
4775
|
+
cardStyle: true,
|
|
4776
|
+
mode: "single",
|
|
4777
|
+
disableRange: true
|
|
4778
|
+
}
|
|
4779
|
+
)
|
|
4780
|
+
}
|
|
4781
|
+
),
|
|
4782
|
+
findDocumentRoot(popoverRef.current)
|
|
4783
|
+
)
|
|
4784
|
+
] });
|
|
4785
|
+
};
|
|
4786
|
+
DateInput.displayName = "DateInput";
|
|
4787
|
+
function formatDisplayValue(from) {
|
|
4788
|
+
if (!from) {
|
|
4789
|
+
return "";
|
|
4790
|
+
}
|
|
4791
|
+
if (!isValidDate(from)) {
|
|
4792
|
+
return "";
|
|
4793
|
+
}
|
|
4794
|
+
return formatDate(from);
|
|
4795
|
+
}
|
|
4042
4796
|
|
|
4043
4797
|
// src/components/Accordion.tsx
|
|
4798
|
+
var import_clsx22 = __toESM(require("clsx"), 1);
|
|
4799
|
+
|
|
4800
|
+
// src/components/Card.tsx
|
|
4801
|
+
var import_clsx20 = __toESM(require("clsx"), 1);
|
|
4044
4802
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
4045
4803
|
|
|
4046
|
-
// src/components/
|
|
4047
|
-
var
|
|
4804
|
+
// src/components/Stack.tsx
|
|
4805
|
+
var import_clsx21 = __toESM(require("clsx"), 1);
|
|
4048
4806
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
4807
|
+
|
|
4808
|
+
// src/components/Accordion.tsx
|
|
4809
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4810
|
+
|
|
4811
|
+
// src/components/Heading.tsx
|
|
4812
|
+
var import_clsx23 = __toESM(require("clsx"), 1);
|
|
4813
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
4049
4814
|
var Heading = (_a) => {
|
|
4050
4815
|
var _b = _a, {
|
|
4051
4816
|
className,
|
|
@@ -4068,12 +4833,12 @@ var Heading = (_a) => {
|
|
|
4068
4833
|
]);
|
|
4069
4834
|
const defaultElement = variant === "heading1" ? "h1" : variant === "heading2" ? "h2" : "h3";
|
|
4070
4835
|
const Element = as != null ? as : defaultElement;
|
|
4071
|
-
return /* @__PURE__ */ (0,
|
|
4836
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4072
4837
|
Element,
|
|
4073
4838
|
__spreadProps(__spreadValues({
|
|
4074
4839
|
id,
|
|
4075
4840
|
"data-testid": testid,
|
|
4076
|
-
className: (0,
|
|
4841
|
+
className: (0, import_clsx23.default)(
|
|
4077
4842
|
typography[variant],
|
|
4078
4843
|
className,
|
|
4079
4844
|
align === "left" && "text-left",
|
|
@@ -4089,43 +4854,43 @@ var Heading = (_a) => {
|
|
|
4089
4854
|
);
|
|
4090
4855
|
};
|
|
4091
4856
|
Heading.displayName = "Heading";
|
|
4092
|
-
var Heading1 = (props) => /* @__PURE__ */ (0,
|
|
4093
|
-
var Heading2 = (props) => /* @__PURE__ */ (0,
|
|
4094
|
-
var Heading3 = (props) => /* @__PURE__ */ (0,
|
|
4857
|
+
var Heading1 = (props) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Heading, __spreadProps(__spreadValues({}, props), { variant: "heading1" }));
|
|
4858
|
+
var Heading2 = (props) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Heading, __spreadProps(__spreadValues({}, props), { variant: "heading2" }));
|
|
4859
|
+
var Heading3 = (props) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Heading, __spreadProps(__spreadValues({}, props), { variant: "heading3" }));
|
|
4095
4860
|
Heading1.displayName = "Heading1";
|
|
4096
4861
|
Heading2.displayName = "Heading2";
|
|
4097
4862
|
Heading3.displayName = "Heading3";
|
|
4098
4863
|
|
|
4099
4864
|
// src/components/Theme.tsx
|
|
4100
|
-
var
|
|
4865
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
4101
4866
|
|
|
4102
4867
|
// src/components/MobileDataGrid/ColumnSelector/index.tsx
|
|
4103
|
-
var
|
|
4868
|
+
var import_react22 = require("react");
|
|
4104
4869
|
|
|
4105
4870
|
// src/components/MobileDataGrid/GridContextProvider/useGridContext.ts
|
|
4106
|
-
var
|
|
4871
|
+
var import_react21 = require("react");
|
|
4107
4872
|
|
|
4108
4873
|
// src/components/MobileDataGrid/GridContextProvider/GridContext.tsx
|
|
4109
|
-
var
|
|
4110
|
-
var GridContext = (0,
|
|
4874
|
+
var import_react20 = require("react");
|
|
4875
|
+
var GridContext = (0, import_react20.createContext)(null);
|
|
4111
4876
|
|
|
4112
4877
|
// src/components/MobileDataGrid/ColumnSelector/index.tsx
|
|
4113
|
-
var
|
|
4878
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
4114
4879
|
|
|
4115
4880
|
// src/components/MobileDataGrid/MobileDataGridHeader.tsx
|
|
4116
|
-
var
|
|
4881
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
4117
4882
|
|
|
4118
4883
|
// src/components/MobileDataGrid/GridContextProvider/index.tsx
|
|
4119
|
-
var
|
|
4120
|
-
var
|
|
4884
|
+
var import_react23 = require("react");
|
|
4885
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
4121
4886
|
|
|
4122
4887
|
// src/components/Modal.tsx
|
|
4123
|
-
var
|
|
4124
|
-
var
|
|
4888
|
+
var import_clsx28 = __toESM(require("clsx"), 1);
|
|
4889
|
+
var import_react25 = require("react");
|
|
4125
4890
|
|
|
4126
4891
|
// src/components/ModalHeader.tsx
|
|
4127
|
-
var
|
|
4128
|
-
var
|
|
4892
|
+
var import_clsx24 = __toESM(require("clsx"), 1);
|
|
4893
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
4129
4894
|
var ModalHeader = ({
|
|
4130
4895
|
title,
|
|
4131
4896
|
hideCloseIcon,
|
|
@@ -4136,12 +4901,12 @@ var ModalHeader = ({
|
|
|
4136
4901
|
testid,
|
|
4137
4902
|
headerClassname
|
|
4138
4903
|
}) => {
|
|
4139
|
-
return /* @__PURE__ */ (0,
|
|
4904
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
4140
4905
|
"div",
|
|
4141
4906
|
{
|
|
4142
4907
|
id,
|
|
4143
4908
|
"data-testid": testid,
|
|
4144
|
-
className: (0,
|
|
4909
|
+
className: (0, import_clsx24.default)(
|
|
4145
4910
|
"flex justify-between items-center",
|
|
4146
4911
|
headerIconAlign === "center" && "justify-center",
|
|
4147
4912
|
headerIconAlign === "right" && "justify-end",
|
|
@@ -4151,9 +4916,9 @@ var ModalHeader = ({
|
|
|
4151
4916
|
headerClassname
|
|
4152
4917
|
),
|
|
4153
4918
|
children: [
|
|
4154
|
-
/* @__PURE__ */ (0,
|
|
4919
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: (0, import_clsx24.default)("flex items-center flex-1", layoutGroupGap), children: [
|
|
4155
4920
|
headerIcon,
|
|
4156
|
-
title && /* @__PURE__ */ (0,
|
|
4921
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4157
4922
|
Heading2,
|
|
4158
4923
|
{
|
|
4159
4924
|
id: id ? `${id}-title` : void 0,
|
|
@@ -4163,7 +4928,7 @@ var ModalHeader = ({
|
|
|
4163
4928
|
}
|
|
4164
4929
|
)
|
|
4165
4930
|
] }),
|
|
4166
|
-
!hideCloseIcon && /* @__PURE__ */ (0,
|
|
4931
|
+
!hideCloseIcon && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4167
4932
|
Button,
|
|
4168
4933
|
{
|
|
4169
4934
|
id: id ? `${id}-close-button` : void 0,
|
|
@@ -4171,7 +4936,7 @@ var ModalHeader = ({
|
|
|
4171
4936
|
iconOnly: true,
|
|
4172
4937
|
variant: "tertiary",
|
|
4173
4938
|
onClick: onClose,
|
|
4174
|
-
leftIcon: /* @__PURE__ */ (0,
|
|
4939
|
+
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 }) })
|
|
4175
4940
|
}
|
|
4176
4941
|
)
|
|
4177
4942
|
]
|
|
@@ -4181,20 +4946,20 @@ var ModalHeader = ({
|
|
|
4181
4946
|
ModalHeader.displayName = "ModalHeader";
|
|
4182
4947
|
|
|
4183
4948
|
// src/components/ModalContent.tsx
|
|
4184
|
-
var
|
|
4185
|
-
var
|
|
4949
|
+
var import_clsx25 = __toESM(require("clsx"), 1);
|
|
4950
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
4186
4951
|
function ModalContent({
|
|
4187
4952
|
fixedHeightScrolling,
|
|
4188
4953
|
children,
|
|
4189
4954
|
id,
|
|
4190
4955
|
testid
|
|
4191
4956
|
}) {
|
|
4192
|
-
return /* @__PURE__ */ (0,
|
|
4957
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4193
4958
|
"div",
|
|
4194
4959
|
{
|
|
4195
4960
|
id,
|
|
4196
4961
|
"data-testid": testid,
|
|
4197
|
-
className: (0,
|
|
4962
|
+
className: (0, import_clsx25.default)(
|
|
4198
4963
|
"flex-grow desktop:flex-grow-0",
|
|
4199
4964
|
layoutPaddding,
|
|
4200
4965
|
fixedHeightScrolling && "overflow-auto"
|
|
@@ -4206,8 +4971,8 @@ function ModalContent({
|
|
|
4206
4971
|
ModalContent.displayName = "ModalContent";
|
|
4207
4972
|
|
|
4208
4973
|
// src/components/ModalButtons.tsx
|
|
4209
|
-
var
|
|
4210
|
-
var
|
|
4974
|
+
var import_clsx26 = __toESM(require("clsx"), 1);
|
|
4975
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
4211
4976
|
var ModalButtons = ({
|
|
4212
4977
|
onClose,
|
|
4213
4978
|
onContinue,
|
|
@@ -4215,36 +4980,36 @@ var ModalButtons = ({
|
|
|
4215
4980
|
id,
|
|
4216
4981
|
testid
|
|
4217
4982
|
}) => {
|
|
4218
|
-
return /* @__PURE__ */ (0,
|
|
4983
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4219
4984
|
"div",
|
|
4220
4985
|
{
|
|
4221
4986
|
id,
|
|
4222
4987
|
"data-testid": testid,
|
|
4223
|
-
className: (0,
|
|
4988
|
+
className: (0, import_clsx26.default)(
|
|
4224
4989
|
"border-t border-neutral-300 flex justify-end",
|
|
4225
4990
|
layoutPaddding,
|
|
4226
4991
|
layoutGroupGap
|
|
4227
4992
|
),
|
|
4228
|
-
children: customActions != null ? customActions : /* @__PURE__ */ (0,
|
|
4229
|
-
/* @__PURE__ */ (0,
|
|
4993
|
+
children: customActions != null ? customActions : /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
4994
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4230
4995
|
Button,
|
|
4231
4996
|
{
|
|
4232
4997
|
id: id ? `${id}-close-button` : void 0,
|
|
4233
4998
|
testid: testid ? `${testid}-close-button` : void 0,
|
|
4234
4999
|
variant: "secondary",
|
|
4235
|
-
leftIcon: /* @__PURE__ */ (0,
|
|
5000
|
+
leftIcon: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Icon, { name: "close", size: 24 }),
|
|
4236
5001
|
onClick: onClose,
|
|
4237
5002
|
className: "max-sm:w-full",
|
|
4238
5003
|
children: "Close"
|
|
4239
5004
|
}
|
|
4240
5005
|
),
|
|
4241
|
-
/* @__PURE__ */ (0,
|
|
5006
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4242
5007
|
Button,
|
|
4243
5008
|
{
|
|
4244
5009
|
id: id ? `${id}-continue-button` : void 0,
|
|
4245
5010
|
testid: testid ? `${testid}-continue-button` : void 0,
|
|
4246
5011
|
variant: "primary",
|
|
4247
|
-
leftIcon: /* @__PURE__ */ (0,
|
|
5012
|
+
leftIcon: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Icon, { name: "check", size: 24 }),
|
|
4248
5013
|
className: "max-sm:w-full",
|
|
4249
5014
|
onClick: onContinue,
|
|
4250
5015
|
children: "Continue"
|
|
@@ -4257,8 +5022,8 @@ var ModalButtons = ({
|
|
|
4257
5022
|
ModalButtons.displayName = "ModalButtons";
|
|
4258
5023
|
|
|
4259
5024
|
// src/components/ModalScrim.tsx
|
|
4260
|
-
var
|
|
4261
|
-
var
|
|
5025
|
+
var import_clsx27 = __toESM(require("clsx"), 1);
|
|
5026
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
4262
5027
|
var ModalScrim = ({
|
|
4263
5028
|
show = false,
|
|
4264
5029
|
size = "small",
|
|
@@ -4268,12 +5033,12 @@ var ModalScrim = ({
|
|
|
4268
5033
|
id,
|
|
4269
5034
|
testid
|
|
4270
5035
|
}) => {
|
|
4271
|
-
return /* @__PURE__ */ (0,
|
|
5036
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4272
5037
|
"div",
|
|
4273
5038
|
{
|
|
4274
5039
|
id,
|
|
4275
5040
|
"data-testid": testid,
|
|
4276
|
-
className: (0,
|
|
5041
|
+
className: (0, import_clsx27.default)(
|
|
4277
5042
|
"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",
|
|
4278
5043
|
!show && " pointer-events-none",
|
|
4279
5044
|
size === "small" && "p-4",
|
|
@@ -4289,14 +5054,14 @@ var ModalScrim = ({
|
|
|
4289
5054
|
ModalScrim.displayName = "ModalScrim";
|
|
4290
5055
|
|
|
4291
5056
|
// src/components/Modal.tsx
|
|
4292
|
-
var
|
|
5057
|
+
var import_react_dom4 = require("react-dom");
|
|
4293
5058
|
var import_react_use = require("react-use");
|
|
4294
5059
|
|
|
4295
5060
|
// src/components/useMounted.tsx
|
|
4296
|
-
var
|
|
5061
|
+
var import_react24 = require("react");
|
|
4297
5062
|
var useMounted = () => {
|
|
4298
|
-
const [isMounted, setIsMounted] = (0,
|
|
4299
|
-
(0,
|
|
5063
|
+
const [isMounted, setIsMounted] = (0, import_react24.useState)(false);
|
|
5064
|
+
(0, import_react24.useEffect)(() => {
|
|
4300
5065
|
setIsMounted(true);
|
|
4301
5066
|
return () => setIsMounted(false);
|
|
4302
5067
|
}, []);
|
|
@@ -4304,7 +5069,7 @@ var useMounted = () => {
|
|
|
4304
5069
|
};
|
|
4305
5070
|
|
|
4306
5071
|
// src/components/Modal.tsx
|
|
4307
|
-
var
|
|
5072
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
4308
5073
|
var fadeInScale = (element, duration = 300) => element.animate(
|
|
4309
5074
|
[
|
|
4310
5075
|
{ opacity: 0, transform: "scale(0.95)" },
|
|
@@ -4388,12 +5153,12 @@ var Modal = ({
|
|
|
4388
5153
|
}) => {
|
|
4389
5154
|
var _a;
|
|
4390
5155
|
const mounted = useMounted();
|
|
4391
|
-
const modalRef = (0,
|
|
4392
|
-
const bgRef = (0,
|
|
5156
|
+
const modalRef = (0, import_react25.useRef)(null);
|
|
5157
|
+
const bgRef = (0, import_react25.useRef)(null);
|
|
4393
5158
|
const wasOpen = (0, import_react_use.usePrevious)(open);
|
|
4394
5159
|
const isMobile = useMatchesMobile();
|
|
4395
5160
|
const computedFixedHeightScrolling = isMobile || fixedHeightScrolling;
|
|
4396
|
-
(0,
|
|
5161
|
+
(0, import_react25.useEffect)(() => {
|
|
4397
5162
|
if (!mounted) return;
|
|
4398
5163
|
if (!modalRef.current || !bgRef.current) {
|
|
4399
5164
|
console.error("Modal or background reference is not set.");
|
|
@@ -4413,7 +5178,7 @@ var Modal = ({
|
|
|
4413
5178
|
bgFadeIn(bgRef.current);
|
|
4414
5179
|
}
|
|
4415
5180
|
}, [mounted, onClose, open, wasOpen]);
|
|
4416
|
-
const handleKeyDown = (0,
|
|
5181
|
+
const handleKeyDown = (0, import_react25.useCallback)(
|
|
4417
5182
|
(e) => {
|
|
4418
5183
|
if (e.key === "Escape") {
|
|
4419
5184
|
if (onClose) {
|
|
@@ -4424,12 +5189,12 @@ var Modal = ({
|
|
|
4424
5189
|
},
|
|
4425
5190
|
[onClose]
|
|
4426
5191
|
);
|
|
4427
|
-
const handleClose = (0,
|
|
5192
|
+
const handleClose = (0, import_react25.useCallback)(() => {
|
|
4428
5193
|
if (onClose) {
|
|
4429
5194
|
onClose();
|
|
4430
5195
|
}
|
|
4431
5196
|
}, [onClose]);
|
|
4432
|
-
(0,
|
|
5197
|
+
(0, import_react25.useEffect)(() => {
|
|
4433
5198
|
if (open) {
|
|
4434
5199
|
document.addEventListener("keyup", handleKeyDown);
|
|
4435
5200
|
}
|
|
@@ -4437,7 +5202,7 @@ var Modal = ({
|
|
|
4437
5202
|
document.removeEventListener("keyup", handleKeyDown);
|
|
4438
5203
|
};
|
|
4439
5204
|
}, [open, handleKeyDown]);
|
|
4440
|
-
(0,
|
|
5205
|
+
(0, import_react25.useEffect)(() => {
|
|
4441
5206
|
if (!open) return;
|
|
4442
5207
|
const scrollY = window.scrollY;
|
|
4443
5208
|
const body = document.body;
|
|
@@ -4458,7 +5223,7 @@ var Modal = ({
|
|
|
4458
5223
|
};
|
|
4459
5224
|
}, [open]);
|
|
4460
5225
|
const { sizeClass } = (_a = sizes[size]) != null ? _a : sizes.small;
|
|
4461
|
-
const backgroundClickHandler = (0,
|
|
5226
|
+
const backgroundClickHandler = (0, import_react25.useCallback)(
|
|
4462
5227
|
(e) => {
|
|
4463
5228
|
const target = e.target;
|
|
4464
5229
|
const currentTarget = e.currentTarget;
|
|
@@ -4475,8 +5240,8 @@ var Modal = ({
|
|
|
4475
5240
|
if (!mounted) {
|
|
4476
5241
|
return null;
|
|
4477
5242
|
}
|
|
4478
|
-
return (0,
|
|
4479
|
-
/* @__PURE__ */ (0,
|
|
5243
|
+
return (0, import_react_dom4.createPortal)(
|
|
5244
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4480
5245
|
ModalScrim,
|
|
4481
5246
|
{
|
|
4482
5247
|
id: id ? `${id}-scrim` : void 0,
|
|
@@ -4485,13 +5250,13 @@ var Modal = ({
|
|
|
4485
5250
|
ref: bgRef,
|
|
4486
5251
|
show: open,
|
|
4487
5252
|
onClick: backgroundClickHandler,
|
|
4488
|
-
children: /* @__PURE__ */ (0,
|
|
5253
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
4489
5254
|
"div",
|
|
4490
5255
|
{
|
|
4491
5256
|
id,
|
|
4492
5257
|
"data-testid": testid,
|
|
4493
5258
|
ref: modalRef,
|
|
4494
|
-
className: (0,
|
|
5259
|
+
className: (0, import_clsx28.default)(
|
|
4495
5260
|
"shadow-md rounded-sm flex flex-col overflow-hidden w-full opacity-0 h-fit",
|
|
4496
5261
|
computedFixedHeightScrolling && size !== "screen" && "desktop:max-h-[calc(100vh-32px)] desktop:h-auto",
|
|
4497
5262
|
className,
|
|
@@ -4500,7 +5265,7 @@ var Modal = ({
|
|
|
4500
5265
|
),
|
|
4501
5266
|
onClick: (e) => e.stopPropagation(),
|
|
4502
5267
|
children: [
|
|
4503
|
-
/* @__PURE__ */ (0,
|
|
5268
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4504
5269
|
ModalHeader,
|
|
4505
5270
|
{
|
|
4506
5271
|
id: id ? `${id}-header` : void 0,
|
|
@@ -4513,7 +5278,7 @@ var Modal = ({
|
|
|
4513
5278
|
headerClassname
|
|
4514
5279
|
}
|
|
4515
5280
|
),
|
|
4516
|
-
children && (size !== "screen" || noWrapper) ? /* @__PURE__ */ (0,
|
|
5281
|
+
children && (size !== "screen" || noWrapper) ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4517
5282
|
ModalContent,
|
|
4518
5283
|
{
|
|
4519
5284
|
id: id ? `${id}-content` : void 0,
|
|
@@ -4522,7 +5287,7 @@ var Modal = ({
|
|
|
4522
5287
|
children
|
|
4523
5288
|
}
|
|
4524
5289
|
) : children,
|
|
4525
|
-
showButtons ? customFooter ? customActions : /* @__PURE__ */ (0,
|
|
5290
|
+
showButtons ? customFooter ? customActions : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4526
5291
|
ModalButtons,
|
|
4527
5292
|
{
|
|
4528
5293
|
id: id ? `${id}-buttons` : void 0,
|
|
@@ -4543,51 +5308,51 @@ var Modal = ({
|
|
|
4543
5308
|
Modal.displayName = "Modal";
|
|
4544
5309
|
|
|
4545
5310
|
// src/components/MobileDataGrid/MobileDataGridCard/MobileDataGridColumn.tsx
|
|
4546
|
-
var
|
|
5311
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
4547
5312
|
|
|
4548
5313
|
// src/components/MobileDataGrid/RowDetailModalProvider/ModalContent.tsx
|
|
4549
|
-
var
|
|
5314
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
4550
5315
|
|
|
4551
5316
|
// src/components/MobileDataGrid/RowDetailModalProvider/index.tsx
|
|
4552
|
-
var
|
|
5317
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
4553
5318
|
|
|
4554
5319
|
// src/components/MobileDataGrid/ColumnList.tsx
|
|
4555
|
-
var
|
|
5320
|
+
var import_clsx30 = __toESM(require("clsx"), 1);
|
|
4556
5321
|
|
|
4557
5322
|
// src/components/MobileDataGrid/MobileDataGridCard/index.tsx
|
|
4558
|
-
var
|
|
4559
|
-
var
|
|
5323
|
+
var import_clsx29 = __toESM(require("clsx"), 1);
|
|
5324
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
4560
5325
|
|
|
4561
5326
|
// src/components/MobileDataGrid/ColumnList.tsx
|
|
4562
|
-
var
|
|
5327
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
4563
5328
|
|
|
4564
5329
|
// src/components/MobileDataGrid/index.tsx
|
|
4565
|
-
var
|
|
5330
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
4566
5331
|
|
|
4567
5332
|
// src/components/ProductImagePreview/Thumbnail.tsx
|
|
4568
|
-
var
|
|
5333
|
+
var import_react27 = require("react");
|
|
4569
5334
|
|
|
4570
5335
|
// src/components/ImagePlaceholder.tsx
|
|
4571
|
-
var
|
|
4572
|
-
var
|
|
5336
|
+
var import_react26 = require("react");
|
|
5337
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
4573
5338
|
|
|
4574
5339
|
// src/components/ProductImagePreview/Thumbnail.tsx
|
|
4575
|
-
var
|
|
5340
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
4576
5341
|
|
|
4577
5342
|
// src/components/Grid.tsx
|
|
4578
|
-
var
|
|
4579
|
-
var
|
|
5343
|
+
var import_clsx31 = __toESM(require("clsx"), 1);
|
|
5344
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
4580
5345
|
|
|
4581
5346
|
// src/components/ProductImagePreview/ProductPrimaryImage.tsx
|
|
4582
|
-
var
|
|
4583
|
-
var
|
|
5347
|
+
var import_react28 = require("react");
|
|
5348
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
4584
5349
|
|
|
4585
5350
|
// src/components/ProductImagePreview/ZoomWindow.tsx
|
|
4586
|
-
var
|
|
5351
|
+
var import_react29 = require("react");
|
|
4587
5352
|
|
|
4588
5353
|
// src/components/Surface.tsx
|
|
4589
|
-
var
|
|
4590
|
-
var
|
|
5354
|
+
var import_clsx32 = __toESM(require("clsx"), 1);
|
|
5355
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
4591
5356
|
var Surface = (_a) => {
|
|
4592
5357
|
var _b = _a, {
|
|
4593
5358
|
children,
|
|
@@ -4600,11 +5365,11 @@ var Surface = (_a) => {
|
|
|
4600
5365
|
"elevation",
|
|
4601
5366
|
"id"
|
|
4602
5367
|
]);
|
|
4603
|
-
return /* @__PURE__ */ (0,
|
|
5368
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
4604
5369
|
"div",
|
|
4605
5370
|
__spreadProps(__spreadValues({
|
|
4606
5371
|
id,
|
|
4607
|
-
className: (0,
|
|
5372
|
+
className: (0, import_clsx32.default)(
|
|
4608
5373
|
"rounded-base",
|
|
4609
5374
|
{
|
|
4610
5375
|
"shadow-2": elevation === 2,
|
|
@@ -4621,43 +5386,43 @@ var Surface = (_a) => {
|
|
|
4621
5386
|
Surface.displayName = "Surface";
|
|
4622
5387
|
|
|
4623
5388
|
// src/components/ProductImagePreview/ZoomWindow.tsx
|
|
4624
|
-
var
|
|
5389
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
4625
5390
|
|
|
4626
5391
|
// src/components/ProductImagePreview/CarouselPagination.tsx
|
|
4627
|
-
var
|
|
4628
|
-
var
|
|
5392
|
+
var import_clsx33 = require("clsx");
|
|
5393
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
4629
5394
|
|
|
4630
5395
|
// src/components/ProductImagePreview/MobileImageCarousel.tsx
|
|
4631
|
-
var
|
|
4632
|
-
var
|
|
5396
|
+
var import_react30 = require("react");
|
|
5397
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
4633
5398
|
|
|
4634
5399
|
// src/components/ProductImagePreview/useProductImagePreview.ts
|
|
4635
|
-
var
|
|
5400
|
+
var import_react31 = require("react");
|
|
4636
5401
|
|
|
4637
5402
|
// src/components/ProductImagePreview/index.tsx
|
|
4638
|
-
var
|
|
5403
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
4639
5404
|
|
|
4640
5405
|
// src/components/CompactImagesPreview.tsx
|
|
4641
|
-
var
|
|
4642
|
-
var
|
|
4643
|
-
var
|
|
5406
|
+
var import_react32 = require("react");
|
|
5407
|
+
var import_clsx34 = __toESM(require("clsx"), 1);
|
|
5408
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
4644
5409
|
|
|
4645
5410
|
// src/components/SimpleTable.tsx
|
|
4646
|
-
var
|
|
4647
|
-
var
|
|
5411
|
+
var import_clsx35 = __toESM(require("clsx"), 1);
|
|
5412
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
4648
5413
|
|
|
4649
5414
|
// src/components/PDFViewer/index.tsx
|
|
4650
|
-
var
|
|
5415
|
+
var import_react35 = require("react");
|
|
4651
5416
|
|
|
4652
5417
|
// src/components/PDFViewer/PDFElement.tsx
|
|
4653
5418
|
var import_react_pdf2 = require("@mikecousins/react-pdf");
|
|
4654
|
-
var
|
|
5419
|
+
var import_react34 = require("react");
|
|
4655
5420
|
|
|
4656
5421
|
// src/components/Spinner.tsx
|
|
4657
|
-
var
|
|
5422
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
4658
5423
|
var Spinner = ({ size = "small", testid }) => {
|
|
4659
5424
|
const dimension = size === "large" ? 48 : 24;
|
|
4660
|
-
return /* @__PURE__ */ (0,
|
|
5425
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
4661
5426
|
"svg",
|
|
4662
5427
|
{
|
|
4663
5428
|
"data-testid": testid,
|
|
@@ -4669,14 +5434,14 @@ var Spinner = ({ size = "small", testid }) => {
|
|
|
4669
5434
|
className: "spinner",
|
|
4670
5435
|
"aria-label": "Loading",
|
|
4671
5436
|
children: [
|
|
4672
|
-
/* @__PURE__ */ (0,
|
|
4673
|
-
/* @__PURE__ */ (0,
|
|
4674
|
-
/* @__PURE__ */ (0,
|
|
4675
|
-
/* @__PURE__ */ (0,
|
|
4676
|
-
/* @__PURE__ */ (0,
|
|
4677
|
-
/* @__PURE__ */ (0,
|
|
4678
|
-
/* @__PURE__ */ (0,
|
|
4679
|
-
/* @__PURE__ */ (0,
|
|
5437
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("circle", { cx: "12", cy: "4", r: "2", opacity: "1" }),
|
|
5438
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("circle", { cx: "17.666", cy: "6.334", r: "2", opacity: "0.125" }),
|
|
5439
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("circle", { cx: "20", cy: "12", r: "2", opacity: "0.25" }),
|
|
5440
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("circle", { cx: "17.666", cy: "17.666", r: "2", opacity: "0.375" }),
|
|
5441
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("circle", { cx: "12", cy: "20", r: "2", opacity: "0.5" }),
|
|
5442
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("circle", { cx: "6.334", cy: "17.666", r: "2", opacity: "0.625" }),
|
|
5443
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("circle", { cx: "4", cy: "12", r: "2", opacity: "0.75" }),
|
|
5444
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("circle", { cx: "6.334", cy: "6.334", r: "2", opacity: "0.875" })
|
|
4680
5445
|
]
|
|
4681
5446
|
}
|
|
4682
5447
|
);
|
|
@@ -4685,31 +5450,31 @@ Spinner.displayName = "Spinner";
|
|
|
4685
5450
|
|
|
4686
5451
|
// src/components/PDFViewer/PDFPage.tsx
|
|
4687
5452
|
var import_react_pdf = require("@mikecousins/react-pdf");
|
|
4688
|
-
var
|
|
4689
|
-
var
|
|
5453
|
+
var import_react33 = require("react");
|
|
5454
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
4690
5455
|
|
|
4691
5456
|
// src/components/PDFViewer/PDFElement.tsx
|
|
4692
|
-
var
|
|
4693
|
-
var
|
|
5457
|
+
var import_clsx36 = __toESM(require("clsx"), 1);
|
|
5458
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
4694
5459
|
|
|
4695
5460
|
// src/components/PDFViewer/DownloadIcon.tsx
|
|
4696
|
-
var
|
|
5461
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
4697
5462
|
|
|
4698
5463
|
// src/components/PDFViewer/PDFNavigation.tsx
|
|
4699
|
-
var
|
|
5464
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
4700
5465
|
|
|
4701
5466
|
// src/components/PDFViewer/index.tsx
|
|
4702
|
-
var
|
|
5467
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
4703
5468
|
|
|
4704
5469
|
// src/components/ListGroup.tsx
|
|
4705
|
-
var
|
|
4706
|
-
var
|
|
4707
|
-
var
|
|
5470
|
+
var import_react36 = require("react");
|
|
5471
|
+
var import_clsx37 = __toESM(require("clsx"), 1);
|
|
5472
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
4708
5473
|
|
|
4709
5474
|
// src/components/Pagination.tsx
|
|
4710
|
-
var
|
|
4711
|
-
var
|
|
4712
|
-
var
|
|
5475
|
+
var import_react37 = require("react");
|
|
5476
|
+
var import_clsx38 = __toESM(require("clsx"), 1);
|
|
5477
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
4713
5478
|
var Pagination = ({
|
|
4714
5479
|
totalPages,
|
|
4715
5480
|
currentPage,
|
|
@@ -4719,7 +5484,7 @@ var Pagination = ({
|
|
|
4719
5484
|
className,
|
|
4720
5485
|
disabled
|
|
4721
5486
|
}) => {
|
|
4722
|
-
const goTo = (0,
|
|
5487
|
+
const goTo = (0, import_react37.useCallback)(
|
|
4723
5488
|
(page) => {
|
|
4724
5489
|
if (disabled) return;
|
|
4725
5490
|
onPageChange(page);
|
|
@@ -4736,7 +5501,7 @@ var Pagination = ({
|
|
|
4736
5501
|
goTo(currentPage + 1);
|
|
4737
5502
|
}
|
|
4738
5503
|
};
|
|
4739
|
-
const pageTokens = (0,
|
|
5504
|
+
const pageTokens = (0, import_react37.useMemo)(() => {
|
|
4740
5505
|
if (totalPages <= 5) {
|
|
4741
5506
|
return Array.from({ length: totalPages }, (_, i) => i + 1);
|
|
4742
5507
|
}
|
|
@@ -4773,7 +5538,7 @@ var Pagination = ({
|
|
|
4773
5538
|
return tokens;
|
|
4774
5539
|
}, [totalPages, currentPage]);
|
|
4775
5540
|
if (totalPages <= 1) return null;
|
|
4776
|
-
const buttonClass = (0,
|
|
5541
|
+
const buttonClass = (0, import_clsx38.default)(
|
|
4777
5542
|
"cursor-pointer disabled:cursor-default",
|
|
4778
5543
|
paddingUsingComponentGap,
|
|
4779
5544
|
"w-8 h-8",
|
|
@@ -4784,14 +5549,14 @@ var Pagination = ({
|
|
|
4784
5549
|
"focus:bg-background-grouped-secondary-normal focus:outline-0",
|
|
4785
5550
|
"disabled:bg-transparent disabled:text-text-action-primary-disabled"
|
|
4786
5551
|
);
|
|
4787
|
-
return /* @__PURE__ */ (0,
|
|
5552
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
4788
5553
|
"nav",
|
|
4789
5554
|
{
|
|
4790
5555
|
id,
|
|
4791
5556
|
"data-testid": testid,
|
|
4792
5557
|
"aria-label": "Pagination",
|
|
4793
5558
|
onKeyDown: handleKey,
|
|
4794
|
-
className: (0,
|
|
5559
|
+
className: (0, import_clsx38.default)(
|
|
4795
5560
|
"flex items-center",
|
|
4796
5561
|
"border border-border-primary-normal",
|
|
4797
5562
|
"bg-background-grouped-primary-normal",
|
|
@@ -4799,19 +5564,19 @@ var Pagination = ({
|
|
|
4799
5564
|
className
|
|
4800
5565
|
),
|
|
4801
5566
|
children: [
|
|
4802
|
-
/* @__PURE__ */ (0,
|
|
5567
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4803
5568
|
"button",
|
|
4804
5569
|
{
|
|
4805
5570
|
disabled: disabled || currentPage <= 1,
|
|
4806
5571
|
"aria-label": "Previous page",
|
|
4807
5572
|
onClick: () => goTo(currentPage - 1),
|
|
4808
|
-
className: (0,
|
|
4809
|
-
children: /* @__PURE__ */ (0,
|
|
5573
|
+
className: (0, import_clsx38.default)(buttonClass, "border-r-1 border-border-primary-normal"),
|
|
5574
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Icon, { name: "keyboard_arrow_left" })
|
|
4810
5575
|
}
|
|
4811
5576
|
),
|
|
4812
|
-
/* @__PURE__ */ (0,
|
|
5577
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("ul", { className: (0, import_clsx38.default)("flex items-center"), children: pageTokens.map((token, index) => {
|
|
4813
5578
|
if (token === "ellipsis") {
|
|
4814
|
-
return /* @__PURE__ */ (0,
|
|
5579
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4815
5580
|
"li",
|
|
4816
5581
|
{
|
|
4817
5582
|
className: "w-8 h-8 select-none text-text-action-primary-disabled",
|
|
@@ -4821,29 +5586,29 @@ var Pagination = ({
|
|
|
4821
5586
|
);
|
|
4822
5587
|
}
|
|
4823
5588
|
const selected = token === currentPage;
|
|
4824
|
-
return /* @__PURE__ */ (0,
|
|
5589
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4825
5590
|
"button",
|
|
4826
5591
|
{
|
|
4827
5592
|
"aria-label": `Page ${token}`,
|
|
4828
5593
|
"aria-current": selected ? "page" : void 0,
|
|
4829
5594
|
disabled,
|
|
4830
5595
|
onClick: () => goTo(token),
|
|
4831
|
-
className: (0,
|
|
5596
|
+
className: (0, import_clsx38.default)(
|
|
4832
5597
|
buttonClass,
|
|
4833
5598
|
selected && "border-x-1 bg-background-grouped-secondary-normal border-border-primary-normal"
|
|
4834
5599
|
),
|
|
4835
|
-
children: /* @__PURE__ */ (0,
|
|
5600
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Subheader, { align: "center", weight: "bold", children: token })
|
|
4836
5601
|
}
|
|
4837
5602
|
) }, token);
|
|
4838
5603
|
}) }),
|
|
4839
|
-
/* @__PURE__ */ (0,
|
|
5604
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4840
5605
|
"button",
|
|
4841
5606
|
{
|
|
4842
5607
|
disabled: disabled || currentPage >= totalPages,
|
|
4843
5608
|
"aria-label": "Next page",
|
|
4844
5609
|
onClick: () => goTo(currentPage + 1),
|
|
4845
|
-
className: (0,
|
|
4846
|
-
children: /* @__PURE__ */ (0,
|
|
5610
|
+
className: (0, import_clsx38.default)(buttonClass, "border-l-1 border-border-primary-normal"),
|
|
5611
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Icon, { name: "keyboard_arrow_right" })
|
|
4847
5612
|
}
|
|
4848
5613
|
)
|
|
4849
5614
|
]
|
|
@@ -4853,22 +5618,27 @@ var Pagination = ({
|
|
|
4853
5618
|
Pagination.displayName = "Pagination";
|
|
4854
5619
|
|
|
4855
5620
|
// src/components/SkeletonParagraph.tsx
|
|
4856
|
-
var
|
|
5621
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
4857
5622
|
|
|
4858
5623
|
// src/components/EmptyCartIcon.tsx
|
|
4859
|
-
var
|
|
5624
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
5625
|
+
|
|
5626
|
+
// src/components/Alert.tsx
|
|
5627
|
+
var import_clsx39 = __toESM(require("clsx"), 1);
|
|
5628
|
+
var import_react38 = require("react");
|
|
5629
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
4860
5630
|
|
|
4861
5631
|
// src/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.tsx
|
|
4862
|
-
var
|
|
5632
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
4863
5633
|
function ColumnSelectorMenuOption({
|
|
4864
5634
|
id,
|
|
4865
5635
|
testid,
|
|
4866
5636
|
column,
|
|
4867
5637
|
toggleColumnVisibility
|
|
4868
5638
|
}) {
|
|
4869
|
-
const [isVisible, setIsVisible] = (0,
|
|
5639
|
+
const [isVisible, setIsVisible] = (0, import_react39.useState)(column.getIsVisible());
|
|
4870
5640
|
const label = typeof column.columnDef.header === "string" ? column.columnDef.header : null;
|
|
4871
|
-
return /* @__PURE__ */ (0,
|
|
5641
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(MenuOption, { id, testid, defaultChecked: isVisible, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
4872
5642
|
Checkbox,
|
|
4873
5643
|
{
|
|
4874
5644
|
id: id ? `${id}-checkbox` : void 0,
|