@trackunit/react-components 0.1.237 → 0.1.239
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs.js +213 -166
- package/index.esm.js +215 -165
- package/package.json +1 -1
- package/src/components/Icon/Icon.d.ts +8 -4
- package/src/components/PageHeader/PageHeader.d.ts +5 -1
- package/src/components/PageHeader/PageHeader.variants.d.ts +2 -0
- package/src/components/SkeletonLines/SkeletonLines.d.ts +0 -2
- package/src/components/Tooltip/Tooltip.d.ts +17 -4
- package/src/components/Tooltip/Tooltip.variants.d.ts +10 -2
- package/src/components/buttons/shared/Button.variants.d.ts +0 -4
- package/src/components/index.d.ts +0 -1
- package/src/components/Tip/Tip.d.ts +0 -27
- package/src/components/Tip/Tip.variants.d.ts +0 -4
- package/src/components/Tip/index.d.ts +0 -1
package/index.cjs.js
CHANGED
|
@@ -74,43 +74,6 @@ const useContainerProps = ({ className, dataTestId }) => {
|
|
|
74
74
|
return containerProps;
|
|
75
75
|
};
|
|
76
76
|
|
|
77
|
-
/******************************************************************************
|
|
78
|
-
Copyright (c) Microsoft Corporation.
|
|
79
|
-
|
|
80
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
81
|
-
purpose with or without fee is hereby granted.
|
|
82
|
-
|
|
83
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
84
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
85
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
86
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
87
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
88
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
89
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
90
|
-
***************************************************************************** */
|
|
91
|
-
|
|
92
|
-
function __rest(s, e) {
|
|
93
|
-
var t = {};
|
|
94
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
95
|
-
t[p] = s[p];
|
|
96
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
97
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
98
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
99
|
-
t[p[i]] = s[p[i]];
|
|
100
|
-
}
|
|
101
|
-
return t;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
105
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
106
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
107
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
108
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
109
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
110
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
|
|
114
77
|
const cvaIcon = cssClassVarianceUtilities.cvaMerge(["aspect-square", "inline-grid", "relative"], {
|
|
115
78
|
variants: {
|
|
116
79
|
color: {
|
|
@@ -197,6 +160,7 @@ cssClassVarianceUtilities.cvaMerge([
|
|
|
197
160
|
]);
|
|
198
161
|
|
|
199
162
|
const iconPalette = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, uiDesignTokens.intentPalette), uiDesignTokens.generalPalette), uiDesignTokens.criticalityPalette), uiDesignTokens.activityPalette), uiDesignTokens.utilizationPalette), uiDesignTokens.sitesPalette), uiDesignTokens.rentalStatusPalette);
|
|
163
|
+
// eslint-disable-next-line local-rules/no-typescript-assertion
|
|
200
164
|
const iconColorNames = Object.keys(iconPalette).map(key => key.toLowerCase()); // This users the object in the Object.keys() to infer the type of the keys.
|
|
201
165
|
const isSafari = () => {
|
|
202
166
|
const ua = navigator.userAgent.toLowerCase();
|
|
@@ -232,10 +196,7 @@ const Icon = ({ name, size = "large", className, dataTestId, color, onClick, typ
|
|
|
232
196
|
useTagRef.current.setAttribute("href", href[correctIconType]);
|
|
233
197
|
}
|
|
234
198
|
}, [correctIconType, href]);
|
|
235
|
-
|
|
236
|
-
return null;
|
|
237
|
-
}
|
|
238
|
-
return (jsxRuntime.jsx("span", { className: cvaIcon({ color, size, className }), onClick: onClick, "data-testid": dataTestId, ref: forwardedRef, children: jsxRuntime.jsx("svg", { viewBox: correctIconType === "mini" ? "0 0 20 20" : "0 0 24 24", "data-testid": dataTestId ? `${dataTestId}-${iconName}` : iconName, style: style, children: jsxRuntime.jsx("use", { href: href[correctIconType], ref: useTagRef }) }) }));
|
|
199
|
+
return (jsxRuntime.jsx("span", { className: cvaIcon({ color, size, className }), onClick: onClick, "data-testid": dataTestId, ref: forwardedRef, children: jsxRuntime.jsxs("svg", { viewBox: correctIconType === "mini" ? "0 0 20 20" : "0 0 24 24", "data-testid": dataTestId ? `${dataTestId}-${iconName}` : iconName, style: style, role: "img", children: [jsxRuntime.jsx("title", { children: iconName }), jsxRuntime.jsx("use", { href: href[correctIconType], ref: useTagRef })] }) }));
|
|
239
200
|
};
|
|
240
201
|
|
|
241
202
|
const cvaTag = cssClassVarianceUtilities.cvaMerge([
|
|
@@ -314,12 +275,12 @@ const cvaTagIcon = cssClassVarianceUtilities.cvaMerge(["cursor-pointer", "transi
|
|
|
314
275
|
* @param {TagProps} props - The props for the tag component
|
|
315
276
|
* @returns {JSX.Element} tag component
|
|
316
277
|
*/
|
|
317
|
-
const Tag = React__namespace.forwardRef((
|
|
318
|
-
|
|
319
|
-
return (jsxRuntime.jsxs("span", { className: cvaTag({ className, size, color, layout: Boolean(onClose) ? "withIcon" : "default" }), "data-testid": dataTestId && `${dataTestId}-tag`, ref: ref, children: [children, Boolean(onClose) && !disabled && (
|
|
278
|
+
const Tag = React__namespace.forwardRef(({ className, dataTestId, children, size = "medium", onClose, color = "primary", disabled = false }, ref) => {
|
|
279
|
+
return (jsxRuntime.jsxs("span", { className: cvaTag({ className, size, color, layout: onClose ? "withIcon" : "default" }), "data-testid": dataTestId, ref: ref, children: [children, Boolean(onClose) && !disabled ? (
|
|
320
280
|
// a fix for multiselect deselecting tags working together with fade out animation
|
|
321
|
-
jsxRuntime.jsx("div", { className: cvaTagIconContainer(), onMouseDown: onClose, children: jsxRuntime.jsx(Icon, { name: "XCircle", dataTestId: dataTestId + "Icon", type: "solid", size: size, style: { WebkitTransition: "-webkit-transform 0.150s" }, className: cvaTagIcon() }) }))] }));
|
|
281
|
+
jsxRuntime.jsx("div", { className: cvaTagIconContainer(), onMouseDown: onClose, children: jsxRuntime.jsx(Icon, { name: "XCircle", dataTestId: dataTestId + "Icon", type: "solid", size: size, style: { WebkitTransition: "-webkit-transform 0.150s" }, className: cvaTagIcon() }) })) : null] }));
|
|
322
282
|
});
|
|
283
|
+
Tag.displayName = "Tag";
|
|
323
284
|
|
|
324
285
|
/**
|
|
325
286
|
* A component used to display the package name and version in the Storybook docs.
|
|
@@ -328,6 +289,43 @@ const PackageNameStoryComponent = ({ packageJSON }) => {
|
|
|
328
289
|
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] })] }));
|
|
329
290
|
};
|
|
330
291
|
|
|
292
|
+
/******************************************************************************
|
|
293
|
+
Copyright (c) Microsoft Corporation.
|
|
294
|
+
|
|
295
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
296
|
+
purpose with or without fee is hereby granted.
|
|
297
|
+
|
|
298
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
299
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
300
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
301
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
302
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
303
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
304
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
305
|
+
***************************************************************************** */
|
|
306
|
+
|
|
307
|
+
function __rest(s, e) {
|
|
308
|
+
var t = {};
|
|
309
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
310
|
+
t[p] = s[p];
|
|
311
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
312
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
313
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
314
|
+
t[p[i]] = s[p[i]];
|
|
315
|
+
}
|
|
316
|
+
return t;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
320
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
321
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
322
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
323
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
324
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
325
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
|
|
331
329
|
const cvaText = cssClassVarianceUtilities.cvaMerge(["text-black", "m-0", "relative", "text-sm", "font-normal"], {
|
|
332
330
|
variants: {
|
|
333
331
|
align: {
|
|
@@ -404,7 +402,7 @@ const Text = (_a) => {
|
|
|
404
402
|
subtle,
|
|
405
403
|
disabled,
|
|
406
404
|
className,
|
|
407
|
-
}), "data-testid": dataTestId
|
|
405
|
+
}), "data-testid": dataTestId }, rest), children);
|
|
408
406
|
};
|
|
409
407
|
|
|
410
408
|
const cvaSpinner = cssClassVarianceUtilities.cvaMerge([
|
|
@@ -477,10 +475,9 @@ const cvaButton = cssClassVarianceUtilities.cvaMerge([
|
|
|
477
475
|
"outline-current",
|
|
478
476
|
"transition-all",
|
|
479
477
|
"ease-in-out",
|
|
480
|
-
"component-button-border",
|
|
481
478
|
"cursor-pointer",
|
|
482
479
|
"flex-none",
|
|
483
|
-
"
|
|
480
|
+
"component-button-border",
|
|
484
481
|
"component-button-padding",
|
|
485
482
|
"component-button-height",
|
|
486
483
|
"focus:ring",
|
|
@@ -490,7 +487,6 @@ const cvaButton = cssClassVarianceUtilities.cvaMerge([
|
|
|
490
487
|
"text-sm",
|
|
491
488
|
"font-medium",
|
|
492
489
|
"align-middle",
|
|
493
|
-
"h-min",
|
|
494
490
|
], {
|
|
495
491
|
variants: {
|
|
496
492
|
color: {
|
|
@@ -553,9 +549,24 @@ const cvaButton = cssClassVarianceUtilities.cvaMerge([
|
|
|
553
549
|
],
|
|
554
550
|
},
|
|
555
551
|
size: {
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
552
|
+
/**
|
|
553
|
+
* TLDR; Calculating min-height so button sizes are (more) consistently sized.
|
|
554
|
+
*
|
|
555
|
+
* OK. let me explain this one.
|
|
556
|
+
* min-h here is to match the height of a button that has text inside
|
|
557
|
+
* We could just use the same min-h-[var(--line-height-sm)]) for all sizes
|
|
558
|
+
* but then the button would be too small since button is using box-sizing: border-box
|
|
559
|
+
* and what we really want is to make sure it's _content_ is the same height as a
|
|
560
|
+
* button with text inside.
|
|
561
|
+
* We could then change the box-sizing to content-box but that would break other things
|
|
562
|
+
* and be inconsistent with almost all everything else.
|
|
563
|
+
*
|
|
564
|
+
* So we need to add padding to the min-height calculation. Two times the vertical
|
|
565
|
+
* padding aka py-1 * 2 aka --spacing-1 * 2 aka spacing-2 (for small).
|
|
566
|
+
*/
|
|
567
|
+
small: ["py-1", "px-2", "min-h-[calc(var(--line-height-sm)+var(--spacing-2))]"],
|
|
568
|
+
medium: ["py-1.5", "px-3", "min-h-[calc(var(--line-height-sm)+var(--spacing-3))]"],
|
|
569
|
+
large: ["py-2", "px-4", "min-h-[calc(var(--line-height-sm)+var(--spacing-4))]"],
|
|
559
570
|
},
|
|
560
571
|
rounded: {
|
|
561
572
|
true: ["rounded-full"],
|
|
@@ -579,6 +590,21 @@ const cvaButton = cssClassVarianceUtilities.cvaMerge([
|
|
|
579
590
|
},
|
|
580
591
|
},
|
|
581
592
|
compoundVariants: [
|
|
593
|
+
{
|
|
594
|
+
square: true,
|
|
595
|
+
size: "small",
|
|
596
|
+
className: ["p-1"], // square is easier with same padding on all sides
|
|
597
|
+
},
|
|
598
|
+
{
|
|
599
|
+
square: true,
|
|
600
|
+
size: "medium",
|
|
601
|
+
className: ["p-1.5"],
|
|
602
|
+
},
|
|
603
|
+
{
|
|
604
|
+
square: true,
|
|
605
|
+
size: "large",
|
|
606
|
+
className: ["p-2"],
|
|
607
|
+
},
|
|
582
608
|
{
|
|
583
609
|
color: "primary",
|
|
584
610
|
variant: "transparent",
|
|
@@ -638,19 +664,6 @@ const cvaButton = cssClassVarianceUtilities.cvaMerge([
|
|
|
638
664
|
variant: "filled",
|
|
639
665
|
},
|
|
640
666
|
});
|
|
641
|
-
const cvaButtonSpinner = cssClassVarianceUtilities.cvaMerge(["!w-[1em]", "!h-[1em]"]);
|
|
642
|
-
const cvaIconButtonContainer = cssClassVarianceUtilities.cvaMerge(["w-5", "h-5", "flex", "justify-center", "items-center", "box-border"], {
|
|
643
|
-
variants: {
|
|
644
|
-
size: {
|
|
645
|
-
small: ["flex", "justify-center", "items-center", "box-border"],
|
|
646
|
-
medium: "",
|
|
647
|
-
large: "",
|
|
648
|
-
},
|
|
649
|
-
},
|
|
650
|
-
defaultVariants: {
|
|
651
|
-
size: "medium",
|
|
652
|
-
},
|
|
653
|
-
});
|
|
654
667
|
|
|
655
668
|
/**
|
|
656
669
|
* Buttons allow users to perform an action when triggered.
|
|
@@ -665,16 +678,18 @@ const Button = React__namespace.forwardRef((_a, ref) => {
|
|
|
665
678
|
type,
|
|
666
679
|
role,
|
|
667
680
|
onClick,
|
|
668
|
-
tabIndex, disabled: disabled || loading, className: cvaButton({ rounded: circular, disabled, size, square, color, variant, fullWidth, className }), "aria-label": title, "data-testid": dataTestId,
|
|
681
|
+
tabIndex, disabled: disabled || loading, className: cvaButton({ rounded: circular, disabled, size, square, color, variant, fullWidth, className }), "aria-label": title, "data-testid": dataTestId }, rest), jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [loading ? jsxRuntime.jsx(Spinner, { size: "small", centering: "vertically" }) : null, prefix, children, suffix] }));
|
|
669
682
|
});
|
|
683
|
+
Button.displayName = "Button";
|
|
670
684
|
|
|
671
685
|
/**
|
|
672
686
|
* The IconButton is used for a button with an icon.
|
|
673
687
|
*/
|
|
674
688
|
const IconButton = React__namespace.forwardRef((_a, ref) => {
|
|
675
689
|
var { icon, size = "small", square = true, loading, disabled } = _a, rest = __rest(_a, ["icon", "size", "square", "loading", "disabled"]);
|
|
676
|
-
return (jsxRuntime.jsx(Button, Object.assign({ size: size,
|
|
690
|
+
return (jsxRuntime.jsx(Button, Object.assign({ size: size, prefix: !loading ? icon : undefined, square: square, loading: loading, disabled: disabled || loading, ref: ref }, rest)));
|
|
677
691
|
});
|
|
692
|
+
IconButton.displayName = "IconButton";
|
|
678
693
|
|
|
679
694
|
/**
|
|
680
695
|
* The StarButton component is used for favorite actions or similar.
|
|
@@ -738,11 +753,13 @@ const Alert = ({ color = "info", title, className, children, primaryAction, seco
|
|
|
738
753
|
}
|
|
739
754
|
};
|
|
740
755
|
React__namespace.useEffect(() => {
|
|
756
|
+
var _a, _b;
|
|
741
757
|
if (autoScroll) {
|
|
742
|
-
|
|
758
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
759
|
+
(_b = (_a = ref.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
743
760
|
}
|
|
744
761
|
}, [ref, autoScroll]);
|
|
745
|
-
return (jsxRuntime.jsxs("div", { className: cvaAlert({ color, className }), "data-testid": dataTestId, ref: ref, role: "alert", children: [jsxRuntime.jsxs("div", { className: cvaAlertContentContainer(), children: [jsxRuntime.jsx("div", { className: cvaAlertIconContainer(), children: getIconFromColor() }), jsxRuntime.jsxs("div", { className: cvaContent(), children: [title ? jsxRuntime.jsx(Text, { 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, { size: "small", variant: "transparent", color: "secondary", onClick: onClose, icon: jsxRuntime.jsx(Icon, { name: "XMark", size: "small" }), title: "Close Alert", circular: true }) })) : null] }),
|
|
762
|
+
return (jsxRuntime.jsxs("div", { className: cvaAlert({ color, className }), "data-testid": dataTestId, ref: ref, role: "alert", children: [jsxRuntime.jsxs("div", { className: cvaAlertContentContainer(), children: [jsxRuntime.jsx("div", { className: cvaAlertIconContainer(), children: getIconFromColor() }), jsxRuntime.jsxs("div", { className: cvaContent(), children: [title ? jsxRuntime.jsx(Text, { 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, { size: "small", variant: "transparent", color: "secondary", onClick: onClose, icon: jsxRuntime.jsx(Icon, { name: "XMark", size: "small" }), title: "Close Alert", circular: true }) })) : null] }), primaryAction || secondaryAction ? (jsxRuntime.jsxs("div", { className: cvaAlertActionsContainer(), children: [secondaryAction ? (jsxRuntime.jsx(Button, { size: "small", variant: "transparent", color: getButtonColor(), onClick: secondaryAction.onClick, loading: secondaryAction.loading, children: secondaryAction.label })) : null, primaryAction ? (jsxRuntime.jsx(Button, { size: "small", color: getButtonColor(), onClick: primaryAction.onClick, loading: primaryAction.loading, children: primaryAction.label })) : null] })) : null] }));
|
|
746
763
|
};
|
|
747
764
|
|
|
748
765
|
const cvaBadge = cssClassVarianceUtilities.cvaMerge([
|
|
@@ -818,7 +835,7 @@ const cvaCard = cssClassVarianceUtilities.cvaMerge([
|
|
|
818
835
|
fullHeight: false,
|
|
819
836
|
},
|
|
820
837
|
});
|
|
821
|
-
const cvaCardFooterDensityContainer = cssClassVarianceUtilities.cvaMerge(["flex border-t-2", "border-neutral-200", "justify-end", "flex-row"], {
|
|
838
|
+
const cvaCardFooterDensityContainer = cssClassVarianceUtilities.cvaMerge(["flex", "border-t-2", "border-neutral-200", "justify-end", "flex-row"], {
|
|
822
839
|
variants: {
|
|
823
840
|
border: {
|
|
824
841
|
default: "",
|
|
@@ -839,7 +856,7 @@ const cvaCardFooterDensityContainer = cssClassVarianceUtilities.cvaMerge(["flex
|
|
|
839
856
|
});
|
|
840
857
|
const cvaCardHeader = cssClassVarianceUtilities.cvaMerge(["flex", "justify-between", "flex-1"]);
|
|
841
858
|
const cvaCardHeaderHeadingContainer = cssClassVarianceUtilities.cvaMerge(["flex", "gap-4", "items-center"]);
|
|
842
|
-
const cvaCardHeaderDensityContainer = cssClassVarianceUtilities.cvaMerge(["flex border-b-2", "border-neutral-200"], {
|
|
859
|
+
const cvaCardHeaderDensityContainer = cssClassVarianceUtilities.cvaMerge(["flex", "border-b-2", "border-neutral-200"], {
|
|
843
860
|
variants: {
|
|
844
861
|
border: {
|
|
845
862
|
default: "",
|
|
@@ -985,7 +1002,7 @@ const CardHeader = ({ heading, headingVariant = "primary", subHeading, onClose,
|
|
|
985
1002
|
density,
|
|
986
1003
|
border: hideSeparator ? "borderless" : "default",
|
|
987
1004
|
className,
|
|
988
|
-
}), children: jsxRuntime.jsxs("div", { className: cvaCardHeader(), children: [jsxRuntime.jsxs("div", { className: extraClassName, children: [jsxRuntime.jsxs("div", { className: cvaCardHeaderHeadingContainer(), children: [jsxRuntime.jsx(Heading, { className: "self-center", variant: headingVariant, children: heading }), accessories] }), subHeading
|
|
1005
|
+
}), children: jsxRuntime.jsxs("div", { className: cvaCardHeader(), children: [jsxRuntime.jsxs("div", { className: extraClassName, children: [jsxRuntime.jsxs("div", { className: cvaCardHeaderHeadingContainer(), children: [jsxRuntime.jsx(Heading, { className: "self-center", variant: headingVariant, children: heading }), accessories] }), subHeading ? (jsxRuntime.jsx(Heading, { subtle: true, variant: "subtitle", children: subHeading })) : null, children] }), onClose ? (jsxRuntime.jsx(IconButton, { dataTestId: "card-header-close-button", variant: "transparent", color: "secondary", onClick: onClose, icon: jsxRuntime.jsx(Icon, { name: "XMark", size: "small" }), className: "!h-min" })) : null] }) }));
|
|
989
1006
|
};
|
|
990
1007
|
|
|
991
1008
|
const cvaCollapse = cssClassVarianceUtilities.cvaMerge([
|
|
@@ -1225,11 +1242,11 @@ const cvaPopoverTitleContainer = cssClassVarianceUtilities.cvaMerge(["flex", "it
|
|
|
1225
1242
|
const cvaPopoverTitleText = cssClassVarianceUtilities.cvaMerge(["flex-1", "text-neutral-500"]);
|
|
1226
1243
|
|
|
1227
1244
|
const PopoverContent = React__default["default"].forwardRef(function PopoverContent(_a, propRef) {
|
|
1228
|
-
var _b
|
|
1245
|
+
var _b;
|
|
1229
1246
|
var { className, dataTestId, children, portalId } = _a, props = __rest(_a, ["className", "dataTestId", "children", "portalId"]);
|
|
1230
|
-
const
|
|
1247
|
+
const _c = usePopoverContext(), { context: floatingContext, customProps } = _c, context = __rest(_c, ["context", "customProps"]);
|
|
1231
1248
|
const ref = react.useMergeRefs([context.refs.setFloating, propRef]);
|
|
1232
|
-
return (jsxRuntime.jsx(react.FloatingPortal, { id: portalId !== null && portalId !== void 0 ? portalId : "tu-floating-ui", children: context.isOpen
|
|
1249
|
+
return (jsxRuntime.jsx(react.FloatingPortal, { id: portalId !== null && portalId !== void 0 ? portalId : "tu-floating-ui", children: context.isOpen ? (jsxRuntime.jsx(react.FloatingFocusManager, { guards: false, context: floatingContext, modal: context.isModal, closeOnFocusOut: false, order: ["reference", "content"], returnFocus: false, children: jsxRuntime.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 }));
|
|
1233
1250
|
});
|
|
1234
1251
|
|
|
1235
1252
|
/**
|
|
@@ -1245,7 +1262,7 @@ const PopoverTitle = ({ children, action, divider = false, className, dataTestId
|
|
|
1245
1262
|
const PopoverTrigger = React.forwardRef(function PopoverTrigger(_a, propRef) {
|
|
1246
1263
|
var { children, renderButton } = _a, props = __rest(_a, ["children", "renderButton"]);
|
|
1247
1264
|
const context = usePopoverContext();
|
|
1248
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1265
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, local-rules/no-typescript-assertion
|
|
1249
1266
|
const childrenRef = children.ref;
|
|
1250
1267
|
const ref = react.useMergeRefs([context.refs.setReference, propRef, childrenRef]);
|
|
1251
1268
|
if (!renderButton && React.isValidElement(children)) {
|
|
@@ -1284,7 +1301,7 @@ const DayRangePicker = ({ onRangeSelect, selectedDays, disabledDays, dataTestId,
|
|
|
1284
1301
|
onRangeSelect({ from, to });
|
|
1285
1302
|
}
|
|
1286
1303
|
}, [onRangeSelect]);
|
|
1287
|
-
return (jsxRuntime.jsx(reactDayPicker.DayPicker, { mode: "range", onSelect: onSelect, selected: selectedDays, defaultMonth: selectedDays
|
|
1304
|
+
return (jsxRuntime.jsx(reactDayPicker.DayPicker, { 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: jsxRuntime.jsx("div", { "data-testid": dataTestId }) }));
|
|
1288
1305
|
};
|
|
1289
1306
|
|
|
1290
1307
|
const cvaDrawerOverlay = cssClassVarianceUtilities.cvaMerge([
|
|
@@ -1352,7 +1369,6 @@ const cvaSkeletonLine = cssClassVarianceUtilities.cvaMerge([
|
|
|
1352
1369
|
|
|
1353
1370
|
/**
|
|
1354
1371
|
* Display placeholder lines before the data gets loaded to reduce load-time frustration.
|
|
1355
|
-
|
|
1356
1372
|
*/
|
|
1357
1373
|
const SkeletonLines = React.memo(({ margin = "10px 0", lines = 1, height, width = "100%", className, dataTestId }) => {
|
|
1358
1374
|
const skeletonLines = [];
|
|
@@ -1374,6 +1390,7 @@ const SkeletonLines = React.memo(({ margin = "10px 0", lines = 1, height, width
|
|
|
1374
1390
|
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
1375
1391
|
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: skeletonLines });
|
|
1376
1392
|
});
|
|
1393
|
+
SkeletonLines.displayName = "SkeletonLines";
|
|
1377
1394
|
|
|
1378
1395
|
const cvaContainerStyles = cssClassVarianceUtilities.cvaMerge([
|
|
1379
1396
|
"flex",
|
|
@@ -1454,36 +1471,96 @@ const ExternalLink = ({ rel = "noreferrer", target = "_blank", href, className,
|
|
|
1454
1471
|
return (jsxRuntime.jsx("a", { onClick: onClick, "data-testid": dataTestId, className: cvaExternalLink({ className }), title: title, href: href, rel: rel, target: target, children: children }));
|
|
1455
1472
|
};
|
|
1456
1473
|
|
|
1457
|
-
const cvaTooltipFlexContainer = cssClassVarianceUtilities.cvaMerge("inline-flex");
|
|
1458
|
-
const
|
|
1459
|
-
|
|
1460
|
-
|
|
1474
|
+
const cvaTooltipFlexContainer = cssClassVarianceUtilities.cvaMerge(["inline-flex", "hover:cursor-pointer"]);
|
|
1475
|
+
const cvaTooltipIcon = cssClassVarianceUtilities.cvaMerge(["flex", "h-max", "w-fit", "text-slate-300", "transition", "hover:cursor-pointer", "hover:text-slate-400"], {
|
|
1476
|
+
variants: {
|
|
1477
|
+
color: {
|
|
1478
|
+
light: "hover:text-white",
|
|
1479
|
+
dark: "hover:text-slate-400",
|
|
1480
|
+
},
|
|
1481
|
+
defaultVariants: {
|
|
1482
|
+
color: "dark",
|
|
1483
|
+
},
|
|
1484
|
+
},
|
|
1485
|
+
});
|
|
1486
|
+
const cvaTooltipPopover = cssClassVarianceUtilities.cvaMerge(["pointer-events-none", "origin-center"]);
|
|
1487
|
+
const cvaTooltipPopoverTail = cssClassVarianceUtilities.cvaMerge("", {
|
|
1488
|
+
variants: {
|
|
1489
|
+
placement: {
|
|
1490
|
+
top: "top-full left-2/4 ml-[-5px]",
|
|
1491
|
+
"top-start": "top-full left-[5%]",
|
|
1492
|
+
"top-end": "top-full right-[5%]",
|
|
1493
|
+
bottom: "bottom-full right-2/4 mr-[-6px] ",
|
|
1494
|
+
"bottom-start": "bottom-full left-[5%]",
|
|
1495
|
+
"bottom-end": "bottom-full right-[5%]",
|
|
1496
|
+
left: "top-2/4 left-full mt-[-6px]",
|
|
1497
|
+
"left-start": "top-1/4 top-[8%]",
|
|
1498
|
+
"left-end": "bottom-1/4 bottom-[8%]",
|
|
1499
|
+
right: "top-2/4 right-full mt-[-6px] ",
|
|
1500
|
+
"right-start": "top-1/4 top-[8%]",
|
|
1501
|
+
"right-end": "bottom-1/4 bottom-[8%]",
|
|
1502
|
+
},
|
|
1503
|
+
mode: {
|
|
1504
|
+
light: "fill-white",
|
|
1505
|
+
dark: "fill-slate-600",
|
|
1506
|
+
},
|
|
1507
|
+
},
|
|
1508
|
+
defaultVariants: {
|
|
1509
|
+
placement: "bottom",
|
|
1510
|
+
mode: "dark",
|
|
1511
|
+
},
|
|
1512
|
+
});
|
|
1513
|
+
cssClassVarianceUtilities.cvaMerge(["component-popover-border", "z-popover", "animate-fade-in-fast"]);
|
|
1514
|
+
const cvaTooltipPopoverContent = cssClassVarianceUtilities.cvaMerge(["max-w-sm", "rounded", "p-2"], {
|
|
1461
1515
|
variants: {
|
|
1462
1516
|
color: {
|
|
1463
|
-
light: "bg-white shadow-
|
|
1464
|
-
dark: "bg-
|
|
1517
|
+
light: "bg-white shadow-lg",
|
|
1518
|
+
dark: "bg-slate-600 text-white",
|
|
1465
1519
|
},
|
|
1466
1520
|
},
|
|
1467
1521
|
defaultVariants: {
|
|
1468
|
-
color: "
|
|
1522
|
+
color: "dark",
|
|
1469
1523
|
},
|
|
1470
1524
|
});
|
|
1471
1525
|
|
|
1472
1526
|
/**
|
|
1473
|
-
*
|
|
1527
|
+
*
|
|
1528
|
+
* @description Adding Tooltip Arrow
|
|
1529
|
+
* @returns {JSX.Element} Tooltip floating Arrow
|
|
1530
|
+
*/
|
|
1531
|
+
const FloatingArrowContainer = ({ arrowRef, mode = "dark", }) => {
|
|
1532
|
+
const { context: floatingContext } = usePopoverContext();
|
|
1533
|
+
return (jsxRuntime.jsx(react.FloatingArrow, { ref: arrowRef, context: floatingContext, className: cvaTooltipPopoverTail({ mode, placement: floatingContext.placement }) }));
|
|
1534
|
+
};
|
|
1535
|
+
/**
|
|
1536
|
+
* Tooltips display additional information upon hover. The information included should be contextual, helpful, and nonessential while providing that extra ability to communicate and give clarity to a user.
|
|
1537
|
+
*
|
|
1538
|
+
* Tooltips should be used sparingly and contain succinct, supplementary information, and they should contain read-only text. **❗️Do not include interactive elements in tooltips ** (no links, buttons, etc). Interactive elements in tooltips are inaccessible since tooltips do not receive focus.
|
|
1539
|
+
*
|
|
1540
|
+
* **Do use** tooltips to expose names of icon buttons that lack visual labels, when more information is useful in helping a user understand the context, when an element needs additional explanation, or use when defining a term or inline item.
|
|
1541
|
+
*
|
|
1542
|
+
* **Do not use** tooltips to include information that is necessary for the user to complete their task. Use helper text that is always visible and accessible for vital information.
|
|
1474
1543
|
|
|
1475
1544
|
* @param {TooltipProps} props - The props for the Tooltip component
|
|
1476
1545
|
* @returns {JSX.Element} Tooltip component
|
|
1477
1546
|
*/
|
|
1478
|
-
const Tooltip = (
|
|
1479
|
-
|
|
1480
|
-
const
|
|
1547
|
+
const Tooltip = ({ children, dataTestId = "tool-tip", disabled, className, label, placement = "auto", mode = "dark", contentTextType = "p", iconProps, }) => {
|
|
1548
|
+
const [isOpen, setIsOpen] = React__namespace.useState(false);
|
|
1549
|
+
const arrowRef = React__namespace.useRef(null);
|
|
1550
|
+
const { refs, floatingStyles, context } = react.useFloating({
|
|
1551
|
+
placement: placement === "auto" ? "bottom" : placement,
|
|
1552
|
+
open: isOpen,
|
|
1553
|
+
onOpenChange: setIsOpen,
|
|
1554
|
+
middleware: [react.offset(8), react.arrow({ element: arrowRef })],
|
|
1555
|
+
whileElementsMounted: react.autoUpdate,
|
|
1556
|
+
});
|
|
1557
|
+
const { isMounted } = react.useTransitionStatus(context);
|
|
1558
|
+
const wrappedChildren = (jsxRuntime.jsx("div", { className: cvaTooltipFlexContainer({ className }), "data-testid": dataTestId ? `${dataTestId}-parent` : null, children: children }));
|
|
1481
1559
|
if (disabled) {
|
|
1482
1560
|
return wrappedChildren;
|
|
1483
1561
|
}
|
|
1484
|
-
return (jsxRuntime.jsx(
|
|
1562
|
+
return (jsxRuntime.jsxs(Popover, { className: cvaTooltipPopover(), placement: placement === "auto" ? "bottom" : placement, activation: { hover: true }, dataTestId: dataTestId, children: [jsxRuntime.jsx(PopoverTrigger, { className: cvaTooltipIcon({ color: mode }), ref: refs.setReference, onMouseEnter: () => setIsOpen(true), onMouseLeave: () => setIsOpen(false), "data-testid": dataTestId ? `${dataTestId}-trigger` : null, children: children === undefined ? (jsxRuntime.jsx("div", { children: jsxRuntime.jsx(Icon, Object.assign({ name: "QuestionMarkCircle", size: "small", dataTestId: dataTestId ? `${dataTestId}-icon` : undefined }, iconProps)) })) : (wrappedChildren) }), isMounted ? (jsxRuntime.jsx("div", { ref: refs.setFloating, style: floatingStyles, children: jsxRuntime.jsx(PopoverContent, { children: jsxRuntime.jsxs("div", { "aria-label": typeof label === "string" ? label : undefined, className: cvaTooltipPopoverContent({ color: mode }), "data-testid": `${dataTestId}-content`, children: [jsxRuntime.jsx(Text, { inverted: mode === "dark", type: contentTextType, children: label }), placement !== "auto" && jsxRuntime.jsx(FloatingArrowContainer, { arrowRef: arrowRef, mode: mode })] }) }) })) : null] }));
|
|
1485
1563
|
};
|
|
1486
|
-
const TooltipContainer = ({ label, placement = "bottom", mode = "dark", contentTextType = "p", children, dataTestId, }) => (jsxRuntime.jsxs(Popover, { className: cvaTooltipPopover(), placement: placement, activation: { hover: true }, dataTestId: dataTestId !== null && dataTestId !== void 0 ? dataTestId : "", children: [jsxRuntime.jsx(PopoverTrigger, { children: children }), jsxRuntime.jsx(PopoverContent, { children: jsxRuntime.jsx("div", { "aria-label": typeof label === "string" ? label : undefined, className: cvaTooltipContent({ color: mode }), children: jsxRuntime.jsx(Text, { inverted: mode === "dark", type: contentTextType, children: label }) }) })] }));
|
|
1487
1564
|
|
|
1488
1565
|
const cvaIndicator = cssClassVarianceUtilities.cvaMerge(["flex", "items-center"]);
|
|
1489
1566
|
const cvaIndicatorIcon = cssClassVarianceUtilities.cvaMerge(["mr-2"]);
|
|
@@ -1585,7 +1662,7 @@ const cvaIndicatorIconBackground = cssClassVarianceUtilities.cvaMerge(["rounded-
|
|
|
1585
1662
|
*/
|
|
1586
1663
|
const Indicator = (_a) => {
|
|
1587
1664
|
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"]);
|
|
1588
|
-
return (jsxRuntime.jsx(Tooltip, { className: className, disabled: withLabel, label: label, children: jsxRuntime.jsxs("div", Object.assign({ className: cvaIndicator(), "data-testid": dataTestId, "aria-label": label }, rest, { children: [jsxRuntime.jsxs("div", { className: cvaIndicatorIconBackground({ color, background: withBackground ? "visible" : "hidden" }), "data-testid": dataTestId ? `${dataTestId}-background` : "indicator-background", children: [ping
|
|
1665
|
+
return (jsxRuntime.jsx(Tooltip, { className: className, disabled: withLabel, label: label, placement: "bottom", children: jsxRuntime.jsxs("div", Object.assign({ className: cvaIndicator(), "data-testid": dataTestId, "aria-label": label }, rest, { children: [jsxRuntime.jsxs("div", { className: cvaIndicatorIconBackground({ color, background: withBackground ? "visible" : "hidden" }), "data-testid": dataTestId ? `${dataTestId}-background` : "indicator-background", children: [ping ? jsxRuntime.jsx("div", { className: cvaIndicatorPing({ color }), "data-testid": dataTestId ? `${dataTestId}-ping` : "indicator-ping" }) : null, icon] }), label !== undefined && withLabel ? jsxRuntime.jsx("div", { className: cvaIndicatorLabel(), "data-testid": dataTestId ? `${dataTestId}-label` : "indicator-label", children: label }) : null] })) }));
|
|
1589
1666
|
};
|
|
1590
1667
|
|
|
1591
1668
|
const cvaMenuItem = cssClassVarianceUtilities.cvaMerge([
|
|
@@ -1672,7 +1749,7 @@ const MenuItem = ({ className, dataTestId, label, size, children, selected, focu
|
|
|
1672
1749
|
}), onClick: e => {
|
|
1673
1750
|
stopPropagation && e.stopPropagation();
|
|
1674
1751
|
onClick && onClick(e);
|
|
1675
|
-
}, tabIndex: 0, children: [prefix
|
|
1752
|
+
}, tabIndex: 0, children: [prefix ? jsxRuntime.jsx("div", { className: cvaMenuItemPrefix({ selected }), "data-testid": dataTestId ? `${dataTestId}-prefix` : null, children: prefix }) : null, children && typeof children !== "string" ? (children) : (jsxRuntime.jsx("div", { className: cvaMenuItemLabel(), "data-testid": dataTestId ? `${dataTestId}-label` : null, children: children !== null && children !== void 0 ? children : label })), suffix ? jsxRuntime.jsx("div", { className: cvaMenuItemSuffix({ selected }), "data-testid": dataTestId ? `${dataTestId}-suffix` : null, children: suffix }) : null] })));
|
|
1676
1753
|
};
|
|
1677
1754
|
|
|
1678
1755
|
const cvaMenuList = cssClassVarianceUtilities.cvaMerge(["shadow-md", "rounded-lg", "z-20", "bg-white", "p-1", "border", "border-slate-300", "gap-1", "grid"], {
|
|
@@ -1700,7 +1777,7 @@ const MenuList = (_a) => {
|
|
|
1700
1777
|
var { dataTestId, className, children, withStickyHeader = false, showDivider = false } = _a, args = __rest(_a, ["dataTestId", "className", "children", "withStickyHeader", "showDivider"]);
|
|
1701
1778
|
const childrenArr = React.Children.toArray(children);
|
|
1702
1779
|
const isLastItem = (index) => index === childrenArr.length - 1;
|
|
1703
|
-
return (jsxRuntime.jsx("div", { "data-testid": dataTestId, className: cvaMenuList({ stickyHeader: withStickyHeader, className }), tabIndex: 0, role: "list", onClick: args.onClick, children: React.Children.map(childrenArr, (menuItem, index) => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [menuItem, showDivider && !isLastItem(index)
|
|
1780
|
+
return (jsxRuntime.jsx("div", { "data-testid": dataTestId, className: cvaMenuList({ stickyHeader: withStickyHeader, className }), tabIndex: 0, role: "list", onClick: args.onClick, children: React.Children.map(childrenArr, (menuItem, index) => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [menuItem, showDivider && !isLastItem(index) ? jsxRuntime.jsx("hr", { className: cvaMenuListDivider() }) : null] }))) }));
|
|
1704
1781
|
};
|
|
1705
1782
|
|
|
1706
1783
|
const cvaMoreMenu = cssClassVarianceUtilities.cvaMerge(["p-4"]);
|
|
@@ -1764,12 +1841,9 @@ const cvaModalBackdrop = cssClassVarianceUtilities.cvaMerge([
|
|
|
1764
1841
|
const ModalBackdrop = ({ children, isVisible, onClick }) => {
|
|
1765
1842
|
const ref = React__namespace.useRef(null);
|
|
1766
1843
|
return (jsxRuntime.jsx("div", { ref: ref, className: cvaModalBackdrop({ show: isVisible }), onMouseDown: e => {
|
|
1767
|
-
var _a, _b;
|
|
1768
1844
|
// only react on click on backdrop - accessing first child to get around styled element element
|
|
1769
|
-
if (ref.current !== null) {
|
|
1770
|
-
|
|
1771
|
-
onClick();
|
|
1772
|
-
}
|
|
1845
|
+
if (ref.current !== null && e.target === ref.current.children[0]) {
|
|
1846
|
+
onClick();
|
|
1773
1847
|
}
|
|
1774
1848
|
}, children: children }));
|
|
1775
1849
|
};
|
|
@@ -1783,8 +1857,9 @@ const ModalBackdrop = ({ children, isVisible, onClick }) => {
|
|
|
1783
1857
|
const Modal = React__namespace.forwardRef(({ isOpen, children, dataTestId, className, role = "", onDismissClick = () => {
|
|
1784
1858
|
return;
|
|
1785
1859
|
}, }, ref) => {
|
|
1786
|
-
return (jsxRuntime.jsx(ModalBackdrop, { isVisible: isOpen, onClick: onDismissClick, children: isOpen
|
|
1860
|
+
return (jsxRuntime.jsx(ModalBackdrop, { isVisible: isOpen, onClick: onDismissClick, children: isOpen ? (jsxRuntime.jsx("div", { className: cvaModalContainer(), ref: ref, role: role, children: jsxRuntime.jsx(Card, { dataTestId: dataTestId, className: cvaModalCard({ className }), children: children }) })) : null }));
|
|
1787
1861
|
});
|
|
1862
|
+
Modal.displayName = "Modal";
|
|
1788
1863
|
|
|
1789
1864
|
/**
|
|
1790
1865
|
* The useModal component should be used to inform the user of important information.
|
|
@@ -1797,10 +1872,12 @@ const useModal = ({ closeOnOutsideClick } = {}) => {
|
|
|
1797
1872
|
const { isOpen, togglePortal, openPortal, closePortal, Portal } = usePortal__default["default"]({
|
|
1798
1873
|
closeOnOutsideClick,
|
|
1799
1874
|
onPortalClick: ({ target }) => {
|
|
1875
|
+
var _a;
|
|
1800
1876
|
if (!closeOnOutsideClick) {
|
|
1801
1877
|
return;
|
|
1802
1878
|
}
|
|
1803
|
-
|
|
1879
|
+
// eslint-disable-next-line local-rules/no-typescript-assertion
|
|
1880
|
+
const clickingOutsideModal = !((_a = modalRef.current) === null || _a === void 0 ? void 0 : _a.contains(target));
|
|
1804
1881
|
if (clickingOutsideModal) {
|
|
1805
1882
|
closePortal();
|
|
1806
1883
|
}
|
|
@@ -1818,31 +1895,7 @@ const useModal = ({ closeOnOutsideClick } = {}) => {
|
|
|
1818
1895
|
};
|
|
1819
1896
|
};
|
|
1820
1897
|
|
|
1821
|
-
const
|
|
1822
|
-
const cvaTipContent = cssClassVarianceUtilities.cvaMerge("flex max-w-sm items-center gap-2 rounded p-2 text-sm", {
|
|
1823
|
-
variants: {
|
|
1824
|
-
color: {
|
|
1825
|
-
light: "bg-white shadow-md",
|
|
1826
|
-
dark: "bg-neutral-800 text-white",
|
|
1827
|
-
},
|
|
1828
|
-
},
|
|
1829
|
-
defaultVariants: {
|
|
1830
|
-
color: "light",
|
|
1831
|
-
},
|
|
1832
|
-
});
|
|
1833
|
-
|
|
1834
|
-
/**
|
|
1835
|
-
* The Tip component is used to show helpful tips or contextual information to the users.
|
|
1836
|
-
* The tip can optionally be rendered as an anchor tag, which redirects to users to an external link on click.
|
|
1837
|
-
|
|
1838
|
-
* @param {TipProps} props - The props for the Tip component
|
|
1839
|
-
* @returns {JSX.Element} Tip component
|
|
1840
|
-
*/
|
|
1841
|
-
const Tip = ({ children, iconProps, dataTestId, className, placement = "bottom", mode = "dark", link, }) => {
|
|
1842
|
-
return (jsxRuntime.jsx("span", { "data-testid": dataTestId, className: cvaTip({ className }), children: jsxRuntime.jsxs(Popover, { placement: placement, activation: { click: true }, dataTestId: dataTestId !== null && dataTestId !== void 0 ? dataTestId : "", children: [jsxRuntime.jsx(PopoverTrigger, { children: jsxRuntime.jsx("div", { "data-testid": dataTestId && `${dataTestId}-trigger`, children: jsxRuntime.jsx(Icon, Object.assign({ name: "QuestionMarkCircle", size: "medium", dataTestId: dataTestId && `${dataTestId}-icon` }, iconProps)) }) }), jsxRuntime.jsx(PopoverContent, { children: jsxRuntime.jsxs("div", { className: cvaTipContent({ color: mode }), children: [jsxRuntime.jsx("div", { children: typeof children === "string" ? jsxRuntime.jsx("p", { children: children }) : children }), link ? (jsxRuntime.jsx("a", { href: link, children: jsxRuntime.jsx(Icon, { name: "ArrowRightCircle" }) })) : null] }) })] }) }));
|
|
1843
|
-
};
|
|
1844
|
-
|
|
1845
|
-
const cvaPageHeaderContainer = cssClassVarianceUtilities.cvaMerge(["bg-white"], {
|
|
1898
|
+
const cvaPageHeaderContainer = cssClassVarianceUtilities.cvaMerge(["bg-white", "tu-page-header"], {
|
|
1846
1899
|
variants: {
|
|
1847
1900
|
withBorder: {
|
|
1848
1901
|
true: ["border-b", "border-b-secondary-200"],
|
|
@@ -1851,10 +1904,9 @@ const cvaPageHeaderContainer = cssClassVarianceUtilities.cvaMerge(["bg-white"],
|
|
|
1851
1904
|
},
|
|
1852
1905
|
});
|
|
1853
1906
|
const cvaPageHeader = cssClassVarianceUtilities.cvaMerge([
|
|
1854
|
-
"min-h-[72px]",
|
|
1855
1907
|
"box-border",
|
|
1856
|
-
"
|
|
1857
|
-
"
|
|
1908
|
+
"py-responsive-space",
|
|
1909
|
+
"px-responsive-space-lg",
|
|
1858
1910
|
"flex",
|
|
1859
1911
|
"flex-wrap",
|
|
1860
1912
|
"items-center",
|
|
@@ -1863,7 +1915,7 @@ const cvaPageHeader = cssClassVarianceUtilities.cvaMerge([
|
|
|
1863
1915
|
"justify-between",
|
|
1864
1916
|
]);
|
|
1865
1917
|
const cvaPageHeaderHeading = cssClassVarianceUtilities.cvaMerge(["flex", "text-slate-900", "text-2xl", "font-bold", "min-w-0"]);
|
|
1866
|
-
const cvaPageHeaderHeadingContainer = cssClassVarianceUtilities.cvaMerge(["flex", "gap-x-4", "items-center"]);
|
|
1918
|
+
const cvaPageHeaderHeadingContainer = cssClassVarianceUtilities.cvaMerge(["flex", "gap-x-4", "flex-wrap", "items-center"]);
|
|
1867
1919
|
const cvaPageHeaderHeadingAccessoriesContainer = cssClassVarianceUtilities.cvaMerge([
|
|
1868
1920
|
"flex",
|
|
1869
1921
|
"flex-wrap",
|
|
@@ -1872,6 +1924,16 @@ const cvaPageHeaderHeadingAccessoriesContainer = cssClassVarianceUtilities.cvaMe
|
|
|
1872
1924
|
"gap-y-2",
|
|
1873
1925
|
]);
|
|
1874
1926
|
const cvaPageHeaderChildContainer = cssClassVarianceUtilities.cvaMerge(["flex", "flex-wrap", "gap-x-6", "items-center"]);
|
|
1927
|
+
const cvaPageHeaderDescriptionAndLinkContainer = cssClassVarianceUtilities.cvaMerge(["flex", "h-fit", "items-center", "gap-1"]);
|
|
1928
|
+
const cvaPageHeaderLink = cssClassVarianceUtilities.cvaMerge([
|
|
1929
|
+
"text-primary-600",
|
|
1930
|
+
"hover:text-primary-700",
|
|
1931
|
+
"flex",
|
|
1932
|
+
"items-center",
|
|
1933
|
+
"gap-1",
|
|
1934
|
+
"text-xs",
|
|
1935
|
+
"underline",
|
|
1936
|
+
]);
|
|
1875
1937
|
|
|
1876
1938
|
/**
|
|
1877
1939
|
* Pageheader component is used to display a page header.
|
|
@@ -1881,11 +1943,11 @@ const cvaPageHeaderChildContainer = cssClassVarianceUtilities.cvaMerge(["flex",
|
|
|
1881
1943
|
* @param {PageHeaderProps} props - The props for the PageHeader component
|
|
1882
1944
|
* @returns {JSX.Element} PageHeader component
|
|
1883
1945
|
*/
|
|
1884
|
-
const PageHeader = ({ className, dataTestId, action, showLoading, description, link, title, tag, backTo, tagColor, children, tabsList, }) => {
|
|
1946
|
+
const PageHeader = ({ className, dataTestId, action, showLoading, description, link, title, tag, backTo, tagColor, children, tabsList, linkText = "Help Center Article", }) => {
|
|
1885
1947
|
return (jsxRuntime.jsxs("div", { className: cvaPageHeaderContainer({
|
|
1886
|
-
className
|
|
1887
|
-
withBorder: !
|
|
1888
|
-
}), "data-testid": dataTestId, children: [jsxRuntime.jsxs("div", { className: cvaPageHeader(), children: [jsxRuntime.jsxs("div", { className: cvaPageHeaderHeadingAccessoriesContainer(), "data-testid": dataTestId
|
|
1948
|
+
className,
|
|
1949
|
+
withBorder: !tabsList,
|
|
1950
|
+
}), "data-testid": dataTestId, children: [jsxRuntime.jsxs("div", { className: cvaPageHeader(), children: [jsxRuntime.jsxs("div", { className: cvaPageHeaderHeadingAccessoriesContainer(), "data-testid": dataTestId ? `${dataTestId}-heading-container` : undefined, children: [jsxRuntime.jsxs("div", { className: cvaPageHeaderHeadingContainer(), children: [backTo ? (jsxRuntime.jsx(IconButton, { to: backTo, renderAs: reactRouterDom.Link, color: "tertiary", variant: "transparent", size: "small", icon: jsxRuntime.jsx(Icon, { name: "ArrowLeft" }) })) : undefined, jsxRuntime.jsx("h1", { className: cvaPageHeaderHeading(), "data-testid": dataTestId ? `${dataTestId}-heading` : undefined, children: title }), description && !showLoading ? (jsxRuntime.jsxs("div", { className: cvaPageHeaderDescriptionAndLinkContainer(), children: [jsxRuntime.jsx(Tooltip, { label: description, dataTestId: dataTestId ? `${dataTestId}-tooltip` : undefined, iconProps: { name: "QuestionMarkCircle" }, placement: "bottom" }), link ? (jsxRuntime.jsxs(reactRouterDom.Link, { to: link, "data-testid": "tooltip-link", target: "_blank", className: cvaPageHeaderLink(), children: [linkText, jsxRuntime.jsx(Icon, { name: "ArrowTopRightOnSquare", size: "small" })] })) : undefined] })) : undefined] }), tag && !showLoading ? (jsxRuntime.jsx(Tag, { dataTestId: dataTestId ? `${dataTestId}-tag` : undefined, color: tagColor, children: tag })) : undefined, showLoading ? (jsxRuntime.jsx(Spinner, { dataTestId: dataTestId ? `${dataTestId}-spinner` : undefined, centering: "vertically" })) : null, action] }), children ? jsxRuntime.jsx("div", { className: cvaPageHeaderChildContainer(), children: children }) : null] }), tabsList] }));
|
|
1889
1951
|
};
|
|
1890
1952
|
|
|
1891
1953
|
const cvaPagination = cssClassVarianceUtilities.cvaMerge(["flex", "items-center", "gap-1"]);
|
|
@@ -1934,7 +1996,7 @@ const Pagination = ({ previousPage, nextPage, canPreviousPage, canNextPage, page
|
|
|
1934
1996
|
if (loading) {
|
|
1935
1997
|
return (jsxRuntime.jsx("div", { className: cvaPagination({ className }), children: jsxRuntime.jsx(SkeletonLines, { height: 16, width: 150 }) }));
|
|
1936
1998
|
}
|
|
1937
|
-
return (jsxRuntime.jsxs("div", { "data-testid": dataTestId, className: cvaPagination({ className }), children: [jsxRuntime.jsx(IconButton, { onClick: () => handlePageChange("prev"), disabled: cursorBase ? !canPreviousPage || false : page !== undefined && page <= 0, "data-testid": "prev-page", icon: jsxRuntime.jsx(Icon, { name: "ChevronLeft", size: "small" }), size: "small", color: "secondary", variant: "transparent" }), !cursorBase && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: cvaPaginationText(), "data-testid": "current-page", children: currentPage }), jsxRuntime.jsx("div", { className: cvaPaginationText(), "data-testid": "page-count", children: pageCount !== null && pageCount !== undefined && getTranslatedCount
|
|
1999
|
+
return (jsxRuntime.jsxs("div", { "data-testid": dataTestId, className: cvaPagination({ className }), children: [jsxRuntime.jsx(IconButton, { onClick: () => handlePageChange("prev"), disabled: cursorBase ? !canPreviousPage || false : page !== undefined && page <= 0, "data-testid": "prev-page", icon: jsxRuntime.jsx(Icon, { name: "ChevronLeft", size: "small" }), size: "small", color: "secondary", variant: "transparent" }), !cursorBase && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: cvaPaginationText(), "data-testid": "current-page", children: currentPage }), jsxRuntime.jsx("div", { className: cvaPaginationText(), "data-testid": "page-count", children: pageCount !== null && pageCount !== undefined && getTranslatedCount ? getTranslatedCount(pageCount) : null })] })), jsxRuntime.jsx(IconButton, { onClick: () => handlePageChange("next"), disabled: cursorBase
|
|
1938
2000
|
? !canNextPage || false
|
|
1939
2001
|
: page !== undefined && pageCount !== undefined && pageCount !== null && page >= pageCount - 1, "data-testid": "next-page", icon: jsxRuntime.jsx(Icon, { name: "ChevronRight", size: "small" }), size: "small", color: "secondary", variant: "transparent" })] }));
|
|
1940
2002
|
};
|
|
@@ -1980,8 +2042,7 @@ const usePrompt = (message, when = true) => {
|
|
|
1980
2042
|
};
|
|
1981
2043
|
}, [message, when]);
|
|
1982
2044
|
const confirmExit = React.useCallback(() => {
|
|
1983
|
-
|
|
1984
|
-
return confirm;
|
|
2045
|
+
return window.confirm(message);
|
|
1985
2046
|
}, [message]);
|
|
1986
2047
|
useConfirmExit(confirmExit, when);
|
|
1987
2048
|
};
|
|
@@ -2031,11 +2092,11 @@ const Spacer = ({ size = "medium", border = false, dataTestId, className }) => {
|
|
|
2031
2092
|
* @returns {JSX.Element} SectionHeader component
|
|
2032
2093
|
*/
|
|
2033
2094
|
const SectionHeader = ({ title, subtitle, dataTestId, addons }) => {
|
|
2034
|
-
return (jsxRuntime.jsxs("div", { className: "flex flex-col", children: [jsxRuntime.jsx(reactHelmetAsync.HelmetProvider, { children: jsxRuntime.jsx(reactHelmetAsync.Helmet, { title: title }) }), jsxRuntime.jsxs("div", { className: "mb-2 flex flex-row gap-2", children: [jsxRuntime.jsxs("div", { className: "flex grow flex-col gap-2", children: [jsxRuntime.jsx(Heading, { variant: "secondary", dataTestId: dataTestId, children: title }), subtitle
|
|
2095
|
+
return (jsxRuntime.jsxs("div", { className: "flex flex-col", children: [jsxRuntime.jsx(reactHelmetAsync.HelmetProvider, { children: jsxRuntime.jsx(reactHelmetAsync.Helmet, { title: title }) }), jsxRuntime.jsxs("div", { className: "mb-2 flex flex-row gap-2", children: [jsxRuntime.jsxs("div", { className: "flex grow flex-col gap-2", children: [jsxRuntime.jsx(Heading, { variant: "secondary", dataTestId: dataTestId, children: title }), subtitle ? jsxRuntime.jsx(Heading, { variant: "subtitle", subtle: true, children: subtitle }) : null] }), addons ? jsxRuntime.jsx("div", { className: "flex gap-2", children: addons }) : null] }), jsxRuntime.jsx(Spacer, { size: "small" })] }));
|
|
2035
2096
|
};
|
|
2036
2097
|
|
|
2037
|
-
const cvaSidebar = cssClassVarianceUtilities.cvaMerge(["apply grid", "grid-cols-fr-min", "items-center"]);
|
|
2038
|
-
const cvaSidebarChildContainer = cssClassVarianceUtilities.cvaMerge(["apply flex", "overflow-hidden", "gap-2", "p-1", "max-w-full"], {
|
|
2098
|
+
const cvaSidebar = cssClassVarianceUtilities.cvaMerge(["apply", "grid", "grid-cols-fr-min", "items-center"]);
|
|
2099
|
+
const cvaSidebarChildContainer = cssClassVarianceUtilities.cvaMerge(["apply", "flex", "overflow-hidden", "gap-2", "p-1", "max-w-full"], {
|
|
2039
2100
|
variants: {
|
|
2040
2101
|
breakpoint: {
|
|
2041
2102
|
xs: ["xs:overflow-visible", "xs:p-0", "xs:grid", "xs:grid-cols-1", "xs:w-full"],
|
|
@@ -2073,7 +2134,7 @@ const useOverflowItems = ({ threshold = 1, childUniqueIdentifierAttribute = "id"
|
|
|
2073
2134
|
}, [childUniqueIdentifierAttribute]);
|
|
2074
2135
|
const observe = React.useCallback(() => {
|
|
2075
2136
|
const node = overflowContainerRef.current;
|
|
2076
|
-
if (node
|
|
2137
|
+
if (node) {
|
|
2077
2138
|
const root = overflowContainerRef.current;
|
|
2078
2139
|
const options = { root, threshold };
|
|
2079
2140
|
const observer = new IntersectionObserver(handleIntersection, options);
|
|
@@ -2126,7 +2187,7 @@ const Sidebar = ({ childContainerClassName, children, breakpoint = "lg", classNa
|
|
|
2126
2187
|
}
|
|
2127
2188
|
return "visible";
|
|
2128
2189
|
};
|
|
2129
|
-
return (jsxRuntime.jsxs("div", { className: cvaSidebar({ className }), "data-testid": dataTestId, children: [jsxRuntime.jsx("div", { ref: overflowContainerRef, className: cvaSidebarChildContainer({ breakpoint, className: childContainerClassName }), "data-testid": dataTestId
|
|
2190
|
+
return (jsxRuntime.jsxs("div", { className: cvaSidebar({ className }), "data-testid": dataTestId, children: [jsxRuntime.jsx("div", { ref: overflowContainerRef, className: cvaSidebarChildContainer({ breakpoint, className: childContainerClassName }), "data-testid": dataTestId ? `${dataTestId}-child-container` : null, children: React__default["default"].Children.map(children, child => {
|
|
2130
2191
|
return React__default["default"].cloneElement(child, {
|
|
2131
2192
|
className: `${child.props.className} ${itemVisibilityClassName(child.props.id)}`,
|
|
2132
2193
|
});
|
|
@@ -2134,12 +2195,12 @@ const Sidebar = ({ childContainerClassName, children, breakpoint = "lg", classNa
|
|
|
2134
2195
|
circular: false,
|
|
2135
2196
|
variant: "transparent",
|
|
2136
2197
|
color: "secondary",
|
|
2137
|
-
}, popoverProps: { placement: "bottom-end" } }, moreMenuProps, { className: `${(moreMenuProps === null || moreMenuProps === void 0 ? void 0 : moreMenuProps.className) || ""} !p-0`, dataTestId: dataTestId
|
|
2198
|
+
}, 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 => (jsxRuntime.jsx(MenuList, Object.assign({}, menuListProps, { dataTestId: dataTestId ? `${dataTestId}-menu-list` : undefined, children: React__default["default"].Children.map(children, child => {
|
|
2138
2199
|
return itemOverflowMap[child.props.id]
|
|
2139
2200
|
? React__default["default"].cloneElement(child, {
|
|
2140
2201
|
onClick: () => {
|
|
2141
2202
|
var _a, _b;
|
|
2142
|
-
(_b = (_a = child
|
|
2203
|
+
(_b = (_a = child.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
2143
2204
|
close();
|
|
2144
2205
|
},
|
|
2145
2206
|
})
|
|
@@ -2201,7 +2262,7 @@ const cvaTab = cssClassVarianceUtilities.cvaMerge([
|
|
|
2201
2262
|
*/
|
|
2202
2263
|
const Tab = (_a) => {
|
|
2203
2264
|
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"]);
|
|
2204
|
-
const renderContent = () => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [iconName
|
|
2265
|
+
const renderContent = () => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [iconName ? jsxRuntime.jsx(Icon, { name: iconName, size: "small" }) : null, React__default["default"].isValidElement(children) ? children.props.children : children, suffix] }));
|
|
2205
2266
|
const commonProps = Object.assign({ className: appendTabStylesToChildIfAsChild ? cvaTab({ className, isFullWidth }) : className }, rest);
|
|
2206
2267
|
return (jsxRuntime.jsx(reactTabs.Trigger, { asChild: true, value: value, children: asChild && typeof children !== "string" ? (React__default["default"].cloneElement(children, Object.assign(Object.assign({}, commonProps), { children: renderContent() }))) : (jsxRuntime.jsx("button", Object.assign({}, commonProps, { "data-testid": dataTestId, children: renderContent() }))) }));
|
|
2207
2268
|
};
|
|
@@ -2211,7 +2272,7 @@ const Tab = (_a) => {
|
|
|
2211
2272
|
*/
|
|
2212
2273
|
const TabContent = (_a) => {
|
|
2213
2274
|
var { className, dataTestId, children } = _a, rest = __rest(_a, ["className", "dataTestId", "children"]);
|
|
2214
|
-
return (jsxRuntime.jsx(reactTabs.Content, Object.assign({ "data-testid": `${dataTestId}-content
|
|
2275
|
+
return (jsxRuntime.jsx(reactTabs.Content, Object.assign({ "data-testid": dataTestId ? `${dataTestId}-content` : undefined, className: cvaTabContent({ className }) }, rest, { children: children })));
|
|
2215
2276
|
};
|
|
2216
2277
|
|
|
2217
2278
|
/**
|
|
@@ -2263,7 +2324,7 @@ const Timeline = ({ className, dataTestId, children }) => {
|
|
|
2263
2324
|
* @returns {JSX.Element} component
|
|
2264
2325
|
*/
|
|
2265
2326
|
const TimelineElement = ({ date, showTime, children, className, dataTestId = "timeline-date", dot = jsxRuntime.jsx(Indicator, { className: "mt-[-1px]", color: "neutral", icon: jsxRuntime.jsx(Icon, { name: "Calendar", size: "large" }) }), header = defaultHeader(date, showTime), onClick, }) => {
|
|
2266
|
-
return (jsxRuntime.jsxs("li", { className: cvaTimelineElement({ className }), "data-date": `${date}`, "data-testid": dataTestId
|
|
2327
|
+
return (jsxRuntime.jsxs("li", { className: cvaTimelineElement({ className }), "data-date": `${date}`, "data-testid": dataTestId ? `${dataTestId}` : null, onClick: () => onClick && onClick(), children: [jsxRuntime.jsx("div", { className: cvaTimelineDot(), children: dot }), jsxRuntime.jsx("div", { children: header }), jsxRuntime.jsx("div", {}), jsxRuntime.jsx("div", { children: jsxRuntime.jsx("div", { children: children }) })] }));
|
|
2267
2328
|
};
|
|
2268
2329
|
function defaultHeader(date, showTime) {
|
|
2269
2330
|
return `${dateFns.format(date, showTime ? "MMM d, yyyy H:mm" : "MMM d, yyyy")} (${dateFns.formatDistance(date, new Date(), {
|
|
@@ -2378,7 +2439,7 @@ const ValueBar = ({ value, min = 0, max = 100, unit, size = "small", levelColors
|
|
|
2378
2439
|
const score = getScore(value, min, max);
|
|
2379
2440
|
const barFillColor = levelColors ? getFillColor(score, levelColors) : getDefaultFillColor(score);
|
|
2380
2441
|
const barWidth = showValue && size === "small" ? 90 : 100;
|
|
2381
|
-
return (jsxRuntime.jsx("svg", { className: cvaValueBar({ size, className }), "data-testid": dataTestId, children: jsxRuntime.jsxs("g", { children: [jsxRuntime.jsx("rect", { className: cvaValueBarProgress({ fill: "background" }), width: `${barWidth}%`, rx: "5" }), jsxRuntime.jsx("rect", { className: cvaValueBarProgress(), width: `${score * barWidth}%`, fill: barFillColor, rx: "5" }), showValue && size === "large"
|
|
2442
|
+
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" }), width: `${barWidth}%`, rx: "5", "data-testid": "value-bar-svg-rect-0" }), jsxRuntime.jsx("rect", { className: cvaValueBarProgress(), width: `${score * barWidth}%`, fill: barFillColor, rx: "5", "data-testid": "value-bar-svg-rect-1" }), showValue && size === "large" ? (jsxRuntime.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" ? (jsxRuntime.jsxs("text", { className: cvaValueBarText({ size }), x: `${barWidth + 2}%`, y: "11", fill: valueColor !== null && valueColor !== void 0 ? valueColor : uiDesignTokens.color("NEUTRAL", 400, "CSS"), children: [Number(value.toFixed(1)), unit || ""] })) : null] }) }));
|
|
2382
2443
|
};
|
|
2383
2444
|
|
|
2384
2445
|
const cvaWidgetBodyDensityContainer = cssClassVarianceUtilities.cvaMerge([
|
|
@@ -2600,6 +2661,7 @@ const useClickOutside = (el, options = {}, onClick) => {
|
|
|
2600
2661
|
active = options.active !== undefined ? options.active : active;
|
|
2601
2662
|
}
|
|
2602
2663
|
const handler = (ev) => {
|
|
2664
|
+
// eslint-disable-next-line local-rules/no-typescript-assertion
|
|
2603
2665
|
const target = ev.target;
|
|
2604
2666
|
if (els.every(ref => !ref.current || !ref.current.contains(target))) {
|
|
2605
2667
|
onClick && onClick(ev);
|
|
@@ -2751,20 +2813,9 @@ function useDevicePixelRatio(options) {
|
|
|
2751
2813
|
}
|
|
2752
2814
|
const updateDpr = () => setCurrentDpr(getDevicePixelRatio({ defaultDpr, maxDpr, round }));
|
|
2753
2815
|
const mediaMatcher = window.matchMedia(`screen and (resolution: ${currentDpr}dppx)`);
|
|
2754
|
-
|
|
2755
|
-
if (mediaMatcher.addEventListener) {
|
|
2756
|
-
mediaMatcher.addEventListener("change", updateDpr);
|
|
2757
|
-
}
|
|
2758
|
-
else {
|
|
2759
|
-
mediaMatcher.addListener(updateDpr);
|
|
2760
|
-
}
|
|
2816
|
+
mediaMatcher.addEventListener("change", updateDpr);
|
|
2761
2817
|
return () => {
|
|
2762
|
-
|
|
2763
|
-
mediaMatcher.removeEventListener("change", updateDpr);
|
|
2764
|
-
}
|
|
2765
|
-
else {
|
|
2766
|
-
mediaMatcher.removeListener(updateDpr);
|
|
2767
|
-
}
|
|
2818
|
+
mediaMatcher.removeEventListener("change", updateDpr);
|
|
2768
2819
|
};
|
|
2769
2820
|
}, [currentDpr, defaultDpr, maxDpr, round]);
|
|
2770
2821
|
return currentDpr;
|
|
@@ -2779,8 +2830,7 @@ function getDevicePixelRatio(options) {
|
|
|
2779
2830
|
const { defaultDpr = 1, maxDpr = 3, round = true } = options || {};
|
|
2780
2831
|
const hasDprProp = typeof window !== "undefined" && typeof window.devicePixelRatio === "number";
|
|
2781
2832
|
const dpr = hasDprProp ? window.devicePixelRatio : defaultDpr;
|
|
2782
|
-
|
|
2783
|
-
return rounded;
|
|
2833
|
+
return Math.min(Math.max(1, round ? Math.floor(dpr) : dpr), maxDpr);
|
|
2784
2834
|
}
|
|
2785
2835
|
|
|
2786
2836
|
/**
|
|
@@ -3023,14 +3073,11 @@ exports.Tag = Tag;
|
|
|
3023
3073
|
exports.Text = Text;
|
|
3024
3074
|
exports.Timeline = Timeline;
|
|
3025
3075
|
exports.TimelineElement = TimelineElement;
|
|
3026
|
-
exports.Tip = Tip;
|
|
3027
3076
|
exports.Tooltip = Tooltip;
|
|
3028
3077
|
exports.ValueBar = ValueBar;
|
|
3029
3078
|
exports.WidgetBody = WidgetBody;
|
|
3030
3079
|
exports.cvaButton = cvaButton;
|
|
3031
|
-
exports.cvaButtonSpinner = cvaButtonSpinner;
|
|
3032
3080
|
exports.cvaClickable = cvaClickable;
|
|
3033
|
-
exports.cvaIconButtonContainer = cvaIconButtonContainer;
|
|
3034
3081
|
exports.cvaIndicator = cvaIndicator;
|
|
3035
3082
|
exports.cvaIndicatorIcon = cvaIndicatorIcon;
|
|
3036
3083
|
exports.cvaIndicatorIconBackground = cvaIndicatorIconBackground;
|