@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
@@ -1,306 +0,0 @@
1
- import { useRef, useEffect, useState, useLayoutEffect } from "react";
2
- import { createPortal } from "react-dom";
3
- import { InputBaseProps, InputBase } from "./Input";
4
- import { CalendarRange } from "./CalendarRange";
5
- import { Icon } from "./Icon";
6
- import { findDocumentRoot } from "../utils";
7
- import {
8
- parseInputDate,
9
- isValidDate,
10
- formatInputValue,
11
- calculateCursorPosition,
12
- formatDate,
13
- } from "../utils/date";
14
- import { Temporal } from "@js-temporal/polyfill";
15
-
16
- type DateInputProps = Omit<InputBaseProps, "id"> & {
17
- id?: string;
18
- testid?: string;
19
- /**
20
- * Value in the format "YYYY-MM-DD" or empty string.
21
- * When enableRangeInSingleMode is true, this should be in format "YYYY-MM-DD|YYYY-MM-DD"
22
- */
23
- value: string;
24
- /**
25
- * Called when the date changes.
26
- * For single date: receives "YYYY-MM-DD"
27
- * For range: receives "YYYY-MM-DD|YYYY-MM-DD"
28
- */
29
- onChange: (value: string) => void;
30
- /**
31
- * Optional placeholder text
32
- */
33
- placeholder?: string;
34
- /**
35
- * Optional disabled state
36
- */
37
- disabled?: boolean;
38
- /**
39
- * Enable range selection in single mode calendar
40
- */
41
- readOnly?: boolean; // If true, input is read-only and cannot be focused
42
- label?: string; // Optional label for the input
43
- /**
44
- * Optional to check if a day is enabled/disabled
45
- * @param value The date to check for availability as a Temporal.PlainDate
46
- * @returns Is date enabled/disabled
47
- */
48
- isDateAvailable?: (value: Temporal.PlainDate) => boolean;
49
- };
50
-
51
- export const DateInput = ({
52
- id,
53
- testid,
54
- value,
55
- onChange,
56
- placeholder = "MM/DD/YYYY",
57
- disabled,
58
- readOnly = false,
59
- label,
60
- isDateAvailable,
61
- ...props
62
- }: DateInputProps) => {
63
- const [visible, setVisible] = useState(false);
64
- const [inputValue, setInputValue] = useState("");
65
- const [isTyping, setIsTyping] = useState(false);
66
- const popoverRef = useRef<HTMLDivElement | null>(null);
67
- const triggerRef = useRef<HTMLInputElement | null>(null);
68
- const rootRef = useRef<HTMLDivElement | null>(null);
69
- const [calendarPosition, setCalendarPosition] = useState({
70
- top: 0,
71
- left: 0,
72
- width: 0,
73
- });
74
-
75
- // Extract from and to values from the pipe-separated string when range is enabled
76
- const [from, to] = [value, ""];
77
-
78
- // Update input value when external value changes (but not when typing)
79
- useEffect(() => {
80
- if (!isTyping) {
81
- setInputValue(formatDisplayValue(from));
82
- }
83
- }, [from, isTyping]);
84
-
85
- useLayoutEffect(() => {
86
- if (visible) {
87
- updatePosition();
88
- }
89
- }, [visible]);
90
-
91
- const updatePosition = () => {
92
- if (rootRef.current) {
93
- const rect = rootRef.current.getBoundingClientRect();
94
- setCalendarPosition({
95
- top: rect.bottom + window.scrollY,
96
- left: rect.left + window.scrollX,
97
- width: rect.width,
98
- });
99
- }
100
- };
101
-
102
- useEffect(() => {
103
- updatePosition();
104
-
105
- const resizeObserver = new ResizeObserver(updatePosition);
106
- if (triggerRef.current) {
107
- resizeObserver.observe(triggerRef.current);
108
- }
109
-
110
- window.addEventListener("scroll", updatePosition);
111
-
112
- return () => {
113
- resizeObserver.disconnect();
114
- window.removeEventListener("scroll", updatePosition);
115
- };
116
- }, []);
117
-
118
- useEffect(() => {
119
- const handleKeyDown = (event: KeyboardEvent) => {
120
- if (event.key === "Escape" && popoverRef.current) {
121
- setVisible(false);
122
- triggerRef.current?.blur();
123
- }
124
- };
125
- document.addEventListener("keydown", handleKeyDown);
126
- return () => {
127
- document.removeEventListener("keydown", handleKeyDown);
128
- };
129
- });
130
-
131
- useEffect(() => {
132
- const handleClickOutside = (event: MouseEvent) => {
133
- if (
134
- popoverRef.current &&
135
- !popoverRef.current.contains(event.target as HTMLElement) &&
136
- triggerRef.current &&
137
- !triggerRef.current.contains(event.target as HTMLElement)
138
- ) {
139
- setVisible(false);
140
- }
141
- };
142
- document.addEventListener("mousedown", handleClickOutside);
143
- return () => {
144
- document.removeEventListener("mousedown", handleClickOutside);
145
- };
146
- }, []);
147
-
148
- function handleDateChange(fromValue: string) {
149
- // For single date selection, only pass the from value
150
- onChange(fromValue);
151
- setVisible(false);
152
- setIsTyping(false);
153
- }
154
-
155
- const handleFocus = () => {
156
- if (readOnly) return;
157
- setVisible(true);
158
- };
159
-
160
- const handleClick = () => {
161
- handleFocus();
162
- };
163
-
164
- const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {
165
- if (readOnly) return;
166
-
167
- const rawValue = event.target.value;
168
- const cursorPosition = event.target.selectionStart || 0;
169
- setIsTyping(true);
170
-
171
- // Format the input as user types (add slashes automatically)
172
- const formattedValue = formatInputValue(rawValue);
173
- setInputValue(formattedValue);
174
-
175
- // Restore cursor position after formatting
176
- requestAnimationFrame(() => {
177
- if (triggerRef.current) {
178
- const newPosition = calculateCursorPosition(
179
- rawValue,
180
- formattedValue,
181
- cursorPosition,
182
- );
183
- triggerRef.current.setSelectionRange(newPosition, newPosition);
184
- }
185
- });
186
-
187
- // Try to parse and validate the date
188
- const parsedDate = parseInputDate(formattedValue);
189
- if (parsedDate && isValidDate(parsedDate)) {
190
- onChange(parsedDate);
191
- }
192
- };
193
-
194
- const handleBlur = () => {
195
- setIsTyping(false);
196
- // If the input is invalid, revert to the last valid value
197
- const parsedDate = parseInputDate(inputValue);
198
- if (!parsedDate || !isValidDate(parsedDate)) {
199
- setInputValue(formatDisplayValue(from));
200
- }
201
- };
202
-
203
- const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {
204
- if (event.key === "Backspace") {
205
- const input = event.target as HTMLInputElement;
206
- const cursorPosition = input.selectionStart || 0;
207
- const value = input.value;
208
-
209
- // If cursor is right after a slash, move it before the slash
210
- if (cursorPosition > 0 && value[cursorPosition - 1] === "/") {
211
- event.preventDefault();
212
- const newValue =
213
- value.slice(0, cursorPosition - 2) + value.slice(cursorPosition);
214
- const formattedValue = formatInputValue(newValue);
215
- setInputValue(formattedValue);
216
-
217
- // Set cursor position after the deletion
218
- requestAnimationFrame(() => {
219
- if (triggerRef.current) {
220
- const newPosition = Math.max(0, cursorPosition - 2);
221
- triggerRef.current.setSelectionRange(newPosition, newPosition);
222
- }
223
- });
224
-
225
- setIsTyping(true);
226
- return;
227
- }
228
- }
229
-
230
- if (event.key === "Enter") {
231
- const parsedDate = parseInputDate(inputValue);
232
- if (parsedDate && isValidDate(parsedDate)) {
233
- onChange(parsedDate);
234
- setVisible(false);
235
- setIsTyping(false);
236
- }
237
- }
238
- };
239
-
240
- return (
241
- <div className="relative">
242
- <InputBase
243
- id={id}
244
- testid={testid}
245
- ref={(el) => {
246
- triggerRef.current = el;
247
- }}
248
- {...props}
249
- wrapperRef={rootRef}
250
- value={inputValue}
251
- placeholder={placeholder}
252
- disabled={disabled}
253
- readOnly={readOnly}
254
- after={<Icon name="calendar_month" />}
255
- onFocus={handleFocus}
256
- onClick={handleClick}
257
- onChange={handleInputChange}
258
- onBlur={handleBlur}
259
- onKeyDown={handleKeyDown}
260
- label={label}
261
- secondaryIconColor
262
- />
263
- {visible &&
264
- !readOnly &&
265
- createPortal(
266
- <div
267
- ref={(el) => {
268
- popoverRef.current = el;
269
- }}
270
- className="absolute z-40 bg-white"
271
- style={{
272
- top: `${calendarPosition.top + 4}px`,
273
- left: `${calendarPosition.left}px`,
274
- minWidth: `${calendarPosition.width}px`,
275
- }}
276
- >
277
- <CalendarRange
278
- id={id ? `${id}-calendar` : undefined}
279
- testid={testid ? `${testid}-calendar` : undefined}
280
- from={from}
281
- to={to || from}
282
- onChange={handleDateChange}
283
- cardStyle
284
- mode="single"
285
- disableRange
286
- isDateAvailable={isDateAvailable}
287
- />
288
- </div>,
289
- findDocumentRoot(popoverRef.current),
290
- )}
291
- </div>
292
- );
293
- };
294
-
295
- DateInput.displayName = "DateInput";
296
-
297
- function formatDisplayValue(from?: string): string {
298
- if (!from) {
299
- return "";
300
- }
301
- if (!isValidDate(from)) {
302
- return "";
303
- }
304
-
305
- return formatDate(from);
306
- }