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