@trackunit/react-components 1.0.12 → 1.1.0

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.cjs.js CHANGED
@@ -273,7 +273,7 @@ const cvaTagIcon = cssClassVarianceUtilities.cvaMerge(["cursor-pointer", "transi
273
273
  * @param {TagProps} props - The props for the tag component
274
274
  * @returns {JSX.Element} tag component
275
275
  */
276
- const Tag = React__namespace.forwardRef(({ className, dataTestId, children, size = "medium", onClose, color = "primary", disabled = false }, ref) => {
276
+ const Tag = React.forwardRef(({ className, dataTestId, children, size = "medium", onClose, color = "primary", disabled = false }, ref) => {
277
277
  return (jsxRuntime.jsxs("span", { className: cvaTag({ className, size, color, layout: onClose ? "withIcon" : "default" }), "data-testid": dataTestId, ref: ref, children: [children, Boolean(onClose) && !disabled ? (
278
278
  // a fix for multiselect deselecting tags working together with fade out animation
279
279
  jsxRuntime.jsx("div", { className: cvaTagIconContainer(), onMouseDown: onClose, children: jsxRuntime.jsx(Icon, { className: cvaTagIcon(), dataTestId: dataTestId + "Icon", name: "XCircle", size: size, style: { WebkitTransition: "-webkit-transform 0.150s" }, type: "solid" }) })) : null] }));
@@ -284,7 +284,7 @@ Tag.displayName = "Tag";
284
284
  * A component used to display the package name and version in the Storybook docs.
285
285
  */
286
286
  const PackageNameStoryComponent = ({ packageJSON }) => {
287
- return (jsxRuntime.jsxs("div", { className: "flex gap-2", children: [jsxRuntime.jsx(Tag, { color: "secondary", children: packageJSON === null || packageJSON === void 0 ? void 0 : packageJSON.name }), jsxRuntime.jsxs(Tag, { color: "secondary", children: ["v", packageJSON === null || packageJSON === void 0 ? void 0 : packageJSON.version] })] }));
287
+ return (jsxRuntime.jsxs("div", { className: "flex gap-2", children: [jsxRuntime.jsx(Tag, { color: "secondary", children: packageJSON?.name }), jsxRuntime.jsxs(Tag, { color: "secondary", children: ["v", packageJSON?.version] })] }));
288
288
  };
289
289
 
290
290
  /**
@@ -294,7 +294,6 @@ const PackageNameStoryComponent = ({ packageJSON }) => {
294
294
  * @returns {boolean} True if the text spans multiple lines
295
295
  */
296
296
  const useIsTextWrapping = (ref) => {
297
- var _a, _b;
298
297
  const [isWrapping, setIsWrapping] = React.useState(false);
299
298
  React.useEffect(() => {
300
299
  if (!ref.current) {
@@ -302,7 +301,7 @@ const useIsTextWrapping = (ref) => {
302
301
  return;
303
302
  }
304
303
  setIsWrapping(ref.current.clientHeight > ref.current.scrollHeight / 2);
305
- }, [(_a = ref.current) === null || _a === void 0 ? void 0 : _a.clientHeight, (_b = ref.current) === null || _b === void 0 ? void 0 : _b.scrollHeight, ref]);
304
+ }, [ref.current?.clientHeight, ref.current?.scrollHeight, ref]);
306
305
  return isWrapping;
307
306
  };
308
307
 
@@ -369,8 +368,8 @@ const cvaText = cssClassVarianceUtilities.cvaMerge(["text-black", "m-0", "relati
369
368
  * @param {TextProps} props - The props for the Text component
370
369
  * @returns {JSX.Element} Text component
371
370
  */
372
- const Text = React__namespace.forwardRef(({ children, type = "p", size = "medium", align = "left", weight = "normal", underline = false, inverted = false, subtle = false, italicize = false, uppercase = false, disabled = false, className, dataTestId, ...rest }, ref) => {
373
- return React__namespace.createElement(type, {
371
+ const Text = React.forwardRef(({ children, type = "p", size = "medium", align = "left", weight = "normal", underline = false, inverted = false, subtle = false, italicize = false, uppercase = false, disabled = false, className, dataTestId, ...rest }, ref) => {
372
+ return React.createElement(type, {
374
373
  ref,
375
374
  className: cvaText({
376
375
  inverted,
@@ -700,7 +699,7 @@ const cvaIconButton = cssClassVarianceUtilities.cvaMerge([], {
700
699
  * @param {ButtonProps} props - The props for the Button component
701
700
  * @returns {JSX.Element} Button component
702
701
  */
703
- const Button = React__namespace.forwardRef(({ onClick, children, loading, disabled, className, fullWidth = false, prefix, suffix, variant = "primary", type = "button", size = "medium", square = false, dataTestId, title, role, tabIndex, asChild = false, circular, ...rest }, ref) => {
702
+ const Button = React.forwardRef(({ onClick, children, loading, disabled, className, fullWidth = false, prefix, suffix, variant = "primary", type = "button", size = "medium", square = false, dataTestId, title, role, tabIndex, asChild = false, circular, ...rest }, ref) => {
704
703
  const Comp = asChild ? reactSlot.Slot : "button";
705
704
  const sharedCompProps = {
706
705
  ref,
@@ -725,7 +724,7 @@ Button.displayName = "Button";
725
724
  /**
726
725
  * Buttons are clickable elements that are used to trigger actions. They communicate calls to action to the user and allow users to interact with pages in a variety of ways. The Icon Button is a version of the standard Button component without the text label.
727
726
  */
728
- const IconButton = React__namespace.forwardRef(({ icon, size = "medium", square = true, loading, disabled, className, ...rest }, ref) => {
727
+ const IconButton = React.forwardRef(({ icon, size = "medium", square = true, loading, disabled, className, ...rest }, ref) => {
729
728
  return (jsxRuntime.jsx(Button, { className: cvaIconButton({ size: size, className }), disabled: disabled || loading, loading: loading,
730
729
  // eslint-disable-next-line local-rules/design-guideline-button-icon-size-match
731
730
  prefix: !loading ? icon : undefined, ref: ref, size: size, square: square, ...rest }));
@@ -775,14 +774,13 @@ const cvaAlertIconContainer = cssClassVarianceUtilities.cvaMerge(["self-start",
775
774
  * @returns {JSX.Element} Alert component
776
775
  */
777
776
  const Alert = ({ color = "info", title, className, children, primaryAction, secondaryAction, onClose, dataTestId, autoScroll, }) => {
778
- const ref = React__namespace.useRef(null);
779
- const titleRef = React__namespace.useRef(null);
777
+ const ref = React.useRef(null);
778
+ const titleRef = React.useRef(null);
780
779
  const isWrapping = useIsTextWrapping(titleRef);
781
- React__namespace.useEffect(() => {
782
- var _a, _b;
780
+ React.useEffect(() => {
783
781
  if (autoScroll) {
784
782
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
785
- (_b = (_a = ref.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView) === null || _b === void 0 ? void 0 : _b.call(_a);
783
+ ref.current?.scrollIntoView?.();
786
784
  }
787
785
  }, [ref, autoScroll]);
788
786
  return (jsxRuntime.jsxs("div", { className: cvaAlert({ color, className }), "data-testid": dataTestId, ref: ref, role: "alert", children: [jsxRuntime.jsxs("div", { className: cvaAlertContentContainer({ inline: !isWrapping && !children }), children: [jsxRuntime.jsx("div", { className: cvaAlertIconContainer(), children: jsxRuntime.jsx(Icon, { color: color, name: getIconName(color) }) }), jsxRuntime.jsxs("div", { className: cvaContent(), children: [title ? (jsxRuntime.jsx(Text, { dataTestId: `${dataTestId}-title`, ref: titleRef, weight: "bold", children: title })) : null, children ? (jsxRuntime.jsx(Text, { type: typeof children === "string" || typeof children === "number" ? "p" : "span", weight: !title ? "bold" : "normal", children: children })) : null] }), onClose ? (jsxRuntime.jsx("div", { className: cvaAlertCloseButtonContainer(), children: jsxRuntime.jsx(IconButton, { circular: true, icon: jsxRuntime.jsx(Icon, { name: "XMark", size: "small" }), onClick: onClose, size: "small", title: "Close Alert", variant: "ghost-neutral" }) })) : null] }), primaryAction || secondaryAction ? (jsxRuntime.jsxs("div", { className: cvaAlertActionsContainer(), children: [secondaryAction ? (jsxRuntime.jsx(Button, { loading: secondaryAction.loading, onClick: secondaryAction.onClick, size: "small", variant: "ghost-neutral", children: secondaryAction.label })) : null, primaryAction ? (jsxRuntime.jsx(Button, { loading: primaryAction.loading, onClick: primaryAction.onClick, size: "small", variant: color === "danger" ? "primary-danger" : "primary", children: primaryAction.label })) : null] })) : null] }));
@@ -1048,7 +1046,7 @@ const useContinuousTimeout = ({ onTimeout, onMaxRetries, duration, maxRetries })
1048
1046
  retries.current++;
1049
1047
  }
1050
1048
  else {
1051
- onMaxRetries === null || onMaxRetries === void 0 ? void 0 : onMaxRetries();
1049
+ onMaxRetries?.();
1052
1050
  retries.current = 0;
1053
1051
  }
1054
1052
  startTimeout(); // Restart the timeout if it's still running
@@ -1084,7 +1082,7 @@ const useDebounce = (value, delay = 500, direction, onBounce) => {
1084
1082
  !direction) {
1085
1083
  handler = setTimeout(() => {
1086
1084
  setDebouncedValue(value);
1087
- onBounce === null || onBounce === void 0 ? void 0 : onBounce(value);
1085
+ onBounce?.(value);
1088
1086
  }, delay);
1089
1087
  }
1090
1088
  else {
@@ -1138,14 +1136,14 @@ function getDevicePixelRatio(options) {
1138
1136
 
1139
1137
  /**
1140
1138
  * Use this hook if you want to optionally elevate the state of a component.
1141
- * Useful when you want to optionally be able to control the state of a component
1142
- * from a parent componentbut keep the simplicity of not having to.
1139
+ * Useful when you _want_ to be able to control the state of a component
1140
+ * from a parent component but keep the simplicity of not _having_ to.
1143
1141
  *
1144
1142
  * If no custom state is provided, the fallback state will be used and it works like a normal useState hook.
1145
1143
  */
1146
1144
  const useElevatedState = (initialState, customState) => {
1147
1145
  const fallbackState = React.useState(initialState);
1148
- return customState !== null && customState !== void 0 ? customState : fallbackState;
1146
+ return customState ?? fallbackState;
1149
1147
  };
1150
1148
 
1151
1149
  /**
@@ -1253,7 +1251,6 @@ const useIsFullscreen = () => {
1253
1251
  * @returns {boolean} True if the text is cut off.
1254
1252
  */
1255
1253
  const useIsTextCutOff = (ref) => {
1256
- var _a, _b;
1257
1254
  const [isTextCutOff, setIsTextCutOff] = React.useState(false);
1258
1255
  React.useEffect(() => {
1259
1256
  if (!ref.current) {
@@ -1261,7 +1258,7 @@ const useIsTextCutOff = (ref) => {
1261
1258
  return;
1262
1259
  }
1263
1260
  setIsTextCutOff(ref.current.offsetWidth < ref.current.scrollWidth);
1264
- }, [(_a = ref.current) === null || _a === void 0 ? void 0 : _a.offsetWidth, (_b = ref.current) === null || _b === void 0 ? void 0 : _b.scrollWidth, ref]);
1261
+ }, [ref.current?.offsetWidth, ref.current?.scrollWidth, ref]);
1265
1262
  return isTextCutOff;
1266
1263
  };
1267
1264
 
@@ -1424,11 +1421,11 @@ const useWindowActivity = ({ onFocus, onBlur } = { onBlur: undefined, onFocus: u
1424
1421
  const [focused, setFocused] = React.useState(hasFocus());
1425
1422
  const onFocusInternal = React.useCallback(() => {
1426
1423
  setFocused(hasFocus());
1427
- onFocus === null || onFocus === void 0 ? void 0 : onFocus();
1424
+ onFocus?.();
1428
1425
  }, [onFocus]);
1429
1426
  const onBlurInternal = React.useCallback(() => {
1430
1427
  setFocused(hasFocus());
1431
- onBlur === null || onBlur === void 0 ? void 0 : onBlur();
1428
+ onBlur?.();
1432
1429
  }, [onBlur]);
1433
1430
  React.useEffect(() => {
1434
1431
  setFocused(hasFocus()); // Focus for additional renders
@@ -1726,7 +1723,7 @@ const Heading = ({ variant = "primary", inverted = false, subtle = false, classN
1726
1723
  tertiary: "h3",
1727
1724
  subtitle: "h4",
1728
1725
  };
1729
- return React__namespace.createElement(semanticType[variant], {
1726
+ return React.createElement(semanticType[variant], {
1730
1727
  ...rest,
1731
1728
  className: cvaHeading({ subtle, inverted, size: variant, className }),
1732
1729
  "data-testid": dataTestId,
@@ -1823,8 +1820,8 @@ const cvaChevronIcon = cssClassVarianceUtilities.cvaMerge(["transition-transform
1823
1820
  */
1824
1821
  const Collapse = ({ id, initialExpanded = false, onToggle, label, children, className, headerClassName, headerAddon, dataTestId, animate = true, extraPadding = true, }) => {
1825
1822
  const LABEL_ID = sharedUtils.uuidv4();
1826
- const [expanded, setExpanded] = React__namespace.useState(initialExpanded);
1827
- const handleClick = React__namespace.useCallback((e) => {
1823
+ const [expanded, setExpanded] = React.useState(initialExpanded);
1824
+ const handleClick = React.useCallback((e) => {
1828
1825
  if (onToggle) {
1829
1826
  onToggle(e, !expanded);
1830
1827
  }
@@ -1896,8 +1893,7 @@ const cvaCopyableText = cssClassVarianceUtilities.cvaMerge([
1896
1893
  * @returns {JSX.Element} CopyableText component
1897
1894
  */
1898
1895
  const CopyableText = ({ text, alternativeText, dataTestId, className }) => {
1899
- var _a;
1900
- const value = (_a = alternativeText !== null && alternativeText !== void 0 ? alternativeText : text) !== null && _a !== void 0 ? _a : "";
1896
+ const value = alternativeText ?? text ?? "";
1901
1897
  const [animating, setAnimating] = React.useState(false);
1902
1898
  const [, copyToClipboard] = usehooksTs.useCopyToClipboard();
1903
1899
  const handleOnClick = () => {
@@ -3271,7 +3267,6 @@ var ForwardRef = /*#__PURE__*/React.forwardRef(SvgWorkerWithSign);
3271
3267
  * - In celebratory instances (e.g., no new notifications, services up to date).
3272
3268
  */
3273
3269
  const EmptyState = ({ description, altText, image = "SEARCH_DOCUMENT", customImageSrc, loading, dataTestId, className, primaryAction, secondaryAction, additionalHelpAction, }) => {
3274
- var _a, _b, _c;
3275
3270
  const ImageSource = React.useMemo(() => {
3276
3271
  switch (image) {
3277
3272
  case "WORKER_WITH_SIGN":
@@ -3289,7 +3284,7 @@ const EmptyState = ({ description, altText, image = "SEARCH_DOCUMENT", customIma
3289
3284
  return ForwardRef$2;
3290
3285
  }
3291
3286
  }, [image]);
3292
- return (jsxRuntime.jsx("div", { className: cvaContainerStyles({ className }), "data-testid": dataTestId !== null && dataTestId !== void 0 ? dataTestId : "empty-state", children: loading ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Spinner, { centering: "centered", dataTestId: "spinner" }), jsxRuntime.jsx(SkeletonLines, { dataTestId: "skeleton-lines", width: 50 })] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [customImageSrc ? (jsxRuntime.jsx("img", { alt: altText, className: cvaImgStyles(), height: 200, src: customImageSrc, width: 200 })) : (typeof ImageSource !== "undefined" && (jsxRuntime.jsx(ImageSource, { "data-testid": "empty-state-image", height: 200, width: 200 }, image))), description ? (jsxRuntime.jsx(Text, { align: "center", size: "large", children: description })) : null, jsxRuntime.jsxs("div", { className: "grid gap-3", children: [jsxRuntime.jsxs("div", { className: "flex gap-3", children: [secondaryAction ? (jsxRuntime.jsx(Button, { dataTestId: "empty-state-secondary-button", disabled: secondaryAction.disabled, onClick: secondaryAction.onClick, variant: "secondary", children: secondaryAction.to ? (jsxRuntime.jsx(reactRouter.Link, { params: secondaryAction.to.parameters, to: secondaryAction.to.pathname, children: secondaryAction.title })) : (secondaryAction.title) })) : null, primaryAction ? (jsxRuntime.jsx(Button, { dataTestId: "empty-state-primary-button", disabled: primaryAction.disabled, onClick: primaryAction.onClick, children: primaryAction.to ? (jsxRuntime.jsx(reactRouter.Link, { params: primaryAction.to.parameters, to: primaryAction.to.pathname, children: primaryAction.title })) : (primaryAction.title) })) : null] }), additionalHelpAction ? (jsxRuntime.jsx(Button, { asChild: true, dataTestId: "empty-state-additional-button", disabled: additionalHelpAction.disabled, onClick: additionalHelpAction.onClick, suffix: jsxRuntime.jsx(Icon, { name: "ArrowTopRightOnSquare", size: "small" }), variant: "ghost", children: jsxRuntime.jsx(reactRouter.Link, { params: (_a = additionalHelpAction.to) === null || _a === void 0 ? void 0 : _a.parameters, target: (_b = additionalHelpAction.to) === null || _b === void 0 ? void 0 : _b.target, to: (_c = additionalHelpAction.to) === null || _c === void 0 ? void 0 : _c.pathname, children: additionalHelpAction.title }) })) : null] })] })) }));
3287
+ return (jsxRuntime.jsx("div", { className: cvaContainerStyles({ className }), "data-testid": dataTestId ?? "empty-state", children: loading ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Spinner, { centering: "centered", dataTestId: "spinner" }), jsxRuntime.jsx(SkeletonLines, { dataTestId: "skeleton-lines", width: 50 })] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [customImageSrc ? (jsxRuntime.jsx("img", { alt: altText, className: cvaImgStyles(), height: 200, src: customImageSrc, width: 200 })) : (typeof ImageSource !== "undefined" && (jsxRuntime.jsx(ImageSource, { "data-testid": "empty-state-image", height: 200, width: 200 }, image))), description ? (jsxRuntime.jsx(Text, { align: "center", size: "large", children: description })) : null, jsxRuntime.jsxs("div", { className: "grid gap-3", children: [jsxRuntime.jsxs("div", { className: "flex gap-3", children: [secondaryAction ? (jsxRuntime.jsx(Button, { dataTestId: "empty-state-secondary-button", disabled: secondaryAction.disabled, onClick: secondaryAction.onClick, variant: "secondary", children: secondaryAction.to ? (jsxRuntime.jsx(reactRouter.Link, { params: secondaryAction.to.parameters, to: secondaryAction.to.pathname, children: secondaryAction.title })) : (secondaryAction.title) })) : null, primaryAction ? (jsxRuntime.jsx(Button, { dataTestId: "empty-state-primary-button", disabled: primaryAction.disabled, onClick: primaryAction.onClick, children: primaryAction.to ? (jsxRuntime.jsx(reactRouter.Link, { params: primaryAction.to.parameters, to: primaryAction.to.pathname, children: primaryAction.title })) : (primaryAction.title) })) : null] }), additionalHelpAction ? (jsxRuntime.jsx(Button, { asChild: true, dataTestId: "empty-state-additional-button", disabled: additionalHelpAction.disabled, onClick: additionalHelpAction.onClick, suffix: jsxRuntime.jsx(Icon, { name: "ArrowTopRightOnSquare", size: "small" }), variant: "ghost", children: jsxRuntime.jsx(reactRouter.Link, { params: additionalHelpAction.to?.parameters, target: additionalHelpAction.to?.target, to: additionalHelpAction.to?.pathname, children: additionalHelpAction.title }) })) : null] })] })) }));
3293
3288
  };
3294
3289
 
3295
3290
  const cvaEmptyValue = cssClassVarianceUtilities.cvaMerge(["text-gray-400"]);
@@ -3316,7 +3311,7 @@ const ExternalLink = ({ rel = "noreferrer", target = "_blank", href, className,
3316
3311
  return (jsxRuntime.jsx("a", { className: cvaExternalLink({ className }), "data-testid": dataTestId, href: href, onClick: onClick, rel: rel, target: target, title: title, children: children }));
3317
3312
  };
3318
3313
 
3319
- const PADDING$1 = 16;
3314
+ const PADDING = 12;
3320
3315
  /**
3321
3316
  * Converts a width size value into a CSS dimension value for max constraints
3322
3317
  *
@@ -3332,7 +3327,7 @@ const getMaxWidthValue = ({ value, referenceWidth, availableWidth }) => {
3332
3327
  }
3333
3328
  case undefined:
3334
3329
  case "none": {
3335
- return `${availableWidth - PADDING$1 * 2}px`;
3330
+ return `${availableWidth - PADDING * 2}px`;
3336
3331
  }
3337
3332
  default: {
3338
3333
  if (typeof value === "number") {
@@ -3377,7 +3372,7 @@ const getMaxHeightValue = ({ value, availableHeight }) => {
3377
3372
  switch (value) {
3378
3373
  case undefined:
3379
3374
  case "none": {
3380
- return `${availableHeight - PADDING$1 * 2}px`;
3375
+ return `${availableHeight - PADDING * 2}px`;
3381
3376
  }
3382
3377
  default: {
3383
3378
  if (typeof value === "number") {
@@ -3409,7 +3404,6 @@ const getMinHeightValue = ({ value }) => {
3409
3404
  };
3410
3405
 
3411
3406
  const DEFAULT_ACTIVATION = { click: true, hover: false, keyboardHandlers: true };
3412
- const PADDING = 16;
3413
3407
  const DEFAULT_DISMISSAL = {
3414
3408
  enabled: true,
3415
3409
  outsidePress: true,
@@ -3432,13 +3426,13 @@ const usePopover = ({ initialOpen = false, placement = "bottom", isModal, isOpen
3432
3426
  const [uncontrolledIsOpen, setUncontrolledIsOpen] = React.useState(initialOpen);
3433
3427
  const [labelId, setLabelId] = React.useState();
3434
3428
  const [descriptionId, setDescriptionId] = React.useState();
3435
- const isOpen = controlledIsOpen !== null && controlledIsOpen !== void 0 ? controlledIsOpen : uncontrolledIsOpen;
3429
+ const isOpen = controlledIsOpen ?? uncontrolledIsOpen;
3436
3430
  const popoverData = react.useFloating({
3437
3431
  placement,
3438
3432
  open: isOpen,
3439
3433
  onOpenChange: open => {
3440
3434
  setUncontrolledIsOpen(open);
3441
- onOpenStateChange === null || onOpenStateChange === void 0 ? void 0 : onOpenStateChange(open);
3435
+ onOpenStateChange?.(open);
3442
3436
  },
3443
3437
  whileElementsMounted: react.autoUpdate,
3444
3438
  middleware: [
@@ -3568,8 +3562,7 @@ const getDefaultPortalContainer = () => {
3568
3562
  * alongside other portalled elements.
3569
3563
  */
3570
3564
  const Portal = (props) => {
3571
- var _a;
3572
- return jsxRuntime.jsx(react.FloatingPortal, { ...props, root: (_a = props.root) !== null && _a !== void 0 ? _a : getDefaultPortalContainer() });
3565
+ return jsxRuntime.jsx(react.FloatingPortal, { ...props, root: props.root ?? getDefaultPortalContainer() });
3573
3566
  };
3574
3567
 
3575
3568
  const cvaPopoverContainer = cssClassVarianceUtilities.cvaMerge(["component-popover-border", "z-popover", "animate-fade-in-fast"]);
@@ -3584,10 +3577,9 @@ const cvaPopoverTitleContainer = cssClassVarianceUtilities.cvaMerge(["flex", "it
3584
3577
  const cvaPopoverTitleText = cssClassVarianceUtilities.cvaMerge(["flex-1", "text-neutral-500"]);
3585
3578
 
3586
3579
  const PopoverContent = React.forwardRef(function PopoverContent({ className, dataTestId, children, portalId, ...props }, propRef) {
3587
- var _a;
3588
3580
  const { context: floatingContext, customProps, ...context } = usePopoverContext();
3589
3581
  const ref = react.useMergeRefs([context.refs.setFloating, propRef]);
3590
- return (jsxRuntime.jsx(Portal, { id: portalId, children: context.isOpen ? (jsxRuntime.jsx(react.FloatingFocusManager, { closeOnFocusOut: false, context: floatingContext, guards: true, modal: context.isModal, order: ["reference", "content"], returnFocus: true, children: jsxRuntime.jsx("div", { "aria-describedby": context.descriptionId, "aria-labelledby": context.labelId, className: cvaPopoverContainer({ className: className !== null && className !== void 0 ? className : customProps.className }), "data-testid": (_a = dataTestId !== null && dataTestId !== void 0 ? dataTestId : customProps.dataTestId) !== null && _a !== void 0 ? _a : "popover-content", ref: ref, style: {
3582
+ return (jsxRuntime.jsx(Portal, { id: portalId, children: context.isOpen ? (jsxRuntime.jsx(react.FloatingFocusManager, { closeOnFocusOut: false, context: floatingContext, guards: true, modal: context.isModal, order: ["reference", "content"], returnFocus: true, children: jsxRuntime.jsx("div", { "aria-describedby": context.descriptionId, "aria-labelledby": context.labelId, className: cvaPopoverContainer({ className: className ?? customProps.className }), "data-testid": dataTestId ?? customProps.dataTestId ?? "popover-content", ref: ref, style: {
3591
3583
  position: context.strategy,
3592
3584
  top: context.y,
3593
3585
  left: context.x,
@@ -3698,8 +3690,8 @@ const FloatingArrowContainer = ({ arrowRef, mode = "dark", }) => {
3698
3690
  * @returns {JSX.Element} Tooltip component
3699
3691
  */
3700
3692
  const Tooltip = ({ children, dataTestId = "tool-tip", disabled, className, label, placement = "auto", mode = "dark", iconProps, id, }) => {
3701
- const [isOpen, setIsOpen] = React__namespace.useState(false);
3702
- const arrowRef = React__namespace.useRef(null);
3693
+ const [isOpen, setIsOpen] = React.useState(false);
3694
+ const arrowRef = React.useRef(null);
3703
3695
  const { refs, floatingStyles, context } = react.useFloating({
3704
3696
  placement: placement === "auto" ? "bottom" : placement,
3705
3697
  open: isOpen,
@@ -3711,13 +3703,13 @@ const Tooltip = ({ children, dataTestId = "tool-tip", disabled, className, label
3711
3703
  // Please don't try to move this into the component body directly
3712
3704
  // I tried and it caused infinite re-renders some places (for whatever reason)
3713
3705
  const wrappedChildren = (jsxRuntime.jsx("div", { className: cvaTooltipContainer({ className }), "data-testid": dataTestId ? `${dataTestId}-parent` : undefined, children: children }));
3714
- const openTooltip = React__namespace.useCallback(() => {
3706
+ const openTooltip = React.useCallback(() => {
3715
3707
  if (disabled) {
3716
3708
  return;
3717
3709
  }
3718
3710
  setIsOpen(true);
3719
3711
  }, [disabled]);
3720
- const closeTooltip = React__namespace.useCallback(() => {
3712
+ const closeTooltip = React.useCallback(() => {
3721
3713
  if (disabled) {
3722
3714
  return;
3723
3715
  }
@@ -3906,15 +3898,14 @@ const KPICard = ({ asChild = false, title, value, loading, unit, className, data
3906
3898
  const Comp = asChild ? reactSlot.Slot : "div";
3907
3899
  const isSmallVariant = variant === "small";
3908
3900
  return (jsxRuntime.jsxs(Comp, { className: cvaKPICardContainer({ className, isClickable: Boolean(asChild || onClick) }), "data-testid": `${dataTestId}-comp`, onClick: onClick, ...rest, children: [jsxRuntime.jsx(Tooltip, { className: "w-full", disabled: !tooltipLabel, label: tooltipLabel, placement: "bottom", children: jsxRuntime.jsx(Card, { className: cvaKPICard({ isClickable: Boolean((onClick || asChild) && !loading), isActive, variant }), children: loading ? (jsxRuntime.jsx(LoadingContent, {})) : (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(Text, { dataTestId: `${dataTestId}-title`, size: isSmallVariant ? "small" : "medium", subtle: true, weight: isSmallVariant ? "normal" : "bold", children: title }), jsxRuntime.jsx(Text, { className: isSmallVariant ? "mt-0.5" : "", dataTestId: `${dataTestId}-value`, size: isSmallVariant ? "small" : "large", type: "div", weight: isSmallVariant ? "bold" : "thick", children: jsxRuntime.jsxs("div", { className: cvaKPICardValueContainer({
3909
- isDefaultAndHasTrendValue: Boolean((trend === null || trend === void 0 ? void 0 : trend.value) && !isSmallVariant),
3901
+ isDefaultAndHasTrendValue: Boolean(trend?.value && !isSmallVariant),
3910
3902
  }), children: [jsxRuntime.jsxs("span", { children: [value, " ", unit] }), jsxRuntime.jsx(TrendIndicator, { isSmallVariant: isSmallVariant, trend: trend, unit: unit })] }) })] })) }) }), !loading && jsxRuntime.jsx(reactSlot.Slottable, { children: rest.children })] }));
3911
3903
  };
3912
3904
  const TrendIndicator = ({ trend, unit, isSmallVariant }) => {
3913
- var _a, _b;
3914
3905
  if (!trend) {
3915
3906
  return null;
3916
3907
  }
3917
- return (jsxRuntime.jsxs("div", { className: "flex flex-row items-center gap-1", "data-testid": "trend-indicator", children: [!isSmallVariant && trend.value ? (jsxRuntime.jsxs(Text, { dataTestId: "trend-value", size: "small", weight: "normal", children: [trend.value, " ", unit] })) : null, ((_a = trend.variant) === null || _a === void 0 ? void 0 : _a.icon) ? jsxRuntime.jsx(Icon, { color: trend.variant.color, name: trend.variant.icon, size: "small" }) : null, trend.percentage ? (jsxRuntime.jsxs(Text, { className: cvaKPICardTrendPercentage({ color: (_b = trend.variant) === null || _b === void 0 ? void 0 : _b.color }), size: "small", weight: "bold", children: [trend.percentage, "%"] })) : null] }));
3908
+ return (jsxRuntime.jsxs("div", { className: "flex flex-row items-center gap-1", "data-testid": "trend-indicator", children: [!isSmallVariant && trend.value ? (jsxRuntime.jsxs(Text, { dataTestId: "trend-value", size: "small", weight: "normal", children: [trend.value, " ", unit] })) : null, trend.variant?.icon ? jsxRuntime.jsx(Icon, { color: trend.variant.color, name: trend.variant.icon, size: "small" }) : null, trend.percentage ? (jsxRuntime.jsxs(Text, { className: cvaKPICardTrendPercentage({ color: trend.variant?.color }), size: "small", weight: "bold", children: [trend.percentage, "%"] })) : null] }));
3918
3909
  };
3919
3910
 
3920
3911
  const cvaMenuList = cssClassVarianceUtilities.cvaMerge([
@@ -3938,7 +3929,7 @@ const cvaMenuList = cssClassVarianceUtilities.cvaMerge([
3938
3929
  });
3939
3930
  const cvaMenuListDivider = cssClassVarianceUtilities.cvaMerge(["mx-[-4px]", "my-1", "min-h-px", "bg-slate-300"]);
3940
3931
  const cvaMenuListMultiSelect = cssClassVarianceUtilities.cvaMerge("hover:!bg-blue-200");
3941
- const cvaMenuListItem = cssClassVarianceUtilities.cvaMerge("max-w-[292px]");
3932
+ const cvaMenuListItem = cssClassVarianceUtilities.cvaMerge("max-w-full");
3942
3933
 
3943
3934
  /**
3944
3935
  * The MenuDivider component is used to separate items in a menu list.
@@ -4004,7 +3995,7 @@ const cvaInteractableItem = cssClassVarianceUtilities.cvaMerge("", {
4004
3995
  * The cvaInteractableItem variant is used to set the standardized styles that change through interaction with the element (background color, hover, focus, and disabled).
4005
3996
  */
4006
3997
  const cvaMenuItem = (props) => {
4007
- const { selected, disabled, focused, className, variant } = props !== null && props !== void 0 ? props : {};
3998
+ const { selected, disabled, focused, className, variant } = props ?? {};
4008
3999
  return tailwindMerge.twMerge(cvaMenuItemStyle({ variant, selected, disabled }), cvaInteractableItem({ selected, disabled, cursor: "pointer", focused }), className);
4009
4000
  };
4010
4001
  const cvaMenuItemStyle = cssClassVarianceUtilities.cvaMerge(["py-2", "px-2", "h-auto", "flex", "flex-row", "items-center", "gap-x-2", "select-none", "rounded", "text-sm"], {
@@ -4121,8 +4112,8 @@ const MenuItem = ({ className, dataTestId, label, children, selected, prefix, su
4121
4112
  variant,
4122
4113
  }), "data-testid": dataTestId ? `${dataTestId}-menu-item` : "menu-item", id: id, onClick: e => {
4123
4114
  stopPropagation && e.stopPropagation();
4124
- onClick === null || onClick === void 0 ? void 0 : onClick(e);
4125
- }, onKeyDown: handleKeyDown, role: "menuitem", tabIndex: disabled ? -1 : tabIndex !== null && tabIndex !== void 0 ? tabIndex : 0, children: [prefix ? (jsxRuntime.jsx("div", { className: cvaMenuItemPrefix({ selected, variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-prefix` : "menu-item-prefix", children: prefix })) : null, children && typeof children !== "string" ? (children) : (jsxRuntime.jsxs("div", { className: cvaMenuItemLabel({ variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-label` : "menu-item-label", children: [children !== null && children !== void 0 ? children : label, optionLabelDescription ? jsxRuntime.jsxs("span", { className: "text-secondary-400 ml-1", children: ["(", optionLabelDescription, ")"] }) : null] })), suffix ? (jsxRuntime.jsx("div", { className: cvaMenuItemSuffix({ selected, variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-suffix` : "menu-item-suffix", children: suffix })) : null] }));
4115
+ onClick?.(e);
4116
+ }, onKeyDown: handleKeyDown, role: "menuitem", tabIndex: disabled ? -1 : (tabIndex ?? 0), children: [prefix ? (jsxRuntime.jsx("div", { className: cvaMenuItemPrefix({ selected, variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-prefix` : "menu-item-prefix", children: prefix })) : null, children && typeof children !== "string" ? (children) : (jsxRuntime.jsxs("div", { className: cvaMenuItemLabel({ variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-label` : "menu-item-label", children: [children ?? label, optionLabelDescription ? jsxRuntime.jsxs("span", { className: "text-secondary-400 ml-1", children: ["(", optionLabelDescription, ")"] }) : null] })), suffix ? (jsxRuntime.jsx("div", { className: cvaMenuItemSuffix({ selected, variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-suffix` : "menu-item-suffix", children: suffix })) : null] }));
4126
4117
  };
4127
4118
 
4128
4119
  /**
@@ -4138,8 +4129,8 @@ const MenuItem = ({ className, dataTestId, label, children, selected, prefix, su
4138
4129
  */
4139
4130
  const MenuList = ({ dataTestId, className, children, withStickyHeader = false, isMulti = false, selectedItems: controlledSelectedItems, onSelectionChange, ...args }) => {
4140
4131
  const childrenArr = React.Children.toArray(children);
4141
- const [internalSelectedItems, setInternalSelectedItems] = React.useState(controlledSelectedItems !== null && controlledSelectedItems !== void 0 ? controlledSelectedItems : []);
4142
- const selectedItems = controlledSelectedItems !== null && controlledSelectedItems !== void 0 ? controlledSelectedItems : internalSelectedItems;
4132
+ const [internalSelectedItems, setInternalSelectedItems] = React.useState(controlledSelectedItems ?? []);
4133
+ const selectedItems = controlledSelectedItems ?? internalSelectedItems;
4143
4134
  const handleItemClick = React.useCallback((id, disabled) => {
4144
4135
  if (disabled) {
4145
4136
  return;
@@ -4157,22 +4148,22 @@ const MenuList = ({ dataTestId, className, children, withStickyHeader = false, i
4157
4148
  }
4158
4149
  }, [isMulti, selectedItems, onSelectionChange]);
4159
4150
  return (jsxRuntime.jsx("div", { className: cvaMenuList({ stickyHeader: withStickyHeader, className }), "data-testid": dataTestId ? `${dataTestId}-menu-list` : "menu-list", onClick: args.onClick, role: "list", tabIndex: 0, children: childrenArr.map((menuItem, index) => {
4160
- var _a;
4161
4151
  if (React.isValidElement(menuItem)) {
4162
- const isSelected = selectedItems.includes((_a = menuItem.props.id) !== null && _a !== void 0 ? _a : `${index}`) || menuItem.props.selected;
4163
- return (jsxRuntime.jsx("div", { children: React.cloneElement(menuItem, {
4164
- ...menuItem.props,
4165
- onClick: (event) => {
4166
- var _a, _b, _c;
4167
- (_b = (_a = menuItem.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a, event);
4168
- handleItemClick((_c = menuItem.props.id) !== null && _c !== void 0 ? _c : `${index}`, menuItem.props.disabled);
4169
- },
4170
- className: isMulti && isSelected
4171
- ? cvaMenuListMultiSelect({ className: menuItem.props.className })
4172
- : cvaMenuListItem({ className: menuItem.props.className }),
4173
- selected: isSelected,
4174
- suffix: isMulti && isSelected ? jsxRuntime.jsx(Icon, { className: "block text-blue-600", name: "Check", size: "medium" }) : null,
4175
- }) }, index));
4152
+ const isSelected = selectedItems.includes(menuItem.props.id ?? `${index}`) || menuItem.props.selected;
4153
+ return React.cloneElement(menuItem, {
4154
+ ...menuItem.props,
4155
+ key: index,
4156
+ onClick: (event) => {
4157
+ menuItem.props.onClick?.(event);
4158
+ handleItemClick(menuItem.props.id ?? `${index}`, menuItem.props.disabled);
4159
+ },
4160
+ className: isMulti && isSelected
4161
+ ? cvaMenuListMultiSelect({ className: menuItem.props.className })
4162
+ : cvaMenuListItem({ className: menuItem.props.className }),
4163
+ selected: isSelected,
4164
+ suffix: menuItem.props.suffix ??
4165
+ (isMulti && isSelected ? jsxRuntime.jsx(Icon, { className: "block text-blue-600", name: "Check", size: "medium" }) : null),
4166
+ });
4176
4167
  }
4177
4168
  return null;
4178
4169
  }) }));
@@ -4197,7 +4188,7 @@ const MoreMenu = ({ className, dataTestId, popoverProps, iconProps = {
4197
4188
  variant: "secondary",
4198
4189
  }, customButton, customPortalId, children, }) => {
4199
4190
  const actionMenuRef = React.useRef(null);
4200
- return (jsxRuntime.jsx("div", { className: cvaMoreMenu({ className }), "data-testid": dataTestId ? dataTestId : "more-menu", ref: actionMenuRef, children: jsxRuntime.jsxs(Popover, { placement: "bottom-end", ...popoverProps, children: [jsxRuntime.jsx(PopoverTrigger, { children: customButton !== null && customButton !== void 0 ? customButton : (jsxRuntime.jsx(IconButton, { dataTestId: "more-menu-icon", ...iconButtonProps, icon: jsxRuntime.jsx(Icon, { name: "EllipsisHorizontal", ...iconProps }) })) }), jsxRuntime.jsx(PopoverContent, { portalId: customPortalId, children: close => (typeof children === "function" ? children(close) : children) })] }) }));
4191
+ return (jsxRuntime.jsx("div", { className: cvaMoreMenu({ className }), "data-testid": dataTestId ? dataTestId : "more-menu", ref: actionMenuRef, children: jsxRuntime.jsxs(Popover, { placement: "bottom-end", ...popoverProps, children: [jsxRuntime.jsx(PopoverTrigger, { children: customButton ?? (jsxRuntime.jsx(IconButton, { dataTestId: "more-menu-icon", ...iconButtonProps, icon: jsxRuntime.jsx(Icon, { name: "EllipsisHorizontal", ...iconProps }) })) }), jsxRuntime.jsx(PopoverContent, { portalId: customPortalId, children: close => (typeof children === "function" ? children(close) : children) })] }) }));
4201
4192
  };
4202
4193
 
4203
4194
  const cvaNotice = cssClassVarianceUtilities.cvaMerge(["flex", "items-center"]);
@@ -4302,7 +4293,7 @@ const Page = ({ layout, className, children, dataTestId }) => {
4302
4293
  * Applies padding to content. To be used within a <Page/>
4303
4294
  *
4304
4295
  * @param {PageContentProps} props - The component props.
4305
- * @returns {React.ReactNode} - The rendered component.
4296
+ * @returns {ReactNode} - The rendered component.
4306
4297
  */
4307
4298
  const PageContent = ({ className, children, dataTestId, layout }) => {
4308
4299
  return (jsxRuntime.jsx("div", { className: cvaPageContent({ className, layout }), "data-testid": dataTestId ? dataTestId : "page-content", children: children }));
@@ -4362,7 +4353,7 @@ const PageHeader = ({ className, dataTestId, action, actionPosition, showLoading
4362
4353
  withBorder: !tabsList,
4363
4354
  }), "data-testid": dataTestId, children: [jsxRuntime.jsxs("div", { className: cvaPageHeader(), children: [jsxRuntime.jsxs("div", { className: cvaPageHeaderHeadingAccessoriesContainer({
4364
4355
  actionPosition: actionPosition ? actionPosition : null,
4365
- }), "data-testid": dataTestId ? `${dataTestId}-heading-container` : undefined, children: [jsxRuntime.jsxs("div", { className: cvaPageHeaderHeadingContainer(), children: [backTo ? (jsxRuntime.jsx(Button, { asChild: true, className: "bg-black/5 hover:bg-black/10", prefix: jsxRuntime.jsx(Icon, { name: "ArrowLeft", size: "small" }), size: "small", square: true, variant: "ghost-neutral", children: jsxRuntime.jsx(reactRouter.Link, { to: backTo }) })) : undefined, jsxRuntime.jsxs("div", { className: "flex flex-col", children: [jsxRuntime.jsxs("div", { className: "flex flex-row flex-wrap items-center gap-x-4 gap-y-2", children: [jsxRuntime.jsx("h1", { className: cvaPageHeaderHeading(), "data-testid": dataTestId ? `${dataTestId}-heading` : undefined, children: title }), description && !showLoading ? (jsxRuntime.jsx(Tooltip, { dataTestId: dataTestId ? `${dataTestId}-tooltip` : undefined, iconProps: { name: descriptionIcon !== null && descriptionIcon !== void 0 ? descriptionIcon : "QuestionMarkCircle" }, label: description, placement: "bottom" })) : undefined, tag && !showLoading ? (jsxRuntime.jsx(Tag, { color: tagColor, dataTestId: dataTestId ? `${dataTestId}-tag` : undefined, children: tag })) : undefined] }), link ? (jsxRuntime.jsxs(reactRouter.Link, { className: cvaPageHeaderLink(), "data-testid": "tooltip-link", target: "_blank", to: link, children: [linkText, jsxRuntime.jsx(Icon, { name: "ArrowTopRightOnSquare", size: "small" })] })) : undefined] }), showLoading ? (jsxRuntime.jsx(Spinner, { centering: "vertically", dataTestId: dataTestId ? `${dataTestId}-spinner` : undefined })) : null] }), jsxRuntime.jsx("div", { children: action })] }), children ? jsxRuntime.jsx("div", { className: cvaPageHeaderChildContainer(), children: children }) : null] }), tabsList] }));
4356
+ }), "data-testid": dataTestId ? `${dataTestId}-heading-container` : undefined, children: [jsxRuntime.jsxs("div", { className: cvaPageHeaderHeadingContainer(), children: [backTo ? (jsxRuntime.jsx(Button, { asChild: true, className: "bg-black/5 hover:bg-black/10", prefix: jsxRuntime.jsx(Icon, { name: "ArrowLeft", size: "small" }), size: "small", square: true, variant: "ghost-neutral", children: jsxRuntime.jsx(reactRouter.Link, { to: backTo }) })) : undefined, jsxRuntime.jsxs("div", { className: "flex flex-col", children: [jsxRuntime.jsxs("div", { className: "flex flex-row flex-wrap items-center gap-x-4 gap-y-2", children: [jsxRuntime.jsx("h1", { className: cvaPageHeaderHeading(), "data-testid": dataTestId ? `${dataTestId}-heading` : undefined, children: title }), description && !showLoading ? (jsxRuntime.jsx(Tooltip, { dataTestId: dataTestId ? `${dataTestId}-tooltip` : undefined, iconProps: { name: descriptionIcon ?? "QuestionMarkCircle" }, label: description, placement: "bottom" })) : undefined, tag && !showLoading ? (jsxRuntime.jsx(Tag, { color: tagColor, dataTestId: dataTestId ? `${dataTestId}-tag` : undefined, children: tag })) : undefined] }), link ? (jsxRuntime.jsxs(reactRouter.Link, { className: cvaPageHeaderLink(), "data-testid": "tooltip-link", target: "_blank", to: link, children: [linkText, jsxRuntime.jsx(Icon, { name: "ArrowTopRightOnSquare", size: "small" })] })) : undefined] }), showLoading ? (jsxRuntime.jsx(Spinner, { centering: "vertically", dataTestId: dataTestId ? `${dataTestId}-spinner` : undefined })) : null] }), jsxRuntime.jsx("div", { children: action })] }), children ? jsxRuntime.jsx("div", { className: cvaPageHeaderChildContainer(), children: children }) : null] }), tabsList] }));
4366
4357
  };
4367
4358
 
4368
4359
  const cvaPagination = cssClassVarianceUtilities.cvaMerge(["flex", "items-center", "gap-1"]);
@@ -4406,7 +4397,7 @@ const Pagination = ({ previousPage, nextPage, canPreviousPage, canNextPage, page
4406
4397
  setPage(to);
4407
4398
  setCurrentPage(String(to + 1));
4408
4399
  }
4409
- onPageChange === null || onPageChange === void 0 ? void 0 : onPageChange({ from, to, description });
4400
+ onPageChange?.({ from, to, description });
4410
4401
  }, [page, onPageChange, previousPage, nextPage]);
4411
4402
  if (loading) {
4412
4403
  return (jsxRuntime.jsx("div", { className: cvaPagination({ className }), children: jsxRuntime.jsx(SkeletonLines, { height: 16, width: 150 }) }));
@@ -4577,7 +4568,7 @@ const useOverflowItems = ({ threshold = 1, childUniqueIdentifierAttribute = "id"
4577
4568
  }, [handleIntersection, threshold]);
4578
4569
  const unobserve = React.useCallback(() => {
4579
4570
  const currentObserver = observerRef.current;
4580
- currentObserver === null || currentObserver === void 0 ? void 0 : currentObserver.disconnect();
4571
+ currentObserver?.disconnect();
4581
4572
  observerRef.current = null;
4582
4573
  }, []);
4583
4574
  const initializeObserver = React.useCallback(() => {
@@ -4608,7 +4599,7 @@ const Sidebar = ({ childContainerClassName, children, breakpoint = "lg", classNa
4608
4599
  const { overflowContainerRef, itemOverflowMap } = useOverflowItems({
4609
4600
  children,
4610
4601
  childUniqueIdentifierAttribute: "id",
4611
- threshold: overflowThreshold !== null && overflowThreshold !== void 0 ? overflowThreshold : 0.8,
4602
+ threshold: overflowThreshold ?? 0.8,
4612
4603
  });
4613
4604
  const overflowItemCount = sharedUtils.objectValues(itemOverflowMap).filter(isOverflowing => isOverflowing).length;
4614
4605
  const itemVisibilityClassName = (id) => {
@@ -4623,12 +4614,11 @@ const Sidebar = ({ childContainerClassName, children, breakpoint = "lg", classNa
4623
4614
  });
4624
4615
  }) }), overflowItemCount > 0 ? (jsxRuntime.jsx(MoreMenu, { iconButtonProps: {
4625
4616
  variant: "ghost-neutral",
4626
- }, ...moreMenuProps, className: moreMenuProps === null || moreMenuProps === void 0 ? void 0 : moreMenuProps.className, dataTestId: dataTestId ? `${dataTestId}-more-menu` : undefined, children: close => (jsxRuntime.jsx(MenuList, { ...menuListProps, dataTestId: dataTestId, children: React.Children.map(children, child => {
4617
+ }, ...moreMenuProps, className: moreMenuProps?.className, dataTestId: dataTestId ? `${dataTestId}-more-menu` : undefined, children: close => (jsxRuntime.jsx(MenuList, { ...menuListProps, dataTestId: dataTestId, children: React.Children.map(children, child => {
4627
4618
  return itemOverflowMap[child.props.id]
4628
4619
  ? React.cloneElement(child, {
4629
4620
  onClick: () => {
4630
- var _a, _b;
4631
- (_b = (_a = child.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a);
4621
+ child.props.onClick?.();
4632
4622
  close();
4633
4623
  },
4634
4624
  className: "w-full",
@@ -4752,7 +4742,7 @@ const cvaToggleItemText = cssClassVarianceUtilities.cvaMerge(["text-ellipsis", "
4752
4742
  const ToggleGroup = ({ list, selected, setSelected, onChange, disabled = false, size = "medium", isIconOnly = false, className, dataTestId, }) => {
4753
4743
  return (jsxRuntime.jsx("div", { className: cvaToggleGroup(), "data-testid": dataTestId, children: list.map((item, index) => (jsxRuntime.jsx(ToggleItem, { className: tailwindMerge.twMerge(className, index === 0 ? ["rounded-l-md", "border-l"] : "", index === list.length - 1 ? ["rounded-r-md", "border-r"] : ""), dataTestId: item.dataTestId, disabled: disabled, iconName: item.iconName, isIconOnly: isIconOnly, onClick: () => {
4754
4744
  setSelected(item.id);
4755
- onChange === null || onChange === void 0 ? void 0 : onChange(item.id);
4745
+ onChange?.(item.id);
4756
4746
  }, selected: selected === item.id, size: size, text: item.text, title: item.title, tooltip: item.tooltip }, item.id))) }));
4757
4747
  };
4758
4748
  /**
@@ -4760,7 +4750,7 @@ const ToggleGroup = ({ list, selected, setSelected, onChange, disabled = false,
4760
4750
  */
4761
4751
  const ToggleItem = ({ title, onClick, disabled = false, isIconOnly = false, iconName, size, className, selected = false, text, tooltip, dataTestId, }) => {
4762
4752
  // eslint-disable-next-line sonarjs/no-selector-parameter
4763
- return isIconOnly ? (jsxRuntime.jsx(Tooltip, { label: (tooltip === null || tooltip === void 0 ? void 0 : tooltip.content) || title, placement: (tooltip === null || tooltip === void 0 ? void 0 : tooltip.placement) || "top", children: jsxRuntime.jsx(IconButton, { className: cvaToggleItem({ className, selected }), "data-testid": dataTestId, disabled: disabled, icon: iconName ? (jsxRuntime.jsx(Icon, { className: selected ? "text-slate-600" : "text-slate-400", name: iconName, size: "small" })) : null, onClick: onClick, size: size, title: iconName, variant: "secondary" }) })) : (jsxRuntime.jsx(Tooltip, { disabled: !(text === null || text === void 0 ? void 0 : text.truncate) && (tooltip === null || tooltip === void 0 ? void 0 : tooltip.content) === undefined, label: (tooltip === null || tooltip === void 0 ? void 0 : tooltip.content) || title, placement: (tooltip === null || tooltip === void 0 ? void 0 : tooltip.placement) || "top", children: jsxRuntime.jsx(Button, { className: cvaToggleItem({ className, selected }), "data-testid": dataTestId, disabled: disabled, onClick: onClick, prefix: iconName ? (jsxRuntime.jsx(Icon, { className: selected ? "text-slate-600" : "text-slate-400", name: iconName, size: "small" })) : null, size: size, variant: "secondary", children: jsxRuntime.jsx("span", { className: cvaToggleItemText({ disabledAndSelected: disabled && selected, maxWidth: text === null || text === void 0 ? void 0 : text.maxWidth }), children: title }) }) }));
4753
+ return isIconOnly ? (jsxRuntime.jsx(Tooltip, { label: tooltip?.content || title, placement: tooltip?.placement || "top", children: jsxRuntime.jsx(IconButton, { className: cvaToggleItem({ className, selected }), "data-testid": dataTestId, disabled: disabled, icon: iconName ? (jsxRuntime.jsx(Icon, { className: selected ? "text-slate-600" : "text-slate-400", name: iconName, size: "small" })) : null, onClick: onClick, size: size, title: iconName, variant: "secondary" }) })) : (jsxRuntime.jsx(Tooltip, { disabled: !text?.truncate && tooltip?.content === undefined, label: tooltip?.content || title, placement: tooltip?.placement || "top", children: jsxRuntime.jsx(Button, { className: cvaToggleItem({ className, selected }), "data-testid": dataTestId, disabled: disabled, onClick: onClick, prefix: iconName ? (jsxRuntime.jsx(Icon, { className: selected ? "text-slate-600" : "text-slate-400", name: iconName, size: "small" })) : null, size: size, variant: "secondary", children: jsxRuntime.jsx("span", { className: cvaToggleItemText({ disabledAndSelected: disabled && selected, maxWidth: text?.maxWidth }), children: title }) }) }));
4764
4754
  };
4765
4755
 
4766
4756
  const cvaValueBar = cssClassVarianceUtilities.cvaMerge(["w-full"], {
@@ -4843,14 +4833,13 @@ const getDefaultFillColor = (score) => {
4843
4833
  * @returns {string} color value
4844
4834
  */
4845
4835
  const getFillColor = (score, levelColors) => {
4846
- var _a, _b;
4847
4836
  if (levelColors.low && score < (levelColors.low.level || 0)) {
4848
4837
  return levelColors.low.color;
4849
4838
  }
4850
4839
  if (levelColors.high && score >= (levelColors.high.level || 0)) {
4851
4840
  return levelColors.high.color;
4852
4841
  }
4853
- return (_b = (_a = levelColors.medium) === null || _a === void 0 ? void 0 : _a.color) !== null && _b !== void 0 ? _b : uiDesignTokens.color("WARNING", 300);
4842
+ return levelColors.medium?.color ?? uiDesignTokens.color("WARNING", 300);
4854
4843
  };
4855
4844
  /**
4856
4845
  * Helper function to get color used by the ValueBar
@@ -4876,7 +4865,7 @@ const ValueBar = ({ value, min = 0, max = 100, unit, size = "small", levelColors
4876
4865
  const score = getScore(value, min, max, zeroScoreAllowed);
4877
4866
  const barFillColor = levelColors ? getFillColor(score, levelColors) : getDefaultFillColor(score);
4878
4867
  const barWidth = showValue && size === "small" ? 90 : 100;
4879
- return (jsxRuntime.jsx("svg", { className: cvaValueBar({ size, className }), "data-testid": dataTestId, role: "img", children: jsxRuntime.jsxs("g", { children: [jsxRuntime.jsx("rect", { className: cvaValueBarProgress({ fill: "background", className }), "data-testid": "value-bar-svg-rect-0", rx: size === "extraSmall" ? "2" : "5", width: `${barWidth}%` }), jsxRuntime.jsx("rect", { className: cvaValueBarProgress(), "data-testid": "value-bar-svg-rect-1", fill: barFillColor, rx: size === "extraSmall" ? "2" : "5", width: `${score * barWidth}%` }), showValue && size === "large" ? (jsxRuntime.jsxs("text", { className: cvaValueBarText({ size }), fill: valueColor !== null && valueColor !== void 0 ? valueColor : "white", x: "12", y: "23", children: [Number(value.toFixed(1)), unit || ""] })) : null, showValue && size === "small" ? (jsxRuntime.jsxs("text", { className: cvaValueBarText({ size }), fill: valueColor !== null && valueColor !== void 0 ? valueColor : uiDesignTokens.color("NEUTRAL", 400, "CSS"), x: `${barWidth + 2}%`, y: "11", children: [Number(value.toFixed(1)), unit || ""] })) : null] }) }));
4868
+ return (jsxRuntime.jsx("svg", { className: cvaValueBar({ size, className }), "data-testid": dataTestId, role: "img", children: jsxRuntime.jsxs("g", { children: [jsxRuntime.jsx("rect", { className: cvaValueBarProgress({ fill: "background", className }), "data-testid": "value-bar-svg-rect-0", rx: size === "extraSmall" ? "2" : "5", width: `${barWidth}%` }), jsxRuntime.jsx("rect", { className: cvaValueBarProgress(), "data-testid": "value-bar-svg-rect-1", fill: barFillColor, rx: size === "extraSmall" ? "2" : "5", width: `${score * barWidth}%` }), showValue && size === "large" ? (jsxRuntime.jsxs("text", { className: cvaValueBarText({ size }), fill: valueColor ?? "white", x: "12", y: "23", children: [Number(value.toFixed(1)), unit || ""] })) : null, showValue && size === "small" ? (jsxRuntime.jsxs("text", { className: cvaValueBarText({ size }), fill: valueColor ?? uiDesignTokens.color("NEUTRAL", 400, "CSS"), x: `${barWidth + 2}%`, y: "11", children: [Number(value.toFixed(1)), unit || ""] })) : null] }) }));
4880
4869
  };
4881
4870
 
4882
4871
  const cvaVirtualizedListContainer = cssClassVarianceUtilities.cvaMerge(["h-full", "overflow-auto"]);
@@ -4907,13 +4896,12 @@ const cvaVirtualizedListItem = cssClassVarianceUtilities.cvaMerge(["absolute", "
4907
4896
  * @property {skeletonLinesHeight} [skeletonLinesHeight="2rem"] - The height of the skeleton lines.
4908
4897
  */
4909
4898
  const VirtualizedList = ({ count, rowHeight = 40, pagination, children, className, dataTestId, separator = "none", loadingIndicator = "spinner", skeletonLinesHeight = rowHeight + "px", onRowClick, }) => {
4910
- var _a;
4911
4899
  const containerRef = React.useRef(null);
4912
4900
  const listRef = React.useRef(null);
4913
4901
  const { fetchMoreOnBottomReached, getVirtualItems, getTotalSize, measureElement } = reactTablePagination.useInfiniteScroll({
4914
4902
  pagination: pagination || reactTablePagination.noPagination,
4915
4903
  containerRef,
4916
- rowSize: ((_a = pagination === null || pagination === void 0 ? void 0 : pagination.pageInfo) === null || _a === void 0 ? void 0 : _a.hasNextPage) && pagination.isLoading ? count + 1 : count,
4904
+ rowSize: pagination?.pageInfo?.hasNextPage && pagination.isLoading ? count + 1 : count,
4917
4905
  rowHeight,
4918
4906
  });
4919
4907
  return (jsxRuntime.jsx("div", { className: cvaVirtualizedListContainer({ className }), "data-testid": dataTestId,
@@ -4922,7 +4910,7 @@ const VirtualizedList = ({ count, rowHeight = 40, pagination, children, classNam
4922
4910
  const isLoaderRow = virtualRow.index > count - 1;
4923
4911
  return (jsxRuntime.jsx("li", { className: cvaVirtualizedListItem({ separator }), "data-index": virtualRow.index, onClick: onRowClick ? () => onRowClick(virtualRow.index) : undefined, ref: measureElement, style: {
4924
4912
  transform: `translateY(${virtualRow.start}px)`,
4925
- }, tabIndex: -1, children: isLoaderRow ? ((pagination === null || pagination === void 0 ? void 0 : pagination.isLoading) ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [loadingIndicator === "spinner" && jsxRuntime.jsx(Spinner, { centering: "horizontally", containerClassName: "p-4" }), loadingIndicator === "skeletonLines" && (jsxRuntime.jsx(SkeletonLines, { height: skeletonLinesHeight, lines: 3, width: "full" }))] })) : null) : (children(virtualRow.index)) }, virtualRow.key));
4913
+ }, tabIndex: -1, children: isLoaderRow ? (pagination?.isLoading ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [loadingIndicator === "spinner" && jsxRuntime.jsx(Spinner, { centering: "horizontally", containerClassName: "p-4" }), loadingIndicator === "skeletonLines" && (jsxRuntime.jsx(SkeletonLines, { height: skeletonLinesHeight, lines: 3, width: "full" }))] })) : null) : (children(virtualRow.index)) }, virtualRow.key));
4926
4914
  }) }) }));
4927
4915
  };
4928
4916