@trackunit/react-components 0.1.238 → 0.1.241

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
@@ -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([
@@ -430,7 +428,7 @@ const cvaSpinnerContainer = cvaMerge(["box-border", "p-0.5", "overflow-hidden"],
430
428
  * @param {SpinnerProps} props - The props for the Spinner component
431
429
  * @returns {JSX.Element} Spinner component
432
430
  */
433
- const Spinner = ({ mode = "light", size = "medium", centering = "centered", className, containerClassName, dataTestId, }) => {
431
+ const Spinner = ({ mode = "light", size = "medium", centering = "centered", className, containerClassName, dataTestId = "spinner", }) => {
434
432
  return (jsx("div", { className: cvaSpinnerContainer({ centering, className: containerClassName }), children: jsx("div", { role: "spinbutton", className: cvaSpinner({ size, mode, className }), "data-testid": dataTestId }) }));
435
433
  };
436
434
 
@@ -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,40 +972,35 @@ 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([
962
979
  "block",
963
980
  "w-full",
964
- "border-b",
981
+ "border",
965
982
  "border-solid",
966
- "border-neutral-100",
967
- "pb-3",
968
- "mb-4",
969
- "last:border-0",
970
- "last:m-0",
971
- "only:border-0",
972
- "only:m-0",
983
+ "border-secondary-200",
984
+ "rounded",
985
+ "overflow-hidden",
973
986
  ]);
974
- const cvaCollapseLabel = cvaMerge(["block", "w-full", "cursor-pointer"]);
975
- const cvaCollapseLabelContainer = cvaMerge(["flex", "items-center"], {
976
- defaultVariants: { layout: "fullwidth" },
977
- variants: { layout: { fullwidth: "justify-between", compact: "justify-start" } },
987
+ const cvaCollapseHeader = cvaMerge([
988
+ "flex",
989
+ "w-full",
990
+ "items-center",
991
+ "justify-between",
992
+ "cursor-pointer",
993
+ "bg-secondary-50",
994
+ "px-4",
995
+ "gap-4",
996
+ "py-2",
997
+ "transition-all",
998
+ ], {
999
+ variants: { expanded: { true: ["border-secondary-200", "border-b", "border-solid"], false: "" } },
978
1000
  });
979
- cvaMerge(["block", "relative", "w-full", "mt-1", "p-1"]);
1001
+ const cvaCollapseLabelContainer = cvaMerge(["flex", "items-center", "gap-2"]);
1002
+ const cvaCollapsible = cvaMerge(["block", "relative", "w-full", "p-4"]);
980
1003
  const cvaCollapseAnimated = cvaMerge(["overflow-y-hidden", "transition-all"]);
981
- const cvaCollapseIcon = cvaMerge(["ease-in-out", "duration-200"], {
982
- variants: {
983
- expanded: {
984
- false: "",
985
- true: "rotate-180",
986
- },
987
- },
988
- defaultVariants: {
989
- expanded: false,
990
- },
991
- });
992
1004
 
993
1005
  /**
994
1006
  * The Collapse component is used to condense non-important information.
@@ -996,7 +1008,7 @@ const cvaCollapseIcon = cvaMerge(["ease-in-out", "duration-200"], {
996
1008
  * @param {CollapseProps} props - The props for the Collapse component
997
1009
  * @returns {JSX.Element} Collapse component
998
1010
  */
999
- const Collapse = ({ id, initialExpanded = false, onToggle, label, children, layout = "fullwidth", className, dataTestId, }) => {
1011
+ const Collapse = ({ id, initialExpanded = false, onToggle, label, children, className, headerAddon, dataTestId, }) => {
1000
1012
  const [expanded, setExpanded] = React.useState(initialExpanded);
1001
1013
  const handleClick = React.useCallback((e) => {
1002
1014
  if (onToggle) {
@@ -1004,11 +1016,11 @@ const Collapse = ({ id, initialExpanded = false, onToggle, label, children, layo
1004
1016
  }
1005
1017
  setExpanded(!expanded);
1006
1018
  }, [expanded, onToggle]);
1007
- return (jsxs("div", { className: cvaCollapse({ className }), "data-testid": dataTestId, children: [jsx("div", { className: cvaCollapseLabel(), role: "button", "aria-expanded": expanded, "aria-controls": id, onClick: handleClick, children: jsxs("div", { className: cvaCollapseLabelContainer({ layout }), children: [jsx(Text, { type: "span", weight: "bold", children: label }), jsx(IconButton, { icon: jsx(Icon, { className: cvaCollapseIcon({ expanded }), name: "ChevronDown", size: "small" }), size: "medium", variant: "transparent", color: "secondary" })] }) }), jsx(Collapsible, { expanded: expanded, id: id, children: children })] }));
1019
+ return (jsxs("div", { className: cvaCollapse({ className }), "data-testid": dataTestId, children: [jsxs("div", { className: cvaCollapseHeader({ expanded }), role: "button", "aria-expanded": expanded, "aria-controls": id, onClick: handleClick, children: [jsxs("div", { className: cvaCollapseLabelContainer(), children: [jsx(Text, { type: "span", weight: "bold", children: label }), jsx(IconButton, { icon: jsx(Icon, { name: "ChevronUpDown", size: "small" }), size: "medium", variant: "transparent", color: "secondary" })] }), headerAddon ? headerAddon : null] }), jsx(Collapsible, { expanded: expanded, id: id, children: children })] }));
1008
1020
  };
1009
1021
  const Collapsible = ({ children, expanded, id }) => {
1010
1022
  const [ref, { height }] = useMeasure();
1011
- return (jsx("div", { className: cvaCollapseAnimated(), id: id, style: { height: expanded ? height : "0" }, children: jsx("div", { className: cvaCollapse(), ref: ref, children: children }) }));
1023
+ return (jsx("div", { className: cvaCollapseAnimated(), id: id, style: { height: expanded ? height : "0" }, children: jsx("div", { ref: ref, children: jsx("div", { className: cvaCollapsible(), children: children }) }) }));
1012
1024
  };
1013
1025
 
1014
1026
  const cvaCopyableText = cvaMerge([
@@ -1195,11 +1207,11 @@ const cvaPopoverTitleContainer = cvaMerge(["flex", "items-center", "px-2", "py-1
1195
1207
  const cvaPopoverTitleText = cvaMerge(["flex-1", "text-neutral-500"]);
1196
1208
 
1197
1209
  const PopoverContent = React__default.forwardRef(function PopoverContent(_a, propRef) {
1198
- var _b, _c, _d;
1210
+ var _b;
1199
1211
  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"]);
1212
+ const _c = usePopoverContext(), { context: floatingContext, customProps } = _c, context = __rest(_c, ["context", "customProps"]);
1201
1213
  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 })) })) }));
1214
+ 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
1215
  });
1204
1216
 
1205
1217
  /**
@@ -1215,7 +1227,7 @@ const PopoverTitle = ({ children, action, divider = false, className, dataTestId
1215
1227
  const PopoverTrigger = forwardRef(function PopoverTrigger(_a, propRef) {
1216
1228
  var { children, renderButton } = _a, props = __rest(_a, ["children", "renderButton"]);
1217
1229
  const context = usePopoverContext();
1218
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1230
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, local-rules/no-typescript-assertion
1219
1231
  const childrenRef = children.ref;
1220
1232
  const ref = useMergeRefs([context.refs.setReference, propRef, childrenRef]);
1221
1233
  if (!renderButton && isValidElement(children)) {
@@ -1254,7 +1266,7 @@ const DayRangePicker = ({ onRangeSelect, selectedDays, disabledDays, dataTestId,
1254
1266
  onRangeSelect({ from, to });
1255
1267
  }
1256
1268
  }, [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 }) }));
1269
+ 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
1270
  };
1259
1271
 
1260
1272
  const cvaDrawerOverlay = cvaMerge([
@@ -1322,7 +1334,6 @@ const cvaSkeletonLine = cvaMerge([
1322
1334
 
1323
1335
  /**
1324
1336
  * Display placeholder lines before the data gets loaded to reduce load-time frustration.
1325
-
1326
1337
  */
1327
1338
  const SkeletonLines = memo(({ margin = "10px 0", lines = 1, height, width = "100%", className, dataTestId }) => {
1328
1339
  const skeletonLines = [];
@@ -1344,6 +1355,7 @@ const SkeletonLines = memo(({ margin = "10px 0", lines = 1, height, width = "100
1344
1355
  // eslint-disable-next-line react/jsx-no-useless-fragment
1345
1356
  return jsx(Fragment, { children: skeletonLines });
1346
1357
  });
1358
+ SkeletonLines.displayName = "SkeletonLines";
1347
1359
 
1348
1360
  const cvaContainerStyles = cvaMerge([
1349
1361
  "flex",
@@ -1424,8 +1436,8 @@ const ExternalLink = ({ rel = "noreferrer", target = "_blank", href, className,
1424
1436
  return (jsx("a", { onClick: onClick, "data-testid": dataTestId, className: cvaExternalLink({ className }), title: title, href: href, rel: rel, target: target, children: children }));
1425
1437
  };
1426
1438
 
1427
- const cvaTooltipFlexContainer = cvaMerge("inline-flex hover:cursor-pointer");
1428
- const cvaTooltipIcon = cvaMerge("flex h-max w-fit text-slate-300 transition hover:cursor-pointer hover:text-slate-400", {
1439
+ const cvaTooltipFlexContainer = cvaMerge(["inline-flex", "hover:cursor-pointer"]);
1440
+ const cvaTooltipIcon = cvaMerge(["flex", "h-max", "w-fit", "text-slate-300", "transition", "hover:cursor-pointer", "hover:text-slate-400"], {
1429
1441
  variants: {
1430
1442
  color: {
1431
1443
  light: "hover:text-white",
@@ -1436,7 +1448,7 @@ const cvaTooltipIcon = cvaMerge("flex h-max w-fit text-slate-300 transition hove
1436
1448
  },
1437
1449
  },
1438
1450
  });
1439
- const cvaTooltipPopover = cvaMerge("pointer-events-none origin-center");
1451
+ const cvaTooltipPopover = cvaMerge(["pointer-events-none", "origin-center"]);
1440
1452
  const cvaTooltipPopoverTail = cvaMerge("", {
1441
1453
  variants: {
1442
1454
  placement: {
@@ -1464,7 +1476,7 @@ const cvaTooltipPopoverTail = cvaMerge("", {
1464
1476
  },
1465
1477
  });
1466
1478
  cvaMerge(["component-popover-border", "z-popover", "animate-fade-in-fast"]);
1467
- const cvaTooltipPopoverContent = cvaMerge("max-w-sm rounded p-2", {
1479
+ const cvaTooltipPopoverContent = cvaMerge(["max-w-sm", "rounded", "p-2"], {
1468
1480
  variants: {
1469
1481
  color: {
1470
1482
  light: "bg-white shadow-lg",
@@ -1508,11 +1520,11 @@ const Tooltip = ({ children, dataTestId = "tool-tip", disabled, className, label
1508
1520
  whileElementsMounted: autoUpdate,
1509
1521
  });
1510
1522
  const { isMounted } = useTransitionStatus(context);
1511
- const wrappedChildren = (jsx("div", { className: cvaTooltipFlexContainer({ className }), "data-testid": dataTestId && `${dataTestId}-parent`, children: children }));
1523
+ const wrappedChildren = (jsx("div", { className: cvaTooltipFlexContainer({ className }), "data-testid": dataTestId ? `${dataTestId}-parent` : null, children: children }));
1512
1524
  if (disabled) {
1513
1525
  return wrappedChildren;
1514
1526
  }
1515
- return (jsxs(Popover, { className: cvaTooltipPopover(), placement: placement === "auto" ? "bottom" : placement, activation: { hover: true }, dataTestId: dataTestId !== null && dataTestId !== void 0 ? dataTestId : "", children: [jsx(PopoverTrigger, { className: cvaTooltipIcon({ color: mode }), ref: refs.setReference, onMouseEnter: () => setIsOpen(true), onMouseLeave: () => setIsOpen(false), "data-testid": dataTestId && `${dataTestId}-trigger`, children: children === undefined ? (jsx("div", { children: jsx(Icon, Object.assign({ name: "QuestionMarkCircle", size: "small", dataTestId: dataTestId && `${dataTestId}-icon` }, 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 })] }) }) }))] }));
1527
+ 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] }));
1516
1528
  };
1517
1529
 
1518
1530
  const cvaIndicator = cvaMerge(["flex", "items-center"]);
@@ -1615,7 +1627,7 @@ const cvaIndicatorIconBackground = cvaMerge(["rounded-full", "items-center", "ju
1615
1627
  */
1616
1628
  const Indicator = (_a) => {
1617
1629
  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"]);
1618
- 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" })), icon] }), label !== undefined && withLabel && (jsx("div", { className: cvaIndicatorLabel(), "data-testid": dataTestId ? `${dataTestId}-label` : "indicator-label", children: label }))] })) }));
1630
+ 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] })) }));
1619
1631
  };
1620
1632
 
1621
1633
  const cvaMenuItem = cvaMerge([
@@ -1702,7 +1714,7 @@ const MenuItem = ({ className, dataTestId, label, size, children, selected, focu
1702
1714
  }), onClick: e => {
1703
1715
  stopPropagation && e.stopPropagation();
1704
1716
  onClick && onClick(e);
1705
- }, 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 }))] })));
1717
+ }, 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] })));
1706
1718
  };
1707
1719
 
1708
1720
  const cvaMenuList = cvaMerge(["shadow-md", "rounded-lg", "z-20", "bg-white", "p-1", "border", "border-slate-300", "gap-1", "grid"], {
@@ -1730,7 +1742,7 @@ const MenuList = (_a) => {
1730
1742
  var { dataTestId, className, children, withStickyHeader = false, showDivider = false } = _a, args = __rest(_a, ["dataTestId", "className", "children", "withStickyHeader", "showDivider"]);
1731
1743
  const childrenArr = Children.toArray(children);
1732
1744
  const isLastItem = (index) => index === childrenArr.length - 1;
1733
- 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() })] }))) }));
1745
+ 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] }))) }));
1734
1746
  };
1735
1747
 
1736
1748
  const cvaMoreMenu = cvaMerge(["p-4"]);
@@ -1794,12 +1806,9 @@ const cvaModalBackdrop = cvaMerge([
1794
1806
  const ModalBackdrop = ({ children, isVisible, onClick }) => {
1795
1807
  const ref = React.useRef(null);
1796
1808
  return (jsx("div", { ref: ref, className: cvaModalBackdrop({ show: isVisible }), onMouseDown: e => {
1797
- var _a, _b;
1798
1809
  // only react on click on backdrop - accessing first child to get around styled element element
1799
- if (ref.current !== null) {
1800
- 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])) {
1801
- onClick();
1802
- }
1810
+ if (ref.current !== null && e.target === ref.current.children[0]) {
1811
+ onClick();
1803
1812
  }
1804
1813
  }, children: children }));
1805
1814
  };
@@ -1813,8 +1822,9 @@ const ModalBackdrop = ({ children, isVisible, onClick }) => {
1813
1822
  const Modal = React.forwardRef(({ isOpen, children, dataTestId, className, role = "", onDismissClick = () => {
1814
1823
  return;
1815
1824
  }, }, ref) => {
1816
- 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 }) })) }));
1825
+ 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 }));
1817
1826
  });
1827
+ Modal.displayName = "Modal";
1818
1828
 
1819
1829
  /**
1820
1830
  * The useModal component should be used to inform the user of important information.
@@ -1827,10 +1837,12 @@ const useModal = ({ closeOnOutsideClick } = {}) => {
1827
1837
  const { isOpen, togglePortal, openPortal, closePortal, Portal } = usePortal({
1828
1838
  closeOnOutsideClick,
1829
1839
  onPortalClick: ({ target }) => {
1840
+ var _a;
1830
1841
  if (!closeOnOutsideClick) {
1831
1842
  return;
1832
1843
  }
1833
- const clickingOutsideModal = modalRef && modalRef.current && !modalRef.current.contains(target);
1844
+ // eslint-disable-next-line local-rules/no-typescript-assertion
1845
+ const clickingOutsideModal = !((_a = modalRef.current) === null || _a === void 0 ? void 0 : _a.contains(target));
1834
1846
  if (clickingOutsideModal) {
1835
1847
  closePortal();
1836
1848
  }
@@ -1848,7 +1860,7 @@ const useModal = ({ closeOnOutsideClick } = {}) => {
1848
1860
  };
1849
1861
  };
1850
1862
 
1851
- const cvaPageHeaderContainer = cvaMerge(["bg-white"], {
1863
+ const cvaPageHeaderContainer = cvaMerge(["bg-white", "tu-page-header"], {
1852
1864
  variants: {
1853
1865
  withBorder: {
1854
1866
  true: ["border-b", "border-b-secondary-200"],
@@ -1857,10 +1869,9 @@ const cvaPageHeaderContainer = cvaMerge(["bg-white"], {
1857
1869
  },
1858
1870
  });
1859
1871
  const cvaPageHeader = cvaMerge([
1860
- "min-h-[72px]",
1861
1872
  "box-border",
1862
- "px-6",
1863
- "py-5",
1873
+ "py-responsive-space",
1874
+ "px-responsive-space-lg",
1864
1875
  "flex",
1865
1876
  "flex-wrap",
1866
1877
  "items-center",
@@ -1869,7 +1880,7 @@ const cvaPageHeader = cvaMerge([
1869
1880
  "justify-between",
1870
1881
  ]);
1871
1882
  const cvaPageHeaderHeading = cvaMerge(["flex", "text-slate-900", "text-2xl", "font-bold", "min-w-0"]);
1872
- const cvaPageHeaderHeadingContainer = cvaMerge(["flex", "gap-x-4", "items-center"]);
1883
+ const cvaPageHeaderHeadingContainer = cvaMerge(["flex", "gap-x-4", "flex-wrap", "items-center"]);
1873
1884
  const cvaPageHeaderHeadingAccessoriesContainer = cvaMerge([
1874
1885
  "flex",
1875
1886
  "flex-wrap",
@@ -1878,6 +1889,16 @@ const cvaPageHeaderHeadingAccessoriesContainer = cvaMerge([
1878
1889
  "gap-y-2",
1879
1890
  ]);
1880
1891
  const cvaPageHeaderChildContainer = cvaMerge(["flex", "flex-wrap", "gap-x-6", "items-center"]);
1892
+ const cvaPageHeaderDescriptionAndLinkContainer = cvaMerge(["flex", "h-fit", "items-center", "gap-1"]);
1893
+ const cvaPageHeaderLink = cvaMerge([
1894
+ "text-primary-600",
1895
+ "hover:text-primary-700",
1896
+ "flex",
1897
+ "items-center",
1898
+ "gap-1",
1899
+ "text-xs",
1900
+ "underline",
1901
+ ]);
1881
1902
 
1882
1903
  /**
1883
1904
  * Pageheader component is used to display a page header.
@@ -1889,9 +1910,9 @@ const cvaPageHeaderChildContainer = cvaMerge(["flex", "flex-wrap", "gap-x-6", "i
1889
1910
  */
1890
1911
  const PageHeader = ({ className, dataTestId, action, showLoading, description, link, title, tag, backTo, tagColor, children, tabsList, linkText = "Help Center Article", }) => {
1891
1912
  return (jsxs("div", { className: cvaPageHeaderContainer({
1892
- className: `${className} tu-page-header`,
1893
- withBorder: !Boolean(tabsList),
1894
- }), "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 && (jsxs("div", { className: "flex h-fit items-center gap-1", children: [jsx(Tooltip, { label: description, dataTestId: dataTestId && `${dataTestId}-tooltip`, iconProps: { name: "QuestionMarkCircle" }, placement: "bottom" }), link && (jsxs(Link, { to: link, "data-testid": "tooltip-link", target: "_blank", className: "text-primary-600 hover:text-primary-700 flex h-4 items-center gap-1 text-xs underline", children: [linkText, jsx(Icon, { name: "ArrowTopRightOnSquare", size: "small" })] }))] }))] }), 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] }));
1913
+ className,
1914
+ withBorder: !tabsList,
1915
+ }), "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] }));
1895
1916
  };
1896
1917
 
1897
1918
  const cvaPagination = cvaMerge(["flex", "items-center", "gap-1"]);
@@ -1940,7 +1961,7 @@ const Pagination = ({ previousPage, nextPage, canPreviousPage, canNextPage, page
1940
1961
  if (loading) {
1941
1962
  return (jsx("div", { className: cvaPagination({ className }), children: jsx(SkeletonLines, { height: 16, width: 150 }) }));
1942
1963
  }
1943
- 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
1964
+ 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
1944
1965
  ? !canNextPage || false
1945
1966
  : 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" })] }));
1946
1967
  };
@@ -1986,8 +2007,7 @@ const usePrompt = (message, when = true) => {
1986
2007
  };
1987
2008
  }, [message, when]);
1988
2009
  const confirmExit = useCallback(() => {
1989
- const confirm = window.confirm(message);
1990
- return confirm;
2010
+ return window.confirm(message);
1991
2011
  }, [message]);
1992
2012
  useConfirmExit(confirmExit, when);
1993
2013
  };
@@ -2037,11 +2057,11 @@ const Spacer = ({ size = "medium", border = false, dataTestId, className }) => {
2037
2057
  * @returns {JSX.Element} SectionHeader component
2038
2058
  */
2039
2059
  const SectionHeader = ({ title, subtitle, dataTestId, addons }) => {
2040
- 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" })] }));
2060
+ 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" })] }));
2041
2061
  };
2042
2062
 
2043
- const cvaSidebar = cvaMerge(["apply grid", "grid-cols-fr-min", "items-center"]);
2044
- const cvaSidebarChildContainer = cvaMerge(["apply flex", "overflow-hidden", "gap-2", "p-1", "max-w-full"], {
2063
+ const cvaSidebar = cvaMerge(["apply", "grid", "grid-cols-fr-min", "items-center"]);
2064
+ const cvaSidebarChildContainer = cvaMerge(["apply", "flex", "overflow-hidden", "gap-2", "p-1", "max-w-full"], {
2045
2065
  variants: {
2046
2066
  breakpoint: {
2047
2067
  xs: ["xs:overflow-visible", "xs:p-0", "xs:grid", "xs:grid-cols-1", "xs:w-full"],
@@ -2079,7 +2099,7 @@ const useOverflowItems = ({ threshold = 1, childUniqueIdentifierAttribute = "id"
2079
2099
  }, [childUniqueIdentifierAttribute]);
2080
2100
  const observe = useCallback(() => {
2081
2101
  const node = overflowContainerRef.current;
2082
- if (node && node.children) {
2102
+ if (node) {
2083
2103
  const root = overflowContainerRef.current;
2084
2104
  const options = { root, threshold };
2085
2105
  const observer = new IntersectionObserver(handleIntersection, options);
@@ -2132,7 +2152,7 @@ const Sidebar = ({ childContainerClassName, children, breakpoint = "lg", classNa
2132
2152
  }
2133
2153
  return "visible";
2134
2154
  };
2135
- 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 => {
2155
+ 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 => {
2136
2156
  return React__default.cloneElement(child, {
2137
2157
  className: `${child.props.className} ${itemVisibilityClassName(child.props.id)}`,
2138
2158
  });
@@ -2140,12 +2160,12 @@ const Sidebar = ({ childContainerClassName, children, breakpoint = "lg", classNa
2140
2160
  circular: false,
2141
2161
  variant: "transparent",
2142
2162
  color: "secondary",
2143
- }, 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 => {
2163
+ }, 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 => {
2144
2164
  return itemOverflowMap[child.props.id]
2145
2165
  ? React__default.cloneElement(child, {
2146
2166
  onClick: () => {
2147
2167
  var _a, _b;
2148
- (_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);
2168
+ (_b = (_a = child.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a);
2149
2169
  close();
2150
2170
  },
2151
2171
  })
@@ -2207,7 +2227,7 @@ const cvaTab = cvaMerge([
2207
2227
  */
2208
2228
  const Tab = (_a) => {
2209
2229
  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"]);
2210
- const renderContent = () => (jsxs(Fragment, { children: [iconName && jsx(Icon, { name: iconName, size: "small" }), React__default.isValidElement(children) ? children.props.children : children, suffix] }));
2230
+ const renderContent = () => (jsxs(Fragment, { children: [iconName ? jsx(Icon, { name: iconName, size: "small" }) : null, React__default.isValidElement(children) ? children.props.children : children, suffix] }));
2211
2231
  const commonProps = Object.assign({ className: appendTabStylesToChildIfAsChild ? cvaTab({ className, isFullWidth }) : className }, rest);
2212
2232
  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() }))) }));
2213
2233
  };
@@ -2217,7 +2237,7 @@ const Tab = (_a) => {
2217
2237
  */
2218
2238
  const TabContent = (_a) => {
2219
2239
  var { className, dataTestId, children } = _a, rest = __rest(_a, ["className", "dataTestId", "children"]);
2220
- return (jsx(Content, Object.assign({ "data-testid": `${dataTestId}-content`, className: cvaTabContent({ className }) }, rest, { children: children })));
2240
+ return (jsx(Content, Object.assign({ "data-testid": dataTestId ? `${dataTestId}-content` : undefined, className: cvaTabContent({ className }) }, rest, { children: children })));
2221
2241
  };
2222
2242
 
2223
2243
  /**
@@ -2269,7 +2289,7 @@ const Timeline = ({ className, dataTestId, children }) => {
2269
2289
  * @returns {JSX.Element} component
2270
2290
  */
2271
2291
  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, }) => {
2272
- 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 }) })] }));
2292
+ 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 }) })] }));
2273
2293
  };
2274
2294
  function defaultHeader(date, showTime) {
2275
2295
  return `${format(date, showTime ? "MMM d, yyyy H:mm" : "MMM d, yyyy")} (${formatDistance(date, new Date(), {
@@ -2384,7 +2404,7 @@ const ValueBar = ({ value, min = 0, max = 100, unit, size = "small", levelColors
2384
2404
  const score = getScore(value, min, max);
2385
2405
  const barFillColor = levelColors ? getFillColor(score, levelColors) : getDefaultFillColor(score);
2386
2406
  const barWidth = showValue && size === "small" ? 90 : 100;
2387
- 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 || ""] }))] }) }));
2407
+ 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] }) }));
2388
2408
  };
2389
2409
 
2390
2410
  const cvaWidgetBodyDensityContainer = cvaMerge([
@@ -2606,6 +2626,7 @@ const useClickOutside = (el, options = {}, onClick) => {
2606
2626
  active = options.active !== undefined ? options.active : active;
2607
2627
  }
2608
2628
  const handler = (ev) => {
2629
+ // eslint-disable-next-line local-rules/no-typescript-assertion
2609
2630
  const target = ev.target;
2610
2631
  if (els.every(ref => !ref.current || !ref.current.contains(target))) {
2611
2632
  onClick && onClick(ev);
@@ -2757,20 +2778,9 @@ function useDevicePixelRatio(options) {
2757
2778
  }
2758
2779
  const updateDpr = () => setCurrentDpr(getDevicePixelRatio({ defaultDpr, maxDpr, round }));
2759
2780
  const mediaMatcher = window.matchMedia(`screen and (resolution: ${currentDpr}dppx)`);
2760
- // Safari 13.1 does not have `addEventListener`, but does have `addListener`
2761
- if (mediaMatcher.addEventListener) {
2762
- mediaMatcher.addEventListener("change", updateDpr);
2763
- }
2764
- else {
2765
- mediaMatcher.addListener(updateDpr);
2766
- }
2781
+ mediaMatcher.addEventListener("change", updateDpr);
2767
2782
  return () => {
2768
- if (mediaMatcher.removeEventListener) {
2769
- mediaMatcher.removeEventListener("change", updateDpr);
2770
- }
2771
- else {
2772
- mediaMatcher.removeListener(updateDpr);
2773
- }
2783
+ mediaMatcher.removeEventListener("change", updateDpr);
2774
2784
  };
2775
2785
  }, [currentDpr, defaultDpr, maxDpr, round]);
2776
2786
  return currentDpr;
@@ -2785,8 +2795,7 @@ function getDevicePixelRatio(options) {
2785
2795
  const { defaultDpr = 1, maxDpr = 3, round = true } = options || {};
2786
2796
  const hasDprProp = typeof window !== "undefined" && typeof window.devicePixelRatio === "number";
2787
2797
  const dpr = hasDprProp ? window.devicePixelRatio : defaultDpr;
2788
- const rounded = Math.min(Math.max(1, round ? Math.floor(dpr) : dpr), maxDpr);
2789
- return rounded;
2798
+ return Math.min(Math.max(1, round ? Math.floor(dpr) : dpr), maxDpr);
2790
2799
  }
2791
2800
 
2792
2801
  /**
@@ -2982,4 +2991,4 @@ const useVisibilityChange = ({ onChange, targetState = "hidden" }) => {
2982
2991
  }, [onChange, targetState]);
2983
2992
  };
2984
2993
 
2985
- 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, 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 };
2994
+ 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 };