@trackunit/react-components 0.1.14 → 0.1.17
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.js
CHANGED
|
@@ -99,7 +99,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
99
99
|
* @returns {JSX.Element} Spinner component
|
|
100
100
|
*/
|
|
101
101
|
const Spinner = ({ mode = "light", size = "medium", centered = false, className, containerClassName, dataTestId, }) => {
|
|
102
|
-
return (jsx(Container$
|
|
102
|
+
return (jsx(Container$9, Object.assign({ "$mode": mode, "$centered": centered, className: containerClassName }, { children: jsx(StyledSpinner$1, { "$size": size, "$mode": mode, role: "spinbutton", className: className, "data-testid": dataTestId }) })));
|
|
103
103
|
};
|
|
104
104
|
const getSpinnerStyles = () => ({ $size }) => {
|
|
105
105
|
switch ($size) {
|
|
@@ -117,7 +117,7 @@ const StyledSpinner$1 = tw.span `
|
|
|
117
117
|
${p => (p.$mode === "dark" ? tws `tu-spinner--dark` : null)}
|
|
118
118
|
${getSpinnerStyles()}
|
|
119
119
|
`;
|
|
120
|
-
const Container$
|
|
120
|
+
const Container$9 = tw.div `
|
|
121
121
|
tu-spinner--container
|
|
122
122
|
${p => (p.$centered ? tws `tu-spinner--container-centered` : null)}
|
|
123
123
|
`;
|
|
@@ -226,12 +226,12 @@ const Icon$1 = ({ name, size = "large", className, dataTestId, color, onClick, f
|
|
|
226
226
|
if (!IconComponent) {
|
|
227
227
|
return null;
|
|
228
228
|
}
|
|
229
|
-
return (jsx(React.Suspense, Object.assign({ fallback: jsx(LoadingDot, { className: iconSizeClassName }) }, { children: jsx(Root$
|
|
229
|
+
return (jsx(React.Suspense, Object.assign({ fallback: jsx(LoadingDot, { className: iconSizeClassName }) }, { children: jsx(Root$9, Object.assign({ "$color": color, onClick: onClick, "data-testid": dataTestId, ref: forwardedRef }, { children: jsx(IconComponent, { "data-testid": dataTestId ? `${dataTestId}-${name}` : name, className: `${iconSizeClassName} ${colorClassNames} ${className !== null && className !== void 0 ? className : ""} ${name} aspect-square`, style: fillColor ? Object.assign(Object.assign({}, style), { fill: fillColor }) : Object.assign({}, style) }) })) })));
|
|
230
230
|
};
|
|
231
231
|
const LoadingDot = tw.span `
|
|
232
232
|
tu-loading-dot
|
|
233
233
|
`;
|
|
234
|
-
const Root$
|
|
234
|
+
const Root$9 = tw.span `
|
|
235
235
|
tu-icon
|
|
236
236
|
${({ $color }) => {
|
|
237
237
|
switch ($color) {
|
|
@@ -428,7 +428,7 @@ const Alert = ({ color = "info", title, className, children, primaryAction, seco
|
|
|
428
428
|
ref && ref.current && ref.current.scrollIntoView && ref.current.scrollIntoView();
|
|
429
429
|
}
|
|
430
430
|
}, [ref, autoScroll]);
|
|
431
|
-
return (jsxs(Container$
|
|
431
|
+
return (jsxs(Container$8, Object.assign({ "$color": color, className: className, "data-testid": dataTestId, "$inline": inline, ref: ref, role: "alert" }, { children: [jsx(IconContainer$1, Object.assign({ "$inline": inline }, { children: getIconFromColor() })), jsxs(Content$1, Object.assign({ "$inline": inline }, { children: [jsxs(ContentDetails, { children: [jsx(ContentBody, { children: body }), onClose && !inline ? (jsx(CloseButtonContainer, Object.assign({ "$inline": inline }, { children: jsx(IconButton, { size: "small", variant: "transparent", color: "secondary", onClick: onClose, icon: jsx(Icon$1, { name: "XIcon", size: "small" }), title: "Close Alert", circular: true }) }))) : null] }), (primaryAction || secondaryAction || onClose) && (jsxs(RightAligned, Object.assign({ "$inline": inline }, { children: [secondaryAction && (jsx(Button, Object.assign({ size: "small", variant: "transparent", color: getButtonColor(), onClick: secondaryAction.onClick, loading: secondaryAction === null || secondaryAction === void 0 ? void 0 : secondaryAction.loading }, { children: secondaryAction.label }))), primaryAction && (jsx(Button, Object.assign({ size: "small", color: getButtonColor(), onClick: primaryAction.onClick, loading: primaryAction === null || primaryAction === void 0 ? void 0 : primaryAction.loading }, { children: primaryAction.label }))), onClose && inline ? (jsx(CloseButtonContainer, Object.assign({ "$inline": inline }, { children: jsx(IconButton, { size: "small", variant: "transparent", color: "secondary", onClick: onClose, icon: jsx(Icon$1, { name: "XIcon", size: "small" }), title: "Close Alert", circular: true }) }))) : null] })))] }))] })));
|
|
432
432
|
};
|
|
433
433
|
const CloseButtonContainer = tw.div `
|
|
434
434
|
${p => (p.$inline ? tws `tu-alert__close-button-container--inline` : tws `tu-alert__close-button-container`)}
|
|
@@ -442,7 +442,7 @@ const getBackgroundColor = () => ({ $color }) => {
|
|
|
442
442
|
};
|
|
443
443
|
return colors[$color];
|
|
444
444
|
};
|
|
445
|
-
const Container$
|
|
445
|
+
const Container$8 = tw.div `
|
|
446
446
|
tu-alert
|
|
447
447
|
${p => (p.$inline ? tws `tu-alert--inline` : null)}
|
|
448
448
|
${getBackgroundColor()}
|
|
@@ -655,11 +655,12 @@ const StyledDensityContainer = twx(DensityContainer) `
|
|
|
655
655
|
* @param {CardFooterProps} props - The props for the CardFooter component
|
|
656
656
|
* @returns {JSX.Element} CardFooter component
|
|
657
657
|
*/
|
|
658
|
-
const CardFooter = ({ dataTestId, className, children, density }) => {
|
|
659
|
-
return (jsx(
|
|
658
|
+
const CardFooter = ({ dataTestId, className, children, density, hideSeparator = false }) => {
|
|
659
|
+
return (jsx(Container$7, Object.assign({ dataTestId: dataTestId, className: className, "$hideSeparator": hideSeparator, "$density": density }, { children: jsx(Body, { children: children }) })));
|
|
660
660
|
};
|
|
661
|
-
const
|
|
661
|
+
const Container$7 = twx(DensityContainer) `
|
|
662
662
|
tu-card__footer-density-container
|
|
663
|
+
${p => p.$hideSeparator && tws `tu-card__footer-density-container--borderless`}
|
|
663
664
|
`;
|
|
664
665
|
const Body = tw.div `
|
|
665
666
|
tu-card__footer
|
|
@@ -706,11 +707,12 @@ const StyledHeading = tw.div `
|
|
|
706
707
|
* @param {CardHeaderProps} props - The props for the CardHeader component
|
|
707
708
|
* @returns {JSX.Element} CardHeader component
|
|
708
709
|
*/
|
|
709
|
-
const CardHeader = ({ heading, headingVariant = "primary", subHeading, onClose, dataTestId, className, children, accessories, density, extraClassName, }) => {
|
|
710
|
-
return (jsx(
|
|
710
|
+
const CardHeader = ({ heading, headingVariant = "primary", subHeading, onClose, dataTestId, className, children, accessories, density, extraClassName, hideSeparator = false, }) => {
|
|
711
|
+
return (jsx(Root$8, Object.assign({ dataTestId: dataTestId, className: className, "$hideSeparator": hideSeparator, "$density": density }, { children: jsxs(Container$6, { children: [jsxs("div", Object.assign({ className: extraClassName }, { children: [jsxs(HeadingContainer$1, { children: [jsx(Heading$1, Object.assign({ variant: headingVariant }, { children: heading })), accessories] }), subHeading && (jsx(Heading$1, Object.assign({ subtle: true, variant: "subtitle" }, { children: subHeading }))), children] })), onClose && (jsx(IconButton, { dataTestId: "card-header-close-button", variant: "transparent", color: "secondary", onClick: onClose, icon: jsx(Icon$1, { name: "XIcon", size: "small" }) }))] }) })));
|
|
711
712
|
};
|
|
712
|
-
const
|
|
713
|
-
tu-card__header-density-container
|
|
713
|
+
const Root$8 = twx(DensityContainer) `
|
|
714
|
+
tu-card__header-density-container
|
|
715
|
+
${p => p.$hideSeparator && tws `tu-card__header-density-container--borderless`}
|
|
714
716
|
`;
|
|
715
717
|
const Container$6 = tw.div `
|
|
716
718
|
tu-card__header
|
|
@@ -1085,7 +1087,7 @@ const TipContainer = tw.text `
|
|
|
1085
1087
|
* @returns {JSX.Element} FormGroup component
|
|
1086
1088
|
*/
|
|
1087
1089
|
const FormGroup = ({ isInvalid, helpText, helpAddon, tip, className, dataTestId, label, children, disabled = false, }) => {
|
|
1088
|
-
return (jsxs(FormGroupRoot, Object.assign({ className: className, "data-testid": dataTestId, "$disabled": disabled }, { children: [jsxs(ContainerBefore, { children: [jsx(
|
|
1090
|
+
return (jsxs(FormGroupRoot, Object.assign({ className: className, "data-testid": dataTestId, "$disabled": disabled }, { children: [jsxs(ContainerBefore, { children: [jsx(FormGroupLabel, Object.assign({ dataTestId: `${dataTestId}-label` }, { children: label })), tip && jsx(Tip, Object.assign({ dataTestId: `${dataTestId}-tip` }, { children: tip }))] }), children, jsxs(ContainerAfter, Object.assign({ "$isInvalid": isInvalid }, { children: [helpText && jsx("span", Object.assign({ "data-testid": `${dataTestId}-helpText` }, { children: helpText })), helpAddon && jsx(HelpAddon, Object.assign({ "data-testid": `${dataTestId}-helpAddon` }, { children: helpAddon }))] }))] })));
|
|
1089
1091
|
};
|
|
1090
1092
|
const FormGroupRoot = tw.label `
|
|
1091
1093
|
tu-form-group
|
|
@@ -1096,6 +1098,9 @@ const FormGroupRoot = tw.label `
|
|
|
1096
1098
|
const ContainerBefore = tw.div `
|
|
1097
1099
|
tu-form-group__container-before
|
|
1098
1100
|
`;
|
|
1101
|
+
const FormGroupLabel = twx(Label$2) `
|
|
1102
|
+
component-formGroup-font
|
|
1103
|
+
`;
|
|
1099
1104
|
const ContainerAfter = tw.div `
|
|
1100
1105
|
tu-form-group__container-after
|
|
1101
1106
|
${({ $isInvalid }) => ($isInvalid ? tws `tu-form-group__container-after--invalid` : null)}
|
|
@@ -2514,7 +2519,7 @@ const useOverflowItems = ({ threshold = 1, childUniqueIdentifierAttribute = "id"
|
|
|
2514
2519
|
* @param {SidebarProps} props - The props for the Sidebar component
|
|
2515
2520
|
* @returns {JSX.Element} Sidebar component
|
|
2516
2521
|
*/
|
|
2517
|
-
const Sidebar = ({ childContainerClassName, children, breakpoint = "lg", className, dataTestId = "sidebar", moreMenuProps, overflowThreshold, }) => {
|
|
2522
|
+
const Sidebar = ({ childContainerClassName, children, breakpoint = "lg", className, dataTestId = "sidebar", moreMenuProps, menuListProps, overflowThreshold, }) => {
|
|
2518
2523
|
const { overflowContainerRef, itemOverflowMap } = useOverflowItems({
|
|
2519
2524
|
children,
|
|
2520
2525
|
childUniqueIdentifierAttribute: "id",
|
|
@@ -2531,7 +2536,11 @@ const Sidebar = ({ childContainerClassName, children, breakpoint = "lg", classNa
|
|
|
2531
2536
|
return React__default.cloneElement(child, {
|
|
2532
2537
|
className: `${child.props.className} ${itemVisibilityClassName(child.props.id)}`,
|
|
2533
2538
|
});
|
|
2534
|
-
}) })), overflowItemCount > 0 ? (jsx(MoreMenu, Object.assign({
|
|
2539
|
+
}) })), overflowItemCount > 0 ? (jsx(MoreMenu, Object.assign({ iconButtonProps: {
|
|
2540
|
+
circular: false,
|
|
2541
|
+
variant: "transparent",
|
|
2542
|
+
color: "secondary",
|
|
2543
|
+
}, menuPlacement: "bottom-end" }, moreMenuProps, { className: `${(moreMenuProps === null || moreMenuProps === void 0 ? void 0 : moreMenuProps.className) || ""} !p-0`, dataTestId: `${dataTestId}-more-menu` }, { children: jsx(MenuList, Object.assign({}, menuListProps, { dataTestId: `${dataTestId}-menu-list` }, { children: React__default.Children.map(children, child => {
|
|
2535
2544
|
return itemOverflowMap[child.props.id] ? child : null;
|
|
2536
2545
|
}) })) }))) : null] })));
|
|
2537
2546
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-components",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"dependencies": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"@trackunit/tailwind-styled-components": "0.0.51",
|
|
10
10
|
"react": "18.2.0",
|
|
11
11
|
"@trackunit/ui-design-tokens": "0.0.53",
|
|
12
|
-
"@trackunit/react-core-contexts-test": "0.1.
|
|
12
|
+
"@trackunit/react-core-contexts-test": "0.1.16",
|
|
13
13
|
"echarts-for-react": "3.0.2",
|
|
14
14
|
"echarts": "5.4.0",
|
|
15
15
|
"uuid": "8.3.2",
|
|
@@ -9,6 +9,10 @@ export interface CardFooterProps extends CommonProps {
|
|
|
9
9
|
* Element to render in the footer
|
|
10
10
|
*/
|
|
11
11
|
children?: React.ReactNode | null;
|
|
12
|
+
/**
|
|
13
|
+
* Wether or not a seperator line should be rendered
|
|
14
|
+
*/
|
|
15
|
+
hideSeparator?: boolean;
|
|
12
16
|
}
|
|
13
17
|
/**
|
|
14
18
|
* A simple footer intended to use with Cards and Modals.
|
|
@@ -18,4 +22,4 @@ export interface CardFooterProps extends CommonProps {
|
|
|
18
22
|
* @param {CardFooterProps} props - The props for the CardFooter component
|
|
19
23
|
* @returns {JSX.Element} CardFooter component
|
|
20
24
|
*/
|
|
21
|
-
export declare const CardFooter: ({ dataTestId, className, children, density }: CardFooterProps) => JSX.Element;
|
|
25
|
+
export declare const CardFooter: ({ dataTestId, className, children, density, hideSeparator }: CardFooterProps) => JSX.Element;
|
|
@@ -5,7 +5,7 @@ export interface CardHeaderProps extends CommonProps {
|
|
|
5
5
|
/**
|
|
6
6
|
* The text to show in the Cards main heading
|
|
7
7
|
*/
|
|
8
|
-
heading
|
|
8
|
+
heading?: string;
|
|
9
9
|
/**
|
|
10
10
|
* The variant/size of the heading.
|
|
11
11
|
* Same as the `Heading` component.
|
|
@@ -26,7 +26,7 @@ export interface CardHeaderProps extends CommonProps {
|
|
|
26
26
|
/**
|
|
27
27
|
* Wether or not a seperator line should be rendered
|
|
28
28
|
*/
|
|
29
|
-
|
|
29
|
+
hideSeparator?: boolean;
|
|
30
30
|
/** Function to call when the close button is clicked */
|
|
31
31
|
onClose?: () => void;
|
|
32
32
|
/**
|
|
@@ -44,4 +44,4 @@ export interface CardHeaderProps extends CommonProps {
|
|
|
44
44
|
* @param {CardHeaderProps} props - The props for the CardHeader component
|
|
45
45
|
* @returns {JSX.Element} CardHeader component
|
|
46
46
|
*/
|
|
47
|
-
export declare const CardHeader: ({ heading, headingVariant, subHeading, onClose, dataTestId, className, children, accessories, density, extraClassName, }: CardHeaderProps) => JSX.Element;
|
|
47
|
+
export declare const CardHeader: ({ heading, headingVariant, subHeading, onClose, dataTestId, className, children, accessories, density, extraClassName, hideSeparator, }: CardHeaderProps) => JSX.Element;
|
|
@@ -52,4 +52,4 @@ export interface SidebarProps extends CommonProps {
|
|
|
52
52
|
* @param {SidebarProps} props - The props for the Sidebar component
|
|
53
53
|
* @returns {JSX.Element} Sidebar component
|
|
54
54
|
*/
|
|
55
|
-
export declare const Sidebar: ({ childContainerClassName, children, breakpoint, className, dataTestId, moreMenuProps, overflowThreshold, }: SidebarProps) => JSX.Element;
|
|
55
|
+
export declare const Sidebar: ({ childContainerClassName, children, breakpoint, className, dataTestId, moreMenuProps, menuListProps, overflowThreshold, }: SidebarProps) => JSX.Element;
|