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