@trackunit/react-components 0.1.237 → 0.1.239

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.
package/index.esm.js CHANGED
@@ -10,7 +10,7 @@ import { cvaMerge } from '@trackunit/css-class-variance-utilities';
10
10
  import { useMeasure, useCopyToClipboard, usePrevious } from 'react-use';
11
11
  import { DayPicker as DayPicker$1 } from 'react-day-picker';
12
12
  import { enGB, enUS, da, de, cs, nl, fr, fi, hu, it, nb, pl, pt, ru, ro, es, sv, ja, th } from 'date-fns/locale';
13
- import { useFloating, autoUpdate, offset, flip, shift, size, useClick, useDismiss, useHover as useHover$1, useRole, useInteractions, useMergeRefs, FloatingPortal, FloatingFocusManager } from '@floating-ui/react';
13
+ import { useFloating, autoUpdate, offset, flip, shift, size, useClick, useDismiss, useHover as useHover$1, useRole, useInteractions, useMergeRefs, FloatingPortal, FloatingFocusManager, arrow, useTransitionStatus, FloatingArrow } from '@floating-ui/react';
14
14
  import usePortal from 'react-useportal';
15
15
  import { Link, UNSAFE_NavigationContext } from 'react-router-dom';
16
16
  import { HelmetProvider, Helmet } from 'react-helmet-async';
@@ -44,43 +44,6 @@ const useContainerProps = ({ className, dataTestId }) => {
44
44
  return containerProps;
45
45
  };
46
46
 
47
- /******************************************************************************
48
- Copyright (c) Microsoft Corporation.
49
-
50
- Permission to use, copy, modify, and/or distribute this software for any
51
- purpose with or without fee is hereby granted.
52
-
53
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
54
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
55
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
56
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
57
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
58
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
59
- PERFORMANCE OF THIS SOFTWARE.
60
- ***************************************************************************** */
61
-
62
- function __rest(s, e) {
63
- var t = {};
64
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
65
- t[p] = s[p];
66
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
67
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
68
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
69
- t[p[i]] = s[p[i]];
70
- }
71
- return t;
72
- }
73
-
74
- function __awaiter(thisArg, _arguments, P, generator) {
75
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
76
- return new (P || (P = Promise))(function (resolve, reject) {
77
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
78
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
79
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
80
- step((generator = generator.apply(thisArg, _arguments || [])).next());
81
- });
82
- }
83
-
84
47
  const cvaIcon = cvaMerge(["aspect-square", "inline-grid", "relative"], {
85
48
  variants: {
86
49
  color: {
@@ -167,6 +130,7 @@ cvaMerge([
167
130
  ]);
168
131
 
169
132
  const iconPalette = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, intentPalette), generalPalette), criticalityPalette), activityPalette), utilizationPalette), sitesPalette), rentalStatusPalette);
133
+ // eslint-disable-next-line local-rules/no-typescript-assertion
170
134
  const iconColorNames = Object.keys(iconPalette).map(key => key.toLowerCase()); // This users the object in the Object.keys() to infer the type of the keys.
171
135
  const isSafari = () => {
172
136
  const ua = navigator.userAgent.toLowerCase();
@@ -202,10 +166,7 @@ const Icon = ({ name, size = "large", className, dataTestId, color, onClick, typ
202
166
  useTagRef.current.setAttribute("href", href[correctIconType]);
203
167
  }
204
168
  }, [correctIconType, href]);
205
- if (!iconName) {
206
- return null;
207
- }
208
- return (jsx("span", { className: cvaIcon({ color, size, className }), onClick: onClick, "data-testid": dataTestId, ref: forwardedRef, children: jsx("svg", { viewBox: correctIconType === "mini" ? "0 0 20 20" : "0 0 24 24", "data-testid": dataTestId ? `${dataTestId}-${iconName}` : iconName, style: style, children: jsx("use", { href: href[correctIconType], ref: useTagRef }) }) }));
169
+ return (jsx("span", { className: cvaIcon({ color, size, className }), onClick: onClick, "data-testid": dataTestId, ref: forwardedRef, children: jsxs("svg", { viewBox: correctIconType === "mini" ? "0 0 20 20" : "0 0 24 24", "data-testid": dataTestId ? `${dataTestId}-${iconName}` : iconName, style: style, role: "img", children: [jsx("title", { children: iconName }), jsx("use", { href: href[correctIconType], ref: useTagRef })] }) }));
209
170
  };
210
171
 
211
172
  const cvaTag = cvaMerge([
@@ -284,12 +245,12 @@ const cvaTagIcon = cvaMerge(["cursor-pointer", "transition-opacity", "hover:opac
284
245
  * @param {TagProps} props - The props for the tag component
285
246
  * @returns {JSX.Element} tag component
286
247
  */
287
- const Tag = React.forwardRef((_a, ref) => {
288
- var { className, dataTestId, children, size = "medium", onClose, color = "primary", disabled = false } = _a; __rest(_a, ["className", "dataTestId", "children", "size", "onClose", "color", "disabled"]);
289
- return (jsxs("span", { className: cvaTag({ className, size, color, layout: Boolean(onClose) ? "withIcon" : "default" }), "data-testid": dataTestId && `${dataTestId}-tag`, ref: ref, children: [children, Boolean(onClose) && !disabled && (
248
+ const Tag = React.forwardRef(({ className, dataTestId, children, size = "medium", onClose, color = "primary", disabled = false }, ref) => {
249
+ return (jsxs("span", { className: cvaTag({ className, size, color, layout: onClose ? "withIcon" : "default" }), "data-testid": dataTestId, ref: ref, children: [children, Boolean(onClose) && !disabled ? (
290
250
  // a fix for multiselect deselecting tags working together with fade out animation
291
- jsx("div", { className: cvaTagIconContainer(), onMouseDown: onClose, children: jsx(Icon, { name: "XCircle", dataTestId: dataTestId + "Icon", type: "solid", size: size, style: { WebkitTransition: "-webkit-transform 0.150s" }, className: cvaTagIcon() }) }))] }));
251
+ jsx("div", { className: cvaTagIconContainer(), onMouseDown: onClose, children: jsx(Icon, { name: "XCircle", dataTestId: dataTestId + "Icon", type: "solid", size: size, style: { WebkitTransition: "-webkit-transform 0.150s" }, className: cvaTagIcon() }) })) : null] }));
292
252
  });
253
+ Tag.displayName = "Tag";
293
254
 
294
255
  /**
295
256
  * A component used to display the package name and version in the Storybook docs.
@@ -298,6 +259,43 @@ const PackageNameStoryComponent = ({ packageJSON }) => {
298
259
  return (jsxs("div", { className: "flex gap-2", children: [jsx(Tag, { color: "secondary", children: packageJSON === null || packageJSON === void 0 ? void 0 : packageJSON.name }), jsxs(Tag, { color: "secondary", children: ["v", packageJSON === null || packageJSON === void 0 ? void 0 : packageJSON.version] })] }));
299
260
  };
300
261
 
262
+ /******************************************************************************
263
+ Copyright (c) Microsoft Corporation.
264
+
265
+ Permission to use, copy, modify, and/or distribute this software for any
266
+ purpose with or without fee is hereby granted.
267
+
268
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
269
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
270
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
271
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
272
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
273
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
274
+ PERFORMANCE OF THIS SOFTWARE.
275
+ ***************************************************************************** */
276
+
277
+ function __rest(s, e) {
278
+ var t = {};
279
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
280
+ t[p] = s[p];
281
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
282
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
283
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
284
+ t[p[i]] = s[p[i]];
285
+ }
286
+ return t;
287
+ }
288
+
289
+ function __awaiter(thisArg, _arguments, P, generator) {
290
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
291
+ return new (P || (P = Promise))(function (resolve, reject) {
292
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
293
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
294
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
295
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
296
+ });
297
+ }
298
+
301
299
  const cvaText = cvaMerge(["text-black", "m-0", "relative", "text-sm", "font-normal"], {
302
300
  variants: {
303
301
  align: {
@@ -374,7 +372,7 @@ const Text = (_a) => {
374
372
  subtle,
375
373
  disabled,
376
374
  className,
377
- }), "data-testid": dataTestId, children }, rest));
375
+ }), "data-testid": dataTestId }, rest), children);
378
376
  };
379
377
 
380
378
  const cvaSpinner = cvaMerge([
@@ -447,10 +445,9 @@ const cvaButton = cvaMerge([
447
445
  "outline-current",
448
446
  "transition-all",
449
447
  "ease-in-out",
450
- "component-button-border",
451
448
  "cursor-pointer",
452
449
  "flex-none",
453
- "py-1.5",
450
+ "component-button-border",
454
451
  "component-button-padding",
455
452
  "component-button-height",
456
453
  "focus:ring",
@@ -460,7 +457,6 @@ const cvaButton = cvaMerge([
460
457
  "text-sm",
461
458
  "font-medium",
462
459
  "align-middle",
463
- "h-min",
464
460
  ], {
465
461
  variants: {
466
462
  color: {
@@ -523,9 +519,24 @@ const cvaButton = cvaMerge([
523
519
  ],
524
520
  },
525
521
  size: {
526
- small: ["py-1", "px-2"],
527
- medium: "",
528
- large: ["py-2", "px-4"],
522
+ /**
523
+ * TLDR; Calculating min-height so button sizes are (more) consistently sized.
524
+ *
525
+ * OK. let me explain this one.
526
+ * min-h here is to match the height of a button that has text inside
527
+ * We could just use the same min-h-[var(--line-height-sm)]) for all sizes
528
+ * but then the button would be too small since button is using box-sizing: border-box
529
+ * and what we really want is to make sure it's _content_ is the same height as a
530
+ * button with text inside.
531
+ * We could then change the box-sizing to content-box but that would break other things
532
+ * and be inconsistent with almost all everything else.
533
+ *
534
+ * So we need to add padding to the min-height calculation. Two times the vertical
535
+ * padding aka py-1 * 2 aka --spacing-1 * 2 aka spacing-2 (for small).
536
+ */
537
+ small: ["py-1", "px-2", "min-h-[calc(var(--line-height-sm)+var(--spacing-2))]"],
538
+ medium: ["py-1.5", "px-3", "min-h-[calc(var(--line-height-sm)+var(--spacing-3))]"],
539
+ large: ["py-2", "px-4", "min-h-[calc(var(--line-height-sm)+var(--spacing-4))]"],
529
540
  },
530
541
  rounded: {
531
542
  true: ["rounded-full"],
@@ -549,6 +560,21 @@ const cvaButton = cvaMerge([
549
560
  },
550
561
  },
551
562
  compoundVariants: [
563
+ {
564
+ square: true,
565
+ size: "small",
566
+ className: ["p-1"], // square is easier with same padding on all sides
567
+ },
568
+ {
569
+ square: true,
570
+ size: "medium",
571
+ className: ["p-1.5"],
572
+ },
573
+ {
574
+ square: true,
575
+ size: "large",
576
+ className: ["p-2"],
577
+ },
552
578
  {
553
579
  color: "primary",
554
580
  variant: "transparent",
@@ -608,19 +634,6 @@ const cvaButton = cvaMerge([
608
634
  variant: "filled",
609
635
  },
610
636
  });
611
- const cvaButtonSpinner = cvaMerge(["!w-[1em]", "!h-[1em]"]);
612
- const cvaIconButtonContainer = cvaMerge(["w-5", "h-5", "flex", "justify-center", "items-center", "box-border"], {
613
- variants: {
614
- size: {
615
- small: ["flex", "justify-center", "items-center", "box-border"],
616
- medium: "",
617
- large: "",
618
- },
619
- },
620
- defaultVariants: {
621
- size: "medium",
622
- },
623
- });
624
637
 
625
638
  /**
626
639
  * Buttons allow users to perform an action when triggered.
@@ -635,16 +648,18 @@ const Button = React.forwardRef((_a, ref) => {
635
648
  type,
636
649
  role,
637
650
  onClick,
638
- tabIndex, disabled: disabled || loading, className: cvaButton({ rounded: circular, disabled, size, square, color, variant, fullWidth, className }), "aria-label": title, "data-testid": dataTestId, children: (jsxs(Fragment, { children: [loading && jsx(Spinner, { className: cvaButtonSpinner(), centering: "vertically" }), prefix, children, suffix] })) }, rest));
651
+ tabIndex, disabled: disabled || loading, className: cvaButton({ rounded: circular, disabled, size, square, color, variant, fullWidth, className }), "aria-label": title, "data-testid": dataTestId }, rest), jsxs(Fragment, { children: [loading ? jsx(Spinner, { size: "small", centering: "vertically" }) : null, prefix, children, suffix] }));
639
652
  });
653
+ Button.displayName = "Button";
640
654
 
641
655
  /**
642
656
  * The IconButton is used for a button with an icon.
643
657
  */
644
658
  const IconButton = React.forwardRef((_a, ref) => {
645
659
  var { icon, size = "small", square = true, loading, disabled } = _a, rest = __rest(_a, ["icon", "size", "square", "loading", "disabled"]);
646
- return (jsx(Button, Object.assign({ size: size, square: square, disabled: disabled || loading, ref: ref }, rest, { children: jsx("div", { className: cvaIconButtonContainer({ size }), children: loading ? jsx(Spinner, { size: size }) : icon }) })));
660
+ return (jsx(Button, Object.assign({ size: size, prefix: !loading ? icon : undefined, square: square, loading: loading, disabled: disabled || loading, ref: ref }, rest)));
647
661
  });
662
+ IconButton.displayName = "IconButton";
648
663
 
649
664
  /**
650
665
  * The StarButton component is used for favorite actions or similar.
@@ -708,11 +723,13 @@ const Alert = ({ color = "info", title, className, children, primaryAction, seco
708
723
  }
709
724
  };
710
725
  React.useEffect(() => {
726
+ var _a, _b;
711
727
  if (autoScroll) {
712
- ref && ref.current && ref.current.scrollIntoView && ref.current.scrollIntoView();
728
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
729
+ (_b = (_a = ref.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView) === null || _b === void 0 ? void 0 : _b.call(_a);
713
730
  }
714
731
  }, [ref, autoScroll]);
715
- return (jsxs("div", { className: cvaAlert({ color, className }), "data-testid": dataTestId, ref: ref, role: "alert", children: [jsxs("div", { className: cvaAlertContentContainer(), children: [jsx("div", { className: cvaAlertIconContainer(), children: getIconFromColor() }), jsxs("div", { className: cvaContent(), children: [title ? jsx(Text, { weight: "bold", children: title }) : null, children ? (jsx(Text, { type: typeof children === "string" || typeof children === "number" ? "p" : "span", weight: !title ? "bold" : "normal", children: children })) : null] }), onClose ? (jsx("div", { className: cvaAlertCloseButtonContainer(), children: jsx(IconButton, { size: "small", variant: "transparent", color: "secondary", onClick: onClose, icon: jsx(Icon, { name: "XMark", size: "small" }), title: "Close Alert", circular: true }) })) : null] }), (primaryAction || secondaryAction) && (jsxs("div", { className: cvaAlertActionsContainer(), children: [secondaryAction && (jsx(Button, { size: "small", variant: "transparent", color: getButtonColor(), onClick: secondaryAction.onClick, loading: secondaryAction === null || secondaryAction === void 0 ? void 0 : secondaryAction.loading, children: secondaryAction.label })), primaryAction && (jsx(Button, { size: "small", color: getButtonColor(), onClick: primaryAction.onClick, loading: primaryAction === null || primaryAction === void 0 ? void 0 : primaryAction.loading, children: primaryAction.label }))] }))] }));
732
+ return (jsxs("div", { className: cvaAlert({ color, className }), "data-testid": dataTestId, ref: ref, role: "alert", children: [jsxs("div", { className: cvaAlertContentContainer(), children: [jsx("div", { className: cvaAlertIconContainer(), children: getIconFromColor() }), jsxs("div", { className: cvaContent(), children: [title ? jsx(Text, { weight: "bold", children: title }) : null, children ? (jsx(Text, { type: typeof children === "string" || typeof children === "number" ? "p" : "span", weight: !title ? "bold" : "normal", children: children })) : null] }), onClose ? (jsx("div", { className: cvaAlertCloseButtonContainer(), children: jsx(IconButton, { size: "small", variant: "transparent", color: "secondary", onClick: onClose, icon: jsx(Icon, { name: "XMark", size: "small" }), title: "Close Alert", circular: true }) })) : null] }), primaryAction || secondaryAction ? (jsxs("div", { className: cvaAlertActionsContainer(), children: [secondaryAction ? (jsx(Button, { size: "small", variant: "transparent", color: getButtonColor(), onClick: secondaryAction.onClick, loading: secondaryAction.loading, children: secondaryAction.label })) : null, primaryAction ? (jsx(Button, { size: "small", color: getButtonColor(), onClick: primaryAction.onClick, loading: primaryAction.loading, children: primaryAction.label })) : null] })) : null] }));
716
733
  };
717
734
 
718
735
  const cvaBadge = cvaMerge([
@@ -788,7 +805,7 @@ const cvaCard = cvaMerge([
788
805
  fullHeight: false,
789
806
  },
790
807
  });
791
- const cvaCardFooterDensityContainer = cvaMerge(["flex border-t-2", "border-neutral-200", "justify-end", "flex-row"], {
808
+ const cvaCardFooterDensityContainer = cvaMerge(["flex", "border-t-2", "border-neutral-200", "justify-end", "flex-row"], {
792
809
  variants: {
793
810
  border: {
794
811
  default: "",
@@ -809,7 +826,7 @@ const cvaCardFooterDensityContainer = cvaMerge(["flex border-t-2", "border-neutr
809
826
  });
810
827
  const cvaCardHeader = cvaMerge(["flex", "justify-between", "flex-1"]);
811
828
  const cvaCardHeaderHeadingContainer = cvaMerge(["flex", "gap-4", "items-center"]);
812
- const cvaCardHeaderDensityContainer = cvaMerge(["flex border-b-2", "border-neutral-200"], {
829
+ const cvaCardHeaderDensityContainer = cvaMerge(["flex", "border-b-2", "border-neutral-200"], {
813
830
  variants: {
814
831
  border: {
815
832
  default: "",
@@ -955,7 +972,7 @@ const CardHeader = ({ heading, headingVariant = "primary", subHeading, onClose,
955
972
  density,
956
973
  border: hideSeparator ? "borderless" : "default",
957
974
  className,
958
- }), children: jsxs("div", { className: cvaCardHeader(), children: [jsxs("div", { className: extraClassName, children: [jsxs("div", { className: cvaCardHeaderHeadingContainer(), children: [jsx(Heading, { className: "self-center", variant: headingVariant, children: heading }), accessories] }), subHeading && (jsx(Heading, { subtle: true, variant: "subtitle", children: subHeading })), children] }), onClose && (jsx(IconButton, { dataTestId: "card-header-close-button", variant: "transparent", color: "secondary", onClick: onClose, icon: jsx(Icon, { name: "XMark", size: "small" }), className: "!h-min" }))] }) }));
975
+ }), children: jsxs("div", { className: cvaCardHeader(), children: [jsxs("div", { className: extraClassName, children: [jsxs("div", { className: cvaCardHeaderHeadingContainer(), children: [jsx(Heading, { className: "self-center", variant: headingVariant, children: heading }), accessories] }), subHeading ? (jsx(Heading, { subtle: true, variant: "subtitle", children: subHeading })) : null, children] }), onClose ? (jsx(IconButton, { dataTestId: "card-header-close-button", variant: "transparent", color: "secondary", onClick: onClose, icon: jsx(Icon, { name: "XMark", size: "small" }), className: "!h-min" })) : null] }) }));
959
976
  };
960
977
 
961
978
  const cvaCollapse = cvaMerge([
@@ -1195,11 +1212,11 @@ const cvaPopoverTitleContainer = cvaMerge(["flex", "items-center", "px-2", "py-1
1195
1212
  const cvaPopoverTitleText = cvaMerge(["flex-1", "text-neutral-500"]);
1196
1213
 
1197
1214
  const PopoverContent = React__default.forwardRef(function PopoverContent(_a, propRef) {
1198
- var _b, _c, _d;
1215
+ var _b;
1199
1216
  var { className, dataTestId, children, portalId } = _a, props = __rest(_a, ["className", "dataTestId", "children", "portalId"]);
1200
- const _e = usePopoverContext(), { context: floatingContext, customProps } = _e, context = __rest(_e, ["context", "customProps"]);
1217
+ const _c = usePopoverContext(), { context: floatingContext, customProps } = _c, context = __rest(_c, ["context", "customProps"]);
1201
1218
  const ref = useMergeRefs([context.refs.setFloating, propRef]);
1202
- return (jsx(FloatingPortal, { id: portalId !== null && portalId !== void 0 ? portalId : "tu-floating-ui", children: context.isOpen && (jsx(FloatingFocusManager, { guards: false, context: floatingContext, modal: context.isModal, closeOnFocusOut: false, order: ["reference", "content"], returnFocus: false, children: jsx("div", Object.assign({ ref: ref, className: cvaPopoverContainer({ className: className !== null && className !== void 0 ? className : customProps.className }), "data-testid": (_b = dataTestId !== null && dataTestId !== void 0 ? dataTestId : customProps.dataTestId) !== null && _b !== void 0 ? _b : "popover-content", style: Object.assign({ position: context.strategy, top: (_c = context.y) !== null && _c !== void 0 ? _c : 0, left: (_d = context.x) !== null && _d !== void 0 ? _d : 0, width: "max-content" }, props.style), "aria-labelledby": context.labelId, "aria-describedby": context.descriptionId }, context.getFloatingProps(props), { children: typeof children === "function" ? children(() => context.setIsOpen(false)) : children })) })) }));
1219
+ return (jsx(FloatingPortal, { id: portalId !== null && portalId !== void 0 ? portalId : "tu-floating-ui", children: context.isOpen ? (jsx(FloatingFocusManager, { guards: false, context: floatingContext, modal: context.isModal, closeOnFocusOut: false, order: ["reference", "content"], returnFocus: false, children: jsx("div", Object.assign({ ref: ref, className: cvaPopoverContainer({ className: className !== null && className !== void 0 ? className : customProps.className }), "data-testid": (_b = dataTestId !== null && dataTestId !== void 0 ? dataTestId : customProps.dataTestId) !== null && _b !== void 0 ? _b : "popover-content", style: Object.assign({ position: context.strategy, top: context.y, left: context.x, width: "max-content" }, props.style), "aria-labelledby": context.labelId, "aria-describedby": context.descriptionId }, context.getFloatingProps(props), { children: typeof children === "function" ? children(() => context.setIsOpen(false)) : children })) })) : null }));
1203
1220
  });
1204
1221
 
1205
1222
  /**
@@ -1215,7 +1232,7 @@ const PopoverTitle = ({ children, action, divider = false, className, dataTestId
1215
1232
  const PopoverTrigger = forwardRef(function PopoverTrigger(_a, propRef) {
1216
1233
  var { children, renderButton } = _a, props = __rest(_a, ["children", "renderButton"]);
1217
1234
  const context = usePopoverContext();
1218
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1235
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, local-rules/no-typescript-assertion
1219
1236
  const childrenRef = children.ref;
1220
1237
  const ref = useMergeRefs([context.refs.setReference, propRef, childrenRef]);
1221
1238
  if (!renderButton && isValidElement(children)) {
@@ -1254,7 +1271,7 @@ const DayRangePicker = ({ onRangeSelect, selectedDays, disabledDays, dataTestId,
1254
1271
  onRangeSelect({ from, to });
1255
1272
  }
1256
1273
  }, [onRangeSelect]);
1257
- return (jsx(DayPicker$1, { mode: "range", onSelect: onSelect, selected: selectedDays, defaultMonth: selectedDays && selectedDays.from, locale: locale, disabled: disabledDays, className: `custom-day-picker range-picker ${className !== null && className !== void 0 ? className : ""}`, max: max, footer: jsx("div", { "data-testid": dataTestId }) }));
1274
+ return (jsx(DayPicker$1, { mode: "range", onSelect: onSelect, selected: selectedDays, defaultMonth: selectedDays ? selectedDays.from : undefined, locale: locale, disabled: disabledDays, className: `custom-day-picker range-picker ${className !== null && className !== void 0 ? className : ""}`, max: max, footer: jsx("div", { "data-testid": dataTestId }) }));
1258
1275
  };
1259
1276
 
1260
1277
  const cvaDrawerOverlay = cvaMerge([
@@ -1322,7 +1339,6 @@ const cvaSkeletonLine = cvaMerge([
1322
1339
 
1323
1340
  /**
1324
1341
  * Display placeholder lines before the data gets loaded to reduce load-time frustration.
1325
-
1326
1342
  */
1327
1343
  const SkeletonLines = memo(({ margin = "10px 0", lines = 1, height, width = "100%", className, dataTestId }) => {
1328
1344
  const skeletonLines = [];
@@ -1344,6 +1360,7 @@ const SkeletonLines = memo(({ margin = "10px 0", lines = 1, height, width = "100
1344
1360
  // eslint-disable-next-line react/jsx-no-useless-fragment
1345
1361
  return jsx(Fragment, { children: skeletonLines });
1346
1362
  });
1363
+ SkeletonLines.displayName = "SkeletonLines";
1347
1364
 
1348
1365
  const cvaContainerStyles = cvaMerge([
1349
1366
  "flex",
@@ -1424,36 +1441,96 @@ const ExternalLink = ({ rel = "noreferrer", target = "_blank", href, className,
1424
1441
  return (jsx("a", { onClick: onClick, "data-testid": dataTestId, className: cvaExternalLink({ className }), title: title, href: href, rel: rel, target: target, children: children }));
1425
1442
  };
1426
1443
 
1427
- const cvaTooltipFlexContainer = cvaMerge("inline-flex");
1428
- const cvaTooltipPopover = cvaMerge("pointer-events-none origin-center");
1429
- cvaMerge("pointer-events-none origin-center");
1430
- const cvaTooltipContent = cvaMerge("max-w-sm rounded p-2", {
1444
+ const cvaTooltipFlexContainer = cvaMerge(["inline-flex", "hover:cursor-pointer"]);
1445
+ const cvaTooltipIcon = cvaMerge(["flex", "h-max", "w-fit", "text-slate-300", "transition", "hover:cursor-pointer", "hover:text-slate-400"], {
1446
+ variants: {
1447
+ color: {
1448
+ light: "hover:text-white",
1449
+ dark: "hover:text-slate-400",
1450
+ },
1451
+ defaultVariants: {
1452
+ color: "dark",
1453
+ },
1454
+ },
1455
+ });
1456
+ const cvaTooltipPopover = cvaMerge(["pointer-events-none", "origin-center"]);
1457
+ const cvaTooltipPopoverTail = cvaMerge("", {
1458
+ variants: {
1459
+ placement: {
1460
+ top: "top-full left-2/4 ml-[-5px]",
1461
+ "top-start": "top-full left-[5%]",
1462
+ "top-end": "top-full right-[5%]",
1463
+ bottom: "bottom-full right-2/4 mr-[-6px] ",
1464
+ "bottom-start": "bottom-full left-[5%]",
1465
+ "bottom-end": "bottom-full right-[5%]",
1466
+ left: "top-2/4 left-full mt-[-6px]",
1467
+ "left-start": "top-1/4 top-[8%]",
1468
+ "left-end": "bottom-1/4 bottom-[8%]",
1469
+ right: "top-2/4 right-full mt-[-6px] ",
1470
+ "right-start": "top-1/4 top-[8%]",
1471
+ "right-end": "bottom-1/4 bottom-[8%]",
1472
+ },
1473
+ mode: {
1474
+ light: "fill-white",
1475
+ dark: "fill-slate-600",
1476
+ },
1477
+ },
1478
+ defaultVariants: {
1479
+ placement: "bottom",
1480
+ mode: "dark",
1481
+ },
1482
+ });
1483
+ cvaMerge(["component-popover-border", "z-popover", "animate-fade-in-fast"]);
1484
+ const cvaTooltipPopoverContent = cvaMerge(["max-w-sm", "rounded", "p-2"], {
1431
1485
  variants: {
1432
1486
  color: {
1433
- light: "bg-white shadow-md",
1434
- dark: "bg-neutral-800 text-white",
1487
+ light: "bg-white shadow-lg",
1488
+ dark: "bg-slate-600 text-white",
1435
1489
  },
1436
1490
  },
1437
1491
  defaultVariants: {
1438
- color: "light",
1492
+ color: "dark",
1439
1493
  },
1440
1494
  });
1441
1495
 
1442
1496
  /**
1443
- * The Tooltip component is used to show helpful tips or contextual information to the users.
1497
+ *
1498
+ * @description Adding Tooltip Arrow
1499
+ * @returns {JSX.Element} Tooltip floating Arrow
1500
+ */
1501
+ const FloatingArrowContainer = ({ arrowRef, mode = "dark", }) => {
1502
+ const { context: floatingContext } = usePopoverContext();
1503
+ return (jsx(FloatingArrow, { ref: arrowRef, context: floatingContext, className: cvaTooltipPopoverTail({ mode, placement: floatingContext.placement }) }));
1504
+ };
1505
+ /**
1506
+ * Tooltips display additional information upon hover. The information included should be contextual, helpful, and nonessential while providing that extra ability to communicate and give clarity to a user.
1507
+ *
1508
+ * Tooltips should be used sparingly and contain succinct, supplementary information, and they should contain read-only text. **❗️Do not include interactive elements in tooltips ** (no links, buttons, etc). Interactive elements in tooltips are inaccessible since tooltips do not receive focus.
1509
+ *
1510
+ * **Do use** tooltips to expose names of icon buttons that lack visual labels, when more information is useful in helping a user understand the context, when an element needs additional explanation, or use when defining a term or inline item.
1511
+ *
1512
+ * **Do not use** tooltips to include information that is necessary for the user to complete their task. Use helper text that is always visible and accessible for vital information.
1444
1513
 
1445
1514
  * @param {TooltipProps} props - The props for the Tooltip component
1446
1515
  * @returns {JSX.Element} Tooltip component
1447
1516
  */
1448
- const Tooltip = (_a) => {
1449
- var { children, dataTestId, disabled, className } = _a, rest = __rest(_a, ["children", "dataTestId", "disabled", "className"]);
1450
- const wrappedChildren = (jsx("div", { className: cvaTooltipFlexContainer({ className }), "data-testid": dataTestId && `${dataTestId}-parent`, children: children }));
1517
+ const Tooltip = ({ children, dataTestId = "tool-tip", disabled, className, label, placement = "auto", mode = "dark", contentTextType = "p", iconProps, }) => {
1518
+ const [isOpen, setIsOpen] = React.useState(false);
1519
+ const arrowRef = React.useRef(null);
1520
+ const { refs, floatingStyles, context } = useFloating({
1521
+ placement: placement === "auto" ? "bottom" : placement,
1522
+ open: isOpen,
1523
+ onOpenChange: setIsOpen,
1524
+ middleware: [offset(8), arrow({ element: arrowRef })],
1525
+ whileElementsMounted: autoUpdate,
1526
+ });
1527
+ const { isMounted } = useTransitionStatus(context);
1528
+ const wrappedChildren = (jsx("div", { className: cvaTooltipFlexContainer({ className }), "data-testid": dataTestId ? `${dataTestId}-parent` : null, children: children }));
1451
1529
  if (disabled) {
1452
1530
  return wrappedChildren;
1453
1531
  }
1454
- return (jsx(TooltipContainer, Object.assign({ dataTestId: dataTestId }, rest, { children: wrappedChildren })));
1532
+ return (jsxs(Popover, { className: cvaTooltipPopover(), placement: placement === "auto" ? "bottom" : placement, activation: { hover: true }, dataTestId: dataTestId, children: [jsx(PopoverTrigger, { className: cvaTooltipIcon({ color: mode }), ref: refs.setReference, onMouseEnter: () => setIsOpen(true), onMouseLeave: () => setIsOpen(false), "data-testid": dataTestId ? `${dataTestId}-trigger` : null, children: children === undefined ? (jsx("div", { children: jsx(Icon, Object.assign({ name: "QuestionMarkCircle", size: "small", dataTestId: dataTestId ? `${dataTestId}-icon` : undefined }, iconProps)) })) : (wrappedChildren) }), isMounted ? (jsx("div", { ref: refs.setFloating, style: floatingStyles, children: jsx(PopoverContent, { children: jsxs("div", { "aria-label": typeof label === "string" ? label : undefined, className: cvaTooltipPopoverContent({ color: mode }), "data-testid": `${dataTestId}-content`, children: [jsx(Text, { inverted: mode === "dark", type: contentTextType, children: label }), placement !== "auto" && jsx(FloatingArrowContainer, { arrowRef: arrowRef, mode: mode })] }) }) })) : null] }));
1455
1533
  };
1456
- const TooltipContainer = ({ label, placement = "bottom", mode = "dark", contentTextType = "p", children, dataTestId, }) => (jsxs(Popover, { className: cvaTooltipPopover(), placement: placement, activation: { hover: true }, dataTestId: dataTestId !== null && dataTestId !== void 0 ? dataTestId : "", children: [jsx(PopoverTrigger, { children: children }), jsx(PopoverContent, { children: jsx("div", { "aria-label": typeof label === "string" ? label : undefined, className: cvaTooltipContent({ color: mode }), children: jsx(Text, { inverted: mode === "dark", type: contentTextType, children: label }) }) })] }));
1457
1534
 
1458
1535
  const cvaIndicator = cvaMerge(["flex", "items-center"]);
1459
1536
  const cvaIndicatorIcon = cvaMerge(["mr-2"]);
@@ -1555,7 +1632,7 @@ const cvaIndicatorIconBackground = cvaMerge(["rounded-full", "items-center", "ju
1555
1632
  */
1556
1633
  const Indicator = (_a) => {
1557
1634
  var { dataTestId, icon, label, color = "unknown", withBackground = true, withLabel = true, ping = false, className } = _a, rest = __rest(_a, ["dataTestId", "icon", "label", "color", "withBackground", "withLabel", "ping", "className"]);
1558
- return (jsx(Tooltip, { className: className, disabled: withLabel, label: label, children: jsxs("div", Object.assign({ className: cvaIndicator(), "data-testid": dataTestId, "aria-label": label }, rest, { children: [jsxs("div", { className: cvaIndicatorIconBackground({ color, background: withBackground ? "visible" : "hidden" }), "data-testid": dataTestId ? `${dataTestId}-background` : "indicator-background", children: [ping && (jsx("div", { className: cvaIndicatorPing({ color }), "data-testid": dataTestId ? `${dataTestId}-ping` : "indicator-ping" })), icon] }), label !== undefined && withLabel && (jsx("div", { className: cvaIndicatorLabel(), "data-testid": dataTestId ? `${dataTestId}-label` : "indicator-label", children: label }))] })) }));
1635
+ return (jsx(Tooltip, { className: className, disabled: withLabel, label: label, placement: "bottom", children: jsxs("div", Object.assign({ className: cvaIndicator(), "data-testid": dataTestId, "aria-label": label }, rest, { children: [jsxs("div", { className: cvaIndicatorIconBackground({ color, background: withBackground ? "visible" : "hidden" }), "data-testid": dataTestId ? `${dataTestId}-background` : "indicator-background", children: [ping ? jsx("div", { className: cvaIndicatorPing({ color }), "data-testid": dataTestId ? `${dataTestId}-ping` : "indicator-ping" }) : null, icon] }), label !== undefined && withLabel ? jsx("div", { className: cvaIndicatorLabel(), "data-testid": dataTestId ? `${dataTestId}-label` : "indicator-label", children: label }) : null] })) }));
1559
1636
  };
1560
1637
 
1561
1638
  const cvaMenuItem = cvaMerge([
@@ -1642,7 +1719,7 @@ const MenuItem = ({ className, dataTestId, label, size, children, selected, focu
1642
1719
  }), onClick: e => {
1643
1720
  stopPropagation && e.stopPropagation();
1644
1721
  onClick && onClick(e);
1645
- }, tabIndex: 0, children: [prefix && (jsx("div", { className: cvaMenuItemPrefix({ selected }), "data-testid": dataTestId && `${dataTestId}-prefix`, children: prefix })), children && typeof children !== "string" ? (children) : (jsx("div", { className: cvaMenuItemLabel(), "data-testid": dataTestId && `${dataTestId}-label`, children: children !== null && children !== void 0 ? children : label })), suffix && (jsx("div", { className: cvaMenuItemSuffix({ selected }), "data-testid": dataTestId && `${dataTestId}-suffix`, children: suffix }))] })));
1722
+ }, tabIndex: 0, children: [prefix ? jsx("div", { className: cvaMenuItemPrefix({ selected }), "data-testid": dataTestId ? `${dataTestId}-prefix` : null, children: prefix }) : null, children && typeof children !== "string" ? (children) : (jsx("div", { className: cvaMenuItemLabel(), "data-testid": dataTestId ? `${dataTestId}-label` : null, children: children !== null && children !== void 0 ? children : label })), suffix ? jsx("div", { className: cvaMenuItemSuffix({ selected }), "data-testid": dataTestId ? `${dataTestId}-suffix` : null, children: suffix }) : null] })));
1646
1723
  };
1647
1724
 
1648
1725
  const cvaMenuList = cvaMerge(["shadow-md", "rounded-lg", "z-20", "bg-white", "p-1", "border", "border-slate-300", "gap-1", "grid"], {
@@ -1670,7 +1747,7 @@ const MenuList = (_a) => {
1670
1747
  var { dataTestId, className, children, withStickyHeader = false, showDivider = false } = _a, args = __rest(_a, ["dataTestId", "className", "children", "withStickyHeader", "showDivider"]);
1671
1748
  const childrenArr = Children.toArray(children);
1672
1749
  const isLastItem = (index) => index === childrenArr.length - 1;
1673
- return (jsx("div", { "data-testid": dataTestId, className: cvaMenuList({ stickyHeader: withStickyHeader, className }), tabIndex: 0, role: "list", onClick: args.onClick, children: Children.map(childrenArr, (menuItem, index) => (jsxs(Fragment, { children: [menuItem, showDivider && !isLastItem(index) && jsx("hr", { className: cvaMenuListDivider() })] }))) }));
1750
+ return (jsx("div", { "data-testid": dataTestId, className: cvaMenuList({ stickyHeader: withStickyHeader, className }), tabIndex: 0, role: "list", onClick: args.onClick, children: Children.map(childrenArr, (menuItem, index) => (jsxs(Fragment, { children: [menuItem, showDivider && !isLastItem(index) ? jsx("hr", { className: cvaMenuListDivider() }) : null] }))) }));
1674
1751
  };
1675
1752
 
1676
1753
  const cvaMoreMenu = cvaMerge(["p-4"]);
@@ -1734,12 +1811,9 @@ const cvaModalBackdrop = cvaMerge([
1734
1811
  const ModalBackdrop = ({ children, isVisible, onClick }) => {
1735
1812
  const ref = React.useRef(null);
1736
1813
  return (jsx("div", { ref: ref, className: cvaModalBackdrop({ show: isVisible }), onMouseDown: e => {
1737
- var _a, _b;
1738
1814
  // only react on click on backdrop - accessing first child to get around styled element element
1739
- if (ref.current !== null) {
1740
- if ((e === null || e === void 0 ? void 0 : e.target) === ((_b = (_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.children) === null || _b === void 0 ? void 0 : _b[0])) {
1741
- onClick();
1742
- }
1815
+ if (ref.current !== null && e.target === ref.current.children[0]) {
1816
+ onClick();
1743
1817
  }
1744
1818
  }, children: children }));
1745
1819
  };
@@ -1753,8 +1827,9 @@ const ModalBackdrop = ({ children, isVisible, onClick }) => {
1753
1827
  const Modal = React.forwardRef(({ isOpen, children, dataTestId, className, role = "", onDismissClick = () => {
1754
1828
  return;
1755
1829
  }, }, ref) => {
1756
- return (jsx(ModalBackdrop, { isVisible: isOpen, onClick: onDismissClick, children: isOpen && (jsx("div", { className: cvaModalContainer(), ref: ref, role: role, children: jsx(Card, { dataTestId: dataTestId, className: cvaModalCard({ className }), children: children }) })) }));
1830
+ return (jsx(ModalBackdrop, { isVisible: isOpen, onClick: onDismissClick, children: isOpen ? (jsx("div", { className: cvaModalContainer(), ref: ref, role: role, children: jsx(Card, { dataTestId: dataTestId, className: cvaModalCard({ className }), children: children }) })) : null }));
1757
1831
  });
1832
+ Modal.displayName = "Modal";
1758
1833
 
1759
1834
  /**
1760
1835
  * The useModal component should be used to inform the user of important information.
@@ -1767,10 +1842,12 @@ const useModal = ({ closeOnOutsideClick } = {}) => {
1767
1842
  const { isOpen, togglePortal, openPortal, closePortal, Portal } = usePortal({
1768
1843
  closeOnOutsideClick,
1769
1844
  onPortalClick: ({ target }) => {
1845
+ var _a;
1770
1846
  if (!closeOnOutsideClick) {
1771
1847
  return;
1772
1848
  }
1773
- const clickingOutsideModal = modalRef && modalRef.current && !modalRef.current.contains(target);
1849
+ // eslint-disable-next-line local-rules/no-typescript-assertion
1850
+ const clickingOutsideModal = !((_a = modalRef.current) === null || _a === void 0 ? void 0 : _a.contains(target));
1774
1851
  if (clickingOutsideModal) {
1775
1852
  closePortal();
1776
1853
  }
@@ -1788,31 +1865,7 @@ const useModal = ({ closeOnOutsideClick } = {}) => {
1788
1865
  };
1789
1866
  };
1790
1867
 
1791
- const cvaTip = cvaMerge("flex text-slate-300 transition hover:text-slate-500");
1792
- const cvaTipContent = cvaMerge("flex max-w-sm items-center gap-2 rounded p-2 text-sm", {
1793
- variants: {
1794
- color: {
1795
- light: "bg-white shadow-md",
1796
- dark: "bg-neutral-800 text-white",
1797
- },
1798
- },
1799
- defaultVariants: {
1800
- color: "light",
1801
- },
1802
- });
1803
-
1804
- /**
1805
- * The Tip component is used to show helpful tips or contextual information to the users.
1806
- * The tip can optionally be rendered as an anchor tag, which redirects to users to an external link on click.
1807
-
1808
- * @param {TipProps} props - The props for the Tip component
1809
- * @returns {JSX.Element} Tip component
1810
- */
1811
- const Tip = ({ children, iconProps, dataTestId, className, placement = "bottom", mode = "dark", link, }) => {
1812
- return (jsx("span", { "data-testid": dataTestId, className: cvaTip({ className }), children: jsxs(Popover, { placement: placement, activation: { click: true }, dataTestId: dataTestId !== null && dataTestId !== void 0 ? dataTestId : "", children: [jsx(PopoverTrigger, { children: jsx("div", { "data-testid": dataTestId && `${dataTestId}-trigger`, children: jsx(Icon, Object.assign({ name: "QuestionMarkCircle", size: "medium", dataTestId: dataTestId && `${dataTestId}-icon` }, iconProps)) }) }), jsx(PopoverContent, { children: jsxs("div", { className: cvaTipContent({ color: mode }), children: [jsx("div", { children: typeof children === "string" ? jsx("p", { children: children }) : children }), link ? (jsx("a", { href: link, children: jsx(Icon, { name: "ArrowRightCircle" }) })) : null] }) })] }) }));
1813
- };
1814
-
1815
- const cvaPageHeaderContainer = cvaMerge(["bg-white"], {
1868
+ const cvaPageHeaderContainer = cvaMerge(["bg-white", "tu-page-header"], {
1816
1869
  variants: {
1817
1870
  withBorder: {
1818
1871
  true: ["border-b", "border-b-secondary-200"],
@@ -1821,10 +1874,9 @@ const cvaPageHeaderContainer = cvaMerge(["bg-white"], {
1821
1874
  },
1822
1875
  });
1823
1876
  const cvaPageHeader = cvaMerge([
1824
- "min-h-[72px]",
1825
1877
  "box-border",
1826
- "px-6",
1827
- "py-5",
1878
+ "py-responsive-space",
1879
+ "px-responsive-space-lg",
1828
1880
  "flex",
1829
1881
  "flex-wrap",
1830
1882
  "items-center",
@@ -1833,7 +1885,7 @@ const cvaPageHeader = cvaMerge([
1833
1885
  "justify-between",
1834
1886
  ]);
1835
1887
  const cvaPageHeaderHeading = cvaMerge(["flex", "text-slate-900", "text-2xl", "font-bold", "min-w-0"]);
1836
- const cvaPageHeaderHeadingContainer = cvaMerge(["flex", "gap-x-4", "items-center"]);
1888
+ const cvaPageHeaderHeadingContainer = cvaMerge(["flex", "gap-x-4", "flex-wrap", "items-center"]);
1837
1889
  const cvaPageHeaderHeadingAccessoriesContainer = cvaMerge([
1838
1890
  "flex",
1839
1891
  "flex-wrap",
@@ -1842,6 +1894,16 @@ const cvaPageHeaderHeadingAccessoriesContainer = cvaMerge([
1842
1894
  "gap-y-2",
1843
1895
  ]);
1844
1896
  const cvaPageHeaderChildContainer = cvaMerge(["flex", "flex-wrap", "gap-x-6", "items-center"]);
1897
+ const cvaPageHeaderDescriptionAndLinkContainer = cvaMerge(["flex", "h-fit", "items-center", "gap-1"]);
1898
+ const cvaPageHeaderLink = cvaMerge([
1899
+ "text-primary-600",
1900
+ "hover:text-primary-700",
1901
+ "flex",
1902
+ "items-center",
1903
+ "gap-1",
1904
+ "text-xs",
1905
+ "underline",
1906
+ ]);
1845
1907
 
1846
1908
  /**
1847
1909
  * Pageheader component is used to display a page header.
@@ -1851,11 +1913,11 @@ const cvaPageHeaderChildContainer = cvaMerge(["flex", "flex-wrap", "gap-x-6", "i
1851
1913
  * @param {PageHeaderProps} props - The props for the PageHeader component
1852
1914
  * @returns {JSX.Element} PageHeader component
1853
1915
  */
1854
- const PageHeader = ({ className, dataTestId, action, showLoading, description, link, title, tag, backTo, tagColor, children, tabsList, }) => {
1916
+ const PageHeader = ({ className, dataTestId, action, showLoading, description, link, title, tag, backTo, tagColor, children, tabsList, linkText = "Help Center Article", }) => {
1855
1917
  return (jsxs("div", { className: cvaPageHeaderContainer({
1856
- className: `${className} tu-page-header`,
1857
- withBorder: !Boolean(tabsList),
1858
- }), "data-testid": dataTestId, children: [jsxs("div", { className: cvaPageHeader(), children: [jsxs("div", { className: cvaPageHeaderHeadingAccessoriesContainer(), "data-testid": dataTestId && `${dataTestId}-heading-container`, children: [jsxs("div", { className: cvaPageHeaderHeadingContainer(), children: [backTo && (jsx(IconButton, { to: backTo, renderAs: Link, color: "tertiary", variant: "transparent", size: "small", icon: jsx(Icon, { name: "ArrowLeft" }) })), jsx("h1", { className: cvaPageHeaderHeading(), "data-testid": dataTestId && `${dataTestId}-heading`, children: title }), description && !showLoading && (jsx(Tip, { dataTestId: dataTestId && `${dataTestId}-tip`, iconProps: { name: "QuestionMarkCircle" }, link: link, children: description }))] }), tag && !showLoading && (jsx(Tag, { dataTestId: dataTestId, color: tagColor, children: tag })), showLoading && jsx(Spinner, { dataTestId: dataTestId && `${dataTestId}-spinner`, centering: "vertically" }), action] }), jsx("div", { className: cvaPageHeaderChildContainer(), children: children })] }), tabsList] }));
1918
+ className,
1919
+ withBorder: !tabsList,
1920
+ }), "data-testid": dataTestId, children: [jsxs("div", { className: cvaPageHeader(), children: [jsxs("div", { className: cvaPageHeaderHeadingAccessoriesContainer(), "data-testid": dataTestId ? `${dataTestId}-heading-container` : undefined, children: [jsxs("div", { className: cvaPageHeaderHeadingContainer(), children: [backTo ? (jsx(IconButton, { to: backTo, renderAs: Link, color: "tertiary", variant: "transparent", size: "small", icon: jsx(Icon, { name: "ArrowLeft" }) })) : undefined, jsx("h1", { className: cvaPageHeaderHeading(), "data-testid": dataTestId ? `${dataTestId}-heading` : undefined, children: title }), description && !showLoading ? (jsxs("div", { className: cvaPageHeaderDescriptionAndLinkContainer(), children: [jsx(Tooltip, { label: description, dataTestId: dataTestId ? `${dataTestId}-tooltip` : undefined, iconProps: { name: "QuestionMarkCircle" }, placement: "bottom" }), link ? (jsxs(Link, { to: link, "data-testid": "tooltip-link", target: "_blank", className: cvaPageHeaderLink(), children: [linkText, jsx(Icon, { name: "ArrowTopRightOnSquare", size: "small" })] })) : undefined] })) : undefined] }), tag && !showLoading ? (jsx(Tag, { dataTestId: dataTestId ? `${dataTestId}-tag` : undefined, color: tagColor, children: tag })) : undefined, showLoading ? (jsx(Spinner, { dataTestId: dataTestId ? `${dataTestId}-spinner` : undefined, centering: "vertically" })) : null, action] }), children ? jsx("div", { className: cvaPageHeaderChildContainer(), children: children }) : null] }), tabsList] }));
1859
1921
  };
1860
1922
 
1861
1923
  const cvaPagination = cvaMerge(["flex", "items-center", "gap-1"]);
@@ -1904,7 +1966,7 @@ const Pagination = ({ previousPage, nextPage, canPreviousPage, canNextPage, page
1904
1966
  if (loading) {
1905
1967
  return (jsx("div", { className: cvaPagination({ className }), children: jsx(SkeletonLines, { height: 16, width: 150 }) }));
1906
1968
  }
1907
- return (jsxs("div", { "data-testid": dataTestId, className: cvaPagination({ className }), children: [jsx(IconButton, { onClick: () => handlePageChange("prev"), disabled: cursorBase ? !canPreviousPage || false : page !== undefined && page <= 0, "data-testid": "prev-page", icon: jsx(Icon, { name: "ChevronLeft", size: "small" }), size: "small", color: "secondary", variant: "transparent" }), !cursorBase && (jsxs(Fragment, { children: [jsx("div", { className: cvaPaginationText(), "data-testid": "current-page", children: currentPage }), jsx("div", { className: cvaPaginationText(), "data-testid": "page-count", children: pageCount !== null && pageCount !== undefined && getTranslatedCount && getTranslatedCount(pageCount) })] })), jsx(IconButton, { onClick: () => handlePageChange("next"), disabled: cursorBase
1969
+ return (jsxs("div", { "data-testid": dataTestId, className: cvaPagination({ className }), children: [jsx(IconButton, { onClick: () => handlePageChange("prev"), disabled: cursorBase ? !canPreviousPage || false : page !== undefined && page <= 0, "data-testid": "prev-page", icon: jsx(Icon, { name: "ChevronLeft", size: "small" }), size: "small", color: "secondary", variant: "transparent" }), !cursorBase && (jsxs(Fragment, { children: [jsx("div", { className: cvaPaginationText(), "data-testid": "current-page", children: currentPage }), jsx("div", { className: cvaPaginationText(), "data-testid": "page-count", children: pageCount !== null && pageCount !== undefined && getTranslatedCount ? getTranslatedCount(pageCount) : null })] })), jsx(IconButton, { onClick: () => handlePageChange("next"), disabled: cursorBase
1908
1970
  ? !canNextPage || false
1909
1971
  : page !== undefined && pageCount !== undefined && pageCount !== null && page >= pageCount - 1, "data-testid": "next-page", icon: jsx(Icon, { name: "ChevronRight", size: "small" }), size: "small", color: "secondary", variant: "transparent" })] }));
1910
1972
  };
@@ -1950,8 +2012,7 @@ const usePrompt = (message, when = true) => {
1950
2012
  };
1951
2013
  }, [message, when]);
1952
2014
  const confirmExit = useCallback(() => {
1953
- const confirm = window.confirm(message);
1954
- return confirm;
2015
+ return window.confirm(message);
1955
2016
  }, [message]);
1956
2017
  useConfirmExit(confirmExit, when);
1957
2018
  };
@@ -2001,11 +2062,11 @@ const Spacer = ({ size = "medium", border = false, dataTestId, className }) => {
2001
2062
  * @returns {JSX.Element} SectionHeader component
2002
2063
  */
2003
2064
  const SectionHeader = ({ title, subtitle, dataTestId, addons }) => {
2004
- return (jsxs("div", { className: "flex flex-col", children: [jsx(HelmetProvider, { children: jsx(Helmet, { title: title }) }), jsxs("div", { className: "mb-2 flex flex-row gap-2", children: [jsxs("div", { className: "flex grow flex-col gap-2", children: [jsx(Heading, { variant: "secondary", dataTestId: dataTestId, children: title }), subtitle && (jsx(Heading, { variant: "subtitle", subtle: true, children: subtitle }))] }), addons && jsx("div", { className: "flex gap-2", children: addons })] }), jsx(Spacer, { size: "small" })] }));
2065
+ return (jsxs("div", { className: "flex flex-col", children: [jsx(HelmetProvider, { children: jsx(Helmet, { title: title }) }), jsxs("div", { className: "mb-2 flex flex-row gap-2", children: [jsxs("div", { className: "flex grow flex-col gap-2", children: [jsx(Heading, { variant: "secondary", dataTestId: dataTestId, children: title }), subtitle ? jsx(Heading, { variant: "subtitle", subtle: true, children: subtitle }) : null] }), addons ? jsx("div", { className: "flex gap-2", children: addons }) : null] }), jsx(Spacer, { size: "small" })] }));
2005
2066
  };
2006
2067
 
2007
- const cvaSidebar = cvaMerge(["apply grid", "grid-cols-fr-min", "items-center"]);
2008
- const cvaSidebarChildContainer = cvaMerge(["apply flex", "overflow-hidden", "gap-2", "p-1", "max-w-full"], {
2068
+ const cvaSidebar = cvaMerge(["apply", "grid", "grid-cols-fr-min", "items-center"]);
2069
+ const cvaSidebarChildContainer = cvaMerge(["apply", "flex", "overflow-hidden", "gap-2", "p-1", "max-w-full"], {
2009
2070
  variants: {
2010
2071
  breakpoint: {
2011
2072
  xs: ["xs:overflow-visible", "xs:p-0", "xs:grid", "xs:grid-cols-1", "xs:w-full"],
@@ -2043,7 +2104,7 @@ const useOverflowItems = ({ threshold = 1, childUniqueIdentifierAttribute = "id"
2043
2104
  }, [childUniqueIdentifierAttribute]);
2044
2105
  const observe = useCallback(() => {
2045
2106
  const node = overflowContainerRef.current;
2046
- if (node && node.children) {
2107
+ if (node) {
2047
2108
  const root = overflowContainerRef.current;
2048
2109
  const options = { root, threshold };
2049
2110
  const observer = new IntersectionObserver(handleIntersection, options);
@@ -2096,7 +2157,7 @@ const Sidebar = ({ childContainerClassName, children, breakpoint = "lg", classNa
2096
2157
  }
2097
2158
  return "visible";
2098
2159
  };
2099
- return (jsxs("div", { className: cvaSidebar({ className }), "data-testid": dataTestId, children: [jsx("div", { ref: overflowContainerRef, className: cvaSidebarChildContainer({ breakpoint, className: childContainerClassName }), "data-testid": dataTestId && `${dataTestId}-child-container`, children: React__default.Children.map(children, child => {
2160
+ return (jsxs("div", { className: cvaSidebar({ className }), "data-testid": dataTestId, children: [jsx("div", { ref: overflowContainerRef, className: cvaSidebarChildContainer({ breakpoint, className: childContainerClassName }), "data-testid": dataTestId ? `${dataTestId}-child-container` : null, children: React__default.Children.map(children, child => {
2100
2161
  return React__default.cloneElement(child, {
2101
2162
  className: `${child.props.className} ${itemVisibilityClassName(child.props.id)}`,
2102
2163
  });
@@ -2104,12 +2165,12 @@ const Sidebar = ({ childContainerClassName, children, breakpoint = "lg", classNa
2104
2165
  circular: false,
2105
2166
  variant: "transparent",
2106
2167
  color: "secondary",
2107
- }, popoverProps: { placement: "bottom-end" } }, moreMenuProps, { className: `${(moreMenuProps === null || moreMenuProps === void 0 ? void 0 : moreMenuProps.className) || ""} !p-0`, dataTestId: dataTestId && `${dataTestId}-more-menu`, children: close => (jsx(MenuList, Object.assign({}, menuListProps, { dataTestId: dataTestId && `${dataTestId}-menu-list`, children: React__default.Children.map(children, child => {
2168
+ }, popoverProps: { placement: "bottom-end" } }, moreMenuProps, { className: `${(moreMenuProps === null || moreMenuProps === void 0 ? void 0 : moreMenuProps.className) || ""} !p-0`, dataTestId: dataTestId ? `${dataTestId}-more-menu` : undefined, children: close => (jsx(MenuList, Object.assign({}, menuListProps, { dataTestId: dataTestId ? `${dataTestId}-menu-list` : undefined, children: React__default.Children.map(children, child => {
2108
2169
  return itemOverflowMap[child.props.id]
2109
2170
  ? React__default.cloneElement(child, {
2110
2171
  onClick: () => {
2111
2172
  var _a, _b;
2112
- (_b = (_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a);
2173
+ (_b = (_a = child.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a);
2113
2174
  close();
2114
2175
  },
2115
2176
  })
@@ -2171,7 +2232,7 @@ const cvaTab = cvaMerge([
2171
2232
  */
2172
2233
  const Tab = (_a) => {
2173
2234
  var { value, isFullWidth = false, iconName, dataTestId, className, children, suffix, asChild, appendTabStylesToChildIfAsChild = true } = _a, rest = __rest(_a, ["value", "isFullWidth", "iconName", "dataTestId", "className", "children", "suffix", "asChild", "appendTabStylesToChildIfAsChild"]);
2174
- const renderContent = () => (jsxs(Fragment, { children: [iconName && jsx(Icon, { name: iconName, size: "small" }), React__default.isValidElement(children) ? children.props.children : children, suffix] }));
2235
+ const renderContent = () => (jsxs(Fragment, { children: [iconName ? jsx(Icon, { name: iconName, size: "small" }) : null, React__default.isValidElement(children) ? children.props.children : children, suffix] }));
2175
2236
  const commonProps = Object.assign({ className: appendTabStylesToChildIfAsChild ? cvaTab({ className, isFullWidth }) : className }, rest);
2176
2237
  return (jsx(Trigger, { asChild: true, value: value, children: asChild && typeof children !== "string" ? (React__default.cloneElement(children, Object.assign(Object.assign({}, commonProps), { children: renderContent() }))) : (jsx("button", Object.assign({}, commonProps, { "data-testid": dataTestId, children: renderContent() }))) }));
2177
2238
  };
@@ -2181,7 +2242,7 @@ const Tab = (_a) => {
2181
2242
  */
2182
2243
  const TabContent = (_a) => {
2183
2244
  var { className, dataTestId, children } = _a, rest = __rest(_a, ["className", "dataTestId", "children"]);
2184
- return (jsx(Content, Object.assign({ "data-testid": `${dataTestId}-content`, className: cvaTabContent({ className }) }, rest, { children: children })));
2245
+ return (jsx(Content, Object.assign({ "data-testid": dataTestId ? `${dataTestId}-content` : undefined, className: cvaTabContent({ className }) }, rest, { children: children })));
2185
2246
  };
2186
2247
 
2187
2248
  /**
@@ -2233,7 +2294,7 @@ const Timeline = ({ className, dataTestId, children }) => {
2233
2294
  * @returns {JSX.Element} component
2234
2295
  */
2235
2296
  const TimelineElement = ({ date, showTime, children, className, dataTestId = "timeline-date", dot = jsx(Indicator, { className: "mt-[-1px]", color: "neutral", icon: jsx(Icon, { name: "Calendar", size: "large" }) }), header = defaultHeader(date, showTime), onClick, }) => {
2236
- return (jsxs("li", { className: cvaTimelineElement({ className }), "data-date": `${date}`, "data-testid": dataTestId && `${dataTestId}`, onClick: () => onClick && onClick(), children: [jsx("div", { className: cvaTimelineDot(), children: dot }), jsx("div", { children: header }), jsx("div", {}), jsx("div", { children: jsx("div", { children: children }) })] }));
2297
+ return (jsxs("li", { className: cvaTimelineElement({ className }), "data-date": `${date}`, "data-testid": dataTestId ? `${dataTestId}` : null, onClick: () => onClick && onClick(), children: [jsx("div", { className: cvaTimelineDot(), children: dot }), jsx("div", { children: header }), jsx("div", {}), jsx("div", { children: jsx("div", { children: children }) })] }));
2237
2298
  };
2238
2299
  function defaultHeader(date, showTime) {
2239
2300
  return `${format(date, showTime ? "MMM d, yyyy H:mm" : "MMM d, yyyy")} (${formatDistance(date, new Date(), {
@@ -2348,7 +2409,7 @@ const ValueBar = ({ value, min = 0, max = 100, unit, size = "small", levelColors
2348
2409
  const score = getScore(value, min, max);
2349
2410
  const barFillColor = levelColors ? getFillColor(score, levelColors) : getDefaultFillColor(score);
2350
2411
  const barWidth = showValue && size === "small" ? 90 : 100;
2351
- return (jsx("svg", { className: cvaValueBar({ size, className }), "data-testid": dataTestId, children: jsxs("g", { children: [jsx("rect", { className: cvaValueBarProgress({ fill: "background" }), width: `${barWidth}%`, rx: "5" }), jsx("rect", { className: cvaValueBarProgress(), width: `${score * barWidth}%`, fill: barFillColor, rx: "5" }), showValue && size === "large" && (jsxs("text", { className: cvaValueBarText({ size }), x: "12", y: "23", fill: valueColor !== null && valueColor !== void 0 ? valueColor : "white", children: [Number(value.toFixed(1)), unit || ""] })), showValue && size === "small" && (jsxs("text", { className: cvaValueBarText({ size }), x: `${barWidth + 2}%`, y: "11", fill: valueColor !== null && valueColor !== void 0 ? valueColor : color("NEUTRAL", 400, "CSS"), children: [Number(value.toFixed(1)), unit || ""] }))] }) }));
2412
+ return (jsx("svg", { className: cvaValueBar({ size, className }), "data-testid": dataTestId, role: "img", children: jsxs("g", { children: [jsx("rect", { className: cvaValueBarProgress({ fill: "background" }), width: `${barWidth}%`, rx: "5", "data-testid": "value-bar-svg-rect-0" }), jsx("rect", { className: cvaValueBarProgress(), width: `${score * barWidth}%`, fill: barFillColor, rx: "5", "data-testid": "value-bar-svg-rect-1" }), showValue && size === "large" ? (jsxs("text", { className: cvaValueBarText({ size }), x: "12", y: "23", fill: valueColor !== null && valueColor !== void 0 ? valueColor : "white", children: [Number(value.toFixed(1)), unit || ""] })) : null, showValue && size === "small" ? (jsxs("text", { className: cvaValueBarText({ size }), x: `${barWidth + 2}%`, y: "11", fill: valueColor !== null && valueColor !== void 0 ? valueColor : color("NEUTRAL", 400, "CSS"), children: [Number(value.toFixed(1)), unit || ""] })) : null] }) }));
2352
2413
  };
2353
2414
 
2354
2415
  const cvaWidgetBodyDensityContainer = cvaMerge([
@@ -2570,6 +2631,7 @@ const useClickOutside = (el, options = {}, onClick) => {
2570
2631
  active = options.active !== undefined ? options.active : active;
2571
2632
  }
2572
2633
  const handler = (ev) => {
2634
+ // eslint-disable-next-line local-rules/no-typescript-assertion
2573
2635
  const target = ev.target;
2574
2636
  if (els.every(ref => !ref.current || !ref.current.contains(target))) {
2575
2637
  onClick && onClick(ev);
@@ -2721,20 +2783,9 @@ function useDevicePixelRatio(options) {
2721
2783
  }
2722
2784
  const updateDpr = () => setCurrentDpr(getDevicePixelRatio({ defaultDpr, maxDpr, round }));
2723
2785
  const mediaMatcher = window.matchMedia(`screen and (resolution: ${currentDpr}dppx)`);
2724
- // Safari 13.1 does not have `addEventListener`, but does have `addListener`
2725
- if (mediaMatcher.addEventListener) {
2726
- mediaMatcher.addEventListener("change", updateDpr);
2727
- }
2728
- else {
2729
- mediaMatcher.addListener(updateDpr);
2730
- }
2786
+ mediaMatcher.addEventListener("change", updateDpr);
2731
2787
  return () => {
2732
- if (mediaMatcher.removeEventListener) {
2733
- mediaMatcher.removeEventListener("change", updateDpr);
2734
- }
2735
- else {
2736
- mediaMatcher.removeListener(updateDpr);
2737
- }
2788
+ mediaMatcher.removeEventListener("change", updateDpr);
2738
2789
  };
2739
2790
  }, [currentDpr, defaultDpr, maxDpr, round]);
2740
2791
  return currentDpr;
@@ -2749,8 +2800,7 @@ function getDevicePixelRatio(options) {
2749
2800
  const { defaultDpr = 1, maxDpr = 3, round = true } = options || {};
2750
2801
  const hasDprProp = typeof window !== "undefined" && typeof window.devicePixelRatio === "number";
2751
2802
  const dpr = hasDprProp ? window.devicePixelRatio : defaultDpr;
2752
- const rounded = Math.min(Math.max(1, round ? Math.floor(dpr) : dpr), maxDpr);
2753
- return rounded;
2803
+ return Math.min(Math.max(1, round ? Math.floor(dpr) : dpr), maxDpr);
2754
2804
  }
2755
2805
 
2756
2806
  /**
@@ -2946,4 +2996,4 @@ const useVisibilityChange = ({ onChange, targetState = "hidden" }) => {
2946
2996
  }, [onChange, targetState]);
2947
2997
  };
2948
2998
 
2949
- export { Alert, Badge, Button, Card, CardBody, CardFooter, CardHeader, Collapse, CopyableText, DayPicker, DayPickerPopover, DayRangePicker, Drawer, EmptyState, ExternalLink, Heading, Icon, IconButton, Indicator, MenuItem, MenuList, Modal, ModalBackdrop, MoreMenu, PackageNameStoryComponent, PageHeader, Pagination, Popover, PopoverContent, PopoverTitle, PopoverTrigger, Prompt, ROLE_CARD, SectionHeader, Sidebar, SkeletonLines, Spacer, Spinner, StarButton, Tab, TabContent, TabList, Tabs, Tag, Text, Timeline, TimelineElement, Tip, Tooltip, ValueBar, WidgetBody, cvaButton, cvaButtonSpinner, cvaClickable, cvaIconButtonContainer, cvaIndicator, cvaIndicatorIcon, cvaIndicatorIconBackground, cvaIndicatorLabel, cvaIndicatorPing, cvaMenuItem, cvaMenuItemLabel, cvaMenuItemPrefix, cvaMenuItemSuffix, docs, getDevicePixelRatio, getValueBarColorByValue, iconColorNames, iconPalette, setLocalStorage, useClickOutside, useContainerProps, useContinuousTimeout, useDebounce, useDevicePixelRatio, useGeometry, useHover, useIsFirstRender, useIsFullscreen, useIsTextCutOff, useLocalStorage, useLocalStorageReducer, useModal, useOptionallyElevatedState, useOverflowItems, usePopoverContext, usePrompt, useResize, useSelfUpdatingRef, useTimeout, useVisibilityChange };
2999
+ export { Alert, Badge, Button, Card, CardBody, CardFooter, CardHeader, Collapse, CopyableText, DayPicker, DayPickerPopover, DayRangePicker, Drawer, EmptyState, ExternalLink, Heading, Icon, IconButton, Indicator, MenuItem, MenuList, Modal, ModalBackdrop, MoreMenu, PackageNameStoryComponent, PageHeader, Pagination, Popover, PopoverContent, PopoverTitle, PopoverTrigger, Prompt, ROLE_CARD, SectionHeader, Sidebar, SkeletonLines, Spacer, Spinner, StarButton, Tab, TabContent, TabList, Tabs, Tag, Text, Timeline, TimelineElement, Tooltip, ValueBar, WidgetBody, cvaButton, cvaClickable, cvaIndicator, cvaIndicatorIcon, cvaIndicatorIconBackground, cvaIndicatorLabel, cvaIndicatorPing, cvaMenuItem, cvaMenuItemLabel, cvaMenuItemPrefix, cvaMenuItemSuffix, docs, getDevicePixelRatio, getValueBarColorByValue, iconColorNames, iconPalette, setLocalStorage, useClickOutside, useContainerProps, useContinuousTimeout, useDebounce, useDevicePixelRatio, useGeometry, useHover, useIsFirstRender, useIsFullscreen, useIsTextCutOff, useLocalStorage, useLocalStorageReducer, useModal, useOptionallyElevatedState, useOverflowItems, usePopoverContext, usePrompt, useResize, useSelfUpdatingRef, useTimeout, useVisibilityChange };