@trackunit/react-components 0.1.238 → 0.1.241
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs.js +168 -161
- package/index.esm.js +169 -160
- package/package.json +1 -1
- package/src/components/Collapse/Collapse.d.ts +4 -3
- package/src/components/Collapse/Collapse.variants.d.ts +3 -6
- package/src/components/Icon/Icon.d.ts +8 -4
- package/src/components/PageHeader/PageHeader.variants.d.ts +2 -0
- package/src/components/SkeletonLines/SkeletonLines.d.ts +0 -2
- package/src/components/buttons/shared/Button.variants.d.ts +0 -4
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([
|
|
@@ -460,7 +458,7 @@ const cvaSpinnerContainer = cssClassVarianceUtilities.cvaMerge(["box-border", "p
|
|
|
460
458
|
* @param {SpinnerProps} props - The props for the Spinner component
|
|
461
459
|
* @returns {JSX.Element} Spinner component
|
|
462
460
|
*/
|
|
463
|
-
const Spinner = ({ mode = "light", size = "medium", centering = "centered", className, containerClassName, dataTestId, }) => {
|
|
461
|
+
const Spinner = ({ mode = "light", size = "medium", centering = "centered", className, containerClassName, dataTestId = "spinner", }) => {
|
|
464
462
|
return (jsxRuntime.jsx("div", { className: cvaSpinnerContainer({ centering, className: containerClassName }), children: jsxRuntime.jsx("div", { role: "spinbutton", className: cvaSpinner({ size, mode, className }), "data-testid": dataTestId }) }));
|
|
465
463
|
};
|
|
466
464
|
|
|
@@ -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,40 +1002,35 @@ 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([
|
|
992
1009
|
"block",
|
|
993
1010
|
"w-full",
|
|
994
|
-
"border
|
|
1011
|
+
"border",
|
|
995
1012
|
"border-solid",
|
|
996
|
-
"border-
|
|
997
|
-
"
|
|
998
|
-
"
|
|
999
|
-
"last:border-0",
|
|
1000
|
-
"last:m-0",
|
|
1001
|
-
"only:border-0",
|
|
1002
|
-
"only:m-0",
|
|
1013
|
+
"border-secondary-200",
|
|
1014
|
+
"rounded",
|
|
1015
|
+
"overflow-hidden",
|
|
1003
1016
|
]);
|
|
1004
|
-
const
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1017
|
+
const cvaCollapseHeader = cssClassVarianceUtilities.cvaMerge([
|
|
1018
|
+
"flex",
|
|
1019
|
+
"w-full",
|
|
1020
|
+
"items-center",
|
|
1021
|
+
"justify-between",
|
|
1022
|
+
"cursor-pointer",
|
|
1023
|
+
"bg-secondary-50",
|
|
1024
|
+
"px-4",
|
|
1025
|
+
"gap-4",
|
|
1026
|
+
"py-2",
|
|
1027
|
+
"transition-all",
|
|
1028
|
+
], {
|
|
1029
|
+
variants: { expanded: { true: ["border-secondary-200", "border-b", "border-solid"], false: "" } },
|
|
1008
1030
|
});
|
|
1009
|
-
cssClassVarianceUtilities.cvaMerge(["
|
|
1031
|
+
const cvaCollapseLabelContainer = cssClassVarianceUtilities.cvaMerge(["flex", "items-center", "gap-2"]);
|
|
1032
|
+
const cvaCollapsible = cssClassVarianceUtilities.cvaMerge(["block", "relative", "w-full", "p-4"]);
|
|
1010
1033
|
const cvaCollapseAnimated = cssClassVarianceUtilities.cvaMerge(["overflow-y-hidden", "transition-all"]);
|
|
1011
|
-
const cvaCollapseIcon = cssClassVarianceUtilities.cvaMerge(["ease-in-out", "duration-200"], {
|
|
1012
|
-
variants: {
|
|
1013
|
-
expanded: {
|
|
1014
|
-
false: "",
|
|
1015
|
-
true: "rotate-180",
|
|
1016
|
-
},
|
|
1017
|
-
},
|
|
1018
|
-
defaultVariants: {
|
|
1019
|
-
expanded: false,
|
|
1020
|
-
},
|
|
1021
|
-
});
|
|
1022
1034
|
|
|
1023
1035
|
/**
|
|
1024
1036
|
* The Collapse component is used to condense non-important information.
|
|
@@ -1026,7 +1038,7 @@ const cvaCollapseIcon = cssClassVarianceUtilities.cvaMerge(["ease-in-out", "dura
|
|
|
1026
1038
|
* @param {CollapseProps} props - The props for the Collapse component
|
|
1027
1039
|
* @returns {JSX.Element} Collapse component
|
|
1028
1040
|
*/
|
|
1029
|
-
const Collapse = ({ id, initialExpanded = false, onToggle, label, children,
|
|
1041
|
+
const Collapse = ({ id, initialExpanded = false, onToggle, label, children, className, headerAddon, dataTestId, }) => {
|
|
1030
1042
|
const [expanded, setExpanded] = React__namespace.useState(initialExpanded);
|
|
1031
1043
|
const handleClick = React__namespace.useCallback((e) => {
|
|
1032
1044
|
if (onToggle) {
|
|
@@ -1034,11 +1046,11 @@ const Collapse = ({ id, initialExpanded = false, onToggle, label, children, layo
|
|
|
1034
1046
|
}
|
|
1035
1047
|
setExpanded(!expanded);
|
|
1036
1048
|
}, [expanded, onToggle]);
|
|
1037
|
-
return (jsxRuntime.jsxs("div", { className: cvaCollapse({ className }), "data-testid": dataTestId, children: [jsxRuntime.
|
|
1049
|
+
return (jsxRuntime.jsxs("div", { className: cvaCollapse({ className }), "data-testid": dataTestId, children: [jsxRuntime.jsxs("div", { className: cvaCollapseHeader({ expanded }), role: "button", "aria-expanded": expanded, "aria-controls": id, onClick: handleClick, children: [jsxRuntime.jsxs("div", { className: cvaCollapseLabelContainer(), children: [jsxRuntime.jsx(Text, { type: "span", weight: "bold", children: label }), jsxRuntime.jsx(IconButton, { icon: jsxRuntime.jsx(Icon, { name: "ChevronUpDown", size: "small" }), size: "medium", variant: "transparent", color: "secondary" })] }), headerAddon ? headerAddon : null] }), jsxRuntime.jsx(Collapsible, { expanded: expanded, id: id, children: children })] }));
|
|
1038
1050
|
};
|
|
1039
1051
|
const Collapsible = ({ children, expanded, id }) => {
|
|
1040
1052
|
const [ref, { height }] = reactUse.useMeasure();
|
|
1041
|
-
return (jsxRuntime.jsx("div", { className: cvaCollapseAnimated(), id: id, style: { height: expanded ? height : "0" }, children: jsxRuntime.jsx("div", {
|
|
1053
|
+
return (jsxRuntime.jsx("div", { className: cvaCollapseAnimated(), id: id, style: { height: expanded ? height : "0" }, children: jsxRuntime.jsx("div", { ref: ref, children: jsxRuntime.jsx("div", { className: cvaCollapsible(), children: children }) }) }));
|
|
1042
1054
|
};
|
|
1043
1055
|
|
|
1044
1056
|
const cvaCopyableText = cssClassVarianceUtilities.cvaMerge([
|
|
@@ -1225,11 +1237,11 @@ const cvaPopoverTitleContainer = cssClassVarianceUtilities.cvaMerge(["flex", "it
|
|
|
1225
1237
|
const cvaPopoverTitleText = cssClassVarianceUtilities.cvaMerge(["flex-1", "text-neutral-500"]);
|
|
1226
1238
|
|
|
1227
1239
|
const PopoverContent = React__default["default"].forwardRef(function PopoverContent(_a, propRef) {
|
|
1228
|
-
var _b
|
|
1240
|
+
var _b;
|
|
1229
1241
|
var { className, dataTestId, children, portalId } = _a, props = __rest(_a, ["className", "dataTestId", "children", "portalId"]);
|
|
1230
|
-
const
|
|
1242
|
+
const _c = usePopoverContext(), { context: floatingContext, customProps } = _c, context = __rest(_c, ["context", "customProps"]);
|
|
1231
1243
|
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
|
|
1244
|
+
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
1245
|
});
|
|
1234
1246
|
|
|
1235
1247
|
/**
|
|
@@ -1245,7 +1257,7 @@ const PopoverTitle = ({ children, action, divider = false, className, dataTestId
|
|
|
1245
1257
|
const PopoverTrigger = React.forwardRef(function PopoverTrigger(_a, propRef) {
|
|
1246
1258
|
var { children, renderButton } = _a, props = __rest(_a, ["children", "renderButton"]);
|
|
1247
1259
|
const context = usePopoverContext();
|
|
1248
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1260
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, local-rules/no-typescript-assertion
|
|
1249
1261
|
const childrenRef = children.ref;
|
|
1250
1262
|
const ref = react.useMergeRefs([context.refs.setReference, propRef, childrenRef]);
|
|
1251
1263
|
if (!renderButton && React.isValidElement(children)) {
|
|
@@ -1284,7 +1296,7 @@ const DayRangePicker = ({ onRangeSelect, selectedDays, disabledDays, dataTestId,
|
|
|
1284
1296
|
onRangeSelect({ from, to });
|
|
1285
1297
|
}
|
|
1286
1298
|
}, [onRangeSelect]);
|
|
1287
|
-
return (jsxRuntime.jsx(reactDayPicker.DayPicker, { mode: "range", onSelect: onSelect, selected: selectedDays, defaultMonth: selectedDays
|
|
1299
|
+
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
1300
|
};
|
|
1289
1301
|
|
|
1290
1302
|
const cvaDrawerOverlay = cssClassVarianceUtilities.cvaMerge([
|
|
@@ -1352,7 +1364,6 @@ const cvaSkeletonLine = cssClassVarianceUtilities.cvaMerge([
|
|
|
1352
1364
|
|
|
1353
1365
|
/**
|
|
1354
1366
|
* Display placeholder lines before the data gets loaded to reduce load-time frustration.
|
|
1355
|
-
|
|
1356
1367
|
*/
|
|
1357
1368
|
const SkeletonLines = React.memo(({ margin = "10px 0", lines = 1, height, width = "100%", className, dataTestId }) => {
|
|
1358
1369
|
const skeletonLines = [];
|
|
@@ -1374,6 +1385,7 @@ const SkeletonLines = React.memo(({ margin = "10px 0", lines = 1, height, width
|
|
|
1374
1385
|
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
1375
1386
|
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: skeletonLines });
|
|
1376
1387
|
});
|
|
1388
|
+
SkeletonLines.displayName = "SkeletonLines";
|
|
1377
1389
|
|
|
1378
1390
|
const cvaContainerStyles = cssClassVarianceUtilities.cvaMerge([
|
|
1379
1391
|
"flex",
|
|
@@ -1454,8 +1466,8 @@ const ExternalLink = ({ rel = "noreferrer", target = "_blank", href, className,
|
|
|
1454
1466
|
return (jsxRuntime.jsx("a", { onClick: onClick, "data-testid": dataTestId, className: cvaExternalLink({ className }), title: title, href: href, rel: rel, target: target, children: children }));
|
|
1455
1467
|
};
|
|
1456
1468
|
|
|
1457
|
-
const cvaTooltipFlexContainer = cssClassVarianceUtilities.cvaMerge("inline-flex hover:cursor-pointer");
|
|
1458
|
-
const cvaTooltipIcon = cssClassVarianceUtilities.cvaMerge("flex h-max w-fit text-slate-300 transition hover:cursor-pointer hover:text-slate-400", {
|
|
1469
|
+
const cvaTooltipFlexContainer = cssClassVarianceUtilities.cvaMerge(["inline-flex", "hover:cursor-pointer"]);
|
|
1470
|
+
const cvaTooltipIcon = cssClassVarianceUtilities.cvaMerge(["flex", "h-max", "w-fit", "text-slate-300", "transition", "hover:cursor-pointer", "hover:text-slate-400"], {
|
|
1459
1471
|
variants: {
|
|
1460
1472
|
color: {
|
|
1461
1473
|
light: "hover:text-white",
|
|
@@ -1466,7 +1478,7 @@ const cvaTooltipIcon = cssClassVarianceUtilities.cvaMerge("flex h-max w-fit text
|
|
|
1466
1478
|
},
|
|
1467
1479
|
},
|
|
1468
1480
|
});
|
|
1469
|
-
const cvaTooltipPopover = cssClassVarianceUtilities.cvaMerge("pointer-events-none origin-center");
|
|
1481
|
+
const cvaTooltipPopover = cssClassVarianceUtilities.cvaMerge(["pointer-events-none", "origin-center"]);
|
|
1470
1482
|
const cvaTooltipPopoverTail = cssClassVarianceUtilities.cvaMerge("", {
|
|
1471
1483
|
variants: {
|
|
1472
1484
|
placement: {
|
|
@@ -1494,7 +1506,7 @@ const cvaTooltipPopoverTail = cssClassVarianceUtilities.cvaMerge("", {
|
|
|
1494
1506
|
},
|
|
1495
1507
|
});
|
|
1496
1508
|
cssClassVarianceUtilities.cvaMerge(["component-popover-border", "z-popover", "animate-fade-in-fast"]);
|
|
1497
|
-
const cvaTooltipPopoverContent = cssClassVarianceUtilities.cvaMerge("max-w-sm rounded p-2", {
|
|
1509
|
+
const cvaTooltipPopoverContent = cssClassVarianceUtilities.cvaMerge(["max-w-sm", "rounded", "p-2"], {
|
|
1498
1510
|
variants: {
|
|
1499
1511
|
color: {
|
|
1500
1512
|
light: "bg-white shadow-lg",
|
|
@@ -1538,11 +1550,11 @@ const Tooltip = ({ children, dataTestId = "tool-tip", disabled, className, label
|
|
|
1538
1550
|
whileElementsMounted: react.autoUpdate,
|
|
1539
1551
|
});
|
|
1540
1552
|
const { isMounted } = react.useTransitionStatus(context);
|
|
1541
|
-
const wrappedChildren = (jsxRuntime.jsx("div", { className: cvaTooltipFlexContainer({ className }), "data-testid": dataTestId
|
|
1553
|
+
const wrappedChildren = (jsxRuntime.jsx("div", { className: cvaTooltipFlexContainer({ className }), "data-testid": dataTestId ? `${dataTestId}-parent` : null, children: children }));
|
|
1542
1554
|
if (disabled) {
|
|
1543
1555
|
return wrappedChildren;
|
|
1544
1556
|
}
|
|
1545
|
-
return (jsxRuntime.jsxs(Popover, { className: cvaTooltipPopover(), placement: placement === "auto" ? "bottom" : placement, activation: { hover: true }, dataTestId: dataTestId
|
|
1557
|
+
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] }));
|
|
1546
1558
|
};
|
|
1547
1559
|
|
|
1548
1560
|
const cvaIndicator = cssClassVarianceUtilities.cvaMerge(["flex", "items-center"]);
|
|
@@ -1645,7 +1657,7 @@ const cvaIndicatorIconBackground = cssClassVarianceUtilities.cvaMerge(["rounded-
|
|
|
1645
1657
|
*/
|
|
1646
1658
|
const Indicator = (_a) => {
|
|
1647
1659
|
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"]);
|
|
1648
|
-
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
|
|
1660
|
+
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] })) }));
|
|
1649
1661
|
};
|
|
1650
1662
|
|
|
1651
1663
|
const cvaMenuItem = cssClassVarianceUtilities.cvaMerge([
|
|
@@ -1732,7 +1744,7 @@ const MenuItem = ({ className, dataTestId, label, size, children, selected, focu
|
|
|
1732
1744
|
}), onClick: e => {
|
|
1733
1745
|
stopPropagation && e.stopPropagation();
|
|
1734
1746
|
onClick && onClick(e);
|
|
1735
|
-
}, tabIndex: 0, children: [prefix
|
|
1747
|
+
}, 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] })));
|
|
1736
1748
|
};
|
|
1737
1749
|
|
|
1738
1750
|
const cvaMenuList = cssClassVarianceUtilities.cvaMerge(["shadow-md", "rounded-lg", "z-20", "bg-white", "p-1", "border", "border-slate-300", "gap-1", "grid"], {
|
|
@@ -1760,7 +1772,7 @@ const MenuList = (_a) => {
|
|
|
1760
1772
|
var { dataTestId, className, children, withStickyHeader = false, showDivider = false } = _a, args = __rest(_a, ["dataTestId", "className", "children", "withStickyHeader", "showDivider"]);
|
|
1761
1773
|
const childrenArr = React.Children.toArray(children);
|
|
1762
1774
|
const isLastItem = (index) => index === childrenArr.length - 1;
|
|
1763
|
-
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)
|
|
1775
|
+
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] }))) }));
|
|
1764
1776
|
};
|
|
1765
1777
|
|
|
1766
1778
|
const cvaMoreMenu = cssClassVarianceUtilities.cvaMerge(["p-4"]);
|
|
@@ -1824,12 +1836,9 @@ const cvaModalBackdrop = cssClassVarianceUtilities.cvaMerge([
|
|
|
1824
1836
|
const ModalBackdrop = ({ children, isVisible, onClick }) => {
|
|
1825
1837
|
const ref = React__namespace.useRef(null);
|
|
1826
1838
|
return (jsxRuntime.jsx("div", { ref: ref, className: cvaModalBackdrop({ show: isVisible }), onMouseDown: e => {
|
|
1827
|
-
var _a, _b;
|
|
1828
1839
|
// only react on click on backdrop - accessing first child to get around styled element element
|
|
1829
|
-
if (ref.current !== null) {
|
|
1830
|
-
|
|
1831
|
-
onClick();
|
|
1832
|
-
}
|
|
1840
|
+
if (ref.current !== null && e.target === ref.current.children[0]) {
|
|
1841
|
+
onClick();
|
|
1833
1842
|
}
|
|
1834
1843
|
}, children: children }));
|
|
1835
1844
|
};
|
|
@@ -1843,8 +1852,9 @@ const ModalBackdrop = ({ children, isVisible, onClick }) => {
|
|
|
1843
1852
|
const Modal = React__namespace.forwardRef(({ isOpen, children, dataTestId, className, role = "", onDismissClick = () => {
|
|
1844
1853
|
return;
|
|
1845
1854
|
}, }, ref) => {
|
|
1846
|
-
return (jsxRuntime.jsx(ModalBackdrop, { isVisible: isOpen, onClick: onDismissClick, children: isOpen
|
|
1855
|
+
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 }));
|
|
1847
1856
|
});
|
|
1857
|
+
Modal.displayName = "Modal";
|
|
1848
1858
|
|
|
1849
1859
|
/**
|
|
1850
1860
|
* The useModal component should be used to inform the user of important information.
|
|
@@ -1857,10 +1867,12 @@ const useModal = ({ closeOnOutsideClick } = {}) => {
|
|
|
1857
1867
|
const { isOpen, togglePortal, openPortal, closePortal, Portal } = usePortal__default["default"]({
|
|
1858
1868
|
closeOnOutsideClick,
|
|
1859
1869
|
onPortalClick: ({ target }) => {
|
|
1870
|
+
var _a;
|
|
1860
1871
|
if (!closeOnOutsideClick) {
|
|
1861
1872
|
return;
|
|
1862
1873
|
}
|
|
1863
|
-
|
|
1874
|
+
// eslint-disable-next-line local-rules/no-typescript-assertion
|
|
1875
|
+
const clickingOutsideModal = !((_a = modalRef.current) === null || _a === void 0 ? void 0 : _a.contains(target));
|
|
1864
1876
|
if (clickingOutsideModal) {
|
|
1865
1877
|
closePortal();
|
|
1866
1878
|
}
|
|
@@ -1878,7 +1890,7 @@ const useModal = ({ closeOnOutsideClick } = {}) => {
|
|
|
1878
1890
|
};
|
|
1879
1891
|
};
|
|
1880
1892
|
|
|
1881
|
-
const cvaPageHeaderContainer = cssClassVarianceUtilities.cvaMerge(["bg-white"], {
|
|
1893
|
+
const cvaPageHeaderContainer = cssClassVarianceUtilities.cvaMerge(["bg-white", "tu-page-header"], {
|
|
1882
1894
|
variants: {
|
|
1883
1895
|
withBorder: {
|
|
1884
1896
|
true: ["border-b", "border-b-secondary-200"],
|
|
@@ -1887,10 +1899,9 @@ const cvaPageHeaderContainer = cssClassVarianceUtilities.cvaMerge(["bg-white"],
|
|
|
1887
1899
|
},
|
|
1888
1900
|
});
|
|
1889
1901
|
const cvaPageHeader = cssClassVarianceUtilities.cvaMerge([
|
|
1890
|
-
"min-h-[72px]",
|
|
1891
1902
|
"box-border",
|
|
1892
|
-
"
|
|
1893
|
-
"
|
|
1903
|
+
"py-responsive-space",
|
|
1904
|
+
"px-responsive-space-lg",
|
|
1894
1905
|
"flex",
|
|
1895
1906
|
"flex-wrap",
|
|
1896
1907
|
"items-center",
|
|
@@ -1899,7 +1910,7 @@ const cvaPageHeader = cssClassVarianceUtilities.cvaMerge([
|
|
|
1899
1910
|
"justify-between",
|
|
1900
1911
|
]);
|
|
1901
1912
|
const cvaPageHeaderHeading = cssClassVarianceUtilities.cvaMerge(["flex", "text-slate-900", "text-2xl", "font-bold", "min-w-0"]);
|
|
1902
|
-
const cvaPageHeaderHeadingContainer = cssClassVarianceUtilities.cvaMerge(["flex", "gap-x-4", "items-center"]);
|
|
1913
|
+
const cvaPageHeaderHeadingContainer = cssClassVarianceUtilities.cvaMerge(["flex", "gap-x-4", "flex-wrap", "items-center"]);
|
|
1903
1914
|
const cvaPageHeaderHeadingAccessoriesContainer = cssClassVarianceUtilities.cvaMerge([
|
|
1904
1915
|
"flex",
|
|
1905
1916
|
"flex-wrap",
|
|
@@ -1908,6 +1919,16 @@ const cvaPageHeaderHeadingAccessoriesContainer = cssClassVarianceUtilities.cvaMe
|
|
|
1908
1919
|
"gap-y-2",
|
|
1909
1920
|
]);
|
|
1910
1921
|
const cvaPageHeaderChildContainer = cssClassVarianceUtilities.cvaMerge(["flex", "flex-wrap", "gap-x-6", "items-center"]);
|
|
1922
|
+
const cvaPageHeaderDescriptionAndLinkContainer = cssClassVarianceUtilities.cvaMerge(["flex", "h-fit", "items-center", "gap-1"]);
|
|
1923
|
+
const cvaPageHeaderLink = cssClassVarianceUtilities.cvaMerge([
|
|
1924
|
+
"text-primary-600",
|
|
1925
|
+
"hover:text-primary-700",
|
|
1926
|
+
"flex",
|
|
1927
|
+
"items-center",
|
|
1928
|
+
"gap-1",
|
|
1929
|
+
"text-xs",
|
|
1930
|
+
"underline",
|
|
1931
|
+
]);
|
|
1911
1932
|
|
|
1912
1933
|
/**
|
|
1913
1934
|
* Pageheader component is used to display a page header.
|
|
@@ -1919,9 +1940,9 @@ const cvaPageHeaderChildContainer = cssClassVarianceUtilities.cvaMerge(["flex",
|
|
|
1919
1940
|
*/
|
|
1920
1941
|
const PageHeader = ({ className, dataTestId, action, showLoading, description, link, title, tag, backTo, tagColor, children, tabsList, linkText = "Help Center Article", }) => {
|
|
1921
1942
|
return (jsxRuntime.jsxs("div", { className: cvaPageHeaderContainer({
|
|
1922
|
-
className
|
|
1923
|
-
withBorder: !
|
|
1924
|
-
}), "data-testid": dataTestId, children: [jsxRuntime.jsxs("div", { className: cvaPageHeader(), children: [jsxRuntime.jsxs("div", { className: cvaPageHeaderHeadingAccessoriesContainer(), "data-testid": dataTestId
|
|
1943
|
+
className,
|
|
1944
|
+
withBorder: !tabsList,
|
|
1945
|
+
}), "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] }));
|
|
1925
1946
|
};
|
|
1926
1947
|
|
|
1927
1948
|
const cvaPagination = cssClassVarianceUtilities.cvaMerge(["flex", "items-center", "gap-1"]);
|
|
@@ -1970,7 +1991,7 @@ const Pagination = ({ previousPage, nextPage, canPreviousPage, canNextPage, page
|
|
|
1970
1991
|
if (loading) {
|
|
1971
1992
|
return (jsxRuntime.jsx("div", { className: cvaPagination({ className }), children: jsxRuntime.jsx(SkeletonLines, { height: 16, width: 150 }) }));
|
|
1972
1993
|
}
|
|
1973
|
-
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
|
|
1994
|
+
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
|
|
1974
1995
|
? !canNextPage || false
|
|
1975
1996
|
: 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" })] }));
|
|
1976
1997
|
};
|
|
@@ -2016,8 +2037,7 @@ const usePrompt = (message, when = true) => {
|
|
|
2016
2037
|
};
|
|
2017
2038
|
}, [message, when]);
|
|
2018
2039
|
const confirmExit = React.useCallback(() => {
|
|
2019
|
-
|
|
2020
|
-
return confirm;
|
|
2040
|
+
return window.confirm(message);
|
|
2021
2041
|
}, [message]);
|
|
2022
2042
|
useConfirmExit(confirmExit, when);
|
|
2023
2043
|
};
|
|
@@ -2067,11 +2087,11 @@ const Spacer = ({ size = "medium", border = false, dataTestId, className }) => {
|
|
|
2067
2087
|
* @returns {JSX.Element} SectionHeader component
|
|
2068
2088
|
*/
|
|
2069
2089
|
const SectionHeader = ({ title, subtitle, dataTestId, addons }) => {
|
|
2070
|
-
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
|
|
2090
|
+
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" })] }));
|
|
2071
2091
|
};
|
|
2072
2092
|
|
|
2073
|
-
const cvaSidebar = cssClassVarianceUtilities.cvaMerge(["apply grid", "grid-cols-fr-min", "items-center"]);
|
|
2074
|
-
const cvaSidebarChildContainer = cssClassVarianceUtilities.cvaMerge(["apply flex", "overflow-hidden", "gap-2", "p-1", "max-w-full"], {
|
|
2093
|
+
const cvaSidebar = cssClassVarianceUtilities.cvaMerge(["apply", "grid", "grid-cols-fr-min", "items-center"]);
|
|
2094
|
+
const cvaSidebarChildContainer = cssClassVarianceUtilities.cvaMerge(["apply", "flex", "overflow-hidden", "gap-2", "p-1", "max-w-full"], {
|
|
2075
2095
|
variants: {
|
|
2076
2096
|
breakpoint: {
|
|
2077
2097
|
xs: ["xs:overflow-visible", "xs:p-0", "xs:grid", "xs:grid-cols-1", "xs:w-full"],
|
|
@@ -2109,7 +2129,7 @@ const useOverflowItems = ({ threshold = 1, childUniqueIdentifierAttribute = "id"
|
|
|
2109
2129
|
}, [childUniqueIdentifierAttribute]);
|
|
2110
2130
|
const observe = React.useCallback(() => {
|
|
2111
2131
|
const node = overflowContainerRef.current;
|
|
2112
|
-
if (node
|
|
2132
|
+
if (node) {
|
|
2113
2133
|
const root = overflowContainerRef.current;
|
|
2114
2134
|
const options = { root, threshold };
|
|
2115
2135
|
const observer = new IntersectionObserver(handleIntersection, options);
|
|
@@ -2162,7 +2182,7 @@ const Sidebar = ({ childContainerClassName, children, breakpoint = "lg", classNa
|
|
|
2162
2182
|
}
|
|
2163
2183
|
return "visible";
|
|
2164
2184
|
};
|
|
2165
|
-
return (jsxRuntime.jsxs("div", { className: cvaSidebar({ className }), "data-testid": dataTestId, children: [jsxRuntime.jsx("div", { ref: overflowContainerRef, className: cvaSidebarChildContainer({ breakpoint, className: childContainerClassName }), "data-testid": dataTestId
|
|
2185
|
+
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 => {
|
|
2166
2186
|
return React__default["default"].cloneElement(child, {
|
|
2167
2187
|
className: `${child.props.className} ${itemVisibilityClassName(child.props.id)}`,
|
|
2168
2188
|
});
|
|
@@ -2170,12 +2190,12 @@ const Sidebar = ({ childContainerClassName, children, breakpoint = "lg", classNa
|
|
|
2170
2190
|
circular: false,
|
|
2171
2191
|
variant: "transparent",
|
|
2172
2192
|
color: "secondary",
|
|
2173
|
-
}, popoverProps: { placement: "bottom-end" } }, moreMenuProps, { className: `${(moreMenuProps === null || moreMenuProps === void 0 ? void 0 : moreMenuProps.className) || ""} !p-0`, dataTestId: dataTestId
|
|
2193
|
+
}, 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 => {
|
|
2174
2194
|
return itemOverflowMap[child.props.id]
|
|
2175
2195
|
? React__default["default"].cloneElement(child, {
|
|
2176
2196
|
onClick: () => {
|
|
2177
2197
|
var _a, _b;
|
|
2178
|
-
(_b = (_a = child
|
|
2198
|
+
(_b = (_a = child.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
2179
2199
|
close();
|
|
2180
2200
|
},
|
|
2181
2201
|
})
|
|
@@ -2237,7 +2257,7 @@ const cvaTab = cssClassVarianceUtilities.cvaMerge([
|
|
|
2237
2257
|
*/
|
|
2238
2258
|
const Tab = (_a) => {
|
|
2239
2259
|
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"]);
|
|
2240
|
-
const renderContent = () => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [iconName
|
|
2260
|
+
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] }));
|
|
2241
2261
|
const commonProps = Object.assign({ className: appendTabStylesToChildIfAsChild ? cvaTab({ className, isFullWidth }) : className }, rest);
|
|
2242
2262
|
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() }))) }));
|
|
2243
2263
|
};
|
|
@@ -2247,7 +2267,7 @@ const Tab = (_a) => {
|
|
|
2247
2267
|
*/
|
|
2248
2268
|
const TabContent = (_a) => {
|
|
2249
2269
|
var { className, dataTestId, children } = _a, rest = __rest(_a, ["className", "dataTestId", "children"]);
|
|
2250
|
-
return (jsxRuntime.jsx(reactTabs.Content, Object.assign({ "data-testid": `${dataTestId}-content
|
|
2270
|
+
return (jsxRuntime.jsx(reactTabs.Content, Object.assign({ "data-testid": dataTestId ? `${dataTestId}-content` : undefined, className: cvaTabContent({ className }) }, rest, { children: children })));
|
|
2251
2271
|
};
|
|
2252
2272
|
|
|
2253
2273
|
/**
|
|
@@ -2299,7 +2319,7 @@ const Timeline = ({ className, dataTestId, children }) => {
|
|
|
2299
2319
|
* @returns {JSX.Element} component
|
|
2300
2320
|
*/
|
|
2301
2321
|
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, }) => {
|
|
2302
|
-
return (jsxRuntime.jsxs("li", { className: cvaTimelineElement({ className }), "data-date": `${date}`, "data-testid": dataTestId
|
|
2322
|
+
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 }) })] }));
|
|
2303
2323
|
};
|
|
2304
2324
|
function defaultHeader(date, showTime) {
|
|
2305
2325
|
return `${dateFns.format(date, showTime ? "MMM d, yyyy H:mm" : "MMM d, yyyy")} (${dateFns.formatDistance(date, new Date(), {
|
|
@@ -2414,7 +2434,7 @@ const ValueBar = ({ value, min = 0, max = 100, unit, size = "small", levelColors
|
|
|
2414
2434
|
const score = getScore(value, min, max);
|
|
2415
2435
|
const barFillColor = levelColors ? getFillColor(score, levelColors) : getDefaultFillColor(score);
|
|
2416
2436
|
const barWidth = showValue && size === "small" ? 90 : 100;
|
|
2417
|
-
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"
|
|
2437
|
+
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] }) }));
|
|
2418
2438
|
};
|
|
2419
2439
|
|
|
2420
2440
|
const cvaWidgetBodyDensityContainer = cssClassVarianceUtilities.cvaMerge([
|
|
@@ -2636,6 +2656,7 @@ const useClickOutside = (el, options = {}, onClick) => {
|
|
|
2636
2656
|
active = options.active !== undefined ? options.active : active;
|
|
2637
2657
|
}
|
|
2638
2658
|
const handler = (ev) => {
|
|
2659
|
+
// eslint-disable-next-line local-rules/no-typescript-assertion
|
|
2639
2660
|
const target = ev.target;
|
|
2640
2661
|
if (els.every(ref => !ref.current || !ref.current.contains(target))) {
|
|
2641
2662
|
onClick && onClick(ev);
|
|
@@ -2787,20 +2808,9 @@ function useDevicePixelRatio(options) {
|
|
|
2787
2808
|
}
|
|
2788
2809
|
const updateDpr = () => setCurrentDpr(getDevicePixelRatio({ defaultDpr, maxDpr, round }));
|
|
2789
2810
|
const mediaMatcher = window.matchMedia(`screen and (resolution: ${currentDpr}dppx)`);
|
|
2790
|
-
|
|
2791
|
-
if (mediaMatcher.addEventListener) {
|
|
2792
|
-
mediaMatcher.addEventListener("change", updateDpr);
|
|
2793
|
-
}
|
|
2794
|
-
else {
|
|
2795
|
-
mediaMatcher.addListener(updateDpr);
|
|
2796
|
-
}
|
|
2811
|
+
mediaMatcher.addEventListener("change", updateDpr);
|
|
2797
2812
|
return () => {
|
|
2798
|
-
|
|
2799
|
-
mediaMatcher.removeEventListener("change", updateDpr);
|
|
2800
|
-
}
|
|
2801
|
-
else {
|
|
2802
|
-
mediaMatcher.removeListener(updateDpr);
|
|
2803
|
-
}
|
|
2813
|
+
mediaMatcher.removeEventListener("change", updateDpr);
|
|
2804
2814
|
};
|
|
2805
2815
|
}, [currentDpr, defaultDpr, maxDpr, round]);
|
|
2806
2816
|
return currentDpr;
|
|
@@ -2815,8 +2825,7 @@ function getDevicePixelRatio(options) {
|
|
|
2815
2825
|
const { defaultDpr = 1, maxDpr = 3, round = true } = options || {};
|
|
2816
2826
|
const hasDprProp = typeof window !== "undefined" && typeof window.devicePixelRatio === "number";
|
|
2817
2827
|
const dpr = hasDprProp ? window.devicePixelRatio : defaultDpr;
|
|
2818
|
-
|
|
2819
|
-
return rounded;
|
|
2828
|
+
return Math.min(Math.max(1, round ? Math.floor(dpr) : dpr), maxDpr);
|
|
2820
2829
|
}
|
|
2821
2830
|
|
|
2822
2831
|
/**
|
|
@@ -3063,9 +3072,7 @@ exports.Tooltip = Tooltip;
|
|
|
3063
3072
|
exports.ValueBar = ValueBar;
|
|
3064
3073
|
exports.WidgetBody = WidgetBody;
|
|
3065
3074
|
exports.cvaButton = cvaButton;
|
|
3066
|
-
exports.cvaButtonSpinner = cvaButtonSpinner;
|
|
3067
3075
|
exports.cvaClickable = cvaClickable;
|
|
3068
|
-
exports.cvaIconButtonContainer = cvaIconButtonContainer;
|
|
3069
3076
|
exports.cvaIndicator = cvaIndicator;
|
|
3070
3077
|
exports.cvaIndicatorIcon = cvaIndicatorIcon;
|
|
3071
3078
|
exports.cvaIndicatorIconBackground = cvaIndicatorIconBackground;
|