@dmsi/wedgekit-react 0.0.171 → 0.0.172

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 (39) hide show
  1. package/dist/{chunk-GCBW2LDM.js → chunk-F6YFWBVV.js} +7 -5
  2. package/dist/{chunk-6A54FL75.js → chunk-MJKBQSNI.js} +16 -4
  3. package/dist/{chunk-OJX75MY2.js → chunk-O4JGGMFE.js} +6 -6
  4. package/dist/{chunk-IDSFWKOR.js → chunk-PMBEIP24.js} +1 -1
  5. package/dist/{chunk-KADNOKNW.js → chunk-XH65MD2C.js} +1 -1
  6. package/dist/components/DataGridCell.js +6 -6
  7. package/dist/components/DateInput.js +10 -10
  8. package/dist/components/DateRangeInput.js +10 -10
  9. package/dist/components/FilterGroup.js +5 -5
  10. package/dist/components/Input.js +2 -2
  11. package/dist/components/MobileDataGrid.js +3 -3
  12. package/dist/components/Modal.cjs +18 -4
  13. package/dist/components/Modal.js +4 -4
  14. package/dist/components/ModalButtons.js +2 -2
  15. package/dist/components/ModalHeader.cjs +13 -1
  16. package/dist/components/ModalHeader.js +2 -2
  17. package/dist/components/NavigationTab.js +2 -2
  18. package/dist/components/NavigationTabs.js +2 -2
  19. package/dist/components/Notification.js +3 -3
  20. package/dist/components/OptionPill.js +2 -2
  21. package/dist/components/PDFViewer.cjs +221 -101
  22. package/dist/components/PDFViewer.js +155 -97
  23. package/dist/components/Password.js +2 -2
  24. package/dist/components/Search.js +3 -3
  25. package/dist/components/Select.js +3 -3
  26. package/dist/components/Stepper.js +5 -5
  27. package/dist/components/Time.js +2 -2
  28. package/dist/components/Toast.js +3 -3
  29. package/dist/components/Upload.js +3 -3
  30. package/dist/components/index.js +12 -12
  31. package/dist/index.css +8 -0
  32. package/package.json +1 -1
  33. package/src/components/Modal.tsx +5 -2
  34. package/src/components/ModalHeader.tsx +10 -1
  35. package/src/components/PDFViewer.tsx +86 -15
  36. package/dist/{chunk-MVGOAMTP.js → chunk-4T3DRGLF.js} +3 -3
  37. package/dist/{chunk-T7NDKJDP.js → chunk-C4JGTH6G.js} +3 -3
  38. package/dist/{chunk-UGNB32SL.js → chunk-LM5MKBPM.js} +3 -3
  39. package/dist/{chunk-ZR4E5A43.js → chunk-ZGFQN47L.js} +3 -3
@@ -8,6 +8,8 @@ import { Icon } from "./Icon";
8
8
  import { Stack } from "./Stack";
9
9
  import { Caption } from "./Caption";
10
10
  import { Spinner } from "./Spinner";
11
+ import { Paragraph } from "./Paragraph";
12
+ import { Heading3 } from "./Heading";
11
13
 
12
14
  type PDFViewerProps = {
13
15
  isOpen: boolean;
@@ -42,13 +44,34 @@ export function PDFViewer(props: PDFViewerProps) {
42
44
 
43
45
  if (!encodedPdfs.length) return null;
44
46
 
47
+ function handleNextFile() {
48
+ if (currentIndex < encodedPdfs.length - 1) {
49
+ setCurrentIndex((prev) => prev + 1);
50
+ }
51
+ }
52
+
53
+ function handlePreviousFile() {
54
+ if (currentIndex > 0) {
55
+ setCurrentIndex((prev) => prev - 1);
56
+ }
57
+ }
58
+
59
+ function handleClose() {
60
+ setCurrentIndex(0);
61
+ setIsDownloading(false);
62
+ onClose();
63
+ }
64
+
45
65
  return (
46
66
  <Modal
47
67
  testid={testid}
48
68
  open={isOpen}
49
- onClose={onClose}
69
+ onClose={handleClose}
50
70
  showButtons={!!customActions}
51
71
  customActions={customActions}
72
+ size="large"
73
+ fixedHeightScrolling
74
+ headerIconAlign="right"
52
75
  headerIcon={
53
76
  <DownloadIcon
54
77
  testid={testid ? `${testid}-download-icon` : undefined}
@@ -56,11 +79,44 @@ export function PDFViewer(props: PDFViewerProps) {
56
79
  isDownloading={isDownloading}
57
80
  />
58
81
  }
82
+ className="!max-w-fit"
59
83
  >
60
- <Stack sizing="layout">
84
+ <Stack sizing="layout" items="center">
61
85
  <PDFElement testid={testid} b64={encodedPdfs[currentIndex].base64} />
62
- <Stack horizontal overflowX="auto" sizing="layout-group">
63
- {encodedPdfs.map((pdf, index) => (
86
+ {!!encodedPdfs[currentIndex].fileName && (
87
+ <Paragraph>
88
+ {encodedPdfs[currentIndex].fileName.endsWith(".pdf")
89
+ ? encodedPdfs[currentIndex].fileName
90
+ : `${encodedPdfs[currentIndex].fileName}.pdf`}
91
+ </Paragraph>
92
+ )}
93
+ <Stack
94
+ horizontal
95
+ overflowX="auto"
96
+ justify="center"
97
+ items="center"
98
+ sizing="layout-group"
99
+ >
100
+ <Button
101
+ iconOnly
102
+ variant="tertiary"
103
+ onClick={handlePreviousFile}
104
+ leftIcon={<Icon name="chevron_backward" />}
105
+ disabled={currentIndex === 0}
106
+ testid={testid ? `${testid}-pdf-file-previous-button` : undefined}
107
+ />
108
+ <Heading3 className="text-text-primary-normal">
109
+ {currentIndex + 1} / {encodedPdfs.length}
110
+ </Heading3>
111
+ <Button
112
+ iconOnly
113
+ variant="tertiary"
114
+ onClick={handleNextFile}
115
+ rightIcon={<Icon name="chevron_forward" />}
116
+ disabled={currentIndex === encodedPdfs.length - 1}
117
+ testid={testid ? `${testid}-pdf-file-next-button` : undefined}
118
+ />
119
+ {/* {encodedPdfs.map((pdf, index) => (
64
120
  <Button
65
121
  testid={testid ? `${testid}-${pdf.fileName}-button` : undefined}
66
122
  variant={index === currentIndex ? "primary" : "secondary"}
@@ -84,7 +140,7 @@ export function PDFViewer(props: PDFViewerProps) {
84
140
  {!pdf.base64 && <Spinner />}
85
141
  {pdf.fileName}
86
142
  </Button>
87
- ))}
143
+ ))} */}
88
144
  </Stack>
89
145
  </Stack>
90
146
  </Modal>
@@ -120,20 +176,32 @@ function PDFElement({ b64, testid }: { b64: string; testid?: string }) {
120
176
  workerSrc: "/scripts/pdf.worker.min.mjs",
121
177
  page,
122
178
  canvasRef,
123
- scale: 1,
179
+ scale: 1.1,
124
180
  });
125
181
 
126
182
  return (
127
- <div className="flex flex-col space-y-4">
128
- {pdfDocument ? (
183
+ <div
184
+ className="flex flex-col space-y-4 "
185
+ style={{
186
+ minHeight: 871,
187
+ minWidth: 654,
188
+ }}
189
+ >
190
+ {!!pdfDocument && !!b64 ? (
129
191
  <canvas
130
192
  data-testid={testid ? `${testid}-pdf-content` : undefined}
131
193
  ref={canvasRef}
132
194
  />
133
195
  ) : (
134
- <div data-testid={testid ? `${testid}-pdf-loading` : undefined}>
135
- Loading PDF...
136
- </div>
196
+ <Stack
197
+ justify="center"
198
+ items="center"
199
+ height="full"
200
+ flexGrow={1}
201
+ data-testid={testid ? `${testid}-pdf-loading` : undefined}
202
+ >
203
+ <Spinner size="large" />
204
+ </Stack>
137
205
  )}
138
206
  {pdfDocument?.numPages && pdfDocument.numPages > 1 && (
139
207
  <ul
@@ -149,12 +217,14 @@ function PDFElement({ b64, testid }: { b64: string; testid?: string }) {
149
217
  onClick={() => setPage(page - 1)}
150
218
  className="not-disabled:cursor-pointer not-disabled:hover:underline "
151
219
  >
152
- <Caption>Previous</Caption>
220
+ <Caption className="not-disabled:cursor-pointer not-disabled:hover:underline not-disabled:text-text-primary-normal">
221
+ Previous
222
+ </Caption>
153
223
  </button>
154
224
  </li>
155
225
  <li
156
226
  data-testid={testid ? `${testid}-pdf-pagination-text` : undefined}
157
- className="text-label-desktop text-text-on-action-primary-normal"
227
+ className="text-label-desktop text-text-primary-normal"
158
228
  >
159
229
  Page{" "}
160
230
  <span
@@ -182,9 +252,10 @@ function PDFElement({ b64, testid }: { b64: string; testid?: string }) {
182
252
  }
183
253
  disabled={page === pdfDocument!.numPages}
184
254
  onClick={() => setPage(page + 1)}
185
- className="not-disabled:cursor-pointer not-disabled:hover:underline "
186
255
  >
187
- <Caption>Next</Caption>
256
+ <Caption className="not-disabled:cursor-pointer not-disabled:hover:underline not-disabled:text-text-primary-normal">
257
+ Next
258
+ </Caption>
188
259
  </button>
189
260
  </li>
190
261
  </ul>
@@ -1,11 +1,11 @@
1
- import {
2
- Label
3
- } from "./chunk-JWCT72WR.js";
4
1
  import {
5
2
  formatCurrencyDisplay,
6
3
  formatDecimalValue,
7
4
  getDecimalPlaceholder
8
5
  } from "./chunk-5UH6QUFB.js";
6
+ import {
7
+ Label
8
+ } from "./chunk-JWCT72WR.js";
9
9
  import {
10
10
  Icon
11
11
  } from "./chunk-NKUETCDA.js";
@@ -1,9 +1,9 @@
1
- import {
2
- Icon
3
- } from "./chunk-NKUETCDA.js";
4
1
  import {
5
2
  Button
6
3
  } from "./chunk-FKMKHLQH.js";
4
+ import {
5
+ Icon
6
+ } from "./chunk-NKUETCDA.js";
7
7
  import {
8
8
  layoutGroupGap,
9
9
  layoutPaddding
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  Label
3
3
  } from "./chunk-JWCT72WR.js";
4
- import {
5
- Icon
6
- } from "./chunk-NKUETCDA.js";
7
4
  import {
8
5
  Button
9
6
  } from "./chunk-FKMKHLQH.js";
7
+ import {
8
+ Icon
9
+ } from "./chunk-NKUETCDA.js";
10
10
  import {
11
11
  baseTransition,
12
12
  componentGap,
@@ -1,9 +1,9 @@
1
- import {
2
- Icon
3
- } from "./chunk-NKUETCDA.js";
4
1
  import {
5
2
  Button
6
3
  } from "./chunk-FKMKHLQH.js";
4
+ import {
5
+ Icon
6
+ } from "./chunk-NKUETCDA.js";
7
7
  import {
8
8
  __objRest,
9
9
  __spreadProps,