@trackunit/react-table-base-components 0.0.368 → 0.0.370
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
CHANGED
|
@@ -130,12 +130,12 @@ const cvaMultiValueTextCellTooltip = cssClassVarianceUtilities.cvaMerge(["whites
|
|
|
130
130
|
* @param {MultiValueTextCellProps} props - The props for the MultiValueTextCell component
|
|
131
131
|
* @returns {JSX.Element} MultiValueTextCell component
|
|
132
132
|
*/
|
|
133
|
-
const MultiValueTextCell = ({ content, count, icon, iconTooltip, dataTestId, className, }) => {
|
|
133
|
+
const MultiValueTextCell = ({ content, count, countTooltip, icon, iconTooltip, dataTestId, className, }) => {
|
|
134
134
|
const [isTooltipVisible, setIsTooltipVisible] = react.useState(false);
|
|
135
135
|
const updateTooltipVisibility = (element) => {
|
|
136
136
|
setIsTooltipVisible(element ? element.scrollWidth > element.clientWidth : false);
|
|
137
137
|
};
|
|
138
|
-
return count && count > 0 ? (jsxRuntime.jsxs("div", { className: cvaMultiValueTextCellWrapper({ className }), "data-testid": dataTestId, children: [jsxRuntime.jsx(reactComponents.Tooltip, { className: "inline", disabled: !iconTooltip, label: iconTooltip !== null && iconTooltip !== void 0 ? iconTooltip : "", placement: "bottom", children: icon }), jsxRuntime.jsx("span", { className: cvaMultiValueTextCellTooltip(), ref: elementRef => updateTooltipVisibility(elementRef), children: jsxRuntime.jsx(reactComponents.Tooltip, { className: "inline", disabled: !isTooltipVisible, label: content !== null && content !== void 0 ? content : "", placement: "bottom", children: content !== null && content !== void 0 ? content : "" }) }), jsxRuntime.jsx("
|
|
138
|
+
return count && count > 0 ? (jsxRuntime.jsxs("div", { className: cvaMultiValueTextCellWrapper({ className }), "data-testid": dataTestId, children: [jsxRuntime.jsx(reactComponents.Tooltip, { className: "inline", disabled: !iconTooltip, label: iconTooltip !== null && iconTooltip !== void 0 ? iconTooltip : "", placement: "bottom", children: icon }), jsxRuntime.jsx("span", { className: cvaMultiValueTextCellTooltip(), ref: elementRef => updateTooltipVisibility(elementRef), children: jsxRuntime.jsx(reactComponents.Tooltip, { className: "inline", disabled: !isTooltipVisible, label: content !== null && content !== void 0 ? content : "", placement: "bottom", children: content !== null && content !== void 0 ? content : "" }) }), jsxRuntime.jsx(reactComponents.Tooltip, { className: "inline", disabled: !countTooltip, label: countTooltip !== null && countTooltip !== void 0 ? countTooltip : "", placement: "bottom", children: jsxRuntime.jsx(reactComponents.Tag, { color: "neutral", size: "small", children: count > 1 ? `+${count - 1}` : "" }) })] })) : null;
|
|
139
139
|
};
|
|
140
140
|
|
|
141
141
|
/**
|
package/index.esm.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
2
2
|
import { Checkbox } from '@trackunit/react-form-components';
|
|
3
3
|
import { cvaMerge } from '@trackunit/css-class-variance-utilities';
|
|
4
4
|
import { formatDateUtil, timeSinceAuto, timeSinceInDays } from '@trackunit/date-and-time-utils';
|
|
5
|
-
import { Indicator, ExternalLink, Tooltip,
|
|
5
|
+
import { Indicator, ExternalLink, Tooltip, Tag, Notice } from '@trackunit/react-components';
|
|
6
6
|
import { useState, useEffect } from 'react';
|
|
7
7
|
import { Temporal } from '@js-temporal/polyfill';
|
|
8
8
|
import { DateTimeFormat } from '@trackunit/shared-utils';
|
|
@@ -126,12 +126,12 @@ const cvaMultiValueTextCellTooltip = cvaMerge(["whitespace-no-wrap", "overflow-h
|
|
|
126
126
|
* @param {MultiValueTextCellProps} props - The props for the MultiValueTextCell component
|
|
127
127
|
* @returns {JSX.Element} MultiValueTextCell component
|
|
128
128
|
*/
|
|
129
|
-
const MultiValueTextCell = ({ content, count, icon, iconTooltip, dataTestId, className, }) => {
|
|
129
|
+
const MultiValueTextCell = ({ content, count, countTooltip, icon, iconTooltip, dataTestId, className, }) => {
|
|
130
130
|
const [isTooltipVisible, setIsTooltipVisible] = useState(false);
|
|
131
131
|
const updateTooltipVisibility = (element) => {
|
|
132
132
|
setIsTooltipVisible(element ? element.scrollWidth > element.clientWidth : false);
|
|
133
133
|
};
|
|
134
|
-
return count && count > 0 ? (jsxs("div", { className: cvaMultiValueTextCellWrapper({ className }), "data-testid": dataTestId, children: [jsx(Tooltip, { className: "inline", disabled: !iconTooltip, label: iconTooltip !== null && iconTooltip !== void 0 ? iconTooltip : "", placement: "bottom", children: icon }), jsx("span", { className: cvaMultiValueTextCellTooltip(), ref: elementRef => updateTooltipVisibility(elementRef), children: jsx(Tooltip, { className: "inline", disabled: !isTooltipVisible, label: content !== null && content !== void 0 ? content : "", placement: "bottom", children: content !== null && content !== void 0 ? content : "" }) }), jsx("
|
|
134
|
+
return count && count > 0 ? (jsxs("div", { className: cvaMultiValueTextCellWrapper({ className }), "data-testid": dataTestId, children: [jsx(Tooltip, { className: "inline", disabled: !iconTooltip, label: iconTooltip !== null && iconTooltip !== void 0 ? iconTooltip : "", placement: "bottom", children: icon }), jsx("span", { className: cvaMultiValueTextCellTooltip(), ref: elementRef => updateTooltipVisibility(elementRef), children: jsx(Tooltip, { className: "inline", disabled: !isTooltipVisible, label: content !== null && content !== void 0 ? content : "", placement: "bottom", children: content !== null && content !== void 0 ? content : "" }) }), jsx(Tooltip, { className: "inline", disabled: !countTooltip, label: countTooltip !== null && countTooltip !== void 0 ? countTooltip : "", placement: "bottom", children: jsx(Tag, { color: "neutral", size: "small", children: count > 1 ? `+${count - 1}` : "" }) })] })) : null;
|
|
135
135
|
};
|
|
136
136
|
|
|
137
137
|
/**
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { CommonProps } from "@trackunit/react-components";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
3
|
export interface MultiValueTextCellProps extends CommonProps {
|
|
4
4
|
icon?: JSX.Element;
|
|
5
5
|
iconTooltip?: string;
|
|
6
6
|
content?: string;
|
|
7
7
|
count?: number | null;
|
|
8
|
+
countTooltip?: ReactNode;
|
|
8
9
|
}
|
|
9
10
|
/**
|
|
10
11
|
* The `<MultiValueTextCell>` component is used for displaying the text values with multiple values in a table cell. First element is displayed as a text, the rest of the values are displayed as a number. Icon can be passed as an optional prop.
|
|
@@ -13,4 +14,4 @@ export interface MultiValueTextCellProps extends CommonProps {
|
|
|
13
14
|
* @param {MultiValueTextCellProps} props - The props for the MultiValueTextCell component
|
|
14
15
|
* @returns {JSX.Element} MultiValueTextCell component
|
|
15
16
|
*/
|
|
16
|
-
export declare const MultiValueTextCell: ({ content, count, icon, iconTooltip, dataTestId, className, }: MultiValueTextCellProps) => JSX.Element | null;
|
|
17
|
+
export declare const MultiValueTextCell: ({ content, count, countTooltip, icon, iconTooltip, dataTestId, className, }: MultiValueTextCellProps) => JSX.Element | null;
|