@trackunit/react-components 0.1.256 → 0.1.257
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/Icon/Icon.d.ts +7 -1
package/index.cjs.js
CHANGED
|
@@ -176,7 +176,7 @@ const isSafari = () => {
|
|
|
176
176
|
* @param {IconProps} props - The props for the Icon component
|
|
177
177
|
* @returns {JSX.Element} Icon component
|
|
178
178
|
*/
|
|
179
|
-
const Icon = ({ name, size = "large", className, dataTestId, color, onClick, type, style, forwardedRef, }) => {
|
|
179
|
+
const Icon = ({ name, size = "large", className, dataTestId, color, onClick, type, style, forwardedRef, title, }) => {
|
|
180
180
|
const useTagRef = React.useRef(null);
|
|
181
181
|
const correctIconType = React.useMemo(() => {
|
|
182
182
|
if (size === "small" || size === "medium") {
|
|
@@ -198,7 +198,7 @@ const Icon = ({ name, size = "large", className, dataTestId, color, onClick, typ
|
|
|
198
198
|
useTagRef.current.setAttribute("href", href[correctIconType]);
|
|
199
199
|
}
|
|
200
200
|
}, [correctIconType, href]);
|
|
201
|
-
return (jsxRuntime.jsx("span", { className: cvaIcon({ color, size, className }), onClick: onClick, "data-testid": dataTestId, ref: forwardedRef, children: jsxRuntime.jsxs("svg", { viewBox: correctIconType === "mini" ? "0 0 20 20" : "0 0 24 24", "data-testid": dataTestId ? `${dataTestId}-${iconName}` : iconName, style: style, role: "img", children: [jsxRuntime.jsx("title", { children: iconName }), jsxRuntime.jsx("use", { href: href[correctIconType], ref: useTagRef })] }) }));
|
|
201
|
+
return (jsxRuntime.jsx("span", { className: cvaIcon({ color, size, className }), onClick: onClick, "data-testid": dataTestId, ref: forwardedRef, children: jsxRuntime.jsxs("svg", { viewBox: correctIconType === "mini" ? "0 0 20 20" : "0 0 24 24", "data-testid": dataTestId ? `${dataTestId}-${iconName}` : iconName, style: style, role: "img", children: [jsxRuntime.jsx("title", { children: title ? title : iconName }), jsxRuntime.jsx("use", { href: href[correctIconType], ref: useTagRef })] }) }));
|
|
202
202
|
};
|
|
203
203
|
|
|
204
204
|
const cvaTag = cssClassVarianceUtilities.cvaMerge([
|
package/index.esm.js
CHANGED
|
@@ -145,7 +145,7 @@ const isSafari = () => {
|
|
|
145
145
|
* @param {IconProps} props - The props for the Icon component
|
|
146
146
|
* @returns {JSX.Element} Icon component
|
|
147
147
|
*/
|
|
148
|
-
const Icon = ({ name, size = "large", className, dataTestId, color, onClick, type, style, forwardedRef, }) => {
|
|
148
|
+
const Icon = ({ name, size = "large", className, dataTestId, color, onClick, type, style, forwardedRef, title, }) => {
|
|
149
149
|
const useTagRef = useRef(null);
|
|
150
150
|
const correctIconType = useMemo(() => {
|
|
151
151
|
if (size === "small" || size === "medium") {
|
|
@@ -167,7 +167,7 @@ const Icon = ({ name, size = "large", className, dataTestId, color, onClick, typ
|
|
|
167
167
|
useTagRef.current.setAttribute("href", href[correctIconType]);
|
|
168
168
|
}
|
|
169
169
|
}, [correctIconType, href]);
|
|
170
|
-
return (jsx("span", { className: cvaIcon({ color, size, className }), onClick: onClick, "data-testid": dataTestId, ref: forwardedRef, children: jsxs("svg", { viewBox: correctIconType === "mini" ? "0 0 20 20" : "0 0 24 24", "data-testid": dataTestId ? `${dataTestId}-${iconName}` : iconName, style: style, role: "img", children: [jsx("title", { children: iconName }), jsx("use", { href: href[correctIconType], ref: useTagRef })] }) }));
|
|
170
|
+
return (jsx("span", { className: cvaIcon({ color, size, className }), onClick: onClick, "data-testid": dataTestId, ref: forwardedRef, children: jsxs("svg", { viewBox: correctIconType === "mini" ? "0 0 20 20" : "0 0 24 24", "data-testid": dataTestId ? `${dataTestId}-${iconName}` : iconName, style: style, role: "img", children: [jsx("title", { children: title ? title : iconName }), jsx("use", { href: href[correctIconType], ref: useTagRef })] }) }));
|
|
171
171
|
};
|
|
172
172
|
|
|
173
173
|
const cvaTag = cvaMerge([
|
package/package.json
CHANGED
|
@@ -310,6 +310,12 @@ export type IconProps = DiscriminatedIconProps & CommonProps & {
|
|
|
310
310
|
* @memberof IconProps
|
|
311
311
|
*/
|
|
312
312
|
style?: CSSProperties;
|
|
313
|
+
/**
|
|
314
|
+
* The title (text) to show in the tooltip when hovering over an icon
|
|
315
|
+
* Default title is the name of the icon.
|
|
316
|
+
* If a custom title is needed, set it using this prop.
|
|
317
|
+
*/
|
|
318
|
+
title?: string;
|
|
313
319
|
};
|
|
314
320
|
/**
|
|
315
321
|
* - The Icon component is used to display an Icon.
|
|
@@ -319,5 +325,5 @@ export type IconProps = DiscriminatedIconProps & CommonProps & {
|
|
|
319
325
|
* @param {IconProps} props - The props for the Icon component
|
|
320
326
|
* @returns {JSX.Element} Icon component
|
|
321
327
|
*/
|
|
322
|
-
export declare const Icon: ({ name, size, className, dataTestId, color, onClick, type, style, forwardedRef, }: IconProps) => JSX.Element;
|
|
328
|
+
export declare const Icon: ({ name, size, className, dataTestId, color, onClick, type, style, forwardedRef, title, }: IconProps) => JSX.Element;
|
|
323
329
|
export {};
|