@trackunit/react-components 0.1.238 → 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 +145 -133
- package/index.esm.js +146 -132
- package/package.json +1 -1
- 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([
|
|
@@ -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,8 +1471,8 @@ 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 hover:cursor-pointer");
|
|
1458
|
-
const cvaTooltipIcon = cssClassVarianceUtilities.cvaMerge("flex h-max w-fit text-slate-300 transition hover:cursor-pointer hover:text-slate-400", {
|
|
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"], {
|
|
1459
1476
|
variants: {
|
|
1460
1477
|
color: {
|
|
1461
1478
|
light: "hover:text-white",
|
|
@@ -1466,7 +1483,7 @@ const cvaTooltipIcon = cssClassVarianceUtilities.cvaMerge("flex h-max w-fit text
|
|
|
1466
1483
|
},
|
|
1467
1484
|
},
|
|
1468
1485
|
});
|
|
1469
|
-
const cvaTooltipPopover = cssClassVarianceUtilities.cvaMerge("pointer-events-none origin-center");
|
|
1486
|
+
const cvaTooltipPopover = cssClassVarianceUtilities.cvaMerge(["pointer-events-none", "origin-center"]);
|
|
1470
1487
|
const cvaTooltipPopoverTail = cssClassVarianceUtilities.cvaMerge("", {
|
|
1471
1488
|
variants: {
|
|
1472
1489
|
placement: {
|
|
@@ -1494,7 +1511,7 @@ const cvaTooltipPopoverTail = cssClassVarianceUtilities.cvaMerge("", {
|
|
|
1494
1511
|
},
|
|
1495
1512
|
});
|
|
1496
1513
|
cssClassVarianceUtilities.cvaMerge(["component-popover-border", "z-popover", "animate-fade-in-fast"]);
|
|
1497
|
-
const cvaTooltipPopoverContent = cssClassVarianceUtilities.cvaMerge("max-w-sm rounded p-2", {
|
|
1514
|
+
const cvaTooltipPopoverContent = cssClassVarianceUtilities.cvaMerge(["max-w-sm", "rounded", "p-2"], {
|
|
1498
1515
|
variants: {
|
|
1499
1516
|
color: {
|
|
1500
1517
|
light: "bg-white shadow-lg",
|
|
@@ -1538,11 +1555,11 @@ const Tooltip = ({ children, dataTestId = "tool-tip", disabled, className, label
|
|
|
1538
1555
|
whileElementsMounted: react.autoUpdate,
|
|
1539
1556
|
});
|
|
1540
1557
|
const { isMounted } = react.useTransitionStatus(context);
|
|
1541
|
-
const wrappedChildren = (jsxRuntime.jsx("div", { className: cvaTooltipFlexContainer({ className }), "data-testid": dataTestId
|
|
1558
|
+
const wrappedChildren = (jsxRuntime.jsx("div", { className: cvaTooltipFlexContainer({ className }), "data-testid": dataTestId ? `${dataTestId}-parent` : null, children: children }));
|
|
1542
1559
|
if (disabled) {
|
|
1543
1560
|
return wrappedChildren;
|
|
1544
1561
|
}
|
|
1545
|
-
return (jsxRuntime.jsxs(Popover, { className: cvaTooltipPopover(), placement: placement === "auto" ? "bottom" : placement, activation: { hover: true }, dataTestId: dataTestId
|
|
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] }));
|
|
1546
1563
|
};
|
|
1547
1564
|
|
|
1548
1565
|
const cvaIndicator = cssClassVarianceUtilities.cvaMerge(["flex", "items-center"]);
|
|
@@ -1645,7 +1662,7 @@ const cvaIndicatorIconBackground = cssClassVarianceUtilities.cvaMerge(["rounded-
|
|
|
1645
1662
|
*/
|
|
1646
1663
|
const Indicator = (_a) => {
|
|
1647
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"]);
|
|
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
|
|
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] })) }));
|
|
1649
1666
|
};
|
|
1650
1667
|
|
|
1651
1668
|
const cvaMenuItem = cssClassVarianceUtilities.cvaMerge([
|
|
@@ -1732,7 +1749,7 @@ const MenuItem = ({ className, dataTestId, label, size, children, selected, focu
|
|
|
1732
1749
|
}), onClick: e => {
|
|
1733
1750
|
stopPropagation && e.stopPropagation();
|
|
1734
1751
|
onClick && onClick(e);
|
|
1735
|
-
}, 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] })));
|
|
1736
1753
|
};
|
|
1737
1754
|
|
|
1738
1755
|
const cvaMenuList = cssClassVarianceUtilities.cvaMerge(["shadow-md", "rounded-lg", "z-20", "bg-white", "p-1", "border", "border-slate-300", "gap-1", "grid"], {
|
|
@@ -1760,7 +1777,7 @@ const MenuList = (_a) => {
|
|
|
1760
1777
|
var { dataTestId, className, children, withStickyHeader = false, showDivider = false } = _a, args = __rest(_a, ["dataTestId", "className", "children", "withStickyHeader", "showDivider"]);
|
|
1761
1778
|
const childrenArr = React.Children.toArray(children);
|
|
1762
1779
|
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)
|
|
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] }))) }));
|
|
1764
1781
|
};
|
|
1765
1782
|
|
|
1766
1783
|
const cvaMoreMenu = cssClassVarianceUtilities.cvaMerge(["p-4"]);
|
|
@@ -1824,12 +1841,9 @@ const cvaModalBackdrop = cssClassVarianceUtilities.cvaMerge([
|
|
|
1824
1841
|
const ModalBackdrop = ({ children, isVisible, onClick }) => {
|
|
1825
1842
|
const ref = React__namespace.useRef(null);
|
|
1826
1843
|
return (jsxRuntime.jsx("div", { ref: ref, className: cvaModalBackdrop({ show: isVisible }), onMouseDown: e => {
|
|
1827
|
-
var _a, _b;
|
|
1828
1844
|
// only react on click on backdrop - accessing first child to get around styled element element
|
|
1829
|
-
if (ref.current !== null) {
|
|
1830
|
-
|
|
1831
|
-
onClick();
|
|
1832
|
-
}
|
|
1845
|
+
if (ref.current !== null && e.target === ref.current.children[0]) {
|
|
1846
|
+
onClick();
|
|
1833
1847
|
}
|
|
1834
1848
|
}, children: children }));
|
|
1835
1849
|
};
|
|
@@ -1843,8 +1857,9 @@ const ModalBackdrop = ({ children, isVisible, onClick }) => {
|
|
|
1843
1857
|
const Modal = React__namespace.forwardRef(({ isOpen, children, dataTestId, className, role = "", onDismissClick = () => {
|
|
1844
1858
|
return;
|
|
1845
1859
|
}, }, ref) => {
|
|
1846
|
-
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 }));
|
|
1847
1861
|
});
|
|
1862
|
+
Modal.displayName = "Modal";
|
|
1848
1863
|
|
|
1849
1864
|
/**
|
|
1850
1865
|
* The useModal component should be used to inform the user of important information.
|
|
@@ -1857,10 +1872,12 @@ const useModal = ({ closeOnOutsideClick } = {}) => {
|
|
|
1857
1872
|
const { isOpen, togglePortal, openPortal, closePortal, Portal } = usePortal__default["default"]({
|
|
1858
1873
|
closeOnOutsideClick,
|
|
1859
1874
|
onPortalClick: ({ target }) => {
|
|
1875
|
+
var _a;
|
|
1860
1876
|
if (!closeOnOutsideClick) {
|
|
1861
1877
|
return;
|
|
1862
1878
|
}
|
|
1863
|
-
|
|
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));
|
|
1864
1881
|
if (clickingOutsideModal) {
|
|
1865
1882
|
closePortal();
|
|
1866
1883
|
}
|
|
@@ -1878,7 +1895,7 @@ const useModal = ({ closeOnOutsideClick } = {}) => {
|
|
|
1878
1895
|
};
|
|
1879
1896
|
};
|
|
1880
1897
|
|
|
1881
|
-
const cvaPageHeaderContainer = cssClassVarianceUtilities.cvaMerge(["bg-white"], {
|
|
1898
|
+
const cvaPageHeaderContainer = cssClassVarianceUtilities.cvaMerge(["bg-white", "tu-page-header"], {
|
|
1882
1899
|
variants: {
|
|
1883
1900
|
withBorder: {
|
|
1884
1901
|
true: ["border-b", "border-b-secondary-200"],
|
|
@@ -1887,10 +1904,9 @@ const cvaPageHeaderContainer = cssClassVarianceUtilities.cvaMerge(["bg-white"],
|
|
|
1887
1904
|
},
|
|
1888
1905
|
});
|
|
1889
1906
|
const cvaPageHeader = cssClassVarianceUtilities.cvaMerge([
|
|
1890
|
-
"min-h-[72px]",
|
|
1891
1907
|
"box-border",
|
|
1892
|
-
"
|
|
1893
|
-
"
|
|
1908
|
+
"py-responsive-space",
|
|
1909
|
+
"px-responsive-space-lg",
|
|
1894
1910
|
"flex",
|
|
1895
1911
|
"flex-wrap",
|
|
1896
1912
|
"items-center",
|
|
@@ -1899,7 +1915,7 @@ const cvaPageHeader = cssClassVarianceUtilities.cvaMerge([
|
|
|
1899
1915
|
"justify-between",
|
|
1900
1916
|
]);
|
|
1901
1917
|
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"]);
|
|
1918
|
+
const cvaPageHeaderHeadingContainer = cssClassVarianceUtilities.cvaMerge(["flex", "gap-x-4", "flex-wrap", "items-center"]);
|
|
1903
1919
|
const cvaPageHeaderHeadingAccessoriesContainer = cssClassVarianceUtilities.cvaMerge([
|
|
1904
1920
|
"flex",
|
|
1905
1921
|
"flex-wrap",
|
|
@@ -1908,6 +1924,16 @@ const cvaPageHeaderHeadingAccessoriesContainer = cssClassVarianceUtilities.cvaMe
|
|
|
1908
1924
|
"gap-y-2",
|
|
1909
1925
|
]);
|
|
1910
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
|
+
]);
|
|
1911
1937
|
|
|
1912
1938
|
/**
|
|
1913
1939
|
* Pageheader component is used to display a page header.
|
|
@@ -1919,9 +1945,9 @@ const cvaPageHeaderChildContainer = cssClassVarianceUtilities.cvaMerge(["flex",
|
|
|
1919
1945
|
*/
|
|
1920
1946
|
const PageHeader = ({ className, dataTestId, action, showLoading, description, link, title, tag, backTo, tagColor, children, tabsList, linkText = "Help Center Article", }) => {
|
|
1921
1947
|
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
|
|
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] }));
|
|
1925
1951
|
};
|
|
1926
1952
|
|
|
1927
1953
|
const cvaPagination = cssClassVarianceUtilities.cvaMerge(["flex", "items-center", "gap-1"]);
|
|
@@ -1970,7 +1996,7 @@ const Pagination = ({ previousPage, nextPage, canPreviousPage, canNextPage, page
|
|
|
1970
1996
|
if (loading) {
|
|
1971
1997
|
return (jsxRuntime.jsx("div", { className: cvaPagination({ className }), children: jsxRuntime.jsx(SkeletonLines, { height: 16, width: 150 }) }));
|
|
1972
1998
|
}
|
|
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
|
|
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
|
|
1974
2000
|
? !canNextPage || false
|
|
1975
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" })] }));
|
|
1976
2002
|
};
|
|
@@ -2016,8 +2042,7 @@ const usePrompt = (message, when = true) => {
|
|
|
2016
2042
|
};
|
|
2017
2043
|
}, [message, when]);
|
|
2018
2044
|
const confirmExit = React.useCallback(() => {
|
|
2019
|
-
|
|
2020
|
-
return confirm;
|
|
2045
|
+
return window.confirm(message);
|
|
2021
2046
|
}, [message]);
|
|
2022
2047
|
useConfirmExit(confirmExit, when);
|
|
2023
2048
|
};
|
|
@@ -2067,11 +2092,11 @@ const Spacer = ({ size = "medium", border = false, dataTestId, className }) => {
|
|
|
2067
2092
|
* @returns {JSX.Element} SectionHeader component
|
|
2068
2093
|
*/
|
|
2069
2094
|
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
|
|
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" })] }));
|
|
2071
2096
|
};
|
|
2072
2097
|
|
|
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"], {
|
|
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"], {
|
|
2075
2100
|
variants: {
|
|
2076
2101
|
breakpoint: {
|
|
2077
2102
|
xs: ["xs:overflow-visible", "xs:p-0", "xs:grid", "xs:grid-cols-1", "xs:w-full"],
|
|
@@ -2109,7 +2134,7 @@ const useOverflowItems = ({ threshold = 1, childUniqueIdentifierAttribute = "id"
|
|
|
2109
2134
|
}, [childUniqueIdentifierAttribute]);
|
|
2110
2135
|
const observe = React.useCallback(() => {
|
|
2111
2136
|
const node = overflowContainerRef.current;
|
|
2112
|
-
if (node
|
|
2137
|
+
if (node) {
|
|
2113
2138
|
const root = overflowContainerRef.current;
|
|
2114
2139
|
const options = { root, threshold };
|
|
2115
2140
|
const observer = new IntersectionObserver(handleIntersection, options);
|
|
@@ -2162,7 +2187,7 @@ const Sidebar = ({ childContainerClassName, children, breakpoint = "lg", classNa
|
|
|
2162
2187
|
}
|
|
2163
2188
|
return "visible";
|
|
2164
2189
|
};
|
|
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
|
|
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 => {
|
|
2166
2191
|
return React__default["default"].cloneElement(child, {
|
|
2167
2192
|
className: `${child.props.className} ${itemVisibilityClassName(child.props.id)}`,
|
|
2168
2193
|
});
|
|
@@ -2170,12 +2195,12 @@ const Sidebar = ({ childContainerClassName, children, breakpoint = "lg", classNa
|
|
|
2170
2195
|
circular: false,
|
|
2171
2196
|
variant: "transparent",
|
|
2172
2197
|
color: "secondary",
|
|
2173
|
-
}, 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 => {
|
|
2174
2199
|
return itemOverflowMap[child.props.id]
|
|
2175
2200
|
? React__default["default"].cloneElement(child, {
|
|
2176
2201
|
onClick: () => {
|
|
2177
2202
|
var _a, _b;
|
|
2178
|
-
(_b = (_a = child
|
|
2203
|
+
(_b = (_a = child.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
2179
2204
|
close();
|
|
2180
2205
|
},
|
|
2181
2206
|
})
|
|
@@ -2237,7 +2262,7 @@ const cvaTab = cssClassVarianceUtilities.cvaMerge([
|
|
|
2237
2262
|
*/
|
|
2238
2263
|
const Tab = (_a) => {
|
|
2239
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"]);
|
|
2240
|
-
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] }));
|
|
2241
2266
|
const commonProps = Object.assign({ className: appendTabStylesToChildIfAsChild ? cvaTab({ className, isFullWidth }) : className }, rest);
|
|
2242
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() }))) }));
|
|
2243
2268
|
};
|
|
@@ -2247,7 +2272,7 @@ const Tab = (_a) => {
|
|
|
2247
2272
|
*/
|
|
2248
2273
|
const TabContent = (_a) => {
|
|
2249
2274
|
var { className, dataTestId, children } = _a, rest = __rest(_a, ["className", "dataTestId", "children"]);
|
|
2250
|
-
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 })));
|
|
2251
2276
|
};
|
|
2252
2277
|
|
|
2253
2278
|
/**
|
|
@@ -2299,7 +2324,7 @@ const Timeline = ({ className, dataTestId, children }) => {
|
|
|
2299
2324
|
* @returns {JSX.Element} component
|
|
2300
2325
|
*/
|
|
2301
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, }) => {
|
|
2302
|
-
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 }) })] }));
|
|
2303
2328
|
};
|
|
2304
2329
|
function defaultHeader(date, showTime) {
|
|
2305
2330
|
return `${dateFns.format(date, showTime ? "MMM d, yyyy H:mm" : "MMM d, yyyy")} (${dateFns.formatDistance(date, new Date(), {
|
|
@@ -2414,7 +2439,7 @@ const ValueBar = ({ value, min = 0, max = 100, unit, size = "small", levelColors
|
|
|
2414
2439
|
const score = getScore(value, min, max);
|
|
2415
2440
|
const barFillColor = levelColors ? getFillColor(score, levelColors) : getDefaultFillColor(score);
|
|
2416
2441
|
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"
|
|
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] }) }));
|
|
2418
2443
|
};
|
|
2419
2444
|
|
|
2420
2445
|
const cvaWidgetBodyDensityContainer = cssClassVarianceUtilities.cvaMerge([
|
|
@@ -2636,6 +2661,7 @@ const useClickOutside = (el, options = {}, onClick) => {
|
|
|
2636
2661
|
active = options.active !== undefined ? options.active : active;
|
|
2637
2662
|
}
|
|
2638
2663
|
const handler = (ev) => {
|
|
2664
|
+
// eslint-disable-next-line local-rules/no-typescript-assertion
|
|
2639
2665
|
const target = ev.target;
|
|
2640
2666
|
if (els.every(ref => !ref.current || !ref.current.contains(target))) {
|
|
2641
2667
|
onClick && onClick(ev);
|
|
@@ -2787,20 +2813,9 @@ function useDevicePixelRatio(options) {
|
|
|
2787
2813
|
}
|
|
2788
2814
|
const updateDpr = () => setCurrentDpr(getDevicePixelRatio({ defaultDpr, maxDpr, round }));
|
|
2789
2815
|
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
|
-
}
|
|
2816
|
+
mediaMatcher.addEventListener("change", updateDpr);
|
|
2797
2817
|
return () => {
|
|
2798
|
-
|
|
2799
|
-
mediaMatcher.removeEventListener("change", updateDpr);
|
|
2800
|
-
}
|
|
2801
|
-
else {
|
|
2802
|
-
mediaMatcher.removeListener(updateDpr);
|
|
2803
|
-
}
|
|
2818
|
+
mediaMatcher.removeEventListener("change", updateDpr);
|
|
2804
2819
|
};
|
|
2805
2820
|
}, [currentDpr, defaultDpr, maxDpr, round]);
|
|
2806
2821
|
return currentDpr;
|
|
@@ -2815,8 +2830,7 @@ function getDevicePixelRatio(options) {
|
|
|
2815
2830
|
const { defaultDpr = 1, maxDpr = 3, round = true } = options || {};
|
|
2816
2831
|
const hasDprProp = typeof window !== "undefined" && typeof window.devicePixelRatio === "number";
|
|
2817
2832
|
const dpr = hasDprProp ? window.devicePixelRatio : defaultDpr;
|
|
2818
|
-
|
|
2819
|
-
return rounded;
|
|
2833
|
+
return Math.min(Math.max(1, round ? Math.floor(dpr) : dpr), maxDpr);
|
|
2820
2834
|
}
|
|
2821
2835
|
|
|
2822
2836
|
/**
|
|
@@ -3063,9 +3077,7 @@ exports.Tooltip = Tooltip;
|
|
|
3063
3077
|
exports.ValueBar = ValueBar;
|
|
3064
3078
|
exports.WidgetBody = WidgetBody;
|
|
3065
3079
|
exports.cvaButton = cvaButton;
|
|
3066
|
-
exports.cvaButtonSpinner = cvaButtonSpinner;
|
|
3067
3080
|
exports.cvaClickable = cvaClickable;
|
|
3068
|
-
exports.cvaIconButtonContainer = cvaIconButtonContainer;
|
|
3069
3081
|
exports.cvaIndicator = cvaIndicator;
|
|
3070
3082
|
exports.cvaIndicatorIcon = cvaIndicatorIcon;
|
|
3071
3083
|
exports.cvaIndicatorIconBackground = cvaIndicatorIconBackground;
|