@dmsi/wedgekit-react 0.0.411 → 0.0.413

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.
Files changed (35) hide show
  1. package/dist/components/CalendarRange.cjs +46 -71
  2. package/dist/components/CalendarRange.js +1 -6
  3. package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.cjs +4 -29
  4. package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.js +1 -6
  5. package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.cjs +13 -38
  6. package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.js +1 -6
  7. package/dist/components/DataGrid/PinnedColumns.cjs +29 -54
  8. package/dist/components/DataGrid/PinnedColumns.js +1 -6
  9. package/dist/components/DataGrid/TableBody/LoadingCell.cjs +5 -30
  10. package/dist/components/DataGrid/TableBody/LoadingCell.js +1 -6
  11. package/dist/components/DataGrid/TableBody/TableBodyRow.cjs +11 -36
  12. package/dist/components/DataGrid/TableBody/TableBodyRow.js +1 -6
  13. package/dist/components/DataGrid/TableBody/index.cjs +26 -51
  14. package/dist/components/DataGrid/TableBody/index.js +1 -6
  15. package/dist/components/DataGrid/index.cjs +115 -140
  16. package/dist/components/DataGrid/index.js +1 -6
  17. package/dist/components/DataGrid/utils.cjs +5 -30
  18. package/dist/components/DataGrid/utils.js +1 -6
  19. package/dist/components/DateInput.cjs +65 -90
  20. package/dist/components/DateInput.js +1 -6
  21. package/dist/components/DateRangeInput.cjs +65 -90
  22. package/dist/components/DateRangeInput.js +1 -6
  23. package/dist/components/MobileDataGrid/ColumnSelector/index.cjs +12 -37
  24. package/dist/components/MobileDataGrid/ColumnSelector/index.js +1 -6
  25. package/dist/components/MobileDataGrid/MobileDataGridHeader.cjs +20 -45
  26. package/dist/components/MobileDataGrid/MobileDataGridHeader.js +1 -6
  27. package/dist/components/MobileDataGrid/index.cjs +499 -524
  28. package/dist/components/MobileDataGrid/index.js +1 -6
  29. package/dist/components/PDFViewer/index.js +109 -6
  30. package/dist/components/index.cjs +0 -286
  31. package/dist/components/index.js +1 -9
  32. package/package.json +1 -1
  33. package/src/components/index.ts +0 -1
  34. package/dist/chunk-LLZ3SSZJ.js +0 -114
  35. /package/dist/{chunk-OW3WN3JV.js → chunk-OBY5EH47.js} +0 -0
@@ -670,7 +670,7 @@ function Theme({
670
670
  }
671
671
 
672
672
  // src/components/MobileDataGrid/ColumnSelector/index.tsx
673
- var import_react34 = require("react");
673
+ var import_react29 = require("react");
674
674
 
675
675
  // src/components/DataGridCell.tsx
676
676
  var import_sortable = require("@dnd-kit/sortable");
@@ -4403,149 +4403,460 @@ var import_react26 = require("react");
4403
4403
  var import_clsx26 = __toESM(require("clsx"), 1);
4404
4404
  var import_jsx_runtime37 = require("react/jsx-runtime");
4405
4405
 
4406
- // src/components/PDFViewer/index.tsx
4407
- var import_react31 = require("react");
4408
-
4409
- // src/components/Modal.tsx
4410
- var import_clsx31 = __toESM(require("clsx"), 1);
4406
+ // src/components/MobileDataGrid/GridContextProvider/useGridContext.ts
4411
4407
  var import_react28 = require("react");
4412
4408
 
4413
- // src/components/ModalHeader.tsx
4414
- var import_clsx27 = __toESM(require("clsx"), 1);
4409
+ // src/components/MobileDataGrid/GridContextProvider/GridContext.tsx
4410
+ var import_react27 = require("react");
4411
+ var GridContext = (0, import_react27.createContext)(null);
4412
+
4413
+ // src/components/MobileDataGrid/GridContextProvider/useGridContext.ts
4414
+ function useGridContext() {
4415
+ const ctx = (0, import_react28.useContext)(GridContext);
4416
+ if (!ctx) {
4417
+ throw new Error("useGridContext must be used within GridContextProvider");
4418
+ }
4419
+ return ctx;
4420
+ }
4421
+
4422
+ // src/components/MobileDataGrid/ColumnSelector/index.tsx
4415
4423
  var import_jsx_runtime38 = require("react/jsx-runtime");
4416
- var ModalHeader = ({
4417
- title,
4418
- hideCloseIcon,
4419
- headerIcon,
4420
- headerIconAlign,
4421
- onClose,
4422
- id,
4423
- testid,
4424
- headerClassname
4425
- }) => {
4424
+ function ColumnSelector() {
4425
+ const context = useGridContext();
4426
+ const ref = (0, import_react29.useRef)(null);
4427
+ const [show, setShow] = (0, import_react29.useState)(false);
4428
+ const {
4429
+ columns,
4430
+ id,
4431
+ testid,
4432
+ visibleColumns,
4433
+ numberOfColumnsToShow,
4434
+ primaryKey,
4435
+ resetColumnVisibility,
4436
+ dispatch
4437
+ } = context;
4438
+ const toggleColumnVisibility = (0, import_react29.useCallback)(
4439
+ (index, visible) => {
4440
+ dispatch({ type: "UPDATE", index, payload: { meta: { visible } } });
4441
+ },
4442
+ [dispatch]
4443
+ );
4426
4444
  return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
4427
4445
  "div",
4428
4446
  {
4429
- id,
4447
+ id: id ? `${id}-column-selector` : void 0,
4430
4448
  "data-testid": testid,
4431
- className: (0, import_clsx27.default)(
4432
- "flex justify-between items-center",
4433
- headerIconAlign === "center" && "justify-center",
4434
- headerIconAlign === "right" && "justify-end",
4435
- headerIconAlign === "left" && "justify-start",
4436
- layoutPaddding,
4437
- layoutGroupGap,
4438
- headerClassname
4439
- ),
4449
+ className: "text-text-secondary-normal border-l border-brand-200 p-mobile-container-padding",
4450
+ ref,
4440
4451
  children: [
4441
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: (0, import_clsx27.default)("flex items-center flex-1", layoutGroupGap), children: [
4442
- headerIcon,
4443
- title && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
4444
- Heading2,
4445
- {
4446
- id: id ? `${id}-title` : void 0,
4447
- testid: testid ? `${testid}-title` : void 0,
4448
- as: "p",
4449
- children: title
4450
- }
4451
- )
4452
- ] }),
4453
- !hideCloseIcon && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
4452
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
4454
4453
  Button,
4455
4454
  {
4456
- id: id ? `${id}-close-button` : void 0,
4457
- testid: testid ? `${testid}-close-button` : void 0,
4455
+ id: id ? `${id}-button` : void 0,
4456
+ testid: testid ? `${testid}-button` : void 0,
4457
+ onClick: () => setShow((prev) => !prev),
4458
+ variant: "navigation",
4458
4459
  iconOnly: true,
4459
- variant: "tertiary",
4460
- onClick: onClose,
4461
- leftIcon: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "text-brand-text-action-primary-normal desktop:text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Icon, { name: "close", size: 24 }) })
4460
+ size: 24,
4461
+ leftIcon: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Icon, { name: "tune" })
4462
+ }
4463
+ ),
4464
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
4465
+ Menu,
4466
+ {
4467
+ id: id ? `${id}-menu` : void 0,
4468
+ testid: testid ? `${testid}-menu` : void 0,
4469
+ positionTo: ref,
4470
+ position: "bottom-right",
4471
+ show,
4472
+ setShow,
4473
+ calculateMinMaxHeight: true,
4474
+ children: [
4475
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
4476
+ Button,
4477
+ {
4478
+ id: id ? `${id}-reset-button` : void 0,
4479
+ testid: testid ? `${testid}-reset-button` : void 0,
4480
+ variant: "tertiary",
4481
+ onClick: () => {
4482
+ resetColumnVisibility();
4483
+ setShow(false);
4484
+ },
4485
+ children: "Reset to default"
4486
+ }
4487
+ ),
4488
+ columns.filter((x) => {
4489
+ var _a;
4490
+ return (_a = x.meta) == null ? void 0 : _a.inVisibilityMenu;
4491
+ }).map((column) => {
4492
+ var _a, _b, _c;
4493
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
4494
+ MenuOption,
4495
+ {
4496
+ testid: testid ? `${testid}-option-${column.id}` : void 0,
4497
+ children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
4498
+ Checkbox,
4499
+ {
4500
+ id: id ? `${id}-checkbox-${column.id}` : void 0,
4501
+ testid: testid ? `${testid}-checkbox-${column.id}` : void 0,
4502
+ label: (_a = column.header) == null ? void 0 : _a.toString(),
4503
+ checked: !!((_b = column.meta) == null ? void 0 : _b.visible) || column.id === String(primaryKey),
4504
+ disabled: typeof numberOfColumnsToShow !== "undefined" && // account for header+link occupying one slot
4505
+ visibleColumns.length >= numberOfColumnsToShow - 1 && ((_c = column.meta) == null ? void 0 : _c.visible) !== true || column.id === String(primaryKey),
4506
+ onChange: (e) => {
4507
+ toggleColumnVisibility(
4508
+ columns.findIndex(({ id: id2 }) => id2 === column.id),
4509
+ e.target.checked
4510
+ );
4511
+ }
4512
+ }
4513
+ )
4514
+ },
4515
+ id ? `${id}-option-${column.id}` : void 0
4516
+ );
4517
+ })
4518
+ ]
4462
4519
  }
4463
4520
  )
4464
4521
  ]
4465
4522
  }
4466
4523
  );
4467
- };
4468
- ModalHeader.displayName = "ModalHeader";
4524
+ }
4469
4525
 
4470
- // src/components/ModalContent.tsx
4471
- var import_clsx28 = __toESM(require("clsx"), 1);
4526
+ // src/components/MobileDataGrid/MobileDataGridHeader.tsx
4472
4527
  var import_jsx_runtime39 = require("react/jsx-runtime");
4473
- function ModalContent({
4474
- fixedHeightScrolling,
4475
- children,
4476
- id,
4477
- testid
4528
+ function MobileDataGridHeader({
4529
+ header: Header,
4530
+ enableColumnSelector,
4531
+ enableRowSelection
4478
4532
  }) {
4479
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
4480
- "div",
4481
- {
4482
- id,
4483
- "data-testid": testid,
4484
- className: (0, import_clsx28.default)(
4485
- "flex-grow desktop:flex-grow-0",
4486
- layoutPaddding,
4487
- fixedHeightScrolling && "overflow-auto"
4488
- ),
4489
- children
4490
- }
4491
- );
4492
- }
4493
- ModalContent.displayName = "ModalContent";
4494
-
4495
- // src/components/ModalButtons.tsx
4496
- var import_clsx29 = __toESM(require("clsx"), 1);
4497
- var import_jsx_runtime40 = require("react/jsx-runtime");
4498
- var ModalButtons = ({
4499
- onClose,
4500
- onContinue,
4501
- customActions,
4502
- id,
4503
- testid
4504
- }) => {
4505
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
4506
- "div",
4507
- {
4508
- id,
4509
- "data-testid": testid,
4510
- className: (0, import_clsx29.default)(
4511
- "border-t border-neutral-300 flex justify-end",
4512
- layoutPaddding,
4513
- layoutGroupGap
4514
- ),
4515
- children: customActions != null ? customActions : /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
4516
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
4517
- Button,
4518
- {
4519
- id: id ? `${id}-close-button` : void 0,
4520
- testid: testid ? `${testid}-close-button` : void 0,
4521
- variant: "secondary",
4522
- leftIcon: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Icon, { name: "close", size: 24 }),
4523
- onClick: onClose,
4524
- className: "max-sm:w-full",
4525
- children: "Close"
4526
- }
4527
- ),
4528
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
4529
- Button,
4533
+ var _a, _b;
4534
+ const ctx = useGridContext();
4535
+ const {
4536
+ id,
4537
+ testid,
4538
+ selectedRowIds,
4539
+ data,
4540
+ primaryKey,
4541
+ columns,
4542
+ handleRowSelectAll
4543
+ } = ctx;
4544
+ if (typeof Header === "undefined" && !primaryKey) return null;
4545
+ if (typeof Header === "function") return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Header, __spreadValues({}, ctx));
4546
+ if (typeof Header === "string" || primaryKey)
4547
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
4548
+ "div",
4549
+ {
4550
+ id: id ? `${id}-header` : void 0,
4551
+ "data-testid": testid ? `${testid}-header` : void 0,
4552
+ className: "sticky top-0",
4553
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Theme, { theme: "brand", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
4554
+ Stack,
4530
4555
  {
4531
- id: id ? `${id}-continue-button` : void 0,
4532
- testid: testid ? `${testid}-continue-button` : void 0,
4533
- variant: "primary",
4534
- leftIcon: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Icon, { name: "check", size: 24 }),
4535
- className: "max-sm:w-full",
4536
- onClick: onContinue,
4537
- children: "Continue"
4556
+ horizontal: true,
4557
+ horizontalMobile: true,
4558
+ items: "center",
4559
+ justify: "between",
4560
+ backgroundColor: "background-primary-normal",
4561
+ children: [
4562
+ enableRowSelection && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "p-mobile-component-padding border-r border-brand-200 max-w-fit h-full", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
4563
+ Checkbox,
4564
+ {
4565
+ id: id ? `${id}-select-all-checkbox` : void 0,
4566
+ testid: testid ? `${testid}-select-all-checkbox` : void 0,
4567
+ checked: selectedRowIds.length === data.length,
4568
+ indeterminate: !!selectedRowIds.length && selectedRowIds.length !== data.length,
4569
+ onChange: handleRowSelectAll
4570
+ }
4571
+ ) }),
4572
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
4573
+ Stack,
4574
+ {
4575
+ horizontal: true,
4576
+ horizontalMobile: true,
4577
+ items: "center",
4578
+ sizing: "component",
4579
+ padding: true,
4580
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Heading3, { as: "span", color: "text-primary-normal", children: typeof Header === "string" ? Header : (_b = (_a = columns.find((col) => col.id === primaryKey)) == null ? void 0 : _a.header) == null ? void 0 : _b.toString() })
4581
+ }
4582
+ ),
4583
+ enableColumnSelector && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ColumnSelector, {})
4584
+ ]
4538
4585
  }
4539
- )
4540
- ] })
4541
- }
4542
- );
4543
- };
4544
- ModalButtons.displayName = "ModalButtons";
4586
+ ) })
4587
+ }
4588
+ );
4589
+ }
4545
4590
 
4546
- // src/components/ModalScrim.tsx
4547
- var import_clsx30 = __toESM(require("clsx"), 1);
4548
- var import_jsx_runtime41 = require("react/jsx-runtime");
4591
+ // src/components/MobileDataGrid/GridContextProvider/index.tsx
4592
+ var import_react30 = require("react");
4593
+
4594
+ // src/components/MobileDataGrid/dataGridReducer.ts
4595
+ function dataGridReducer(state, action) {
4596
+ var _a, _b, _c;
4597
+ const { type, payload } = action;
4598
+ let itemIndex = null;
4599
+ if (action.type === "INSERT" && action.pos === "INDEX")
4600
+ itemIndex = action.index;
4601
+ if (action.type === "UPDATE")
4602
+ itemIndex = (_a = action.index) != null ? _a : state.filter(({ id }) => !!id).findIndex(({ id }) => id === action.id);
4603
+ switch (type) {
4604
+ case "SET":
4605
+ return [...payload];
4606
+ case "UPDATE":
4607
+ if (typeof itemIndex !== "number" || itemIndex < 0)
4608
+ throw new Error("action.(id | index) must be provided.");
4609
+ return [
4610
+ ...state.slice(0, itemIndex),
4611
+ __spreadProps(__spreadValues(__spreadValues({}, state[itemIndex]), payload), {
4612
+ meta: __spreadValues(__spreadValues({}, (_b = state[itemIndex].meta) != null ? _b : {}), (_c = payload.meta) != null ? _c : {})
4613
+ }),
4614
+ ...state.slice(itemIndex + 1)
4615
+ ];
4616
+ default:
4617
+ throw new Error("Action type not implemented.");
4618
+ }
4619
+ }
4620
+
4621
+ // src/components/MobileDataGrid/GridContextProvider/index.tsx
4622
+ var import_jsx_runtime40 = require("react/jsx-runtime");
4623
+ function GridContextProvider(props) {
4624
+ const {
4625
+ initialColumns,
4626
+ id,
4627
+ testid,
4628
+ children,
4629
+ data,
4630
+ numberOfColumnsToShow,
4631
+ primaryKey,
4632
+ getId,
4633
+ onRowSelect
4634
+ } = props;
4635
+ const [columns, dispatch] = (0, import_react30.useReducer)(dataGridReducer, initialColumns);
4636
+ const [selectedRowIds, setSelectedRowIds] = (0, import_react30.useState)([]);
4637
+ const [currentRow, setCurrentRow] = (0, import_react30.useState)(null);
4638
+ const resetColumnVisibility = (0, import_react30.useCallback)(() => {
4639
+ const newColumns = columns.map((column) => {
4640
+ var _a;
4641
+ const initialColumn = initialColumns.find((c) => c.id === column.id);
4642
+ return __spreadProps(__spreadValues({}, column), {
4643
+ meta: __spreadProps(__spreadValues({}, column.meta), {
4644
+ visible: (_a = initialColumn == null ? void 0 : initialColumn.meta) == null ? void 0 : _a.visible
4645
+ })
4646
+ });
4647
+ });
4648
+ dispatch({ type: "SET", payload: newColumns });
4649
+ }, [columns, initialColumns]);
4650
+ const handleRowSelect = (0, import_react30.useCallback)(
4651
+ (item) => {
4652
+ var _a;
4653
+ const rowId = (_a = getId(item)) != null ? _a : "";
4654
+ if (!rowId) return;
4655
+ const nextSelected = selectedRowIds.includes(rowId) ? selectedRowIds.filter((id2) => id2 !== rowId) : [...selectedRowIds, rowId];
4656
+ setSelectedRowIds(nextSelected);
4657
+ if (onRowSelect) onRowSelect(item, nextSelected);
4658
+ },
4659
+ [getId, onRowSelect, selectedRowIds]
4660
+ );
4661
+ const handleRowSelectAll = (0, import_react30.useCallback)(() => {
4662
+ setSelectedRowIds((prev) => {
4663
+ if (prev.length === data.length) {
4664
+ return [];
4665
+ }
4666
+ return data.map(getId).filter((id2) => id2 !== void 0);
4667
+ });
4668
+ }, [data, getId]);
4669
+ const openRowDetail = (0, import_react30.useCallback)((row) => {
4670
+ setCurrentRow(row);
4671
+ }, []);
4672
+ const closeRowDetail = (0, import_react30.useCallback)(() => {
4673
+ setCurrentRow(null);
4674
+ }, []);
4675
+ const visibleColumns = (0, import_react30.useMemo)(() => {
4676
+ const effectiveLimit = typeof numberOfColumnsToShow === "number" ? Math.max(numberOfColumnsToShow - 1, 0) : void 0;
4677
+ if (primaryKey) {
4678
+ const pkColumn = columns.find((col) => col.id === String(primaryKey));
4679
+ const otherColumns = columns.filter(
4680
+ (col) => col.id !== String(primaryKey)
4681
+ );
4682
+ const orderedColumns = pkColumn ? [pkColumn, ...otherColumns] : [...otherColumns];
4683
+ return orderedColumns.filter((x) => {
4684
+ var _a;
4685
+ return ((_a = x.meta) == null ? void 0 : _a.visible) !== false;
4686
+ }).slice(0, effectiveLimit);
4687
+ }
4688
+ return columns.filter((x) => {
4689
+ var _a;
4690
+ return ((_a = x.meta) == null ? void 0 : _a.visible) !== false;
4691
+ }).slice(0, effectiveLimit);
4692
+ }, [columns, numberOfColumnsToShow, primaryKey]);
4693
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
4694
+ GridContext.Provider,
4695
+ {
4696
+ value: {
4697
+ columns,
4698
+ testid,
4699
+ id,
4700
+ data,
4701
+ selectedRowIds,
4702
+ visibleColumns,
4703
+ numberOfColumnsToShow,
4704
+ primaryKey,
4705
+ dispatch,
4706
+ getId,
4707
+ resetColumnVisibility,
4708
+ handleRowSelect,
4709
+ handleRowSelectAll,
4710
+ isRowDetailOpen: !!currentRow,
4711
+ currentRow,
4712
+ openRowDetail,
4713
+ closeRowDetail
4714
+ },
4715
+ children
4716
+ }
4717
+ );
4718
+ }
4719
+
4720
+ // src/components/Modal.tsx
4721
+ var import_clsx31 = __toESM(require("clsx"), 1);
4722
+ var import_react32 = require("react");
4723
+
4724
+ // src/components/ModalHeader.tsx
4725
+ var import_clsx27 = __toESM(require("clsx"), 1);
4726
+ var import_jsx_runtime41 = require("react/jsx-runtime");
4727
+ var ModalHeader = ({
4728
+ title,
4729
+ hideCloseIcon,
4730
+ headerIcon,
4731
+ headerIconAlign,
4732
+ onClose,
4733
+ id,
4734
+ testid,
4735
+ headerClassname
4736
+ }) => {
4737
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
4738
+ "div",
4739
+ {
4740
+ id,
4741
+ "data-testid": testid,
4742
+ className: (0, import_clsx27.default)(
4743
+ "flex justify-between items-center",
4744
+ headerIconAlign === "center" && "justify-center",
4745
+ headerIconAlign === "right" && "justify-end",
4746
+ headerIconAlign === "left" && "justify-start",
4747
+ layoutPaddding,
4748
+ layoutGroupGap,
4749
+ headerClassname
4750
+ ),
4751
+ children: [
4752
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: (0, import_clsx27.default)("flex items-center flex-1", layoutGroupGap), children: [
4753
+ headerIcon,
4754
+ title && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
4755
+ Heading2,
4756
+ {
4757
+ id: id ? `${id}-title` : void 0,
4758
+ testid: testid ? `${testid}-title` : void 0,
4759
+ as: "p",
4760
+ children: title
4761
+ }
4762
+ )
4763
+ ] }),
4764
+ !hideCloseIcon && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
4765
+ Button,
4766
+ {
4767
+ id: id ? `${id}-close-button` : void 0,
4768
+ testid: testid ? `${testid}-close-button` : void 0,
4769
+ iconOnly: true,
4770
+ variant: "tertiary",
4771
+ onClick: onClose,
4772
+ leftIcon: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "text-brand-text-action-primary-normal desktop:text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Icon, { name: "close", size: 24 }) })
4773
+ }
4774
+ )
4775
+ ]
4776
+ }
4777
+ );
4778
+ };
4779
+ ModalHeader.displayName = "ModalHeader";
4780
+
4781
+ // src/components/ModalContent.tsx
4782
+ var import_clsx28 = __toESM(require("clsx"), 1);
4783
+ var import_jsx_runtime42 = require("react/jsx-runtime");
4784
+ function ModalContent({
4785
+ fixedHeightScrolling,
4786
+ children,
4787
+ id,
4788
+ testid
4789
+ }) {
4790
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4791
+ "div",
4792
+ {
4793
+ id,
4794
+ "data-testid": testid,
4795
+ className: (0, import_clsx28.default)(
4796
+ "flex-grow desktop:flex-grow-0",
4797
+ layoutPaddding,
4798
+ fixedHeightScrolling && "overflow-auto"
4799
+ ),
4800
+ children
4801
+ }
4802
+ );
4803
+ }
4804
+ ModalContent.displayName = "ModalContent";
4805
+
4806
+ // src/components/ModalButtons.tsx
4807
+ var import_clsx29 = __toESM(require("clsx"), 1);
4808
+ var import_jsx_runtime43 = require("react/jsx-runtime");
4809
+ var ModalButtons = ({
4810
+ onClose,
4811
+ onContinue,
4812
+ customActions,
4813
+ id,
4814
+ testid
4815
+ }) => {
4816
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
4817
+ "div",
4818
+ {
4819
+ id,
4820
+ "data-testid": testid,
4821
+ className: (0, import_clsx29.default)(
4822
+ "border-t border-neutral-300 flex justify-end",
4823
+ layoutPaddding,
4824
+ layoutGroupGap
4825
+ ),
4826
+ children: customActions != null ? customActions : /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
4827
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
4828
+ Button,
4829
+ {
4830
+ id: id ? `${id}-close-button` : void 0,
4831
+ testid: testid ? `${testid}-close-button` : void 0,
4832
+ variant: "secondary",
4833
+ leftIcon: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Icon, { name: "close", size: 24 }),
4834
+ onClick: onClose,
4835
+ className: "max-sm:w-full",
4836
+ children: "Close"
4837
+ }
4838
+ ),
4839
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
4840
+ Button,
4841
+ {
4842
+ id: id ? `${id}-continue-button` : void 0,
4843
+ testid: testid ? `${testid}-continue-button` : void 0,
4844
+ variant: "primary",
4845
+ leftIcon: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Icon, { name: "check", size: 24 }),
4846
+ className: "max-sm:w-full",
4847
+ onClick: onContinue,
4848
+ children: "Continue"
4849
+ }
4850
+ )
4851
+ ] })
4852
+ }
4853
+ );
4854
+ };
4855
+ ModalButtons.displayName = "ModalButtons";
4856
+
4857
+ // src/components/ModalScrim.tsx
4858
+ var import_clsx30 = __toESM(require("clsx"), 1);
4859
+ var import_jsx_runtime44 = require("react/jsx-runtime");
4549
4860
  var ModalScrim = ({
4550
4861
  show = false,
4551
4862
  size = "small",
@@ -4555,7 +4866,7 @@ var ModalScrim = ({
4555
4866
  id,
4556
4867
  testid
4557
4868
  }) => {
4558
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
4869
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
4559
4870
  "div",
4560
4871
  {
4561
4872
  id,
@@ -4580,10 +4891,10 @@ var import_react_dom3 = require("react-dom");
4580
4891
  var import_react_use = require("react-use");
4581
4892
 
4582
4893
  // src/components/useMounted.tsx
4583
- var import_react27 = require("react");
4894
+ var import_react31 = require("react");
4584
4895
  var useMounted = () => {
4585
- const [isMounted, setIsMounted] = (0, import_react27.useState)(false);
4586
- (0, import_react27.useEffect)(() => {
4896
+ const [isMounted, setIsMounted] = (0, import_react31.useState)(false);
4897
+ (0, import_react31.useEffect)(() => {
4587
4898
  setIsMounted(true);
4588
4899
  return () => setIsMounted(false);
4589
4900
  }, []);
@@ -4591,7 +4902,7 @@ var useMounted = () => {
4591
4902
  };
4592
4903
 
4593
4904
  // src/components/Modal.tsx
4594
- var import_jsx_runtime42 = require("react/jsx-runtime");
4905
+ var import_jsx_runtime45 = require("react/jsx-runtime");
4595
4906
  var fadeInScale = (element, duration = 300) => element.animate(
4596
4907
  [
4597
4908
  { opacity: 0, transform: "scale(0.95)" },
@@ -4675,12 +4986,12 @@ var Modal = ({
4675
4986
  }) => {
4676
4987
  var _a;
4677
4988
  const mounted = useMounted();
4678
- const modalRef = (0, import_react28.useRef)(null);
4679
- const bgRef = (0, import_react28.useRef)(null);
4989
+ const modalRef = (0, import_react32.useRef)(null);
4990
+ const bgRef = (0, import_react32.useRef)(null);
4680
4991
  const wasOpen = (0, import_react_use.usePrevious)(open);
4681
4992
  const isMobile = useMatchesMobile();
4682
4993
  const computedFixedHeightScrolling = isMobile || fixedHeightScrolling;
4683
- (0, import_react28.useEffect)(() => {
4994
+ (0, import_react32.useEffect)(() => {
4684
4995
  if (!mounted) return;
4685
4996
  if (!modalRef.current || !bgRef.current) {
4686
4997
  console.error("Modal or background reference is not set.");
@@ -4700,7 +5011,7 @@ var Modal = ({
4700
5011
  bgFadeIn(bgRef.current);
4701
5012
  }
4702
5013
  }, [mounted, onClose, open, wasOpen]);
4703
- const handleKeyDown = (0, import_react28.useCallback)(
5014
+ const handleKeyDown = (0, import_react32.useCallback)(
4704
5015
  (e) => {
4705
5016
  if (e.key === "Escape") {
4706
5017
  if (onClose) {
@@ -4711,12 +5022,12 @@ var Modal = ({
4711
5022
  },
4712
5023
  [onClose]
4713
5024
  );
4714
- const handleClose = (0, import_react28.useCallback)(() => {
5025
+ const handleClose = (0, import_react32.useCallback)(() => {
4715
5026
  if (onClose) {
4716
5027
  onClose();
4717
5028
  }
4718
5029
  }, [onClose]);
4719
- (0, import_react28.useEffect)(() => {
5030
+ (0, import_react32.useEffect)(() => {
4720
5031
  if (open) {
4721
5032
  document.addEventListener("keyup", handleKeyDown);
4722
5033
  }
@@ -4724,7 +5035,7 @@ var Modal = ({
4724
5035
  document.removeEventListener("keyup", handleKeyDown);
4725
5036
  };
4726
5037
  }, [open, handleKeyDown]);
4727
- (0, import_react28.useEffect)(() => {
5038
+ (0, import_react32.useEffect)(() => {
4728
5039
  if (!open) return;
4729
5040
  const scrollY = window.scrollY;
4730
5041
  const body = document.body;
@@ -4745,7 +5056,7 @@ var Modal = ({
4745
5056
  };
4746
5057
  }, [open]);
4747
5058
  const { sizeClass } = (_a = sizes[size]) != null ? _a : sizes.small;
4748
- const backgroundClickHandler = (0, import_react28.useCallback)(
5059
+ const backgroundClickHandler = (0, import_react32.useCallback)(
4749
5060
  (e) => {
4750
5061
  const target = e.target;
4751
5062
  const currentTarget = e.currentTarget;
@@ -4763,7 +5074,7 @@ var Modal = ({
4763
5074
  return null;
4764
5075
  }
4765
5076
  return (0, import_react_dom3.createPortal)(
4766
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
5077
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
4767
5078
  ModalScrim,
4768
5079
  {
4769
5080
  id: id ? `${id}-scrim` : void 0,
@@ -4772,7 +5083,7 @@ var Modal = ({
4772
5083
  ref: bgRef,
4773
5084
  show: open,
4774
5085
  onClick: backgroundClickHandler,
4775
- children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
5086
+ children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
4776
5087
  "div",
4777
5088
  {
4778
5089
  id,
@@ -4787,7 +5098,7 @@ var Modal = ({
4787
5098
  ),
4788
5099
  onClick: (e) => e.stopPropagation(),
4789
5100
  children: [
4790
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
5101
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
4791
5102
  ModalHeader,
4792
5103
  {
4793
5104
  id: id ? `${id}-header` : void 0,
@@ -4800,7 +5111,7 @@ var Modal = ({
4800
5111
  headerClassname
4801
5112
  }
4802
5113
  ),
4803
- children && (size !== "screen" || noWrapper) ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
5114
+ children && (size !== "screen" || noWrapper) ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
4804
5115
  ModalContent,
4805
5116
  {
4806
5117
  id: id ? `${id}-content` : void 0,
@@ -4809,7 +5120,7 @@ var Modal = ({
4809
5120
  children
4810
5121
  }
4811
5122
  ) : children,
4812
- showButtons ? customFooter ? customActions : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
5123
+ showButtons ? customFooter ? customActions : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
4813
5124
  ModalButtons,
4814
5125
  {
4815
5126
  id: id ? `${id}-buttons` : void 0,
@@ -4829,349 +5140,13 @@ var Modal = ({
4829
5140
  };
4830
5141
  Modal.displayName = "Modal";
4831
5142
 
4832
- // src/components/PDFViewer/PDFElement.tsx
4833
- var import_react_pdf2 = require("@mikecousins/react-pdf");
4834
- var import_react30 = require("react");
4835
-
4836
- // src/components/PDFViewer/PDFPage.tsx
4837
- var import_react_pdf = require("@mikecousins/react-pdf");
4838
- var import_react29 = require("react");
4839
- var import_jsx_runtime43 = require("react/jsx-runtime");
4840
-
4841
- // src/components/PDFViewer/PDFElement.tsx
4842
- var import_clsx32 = __toESM(require("clsx"), 1);
4843
- var import_jsx_runtime44 = require("react/jsx-runtime");
4844
-
4845
- // src/components/PDFViewer/DownloadIcon.tsx
4846
- var import_jsx_runtime45 = require("react/jsx-runtime");
4847
-
4848
- // src/components/PDFViewer/PDFNavigation.tsx
4849
- var import_jsx_runtime46 = require("react/jsx-runtime");
4850
-
4851
- // src/components/PDFViewer/index.tsx
4852
- var import_jsx_runtime47 = require("react/jsx-runtime");
4853
-
4854
- // src/components/MobileDataGrid/GridContextProvider/useGridContext.ts
4855
- var import_react33 = require("react");
4856
-
4857
- // src/components/MobileDataGrid/GridContextProvider/GridContext.tsx
4858
- var import_react32 = require("react");
4859
- var GridContext = (0, import_react32.createContext)(null);
4860
-
4861
- // src/components/MobileDataGrid/GridContextProvider/useGridContext.ts
4862
- function useGridContext() {
4863
- const ctx = (0, import_react33.useContext)(GridContext);
4864
- if (!ctx) {
4865
- throw new Error("useGridContext must be used within GridContextProvider");
4866
- }
4867
- return ctx;
4868
- }
4869
-
4870
- // src/components/MobileDataGrid/ColumnSelector/index.tsx
4871
- var import_jsx_runtime48 = require("react/jsx-runtime");
4872
- function ColumnSelector() {
4873
- const context = useGridContext();
4874
- const ref = (0, import_react34.useRef)(null);
4875
- const [show, setShow] = (0, import_react34.useState)(false);
4876
- const {
4877
- columns,
4878
- id,
4879
- testid,
4880
- visibleColumns,
4881
- numberOfColumnsToShow,
4882
- primaryKey,
4883
- resetColumnVisibility,
4884
- dispatch
4885
- } = context;
4886
- const toggleColumnVisibility = (0, import_react34.useCallback)(
4887
- (index, visible) => {
4888
- dispatch({ type: "UPDATE", index, payload: { meta: { visible } } });
4889
- },
4890
- [dispatch]
4891
- );
4892
- return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
4893
- "div",
4894
- {
4895
- id: id ? `${id}-column-selector` : void 0,
4896
- "data-testid": testid,
4897
- className: "text-text-secondary-normal border-l border-brand-200 p-mobile-container-padding",
4898
- ref,
4899
- children: [
4900
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
4901
- Button,
4902
- {
4903
- id: id ? `${id}-button` : void 0,
4904
- testid: testid ? `${testid}-button` : void 0,
4905
- onClick: () => setShow((prev) => !prev),
4906
- variant: "navigation",
4907
- iconOnly: true,
4908
- size: 24,
4909
- leftIcon: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Icon, { name: "tune" })
4910
- }
4911
- ),
4912
- /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
4913
- Menu,
4914
- {
4915
- id: id ? `${id}-menu` : void 0,
4916
- testid: testid ? `${testid}-menu` : void 0,
4917
- positionTo: ref,
4918
- position: "bottom-right",
4919
- show,
4920
- setShow,
4921
- calculateMinMaxHeight: true,
4922
- children: [
4923
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
4924
- Button,
4925
- {
4926
- id: id ? `${id}-reset-button` : void 0,
4927
- testid: testid ? `${testid}-reset-button` : void 0,
4928
- variant: "tertiary",
4929
- onClick: () => {
4930
- resetColumnVisibility();
4931
- setShow(false);
4932
- },
4933
- children: "Reset to default"
4934
- }
4935
- ),
4936
- columns.filter((x) => {
4937
- var _a;
4938
- return (_a = x.meta) == null ? void 0 : _a.inVisibilityMenu;
4939
- }).map((column) => {
4940
- var _a, _b, _c;
4941
- return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
4942
- MenuOption,
4943
- {
4944
- testid: testid ? `${testid}-option-${column.id}` : void 0,
4945
- children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
4946
- Checkbox,
4947
- {
4948
- id: id ? `${id}-checkbox-${column.id}` : void 0,
4949
- testid: testid ? `${testid}-checkbox-${column.id}` : void 0,
4950
- label: (_a = column.header) == null ? void 0 : _a.toString(),
4951
- checked: !!((_b = column.meta) == null ? void 0 : _b.visible) || column.id === String(primaryKey),
4952
- disabled: typeof numberOfColumnsToShow !== "undefined" && // account for header+link occupying one slot
4953
- visibleColumns.length >= numberOfColumnsToShow - 1 && ((_c = column.meta) == null ? void 0 : _c.visible) !== true || column.id === String(primaryKey),
4954
- onChange: (e) => {
4955
- toggleColumnVisibility(
4956
- columns.findIndex(({ id: id2 }) => id2 === column.id),
4957
- e.target.checked
4958
- );
4959
- }
4960
- }
4961
- )
4962
- },
4963
- id ? `${id}-option-${column.id}` : void 0
4964
- );
4965
- })
4966
- ]
4967
- }
4968
- )
4969
- ]
4970
- }
4971
- );
4972
- }
4973
-
4974
- // src/components/MobileDataGrid/MobileDataGridHeader.tsx
4975
- var import_jsx_runtime49 = require("react/jsx-runtime");
4976
- function MobileDataGridHeader({
4977
- header: Header,
4978
- enableColumnSelector,
4979
- enableRowSelection
4980
- }) {
4981
- var _a, _b;
4982
- const ctx = useGridContext();
4983
- const {
4984
- id,
4985
- testid,
4986
- selectedRowIds,
4987
- data,
4988
- primaryKey,
4989
- columns,
4990
- handleRowSelectAll
4991
- } = ctx;
4992
- if (typeof Header === "undefined" && !primaryKey) return null;
4993
- if (typeof Header === "function") return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Header, __spreadValues({}, ctx));
4994
- if (typeof Header === "string" || primaryKey)
4995
- return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
4996
- "div",
4997
- {
4998
- id: id ? `${id}-header` : void 0,
4999
- "data-testid": testid ? `${testid}-header` : void 0,
5000
- className: "sticky top-0",
5001
- children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Theme, { theme: "brand", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
5002
- Stack,
5003
- {
5004
- horizontal: true,
5005
- horizontalMobile: true,
5006
- items: "center",
5007
- justify: "between",
5008
- backgroundColor: "background-primary-normal",
5009
- children: [
5010
- enableRowSelection && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "p-mobile-component-padding border-r border-brand-200 max-w-fit h-full", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
5011
- Checkbox,
5012
- {
5013
- id: id ? `${id}-select-all-checkbox` : void 0,
5014
- testid: testid ? `${testid}-select-all-checkbox` : void 0,
5015
- checked: selectedRowIds.length === data.length,
5016
- indeterminate: !!selectedRowIds.length && selectedRowIds.length !== data.length,
5017
- onChange: handleRowSelectAll
5018
- }
5019
- ) }),
5020
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
5021
- Stack,
5022
- {
5023
- horizontal: true,
5024
- horizontalMobile: true,
5025
- items: "center",
5026
- sizing: "component",
5027
- padding: true,
5028
- children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Heading3, { as: "span", color: "text-primary-normal", children: typeof Header === "string" ? Header : (_b = (_a = columns.find((col) => col.id === primaryKey)) == null ? void 0 : _a.header) == null ? void 0 : _b.toString() })
5029
- }
5030
- ),
5031
- enableColumnSelector && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ColumnSelector, {})
5032
- ]
5033
- }
5034
- ) })
5035
- }
5036
- );
5037
- }
5038
-
5039
- // src/components/MobileDataGrid/GridContextProvider/index.tsx
5040
- var import_react35 = require("react");
5041
-
5042
- // src/components/MobileDataGrid/dataGridReducer.ts
5043
- function dataGridReducer(state, action) {
5044
- var _a, _b, _c;
5045
- const { type, payload } = action;
5046
- let itemIndex = null;
5047
- if (action.type === "INSERT" && action.pos === "INDEX")
5048
- itemIndex = action.index;
5049
- if (action.type === "UPDATE")
5050
- itemIndex = (_a = action.index) != null ? _a : state.filter(({ id }) => !!id).findIndex(({ id }) => id === action.id);
5051
- switch (type) {
5052
- case "SET":
5053
- return [...payload];
5054
- case "UPDATE":
5055
- if (typeof itemIndex !== "number" || itemIndex < 0)
5056
- throw new Error("action.(id | index) must be provided.");
5057
- return [
5058
- ...state.slice(0, itemIndex),
5059
- __spreadProps(__spreadValues(__spreadValues({}, state[itemIndex]), payload), {
5060
- meta: __spreadValues(__spreadValues({}, (_b = state[itemIndex].meta) != null ? _b : {}), (_c = payload.meta) != null ? _c : {})
5061
- }),
5062
- ...state.slice(itemIndex + 1)
5063
- ];
5064
- default:
5065
- throw new Error("Action type not implemented.");
5066
- }
5067
- }
5068
-
5069
- // src/components/MobileDataGrid/GridContextProvider/index.tsx
5070
- var import_jsx_runtime50 = require("react/jsx-runtime");
5071
- function GridContextProvider(props) {
5072
- const {
5073
- initialColumns,
5074
- id,
5075
- testid,
5076
- children,
5077
- data,
5078
- numberOfColumnsToShow,
5079
- primaryKey,
5080
- getId,
5081
- onRowSelect
5082
- } = props;
5083
- const [columns, dispatch] = (0, import_react35.useReducer)(dataGridReducer, initialColumns);
5084
- const [selectedRowIds, setSelectedRowIds] = (0, import_react35.useState)([]);
5085
- const [currentRow, setCurrentRow] = (0, import_react35.useState)(null);
5086
- const resetColumnVisibility = (0, import_react35.useCallback)(() => {
5087
- const newColumns = columns.map((column) => {
5088
- var _a;
5089
- const initialColumn = initialColumns.find((c) => c.id === column.id);
5090
- return __spreadProps(__spreadValues({}, column), {
5091
- meta: __spreadProps(__spreadValues({}, column.meta), {
5092
- visible: (_a = initialColumn == null ? void 0 : initialColumn.meta) == null ? void 0 : _a.visible
5093
- })
5094
- });
5095
- });
5096
- dispatch({ type: "SET", payload: newColumns });
5097
- }, [columns, initialColumns]);
5098
- const handleRowSelect = (0, import_react35.useCallback)(
5099
- (item) => {
5100
- var _a;
5101
- const rowId = (_a = getId(item)) != null ? _a : "";
5102
- if (!rowId) return;
5103
- const nextSelected = selectedRowIds.includes(rowId) ? selectedRowIds.filter((id2) => id2 !== rowId) : [...selectedRowIds, rowId];
5104
- setSelectedRowIds(nextSelected);
5105
- if (onRowSelect) onRowSelect(item, nextSelected);
5106
- },
5107
- [getId, onRowSelect, selectedRowIds]
5108
- );
5109
- const handleRowSelectAll = (0, import_react35.useCallback)(() => {
5110
- setSelectedRowIds((prev) => {
5111
- if (prev.length === data.length) {
5112
- return [];
5113
- }
5114
- return data.map(getId).filter((id2) => id2 !== void 0);
5115
- });
5116
- }, [data, getId]);
5117
- const openRowDetail = (0, import_react35.useCallback)((row) => {
5118
- setCurrentRow(row);
5119
- }, []);
5120
- const closeRowDetail = (0, import_react35.useCallback)(() => {
5121
- setCurrentRow(null);
5122
- }, []);
5123
- const visibleColumns = (0, import_react35.useMemo)(() => {
5124
- const effectiveLimit = typeof numberOfColumnsToShow === "number" ? Math.max(numberOfColumnsToShow - 1, 0) : void 0;
5125
- if (primaryKey) {
5126
- const pkColumn = columns.find((col) => col.id === String(primaryKey));
5127
- const otherColumns = columns.filter(
5128
- (col) => col.id !== String(primaryKey)
5129
- );
5130
- const orderedColumns = pkColumn ? [pkColumn, ...otherColumns] : [...otherColumns];
5131
- return orderedColumns.filter((x) => {
5132
- var _a;
5133
- return ((_a = x.meta) == null ? void 0 : _a.visible) !== false;
5134
- }).slice(0, effectiveLimit);
5135
- }
5136
- return columns.filter((x) => {
5137
- var _a;
5138
- return ((_a = x.meta) == null ? void 0 : _a.visible) !== false;
5139
- }).slice(0, effectiveLimit);
5140
- }, [columns, numberOfColumnsToShow, primaryKey]);
5141
- return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
5142
- GridContext.Provider,
5143
- {
5144
- value: {
5145
- columns,
5146
- testid,
5147
- id,
5148
- data,
5149
- selectedRowIds,
5150
- visibleColumns,
5151
- numberOfColumnsToShow,
5152
- primaryKey,
5153
- dispatch,
5154
- getId,
5155
- resetColumnVisibility,
5156
- handleRowSelect,
5157
- handleRowSelectAll,
5158
- isRowDetailOpen: !!currentRow,
5159
- currentRow,
5160
- openRowDetail,
5161
- closeRowDetail
5162
- },
5163
- children
5164
- }
5165
- );
5166
- }
5167
-
5168
5143
  // src/components/MobileDataGrid/MobileDataGridCard/MobileDataGridColumn.tsx
5169
- var import_jsx_runtime51 = require("react/jsx-runtime");
5144
+ var import_jsx_runtime46 = require("react/jsx-runtime");
5170
5145
  function MobileDataGridColumn(props) {
5171
5146
  var _a;
5172
5147
  const { column, data } = props;
5173
- return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "mb-2 grid grid-cols-2 gap-2 px-3 flex-1", children: [
5174
- /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(Paragraph, { color: "text-secondary-normal", className: "text-left", children: [
5148
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "mb-2 grid grid-cols-2 gap-2 px-3 flex-1", children: [
5149
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(Paragraph, { color: "text-secondary-normal", className: "text-left", children: [
5175
5150
  (_a = column.header) == null ? void 0 : _a.toString(),
5176
5151
  ":"
5177
5152
  ] }),
@@ -5181,28 +5156,28 @@ function MobileDataGridColumn(props) {
5181
5156
  }
5182
5157
 
5183
5158
  // src/components/MobileDataGrid/RowDetailModalProvider/ModalContent.tsx
5184
- var import_jsx_runtime52 = require("react/jsx-runtime");
5159
+ var import_jsx_runtime47 = require("react/jsx-runtime");
5185
5160
  function ModalContent2() {
5186
5161
  const context = useGridContext();
5187
5162
  const { columns, currentRow } = context;
5188
5163
  if (!currentRow) return null;
5189
- return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Stack, { sizing: "layout-group", children: columns.filter((x) => {
5164
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Stack, { sizing: "layout-group", children: columns.filter((x) => {
5190
5165
  var _a;
5191
5166
  return !((_a = x.id) == null ? void 0 : _a.startsWith("__"));
5192
5167
  }).map(
5193
5168
  (column, index) => {
5194
5169
  var _a, _b;
5195
- return ((_a = column.meta) == null ? void 0 : _a.useCustomRenderer) && column.meta.mobileCell && column.id ? /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
5170
+ return ((_a = column.meta) == null ? void 0 : _a.useCustomRenderer) && column.meta.mobileCell && column.id ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
5196
5171
  "div",
5197
5172
  {
5198
5173
  className: "mb-2 grid grid-cols-2 gap-2 px-3 items-center flex-1",
5199
5174
  children: [
5200
- /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(Paragraph, { color: "text-secondary-normal", className: "text-left", children: [
5175
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Paragraph, { color: "text-secondary-normal", className: "text-left", children: [
5201
5176
  (_b = column.header) == null ? void 0 : _b.toString(),
5202
5177
  ":"
5203
5178
  ] }),
5204
5179
  " ",
5205
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
5180
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
5206
5181
  column.meta.mobileCell,
5207
5182
  {
5208
5183
  column,
@@ -5213,7 +5188,7 @@ function ModalContent2() {
5213
5188
  ]
5214
5189
  },
5215
5190
  `${column.id}-${index}`
5216
- ) : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
5191
+ ) : /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
5217
5192
  MobileDataGridColumn,
5218
5193
  {
5219
5194
  column,
@@ -5226,7 +5201,7 @@ function ModalContent2() {
5226
5201
  }
5227
5202
 
5228
5203
  // src/components/MobileDataGrid/RowDetailModalProvider/index.tsx
5229
- var import_jsx_runtime53 = require("react/jsx-runtime");
5204
+ var import_jsx_runtime48 = require("react/jsx-runtime");
5230
5205
  function RowDetailModalProvider() {
5231
5206
  var _a;
5232
5207
  const context = useGridContext();
@@ -5238,7 +5213,7 @@ function RowDetailModalProvider() {
5238
5213
  primaryKey,
5239
5214
  closeRowDetail
5240
5215
  } = context;
5241
- return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
5216
+ return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
5242
5217
  Modal,
5243
5218
  {
5244
5219
  fixedHeightScrolling: true,
@@ -5247,7 +5222,7 @@ function RowDetailModalProvider() {
5247
5222
  hideCloseIcon: true,
5248
5223
  size: "medium",
5249
5224
  className: "!p-0",
5250
- headerIcon: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
5225
+ headerIcon: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
5251
5226
  Stack,
5252
5227
  {
5253
5228
  horizontal: true,
@@ -5256,8 +5231,8 @@ function RowDetailModalProvider() {
5256
5231
  justify: "between",
5257
5232
  width: "full",
5258
5233
  children: [
5259
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Heading2, { children: (_a = currentRow == null ? void 0 : currentRow[primaryKey != null ? primaryKey : "id"]) != null ? _a : "Grid Detail" }),
5260
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
5234
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Heading2, { children: (_a = currentRow == null ? void 0 : currentRow[primaryKey != null ? primaryKey : "id"]) != null ? _a : "Grid Detail" }),
5235
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
5261
5236
  Button,
5262
5237
  {
5263
5238
  id: id ? `${id}-open-in-new-button` : void 0,
@@ -5265,25 +5240,25 @@ function RowDetailModalProvider() {
5265
5240
  iconOnly: true,
5266
5241
  variant: "tertiary",
5267
5242
  onClick: closeRowDetail,
5268
- leftIcon: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Icon, { name: "open_in_new", size: 24 }) })
5243
+ leftIcon: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Icon, { name: "open_in_new", size: 24 }) })
5269
5244
  }
5270
5245
  )
5271
5246
  ]
5272
5247
  }
5273
5248
  ),
5274
- customActions: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Button, { onClick: closeRowDetail, className: "w-full", children: "Close" }),
5249
+ customActions: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Button, { onClick: closeRowDetail, className: "w-full", children: "Close" }),
5275
5250
  showButtons: true,
5276
- children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "bg-white max-h-full flex flex-col flex-grow-1", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ModalContent2, {}) })
5251
+ children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "bg-white max-h-full flex flex-col flex-grow-1", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ModalContent2, {}) })
5277
5252
  }
5278
5253
  );
5279
5254
  }
5280
5255
 
5281
5256
  // src/components/MobileDataGrid/ColumnList.tsx
5282
- var import_clsx34 = __toESM(require("clsx"), 1);
5257
+ var import_clsx33 = __toESM(require("clsx"), 1);
5283
5258
 
5284
5259
  // src/components/MobileDataGrid/MobileDataGridCard/index.tsx
5285
- var import_clsx33 = __toESM(require("clsx"), 1);
5286
- var import_jsx_runtime54 = require("react/jsx-runtime");
5260
+ var import_clsx32 = __toESM(require("clsx"), 1);
5261
+ var import_jsx_runtime49 = require("react/jsx-runtime");
5287
5262
  function MobileDataGridCard({
5288
5263
  renderLink,
5289
5264
  renderChevron = true,
@@ -5295,27 +5270,27 @@ function MobileDataGridCard({
5295
5270
  var _a;
5296
5271
  const context = useGridContext();
5297
5272
  const { id, testid, visibleColumns, getId, handleRowSelect, openRowDetail } = context;
5298
- return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
5273
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
5299
5274
  "li",
5300
5275
  {
5301
5276
  id: id ? `${id}-card-${getId(data)}` : void 0,
5302
5277
  "data-testid": testid ? `${testid}-card-${getId(data)}` : void 0,
5303
- className: (0, import_clsx33.default)(
5278
+ className: (0, import_clsx32.default)(
5304
5279
  "hover:bg-action-100 cursor-pointer list-none",
5305
5280
  selected ? "bg-action-100" : "bg-background-grouped-primary-normal"
5306
5281
  ),
5307
5282
  onClick: () => openRowDetail(data),
5308
5283
  children: [
5309
- /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(Stack, { sizing: "component", children: [
5310
- /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(Stack, { horizontal: true, horizontalMobile: true, items: "center", justify: "between", children: [
5311
- enableRowSelection && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
5284
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(Stack, { sizing: "component", children: [
5285
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(Stack, { horizontal: true, horizontalMobile: true, items: "center", justify: "between", children: [
5286
+ enableRowSelection && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
5312
5287
  Stack,
5313
5288
  {
5314
5289
  sizing: "component",
5315
5290
  padding: true,
5316
5291
  width: "fit",
5317
5292
  onClick: (e) => e.stopPropagation(),
5318
- children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
5293
+ children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
5319
5294
  Checkbox,
5320
5295
  {
5321
5296
  id: id ? `${id}-${getId(data)}-select-checkbox` : void 0,
@@ -5326,16 +5301,16 @@ function MobileDataGridCard({
5326
5301
  )
5327
5302
  }
5328
5303
  ),
5329
- /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
5304
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
5330
5305
  Stack,
5331
5306
  {
5332
5307
  sizing: "component",
5333
5308
  padding: true,
5334
5309
  onClick: (e) => e.stopPropagation(),
5335
- children: renderLink ? renderLink(data) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(Subheader, { children: String((_a = data[context.primaryKey]) != null ? _a : "") })
5310
+ children: renderLink ? renderLink(data) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Subheader, { children: String((_a = data[context.primaryKey]) != null ? _a : "") })
5336
5311
  }
5337
5312
  ),
5338
- /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
5313
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
5339
5314
  Stack,
5340
5315
  {
5341
5316
  horizontal: true,
@@ -5348,18 +5323,18 @@ function MobileDataGridCard({
5348
5323
  }
5349
5324
  )
5350
5325
  ] }),
5351
- /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(Stack, { sizing: "layout-group", children: visibleColumns.filter((x) => {
5326
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Stack, { sizing: "layout-group", children: visibleColumns.filter((x) => {
5352
5327
  var _a2, _b;
5353
5328
  return ((_a2 = x.meta) == null ? void 0 : _a2.visible) !== false && !((_b = x.id) == null ? void 0 : _b.startsWith("__"));
5354
5329
  }).map(
5355
5330
  (column, index) => {
5356
5331
  var _a2, _b;
5357
- return ((_a2 = column.meta) == null ? void 0 : _a2.useCustomRenderer) && column.meta.mobileCell && column.id ? /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
5332
+ return ((_a2 = column.meta) == null ? void 0 : _a2.useCustomRenderer) && column.meta.mobileCell && column.id ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
5358
5333
  "div",
5359
5334
  {
5360
5335
  className: "mb-2 grid grid-cols-2 gap-2 px-3 items-center flex-1",
5361
5336
  children: [
5362
- /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
5337
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
5363
5338
  Paragraph,
5364
5339
  {
5365
5340
  color: "text-secondary-normal",
@@ -5371,7 +5346,7 @@ function MobileDataGridCard({
5371
5346
  }
5372
5347
  ),
5373
5348
  " ",
5374
- /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
5349
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
5375
5350
  column.meta.mobileCell,
5376
5351
  {
5377
5352
  column,
@@ -5382,7 +5357,7 @@ function MobileDataGridCard({
5382
5357
  ]
5383
5358
  },
5384
5359
  `${column.id}-${index}`
5385
- ) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
5360
+ ) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
5386
5361
  MobileDataGridColumn,
5387
5362
  {
5388
5363
  column,
@@ -5393,14 +5368,14 @@ function MobileDataGridCard({
5393
5368
  }
5394
5369
  ) })
5395
5370
  ] }),
5396
- renderChevron && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(Stack, { items: "center", justify: "center", horizontal: true, horizontalMobile: true, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(Icon, { name: "keyboard_arrow_down" }) })
5371
+ renderChevron && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Stack, { items: "center", justify: "center", horizontal: true, horizontalMobile: true, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Icon, { name: "keyboard_arrow_down" }) })
5397
5372
  ]
5398
5373
  }
5399
5374
  );
5400
5375
  }
5401
5376
 
5402
5377
  // src/components/MobileDataGrid/ColumnList.tsx
5403
- var import_jsx_runtime55 = require("react/jsx-runtime");
5378
+ var import_jsx_runtime50 = require("react/jsx-runtime");
5404
5379
  function ColumnList(props) {
5405
5380
  const {
5406
5381
  withBorder,
@@ -5412,19 +5387,19 @@ function ColumnList(props) {
5412
5387
  } = props;
5413
5388
  const ctx = useGridContext();
5414
5389
  const { id, testid, data, getId, selectedRowIds } = ctx;
5415
- return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
5390
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
5416
5391
  "div",
5417
5392
  {
5418
- className: (0, import_clsx34.default)(
5393
+ className: (0, import_clsx33.default)(
5419
5394
  "flex flex-col flex-1 relative overflow-y-auto overflow-x-hidden",
5420
5395
  !!Footer && "mb-20"
5421
5396
  ),
5422
- children: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
5397
+ children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
5423
5398
  "ul",
5424
5399
  {
5425
5400
  id,
5426
5401
  "data-testid": testid,
5427
- className: (0, import_clsx34.default)(
5402
+ className: (0, import_clsx33.default)(
5428
5403
  "rounded absolute top-0 left-0 w-full flex-1",
5429
5404
  "divide-y divide-border-primary-normal",
5430
5405
  withBorder && "border border-border-primary-normal"
@@ -5432,7 +5407,7 @@ function ColumnList(props) {
5432
5407
  children: [
5433
5408
  data.map((item) => {
5434
5409
  const id2 = getId(item);
5435
- return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
5410
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
5436
5411
  MobileDataGridCard,
5437
5412
  {
5438
5413
  data: item,
@@ -5445,7 +5420,7 @@ function ColumnList(props) {
5445
5420
  id2
5446
5421
  );
5447
5422
  }),
5448
- !!Footer && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "fixed left-0 right-0 bottom-0 flex flex-col w-full min-h-20", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Footer, __spreadValues({}, ctx)) })
5423
+ !!Footer && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "fixed left-0 right-0 bottom-0 flex flex-col w-full min-h-20", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Footer, __spreadValues({}, ctx)) })
5449
5424
  ]
5450
5425
  }
5451
5426
  )
@@ -5454,7 +5429,7 @@ function ColumnList(props) {
5454
5429
  }
5455
5430
 
5456
5431
  // src/components/MobileDataGrid/index.tsx
5457
- var import_jsx_runtime56 = require("react/jsx-runtime");
5432
+ var import_jsx_runtime51 = require("react/jsx-runtime");
5458
5433
  function MobileDataGrid(props) {
5459
5434
  const {
5460
5435
  columns,
@@ -5476,7 +5451,7 @@ function MobileDataGrid(props) {
5476
5451
  rowActions,
5477
5452
  rounded
5478
5453
  } = props;
5479
- return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
5454
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
5480
5455
  GridContextProvider,
5481
5456
  {
5482
5457
  initialColumns: columns,
@@ -5488,7 +5463,7 @@ function MobileDataGrid(props) {
5488
5463
  numberOfColumnsToShow,
5489
5464
  primaryKey,
5490
5465
  children: [
5491
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
5466
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
5492
5467
  Stack,
5493
5468
  {
5494
5469
  height: "full",
@@ -5496,7 +5471,7 @@ function MobileDataGrid(props) {
5496
5471
  overflowX: "hidden",
5497
5472
  overflowY: "hidden",
5498
5473
  children: [
5499
- !hideHeader && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
5474
+ !hideHeader && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
5500
5475
  MobileDataGridHeader,
5501
5476
  {
5502
5477
  header,
@@ -5504,7 +5479,7 @@ function MobileDataGrid(props) {
5504
5479
  enableRowSelection
5505
5480
  }
5506
5481
  ),
5507
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
5482
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
5508
5483
  ColumnList,
5509
5484
  {
5510
5485
  withBorder,
@@ -5518,7 +5493,7 @@ function MobileDataGrid(props) {
5518
5493
  ]
5519
5494
  }
5520
5495
  ),
5521
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(RowDetailModalProvider, {})
5496
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(RowDetailModalProvider, {})
5522
5497
  ]
5523
5498
  }
5524
5499
  );