@brighthr/component-tooltip
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -7,7 +7,9 @@ import React from 'react'; | ||
icon?: React.ComponentType<React.SVGAttributes<SVGElement>>; | ||
label?: string; | ||
label?: string | React.ReactElement; | ||
placement?: Placement; | ||
background?: 'dark' | 'white'; | ||
width?: string; | ||
}; | ||
declare const Tooltip: ({ className, icon: Icon, label, children, placement, }: TooltipProps) => React.ReactElement; | ||
declare const Tooltip: ({ className, icon: Icon, label, children, placement, background, width, }: TooltipProps) => React.ReactElement; | ||
export { TooltipProps, Tooltip as default }; |
@@ -25,6 +25,10 @@ // src/index.tsx | ||
children, | ||
placement = "left" | ||
placement = "left", | ||
background = "dark", | ||
width | ||
}) => { | ||
const [visible, setVisible] = useState(false); | ||
const arrowRef = useRef(null); | ||
const whiteBackground = background === "white"; | ||
const darkBackground = background === "dark"; | ||
const { | ||
@@ -87,3 +91,6 @@ refs: { setReference, setFloating }, | ||
{ | ||
className: " bg-neutral-700 text-white p-2 rounded-[4px] text-sm", | ||
className: cn(`p-2 rounded-[4px] text-sm ${width}`, { | ||
"bg-neutral-700 text-white": darkBackground, | ||
"bg-white shadow-lg": whiteBackground | ||
}), | ||
style: transitionStyles | ||
@@ -94,3 +101,6 @@ }, | ||
{ | ||
className: "fill-neutral-700", | ||
className: cn({ | ||
"fill-neutral-700": darkBackground, | ||
"fill-white shadow-lg": whiteBackground | ||
}), | ||
tipRadius: 2, | ||
@@ -97,0 +107,0 @@ height: 8, |
{ | ||
"name": "@brighthr/component-tooltip", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"license": "MIT", | ||
@@ -27,3 +27,3 @@ "type": "module", | ||
}, | ||
"gitHead": "e436e08fcd11f90b558ca5f6ffc5acde15bbf593" | ||
"gitHead": "0dba297b12f62dc853ab167543535322a9014fce" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17978
227