@trackunit/react-components 0.1.19 → 0.1.21
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
|
@@ -518,7 +518,7 @@ const StyledText$3 = tw.text `
|
|
|
518
518
|
*/
|
|
519
519
|
const BaseInput = React.forwardRef((_a, ref) => {
|
|
520
520
|
var { className, isInvalid, dataTestId, prefix, suffix, addonBefore, addonAfter, actions, fieldSize = "medium", nonInteractive = false } = _a, rest = __rest(_a, ["className", "isInvalid", "dataTestId", "prefix", "suffix", "addonBefore", "addonAfter", "actions", "fieldSize", "nonInteractive"]);
|
|
521
|
-
return (jsxs(InputContainer$1, Object.assign({ "$fieldSize": fieldSize, "$invalid": isInvalid, "$disabled": rest.disabled || rest.readOnly, className: className, "data-testid": `${dataTestId}-container` }, { children: [addonBefore
|
|
521
|
+
return (jsxs(InputContainer$1, Object.assign({ "$fieldSize": fieldSize, "$invalid": isInvalid, "$disabled": rest.disabled || rest.readOnly, className: className, "data-testid": `${dataTestId}-container` }, { children: [addonBefore && addonBefore !== undefined ? (jsx(AddonBefore, Object.assign({ "data-testid": `${dataTestId}-addonBefore` }, { children: addonBefore }))) : null, prefix && addonBefore !== prefix ? (jsx(InputPrefix, Object.assign({ "data-testid": `${dataTestId}-prefix` }, { children: prefix }))) : null, jsx("input", Object.assign({ ref: ref, "data-testid": dataTestId, className: tws `tu-input__field` }, rest, { readOnly: rest.readOnly || nonInteractive })), suffix && addonBefore !== suffix ? (jsx(InputSuffix, Object.assign({ "data-testid": `${dataTestId}-suffix` }, { children: suffix }))) : null, actions && addonBefore !== actions ? actions : null, addonAfter && addonAfter !== undefined && addonBefore !== addonAfter ? (jsx(AddonAfter, Object.assign({ "data-testid": `${dataTestId}-addonAfter` }, { children: addonAfter }))) : null] })));
|
|
522
522
|
});
|
|
523
523
|
const InputPrefix = tw.div `
|
|
524
524
|
tu-input__prefix
|
|
@@ -579,11 +579,11 @@ const StyledCard$2 = tw.div `
|
|
|
579
579
|
* @param {ContainerProps} props - The props for the DensityContainer component
|
|
580
580
|
* @returns {JSX.Element} DensityContainer component
|
|
581
581
|
*/
|
|
582
|
-
const DensityContainer = ({ children, className, dataTestId,
|
|
583
|
-
return (jsx(StyledDensityContainer$1, Object.assign({ "$disableGap":
|
|
582
|
+
const DensityContainer = ({ children, className, dataTestId, density, disableGap, direction, }) => {
|
|
583
|
+
return (jsx(StyledDensityContainer$1, Object.assign({ "$disableGap": disableGap, "$density": density, "$direction": direction, "data-testid": dataTestId, className: className }, { children: children })));
|
|
584
584
|
};
|
|
585
585
|
const getDirection = () => ({ $direction }) => {
|
|
586
|
-
$direction = $direction ? $direction : "column";
|
|
586
|
+
$direction = $direction !== null && $direction !== void 0 ? $direction : "column";
|
|
587
587
|
const directions = {
|
|
588
588
|
row: tws `flex-row`,
|
|
589
589
|
"row-reverse": tws `flex-row-reverse`,
|
|
@@ -628,7 +628,7 @@ ${DensityFinder}
|
|
|
628
628
|
* @returns {JSX.Element} CardBody component
|
|
629
629
|
*/
|
|
630
630
|
const CardBody = ({ density = "auto", overflow = "auto", children, dataTestId, className, disableGap, }) => {
|
|
631
|
-
return (jsx(StyledDensityContainer, Object.assign({ "$overflow": overflow,
|
|
631
|
+
return (jsx(StyledDensityContainer, Object.assign({ "$overflow": overflow, density: density, dataTestId: dataTestId, className: className, disableGap: disableGap }, { children: children })));
|
|
632
632
|
};
|
|
633
633
|
const getOverflow = () => ({ $overflow }) => {
|
|
634
634
|
if (!$overflow) {
|
|
@@ -656,14 +656,11 @@ const StyledDensityContainer = twx(DensityContainer) `
|
|
|
656
656
|
* @returns {JSX.Element} CardFooter component
|
|
657
657
|
*/
|
|
658
658
|
const CardFooter = ({ dataTestId, className, children, density, hideSeparator = false }) => {
|
|
659
|
-
return (jsx(Container$7, Object.assign({ dataTestId: dataTestId, className: className, "$hideSeparator": hideSeparator,
|
|
659
|
+
return (jsx(Container$7, Object.assign({ dataTestId: dataTestId, className: className, "$hideSeparator": hideSeparator, density: density, direction: "row" }, { children: children })));
|
|
660
660
|
};
|
|
661
661
|
const Container$7 = twx(DensityContainer) `
|
|
662
662
|
tu-card__footer-density-container
|
|
663
663
|
${p => p.$hideSeparator && tws `tu-card__footer-density-container--borderless`}
|
|
664
|
-
`;
|
|
665
|
-
const Body = tw.div `
|
|
666
|
-
tu-card__footer
|
|
667
664
|
`;
|
|
668
665
|
|
|
669
666
|
/**
|
|
@@ -708,7 +705,7 @@ const StyledHeading = tw.div `
|
|
|
708
705
|
* @returns {JSX.Element} CardHeader component
|
|
709
706
|
*/
|
|
710
707
|
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,
|
|
708
|
+
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" }), className: "self-start" }))] }) })));
|
|
712
709
|
};
|
|
713
710
|
const Root$8 = twx(DensityContainer) `
|
|
714
711
|
tu-card__header-density-container
|
|
@@ -1485,25 +1482,13 @@ const Backdrop = tw.div `
|
|
|
1485
1482
|
* - Modals interrupt a user's workflow by design.
|
|
1486
1483
|
* - The modal component provides a foundation for creating dialogs, lightboxes, etc.
|
|
1487
1484
|
*/
|
|
1488
|
-
const Modal = React.forwardRef(({ isOpen, children,
|
|
1485
|
+
const Modal = React.forwardRef(({ isOpen, children, dataTestId, className, onDismissClick = () => {
|
|
1489
1486
|
return;
|
|
1490
1487
|
}, }, ref) => {
|
|
1491
|
-
return (jsx(ModalBackdrop, Object.assign({ isVisible: isOpen, onClick: onDismissClick }, { children: isOpen && (jsx(StyledDiv, Object.assign({ ref: ref }, { children: jsx(StyledCard, Object.assign({ dataTestId: dataTestId, className: className
|
|
1488
|
+
return (jsx(ModalBackdrop, Object.assign({ isVisible: isOpen, onClick: onDismissClick }, { children: isOpen && (jsx(StyledDiv, Object.assign({ ref: ref }, { children: jsx(StyledCard, Object.assign({ dataTestId: dataTestId, className: className }, { children: children })) }))) })));
|
|
1492
1489
|
});
|
|
1493
|
-
const getCardMaxWidth = ($maxWidth) => {
|
|
1494
|
-
$maxWidth = $maxWidth ? $maxWidth : "full";
|
|
1495
|
-
const widths = {
|
|
1496
|
-
slim: tws `tu-modal__card--slim`,
|
|
1497
|
-
narrow: tws `tu-modal__card--narrow`,
|
|
1498
|
-
wide: tws `tu-modal__card--wide`,
|
|
1499
|
-
normal: tws `tu-modal__card--normal`,
|
|
1500
|
-
full: "",
|
|
1501
|
-
};
|
|
1502
|
-
return widths[$maxWidth];
|
|
1503
|
-
};
|
|
1504
1490
|
const StyledCard = twx(Card) `
|
|
1505
1491
|
tu-modal__card
|
|
1506
|
-
${({ $maxWidth }) => getCardMaxWidth($maxWidth)}
|
|
1507
1492
|
`;
|
|
1508
1493
|
const StyledDiv = tw.div `
|
|
1509
1494
|
tu-modal__container
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-components",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.21",
|
|
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.19",
|
|
13
13
|
"echarts-for-react": "3.0.2",
|
|
14
14
|
"echarts": "5.4.0",
|
|
15
15
|
"uuid": "8.3.2",
|
|
@@ -7,15 +7,15 @@ interface ContainerProps extends CommonProps {
|
|
|
7
7
|
* "comfortable" = 16px gap and padding.
|
|
8
8
|
* "spacious" = 16px gap, 26px padding.
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
density?: Density;
|
|
11
11
|
/**
|
|
12
12
|
* Set gap to be 0px (not preferable)
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
disableGap?: boolean;
|
|
15
15
|
/**
|
|
16
16
|
* The flex direction of the Card. Defaults to "column".
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
direction?: "row" | "row-reverse" | "column" | "column-reverse";
|
|
19
19
|
children?: React.ReactNode;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
@@ -26,5 +26,5 @@ interface ContainerProps extends CommonProps {
|
|
|
26
26
|
* @param {ContainerProps} props - The props for the DensityContainer component
|
|
27
27
|
* @returns {JSX.Element} DensityContainer component
|
|
28
28
|
*/
|
|
29
|
-
export declare const DensityContainer: ({ children, className, dataTestId,
|
|
29
|
+
export declare const DensityContainer: ({ children, className, dataTestId, density, disableGap, direction, }: ContainerProps) => JSX.Element;
|
|
30
30
|
export {};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { CommonProps } from "../../common/CommonProps";
|
|
3
|
-
type ModalWidth = "slim" | "narrow" | "normal" | "wide" | "full";
|
|
4
3
|
export interface ModalProps extends CommonProps {
|
|
5
4
|
/**
|
|
6
5
|
* Whether modal is open or not.
|
|
@@ -18,10 +17,6 @@ export interface ModalProps extends CommonProps {
|
|
|
18
17
|
* Test id to be applied to the modal.
|
|
19
18
|
*/
|
|
20
19
|
dataTestId?: string;
|
|
21
|
-
/**
|
|
22
|
-
* Maximum width of the modal.
|
|
23
|
-
*/
|
|
24
|
-
maxWidth?: ModalWidth;
|
|
25
20
|
}
|
|
26
21
|
/**
|
|
27
22
|
* - Modals are used to present critical information or request user input needed to complete a user's workflow.
|
|
@@ -29,4 +24,3 @@ export interface ModalProps extends CommonProps {
|
|
|
29
24
|
* - The modal component provides a foundation for creating dialogs, lightboxes, etc.
|
|
30
25
|
*/
|
|
31
26
|
export declare const Modal: React.ForwardRefExoticComponent<ModalProps & React.RefAttributes<HTMLDivElement>>;
|
|
32
|
-
export {};
|