@dmsi/wedgekit-react 0.0.551 → 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 (137) hide show
  1. package/package.json +2 -3
  2. package/src/brand.css +0 -125
  3. package/src/classNames.ts +0 -174
  4. package/src/components/AccessChangerTabItem.tsx +0 -71
  5. package/src/components/Accordion.tsx +0 -108
  6. package/src/components/Alert.tsx +0 -81
  7. package/src/components/Breadcrumbs.tsx +0 -142
  8. package/src/components/Button.tsx +0 -216
  9. package/src/components/CalendarRange.tsx +0 -628
  10. package/src/components/Caption.tsx +0 -144
  11. package/src/components/Card.tsx +0 -88
  12. package/src/components/Checkbox.tsx +0 -206
  13. package/src/components/CompactImagesPreview.tsx +0 -135
  14. package/src/components/ContentTab.tsx +0 -84
  15. package/src/components/ContentTabs.tsx +0 -136
  16. package/src/components/DMSiLogo.tsx +0 -33
  17. package/src/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.tsx +0 -35
  18. package/src/components/DataGrid/ColumnSelectorHeaderCell/index.tsx +0 -74
  19. package/src/components/DataGrid/PinnedColumns.tsx +0 -183
  20. package/src/components/DataGrid/TableBody/LoadingCell.tsx +0 -44
  21. package/src/components/DataGrid/TableBody/TableBodyRow.tsx +0 -157
  22. package/src/components/DataGrid/TableBody/index.tsx +0 -185
  23. package/src/components/DataGrid/index.tsx +0 -756
  24. package/src/components/DataGrid/types.ts +0 -98
  25. package/src/components/DataGrid/utils.tsx +0 -15
  26. package/src/components/DataGridCell.tsx +0 -526
  27. package/src/components/DataTable.tsx +0 -881
  28. package/src/components/DateInput.tsx +0 -306
  29. package/src/components/DateRangeInput.tsx +0 -758
  30. package/src/components/DebugJson.tsx +0 -28
  31. package/src/components/Display.tsx +0 -66
  32. package/src/components/EditingContext.tsx +0 -43
  33. package/src/components/EmptyCartIcon.tsx +0 -18
  34. package/src/components/FilterGroup.tsx +0 -264
  35. package/src/components/FullViewportBox.tsx +0 -19
  36. package/src/components/Grid.tsx +0 -97
  37. package/src/components/Heading.tsx +0 -72
  38. package/src/components/HorizontalDivider.tsx +0 -22
  39. package/src/components/Icon.tsx +0 -39
  40. package/src/components/ImagePlaceholder.tsx +0 -22
  41. package/src/components/Input.tsx +0 -609
  42. package/src/components/InputGroup.tsx +0 -59
  43. package/src/components/Label.tsx +0 -46
  44. package/src/components/Link.tsx +0 -117
  45. package/src/components/List.tsx +0 -18
  46. package/src/components/ListGroup.tsx +0 -82
  47. package/src/components/LiveChatComponent.tsx +0 -56
  48. package/src/components/LoadingScrim.tsx +0 -33
  49. package/src/components/LogoAgilityTopBar.tsx +0 -54
  50. package/src/components/LogoDMSiTopBar.tsx +0 -33
  51. package/src/components/LogoMillworkTopBar.tsx +0 -119
  52. package/src/components/MainBar.tsx +0 -91
  53. package/src/components/MaxViewportBox.tsx +0 -19
  54. package/src/components/Menu.tsx +0 -316
  55. package/src/components/MenuOption.tsx +0 -330
  56. package/src/components/MobileDataGrid/ColumnList.tsx +0 -66
  57. package/src/components/MobileDataGrid/ColumnSelector/index.tsx +0 -97
  58. package/src/components/MobileDataGrid/GridContextProvider/GridContext.tsx +0 -25
  59. package/src/components/MobileDataGrid/GridContextProvider/index.tsx +0 -132
  60. package/src/components/MobileDataGrid/GridContextProvider/useGridContext.ts +0 -10
  61. package/src/components/MobileDataGrid/MobileDataGridCard/MobileDataGridColumn.tsx +0 -27
  62. package/src/components/MobileDataGrid/MobileDataGridCard/index.tsx +0 -138
  63. package/src/components/MobileDataGrid/MobileDataGridHeader.tsx +0 -81
  64. package/src/components/MobileDataGrid/RowDetailModalProvider/ModalContent.tsx +0 -42
  65. package/src/components/MobileDataGrid/RowDetailModalProvider/index.tsx +0 -68
  66. package/src/components/MobileDataGrid/dataGridReducer.ts +0 -55
  67. package/src/components/MobileDataGrid/index.tsx +0 -92
  68. package/src/components/MobileDataGrid/types.ts +0 -4
  69. package/src/components/Modal.tsx +0 -312
  70. package/src/components/ModalButtons.tsx +0 -62
  71. package/src/components/ModalContent.tsx +0 -31
  72. package/src/components/ModalHeader.tsx +0 -78
  73. package/src/components/ModalScrim.tsx +0 -42
  74. package/src/components/NavigationTab.tsx +0 -95
  75. package/src/components/NavigationTabs.tsx +0 -70
  76. package/src/components/NestedMenu.tsx +0 -131
  77. package/src/components/Notification.tsx +0 -128
  78. package/src/components/OptionPill.tsx +0 -139
  79. package/src/components/OrderCheckIcon.tsx +0 -19
  80. package/src/components/PDFViewer/DownloadIcon.tsx +0 -25
  81. package/src/components/PDFViewer/PDFElement.tsx +0 -90
  82. package/src/components/PDFViewer/PDFNavigation.tsx +0 -68
  83. package/src/components/PDFViewer/PDFPage.tsx +0 -34
  84. package/src/components/PDFViewer/index.tsx +0 -128
  85. package/src/components/Pagination.tsx +0 -182
  86. package/src/components/Paragraph.tsx +0 -55
  87. package/src/components/Password.tsx +0 -62
  88. package/src/components/ProductImagePreview/CarouselPagination.tsx +0 -54
  89. package/src/components/ProductImagePreview/MobileImageCarousel.tsx +0 -226
  90. package/src/components/ProductImagePreview/ProductPrimaryImage.tsx +0 -219
  91. package/src/components/ProductImagePreview/Thumbnail.tsx +0 -55
  92. package/src/components/ProductImagePreview/ZoomWindow.tsx +0 -136
  93. package/src/components/ProductImagePreview/index.tsx +0 -182
  94. package/src/components/ProductImagePreview/useProductImagePreview.ts +0 -211
  95. package/src/components/ProjectBar.tsx +0 -82
  96. package/src/components/Radio.tsx +0 -146
  97. package/src/components/Search.tsx +0 -152
  98. package/src/components/SearchResultImage/index.tsx +0 -39
  99. package/src/components/Select.tsx +0 -114
  100. package/src/components/SideMenu.tsx +0 -30
  101. package/src/components/SideMenuGroup.tsx +0 -95
  102. package/src/components/SideMenuItem.tsx +0 -109
  103. package/src/components/SimpleTable.tsx +0 -77
  104. package/src/components/SkeletonParagraph.tsx +0 -31
  105. package/src/components/Spinner.tsx +0 -32
  106. package/src/components/Stack.tsx +0 -347
  107. package/src/components/StatusPill.tsx +0 -59
  108. package/src/components/Stepper.tsx +0 -128
  109. package/src/components/Subheader.tsx +0 -50
  110. package/src/components/Surface.tsx +0 -37
  111. package/src/components/Swatch.tsx +0 -1341
  112. package/src/components/Textarea.tsx +0 -102
  113. package/src/components/Theme.tsx +0 -27
  114. package/src/components/Time.tsx +0 -460
  115. package/src/components/Toast.tsx +0 -268
  116. package/src/components/Tooltip.tsx +0 -159
  117. package/src/components/TopBar.tsx +0 -139
  118. package/src/components/Upload.tsx +0 -107
  119. package/src/components/WorldpayIframe.tsx +0 -7
  120. package/src/components/index.ts +0 -34
  121. package/src/components/useMenuSystem.tsx +0 -456
  122. package/src/components/useMounted.tsx +0 -14
  123. package/src/darkmode.css +0 -278
  124. package/src/fonts.css +0 -23
  125. package/src/hooks/index.ts +0 -4
  126. package/src/hooks/useInfiniteScroll.tsx +0 -40
  127. package/src/hooks/useKeydown.ts +0 -42
  128. package/src/hooks/useMatchesMedia.ts +0 -18
  129. package/src/hooks/useTableLayout.ts +0 -106
  130. package/src/index.css +0 -800
  131. package/src/index.tsx +0 -5
  132. package/src/types.ts +0 -150
  133. package/src/utils/date.ts +0 -236
  134. package/src/utils/formatting.tsx +0 -81
  135. package/src/utils/index.ts +0 -4
  136. package/src/utils/mergeObjectArrays.ts +0 -18
  137. package/src/utils.ts +0 -24
@@ -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
- }