@dmsi/wedgekit-react 0.0.550 → 0.0.552

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 (180) hide show
  1. package/dist/{chunk-U3QGZAVS.js → chunk-JADOJNBI.js} +4 -4
  2. package/dist/{chunk-N2KPADIL.js → chunk-WNGFRQ4Y.js} +7 -7
  3. package/dist/{chunk-ZVY3TLXL.js → chunk-ZIPJMN2E.js} +4 -4
  4. package/dist/components/Alert.js +2 -2
  5. package/dist/components/CalendarRange.js +10 -10
  6. package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.js +10 -10
  7. package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.js +10 -10
  8. package/dist/components/DataGrid/PinnedColumns.js +10 -10
  9. package/dist/components/DataGrid/TableBody/LoadingCell.js +10 -10
  10. package/dist/components/DataGrid/TableBody/TableBodyRow.js +10 -10
  11. package/dist/components/DataGrid/TableBody/index.js +10 -10
  12. package/dist/components/DataGrid/index.js +10 -10
  13. package/dist/components/DataGrid/utils.js +10 -10
  14. package/dist/components/DateInput.js +10 -10
  15. package/dist/components/DateRangeInput.js +10 -10
  16. package/dist/components/FilterGroup.js +5 -5
  17. package/dist/components/MobileDataGrid/ColumnSelector/index.js +10 -10
  18. package/dist/components/MobileDataGrid/MobileDataGridHeader.js +10 -10
  19. package/dist/components/MobileDataGrid/RowDetailModalProvider/index.js +5 -5
  20. package/dist/components/MobileDataGrid/index.js +10 -10
  21. package/dist/components/Modal.js +4 -4
  22. package/dist/components/ModalButtons.js +2 -2
  23. package/dist/components/ModalHeader.js +2 -2
  24. package/dist/components/NavigationTab.js +2 -2
  25. package/dist/components/NavigationTabs.js +2 -2
  26. package/dist/components/NestedMenu.js +3 -3
  27. package/dist/components/Notification.js +3 -3
  28. package/dist/components/OptionPill.js +2 -2
  29. package/dist/components/PDFViewer/DownloadIcon.js +2 -2
  30. package/dist/components/PDFViewer/PDFNavigation.js +2 -2
  31. package/dist/components/PDFViewer/index.js +6 -6
  32. package/dist/components/ProductImagePreview/index.js +1 -1
  33. package/dist/components/Stepper.js +3 -3
  34. package/dist/components/Toast.js +3 -3
  35. package/dist/components/Upload.js +3 -3
  36. package/dist/components/index.js +16 -16
  37. package/package.json +8 -9
  38. package/src/brand.css +0 -125
  39. package/src/classNames.ts +0 -174
  40. package/src/components/AccessChangerTabItem.tsx +0 -71
  41. package/src/components/Accordion.tsx +0 -108
  42. package/src/components/Alert.tsx +0 -81
  43. package/src/components/Breadcrumbs.tsx +0 -142
  44. package/src/components/Button.tsx +0 -216
  45. package/src/components/CalendarRange.tsx +0 -628
  46. package/src/components/Caption.tsx +0 -144
  47. package/src/components/Card.tsx +0 -88
  48. package/src/components/Checkbox.tsx +0 -206
  49. package/src/components/CompactImagesPreview.tsx +0 -135
  50. package/src/components/ContentTab.tsx +0 -84
  51. package/src/components/ContentTabs.tsx +0 -136
  52. package/src/components/DMSiLogo.tsx +0 -33
  53. package/src/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.tsx +0 -35
  54. package/src/components/DataGrid/ColumnSelectorHeaderCell/index.tsx +0 -74
  55. package/src/components/DataGrid/PinnedColumns.tsx +0 -183
  56. package/src/components/DataGrid/TableBody/LoadingCell.tsx +0 -44
  57. package/src/components/DataGrid/TableBody/TableBodyRow.tsx +0 -157
  58. package/src/components/DataGrid/TableBody/index.tsx +0 -185
  59. package/src/components/DataGrid/index.tsx +0 -756
  60. package/src/components/DataGrid/types.ts +0 -98
  61. package/src/components/DataGrid/utils.tsx +0 -15
  62. package/src/components/DataGridCell.tsx +0 -526
  63. package/src/components/DataTable.tsx +0 -881
  64. package/src/components/DateInput.tsx +0 -306
  65. package/src/components/DateRangeInput.tsx +0 -758
  66. package/src/components/DebugJson.tsx +0 -28
  67. package/src/components/Display.tsx +0 -66
  68. package/src/components/EditingContext.tsx +0 -43
  69. package/src/components/EmptyCartIcon.tsx +0 -18
  70. package/src/components/FilterGroup.tsx +0 -264
  71. package/src/components/FullViewportBox.tsx +0 -19
  72. package/src/components/Grid.tsx +0 -97
  73. package/src/components/Heading.tsx +0 -72
  74. package/src/components/HorizontalDivider.tsx +0 -22
  75. package/src/components/Icon.tsx +0 -39
  76. package/src/components/ImagePlaceholder.tsx +0 -22
  77. package/src/components/Input.tsx +0 -609
  78. package/src/components/InputGroup.tsx +0 -59
  79. package/src/components/Label.tsx +0 -46
  80. package/src/components/Link.tsx +0 -117
  81. package/src/components/List.tsx +0 -18
  82. package/src/components/ListGroup.tsx +0 -82
  83. package/src/components/LiveChatComponent.tsx +0 -56
  84. package/src/components/LoadingScrim.tsx +0 -33
  85. package/src/components/LogoAgilityTopBar.tsx +0 -54
  86. package/src/components/LogoDMSiTopBar.tsx +0 -33
  87. package/src/components/LogoMillworkTopBar.tsx +0 -119
  88. package/src/components/MainBar.tsx +0 -91
  89. package/src/components/MaxViewportBox.tsx +0 -19
  90. package/src/components/Menu.tsx +0 -316
  91. package/src/components/MenuOption.tsx +0 -330
  92. package/src/components/MobileDataGrid/ColumnList.tsx +0 -66
  93. package/src/components/MobileDataGrid/ColumnSelector/index.tsx +0 -97
  94. package/src/components/MobileDataGrid/GridContextProvider/GridContext.tsx +0 -25
  95. package/src/components/MobileDataGrid/GridContextProvider/index.tsx +0 -132
  96. package/src/components/MobileDataGrid/GridContextProvider/useGridContext.ts +0 -10
  97. package/src/components/MobileDataGrid/MobileDataGridCard/MobileDataGridColumn.tsx +0 -27
  98. package/src/components/MobileDataGrid/MobileDataGridCard/index.tsx +0 -138
  99. package/src/components/MobileDataGrid/MobileDataGridHeader.tsx +0 -81
  100. package/src/components/MobileDataGrid/RowDetailModalProvider/ModalContent.tsx +0 -42
  101. package/src/components/MobileDataGrid/RowDetailModalProvider/index.tsx +0 -68
  102. package/src/components/MobileDataGrid/dataGridReducer.ts +0 -55
  103. package/src/components/MobileDataGrid/index.tsx +0 -92
  104. package/src/components/MobileDataGrid/types.ts +0 -4
  105. package/src/components/Modal.tsx +0 -312
  106. package/src/components/ModalButtons.tsx +0 -62
  107. package/src/components/ModalContent.tsx +0 -31
  108. package/src/components/ModalHeader.tsx +0 -78
  109. package/src/components/ModalScrim.tsx +0 -42
  110. package/src/components/NavigationTab.tsx +0 -95
  111. package/src/components/NavigationTabs.tsx +0 -70
  112. package/src/components/NestedMenu.tsx +0 -131
  113. package/src/components/Notification.tsx +0 -128
  114. package/src/components/OptionPill.tsx +0 -139
  115. package/src/components/OrderCheckIcon.tsx +0 -19
  116. package/src/components/PDFViewer/DownloadIcon.tsx +0 -25
  117. package/src/components/PDFViewer/PDFElement.tsx +0 -90
  118. package/src/components/PDFViewer/PDFNavigation.tsx +0 -68
  119. package/src/components/PDFViewer/PDFPage.tsx +0 -34
  120. package/src/components/PDFViewer/index.tsx +0 -128
  121. package/src/components/Pagination.tsx +0 -182
  122. package/src/components/Paragraph.tsx +0 -55
  123. package/src/components/Password.tsx +0 -62
  124. package/src/components/ProductImagePreview/CarouselPagination.tsx +0 -54
  125. package/src/components/ProductImagePreview/MobileImageCarousel.tsx +0 -226
  126. package/src/components/ProductImagePreview/ProductPrimaryImage.tsx +0 -219
  127. package/src/components/ProductImagePreview/Thumbnail.tsx +0 -55
  128. package/src/components/ProductImagePreview/ZoomWindow.tsx +0 -136
  129. package/src/components/ProductImagePreview/index.tsx +0 -182
  130. package/src/components/ProductImagePreview/useProductImagePreview.ts +0 -211
  131. package/src/components/ProjectBar.tsx +0 -82
  132. package/src/components/Radio.tsx +0 -146
  133. package/src/components/Search.tsx +0 -152
  134. package/src/components/SearchResultImage/index.tsx +0 -39
  135. package/src/components/Select.tsx +0 -114
  136. package/src/components/SideMenu.tsx +0 -30
  137. package/src/components/SideMenuGroup.tsx +0 -95
  138. package/src/components/SideMenuItem.tsx +0 -109
  139. package/src/components/SimpleTable.tsx +0 -77
  140. package/src/components/SkeletonParagraph.tsx +0 -31
  141. package/src/components/Spinner.tsx +0 -32
  142. package/src/components/Stack.tsx +0 -347
  143. package/src/components/StatusPill.tsx +0 -59
  144. package/src/components/Stepper.tsx +0 -128
  145. package/src/components/Subheader.tsx +0 -50
  146. package/src/components/Surface.tsx +0 -37
  147. package/src/components/Swatch.tsx +0 -1341
  148. package/src/components/Textarea.tsx +0 -102
  149. package/src/components/Theme.tsx +0 -27
  150. package/src/components/Time.tsx +0 -460
  151. package/src/components/Toast.tsx +0 -268
  152. package/src/components/Tooltip.tsx +0 -159
  153. package/src/components/TopBar.tsx +0 -139
  154. package/src/components/Upload.tsx +0 -107
  155. package/src/components/WorldpayIframe.tsx +0 -7
  156. package/src/components/index.ts +0 -34
  157. package/src/components/useMenuSystem.tsx +0 -456
  158. package/src/components/useMounted.tsx +0 -14
  159. package/src/darkmode.css +0 -278
  160. package/src/fonts.css +0 -23
  161. package/src/hooks/index.ts +0 -4
  162. package/src/hooks/useInfiniteScroll.tsx +0 -40
  163. package/src/hooks/useKeydown.ts +0 -42
  164. package/src/hooks/useMatchesMedia.ts +0 -18
  165. package/src/hooks/useTableLayout.ts +0 -106
  166. package/src/index.css +0 -800
  167. package/src/index.tsx +0 -5
  168. package/src/types.ts +0 -150
  169. package/src/utils/date.ts +0 -236
  170. package/src/utils/formatting.tsx +0 -81
  171. package/src/utils/index.ts +0 -4
  172. package/src/utils/mergeObjectArrays.ts +0 -18
  173. package/src/utils.ts +0 -24
  174. package/dist/{chunk-7FQ7PGUF.js → chunk-7COWXCPA.js} +3 -3
  175. package/dist/{chunk-NKCFYM7A.js → chunk-7SFFUICM.js} +3 -3
  176. package/dist/{chunk-25RZP3VR.js → chunk-AKJUBFJK.js} +3 -3
  177. package/dist/{chunk-TAPYQBQU.js → chunk-CMMQTIVM.js} +3 -3
  178. package/dist/{chunk-GYEXSNFP.js → chunk-FWCVZWE6.js} +3 -3
  179. package/dist/{chunk-MV6W7OMC.js → chunk-QMMPHXVE.js} +3 -3
  180. package/dist/{chunk-GG5OZTI5.js → chunk-XRE52QTN.js} +3 -3
package/src/index.tsx DELETED
@@ -1,5 +0,0 @@
1
- import "./fonts.css";
2
- import "./index.css";
3
- import NoResultsImg from "../static/no-results-image.png";
4
-
5
- export { NoResultsImg };
package/src/types.ts DELETED
@@ -1,150 +0,0 @@
1
- import React, { ComponentPropsWithoutRef } from "react";
2
-
3
- export type IconSize = 16 | 24 | 32;
4
-
5
- export type ValidTags<T = keyof React.ElementType> = Extract<
6
- React.ElementType,
7
- T | React.JSXElementConstructor<unknown>
8
- >;
9
-
10
- export type AsProps<
11
- T extends React.ElementType = React.ElementType,
12
- K extends ValidTags<T> = ValidTags<T>,
13
- > = K extends React.ElementType
14
- ? { as?: K } & ComponentPropsWithoutRef<K>
15
- : never;
16
-
17
- export type Elevation = 0 | 2 | 4 | 16;
18
-
19
- export type Sizing =
20
- | "layout"
21
- | "layout-group"
22
- | "container"
23
- | "component"
24
- | "none";
25
- export type TextAlign = "left" | "right" | "center";
26
- export type ItemsAlign = "start" | "center" | "end" | "start-center";
27
- export type JustifyAlign = "start" | "center" | "end" | "between" | "around";
28
-
29
- export type TextColorTokens =
30
- | "text-primary-normal"
31
- | "text-primary-disabled"
32
- | "text-primary-error"
33
- | "text-secondary-normal"
34
- | "text-secondary-disabled"
35
- | "text-secondary-error"
36
- | "text-action-normal"
37
- | "text-action-hover"
38
- | "text-action-active"
39
- | "text-action-disabled"
40
- | "text-on-action-primary-normal"
41
- | "text-on-action-primary-hover"
42
- | "text-on-action-primary-active"
43
- | "text-on-action-primary-disabled"
44
- | "text-action-critical-normal"
45
- | "text-action-critical-hover"
46
- | "text-action-critical-active"
47
- | "text-action-critical-disabled"
48
- | "text-critical-normal"
49
- | "text-critical-disabled"
50
- | "text-critical-error"
51
- | "text-success-normal"
52
- | "text-warning-normal";
53
-
54
- export type BorderColorTokens =
55
- | "border-primary-normal"
56
- | "border-primary-focus"
57
- | "border-primary-error"
58
- | "border-primary-normal"
59
- | "border-action-normal"
60
- | "border-action-hover"
61
- | "border-action-active"
62
- | "border-action-disabled"
63
- | "border-action-critical-normal"
64
- | "border-action-critical-hover"
65
- | "border-action-critical-active"
66
- | "border-action-critical-disabled";
67
-
68
- export type IconColorTokens =
69
- | "icon-primary-normal"
70
- | "icon-primary-disabled"
71
- | "icon-success-normal"
72
- | "icon-success-disabled"
73
- | "icon-warning-normal"
74
- | "icon-warning-disabled"
75
- | "icon-critical-normal"
76
- | "icon-critical-disabled"
77
- | "icon-action-primary-normal"
78
- | "icon-action-primary-hover"
79
- | "icon-action-primary-active"
80
- | "icon-action-primary-disabled"
81
- | "icon-on-action-primary-normal"
82
- | "icon-on-action-primary-hover"
83
- | "icon-on-action-primary-active"
84
- | "icon-on-action-primary-disabled"
85
- | "icon-on-action-secondary-normal"
86
- | "icon-on-action-secondary-hover"
87
- | "icon-on-action-secondary-active"
88
- | "icon-on-action-secondary-disabled"
89
- | "icon-action-critical-secondary-normal"
90
- | "icon-action-critical-secondary-hover"
91
- | "icon-action-critical-secondary-active"
92
- | "icon-action-critical-secondary-disabled"
93
- | "icon-brand-primary-normal"
94
- | "icon-brand-primary-hover"
95
- | "icon-brand-primary-active"
96
- | "icon-brand-primary-disabled";
97
-
98
- export type BackgroundColorTokens =
99
- | "background-primary-normal"
100
- | "background-grouped-primary-normal"
101
- | "background-secondary-normal"
102
- | "background-grouped-secondary-normal"
103
- | "background-success-normal"
104
- | "background-warning-normal"
105
- | "background-critical-normal"
106
- | "background-action-normal"
107
- | "background-action-hover"
108
- | "background-action-active"
109
- | "background-action-disabled"
110
- | "background-action-critical-normal"
111
- | "background-action-critical-hover"
112
- | "background-action-critical-active"
113
- | "background-action-critical-disabled"
114
- | "background-action-primary-normal"
115
- | "background-action-primary-hover"
116
- | "background-action-primary-active"
117
- | "background-action-primary-disabled"
118
- | "background-action-secondary-normal"
119
- | "background-action-secondary-hover"
120
- | "background-action-secondary-active"
121
- | "background-action-secondary-disabled"
122
- | "background-action-critical-primary-normal"
123
- | "background-action-critical-primary-hover"
124
- | "background-action-critical-primary-active"
125
- | "background-action-critical-primary-disabled"
126
- | "background-action-critical-secondary-normal"
127
- | "background-action-critical-secondary-hover"
128
- | "background-action-critical-secondary-active"
129
- | "background-action-critical-secondary-disabled"
130
- | "background-brand-normal";
131
-
132
- export type TextAttributes = {
133
- color?: TextColorTokens;
134
- align?: TextAlign;
135
- tall?: boolean;
136
- padded?: boolean;
137
- addOverflow?: boolean;
138
- };
139
-
140
- export type TypographyProps = {
141
- className?: string;
142
- children?: React.ReactNode;
143
- color?: string;
144
- };
145
-
146
- declare module "react" {
147
- interface CSSProperties {
148
- [key: `--${string}`]: string | number;
149
- }
150
- }
package/src/utils/date.ts DELETED
@@ -1,236 +0,0 @@
1
- /**
2
- * Shared date utility functions for DateInput and DateRangeInput components
3
- */
4
-
5
- /**
6
- * Parse MM/DD/YYYY format to YYYY-MM-DD format
7
- */
8
- export function parseInputDate(input: string): string | null {
9
- const match = input.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);
10
- if (!match) {
11
- return null;
12
- }
13
-
14
- const [, month, day, year] = match;
15
-
16
- // Pad with zeros if necessary
17
- const paddedMonth = month.padStart(2, "0");
18
- const paddedDay = day.padStart(2, "0");
19
-
20
- return `${year}-${paddedMonth}-${paddedDay}`;
21
- }
22
-
23
- /**
24
- * Validate if a date string is a valid date
25
- */
26
- export function isValidDate(dateString: string): boolean {
27
- const date = new Date(dateString);
28
- return (
29
- date instanceof Date &&
30
- !isNaN(date.getTime()) &&
31
- dateString === date.toISOString().split("T")[0]
32
- );
33
- }
34
-
35
- /**
36
- * Format input value with slashes (MM/DD/YYYY)
37
- */
38
- export function formatInputValue(value: string): string {
39
- // Remove all non-digits
40
- const digits = value.replace(/\D/g, "");
41
-
42
- // Return digits as-is if less than 2
43
- if (digits.length < 2) {
44
- return digits;
45
- }
46
-
47
- // Format with full MM/DD/YYYY pattern if 4 or more digits
48
- if (digits.length >= 4) {
49
- return `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, 8)}`;
50
- }
51
-
52
- // Format with MM/DD pattern for 2-3 digits
53
- return `${digits.slice(0, 2)}/${digits.slice(2)}`;
54
- }
55
-
56
- /**
57
- * Check if character is a digit
58
- */
59
- export function isDigit(character: string): boolean {
60
- return /\d/.test(character);
61
- }
62
-
63
- /**
64
- * Check if character is a slash
65
- */
66
- export function isSlash(character: string): boolean {
67
- return character === "/";
68
- }
69
-
70
- /**
71
- * Count digits up to cursor position
72
- */
73
- export function countDigitsUpToCursor(
74
- value: string,
75
- cursorPosition: number,
76
- ): number {
77
- let digitCount = 0;
78
-
79
- for (let i = 0; i < cursorPosition && i < value.length; i++) {
80
- if (!isDigit(value[i])) {
81
- continue;
82
- }
83
-
84
- digitCount++;
85
- }
86
-
87
- return digitCount;
88
- }
89
-
90
- /**
91
- * Find position after specific digit count
92
- */
93
- export function findPositionAfterDigitCount(
94
- formattedValue: string,
95
- targetDigitCount: number,
96
- ): number {
97
- let currentDigitCount = 0;
98
-
99
- for (let i = 0; i < formattedValue.length; i++) {
100
- if (!isDigit(formattedValue[i])) {
101
- continue;
102
- }
103
-
104
- currentDigitCount++;
105
-
106
- if (currentDigitCount !== targetDigitCount) {
107
- continue;
108
- }
109
-
110
- const positionAfterDigit = i + 1;
111
- const nextCharacter = formattedValue[positionAfterDigit];
112
-
113
- // Place cursor after slash if it follows the target digit
114
- if (nextCharacter && isSlash(nextCharacter)) {
115
- return positionAfterDigit + 1;
116
- }
117
-
118
- return positionAfterDigit;
119
- }
120
-
121
- return formattedValue.length;
122
- }
123
-
124
- /**
125
- * Calculate cursor position after formatting
126
- */
127
- export function calculateCursorPosition(
128
- originalValue: string,
129
- formattedValue: string,
130
- originalPosition: number,
131
- ): number {
132
- const targetDigitCount = countDigitsUpToCursor(
133
- originalValue,
134
- originalPosition,
135
- );
136
- const newPosition = findPositionAfterDigitCount(
137
- formattedValue,
138
- targetDigitCount,
139
- );
140
-
141
- return Math.min(newPosition, formattedValue.length);
142
- }
143
-
144
- /**
145
- * Parse date parts from YYYY-MM-DD format
146
- */
147
- export function parseDateParts(
148
- dateString: string,
149
- ): { year: number; month: number; day: number } | null {
150
- const [yearStr, monthStr, dayStr] = dateString.split("-");
151
-
152
- if (!yearStr || !monthStr || !dayStr) {
153
- return null;
154
- }
155
-
156
- const year = parseInt(yearStr, 10);
157
- const month = parseInt(monthStr, 10);
158
- const day = parseInt(dayStr, 10);
159
-
160
- if (isNaN(year) || isNaN(month) || isNaN(day)) {
161
- return null;
162
- }
163
-
164
- return { year, month, day };
165
- }
166
-
167
- /**
168
- * Check if date range is valid (month 1-12, day 1-31)
169
- */
170
- export function isValidDateRange(month: number, day: number): boolean {
171
- if (month < 1 || month > 12) {
172
- return false;
173
- }
174
- if (day < 1 || day > 31) {
175
- return false;
176
- }
177
- return true;
178
- }
179
-
180
- /**
181
- * Format date parts to display format (MM/DD/YYYY)
182
- */
183
- export function formatDatePartsToDisplay(
184
- year: number,
185
- month: number,
186
- day: number,
187
- ): string {
188
- const paddedMonth = month.toString().padStart(2, "0");
189
- const paddedDay = day.toString().padStart(2, "0");
190
-
191
- return `${paddedMonth}/${paddedDay}/${year}`;
192
- }
193
-
194
- /**
195
- * Format date string to display format
196
- */
197
- export function formatDate(date: string): string {
198
- if (!date) {
199
- return "";
200
- }
201
-
202
- try {
203
- const dateParts = parseDateParts(date);
204
- if (!dateParts) {
205
- return "";
206
- }
207
-
208
- const { year, month, day } = dateParts;
209
-
210
- if (!isValidDateRange(month, day)) {
211
- return "";
212
- }
213
-
214
- return formatDatePartsToDisplay(year, month, day);
215
- } catch (error) {
216
- console.error("Error formatting date:", error);
217
- return "";
218
- }
219
- }
220
-
221
- /**
222
- * Validate if date range is valid (to >= from)
223
- */
224
- export function isValidDateRangeOrder(
225
- fromDate: string,
226
- toDate: string,
227
- ): boolean {
228
- if (!fromDate || !toDate || !isValidDate(fromDate) || !isValidDate(toDate)) {
229
- return false;
230
- }
231
-
232
- // Check if 'to' date is not earlier than 'from' date
233
- const from = new Date(fromDate);
234
- const to = new Date(toDate);
235
- return to >= from;
236
- }
@@ -1,81 +0,0 @@
1
- /**
2
- * Utility functions for input formatting and value processing
3
- */
4
-
5
- /**
6
- * Generates placeholder text for decimal inputs based on the number of decimal places
7
- * @param decimals - Number of decimal places to display
8
- * @returns Object with placeholder property or empty object if no decimals
9
- * @example
10
- * getDecimalPlaceholder(2) // returns { placeholder: "0.00" }
11
- * getDecimalPlaceholder(0) // returns {}
12
- */
13
- export function getDecimalPlaceholder(decimals: number | undefined): {
14
- placeholder?: string;
15
- } {
16
- if (!decimals || decimals <= 0) {
17
- return {};
18
- }
19
-
20
- return {
21
- placeholder: `0.${"0".repeat(decimals)}`,
22
- };
23
- }
24
-
25
- /**
26
- * Formats a numeric value to a string with specified decimal places
27
- * @param value - The value to format (string or number)
28
- * @param decimals - Number of decimal places to format to
29
- * @returns Formatted string value
30
- * @example
31
- * formatDecimalValue("123.456", 2) // returns "123.46"
32
- * formatDecimalValue(123, 0) // returns "123"
33
- * formatDecimalValue("", 2) // returns ""
34
- */
35
- export function formatDecimalValue(
36
- value: string | number | undefined,
37
- decimals: number | undefined,
38
- ): string {
39
- if (!value || value === "") {
40
- return "";
41
- }
42
-
43
- const numValue = typeof value === "string" ? parseFloat(value) : value;
44
-
45
- if (isNaN(numValue)) {
46
- return "";
47
- }
48
-
49
- if (!decimals || decimals <= 0) {
50
- return String(Math.round(numValue));
51
- }
52
-
53
- return numValue.toFixed(decimals);
54
- }
55
-
56
- /**
57
- * Formats a numeric string for currency display by adding thousand separators
58
- * @param value - The numeric string to format
59
- * @returns Formatted string with thousand separators
60
- * @example
61
- * formatCurrencyDisplay("1234.56") // returns "1,234.56"
62
- * formatCurrencyDisplay("1000") // returns "1,000"
63
- * formatCurrencyDisplay("") // returns ""
64
- */
65
- export function formatCurrencyDisplay(value: string): string {
66
- if (!value || value === "") {
67
- return "";
68
- }
69
-
70
- const parts = value.split(".");
71
- const integerPart = parts[0];
72
- const decimalPart = parts[1];
73
-
74
- // Add thousand separators to the integer part
75
- const formattedInteger = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
76
-
77
- // Combine with decimal part if it exists
78
- return decimalPart !== undefined
79
- ? `${formattedInteger}.${decimalPart}`
80
- : formattedInteger;
81
- }
@@ -1,4 +0,0 @@
1
- export * from "./formatting";
2
- export * from "./date";
3
- export { mergeObjectArrays } from "./mergeObjectArrays";
4
- export const LocalStoragePrefixVersion = `dmsi-acc-v1.1.0`;
@@ -1,18 +0,0 @@
1
- /**
2
- * Merges two arrays of objects element-wise.
3
- *
4
- * @template T The type of the objects in the arrays.
5
- * @param {T[]} arr1 The first array.
6
- * @param {T[]} arr2 The second array.
7
- * @returns {T[]} A new array containing the merged objects.
8
- */
9
- export function mergeObjectArrays<T extends object>(arr1: T[], arr2: T[]): T[] {
10
- const maxLength = Math.max(arr1.length, arr2.length);
11
-
12
- // Create a new array with a length equal to the longer of the two arrays.
13
- // For each index, merge the objects from arr1 and arr2.
14
- return Array.from(
15
- { length: maxLength },
16
- (_, i) => ({ ...(arr1[i] || {}), ...(arr2[i] || {}) }) as T,
17
- );
18
- }
package/src/utils.ts DELETED
@@ -1,24 +0,0 @@
1
- export function findDocumentRoot(
2
- element: Node | undefined | null,
3
- ): Element | DocumentFragment {
4
- if (typeof window === "undefined" || typeof document === "undefined") {
5
- throw new Error(
6
- "findDocumentRoot can only be used in a browser environment.",
7
- );
8
- }
9
- if (!element || !(element instanceof Node)) {
10
- return window.document.body;
11
- }
12
- let currentElement = element;
13
- while (currentElement && currentElement.parentNode) {
14
- if (currentElement.parentNode === document) {
15
- return document.body;
16
- } else if (currentElement.parentNode instanceof DocumentFragment) {
17
- return currentElement.parentNode;
18
- } else {
19
- currentElement = currentElement.parentNode;
20
- }
21
- }
22
- return window.document.body;
23
- }
24
- export * from "./utils/index";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  Tooltip
3
3
  } from "./chunk-MDB26F6T.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
 
11
11
  // src/components/PDFViewer/DownloadIcon.tsx
12
12
  import { jsx } from "react/jsx-runtime";
@@ -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,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
  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";