@dmsi/wedgekit-react 0.0.415 → 0.0.418

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 (125) hide show
  1. package/dist/chunk-3HBYDOYE.js +114 -0
  2. package/dist/{chunk-JIMJIJOF.js → chunk-5TGP5EFM.js} +2 -2
  3. package/dist/{chunk-2HMCS25C.js → chunk-6LHBY2IH.js} +1 -1
  4. package/dist/{chunk-6I5LZ2ZC.js → chunk-7AXHAWJX.js} +3 -3
  5. package/dist/{chunk-MQX7GFLX.js → chunk-CANJ2YPW.js} +24 -6
  6. package/dist/{chunk-QQ5G773N.js → chunk-DCLNAUC4.js} +1 -1
  7. package/dist/{chunk-GB4ZTUQV.js → chunk-DTW7JCBR.js} +36 -0
  8. package/dist/chunk-ESCNCQGI.js +9 -0
  9. package/dist/chunk-IFHMGICR.js +66 -0
  10. package/dist/{chunk-ZHZIIVJN.js → chunk-IMOIZFJZ.js} +5 -5
  11. package/dist/chunk-KBJZUVLM.js +65 -0
  12. package/dist/{chunk-AA6GE3TH.js → chunk-LUPHOXAQ.js} +1 -1
  13. package/dist/{chunk-44TDIHUP.js → chunk-P3MIP2FD.js} +1 -1
  14. package/dist/{chunk-7ULLUUVJ.js → chunk-PQWWVBSR.js} +1 -1
  15. package/dist/{chunk-ERW5DEIO.js → chunk-RQLWSLVE.js} +1 -1
  16. package/dist/{chunk-BK7SPR6Y.js → chunk-TQIKP534.js} +4 -4
  17. package/dist/chunk-TYAQWVIM.js +159 -0
  18. package/dist/{chunk-KZZKQLKF.js → chunk-W55J2KJZ.js} +1 -1
  19. package/dist/chunk-Y2GK27RX.js +79 -0
  20. package/dist/components/Accordion.cjs +74 -2
  21. package/dist/components/Accordion.js +3 -3
  22. package/dist/components/CalendarRange.cjs +231 -53
  23. package/dist/components/CalendarRange.css +169 -65
  24. package/dist/components/CalendarRange.js +24 -16
  25. package/dist/components/Card.cjs +38 -2
  26. package/dist/components/Card.js +1 -1
  27. package/dist/components/CompactImagesPreview.cjs +59 -5
  28. package/dist/components/CompactImagesPreview.js +2 -2
  29. package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.cjs +189 -11
  30. package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.css +169 -65
  31. package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.js +24 -16
  32. package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.cjs +198 -20
  33. package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.css +169 -65
  34. package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.js +24 -16
  35. package/dist/components/DataGrid/PinnedColumns.cjs +214 -36
  36. package/dist/components/DataGrid/PinnedColumns.css +169 -65
  37. package/dist/components/DataGrid/PinnedColumns.js +24 -16
  38. package/dist/components/DataGrid/TableBody/LoadingCell.cjs +190 -12
  39. package/dist/components/DataGrid/TableBody/LoadingCell.css +169 -65
  40. package/dist/components/DataGrid/TableBody/LoadingCell.js +24 -16
  41. package/dist/components/DataGrid/TableBody/TableBodyRow.cjs +196 -18
  42. package/dist/components/DataGrid/TableBody/TableBodyRow.css +169 -65
  43. package/dist/components/DataGrid/TableBody/TableBodyRow.js +24 -16
  44. package/dist/components/DataGrid/TableBody/index.cjs +211 -33
  45. package/dist/components/DataGrid/TableBody/index.css +169 -65
  46. package/dist/components/DataGrid/TableBody/index.js +24 -16
  47. package/dist/components/DataGrid/index.cjs +300 -122
  48. package/dist/components/DataGrid/index.css +169 -65
  49. package/dist/components/DataGrid/index.js +24 -16
  50. package/dist/components/DataGrid/utils.cjs +190 -12
  51. package/dist/components/DataGrid/utils.css +169 -65
  52. package/dist/components/DataGrid/utils.js +24 -16
  53. package/dist/components/DateInput.cjs +250 -72
  54. package/dist/components/DateInput.css +169 -65
  55. package/dist/components/DateInput.js +24 -16
  56. package/dist/components/DateRangeInput.cjs +250 -72
  57. package/dist/components/DateRangeInput.css +169 -65
  58. package/dist/components/DateRangeInput.js +24 -16
  59. package/dist/components/Grid.cjs +81 -76
  60. package/dist/components/Grid.js +1 -1
  61. package/dist/components/ListGroup.cjs +553 -0
  62. package/dist/components/ListGroup.js +11 -0
  63. package/dist/components/MobileDataGrid/ColumnList.cjs +36 -0
  64. package/dist/components/MobileDataGrid/ColumnList.js +3 -3
  65. package/dist/components/MobileDataGrid/ColumnSelector/index.cjs +197 -19
  66. package/dist/components/MobileDataGrid/ColumnSelector/index.css +169 -65
  67. package/dist/components/MobileDataGrid/ColumnSelector/index.js +24 -16
  68. package/dist/components/MobileDataGrid/MobileDataGridCard/index.cjs +36 -0
  69. package/dist/components/MobileDataGrid/MobileDataGridCard/index.js +2 -2
  70. package/dist/components/MobileDataGrid/MobileDataGridHeader.cjs +241 -27
  71. package/dist/components/MobileDataGrid/MobileDataGridHeader.css +169 -65
  72. package/dist/components/MobileDataGrid/MobileDataGridHeader.js +24 -16
  73. package/dist/components/MobileDataGrid/RowDetailModalProvider/ModalContent.cjs +36 -0
  74. package/dist/components/MobileDataGrid/RowDetailModalProvider/ModalContent.js +2 -2
  75. package/dist/components/MobileDataGrid/RowDetailModalProvider/index.cjs +36 -0
  76. package/dist/components/MobileDataGrid/RowDetailModalProvider/index.js +5 -5
  77. package/dist/components/MobileDataGrid/index.cjs +743 -529
  78. package/dist/components/MobileDataGrid/index.css +169 -65
  79. package/dist/components/MobileDataGrid/index.js +24 -16
  80. package/dist/components/Modal.js +2 -2
  81. package/dist/components/Notification.cjs +36 -0
  82. package/dist/components/Notification.js +1 -1
  83. package/dist/components/PDFViewer/PDFElement.cjs +36 -0
  84. package/dist/components/PDFViewer/PDFElement.js +2 -2
  85. package/dist/components/PDFViewer/PDFNavigation.cjs +36 -0
  86. package/dist/components/PDFViewer/PDFNavigation.js +2 -2
  87. package/dist/components/PDFViewer/index.cjs +36 -0
  88. package/dist/components/PDFViewer/index.js +8 -111
  89. package/dist/components/Pagination.cjs +427 -0
  90. package/dist/components/Pagination.js +10 -0
  91. package/dist/components/ProductImagePreview/index.cjs +139 -127
  92. package/dist/components/ProductImagePreview/index.js +4 -4
  93. package/dist/components/SideMenuGroup.cjs +36 -0
  94. package/dist/components/SideMenuGroup.js +1 -1
  95. package/dist/components/SideMenuItem.cjs +36 -0
  96. package/dist/components/SideMenuItem.js +1 -1
  97. package/dist/components/SimpleTable.cjs +36 -0
  98. package/dist/components/SimpleTable.js +2 -2
  99. package/dist/components/SkeletonParagraph.js +3 -6
  100. package/dist/components/Stack.cjs +36 -0
  101. package/dist/components/Stack.js +1 -1
  102. package/dist/components/Swatch.cjs +36 -0
  103. package/dist/components/Swatch.js +1 -1
  104. package/dist/components/Time.cjs +36 -0
  105. package/dist/components/Time.js +1 -1
  106. package/dist/components/Tooltip.cjs +1 -1
  107. package/dist/components/Tooltip.js +1 -1
  108. package/dist/components/Upload.cjs +36 -0
  109. package/dist/components/Upload.js +1 -1
  110. package/dist/components/index.cjs +694 -131
  111. package/dist/components/index.css +169 -65
  112. package/dist/components/index.js +37 -17
  113. package/dist/index.css +169 -65
  114. package/package.json +1 -1
  115. package/src/components/Card.tsx +60 -2
  116. package/src/components/CompactImagesPreview.tsx +54 -30
  117. package/src/components/Grid.tsx +59 -91
  118. package/src/components/ListGroup.tsx +82 -0
  119. package/src/components/Pagination.tsx +182 -0
  120. package/src/components/Stack.tsx +76 -0
  121. package/src/components/Tooltip.tsx +4 -3
  122. package/src/components/index.ts +4 -0
  123. package/dist/chunk-ER6RCOH3.js +0 -97
  124. package/dist/chunk-EZCH4PQS.js +0 -29
  125. package/dist/{chunk-D6YCMQPO.js → chunk-SBCFBHNG.js} +3 -3
@@ -72,14 +72,18 @@ __export(components_exports, {
72
72
  Icon: () => Icon,
73
73
  Input: () => Input,
74
74
  Label: () => Label,
75
+ ListGroup: () => ListGroup,
75
76
  Menu: () => Menu,
76
77
  MenuOption: () => MenuOption,
77
78
  MobileDataGrid: () => MobileDataGrid,
79
+ PDFViewer: () => PDFViewer,
80
+ Pagination: () => Pagination,
78
81
  Paragraph: () => Paragraph,
79
82
  ProductImagePreview: () => ProductImagePreview,
80
83
  Search: () => Search,
81
84
  Select: () => Select,
82
85
  SimpleTable: () => SimpleTable,
86
+ SkeletonParagraph: () => SkeletonParagraph,
83
87
  Subheader: () => Subheader,
84
88
  Tooltip: () => Tooltip
85
89
  });
@@ -3993,7 +3997,7 @@ var Tooltip = ({
3993
3997
  id,
3994
3998
  "data-testid": testid,
3995
3999
  ref,
3996
- className: "relative inline-grid grid-cols-[auto_1fr] items-center",
4000
+ className: "relative inline-grid grid-cols-[auto_1fr] items-center cursor-pointer",
3997
4001
  onMouseEnter: handleMouseEnter,
3998
4002
  onMouseLeave: handleMouseLeave,
3999
4003
  children: [
@@ -4045,14 +4049,50 @@ var import_clsx21 = __toESM(require("clsx"), 1);
4045
4049
  var import_clsx19 = __toESM(require("clsx"), 1);
4046
4050
  var import_jsx_runtime22 = require("react/jsx-runtime");
4047
4051
  function Card(props) {
4048
- const _a = props, { children, selected, testid } = _a, rest = __objRest(_a, ["children", "selected", "testid"]);
4052
+ const _a = props, {
4053
+ children,
4054
+ selected,
4055
+ testid,
4056
+ padding,
4057
+ paddingX,
4058
+ paddingY,
4059
+ paddingBottom,
4060
+ paddingTop,
4061
+ paddingLeft,
4062
+ paddingRight
4063
+ } = _a, rest = __objRest(_a, [
4064
+ "children",
4065
+ "selected",
4066
+ "testid",
4067
+ "padding",
4068
+ "paddingX",
4069
+ "paddingY",
4070
+ "paddingBottom",
4071
+ "paddingTop",
4072
+ "paddingLeft",
4073
+ "paddingRight"
4074
+ ]);
4049
4075
  const CardComponent = props.as || "div";
4076
+ const anyPaddingPropSpecified = padding !== void 0 || paddingX !== void 0 || paddingY !== void 0 || paddingBottom !== void 0 || paddingTop !== void 0 || paddingLeft !== void 0 || paddingRight !== void 0;
4077
+ const paddingClasses = (0, import_clsx19.default)(
4078
+ // Backward compatibility: if no new padding props provided keep existing class.
4079
+ !anyPaddingPropSpecified && "p-desktop-layout-padding",
4080
+ // New responsive spacing tokens (mirrors Stack for layout sizing)
4081
+ padding && "p-mobile-layout-padding desktop:p-desktop-layout-padding compact:p-desktop-compact-layout-padding",
4082
+ paddingX && "px-mobile-layout-padding desktop:px-desktop-layout-padding compact:px-desktop-compact-layout-padding",
4083
+ paddingY && "py-mobile-layout-padding desktop:py-desktop-layout-padding compact:py-desktop-compact-layout-padding",
4084
+ paddingBottom && "pb-mobile-layout-padding desktop:pb-desktop-layout-padding compact:pb-desktop-compact-layout-padding",
4085
+ paddingTop && "pt-mobile-layout-padding desktop:pt-desktop-layout-padding compact:pt-desktop-compact-layout-padding",
4086
+ paddingLeft && "pl-mobile-layout-padding desktop:pl-desktop-layout-padding compact:pl-desktop-compact-layout-padding",
4087
+ paddingRight && "pr-mobile-layout-padding desktop:pr-desktop-layout-padding compact:pr-desktop-compact-layout-padding"
4088
+ );
4050
4089
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4051
4090
  CardComponent,
4052
4091
  __spreadProps(__spreadValues({}, rest), {
4053
4092
  "data-testid": testid,
4054
4093
  className: (0, import_clsx19.default)(
4055
- "rounded-sm p-desktop-layout-padding",
4094
+ "rounded-sm",
4095
+ paddingClasses,
4056
4096
  selected ? "border-2 border-border-primary-focus" : "border border-border-primary-normal",
4057
4097
  rest.className
4058
4098
  ),
@@ -4096,6 +4136,10 @@ var Stack = (_a) => {
4096
4136
  padding,
4097
4137
  paddingX,
4098
4138
  paddingY,
4139
+ paddingBottom,
4140
+ paddingTop,
4141
+ paddingLeft,
4142
+ paddingRight,
4099
4143
  margin,
4100
4144
  marginX,
4101
4145
  marginY,
@@ -4111,6 +4155,10 @@ var Stack = (_a) => {
4111
4155
  height,
4112
4156
  maxHeight,
4113
4157
  borderColor,
4158
+ borderTopColor,
4159
+ borderRightColor,
4160
+ borderBottomColor,
4161
+ borderLeftColor,
4114
4162
  backgroundColor,
4115
4163
  sizing = "none",
4116
4164
  overflowY = "inherit",
@@ -4136,6 +4184,10 @@ var Stack = (_a) => {
4136
4184
  "padding",
4137
4185
  "paddingX",
4138
4186
  "paddingY",
4187
+ "paddingBottom",
4188
+ "paddingTop",
4189
+ "paddingLeft",
4190
+ "paddingRight",
4139
4191
  "margin",
4140
4192
  "marginX",
4141
4193
  "marginY",
@@ -4151,6 +4203,10 @@ var Stack = (_a) => {
4151
4203
  "height",
4152
4204
  "maxHeight",
4153
4205
  "borderColor",
4206
+ "borderTopColor",
4207
+ "borderRightColor",
4208
+ "borderBottomColor",
4209
+ "borderLeftColor",
4154
4210
  "backgroundColor",
4155
4211
  "sizing",
4156
4212
  "overflowY",
@@ -4186,6 +4242,10 @@ var Stack = (_a) => {
4186
4242
  width: width !== void 0 && typeof width === "number" ? `${width}px` : void 0,
4187
4243
  minWidth: minWidth !== void 0 ? `${minWidth}px` : void 0,
4188
4244
  border: borderColor ? `1px solid var(--color-${borderColor})` : void 0,
4245
+ borderTop: borderTopColor ? `1px solid var(--color-${borderTopColor})` : void 0,
4246
+ borderRight: borderRightColor ? `1px solid var(--color-${borderRightColor})` : void 0,
4247
+ borderBottom: borderBottomColor ? `1px solid var(--color-${borderBottomColor})` : void 0,
4248
+ borderLeft: borderLeftColor ? `1px solid var(--color-${borderLeftColor})` : void 0,
4189
4249
  backgroundColor: backgroundColor ? `var(--color-${backgroundColor})` : void 0,
4190
4250
  flexGrow: flexGrow !== void 0 ? flexGrow : void 0,
4191
4251
  flexShrink: flexShrink !== void 0 ? flexShrink : void 0,
@@ -4225,6 +4285,22 @@ var Stack = (_a) => {
4225
4285
  paddingY && sizing === "layout" && "py-mobile-layout-padding desktop:py-desktop-layout-padding compact:py-desktop-compact-layout-padding",
4226
4286
  paddingY && sizing === "layout-group" && paddingYUsingLayoutGroupGap,
4227
4287
  paddingY && sizing === "component" && "py-mobile-component-padding desktop:py-desktop-component-padding compact:py-desktop-compact-component-padding",
4288
+ paddingBottom && sizing === "container" && "pb-mobile-container-padding desktop:pb-desktop-container-padding compact:pb-desktop-compact-container-padding",
4289
+ paddingBottom && sizing === "layout" && "pb-mobile-layout-padding desktop:pb-desktop-layout-padding compact:pb-desktop-compact-layout-padding",
4290
+ paddingBottom && sizing === "layout-group" && "pb-mobile-layout-group-padding desktop:pb-desktop-layout-group-padding compact:pb-desktop-compact-layout-group-padding",
4291
+ paddingBottom && sizing === "component" && "pb-mobile-component-padding desktop:pb-desktop-component-padding compact:pb-desktop-compact-component-padding",
4292
+ paddingTop && sizing === "container" && "pt-mobile-container-padding desktop:pt-desktop-container-padding compact:pt-desktop-compact-container-padding",
4293
+ paddingTop && sizing === "layout" && "pt-mobile-layout-padding desktop:pt-desktop-layout-padding compact:pt-desktop-compact-layout-padding",
4294
+ paddingTop && sizing === "layout-group" && "pt-mobile-layout-group-padding desktop:pt-desktop-layout-group-padding compact:pt-desktop-compact-layout-group-padding",
4295
+ paddingTop && sizing === "component" && "pt-mobile-component-padding desktop:pt-desktop-component-padding compact:pt-desktop-compact-component-padding",
4296
+ paddingLeft && sizing === "container" && "pl-mobile-container-padding desktop:pl-desktop-container-padding compact:pl-desktop-compact-container-padding",
4297
+ paddingLeft && sizing === "layout" && "pl-mobile-layout-padding desktop:pl-desktop-layout-padding compact:pl-desktop-compact-layout-padding",
4298
+ paddingLeft && sizing === "layout-group" && "pl-mobile-layout-group-padding desktop:pl-desktop-layout-group-padding compact:pl-desktop-compact-layout-group-padding",
4299
+ paddingLeft && sizing === "component" && "pl-mobile-component-padding desktop:pl-desktop-component-padding compact:pl-desktop-compact-component-padding",
4300
+ paddingRight && sizing === "container" && "pr-mobile-container-padding desktop:pr-desktop-container-padding compact:pr-desktop-compact-container-padding",
4301
+ paddingRight && sizing === "layout" && "pr-mobile-layout-padding desktop:pr-desktop-layout-padding compact:pr-desktop-compact-layout-padding",
4302
+ paddingRight && sizing === "layout-group" && "pr-mobile-layout-group-padding desktop:pr-desktop-layout-group-padding compact:pr-desktop-compact-layout-group-padding",
4303
+ paddingRight && sizing === "component" && "pr-mobile-component-padding desktop:pr-desktop-component-padding compact:pr-desktop-compact-component-padding",
4228
4304
  margin && sizing === "container" && "m-mobile-container-padding desktop:m-desktop-container-padding compact:m-compact-container-padding",
4229
4305
  marginX && sizing === "container" && "mx-mobile-container-padding desktop:mx-desktop-container-padding compact:mx-compact-container-padding",
4230
4306
  marginTop && sizing === "container" && "mt-mobile-container-padding desktop:mt-desktop-container-padding compact:mt-compact-container-padding",
@@ -5582,101 +5658,77 @@ function Thumbnail({
5582
5658
  }
5583
5659
 
5584
5660
  // src/components/Grid.tsx
5585
- var import_react27 = require("react");
5586
5661
  var import_clsx30 = __toESM(require("clsx"), 1);
5587
5662
  var import_jsx_runtime43 = require("react/jsx-runtime");
5588
- var COLUMNS_WITH_SIDE_MENU_MAP = {
5589
- 1: "grid-cols-1",
5590
- 2: "sm:grid-cols-2",
5591
- 3: "sm:grid-cols-2 md:grid-cols-3",
5592
- 4: "sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4",
5593
- 5: "sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4",
5594
- 6: "sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4",
5595
- 7: "sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-6",
5596
- 8: "sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-6",
5597
- 9: "sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-6",
5598
- 10: "sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-6",
5599
- 11: "sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-8",
5600
- 12: "sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-8"
5601
- };
5602
- var COLUMNS_WITHOUT_SIDE_MENU_MAP = {
5603
- 1: "grid-cols-1",
5604
- 2: "sm:grid-cols-2",
5605
- 3: "sm:grid-cols-2 md:grid-cols-3",
5606
- 4: "sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4",
5607
- 5: "sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5",
5608
- 6: "sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-6",
5609
- 7: "sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-6 2xl:grid-cols-7",
5610
- 8: "sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-6 2xl:grid-cols-8",
5611
- 9: "sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-6 2xl:grid-cols-9",
5612
- 10: "sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-8 2xl:grid-cols-10",
5613
- 11: "sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-8 2xl:grid-cols-11",
5614
- 12: "sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-8 2xl:grid-cols-12"
5663
+ var GAP_BY_SIZING = {
5664
+ none: "gap-0",
5665
+ "layout-group": "gap-mobile-layout-group-gap desktop:gap-desktop-layout-group-gap compact:gap-compact-layout-group-gap",
5666
+ layout: "gap-mobile-layout-gap desktop:gap-desktop-layout-gap compact:gap-compact-layout-gap",
5667
+ container: "gap-mobile-container-gap desktop:gap-desktop-container-gap compact:gap-compact-container-gap",
5668
+ component: "gap-mobile-component-gap desktop:gap-desktop-component-gap compact:gap-compact-component-gap"
5615
5669
  };
5616
- var getChildCountBasedClasses = (childCount, hasSideMenu) => {
5617
- if (hasSideMenu) {
5618
- if (childCount <= 1) return "grid-cols-1";
5619
- if (childCount <= 2) return "sm:grid-cols-2";
5620
- if (childCount === 3) return "sm:grid-cols-2 md:grid-cols-3";
5621
- if (childCount <= 5) return "sm:grid-cols-2 md:grid-cols-3";
5622
- return "sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-6";
5623
- }
5624
- if (childCount <= 1) return "grid-cols-1";
5625
- if (childCount <= 2) return "sm:grid-cols-2";
5626
- if (childCount === 3) return "sm:grid-cols-2 md:grid-cols-3";
5627
- if (childCount <= 5) return "sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4";
5628
- if (childCount <= 6)
5629
- return "sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-6";
5630
- if (childCount === 7)
5631
- return "sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-6";
5632
- if (childCount <= 11)
5633
- return "sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-6 2xl:grid-cols-8";
5634
- return "sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-8 2xl:grid-cols-12";
5670
+ var PADDING_BY_SIZING = {
5671
+ none: "p-0",
5672
+ container: "p-mobile-container-padding desktop:p-desktop-container-padding compact:p-desktop-compact-container-padding",
5673
+ layout: "p-mobile-layout-padding desktop:p-desktop-layout-padding compact:p-desktop-compact-layout-padding",
5674
+ "layout-group": "p-mobile-layout-group-padding desktop:p-desktop-layout-group-padding compact:p-desktop-compact-layout-group-padding",
5675
+ component: "p-mobile-component-padding desktop:p-desktop-component-padding compact:p-desktop-compact-component-padding"
5635
5676
  };
5636
- var getGridClasses = (childCount, hasSideMenu, columns) => {
5637
- var _a;
5638
- if (columns) {
5639
- const map = hasSideMenu ? COLUMNS_WITH_SIDE_MENU_MAP : COLUMNS_WITHOUT_SIDE_MENU_MAP;
5640
- return (_a = map[columns]) != null ? _a : map[12];
5677
+ var buildColumnClasses = (base, responsive) => {
5678
+ const classes = [`grid-cols-${base}`];
5679
+ if (responsive) {
5680
+ Object.entries(responsive).forEach(([bp, value]) => {
5681
+ if (value && value > 0) classes.push(`${bp}:grid-cols-${value}`);
5682
+ });
5641
5683
  }
5642
- return getChildCountBasedClasses(childCount, hasSideMenu != null ? hasSideMenu : false);
5684
+ return classes.join(" ");
5643
5685
  };
5644
- var Grid = ({
5645
- children,
5646
- sizing = "container",
5647
- padding,
5648
- hasSideMenu = false,
5649
- columns,
5650
- id,
5651
- testid,
5652
- style
5653
- }) => {
5654
- const childCount = import_react27.Children.count(children);
5686
+ var Grid = (_a) => {
5687
+ var _b = _a, {
5688
+ children,
5689
+ sizing = "container",
5690
+ padding,
5691
+ columns,
5692
+ responsive,
5693
+ id,
5694
+ testid,
5695
+ style,
5696
+ className
5697
+ } = _b, rest = __objRest(_b, [
5698
+ "children",
5699
+ "sizing",
5700
+ "padding",
5701
+ "columns",
5702
+ "responsive",
5703
+ "id",
5704
+ "testid",
5705
+ "style",
5706
+ "className"
5707
+ ]);
5708
+ var _a2, _b2;
5709
+ const columnClasses = buildColumnClasses(columns, responsive);
5655
5710
  return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
5656
5711
  "div",
5657
- {
5712
+ __spreadProps(__spreadValues({
5658
5713
  id,
5659
5714
  "data-testid": testid,
5715
+ style
5716
+ }, rest), {
5660
5717
  className: (0, import_clsx30.default)(
5661
- padding && sizing === "container" && "p-mobile-container-padding desktop:p-desktop-container-padding compact:p-desktop-compact-container-padding",
5662
- padding && sizing === "layout" && "p-mobile-layout-padding desktop:p-desktop-layout-padding compact:p-desktop-compact-layout-padding",
5663
- padding && sizing === "layout-group" && "p-mobile-layout-group-padding desktop:p-desktop-layout-group-padding compact:p-desktop-compact-layout-group-padding",
5664
- padding && sizing === "component" && "p-mobile-component-padding desktop:p-desktop-component-padding compact:p-desktop-compact-component-padding",
5665
- sizing === "layout-group" && "gap-mobile-layout-group-gap desktop:gap-desktop-layout-group-gap compact:gap-compact-layout-group-gap",
5666
- sizing === "layout" && "gap-mobile-layout-gap desktop:gap-desktop-layout-gap compact:gap-compact-layout-gap",
5667
- sizing === "container" && "gap-mobile-container-gap desktop:gap-desktop-container-gap compact:gap-compact-container-gap",
5668
- sizing === "component" && "gap-mobile-component-gap desktop:gap-desktop-component-gap compact:gap-compact-component-gap",
5669
5718
  "w-full grid",
5670
- getGridClasses(childCount, hasSideMenu, columns)
5719
+ (_a2 = GAP_BY_SIZING[sizing]) != null ? _a2 : GAP_BY_SIZING.container,
5720
+ padding && ((_b2 = PADDING_BY_SIZING[sizing]) != null ? _b2 : PADDING_BY_SIZING.container),
5721
+ columnClasses,
5722
+ "grid-cols-1 desktop:grid-cols-4",
5723
+ className
5671
5724
  ),
5672
- style,
5673
5725
  children
5674
- }
5726
+ })
5675
5727
  );
5676
5728
  };
5677
5729
 
5678
5730
  // src/components/ProductImagePreview/ProductPrimaryImage.tsx
5679
- var import_react28 = require("react");
5731
+ var import_react27 = require("react");
5680
5732
 
5681
5733
  // src/components/Spinner.tsx
5682
5734
  var import_jsx_runtime44 = require("react/jsx-runtime");
@@ -5722,14 +5774,14 @@ function ProductPrimaryImage({
5722
5774
  onZoomPositionChange,
5723
5775
  onScrollZoom
5724
5776
  }) {
5725
- const containerRef = (0, import_react28.useRef)(null);
5726
- const lastPointRef = (0, import_react28.useRef)(null);
5727
- const rafRef = (0, import_react28.useRef)(null);
5728
- const [active, setActive] = (0, import_react28.useState)(false);
5729
- const [, forceRerender] = (0, import_react28.useState)(0);
5730
- const [imageLoading, setImageLoading] = (0, import_react28.useState)(true);
5731
- const [imageError, setImageError] = (0, import_react28.useState)(false);
5732
- const imageSrc = (0, import_react28.useMemo)(() => image == null ? void 0 : image.src, [image == null ? void 0 : image.src]);
5777
+ const containerRef = (0, import_react27.useRef)(null);
5778
+ const lastPointRef = (0, import_react27.useRef)(null);
5779
+ const rafRef = (0, import_react27.useRef)(null);
5780
+ const [active, setActive] = (0, import_react27.useState)(false);
5781
+ const [, forceRerender] = (0, import_react27.useState)(0);
5782
+ const [imageLoading, setImageLoading] = (0, import_react27.useState)(true);
5783
+ const [imageError, setImageError] = (0, import_react27.useState)(false);
5784
+ const imageSrc = (0, import_react27.useMemo)(() => image == null ? void 0 : image.src, [image == null ? void 0 : image.src]);
5733
5785
  const schedule = () => {
5734
5786
  if (rafRef.current != null) return;
5735
5787
  rafRef.current = requestAnimationFrame(() => {
@@ -5737,7 +5789,7 @@ function ProductPrimaryImage({
5737
5789
  forceRerender((n) => n + 1);
5738
5790
  });
5739
5791
  };
5740
- const handlePointerEnter = (0, import_react28.useCallback)(() => {
5792
+ const handlePointerEnter = (0, import_react27.useCallback)(() => {
5741
5793
  if (!zoomEnabled) return;
5742
5794
  setActive(true);
5743
5795
  const el = containerRef.current;
@@ -5750,13 +5802,13 @@ function ProductPrimaryImage({
5750
5802
  );
5751
5803
  }
5752
5804
  }, [zoomEnabled, onZoomPositionChange, zoomLensSize]);
5753
- const handlePointerLeave = (0, import_react28.useCallback)(() => {
5805
+ const handlePointerLeave = (0, import_react27.useCallback)(() => {
5754
5806
  if (!zoomEnabled) return;
5755
5807
  setActive(false);
5756
5808
  lastPointRef.current = null;
5757
5809
  onZoomPositionChange == null ? void 0 : onZoomPositionChange(null, false);
5758
5810
  }, [zoomEnabled, onZoomPositionChange]);
5759
- const handlePointerMove = (0, import_react28.useCallback)(
5811
+ const handlePointerMove = (0, import_react27.useCallback)(
5760
5812
  (e) => {
5761
5813
  if (!zoomEnabled || !active || imageError) return;
5762
5814
  if (e.pointerType === "touch") return;
@@ -5792,7 +5844,7 @@ function ProductPrimaryImage({
5792
5844
  },
5793
5845
  [zoomEnabled, active, imageError, zoomLensSize, onZoomPositionChange]
5794
5846
  );
5795
- (0, import_react28.useEffect)(() => {
5847
+ (0, import_react27.useEffect)(() => {
5796
5848
  const container = containerRef.current;
5797
5849
  if (!container || !scrollToZoomEnabled) return;
5798
5850
  const handleNativeWheel = (e) => {
@@ -5807,7 +5859,7 @@ function ProductPrimaryImage({
5807
5859
  container.removeEventListener("wheel", handleNativeWheel);
5808
5860
  };
5809
5861
  }, [scrollToZoomEnabled, zoomEnabled, active, onScrollZoom]);
5810
- (0, import_react28.useEffect)(() => {
5862
+ (0, import_react27.useEffect)(() => {
5811
5863
  setImageLoading(true);
5812
5864
  setImageError(false);
5813
5865
  }, [image]);
@@ -5876,7 +5928,7 @@ function ProductPrimaryImage({
5876
5928
  }
5877
5929
 
5878
5930
  // src/components/ProductImagePreview/ZoomWindow.tsx
5879
- var import_react29 = require("react");
5931
+ var import_react28 = require("react");
5880
5932
 
5881
5933
  // src/components/Surface.tsx
5882
5934
  var import_clsx31 = __toESM(require("clsx"), 1);
@@ -5927,7 +5979,7 @@ function ZoomWindow({
5927
5979
  offset = 10,
5928
5980
  className = ""
5929
5981
  }) {
5930
- const imageSrc = (0, import_react29.useMemo)(() => image == null ? void 0 : image.src, [image == null ? void 0 : image.src]);
5982
+ const imageSrc = (0, import_react28.useMemo)(() => image == null ? void 0 : image.src, [image == null ? void 0 : image.src]);
5931
5983
  if (!image || !active || !pointer) return null;
5932
5984
  const zoomWindowSize = pointer.lensSize * scaleFactor;
5933
5985
  const baseW = pointer.w || width;
@@ -6056,7 +6108,7 @@ function CarouselPagination({
6056
6108
  }
6057
6109
 
6058
6110
  // src/components/ProductImagePreview/MobileImageCarousel.tsx
6059
- var import_react30 = require("react");
6111
+ var import_react29 = require("react");
6060
6112
  var import_jsx_runtime49 = require("react/jsx-runtime");
6061
6113
  function MobileImageCarousel({
6062
6114
  images,
@@ -6066,15 +6118,15 @@ function MobileImageCarousel({
6066
6118
  onChangeIndex,
6067
6119
  className = ""
6068
6120
  }) {
6069
- const containerRef = (0, import_react30.useRef)(null);
6070
- const [isDragging, setIsDragging] = (0, import_react30.useState)(false);
6071
- const [startX, setStartX] = (0, import_react30.useState)(0);
6072
- const [currentTranslate, setCurrentTranslate] = (0, import_react30.useState)(0);
6073
- const [prevTranslate, setPrevTranslate] = (0, import_react30.useState)(0);
6074
- const [containerWidth, setContainerWidth] = (0, import_react30.useState)(width);
6121
+ const containerRef = (0, import_react29.useRef)(null);
6122
+ const [isDragging, setIsDragging] = (0, import_react29.useState)(false);
6123
+ const [startX, setStartX] = (0, import_react29.useState)(0);
6124
+ const [currentTranslate, setCurrentTranslate] = (0, import_react29.useState)(0);
6125
+ const [prevTranslate, setPrevTranslate] = (0, import_react29.useState)(0);
6126
+ const [containerWidth, setContainerWidth] = (0, import_react29.useState)(width);
6075
6127
  const imageSize = Math.min(containerWidth * 0.6, height * 0.6);
6076
6128
  const gap = 16;
6077
- const getTranslateX = (0, import_react30.useCallback)(
6129
+ const getTranslateX = (0, import_react29.useCallback)(
6078
6130
  (index) => {
6079
6131
  const containerCenter = containerWidth / 2;
6080
6132
  const imageCenter = imageSize / 2;
@@ -6083,12 +6135,12 @@ function MobileImageCarousel({
6083
6135
  },
6084
6136
  [containerWidth, imageSize, gap]
6085
6137
  );
6086
- (0, import_react30.useEffect)(() => {
6138
+ (0, import_react29.useEffect)(() => {
6087
6139
  const translateX = getTranslateX(currentIndex);
6088
6140
  setCurrentTranslate(translateX);
6089
6141
  setPrevTranslate(translateX);
6090
6142
  }, [currentIndex, getTranslateX]);
6091
- (0, import_react30.useEffect)(() => {
6143
+ (0, import_react29.useEffect)(() => {
6092
6144
  const updateContainerWidth = () => {
6093
6145
  if (containerRef.current) {
6094
6146
  const rect = containerRef.current.getBoundingClientRect();
@@ -6102,11 +6154,11 @@ function MobileImageCarousel({
6102
6154
  }
6103
6155
  return () => resizeObserver.disconnect();
6104
6156
  }, []);
6105
- const handleStart = (0, import_react30.useCallback)((clientX) => {
6157
+ const handleStart = (0, import_react29.useCallback)((clientX) => {
6106
6158
  setIsDragging(true);
6107
6159
  setStartX(clientX);
6108
6160
  }, []);
6109
- const handleMove = (0, import_react30.useCallback)(
6161
+ const handleMove = (0, import_react29.useCallback)(
6110
6162
  (clientX) => {
6111
6163
  if (!isDragging) return;
6112
6164
  const currentPosition = clientX;
@@ -6115,7 +6167,7 @@ function MobileImageCarousel({
6115
6167
  },
6116
6168
  [isDragging, startX, prevTranslate]
6117
6169
  );
6118
- const handleEnd = (0, import_react30.useCallback)(() => {
6170
+ const handleEnd = (0, import_react29.useCallback)(() => {
6119
6171
  if (!isDragging) return;
6120
6172
  setIsDragging(false);
6121
6173
  const moved = currentTranslate - prevTranslate;
@@ -6163,7 +6215,7 @@ function MobileImageCarousel({
6163
6215
  const handleTouchEnd = () => {
6164
6216
  handleEnd();
6165
6217
  };
6166
- const handleImageClick = (0, import_react30.useCallback)(
6218
+ const handleImageClick = (0, import_react29.useCallback)(
6167
6219
  (index) => {
6168
6220
  if (!isDragging && index !== currentIndex) {
6169
6221
  onChangeIndex(index);
@@ -6243,7 +6295,7 @@ function MobileImageCarousel({
6243
6295
  }
6244
6296
 
6245
6297
  // src/components/ProductImagePreview/useProductImagePreview.ts
6246
- var import_react31 = require("react");
6298
+ var import_react30 = require("react");
6247
6299
  function useProductImagePreview(props) {
6248
6300
  const {
6249
6301
  images,
@@ -6256,18 +6308,18 @@ function useProductImagePreview(props) {
6256
6308
  } = props;
6257
6309
  const hasImages = !!(images == null ? void 0 : images.length);
6258
6310
  const safeIndex = hasImages && currentIndex >= 0 && currentIndex < images.length ? currentIndex : 0;
6259
- const active = (0, import_react31.useMemo)(() => {
6311
+ const active = (0, import_react30.useMemo)(() => {
6260
6312
  return hasImages ? images[safeIndex] : void 0;
6261
6313
  }, [hasImages, images, safeIndex]);
6262
- const [zoomPoint, setZoomPoint] = (0, import_react31.useState)(null);
6263
- const [zoomActive, setZoomActive] = (0, import_react31.useState)(false);
6264
- const [currentZoomFactor, setCurrentZoomFactor] = (0, import_react31.useState)(zoomFactor);
6265
- const [primaryImagePosition, setPrimaryImagePosition] = (0, import_react31.useState)(null);
6266
- const primaryImageRef = (0, import_react31.useRef)(null);
6267
- const cleanupRef = (0, import_react31.useRef)(null);
6314
+ const [zoomPoint, setZoomPoint] = (0, import_react30.useState)(null);
6315
+ const [zoomActive, setZoomActive] = (0, import_react30.useState)(false);
6316
+ const [currentZoomFactor, setCurrentZoomFactor] = (0, import_react30.useState)(zoomFactor);
6317
+ const [primaryImagePosition, setPrimaryImagePosition] = (0, import_react30.useState)(null);
6318
+ const primaryImageRef = (0, import_react30.useRef)(null);
6319
+ const cleanupRef = (0, import_react30.useRef)(null);
6268
6320
  const effectiveZoomEnabled = zoomEnabled && !isMobile;
6269
6321
  const effectiveScrollToZoomEnabled = scrollToZoomEnabled && !isMobile;
6270
- (0, import_react31.useEffect)(() => {
6322
+ (0, import_react30.useEffect)(() => {
6271
6323
  if (!effectiveZoomEnabled) return;
6272
6324
  const setupTracking = () => {
6273
6325
  const element = primaryImageRef.current;
@@ -6301,24 +6353,24 @@ function useProductImagePreview(props) {
6301
6353
  }
6302
6354
  };
6303
6355
  }, [effectiveZoomEnabled]);
6304
- const handleSelect = (0, import_react31.useCallback)(
6356
+ const handleSelect = (0, import_react30.useCallback)(
6305
6357
  (idx) => {
6306
6358
  if (idx === safeIndex) return;
6307
6359
  onChangeIndex(idx);
6308
6360
  },
6309
6361
  [safeIndex, onChangeIndex]
6310
6362
  );
6311
- const handleNext = (0, import_react31.useCallback)(() => {
6363
+ const handleNext = (0, import_react30.useCallback)(() => {
6312
6364
  if (!hasImages) return;
6313
6365
  const nextIndex = (safeIndex + 1) % images.length;
6314
6366
  onChangeIndex(nextIndex);
6315
6367
  }, [hasImages, safeIndex, images.length, onChangeIndex]);
6316
- const handlePrevious = (0, import_react31.useCallback)(() => {
6368
+ const handlePrevious = (0, import_react30.useCallback)(() => {
6317
6369
  if (!hasImages) return;
6318
6370
  const previousIndex = safeIndex === 0 ? images.length - 1 : safeIndex - 1;
6319
6371
  onChangeIndex(previousIndex);
6320
6372
  }, [hasImages, safeIndex, images.length, onChangeIndex]);
6321
- const handleZoomPositionChange = (0, import_react31.useCallback)(
6373
+ const handleZoomPositionChange = (0, import_react30.useCallback)(
6322
6374
  (p, active2) => {
6323
6375
  if (isMobile) return;
6324
6376
  setZoomPoint(p);
@@ -6326,7 +6378,7 @@ function useProductImagePreview(props) {
6326
6378
  },
6327
6379
  [isMobile]
6328
6380
  );
6329
- const handleScrollZoom = (0, import_react31.useCallback)(
6381
+ const handleScrollZoom = (0, import_react30.useCallback)(
6330
6382
  (delta) => {
6331
6383
  if (!effectiveScrollToZoomEnabled) return;
6332
6384
  const newZoomFactor = Math.max(1, Math.min(5, currentZoomFactor + delta));
@@ -6334,7 +6386,7 @@ function useProductImagePreview(props) {
6334
6386
  },
6335
6387
  [effectiveScrollToZoomEnabled, currentZoomFactor]
6336
6388
  );
6337
- (0, import_react31.useEffect)(() => {
6389
+ (0, import_react30.useEffect)(() => {
6338
6390
  setCurrentZoomFactor(zoomFactor);
6339
6391
  }, [zoomFactor]);
6340
6392
  return {
@@ -6498,7 +6550,7 @@ function ProductImagePreview(props) {
6498
6550
  }
6499
6551
 
6500
6552
  // src/components/CompactImagesPreview.tsx
6501
- var import_react32 = require("react");
6553
+ var import_react31 = require("react");
6502
6554
  var import_clsx33 = __toESM(require("clsx"), 1);
6503
6555
  var import_jsx_runtime51 = require("react/jsx-runtime");
6504
6556
  function CompactImagesPreview(props) {
@@ -6511,11 +6563,23 @@ function CompactImagesPreview(props) {
6511
6563
  thumbnailHeight = 30,
6512
6564
  enableThumbnailBorder = false,
6513
6565
  placeholderImageUri,
6514
- onChangeSource
6566
+ placeholderAlt = "placeholder image",
6567
+ onChangeSource,
6568
+ onMainImageClick
6515
6569
  } = props;
6516
6570
  const isMobile = useMatchesMobile();
6517
6571
  const imagesCount = sources.length;
6518
- const handleThumbnailClick = (0, import_react32.useCallback)(
6572
+ const handleImgError = (0, import_react31.useCallback)(
6573
+ (e) => {
6574
+ if (!placeholderImageUri) return;
6575
+ const img = e.currentTarget;
6576
+ if (img.src === placeholderImageUri) return;
6577
+ img.src = placeholderImageUri;
6578
+ if (!img.alt) img.alt = placeholderAlt;
6579
+ },
6580
+ [placeholderImageUri, placeholderAlt]
6581
+ );
6582
+ const handleThumbnailClick = (0, import_react31.useCallback)(
6519
6583
  (newIndex) => {
6520
6584
  if (newIndex === currentSourceIndex) return;
6521
6585
  if (newIndex < 0 || newIndex >= imagesCount) return;
@@ -6535,7 +6599,9 @@ function CompactImagesPreview(props) {
6535
6599
  objectFit: "cover"
6536
6600
  },
6537
6601
  src: placeholderImageUri,
6538
- alt: "placeholder image"
6602
+ alt: placeholderAlt,
6603
+ onError: handleImgError,
6604
+ onClick: onMainImageClick
6539
6605
  }
6540
6606
  );
6541
6607
  const currentSource = sources[currentSourceIndex];
@@ -6543,6 +6609,7 @@ function CompactImagesPreview(props) {
6543
6609
  /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
6544
6610
  "img",
6545
6611
  {
6612
+ className: (0, import_clsx33.default)("object-center", onMainImageClick && "cursor-pointer"),
6546
6613
  style: {
6547
6614
  width: isMobile ? "100%" : activeImageWidth,
6548
6615
  height: activeImageHeight,
@@ -6550,10 +6617,12 @@ function CompactImagesPreview(props) {
6550
6617
  objectFit: "cover"
6551
6618
  },
6552
6619
  src: currentSource.uri,
6553
- alt: currentSource.name
6620
+ alt: currentSource.name,
6621
+ onError: handleImgError,
6622
+ onClick: onMainImageClick
6554
6623
  }
6555
6624
  ),
6556
- sources.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "flex flex-row flex-wrap items-center gap-3", children: sources.map((source, index) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
6625
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "flex flex-row flex-wrap items-center gap-3", children: sources.slice(0, 4).map((source, index) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
6557
6626
  "button",
6558
6627
  {
6559
6628
  onClick: (e) => {
@@ -6574,7 +6643,8 @@ function CompactImagesPreview(props) {
6574
6643
  height: thumbnailHeight,
6575
6644
  objectPosition: "center",
6576
6645
  objectFit: "cover"
6577
- }
6646
+ },
6647
+ onError: handleImgError
6578
6648
  }
6579
6649
  )
6580
6650
  },
@@ -6633,6 +6703,495 @@ function SimpleTable({
6633
6703
  )) })
6634
6704
  ] }) });
6635
6705
  }
6706
+
6707
+ // src/components/PDFViewer/index.tsx
6708
+ var import_react34 = require("react");
6709
+
6710
+ // src/components/PDFViewer/PDFElement.tsx
6711
+ var import_react_pdf2 = require("@mikecousins/react-pdf");
6712
+ var import_react33 = require("react");
6713
+
6714
+ // src/components/PDFViewer/PDFPage.tsx
6715
+ var import_react_pdf = require("@mikecousins/react-pdf");
6716
+ var import_react32 = require("react");
6717
+ var import_jsx_runtime53 = require("react/jsx-runtime");
6718
+ function PdfPage({
6719
+ file,
6720
+ pageNumber,
6721
+ testid,
6722
+ isMobile
6723
+ }) {
6724
+ const canvasRef = (0, import_react32.useRef)(null);
6725
+ const { pdfDocument } = (0, import_react_pdf.usePdf)({
6726
+ file,
6727
+ page: pageNumber,
6728
+ canvasRef,
6729
+ workerSrc: "/scripts/pdf.worker.min.mjs",
6730
+ scale: isMobile ? 1 : 1.3
6731
+ });
6732
+ if (!pdfDocument) return null;
6733
+ return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
6734
+ "canvas",
6735
+ {
6736
+ ref: canvasRef,
6737
+ "data-testid": testid,
6738
+ style: { width: "100%", height: "auto" }
6739
+ }
6740
+ );
6741
+ }
6742
+
6743
+ // src/components/PDFViewer/PDFElement.tsx
6744
+ var import_clsx35 = __toESM(require("clsx"), 1);
6745
+ var import_jsx_runtime54 = require("react/jsx-runtime");
6746
+ function PDFElement({
6747
+ b64,
6748
+ testid,
6749
+ isMobile,
6750
+ error
6751
+ }) {
6752
+ var _a;
6753
+ const canvasRef = (0, import_react33.useRef)(null);
6754
+ const { pdfDocument } = (0, import_react_pdf2.usePdf)({
6755
+ file: `data:application/pdf;base64,${b64}`,
6756
+ workerSrc: "/scripts/pdf.worker.min.mjs",
6757
+ scale: isMobile ? 1 : 1.3,
6758
+ canvasRef
6759
+ });
6760
+ const pagesArr = new Array((_a = pdfDocument == null ? void 0 : pdfDocument.numPages) != null ? _a : 1).fill(null);
6761
+ return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
6762
+ "div",
6763
+ {
6764
+ className: "flex flex-col space-y-4",
6765
+ style: !isMobile ? {
6766
+ minHeight: 871,
6767
+ minWidth: 654
6768
+ } : void 0,
6769
+ children: !!pdfDocument && !!b64 && !error ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(Stack, { sizing: "layout-group", children: pagesArr.length > 1 ? pagesArr.map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
6770
+ "div",
6771
+ {
6772
+ className: (0, import_clsx35.default)(
6773
+ "flex justify-center border-border-primary-normal",
6774
+ isMobile ? "border-0" : "border"
6775
+ ),
6776
+ children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
6777
+ PdfPage,
6778
+ {
6779
+ testid: testid ? `${testid}-pdf_page_${i + 1}` : void 0,
6780
+ file: `data:application/pdf;base64,${b64}`,
6781
+ pageNumber: i + 1
6782
+ }
6783
+ )
6784
+ },
6785
+ `${testid}-pdf-page-${i + 1}`
6786
+ )) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
6787
+ "div",
6788
+ {
6789
+ className: (0, import_clsx35.default)(
6790
+ "flex justify-center border-border-primary-normal",
6791
+ isMobile ? "border-0" : "border"
6792
+ ),
6793
+ children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
6794
+ "canvas",
6795
+ {
6796
+ "data-testid": testid ? `${testid}-pdf-content` : void 0,
6797
+ ref: canvasRef,
6798
+ style: { width: "100%", height: "auto" }
6799
+ }
6800
+ )
6801
+ }
6802
+ ) }) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
6803
+ Stack,
6804
+ {
6805
+ justify: "center",
6806
+ items: "center",
6807
+ height: "full",
6808
+ flexGrow: 1,
6809
+ "data-testid": testid ? `${testid}-pdf-${error ? "error" : "loading"}` : void 0,
6810
+ children: error ? error : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(Spinner, { size: "large" })
6811
+ }
6812
+ )
6813
+ }
6814
+ );
6815
+ }
6816
+
6817
+ // src/components/PDFViewer/DownloadIcon.tsx
6818
+ var import_jsx_runtime55 = require("react/jsx-runtime");
6819
+ function DownloadIcon({
6820
+ onClick,
6821
+ isDownloading,
6822
+ testid
6823
+ }) {
6824
+ return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
6825
+ Button,
6826
+ {
6827
+ testid,
6828
+ iconOnly: true,
6829
+ variant: "tertiary",
6830
+ leftIcon: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Icon, { name: isDownloading ? "cached" : "download" }),
6831
+ onClick
6832
+ }
6833
+ );
6834
+ }
6835
+
6836
+ // src/components/PDFViewer/PDFNavigation.tsx
6837
+ var import_jsx_runtime56 = require("react/jsx-runtime");
6838
+ function PdfNavigation({
6839
+ currentIndex,
6840
+ total,
6841
+ onPrev,
6842
+ onNext,
6843
+ disablePrev,
6844
+ disableNext,
6845
+ extraActions,
6846
+ testid,
6847
+ fileName
6848
+ }) {
6849
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
6850
+ Stack,
6851
+ {
6852
+ horizontal: true,
6853
+ items: "center",
6854
+ justify: "between",
6855
+ sizing: "layout-group",
6856
+ testid: testid ? `${testid}-pdf-navigation` : void 0,
6857
+ children: [
6858
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Stack, { horizontal: true, items: "center", children: [
6859
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
6860
+ Button,
6861
+ {
6862
+ iconOnly: true,
6863
+ variant: "tertiary",
6864
+ onClick: onPrev,
6865
+ leftIcon: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Icon, { name: "chevron_backward" }),
6866
+ disabled: disablePrev,
6867
+ testid: testid ? `${testid}-pdf-file-previous-button` : void 0
6868
+ }
6869
+ ),
6870
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Heading3, { className: "text-text-primary-normal whitespace-nowrap", children: [
6871
+ currentIndex + 1,
6872
+ " / ",
6873
+ total
6874
+ ] }),
6875
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
6876
+ Button,
6877
+ {
6878
+ iconOnly: true,
6879
+ variant: "tertiary",
6880
+ onClick: onNext,
6881
+ rightIcon: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Icon, { name: "chevron_forward" }),
6882
+ disabled: disableNext,
6883
+ testid: testid ? `${testid}-pdf-file-next-button` : void 0
6884
+ }
6885
+ ),
6886
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Paragraph, { children: (fileName == null ? void 0 : fileName.endsWith(".pdf")) ? fileName : `${fileName}.pdf` })
6887
+ ] }),
6888
+ extraActions && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "flex items-center gap-2", children: extraActions })
6889
+ ]
6890
+ }
6891
+ ) });
6892
+ }
6893
+
6894
+ // src/components/PDFViewer/index.tsx
6895
+ var import_jsx_runtime57 = require("react/jsx-runtime");
6896
+ function PDFViewer(props) {
6897
+ const {
6898
+ isOpen,
6899
+ onClose,
6900
+ encodedPdfs,
6901
+ customActions,
6902
+ testid,
6903
+ isMobile,
6904
+ title,
6905
+ customFooter = false,
6906
+ withPagination = true,
6907
+ error
6908
+ } = props;
6909
+ const [currentIndex, setCurrentIndex] = (0, import_react34.useState)(0);
6910
+ const [isDownloading, setIsDownloading] = (0, import_react34.useState)(false);
6911
+ const handleDownload = (0, import_react34.useCallback)(() => {
6912
+ setIsDownloading(true);
6913
+ const link = document.createElement("a");
6914
+ const currentPdf = encodedPdfs[currentIndex];
6915
+ if (!currentPdf) {
6916
+ setIsDownloading(false);
6917
+ return;
6918
+ }
6919
+ link.href = `data:application/pdf;base64,${currentPdf.base64}`;
6920
+ link.download = currentPdf.fileName.endsWith(".pdf") ? currentPdf.fileName : `${currentPdf.fileName}.pdf`;
6921
+ document.body.appendChild(link);
6922
+ link.click();
6923
+ document.body.removeChild(link);
6924
+ setIsDownloading(false);
6925
+ }, [currentIndex, encodedPdfs]);
6926
+ if (!encodedPdfs.length) return null;
6927
+ function handleNextFile() {
6928
+ if (currentIndex < encodedPdfs.length - 1) {
6929
+ setCurrentIndex((prev) => prev + 1);
6930
+ }
6931
+ }
6932
+ function handlePreviousFile() {
6933
+ if (currentIndex > 0) {
6934
+ setCurrentIndex((prev) => prev - 1);
6935
+ }
6936
+ }
6937
+ function handleClose() {
6938
+ setCurrentIndex(0);
6939
+ setIsDownloading(false);
6940
+ onClose();
6941
+ }
6942
+ return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
6943
+ Modal,
6944
+ {
6945
+ testid,
6946
+ open: isOpen,
6947
+ customFooter,
6948
+ onClose: handleClose,
6949
+ noWrapper: true,
6950
+ showButtons: isMobile && customFooter ? !!customActions : !!encodedPdfs.length,
6951
+ customActions: !!encodedPdfs.length && !isMobile && withPagination ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
6952
+ PdfNavigation,
6953
+ {
6954
+ testid,
6955
+ currentIndex,
6956
+ total: encodedPdfs.length,
6957
+ onPrev: handlePreviousFile,
6958
+ onNext: handleNextFile,
6959
+ disablePrev: currentIndex === 0,
6960
+ disableNext: currentIndex === encodedPdfs.length - 1,
6961
+ extraActions: customActions,
6962
+ fileName: encodedPdfs[currentIndex].fileName
6963
+ }
6964
+ ) : customActions,
6965
+ fixedHeightScrolling: true,
6966
+ headerIconAlign: "right",
6967
+ headerIcon: !isMobile ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
6968
+ DownloadIcon,
6969
+ {
6970
+ testid: testid ? `${testid}-download-icon` : void 0,
6971
+ onClick: handleDownload,
6972
+ isDownloading
6973
+ }
6974
+ ) : void 0,
6975
+ title: isMobile ? title != null ? title : encodedPdfs[currentIndex].fileName : void 0,
6976
+ size: isMobile ? "screen" : "large",
6977
+ headerClassname: "bg-brand-400 desktop:bg-background-grouped-primary-normal p-mobile-layout-padding text-brand-text-action-primary-normal",
6978
+ children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
6979
+ PDFElement,
6980
+ {
6981
+ testid,
6982
+ b64: encodedPdfs[currentIndex].base64,
6983
+ isMobile,
6984
+ error
6985
+ }
6986
+ )
6987
+ }
6988
+ );
6989
+ }
6990
+
6991
+ // src/components/ListGroup.tsx
6992
+ var import_react35 = require("react");
6993
+ var import_clsx36 = __toESM(require("clsx"), 1);
6994
+ var import_jsx_runtime58 = require("react/jsx-runtime");
6995
+ function ListGroup({
6996
+ title,
6997
+ defaultOpen = false,
6998
+ open: controlledOpen,
6999
+ onToggle,
7000
+ testid,
7001
+ disabled,
7002
+ className,
7003
+ children
7004
+ }) {
7005
+ const [uncontrolledOpen, setUncontrolledOpen] = (0, import_react35.useState)(defaultOpen);
7006
+ const isControlled = controlledOpen !== void 0;
7007
+ const isOpen = isControlled ? controlledOpen : uncontrolledOpen;
7008
+ const toggle = () => {
7009
+ if (disabled) return;
7010
+ const next = !isOpen;
7011
+ if (!isControlled) setUncontrolledOpen(next);
7012
+ onToggle == null ? void 0 : onToggle(next);
7013
+ };
7014
+ return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { "data-testid": testid, className: (0, import_clsx36.default)("rounded-sm", className), children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(Stack, { sizing: "layout", noGap: true, children: [
7015
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
7016
+ "button",
7017
+ {
7018
+ type: "button",
7019
+ onClick: toggle,
7020
+ className: (0, import_clsx36.default)(
7021
+ "w-full flex items-center justify-between text-left",
7022
+ disabled && "opacity-50 cursor-not-allowed"
7023
+ ),
7024
+ "aria-expanded": isOpen,
7025
+ children: [
7026
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Label, { children: title }),
7027
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
7028
+ Icon,
7029
+ {
7030
+ name: "expand_more",
7031
+ className: (0, import_clsx36.default)(
7032
+ "transition-transform duration-200",
7033
+ isOpen ? "rotate-180" : "rotate-0"
7034
+ )
7035
+ }
7036
+ )
7037
+ ]
7038
+ }
7039
+ ),
7040
+ isOpen && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Stack, { sizing: "layout", paddingTop: true, children })
7041
+ ] }) });
7042
+ }
7043
+
7044
+ // src/components/Pagination.tsx
7045
+ var import_react36 = require("react");
7046
+ var import_clsx37 = __toESM(require("clsx"), 1);
7047
+ var import_jsx_runtime59 = require("react/jsx-runtime");
7048
+ var Pagination = ({
7049
+ totalPages,
7050
+ currentPage,
7051
+ onPageChange,
7052
+ id,
7053
+ testid,
7054
+ className,
7055
+ disabled
7056
+ }) => {
7057
+ const goTo = (0, import_react36.useCallback)(
7058
+ (page) => {
7059
+ if (disabled) return;
7060
+ onPageChange(page);
7061
+ },
7062
+ [onPageChange, disabled]
7063
+ );
7064
+ const handleKey = (e) => {
7065
+ if (disabled) return;
7066
+ if (e.key === "ArrowLeft") {
7067
+ e.preventDefault();
7068
+ goTo(currentPage - 1);
7069
+ } else if (e.key === "ArrowRight") {
7070
+ e.preventDefault();
7071
+ goTo(currentPage + 1);
7072
+ }
7073
+ };
7074
+ const pageTokens = (0, import_react36.useMemo)(() => {
7075
+ if (totalPages <= 5) {
7076
+ return Array.from({ length: totalPages }, (_, i) => i + 1);
7077
+ }
7078
+ const pages = /* @__PURE__ */ new Set();
7079
+ pages.add(1);
7080
+ pages.add(totalPages);
7081
+ if (currentPage <= 3) {
7082
+ pages.add(2);
7083
+ pages.add(3);
7084
+ pages.add(4);
7085
+ } else if (currentPage >= totalPages - 2) {
7086
+ pages.add(totalPages - 1);
7087
+ pages.add(totalPages - 2);
7088
+ pages.add(totalPages - 3);
7089
+ } else {
7090
+ pages.add(currentPage - 1);
7091
+ pages.add(currentPage);
7092
+ pages.add(currentPage + 1);
7093
+ }
7094
+ const sorted = Array.from(pages).sort((a, b) => a - b);
7095
+ const tokens = [];
7096
+ for (let i = 0; i < sorted.length; i++) {
7097
+ const value = sorted[i];
7098
+ const prev = sorted[i - 1];
7099
+ if (i > 0) {
7100
+ if (value - prev === 2) {
7101
+ tokens.push(prev + 1);
7102
+ } else if (value - prev > 2) {
7103
+ tokens.push("ellipsis");
7104
+ }
7105
+ }
7106
+ tokens.push(value);
7107
+ }
7108
+ return tokens;
7109
+ }, [totalPages, currentPage]);
7110
+ if (totalPages <= 1) return null;
7111
+ const buttonClass = (0, import_clsx37.default)(
7112
+ "cursor-pointer disabled:cursor-default",
7113
+ paddingUsingComponentGap,
7114
+ "w-8 h-8",
7115
+ "flex items-center justify-center",
7116
+ "bg-transparent",
7117
+ "box-content",
7118
+ "hover:bg-background-grouped-secondary-normal",
7119
+ "focus:bg-background-grouped-secondary-normal focus:outline-0",
7120
+ "disabled:bg-transparent disabled:text-text-action-primary-disabled"
7121
+ );
7122
+ return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
7123
+ "nav",
7124
+ {
7125
+ id,
7126
+ "data-testid": testid,
7127
+ "aria-label": "Pagination",
7128
+ onKeyDown: handleKey,
7129
+ className: (0, import_clsx37.default)(
7130
+ "flex items-center",
7131
+ "border border-border-primary-normal",
7132
+ "bg-background-grouped-primary-normal",
7133
+ "rounded-sm",
7134
+ className
7135
+ ),
7136
+ children: [
7137
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
7138
+ "button",
7139
+ {
7140
+ disabled: disabled || currentPage <= 1,
7141
+ "aria-label": "Previous page",
7142
+ onClick: () => goTo(currentPage - 1),
7143
+ className: (0, import_clsx37.default)(buttonClass, "border-r-1 border-border-primary-normal"),
7144
+ children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Icon, { name: "keyboard_arrow_left" })
7145
+ }
7146
+ ),
7147
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("ul", { className: (0, import_clsx37.default)("flex items-center"), children: pageTokens.map((token, index) => {
7148
+ if (token === "ellipsis") {
7149
+ return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
7150
+ "li",
7151
+ {
7152
+ className: "w-8 h-8 select-none text-text-action-primary-disabled",
7153
+ children: "\u2026"
7154
+ },
7155
+ `ellipsis-${index}`
7156
+ );
7157
+ }
7158
+ const selected = token === currentPage;
7159
+ return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
7160
+ "button",
7161
+ {
7162
+ "aria-label": `Page ${token}`,
7163
+ "aria-current": selected ? "page" : void 0,
7164
+ disabled,
7165
+ onClick: () => goTo(token),
7166
+ className: (0, import_clsx37.default)(
7167
+ buttonClass,
7168
+ selected && "border-x-1 bg-background-grouped-secondary-normal border-border-primary-normal"
7169
+ ),
7170
+ children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Subheader, { align: "center", weight: "bold", children: token })
7171
+ }
7172
+ ) }, token);
7173
+ }) }),
7174
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
7175
+ "button",
7176
+ {
7177
+ disabled: disabled || currentPage >= totalPages,
7178
+ "aria-label": "Next page",
7179
+ onClick: () => goTo(currentPage + 1),
7180
+ className: (0, import_clsx37.default)(buttonClass, "border-l-1 border-border-primary-normal"),
7181
+ children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Icon, { name: "keyboard_arrow_right" })
7182
+ }
7183
+ )
7184
+ ]
7185
+ }
7186
+ );
7187
+ };
7188
+ Pagination.displayName = "Pagination";
7189
+
7190
+ // src/components/SkeletonParagraph.tsx
7191
+ var import_jsx_runtime60 = require("react/jsx-runtime");
7192
+ function SkeletonParagraph() {
7193
+ return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "h-[24px] bg-gradient-to-r from-neutral-100 to-[#f7f7f7] w-full rounded-xs min-w-32 " });
7194
+ }
6636
7195
  // Annotate the CommonJS export names for ESM import in node:
6637
7196
  0 && (module.exports = {
6638
7197
  Accordion,
@@ -6648,14 +7207,18 @@ function SimpleTable({
6648
7207
  Icon,
6649
7208
  Input,
6650
7209
  Label,
7210
+ ListGroup,
6651
7211
  Menu,
6652
7212
  MenuOption,
6653
7213
  MobileDataGrid,
7214
+ PDFViewer,
7215
+ Pagination,
6654
7216
  Paragraph,
6655
7217
  ProductImagePreview,
6656
7218
  Search,
6657
7219
  Select,
6658
7220
  SimpleTable,
7221
+ SkeletonParagraph,
6659
7222
  Subheader,
6660
7223
  Tooltip
6661
7224
  });