@dmsi/wedgekit-react 0.0.26 → 0.0.28

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 (217) hide show
  1. package/dist/{chunk-KDEPZ6I7.js → chunk-2S2Z3L56.js} +5 -1
  2. package/dist/{chunk-TU55CHXU.js → chunk-4JLU7TAC.js} +3 -1
  3. package/dist/{chunk-Z2LOGSGE.js → chunk-4N2PED4P.js} +15 -3
  4. package/dist/{chunk-U42SKNR6.js → chunk-57WRM337.js} +68 -30
  5. package/dist/{chunk-ZFGGZXB6.js → chunk-AY7ELVQY.js} +5 -2
  6. package/dist/{chunk-I2UVVKQI.js → chunk-CHTO7PW4.js} +3 -2
  7. package/dist/{chunk-WIDBAFBU.js → chunk-FWPJ73IK.js} +3 -1
  8. package/dist/{chunk-5TLFMKSR.js → chunk-INYI65WW.js} +15 -5
  9. package/dist/{chunk-TJ44JJCB.js → chunk-J6LETUNM.js} +5 -2
  10. package/dist/{chunk-T6HZARR7.js → chunk-MZJS2ZAU.js} +6 -3
  11. package/dist/{chunk-ZCBSLV7U.js → chunk-O4M2GISS.js} +5 -2
  12. package/dist/{chunk-OUTEIXV4.js → chunk-OUSNH76S.js} +11 -3
  13. package/dist/{chunk-YDREJNAS.js → chunk-PDDZ5PMY.js} +18 -4
  14. package/dist/{chunk-4RD5ZF2V.js → chunk-QBIEU25R.js} +10 -4
  15. package/dist/chunk-QUPHLL7D.js +61 -0
  16. package/dist/{chunk-OISE6NMA.js → chunk-QV2EFOYF.js} +17 -6
  17. package/dist/{chunk-YZQNTOIF.js → chunk-QZGUMB7T.js} +10 -5
  18. package/dist/{chunk-S7R37IUP.js → chunk-S5K22XTH.js} +5 -2
  19. package/dist/{chunk-GCPJH5R6.js → chunk-S5KPS4IQ.js} +22 -7
  20. package/dist/{chunk-VELXLFMJ.js → chunk-SAMX4YGM.js} +4 -1
  21. package/dist/{chunk-TWP6YSFO.js → chunk-SKHSGGO3.js} +14 -6
  22. package/dist/chunk-TVDFTRGL.js +57 -0
  23. package/dist/{chunk-N32PXOA5.js → chunk-UT7XCBZF.js} +9 -4
  24. package/dist/{chunk-L4UM372R.js → chunk-VC3R5EUH.js} +3 -0
  25. package/dist/{chunk-UIQ733QP.js → chunk-VG4EPHJA.js} +7 -3
  26. package/dist/components/Breadcrumbs.cjs +29 -9
  27. package/dist/components/Breadcrumbs.js +29 -9
  28. package/dist/components/Button.cjs +6 -3
  29. package/dist/components/Button.js +1 -1
  30. package/dist/components/CalendarRange.cjs +11 -3
  31. package/dist/components/CalendarRange.js +1 -1
  32. package/dist/components/Caption.cjs +53 -9
  33. package/dist/components/Caption.js +53 -9
  34. package/dist/components/Checkbox.cjs +15 -6
  35. package/dist/components/Checkbox.js +2 -2
  36. package/dist/components/ContentTab.cjs +20 -7
  37. package/dist/components/ContentTab.js +2 -2
  38. package/dist/components/ContentTabs.cjs +32 -18
  39. package/dist/components/ContentTabs.js +14 -13
  40. package/dist/components/DMSiLogo.cjs +22 -4
  41. package/dist/components/DMSiLogo.js +9 -5
  42. package/dist/components/DataGrid.cjs +374 -243
  43. package/dist/components/DataGrid.js +283 -226
  44. package/dist/components/DataGridCell.cjs +79 -21
  45. package/dist/components/DataGridCell.js +7 -7
  46. package/dist/components/DataTable.cjs +197 -139
  47. package/dist/components/DataTable.js +197 -139
  48. package/dist/components/DateInput.cjs +36 -10
  49. package/dist/components/DateInput.js +7 -3
  50. package/dist/components/DateRangeInput.cjs +36 -10
  51. package/dist/components/DateRangeInput.js +7 -3
  52. package/dist/components/DebugJson.cjs +21 -13
  53. package/dist/components/DebugJson.js +21 -13
  54. package/dist/components/Display.cjs +5 -2
  55. package/dist/components/Display.js +1 -1
  56. package/dist/components/EditingContext.cjs +4 -1
  57. package/dist/components/EditingContext.js +4 -1
  58. package/dist/components/FilterGroup.cjs +102 -32
  59. package/dist/components/FilterGroup.js +41 -17
  60. package/dist/components/FullViewportBox.cjs +10 -2
  61. package/dist/components/FullViewportBox.js +10 -2
  62. package/dist/components/Grid.cjs +3 -1
  63. package/dist/components/Grid.js +3 -1
  64. package/dist/components/Heading.cjs +5 -2
  65. package/dist/components/Heading.js +1 -1
  66. package/dist/components/HorizontalDivider.cjs +2 -2
  67. package/dist/components/HorizontalDivider.js +2 -2
  68. package/dist/components/Input.cjs +21 -7
  69. package/dist/components/Input.js +2 -2
  70. package/dist/components/InputGroup.cjs +13 -6
  71. package/dist/components/InputGroup.js +9 -5
  72. package/dist/components/Label.cjs +5 -2
  73. package/dist/components/Label.js +1 -1
  74. package/dist/components/List.cjs +3 -2
  75. package/dist/components/List.js +3 -2
  76. package/dist/components/LogoAgilityTopBar.cjs +22 -4
  77. package/dist/components/LogoAgilityTopBar.js +9 -5
  78. package/dist/components/LogoDMSiTopBar.cjs +22 -4
  79. package/dist/components/LogoDMSiTopBar.js +1 -1
  80. package/dist/components/LogoMillworkTopBar.cjs +22 -4
  81. package/dist/components/LogoMillworkTopBar.js +9 -5
  82. package/dist/components/MainBar.cjs +2 -0
  83. package/dist/components/MainBar.js +2 -0
  84. package/dist/components/Menu.cjs +3 -0
  85. package/dist/components/Menu.js +1 -1
  86. package/dist/components/MenuOption.cjs +28 -7
  87. package/dist/components/MenuOption.js +3 -3
  88. package/dist/components/MobileDataGrid.cjs +101 -46
  89. package/dist/components/MobileDataGrid.js +23 -11
  90. package/dist/components/Modal.cjs +96 -51
  91. package/dist/components/Modal.js +19 -7
  92. package/dist/components/ModalButtons.cjs +43 -26
  93. package/dist/components/ModalButtons.js +2 -2
  94. package/dist/components/ModalContent.cjs +3 -1
  95. package/dist/components/ModalContent.js +1 -1
  96. package/dist/components/ModalHeader.cjs +40 -25
  97. package/dist/components/ModalHeader.js +3 -3
  98. package/dist/components/ModalScrim.cjs +3 -1
  99. package/dist/components/ModalScrim.js +1 -1
  100. package/dist/components/NavigationTab.cjs +9 -3
  101. package/dist/components/NavigationTab.js +2 -2
  102. package/dist/components/NavigationTabs.cjs +15 -7
  103. package/dist/components/NavigationTabs.js +8 -6
  104. package/dist/components/NestedMenu.cjs +28 -7
  105. package/dist/components/NestedMenu.js +3 -3
  106. package/dist/components/Notification.cjs +84 -38
  107. package/dist/components/Notification.js +8 -4
  108. package/dist/components/OptionPill.cjs +24 -6
  109. package/dist/components/OptionPill.js +3 -3
  110. package/dist/components/Paragraph.cjs +7 -3
  111. package/dist/components/Paragraph.js +1 -1
  112. package/dist/components/Password.cjs +33 -11
  113. package/dist/components/Password.js +14 -6
  114. package/dist/components/ProjectBar.cjs +3 -1
  115. package/dist/components/ProjectBar.js +3 -1
  116. package/dist/components/Radio.cjs +13 -7
  117. package/dist/components/Radio.js +7 -5
  118. package/dist/components/Search.cjs +34 -12
  119. package/dist/components/Search.js +3 -3
  120. package/dist/components/Select.cjs +25 -7
  121. package/dist/components/Select.js +3 -3
  122. package/dist/components/SideMenu.cjs +6 -1
  123. package/dist/components/SideMenu.js +6 -1
  124. package/dist/components/SideMenuGroup.cjs +96 -49
  125. package/dist/components/SideMenuGroup.js +31 -19
  126. package/dist/components/SideMenuItem.cjs +99 -43
  127. package/dist/components/SideMenuItem.js +32 -12
  128. package/dist/components/Stack.cjs +91 -30
  129. package/dist/components/Stack.js +1 -1
  130. package/dist/components/StatusPill.cjs +13 -6
  131. package/dist/components/StatusPill.js +9 -5
  132. package/dist/components/Stepper.cjs +35 -17
  133. package/dist/components/Stepper.js +11 -10
  134. package/dist/components/Subheader.cjs +5 -2
  135. package/dist/components/Subheader.js +1 -1
  136. package/dist/components/Surface.cjs +5 -2
  137. package/dist/components/Surface.js +5 -2
  138. package/dist/components/Swatch.cjs +1544 -1308
  139. package/dist/components/Swatch.js +1469 -1275
  140. package/dist/components/Textarea.cjs +5 -2
  141. package/dist/components/Textarea.js +5 -2
  142. package/dist/components/Theme.cjs +3 -2
  143. package/dist/components/Theme.js +1 -1
  144. package/dist/components/Time.cjs +98 -40
  145. package/dist/components/Time.js +18 -6
  146. package/dist/components/Toast.cjs +38 -15
  147. package/dist/components/Toast.js +23 -10
  148. package/dist/components/Tooltip.cjs +5 -4
  149. package/dist/components/Tooltip.js +1 -1
  150. package/dist/components/TopBar.cjs +16 -8
  151. package/dist/components/TopBar.js +12 -5
  152. package/package.json +1 -1
  153. package/src/components/Breadcrumbs.tsx +24 -15
  154. package/src/components/Button.tsx +7 -3
  155. package/src/components/CalendarRange.tsx +9 -0
  156. package/src/components/Caption.tsx +36 -6
  157. package/src/components/Checkbox.tsx +7 -2
  158. package/src/components/ContentTab.tsx +13 -3
  159. package/src/components/ContentTabs.tsx +11 -8
  160. package/src/components/DMSiLogo.tsx +2 -1
  161. package/src/components/DataGrid.tsx +85 -23
  162. package/src/components/DataGridCell.tsx +15 -2
  163. package/src/components/DataTable.tsx +64 -14
  164. package/src/components/DateInput.tsx +5 -1
  165. package/src/components/DateRangeInput.tsx +5 -1
  166. package/src/components/DebugJson.tsx +7 -3
  167. package/src/components/Display.tsx +3 -0
  168. package/src/components/EditingContext.tsx +8 -6
  169. package/src/components/FilterGroup.tsx +23 -3
  170. package/src/components/FullViewportBox.tsx +6 -1
  171. package/src/components/Grid.tsx +3 -0
  172. package/src/components/Heading.tsx +3 -0
  173. package/src/components/HorizontalDivider.tsx +4 -2
  174. package/src/components/Input.tsx +19 -10
  175. package/src/components/InputGroup.tsx +8 -4
  176. package/src/components/Label.tsx +3 -0
  177. package/src/components/Link.tsx +1 -0
  178. package/src/components/List.tsx +7 -1
  179. package/src/components/LogoAgilityTopBar.tsx +2 -1
  180. package/src/components/LogoDMSiTopBar.tsx +2 -1
  181. package/src/components/LogoMillworkTopBar.tsx +2 -1
  182. package/src/components/MainBar.tsx +3 -0
  183. package/src/components/Menu.tsx +3 -0
  184. package/src/components/MenuOption.tsx +72 -58
  185. package/src/components/MobileDataGrid.tsx +15 -4
  186. package/src/components/Modal.tsx +10 -1
  187. package/src/components/ModalButtons.tsx +12 -1
  188. package/src/components/ModalContent.tsx +3 -0
  189. package/src/components/ModalHeader.tsx +16 -6
  190. package/src/components/ModalScrim.tsx +3 -0
  191. package/src/components/NavigationTab.tsx +6 -3
  192. package/src/components/NavigationTabs.tsx +5 -2
  193. package/src/components/Notification.tsx +4 -0
  194. package/src/components/OptionPill.tsx +9 -1
  195. package/src/components/Paragraph.tsx +3 -0
  196. package/src/components/Password.tsx +9 -3
  197. package/src/components/ProjectBar.tsx +3 -0
  198. package/src/components/Radio.tsx +3 -2
  199. package/src/components/Search.tsx +56 -41
  200. package/src/components/Select.tsx +6 -1
  201. package/src/components/SideMenu.tsx +7 -1
  202. package/src/components/SideMenuGroup.tsx +13 -2
  203. package/src/components/SideMenuItem.tsx +15 -2
  204. package/src/components/Stack.tsx +8 -3
  205. package/src/components/StatusPill.tsx +4 -2
  206. package/src/components/Stepper.tsx +5 -5
  207. package/src/components/Subheader.tsx +3 -0
  208. package/src/components/Surface.tsx +3 -0
  209. package/src/components/Swatch.tsx +415 -140
  210. package/src/components/Textarea.tsx +6 -3
  211. package/src/components/Theme.tsx +3 -1
  212. package/src/components/Time.tsx +21 -5
  213. package/src/components/Toast.tsx +29 -14
  214. package/src/components/Tooltip.tsx +46 -32
  215. package/src/components/TopBar.tsx +7 -3
  216. package/dist/chunk-DBYSGYST.js +0 -47
  217. package/dist/chunk-UK3WG7HQ.js +0 -48
@@ -6,8 +6,9 @@ import { baseTransition, componentGap, componentPaddingMinusBorder, typography }
6
6
  interface TextareaProps
7
7
  extends Omit<
8
8
  ComponentProps<"textarea">,
9
- "children" | "dangerouslySetInnerHTML"
9
+ "children" | "dangerouslySetInnerHTML" | "id"
10
10
  > {
11
+ id?: string;
11
12
  label?: string;
12
13
  error?: boolean;
13
14
  caption?: ReactNode;
@@ -38,6 +39,7 @@ const textareaReadOnlyClass = clsx(
38
39
  );
39
40
 
40
41
  export const Textarea = ({
42
+ id,
41
43
  label,
42
44
  error,
43
45
  caption,
@@ -49,6 +51,7 @@ export const Textarea = ({
49
51
 
50
52
  return (
51
53
  <label
54
+ htmlFor={id}
52
55
  className={clsx(
53
56
  "flex flex-col w-full",
54
57
  "text-text-primary-normal has-disabled:text-text-primary-disabled",
@@ -76,7 +79,7 @@ export const Textarea = ({
76
79
  <textarea
77
80
  {...props}
78
81
  {...attributes}
79
- id={props.id}
82
+ id={id}
80
83
  className={clsx(
81
84
  "disabled:text-text-primary-disabled",
82
85
  typography.paragraph,
@@ -88,7 +91,7 @@ export const Textarea = ({
88
91
  )}
89
92
  ></textarea>
90
93
 
91
- {caption}
94
+ {caption && <div id={id ? `${id}-caption` : undefined}>{caption}</div>}
92
95
  </label>
93
96
  );
94
97
  };
@@ -1,12 +1,14 @@
1
1
  export function Theme({
2
2
  theme,
3
3
  children,
4
+ id,
4
5
  }: {
5
6
  theme: "auto" | "brand";
6
7
  children: React.ReactNode;
8
+ id?: string;
7
9
  }) {
8
10
  return (
9
- <div className="contents" data-theme={theme}>
11
+ <div id={id} className="contents" data-theme={theme}>
10
12
  {children}
11
13
  </div>
12
14
  );
@@ -13,11 +13,15 @@ type TimeProps = {
13
13
  readOnly?: boolean;
14
14
  caption?: ReactNode;
15
15
  format?: "12h" | "24h";
16
- } & Omit<ComponentProps<"input">, "type" | "children" | "dangerouslySetInnerHTML">;
16
+ id?: string;
17
+ } & Omit<
18
+ ComponentProps<"input">,
19
+ "type" | "children" | "dangerouslySetInnerHTML" | "id"
20
+ >;
17
21
 
18
22
  const timePickerScrollableStyle = "overflow-auto max-h-full py-4 no-scrollbar";
19
23
 
20
- export const Time = ({ onChange, format = "12h", ...props }: TimeProps) => {
24
+ export const Time = ({ onChange, format = "12h", id, ...props }: TimeProps) => {
21
25
  const [showTimePicker, setShowTimePicker] = useState(false);
22
26
  const [hasInteracted, setHasInteracted] = useState(false);
23
27
  const inputRef = useRef<HTMLInputElement>(null);
@@ -281,7 +285,13 @@ export const Time = ({ onChange, format = "12h", ...props }: TimeProps) => {
281
285
  }
282
286
  }, 0);
283
287
  }
284
- }, [showTimePicker, is12HourFormat, selectedRefs.hour, selectedRefs.minute, selectedRefs.meridiem]);
288
+ }, [
289
+ showTimePicker,
290
+ is12HourFormat,
291
+ selectedRefs.hour,
292
+ selectedRefs.minute,
293
+ selectedRefs.meridiem,
294
+ ]);
285
295
  const renderOptions = (
286
296
  items: string[],
287
297
  type: "hour" | "minute" | "meridiem",
@@ -295,6 +305,7 @@ export const Time = ({ onChange, format = "12h", ...props }: TimeProps) => {
295
305
  return (
296
306
  <TimeCell
297
307
  key={val}
308
+ id={id ? `${id}-${type}-${val}` : undefined}
298
309
  selected={isSelected}
299
310
  ref={
300
311
  isSelected
@@ -315,6 +326,7 @@ export const Time = ({ onChange, format = "12h", ...props }: TimeProps) => {
315
326
  <div className="relative max-w-38">
316
327
  <InputBase
317
328
  {...props}
329
+ id={id}
318
330
  ref={inputRef}
319
331
  inputContainerRef={inputContainerRef}
320
332
  value={inputValue}
@@ -333,6 +345,7 @@ export const Time = ({ onChange, format = "12h", ...props }: TimeProps) => {
333
345
  {showTimePicker &&
334
346
  createPortal(
335
347
  <Stack
348
+ id={id ? `${id}-timepicker` : undefined}
336
349
  elevation={4}
337
350
  height={240}
338
351
  position="absolute"
@@ -350,7 +363,7 @@ export const Time = ({ onChange, format = "12h", ...props }: TimeProps) => {
350
363
  <div className={clsx(timePickerScrollableStyle)}>
351
364
  {renderOptions(
352
365
  Array.from({ length: is12HourFormat ? 12 : 24 }, (_, i) =>
353
- (i + 1).toString().padStart(2, "0"),
366
+ (i + (is12HourFormat ? 1 : 0)).toString().padStart(2, "0"),
354
367
  ),
355
368
  "hour",
356
369
  )}
@@ -377,6 +390,7 @@ export const Time = ({ onChange, format = "12h", ...props }: TimeProps) => {
377
390
  };
378
391
 
379
392
  type TimeCellProps = {
393
+ id?: string;
380
394
  selected?: boolean;
381
395
  children?: React.ReactNode;
382
396
  start?: boolean;
@@ -392,6 +406,7 @@ type TimeCellProps = {
392
406
  };
393
407
 
394
408
  function TimeCell({
409
+ id,
395
410
  selected = false,
396
411
  start = false,
397
412
  intermediate = false,
@@ -410,6 +425,7 @@ function TimeCell({
410
425
  const isToday = today && !selected && !start && !intermediate && !end;
411
426
  return (
412
427
  <button
428
+ id={id}
413
429
  onPointerOver={onHover}
414
430
  onClick={onClick}
415
431
  onKeyDown={onKeyDown}
@@ -435,4 +451,4 @@ function TimeCell({
435
451
  {children}
436
452
  </button>
437
453
  );
438
- }
454
+ }
@@ -10,6 +10,7 @@ import { createRoot } from "react-dom/client";
10
10
  import { componentGap, componentPadding, layoutGroupGap } from "../classNames";
11
11
 
12
12
  export interface ToastProps {
13
+ id?: string;
13
14
  variant?: "success" | "warning" | "error" | "info";
14
15
  title?: string;
15
16
  message?: string;
@@ -114,6 +115,7 @@ function getToastRoot(): HTMLElement {
114
115
  }
115
116
 
116
117
  export const Toast = ({
118
+ id,
117
119
  variant = "success",
118
120
  title,
119
121
  message,
@@ -131,9 +133,7 @@ export const Toast = ({
131
133
  useEffect(() => {
132
134
  if (show && !showToast) {
133
135
  if (toastElementRef.current) {
134
- const animation = slideInFromBottomAnimation(
135
- toastElementRef.current
136
- );
136
+ const animation = slideInFromBottomAnimation(toastElementRef.current);
137
137
  animationRef.current = animation;
138
138
 
139
139
  animation.onfinish = () => {
@@ -166,10 +166,13 @@ export const Toast = ({
166
166
  };
167
167
 
168
168
  if (animationRef.current) {
169
- animationRef.current.addEventListener('finish', handleAnimationEnd);
169
+ animationRef.current.addEventListener("finish", handleAnimationEnd);
170
170
  return () => {
171
171
  if (animationRef.current) {
172
- animationRef.current.removeEventListener('finish', handleAnimationEnd);
172
+ animationRef.current.removeEventListener(
173
+ "finish",
174
+ handleAnimationEnd,
175
+ );
173
176
  }
174
177
  };
175
178
  }
@@ -179,7 +182,7 @@ export const Toast = ({
179
182
  const handleMouseLeave = () => {
180
183
  setIsHovered(false);
181
184
  // Resume animation when mouse leaves
182
- if (animationRef.current && animationRef.current.playState === 'paused') {
185
+ if (animationRef.current && animationRef.current.playState === "paused") {
183
186
  animationRef.current.play();
184
187
  }
185
188
  };
@@ -191,6 +194,7 @@ export const Toast = ({
191
194
 
192
195
  return (
193
196
  <div
197
+ id={id}
194
198
  ref={toastElementRef}
195
199
  onMouseEnter={handleMouseEnter}
196
200
  onMouseLeave={handleMouseLeave}
@@ -206,12 +210,22 @@ export const Toast = ({
206
210
  {iconElement}
207
211
  <div className={clsx("flex items-center", layoutGroupGap)}>
208
212
  <div className={clsx("flex flex-col w-68", componentGap)}>
209
- {title && <Heading3>{title}</Heading3>}
210
- {message && <Paragraph>{message}</Paragraph>}
213
+ {title && (
214
+ <Heading3 id={id ? `${id}-title` : undefined}>{title}</Heading3>
215
+ )}
216
+ {message && (
217
+ <Paragraph id={id ? `${id}-message` : undefined}>
218
+ {message}
219
+ </Paragraph>
220
+ )}
211
221
  </div>
212
222
 
213
223
  {showViewButton && (
214
- <Button variant="tertiary" href={viewButtonLink}>
224
+ <Button
225
+ id={id ? `${id}-view-button` : undefined}
226
+ variant="tertiary"
227
+ href={viewButtonLink}
228
+ >
215
229
  View
216
230
  </Button>
217
231
  )}
@@ -222,20 +236,21 @@ export const Toast = ({
222
236
 
223
237
  Toast.displayName = "Toast";
224
238
 
225
- export function createToast(config: ToastProps) {
239
+ export function createToast(config: Omit<ToastProps, "id"> & { id?: string }) {
226
240
  const toastRoot = getToastRoot();
227
241
  const toastContainer = document.createElement("div");
228
242
  toastRoot.appendChild(toastContainer);
229
-
243
+
230
244
  const root = createRoot(toastContainer);
231
-
245
+
232
246
  const handleClose = () => {
233
247
  root.unmount();
234
248
  toastContainer.remove();
235
249
  };
236
-
250
+
237
251
  root.render(
238
252
  <Toast
253
+ id={config.id}
239
254
  show={true}
240
255
  onClose={handleClose}
241
256
  variant={config.variant}
@@ -243,6 +258,6 @@ export function createToast(config: ToastProps) {
243
258
  message={config.message}
244
259
  showViewButton={config.showViewButton}
245
260
  viewButtonLink={config.viewButtonLink}
246
- />
261
+ />,
247
262
  );
248
263
  }
@@ -1,11 +1,18 @@
1
1
  "use client";
2
2
 
3
3
  import clsx from "clsx";
4
- import { PropsWithChildren, ReactNode, useEffect, useRef, useState } from "react";
4
+ import {
5
+ PropsWithChildren,
6
+ ReactNode,
7
+ useEffect,
8
+ useRef,
9
+ useState,
10
+ } from "react";
5
11
  import { createPortal } from "react-dom";
6
12
  import { componentPadding, typography } from "../classNames";
7
13
 
8
14
  export type TooltipProps = PropsWithChildren<{
15
+ id?: string;
9
16
  message: string;
10
17
  position?: "top" | "bottom" | "left" | "right";
11
18
  children?: ReactNode;
@@ -14,6 +21,7 @@ export type TooltipProps = PropsWithChildren<{
14
21
  }>;
15
22
 
16
23
  export const Tooltip = ({
24
+ id,
17
25
  message,
18
26
  position = "top",
19
27
  children,
@@ -22,20 +30,21 @@ export const Tooltip = ({
22
30
  }: TooltipProps) => {
23
31
  const ref = useRef<HTMLDivElement>(null);
24
32
  const tooltipRef = useRef<HTMLDivElement>(null);
25
- const [isTruncated, setIsTruncated] = useState(false);
33
+ // Commented as state: "isTruncated" is not used
34
+ // const [isTruncated, setIsTruncated] = useState(false);
26
35
  const [tooltipPosition, setTooltipPosition] = useState({ top: 0, left: 0 });
27
36
  const [isVisible, setIsVisible] = useState(false);
28
37
  const [removeOpacity, setRemoveOpacity] = useState(false);
29
38
 
30
39
  const updatePosition = () => {
31
40
  if (!ref.current || !tooltipRef.current) return;
32
-
41
+
33
42
  const rect = ref.current.getBoundingClientRect();
34
43
  const tooltipRect = tooltipRef.current.getBoundingClientRect();
35
-
44
+
36
45
  let top = 0;
37
46
  let left = 0;
38
-
47
+
39
48
  switch (position) {
40
49
  case "top":
41
50
  top = rect.top - tooltipRect.height - offset;
@@ -54,11 +63,11 @@ export const Tooltip = ({
54
63
  left = rect.right + offset;
55
64
  break;
56
65
  }
57
-
66
+
58
67
  setTooltipPosition({ top, left });
59
68
  requestAnimationFrame(() => {
60
69
  setRemoveOpacity(true);
61
- })
70
+ });
62
71
  };
63
72
 
64
73
  const handleMouseEnter = () => {
@@ -76,19 +85,20 @@ export const Tooltip = ({
76
85
  if (isVisible && tooltipRef.current) {
77
86
  requestAnimationFrame(() => {
78
87
  updatePosition();
79
- })
88
+ });
80
89
  }
81
90
  }, [isVisible]);
82
91
 
83
92
  useEffect(() => {
84
93
  if (isVisible) {
85
- window.addEventListener('resize', updatePosition);
86
- return () => window.removeEventListener('resize', updatePosition);
94
+ window.addEventListener("resize", updatePosition);
95
+ return () => window.removeEventListener("resize", updatePosition);
87
96
  }
88
97
  }, [isVisible]);
89
98
 
90
99
  return (
91
100
  <div
101
+ id={id}
92
102
  ref={ref}
93
103
  className="relative inline-grid grid-cols-[auto_1fr] items-center"
94
104
  onMouseEnter={handleMouseEnter}
@@ -96,36 +106,40 @@ export const Tooltip = ({
96
106
  >
97
107
  {children}
98
108
 
99
- {isVisible && typeof document !== 'undefined' && createPortal(
100
- <div
101
- ref={tooltipRef}
102
- style={{
103
- position: 'fixed',
104
- top: `${tooltipPosition.top}px`,
105
- left: `${tooltipPosition.left}px`,
106
- zIndex: 9999,
107
- }}
108
- className={clsx(
109
- typography.caption,
110
- "bg-neutral-500 text-neutral-100 rounded whitespace-nowrap shadow-2 pointer-events-none transition-opacity duration-100 ease-in-out",
111
- componentPadding,
112
- !removeOpacity && "opacity-0"
113
- )}
114
- >
115
- {message}
116
- </div>,
117
- document.body
118
- )}
109
+ {isVisible &&
110
+ typeof document !== "undefined" &&
111
+ createPortal(
112
+ <div
113
+ id={id ? `${id}-message` : undefined}
114
+ ref={tooltipRef}
115
+ style={{
116
+ position: "fixed",
117
+ top: `${tooltipPosition.top}px`,
118
+ left: `${tooltipPosition.left}px`,
119
+ zIndex: 9999,
120
+ }}
121
+ className={clsx(
122
+ typography.caption,
123
+ "bg-neutral-500 text-neutral-100 rounded whitespace-nowrap shadow-2 pointer-events-none transition-opacity duration-100 ease-in-out",
124
+ componentPadding,
125
+ !removeOpacity && "opacity-0",
126
+ )}
127
+ >
128
+ {message}
129
+ </div>,
130
+ document.body,
131
+ )}
119
132
  </div>
120
133
  );
121
134
 
122
135
  function checkForTextTruncation() {
123
136
  if (showOnTruncation && ref.current) {
124
- const paragraph = ref.current.querySelector('p');
137
+ const paragraph = ref.current.querySelector("p");
125
138
 
126
139
  if (paragraph) {
127
140
  const isTruncated = paragraph.scrollWidth > paragraph.clientWidth;
128
- setIsTruncated(isTruncated);
141
+ // Commented as state: "isTruncated" is not used
142
+ // setIsTruncated(isTruncated);
129
143
 
130
144
  return isTruncated;
131
145
  }
@@ -25,12 +25,14 @@ export const TopBarBase = ({
25
25
  mobileLeft,
26
26
  mobileRight,
27
27
  brandLogo = <LogoDMSiTopBar />,
28
+ id,
28
29
  ...props
29
- }: TopBarProps) => {
30
+ }: TopBarProps & { id?: string }) => {
30
31
  const defaultStyles = clsx("bg-background-primary-normal");
31
32
 
32
33
  return (
33
34
  <div
35
+ id={id}
34
36
  className={clsx(
35
37
  "flex items-center justify-between",
36
38
  containerPaddingX,
@@ -98,16 +100,18 @@ export const TopBarBase = ({
98
100
  export const TopBar = ({
99
101
  left,
100
102
  brandLogo = <LogoDMSiTopBar />,
101
-
103
+ id,
102
104
  ...props
103
- }: TopBarProps & { brandLogo?: ReactNode }) => {
105
+ }: TopBarProps & { brandLogo?: ReactNode; id?: string }) => {
104
106
  return (
105
107
  <TopBarBase
106
108
  {...props}
109
+ id={id}
107
110
  brandLogo={brandLogo}
108
111
  left={
109
112
  <>
110
113
  <a
114
+ id={id ? `${id}-brand-logo-link` : undefined}
111
115
  href="/"
112
116
  className="grow max-w-[400px] h-auto max-h-10 *:max-h-[inherit]"
113
117
  >
@@ -1,47 +0,0 @@
1
- import {
2
- Button
3
- } from "./chunk-T6HZARR7.js";
4
- import {
5
- Icon
6
- } from "./chunk-IGQVA7SC.js";
7
- import {
8
- layoutGroupGap,
9
- layoutPaddding
10
- } from "./chunk-RDLEIAQU.js";
11
-
12
- // src/components/ModalButtons.tsx
13
- import clsx from "clsx";
14
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
15
- var ModalButtons = ({
16
- onClose,
17
- onContinue,
18
- customActions
19
- }) => {
20
- return /* @__PURE__ */ jsx("div", { className: clsx("border-t border-neutral-300 flex justify-end", layoutPaddding, layoutGroupGap), children: customActions != null ? customActions : /* @__PURE__ */ jsxs(Fragment, { children: [
21
- /* @__PURE__ */ jsx(
22
- Button,
23
- {
24
- variant: "secondary",
25
- leftIcon: /* @__PURE__ */ jsx(Icon, { name: "close", size: 24 }),
26
- onClick: onClose,
27
- className: "max-sm:w-full",
28
- children: "Close"
29
- }
30
- ),
31
- /* @__PURE__ */ jsx(
32
- Button,
33
- {
34
- variant: "primary",
35
- leftIcon: /* @__PURE__ */ jsx(Icon, { name: "check", size: 24 }),
36
- className: "max-sm:w-full",
37
- onClick: onContinue,
38
- children: "Continue"
39
- }
40
- )
41
- ] }) });
42
- };
43
- ModalButtons.displayName = "ModalButtons";
44
-
45
- export {
46
- ModalButtons
47
- };
@@ -1,48 +0,0 @@
1
- import {
2
- Heading2
3
- } from "./chunk-TJ44JJCB.js";
4
- import {
5
- Button
6
- } from "./chunk-T6HZARR7.js";
7
- import {
8
- Icon
9
- } from "./chunk-IGQVA7SC.js";
10
- import {
11
- layoutGroupGap,
12
- layoutPaddding
13
- } from "./chunk-RDLEIAQU.js";
14
-
15
- // src/components/ModalHeader.tsx
16
- import clsx from "clsx";
17
- import { jsx, jsxs } from "react/jsx-runtime";
18
- var ModalHeader = ({
19
- title,
20
- hideCloseIcon,
21
- headerIcon,
22
- onClose
23
- }) => {
24
- return /* @__PURE__ */ jsxs("div", { className: clsx(
25
- "flex justify-between items-center",
26
- layoutPaddding,
27
- layoutGroupGap
28
- ), children: [
29
- /* @__PURE__ */ jsxs("div", { className: clsx("flex items-center", layoutGroupGap), children: [
30
- headerIcon,
31
- title && /* @__PURE__ */ jsx(Heading2, { as: "p", children: title })
32
- ] }),
33
- !hideCloseIcon && /* @__PURE__ */ jsx(
34
- Button,
35
- {
36
- iconOnly: true,
37
- variant: "tertiary",
38
- onClick: onClose,
39
- leftIcon: /* @__PURE__ */ jsx("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ jsx(Icon, { name: "close", size: 24 }) })
40
- }
41
- )
42
- ] });
43
- };
44
- ModalHeader.displayName = "ModalHeader";
45
-
46
- export {
47
- ModalHeader
48
- };