@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
|
@@ -62,7 +62,7 @@ __export(ColumnSelector_exports, {
|
|
|
62
62
|
ColumnSelector: () => ColumnSelector
|
|
63
63
|
});
|
|
64
64
|
module.exports = __toCommonJS(ColumnSelector_exports);
|
|
65
|
-
var
|
|
65
|
+
var import_react39 = require("react");
|
|
66
66
|
|
|
67
67
|
// src/components/DataGridCell.tsx
|
|
68
68
|
var import_sortable = require("@dnd-kit/sortable");
|
|
@@ -473,6 +473,76 @@ function formatCurrencyDisplay(value) {
|
|
|
473
473
|
}
|
|
474
474
|
|
|
475
475
|
// src/utils/date.ts
|
|
476
|
+
function parseInputDate(input) {
|
|
477
|
+
const match = input.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);
|
|
478
|
+
if (!match) {
|
|
479
|
+
return null;
|
|
480
|
+
}
|
|
481
|
+
const [, month, day, year] = match;
|
|
482
|
+
const paddedMonth = month.padStart(2, "0");
|
|
483
|
+
const paddedDay = day.padStart(2, "0");
|
|
484
|
+
return `${year}-${paddedMonth}-${paddedDay}`;
|
|
485
|
+
}
|
|
486
|
+
function isValidDate(dateString) {
|
|
487
|
+
const date = new Date(dateString);
|
|
488
|
+
return date instanceof Date && !isNaN(date.getTime()) && dateString === date.toISOString().split("T")[0];
|
|
489
|
+
}
|
|
490
|
+
function formatInputValue(value) {
|
|
491
|
+
const digits = value.replace(/\D/g, "");
|
|
492
|
+
if (digits.length < 2) {
|
|
493
|
+
return digits;
|
|
494
|
+
}
|
|
495
|
+
if (digits.length >= 4) {
|
|
496
|
+
return `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, 8)}`;
|
|
497
|
+
}
|
|
498
|
+
return `${digits.slice(0, 2)}/${digits.slice(2)}`;
|
|
499
|
+
}
|
|
500
|
+
function isDigit(character) {
|
|
501
|
+
return /\d/.test(character);
|
|
502
|
+
}
|
|
503
|
+
function isSlash(character) {
|
|
504
|
+
return character === "/";
|
|
505
|
+
}
|
|
506
|
+
function countDigitsUpToCursor(value, cursorPosition) {
|
|
507
|
+
let digitCount = 0;
|
|
508
|
+
for (let i = 0; i < cursorPosition && i < value.length; i++) {
|
|
509
|
+
if (!isDigit(value[i])) {
|
|
510
|
+
continue;
|
|
511
|
+
}
|
|
512
|
+
digitCount++;
|
|
513
|
+
}
|
|
514
|
+
return digitCount;
|
|
515
|
+
}
|
|
516
|
+
function findPositionAfterDigitCount(formattedValue, targetDigitCount) {
|
|
517
|
+
let currentDigitCount = 0;
|
|
518
|
+
for (let i = 0; i < formattedValue.length; i++) {
|
|
519
|
+
if (!isDigit(formattedValue[i])) {
|
|
520
|
+
continue;
|
|
521
|
+
}
|
|
522
|
+
currentDigitCount++;
|
|
523
|
+
if (currentDigitCount !== targetDigitCount) {
|
|
524
|
+
continue;
|
|
525
|
+
}
|
|
526
|
+
const positionAfterDigit = i + 1;
|
|
527
|
+
const nextCharacter = formattedValue[positionAfterDigit];
|
|
528
|
+
if (nextCharacter && isSlash(nextCharacter)) {
|
|
529
|
+
return positionAfterDigit + 1;
|
|
530
|
+
}
|
|
531
|
+
return positionAfterDigit;
|
|
532
|
+
}
|
|
533
|
+
return formattedValue.length;
|
|
534
|
+
}
|
|
535
|
+
function calculateCursorPosition(originalValue, formattedValue, originalPosition) {
|
|
536
|
+
const targetDigitCount = countDigitsUpToCursor(
|
|
537
|
+
originalValue,
|
|
538
|
+
originalPosition
|
|
539
|
+
);
|
|
540
|
+
const newPosition = findPositionAfterDigitCount(
|
|
541
|
+
formattedValue,
|
|
542
|
+
targetDigitCount
|
|
543
|
+
);
|
|
544
|
+
return Math.min(newPosition, formattedValue.length);
|
|
545
|
+
}
|
|
476
546
|
function parseDateParts(dateString) {
|
|
477
547
|
const [yearStr, monthStr, dayStr] = dateString.split("-");
|
|
478
548
|
if (!yearStr || !monthStr || !dayStr) {
|
|
@@ -4057,23 +4127,718 @@ var Tooltip = ({
|
|
|
4057
4127
|
};
|
|
4058
4128
|
Tooltip.displayName = "Tooltip";
|
|
4059
4129
|
|
|
4060
|
-
// src/components/
|
|
4061
|
-
var
|
|
4130
|
+
// src/components/DateInput.tsx
|
|
4131
|
+
var import_react20 = require("react");
|
|
4132
|
+
var import_react_dom3 = require("react-dom");
|
|
4062
4133
|
|
|
4063
|
-
// src/components/
|
|
4134
|
+
// src/components/CalendarRange.tsx
|
|
4064
4135
|
var import_clsx19 = __toESM(require("clsx"), 1);
|
|
4136
|
+
var import_react19 = __toESM(require("react"), 1);
|
|
4137
|
+
var import_polyfill = require("@js-temporal/polyfill");
|
|
4065
4138
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
4139
|
+
function DateCell(_a) {
|
|
4140
|
+
var _b = _a, {
|
|
4141
|
+
date,
|
|
4142
|
+
isInMonth,
|
|
4143
|
+
isToday,
|
|
4144
|
+
isSelected,
|
|
4145
|
+
inRange,
|
|
4146
|
+
isDisabled,
|
|
4147
|
+
isRangeStart,
|
|
4148
|
+
isRangeEnd,
|
|
4149
|
+
onClick,
|
|
4150
|
+
onMouseEnter,
|
|
4151
|
+
onMouseLeave,
|
|
4152
|
+
cellPadding = "",
|
|
4153
|
+
isRangeDisabled = false,
|
|
4154
|
+
id,
|
|
4155
|
+
testid
|
|
4156
|
+
} = _b, props = __objRest(_b, [
|
|
4157
|
+
"date",
|
|
4158
|
+
"isInMonth",
|
|
4159
|
+
"isToday",
|
|
4160
|
+
"isSelected",
|
|
4161
|
+
"inRange",
|
|
4162
|
+
"isDisabled",
|
|
4163
|
+
"isRangeStart",
|
|
4164
|
+
"isRangeEnd",
|
|
4165
|
+
"onClick",
|
|
4166
|
+
"onMouseEnter",
|
|
4167
|
+
"onMouseLeave",
|
|
4168
|
+
"cellPadding",
|
|
4169
|
+
"isRangeDisabled",
|
|
4170
|
+
"id",
|
|
4171
|
+
"testid"
|
|
4172
|
+
]);
|
|
4173
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4174
|
+
"span",
|
|
4175
|
+
__spreadProps(__spreadValues({}, props), {
|
|
4176
|
+
id,
|
|
4177
|
+
"data-testid": testid,
|
|
4178
|
+
className: (0, import_clsx19.default)(
|
|
4179
|
+
"flex items-center justify-center aspect-square select-none transition-colors border duration-100 font-medium",
|
|
4180
|
+
typography.caption,
|
|
4181
|
+
cellPadding,
|
|
4182
|
+
!isToday && !isSelected && !inRange && !isDisabled && !isRangeStart && !isRangeEnd && "border-transparent",
|
|
4183
|
+
!isInMonth && "border-transparent",
|
|
4184
|
+
// Today: subtle border ring
|
|
4185
|
+
isToday && !isSelected && !inRange && "rounded-full border-border-primary-normal ",
|
|
4186
|
+
// Selected: Figma blue, white text, strong shadow
|
|
4187
|
+
isSelected && "bg-action-400 text-white border-action-400 z-10",
|
|
4188
|
+
!isSelected && !inRange && "rounded-base",
|
|
4189
|
+
// When range is disabled OR when only 'from' is selected (no range yet), apply rounded corners
|
|
4190
|
+
(isRangeDisabled || !inRange && isSelected) && "rounded-base",
|
|
4191
|
+
inRange && isSelected && "hover:border-action-500",
|
|
4192
|
+
// In range: Figma light blue background
|
|
4193
|
+
inRange && !isSelected && "bg-action-100 text-text-primary-normal border-y-action-400 border-x-0 ",
|
|
4194
|
+
// Disabled: Figma gray, no pointer, no hover
|
|
4195
|
+
isDisabled && !inRange ? "text-text-primary-disabled bg-transparent pointer-events-none opacity-40 border-transparent" : [
|
|
4196
|
+
"text-text-primary-normal cursor-pointer",
|
|
4197
|
+
// Figma hover: blue bg, blue text (or red text if selected)
|
|
4198
|
+
isSelected ? "hover:bg-background-action-primary-hover hover:text-white" : "hover:bg-action-100 hover:text-text-action-primary-hover",
|
|
4199
|
+
// Figma active: darker blue bg, white text
|
|
4200
|
+
"active:bg-action-300 active:text-white",
|
|
4201
|
+
// Figma focus: ring
|
|
4202
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-action-400"
|
|
4203
|
+
],
|
|
4204
|
+
isRangeStart && "rounded-l",
|
|
4205
|
+
isRangeEnd && "rounded-r"
|
|
4206
|
+
),
|
|
4207
|
+
tabIndex: isDisabled ? -1 : 0,
|
|
4208
|
+
"aria-disabled": isDisabled,
|
|
4209
|
+
onClick: () => !isDisabled && isInMonth && onClick(),
|
|
4210
|
+
onMouseEnter: () => isInMonth && onMouseEnter(),
|
|
4211
|
+
onMouseLeave: () => isInMonth && onMouseLeave(),
|
|
4212
|
+
children: isInMonth ? date.day : ""
|
|
4213
|
+
})
|
|
4214
|
+
);
|
|
4215
|
+
}
|
|
4216
|
+
function CalendarRange({
|
|
4217
|
+
from,
|
|
4218
|
+
to,
|
|
4219
|
+
onChange,
|
|
4220
|
+
isDateAvailable,
|
|
4221
|
+
mode = "double",
|
|
4222
|
+
cardStyle = false,
|
|
4223
|
+
disableRange = false,
|
|
4224
|
+
id,
|
|
4225
|
+
testid
|
|
4226
|
+
}) {
|
|
4227
|
+
const weekDays = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
|
|
4228
|
+
const parseDate = (d) => {
|
|
4229
|
+
if (!d) {
|
|
4230
|
+
return void 0;
|
|
4231
|
+
}
|
|
4232
|
+
try {
|
|
4233
|
+
if (typeof d === "number") {
|
|
4234
|
+
return import_polyfill.Temporal.PlainDate.from(new Date(d).toISOString().slice(0, 10));
|
|
4235
|
+
}
|
|
4236
|
+
if (typeof d === "string") {
|
|
4237
|
+
return import_polyfill.Temporal.PlainDate.from(d);
|
|
4238
|
+
}
|
|
4239
|
+
return void 0;
|
|
4240
|
+
} catch (error) {
|
|
4241
|
+
console.error("Invalid date format:", d, error);
|
|
4242
|
+
return import_polyfill.Temporal.Now.plainDateISO();
|
|
4243
|
+
}
|
|
4244
|
+
};
|
|
4245
|
+
const fromDate = parseDate(from);
|
|
4246
|
+
const toDate = parseDate(to);
|
|
4247
|
+
const today = import_polyfill.Temporal.Now.plainDateISO();
|
|
4248
|
+
const [baseMonth, setBaseMonth] = (0, import_react19.useState)(
|
|
4249
|
+
fromDate != null ? fromDate : today.with({ day: 1 })
|
|
4250
|
+
);
|
|
4251
|
+
const [selecting, setSelecting] = (0, import_react19.useState)("from");
|
|
4252
|
+
const [pendingFrom, setPendingFrom] = (0, import_react19.useState)(void 0);
|
|
4253
|
+
const [hoveredDate, setHoveredDate] = (0, import_react19.useState)(void 0);
|
|
4254
|
+
(0, import_react19.useEffect)(() => {
|
|
4255
|
+
if (fromDate) {
|
|
4256
|
+
setBaseMonth(fromDate.with({ day: 1 }));
|
|
4257
|
+
} else if (toDate) {
|
|
4258
|
+
setBaseMonth(toDate.with({ day: 1 }));
|
|
4259
|
+
}
|
|
4260
|
+
}, [from, to]);
|
|
4261
|
+
(0, import_react19.useEffect)(() => {
|
|
4262
|
+
if (fromDate && toDate) {
|
|
4263
|
+
setSelecting("from");
|
|
4264
|
+
setPendingFrom(void 0);
|
|
4265
|
+
setHoveredDate(void 0);
|
|
4266
|
+
}
|
|
4267
|
+
}, [from, to]);
|
|
4268
|
+
function getMonthData(monthOffset) {
|
|
4269
|
+
const monthDate = baseMonth.add({ months: monthOffset }).with({ day: 1 });
|
|
4270
|
+
const days = monthDate.daysInMonth;
|
|
4271
|
+
const firstDayOffset = monthDate.dayOfWeek % 7;
|
|
4272
|
+
return {
|
|
4273
|
+
name: monthDate.toLocaleString("en-US", { month: "long" }),
|
|
4274
|
+
year: monthDate.year,
|
|
4275
|
+
days,
|
|
4276
|
+
firstDayOffset,
|
|
4277
|
+
date: monthDate
|
|
4278
|
+
};
|
|
4279
|
+
}
|
|
4280
|
+
function getMonthDataWith(monthOffset) {
|
|
4281
|
+
const monthDate = baseMonth.with({ month: monthOffset }).with({ day: 1 });
|
|
4282
|
+
const days = monthDate.daysInMonth;
|
|
4283
|
+
const firstDayOffset = monthDate.dayOfWeek % 7;
|
|
4284
|
+
return {
|
|
4285
|
+
name: monthDate.toLocaleString("en-US", { month: "long" }),
|
|
4286
|
+
year: monthDate.year,
|
|
4287
|
+
days,
|
|
4288
|
+
firstDayOffset,
|
|
4289
|
+
date: monthDate
|
|
4290
|
+
};
|
|
4291
|
+
}
|
|
4292
|
+
function handleDayClick(date) {
|
|
4293
|
+
if (isDateAvailable && !isDateAvailable(date)) return;
|
|
4294
|
+
if (mode === "single" && disableRange) {
|
|
4295
|
+
if (onChange) {
|
|
4296
|
+
onChange(date.toString(), date.toString());
|
|
4297
|
+
}
|
|
4298
|
+
return;
|
|
4299
|
+
}
|
|
4300
|
+
if (selecting === "from") {
|
|
4301
|
+
setPendingFrom(date);
|
|
4302
|
+
setSelecting("to");
|
|
4303
|
+
setHoveredDate(void 0);
|
|
4304
|
+
} else if (pendingFrom) {
|
|
4305
|
+
if (onChange) {
|
|
4306
|
+
const [start, end] = import_polyfill.Temporal.PlainDate.compare(date, pendingFrom) < 0 ? [date, pendingFrom] : [pendingFrom, date];
|
|
4307
|
+
onChange(start.toString(), end.toString());
|
|
4308
|
+
}
|
|
4309
|
+
setPendingFrom(void 0);
|
|
4310
|
+
setSelecting("from");
|
|
4311
|
+
setHoveredDate(void 0);
|
|
4312
|
+
}
|
|
4313
|
+
}
|
|
4314
|
+
function isInRange(date) {
|
|
4315
|
+
if (mode === "single" && disableRange) {
|
|
4316
|
+
return false;
|
|
4317
|
+
}
|
|
4318
|
+
if (pendingFrom && selecting === "to" && hoveredDate) {
|
|
4319
|
+
const [start, end] = import_polyfill.Temporal.PlainDate.compare(hoveredDate, pendingFrom) < 0 ? [hoveredDate, pendingFrom] : [pendingFrom, hoveredDate];
|
|
4320
|
+
return import_polyfill.Temporal.PlainDate.compare(date, start) >= 0 && import_polyfill.Temporal.PlainDate.compare(date, end) <= 0;
|
|
4321
|
+
}
|
|
4322
|
+
if (!pendingFrom && fromDate && toDate) {
|
|
4323
|
+
return import_polyfill.Temporal.PlainDate.compare(date, fromDate) >= 0 && import_polyfill.Temporal.PlainDate.compare(date, toDate) <= 0;
|
|
4324
|
+
}
|
|
4325
|
+
return false;
|
|
4326
|
+
}
|
|
4327
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4328
|
+
"div",
|
|
4329
|
+
{
|
|
4330
|
+
id,
|
|
4331
|
+
"data-testid": testid,
|
|
4332
|
+
className: (0, import_clsx19.default)(
|
|
4333
|
+
"relative bg-background-grouped-primary-normal rounded-base w-fit",
|
|
4334
|
+
layoutPaddding,
|
|
4335
|
+
layoutGap,
|
|
4336
|
+
cardStyle && "shadow-4",
|
|
4337
|
+
// baseTransition,
|
|
4338
|
+
"overflow-hidden"
|
|
4339
|
+
),
|
|
4340
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4341
|
+
"div",
|
|
4342
|
+
{
|
|
4343
|
+
className: (0, import_clsx19.default)(
|
|
4344
|
+
"flex flex-row items-start justify-start bg-background-primary-normal overflow-clip",
|
|
4345
|
+
layoutGap
|
|
4346
|
+
),
|
|
4347
|
+
children: (mode === "double" ? [0, 1] : [0]).map((offset, idx) => {
|
|
4348
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4349
|
+
CalendarPane,
|
|
4350
|
+
{
|
|
4351
|
+
getMonthData,
|
|
4352
|
+
getMonthDataWith,
|
|
4353
|
+
offset,
|
|
4354
|
+
idx,
|
|
4355
|
+
id,
|
|
4356
|
+
testid,
|
|
4357
|
+
baseMonth,
|
|
4358
|
+
setBaseMonth,
|
|
4359
|
+
mode,
|
|
4360
|
+
pendingFrom,
|
|
4361
|
+
weekDays,
|
|
4362
|
+
fromDate,
|
|
4363
|
+
toDate,
|
|
4364
|
+
isDateAvailable,
|
|
4365
|
+
disableRange,
|
|
4366
|
+
hoveredDate,
|
|
4367
|
+
isInRange,
|
|
4368
|
+
today,
|
|
4369
|
+
setHoveredDate,
|
|
4370
|
+
handleDayClick
|
|
4371
|
+
},
|
|
4372
|
+
idx
|
|
4373
|
+
);
|
|
4374
|
+
})
|
|
4375
|
+
}
|
|
4376
|
+
)
|
|
4377
|
+
}
|
|
4378
|
+
);
|
|
4379
|
+
}
|
|
4380
|
+
function CalendarPane({
|
|
4381
|
+
getMonthData,
|
|
4382
|
+
getMonthDataWith,
|
|
4383
|
+
offset,
|
|
4384
|
+
idx,
|
|
4385
|
+
id,
|
|
4386
|
+
testid,
|
|
4387
|
+
baseMonth,
|
|
4388
|
+
setBaseMonth,
|
|
4389
|
+
mode,
|
|
4390
|
+
pendingFrom,
|
|
4391
|
+
weekDays,
|
|
4392
|
+
fromDate,
|
|
4393
|
+
toDate,
|
|
4394
|
+
isDateAvailable,
|
|
4395
|
+
disableRange,
|
|
4396
|
+
hoveredDate,
|
|
4397
|
+
isInRange,
|
|
4398
|
+
today,
|
|
4399
|
+
setHoveredDate,
|
|
4400
|
+
handleDayClick
|
|
4401
|
+
}) {
|
|
4402
|
+
const months = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
|
|
4403
|
+
const years = Array.from({ length: 100 }).map(
|
|
4404
|
+
(_, i) => baseMonth.year - 50 + i
|
|
4405
|
+
);
|
|
4406
|
+
const [monthMenuOpen, setMonthMenuOpen] = (0, import_react19.useState)(false);
|
|
4407
|
+
const [yearMenuOpen, setYearMenuOpen] = (0, import_react19.useState)(false);
|
|
4408
|
+
const monthMenuRef = (0, import_react19.useRef)(null);
|
|
4409
|
+
const yearMenuRef = (0, import_react19.useRef)(null);
|
|
4410
|
+
const month = getMonthData(offset);
|
|
4411
|
+
const totalCells = 42;
|
|
4412
|
+
const emptyCells = month.firstDayOffset;
|
|
4413
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_react19.default.Fragment, { children: [
|
|
4414
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
4415
|
+
"div",
|
|
4416
|
+
{
|
|
4417
|
+
className: (0, import_clsx19.default)("flex flex-col"),
|
|
4418
|
+
children: [
|
|
4419
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
4420
|
+
"div",
|
|
4421
|
+
{
|
|
4422
|
+
className: (0, import_clsx19.default)(
|
|
4423
|
+
"flex flex-row items-center justify-between",
|
|
4424
|
+
typography.label,
|
|
4425
|
+
"text-text-action-primary-normal"
|
|
4426
|
+
),
|
|
4427
|
+
children: [
|
|
4428
|
+
idx === 0 ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4429
|
+
"button",
|
|
4430
|
+
{
|
|
4431
|
+
id: id ? `${id}-prev-month-button` : void 0,
|
|
4432
|
+
"data-testid": testid ? `${testid}-prev-month-button` : void 0,
|
|
4433
|
+
type: "button",
|
|
4434
|
+
className: (0, import_clsx19.default)(
|
|
4435
|
+
"flex items-center justify-center rounded-base hover:bg-action-100 active:bg-action-300 text-icon-action-primary-normal",
|
|
4436
|
+
componentPadding
|
|
4437
|
+
),
|
|
4438
|
+
"aria-label": "Previous month",
|
|
4439
|
+
onClick: () => setBaseMonth(baseMonth.subtract({ months: 1 })),
|
|
4440
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Icon, { name: "chevron_left", size: 24 })
|
|
4441
|
+
}
|
|
4442
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: (0, import_clsx19.default)(componentPadding, "mr-1") }),
|
|
4443
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex gap-desktop-compact-component-padding", children: [
|
|
4444
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4445
|
+
"button",
|
|
4446
|
+
{
|
|
4447
|
+
ref: (el) => {
|
|
4448
|
+
monthMenuRef.current = el;
|
|
4449
|
+
},
|
|
4450
|
+
type: "button",
|
|
4451
|
+
onClick: () => {
|
|
4452
|
+
setMonthMenuOpen(true);
|
|
4453
|
+
setYearMenuOpen(false);
|
|
4454
|
+
},
|
|
4455
|
+
className: "font-semibold text-text-action-primary-normal text-[14px] py-[2px] truncate",
|
|
4456
|
+
children: month.name
|
|
4457
|
+
}
|
|
4458
|
+
),
|
|
4459
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4460
|
+
Menu,
|
|
4461
|
+
{
|
|
4462
|
+
show: monthMenuOpen,
|
|
4463
|
+
positionTo: monthMenuRef,
|
|
4464
|
+
setShow: () => setMonthMenuOpen(false),
|
|
4465
|
+
children: months.map((x) => [x, getMonthDataWith(x + 1)]).map(([x, m]) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4466
|
+
MenuOption,
|
|
4467
|
+
{
|
|
4468
|
+
selected: baseMonth.month === x + 1,
|
|
4469
|
+
onClick: () => {
|
|
4470
|
+
setBaseMonth(baseMonth.with({ month: x + 1 }));
|
|
4471
|
+
setMonthMenuOpen(false);
|
|
4472
|
+
},
|
|
4473
|
+
children: m.name
|
|
4474
|
+
},
|
|
4475
|
+
m.name
|
|
4476
|
+
))
|
|
4477
|
+
}
|
|
4478
|
+
),
|
|
4479
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4480
|
+
"button",
|
|
4481
|
+
{
|
|
4482
|
+
ref: (el) => {
|
|
4483
|
+
yearMenuRef.current = el;
|
|
4484
|
+
},
|
|
4485
|
+
type: "button",
|
|
4486
|
+
onClick: () => {
|
|
4487
|
+
setYearMenuOpen(true);
|
|
4488
|
+
setMonthMenuOpen(false);
|
|
4489
|
+
},
|
|
4490
|
+
className: "font-semibold text-text-action-primary-normal text-[14px] py-[2px] truncate",
|
|
4491
|
+
children: month.year
|
|
4492
|
+
}
|
|
4493
|
+
),
|
|
4494
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4495
|
+
Menu,
|
|
4496
|
+
{
|
|
4497
|
+
show: yearMenuOpen,
|
|
4498
|
+
positionTo: yearMenuRef,
|
|
4499
|
+
setShow: () => setYearMenuOpen(false),
|
|
4500
|
+
children: years.map((y) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4501
|
+
MenuOption,
|
|
4502
|
+
{
|
|
4503
|
+
selected: baseMonth.year === y,
|
|
4504
|
+
onClick: () => {
|
|
4505
|
+
setBaseMonth(baseMonth.with({ year: y }));
|
|
4506
|
+
setYearMenuOpen(false);
|
|
4507
|
+
},
|
|
4508
|
+
children: y
|
|
4509
|
+
},
|
|
4510
|
+
y
|
|
4511
|
+
))
|
|
4512
|
+
}
|
|
4513
|
+
)
|
|
4514
|
+
] }),
|
|
4515
|
+
(mode === "double" ? idx === 1 : true) ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4516
|
+
"button",
|
|
4517
|
+
{
|
|
4518
|
+
id: id ? `${id}-next-month-button` : void 0,
|
|
4519
|
+
"data-testid": testid ? `${testid}-next-month-button` : void 0,
|
|
4520
|
+
type: "button",
|
|
4521
|
+
className: (0, import_clsx19.default)(
|
|
4522
|
+
"flex items-center justify-center rounded-base hover:bg-action-100 active:bg-action-300 text-icon-action-primary-normal",
|
|
4523
|
+
componentPadding
|
|
4524
|
+
),
|
|
4525
|
+
"aria-label": "Next month",
|
|
4526
|
+
onClick: () => setBaseMonth(baseMonth.add({ months: 1 })),
|
|
4527
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Icon, { name: "chevron_right", size: 24 })
|
|
4528
|
+
}
|
|
4529
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: (0, import_clsx19.default)(componentPadding, "ml-1") })
|
|
4530
|
+
]
|
|
4531
|
+
}
|
|
4532
|
+
),
|
|
4533
|
+
/* @__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)(
|
|
4534
|
+
"span",
|
|
4535
|
+
{
|
|
4536
|
+
className: (0, import_clsx19.default)(
|
|
4537
|
+
typography.caption,
|
|
4538
|
+
"text-text-secondary-normal text-center",
|
|
4539
|
+
"w-10"
|
|
4540
|
+
),
|
|
4541
|
+
children: d
|
|
4542
|
+
},
|
|
4543
|
+
d
|
|
4544
|
+
)) }),
|
|
4545
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: (0, import_clsx19.default)("grid grid-cols-7"), children: Array.from({ length: totalCells }).map((_, i) => {
|
|
4546
|
+
const day = i - emptyCells + 1;
|
|
4547
|
+
const date = month.date.with({ day: 1 }).add({
|
|
4548
|
+
days: i - emptyCells
|
|
4549
|
+
});
|
|
4550
|
+
const isInMonth = day > 0 && day <= month.days;
|
|
4551
|
+
const isToday = isInMonth && date.equals(today);
|
|
4552
|
+
const isSelected = isInMonth && (!pendingFrom && fromDate && date.equals(fromDate) || !pendingFrom && toDate && date.equals(toDate) || pendingFrom && date.equals(pendingFrom));
|
|
4553
|
+
const inRange = isInMonth && isInRange(date);
|
|
4554
|
+
const isDisabled = !isInMonth || (isDateAvailable ? !isDateAvailable(date) : false);
|
|
4555
|
+
const hoverDateIsBeforePendingFrom = hoveredDate && pendingFrom && import_polyfill.Temporal.PlainDate.compare(hoveredDate, pendingFrom) < 0;
|
|
4556
|
+
const hoverDateIsAfterPendingFrom = hoveredDate && pendingFrom && import_polyfill.Temporal.PlainDate.compare(hoveredDate, pendingFrom) >= 0;
|
|
4557
|
+
const isRangeStart = mode === "single" && disableRange ? false : !pendingFrom && isInMonth && fromDate && date.equals(fromDate) || hoverDateIsAfterPendingFrom && date.equals(pendingFrom);
|
|
4558
|
+
const isRangeEnd = mode === "single" && disableRange ? false : !pendingFrom && isInMonth && toDate && date.equals(toDate) || hoverDateIsBeforePendingFrom && date.equals(pendingFrom);
|
|
4559
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4560
|
+
DateCell,
|
|
4561
|
+
{
|
|
4562
|
+
id: id ? `${id}-date-${date.toString()}` : void 0,
|
|
4563
|
+
testid: testid ? `${testid}-date-${date.toString()}` : void 0,
|
|
4564
|
+
date,
|
|
4565
|
+
isInMonth: !!isInMonth,
|
|
4566
|
+
isToday: !!isToday,
|
|
4567
|
+
isSelected: !!isSelected,
|
|
4568
|
+
inRange: !!inRange,
|
|
4569
|
+
isDisabled: !!isDisabled,
|
|
4570
|
+
onClick: () => handleDayClick(date),
|
|
4571
|
+
onMouseEnter: () => setHoveredDate(date),
|
|
4572
|
+
onMouseLeave: () => setHoveredDate(void 0),
|
|
4573
|
+
isRangeStart: !!isRangeStart,
|
|
4574
|
+
isRangeEnd: !!isRangeEnd,
|
|
4575
|
+
isRangeDisabled: mode === "single" && disableRange,
|
|
4576
|
+
cellPadding: componentPadding
|
|
4577
|
+
},
|
|
4578
|
+
i
|
|
4579
|
+
);
|
|
4580
|
+
}) })
|
|
4581
|
+
]
|
|
4582
|
+
}
|
|
4583
|
+
),
|
|
4584
|
+
mode === "double" && idx === 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4585
|
+
"div",
|
|
4586
|
+
{
|
|
4587
|
+
className: (0, import_clsx19.default)(
|
|
4588
|
+
"self-stretch bg-border-primary-normal rounded-base",
|
|
4589
|
+
// 1px width, full height, matches Figma divider
|
|
4590
|
+
"w-px"
|
|
4591
|
+
)
|
|
4592
|
+
}
|
|
4593
|
+
)
|
|
4594
|
+
] }, month.name + month.year);
|
|
4595
|
+
}
|
|
4066
4596
|
|
|
4067
|
-
// src/components/
|
|
4068
|
-
var import_clsx20 = __toESM(require("clsx"), 1);
|
|
4597
|
+
// src/components/DateInput.tsx
|
|
4069
4598
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
4599
|
+
var DateInput = (_a) => {
|
|
4600
|
+
var _b = _a, {
|
|
4601
|
+
id,
|
|
4602
|
+
testid,
|
|
4603
|
+
value,
|
|
4604
|
+
onChange,
|
|
4605
|
+
placeholder = "MM/DD/YYYY",
|
|
4606
|
+
disabled,
|
|
4607
|
+
readOnly = false,
|
|
4608
|
+
label
|
|
4609
|
+
} = _b, props = __objRest(_b, [
|
|
4610
|
+
"id",
|
|
4611
|
+
"testid",
|
|
4612
|
+
"value",
|
|
4613
|
+
"onChange",
|
|
4614
|
+
"placeholder",
|
|
4615
|
+
"disabled",
|
|
4616
|
+
"readOnly",
|
|
4617
|
+
"label"
|
|
4618
|
+
]);
|
|
4619
|
+
const [visible, setVisible] = (0, import_react20.useState)(false);
|
|
4620
|
+
const [inputValue, setInputValue] = (0, import_react20.useState)("");
|
|
4621
|
+
const [isTyping, setIsTyping] = (0, import_react20.useState)(false);
|
|
4622
|
+
const popoverRef = (0, import_react20.useRef)(null);
|
|
4623
|
+
const triggerRef = (0, import_react20.useRef)(null);
|
|
4624
|
+
const rootRef = (0, import_react20.useRef)(null);
|
|
4625
|
+
const [calendarPosition, setCalendarPosition] = (0, import_react20.useState)({
|
|
4626
|
+
top: 0,
|
|
4627
|
+
left: 0,
|
|
4628
|
+
width: 0
|
|
4629
|
+
});
|
|
4630
|
+
const [from, to] = [value, ""];
|
|
4631
|
+
(0, import_react20.useEffect)(() => {
|
|
4632
|
+
if (!isTyping) {
|
|
4633
|
+
setInputValue(formatDisplayValue(from));
|
|
4634
|
+
}
|
|
4635
|
+
}, [from, isTyping]);
|
|
4636
|
+
(0, import_react20.useLayoutEffect)(() => {
|
|
4637
|
+
if (visible) {
|
|
4638
|
+
updatePosition();
|
|
4639
|
+
}
|
|
4640
|
+
}, [visible]);
|
|
4641
|
+
const updatePosition = () => {
|
|
4642
|
+
if (rootRef.current) {
|
|
4643
|
+
const rect = rootRef.current.getBoundingClientRect();
|
|
4644
|
+
setCalendarPosition({
|
|
4645
|
+
top: rect.bottom + window.scrollY,
|
|
4646
|
+
left: rect.left + window.scrollX,
|
|
4647
|
+
width: rect.width
|
|
4648
|
+
});
|
|
4649
|
+
}
|
|
4650
|
+
};
|
|
4651
|
+
(0, import_react20.useEffect)(() => {
|
|
4652
|
+
updatePosition();
|
|
4653
|
+
const resizeObserver = new ResizeObserver(updatePosition);
|
|
4654
|
+
if (triggerRef.current) {
|
|
4655
|
+
resizeObserver.observe(triggerRef.current);
|
|
4656
|
+
}
|
|
4657
|
+
window.addEventListener("scroll", updatePosition);
|
|
4658
|
+
return () => {
|
|
4659
|
+
resizeObserver.disconnect();
|
|
4660
|
+
window.removeEventListener("scroll", updatePosition);
|
|
4661
|
+
};
|
|
4662
|
+
}, []);
|
|
4663
|
+
(0, import_react20.useEffect)(() => {
|
|
4664
|
+
const handleKeyDown2 = (event) => {
|
|
4665
|
+
var _a2;
|
|
4666
|
+
if (event.key === "Escape" && popoverRef.current) {
|
|
4667
|
+
setVisible(false);
|
|
4668
|
+
(_a2 = triggerRef.current) == null ? void 0 : _a2.blur();
|
|
4669
|
+
}
|
|
4670
|
+
};
|
|
4671
|
+
document.addEventListener("keydown", handleKeyDown2);
|
|
4672
|
+
return () => {
|
|
4673
|
+
document.removeEventListener("keydown", handleKeyDown2);
|
|
4674
|
+
};
|
|
4675
|
+
});
|
|
4676
|
+
(0, import_react20.useEffect)(() => {
|
|
4677
|
+
const handleClickOutside = (event) => {
|
|
4678
|
+
if (popoverRef.current && !popoverRef.current.contains(event.target) && triggerRef.current && !triggerRef.current.contains(event.target)) {
|
|
4679
|
+
setVisible(false);
|
|
4680
|
+
}
|
|
4681
|
+
};
|
|
4682
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
4683
|
+
return () => {
|
|
4684
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
4685
|
+
};
|
|
4686
|
+
}, []);
|
|
4687
|
+
function handleDateChange(fromValue) {
|
|
4688
|
+
onChange(fromValue);
|
|
4689
|
+
setVisible(false);
|
|
4690
|
+
setIsTyping(false);
|
|
4691
|
+
}
|
|
4692
|
+
const handleFocus = () => {
|
|
4693
|
+
if (readOnly) return;
|
|
4694
|
+
setVisible(true);
|
|
4695
|
+
};
|
|
4696
|
+
const handleClick = () => {
|
|
4697
|
+
handleFocus();
|
|
4698
|
+
};
|
|
4699
|
+
const handleInputChange = (event) => {
|
|
4700
|
+
if (readOnly) return;
|
|
4701
|
+
const rawValue = event.target.value;
|
|
4702
|
+
const cursorPosition = event.target.selectionStart || 0;
|
|
4703
|
+
setIsTyping(true);
|
|
4704
|
+
const formattedValue = formatInputValue(rawValue);
|
|
4705
|
+
setInputValue(formattedValue);
|
|
4706
|
+
requestAnimationFrame(() => {
|
|
4707
|
+
if (triggerRef.current) {
|
|
4708
|
+
const newPosition = calculateCursorPosition(
|
|
4709
|
+
rawValue,
|
|
4710
|
+
formattedValue,
|
|
4711
|
+
cursorPosition
|
|
4712
|
+
);
|
|
4713
|
+
triggerRef.current.setSelectionRange(newPosition, newPosition);
|
|
4714
|
+
}
|
|
4715
|
+
});
|
|
4716
|
+
const parsedDate = parseInputDate(formattedValue);
|
|
4717
|
+
if (parsedDate && isValidDate(parsedDate)) {
|
|
4718
|
+
onChange(parsedDate);
|
|
4719
|
+
}
|
|
4720
|
+
};
|
|
4721
|
+
const handleBlur = () => {
|
|
4722
|
+
setIsTyping(false);
|
|
4723
|
+
const parsedDate = parseInputDate(inputValue);
|
|
4724
|
+
if (!parsedDate || !isValidDate(parsedDate)) {
|
|
4725
|
+
setInputValue(formatDisplayValue(from));
|
|
4726
|
+
}
|
|
4727
|
+
};
|
|
4728
|
+
const handleKeyDown = (event) => {
|
|
4729
|
+
if (event.key === "Backspace") {
|
|
4730
|
+
const input = event.target;
|
|
4731
|
+
const cursorPosition = input.selectionStart || 0;
|
|
4732
|
+
const value2 = input.value;
|
|
4733
|
+
if (cursorPosition > 0 && value2[cursorPosition - 1] === "/") {
|
|
4734
|
+
event.preventDefault();
|
|
4735
|
+
const newValue = value2.slice(0, cursorPosition - 2) + value2.slice(cursorPosition);
|
|
4736
|
+
const formattedValue = formatInputValue(newValue);
|
|
4737
|
+
setInputValue(formattedValue);
|
|
4738
|
+
requestAnimationFrame(() => {
|
|
4739
|
+
if (triggerRef.current) {
|
|
4740
|
+
const newPosition = Math.max(0, cursorPosition - 2);
|
|
4741
|
+
triggerRef.current.setSelectionRange(newPosition, newPosition);
|
|
4742
|
+
}
|
|
4743
|
+
});
|
|
4744
|
+
setIsTyping(true);
|
|
4745
|
+
return;
|
|
4746
|
+
}
|
|
4747
|
+
}
|
|
4748
|
+
if (event.key === "Enter") {
|
|
4749
|
+
const parsedDate = parseInputDate(inputValue);
|
|
4750
|
+
if (parsedDate && isValidDate(parsedDate)) {
|
|
4751
|
+
onChange(parsedDate);
|
|
4752
|
+
setVisible(false);
|
|
4753
|
+
setIsTyping(false);
|
|
4754
|
+
}
|
|
4755
|
+
}
|
|
4756
|
+
};
|
|
4757
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "relative", children: [
|
|
4758
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4759
|
+
InputBase,
|
|
4760
|
+
__spreadProps(__spreadValues({
|
|
4761
|
+
id,
|
|
4762
|
+
testid,
|
|
4763
|
+
ref: (el) => {
|
|
4764
|
+
triggerRef.current = el;
|
|
4765
|
+
}
|
|
4766
|
+
}, props), {
|
|
4767
|
+
wrapperRef: rootRef,
|
|
4768
|
+
value: inputValue,
|
|
4769
|
+
placeholder,
|
|
4770
|
+
disabled,
|
|
4771
|
+
readOnly,
|
|
4772
|
+
after: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Icon, { name: "calendar_month" }),
|
|
4773
|
+
onFocus: handleFocus,
|
|
4774
|
+
onClick: handleClick,
|
|
4775
|
+
onChange: handleInputChange,
|
|
4776
|
+
onBlur: handleBlur,
|
|
4777
|
+
onKeyDown: handleKeyDown,
|
|
4778
|
+
label,
|
|
4779
|
+
secondaryIconColor: true
|
|
4780
|
+
})
|
|
4781
|
+
),
|
|
4782
|
+
visible && !readOnly && (0, import_react_dom3.createPortal)(
|
|
4783
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4784
|
+
"div",
|
|
4785
|
+
{
|
|
4786
|
+
ref: (el) => {
|
|
4787
|
+
popoverRef.current = el;
|
|
4788
|
+
},
|
|
4789
|
+
className: "absolute z-40 bg-white",
|
|
4790
|
+
style: {
|
|
4791
|
+
top: `${calendarPosition.top + 4}px`,
|
|
4792
|
+
left: `${calendarPosition.left}px`,
|
|
4793
|
+
minWidth: `${calendarPosition.width}px`
|
|
4794
|
+
},
|
|
4795
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4796
|
+
CalendarRange,
|
|
4797
|
+
{
|
|
4798
|
+
id: id ? `${id}-calendar` : void 0,
|
|
4799
|
+
testid: testid ? `${testid}-calendar` : void 0,
|
|
4800
|
+
from,
|
|
4801
|
+
to: to || from,
|
|
4802
|
+
onChange: handleDateChange,
|
|
4803
|
+
cardStyle: true,
|
|
4804
|
+
mode: "single",
|
|
4805
|
+
disableRange: true
|
|
4806
|
+
}
|
|
4807
|
+
)
|
|
4808
|
+
}
|
|
4809
|
+
),
|
|
4810
|
+
findDocumentRoot(popoverRef.current)
|
|
4811
|
+
)
|
|
4812
|
+
] });
|
|
4813
|
+
};
|
|
4814
|
+
DateInput.displayName = "DateInput";
|
|
4815
|
+
function formatDisplayValue(from) {
|
|
4816
|
+
if (!from) {
|
|
4817
|
+
return "";
|
|
4818
|
+
}
|
|
4819
|
+
if (!isValidDate(from)) {
|
|
4820
|
+
return "";
|
|
4821
|
+
}
|
|
4822
|
+
return formatDate(from);
|
|
4823
|
+
}
|
|
4070
4824
|
|
|
4071
4825
|
// src/components/Accordion.tsx
|
|
4826
|
+
var import_clsx22 = __toESM(require("clsx"), 1);
|
|
4827
|
+
|
|
4828
|
+
// src/components/Card.tsx
|
|
4829
|
+
var import_clsx20 = __toESM(require("clsx"), 1);
|
|
4072
4830
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
4073
4831
|
|
|
4074
|
-
// src/components/
|
|
4075
|
-
var
|
|
4832
|
+
// src/components/Stack.tsx
|
|
4833
|
+
var import_clsx21 = __toESM(require("clsx"), 1);
|
|
4076
4834
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4835
|
+
|
|
4836
|
+
// src/components/Accordion.tsx
|
|
4837
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
4838
|
+
|
|
4839
|
+
// src/components/Heading.tsx
|
|
4840
|
+
var import_clsx23 = __toESM(require("clsx"), 1);
|
|
4841
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
4077
4842
|
var Heading = (_a) => {
|
|
4078
4843
|
var _b = _a, {
|
|
4079
4844
|
className,
|
|
@@ -4096,12 +4861,12 @@ var Heading = (_a) => {
|
|
|
4096
4861
|
]);
|
|
4097
4862
|
const defaultElement = variant === "heading1" ? "h1" : variant === "heading2" ? "h2" : "h3";
|
|
4098
4863
|
const Element = as != null ? as : defaultElement;
|
|
4099
|
-
return /* @__PURE__ */ (0,
|
|
4864
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4100
4865
|
Element,
|
|
4101
4866
|
__spreadProps(__spreadValues({
|
|
4102
4867
|
id,
|
|
4103
4868
|
"data-testid": testid,
|
|
4104
|
-
className: (0,
|
|
4869
|
+
className: (0, import_clsx23.default)(
|
|
4105
4870
|
typography[variant],
|
|
4106
4871
|
className,
|
|
4107
4872
|
align === "left" && "text-left",
|
|
@@ -4117,26 +4882,26 @@ var Heading = (_a) => {
|
|
|
4117
4882
|
);
|
|
4118
4883
|
};
|
|
4119
4884
|
Heading.displayName = "Heading";
|
|
4120
|
-
var Heading1 = (props) => /* @__PURE__ */ (0,
|
|
4121
|
-
var Heading2 = (props) => /* @__PURE__ */ (0,
|
|
4122
|
-
var Heading3 = (props) => /* @__PURE__ */ (0,
|
|
4885
|
+
var Heading1 = (props) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Heading, __spreadProps(__spreadValues({}, props), { variant: "heading1" }));
|
|
4886
|
+
var Heading2 = (props) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Heading, __spreadProps(__spreadValues({}, props), { variant: "heading2" }));
|
|
4887
|
+
var Heading3 = (props) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Heading, __spreadProps(__spreadValues({}, props), { variant: "heading3" }));
|
|
4123
4888
|
Heading1.displayName = "Heading1";
|
|
4124
4889
|
Heading2.displayName = "Heading2";
|
|
4125
4890
|
Heading3.displayName = "Heading3";
|
|
4126
4891
|
|
|
4127
4892
|
// src/components/Theme.tsx
|
|
4128
|
-
var
|
|
4893
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
4129
4894
|
|
|
4130
4895
|
// src/components/MobileDataGrid/GridContextProvider/useGridContext.ts
|
|
4131
|
-
var
|
|
4896
|
+
var import_react22 = require("react");
|
|
4132
4897
|
|
|
4133
4898
|
// src/components/MobileDataGrid/GridContextProvider/GridContext.tsx
|
|
4134
|
-
var
|
|
4135
|
-
var GridContext = (0,
|
|
4899
|
+
var import_react21 = require("react");
|
|
4900
|
+
var GridContext = (0, import_react21.createContext)(null);
|
|
4136
4901
|
|
|
4137
4902
|
// src/components/MobileDataGrid/GridContextProvider/useGridContext.ts
|
|
4138
4903
|
function useGridContext() {
|
|
4139
|
-
const ctx = (0,
|
|
4904
|
+
const ctx = (0, import_react22.useContext)(GridContext);
|
|
4140
4905
|
if (!ctx) {
|
|
4141
4906
|
throw new Error("useGridContext must be used within GridContextProvider");
|
|
4142
4907
|
}
|
|
@@ -4144,19 +4909,19 @@ function useGridContext() {
|
|
|
4144
4909
|
}
|
|
4145
4910
|
|
|
4146
4911
|
// src/components/MobileDataGrid/MobileDataGridHeader.tsx
|
|
4147
|
-
var
|
|
4912
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
4148
4913
|
|
|
4149
4914
|
// src/components/MobileDataGrid/GridContextProvider/index.tsx
|
|
4150
|
-
var
|
|
4151
|
-
var
|
|
4915
|
+
var import_react23 = require("react");
|
|
4916
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
4152
4917
|
|
|
4153
4918
|
// src/components/Modal.tsx
|
|
4154
|
-
var
|
|
4155
|
-
var
|
|
4919
|
+
var import_clsx28 = __toESM(require("clsx"), 1);
|
|
4920
|
+
var import_react25 = require("react");
|
|
4156
4921
|
|
|
4157
4922
|
// src/components/ModalHeader.tsx
|
|
4158
|
-
var
|
|
4159
|
-
var
|
|
4923
|
+
var import_clsx24 = __toESM(require("clsx"), 1);
|
|
4924
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
4160
4925
|
var ModalHeader = ({
|
|
4161
4926
|
title,
|
|
4162
4927
|
hideCloseIcon,
|
|
@@ -4167,12 +4932,12 @@ var ModalHeader = ({
|
|
|
4167
4932
|
testid,
|
|
4168
4933
|
headerClassname
|
|
4169
4934
|
}) => {
|
|
4170
|
-
return /* @__PURE__ */ (0,
|
|
4935
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
4171
4936
|
"div",
|
|
4172
4937
|
{
|
|
4173
4938
|
id,
|
|
4174
4939
|
"data-testid": testid,
|
|
4175
|
-
className: (0,
|
|
4940
|
+
className: (0, import_clsx24.default)(
|
|
4176
4941
|
"flex justify-between items-center",
|
|
4177
4942
|
headerIconAlign === "center" && "justify-center",
|
|
4178
4943
|
headerIconAlign === "right" && "justify-end",
|
|
@@ -4182,9 +4947,9 @@ var ModalHeader = ({
|
|
|
4182
4947
|
headerClassname
|
|
4183
4948
|
),
|
|
4184
4949
|
children: [
|
|
4185
|
-
/* @__PURE__ */ (0,
|
|
4950
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: (0, import_clsx24.default)("flex items-center flex-1", layoutGroupGap), children: [
|
|
4186
4951
|
headerIcon,
|
|
4187
|
-
title && /* @__PURE__ */ (0,
|
|
4952
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4188
4953
|
Heading2,
|
|
4189
4954
|
{
|
|
4190
4955
|
id: id ? `${id}-title` : void 0,
|
|
@@ -4194,7 +4959,7 @@ var ModalHeader = ({
|
|
|
4194
4959
|
}
|
|
4195
4960
|
)
|
|
4196
4961
|
] }),
|
|
4197
|
-
!hideCloseIcon && /* @__PURE__ */ (0,
|
|
4962
|
+
!hideCloseIcon && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4198
4963
|
Button,
|
|
4199
4964
|
{
|
|
4200
4965
|
id: id ? `${id}-close-button` : void 0,
|
|
@@ -4202,7 +4967,7 @@ var ModalHeader = ({
|
|
|
4202
4967
|
iconOnly: true,
|
|
4203
4968
|
variant: "tertiary",
|
|
4204
4969
|
onClick: onClose,
|
|
4205
|
-
leftIcon: /* @__PURE__ */ (0,
|
|
4970
|
+
leftIcon: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-brand-text-action-primary-normal desktop:text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Icon, { name: "close", size: 24 }) })
|
|
4206
4971
|
}
|
|
4207
4972
|
)
|
|
4208
4973
|
]
|
|
@@ -4212,20 +4977,20 @@ var ModalHeader = ({
|
|
|
4212
4977
|
ModalHeader.displayName = "ModalHeader";
|
|
4213
4978
|
|
|
4214
4979
|
// src/components/ModalContent.tsx
|
|
4215
|
-
var
|
|
4216
|
-
var
|
|
4980
|
+
var import_clsx25 = __toESM(require("clsx"), 1);
|
|
4981
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
4217
4982
|
function ModalContent({
|
|
4218
4983
|
fixedHeightScrolling,
|
|
4219
4984
|
children,
|
|
4220
4985
|
id,
|
|
4221
4986
|
testid
|
|
4222
4987
|
}) {
|
|
4223
|
-
return /* @__PURE__ */ (0,
|
|
4988
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4224
4989
|
"div",
|
|
4225
4990
|
{
|
|
4226
4991
|
id,
|
|
4227
4992
|
"data-testid": testid,
|
|
4228
|
-
className: (0,
|
|
4993
|
+
className: (0, import_clsx25.default)(
|
|
4229
4994
|
"flex-grow desktop:flex-grow-0",
|
|
4230
4995
|
layoutPaddding,
|
|
4231
4996
|
fixedHeightScrolling && "overflow-auto"
|
|
@@ -4237,8 +5002,8 @@ function ModalContent({
|
|
|
4237
5002
|
ModalContent.displayName = "ModalContent";
|
|
4238
5003
|
|
|
4239
5004
|
// src/components/ModalButtons.tsx
|
|
4240
|
-
var
|
|
4241
|
-
var
|
|
5005
|
+
var import_clsx26 = __toESM(require("clsx"), 1);
|
|
5006
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
4242
5007
|
var ModalButtons = ({
|
|
4243
5008
|
onClose,
|
|
4244
5009
|
onContinue,
|
|
@@ -4246,36 +5011,36 @@ var ModalButtons = ({
|
|
|
4246
5011
|
id,
|
|
4247
5012
|
testid
|
|
4248
5013
|
}) => {
|
|
4249
|
-
return /* @__PURE__ */ (0,
|
|
5014
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4250
5015
|
"div",
|
|
4251
5016
|
{
|
|
4252
5017
|
id,
|
|
4253
5018
|
"data-testid": testid,
|
|
4254
|
-
className: (0,
|
|
5019
|
+
className: (0, import_clsx26.default)(
|
|
4255
5020
|
"border-t border-neutral-300 flex justify-end",
|
|
4256
5021
|
layoutPaddding,
|
|
4257
5022
|
layoutGroupGap
|
|
4258
5023
|
),
|
|
4259
|
-
children: customActions != null ? customActions : /* @__PURE__ */ (0,
|
|
4260
|
-
/* @__PURE__ */ (0,
|
|
5024
|
+
children: customActions != null ? customActions : /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
5025
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4261
5026
|
Button,
|
|
4262
5027
|
{
|
|
4263
5028
|
id: id ? `${id}-close-button` : void 0,
|
|
4264
5029
|
testid: testid ? `${testid}-close-button` : void 0,
|
|
4265
5030
|
variant: "secondary",
|
|
4266
|
-
leftIcon: /* @__PURE__ */ (0,
|
|
5031
|
+
leftIcon: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Icon, { name: "close", size: 24 }),
|
|
4267
5032
|
onClick: onClose,
|
|
4268
5033
|
className: "max-sm:w-full",
|
|
4269
5034
|
children: "Close"
|
|
4270
5035
|
}
|
|
4271
5036
|
),
|
|
4272
|
-
/* @__PURE__ */ (0,
|
|
5037
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4273
5038
|
Button,
|
|
4274
5039
|
{
|
|
4275
5040
|
id: id ? `${id}-continue-button` : void 0,
|
|
4276
5041
|
testid: testid ? `${testid}-continue-button` : void 0,
|
|
4277
5042
|
variant: "primary",
|
|
4278
|
-
leftIcon: /* @__PURE__ */ (0,
|
|
5043
|
+
leftIcon: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Icon, { name: "check", size: 24 }),
|
|
4279
5044
|
className: "max-sm:w-full",
|
|
4280
5045
|
onClick: onContinue,
|
|
4281
5046
|
children: "Continue"
|
|
@@ -4288,8 +5053,8 @@ var ModalButtons = ({
|
|
|
4288
5053
|
ModalButtons.displayName = "ModalButtons";
|
|
4289
5054
|
|
|
4290
5055
|
// src/components/ModalScrim.tsx
|
|
4291
|
-
var
|
|
4292
|
-
var
|
|
5056
|
+
var import_clsx27 = __toESM(require("clsx"), 1);
|
|
5057
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
4293
5058
|
var ModalScrim = ({
|
|
4294
5059
|
show = false,
|
|
4295
5060
|
size = "small",
|
|
@@ -4299,12 +5064,12 @@ var ModalScrim = ({
|
|
|
4299
5064
|
id,
|
|
4300
5065
|
testid
|
|
4301
5066
|
}) => {
|
|
4302
|
-
return /* @__PURE__ */ (0,
|
|
5067
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4303
5068
|
"div",
|
|
4304
5069
|
{
|
|
4305
5070
|
id,
|
|
4306
5071
|
"data-testid": testid,
|
|
4307
|
-
className: (0,
|
|
5072
|
+
className: (0, import_clsx27.default)(
|
|
4308
5073
|
"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",
|
|
4309
5074
|
!show && " pointer-events-none",
|
|
4310
5075
|
size === "small" && "p-4",
|
|
@@ -4320,14 +5085,14 @@ var ModalScrim = ({
|
|
|
4320
5085
|
ModalScrim.displayName = "ModalScrim";
|
|
4321
5086
|
|
|
4322
5087
|
// src/components/Modal.tsx
|
|
4323
|
-
var
|
|
5088
|
+
var import_react_dom4 = require("react-dom");
|
|
4324
5089
|
var import_react_use = require("react-use");
|
|
4325
5090
|
|
|
4326
5091
|
// src/components/useMounted.tsx
|
|
4327
|
-
var
|
|
5092
|
+
var import_react24 = require("react");
|
|
4328
5093
|
var useMounted = () => {
|
|
4329
|
-
const [isMounted, setIsMounted] = (0,
|
|
4330
|
-
(0,
|
|
5094
|
+
const [isMounted, setIsMounted] = (0, import_react24.useState)(false);
|
|
5095
|
+
(0, import_react24.useEffect)(() => {
|
|
4331
5096
|
setIsMounted(true);
|
|
4332
5097
|
return () => setIsMounted(false);
|
|
4333
5098
|
}, []);
|
|
@@ -4335,7 +5100,7 @@ var useMounted = () => {
|
|
|
4335
5100
|
};
|
|
4336
5101
|
|
|
4337
5102
|
// src/components/Modal.tsx
|
|
4338
|
-
var
|
|
5103
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
4339
5104
|
var fadeInScale = (element, duration = 300) => element.animate(
|
|
4340
5105
|
[
|
|
4341
5106
|
{ opacity: 0, transform: "scale(0.95)" },
|
|
@@ -4419,12 +5184,12 @@ var Modal = ({
|
|
|
4419
5184
|
}) => {
|
|
4420
5185
|
var _a;
|
|
4421
5186
|
const mounted = useMounted();
|
|
4422
|
-
const modalRef = (0,
|
|
4423
|
-
const bgRef = (0,
|
|
5187
|
+
const modalRef = (0, import_react25.useRef)(null);
|
|
5188
|
+
const bgRef = (0, import_react25.useRef)(null);
|
|
4424
5189
|
const wasOpen = (0, import_react_use.usePrevious)(open);
|
|
4425
5190
|
const isMobile = useMatchesMobile();
|
|
4426
5191
|
const computedFixedHeightScrolling = isMobile || fixedHeightScrolling;
|
|
4427
|
-
(0,
|
|
5192
|
+
(0, import_react25.useEffect)(() => {
|
|
4428
5193
|
if (!mounted) return;
|
|
4429
5194
|
if (!modalRef.current || !bgRef.current) {
|
|
4430
5195
|
console.error("Modal or background reference is not set.");
|
|
@@ -4444,7 +5209,7 @@ var Modal = ({
|
|
|
4444
5209
|
bgFadeIn(bgRef.current);
|
|
4445
5210
|
}
|
|
4446
5211
|
}, [mounted, onClose, open, wasOpen]);
|
|
4447
|
-
const handleKeyDown = (0,
|
|
5212
|
+
const handleKeyDown = (0, import_react25.useCallback)(
|
|
4448
5213
|
(e) => {
|
|
4449
5214
|
if (e.key === "Escape") {
|
|
4450
5215
|
if (onClose) {
|
|
@@ -4455,12 +5220,12 @@ var Modal = ({
|
|
|
4455
5220
|
},
|
|
4456
5221
|
[onClose]
|
|
4457
5222
|
);
|
|
4458
|
-
const handleClose = (0,
|
|
5223
|
+
const handleClose = (0, import_react25.useCallback)(() => {
|
|
4459
5224
|
if (onClose) {
|
|
4460
5225
|
onClose();
|
|
4461
5226
|
}
|
|
4462
5227
|
}, [onClose]);
|
|
4463
|
-
(0,
|
|
5228
|
+
(0, import_react25.useEffect)(() => {
|
|
4464
5229
|
if (open) {
|
|
4465
5230
|
document.addEventListener("keyup", handleKeyDown);
|
|
4466
5231
|
}
|
|
@@ -4468,7 +5233,7 @@ var Modal = ({
|
|
|
4468
5233
|
document.removeEventListener("keyup", handleKeyDown);
|
|
4469
5234
|
};
|
|
4470
5235
|
}, [open, handleKeyDown]);
|
|
4471
|
-
(0,
|
|
5236
|
+
(0, import_react25.useEffect)(() => {
|
|
4472
5237
|
if (!open) return;
|
|
4473
5238
|
const scrollY = window.scrollY;
|
|
4474
5239
|
const body = document.body;
|
|
@@ -4489,7 +5254,7 @@ var Modal = ({
|
|
|
4489
5254
|
};
|
|
4490
5255
|
}, [open]);
|
|
4491
5256
|
const { sizeClass } = (_a = sizes[size]) != null ? _a : sizes.small;
|
|
4492
|
-
const backgroundClickHandler = (0,
|
|
5257
|
+
const backgroundClickHandler = (0, import_react25.useCallback)(
|
|
4493
5258
|
(e) => {
|
|
4494
5259
|
const target = e.target;
|
|
4495
5260
|
const currentTarget = e.currentTarget;
|
|
@@ -4506,8 +5271,8 @@ var Modal = ({
|
|
|
4506
5271
|
if (!mounted) {
|
|
4507
5272
|
return null;
|
|
4508
5273
|
}
|
|
4509
|
-
return (0,
|
|
4510
|
-
/* @__PURE__ */ (0,
|
|
5274
|
+
return (0, import_react_dom4.createPortal)(
|
|
5275
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4511
5276
|
ModalScrim,
|
|
4512
5277
|
{
|
|
4513
5278
|
id: id ? `${id}-scrim` : void 0,
|
|
@@ -4516,13 +5281,13 @@ var Modal = ({
|
|
|
4516
5281
|
ref: bgRef,
|
|
4517
5282
|
show: open,
|
|
4518
5283
|
onClick: backgroundClickHandler,
|
|
4519
|
-
children: /* @__PURE__ */ (0,
|
|
5284
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
4520
5285
|
"div",
|
|
4521
5286
|
{
|
|
4522
5287
|
id,
|
|
4523
5288
|
"data-testid": testid,
|
|
4524
5289
|
ref: modalRef,
|
|
4525
|
-
className: (0,
|
|
5290
|
+
className: (0, import_clsx28.default)(
|
|
4526
5291
|
"shadow-md rounded-sm flex flex-col overflow-hidden w-full opacity-0 h-fit",
|
|
4527
5292
|
computedFixedHeightScrolling && size !== "screen" && "desktop:max-h-[calc(100vh-32px)] desktop:h-auto",
|
|
4528
5293
|
className,
|
|
@@ -4531,7 +5296,7 @@ var Modal = ({
|
|
|
4531
5296
|
),
|
|
4532
5297
|
onClick: (e) => e.stopPropagation(),
|
|
4533
5298
|
children: [
|
|
4534
|
-
/* @__PURE__ */ (0,
|
|
5299
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4535
5300
|
ModalHeader,
|
|
4536
5301
|
{
|
|
4537
5302
|
id: id ? `${id}-header` : void 0,
|
|
@@ -4544,7 +5309,7 @@ var Modal = ({
|
|
|
4544
5309
|
headerClassname
|
|
4545
5310
|
}
|
|
4546
5311
|
),
|
|
4547
|
-
children && (size !== "screen" || noWrapper) ? /* @__PURE__ */ (0,
|
|
5312
|
+
children && (size !== "screen" || noWrapper) ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4548
5313
|
ModalContent,
|
|
4549
5314
|
{
|
|
4550
5315
|
id: id ? `${id}-content` : void 0,
|
|
@@ -4553,7 +5318,7 @@ var Modal = ({
|
|
|
4553
5318
|
children
|
|
4554
5319
|
}
|
|
4555
5320
|
) : children,
|
|
4556
|
-
showButtons ? customFooter ? customActions : /* @__PURE__ */ (0,
|
|
5321
|
+
showButtons ? customFooter ? customActions : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4557
5322
|
ModalButtons,
|
|
4558
5323
|
{
|
|
4559
5324
|
id: id ? `${id}-buttons` : void 0,
|
|
@@ -4574,51 +5339,51 @@ var Modal = ({
|
|
|
4574
5339
|
Modal.displayName = "Modal";
|
|
4575
5340
|
|
|
4576
5341
|
// src/components/MobileDataGrid/MobileDataGridCard/MobileDataGridColumn.tsx
|
|
4577
|
-
var
|
|
5342
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
4578
5343
|
|
|
4579
5344
|
// src/components/MobileDataGrid/RowDetailModalProvider/ModalContent.tsx
|
|
4580
|
-
var
|
|
5345
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
4581
5346
|
|
|
4582
5347
|
// src/components/MobileDataGrid/RowDetailModalProvider/index.tsx
|
|
4583
|
-
var
|
|
5348
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
4584
5349
|
|
|
4585
5350
|
// src/components/MobileDataGrid/ColumnList.tsx
|
|
4586
|
-
var
|
|
5351
|
+
var import_clsx30 = __toESM(require("clsx"), 1);
|
|
4587
5352
|
|
|
4588
5353
|
// src/components/MobileDataGrid/MobileDataGridCard/index.tsx
|
|
4589
|
-
var
|
|
4590
|
-
var
|
|
5354
|
+
var import_clsx29 = __toESM(require("clsx"), 1);
|
|
5355
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
4591
5356
|
|
|
4592
5357
|
// src/components/MobileDataGrid/ColumnList.tsx
|
|
4593
|
-
var
|
|
5358
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
4594
5359
|
|
|
4595
5360
|
// src/components/MobileDataGrid/index.tsx
|
|
4596
|
-
var
|
|
5361
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
4597
5362
|
|
|
4598
5363
|
// src/components/ProductImagePreview/Thumbnail.tsx
|
|
4599
|
-
var
|
|
5364
|
+
var import_react27 = require("react");
|
|
4600
5365
|
|
|
4601
5366
|
// src/components/ImagePlaceholder.tsx
|
|
4602
|
-
var
|
|
4603
|
-
var
|
|
5367
|
+
var import_react26 = require("react");
|
|
5368
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
4604
5369
|
|
|
4605
5370
|
// src/components/ProductImagePreview/Thumbnail.tsx
|
|
4606
|
-
var
|
|
5371
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
4607
5372
|
|
|
4608
5373
|
// src/components/Grid.tsx
|
|
4609
|
-
var
|
|
4610
|
-
var
|
|
5374
|
+
var import_clsx31 = __toESM(require("clsx"), 1);
|
|
5375
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
4611
5376
|
|
|
4612
5377
|
// src/components/ProductImagePreview/ProductPrimaryImage.tsx
|
|
4613
|
-
var
|
|
4614
|
-
var
|
|
5378
|
+
var import_react28 = require("react");
|
|
5379
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
4615
5380
|
|
|
4616
5381
|
// src/components/ProductImagePreview/ZoomWindow.tsx
|
|
4617
|
-
var
|
|
5382
|
+
var import_react29 = require("react");
|
|
4618
5383
|
|
|
4619
5384
|
// src/components/Surface.tsx
|
|
4620
|
-
var
|
|
4621
|
-
var
|
|
5385
|
+
var import_clsx32 = __toESM(require("clsx"), 1);
|
|
5386
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
4622
5387
|
var Surface = (_a) => {
|
|
4623
5388
|
var _b = _a, {
|
|
4624
5389
|
children,
|
|
@@ -4631,11 +5396,11 @@ var Surface = (_a) => {
|
|
|
4631
5396
|
"elevation",
|
|
4632
5397
|
"id"
|
|
4633
5398
|
]);
|
|
4634
|
-
return /* @__PURE__ */ (0,
|
|
5399
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
4635
5400
|
"div",
|
|
4636
5401
|
__spreadProps(__spreadValues({
|
|
4637
5402
|
id,
|
|
4638
|
-
className: (0,
|
|
5403
|
+
className: (0, import_clsx32.default)(
|
|
4639
5404
|
"rounded-base",
|
|
4640
5405
|
{
|
|
4641
5406
|
"shadow-2": elevation === 2,
|
|
@@ -4652,43 +5417,43 @@ var Surface = (_a) => {
|
|
|
4652
5417
|
Surface.displayName = "Surface";
|
|
4653
5418
|
|
|
4654
5419
|
// src/components/ProductImagePreview/ZoomWindow.tsx
|
|
4655
|
-
var
|
|
5420
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
4656
5421
|
|
|
4657
5422
|
// src/components/ProductImagePreview/CarouselPagination.tsx
|
|
4658
|
-
var
|
|
4659
|
-
var
|
|
5423
|
+
var import_clsx33 = require("clsx");
|
|
5424
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
4660
5425
|
|
|
4661
5426
|
// src/components/ProductImagePreview/MobileImageCarousel.tsx
|
|
4662
|
-
var
|
|
4663
|
-
var
|
|
5427
|
+
var import_react30 = require("react");
|
|
5428
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
4664
5429
|
|
|
4665
5430
|
// src/components/ProductImagePreview/useProductImagePreview.ts
|
|
4666
|
-
var
|
|
5431
|
+
var import_react31 = require("react");
|
|
4667
5432
|
|
|
4668
5433
|
// src/components/ProductImagePreview/index.tsx
|
|
4669
|
-
var
|
|
5434
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
4670
5435
|
|
|
4671
5436
|
// src/components/CompactImagesPreview.tsx
|
|
4672
|
-
var
|
|
4673
|
-
var
|
|
4674
|
-
var
|
|
5437
|
+
var import_react32 = require("react");
|
|
5438
|
+
var import_clsx34 = __toESM(require("clsx"), 1);
|
|
5439
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
4675
5440
|
|
|
4676
5441
|
// src/components/SimpleTable.tsx
|
|
4677
|
-
var
|
|
4678
|
-
var
|
|
5442
|
+
var import_clsx35 = __toESM(require("clsx"), 1);
|
|
5443
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
4679
5444
|
|
|
4680
5445
|
// src/components/PDFViewer/index.tsx
|
|
4681
|
-
var
|
|
5446
|
+
var import_react35 = require("react");
|
|
4682
5447
|
|
|
4683
5448
|
// src/components/PDFViewer/PDFElement.tsx
|
|
4684
5449
|
var import_react_pdf2 = require("@mikecousins/react-pdf");
|
|
4685
|
-
var
|
|
5450
|
+
var import_react34 = require("react");
|
|
4686
5451
|
|
|
4687
5452
|
// src/components/Spinner.tsx
|
|
4688
|
-
var
|
|
5453
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
4689
5454
|
var Spinner = ({ size = "small", testid }) => {
|
|
4690
5455
|
const dimension = size === "large" ? 48 : 24;
|
|
4691
|
-
return /* @__PURE__ */ (0,
|
|
5456
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
4692
5457
|
"svg",
|
|
4693
5458
|
{
|
|
4694
5459
|
"data-testid": testid,
|
|
@@ -4700,14 +5465,14 @@ var Spinner = ({ size = "small", testid }) => {
|
|
|
4700
5465
|
className: "spinner",
|
|
4701
5466
|
"aria-label": "Loading",
|
|
4702
5467
|
children: [
|
|
4703
|
-
/* @__PURE__ */ (0,
|
|
4704
|
-
/* @__PURE__ */ (0,
|
|
4705
|
-
/* @__PURE__ */ (0,
|
|
4706
|
-
/* @__PURE__ */ (0,
|
|
4707
|
-
/* @__PURE__ */ (0,
|
|
4708
|
-
/* @__PURE__ */ (0,
|
|
4709
|
-
/* @__PURE__ */ (0,
|
|
4710
|
-
/* @__PURE__ */ (0,
|
|
5468
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("circle", { cx: "12", cy: "4", r: "2", opacity: "1" }),
|
|
5469
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("circle", { cx: "17.666", cy: "6.334", r: "2", opacity: "0.125" }),
|
|
5470
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("circle", { cx: "20", cy: "12", r: "2", opacity: "0.25" }),
|
|
5471
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("circle", { cx: "17.666", cy: "17.666", r: "2", opacity: "0.375" }),
|
|
5472
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("circle", { cx: "12", cy: "20", r: "2", opacity: "0.5" }),
|
|
5473
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("circle", { cx: "6.334", cy: "17.666", r: "2", opacity: "0.625" }),
|
|
5474
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("circle", { cx: "4", cy: "12", r: "2", opacity: "0.75" }),
|
|
5475
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("circle", { cx: "6.334", cy: "6.334", r: "2", opacity: "0.875" })
|
|
4711
5476
|
]
|
|
4712
5477
|
}
|
|
4713
5478
|
);
|
|
@@ -4716,31 +5481,31 @@ Spinner.displayName = "Spinner";
|
|
|
4716
5481
|
|
|
4717
5482
|
// src/components/PDFViewer/PDFPage.tsx
|
|
4718
5483
|
var import_react_pdf = require("@mikecousins/react-pdf");
|
|
4719
|
-
var
|
|
4720
|
-
var
|
|
5484
|
+
var import_react33 = require("react");
|
|
5485
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
4721
5486
|
|
|
4722
5487
|
// src/components/PDFViewer/PDFElement.tsx
|
|
4723
|
-
var
|
|
4724
|
-
var
|
|
5488
|
+
var import_clsx36 = __toESM(require("clsx"), 1);
|
|
5489
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
4725
5490
|
|
|
4726
5491
|
// src/components/PDFViewer/DownloadIcon.tsx
|
|
4727
|
-
var
|
|
5492
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
4728
5493
|
|
|
4729
5494
|
// src/components/PDFViewer/PDFNavigation.tsx
|
|
4730
|
-
var
|
|
5495
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
4731
5496
|
|
|
4732
5497
|
// src/components/PDFViewer/index.tsx
|
|
4733
|
-
var
|
|
5498
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
4734
5499
|
|
|
4735
5500
|
// src/components/ListGroup.tsx
|
|
4736
|
-
var
|
|
4737
|
-
var
|
|
4738
|
-
var
|
|
5501
|
+
var import_react36 = require("react");
|
|
5502
|
+
var import_clsx37 = __toESM(require("clsx"), 1);
|
|
5503
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
4739
5504
|
|
|
4740
5505
|
// src/components/Pagination.tsx
|
|
4741
|
-
var
|
|
4742
|
-
var
|
|
4743
|
-
var
|
|
5506
|
+
var import_react37 = require("react");
|
|
5507
|
+
var import_clsx38 = __toESM(require("clsx"), 1);
|
|
5508
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
4744
5509
|
var Pagination = ({
|
|
4745
5510
|
totalPages,
|
|
4746
5511
|
currentPage,
|
|
@@ -4750,7 +5515,7 @@ var Pagination = ({
|
|
|
4750
5515
|
className,
|
|
4751
5516
|
disabled
|
|
4752
5517
|
}) => {
|
|
4753
|
-
const goTo = (0,
|
|
5518
|
+
const goTo = (0, import_react37.useCallback)(
|
|
4754
5519
|
(page) => {
|
|
4755
5520
|
if (disabled) return;
|
|
4756
5521
|
onPageChange(page);
|
|
@@ -4767,7 +5532,7 @@ var Pagination = ({
|
|
|
4767
5532
|
goTo(currentPage + 1);
|
|
4768
5533
|
}
|
|
4769
5534
|
};
|
|
4770
|
-
const pageTokens = (0,
|
|
5535
|
+
const pageTokens = (0, import_react37.useMemo)(() => {
|
|
4771
5536
|
if (totalPages <= 5) {
|
|
4772
5537
|
return Array.from({ length: totalPages }, (_, i) => i + 1);
|
|
4773
5538
|
}
|
|
@@ -4804,7 +5569,7 @@ var Pagination = ({
|
|
|
4804
5569
|
return tokens;
|
|
4805
5570
|
}, [totalPages, currentPage]);
|
|
4806
5571
|
if (totalPages <= 1) return null;
|
|
4807
|
-
const buttonClass = (0,
|
|
5572
|
+
const buttonClass = (0, import_clsx38.default)(
|
|
4808
5573
|
"cursor-pointer disabled:cursor-default",
|
|
4809
5574
|
paddingUsingComponentGap,
|
|
4810
5575
|
"w-8 h-8",
|
|
@@ -4815,14 +5580,14 @@ var Pagination = ({
|
|
|
4815
5580
|
"focus:bg-background-grouped-secondary-normal focus:outline-0",
|
|
4816
5581
|
"disabled:bg-transparent disabled:text-text-action-primary-disabled"
|
|
4817
5582
|
);
|
|
4818
|
-
return /* @__PURE__ */ (0,
|
|
5583
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
4819
5584
|
"nav",
|
|
4820
5585
|
{
|
|
4821
5586
|
id,
|
|
4822
5587
|
"data-testid": testid,
|
|
4823
5588
|
"aria-label": "Pagination",
|
|
4824
5589
|
onKeyDown: handleKey,
|
|
4825
|
-
className: (0,
|
|
5590
|
+
className: (0, import_clsx38.default)(
|
|
4826
5591
|
"flex items-center",
|
|
4827
5592
|
"border border-border-primary-normal",
|
|
4828
5593
|
"bg-background-grouped-primary-normal",
|
|
@@ -4830,19 +5595,19 @@ var Pagination = ({
|
|
|
4830
5595
|
className
|
|
4831
5596
|
),
|
|
4832
5597
|
children: [
|
|
4833
|
-
/* @__PURE__ */ (0,
|
|
5598
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4834
5599
|
"button",
|
|
4835
5600
|
{
|
|
4836
5601
|
disabled: disabled || currentPage <= 1,
|
|
4837
5602
|
"aria-label": "Previous page",
|
|
4838
5603
|
onClick: () => goTo(currentPage - 1),
|
|
4839
|
-
className: (0,
|
|
4840
|
-
children: /* @__PURE__ */ (0,
|
|
5604
|
+
className: (0, import_clsx38.default)(buttonClass, "border-r-1 border-border-primary-normal"),
|
|
5605
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Icon, { name: "keyboard_arrow_left" })
|
|
4841
5606
|
}
|
|
4842
5607
|
),
|
|
4843
|
-
/* @__PURE__ */ (0,
|
|
5608
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("ul", { className: (0, import_clsx38.default)("flex items-center"), children: pageTokens.map((token, index) => {
|
|
4844
5609
|
if (token === "ellipsis") {
|
|
4845
|
-
return /* @__PURE__ */ (0,
|
|
5610
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4846
5611
|
"li",
|
|
4847
5612
|
{
|
|
4848
5613
|
className: "w-8 h-8 select-none text-text-action-primary-disabled",
|
|
@@ -4852,29 +5617,29 @@ var Pagination = ({
|
|
|
4852
5617
|
);
|
|
4853
5618
|
}
|
|
4854
5619
|
const selected = token === currentPage;
|
|
4855
|
-
return /* @__PURE__ */ (0,
|
|
5620
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4856
5621
|
"button",
|
|
4857
5622
|
{
|
|
4858
5623
|
"aria-label": `Page ${token}`,
|
|
4859
5624
|
"aria-current": selected ? "page" : void 0,
|
|
4860
5625
|
disabled,
|
|
4861
5626
|
onClick: () => goTo(token),
|
|
4862
|
-
className: (0,
|
|
5627
|
+
className: (0, import_clsx38.default)(
|
|
4863
5628
|
buttonClass,
|
|
4864
5629
|
selected && "border-x-1 bg-background-grouped-secondary-normal border-border-primary-normal"
|
|
4865
5630
|
),
|
|
4866
|
-
children: /* @__PURE__ */ (0,
|
|
5631
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Subheader, { align: "center", weight: "bold", children: token })
|
|
4867
5632
|
}
|
|
4868
5633
|
) }, token);
|
|
4869
5634
|
}) }),
|
|
4870
|
-
/* @__PURE__ */ (0,
|
|
5635
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4871
5636
|
"button",
|
|
4872
5637
|
{
|
|
4873
5638
|
disabled: disabled || currentPage >= totalPages,
|
|
4874
5639
|
"aria-label": "Next page",
|
|
4875
5640
|
onClick: () => goTo(currentPage + 1),
|
|
4876
|
-
className: (0,
|
|
4877
|
-
children: /* @__PURE__ */ (0,
|
|
5641
|
+
className: (0, import_clsx38.default)(buttonClass, "border-l-1 border-border-primary-normal"),
|
|
5642
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Icon, { name: "keyboard_arrow_right" })
|
|
4878
5643
|
}
|
|
4879
5644
|
)
|
|
4880
5645
|
]
|
|
@@ -4884,22 +5649,22 @@ var Pagination = ({
|
|
|
4884
5649
|
Pagination.displayName = "Pagination";
|
|
4885
5650
|
|
|
4886
5651
|
// src/components/SkeletonParagraph.tsx
|
|
4887
|
-
var
|
|
5652
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
4888
5653
|
|
|
4889
5654
|
// src/components/EmptyCartIcon.tsx
|
|
4890
|
-
var
|
|
5655
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
4891
5656
|
|
|
4892
5657
|
// src/components/Alert.tsx
|
|
4893
|
-
var
|
|
4894
|
-
var
|
|
4895
|
-
var
|
|
5658
|
+
var import_clsx39 = __toESM(require("clsx"), 1);
|
|
5659
|
+
var import_react38 = require("react");
|
|
5660
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
4896
5661
|
|
|
4897
5662
|
// src/components/MobileDataGrid/ColumnSelector/index.tsx
|
|
4898
|
-
var
|
|
5663
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
4899
5664
|
function ColumnSelector() {
|
|
4900
5665
|
const context = useGridContext();
|
|
4901
|
-
const ref = (0,
|
|
4902
|
-
const [show, setShow] = (0,
|
|
5666
|
+
const ref = (0, import_react39.useRef)(null);
|
|
5667
|
+
const [show, setShow] = (0, import_react39.useState)(false);
|
|
4903
5668
|
const {
|
|
4904
5669
|
columns,
|
|
4905
5670
|
id,
|
|
@@ -4910,13 +5675,13 @@ function ColumnSelector() {
|
|
|
4910
5675
|
resetColumnVisibility,
|
|
4911
5676
|
dispatch
|
|
4912
5677
|
} = context;
|
|
4913
|
-
const toggleColumnVisibility = (0,
|
|
5678
|
+
const toggleColumnVisibility = (0, import_react39.useCallback)(
|
|
4914
5679
|
(index, visible) => {
|
|
4915
5680
|
dispatch({ type: "UPDATE", index, payload: { meta: { visible } } });
|
|
4916
5681
|
},
|
|
4917
5682
|
[dispatch]
|
|
4918
5683
|
);
|
|
4919
|
-
return /* @__PURE__ */ (0,
|
|
5684
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
4920
5685
|
"div",
|
|
4921
5686
|
{
|
|
4922
5687
|
id: id ? `${id}-column-selector` : void 0,
|
|
@@ -4924,7 +5689,7 @@ function ColumnSelector() {
|
|
|
4924
5689
|
className: "text-text-secondary-normal border-l border-brand-200 p-mobile-container-padding",
|
|
4925
5690
|
ref,
|
|
4926
5691
|
children: [
|
|
4927
|
-
/* @__PURE__ */ (0,
|
|
5692
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
4928
5693
|
Button,
|
|
4929
5694
|
{
|
|
4930
5695
|
id: id ? `${id}-button` : void 0,
|
|
@@ -4933,10 +5698,10 @@ function ColumnSelector() {
|
|
|
4933
5698
|
variant: "navigation",
|
|
4934
5699
|
iconOnly: true,
|
|
4935
5700
|
size: 24,
|
|
4936
|
-
leftIcon: /* @__PURE__ */ (0,
|
|
5701
|
+
leftIcon: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Icon, { name: "tune" })
|
|
4937
5702
|
}
|
|
4938
5703
|
),
|
|
4939
|
-
/* @__PURE__ */ (0,
|
|
5704
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
4940
5705
|
Menu,
|
|
4941
5706
|
{
|
|
4942
5707
|
id: id ? `${id}-menu` : void 0,
|
|
@@ -4947,7 +5712,7 @@ function ColumnSelector() {
|
|
|
4947
5712
|
setShow,
|
|
4948
5713
|
calculateMinMaxHeight: true,
|
|
4949
5714
|
children: [
|
|
4950
|
-
/* @__PURE__ */ (0,
|
|
5715
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
4951
5716
|
Button,
|
|
4952
5717
|
{
|
|
4953
5718
|
id: id ? `${id}-reset-button` : void 0,
|
|
@@ -4965,11 +5730,11 @@ function ColumnSelector() {
|
|
|
4965
5730
|
return (_a = x.meta) == null ? void 0 : _a.inVisibilityMenu;
|
|
4966
5731
|
}).map((column) => {
|
|
4967
5732
|
var _a, _b, _c;
|
|
4968
|
-
return /* @__PURE__ */ (0,
|
|
5733
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
4969
5734
|
MenuOption,
|
|
4970
5735
|
{
|
|
4971
5736
|
testid: testid ? `${testid}-option-${column.id}` : void 0,
|
|
4972
|
-
children: /* @__PURE__ */ (0,
|
|
5737
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
4973
5738
|
Checkbox,
|
|
4974
5739
|
{
|
|
4975
5740
|
id: id ? `${id}-checkbox-${column.id}` : void 0,
|