@trackunit/react-components 1.5.22 → 1.5.23
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/Tag/Tag.d.ts +7 -1
package/index.cjs.js
CHANGED
|
@@ -252,7 +252,7 @@ const cvaTagIcon = cssClassVarianceUtilities.cvaMerge(["cursor-pointer", "transi
|
|
|
252
252
|
* @param {TagProps} props - The props for the Tag component.
|
|
253
253
|
* @returns {ReactElement} The rendered Tag component.
|
|
254
254
|
*/
|
|
255
|
-
const Tag = ({ className, dataTestId, children, size = "medium", onClose, color = "primary", disabled = false, ref, icon, }) => {
|
|
255
|
+
const Tag = ({ className, dataTestId, children, size = "medium", onClose, color = "primary", disabled = false, ref, icon, onMouseEnter, }) => {
|
|
256
256
|
const isSupportedDismissColor = react.useMemo(() => {
|
|
257
257
|
if (color === "neutral" || color === "primary" || color === "white") {
|
|
258
258
|
return true;
|
|
@@ -268,7 +268,7 @@ const Tag = ({ className, dataTestId, children, size = "medium", onClose, color
|
|
|
268
268
|
}
|
|
269
269
|
return "default";
|
|
270
270
|
}, [onClose, icon, isSupportedDismissColor]);
|
|
271
|
-
return (jsxRuntime.jsxs("div", { className: cvaTag({ className, size, color, layout, border: color === "white" ? "default" : "none" }), "data-testid": dataTestId, ref: ref, children: [icon && size === "medium" ? jsxRuntime.jsx("div", { className: cvaTagIconContainer(), children: icon }) : null, jsxRuntime.jsx("span", { className: cvaTagText(), children: children }), Boolean(onClose) && isSupportedDismissColor && size === "medium" && !disabled ? (
|
|
271
|
+
return (jsxRuntime.jsxs("div", { className: cvaTag({ className, size, color, layout, border: color === "white" ? "default" : "none" }), "data-testid": dataTestId, onMouseEnter: onMouseEnter, ref: ref, children: [icon && size === "medium" ? jsxRuntime.jsx("div", { className: cvaTagIconContainer(), children: icon }) : null, jsxRuntime.jsx("span", { className: cvaTagText(), children: children }), Boolean(onClose) && isSupportedDismissColor && size === "medium" && !disabled ? (
|
|
272
272
|
// a fix for multiselect deselecting tags working together with fade out animation
|
|
273
273
|
jsxRuntime.jsx("div", { className: cvaTagIconContainer(), onMouseDown: onClose, children: jsxRuntime.jsx(Icon, { className: cvaTagIcon(), dataTestId: dataTestId + "Icon", name: "XCircle", size: "small", style: { WebkitTransition: "-webkit-transform 0.150s" }, type: "solid" }) })) : null] }));
|
|
274
274
|
};
|
package/index.esm.js
CHANGED
|
@@ -250,7 +250,7 @@ const cvaTagIcon = cvaMerge(["cursor-pointer", "transition-opacity", "hover:opac
|
|
|
250
250
|
* @param {TagProps} props - The props for the Tag component.
|
|
251
251
|
* @returns {ReactElement} The rendered Tag component.
|
|
252
252
|
*/
|
|
253
|
-
const Tag = ({ className, dataTestId, children, size = "medium", onClose, color = "primary", disabled = false, ref, icon, }) => {
|
|
253
|
+
const Tag = ({ className, dataTestId, children, size = "medium", onClose, color = "primary", disabled = false, ref, icon, onMouseEnter, }) => {
|
|
254
254
|
const isSupportedDismissColor = useMemo(() => {
|
|
255
255
|
if (color === "neutral" || color === "primary" || color === "white") {
|
|
256
256
|
return true;
|
|
@@ -266,7 +266,7 @@ const Tag = ({ className, dataTestId, children, size = "medium", onClose, color
|
|
|
266
266
|
}
|
|
267
267
|
return "default";
|
|
268
268
|
}, [onClose, icon, isSupportedDismissColor]);
|
|
269
|
-
return (jsxs("div", { className: cvaTag({ className, size, color, layout, border: color === "white" ? "default" : "none" }), "data-testid": dataTestId, ref: ref, children: [icon && size === "medium" ? jsx("div", { className: cvaTagIconContainer(), children: icon }) : null, jsx("span", { className: cvaTagText(), children: children }), Boolean(onClose) && isSupportedDismissColor && size === "medium" && !disabled ? (
|
|
269
|
+
return (jsxs("div", { className: cvaTag({ className, size, color, layout, border: color === "white" ? "default" : "none" }), "data-testid": dataTestId, onMouseEnter: onMouseEnter, ref: ref, children: [icon && size === "medium" ? jsx("div", { className: cvaTagIconContainer(), children: icon }) : null, jsx("span", { className: cvaTagText(), children: children }), Boolean(onClose) && isSupportedDismissColor && size === "medium" && !disabled ? (
|
|
270
270
|
// a fix for multiselect deselecting tags working together with fade out animation
|
|
271
271
|
jsx("div", { className: cvaTagIconContainer(), onMouseDown: onClose, children: jsx(Icon, { className: cvaTagIcon(), dataTestId: dataTestId + "Icon", name: "XCircle", size: "small", style: { WebkitTransition: "-webkit-transform 0.150s" }, type: "solid" }) })) : null] }));
|
|
272
272
|
};
|
package/package.json
CHANGED
|
@@ -37,6 +37,12 @@ export interface TagProps extends CommonProps {
|
|
|
37
37
|
* The icon to display. Only supported for medium size.
|
|
38
38
|
*/
|
|
39
39
|
icon?: ReactNode;
|
|
40
|
+
/**
|
|
41
|
+
* A handler for an event triggered when the mouse pointer enters the tag area.
|
|
42
|
+
* Can be used to apply hover effects or handle other interactions related to a mouse enter event.
|
|
43
|
+
*
|
|
44
|
+
*/
|
|
45
|
+
onMouseEnter?: MouseEventHandler<HTMLDivElement>;
|
|
40
46
|
}
|
|
41
47
|
/**
|
|
42
48
|
* The Tag component is used for labeling or categorizing items in the UI.
|
|
@@ -52,6 +58,6 @@ export interface TagProps extends CommonProps {
|
|
|
52
58
|
* @returns {ReactElement} The rendered Tag component.
|
|
53
59
|
*/
|
|
54
60
|
export declare const Tag: {
|
|
55
|
-
({ className, dataTestId, children, size, onClose, color, disabled, ref, icon, }: TagProps): import("react/jsx-runtime").JSX.Element;
|
|
61
|
+
({ className, dataTestId, children, size, onClose, color, disabled, ref, icon, onMouseEnter, }: TagProps): import("react/jsx-runtime").JSX.Element;
|
|
56
62
|
displayName: string;
|
|
57
63
|
};
|