@dmsi/wedgekit-react 0.0.476 → 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-HSJ34DOK.js → chunk-WIDUWFLX.js} +748 -34
- package/dist/components/CalendarRange.cjs +452 -152
- package/dist/components/CalendarRange.js +1 -2
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.cjs +916 -151
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.js +1 -1
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.cjs +926 -161
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.js +1 -1
- package/dist/components/DataGrid/PinnedColumns.cjs +941 -176
- package/dist/components/DataGrid/PinnedColumns.js +1 -1
- package/dist/components/DataGrid/TableBody/LoadingCell.cjs +917 -152
- package/dist/components/DataGrid/TableBody/LoadingCell.js +1 -1
- package/dist/components/DataGrid/TableBody/TableBodyRow.cjs +923 -158
- package/dist/components/DataGrid/TableBody/TableBodyRow.js +1 -1
- package/dist/components/DataGrid/TableBody/index.cjs +938 -173
- package/dist/components/DataGrid/TableBody/index.js +1 -1
- package/dist/components/DataGrid/index.cjs +1027 -262
- package/dist/components/DataGrid/index.js +1 -1
- package/dist/components/DataGrid/utils.cjs +917 -152
- package/dist/components/DataGrid/utils.js +1 -1
- package/dist/components/DateInput.js +7 -254
- package/dist/components/DateRangeInput.cjs +406 -176
- package/dist/components/DateRangeInput.js +1 -2
- package/dist/components/MobileDataGrid/ColumnSelector/index.cjs +923 -158
- package/dist/components/MobileDataGrid/ColumnSelector/index.js +1 -1
- package/dist/components/MobileDataGrid/MobileDataGridHeader.cjs +921 -156
- package/dist/components/MobileDataGrid/MobileDataGridHeader.js +1 -1
- package/dist/components/MobileDataGrid/index.cjs +971 -206
- package/dist/components/MobileDataGrid/index.js +1 -1
- package/dist/components/index.cjs +1145 -378
- package/dist/components/index.js +3 -1
- package/package.json +1 -1
- package/src/components/index.ts +1 -0
- package/dist/chunk-X35NLL3N.js +0 -493
|
@@ -68,6 +68,7 @@ __export(components_exports, {
|
|
|
68
68
|
DataCellHeader: () => DataCellHeader,
|
|
69
69
|
DataGrid: () => DataGrid,
|
|
70
70
|
DataGridCell: () => DataGridCell,
|
|
71
|
+
DateInput: () => DateInput,
|
|
71
72
|
DragAlongCell: () => DragAlongCell,
|
|
72
73
|
DraggableCellHeader: () => DraggableCellHeader,
|
|
73
74
|
EmptyCartIcon: () => EmptyCartIcon,
|
|
@@ -500,6 +501,76 @@ function formatCurrencyDisplay(value) {
|
|
|
500
501
|
}
|
|
501
502
|
|
|
502
503
|
// src/utils/date.ts
|
|
504
|
+
function parseInputDate(input) {
|
|
505
|
+
const match = input.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);
|
|
506
|
+
if (!match) {
|
|
507
|
+
return null;
|
|
508
|
+
}
|
|
509
|
+
const [, month, day, year] = match;
|
|
510
|
+
const paddedMonth = month.padStart(2, "0");
|
|
511
|
+
const paddedDay = day.padStart(2, "0");
|
|
512
|
+
return `${year}-${paddedMonth}-${paddedDay}`;
|
|
513
|
+
}
|
|
514
|
+
function isValidDate(dateString) {
|
|
515
|
+
const date = new Date(dateString);
|
|
516
|
+
return date instanceof Date && !isNaN(date.getTime()) && dateString === date.toISOString().split("T")[0];
|
|
517
|
+
}
|
|
518
|
+
function formatInputValue(value) {
|
|
519
|
+
const digits = value.replace(/\D/g, "");
|
|
520
|
+
if (digits.length < 2) {
|
|
521
|
+
return digits;
|
|
522
|
+
}
|
|
523
|
+
if (digits.length >= 4) {
|
|
524
|
+
return `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, 8)}`;
|
|
525
|
+
}
|
|
526
|
+
return `${digits.slice(0, 2)}/${digits.slice(2)}`;
|
|
527
|
+
}
|
|
528
|
+
function isDigit(character) {
|
|
529
|
+
return /\d/.test(character);
|
|
530
|
+
}
|
|
531
|
+
function isSlash(character) {
|
|
532
|
+
return character === "/";
|
|
533
|
+
}
|
|
534
|
+
function countDigitsUpToCursor(value, cursorPosition) {
|
|
535
|
+
let digitCount = 0;
|
|
536
|
+
for (let i = 0; i < cursorPosition && i < value.length; i++) {
|
|
537
|
+
if (!isDigit(value[i])) {
|
|
538
|
+
continue;
|
|
539
|
+
}
|
|
540
|
+
digitCount++;
|
|
541
|
+
}
|
|
542
|
+
return digitCount;
|
|
543
|
+
}
|
|
544
|
+
function findPositionAfterDigitCount(formattedValue, targetDigitCount) {
|
|
545
|
+
let currentDigitCount = 0;
|
|
546
|
+
for (let i = 0; i < formattedValue.length; i++) {
|
|
547
|
+
if (!isDigit(formattedValue[i])) {
|
|
548
|
+
continue;
|
|
549
|
+
}
|
|
550
|
+
currentDigitCount++;
|
|
551
|
+
if (currentDigitCount !== targetDigitCount) {
|
|
552
|
+
continue;
|
|
553
|
+
}
|
|
554
|
+
const positionAfterDigit = i + 1;
|
|
555
|
+
const nextCharacter = formattedValue[positionAfterDigit];
|
|
556
|
+
if (nextCharacter && isSlash(nextCharacter)) {
|
|
557
|
+
return positionAfterDigit + 1;
|
|
558
|
+
}
|
|
559
|
+
return positionAfterDigit;
|
|
560
|
+
}
|
|
561
|
+
return formattedValue.length;
|
|
562
|
+
}
|
|
563
|
+
function calculateCursorPosition(originalValue, formattedValue, originalPosition) {
|
|
564
|
+
const targetDigitCount = countDigitsUpToCursor(
|
|
565
|
+
originalValue,
|
|
566
|
+
originalPosition
|
|
567
|
+
);
|
|
568
|
+
const newPosition = findPositionAfterDigitCount(
|
|
569
|
+
formattedValue,
|
|
570
|
+
targetDigitCount
|
|
571
|
+
);
|
|
572
|
+
return Math.min(newPosition, formattedValue.length);
|
|
573
|
+
}
|
|
503
574
|
function parseDateParts(dateString) {
|
|
504
575
|
const [yearStr, monthStr, dayStr] = dateString.split("-");
|
|
505
576
|
if (!yearStr || !monthStr || !dayStr) {
|
|
@@ -4084,12 +4155,707 @@ var Tooltip = ({
|
|
|
4084
4155
|
};
|
|
4085
4156
|
Tooltip.displayName = "Tooltip";
|
|
4086
4157
|
|
|
4087
|
-
// src/components/
|
|
4088
|
-
var
|
|
4158
|
+
// src/components/DateInput.tsx
|
|
4159
|
+
var import_react20 = require("react");
|
|
4160
|
+
var import_react_dom3 = require("react-dom");
|
|
4089
4161
|
|
|
4090
|
-
// src/components/
|
|
4162
|
+
// src/components/CalendarRange.tsx
|
|
4091
4163
|
var import_clsx19 = __toESM(require("clsx"), 1);
|
|
4164
|
+
var import_react19 = __toESM(require("react"), 1);
|
|
4165
|
+
var import_polyfill = require("@js-temporal/polyfill");
|
|
4092
4166
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
4167
|
+
function DateCell(_a) {
|
|
4168
|
+
var _b = _a, {
|
|
4169
|
+
date,
|
|
4170
|
+
isInMonth,
|
|
4171
|
+
isToday,
|
|
4172
|
+
isSelected,
|
|
4173
|
+
inRange,
|
|
4174
|
+
isDisabled,
|
|
4175
|
+
isRangeStart,
|
|
4176
|
+
isRangeEnd,
|
|
4177
|
+
onClick,
|
|
4178
|
+
onMouseEnter,
|
|
4179
|
+
onMouseLeave,
|
|
4180
|
+
cellPadding = "",
|
|
4181
|
+
isRangeDisabled = false,
|
|
4182
|
+
id,
|
|
4183
|
+
testid
|
|
4184
|
+
} = _b, props = __objRest(_b, [
|
|
4185
|
+
"date",
|
|
4186
|
+
"isInMonth",
|
|
4187
|
+
"isToday",
|
|
4188
|
+
"isSelected",
|
|
4189
|
+
"inRange",
|
|
4190
|
+
"isDisabled",
|
|
4191
|
+
"isRangeStart",
|
|
4192
|
+
"isRangeEnd",
|
|
4193
|
+
"onClick",
|
|
4194
|
+
"onMouseEnter",
|
|
4195
|
+
"onMouseLeave",
|
|
4196
|
+
"cellPadding",
|
|
4197
|
+
"isRangeDisabled",
|
|
4198
|
+
"id",
|
|
4199
|
+
"testid"
|
|
4200
|
+
]);
|
|
4201
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4202
|
+
"span",
|
|
4203
|
+
__spreadProps(__spreadValues({}, props), {
|
|
4204
|
+
id,
|
|
4205
|
+
"data-testid": testid,
|
|
4206
|
+
className: (0, import_clsx19.default)(
|
|
4207
|
+
"flex items-center justify-center aspect-square select-none transition-colors border duration-100 font-medium",
|
|
4208
|
+
typography.caption,
|
|
4209
|
+
cellPadding,
|
|
4210
|
+
!isToday && !isSelected && !inRange && !isDisabled && !isRangeStart && !isRangeEnd && "border-transparent",
|
|
4211
|
+
!isInMonth && "border-transparent",
|
|
4212
|
+
// Today: subtle border ring
|
|
4213
|
+
isToday && !isSelected && !inRange && "rounded-full border-border-primary-normal ",
|
|
4214
|
+
// Selected: Figma blue, white text, strong shadow
|
|
4215
|
+
isSelected && "bg-action-400 text-white border-action-400 z-10",
|
|
4216
|
+
!isSelected && !inRange && "rounded-base",
|
|
4217
|
+
// When range is disabled OR when only 'from' is selected (no range yet), apply rounded corners
|
|
4218
|
+
(isRangeDisabled || !inRange && isSelected) && "rounded-base",
|
|
4219
|
+
inRange && isSelected && "hover:border-action-500",
|
|
4220
|
+
// In range: Figma light blue background
|
|
4221
|
+
inRange && !isSelected && "bg-action-100 text-text-primary-normal border-y-action-400 border-x-0 ",
|
|
4222
|
+
// Disabled: Figma gray, no pointer, no hover
|
|
4223
|
+
isDisabled && !inRange ? "text-text-primary-disabled bg-transparent pointer-events-none opacity-40 border-transparent" : [
|
|
4224
|
+
"text-text-primary-normal cursor-pointer",
|
|
4225
|
+
// Figma hover: blue bg, blue text (or red text if selected)
|
|
4226
|
+
isSelected ? "hover:bg-background-action-primary-hover hover:text-white" : "hover:bg-action-100 hover:text-text-action-primary-hover",
|
|
4227
|
+
// Figma active: darker blue bg, white text
|
|
4228
|
+
"active:bg-action-300 active:text-white",
|
|
4229
|
+
// Figma focus: ring
|
|
4230
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-action-400"
|
|
4231
|
+
],
|
|
4232
|
+
isRangeStart && "rounded-l",
|
|
4233
|
+
isRangeEnd && "rounded-r"
|
|
4234
|
+
),
|
|
4235
|
+
tabIndex: isDisabled ? -1 : 0,
|
|
4236
|
+
"aria-disabled": isDisabled,
|
|
4237
|
+
onClick: () => !isDisabled && isInMonth && onClick(),
|
|
4238
|
+
onMouseEnter: () => isInMonth && onMouseEnter(),
|
|
4239
|
+
onMouseLeave: () => isInMonth && onMouseLeave(),
|
|
4240
|
+
children: isInMonth ? date.day : ""
|
|
4241
|
+
})
|
|
4242
|
+
);
|
|
4243
|
+
}
|
|
4244
|
+
function CalendarRange({
|
|
4245
|
+
from,
|
|
4246
|
+
to,
|
|
4247
|
+
onChange,
|
|
4248
|
+
isDateAvailable,
|
|
4249
|
+
mode = "double",
|
|
4250
|
+
cardStyle = false,
|
|
4251
|
+
disableRange = false,
|
|
4252
|
+
id,
|
|
4253
|
+
testid
|
|
4254
|
+
}) {
|
|
4255
|
+
const weekDays = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
|
|
4256
|
+
const parseDate = (d) => {
|
|
4257
|
+
if (!d) {
|
|
4258
|
+
return void 0;
|
|
4259
|
+
}
|
|
4260
|
+
try {
|
|
4261
|
+
if (typeof d === "number") {
|
|
4262
|
+
return import_polyfill.Temporal.PlainDate.from(new Date(d).toISOString().slice(0, 10));
|
|
4263
|
+
}
|
|
4264
|
+
if (typeof d === "string") {
|
|
4265
|
+
return import_polyfill.Temporal.PlainDate.from(d);
|
|
4266
|
+
}
|
|
4267
|
+
return void 0;
|
|
4268
|
+
} catch (error) {
|
|
4269
|
+
console.error("Invalid date format:", d, error);
|
|
4270
|
+
return import_polyfill.Temporal.Now.plainDateISO();
|
|
4271
|
+
}
|
|
4272
|
+
};
|
|
4273
|
+
const fromDate = parseDate(from);
|
|
4274
|
+
const toDate = parseDate(to);
|
|
4275
|
+
const today = import_polyfill.Temporal.Now.plainDateISO();
|
|
4276
|
+
const [baseMonth, setBaseMonth] = (0, import_react19.useState)(
|
|
4277
|
+
fromDate != null ? fromDate : today.with({ day: 1 })
|
|
4278
|
+
);
|
|
4279
|
+
const [selecting, setSelecting] = (0, import_react19.useState)("from");
|
|
4280
|
+
const [pendingFrom, setPendingFrom] = (0, import_react19.useState)(void 0);
|
|
4281
|
+
const [hoveredDate, setHoveredDate] = (0, import_react19.useState)(void 0);
|
|
4282
|
+
(0, import_react19.useEffect)(() => {
|
|
4283
|
+
if (fromDate) {
|
|
4284
|
+
setBaseMonth(fromDate.with({ day: 1 }));
|
|
4285
|
+
} else if (toDate) {
|
|
4286
|
+
setBaseMonth(toDate.with({ day: 1 }));
|
|
4287
|
+
}
|
|
4288
|
+
}, [from, to]);
|
|
4289
|
+
(0, import_react19.useEffect)(() => {
|
|
4290
|
+
if (fromDate && toDate) {
|
|
4291
|
+
setSelecting("from");
|
|
4292
|
+
setPendingFrom(void 0);
|
|
4293
|
+
setHoveredDate(void 0);
|
|
4294
|
+
}
|
|
4295
|
+
}, [from, to]);
|
|
4296
|
+
function getMonthData(monthOffset) {
|
|
4297
|
+
const monthDate = baseMonth.add({ months: monthOffset }).with({ day: 1 });
|
|
4298
|
+
const days = monthDate.daysInMonth;
|
|
4299
|
+
const firstDayOffset = monthDate.dayOfWeek % 7;
|
|
4300
|
+
return {
|
|
4301
|
+
name: monthDate.toLocaleString("en-US", { month: "long" }),
|
|
4302
|
+
year: monthDate.year,
|
|
4303
|
+
days,
|
|
4304
|
+
firstDayOffset,
|
|
4305
|
+
date: monthDate
|
|
4306
|
+
};
|
|
4307
|
+
}
|
|
4308
|
+
function getMonthDataWith(monthOffset) {
|
|
4309
|
+
const monthDate = baseMonth.with({ month: monthOffset }).with({ day: 1 });
|
|
4310
|
+
const days = monthDate.daysInMonth;
|
|
4311
|
+
const firstDayOffset = monthDate.dayOfWeek % 7;
|
|
4312
|
+
return {
|
|
4313
|
+
name: monthDate.toLocaleString("en-US", { month: "long" }),
|
|
4314
|
+
year: monthDate.year,
|
|
4315
|
+
days,
|
|
4316
|
+
firstDayOffset,
|
|
4317
|
+
date: monthDate
|
|
4318
|
+
};
|
|
4319
|
+
}
|
|
4320
|
+
function handleDayClick(date) {
|
|
4321
|
+
if (isDateAvailable && !isDateAvailable(date)) return;
|
|
4322
|
+
if (mode === "single" && disableRange) {
|
|
4323
|
+
if (onChange) {
|
|
4324
|
+
onChange(date.toString(), date.toString());
|
|
4325
|
+
}
|
|
4326
|
+
return;
|
|
4327
|
+
}
|
|
4328
|
+
if (selecting === "from") {
|
|
4329
|
+
setPendingFrom(date);
|
|
4330
|
+
setSelecting("to");
|
|
4331
|
+
setHoveredDate(void 0);
|
|
4332
|
+
} else if (pendingFrom) {
|
|
4333
|
+
if (onChange) {
|
|
4334
|
+
const [start, end] = import_polyfill.Temporal.PlainDate.compare(date, pendingFrom) < 0 ? [date, pendingFrom] : [pendingFrom, date];
|
|
4335
|
+
onChange(start.toString(), end.toString());
|
|
4336
|
+
}
|
|
4337
|
+
setPendingFrom(void 0);
|
|
4338
|
+
setSelecting("from");
|
|
4339
|
+
setHoveredDate(void 0);
|
|
4340
|
+
}
|
|
4341
|
+
}
|
|
4342
|
+
function isInRange(date) {
|
|
4343
|
+
if (mode === "single" && disableRange) {
|
|
4344
|
+
return false;
|
|
4345
|
+
}
|
|
4346
|
+
if (pendingFrom && selecting === "to" && hoveredDate) {
|
|
4347
|
+
const [start, end] = import_polyfill.Temporal.PlainDate.compare(hoveredDate, pendingFrom) < 0 ? [hoveredDate, pendingFrom] : [pendingFrom, hoveredDate];
|
|
4348
|
+
return import_polyfill.Temporal.PlainDate.compare(date, start) >= 0 && import_polyfill.Temporal.PlainDate.compare(date, end) <= 0;
|
|
4349
|
+
}
|
|
4350
|
+
if (!pendingFrom && fromDate && toDate) {
|
|
4351
|
+
return import_polyfill.Temporal.PlainDate.compare(date, fromDate) >= 0 && import_polyfill.Temporal.PlainDate.compare(date, toDate) <= 0;
|
|
4352
|
+
}
|
|
4353
|
+
return false;
|
|
4354
|
+
}
|
|
4355
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4356
|
+
"div",
|
|
4357
|
+
{
|
|
4358
|
+
id,
|
|
4359
|
+
"data-testid": testid,
|
|
4360
|
+
className: (0, import_clsx19.default)(
|
|
4361
|
+
"relative bg-background-grouped-primary-normal rounded-base w-fit",
|
|
4362
|
+
layoutPaddding,
|
|
4363
|
+
layoutGap,
|
|
4364
|
+
cardStyle && "shadow-4",
|
|
4365
|
+
// baseTransition,
|
|
4366
|
+
"overflow-hidden"
|
|
4367
|
+
),
|
|
4368
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4369
|
+
"div",
|
|
4370
|
+
{
|
|
4371
|
+
className: (0, import_clsx19.default)(
|
|
4372
|
+
"flex flex-row items-start justify-start bg-background-primary-normal overflow-clip",
|
|
4373
|
+
layoutGap
|
|
4374
|
+
),
|
|
4375
|
+
children: (mode === "double" ? [0, 1] : [0]).map((offset, idx) => {
|
|
4376
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4377
|
+
CalendarPane,
|
|
4378
|
+
{
|
|
4379
|
+
getMonthData,
|
|
4380
|
+
getMonthDataWith,
|
|
4381
|
+
offset,
|
|
4382
|
+
idx,
|
|
4383
|
+
id,
|
|
4384
|
+
testid,
|
|
4385
|
+
baseMonth,
|
|
4386
|
+
setBaseMonth,
|
|
4387
|
+
mode,
|
|
4388
|
+
pendingFrom,
|
|
4389
|
+
weekDays,
|
|
4390
|
+
fromDate,
|
|
4391
|
+
toDate,
|
|
4392
|
+
isDateAvailable,
|
|
4393
|
+
disableRange,
|
|
4394
|
+
hoveredDate,
|
|
4395
|
+
isInRange,
|
|
4396
|
+
today,
|
|
4397
|
+
setHoveredDate,
|
|
4398
|
+
handleDayClick
|
|
4399
|
+
},
|
|
4400
|
+
idx
|
|
4401
|
+
);
|
|
4402
|
+
})
|
|
4403
|
+
}
|
|
4404
|
+
)
|
|
4405
|
+
}
|
|
4406
|
+
);
|
|
4407
|
+
}
|
|
4408
|
+
function CalendarPane({
|
|
4409
|
+
getMonthData,
|
|
4410
|
+
getMonthDataWith,
|
|
4411
|
+
offset,
|
|
4412
|
+
idx,
|
|
4413
|
+
id,
|
|
4414
|
+
testid,
|
|
4415
|
+
baseMonth,
|
|
4416
|
+
setBaseMonth,
|
|
4417
|
+
mode,
|
|
4418
|
+
pendingFrom,
|
|
4419
|
+
weekDays,
|
|
4420
|
+
fromDate,
|
|
4421
|
+
toDate,
|
|
4422
|
+
isDateAvailable,
|
|
4423
|
+
disableRange,
|
|
4424
|
+
hoveredDate,
|
|
4425
|
+
isInRange,
|
|
4426
|
+
today,
|
|
4427
|
+
setHoveredDate,
|
|
4428
|
+
handleDayClick
|
|
4429
|
+
}) {
|
|
4430
|
+
const months = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
|
|
4431
|
+
const years = Array.from({ length: 100 }).map(
|
|
4432
|
+
(_, i) => baseMonth.year - 50 + i
|
|
4433
|
+
);
|
|
4434
|
+
const [monthMenuOpen, setMonthMenuOpen] = (0, import_react19.useState)(false);
|
|
4435
|
+
const [yearMenuOpen, setYearMenuOpen] = (0, import_react19.useState)(false);
|
|
4436
|
+
const monthMenuRef = (0, import_react19.useRef)(null);
|
|
4437
|
+
const yearMenuRef = (0, import_react19.useRef)(null);
|
|
4438
|
+
const month = getMonthData(offset);
|
|
4439
|
+
const totalCells = 42;
|
|
4440
|
+
const emptyCells = month.firstDayOffset;
|
|
4441
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_react19.default.Fragment, { children: [
|
|
4442
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
4443
|
+
"div",
|
|
4444
|
+
{
|
|
4445
|
+
className: (0, import_clsx19.default)("flex flex-col"),
|
|
4446
|
+
children: [
|
|
4447
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
4448
|
+
"div",
|
|
4449
|
+
{
|
|
4450
|
+
className: (0, import_clsx19.default)(
|
|
4451
|
+
"flex flex-row items-center justify-between",
|
|
4452
|
+
typography.label,
|
|
4453
|
+
"text-text-action-primary-normal"
|
|
4454
|
+
),
|
|
4455
|
+
children: [
|
|
4456
|
+
idx === 0 ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4457
|
+
"button",
|
|
4458
|
+
{
|
|
4459
|
+
id: id ? `${id}-prev-month-button` : void 0,
|
|
4460
|
+
"data-testid": testid ? `${testid}-prev-month-button` : void 0,
|
|
4461
|
+
type: "button",
|
|
4462
|
+
className: (0, import_clsx19.default)(
|
|
4463
|
+
"flex items-center justify-center rounded-base hover:bg-action-100 active:bg-action-300 text-icon-action-primary-normal",
|
|
4464
|
+
componentPadding
|
|
4465
|
+
),
|
|
4466
|
+
"aria-label": "Previous month",
|
|
4467
|
+
onClick: () => setBaseMonth(baseMonth.subtract({ months: 1 })),
|
|
4468
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Icon, { name: "chevron_left", size: 24 })
|
|
4469
|
+
}
|
|
4470
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: (0, import_clsx19.default)(componentPadding, "mr-1") }),
|
|
4471
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex gap-desktop-compact-component-padding", children: [
|
|
4472
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4473
|
+
"button",
|
|
4474
|
+
{
|
|
4475
|
+
ref: (el) => {
|
|
4476
|
+
monthMenuRef.current = el;
|
|
4477
|
+
},
|
|
4478
|
+
type: "button",
|
|
4479
|
+
onClick: () => {
|
|
4480
|
+
setMonthMenuOpen(true);
|
|
4481
|
+
setYearMenuOpen(false);
|
|
4482
|
+
},
|
|
4483
|
+
className: "font-semibold text-text-action-primary-normal text-[14px] py-[2px] truncate",
|
|
4484
|
+
children: month.name
|
|
4485
|
+
}
|
|
4486
|
+
),
|
|
4487
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4488
|
+
Menu,
|
|
4489
|
+
{
|
|
4490
|
+
show: monthMenuOpen,
|
|
4491
|
+
positionTo: monthMenuRef,
|
|
4492
|
+
setShow: () => setMonthMenuOpen(false),
|
|
4493
|
+
children: months.map((x) => [x, getMonthDataWith(x + 1)]).map(([x, m]) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4494
|
+
MenuOption,
|
|
4495
|
+
{
|
|
4496
|
+
selected: baseMonth.month === x + 1,
|
|
4497
|
+
onClick: () => {
|
|
4498
|
+
setBaseMonth(baseMonth.with({ month: x + 1 }));
|
|
4499
|
+
setMonthMenuOpen(false);
|
|
4500
|
+
},
|
|
4501
|
+
children: m.name
|
|
4502
|
+
},
|
|
4503
|
+
m.name
|
|
4504
|
+
))
|
|
4505
|
+
}
|
|
4506
|
+
),
|
|
4507
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4508
|
+
"button",
|
|
4509
|
+
{
|
|
4510
|
+
ref: (el) => {
|
|
4511
|
+
yearMenuRef.current = el;
|
|
4512
|
+
},
|
|
4513
|
+
type: "button",
|
|
4514
|
+
onClick: () => {
|
|
4515
|
+
setYearMenuOpen(true);
|
|
4516
|
+
setMonthMenuOpen(false);
|
|
4517
|
+
},
|
|
4518
|
+
className: "font-semibold text-text-action-primary-normal text-[14px] py-[2px] truncate",
|
|
4519
|
+
children: month.year
|
|
4520
|
+
}
|
|
4521
|
+
),
|
|
4522
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4523
|
+
Menu,
|
|
4524
|
+
{
|
|
4525
|
+
show: yearMenuOpen,
|
|
4526
|
+
positionTo: yearMenuRef,
|
|
4527
|
+
setShow: () => setYearMenuOpen(false),
|
|
4528
|
+
children: years.map((y) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4529
|
+
MenuOption,
|
|
4530
|
+
{
|
|
4531
|
+
selected: baseMonth.year === y,
|
|
4532
|
+
onClick: () => {
|
|
4533
|
+
setBaseMonth(baseMonth.with({ year: y }));
|
|
4534
|
+
setYearMenuOpen(false);
|
|
4535
|
+
},
|
|
4536
|
+
children: y
|
|
4537
|
+
},
|
|
4538
|
+
y
|
|
4539
|
+
))
|
|
4540
|
+
}
|
|
4541
|
+
)
|
|
4542
|
+
] }),
|
|
4543
|
+
(mode === "double" ? idx === 1 : true) ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4544
|
+
"button",
|
|
4545
|
+
{
|
|
4546
|
+
id: id ? `${id}-next-month-button` : void 0,
|
|
4547
|
+
"data-testid": testid ? `${testid}-next-month-button` : void 0,
|
|
4548
|
+
type: "button",
|
|
4549
|
+
className: (0, import_clsx19.default)(
|
|
4550
|
+
"flex items-center justify-center rounded-base hover:bg-action-100 active:bg-action-300 text-icon-action-primary-normal",
|
|
4551
|
+
componentPadding
|
|
4552
|
+
),
|
|
4553
|
+
"aria-label": "Next month",
|
|
4554
|
+
onClick: () => setBaseMonth(baseMonth.add({ months: 1 })),
|
|
4555
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Icon, { name: "chevron_right", size: 24 })
|
|
4556
|
+
}
|
|
4557
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: (0, import_clsx19.default)(componentPadding, "ml-1") })
|
|
4558
|
+
]
|
|
4559
|
+
}
|
|
4560
|
+
),
|
|
4561
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: (0, import_clsx19.default)("grid grid-cols-7"), children: weekDays.map((d) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4562
|
+
"span",
|
|
4563
|
+
{
|
|
4564
|
+
className: (0, import_clsx19.default)(
|
|
4565
|
+
typography.caption,
|
|
4566
|
+
"text-text-secondary-normal text-center",
|
|
4567
|
+
"w-10"
|
|
4568
|
+
),
|
|
4569
|
+
children: d
|
|
4570
|
+
},
|
|
4571
|
+
d
|
|
4572
|
+
)) }),
|
|
4573
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: (0, import_clsx19.default)("grid grid-cols-7"), children: Array.from({ length: totalCells }).map((_, i) => {
|
|
4574
|
+
const day = i - emptyCells + 1;
|
|
4575
|
+
const date = month.date.with({ day: 1 }).add({
|
|
4576
|
+
days: i - emptyCells
|
|
4577
|
+
});
|
|
4578
|
+
const isInMonth = day > 0 && day <= month.days;
|
|
4579
|
+
const isToday = isInMonth && date.equals(today);
|
|
4580
|
+
const isSelected = isInMonth && (!pendingFrom && fromDate && date.equals(fromDate) || !pendingFrom && toDate && date.equals(toDate) || pendingFrom && date.equals(pendingFrom));
|
|
4581
|
+
const inRange = isInMonth && isInRange(date);
|
|
4582
|
+
const isDisabled = !isInMonth || (isDateAvailable ? !isDateAvailable(date) : false);
|
|
4583
|
+
const hoverDateIsBeforePendingFrom = hoveredDate && pendingFrom && import_polyfill.Temporal.PlainDate.compare(hoveredDate, pendingFrom) < 0;
|
|
4584
|
+
const hoverDateIsAfterPendingFrom = hoveredDate && pendingFrom && import_polyfill.Temporal.PlainDate.compare(hoveredDate, pendingFrom) >= 0;
|
|
4585
|
+
const isRangeStart = mode === "single" && disableRange ? false : !pendingFrom && isInMonth && fromDate && date.equals(fromDate) || hoverDateIsAfterPendingFrom && date.equals(pendingFrom);
|
|
4586
|
+
const isRangeEnd = mode === "single" && disableRange ? false : !pendingFrom && isInMonth && toDate && date.equals(toDate) || hoverDateIsBeforePendingFrom && date.equals(pendingFrom);
|
|
4587
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4588
|
+
DateCell,
|
|
4589
|
+
{
|
|
4590
|
+
id: id ? `${id}-date-${date.toString()}` : void 0,
|
|
4591
|
+
testid: testid ? `${testid}-date-${date.toString()}` : void 0,
|
|
4592
|
+
date,
|
|
4593
|
+
isInMonth: !!isInMonth,
|
|
4594
|
+
isToday: !!isToday,
|
|
4595
|
+
isSelected: !!isSelected,
|
|
4596
|
+
inRange: !!inRange,
|
|
4597
|
+
isDisabled: !!isDisabled,
|
|
4598
|
+
onClick: () => handleDayClick(date),
|
|
4599
|
+
onMouseEnter: () => setHoveredDate(date),
|
|
4600
|
+
onMouseLeave: () => setHoveredDate(void 0),
|
|
4601
|
+
isRangeStart: !!isRangeStart,
|
|
4602
|
+
isRangeEnd: !!isRangeEnd,
|
|
4603
|
+
isRangeDisabled: mode === "single" && disableRange,
|
|
4604
|
+
cellPadding: componentPadding
|
|
4605
|
+
},
|
|
4606
|
+
i
|
|
4607
|
+
);
|
|
4608
|
+
}) })
|
|
4609
|
+
]
|
|
4610
|
+
}
|
|
4611
|
+
),
|
|
4612
|
+
mode === "double" && idx === 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4613
|
+
"div",
|
|
4614
|
+
{
|
|
4615
|
+
className: (0, import_clsx19.default)(
|
|
4616
|
+
"self-stretch bg-border-primary-normal rounded-base",
|
|
4617
|
+
// 1px width, full height, matches Figma divider
|
|
4618
|
+
"w-px"
|
|
4619
|
+
)
|
|
4620
|
+
}
|
|
4621
|
+
)
|
|
4622
|
+
] }, month.name + month.year);
|
|
4623
|
+
}
|
|
4624
|
+
|
|
4625
|
+
// src/components/DateInput.tsx
|
|
4626
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
4627
|
+
var DateInput = (_a) => {
|
|
4628
|
+
var _b = _a, {
|
|
4629
|
+
id,
|
|
4630
|
+
testid,
|
|
4631
|
+
value,
|
|
4632
|
+
onChange,
|
|
4633
|
+
placeholder = "MM/DD/YYYY",
|
|
4634
|
+
disabled,
|
|
4635
|
+
readOnly = false,
|
|
4636
|
+
label
|
|
4637
|
+
} = _b, props = __objRest(_b, [
|
|
4638
|
+
"id",
|
|
4639
|
+
"testid",
|
|
4640
|
+
"value",
|
|
4641
|
+
"onChange",
|
|
4642
|
+
"placeholder",
|
|
4643
|
+
"disabled",
|
|
4644
|
+
"readOnly",
|
|
4645
|
+
"label"
|
|
4646
|
+
]);
|
|
4647
|
+
const [visible, setVisible] = (0, import_react20.useState)(false);
|
|
4648
|
+
const [inputValue, setInputValue] = (0, import_react20.useState)("");
|
|
4649
|
+
const [isTyping, setIsTyping] = (0, import_react20.useState)(false);
|
|
4650
|
+
const popoverRef = (0, import_react20.useRef)(null);
|
|
4651
|
+
const triggerRef = (0, import_react20.useRef)(null);
|
|
4652
|
+
const rootRef = (0, import_react20.useRef)(null);
|
|
4653
|
+
const [calendarPosition, setCalendarPosition] = (0, import_react20.useState)({
|
|
4654
|
+
top: 0,
|
|
4655
|
+
left: 0,
|
|
4656
|
+
width: 0
|
|
4657
|
+
});
|
|
4658
|
+
const [from, to] = [value, ""];
|
|
4659
|
+
(0, import_react20.useEffect)(() => {
|
|
4660
|
+
if (!isTyping) {
|
|
4661
|
+
setInputValue(formatDisplayValue(from));
|
|
4662
|
+
}
|
|
4663
|
+
}, [from, isTyping]);
|
|
4664
|
+
(0, import_react20.useLayoutEffect)(() => {
|
|
4665
|
+
if (visible) {
|
|
4666
|
+
updatePosition();
|
|
4667
|
+
}
|
|
4668
|
+
}, [visible]);
|
|
4669
|
+
const updatePosition = () => {
|
|
4670
|
+
if (rootRef.current) {
|
|
4671
|
+
const rect = rootRef.current.getBoundingClientRect();
|
|
4672
|
+
setCalendarPosition({
|
|
4673
|
+
top: rect.bottom + window.scrollY,
|
|
4674
|
+
left: rect.left + window.scrollX,
|
|
4675
|
+
width: rect.width
|
|
4676
|
+
});
|
|
4677
|
+
}
|
|
4678
|
+
};
|
|
4679
|
+
(0, import_react20.useEffect)(() => {
|
|
4680
|
+
updatePosition();
|
|
4681
|
+
const resizeObserver = new ResizeObserver(updatePosition);
|
|
4682
|
+
if (triggerRef.current) {
|
|
4683
|
+
resizeObserver.observe(triggerRef.current);
|
|
4684
|
+
}
|
|
4685
|
+
window.addEventListener("scroll", updatePosition);
|
|
4686
|
+
return () => {
|
|
4687
|
+
resizeObserver.disconnect();
|
|
4688
|
+
window.removeEventListener("scroll", updatePosition);
|
|
4689
|
+
};
|
|
4690
|
+
}, []);
|
|
4691
|
+
(0, import_react20.useEffect)(() => {
|
|
4692
|
+
const handleKeyDown2 = (event) => {
|
|
4693
|
+
var _a2;
|
|
4694
|
+
if (event.key === "Escape" && popoverRef.current) {
|
|
4695
|
+
setVisible(false);
|
|
4696
|
+
(_a2 = triggerRef.current) == null ? void 0 : _a2.blur();
|
|
4697
|
+
}
|
|
4698
|
+
};
|
|
4699
|
+
document.addEventListener("keydown", handleKeyDown2);
|
|
4700
|
+
return () => {
|
|
4701
|
+
document.removeEventListener("keydown", handleKeyDown2);
|
|
4702
|
+
};
|
|
4703
|
+
});
|
|
4704
|
+
(0, import_react20.useEffect)(() => {
|
|
4705
|
+
const handleClickOutside = (event) => {
|
|
4706
|
+
if (popoverRef.current && !popoverRef.current.contains(event.target) && triggerRef.current && !triggerRef.current.contains(event.target)) {
|
|
4707
|
+
setVisible(false);
|
|
4708
|
+
}
|
|
4709
|
+
};
|
|
4710
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
4711
|
+
return () => {
|
|
4712
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
4713
|
+
};
|
|
4714
|
+
}, []);
|
|
4715
|
+
function handleDateChange(fromValue) {
|
|
4716
|
+
onChange(fromValue);
|
|
4717
|
+
setVisible(false);
|
|
4718
|
+
setIsTyping(false);
|
|
4719
|
+
}
|
|
4720
|
+
const handleFocus = () => {
|
|
4721
|
+
if (readOnly) return;
|
|
4722
|
+
setVisible(true);
|
|
4723
|
+
};
|
|
4724
|
+
const handleClick = () => {
|
|
4725
|
+
handleFocus();
|
|
4726
|
+
};
|
|
4727
|
+
const handleInputChange = (event) => {
|
|
4728
|
+
if (readOnly) return;
|
|
4729
|
+
const rawValue = event.target.value;
|
|
4730
|
+
const cursorPosition = event.target.selectionStart || 0;
|
|
4731
|
+
setIsTyping(true);
|
|
4732
|
+
const formattedValue = formatInputValue(rawValue);
|
|
4733
|
+
setInputValue(formattedValue);
|
|
4734
|
+
requestAnimationFrame(() => {
|
|
4735
|
+
if (triggerRef.current) {
|
|
4736
|
+
const newPosition = calculateCursorPosition(
|
|
4737
|
+
rawValue,
|
|
4738
|
+
formattedValue,
|
|
4739
|
+
cursorPosition
|
|
4740
|
+
);
|
|
4741
|
+
triggerRef.current.setSelectionRange(newPosition, newPosition);
|
|
4742
|
+
}
|
|
4743
|
+
});
|
|
4744
|
+
const parsedDate = parseInputDate(formattedValue);
|
|
4745
|
+
if (parsedDate && isValidDate(parsedDate)) {
|
|
4746
|
+
onChange(parsedDate);
|
|
4747
|
+
}
|
|
4748
|
+
};
|
|
4749
|
+
const handleBlur = () => {
|
|
4750
|
+
setIsTyping(false);
|
|
4751
|
+
const parsedDate = parseInputDate(inputValue);
|
|
4752
|
+
if (!parsedDate || !isValidDate(parsedDate)) {
|
|
4753
|
+
setInputValue(formatDisplayValue(from));
|
|
4754
|
+
}
|
|
4755
|
+
};
|
|
4756
|
+
const handleKeyDown = (event) => {
|
|
4757
|
+
if (event.key === "Backspace") {
|
|
4758
|
+
const input = event.target;
|
|
4759
|
+
const cursorPosition = input.selectionStart || 0;
|
|
4760
|
+
const value2 = input.value;
|
|
4761
|
+
if (cursorPosition > 0 && value2[cursorPosition - 1] === "/") {
|
|
4762
|
+
event.preventDefault();
|
|
4763
|
+
const newValue = value2.slice(0, cursorPosition - 2) + value2.slice(cursorPosition);
|
|
4764
|
+
const formattedValue = formatInputValue(newValue);
|
|
4765
|
+
setInputValue(formattedValue);
|
|
4766
|
+
requestAnimationFrame(() => {
|
|
4767
|
+
if (triggerRef.current) {
|
|
4768
|
+
const newPosition = Math.max(0, cursorPosition - 2);
|
|
4769
|
+
triggerRef.current.setSelectionRange(newPosition, newPosition);
|
|
4770
|
+
}
|
|
4771
|
+
});
|
|
4772
|
+
setIsTyping(true);
|
|
4773
|
+
return;
|
|
4774
|
+
}
|
|
4775
|
+
}
|
|
4776
|
+
if (event.key === "Enter") {
|
|
4777
|
+
const parsedDate = parseInputDate(inputValue);
|
|
4778
|
+
if (parsedDate && isValidDate(parsedDate)) {
|
|
4779
|
+
onChange(parsedDate);
|
|
4780
|
+
setVisible(false);
|
|
4781
|
+
setIsTyping(false);
|
|
4782
|
+
}
|
|
4783
|
+
}
|
|
4784
|
+
};
|
|
4785
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "relative", children: [
|
|
4786
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4787
|
+
InputBase,
|
|
4788
|
+
__spreadProps(__spreadValues({
|
|
4789
|
+
id,
|
|
4790
|
+
testid,
|
|
4791
|
+
ref: (el) => {
|
|
4792
|
+
triggerRef.current = el;
|
|
4793
|
+
}
|
|
4794
|
+
}, props), {
|
|
4795
|
+
wrapperRef: rootRef,
|
|
4796
|
+
value: inputValue,
|
|
4797
|
+
placeholder,
|
|
4798
|
+
disabled,
|
|
4799
|
+
readOnly,
|
|
4800
|
+
after: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Icon, { name: "calendar_month" }),
|
|
4801
|
+
onFocus: handleFocus,
|
|
4802
|
+
onClick: handleClick,
|
|
4803
|
+
onChange: handleInputChange,
|
|
4804
|
+
onBlur: handleBlur,
|
|
4805
|
+
onKeyDown: handleKeyDown,
|
|
4806
|
+
label,
|
|
4807
|
+
secondaryIconColor: true
|
|
4808
|
+
})
|
|
4809
|
+
),
|
|
4810
|
+
visible && !readOnly && (0, import_react_dom3.createPortal)(
|
|
4811
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4812
|
+
"div",
|
|
4813
|
+
{
|
|
4814
|
+
ref: (el) => {
|
|
4815
|
+
popoverRef.current = el;
|
|
4816
|
+
},
|
|
4817
|
+
className: "absolute z-40 bg-white",
|
|
4818
|
+
style: {
|
|
4819
|
+
top: `${calendarPosition.top + 4}px`,
|
|
4820
|
+
left: `${calendarPosition.left}px`,
|
|
4821
|
+
minWidth: `${calendarPosition.width}px`
|
|
4822
|
+
},
|
|
4823
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4824
|
+
CalendarRange,
|
|
4825
|
+
{
|
|
4826
|
+
id: id ? `${id}-calendar` : void 0,
|
|
4827
|
+
testid: testid ? `${testid}-calendar` : void 0,
|
|
4828
|
+
from,
|
|
4829
|
+
to: to || from,
|
|
4830
|
+
onChange: handleDateChange,
|
|
4831
|
+
cardStyle: true,
|
|
4832
|
+
mode: "single",
|
|
4833
|
+
disableRange: true
|
|
4834
|
+
}
|
|
4835
|
+
)
|
|
4836
|
+
}
|
|
4837
|
+
),
|
|
4838
|
+
findDocumentRoot(popoverRef.current)
|
|
4839
|
+
)
|
|
4840
|
+
] });
|
|
4841
|
+
};
|
|
4842
|
+
DateInput.displayName = "DateInput";
|
|
4843
|
+
function formatDisplayValue(from) {
|
|
4844
|
+
if (!from) {
|
|
4845
|
+
return "";
|
|
4846
|
+
}
|
|
4847
|
+
if (!isValidDate(from)) {
|
|
4848
|
+
return "";
|
|
4849
|
+
}
|
|
4850
|
+
return formatDate(from);
|
|
4851
|
+
}
|
|
4852
|
+
|
|
4853
|
+
// src/components/Accordion.tsx
|
|
4854
|
+
var import_clsx22 = __toESM(require("clsx"), 1);
|
|
4855
|
+
|
|
4856
|
+
// src/components/Card.tsx
|
|
4857
|
+
var import_clsx20 = __toESM(require("clsx"), 1);
|
|
4858
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
4093
4859
|
function Card(props) {
|
|
4094
4860
|
const _a = props, {
|
|
4095
4861
|
children,
|
|
@@ -4116,7 +4882,7 @@ function Card(props) {
|
|
|
4116
4882
|
]);
|
|
4117
4883
|
const CardComponent = props.as || "div";
|
|
4118
4884
|
const anyPaddingPropSpecified = padding !== void 0 || paddingX !== void 0 || paddingY !== void 0 || paddingBottom !== void 0 || paddingTop !== void 0 || paddingLeft !== void 0 || paddingRight !== void 0;
|
|
4119
|
-
const paddingClasses = (0,
|
|
4885
|
+
const paddingClasses = (0, import_clsx20.default)(
|
|
4120
4886
|
// Backward compatibility: if no new padding props provided keep existing class.
|
|
4121
4887
|
!anyPaddingPropSpecified && "p-desktop-layout-padding",
|
|
4122
4888
|
// New responsive spacing tokens (mirrors Stack for layout sizing)
|
|
@@ -4128,11 +4894,11 @@ function Card(props) {
|
|
|
4128
4894
|
paddingLeft && "pl-mobile-layout-padding desktop:pl-desktop-layout-padding compact:pl-desktop-compact-layout-padding",
|
|
4129
4895
|
paddingRight && "pr-mobile-layout-padding desktop:pr-desktop-layout-padding compact:pr-desktop-compact-layout-padding"
|
|
4130
4896
|
);
|
|
4131
|
-
return /* @__PURE__ */ (0,
|
|
4897
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4132
4898
|
CardComponent,
|
|
4133
4899
|
__spreadProps(__spreadValues({}, rest), {
|
|
4134
4900
|
"data-testid": testid,
|
|
4135
|
-
className: (0,
|
|
4901
|
+
className: (0, import_clsx20.default)(
|
|
4136
4902
|
"rounded-sm",
|
|
4137
4903
|
paddingClasses,
|
|
4138
4904
|
selected ? "border-2 border-border-primary-focus" : "border border-border-primary-normal",
|
|
@@ -4144,9 +4910,9 @@ function Card(props) {
|
|
|
4144
4910
|
}
|
|
4145
4911
|
|
|
4146
4912
|
// src/components/Stack.tsx
|
|
4147
|
-
var
|
|
4148
|
-
var
|
|
4149
|
-
var getFlexClassNames = ({ items, justify, grow }) => (0,
|
|
4913
|
+
var import_clsx21 = __toESM(require("clsx"), 1);
|
|
4914
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4915
|
+
var getFlexClassNames = ({ items, justify, grow }) => (0, import_clsx21.default)(
|
|
4150
4916
|
"flex",
|
|
4151
4917
|
items === "start" && "items-start",
|
|
4152
4918
|
grow && "grow",
|
|
@@ -4162,7 +4928,7 @@ var getFlexClassNames = ({ items, justify, grow }) => (0, import_clsx20.default)
|
|
|
4162
4928
|
justify === "around" && "justify-around"
|
|
4163
4929
|
);
|
|
4164
4930
|
var useGapClassNames = (sizing) => {
|
|
4165
|
-
return (0,
|
|
4931
|
+
return (0, import_clsx21.default)(
|
|
4166
4932
|
sizing === "layout-group" && "gap-mobile-layout-group-gap desktop:gap-desktop-layout-group-gap compact:gap-compact-layout-group-gap",
|
|
4167
4933
|
sizing === "layout" && "gap-mobile-layout-gap desktop:gap-desktop-layout-gap compact:gap-compact-layout-gap",
|
|
4168
4934
|
sizing === "container" && "gap-mobile-container-gap desktop:gap-desktop-container-gap compact:gap-compact-container-gap",
|
|
@@ -4270,7 +5036,7 @@ var Stack = (_a) => {
|
|
|
4270
5036
|
var _a2, _b2, _c, _d, _e, _f, _g;
|
|
4271
5037
|
const flexClassNames = getFlexClassNames({ items, justify, grow });
|
|
4272
5038
|
const gapClassNames = useGapClassNames(sizing);
|
|
4273
|
-
return /* @__PURE__ */ (0,
|
|
5039
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4274
5040
|
"div",
|
|
4275
5041
|
__spreadProps(__spreadValues({
|
|
4276
5042
|
id,
|
|
@@ -4302,7 +5068,7 @@ var Stack = (_a) => {
|
|
|
4302
5068
|
paddingInline: (_f = props.style) == null ? void 0 : _f.paddingInline,
|
|
4303
5069
|
gap: (_g = props.style) == null ? void 0 : _g.gap
|
|
4304
5070
|
},
|
|
4305
|
-
className: (0,
|
|
5071
|
+
className: (0, import_clsx21.default)(
|
|
4306
5072
|
"scrollbar-thin",
|
|
4307
5073
|
"max-w-screen",
|
|
4308
5074
|
width !== "fit" && "w-full",
|
|
@@ -4364,7 +5130,7 @@ var Stack = (_a) => {
|
|
|
4364
5130
|
};
|
|
4365
5131
|
|
|
4366
5132
|
// src/components/Accordion.tsx
|
|
4367
|
-
var
|
|
5133
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
4368
5134
|
function Accordion(props) {
|
|
4369
5135
|
const {
|
|
4370
5136
|
isOpen,
|
|
@@ -4377,11 +5143,11 @@ function Accordion(props) {
|
|
|
4377
5143
|
const {
|
|
4378
5144
|
title,
|
|
4379
5145
|
before,
|
|
4380
|
-
after = /* @__PURE__ */ (0,
|
|
5146
|
+
after = /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4381
5147
|
Icon,
|
|
4382
5148
|
{
|
|
4383
5149
|
name: "expand_more",
|
|
4384
|
-
className: (0,
|
|
5150
|
+
className: (0, import_clsx22.default)(
|
|
4385
5151
|
"text-icon-primary-normal transform transition-all duration-300 ease-in-out",
|
|
4386
5152
|
isOpen ? "rotate-180" : "rotate-0"
|
|
4387
5153
|
)
|
|
@@ -4394,10 +5160,10 @@ function Accordion(props) {
|
|
|
4394
5160
|
e.preventDefault();
|
|
4395
5161
|
onClick == null ? void 0 : onClick();
|
|
4396
5162
|
}
|
|
4397
|
-
return /* @__PURE__ */ (0,
|
|
5163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
4398
5164
|
Card,
|
|
4399
5165
|
{
|
|
4400
|
-
className: (0,
|
|
5166
|
+
className: (0, import_clsx22.default)(
|
|
4401
5167
|
"overflow-hidden select-none",
|
|
4402
5168
|
{ "cursor-pointer": !disabled },
|
|
4403
5169
|
className
|
|
@@ -4406,7 +5172,7 @@ function Accordion(props) {
|
|
|
4406
5172
|
onClick: handleClick,
|
|
4407
5173
|
testid,
|
|
4408
5174
|
children: [
|
|
4409
|
-
/* @__PURE__ */ (0,
|
|
5175
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
4410
5176
|
Stack,
|
|
4411
5177
|
{
|
|
4412
5178
|
sizing: "component",
|
|
@@ -4415,9 +5181,9 @@ function Accordion(props) {
|
|
|
4415
5181
|
justify: "between",
|
|
4416
5182
|
items: "center",
|
|
4417
5183
|
children: [
|
|
4418
|
-
/* @__PURE__ */ (0,
|
|
5184
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Stack, { sizing: "layout-group", horizontal: true, items: titleAlign, children: [
|
|
4419
5185
|
before,
|
|
4420
|
-
typeof title === "string" ? /* @__PURE__ */ (0,
|
|
5186
|
+
typeof title === "string" ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4421
5187
|
Paragraph,
|
|
4422
5188
|
{
|
|
4423
5189
|
testid: testid ? `${testid}-title` : void 0,
|
|
@@ -4430,18 +5196,18 @@ function Accordion(props) {
|
|
|
4430
5196
|
]
|
|
4431
5197
|
}
|
|
4432
5198
|
),
|
|
4433
|
-
/* @__PURE__ */ (0,
|
|
5199
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4434
5200
|
"div",
|
|
4435
5201
|
{
|
|
4436
|
-
className: (0,
|
|
5202
|
+
className: (0, import_clsx22.default)("grid transition-all duration-300 ease-in-out"),
|
|
4437
5203
|
style: {
|
|
4438
5204
|
gridTemplateRows: isOpen ? "1fr" : "0fr"
|
|
4439
5205
|
},
|
|
4440
5206
|
"data-testid": testid ? `${testid}-content-container` : void 0,
|
|
4441
|
-
children: /* @__PURE__ */ (0,
|
|
5207
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4442
5208
|
"div",
|
|
4443
5209
|
{
|
|
4444
|
-
className: (0,
|
|
5210
|
+
className: (0, import_clsx22.default)(
|
|
4445
5211
|
typography.paragraph,
|
|
4446
5212
|
"text-text-primary-normal desktop:pt-desktop-layout-gap",
|
|
4447
5213
|
"flex flex-col gap-desktop-layout-gap"
|
|
@@ -4458,8 +5224,8 @@ function Accordion(props) {
|
|
|
4458
5224
|
}
|
|
4459
5225
|
|
|
4460
5226
|
// src/components/Heading.tsx
|
|
4461
|
-
var
|
|
4462
|
-
var
|
|
5227
|
+
var import_clsx23 = __toESM(require("clsx"), 1);
|
|
5228
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
4463
5229
|
var Heading = (_a) => {
|
|
4464
5230
|
var _b = _a, {
|
|
4465
5231
|
className,
|
|
@@ -4482,12 +5248,12 @@ var Heading = (_a) => {
|
|
|
4482
5248
|
]);
|
|
4483
5249
|
const defaultElement = variant === "heading1" ? "h1" : variant === "heading2" ? "h2" : "h3";
|
|
4484
5250
|
const Element = as != null ? as : defaultElement;
|
|
4485
|
-
return /* @__PURE__ */ (0,
|
|
5251
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4486
5252
|
Element,
|
|
4487
5253
|
__spreadProps(__spreadValues({
|
|
4488
5254
|
id,
|
|
4489
5255
|
"data-testid": testid,
|
|
4490
|
-
className: (0,
|
|
5256
|
+
className: (0, import_clsx23.default)(
|
|
4491
5257
|
typography[variant],
|
|
4492
5258
|
className,
|
|
4493
5259
|
align === "left" && "text-left",
|
|
@@ -4503,15 +5269,15 @@ var Heading = (_a) => {
|
|
|
4503
5269
|
);
|
|
4504
5270
|
};
|
|
4505
5271
|
Heading.displayName = "Heading";
|
|
4506
|
-
var Heading1 = (props) => /* @__PURE__ */ (0,
|
|
4507
|
-
var Heading2 = (props) => /* @__PURE__ */ (0,
|
|
4508
|
-
var Heading3 = (props) => /* @__PURE__ */ (0,
|
|
5272
|
+
var Heading1 = (props) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Heading, __spreadProps(__spreadValues({}, props), { variant: "heading1" }));
|
|
5273
|
+
var Heading2 = (props) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Heading, __spreadProps(__spreadValues({}, props), { variant: "heading2" }));
|
|
5274
|
+
var Heading3 = (props) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Heading, __spreadProps(__spreadValues({}, props), { variant: "heading3" }));
|
|
4509
5275
|
Heading1.displayName = "Heading1";
|
|
4510
5276
|
Heading2.displayName = "Heading2";
|
|
4511
5277
|
Heading3.displayName = "Heading3";
|
|
4512
5278
|
|
|
4513
5279
|
// src/components/Theme.tsx
|
|
4514
|
-
var
|
|
5280
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
4515
5281
|
function Theme({
|
|
4516
5282
|
theme,
|
|
4517
5283
|
children,
|
|
@@ -4519,7 +5285,7 @@ function Theme({
|
|
|
4519
5285
|
testid,
|
|
4520
5286
|
ref
|
|
4521
5287
|
}) {
|
|
4522
|
-
return /* @__PURE__ */ (0,
|
|
5288
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4523
5289
|
"div",
|
|
4524
5290
|
{
|
|
4525
5291
|
id,
|
|
@@ -4535,18 +5301,18 @@ function Theme({
|
|
|
4535
5301
|
}
|
|
4536
5302
|
|
|
4537
5303
|
// src/components/MobileDataGrid/ColumnSelector/index.tsx
|
|
4538
|
-
var
|
|
5304
|
+
var import_react23 = require("react");
|
|
4539
5305
|
|
|
4540
5306
|
// src/components/MobileDataGrid/GridContextProvider/useGridContext.ts
|
|
4541
|
-
var
|
|
5307
|
+
var import_react22 = require("react");
|
|
4542
5308
|
|
|
4543
5309
|
// src/components/MobileDataGrid/GridContextProvider/GridContext.tsx
|
|
4544
|
-
var
|
|
4545
|
-
var GridContext = (0,
|
|
5310
|
+
var import_react21 = require("react");
|
|
5311
|
+
var GridContext = (0, import_react21.createContext)(null);
|
|
4546
5312
|
|
|
4547
5313
|
// src/components/MobileDataGrid/GridContextProvider/useGridContext.ts
|
|
4548
5314
|
function useGridContext() {
|
|
4549
|
-
const ctx = (0,
|
|
5315
|
+
const ctx = (0, import_react22.useContext)(GridContext);
|
|
4550
5316
|
if (!ctx) {
|
|
4551
5317
|
throw new Error("useGridContext must be used within GridContextProvider");
|
|
4552
5318
|
}
|
|
@@ -4554,11 +5320,11 @@ function useGridContext() {
|
|
|
4554
5320
|
}
|
|
4555
5321
|
|
|
4556
5322
|
// src/components/MobileDataGrid/ColumnSelector/index.tsx
|
|
4557
|
-
var
|
|
5323
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
4558
5324
|
function ColumnSelector() {
|
|
4559
5325
|
const context = useGridContext();
|
|
4560
|
-
const ref = (0,
|
|
4561
|
-
const [show, setShow] = (0,
|
|
5326
|
+
const ref = (0, import_react23.useRef)(null);
|
|
5327
|
+
const [show, setShow] = (0, import_react23.useState)(false);
|
|
4562
5328
|
const {
|
|
4563
5329
|
columns,
|
|
4564
5330
|
id,
|
|
@@ -4569,13 +5335,13 @@ function ColumnSelector() {
|
|
|
4569
5335
|
resetColumnVisibility,
|
|
4570
5336
|
dispatch
|
|
4571
5337
|
} = context;
|
|
4572
|
-
const toggleColumnVisibility = (0,
|
|
5338
|
+
const toggleColumnVisibility = (0, import_react23.useCallback)(
|
|
4573
5339
|
(index, visible) => {
|
|
4574
5340
|
dispatch({ type: "UPDATE", index, payload: { meta: { visible } } });
|
|
4575
5341
|
},
|
|
4576
5342
|
[dispatch]
|
|
4577
5343
|
);
|
|
4578
|
-
return /* @__PURE__ */ (0,
|
|
5344
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
4579
5345
|
"div",
|
|
4580
5346
|
{
|
|
4581
5347
|
id: id ? `${id}-column-selector` : void 0,
|
|
@@ -4583,7 +5349,7 @@ function ColumnSelector() {
|
|
|
4583
5349
|
className: "text-text-secondary-normal border-l border-brand-200 p-mobile-container-padding",
|
|
4584
5350
|
ref,
|
|
4585
5351
|
children: [
|
|
4586
|
-
/* @__PURE__ */ (0,
|
|
5352
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4587
5353
|
Button,
|
|
4588
5354
|
{
|
|
4589
5355
|
id: id ? `${id}-button` : void 0,
|
|
@@ -4592,10 +5358,10 @@ function ColumnSelector() {
|
|
|
4592
5358
|
variant: "navigation",
|
|
4593
5359
|
iconOnly: true,
|
|
4594
5360
|
size: 24,
|
|
4595
|
-
leftIcon: /* @__PURE__ */ (0,
|
|
5361
|
+
leftIcon: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Icon, { name: "tune" })
|
|
4596
5362
|
}
|
|
4597
5363
|
),
|
|
4598
|
-
/* @__PURE__ */ (0,
|
|
5364
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
4599
5365
|
Menu,
|
|
4600
5366
|
{
|
|
4601
5367
|
id: id ? `${id}-menu` : void 0,
|
|
@@ -4606,7 +5372,7 @@ function ColumnSelector() {
|
|
|
4606
5372
|
setShow,
|
|
4607
5373
|
calculateMinMaxHeight: true,
|
|
4608
5374
|
children: [
|
|
4609
|
-
/* @__PURE__ */ (0,
|
|
5375
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4610
5376
|
Button,
|
|
4611
5377
|
{
|
|
4612
5378
|
id: id ? `${id}-reset-button` : void 0,
|
|
@@ -4624,11 +5390,11 @@ function ColumnSelector() {
|
|
|
4624
5390
|
return (_a = x.meta) == null ? void 0 : _a.inVisibilityMenu;
|
|
4625
5391
|
}).map((column) => {
|
|
4626
5392
|
var _a, _b, _c;
|
|
4627
|
-
return /* @__PURE__ */ (0,
|
|
5393
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4628
5394
|
MenuOption,
|
|
4629
5395
|
{
|
|
4630
5396
|
testid: testid ? `${testid}-option-${column.id}` : void 0,
|
|
4631
|
-
children: /* @__PURE__ */ (0,
|
|
5397
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4632
5398
|
Checkbox,
|
|
4633
5399
|
{
|
|
4634
5400
|
id: id ? `${id}-checkbox-${column.id}` : void 0,
|
|
@@ -4658,7 +5424,7 @@ function ColumnSelector() {
|
|
|
4658
5424
|
}
|
|
4659
5425
|
|
|
4660
5426
|
// src/components/MobileDataGrid/MobileDataGridHeader.tsx
|
|
4661
|
-
var
|
|
5427
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
4662
5428
|
function MobileDataGridHeader({
|
|
4663
5429
|
header: Header,
|
|
4664
5430
|
enableColumnSelector,
|
|
@@ -4676,15 +5442,15 @@ function MobileDataGridHeader({
|
|
|
4676
5442
|
handleRowSelectAll
|
|
4677
5443
|
} = ctx;
|
|
4678
5444
|
if (typeof Header === "undefined" && !primaryKey) return null;
|
|
4679
|
-
if (typeof Header === "function") return /* @__PURE__ */ (0,
|
|
5445
|
+
if (typeof Header === "function") return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Header, __spreadValues({}, ctx));
|
|
4680
5446
|
if (typeof Header === "string" || primaryKey)
|
|
4681
|
-
return /* @__PURE__ */ (0,
|
|
5447
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
4682
5448
|
"div",
|
|
4683
5449
|
{
|
|
4684
5450
|
id: id ? `${id}-header` : void 0,
|
|
4685
5451
|
"data-testid": testid ? `${testid}-header` : void 0,
|
|
4686
5452
|
className: "sticky top-0",
|
|
4687
|
-
children: /* @__PURE__ */ (0,
|
|
5453
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Theme, { theme: "brand", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
4688
5454
|
Stack,
|
|
4689
5455
|
{
|
|
4690
5456
|
horizontal: true,
|
|
@@ -4693,7 +5459,7 @@ function MobileDataGridHeader({
|
|
|
4693
5459
|
justify: "between",
|
|
4694
5460
|
backgroundColor: "background-primary-normal",
|
|
4695
5461
|
children: [
|
|
4696
|
-
enableRowSelection && /* @__PURE__ */ (0,
|
|
5462
|
+
enableRowSelection && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "p-mobile-component-padding border-r border-brand-200 max-w-fit h-full", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
4697
5463
|
Checkbox,
|
|
4698
5464
|
{
|
|
4699
5465
|
id: id ? `${id}-select-all-checkbox` : void 0,
|
|
@@ -4703,7 +5469,7 @@ function MobileDataGridHeader({
|
|
|
4703
5469
|
onChange: handleRowSelectAll
|
|
4704
5470
|
}
|
|
4705
5471
|
) }),
|
|
4706
|
-
/* @__PURE__ */ (0,
|
|
5472
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
4707
5473
|
Stack,
|
|
4708
5474
|
{
|
|
4709
5475
|
horizontal: true,
|
|
@@ -4711,10 +5477,10 @@ function MobileDataGridHeader({
|
|
|
4711
5477
|
items: "center",
|
|
4712
5478
|
sizing: "component",
|
|
4713
5479
|
padding: true,
|
|
4714
|
-
children: /* @__PURE__ */ (0,
|
|
5480
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Heading3, { as: "span", color: "text-primary-normal", children: typeof Header === "string" ? Header : (_b = (_a = columns.find((col) => col.id === primaryKey)) == null ? void 0 : _a.header) == null ? void 0 : _b.toString() })
|
|
4715
5481
|
}
|
|
4716
5482
|
),
|
|
4717
|
-
enableColumnSelector && /* @__PURE__ */ (0,
|
|
5483
|
+
enableColumnSelector && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ColumnSelector, {})
|
|
4718
5484
|
]
|
|
4719
5485
|
}
|
|
4720
5486
|
) })
|
|
@@ -4723,7 +5489,7 @@ function MobileDataGridHeader({
|
|
|
4723
5489
|
}
|
|
4724
5490
|
|
|
4725
5491
|
// src/components/MobileDataGrid/GridContextProvider/index.tsx
|
|
4726
|
-
var
|
|
5492
|
+
var import_react24 = require("react");
|
|
4727
5493
|
|
|
4728
5494
|
// src/components/MobileDataGrid/dataGridReducer.ts
|
|
4729
5495
|
function dataGridReducer(state, action) {
|
|
@@ -4753,7 +5519,7 @@ function dataGridReducer(state, action) {
|
|
|
4753
5519
|
}
|
|
4754
5520
|
|
|
4755
5521
|
// src/components/MobileDataGrid/GridContextProvider/index.tsx
|
|
4756
|
-
var
|
|
5522
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
4757
5523
|
function GridContextProvider(props) {
|
|
4758
5524
|
const {
|
|
4759
5525
|
initialColumns,
|
|
@@ -4766,10 +5532,10 @@ function GridContextProvider(props) {
|
|
|
4766
5532
|
getId,
|
|
4767
5533
|
onRowSelect
|
|
4768
5534
|
} = props;
|
|
4769
|
-
const [columns, dispatch] = (0,
|
|
4770
|
-
const [selectedRowIds, setSelectedRowIds] = (0,
|
|
4771
|
-
const [currentRow, setCurrentRow] = (0,
|
|
4772
|
-
const resetColumnVisibility = (0,
|
|
5535
|
+
const [columns, dispatch] = (0, import_react24.useReducer)(dataGridReducer, initialColumns);
|
|
5536
|
+
const [selectedRowIds, setSelectedRowIds] = (0, import_react24.useState)([]);
|
|
5537
|
+
const [currentRow, setCurrentRow] = (0, import_react24.useState)(null);
|
|
5538
|
+
const resetColumnVisibility = (0, import_react24.useCallback)(() => {
|
|
4773
5539
|
const newColumns = columns.map((column) => {
|
|
4774
5540
|
var _a;
|
|
4775
5541
|
const initialColumn = initialColumns.find((c) => c.id === column.id);
|
|
@@ -4781,7 +5547,7 @@ function GridContextProvider(props) {
|
|
|
4781
5547
|
});
|
|
4782
5548
|
dispatch({ type: "SET", payload: newColumns });
|
|
4783
5549
|
}, [columns, initialColumns]);
|
|
4784
|
-
const handleRowSelect = (0,
|
|
5550
|
+
const handleRowSelect = (0, import_react24.useCallback)(
|
|
4785
5551
|
(item) => {
|
|
4786
5552
|
var _a;
|
|
4787
5553
|
const rowId = (_a = getId(item)) != null ? _a : "";
|
|
@@ -4792,7 +5558,7 @@ function GridContextProvider(props) {
|
|
|
4792
5558
|
},
|
|
4793
5559
|
[getId, onRowSelect, selectedRowIds]
|
|
4794
5560
|
);
|
|
4795
|
-
const handleRowSelectAll = (0,
|
|
5561
|
+
const handleRowSelectAll = (0, import_react24.useCallback)(() => {
|
|
4796
5562
|
setSelectedRowIds((prev) => {
|
|
4797
5563
|
if (prev.length === data.length) {
|
|
4798
5564
|
return [];
|
|
@@ -4800,13 +5566,13 @@ function GridContextProvider(props) {
|
|
|
4800
5566
|
return data.map(getId).filter((id2) => id2 !== void 0);
|
|
4801
5567
|
});
|
|
4802
5568
|
}, [data, getId]);
|
|
4803
|
-
const openRowDetail = (0,
|
|
5569
|
+
const openRowDetail = (0, import_react24.useCallback)((row) => {
|
|
4804
5570
|
setCurrentRow(row);
|
|
4805
5571
|
}, []);
|
|
4806
|
-
const closeRowDetail = (0,
|
|
5572
|
+
const closeRowDetail = (0, import_react24.useCallback)(() => {
|
|
4807
5573
|
setCurrentRow(null);
|
|
4808
5574
|
}, []);
|
|
4809
|
-
const visibleColumns = (0,
|
|
5575
|
+
const visibleColumns = (0, import_react24.useMemo)(() => {
|
|
4810
5576
|
const effectiveLimit = typeof numberOfColumnsToShow === "number" ? Math.max(numberOfColumnsToShow - 1, 0) : void 0;
|
|
4811
5577
|
if (primaryKey) {
|
|
4812
5578
|
const pkColumn = columns.find((col) => col.id === String(primaryKey));
|
|
@@ -4824,7 +5590,7 @@ function GridContextProvider(props) {
|
|
|
4824
5590
|
return ((_a = x.meta) == null ? void 0 : _a.visible) !== false;
|
|
4825
5591
|
}).slice(0, effectiveLimit);
|
|
4826
5592
|
}, [columns, numberOfColumnsToShow, primaryKey]);
|
|
4827
|
-
return /* @__PURE__ */ (0,
|
|
5593
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4828
5594
|
GridContext.Provider,
|
|
4829
5595
|
{
|
|
4830
5596
|
value: {
|
|
@@ -4852,12 +5618,12 @@ function GridContextProvider(props) {
|
|
|
4852
5618
|
}
|
|
4853
5619
|
|
|
4854
5620
|
// src/components/Modal.tsx
|
|
4855
|
-
var
|
|
4856
|
-
var
|
|
5621
|
+
var import_clsx28 = __toESM(require("clsx"), 1);
|
|
5622
|
+
var import_react26 = require("react");
|
|
4857
5623
|
|
|
4858
5624
|
// src/components/ModalHeader.tsx
|
|
4859
|
-
var
|
|
4860
|
-
var
|
|
5625
|
+
var import_clsx24 = __toESM(require("clsx"), 1);
|
|
5626
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
4861
5627
|
var ModalHeader = ({
|
|
4862
5628
|
title,
|
|
4863
5629
|
hideCloseIcon,
|
|
@@ -4868,12 +5634,12 @@ var ModalHeader = ({
|
|
|
4868
5634
|
testid,
|
|
4869
5635
|
headerClassname
|
|
4870
5636
|
}) => {
|
|
4871
|
-
return /* @__PURE__ */ (0,
|
|
5637
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
4872
5638
|
"div",
|
|
4873
5639
|
{
|
|
4874
5640
|
id,
|
|
4875
5641
|
"data-testid": testid,
|
|
4876
|
-
className: (0,
|
|
5642
|
+
className: (0, import_clsx24.default)(
|
|
4877
5643
|
"flex justify-between items-center",
|
|
4878
5644
|
headerIconAlign === "center" && "justify-center",
|
|
4879
5645
|
headerIconAlign === "right" && "justify-end",
|
|
@@ -4883,9 +5649,9 @@ var ModalHeader = ({
|
|
|
4883
5649
|
headerClassname
|
|
4884
5650
|
),
|
|
4885
5651
|
children: [
|
|
4886
|
-
/* @__PURE__ */ (0,
|
|
5652
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: (0, import_clsx24.default)("flex items-center flex-1", layoutGroupGap), children: [
|
|
4887
5653
|
headerIcon,
|
|
4888
|
-
title && /* @__PURE__ */ (0,
|
|
5654
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4889
5655
|
Heading2,
|
|
4890
5656
|
{
|
|
4891
5657
|
id: id ? `${id}-title` : void 0,
|
|
@@ -4895,7 +5661,7 @@ var ModalHeader = ({
|
|
|
4895
5661
|
}
|
|
4896
5662
|
)
|
|
4897
5663
|
] }),
|
|
4898
|
-
!hideCloseIcon && /* @__PURE__ */ (0,
|
|
5664
|
+
!hideCloseIcon && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4899
5665
|
Button,
|
|
4900
5666
|
{
|
|
4901
5667
|
id: id ? `${id}-close-button` : void 0,
|
|
@@ -4903,7 +5669,7 @@ var ModalHeader = ({
|
|
|
4903
5669
|
iconOnly: true,
|
|
4904
5670
|
variant: "tertiary",
|
|
4905
5671
|
onClick: onClose,
|
|
4906
|
-
leftIcon: /* @__PURE__ */ (0,
|
|
5672
|
+
leftIcon: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-brand-text-action-primary-normal desktop:text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Icon, { name: "close", size: 24 }) })
|
|
4907
5673
|
}
|
|
4908
5674
|
)
|
|
4909
5675
|
]
|
|
@@ -4913,20 +5679,20 @@ var ModalHeader = ({
|
|
|
4913
5679
|
ModalHeader.displayName = "ModalHeader";
|
|
4914
5680
|
|
|
4915
5681
|
// src/components/ModalContent.tsx
|
|
4916
|
-
var
|
|
4917
|
-
var
|
|
5682
|
+
var import_clsx25 = __toESM(require("clsx"), 1);
|
|
5683
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
4918
5684
|
function ModalContent({
|
|
4919
5685
|
fixedHeightScrolling,
|
|
4920
5686
|
children,
|
|
4921
5687
|
id,
|
|
4922
5688
|
testid
|
|
4923
5689
|
}) {
|
|
4924
|
-
return /* @__PURE__ */ (0,
|
|
5690
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4925
5691
|
"div",
|
|
4926
5692
|
{
|
|
4927
5693
|
id,
|
|
4928
5694
|
"data-testid": testid,
|
|
4929
|
-
className: (0,
|
|
5695
|
+
className: (0, import_clsx25.default)(
|
|
4930
5696
|
"flex-grow desktop:flex-grow-0",
|
|
4931
5697
|
layoutPaddding,
|
|
4932
5698
|
fixedHeightScrolling && "overflow-auto"
|
|
@@ -4938,8 +5704,8 @@ function ModalContent({
|
|
|
4938
5704
|
ModalContent.displayName = "ModalContent";
|
|
4939
5705
|
|
|
4940
5706
|
// src/components/ModalButtons.tsx
|
|
4941
|
-
var
|
|
4942
|
-
var
|
|
5707
|
+
var import_clsx26 = __toESM(require("clsx"), 1);
|
|
5708
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
4943
5709
|
var ModalButtons = ({
|
|
4944
5710
|
onClose,
|
|
4945
5711
|
onContinue,
|
|
@@ -4947,36 +5713,36 @@ var ModalButtons = ({
|
|
|
4947
5713
|
id,
|
|
4948
5714
|
testid
|
|
4949
5715
|
}) => {
|
|
4950
|
-
return /* @__PURE__ */ (0,
|
|
5716
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4951
5717
|
"div",
|
|
4952
5718
|
{
|
|
4953
5719
|
id,
|
|
4954
5720
|
"data-testid": testid,
|
|
4955
|
-
className: (0,
|
|
5721
|
+
className: (0, import_clsx26.default)(
|
|
4956
5722
|
"border-t border-neutral-300 flex justify-end",
|
|
4957
5723
|
layoutPaddding,
|
|
4958
5724
|
layoutGroupGap
|
|
4959
5725
|
),
|
|
4960
|
-
children: customActions != null ? customActions : /* @__PURE__ */ (0,
|
|
4961
|
-
/* @__PURE__ */ (0,
|
|
5726
|
+
children: customActions != null ? customActions : /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
5727
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4962
5728
|
Button,
|
|
4963
5729
|
{
|
|
4964
5730
|
id: id ? `${id}-close-button` : void 0,
|
|
4965
5731
|
testid: testid ? `${testid}-close-button` : void 0,
|
|
4966
5732
|
variant: "secondary",
|
|
4967
|
-
leftIcon: /* @__PURE__ */ (0,
|
|
5733
|
+
leftIcon: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Icon, { name: "close", size: 24 }),
|
|
4968
5734
|
onClick: onClose,
|
|
4969
5735
|
className: "max-sm:w-full",
|
|
4970
5736
|
children: "Close"
|
|
4971
5737
|
}
|
|
4972
5738
|
),
|
|
4973
|
-
/* @__PURE__ */ (0,
|
|
5739
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4974
5740
|
Button,
|
|
4975
5741
|
{
|
|
4976
5742
|
id: id ? `${id}-continue-button` : void 0,
|
|
4977
5743
|
testid: testid ? `${testid}-continue-button` : void 0,
|
|
4978
5744
|
variant: "primary",
|
|
4979
|
-
leftIcon: /* @__PURE__ */ (0,
|
|
5745
|
+
leftIcon: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Icon, { name: "check", size: 24 }),
|
|
4980
5746
|
className: "max-sm:w-full",
|
|
4981
5747
|
onClick: onContinue,
|
|
4982
5748
|
children: "Continue"
|
|
@@ -4989,8 +5755,8 @@ var ModalButtons = ({
|
|
|
4989
5755
|
ModalButtons.displayName = "ModalButtons";
|
|
4990
5756
|
|
|
4991
5757
|
// src/components/ModalScrim.tsx
|
|
4992
|
-
var
|
|
4993
|
-
var
|
|
5758
|
+
var import_clsx27 = __toESM(require("clsx"), 1);
|
|
5759
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
4994
5760
|
var ModalScrim = ({
|
|
4995
5761
|
show = false,
|
|
4996
5762
|
size = "small",
|
|
@@ -5000,12 +5766,12 @@ var ModalScrim = ({
|
|
|
5000
5766
|
id,
|
|
5001
5767
|
testid
|
|
5002
5768
|
}) => {
|
|
5003
|
-
return /* @__PURE__ */ (0,
|
|
5769
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
5004
5770
|
"div",
|
|
5005
5771
|
{
|
|
5006
5772
|
id,
|
|
5007
5773
|
"data-testid": testid,
|
|
5008
|
-
className: (0,
|
|
5774
|
+
className: (0, import_clsx27.default)(
|
|
5009
5775
|
"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",
|
|
5010
5776
|
!show && " pointer-events-none",
|
|
5011
5777
|
size === "small" && "p-4",
|
|
@@ -5021,14 +5787,14 @@ var ModalScrim = ({
|
|
|
5021
5787
|
ModalScrim.displayName = "ModalScrim";
|
|
5022
5788
|
|
|
5023
5789
|
// src/components/Modal.tsx
|
|
5024
|
-
var
|
|
5790
|
+
var import_react_dom4 = require("react-dom");
|
|
5025
5791
|
var import_react_use = require("react-use");
|
|
5026
5792
|
|
|
5027
5793
|
// src/components/useMounted.tsx
|
|
5028
|
-
var
|
|
5794
|
+
var import_react25 = require("react");
|
|
5029
5795
|
var useMounted = () => {
|
|
5030
|
-
const [isMounted, setIsMounted] = (0,
|
|
5031
|
-
(0,
|
|
5796
|
+
const [isMounted, setIsMounted] = (0, import_react25.useState)(false);
|
|
5797
|
+
(0, import_react25.useEffect)(() => {
|
|
5032
5798
|
setIsMounted(true);
|
|
5033
5799
|
return () => setIsMounted(false);
|
|
5034
5800
|
}, []);
|
|
@@ -5036,7 +5802,7 @@ var useMounted = () => {
|
|
|
5036
5802
|
};
|
|
5037
5803
|
|
|
5038
5804
|
// src/components/Modal.tsx
|
|
5039
|
-
var
|
|
5805
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
5040
5806
|
var fadeInScale = (element, duration = 300) => element.animate(
|
|
5041
5807
|
[
|
|
5042
5808
|
{ opacity: 0, transform: "scale(0.95)" },
|
|
@@ -5120,12 +5886,12 @@ var Modal = ({
|
|
|
5120
5886
|
}) => {
|
|
5121
5887
|
var _a;
|
|
5122
5888
|
const mounted = useMounted();
|
|
5123
|
-
const modalRef = (0,
|
|
5124
|
-
const bgRef = (0,
|
|
5889
|
+
const modalRef = (0, import_react26.useRef)(null);
|
|
5890
|
+
const bgRef = (0, import_react26.useRef)(null);
|
|
5125
5891
|
const wasOpen = (0, import_react_use.usePrevious)(open);
|
|
5126
5892
|
const isMobile = useMatchesMobile();
|
|
5127
5893
|
const computedFixedHeightScrolling = isMobile || fixedHeightScrolling;
|
|
5128
|
-
(0,
|
|
5894
|
+
(0, import_react26.useEffect)(() => {
|
|
5129
5895
|
if (!mounted) return;
|
|
5130
5896
|
if (!modalRef.current || !bgRef.current) {
|
|
5131
5897
|
console.error("Modal or background reference is not set.");
|
|
@@ -5145,7 +5911,7 @@ var Modal = ({
|
|
|
5145
5911
|
bgFadeIn(bgRef.current);
|
|
5146
5912
|
}
|
|
5147
5913
|
}, [mounted, onClose, open, wasOpen]);
|
|
5148
|
-
const handleKeyDown = (0,
|
|
5914
|
+
const handleKeyDown = (0, import_react26.useCallback)(
|
|
5149
5915
|
(e) => {
|
|
5150
5916
|
if (e.key === "Escape") {
|
|
5151
5917
|
if (onClose) {
|
|
@@ -5156,12 +5922,12 @@ var Modal = ({
|
|
|
5156
5922
|
},
|
|
5157
5923
|
[onClose]
|
|
5158
5924
|
);
|
|
5159
|
-
const handleClose = (0,
|
|
5925
|
+
const handleClose = (0, import_react26.useCallback)(() => {
|
|
5160
5926
|
if (onClose) {
|
|
5161
5927
|
onClose();
|
|
5162
5928
|
}
|
|
5163
5929
|
}, [onClose]);
|
|
5164
|
-
(0,
|
|
5930
|
+
(0, import_react26.useEffect)(() => {
|
|
5165
5931
|
if (open) {
|
|
5166
5932
|
document.addEventListener("keyup", handleKeyDown);
|
|
5167
5933
|
}
|
|
@@ -5169,7 +5935,7 @@ var Modal = ({
|
|
|
5169
5935
|
document.removeEventListener("keyup", handleKeyDown);
|
|
5170
5936
|
};
|
|
5171
5937
|
}, [open, handleKeyDown]);
|
|
5172
|
-
(0,
|
|
5938
|
+
(0, import_react26.useEffect)(() => {
|
|
5173
5939
|
if (!open) return;
|
|
5174
5940
|
const scrollY = window.scrollY;
|
|
5175
5941
|
const body = document.body;
|
|
@@ -5190,7 +5956,7 @@ var Modal = ({
|
|
|
5190
5956
|
};
|
|
5191
5957
|
}, [open]);
|
|
5192
5958
|
const { sizeClass } = (_a = sizes[size]) != null ? _a : sizes.small;
|
|
5193
|
-
const backgroundClickHandler = (0,
|
|
5959
|
+
const backgroundClickHandler = (0, import_react26.useCallback)(
|
|
5194
5960
|
(e) => {
|
|
5195
5961
|
const target = e.target;
|
|
5196
5962
|
const currentTarget = e.currentTarget;
|
|
@@ -5207,8 +5973,8 @@ var Modal = ({
|
|
|
5207
5973
|
if (!mounted) {
|
|
5208
5974
|
return null;
|
|
5209
5975
|
}
|
|
5210
|
-
return (0,
|
|
5211
|
-
/* @__PURE__ */ (0,
|
|
5976
|
+
return (0, import_react_dom4.createPortal)(
|
|
5977
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
5212
5978
|
ModalScrim,
|
|
5213
5979
|
{
|
|
5214
5980
|
id: id ? `${id}-scrim` : void 0,
|
|
@@ -5217,13 +5983,13 @@ var Modal = ({
|
|
|
5217
5983
|
ref: bgRef,
|
|
5218
5984
|
show: open,
|
|
5219
5985
|
onClick: backgroundClickHandler,
|
|
5220
|
-
children: /* @__PURE__ */ (0,
|
|
5986
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
5221
5987
|
"div",
|
|
5222
5988
|
{
|
|
5223
5989
|
id,
|
|
5224
5990
|
"data-testid": testid,
|
|
5225
5991
|
ref: modalRef,
|
|
5226
|
-
className: (0,
|
|
5992
|
+
className: (0, import_clsx28.default)(
|
|
5227
5993
|
"shadow-md rounded-sm flex flex-col overflow-hidden w-full opacity-0 h-fit",
|
|
5228
5994
|
computedFixedHeightScrolling && size !== "screen" && "desktop:max-h-[calc(100vh-32px)] desktop:h-auto",
|
|
5229
5995
|
className,
|
|
@@ -5232,7 +5998,7 @@ var Modal = ({
|
|
|
5232
5998
|
),
|
|
5233
5999
|
onClick: (e) => e.stopPropagation(),
|
|
5234
6000
|
children: [
|
|
5235
|
-
/* @__PURE__ */ (0,
|
|
6001
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
5236
6002
|
ModalHeader,
|
|
5237
6003
|
{
|
|
5238
6004
|
id: id ? `${id}-header` : void 0,
|
|
@@ -5245,7 +6011,7 @@ var Modal = ({
|
|
|
5245
6011
|
headerClassname
|
|
5246
6012
|
}
|
|
5247
6013
|
),
|
|
5248
|
-
children && (size !== "screen" || noWrapper) ? /* @__PURE__ */ (0,
|
|
6014
|
+
children && (size !== "screen" || noWrapper) ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
5249
6015
|
ModalContent,
|
|
5250
6016
|
{
|
|
5251
6017
|
id: id ? `${id}-content` : void 0,
|
|
@@ -5254,7 +6020,7 @@ var Modal = ({
|
|
|
5254
6020
|
children
|
|
5255
6021
|
}
|
|
5256
6022
|
) : children,
|
|
5257
|
-
showButtons ? customFooter ? customActions : /* @__PURE__ */ (0,
|
|
6023
|
+
showButtons ? customFooter ? customActions : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
5258
6024
|
ModalButtons,
|
|
5259
6025
|
{
|
|
5260
6026
|
id: id ? `${id}-buttons` : void 0,
|
|
@@ -5275,12 +6041,12 @@ var Modal = ({
|
|
|
5275
6041
|
Modal.displayName = "Modal";
|
|
5276
6042
|
|
|
5277
6043
|
// src/components/MobileDataGrid/MobileDataGridCard/MobileDataGridColumn.tsx
|
|
5278
|
-
var
|
|
6044
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
5279
6045
|
function MobileDataGridColumn(props) {
|
|
5280
6046
|
var _a;
|
|
5281
6047
|
const { column, data } = props;
|
|
5282
|
-
return /* @__PURE__ */ (0,
|
|
5283
|
-
/* @__PURE__ */ (0,
|
|
6048
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "grid grid-cols-2 gap-2 px-3 flex-1", children: [
|
|
6049
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Paragraph, { color: "text-secondary-normal", className: "text-left", children: [
|
|
5284
6050
|
(_a = column.header) == null ? void 0 : _a.toString(),
|
|
5285
6051
|
":"
|
|
5286
6052
|
] }),
|
|
@@ -5290,28 +6056,28 @@ function MobileDataGridColumn(props) {
|
|
|
5290
6056
|
}
|
|
5291
6057
|
|
|
5292
6058
|
// src/components/MobileDataGrid/RowDetailModalProvider/ModalContent.tsx
|
|
5293
|
-
var
|
|
6059
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
5294
6060
|
function ModalContent2() {
|
|
5295
6061
|
const context = useGridContext();
|
|
5296
6062
|
const { columns, currentRow } = context;
|
|
5297
6063
|
if (!currentRow) return null;
|
|
5298
|
-
return /* @__PURE__ */ (0,
|
|
6064
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Stack, { sizing: "layout-group", children: columns.filter((x) => {
|
|
5299
6065
|
var _a;
|
|
5300
6066
|
return !((_a = x.id) == null ? void 0 : _a.startsWith("__"));
|
|
5301
6067
|
}).map(
|
|
5302
6068
|
(column, index) => {
|
|
5303
6069
|
var _a, _b;
|
|
5304
|
-
return ((_a = column.meta) == null ? void 0 : _a.useCustomRenderer) && column.meta.mobileCell && column.id ? /* @__PURE__ */ (0,
|
|
6070
|
+
return ((_a = column.meta) == null ? void 0 : _a.useCustomRenderer) && column.meta.mobileCell && column.id ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
5305
6071
|
"div",
|
|
5306
6072
|
{
|
|
5307
6073
|
className: "grid grid-cols-2 gap-2 px-3 items-center flex-1",
|
|
5308
6074
|
children: [
|
|
5309
|
-
/* @__PURE__ */ (0,
|
|
6075
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Paragraph, { color: "text-secondary-normal", className: "text-left", children: [
|
|
5310
6076
|
(_b = column.header) == null ? void 0 : _b.toString(),
|
|
5311
6077
|
":"
|
|
5312
6078
|
] }),
|
|
5313
6079
|
" ",
|
|
5314
|
-
/* @__PURE__ */ (0,
|
|
6080
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
5315
6081
|
column.meta.mobileCell,
|
|
5316
6082
|
{
|
|
5317
6083
|
column,
|
|
@@ -5322,7 +6088,7 @@ function ModalContent2() {
|
|
|
5322
6088
|
]
|
|
5323
6089
|
},
|
|
5324
6090
|
`${column.id}-${index}`
|
|
5325
|
-
) : /* @__PURE__ */ (0,
|
|
6091
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
5326
6092
|
MobileDataGridColumn,
|
|
5327
6093
|
{
|
|
5328
6094
|
column,
|
|
@@ -5335,7 +6101,7 @@ function ModalContent2() {
|
|
|
5335
6101
|
}
|
|
5336
6102
|
|
|
5337
6103
|
// src/components/MobileDataGrid/RowDetailModalProvider/index.tsx
|
|
5338
|
-
var
|
|
6104
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
5339
6105
|
function RowDetailModalProvider() {
|
|
5340
6106
|
var _a;
|
|
5341
6107
|
const context = useGridContext();
|
|
@@ -5347,7 +6113,7 @@ function RowDetailModalProvider() {
|
|
|
5347
6113
|
primaryKey,
|
|
5348
6114
|
closeRowDetail
|
|
5349
6115
|
} = context;
|
|
5350
|
-
return /* @__PURE__ */ (0,
|
|
6116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
5351
6117
|
Modal,
|
|
5352
6118
|
{
|
|
5353
6119
|
fixedHeightScrolling: true,
|
|
@@ -5356,7 +6122,7 @@ function RowDetailModalProvider() {
|
|
|
5356
6122
|
hideCloseIcon: true,
|
|
5357
6123
|
size: "medium",
|
|
5358
6124
|
className: "!p-0",
|
|
5359
|
-
headerIcon: /* @__PURE__ */ (0,
|
|
6125
|
+
headerIcon: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
5360
6126
|
Stack,
|
|
5361
6127
|
{
|
|
5362
6128
|
horizontal: true,
|
|
@@ -5365,8 +6131,8 @@ function RowDetailModalProvider() {
|
|
|
5365
6131
|
justify: "between",
|
|
5366
6132
|
width: "full",
|
|
5367
6133
|
children: [
|
|
5368
|
-
/* @__PURE__ */ (0,
|
|
5369
|
-
/* @__PURE__ */ (0,
|
|
6134
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Heading2, { children: (_a = currentRow == null ? void 0 : currentRow[primaryKey != null ? primaryKey : "id"]) != null ? _a : "Grid Detail" }),
|
|
6135
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
5370
6136
|
Button,
|
|
5371
6137
|
{
|
|
5372
6138
|
id: id ? `${id}-open-in-new-button` : void 0,
|
|
@@ -5374,25 +6140,25 @@ function RowDetailModalProvider() {
|
|
|
5374
6140
|
iconOnly: true,
|
|
5375
6141
|
variant: "tertiary",
|
|
5376
6142
|
onClick: closeRowDetail,
|
|
5377
|
-
leftIcon: /* @__PURE__ */ (0,
|
|
6143
|
+
leftIcon: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Icon, { name: "open_in_new", size: 24 }) })
|
|
5378
6144
|
}
|
|
5379
6145
|
)
|
|
5380
6146
|
]
|
|
5381
6147
|
}
|
|
5382
6148
|
),
|
|
5383
|
-
customActions: /* @__PURE__ */ (0,
|
|
6149
|
+
customActions: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Button, { onClick: closeRowDetail, className: "w-full", children: "Close" }),
|
|
5384
6150
|
showButtons: true,
|
|
5385
|
-
children: /* @__PURE__ */ (0,
|
|
6151
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "bg-white max-h-full flex flex-col flex-grow-1", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ModalContent2, {}) })
|
|
5386
6152
|
}
|
|
5387
6153
|
);
|
|
5388
6154
|
}
|
|
5389
6155
|
|
|
5390
6156
|
// src/components/MobileDataGrid/ColumnList.tsx
|
|
5391
|
-
var
|
|
6157
|
+
var import_clsx30 = __toESM(require("clsx"), 1);
|
|
5392
6158
|
|
|
5393
6159
|
// src/components/MobileDataGrid/MobileDataGridCard/index.tsx
|
|
5394
|
-
var
|
|
5395
|
-
var
|
|
6160
|
+
var import_clsx29 = __toESM(require("clsx"), 1);
|
|
6161
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
5396
6162
|
function MobileDataGridCard({
|
|
5397
6163
|
renderLink,
|
|
5398
6164
|
renderChevron = true,
|
|
@@ -5404,27 +6170,27 @@ function MobileDataGridCard({
|
|
|
5404
6170
|
var _a;
|
|
5405
6171
|
const context = useGridContext();
|
|
5406
6172
|
const { id, testid, visibleColumns, getId, handleRowSelect, openRowDetail } = context;
|
|
5407
|
-
return /* @__PURE__ */ (0,
|
|
6173
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
5408
6174
|
"li",
|
|
5409
6175
|
{
|
|
5410
6176
|
id: id ? `${id}-card-${getId(data)}` : void 0,
|
|
5411
6177
|
"data-testid": testid ? `${testid}-card-${getId(data)}` : void 0,
|
|
5412
|
-
className: (0,
|
|
6178
|
+
className: (0, import_clsx29.default)(
|
|
5413
6179
|
"hover:bg-action-100 cursor-pointer list-none",
|
|
5414
6180
|
selected ? "bg-action-100" : "bg-background-grouped-primary-normal"
|
|
5415
6181
|
),
|
|
5416
6182
|
onClick: () => openRowDetail(data),
|
|
5417
6183
|
children: [
|
|
5418
|
-
/* @__PURE__ */ (0,
|
|
5419
|
-
/* @__PURE__ */ (0,
|
|
5420
|
-
enableRowSelection && /* @__PURE__ */ (0,
|
|
6184
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Stack, { sizing: "component", children: [
|
|
6185
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Stack, { horizontal: true, horizontalMobile: true, items: "center", justify: "between", children: [
|
|
6186
|
+
enableRowSelection && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
5421
6187
|
Stack,
|
|
5422
6188
|
{
|
|
5423
6189
|
sizing: "component",
|
|
5424
6190
|
padding: true,
|
|
5425
6191
|
width: "fit",
|
|
5426
6192
|
onClick: (e) => e.stopPropagation(),
|
|
5427
|
-
children: /* @__PURE__ */ (0,
|
|
6193
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
5428
6194
|
Checkbox,
|
|
5429
6195
|
{
|
|
5430
6196
|
id: id ? `${id}-${getId(data)}-select-checkbox` : void 0,
|
|
@@ -5435,16 +6201,16 @@ function MobileDataGridCard({
|
|
|
5435
6201
|
)
|
|
5436
6202
|
}
|
|
5437
6203
|
),
|
|
5438
|
-
/* @__PURE__ */ (0,
|
|
6204
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
5439
6205
|
Stack,
|
|
5440
6206
|
{
|
|
5441
6207
|
sizing: "component",
|
|
5442
6208
|
padding: true,
|
|
5443
6209
|
onClick: (e) => e.stopPropagation(),
|
|
5444
|
-
children: renderLink ? renderLink(data) : /* @__PURE__ */ (0,
|
|
6210
|
+
children: renderLink ? renderLink(data) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Subheader, { children: String((_a = data[context.primaryKey]) != null ? _a : "") })
|
|
5445
6211
|
}
|
|
5446
6212
|
),
|
|
5447
|
-
/* @__PURE__ */ (0,
|
|
6213
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
5448
6214
|
Stack,
|
|
5449
6215
|
{
|
|
5450
6216
|
horizontal: true,
|
|
@@ -5457,18 +6223,18 @@ function MobileDataGridCard({
|
|
|
5457
6223
|
}
|
|
5458
6224
|
)
|
|
5459
6225
|
] }),
|
|
5460
|
-
/* @__PURE__ */ (0,
|
|
6226
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Stack, { sizing: "layout-group", children: visibleColumns.filter((x) => {
|
|
5461
6227
|
var _a2, _b;
|
|
5462
6228
|
return ((_a2 = x.meta) == null ? void 0 : _a2.visible) !== false && !((_b = x.id) == null ? void 0 : _b.startsWith("__"));
|
|
5463
6229
|
}).map(
|
|
5464
6230
|
(column, index) => {
|
|
5465
6231
|
var _a2, _b;
|
|
5466
|
-
return ((_a2 = column.meta) == null ? void 0 : _a2.useCustomRenderer) && column.meta.mobileCell && column.id ? /* @__PURE__ */ (0,
|
|
6232
|
+
return ((_a2 = column.meta) == null ? void 0 : _a2.useCustomRenderer) && column.meta.mobileCell && column.id ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
5467
6233
|
"div",
|
|
5468
6234
|
{
|
|
5469
6235
|
className: "grid grid-cols-2 gap-2 px-3 items-center flex-1",
|
|
5470
6236
|
children: [
|
|
5471
|
-
/* @__PURE__ */ (0,
|
|
6237
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
5472
6238
|
Paragraph,
|
|
5473
6239
|
{
|
|
5474
6240
|
color: "text-secondary-normal",
|
|
@@ -5480,7 +6246,7 @@ function MobileDataGridCard({
|
|
|
5480
6246
|
}
|
|
5481
6247
|
),
|
|
5482
6248
|
" ",
|
|
5483
|
-
/* @__PURE__ */ (0,
|
|
6249
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
5484
6250
|
column.meta.mobileCell,
|
|
5485
6251
|
{
|
|
5486
6252
|
column,
|
|
@@ -5491,7 +6257,7 @@ function MobileDataGridCard({
|
|
|
5491
6257
|
]
|
|
5492
6258
|
},
|
|
5493
6259
|
`${column.id}-${index}`
|
|
5494
|
-
) : /* @__PURE__ */ (0,
|
|
6260
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
5495
6261
|
MobileDataGridColumn,
|
|
5496
6262
|
{
|
|
5497
6263
|
column,
|
|
@@ -5502,14 +6268,14 @@ function MobileDataGridCard({
|
|
|
5502
6268
|
}
|
|
5503
6269
|
) })
|
|
5504
6270
|
] }),
|
|
5505
|
-
renderChevron && /* @__PURE__ */ (0,
|
|
6271
|
+
renderChevron && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Stack, { items: "center", justify: "center", horizontal: true, horizontalMobile: true, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Icon, { name: "keyboard_arrow_down" }) })
|
|
5506
6272
|
]
|
|
5507
6273
|
}
|
|
5508
6274
|
);
|
|
5509
6275
|
}
|
|
5510
6276
|
|
|
5511
6277
|
// src/components/MobileDataGrid/ColumnList.tsx
|
|
5512
|
-
var
|
|
6278
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
5513
6279
|
function ColumnList(props) {
|
|
5514
6280
|
const {
|
|
5515
6281
|
withBorder,
|
|
@@ -5521,19 +6287,19 @@ function ColumnList(props) {
|
|
|
5521
6287
|
} = props;
|
|
5522
6288
|
const ctx = useGridContext();
|
|
5523
6289
|
const { id, testid, data, getId, selectedRowIds } = ctx;
|
|
5524
|
-
return /* @__PURE__ */ (0,
|
|
6290
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
5525
6291
|
"div",
|
|
5526
6292
|
{
|
|
5527
|
-
className: (0,
|
|
6293
|
+
className: (0, import_clsx30.default)(
|
|
5528
6294
|
"flex flex-col flex-1 relative overflow-y-auto overflow-x-hidden",
|
|
5529
6295
|
!!Footer && "mb-20"
|
|
5530
6296
|
),
|
|
5531
|
-
children: /* @__PURE__ */ (0,
|
|
6297
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
5532
6298
|
"ul",
|
|
5533
6299
|
{
|
|
5534
6300
|
id,
|
|
5535
6301
|
"data-testid": testid,
|
|
5536
|
-
className: (0,
|
|
6302
|
+
className: (0, import_clsx30.default)(
|
|
5537
6303
|
"rounded absolute top-0 left-0 w-full flex-1",
|
|
5538
6304
|
"divide-y divide-border-primary-normal",
|
|
5539
6305
|
withBorder && "border border-border-primary-normal"
|
|
@@ -5541,7 +6307,7 @@ function ColumnList(props) {
|
|
|
5541
6307
|
children: [
|
|
5542
6308
|
data.map((item) => {
|
|
5543
6309
|
const id2 = getId(item);
|
|
5544
|
-
return /* @__PURE__ */ (0,
|
|
6310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
5545
6311
|
MobileDataGridCard,
|
|
5546
6312
|
{
|
|
5547
6313
|
data: item,
|
|
@@ -5554,7 +6320,7 @@ function ColumnList(props) {
|
|
|
5554
6320
|
id2
|
|
5555
6321
|
);
|
|
5556
6322
|
}),
|
|
5557
|
-
!!Footer && /* @__PURE__ */ (0,
|
|
6323
|
+
!!Footer && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "fixed left-0 right-0 bottom-0 flex flex-col w-full min-h-20", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Footer, __spreadValues({}, ctx)) })
|
|
5558
6324
|
]
|
|
5559
6325
|
}
|
|
5560
6326
|
)
|
|
@@ -5563,7 +6329,7 @@ function ColumnList(props) {
|
|
|
5563
6329
|
}
|
|
5564
6330
|
|
|
5565
6331
|
// src/components/MobileDataGrid/index.tsx
|
|
5566
|
-
var
|
|
6332
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
5567
6333
|
function MobileDataGrid(props) {
|
|
5568
6334
|
const {
|
|
5569
6335
|
columns,
|
|
@@ -5585,7 +6351,7 @@ function MobileDataGrid(props) {
|
|
|
5585
6351
|
rowActions,
|
|
5586
6352
|
rounded
|
|
5587
6353
|
} = props;
|
|
5588
|
-
return /* @__PURE__ */ (0,
|
|
6354
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
5589
6355
|
GridContextProvider,
|
|
5590
6356
|
{
|
|
5591
6357
|
initialColumns: columns,
|
|
@@ -5597,7 +6363,7 @@ function MobileDataGrid(props) {
|
|
|
5597
6363
|
numberOfColumnsToShow,
|
|
5598
6364
|
primaryKey,
|
|
5599
6365
|
children: [
|
|
5600
|
-
/* @__PURE__ */ (0,
|
|
6366
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
5601
6367
|
Stack,
|
|
5602
6368
|
{
|
|
5603
6369
|
height: "full",
|
|
@@ -5605,7 +6371,7 @@ function MobileDataGrid(props) {
|
|
|
5605
6371
|
overflowX: "hidden",
|
|
5606
6372
|
overflowY: "hidden",
|
|
5607
6373
|
children: [
|
|
5608
|
-
!hideHeader && /* @__PURE__ */ (0,
|
|
6374
|
+
!hideHeader && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5609
6375
|
MobileDataGridHeader,
|
|
5610
6376
|
{
|
|
5611
6377
|
header,
|
|
@@ -5613,7 +6379,7 @@ function MobileDataGrid(props) {
|
|
|
5613
6379
|
enableRowSelection
|
|
5614
6380
|
}
|
|
5615
6381
|
),
|
|
5616
|
-
/* @__PURE__ */ (0,
|
|
6382
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5617
6383
|
ColumnList,
|
|
5618
6384
|
{
|
|
5619
6385
|
withBorder,
|
|
@@ -5627,21 +6393,21 @@ function MobileDataGrid(props) {
|
|
|
5627
6393
|
]
|
|
5628
6394
|
}
|
|
5629
6395
|
),
|
|
5630
|
-
/* @__PURE__ */ (0,
|
|
6396
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(RowDetailModalProvider, {})
|
|
5631
6397
|
]
|
|
5632
6398
|
}
|
|
5633
6399
|
);
|
|
5634
6400
|
}
|
|
5635
6401
|
|
|
5636
6402
|
// src/components/ProductImagePreview/Thumbnail.tsx
|
|
5637
|
-
var
|
|
6403
|
+
var import_react28 = require("react");
|
|
5638
6404
|
|
|
5639
6405
|
// src/components/ImagePlaceholder.tsx
|
|
5640
|
-
var
|
|
5641
|
-
var
|
|
6406
|
+
var import_react27 = require("react");
|
|
6407
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
5642
6408
|
function ImagePlaceholder(props) {
|
|
5643
|
-
const clipId = (0,
|
|
5644
|
-
return /* @__PURE__ */ (0,
|
|
6409
|
+
const clipId = (0, import_react27.useId)();
|
|
6410
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
5645
6411
|
"svg",
|
|
5646
6412
|
__spreadProps(__spreadValues({
|
|
5647
6413
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -5650,15 +6416,15 @@ function ImagePlaceholder(props) {
|
|
|
5650
6416
|
fill: "none"
|
|
5651
6417
|
}, props), {
|
|
5652
6418
|
children: [
|
|
5653
|
-
/* @__PURE__ */ (0,
|
|
5654
|
-
/* @__PURE__ */ (0,
|
|
6419
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("g", { clipPath: `url(#${clipId})`, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("rect", { width: props.width, height: props.width, fill: "#F7F7F7", rx: 2 }) }),
|
|
6420
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("clipPath", { id: clipId, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("rect", { width: props.width, height: props.width, fill: "#fff", rx: 2 }) }) })
|
|
5655
6421
|
]
|
|
5656
6422
|
})
|
|
5657
6423
|
);
|
|
5658
6424
|
}
|
|
5659
6425
|
|
|
5660
6426
|
// src/components/ProductImagePreview/Thumbnail.tsx
|
|
5661
|
-
var
|
|
6427
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
5662
6428
|
function Thumbnail({
|
|
5663
6429
|
width,
|
|
5664
6430
|
height,
|
|
@@ -5668,8 +6434,8 @@ function Thumbnail({
|
|
|
5668
6434
|
onClick,
|
|
5669
6435
|
isPlaceholder = false
|
|
5670
6436
|
}) {
|
|
5671
|
-
const [imageError, setImageError] = (0,
|
|
5672
|
-
return /* @__PURE__ */ (0,
|
|
6437
|
+
const [imageError, setImageError] = (0, import_react28.useState)(false);
|
|
6438
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
5673
6439
|
"button",
|
|
5674
6440
|
{
|
|
5675
6441
|
type: "button",
|
|
@@ -5682,7 +6448,7 @@ function Thumbnail({
|
|
|
5682
6448
|
].join(" "),
|
|
5683
6449
|
style: { maxWidth: width, maxHeight: height, aspectRatio: "1 / 1" },
|
|
5684
6450
|
"aria-pressed": isActive && !isPlaceholder ? "true" : "false",
|
|
5685
|
-
children: isPlaceholder ? /* @__PURE__ */ (0,
|
|
6451
|
+
children: isPlaceholder ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ImagePlaceholder, { width: 115, height: 115 }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
5686
6452
|
"img",
|
|
5687
6453
|
{
|
|
5688
6454
|
src: imageError ? "/placeholder.svg" : src,
|
|
@@ -5700,8 +6466,8 @@ function Thumbnail({
|
|
|
5700
6466
|
}
|
|
5701
6467
|
|
|
5702
6468
|
// src/components/Grid.tsx
|
|
5703
|
-
var
|
|
5704
|
-
var
|
|
6469
|
+
var import_clsx31 = __toESM(require("clsx"), 1);
|
|
6470
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
5705
6471
|
var GAP_BY_SIZING = {
|
|
5706
6472
|
none: "gap-0",
|
|
5707
6473
|
"layout-group": "gap-mobile-layout-group-gap desktop:gap-desktop-layout-group-gap compact:gap-compact-layout-group-gap",
|
|
@@ -5749,14 +6515,14 @@ var Grid = (_a) => {
|
|
|
5749
6515
|
]);
|
|
5750
6516
|
var _a2, _b2;
|
|
5751
6517
|
const columnClasses = buildColumnClasses(columns, responsive);
|
|
5752
|
-
return /* @__PURE__ */ (0,
|
|
6518
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
5753
6519
|
"div",
|
|
5754
6520
|
__spreadProps(__spreadValues({
|
|
5755
6521
|
id,
|
|
5756
6522
|
"data-testid": testid,
|
|
5757
6523
|
style
|
|
5758
6524
|
}, rest), {
|
|
5759
|
-
className: (0,
|
|
6525
|
+
className: (0, import_clsx31.default)(
|
|
5760
6526
|
"w-full grid",
|
|
5761
6527
|
(_a2 = GAP_BY_SIZING[sizing]) != null ? _a2 : GAP_BY_SIZING.container,
|
|
5762
6528
|
padding && ((_b2 = PADDING_BY_SIZING[sizing]) != null ? _b2 : PADDING_BY_SIZING.container),
|
|
@@ -5770,8 +6536,8 @@ var Grid = (_a) => {
|
|
|
5770
6536
|
};
|
|
5771
6537
|
|
|
5772
6538
|
// src/components/ProductImagePreview/ProductPrimaryImage.tsx
|
|
5773
|
-
var
|
|
5774
|
-
var
|
|
6539
|
+
var import_react29 = require("react");
|
|
6540
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
5775
6541
|
var placeholderImageUri = "/placeholder.svg";
|
|
5776
6542
|
function ProductPrimaryImage({
|
|
5777
6543
|
image,
|
|
@@ -5785,12 +6551,12 @@ function ProductPrimaryImage({
|
|
|
5785
6551
|
onZoomPositionChange,
|
|
5786
6552
|
onScrollZoom
|
|
5787
6553
|
}) {
|
|
5788
|
-
const containerRef = (0,
|
|
5789
|
-
const lastPointRef = (0,
|
|
5790
|
-
const rafRef = (0,
|
|
5791
|
-
const [active, setActive] = (0,
|
|
5792
|
-
const [, forceRerender] = (0,
|
|
5793
|
-
const imageSrc = (0,
|
|
6554
|
+
const containerRef = (0, import_react29.useRef)(null);
|
|
6555
|
+
const lastPointRef = (0, import_react29.useRef)(null);
|
|
6556
|
+
const rafRef = (0, import_react29.useRef)(null);
|
|
6557
|
+
const [active, setActive] = (0, import_react29.useState)(false);
|
|
6558
|
+
const [, forceRerender] = (0, import_react29.useState)(0);
|
|
6559
|
+
const imageSrc = (0, import_react29.useMemo)(() => image == null ? void 0 : image.src, [image == null ? void 0 : image.src]);
|
|
5794
6560
|
const schedule = () => {
|
|
5795
6561
|
if (rafRef.current != null) return;
|
|
5796
6562
|
rafRef.current = requestAnimationFrame(() => {
|
|
@@ -5798,7 +6564,7 @@ function ProductPrimaryImage({
|
|
|
5798
6564
|
forceRerender((n) => n + 1);
|
|
5799
6565
|
});
|
|
5800
6566
|
};
|
|
5801
|
-
const handlePointerEnter = (0,
|
|
6567
|
+
const handlePointerEnter = (0, import_react29.useCallback)(() => {
|
|
5802
6568
|
if (!zoomEnabled) return;
|
|
5803
6569
|
setActive(true);
|
|
5804
6570
|
const el = containerRef.current;
|
|
@@ -5811,13 +6577,13 @@ function ProductPrimaryImage({
|
|
|
5811
6577
|
);
|
|
5812
6578
|
}
|
|
5813
6579
|
}, [zoomEnabled, onZoomPositionChange, zoomLensSize]);
|
|
5814
|
-
const handlePointerLeave = (0,
|
|
6580
|
+
const handlePointerLeave = (0, import_react29.useCallback)(() => {
|
|
5815
6581
|
if (!zoomEnabled) return;
|
|
5816
6582
|
setActive(false);
|
|
5817
6583
|
lastPointRef.current = null;
|
|
5818
6584
|
onZoomPositionChange == null ? void 0 : onZoomPositionChange(null, false);
|
|
5819
6585
|
}, [zoomEnabled, onZoomPositionChange]);
|
|
5820
|
-
const handlePointerMove = (0,
|
|
6586
|
+
const handlePointerMove = (0, import_react29.useCallback)(
|
|
5821
6587
|
(e) => {
|
|
5822
6588
|
if (isPlaceholder) return;
|
|
5823
6589
|
if (!zoomEnabled || !active) return;
|
|
@@ -5854,7 +6620,7 @@ function ProductPrimaryImage({
|
|
|
5854
6620
|
},
|
|
5855
6621
|
[isPlaceholder, zoomEnabled, active, zoomLensSize, onZoomPositionChange]
|
|
5856
6622
|
);
|
|
5857
|
-
(0,
|
|
6623
|
+
(0, import_react29.useEffect)(() => {
|
|
5858
6624
|
const container = containerRef.current;
|
|
5859
6625
|
if (!container || !scrollToZoomEnabled) return;
|
|
5860
6626
|
const handleNativeWheel = (e) => {
|
|
@@ -5869,7 +6635,7 @@ function ProductPrimaryImage({
|
|
|
5869
6635
|
container.removeEventListener("wheel", handleNativeWheel);
|
|
5870
6636
|
};
|
|
5871
6637
|
}, [scrollToZoomEnabled, zoomEnabled, active, onScrollZoom]);
|
|
5872
|
-
const handleImgError = (0,
|
|
6638
|
+
const handleImgError = (0, import_react29.useCallback)(
|
|
5873
6639
|
(e) => {
|
|
5874
6640
|
if (!placeholderImageUri) return;
|
|
5875
6641
|
const img = e.currentTarget;
|
|
@@ -5891,7 +6657,7 @@ function ProductPrimaryImage({
|
|
|
5891
6657
|
top: Math.max(0, Math.min(height - size, topRaw))
|
|
5892
6658
|
};
|
|
5893
6659
|
}
|
|
5894
|
-
return /* @__PURE__ */ (0,
|
|
6660
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
5895
6661
|
"div",
|
|
5896
6662
|
{
|
|
5897
6663
|
ref: containerRef,
|
|
@@ -5911,7 +6677,7 @@ function ProductPrimaryImage({
|
|
|
5911
6677
|
onPointerLeave: handlePointerLeave,
|
|
5912
6678
|
onPointerMove: handlePointerMove,
|
|
5913
6679
|
children: [
|
|
5914
|
-
/* @__PURE__ */ (0,
|
|
6680
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5915
6681
|
"img",
|
|
5916
6682
|
{
|
|
5917
6683
|
src: imageSrc != null ? imageSrc : placeholderImageUri,
|
|
@@ -5923,7 +6689,7 @@ function ProductPrimaryImage({
|
|
|
5923
6689
|
},
|
|
5924
6690
|
imageSrc
|
|
5925
6691
|
),
|
|
5926
|
-
zoomEnabled && active && lensStyle && /* @__PURE__ */ (0,
|
|
6692
|
+
zoomEnabled && active && lensStyle && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5927
6693
|
"div",
|
|
5928
6694
|
{
|
|
5929
6695
|
"aria-hidden": true,
|
|
@@ -5937,11 +6703,11 @@ function ProductPrimaryImage({
|
|
|
5937
6703
|
}
|
|
5938
6704
|
|
|
5939
6705
|
// src/components/ProductImagePreview/ZoomWindow.tsx
|
|
5940
|
-
var
|
|
6706
|
+
var import_react30 = require("react");
|
|
5941
6707
|
|
|
5942
6708
|
// src/components/Surface.tsx
|
|
5943
|
-
var
|
|
5944
|
-
var
|
|
6709
|
+
var import_clsx32 = __toESM(require("clsx"), 1);
|
|
6710
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
5945
6711
|
var Surface = (_a) => {
|
|
5946
6712
|
var _b = _a, {
|
|
5947
6713
|
children,
|
|
@@ -5954,11 +6720,11 @@ var Surface = (_a) => {
|
|
|
5954
6720
|
"elevation",
|
|
5955
6721
|
"id"
|
|
5956
6722
|
]);
|
|
5957
|
-
return /* @__PURE__ */ (0,
|
|
6723
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
5958
6724
|
"div",
|
|
5959
6725
|
__spreadProps(__spreadValues({
|
|
5960
6726
|
id,
|
|
5961
|
-
className: (0,
|
|
6727
|
+
className: (0, import_clsx32.default)(
|
|
5962
6728
|
"rounded-base",
|
|
5963
6729
|
{
|
|
5964
6730
|
"shadow-2": elevation === 2,
|
|
@@ -5975,7 +6741,7 @@ var Surface = (_a) => {
|
|
|
5975
6741
|
Surface.displayName = "Surface";
|
|
5976
6742
|
|
|
5977
6743
|
// src/components/ProductImagePreview/ZoomWindow.tsx
|
|
5978
|
-
var
|
|
6744
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
5979
6745
|
function ZoomWindow({
|
|
5980
6746
|
image,
|
|
5981
6747
|
width,
|
|
@@ -5988,7 +6754,7 @@ function ZoomWindow({
|
|
|
5988
6754
|
offset = 10,
|
|
5989
6755
|
className = ""
|
|
5990
6756
|
}) {
|
|
5991
|
-
const imageSrc = (0,
|
|
6757
|
+
const imageSrc = (0, import_react30.useMemo)(() => image == null ? void 0 : image.src, [image == null ? void 0 : image.src]);
|
|
5992
6758
|
if (!image || !active || !pointer) return null;
|
|
5993
6759
|
const zoomWindowSize = pointer.lensSize * scaleFactor;
|
|
5994
6760
|
const baseW = pointer.w || width;
|
|
@@ -6033,7 +6799,7 @@ function ZoomWindow({
|
|
|
6033
6799
|
top
|
|
6034
6800
|
};
|
|
6035
6801
|
};
|
|
6036
|
-
return /* @__PURE__ */ (0,
|
|
6802
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
6037
6803
|
Surface,
|
|
6038
6804
|
{
|
|
6039
6805
|
elevation: 16,
|
|
@@ -6048,7 +6814,7 @@ function ZoomWindow({
|
|
|
6048
6814
|
userSelect: "none"
|
|
6049
6815
|
}, calculatePosition()),
|
|
6050
6816
|
"aria-hidden": true,
|
|
6051
|
-
children: /* @__PURE__ */ (0,
|
|
6817
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
6052
6818
|
"img",
|
|
6053
6819
|
{
|
|
6054
6820
|
src: imageSrc,
|
|
@@ -6069,8 +6835,8 @@ function ZoomWindow({
|
|
|
6069
6835
|
}
|
|
6070
6836
|
|
|
6071
6837
|
// src/components/ProductImagePreview/CarouselPagination.tsx
|
|
6072
|
-
var
|
|
6073
|
-
var
|
|
6838
|
+
var import_clsx33 = require("clsx");
|
|
6839
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
6074
6840
|
function CarouselPagination({
|
|
6075
6841
|
images,
|
|
6076
6842
|
currentIndex,
|
|
@@ -6078,15 +6844,15 @@ function CarouselPagination({
|
|
|
6078
6844
|
className
|
|
6079
6845
|
}) {
|
|
6080
6846
|
if (!(images == null ? void 0 : images.length)) return null;
|
|
6081
|
-
return /* @__PURE__ */ (0,
|
|
6847
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
6082
6848
|
"div",
|
|
6083
6849
|
{
|
|
6084
|
-
className: (0,
|
|
6850
|
+
className: (0, import_clsx33.clsx)(
|
|
6085
6851
|
"flex items-center justify-center w-full px-4 md:hidden",
|
|
6086
6852
|
className
|
|
6087
6853
|
),
|
|
6088
6854
|
"aria-label": "Image navigation",
|
|
6089
|
-
children: /* @__PURE__ */ (0,
|
|
6855
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
6090
6856
|
"div",
|
|
6091
6857
|
{
|
|
6092
6858
|
className: "grid gap-2 place-items-center",
|
|
@@ -6094,12 +6860,12 @@ function CarouselPagination({
|
|
|
6094
6860
|
gridTemplateColumns: `repeat(${Math.min(images.length, 8)}, 1fr)`
|
|
6095
6861
|
},
|
|
6096
6862
|
role: "tablist",
|
|
6097
|
-
children: images.map((_, index) => /* @__PURE__ */ (0,
|
|
6863
|
+
children: images.map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
6098
6864
|
"button",
|
|
6099
6865
|
{
|
|
6100
6866
|
type: "button",
|
|
6101
6867
|
onClick: () => onSelect(index),
|
|
6102
|
-
className: (0,
|
|
6868
|
+
className: (0, import_clsx33.clsx)(
|
|
6103
6869
|
"w-4 h-4 transition-all duration-200 focus:outline-none",
|
|
6104
6870
|
index === currentIndex ? "ring-2 ring-brand-400" : "ring ring-neutral-300"
|
|
6105
6871
|
),
|
|
@@ -6117,8 +6883,8 @@ function CarouselPagination({
|
|
|
6117
6883
|
}
|
|
6118
6884
|
|
|
6119
6885
|
// src/components/ProductImagePreview/MobileImageCarousel.tsx
|
|
6120
|
-
var
|
|
6121
|
-
var
|
|
6886
|
+
var import_react31 = require("react");
|
|
6887
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
6122
6888
|
function MobileImageCarousel({
|
|
6123
6889
|
images,
|
|
6124
6890
|
currentIndex,
|
|
@@ -6127,15 +6893,15 @@ function MobileImageCarousel({
|
|
|
6127
6893
|
onChangeIndex,
|
|
6128
6894
|
className = ""
|
|
6129
6895
|
}) {
|
|
6130
|
-
const containerRef = (0,
|
|
6131
|
-
const [isDragging, setIsDragging] = (0,
|
|
6132
|
-
const [startX, setStartX] = (0,
|
|
6133
|
-
const [currentTranslate, setCurrentTranslate] = (0,
|
|
6134
|
-
const [prevTranslate, setPrevTranslate] = (0,
|
|
6135
|
-
const [containerWidth, setContainerWidth] = (0,
|
|
6896
|
+
const containerRef = (0, import_react31.useRef)(null);
|
|
6897
|
+
const [isDragging, setIsDragging] = (0, import_react31.useState)(false);
|
|
6898
|
+
const [startX, setStartX] = (0, import_react31.useState)(0);
|
|
6899
|
+
const [currentTranslate, setCurrentTranslate] = (0, import_react31.useState)(0);
|
|
6900
|
+
const [prevTranslate, setPrevTranslate] = (0, import_react31.useState)(0);
|
|
6901
|
+
const [containerWidth, setContainerWidth] = (0, import_react31.useState)(width);
|
|
6136
6902
|
const imageSize = Math.min(containerWidth * 0.6, height * 0.6);
|
|
6137
6903
|
const gap = 16;
|
|
6138
|
-
const getTranslateX = (0,
|
|
6904
|
+
const getTranslateX = (0, import_react31.useCallback)(
|
|
6139
6905
|
(index) => {
|
|
6140
6906
|
const containerCenter = containerWidth / 2;
|
|
6141
6907
|
const imageCenter = imageSize / 2;
|
|
@@ -6144,12 +6910,12 @@ function MobileImageCarousel({
|
|
|
6144
6910
|
},
|
|
6145
6911
|
[containerWidth, imageSize, gap]
|
|
6146
6912
|
);
|
|
6147
|
-
(0,
|
|
6913
|
+
(0, import_react31.useEffect)(() => {
|
|
6148
6914
|
const translateX = getTranslateX(currentIndex);
|
|
6149
6915
|
setCurrentTranslate(translateX);
|
|
6150
6916
|
setPrevTranslate(translateX);
|
|
6151
6917
|
}, [currentIndex, getTranslateX]);
|
|
6152
|
-
(0,
|
|
6918
|
+
(0, import_react31.useEffect)(() => {
|
|
6153
6919
|
const updateContainerWidth = () => {
|
|
6154
6920
|
if (containerRef.current) {
|
|
6155
6921
|
const rect = containerRef.current.getBoundingClientRect();
|
|
@@ -6163,11 +6929,11 @@ function MobileImageCarousel({
|
|
|
6163
6929
|
}
|
|
6164
6930
|
return () => resizeObserver.disconnect();
|
|
6165
6931
|
}, []);
|
|
6166
|
-
const handleStart = (0,
|
|
6932
|
+
const handleStart = (0, import_react31.useCallback)((clientX) => {
|
|
6167
6933
|
setIsDragging(true);
|
|
6168
6934
|
setStartX(clientX);
|
|
6169
6935
|
}, []);
|
|
6170
|
-
const handleMove = (0,
|
|
6936
|
+
const handleMove = (0, import_react31.useCallback)(
|
|
6171
6937
|
(clientX) => {
|
|
6172
6938
|
if (!isDragging) return;
|
|
6173
6939
|
const currentPosition = clientX;
|
|
@@ -6176,7 +6942,7 @@ function MobileImageCarousel({
|
|
|
6176
6942
|
},
|
|
6177
6943
|
[isDragging, startX, prevTranslate]
|
|
6178
6944
|
);
|
|
6179
|
-
const handleEnd = (0,
|
|
6945
|
+
const handleEnd = (0, import_react31.useCallback)(() => {
|
|
6180
6946
|
if (!isDragging) return;
|
|
6181
6947
|
setIsDragging(false);
|
|
6182
6948
|
const moved = currentTranslate - prevTranslate;
|
|
@@ -6224,7 +6990,7 @@ function MobileImageCarousel({
|
|
|
6224
6990
|
const handleTouchEnd = () => {
|
|
6225
6991
|
handleEnd();
|
|
6226
6992
|
};
|
|
6227
|
-
const handleImageClick = (0,
|
|
6993
|
+
const handleImageClick = (0, import_react31.useCallback)(
|
|
6228
6994
|
(index) => {
|
|
6229
6995
|
if (!isDragging && index !== currentIndex) {
|
|
6230
6996
|
onChangeIndex(index);
|
|
@@ -6233,7 +6999,7 @@ function MobileImageCarousel({
|
|
|
6233
6999
|
[isDragging, currentIndex, onChangeIndex]
|
|
6234
7000
|
);
|
|
6235
7001
|
if (!images.length) return null;
|
|
6236
|
-
return /* @__PURE__ */ (0,
|
|
7002
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: `md:hidden w-full ${className}`, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
6237
7003
|
"div",
|
|
6238
7004
|
{
|
|
6239
7005
|
ref: containerRef,
|
|
@@ -6248,7 +7014,7 @@ function MobileImageCarousel({
|
|
|
6248
7014
|
onTouchStart: handleTouchStart,
|
|
6249
7015
|
onTouchMove: handleTouchMove,
|
|
6250
7016
|
onTouchEnd: handleTouchEnd,
|
|
6251
|
-
children: /* @__PURE__ */ (0,
|
|
7017
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
6252
7018
|
"div",
|
|
6253
7019
|
{
|
|
6254
7020
|
className: "flex items-center",
|
|
@@ -6261,7 +7027,7 @@ function MobileImageCarousel({
|
|
|
6261
7027
|
const isActive = index === currentIndex;
|
|
6262
7028
|
const distance = Math.abs(index - currentIndex);
|
|
6263
7029
|
const shouldRender = distance <= 2;
|
|
6264
|
-
return /* @__PURE__ */ (0,
|
|
7030
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
6265
7031
|
"div",
|
|
6266
7032
|
{
|
|
6267
7033
|
className: "flex-shrink-0 transition-opacity duration-300",
|
|
@@ -6271,7 +7037,7 @@ function MobileImageCarousel({
|
|
|
6271
7037
|
opacity: isActive ? 1 : Math.max(0.3, 1 - distance * 0.3)
|
|
6272
7038
|
},
|
|
6273
7039
|
onClick: () => handleImageClick(index),
|
|
6274
|
-
children: shouldRender ? /* @__PURE__ */ (0,
|
|
7040
|
+
children: shouldRender ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
6275
7041
|
"img",
|
|
6276
7042
|
{
|
|
6277
7043
|
src: image.src,
|
|
@@ -6283,7 +7049,7 @@ function MobileImageCarousel({
|
|
|
6283
7049
|
aspectRatio: "1 / 1"
|
|
6284
7050
|
}
|
|
6285
7051
|
}
|
|
6286
|
-
) : /* @__PURE__ */ (0,
|
|
7052
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
6287
7053
|
"div",
|
|
6288
7054
|
{
|
|
6289
7055
|
className: "w-full h-full bg-neutral-100 rounded-md border border-gray-200",
|
|
@@ -6304,7 +7070,7 @@ function MobileImageCarousel({
|
|
|
6304
7070
|
}
|
|
6305
7071
|
|
|
6306
7072
|
// src/components/ProductImagePreview/useProductImagePreview.ts
|
|
6307
|
-
var
|
|
7073
|
+
var import_react32 = require("react");
|
|
6308
7074
|
function useProductImagePreview(props) {
|
|
6309
7075
|
const {
|
|
6310
7076
|
images,
|
|
@@ -6317,18 +7083,18 @@ function useProductImagePreview(props) {
|
|
|
6317
7083
|
} = props;
|
|
6318
7084
|
const hasImages = !!(images == null ? void 0 : images.length);
|
|
6319
7085
|
const safeIndex = hasImages && currentIndex >= 0 && currentIndex < images.length ? currentIndex : 0;
|
|
6320
|
-
const active = (0,
|
|
7086
|
+
const active = (0, import_react32.useMemo)(() => {
|
|
6321
7087
|
return hasImages ? images[safeIndex] : void 0;
|
|
6322
7088
|
}, [hasImages, images, safeIndex]);
|
|
6323
|
-
const [zoomPoint, setZoomPoint] = (0,
|
|
6324
|
-
const [zoomActive, setZoomActive] = (0,
|
|
6325
|
-
const [currentZoomFactor, setCurrentZoomFactor] = (0,
|
|
6326
|
-
const [primaryImagePosition, setPrimaryImagePosition] = (0,
|
|
6327
|
-
const primaryImageRef = (0,
|
|
6328
|
-
const cleanupRef = (0,
|
|
7089
|
+
const [zoomPoint, setZoomPoint] = (0, import_react32.useState)(null);
|
|
7090
|
+
const [zoomActive, setZoomActive] = (0, import_react32.useState)(false);
|
|
7091
|
+
const [currentZoomFactor, setCurrentZoomFactor] = (0, import_react32.useState)(zoomFactor);
|
|
7092
|
+
const [primaryImagePosition, setPrimaryImagePosition] = (0, import_react32.useState)(null);
|
|
7093
|
+
const primaryImageRef = (0, import_react32.useRef)(null);
|
|
7094
|
+
const cleanupRef = (0, import_react32.useRef)(null);
|
|
6329
7095
|
const effectiveZoomEnabled = zoomEnabled && !isMobile;
|
|
6330
7096
|
const effectiveScrollToZoomEnabled = scrollToZoomEnabled && !isMobile;
|
|
6331
|
-
(0,
|
|
7097
|
+
(0, import_react32.useEffect)(() => {
|
|
6332
7098
|
if (!effectiveZoomEnabled) return;
|
|
6333
7099
|
const setupTracking = () => {
|
|
6334
7100
|
const element = primaryImageRef.current;
|
|
@@ -6362,24 +7128,24 @@ function useProductImagePreview(props) {
|
|
|
6362
7128
|
}
|
|
6363
7129
|
};
|
|
6364
7130
|
}, [effectiveZoomEnabled]);
|
|
6365
|
-
const handleSelect = (0,
|
|
7131
|
+
const handleSelect = (0, import_react32.useCallback)(
|
|
6366
7132
|
(idx) => {
|
|
6367
7133
|
if (idx === safeIndex) return;
|
|
6368
7134
|
onChangeIndex(idx);
|
|
6369
7135
|
},
|
|
6370
7136
|
[safeIndex, onChangeIndex]
|
|
6371
7137
|
);
|
|
6372
|
-
const handleNext = (0,
|
|
7138
|
+
const handleNext = (0, import_react32.useCallback)(() => {
|
|
6373
7139
|
if (!hasImages) return;
|
|
6374
7140
|
const nextIndex = (safeIndex + 1) % images.length;
|
|
6375
7141
|
onChangeIndex(nextIndex);
|
|
6376
7142
|
}, [hasImages, safeIndex, images.length, onChangeIndex]);
|
|
6377
|
-
const handlePrevious = (0,
|
|
7143
|
+
const handlePrevious = (0, import_react32.useCallback)(() => {
|
|
6378
7144
|
if (!hasImages) return;
|
|
6379
7145
|
const previousIndex = safeIndex === 0 ? images.length - 1 : safeIndex - 1;
|
|
6380
7146
|
onChangeIndex(previousIndex);
|
|
6381
7147
|
}, [hasImages, safeIndex, images.length, onChangeIndex]);
|
|
6382
|
-
const handleZoomPositionChange = (0,
|
|
7148
|
+
const handleZoomPositionChange = (0, import_react32.useCallback)(
|
|
6383
7149
|
(p, active2) => {
|
|
6384
7150
|
if (isMobile) return;
|
|
6385
7151
|
setZoomPoint(p);
|
|
@@ -6387,7 +7153,7 @@ function useProductImagePreview(props) {
|
|
|
6387
7153
|
},
|
|
6388
7154
|
[isMobile]
|
|
6389
7155
|
);
|
|
6390
|
-
const handleScrollZoom = (0,
|
|
7156
|
+
const handleScrollZoom = (0, import_react32.useCallback)(
|
|
6391
7157
|
(delta) => {
|
|
6392
7158
|
if (!effectiveScrollToZoomEnabled) return;
|
|
6393
7159
|
const newZoomFactor = Math.max(1, Math.min(5, currentZoomFactor + delta));
|
|
@@ -6395,7 +7161,7 @@ function useProductImagePreview(props) {
|
|
|
6395
7161
|
},
|
|
6396
7162
|
[effectiveScrollToZoomEnabled, currentZoomFactor]
|
|
6397
7163
|
);
|
|
6398
|
-
(0,
|
|
7164
|
+
(0, import_react32.useEffect)(() => {
|
|
6399
7165
|
setCurrentZoomFactor(zoomFactor);
|
|
6400
7166
|
}, [zoomFactor]);
|
|
6401
7167
|
return {
|
|
@@ -6419,7 +7185,7 @@ function useProductImagePreview(props) {
|
|
|
6419
7185
|
}
|
|
6420
7186
|
|
|
6421
7187
|
// src/components/ProductImagePreview/index.tsx
|
|
6422
|
-
var
|
|
7188
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
6423
7189
|
var PLACEHOLDER_IMAGES = [
|
|
6424
7190
|
{ src: "", alt: "placeholder" },
|
|
6425
7191
|
{ src: "", alt: "placeholder" }
|
|
@@ -6462,9 +7228,9 @@ function ProductImagePreview(props) {
|
|
|
6462
7228
|
});
|
|
6463
7229
|
if (typeof isMobile === "undefined") return null;
|
|
6464
7230
|
const effectiveZoomEnabled = zoomEnabled && !isMobile;
|
|
6465
|
-
return /* @__PURE__ */ (0,
|
|
6466
|
-
/* @__PURE__ */ (0,
|
|
6467
|
-
/* @__PURE__ */ (0,
|
|
7231
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(Stack, { sizing: "layout", style: { width, position: "relative" }, children: [
|
|
7232
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "hidden md:block", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex gap-4 items-start", children: [
|
|
7233
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { ref: primaryImageRef, children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
6468
7234
|
ProductPrimaryImage,
|
|
6469
7235
|
{
|
|
6470
7236
|
image: active,
|
|
@@ -6478,7 +7244,7 @@ function ProductImagePreview(props) {
|
|
|
6478
7244
|
isPlaceholder: images.length === 0
|
|
6479
7245
|
}
|
|
6480
7246
|
) }),
|
|
6481
|
-
effectiveZoomEnabled && /* @__PURE__ */ (0,
|
|
7247
|
+
effectiveZoomEnabled && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
6482
7248
|
ZoomWindow,
|
|
6483
7249
|
{
|
|
6484
7250
|
image: active,
|
|
@@ -6493,7 +7259,7 @@ function ProductImagePreview(props) {
|
|
|
6493
7259
|
}
|
|
6494
7260
|
)
|
|
6495
7261
|
] }) }),
|
|
6496
|
-
/* @__PURE__ */ (0,
|
|
7262
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
6497
7263
|
MobileImageCarousel,
|
|
6498
7264
|
{
|
|
6499
7265
|
images,
|
|
@@ -6503,14 +7269,14 @@ function ProductImagePreview(props) {
|
|
|
6503
7269
|
onChangeIndex: handleSelect
|
|
6504
7270
|
}
|
|
6505
7271
|
),
|
|
6506
|
-
/* @__PURE__ */ (0,
|
|
7272
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "hidden md:block", children: images.length <= 3 ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
6507
7273
|
"div",
|
|
6508
7274
|
{
|
|
6509
7275
|
className: "flex justify-center gap-4",
|
|
6510
7276
|
style: { width: "100%", maxWidth: width },
|
|
6511
7277
|
"aria-label": "Product image thumbnails",
|
|
6512
7278
|
children: (images.length === 0 ? PLACEHOLDER_IMAGES : images).map(
|
|
6513
|
-
(img, i) => /* @__PURE__ */ (0,
|
|
7279
|
+
(img, i) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { style: { maxWidth: "115px" }, children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
6514
7280
|
Thumbnail,
|
|
6515
7281
|
{
|
|
6516
7282
|
src: img.src,
|
|
@@ -6522,7 +7288,7 @@ function ProductImagePreview(props) {
|
|
|
6522
7288
|
) }, img.src + i)
|
|
6523
7289
|
)
|
|
6524
7290
|
}
|
|
6525
|
-
) : /* @__PURE__ */ (0,
|
|
7291
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
6526
7292
|
Grid,
|
|
6527
7293
|
{
|
|
6528
7294
|
sizing: "layout-group",
|
|
@@ -6533,7 +7299,7 @@ function ProductImagePreview(props) {
|
|
|
6533
7299
|
},
|
|
6534
7300
|
columns: thumbsPerRow > 12 ? 12 : thumbsPerRow < 1 ? 1 : thumbsPerRow,
|
|
6535
7301
|
children: (images.length === 0 ? PLACEHOLDER_IMAGES : images).map(
|
|
6536
|
-
(img, i) => /* @__PURE__ */ (0,
|
|
7302
|
+
(img, i) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
6537
7303
|
Thumbnail,
|
|
6538
7304
|
{
|
|
6539
7305
|
src: img.src,
|
|
@@ -6547,7 +7313,7 @@ function ProductImagePreview(props) {
|
|
|
6547
7313
|
)
|
|
6548
7314
|
}
|
|
6549
7315
|
) }),
|
|
6550
|
-
/* @__PURE__ */ (0,
|
|
7316
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
6551
7317
|
CarouselPagination,
|
|
6552
7318
|
{
|
|
6553
7319
|
images,
|
|
@@ -6559,9 +7325,9 @@ function ProductImagePreview(props) {
|
|
|
6559
7325
|
}
|
|
6560
7326
|
|
|
6561
7327
|
// src/components/CompactImagesPreview.tsx
|
|
6562
|
-
var
|
|
6563
|
-
var
|
|
6564
|
-
var
|
|
7328
|
+
var import_react33 = require("react");
|
|
7329
|
+
var import_clsx34 = __toESM(require("clsx"), 1);
|
|
7330
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
6565
7331
|
function CompactImagesPreview(props) {
|
|
6566
7332
|
const {
|
|
6567
7333
|
sources,
|
|
@@ -6578,7 +7344,7 @@ function CompactImagesPreview(props) {
|
|
|
6578
7344
|
} = props;
|
|
6579
7345
|
const isMobile = useMatchesMobile();
|
|
6580
7346
|
const imagesCount = sources.length;
|
|
6581
|
-
const handleImgError = (0,
|
|
7347
|
+
const handleImgError = (0, import_react33.useCallback)(
|
|
6582
7348
|
(e) => {
|
|
6583
7349
|
if (!placeholderImageUri2) return;
|
|
6584
7350
|
const img = e.currentTarget;
|
|
@@ -6588,7 +7354,7 @@ function CompactImagesPreview(props) {
|
|
|
6588
7354
|
},
|
|
6589
7355
|
[placeholderImageUri2, placeholderAlt]
|
|
6590
7356
|
);
|
|
6591
|
-
const handleThumbnailClick = (0,
|
|
7357
|
+
const handleThumbnailClick = (0, import_react33.useCallback)(
|
|
6592
7358
|
(newIndex) => {
|
|
6593
7359
|
if (newIndex === currentSourceIndex) return;
|
|
6594
7360
|
if (newIndex < 0 || newIndex >= imagesCount) return;
|
|
@@ -6597,7 +7363,7 @@ function CompactImagesPreview(props) {
|
|
|
6597
7363
|
[currentSourceIndex, onChangeSource, imagesCount]
|
|
6598
7364
|
);
|
|
6599
7365
|
if (!sources.length || currentSourceIndex >= sources.length || typeof isMobile === "undefined")
|
|
6600
|
-
return /* @__PURE__ */ (0,
|
|
7366
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
6601
7367
|
"img",
|
|
6602
7368
|
{
|
|
6603
7369
|
className: "object-center",
|
|
@@ -6614,11 +7380,11 @@ function CompactImagesPreview(props) {
|
|
|
6614
7380
|
}
|
|
6615
7381
|
);
|
|
6616
7382
|
const currentSource = sources[currentSourceIndex];
|
|
6617
|
-
return /* @__PURE__ */ (0,
|
|
6618
|
-
/* @__PURE__ */ (0,
|
|
7383
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(Stack, { sizing: "layout", children: [
|
|
7384
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
6619
7385
|
"img",
|
|
6620
7386
|
{
|
|
6621
|
-
className: (0,
|
|
7387
|
+
className: (0, import_clsx34.default)("object-center", onMainImageClick && "cursor-pointer"),
|
|
6622
7388
|
style: {
|
|
6623
7389
|
width: isMobile ? "100%" : activeImageWidth,
|
|
6624
7390
|
height: activeImageHeight,
|
|
@@ -6631,18 +7397,18 @@ function CompactImagesPreview(props) {
|
|
|
6631
7397
|
onClick: onMainImageClick
|
|
6632
7398
|
}
|
|
6633
7399
|
),
|
|
6634
|
-
/* @__PURE__ */ (0,
|
|
7400
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "flex flex-row flex-wrap items-center gap-3", children: sources.slice(0, 4).map((source, index) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
6635
7401
|
"button",
|
|
6636
7402
|
{
|
|
6637
7403
|
onClick: (e) => {
|
|
6638
7404
|
e.preventDefault();
|
|
6639
7405
|
handleThumbnailClick(index);
|
|
6640
7406
|
},
|
|
6641
|
-
className: (0,
|
|
7407
|
+
className: (0, import_clsx34.default)(
|
|
6642
7408
|
"cursor-pointer",
|
|
6643
7409
|
currentSourceIndex === index && enableThumbnailBorder ? "ring-2 ring-offset-2 ring-brand-400 transition-discrete duration-300" : "ring-brand-400/0"
|
|
6644
7410
|
),
|
|
6645
|
-
children: /* @__PURE__ */ (0,
|
|
7411
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
6646
7412
|
"img",
|
|
6647
7413
|
{
|
|
6648
7414
|
src: source.uri,
|
|
@@ -6663,31 +7429,31 @@ function CompactImagesPreview(props) {
|
|
|
6663
7429
|
}
|
|
6664
7430
|
|
|
6665
7431
|
// src/components/SimpleTable.tsx
|
|
6666
|
-
var
|
|
6667
|
-
var
|
|
7432
|
+
var import_clsx35 = __toESM(require("clsx"), 1);
|
|
7433
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
6668
7434
|
function SimpleTable({
|
|
6669
7435
|
columns,
|
|
6670
7436
|
data,
|
|
6671
7437
|
additionalRows
|
|
6672
7438
|
}) {
|
|
6673
7439
|
const allRows = additionalRows && additionalRows.length > 0 ? [...data, ...additionalRows] : data;
|
|
6674
|
-
return /* @__PURE__ */ (0,
|
|
6675
|
-
/* @__PURE__ */ (0,
|
|
7440
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Stack, { elevation: 4, rounded: true, overflowX: "hidden", overflowY: "hidden", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("table", { className: "w-full border-collapse text-left text-sm border overflow-hidden rounded border-border-primary-normal", children: [
|
|
7441
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("tr", { className: "bg-background-primary-normal divide-x divide-border-primary-normal", children: columns.map((column, index) => {
|
|
6676
7442
|
var _a, _b;
|
|
6677
|
-
return /* @__PURE__ */ (0,
|
|
7443
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
6678
7444
|
"th",
|
|
6679
7445
|
{
|
|
6680
7446
|
scope: "col",
|
|
6681
|
-
className: (0,
|
|
7447
|
+
className: (0, import_clsx35.default)(
|
|
6682
7448
|
"p-mobile-layout-padding desktop:p-desktop-layout-padding font-semibold text-text-primary-normal",
|
|
6683
7449
|
((_a = column.meta) == null ? void 0 : _a.headerWidth) ? column.meta.headerWidth : "w-2/3"
|
|
6684
7450
|
),
|
|
6685
|
-
children: /* @__PURE__ */ (0,
|
|
7451
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Subheader, { children: (_b = column.header) == null ? void 0 : _b.toString() })
|
|
6686
7452
|
},
|
|
6687
7453
|
index
|
|
6688
7454
|
);
|
|
6689
7455
|
}) }) }),
|
|
6690
|
-
/* @__PURE__ */ (0,
|
|
7456
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("tbody", { children: allRows.map((row, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
6691
7457
|
"tr",
|
|
6692
7458
|
{
|
|
6693
7459
|
className: "border-t border-border-primary-normal divide-x divide-border-primary-normal",
|
|
@@ -6695,10 +7461,10 @@ function SimpleTable({
|
|
|
6695
7461
|
var _a;
|
|
6696
7462
|
const rawValue = column.id ? row[column.id] : null;
|
|
6697
7463
|
const cellValue = rawValue != null ? rawValue : null;
|
|
6698
|
-
return /* @__PURE__ */ (0,
|
|
7464
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
6699
7465
|
"td",
|
|
6700
7466
|
{
|
|
6701
|
-
className: (0,
|
|
7467
|
+
className: (0, import_clsx35.default)(
|
|
6702
7468
|
"p-mobile-layout-padding desktop:p-desktop-layout-padding align-middle text-text-primary-normal",
|
|
6703
7469
|
(_a = column.meta) == null ? void 0 : _a.headerWidth
|
|
6704
7470
|
),
|
|
@@ -6714,17 +7480,17 @@ function SimpleTable({
|
|
|
6714
7480
|
}
|
|
6715
7481
|
|
|
6716
7482
|
// src/components/PDFViewer/index.tsx
|
|
6717
|
-
var
|
|
7483
|
+
var import_react36 = require("react");
|
|
6718
7484
|
|
|
6719
7485
|
// src/components/PDFViewer/PDFElement.tsx
|
|
6720
7486
|
var import_react_pdf2 = require("@mikecousins/react-pdf");
|
|
6721
|
-
var
|
|
7487
|
+
var import_react35 = require("react");
|
|
6722
7488
|
|
|
6723
7489
|
// src/components/Spinner.tsx
|
|
6724
|
-
var
|
|
7490
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
6725
7491
|
var Spinner = ({ size = "small", testid }) => {
|
|
6726
7492
|
const dimension = size === "large" ? 48 : 24;
|
|
6727
|
-
return /* @__PURE__ */ (0,
|
|
7493
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
6728
7494
|
"svg",
|
|
6729
7495
|
{
|
|
6730
7496
|
"data-testid": testid,
|
|
@@ -6736,14 +7502,14 @@ var Spinner = ({ size = "small", testid }) => {
|
|
|
6736
7502
|
className: "spinner",
|
|
6737
7503
|
"aria-label": "Loading",
|
|
6738
7504
|
children: [
|
|
6739
|
-
/* @__PURE__ */ (0,
|
|
6740
|
-
/* @__PURE__ */ (0,
|
|
6741
|
-
/* @__PURE__ */ (0,
|
|
6742
|
-
/* @__PURE__ */ (0,
|
|
6743
|
-
/* @__PURE__ */ (0,
|
|
6744
|
-
/* @__PURE__ */ (0,
|
|
6745
|
-
/* @__PURE__ */ (0,
|
|
6746
|
-
/* @__PURE__ */ (0,
|
|
7505
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("circle", { cx: "12", cy: "4", r: "2", opacity: "1" }),
|
|
7506
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("circle", { cx: "17.666", cy: "6.334", r: "2", opacity: "0.125" }),
|
|
7507
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("circle", { cx: "20", cy: "12", r: "2", opacity: "0.25" }),
|
|
7508
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("circle", { cx: "17.666", cy: "17.666", r: "2", opacity: "0.375" }),
|
|
7509
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("circle", { cx: "12", cy: "20", r: "2", opacity: "0.5" }),
|
|
7510
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("circle", { cx: "6.334", cy: "17.666", r: "2", opacity: "0.625" }),
|
|
7511
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("circle", { cx: "4", cy: "12", r: "2", opacity: "0.75" }),
|
|
7512
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("circle", { cx: "6.334", cy: "6.334", r: "2", opacity: "0.875" })
|
|
6747
7513
|
]
|
|
6748
7514
|
}
|
|
6749
7515
|
);
|
|
@@ -6752,15 +7518,15 @@ Spinner.displayName = "Spinner";
|
|
|
6752
7518
|
|
|
6753
7519
|
// src/components/PDFViewer/PDFPage.tsx
|
|
6754
7520
|
var import_react_pdf = require("@mikecousins/react-pdf");
|
|
6755
|
-
var
|
|
6756
|
-
var
|
|
7521
|
+
var import_react34 = require("react");
|
|
7522
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
6757
7523
|
function PdfPage({
|
|
6758
7524
|
file,
|
|
6759
7525
|
pageNumber,
|
|
6760
7526
|
testid,
|
|
6761
7527
|
isMobile
|
|
6762
7528
|
}) {
|
|
6763
|
-
const canvasRef = (0,
|
|
7529
|
+
const canvasRef = (0, import_react34.useRef)(null);
|
|
6764
7530
|
const { pdfDocument } = (0, import_react_pdf.usePdf)({
|
|
6765
7531
|
file,
|
|
6766
7532
|
page: pageNumber,
|
|
@@ -6769,7 +7535,7 @@ function PdfPage({
|
|
|
6769
7535
|
scale: isMobile ? 1 : 1.3
|
|
6770
7536
|
});
|
|
6771
7537
|
if (!pdfDocument) return null;
|
|
6772
|
-
return /* @__PURE__ */ (0,
|
|
7538
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
6773
7539
|
"canvas",
|
|
6774
7540
|
{
|
|
6775
7541
|
ref: canvasRef,
|
|
@@ -6780,8 +7546,8 @@ function PdfPage({
|
|
|
6780
7546
|
}
|
|
6781
7547
|
|
|
6782
7548
|
// src/components/PDFViewer/PDFElement.tsx
|
|
6783
|
-
var
|
|
6784
|
-
var
|
|
7549
|
+
var import_clsx36 = __toESM(require("clsx"), 1);
|
|
7550
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
6785
7551
|
function PDFElement({
|
|
6786
7552
|
b64,
|
|
6787
7553
|
testid,
|
|
@@ -6789,7 +7555,7 @@ function PDFElement({
|
|
|
6789
7555
|
error
|
|
6790
7556
|
}) {
|
|
6791
7557
|
var _a;
|
|
6792
|
-
const canvasRef = (0,
|
|
7558
|
+
const canvasRef = (0, import_react35.useRef)(null);
|
|
6793
7559
|
const { pdfDocument } = (0, import_react_pdf2.usePdf)({
|
|
6794
7560
|
file: `data:application/pdf;base64,${b64}`,
|
|
6795
7561
|
workerSrc: "/scripts/pdf.worker.min.mjs",
|
|
@@ -6797,7 +7563,7 @@ function PDFElement({
|
|
|
6797
7563
|
canvasRef
|
|
6798
7564
|
});
|
|
6799
7565
|
const pagesArr = new Array((_a = pdfDocument == null ? void 0 : pdfDocument.numPages) != null ? _a : 1).fill(null);
|
|
6800
|
-
return /* @__PURE__ */ (0,
|
|
7566
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
6801
7567
|
"div",
|
|
6802
7568
|
{
|
|
6803
7569
|
className: "flex flex-col space-y-4",
|
|
@@ -6805,14 +7571,14 @@ function PDFElement({
|
|
|
6805
7571
|
minHeight: 871,
|
|
6806
7572
|
minWidth: 654
|
|
6807
7573
|
} : void 0,
|
|
6808
|
-
children: !!pdfDocument && !!b64 && !error ? /* @__PURE__ */ (0,
|
|
7574
|
+
children: !!pdfDocument && !!b64 && !error ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Stack, { sizing: "layout-group", children: pagesArr.length > 1 ? pagesArr.map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
6809
7575
|
"div",
|
|
6810
7576
|
{
|
|
6811
|
-
className: (0,
|
|
7577
|
+
className: (0, import_clsx36.default)(
|
|
6812
7578
|
"flex justify-center border-border-primary-normal",
|
|
6813
7579
|
isMobile ? "border-0" : "border"
|
|
6814
7580
|
),
|
|
6815
|
-
children: /* @__PURE__ */ (0,
|
|
7581
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
6816
7582
|
PdfPage,
|
|
6817
7583
|
{
|
|
6818
7584
|
testid: testid ? `${testid}-pdf_page_${i + 1}` : void 0,
|
|
@@ -6822,14 +7588,14 @@ function PDFElement({
|
|
|
6822
7588
|
)
|
|
6823
7589
|
},
|
|
6824
7590
|
`${testid}-pdf-page-${i + 1}`
|
|
6825
|
-
)) : /* @__PURE__ */ (0,
|
|
7591
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
6826
7592
|
"div",
|
|
6827
7593
|
{
|
|
6828
|
-
className: (0,
|
|
7594
|
+
className: (0, import_clsx36.default)(
|
|
6829
7595
|
"flex justify-center border-border-primary-normal",
|
|
6830
7596
|
isMobile ? "border-0" : "border"
|
|
6831
7597
|
),
|
|
6832
|
-
children: /* @__PURE__ */ (0,
|
|
7598
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
6833
7599
|
"canvas",
|
|
6834
7600
|
{
|
|
6835
7601
|
"data-testid": testid ? `${testid}-pdf-content` : void 0,
|
|
@@ -6838,7 +7604,7 @@ function PDFElement({
|
|
|
6838
7604
|
}
|
|
6839
7605
|
)
|
|
6840
7606
|
}
|
|
6841
|
-
) }) : /* @__PURE__ */ (0,
|
|
7607
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
6842
7608
|
Stack,
|
|
6843
7609
|
{
|
|
6844
7610
|
justify: "center",
|
|
@@ -6846,7 +7612,7 @@ function PDFElement({
|
|
|
6846
7612
|
height: "full",
|
|
6847
7613
|
flexGrow: 1,
|
|
6848
7614
|
"data-testid": testid ? `${testid}-pdf-${error ? "error" : "loading"}` : void 0,
|
|
6849
|
-
children: error ? error : /* @__PURE__ */ (0,
|
|
7615
|
+
children: error ? error : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Spinner, { size: "large" })
|
|
6850
7616
|
}
|
|
6851
7617
|
)
|
|
6852
7618
|
}
|
|
@@ -6854,26 +7620,26 @@ function PDFElement({
|
|
|
6854
7620
|
}
|
|
6855
7621
|
|
|
6856
7622
|
// src/components/PDFViewer/DownloadIcon.tsx
|
|
6857
|
-
var
|
|
7623
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
6858
7624
|
function DownloadIcon({
|
|
6859
7625
|
onClick,
|
|
6860
7626
|
isDownloading,
|
|
6861
7627
|
testid
|
|
6862
7628
|
}) {
|
|
6863
|
-
return /* @__PURE__ */ (0,
|
|
7629
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
6864
7630
|
Button,
|
|
6865
7631
|
{
|
|
6866
7632
|
testid,
|
|
6867
7633
|
iconOnly: true,
|
|
6868
7634
|
variant: "tertiary",
|
|
6869
|
-
leftIcon: /* @__PURE__ */ (0,
|
|
7635
|
+
leftIcon: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Icon, { name: isDownloading ? "cached" : "download" }),
|
|
6870
7636
|
onClick
|
|
6871
7637
|
}
|
|
6872
7638
|
);
|
|
6873
7639
|
}
|
|
6874
7640
|
|
|
6875
7641
|
// src/components/PDFViewer/PDFNavigation.tsx
|
|
6876
|
-
var
|
|
7642
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
6877
7643
|
function PdfNavigation({
|
|
6878
7644
|
currentIndex,
|
|
6879
7645
|
total,
|
|
@@ -6885,7 +7651,7 @@ function PdfNavigation({
|
|
|
6885
7651
|
testid,
|
|
6886
7652
|
fileName
|
|
6887
7653
|
}) {
|
|
6888
|
-
return /* @__PURE__ */ (0,
|
|
7654
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
6889
7655
|
Stack,
|
|
6890
7656
|
{
|
|
6891
7657
|
horizontal: true,
|
|
@@ -6894,44 +7660,44 @@ function PdfNavigation({
|
|
|
6894
7660
|
sizing: "layout-group",
|
|
6895
7661
|
testid: testid ? `${testid}-pdf-navigation` : void 0,
|
|
6896
7662
|
children: [
|
|
6897
|
-
/* @__PURE__ */ (0,
|
|
6898
|
-
/* @__PURE__ */ (0,
|
|
7663
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(Stack, { horizontal: true, items: "center", children: [
|
|
7664
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
6899
7665
|
Button,
|
|
6900
7666
|
{
|
|
6901
7667
|
iconOnly: true,
|
|
6902
7668
|
variant: "tertiary",
|
|
6903
7669
|
onClick: onPrev,
|
|
6904
|
-
leftIcon: /* @__PURE__ */ (0,
|
|
7670
|
+
leftIcon: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Icon, { name: "chevron_backward" }),
|
|
6905
7671
|
disabled: disablePrev,
|
|
6906
7672
|
testid: testid ? `${testid}-pdf-file-previous-button` : void 0
|
|
6907
7673
|
}
|
|
6908
7674
|
),
|
|
6909
|
-
/* @__PURE__ */ (0,
|
|
7675
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(Heading3, { className: "text-text-primary-normal whitespace-nowrap", children: [
|
|
6910
7676
|
currentIndex + 1,
|
|
6911
7677
|
" / ",
|
|
6912
7678
|
total
|
|
6913
7679
|
] }),
|
|
6914
|
-
/* @__PURE__ */ (0,
|
|
7680
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
6915
7681
|
Button,
|
|
6916
7682
|
{
|
|
6917
7683
|
iconOnly: true,
|
|
6918
7684
|
variant: "tertiary",
|
|
6919
7685
|
onClick: onNext,
|
|
6920
|
-
rightIcon: /* @__PURE__ */ (0,
|
|
7686
|
+
rightIcon: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Icon, { name: "chevron_forward" }),
|
|
6921
7687
|
disabled: disableNext,
|
|
6922
7688
|
testid: testid ? `${testid}-pdf-file-next-button` : void 0
|
|
6923
7689
|
}
|
|
6924
7690
|
),
|
|
6925
|
-
/* @__PURE__ */ (0,
|
|
7691
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Paragraph, { children: (fileName == null ? void 0 : fileName.endsWith(".pdf")) ? fileName : `${fileName}.pdf` })
|
|
6926
7692
|
] }),
|
|
6927
|
-
extraActions && /* @__PURE__ */ (0,
|
|
7693
|
+
extraActions && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "flex items-center gap-2", children: extraActions })
|
|
6928
7694
|
]
|
|
6929
7695
|
}
|
|
6930
7696
|
) });
|
|
6931
7697
|
}
|
|
6932
7698
|
|
|
6933
7699
|
// src/components/PDFViewer/index.tsx
|
|
6934
|
-
var
|
|
7700
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
6935
7701
|
function PDFViewer(props) {
|
|
6936
7702
|
const {
|
|
6937
7703
|
isOpen,
|
|
@@ -6945,9 +7711,9 @@ function PDFViewer(props) {
|
|
|
6945
7711
|
withPagination = true,
|
|
6946
7712
|
error
|
|
6947
7713
|
} = props;
|
|
6948
|
-
const [currentIndex, setCurrentIndex] = (0,
|
|
6949
|
-
const [isDownloading, setIsDownloading] = (0,
|
|
6950
|
-
const handleDownload = (0,
|
|
7714
|
+
const [currentIndex, setCurrentIndex] = (0, import_react36.useState)(0);
|
|
7715
|
+
const [isDownloading, setIsDownloading] = (0, import_react36.useState)(false);
|
|
7716
|
+
const handleDownload = (0, import_react36.useCallback)(() => {
|
|
6951
7717
|
setIsDownloading(true);
|
|
6952
7718
|
const link = document.createElement("a");
|
|
6953
7719
|
const currentPdf = encodedPdfs[currentIndex];
|
|
@@ -6978,7 +7744,7 @@ function PDFViewer(props) {
|
|
|
6978
7744
|
setIsDownloading(false);
|
|
6979
7745
|
onClose();
|
|
6980
7746
|
}
|
|
6981
|
-
return /* @__PURE__ */ (0,
|
|
7747
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
6982
7748
|
Modal,
|
|
6983
7749
|
{
|
|
6984
7750
|
testid,
|
|
@@ -6987,7 +7753,7 @@ function PDFViewer(props) {
|
|
|
6987
7753
|
onClose: handleClose,
|
|
6988
7754
|
noWrapper: true,
|
|
6989
7755
|
showButtons: isMobile && customFooter ? !!customActions : !!encodedPdfs.length,
|
|
6990
|
-
customActions: !!encodedPdfs.length && !isMobile && withPagination ? /* @__PURE__ */ (0,
|
|
7756
|
+
customActions: !!encodedPdfs.length && !isMobile && withPagination ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
6991
7757
|
PdfNavigation,
|
|
6992
7758
|
{
|
|
6993
7759
|
testid,
|
|
@@ -7003,7 +7769,7 @@ function PDFViewer(props) {
|
|
|
7003
7769
|
) : customActions,
|
|
7004
7770
|
fixedHeightScrolling: true,
|
|
7005
7771
|
headerIconAlign: "right",
|
|
7006
|
-
headerIcon: !isMobile ? /* @__PURE__ */ (0,
|
|
7772
|
+
headerIcon: !isMobile ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
7007
7773
|
DownloadIcon,
|
|
7008
7774
|
{
|
|
7009
7775
|
testid: testid ? `${testid}-download-icon` : void 0,
|
|
@@ -7014,7 +7780,7 @@ function PDFViewer(props) {
|
|
|
7014
7780
|
title: isMobile ? title != null ? title : encodedPdfs[currentIndex].fileName : void 0,
|
|
7015
7781
|
size: isMobile ? "screen" : "large",
|
|
7016
7782
|
headerClassname: "bg-brand-400 desktop:bg-background-grouped-primary-normal p-mobile-layout-padding text-brand-text-action-primary-normal",
|
|
7017
|
-
children: /* @__PURE__ */ (0,
|
|
7783
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
7018
7784
|
PDFElement,
|
|
7019
7785
|
{
|
|
7020
7786
|
testid,
|
|
@@ -7028,9 +7794,9 @@ function PDFViewer(props) {
|
|
|
7028
7794
|
}
|
|
7029
7795
|
|
|
7030
7796
|
// src/components/ListGroup.tsx
|
|
7031
|
-
var
|
|
7032
|
-
var
|
|
7033
|
-
var
|
|
7797
|
+
var import_react37 = require("react");
|
|
7798
|
+
var import_clsx37 = __toESM(require("clsx"), 1);
|
|
7799
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
7034
7800
|
function ListGroup({
|
|
7035
7801
|
title,
|
|
7036
7802
|
defaultOpen = false,
|
|
@@ -7041,7 +7807,7 @@ function ListGroup({
|
|
|
7041
7807
|
className,
|
|
7042
7808
|
children
|
|
7043
7809
|
}) {
|
|
7044
|
-
const [uncontrolledOpen, setUncontrolledOpen] = (0,
|
|
7810
|
+
const [uncontrolledOpen, setUncontrolledOpen] = (0, import_react37.useState)(defaultOpen);
|
|
7045
7811
|
const isControlled = controlledOpen !== void 0;
|
|
7046
7812
|
const isOpen = isControlled ? controlledOpen : uncontrolledOpen;
|
|
7047
7813
|
const toggle = () => {
|
|
@@ -7050,24 +7816,24 @@ function ListGroup({
|
|
|
7050
7816
|
if (!isControlled) setUncontrolledOpen(next);
|
|
7051
7817
|
onToggle == null ? void 0 : onToggle(next);
|
|
7052
7818
|
};
|
|
7053
|
-
return /* @__PURE__ */ (0,
|
|
7054
|
-
/* @__PURE__ */ (0,
|
|
7819
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { "data-testid": testid, className: (0, import_clsx37.default)("rounded-sm", className), children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(Stack, { sizing: "layout", noGap: true, children: [
|
|
7820
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
7055
7821
|
"button",
|
|
7056
7822
|
{
|
|
7057
7823
|
type: "button",
|
|
7058
7824
|
onClick: toggle,
|
|
7059
|
-
className: (0,
|
|
7825
|
+
className: (0, import_clsx37.default)(
|
|
7060
7826
|
"w-full flex items-center justify-between text-left",
|
|
7061
7827
|
disabled && "opacity-50 cursor-not-allowed"
|
|
7062
7828
|
),
|
|
7063
7829
|
"aria-expanded": isOpen,
|
|
7064
7830
|
children: [
|
|
7065
|
-
/* @__PURE__ */ (0,
|
|
7066
|
-
/* @__PURE__ */ (0,
|
|
7831
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Label, { children: title }),
|
|
7832
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
7067
7833
|
Icon,
|
|
7068
7834
|
{
|
|
7069
7835
|
name: "expand_more",
|
|
7070
|
-
className: (0,
|
|
7836
|
+
className: (0, import_clsx37.default)(
|
|
7071
7837
|
"transition-transform duration-200",
|
|
7072
7838
|
isOpen ? "rotate-180" : "rotate-0"
|
|
7073
7839
|
)
|
|
@@ -7076,14 +7842,14 @@ function ListGroup({
|
|
|
7076
7842
|
]
|
|
7077
7843
|
}
|
|
7078
7844
|
),
|
|
7079
|
-
isOpen && /* @__PURE__ */ (0,
|
|
7845
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Stack, { sizing: "layout", paddingTop: true, children })
|
|
7080
7846
|
] }) });
|
|
7081
7847
|
}
|
|
7082
7848
|
|
|
7083
7849
|
// src/components/Pagination.tsx
|
|
7084
|
-
var
|
|
7085
|
-
var
|
|
7086
|
-
var
|
|
7850
|
+
var import_react38 = require("react");
|
|
7851
|
+
var import_clsx38 = __toESM(require("clsx"), 1);
|
|
7852
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
7087
7853
|
var Pagination = ({
|
|
7088
7854
|
totalPages,
|
|
7089
7855
|
currentPage,
|
|
@@ -7093,7 +7859,7 @@ var Pagination = ({
|
|
|
7093
7859
|
className,
|
|
7094
7860
|
disabled
|
|
7095
7861
|
}) => {
|
|
7096
|
-
const goTo = (0,
|
|
7862
|
+
const goTo = (0, import_react38.useCallback)(
|
|
7097
7863
|
(page) => {
|
|
7098
7864
|
if (disabled) return;
|
|
7099
7865
|
onPageChange(page);
|
|
@@ -7110,7 +7876,7 @@ var Pagination = ({
|
|
|
7110
7876
|
goTo(currentPage + 1);
|
|
7111
7877
|
}
|
|
7112
7878
|
};
|
|
7113
|
-
const pageTokens = (0,
|
|
7879
|
+
const pageTokens = (0, import_react38.useMemo)(() => {
|
|
7114
7880
|
if (totalPages <= 5) {
|
|
7115
7881
|
return Array.from({ length: totalPages }, (_, i) => i + 1);
|
|
7116
7882
|
}
|
|
@@ -7147,7 +7913,7 @@ var Pagination = ({
|
|
|
7147
7913
|
return tokens;
|
|
7148
7914
|
}, [totalPages, currentPage]);
|
|
7149
7915
|
if (totalPages <= 1) return null;
|
|
7150
|
-
const buttonClass = (0,
|
|
7916
|
+
const buttonClass = (0, import_clsx38.default)(
|
|
7151
7917
|
"cursor-pointer disabled:cursor-default",
|
|
7152
7918
|
paddingUsingComponentGap,
|
|
7153
7919
|
"w-8 h-8",
|
|
@@ -7158,14 +7924,14 @@ var Pagination = ({
|
|
|
7158
7924
|
"focus:bg-background-grouped-secondary-normal focus:outline-0",
|
|
7159
7925
|
"disabled:bg-transparent disabled:text-text-action-primary-disabled"
|
|
7160
7926
|
);
|
|
7161
|
-
return /* @__PURE__ */ (0,
|
|
7927
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
|
|
7162
7928
|
"nav",
|
|
7163
7929
|
{
|
|
7164
7930
|
id,
|
|
7165
7931
|
"data-testid": testid,
|
|
7166
7932
|
"aria-label": "Pagination",
|
|
7167
7933
|
onKeyDown: handleKey,
|
|
7168
|
-
className: (0,
|
|
7934
|
+
className: (0, import_clsx38.default)(
|
|
7169
7935
|
"flex items-center",
|
|
7170
7936
|
"border border-border-primary-normal",
|
|
7171
7937
|
"bg-background-grouped-primary-normal",
|
|
@@ -7173,19 +7939,19 @@ var Pagination = ({
|
|
|
7173
7939
|
className
|
|
7174
7940
|
),
|
|
7175
7941
|
children: [
|
|
7176
|
-
/* @__PURE__ */ (0,
|
|
7942
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
7177
7943
|
"button",
|
|
7178
7944
|
{
|
|
7179
7945
|
disabled: disabled || currentPage <= 1,
|
|
7180
7946
|
"aria-label": "Previous page",
|
|
7181
7947
|
onClick: () => goTo(currentPage - 1),
|
|
7182
|
-
className: (0,
|
|
7183
|
-
children: /* @__PURE__ */ (0,
|
|
7948
|
+
className: (0, import_clsx38.default)(buttonClass, "border-r-1 border-border-primary-normal"),
|
|
7949
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Icon, { name: "keyboard_arrow_left" })
|
|
7184
7950
|
}
|
|
7185
7951
|
),
|
|
7186
|
-
/* @__PURE__ */ (0,
|
|
7952
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("ul", { className: (0, import_clsx38.default)("flex items-center"), children: pageTokens.map((token, index) => {
|
|
7187
7953
|
if (token === "ellipsis") {
|
|
7188
|
-
return /* @__PURE__ */ (0,
|
|
7954
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
7189
7955
|
"li",
|
|
7190
7956
|
{
|
|
7191
7957
|
className: "w-8 h-8 select-none text-text-action-primary-disabled",
|
|
@@ -7195,29 +7961,29 @@ var Pagination = ({
|
|
|
7195
7961
|
);
|
|
7196
7962
|
}
|
|
7197
7963
|
const selected = token === currentPage;
|
|
7198
|
-
return /* @__PURE__ */ (0,
|
|
7964
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
7199
7965
|
"button",
|
|
7200
7966
|
{
|
|
7201
7967
|
"aria-label": `Page ${token}`,
|
|
7202
7968
|
"aria-current": selected ? "page" : void 0,
|
|
7203
7969
|
disabled,
|
|
7204
7970
|
onClick: () => goTo(token),
|
|
7205
|
-
className: (0,
|
|
7971
|
+
className: (0, import_clsx38.default)(
|
|
7206
7972
|
buttonClass,
|
|
7207
7973
|
selected && "border-x-1 bg-background-grouped-secondary-normal border-border-primary-normal"
|
|
7208
7974
|
),
|
|
7209
|
-
children: /* @__PURE__ */ (0,
|
|
7975
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Subheader, { align: "center", weight: "bold", children: token })
|
|
7210
7976
|
}
|
|
7211
7977
|
) }, token);
|
|
7212
7978
|
}) }),
|
|
7213
|
-
/* @__PURE__ */ (0,
|
|
7979
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
7214
7980
|
"button",
|
|
7215
7981
|
{
|
|
7216
7982
|
disabled: disabled || currentPage >= totalPages,
|
|
7217
7983
|
"aria-label": "Next page",
|
|
7218
7984
|
onClick: () => goTo(currentPage + 1),
|
|
7219
|
-
className: (0,
|
|
7220
|
-
children: /* @__PURE__ */ (0,
|
|
7985
|
+
className: (0, import_clsx38.default)(buttonClass, "border-l-1 border-border-primary-normal"),
|
|
7986
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Icon, { name: "keyboard_arrow_right" })
|
|
7221
7987
|
}
|
|
7222
7988
|
)
|
|
7223
7989
|
]
|
|
@@ -7227,12 +7993,12 @@ var Pagination = ({
|
|
|
7227
7993
|
Pagination.displayName = "Pagination";
|
|
7228
7994
|
|
|
7229
7995
|
// src/components/SkeletonParagraph.tsx
|
|
7230
|
-
var
|
|
7996
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
7231
7997
|
function SkeletonParagraph({
|
|
7232
7998
|
className = "",
|
|
7233
7999
|
heightClassName = "h-6"
|
|
7234
8000
|
}) {
|
|
7235
|
-
return /* @__PURE__ */ (0,
|
|
8001
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
7236
8002
|
"div",
|
|
7237
8003
|
{
|
|
7238
8004
|
"aria-label": "Loading content",
|
|
@@ -7243,9 +8009,9 @@ function SkeletonParagraph({
|
|
|
7243
8009
|
}
|
|
7244
8010
|
|
|
7245
8011
|
// src/components/EmptyCartIcon.tsx
|
|
7246
|
-
var
|
|
8012
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
7247
8013
|
function EmptyCartIcon() {
|
|
7248
|
-
return /* @__PURE__ */ (0,
|
|
8014
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
7249
8015
|
"svg",
|
|
7250
8016
|
{
|
|
7251
8017
|
width: "211",
|
|
@@ -7253,7 +8019,7 @@ function EmptyCartIcon() {
|
|
|
7253
8019
|
viewBox: "0 0 211 196",
|
|
7254
8020
|
fill: "none",
|
|
7255
8021
|
xmlns: "http://www.w3.org/2000/svg",
|
|
7256
|
-
children: /* @__PURE__ */ (0,
|
|
8022
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
7257
8023
|
"path",
|
|
7258
8024
|
{
|
|
7259
8025
|
"fill-rule": "evenodd",
|
|
@@ -7267,9 +8033,9 @@ function EmptyCartIcon() {
|
|
|
7267
8033
|
}
|
|
7268
8034
|
|
|
7269
8035
|
// src/components/Alert.tsx
|
|
7270
|
-
var
|
|
7271
|
-
var
|
|
7272
|
-
var
|
|
8036
|
+
var import_clsx39 = __toESM(require("clsx"), 1);
|
|
8037
|
+
var import_react39 = require("react");
|
|
8038
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
7273
8039
|
function Alert(_a) {
|
|
7274
8040
|
var _b = _a, {
|
|
7275
8041
|
id,
|
|
@@ -7289,10 +8055,10 @@ function Alert(_a) {
|
|
|
7289
8055
|
"onClose"
|
|
7290
8056
|
]);
|
|
7291
8057
|
const isError = variant === "error";
|
|
7292
|
-
const handleClose = (0,
|
|
8058
|
+
const handleClose = (0, import_react39.useCallback)(() => {
|
|
7293
8059
|
if (onClose) onClose();
|
|
7294
8060
|
}, [onClose]);
|
|
7295
|
-
return /* @__PURE__ */ (0,
|
|
8061
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
7296
8062
|
Stack,
|
|
7297
8063
|
__spreadProps(__spreadValues({
|
|
7298
8064
|
id,
|
|
@@ -7308,36 +8074,36 @@ function Alert(_a) {
|
|
|
7308
8074
|
horizontalMobile: true
|
|
7309
8075
|
}, rest), {
|
|
7310
8076
|
children: [
|
|
7311
|
-
/* @__PURE__ */ (0,
|
|
8077
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
7312
8078
|
"div",
|
|
7313
8079
|
{
|
|
7314
|
-
className: (0,
|
|
8080
|
+
className: (0, import_clsx39.default)("min-w-[2px] min-h-full flex", {
|
|
7315
8081
|
"bg-background-critical-normal": isError,
|
|
7316
8082
|
"bg-background-warning-normal": !isError
|
|
7317
8083
|
})
|
|
7318
8084
|
}
|
|
7319
8085
|
),
|
|
7320
|
-
/* @__PURE__ */ (0,
|
|
8086
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
7321
8087
|
"span",
|
|
7322
8088
|
{
|
|
7323
|
-
className: (0,
|
|
8089
|
+
className: (0, import_clsx39.default)({
|
|
7324
8090
|
"text-icon-critical-normal": isError,
|
|
7325
8091
|
"text-icon-warning-normal": !isError
|
|
7326
8092
|
}),
|
|
7327
|
-
children: /* @__PURE__ */ (0,
|
|
8093
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Icon, { name: "warning" })
|
|
7328
8094
|
}
|
|
7329
8095
|
),
|
|
7330
|
-
/* @__PURE__ */ (0,
|
|
7331
|
-
/* @__PURE__ */ (0,
|
|
7332
|
-
/* @__PURE__ */ (0,
|
|
8096
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(Stack, { flexGrow: 1, sizing: "component", children: [
|
|
8097
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Heading2, { children: title }),
|
|
8098
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Paragraph, { children: message })
|
|
7333
8099
|
] }),
|
|
7334
|
-
dismissible && /* @__PURE__ */ (0,
|
|
8100
|
+
dismissible && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
7335
8101
|
Button,
|
|
7336
8102
|
{
|
|
7337
8103
|
"aria-label": "Dismiss alert",
|
|
7338
8104
|
iconOnly: true,
|
|
7339
8105
|
variant: "tertiary",
|
|
7340
|
-
leftIcon: /* @__PURE__ */ (0,
|
|
8106
|
+
leftIcon: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Icon, { name: "close" }),
|
|
7341
8107
|
onClick: handleClose
|
|
7342
8108
|
}
|
|
7343
8109
|
)
|
|
@@ -7356,6 +8122,7 @@ function Alert(_a) {
|
|
|
7356
8122
|
DataCellHeader,
|
|
7357
8123
|
DataGrid,
|
|
7358
8124
|
DataGridCell,
|
|
8125
|
+
DateInput,
|
|
7359
8126
|
DragAlongCell,
|
|
7360
8127
|
DraggableCellHeader,
|
|
7361
8128
|
EmptyCartIcon,
|