@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,268 +0,0 @@
1
- "use client";
2
-
3
- import clsx from "clsx";
4
- import { useEffect, useRef, useState } from "react";
5
- import { Heading3 } from "./Heading";
6
- import { Paragraph } from "./Paragraph";
7
- import { Icon } from "./Icon";
8
- import { Button } from "./Button";
9
- import { createRoot } from "react-dom/client";
10
- import { componentGap, componentPadding, layoutGroupGap } from "../classNames";
11
-
12
- export interface ToastProps {
13
- id?: string;
14
- testid?: string;
15
- variant?: "success" | "warning" | "error" | "info";
16
- title?: string;
17
- message?: string;
18
- show?: boolean;
19
- showToast?: boolean; // deprecated but still supported
20
- onClose?: () => void;
21
- viewButtonLink?: string;
22
- showViewButton?: boolean;
23
- style?: React.CSSProperties;
24
- }
25
-
26
- // Shared variant styles
27
- const variants = {
28
- success: {
29
- className: "border-success-400",
30
- icon: (
31
- <span className="text-icon-success-normal contents">
32
- <Icon name="check_circle" size={24} />
33
- </span>
34
- ),
35
- },
36
- warning: {
37
- className: "border-warning-400",
38
- icon: (
39
- <span className="text-icon-warning-normal contents">
40
- <Icon name="warning" size={24} />
41
- </span>
42
- ),
43
- },
44
- error: {
45
- className: "border-critical-400",
46
- icon: (
47
- <span className="text-icon-critical-normal contents">
48
- <Icon name="error" size={24} />
49
- </span>
50
- ),
51
- },
52
- info: {
53
- className: "border-action-400",
54
- icon: (
55
- <span className="text-icon-on-action-secondary-normal contents">
56
- <Icon name="info" size={24} />
57
- </span>
58
- ),
59
- },
60
- };
61
-
62
- // Animation utility
63
- const slideInFromBottomAnimation = (
64
- element: HTMLElement,
65
- displayDuration = 8000,
66
- inDuration = 50,
67
- outDuration = 50,
68
- ) => {
69
- const totalDuration = inDuration + displayDuration + outDuration;
70
- const rect = element.getBoundingClientRect();
71
- const slideDistance = window.innerHeight - rect.bottom + 16; // 16px for padding
72
-
73
- return element.animate(
74
- [
75
- {
76
- opacity: 0,
77
- transform: `translateY(${slideDistance}px)`,
78
- offset: 0,
79
- },
80
- {
81
- opacity: 1,
82
- transform: "translateY(0)",
83
- offset: inDuration / totalDuration,
84
- },
85
- {
86
- opacity: 1,
87
- transform: "translateY(0)",
88
- offset: (inDuration + displayDuration) / totalDuration,
89
- },
90
- {
91
- opacity: 0,
92
- transform: `translateY(${slideDistance}px)`,
93
- offset: 1,
94
- },
95
- ],
96
- {
97
- duration: totalDuration,
98
- easing: "cubic-bezier(0.4, 0, 0.2, 1)",
99
- fill: "both",
100
- },
101
- );
102
- };
103
-
104
- // Get or create the shared toast root container
105
- const TOAST_ROOT_ID = "toast-root";
106
- function getToastRoot(): HTMLElement {
107
- let root = document.getElementById(TOAST_ROOT_ID);
108
- if (!root) {
109
- root = document.createElement("div");
110
- root.id = TOAST_ROOT_ID;
111
- root.className =
112
- "fixed bottom-6 right-6 z-50 flex flex-col items-end gap-4 pointer-events-none";
113
- document.body.appendChild(root);
114
- }
115
- return root;
116
- }
117
-
118
- export const Toast = ({
119
- id,
120
- testid,
121
- variant = "success",
122
- title,
123
- message,
124
- show = false,
125
- showToast = false, // deprecated
126
- onClose,
127
- viewButtonLink,
128
- showViewButton = false,
129
- ...props
130
- }: ToastProps) => {
131
- const toastElementRef = useRef<HTMLDivElement>(null);
132
- const animationRef = useRef<Animation | null>(null);
133
- const [isHovered, setIsHovered] = useState(false);
134
-
135
- useEffect(() => {
136
- if (show && !showToast) {
137
- if (toastElementRef.current) {
138
- const animation = slideInFromBottomAnimation(toastElementRef.current);
139
- animationRef.current = animation;
140
-
141
- animation.onfinish = () => {
142
- onClose?.();
143
- };
144
- }
145
- return () => {
146
- if (animationRef.current) {
147
- animationRef.current.cancel();
148
- }
149
- };
150
- }
151
- }, [show, showToast, onClose]);
152
-
153
- useEffect(() => {
154
- if (animationRef.current) {
155
- if (isHovered) {
156
- animationRef.current.pause();
157
- } else {
158
- animationRef.current.play();
159
- }
160
- }
161
- }, [isHovered]);
162
-
163
- useEffect(() => {
164
- const handleAnimationEnd = () => {
165
- if (!isHovered) {
166
- onClose?.();
167
- }
168
- };
169
-
170
- if (animationRef.current) {
171
- animationRef.current.addEventListener("finish", handleAnimationEnd);
172
- return () => {
173
- if (animationRef.current) {
174
- animationRef.current.removeEventListener(
175
- "finish",
176
- handleAnimationEnd,
177
- );
178
- }
179
- };
180
- }
181
- }, [isHovered, onClose]);
182
-
183
- const handleMouseEnter = () => setIsHovered(true);
184
- const handleMouseLeave = () => {
185
- setIsHovered(false);
186
- // Resume animation when mouse leaves
187
- if (animationRef.current && animationRef.current.playState === "paused") {
188
- animationRef.current.play();
189
- }
190
- };
191
-
192
- const { className, icon: iconElement } =
193
- variants[variant] ?? variants.success;
194
-
195
- if (!show) return null;
196
-
197
- return (
198
- <div
199
- id={id}
200
- data-testid={testid}
201
- ref={toastElementRef}
202
- onMouseEnter={handleMouseEnter}
203
- onMouseLeave={handleMouseLeave}
204
- className={clsx(
205
- "flex items-start border-2 rounded-sm bg-white shadow-md cursor-pointer pointer-events-auto transition-all duration-300 ease-in-out w-fit",
206
- componentPadding,
207
- layoutGroupGap,
208
- className,
209
- )}
210
- {...props}
211
- style={props.style}
212
- >
213
- {iconElement}
214
- <div className={clsx("flex items-center", layoutGroupGap)}>
215
- <div className={clsx("flex flex-col w-68", componentGap)}>
216
- {title && (
217
- <Heading3 testid={testid ? `${testid}-title` : undefined} id={id ? `${id}-title` : undefined}>{title}</Heading3>
218
- )}
219
- {message && (
220
- <Paragraph testid={testid ? `${testid}-message` : undefined} id={id ? `${id}-message` : undefined}>
221
- {message}
222
- </Paragraph>
223
- )}
224
- </div>
225
-
226
- {showViewButton && (
227
- <Button
228
- id={id ? `${id}-view-button` : undefined}
229
- testid={testid ? `${testid}-view-button` : undefined}
230
- variant="tertiary"
231
- href={viewButtonLink}
232
- >
233
- View
234
- </Button>
235
- )}
236
- </div>
237
- </div>
238
- );
239
- };
240
-
241
- Toast.displayName = "Toast";
242
-
243
- export function createToast(config: Omit<ToastProps, "id"> & { id?: string, testid?: string }) {
244
- const toastRoot = getToastRoot();
245
- const toastContainer = document.createElement("div");
246
- toastRoot.appendChild(toastContainer);
247
-
248
- const root = createRoot(toastContainer);
249
-
250
- const handleClose = () => {
251
- root.unmount();
252
- toastContainer.remove();
253
- };
254
-
255
- root.render(
256
- <Toast
257
- id={config.id}
258
- testid={config.testid}
259
- show={true}
260
- onClose={handleClose}
261
- variant={config.variant}
262
- title={config.title}
263
- message={config.message}
264
- showViewButton={config.showViewButton}
265
- viewButtonLink={config.viewButtonLink}
266
- />,
267
- );
268
- }
@@ -1,159 +0,0 @@
1
- "use client";
2
-
3
- import clsx from "clsx";
4
- import {
5
- PropsWithChildren,
6
- ReactNode,
7
- useEffect,
8
- useRef,
9
- useState,
10
- } from "react";
11
- import { createPortal } from "react-dom";
12
- import { componentPadding, typography } from "../classNames";
13
-
14
- export type TooltipProps = PropsWithChildren<{
15
- id?: string;
16
- testid?: string;
17
- message: string;
18
- position?: "top" | "bottom" | "left" | "right";
19
- children?: ReactNode;
20
- showOnTruncation?: boolean;
21
- offset?: number;
22
- keepHidden?: boolean; // for scenario where we want to keep the tooltip hidden based on a condition
23
- }>;
24
-
25
- export const Tooltip = ({
26
- id,
27
- testid,
28
- message,
29
- position = "top",
30
- children,
31
- showOnTruncation = false,
32
- offset = 8,
33
- keepHidden = false,
34
- }: TooltipProps) => {
35
- const ref = useRef<HTMLDivElement>(null);
36
- const tooltipRef = useRef<HTMLDivElement>(null);
37
- // Commented as state: "isTruncated" is not used
38
- // const [isTruncated, setIsTruncated] = useState(false);
39
- const [tooltipPosition, setTooltipPosition] = useState({ top: 0, left: 0 });
40
- const [isVisible, setIsVisible] = useState(false);
41
- const [removeOpacity, setRemoveOpacity] = useState(false);
42
-
43
- const updatePosition = () => {
44
- if (!ref.current || !tooltipRef.current) return;
45
-
46
- const rect = ref.current.getBoundingClientRect();
47
- const tooltipRect = tooltipRef.current.getBoundingClientRect();
48
-
49
- let top = 0;
50
- let left = 0;
51
-
52
- switch (position) {
53
- case "top":
54
- top = rect.top - tooltipRect.height - offset;
55
- left = rect.left + rect.width / 2 - tooltipRect.width / 2;
56
- break;
57
- case "bottom":
58
- top = rect.bottom + offset;
59
- left = rect.left + rect.width / 2 - tooltipRect.width / 2;
60
- break;
61
- case "left":
62
- top = rect.top + rect.height / 2 - tooltipRect.height / 2;
63
- left = rect.left - tooltipRect.width - offset;
64
- break;
65
- case "right":
66
- top = rect.top + rect.height / 2 - tooltipRect.height / 2;
67
- left = rect.right + offset;
68
- break;
69
- }
70
-
71
- setTooltipPosition({ top, left });
72
- requestAnimationFrame(() => {
73
- setRemoveOpacity(true);
74
- });
75
- };
76
-
77
- const handleMouseEnter = () => {
78
- if (!showOnTruncation || checkForTextTruncation()) {
79
- setIsVisible(true);
80
- }
81
- };
82
-
83
- const handleMouseLeave = () => {
84
- setIsVisible(false);
85
- setRemoveOpacity(false);
86
- };
87
-
88
- useEffect(() => {
89
- if (isVisible && tooltipRef.current) {
90
- requestAnimationFrame(() => {
91
- updatePosition();
92
- });
93
- }
94
- }, [isVisible]);
95
-
96
- useEffect(() => {
97
- if (isVisible) {
98
- window.addEventListener("resize", updatePosition);
99
- return () => window.removeEventListener("resize", updatePosition);
100
- }
101
- }, [isVisible]);
102
-
103
- return (
104
- <div
105
- id={id}
106
- data-testid={testid}
107
- ref={ref}
108
- className="relative inline-grid grid-cols-[auto_1fr] items-center cursor-pointer"
109
- onMouseEnter={handleMouseEnter}
110
- onMouseLeave={handleMouseLeave}
111
- >
112
- {children}
113
-
114
- {!keepHidden &&
115
- isVisible &&
116
- typeof document !== "undefined" &&
117
- createPortal(
118
- <div
119
- id={id ? `${id}-message` : undefined}
120
- data-testid={testid ? `${testid}-message` : undefined}
121
- ref={tooltipRef}
122
- style={{
123
- position: "fixed",
124
- top: `${tooltipPosition.top}px`,
125
- left: `${tooltipPosition.left}px`,
126
- zIndex: 9999,
127
- }}
128
- className={clsx(
129
- typography.caption,
130
- "bg-neutral-500 text-neutral-100 rounded whitespace-nowrap shadow-2 pointer-events-none transition-opacity duration-100 ease-in-out",
131
- componentPadding,
132
- !removeOpacity && "opacity-0",
133
- )}
134
- >
135
- {message}
136
- </div>,
137
- document.body,
138
- )}
139
- </div>
140
- );
141
-
142
- function checkForTextTruncation() {
143
- if (showOnTruncation && ref.current) {
144
- const paragraph = ref.current.querySelector("p");
145
-
146
- if (paragraph) {
147
- const isTruncated = paragraph.scrollWidth > paragraph.clientWidth;
148
- // Commented as state: "isTruncated" is not used
149
- // setIsTruncated(isTruncated);
150
-
151
- return isTruncated;
152
- }
153
- }
154
-
155
- return false;
156
- }
157
- };
158
-
159
- Tooltip.displayName = "Tooltip";
@@ -1,139 +0,0 @@
1
- import clsx from "clsx";
2
- import { ComponentProps, ReactNode } from "react";
3
- import {
4
- containerPaddingX,
5
- gapUsingContainerPadding,
6
- layoutGap,
7
- layoutGroupGap,
8
- layoutGroupGapPaddingY,
9
- } from "../classNames";
10
- import { LogoDMSiTopBar } from "./LogoDMSiTopBar";
11
-
12
- export type TopBarProps = ComponentProps<"div"> & {
13
- left?: ReactNode;
14
- right?: ReactNode;
15
- topNavLinks?: ReactNode;
16
- mobileLeft?: ReactNode;
17
- mobileRight?: ReactNode;
18
- brandLogo?: ReactNode;
19
- };
20
-
21
- export const TopBarBase = ({
22
- left,
23
- right,
24
- topNavLinks,
25
- mobileLeft,
26
- mobileRight,
27
- brandLogo = <LogoDMSiTopBar />,
28
- id,
29
- testid,
30
- ...props
31
- }: TopBarProps & { id?: string; testid?: string }) => {
32
- const defaultStyles = clsx("bg-background-primary-normal");
33
-
34
- return (
35
- <div
36
- id={id}
37
- data-testid={testid}
38
- className={clsx(
39
- "flex items-center justify-between",
40
- containerPaddingX,
41
- layoutGroupGapPaddingY,
42
- layoutGap,
43
- defaultStyles,
44
- )}
45
- {...props}
46
- >
47
- {left && (
48
- <div
49
- className={clsx(
50
- "hidden desktop:flex items-center",
51
- gapUsingContainerPadding,
52
- )}
53
- >
54
- {left}
55
- </div>
56
- )}
57
-
58
- {(right || topNavLinks) && (
59
- <div
60
- className={clsx(
61
- "hidden desktop:flex items-center shrink-0 ml-auto",
62
- "[&>a]:leading-6",
63
- layoutGap,
64
- )}
65
- >
66
- {topNavLinks}
67
-
68
- {topNavLinks && right && (
69
- <div className="h-6 border-r border-border-primary-normal"></div>
70
- )}
71
-
72
- {right}
73
- </div>
74
- )}
75
-
76
- {mobileLeft && (
77
- <div
78
- className={clsx("flex items-center desktop:hidden", layoutGroupGap)}
79
- >
80
- {mobileLeft}
81
-
82
- <a
83
- href="/"
84
- className="grow max-w-100 h-auto max-h-18 *:max-h-[inherit]"
85
- >
86
- {brandLogo && brandLogo}
87
- </a>
88
- </div>
89
- )}
90
-
91
- {mobileRight && (
92
- <div
93
- className={clsx("flex items-center desktop:hidden", layoutGroupGap)}
94
- >
95
- {mobileRight}
96
- </div>
97
- )}
98
- </div>
99
- );
100
- };
101
-
102
- export const TopBar = ({
103
- left,
104
- brandLogo = <LogoDMSiTopBar />,
105
- id,
106
- testid,
107
- brandHref = "/",
108
- ...props
109
- }: TopBarProps & {
110
- brandLogo?: ReactNode;
111
- id?: string;
112
- testid?: string;
113
- brandHref?: string;
114
- }) => {
115
- return (
116
- <TopBarBase
117
- {...props}
118
- id={id}
119
- testid={testid}
120
- brandLogo={brandLogo}
121
- left={
122
- <>
123
- <a
124
- id={id ? `${id}-brand-logo-link` : undefined}
125
- data-testid={testid ? `${testid}-brand-logo-link` : undefined}
126
- href={brandHref}
127
- className="grow max-w-100 h-auto max-h-18 *:max-h-[inherit]"
128
- >
129
- {brandLogo && brandLogo}
130
- </a>
131
-
132
- {left}
133
- </>
134
- }
135
- />
136
- );
137
- };
138
-
139
- TopBar.displayName = "TopBar";
@@ -1,107 +0,0 @@
1
- import clsx from "clsx";
2
- import { ComponentProps, MouseEvent } from "react";
3
- import { componentGap } from "../classNames";
4
- import { Icon } from "./Icon";
5
- import { Paragraph } from "./Paragraph";
6
- import { Button } from "./Button";
7
- import { Stack } from "./Stack";
8
- import { Spinner } from "./Spinner";
9
-
10
- export type UploadProps = {
11
- isLoading?: boolean;
12
- text?: string;
13
- errorText?: string;
14
- onRemove?: () => void;
15
- testid?: string;
16
- } & ComponentProps<"input">;
17
-
18
- export function Upload(props: UploadProps) {
19
- const {
20
- isLoading,
21
- style,
22
- errorText,
23
- text = "Upload your file",
24
- value,
25
- onRemove,
26
- testid,
27
- ...rest
28
- } = props;
29
-
30
- return (
31
- <label
32
- style={{
33
- ...style,
34
- }}
35
- className={clsx(
36
- "border border-dashed border-border-primary-normal",
37
- "flex flex-col items-center justify-center",
38
- "p-6",
39
- "cursor-pointer",
40
- "relative",
41
- "w-full h-[166px] desktop:w-[340px] desktop:h-[190px]",
42
- componentGap,
43
- )}
44
- data-testid={testid}
45
- >
46
- <input
47
- {...rest}
48
- type="file"
49
- className="sr-only"
50
- data-testid={testid ? `${testid}-file-input` : undefined}
51
- />
52
-
53
- {isLoading && (
54
- <Stack
55
- centered
56
- items="center"
57
- justify="center"
58
- sizing="container"
59
- padding
60
- >
61
- <Spinner size="large" />
62
- </Stack>
63
- )}
64
-
65
- {!value && !isLoading && (
66
- <>
67
- <Icon
68
- testid={testid ? `${testid}-icon` : undefined}
69
- name="cloud_upload"
70
- className="text-icon-primary-normal"
71
- />
72
- <Paragraph
73
- testid={testid ? `${testid}-text` : undefined}
74
- color={errorText ? "text-primary-error" : "text-secondary-normal"}
75
- >
76
- {errorText ? errorText : text}
77
- </Paragraph>
78
- </>
79
- )}
80
-
81
- {value && (
82
- <>
83
- <img
84
- data-testid={testid ? `${testid}-uploaded-image` : undefined}
85
- src={value as string}
86
- alt=""
87
- className="absolute inset-0 object-contain object-center max-h-full max-w-full self-center justify-self-center"
88
- />
89
-
90
- <div className="absolute right-2 top-2">
91
- <Button
92
- testid={testid ? `${testid}-remove-image-button` : undefined}
93
- onClick={(e: MouseEvent) => {
94
- e.preventDefault();
95
- e.stopPropagation();
96
-
97
- onRemove?.();
98
- }}
99
- iconOnly
100
- leftIcon={<Icon name="delete" />}
101
- />
102
- </div>
103
- </>
104
- )}
105
- </label>
106
- );
107
- }
@@ -1,7 +0,0 @@
1
- "use client";
2
-
3
- export function WorldpayIframe({ url }: { url: string }) {
4
- return (
5
- <iframe src={url} style={{ width: "100%", height: "100%", flex: 1 }} />
6
- );
7
- }
@@ -1,34 +0,0 @@
1
- export {
2
- DataCellHeader,
3
- DataGridCell,
4
- DragAlongCell,
5
- DraggableCellHeader,
6
- } from "./DataGridCell";
7
- export { DataGrid } from "./DataGrid";
8
- export type { ColumnDef } from "./DataGrid";
9
- export { Label } from "./Label";
10
- export { Select } from "./Select";
11
- export { Subheader } from "./Subheader";
12
- export { Icon } from "./Icon";
13
- export { Checkbox } from "./Checkbox";
14
- export { Paragraph } from "./Paragraph";
15
- export { Button } from "./Button";
16
- export { Menu } from "./Menu";
17
- export { MenuOption } from "./MenuOption";
18
- export { Search } from "./Search";
19
- export { Tooltip } from "./Tooltip";
20
- export { Input } from "./Input";
21
- export { DateInput } from "./DateInput";
22
- export { Accordion } from "./Accordion";
23
- export { Card } from "./Card";
24
- export { MobileDataGrid } from "./MobileDataGrid";
25
- export { ProductImagePreview } from "./ProductImagePreview";
26
- export { CompactImagesPreview } from "./CompactImagesPreview";
27
- export { SimpleTable } from "./SimpleTable";
28
- export { ListGroup } from "./ListGroup";
29
- export { Pagination } from "./Pagination";
30
- export { SkeletonParagraph } from "./SkeletonParagraph";
31
- export { EmptyCartIcon } from "./EmptyCartIcon";
32
- export { SearchResultImage } from "./SearchResultImage";
33
- export { Alert } from "./Alert";
34
- export { OrderCheckIcon } from "./OrderCheckIcon";