@dmsi/wedgekit-react 0.0.502 → 0.0.504

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 (71) hide show
  1. package/dist/{chunk-LJLHGLTS.js → chunk-BMPL6LCR.js} +4 -4
  2. package/dist/{chunk-D4TFZ2WM.js → chunk-ELXVDRWS.js} +4 -4
  3. package/dist/{chunk-QV3NANQC.js → chunk-JWVZOEF5.js} +4 -4
  4. package/dist/{chunk-VOSQMHNF.js → chunk-U5V2IRZX.js} +4 -29
  5. package/dist/{chunk-S5ZJ3Q7P.js → chunk-VJVY6NPF.js} +3 -3
  6. package/dist/components/Alert.js +2 -2
  7. package/dist/components/CalendarRange.cjs +75 -128
  8. package/dist/components/CalendarRange.js +10 -16
  9. package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.cjs +33 -86
  10. package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.js +10 -16
  11. package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.cjs +43 -96
  12. package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.js +10 -16
  13. package/dist/components/DataGrid/PinnedColumns.cjs +58 -111
  14. package/dist/components/DataGrid/PinnedColumns.js +10 -16
  15. package/dist/components/DataGrid/TableBody/LoadingCell.cjs +34 -87
  16. package/dist/components/DataGrid/TableBody/LoadingCell.js +10 -16
  17. package/dist/components/DataGrid/TableBody/TableBodyRow.cjs +40 -93
  18. package/dist/components/DataGrid/TableBody/TableBodyRow.js +10 -16
  19. package/dist/components/DataGrid/TableBody/index.cjs +55 -108
  20. package/dist/components/DataGrid/TableBody/index.js +10 -16
  21. package/dist/components/DataGrid/index.cjs +144 -197
  22. package/dist/components/DataGrid/index.js +10 -16
  23. package/dist/components/DataGrid/utils.cjs +34 -87
  24. package/dist/components/DataGrid/utils.js +10 -16
  25. package/dist/components/DateInput.cjs +94 -147
  26. package/dist/components/DateInput.js +10 -16
  27. package/dist/components/DateRangeInput.cjs +94 -147
  28. package/dist/components/DateRangeInput.js +10 -16
  29. package/dist/components/FilterGroup.js +5 -5
  30. package/dist/components/MobileDataGrid/ColumnSelector/index.cjs +41 -94
  31. package/dist/components/MobileDataGrid/ColumnSelector/index.js +10 -16
  32. package/dist/components/MobileDataGrid/MobileDataGridHeader.cjs +49 -102
  33. package/dist/components/MobileDataGrid/MobileDataGridHeader.js +10 -16
  34. package/dist/components/MobileDataGrid/RowDetailModalProvider/index.js +5 -5
  35. package/dist/components/MobileDataGrid/index.cjs +868 -921
  36. package/dist/components/MobileDataGrid/index.js +10 -16
  37. package/dist/components/Modal.js +4 -4
  38. package/dist/components/ModalButtons.js +2 -2
  39. package/dist/components/ModalHeader.js +2 -2
  40. package/dist/components/NavigationTab.js +2 -2
  41. package/dist/components/NavigationTabs.js +2 -2
  42. package/dist/components/NestedMenu.js +3 -3
  43. package/dist/components/Notification.js +3 -3
  44. package/dist/components/OptionPill.js +2 -2
  45. package/dist/components/PDFViewer/DownloadIcon.js +2 -2
  46. package/dist/components/PDFViewer/PDFElement.cjs +5 -31
  47. package/dist/components/PDFViewer/PDFElement.js +2 -3
  48. package/dist/components/PDFViewer/PDFNavigation.js +2 -2
  49. package/dist/components/PDFViewer/PDFPage.cjs +3 -3
  50. package/dist/components/PDFViewer/PDFPage.js +1 -1
  51. package/dist/components/PDFViewer/index.cjs +5 -35
  52. package/dist/components/PDFViewer/index.js +114 -11
  53. package/dist/components/ProductImagePreview/index.js +1 -1
  54. package/dist/components/Stepper.js +3 -3
  55. package/dist/components/Toast.js +3 -3
  56. package/dist/components/Upload.js +3 -3
  57. package/dist/components/index.cjs +56 -402
  58. package/dist/components/index.js +16 -25
  59. package/package.json +1 -1
  60. package/src/components/PDFViewer/PDFElement.tsx +3 -38
  61. package/src/components/PDFViewer/PDFPage.tsx +2 -4
  62. package/src/components/PDFViewer/index.tsx +1 -9
  63. package/src/components/index.ts +0 -1
  64. package/dist/chunk-B2O4TEOI.js +0 -119
  65. package/dist/{chunk-5DQVYX6H.js → chunk-56RPZLV7.js} +3 -3
  66. package/dist/{chunk-25RZP3VR.js → chunk-AKJUBFJK.js} +3 -3
  67. package/dist/{chunk-TAPYQBQU.js → chunk-CMMQTIVM.js} +3 -3
  68. package/dist/{chunk-GYEXSNFP.js → chunk-FWCVZWE6.js} +3 -3
  69. package/dist/{chunk-MV6W7OMC.js → chunk-QMMPHXVE.js} +3 -3
  70. package/dist/{chunk-BWBSDSA7.js → chunk-SPJ6V6WJ.js} +3 -3
  71. package/dist/{chunk-VS53C5ZD.js → chunk-YJGDVWTH.js} +3 -3
@@ -2,9 +2,9 @@ import {
2
2
  DataGrid,
3
3
  DateInput,
4
4
  MobileDataGrid
5
- } from "../chunk-QV3NANQC.js";
5
+ } from "../chunk-JWVZOEF5.js";
6
6
  import "../chunk-M7INAUAJ.js";
7
- import "../chunk-D4TFZ2WM.js";
7
+ import "../chunk-ELXVDRWS.js";
8
8
  import "../chunk-3UUCDNX3.js";
9
9
  import {
10
10
  ProductImagePreview
@@ -13,12 +13,6 @@ import "../chunk-BQNPOGD5.js";
13
13
  import {
14
14
  SearchResultImage
15
15
  } from "../chunk-Y5GD2FJA.js";
16
- import {
17
- PDFViewer
18
- } from "../chunk-B2O4TEOI.js";
19
- import "../chunk-VOSQMHNF.js";
20
- import "../chunk-VS53C5ZD.js";
21
- import "../chunk-S5ZJ3Q7P.js";
22
16
  import "../chunk-MBZ55T2D.js";
23
17
  import "../chunk-2IKT6IHB.js";
24
18
  import "../chunk-YCDDBSVU.js";
@@ -28,15 +22,11 @@ import "../chunk-5YNEY3WO.js";
28
22
  import "../chunk-5IFPG6TS.js";
29
23
  import "../chunk-AJ5M6MVX.js";
30
24
  import "../chunk-UI7P5J5S.js";
31
- import "../chunk-5DQVYX6H.js";
32
25
  import {
33
26
  Tooltip
34
27
  } from "../chunk-MDB26F6T.js";
35
28
  import "../chunk-AT4AWD6B.js";
36
29
  import "../chunk-EWGHVZL5.js";
37
- import {
38
- Select
39
- } from "../chunk-2TNHD4MQ.js";
40
30
  import {
41
31
  SimpleTable
42
32
  } from "../chunk-OWHPPZZA.js";
@@ -49,21 +39,20 @@ import {
49
39
  import {
50
40
  Pagination
51
41
  } from "../chunk-LB7UT6F3.js";
52
- import "../chunk-LJLHGLTS.js";
42
+ import {
43
+ Select
44
+ } from "../chunk-2TNHD4MQ.js";
45
+ import "../chunk-BMPL6LCR.js";
53
46
  import "../chunk-4RJKB7LC.js";
54
- import "../chunk-25RZP3VR.js";
55
47
  import "../chunk-WVVEOCEH.js";
56
- import "../chunk-TAPYQBQU.js";
48
+ import "../chunk-CMMQTIVM.js";
57
49
  import "../chunk-AG43RS4Q.js";
58
- import "../chunk-SBRRNFOP.js";
59
- import "../chunk-QVWYTQKL.js";
50
+ import "../chunk-AKJUBFJK.js";
60
51
  import {
61
52
  ListGroup
62
53
  } from "../chunk-SUSUNSVZ.js";
63
- import {
64
- EmptyCartIcon
65
- } from "../chunk-75USUR3I.js";
66
54
  import "../chunk-Y2GK27RX.js";
55
+ import "../chunk-QVWYTQKL.js";
67
56
  import {
68
57
  DataCellHeader,
69
58
  DataGridCell,
@@ -87,6 +76,9 @@ import {
87
76
  Label
88
77
  } from "../chunk-HXGJVYGQ.js";
89
78
  import "../chunk-WVUIIBRR.js";
79
+ import {
80
+ EmptyCartIcon
81
+ } from "../chunk-75USUR3I.js";
90
82
  import "../chunk-PS6UJZVH.js";
91
83
  import {
92
84
  Checkbox
@@ -109,11 +101,8 @@ import {
109
101
  } from "../chunk-KBJZUVLM.js";
110
102
  import {
111
103
  Alert
112
- } from "../chunk-BWBSDSA7.js";
104
+ } from "../chunk-SPJ6V6WJ.js";
113
105
  import "../chunk-MXSJF6TW.js";
114
- import {
115
- Button
116
- } from "../chunk-45AHDOAU.js";
117
106
  import {
118
107
  Paragraph
119
108
  } from "../chunk-WMPWWFUJ.js";
@@ -121,6 +110,9 @@ import "../chunk-TPXH53SA.js";
121
110
  import {
122
111
  Icon
123
112
  } from "../chunk-NKUETCDA.js";
113
+ import {
114
+ Button
115
+ } from "../chunk-45AHDOAU.js";
124
116
  import "../chunk-7KWFEH56.js";
125
117
  import "../chunk-ORMEWXMH.js";
126
118
  export {
@@ -145,7 +137,6 @@ export {
145
137
  MenuOption,
146
138
  MobileDataGrid,
147
139
  OrderCheckIcon,
148
- PDFViewer,
149
140
  Pagination,
150
141
  Paragraph,
151
142
  ProductImagePreview,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dmsi/wedgekit-react",
3
3
  "private": false,
4
- "version": "0.0.502",
4
+ "version": "0.0.504",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "build": "tsup",
@@ -1,6 +1,5 @@
1
- "use client";
2
- import { type usePdf } from "@mikecousins/react-pdf";
3
- import { useEffect, useRef, useState } from "react";
1
+ import { usePdf } from "@mikecousins/react-pdf";
2
+ import { useRef } from "react";
4
3
  import { Spinner } from "../Spinner";
5
4
  import { Stack } from "../Stack";
6
5
  import { PdfPage } from "./PDFPage";
@@ -16,43 +15,10 @@ export function PDFElement({
16
15
  testid?: string;
17
16
  isMobile?: boolean;
18
17
  error?: React.ReactNode;
19
- }) {
20
- const [pdfHook, setPDFHook] = useState<typeof usePdf | null>(null);
21
- useEffect(() => {
22
- import("@mikecousins/react-pdf").then((m) => setPDFHook(m.usePdf));
23
- }, []);
24
-
25
- if (pdfHook === null) {
26
- return null;
27
- }
28
-
29
- return (
30
- <PDFElementInternal
31
- b64={b64}
32
- testid={testid}
33
- isMobile={isMobile}
34
- error={error}
35
- usePDF={pdfHook}
36
- />
37
- );
38
- }
39
-
40
- function PDFElementInternal({
41
- b64,
42
- testid,
43
- isMobile,
44
- error,
45
- usePDF,
46
- }: {
47
- b64: string;
48
- testid?: string;
49
- isMobile?: boolean;
50
- error?: React.ReactNode;
51
- usePDF: typeof usePdf;
52
18
  }) {
53
19
  const canvasRef = useRef<HTMLCanvasElement>(null);
54
20
 
55
- const { pdfDocument } = usePDF({
21
+ const { pdfDocument } = usePdf({
56
22
  file: `data:application/pdf;base64,${b64}`,
57
23
  workerSrc: "/scripts/pdf.worker.min.mjs",
58
24
  scale: isMobile ? 1 : 1.3,
@@ -85,7 +51,6 @@ function PDFElementInternal({
85
51
  )}
86
52
  >
87
53
  <PdfPage
88
- usePDF={usePDF}
89
54
  testid={testid ? `${testid}-pdf_page_${i + 1}` : undefined}
90
55
  file={`data:application/pdf;base64,${b64}`}
91
56
  pageNumber={i + 1}
@@ -1,4 +1,4 @@
1
- import { type usePdf } from "@mikecousins/react-pdf";
1
+ import { usePdf } from "@mikecousins/react-pdf";
2
2
  import { useRef } from "react";
3
3
 
4
4
  export function PdfPage({
@@ -6,17 +6,15 @@ export function PdfPage({
6
6
  pageNumber,
7
7
  testid,
8
8
  isMobile,
9
- usePDF,
10
9
  }: {
11
10
  file: string;
12
11
  pageNumber: number;
13
12
  testid?: string;
14
13
  isMobile?: boolean;
15
- usePDF: typeof usePdf;
16
14
  }) {
17
15
  const canvasRef = useRef<HTMLCanvasElement>(null);
18
16
 
19
- const { pdfDocument } = usePDF({
17
+ const { pdfDocument } = usePdf({
20
18
  file,
21
19
  page: pageNumber,
22
20
  canvasRef,
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
- import { useCallback, useEffect, useState } from "react";
3
+ import { useCallback, useState } from "react";
4
4
  import { Modal } from "../Modal";
5
5
  import { PDFElement } from "./PDFElement";
6
6
  import { DownloadIcon } from "./DownloadIcon";
@@ -35,12 +35,6 @@ export function PDFViewer(props: PDFViewerProps) {
35
35
  const [currentIndex, setCurrentIndex] = useState(0);
36
36
  const [isDownloading, setIsDownloading] = useState(false);
37
37
 
38
- const [isMounted, setIsMounted] = useState(false);
39
-
40
- useEffect(() => {
41
- setIsMounted(true);
42
- }, []);
43
-
44
38
  const handleDownload = useCallback(() => {
45
39
  setIsDownloading(true);
46
40
  const link = document.createElement("a");
@@ -79,8 +73,6 @@ export function PDFViewer(props: PDFViewerProps) {
79
73
  onClose();
80
74
  }
81
75
 
82
- if (!isMounted) return null;
83
-
84
76
  return (
85
77
  <Modal
86
78
  testid={testid}
@@ -25,7 +25,6 @@ export { MobileDataGrid } from "./MobileDataGrid";
25
25
  export { ProductImagePreview } from "./ProductImagePreview";
26
26
  export { CompactImagesPreview } from "./CompactImagesPreview";
27
27
  export { SimpleTable } from "./SimpleTable";
28
- export { PDFViewer } from "./PDFViewer";
29
28
  export { ListGroup } from "./ListGroup";
30
29
  export { Pagination } from "./Pagination";
31
30
  export { SkeletonParagraph } from "./SkeletonParagraph";
@@ -1,119 +0,0 @@
1
- import {
2
- PDFElement
3
- } from "./chunk-VOSQMHNF.js";
4
- import {
5
- PdfNavigation
6
- } from "./chunk-VS53C5ZD.js";
7
- import {
8
- DownloadIcon
9
- } from "./chunk-5DQVYX6H.js";
10
- import {
11
- Modal
12
- } from "./chunk-LJLHGLTS.js";
13
-
14
- // src/components/PDFViewer/index.tsx
15
- import { useCallback, useEffect, useState } from "react";
16
- import { jsx } from "react/jsx-runtime";
17
- function PDFViewer(props) {
18
- const {
19
- isOpen,
20
- onClose,
21
- encodedPdfs,
22
- customActions,
23
- testid,
24
- isMobile,
25
- title,
26
- customFooter = false,
27
- withPagination = true,
28
- error
29
- } = props;
30
- const [currentIndex, setCurrentIndex] = useState(0);
31
- const [isDownloading, setIsDownloading] = useState(false);
32
- const [isMounted, setIsMounted] = useState(false);
33
- useEffect(() => {
34
- setIsMounted(true);
35
- }, []);
36
- const handleDownload = useCallback(() => {
37
- setIsDownloading(true);
38
- const link = document.createElement("a");
39
- const currentPdf = encodedPdfs[currentIndex];
40
- if (!currentPdf) {
41
- setIsDownloading(false);
42
- return;
43
- }
44
- link.href = `data:application/pdf;base64,${currentPdf.base64}`;
45
- link.download = currentPdf.fileName.endsWith(".pdf") ? currentPdf.fileName : `${currentPdf.fileName}.pdf`;
46
- document.body.appendChild(link);
47
- link.click();
48
- document.body.removeChild(link);
49
- setIsDownloading(false);
50
- }, [currentIndex, encodedPdfs]);
51
- if (!encodedPdfs.length) return null;
52
- function handleNextFile() {
53
- if (currentIndex < encodedPdfs.length - 1) {
54
- setCurrentIndex((prev) => prev + 1);
55
- }
56
- }
57
- function handlePreviousFile() {
58
- if (currentIndex > 0) {
59
- setCurrentIndex((prev) => prev - 1);
60
- }
61
- }
62
- function handleClose() {
63
- setCurrentIndex(0);
64
- setIsDownloading(false);
65
- onClose();
66
- }
67
- if (!isMounted) return null;
68
- return /* @__PURE__ */ jsx(
69
- Modal,
70
- {
71
- testid,
72
- open: isOpen,
73
- customFooter,
74
- onClose: handleClose,
75
- noWrapper: true,
76
- showButtons: isMobile && customFooter ? !!customActions : !!encodedPdfs.length,
77
- customActions: !!encodedPdfs.length && !isMobile && withPagination ? /* @__PURE__ */ jsx(
78
- PdfNavigation,
79
- {
80
- testid,
81
- currentIndex,
82
- total: encodedPdfs.length,
83
- onPrev: handlePreviousFile,
84
- onNext: handleNextFile,
85
- disablePrev: currentIndex === 0,
86
- disableNext: currentIndex === encodedPdfs.length - 1,
87
- extraActions: customActions,
88
- fileName: encodedPdfs[currentIndex].fileName
89
- }
90
- ) : customActions,
91
- fixedHeightScrolling: true,
92
- headerIconAlign: "right",
93
- headerIcon: !isMobile ? /* @__PURE__ */ jsx(
94
- DownloadIcon,
95
- {
96
- testid: testid ? `${testid}-download-icon` : void 0,
97
- onClick: handleDownload,
98
- isDownloading
99
- }
100
- ) : void 0,
101
- title: isMobile ? title != null ? title : encodedPdfs[currentIndex].fileName : void 0,
102
- size: isMobile ? "screen" : "large",
103
- headerClassname: "bg-brand-400 desktop:bg-background-grouped-primary-normal p-mobile-layout-padding text-brand-text-action-primary-normal",
104
- children: /* @__PURE__ */ jsx(
105
- PDFElement,
106
- {
107
- testid,
108
- b64: encodedPdfs[currentIndex].base64,
109
- isMobile,
110
- error
111
- }
112
- )
113
- }
114
- );
115
- }
116
-
117
- export {
118
- PDFViewer
119
- };
@@ -1,9 +1,9 @@
1
- import {
2
- Button
3
- } from "./chunk-45AHDOAU.js";
4
1
  import {
5
2
  Icon
6
3
  } from "./chunk-NKUETCDA.js";
4
+ import {
5
+ Button
6
+ } from "./chunk-45AHDOAU.js";
7
7
 
8
8
  // src/components/PDFViewer/DownloadIcon.tsx
9
9
  import { jsx } from "react/jsx-runtime";
@@ -1,9 +1,9 @@
1
- import {
2
- Button
3
- } from "./chunk-45AHDOAU.js";
4
1
  import {
5
2
  Icon
6
3
  } from "./chunk-NKUETCDA.js";
4
+ import {
5
+ Button
6
+ } from "./chunk-45AHDOAU.js";
7
7
  import {
8
8
  layoutGroupGap,
9
9
  layoutPaddding
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  Heading2
3
3
  } from "./chunk-MXSJF6TW.js";
4
- import {
5
- Button
6
- } from "./chunk-45AHDOAU.js";
7
4
  import {
8
5
  Icon
9
6
  } from "./chunk-NKUETCDA.js";
7
+ import {
8
+ Button
9
+ } from "./chunk-45AHDOAU.js";
10
10
  import {
11
11
  layoutGroupGap,
12
12
  layoutPaddding
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  Label
3
3
  } from "./chunk-HXGJVYGQ.js";
4
- import {
5
- Button
6
- } from "./chunk-45AHDOAU.js";
7
4
  import {
8
5
  Icon
9
6
  } from "./chunk-NKUETCDA.js";
7
+ import {
8
+ Button
9
+ } from "./chunk-45AHDOAU.js";
10
10
  import {
11
11
  baseTransition,
12
12
  componentGap,
@@ -1,9 +1,9 @@
1
- import {
2
- Button
3
- } from "./chunk-45AHDOAU.js";
4
1
  import {
5
2
  Icon
6
3
  } from "./chunk-NKUETCDA.js";
4
+ import {
5
+ Button
6
+ } from "./chunk-45AHDOAU.js";
7
7
  import {
8
8
  __objRest,
9
9
  __spreadProps,
@@ -1,9 +1,6 @@
1
1
  import {
2
2
  Heading2
3
3
  } from "./chunk-MXSJF6TW.js";
4
- import {
5
- Button
6
- } from "./chunk-45AHDOAU.js";
7
4
  import {
8
5
  Paragraph
9
6
  } from "./chunk-WMPWWFUJ.js";
@@ -13,6 +10,9 @@ import {
13
10
  import {
14
11
  Icon
15
12
  } from "./chunk-NKUETCDA.js";
13
+ import {
14
+ Button
15
+ } from "./chunk-45AHDOAU.js";
16
16
  import {
17
17
  __objRest,
18
18
  __spreadProps,
@@ -1,9 +1,6 @@
1
1
  import {
2
2
  Heading3
3
3
  } from "./chunk-MXSJF6TW.js";
4
- import {
5
- Button
6
- } from "./chunk-45AHDOAU.js";
7
4
  import {
8
5
  Paragraph
9
6
  } from "./chunk-WMPWWFUJ.js";
@@ -13,6 +10,9 @@ import {
13
10
  import {
14
11
  Icon
15
12
  } from "./chunk-NKUETCDA.js";
13
+ import {
14
+ Button
15
+ } from "./chunk-45AHDOAU.js";
16
16
 
17
17
  // src/components/PDFViewer/PDFNavigation.tsx
18
18
  import { jsx, jsxs } from "react/jsx-runtime";