@trackunit/react-table-base-components 0.0.162 → 0.0.163
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 +2 -2
- package/index.esm.js +2 -2
- package/package.json +1 -1
- package/src/components/SiteCell/SiteCell.d.ts +2 -2
package/index.cjs.js
CHANGED
|
@@ -222,12 +222,12 @@ const getIconName = (type) => {
|
|
|
222
222
|
* @returns {JSX.Element} SiteCell component
|
|
223
223
|
*/
|
|
224
224
|
const SiteCell = ({ count, sites, dataTestId, className }) => {
|
|
225
|
-
var _a, _b
|
|
225
|
+
var _a, _b;
|
|
226
226
|
const [isTooltipVisible, setIsTooltipVisible] = react.useState(false);
|
|
227
227
|
const updateTooltipVisibility = (element) => {
|
|
228
228
|
setIsTooltipVisible(element ? element.scrollWidth > element.clientWidth : false);
|
|
229
229
|
};
|
|
230
|
-
return count > 0 ? (jsxRuntime.jsxs("div", { className: cvaSiteCellWrapper({ className }), "data-testid": dataTestId, children: [jsxRuntime.jsx(SiteIcon, { size: "small", type:
|
|
230
|
+
return count && count > 0 ? (jsxRuntime.jsxs("div", { className: cvaSiteCellWrapper({ className }), "data-testid": dataTestId, children: [jsxRuntime.jsx(SiteIcon, { size: "small", type: sites.type }), jsxRuntime.jsx("span", { ref: elementRef => updateTooltipVisibility(elementRef), className: cvaSiteCellTooltip(), children: jsxRuntime.jsx(reactComponents.Tooltip, { disabled: !isTooltipVisible, label: (_a = sites.name) !== null && _a !== void 0 ? _a : "", placement: "bottom", className: "inline", children: (_b = sites.name) !== null && _b !== void 0 ? _b : "" }) }), jsxRuntime.jsx("span", { className: "text-slate-500", children: count > 1 ? `+${count - 1}` : "" })] })) : null;
|
|
231
231
|
};
|
|
232
232
|
|
|
233
233
|
/**
|
package/index.esm.js
CHANGED
|
@@ -218,12 +218,12 @@ const getIconName = (type) => {
|
|
|
218
218
|
* @returns {JSX.Element} SiteCell component
|
|
219
219
|
*/
|
|
220
220
|
const SiteCell = ({ count, sites, dataTestId, className }) => {
|
|
221
|
-
var _a, _b
|
|
221
|
+
var _a, _b;
|
|
222
222
|
const [isTooltipVisible, setIsTooltipVisible] = useState(false);
|
|
223
223
|
const updateTooltipVisibility = (element) => {
|
|
224
224
|
setIsTooltipVisible(element ? element.scrollWidth > element.clientWidth : false);
|
|
225
225
|
};
|
|
226
|
-
return count > 0 ? (jsxs("div", { className: cvaSiteCellWrapper({ className }), "data-testid": dataTestId, children: [jsx(SiteIcon, { size: "small", type:
|
|
226
|
+
return count && count > 0 ? (jsxs("div", { className: cvaSiteCellWrapper({ className }), "data-testid": dataTestId, children: [jsx(SiteIcon, { size: "small", type: sites.type }), jsx("span", { ref: elementRef => updateTooltipVisibility(elementRef), className: cvaSiteCellTooltip(), children: jsx(Tooltip, { disabled: !isTooltipVisible, label: (_a = sites.name) !== null && _a !== void 0 ? _a : "", placement: "bottom", className: "inline", children: (_b = sites.name) !== null && _b !== void 0 ? _b : "" }) }), jsx("span", { className: "text-slate-500", children: count > 1 ? `+${count - 1}` : "" })] })) : null;
|
|
227
227
|
};
|
|
228
228
|
|
|
229
229
|
/**
|
package/package.json
CHANGED
|
@@ -6,8 +6,8 @@ type CellSite = {
|
|
|
6
6
|
type?: CellSiteType;
|
|
7
7
|
};
|
|
8
8
|
export interface SiteCellProps extends CommonProps {
|
|
9
|
-
sites: CellSite
|
|
10
|
-
count
|
|
9
|
+
sites: CellSite;
|
|
10
|
+
count?: number | null;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* The `<SiteCell>` component is used for displaying the sites in a table cell.
|