@trackunit/react-components 0.1.386 → 0.1.388
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 +123 -131
- package/index.esm.js +110 -107
- package/package.json +6 -5
- package/src/common/PackageNameStoryComponent.d.ts +1 -2
- package/src/components/Alert/Alert.d.ts +1 -1
- package/src/components/Badge/Badge.d.ts +1 -2
- package/src/components/Breadcrumb/Breadcrumb.d.ts +3 -4
- package/src/components/Breadcrumb/BreadcrumbForLargeScreen.d.ts +1 -2
- package/src/components/Breadcrumb/BreadcrumbForMediumScreen.d.ts +1 -2
- package/src/components/Breadcrumb/BreadcrumbForSmallScreen.d.ts +1 -2
- package/src/components/Breadcrumb/utils/types.d.ts +0 -1
- package/src/components/Card/Card.d.ts +1 -1
- package/src/components/Card/CardBody.d.ts +1 -1
- package/src/components/Card/CardFooter.d.ts +1 -1
- package/src/components/Card/CardHeader.d.ts +1 -1
- package/src/components/Collapse/Collapse.d.ts +1 -1
- package/src/components/CompletionStatusIndicator/CompletionStatusIndicator.d.ts +1 -2
- package/src/components/CopyableText/CopyableText.d.ts +1 -2
- package/src/components/Drawer/Drawer.d.ts +1 -1
- package/src/components/EmptyState/EmptyState.d.ts +1 -2
- package/src/components/EmptyValue/EmptyValue.d.ts +0 -1
- package/src/components/ExternalLink/ExternalLink.d.ts +0 -1
- package/src/components/Icon/Icon.d.ts +2 -6
- package/src/components/Indicator/Indicator.d.ts +0 -1
- package/src/components/Menu/MenuList/MenuList.d.ts +0 -1
- package/src/components/Menu/MoreMenu/MoreMenu.d.ts +1 -1
- package/src/components/Notice/Notice.d.ts +0 -1
- package/src/components/Page/Page.d.ts +1 -1
- package/src/components/Page/PageContent.d.ts +1 -1
- package/src/components/PageHeader/PageHeader.d.ts +1 -1
- package/src/components/Pagination/Pagination.d.ts +1 -2
- package/src/components/Popover/Popover.d.ts +1 -2
- package/src/components/Popover/PopoverContent.d.ts +1 -1
- package/src/components/Popover/PopoverTitle.d.ts +1 -1
- package/src/components/Popover/PopoverTrigger.d.ts +1 -2
- package/src/components/Popover/PopoverTypes.d.ts +0 -1
- package/src/components/Sidebar/Sidebar.d.ts +1 -1
- package/src/components/SkeletonLines/SkeletonLines.d.ts +1 -2
- package/src/components/Spacer/Spacer.d.ts +1 -2
- package/src/components/Spinner/Spinner.d.ts +1 -2
- package/src/components/Tabs/Tab.d.ts +1 -1
- package/src/components/Tabs/TabContent.d.ts +1 -1
- package/src/components/Tabs/TabList.d.ts +1 -1
- package/src/components/Tabs/Tabs.d.ts +1 -1
- package/src/components/Timeline/Timeline.d.ts +2 -3
- package/src/components/ToggleGroup/ToggleGroup.d.ts +1 -2
- package/src/components/ValueBar/ValueBar.d.ts +1 -2
- package/src/components/VirtualizedList/VirtualizedList.d.ts +1 -2
- package/src/components/Widget/WidgetBody.d.ts +1 -1
- package/src/components/buttons/BackToTopButton/BackToTopButton.d.ts +1 -2
- package/src/components/buttons/StarButton/StarButton.d.ts +1 -1
- package/src/components/buttons/shared/ButtonProps.d.ts +0 -1
- package/src/hooks/useSelfUpdatingRef.d.ts +0 -1
package/index.cjs.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
4
|
var React = require('react');
|
|
7
5
|
var sharedUtils = require('@trackunit/shared-utils');
|
|
@@ -25,10 +23,7 @@ var reactTabs = require('@radix-ui/react-tabs');
|
|
|
25
23
|
var dateFns = require('date-fns');
|
|
26
24
|
var reactTablePagination = require('@trackunit/react-table-pagination');
|
|
27
25
|
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
function _interopNamespace(e) {
|
|
31
|
-
if (e && e.__esModule) return e;
|
|
26
|
+
function _interopNamespaceDefault(e) {
|
|
32
27
|
var n = Object.create(null);
|
|
33
28
|
if (e) {
|
|
34
29
|
Object.keys(e).forEach(function (k) {
|
|
@@ -41,17 +36,11 @@ function _interopNamespace(e) {
|
|
|
41
36
|
}
|
|
42
37
|
});
|
|
43
38
|
}
|
|
44
|
-
n
|
|
39
|
+
n.default = e;
|
|
45
40
|
return Object.freeze(n);
|
|
46
41
|
}
|
|
47
42
|
|
|
48
|
-
var React__namespace = /*#__PURE__*/
|
|
49
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
50
|
-
var IconSpriteMini__default = /*#__PURE__*/_interopDefaultLegacy(IconSpriteMini);
|
|
51
|
-
var IconSpriteOutline__default = /*#__PURE__*/_interopDefaultLegacy(IconSpriteOutline);
|
|
52
|
-
var IconSpriteSolid__default = /*#__PURE__*/_interopDefaultLegacy(IconSpriteSolid);
|
|
53
|
-
var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
|
|
54
|
-
var omit__default = /*#__PURE__*/_interopDefaultLegacy(omit);
|
|
43
|
+
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
55
44
|
|
|
56
45
|
const docs = {
|
|
57
46
|
source: {
|
|
@@ -164,7 +153,15 @@ cssClassVarianceUtilities.cvaMerge([
|
|
|
164
153
|
"after:opacity-50",
|
|
165
154
|
]);
|
|
166
155
|
|
|
167
|
-
const iconPalette =
|
|
156
|
+
const iconPalette = {
|
|
157
|
+
...uiDesignTokens.intentPalette,
|
|
158
|
+
...uiDesignTokens.generalPalette,
|
|
159
|
+
...uiDesignTokens.criticalityPalette,
|
|
160
|
+
...uiDesignTokens.activityPalette,
|
|
161
|
+
...uiDesignTokens.utilizationPalette,
|
|
162
|
+
...uiDesignTokens.sitesPalette,
|
|
163
|
+
...uiDesignTokens.rentalStatusPalette,
|
|
164
|
+
};
|
|
168
165
|
const iconColorNames = sharedUtils.objectKeys(iconPalette).map(key => stringTs.snakeCase(key));
|
|
169
166
|
const isSafari = () => {
|
|
170
167
|
const ua = navigator.userAgent.toLowerCase();
|
|
@@ -192,9 +189,9 @@ const Icon = ({ name, size = "large", className, dataTestId, color, onClick, typ
|
|
|
192
189
|
}, [type, size]);
|
|
193
190
|
const iconName = uiIcons.iconNames[name];
|
|
194
191
|
const href = React.useMemo(() => ({
|
|
195
|
-
solid: `${
|
|
196
|
-
outline: `${
|
|
197
|
-
mini: `${
|
|
192
|
+
solid: `${IconSpriteSolid}#${iconName}`,
|
|
193
|
+
outline: `${IconSpriteOutline}#${iconName}`,
|
|
194
|
+
mini: `${IconSpriteMini}#${iconName}`,
|
|
198
195
|
}), [iconName]);
|
|
199
196
|
React.useEffect(() => {
|
|
200
197
|
if (isSafari() && useTagRef.current) {
|
|
@@ -297,38 +294,6 @@ const PackageNameStoryComponent = ({ packageJSON }) => {
|
|
|
297
294
|
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] })] }));
|
|
298
295
|
};
|
|
299
296
|
|
|
300
|
-
/******************************************************************************
|
|
301
|
-
Copyright (c) Microsoft Corporation.
|
|
302
|
-
|
|
303
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
304
|
-
purpose with or without fee is hereby granted.
|
|
305
|
-
|
|
306
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
307
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
308
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
309
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
310
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
311
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
312
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
313
|
-
***************************************************************************** */
|
|
314
|
-
|
|
315
|
-
function __rest(s, e) {
|
|
316
|
-
var t = {};
|
|
317
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
318
|
-
t[p] = s[p];
|
|
319
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
320
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
321
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
322
|
-
t[p[i]] = s[p[i]];
|
|
323
|
-
}
|
|
324
|
-
return t;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
328
|
-
var e = new Error(message);
|
|
329
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
330
|
-
};
|
|
331
|
-
|
|
332
297
|
const cvaText = cssClassVarianceUtilities.cvaMerge(["text-black", "m-0", "relative", "text-sm", "font-normal"], {
|
|
333
298
|
variants: {
|
|
334
299
|
align: {
|
|
@@ -392,9 +357,9 @@ const cvaText = cssClassVarianceUtilities.cvaMerge(["text-black", "m-0", "relati
|
|
|
392
357
|
* @param {TextProps} props - The props for the Text component
|
|
393
358
|
* @returns {JSX.Element} Text component
|
|
394
359
|
*/
|
|
395
|
-
const Text = (
|
|
396
|
-
|
|
397
|
-
|
|
360
|
+
const Text = ({ children, type = "p", size = "medium", align = "left", weight = "normal", underline = false, inverted = false, subtle = false, italicize = false, uppercase = false, disabled = false, className, dataTestId, ...rest }) => {
|
|
361
|
+
return React__namespace.createElement(type, {
|
|
362
|
+
className: cvaText({
|
|
398
363
|
inverted,
|
|
399
364
|
uppercase,
|
|
400
365
|
align,
|
|
@@ -405,7 +370,10 @@ const Text = (_a) => {
|
|
|
405
370
|
subtle,
|
|
406
371
|
disabled,
|
|
407
372
|
className,
|
|
408
|
-
}),
|
|
373
|
+
}),
|
|
374
|
+
"data-testid": dataTestId,
|
|
375
|
+
...rest,
|
|
376
|
+
}, children);
|
|
409
377
|
};
|
|
410
378
|
|
|
411
379
|
const cvaSpinner = cssClassVarianceUtilities.cvaMerge([
|
|
@@ -710,30 +678,35 @@ const cvaIconButton = cssClassVarianceUtilities.cvaMerge([], {
|
|
|
710
678
|
* @param {ButtonProps} props - The props for the Button component
|
|
711
679
|
* @returns {JSX.Element} Button component
|
|
712
680
|
*/
|
|
713
|
-
const Button = React__namespace.forwardRef((
|
|
714
|
-
var { onClick, children, loading, disabled, className, fullWidth = false, prefix, suffix, variant = "primary", type = "button", size = "medium", square = false, dataTestId, title, role, tabIndex, asChild = false, circular } = _a, rest = __rest(_a, ["onClick", "children", "loading", "disabled", "className", "fullWidth", "prefix", "suffix", "variant", "type", "size", "square", "dataTestId", "title", "role", "tabIndex", "asChild", "circular"]);
|
|
681
|
+
const Button = React__namespace.forwardRef(({ onClick, children, loading, disabled, className, fullWidth = false, prefix, suffix, variant = "primary", type = "button", size = "medium", square = false, dataTestId, title, role, tabIndex, asChild = false, circular, ...rest }, ref) => {
|
|
715
682
|
const Comp = asChild ? reactSlot.Slot : "button";
|
|
716
|
-
const sharedCompProps =
|
|
683
|
+
const sharedCompProps = {
|
|
684
|
+
ref,
|
|
717
685
|
title,
|
|
718
686
|
role,
|
|
719
687
|
onClick,
|
|
720
|
-
tabIndex,
|
|
688
|
+
tabIndex,
|
|
689
|
+
className: cvaButton({ rounded: circular, disabled, size, square, variant, loading, fullWidth, className }),
|
|
690
|
+
"aria-label": title,
|
|
691
|
+
"aria-disabled": disabled || loading,
|
|
692
|
+
"data-testid": dataTestId,
|
|
693
|
+
...rest,
|
|
694
|
+
};
|
|
721
695
|
const buttonSpecificProps = {
|
|
722
696
|
disabled: disabled || loading,
|
|
723
697
|
type,
|
|
724
698
|
};
|
|
725
|
-
return (jsxRuntime.jsxs(Comp,
|
|
699
|
+
return (jsxRuntime.jsxs(Comp, { ...sharedCompProps, ...(asChild ? {} : buttonSpecificProps), children: [loading ? (jsxRuntime.jsx(Spinner, { centering: "vertically", className: cvaButtonSpinner({ variant }), containerClassName: cvaButtonSpinnerContainer(), size: "small" })) : null, prefix && !loading ? jsxRuntime.jsx("div", { className: cvaButtonPrefixSuffix({ size, variant }), children: prefix }) : null, jsxRuntime.jsx(reactSlot.Slottable, { children: children }), suffix && !loading ? jsxRuntime.jsx("div", { className: cvaButtonPrefixSuffix({ size, variant }), children: suffix }) : null] }));
|
|
726
700
|
});
|
|
727
701
|
Button.displayName = "Button";
|
|
728
702
|
|
|
729
703
|
/**
|
|
730
704
|
* Buttons are clickable elements that are used to trigger actions. They communicate calls to action to the user and allow users to interact with pages in a variety of ways. The Icon Button is a version of the standard Button component without the text label.
|
|
731
705
|
*/
|
|
732
|
-
const IconButton = React__namespace.forwardRef((
|
|
733
|
-
|
|
734
|
-
return (jsxRuntime.jsx(Button, Object.assign({ className: cvaIconButton({ size: size, className }), disabled: disabled || loading, loading: loading,
|
|
706
|
+
const IconButton = React__namespace.forwardRef(({ icon, size = "medium", square = true, loading, disabled, className, ...rest }, ref) => {
|
|
707
|
+
return (jsxRuntime.jsx(Button, { className: cvaIconButton({ size: size, className }), disabled: disabled || loading, loading: loading,
|
|
735
708
|
// eslint-disable-next-line local-rules/design-guideline-button-icon-size-match
|
|
736
|
-
prefix: !loading ? icon : undefined, ref: ref, size: size, square: square
|
|
709
|
+
prefix: !loading ? icon : undefined, ref: ref, size: size, square: square, ...rest }));
|
|
737
710
|
});
|
|
738
711
|
IconButton.displayName = "IconButton";
|
|
739
712
|
|
|
@@ -836,8 +809,7 @@ const cvaBadge = cssClassVarianceUtilities.cvaMerge([
|
|
|
836
809
|
* @param {BadgeProps} props - The props for the Badge component
|
|
837
810
|
* @returns {JSX.Element} Badge component
|
|
838
811
|
*/
|
|
839
|
-
const Badge = (
|
|
840
|
-
var { color = "primary", className, count, max, hideZero = false, dataTestId } = _a; __rest(_a, ["color", "className", "count", "max", "hideZero", "dataTestId"]);
|
|
812
|
+
const Badge = ({ color = "primary", className, count, max, hideZero = false, dataTestId, ...rest }) => {
|
|
841
813
|
if (hideZero && count === 0) {
|
|
842
814
|
return null;
|
|
843
815
|
}
|
|
@@ -910,7 +882,7 @@ const initLocalStorageState = ({ key, defaultState, schema, }) => {
|
|
|
910
882
|
const useLocalStorageEffect = ({ key, state, defaultState, schema, onValidationFailed, onValidationSuccessful, }) => {
|
|
911
883
|
const prevState = reactUse.usePrevious(state);
|
|
912
884
|
React.useEffect(() => {
|
|
913
|
-
if (
|
|
885
|
+
if (isEqual(prevState, state)) {
|
|
914
886
|
return;
|
|
915
887
|
}
|
|
916
888
|
if (schema) {
|
|
@@ -1415,8 +1387,8 @@ const BreadcrumbForLargeScreen = ({ dataTestId, breadcrumbItems }) => {
|
|
|
1415
1387
|
* BreadcrumbForMediumScreen is a helper component that renders the breadcrumb items for medium screens.
|
|
1416
1388
|
*/
|
|
1417
1389
|
const BreadcrumbForMediumScreen = ({ dataTestId, breadcrumbItems }) => {
|
|
1418
|
-
const [expanded, setExpanded] =
|
|
1419
|
-
const getReducedArray =
|
|
1390
|
+
const [expanded, setExpanded] = React.useState(false);
|
|
1391
|
+
const getReducedArray = React.useCallback(() => {
|
|
1420
1392
|
let reducedArrayElements = [];
|
|
1421
1393
|
const collapsibleButton = (jsxRuntime.jsxs("div", { className: cvaBreadcrumbItem(), children: [jsxRuntime.jsx(IconButton, { dataTestId: `collapsibleButton-${dataTestId}`, icon: jsxRuntime.jsx(Icon, { name: "EllipsisHorizontal", size: "small" }), onClick: () => setExpanded(true), size: "small", variant: "ghost-neutral" }), jsxRuntime.jsx(Icon, { color: "secondary", name: "Slash", size: "small" })] }));
|
|
1422
1394
|
const firstBreadcrumbItem = breadcrumbItems[0];
|
|
@@ -1597,9 +1569,8 @@ const ROLE_CARD = "region";
|
|
|
1597
1569
|
* @param {CardProps} props - The props for the Card component
|
|
1598
1570
|
* @returns {JSX.Element} Card component
|
|
1599
1571
|
*/
|
|
1600
|
-
const Card = (
|
|
1601
|
-
|
|
1602
|
-
return (jsxRuntime.jsx("div", Object.assign({ className: cvaCard({ fullHeight, clickable: Boolean(onClick), className }), "data-testid": dataTestId, onClick: onClick, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, role: ROLE_CARD }, rest, { children: children })));
|
|
1572
|
+
const Card = ({ children, onClick, fullHeight = false, onMouseEnter, onMouseLeave, className, dataTestId, ...rest }) => {
|
|
1573
|
+
return (jsxRuntime.jsx("div", { className: cvaCard({ fullHeight, clickable: Boolean(onClick), className }), "data-testid": dataTestId, onClick: onClick, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, role: ROLE_CARD, ...rest, children: children }));
|
|
1603
1574
|
};
|
|
1604
1575
|
|
|
1605
1576
|
/**
|
|
@@ -1667,15 +1638,18 @@ const cvaHeading = cssClassVarianceUtilities.cvaMerge(["m-0", "leading-normal",
|
|
|
1667
1638
|
* @param {HeadingProps} props - The props for the Heading component
|
|
1668
1639
|
* @returns {JSX.Element} Heading component
|
|
1669
1640
|
*/
|
|
1670
|
-
const Heading = (
|
|
1671
|
-
var { variant = "primary", inverted = false, subtle = false, className, dataTestId } = _a, rest = __rest(_a, ["variant", "inverted", "subtle", "className", "dataTestId"]);
|
|
1641
|
+
const Heading = ({ variant = "primary", inverted = false, subtle = false, className, dataTestId, ...rest }) => {
|
|
1672
1642
|
const semanticType = {
|
|
1673
1643
|
primary: "h1",
|
|
1674
1644
|
secondary: "h2",
|
|
1675
1645
|
tertiary: "h3",
|
|
1676
1646
|
subtitle: "h4",
|
|
1677
1647
|
};
|
|
1678
|
-
return React__namespace.createElement(semanticType[variant],
|
|
1648
|
+
return React__namespace.createElement(semanticType[variant], {
|
|
1649
|
+
...rest,
|
|
1650
|
+
className: cvaHeading({ subtle, inverted, size: variant, className }),
|
|
1651
|
+
"data-testid": dataTestId,
|
|
1652
|
+
});
|
|
1679
1653
|
};
|
|
1680
1654
|
|
|
1681
1655
|
/**
|
|
@@ -1787,16 +1761,15 @@ const Collapsible = ({ children, expanded, id }) => {
|
|
|
1787
1761
|
* @param {boolean} props.warning - Indicates if the process has a warning.
|
|
1788
1762
|
* @param {boolean} props.success - Indicates if the process was successful.
|
|
1789
1763
|
*/
|
|
1790
|
-
const CompletionStatusIndicator = (
|
|
1791
|
-
var { loading, error, success } = _a, rest = __rest(_a, ["loading", "error", "success"]);
|
|
1764
|
+
const CompletionStatusIndicator = ({ loading, error, success, ...rest }) => {
|
|
1792
1765
|
if (loading) {
|
|
1793
|
-
return jsxRuntime.jsx(Spinner,
|
|
1766
|
+
return jsxRuntime.jsx(Spinner, { className: "h-[22px] w-[22px]", containerClassName: "w-min", ...rest });
|
|
1794
1767
|
}
|
|
1795
1768
|
if (error) {
|
|
1796
|
-
return jsxRuntime.jsx(Icon,
|
|
1769
|
+
return jsxRuntime.jsx(Icon, { color: "danger", name: "XCircle", type: "solid", ...rest });
|
|
1797
1770
|
}
|
|
1798
1771
|
if (success) {
|
|
1799
|
-
return jsxRuntime.jsx(Icon,
|
|
1772
|
+
return jsxRuntime.jsx(Icon, { color: "success", name: "CheckCircle", type: "solid", ...rest });
|
|
1800
1773
|
}
|
|
1801
1774
|
return null;
|
|
1802
1775
|
};
|
|
@@ -3324,8 +3297,7 @@ const ExternalLink = ({ rel = "noreferrer", target = "_blank", href, className,
|
|
|
3324
3297
|
* @param {PopoverProps} options The options for the popover
|
|
3325
3298
|
* @returns {ReturnType<typeof usePopover>} The data for the popover
|
|
3326
3299
|
*/
|
|
3327
|
-
const usePopover = (
|
|
3328
|
-
var { initialOpen = false, placement = "bottom", isModal, isOpen: controlledIsOpen, activation = { click: true, hover: false }, dismissal, onOpenStateChange } = _a, restOptions = __rest(_a, ["initialOpen", "placement", "isModal", "isOpen", "activation", "dismissal", "onOpenStateChange"]);
|
|
3300
|
+
const usePopover = ({ initialOpen = false, placement = "bottom", isModal, isOpen: controlledIsOpen, activation = { click: true, hover: false }, dismissal, onOpenStateChange, ...restOptions }) => {
|
|
3329
3301
|
const [uncontrolledIsOpen, setUncontrolledIsOpen] = React.useState(initialOpen);
|
|
3330
3302
|
const [labelId, setLabelId] = React.useState();
|
|
3331
3303
|
const [descriptionId, setDescriptionId] = React.useState();
|
|
@@ -3363,11 +3335,25 @@ const usePopover = (_a) => {
|
|
|
3363
3335
|
dismissInteraction,
|
|
3364
3336
|
roleInteraction,
|
|
3365
3337
|
]);
|
|
3366
|
-
return React.useMemo(() => (
|
|
3338
|
+
return React.useMemo(() => ({
|
|
3339
|
+
isOpen,
|
|
3340
|
+
setIsOpen: setUncontrolledIsOpen,
|
|
3341
|
+
...omit(popoverData, "middlewareData", "floatingStyles", "elements"),
|
|
3342
|
+
x: popoverData.x,
|
|
3343
|
+
y: popoverData.y,
|
|
3344
|
+
isPositioned: popoverData.isPositioned,
|
|
3345
|
+
refs: popoverData.refs,
|
|
3346
|
+
update: popoverData.update,
|
|
3347
|
+
placement: popoverData.placement,
|
|
3348
|
+
strategy: popoverData.strategy,
|
|
3349
|
+
...combinedInteractions,
|
|
3350
|
+
isModal,
|
|
3367
3351
|
labelId,
|
|
3368
3352
|
descriptionId,
|
|
3369
3353
|
setLabelId,
|
|
3370
|
-
setDescriptionId,
|
|
3354
|
+
setDescriptionId,
|
|
3355
|
+
customProps: restOptions,
|
|
3356
|
+
}), [isOpen, setUncontrolledIsOpen, combinedInteractions, popoverData, isModal, labelId, descriptionId, restOptions]);
|
|
3371
3357
|
};
|
|
3372
3358
|
|
|
3373
3359
|
const PopoverContext = React.createContext(null);
|
|
@@ -3397,9 +3383,8 @@ const usePopoverContext = () => {
|
|
|
3397
3383
|
* @param {PopoverProps} props The props for the popover
|
|
3398
3384
|
* @returns {JSX.Element} A Popover Context Provider containing the children
|
|
3399
3385
|
*/
|
|
3400
|
-
const Popover = (
|
|
3401
|
-
|
|
3402
|
-
const popover = usePopover(Object.assign({ isModal }, restOptions));
|
|
3386
|
+
const Popover = ({ children, isModal = false, ...restOptions }) => {
|
|
3387
|
+
const popover = usePopover({ isModal, ...restOptions });
|
|
3403
3388
|
return jsxRuntime.jsx(PopoverContext.Provider, { value: popover, children: children });
|
|
3404
3389
|
};
|
|
3405
3390
|
|
|
@@ -3414,12 +3399,17 @@ const cvaPopoverTitleContainer = cssClassVarianceUtilities.cvaMerge(["flex", "it
|
|
|
3414
3399
|
});
|
|
3415
3400
|
const cvaPopoverTitleText = cssClassVarianceUtilities.cvaMerge(["flex-1", "text-neutral-500"]);
|
|
3416
3401
|
|
|
3417
|
-
const PopoverContent =
|
|
3418
|
-
var
|
|
3419
|
-
|
|
3420
|
-
const _c = usePopoverContext(), { context: floatingContext, customProps } = _c, context = __rest(_c, ["context", "customProps"]);
|
|
3402
|
+
const PopoverContent = React.forwardRef(function PopoverContent({ className, dataTestId, children, portalId, ...props }, propRef) {
|
|
3403
|
+
var _a;
|
|
3404
|
+
const { context: floatingContext, customProps, ...context } = usePopoverContext();
|
|
3421
3405
|
const ref = react.useMergeRefs([context.refs.setFloating, propRef]);
|
|
3422
|
-
return (jsxRuntime.jsx(react.FloatingPortal, { id: portalId !== null && portalId !== void 0 ? portalId : "tu-floating-ui", children: context.isOpen ? (jsxRuntime.jsx(react.FloatingFocusManager, { closeOnFocusOut: false, context: floatingContext, guards: false, modal: context.isModal, order: ["reference", "content"], returnFocus: false, children: jsxRuntime.jsx("div",
|
|
3406
|
+
return (jsxRuntime.jsx(react.FloatingPortal, { id: portalId !== null && portalId !== void 0 ? portalId : "tu-floating-ui", children: context.isOpen ? (jsxRuntime.jsx(react.FloatingFocusManager, { closeOnFocusOut: false, context: floatingContext, guards: false, modal: context.isModal, order: ["reference", "content"], returnFocus: false, children: jsxRuntime.jsx("div", { "aria-describedby": context.descriptionId, "aria-labelledby": context.labelId, className: cvaPopoverContainer({ className: className !== null && className !== void 0 ? className : customProps.className }), "data-testid": (_a = dataTestId !== null && dataTestId !== void 0 ? dataTestId : customProps.dataTestId) !== null && _a !== void 0 ? _a : "popover-content", ref: ref, style: {
|
|
3407
|
+
position: context.strategy,
|
|
3408
|
+
top: context.y,
|
|
3409
|
+
left: context.x,
|
|
3410
|
+
width: "max-content",
|
|
3411
|
+
...props.style,
|
|
3412
|
+
}, ...context.getFloatingProps(props), children: typeof children === "function" ? children(() => context.setIsOpen(false)) : children }) })) : null }));
|
|
3423
3413
|
});
|
|
3424
3414
|
|
|
3425
3415
|
/**
|
|
@@ -3432,17 +3422,21 @@ const PopoverTitle = ({ children, action, divider = false, className, dataTestId
|
|
|
3432
3422
|
return (jsxRuntime.jsxs("div", { className: cvaPopoverTitleContainer({ divider, className }), "data-testid": dataTestId, children: [jsxRuntime.jsx(Text, { className: cvaPopoverTitleText(), size: "small", subtle: true, type: "div", uppercase: true, weight: "bold", children: children }), action] }));
|
|
3433
3423
|
};
|
|
3434
3424
|
|
|
3435
|
-
const PopoverTrigger = React.forwardRef(function PopoverTrigger(
|
|
3436
|
-
var { children, renderButton } = _a, props = __rest(_a, ["children", "renderButton"]);
|
|
3425
|
+
const PopoverTrigger = React.forwardRef(function PopoverTrigger({ children, renderButton, ...props }, propRef) {
|
|
3437
3426
|
const context = usePopoverContext();
|
|
3438
3427
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any, local-rules/no-typescript-assertion
|
|
3439
3428
|
const childrenRef = children.ref;
|
|
3440
3429
|
const ref = react.useMergeRefs([context.refs.setReference, propRef, childrenRef]);
|
|
3441
3430
|
if (!renderButton && React.isValidElement(children)) {
|
|
3442
|
-
return React.cloneElement(children, context.getReferenceProps(
|
|
3431
|
+
return React.cloneElement(children, context.getReferenceProps({
|
|
3432
|
+
ref,
|
|
3433
|
+
...props,
|
|
3434
|
+
...children.props,
|
|
3435
|
+
"data-state": context.isOpen ? "open" : "closed",
|
|
3436
|
+
}));
|
|
3443
3437
|
}
|
|
3444
3438
|
else {
|
|
3445
|
-
return (jsxRuntime.jsx(Button,
|
|
3439
|
+
return (jsxRuntime.jsx(Button, { "data-state": context.isOpen ? "open" : "closed", ref: ref, type: "button", ...context.getReferenceProps(props), children: children }));
|
|
3446
3440
|
}
|
|
3447
3441
|
});
|
|
3448
3442
|
|
|
@@ -3534,7 +3528,7 @@ const Tooltip = ({ children, dataTestId = "tool-tip", disabled, className, label
|
|
|
3534
3528
|
if (disabled) {
|
|
3535
3529
|
return wrappedChildren;
|
|
3536
3530
|
}
|
|
3537
|
-
return (jsxRuntime.jsxs(Popover, { activation: { hover: true }, className: cvaTooltipPopover(), dataTestId: dataTestId, placement: placement === "auto" ? "bottom" : placement, children: [jsxRuntime.jsx(PopoverTrigger, { className: cvaTooltipIcon({ color: mode, className }), "data-testid": dataTestId ? `${dataTestId}-trigger` : null, onMouseEnter: () => setIsOpen(true), onMouseLeave: () => setIsOpen(false), ref: refs.setReference, children: children === undefined ? (jsxRuntime.jsx("div", { children: jsxRuntime.jsx(Icon,
|
|
3531
|
+
return (jsxRuntime.jsxs(Popover, { activation: { hover: true }, className: cvaTooltipPopover(), dataTestId: dataTestId, placement: placement === "auto" ? "bottom" : placement, children: [jsxRuntime.jsx(PopoverTrigger, { className: cvaTooltipIcon({ color: mode, className }), "data-testid": dataTestId ? `${dataTestId}-trigger` : null, onMouseEnter: () => setIsOpen(true), onMouseLeave: () => setIsOpen(false), ref: refs.setReference, children: children === undefined ? (jsxRuntime.jsx("div", { children: jsxRuntime.jsx(Icon, { dataTestId: dataTestId ? `${dataTestId}-icon` : undefined, name: "QuestionMarkCircle", size: "small", ...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: typeof label === "string" ? "p" : "span", children: label }), placement !== "auto" && jsxRuntime.jsx(FloatingArrowContainer, { arrowRef: arrowRef, mode: mode })] }) }) })) : null] }));
|
|
3538
3532
|
};
|
|
3539
3533
|
|
|
3540
3534
|
const cvaIndicator = cssClassVarianceUtilities.cvaMerge(["flex", "items-center"]);
|
|
@@ -3635,9 +3629,8 @@ const cvaIndicatorIconBackground = cssClassVarianceUtilities.cvaMerge(["rounded-
|
|
|
3635
3629
|
* @param {IndicatorProps} props - The props for the Indicator component
|
|
3636
3630
|
* @returns {JSX.Element} Indicator component
|
|
3637
3631
|
*/
|
|
3638
|
-
const Indicator = (
|
|
3639
|
-
|
|
3640
|
-
return (jsxRuntime.jsx(Tooltip, { className: className, disabled: withLabel, label: label, placement: "bottom", children: jsxRuntime.jsxs("div", Object.assign({ "aria-label": label, className: cvaIndicator(), "data-testid": dataTestId }, 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] })) }));
|
|
3632
|
+
const Indicator = ({ dataTestId, icon, label, color = "unknown", withBackground = true, withLabel = true, ping = false, className, ...rest }) => {
|
|
3633
|
+
return (jsxRuntime.jsx(Tooltip, { className: className, disabled: withLabel, label: label, placement: "bottom", children: jsxRuntime.jsxs("div", { "aria-label": label, className: cvaIndicator(), "data-testid": dataTestId, ...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] }) }));
|
|
3641
3634
|
};
|
|
3642
3635
|
|
|
3643
3636
|
const cvaKPICardContainer = cssClassVarianceUtilities.cvaMerge(["inline-flex"], {
|
|
@@ -3688,13 +3681,12 @@ const LoadingContent = () => (jsxRuntime.jsxs("div", { className: "flex flex-row
|
|
|
3688
3681
|
* @param {KPICardProps} props - The props for the KPICard component
|
|
3689
3682
|
* @returns {JSX.Element} KPICard component
|
|
3690
3683
|
*/
|
|
3691
|
-
const KPICard = (
|
|
3692
|
-
var { asChild = false, title, value, loading, unit, iconName, iconBackgroundColor, className, dataTestId, tooltipLabel, isActive, onClick } = _a, rest = __rest(_a, ["asChild", "title", "value", "loading", "unit", "iconName", "iconBackgroundColor", "className", "dataTestId", "tooltipLabel", "isActive", "onClick"]);
|
|
3684
|
+
const KPICard = ({ asChild = false, title, value, loading, unit, iconName, iconBackgroundColor, className, dataTestId, tooltipLabel, isActive, onClick, ...rest }) => {
|
|
3693
3685
|
const Comp = asChild ? reactSlot.Slot : "div";
|
|
3694
3686
|
const CardContent = () => {
|
|
3695
3687
|
return (jsxRuntime.jsx(Card, { className: cvaKPICard({ isClickable: Boolean((onClick || asChild) && !loading), isActive }), children: loading ? (jsxRuntime.jsx(LoadingContent, {})) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [iconName ? (jsxRuntime.jsx("div", { className: cvaKPICardIconContainer({ backgroundColor: iconBackgroundColor }), "data-testid": `${dataTestId}-icon-container`, children: jsxRuntime.jsx(Icon, { color: "white", dataTestId: `${dataTestId}-icon`, name: iconName, size: "medium" }) })) : null, jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(Text, { dataTestId: `${dataTestId}-title`, subtle: true, weight: "bold", children: title }), jsxRuntime.jsxs(Text, { dataTestId: `${dataTestId}-value`, size: "large", weight: "bold", children: [value, " ", unit] })] })] })) }));
|
|
3696
3688
|
};
|
|
3697
|
-
return (jsxRuntime.jsxs(Comp,
|
|
3689
|
+
return (jsxRuntime.jsxs(Comp, { className: cvaKPICardContainer({ className, isClickable: Boolean(asChild || onClick) }), "data-testid": `${dataTestId}-comp`, onClick: onClick, ...rest, children: [tooltipLabel ? (jsxRuntime.jsx(Tooltip, { className: "w-full", label: tooltipLabel, placement: "bottom", children: jsxRuntime.jsx(CardContent, {}) })) : (jsxRuntime.jsx(CardContent, {})), !loading && jsxRuntime.jsx(reactSlot.Slottable, { children: rest.children })] }));
|
|
3698
3690
|
};
|
|
3699
3691
|
|
|
3700
3692
|
const cvaMenuItem = cssClassVarianceUtilities.cvaMerge([
|
|
@@ -3773,7 +3765,7 @@ const cvaMenuItemPrefix = cssClassVarianceUtilities.cvaMerge(["self-center", "fl
|
|
|
3773
3765
|
*/
|
|
3774
3766
|
const MenuItem = ({ className, dataTestId, label, size, children, selected, focused, prefix, suffix, disabled, onClick, stopPropagation = true, id, tabIndex, }) => {
|
|
3775
3767
|
const containerProps = useContainerProps({ className, dataTestId: dataTestId || "menu-item" });
|
|
3776
|
-
return (jsxRuntime.jsxs("div",
|
|
3768
|
+
return (jsxRuntime.jsxs("div", { ...containerProps, className: cvaMenuItem({
|
|
3777
3769
|
selected,
|
|
3778
3770
|
focused,
|
|
3779
3771
|
disabled,
|
|
@@ -3782,7 +3774,7 @@ const MenuItem = ({ className, dataTestId, label, size, children, selected, focu
|
|
|
3782
3774
|
}), id: id, onClick: e => {
|
|
3783
3775
|
stopPropagation && e.stopPropagation();
|
|
3784
3776
|
onClick && onClick(e);
|
|
3785
|
-
}, tabIndex: tabIndex !== null && tabIndex !== void 0 ? 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] }))
|
|
3777
|
+
}, tabIndex: tabIndex !== null && tabIndex !== void 0 ? 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] }));
|
|
3786
3778
|
};
|
|
3787
3779
|
|
|
3788
3780
|
const cvaMenuList = cssClassVarianceUtilities.cvaMerge(["shadow-md", "rounded-lg", "z-20", "bg-white", "p-1", "border", "border-slate-300", "gap-1", "grid"], {
|
|
@@ -3806,8 +3798,7 @@ const cvaMenuListDivider = cssClassVarianceUtilities.cvaMerge([
|
|
|
3806
3798
|
* @param {MenuListProps} props - The props for the MenuList component
|
|
3807
3799
|
* @returns {JSX.Element} MenuList component
|
|
3808
3800
|
*/
|
|
3809
|
-
const MenuList = (
|
|
3810
|
-
var { dataTestId, className, children, withStickyHeader = false, showDivider = false } = _a, args = __rest(_a, ["dataTestId", "className", "children", "withStickyHeader", "showDivider"]);
|
|
3801
|
+
const MenuList = ({ dataTestId, className, children, withStickyHeader = false, showDivider = false, ...args }) => {
|
|
3811
3802
|
const childrenArr = React.Children.toArray(children);
|
|
3812
3803
|
const isLastItem = (index) => index === childrenArr.length - 1;
|
|
3813
3804
|
return (jsxRuntime.jsx("div", { className: cvaMenuList({ stickyHeader: withStickyHeader, className }), "data-testid": dataTestId, onClick: args.onClick, role: "list", tabIndex: 0, children: React.Children.map(childrenArr, (menuItem, index) => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [menuItem, showDivider && !isLastItem(index) ? jsxRuntime.jsx("hr", { className: cvaMenuListDivider() }) : null] }))) }));
|
|
@@ -3831,7 +3822,7 @@ const MoreMenu = ({ className, dataTestId, popoverProps, iconProps = {
|
|
|
3831
3822
|
variant: "secondary",
|
|
3832
3823
|
}, customButton, customPortalId, children, }) => {
|
|
3833
3824
|
const actionMenuRef = React.useRef(null);
|
|
3834
|
-
return (jsxRuntime.jsx("div", { className: cvaMoreMenu({ className }), "data-testid": dataTestId, ref: actionMenuRef, children: jsxRuntime.jsxs(Popover,
|
|
3825
|
+
return (jsxRuntime.jsx("div", { className: cvaMoreMenu({ className }), "data-testid": dataTestId, ref: actionMenuRef, children: jsxRuntime.jsxs(Popover, { ...popoverProps, children: [jsxRuntime.jsx(PopoverTrigger, { children: customButton !== null && customButton !== void 0 ? customButton : jsxRuntime.jsx(IconButton, { ...iconButtonProps, icon: jsxRuntime.jsx(Icon, { name: "EllipsisHorizontal", ...iconProps }) }) }), jsxRuntime.jsx(PopoverContent, { portalId: customPortalId, children: close => (typeof children === "function" ? children(close) : children) })] }) }));
|
|
3835
3826
|
};
|
|
3836
3827
|
|
|
3837
3828
|
const cvaNotice = cssClassVarianceUtilities.cvaMerge(["flex", "items-center"]);
|
|
@@ -3884,9 +3875,8 @@ const cvaNoticeIcon = cssClassVarianceUtilities.cvaMerge(["rounded-full", "items
|
|
|
3884
3875
|
* @param {NoticeProps} props - The props for the Notice component
|
|
3885
3876
|
* @returns {JSX.Element} Notice component
|
|
3886
3877
|
*/
|
|
3887
|
-
const Notice = (
|
|
3888
|
-
|
|
3889
|
-
return (jsxRuntime.jsx(Tooltip, { className: className, disabled: !withTooltip, label: tooltipLabel, placement: "bottom", children: jsxRuntime.jsxs("div", Object.assign({ "aria-label": label, className: cvaNotice(), "data-testid": dataTestId }, rest, { children: [jsxRuntime.jsx("div", { className: cvaNoticeIcon({ color }), "data-testid": dataTestId ? `${dataTestId}-icon` : "notice-icon", children: icon }), label !== undefined && withLabel ? (jsxRuntime.jsx("div", { className: cvaNoticeLabel({ color }), "data-testid": dataTestId ? `${dataTestId}-label` : "notice-label", children: label })) : null] })) }));
|
|
3878
|
+
const Notice = ({ dataTestId, icon, label, color = "neutral", withLabel = true, className, tooltipLabel = label, withTooltip = false, ...rest }) => {
|
|
3879
|
+
return (jsxRuntime.jsx(Tooltip, { className: className, disabled: !withTooltip, label: tooltipLabel, placement: "bottom", children: jsxRuntime.jsxs("div", { "aria-label": label, className: cvaNotice(), "data-testid": dataTestId, ...rest, children: [jsxRuntime.jsx("div", { className: cvaNoticeIcon({ color }), "data-testid": dataTestId ? `${dataTestId}-icon` : "notice-icon", children: icon }), label !== undefined && withLabel ? (jsxRuntime.jsx("div", { className: cvaNoticeLabel({ color }), "data-testid": dataTestId ? `${dataTestId}-label` : "notice-label", children: label })) : null] }) }));
|
|
3890
3880
|
};
|
|
3891
3881
|
|
|
3892
3882
|
const cvaPage = cssClassVarianceUtilities.cvaMerge(["grid", "h-full"], {
|
|
@@ -4142,7 +4132,7 @@ const useOverflowItems = ({ threshold = 1, childUniqueIdentifierAttribute = "id"
|
|
|
4142
4132
|
updatedEntries[targetElementId] = entry.isIntersecting ? false : true;
|
|
4143
4133
|
}
|
|
4144
4134
|
});
|
|
4145
|
-
setItemOverflowMap(prev => (
|
|
4135
|
+
setItemOverflowMap(prev => ({ ...prev, ...updatedEntries }));
|
|
4146
4136
|
}, [childUniqueIdentifierAttribute]);
|
|
4147
4137
|
const observe = React.useCallback(() => {
|
|
4148
4138
|
const node = overflowContainerRef.current;
|
|
@@ -4199,16 +4189,16 @@ const Sidebar = ({ childContainerClassName, children, breakpoint = "lg", classNa
|
|
|
4199
4189
|
}
|
|
4200
4190
|
return "visible";
|
|
4201
4191
|
};
|
|
4202
|
-
return (jsxRuntime.jsxs("div", { className: cvaSidebar({ className }), "data-testid": dataTestId, children: [jsxRuntime.jsx("div", { className: cvaSidebarChildContainer({ breakpoint, className: childContainerClassName }), "data-testid": dataTestId ? `${dataTestId}-child-container` : null, ref: overflowContainerRef, children:
|
|
4203
|
-
return
|
|
4192
|
+
return (jsxRuntime.jsxs("div", { className: cvaSidebar({ className }), "data-testid": dataTestId, children: [jsxRuntime.jsx("div", { className: cvaSidebarChildContainer({ breakpoint, className: childContainerClassName }), "data-testid": dataTestId ? `${dataTestId}-child-container` : null, ref: overflowContainerRef, children: React.Children.map(children, child => {
|
|
4193
|
+
return React.cloneElement(child, {
|
|
4204
4194
|
className: tailwindMerge.twMerge(child.props.className, itemVisibilityClassName(child.props.id)),
|
|
4205
4195
|
});
|
|
4206
|
-
}) }), overflowItemCount > 0 ? (jsxRuntime.jsx(MoreMenu,
|
|
4196
|
+
}) }), overflowItemCount > 0 ? (jsxRuntime.jsx(MoreMenu, { iconButtonProps: {
|
|
4207
4197
|
circular: false,
|
|
4208
4198
|
variant: "ghost-neutral",
|
|
4209
|
-
}, popoverProps: { placement: "bottom-end" }
|
|
4199
|
+
}, popoverProps: { placement: "bottom-end" }, ...moreMenuProps, className: tailwindMerge.twMerge(moreMenuProps === null || moreMenuProps === void 0 ? void 0 : moreMenuProps.className, "!p-0"), dataTestId: dataTestId ? `${dataTestId}-more-menu` : undefined, children: close => (jsxRuntime.jsx(MenuList, { ...menuListProps, dataTestId: dataTestId ? `${dataTestId}-menu-list` : undefined, children: React.Children.map(children, child => {
|
|
4210
4200
|
return itemOverflowMap[child.props.id]
|
|
4211
|
-
?
|
|
4201
|
+
? React.cloneElement(child, {
|
|
4212
4202
|
onClick: () => {
|
|
4213
4203
|
var _a, _b;
|
|
4214
4204
|
(_b = (_a = child.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
@@ -4216,7 +4206,7 @@ const Sidebar = ({ childContainerClassName, children, breakpoint = "lg", classNa
|
|
|
4216
4206
|
},
|
|
4217
4207
|
})
|
|
4218
4208
|
: null;
|
|
4219
|
-
}) }))
|
|
4209
|
+
}) })) })) : null] }));
|
|
4220
4210
|
};
|
|
4221
4211
|
|
|
4222
4212
|
const cvaTabsRoot = cssClassVarianceUtilities.cvaMerge([]);
|
|
@@ -4270,35 +4260,37 @@ const cvaTab = cssClassVarianceUtilities.cvaMerge([
|
|
|
4270
4260
|
* Wrapper for radix tab component.
|
|
4271
4261
|
* We add a custom implementation of the asChild prop to make it easy to make the child element look like other tabs.
|
|
4272
4262
|
*/
|
|
4273
|
-
const Tab = (
|
|
4274
|
-
|
|
4275
|
-
const
|
|
4276
|
-
|
|
4277
|
-
|
|
4263
|
+
const Tab = ({ value, isFullWidth = false, iconName, dataTestId, className, children, suffix, asChild, appendTabStylesToChildIfAsChild = true, ...rest }) => {
|
|
4264
|
+
const renderContent = () => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [iconName ? jsxRuntime.jsx(Icon, { name: iconName, size: "small" }) : null, React.isValidElement(children) ? children.props.children : children, suffix] }));
|
|
4265
|
+
const commonProps = {
|
|
4266
|
+
className: appendTabStylesToChildIfAsChild ? cvaTab({ className, isFullWidth }) : className,
|
|
4267
|
+
...rest,
|
|
4268
|
+
};
|
|
4269
|
+
return (jsxRuntime.jsx(reactTabs.Trigger, { asChild: true, value: value, children: asChild && typeof children !== "string" ? (React.cloneElement(children, {
|
|
4270
|
+
...commonProps,
|
|
4271
|
+
children: renderContent(),
|
|
4272
|
+
})) : (jsxRuntime.jsx("button", { ...commonProps, "data-testid": dataTestId, children: renderContent() })) }));
|
|
4278
4273
|
};
|
|
4279
4274
|
|
|
4280
4275
|
/**
|
|
4281
4276
|
* Wrapper for radix tab content component.
|
|
4282
4277
|
*/
|
|
4283
|
-
const TabContent = (
|
|
4284
|
-
|
|
4285
|
-
return (jsxRuntime.jsx(reactTabs.Content, Object.assign({ className: cvaTabContent({ className }), "data-testid": dataTestId ? `${dataTestId}-content` : undefined }, rest, { children: children })));
|
|
4278
|
+
const TabContent = ({ className, dataTestId, children, ...rest }) => {
|
|
4279
|
+
return (jsxRuntime.jsx(reactTabs.Content, { className: cvaTabContent({ className }), "data-testid": dataTestId ? `${dataTestId}-content` : undefined, ...rest, children: children }));
|
|
4286
4280
|
};
|
|
4287
4281
|
|
|
4288
4282
|
/**
|
|
4289
4283
|
* Wrapper for radix tab list component.
|
|
4290
4284
|
*/
|
|
4291
|
-
const TabList = (
|
|
4292
|
-
|
|
4293
|
-
return (jsxRuntime.jsx(reactTabs.List, Object.assign({ className: cvaTabList({ className }), "data-testid": dataTestId }, rest, { children: children })));
|
|
4285
|
+
const TabList = ({ className, dataTestId, children, ...rest }) => {
|
|
4286
|
+
return (jsxRuntime.jsx(reactTabs.List, { className: cvaTabList({ className }), "data-testid": dataTestId, ...rest, children: children }));
|
|
4294
4287
|
};
|
|
4295
4288
|
|
|
4296
4289
|
/**
|
|
4297
4290
|
* Tabs are used to group different but related content, allowing users to navigate views without leaving the page. They always contain at least two items and one tab is active at a time. Tabs can be used on full page layouts or in components such as modals or tables.
|
|
4298
4291
|
*/
|
|
4299
|
-
const Tabs = (
|
|
4300
|
-
|
|
4301
|
-
return (jsxRuntime.jsx(reactTabs.Root, Object.assign({ className: cvaTabsRoot({ className }), "data-testid": dataTestId }, rest, { children: children })));
|
|
4292
|
+
const Tabs = ({ children, forceRender, className, dataTestId, fullWidth, ...rest }) => {
|
|
4293
|
+
return (jsxRuntime.jsx(reactTabs.Root, { className: cvaTabsRoot({ className }), "data-testid": dataTestId, ...rest, children: children }));
|
|
4302
4294
|
};
|
|
4303
4295
|
|
|
4304
4296
|
const cvaTimeline = cssClassVarianceUtilities.cvaMerge("ml-4");
|