2024-04-15 09:34:32 -04:00
|
|
|
import Tooltip from '@/features/ui/components/bootstrap-5/tooltip'
|
|
|
|
import BS3Tooltip from '@/shared/components/tooltip'
|
|
|
|
import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher'
|
|
|
|
|
2024-05-15 10:31:00 -04:00
|
|
|
type OLTooltipProps = React.ComponentProps<typeof Tooltip> & {
|
2024-04-15 09:34:32 -04:00
|
|
|
bs3Props?: Record<string, unknown>
|
|
|
|
}
|
|
|
|
|
2024-05-15 10:31:00 -04:00
|
|
|
function OLTooltip(props: OLTooltipProps) {
|
2024-04-15 09:34:32 -04:00
|
|
|
const { bs3Props, ...bs5Props } = props
|
|
|
|
|
2024-10-08 10:22:13 -04:00
|
|
|
type BS3TooltipProps = React.ComponentProps<typeof BS3Tooltip>
|
|
|
|
|
|
|
|
const bs3TooltipProps: BS3TooltipProps = {
|
2024-04-15 09:34:32 -04:00
|
|
|
children: bs5Props.children,
|
|
|
|
id: bs5Props.id,
|
|
|
|
description: bs5Props.description,
|
2024-10-08 10:22:13 -04:00
|
|
|
tooltipProps: bs5Props.tooltipProps as BS3TooltipProps,
|
2024-07-10 09:34:19 -04:00
|
|
|
overlayProps: {
|
|
|
|
placement: bs5Props.overlayProps?.placement,
|
|
|
|
},
|
2024-04-15 09:34:32 -04:00
|
|
|
...bs3Props,
|
|
|
|
}
|
|
|
|
|
|
|
|
if ('hidden' in bs5Props) {
|
|
|
|
bs3TooltipProps.hidden = bs5Props.hidden
|
|
|
|
}
|
|
|
|
|
|
|
|
const delay = bs5Props.overlayProps?.delay
|
|
|
|
if (delay && typeof delay !== 'number') {
|
|
|
|
bs3TooltipProps.overlayProps = {
|
|
|
|
...bs3TooltipProps.overlayProps,
|
|
|
|
delayShow: delay.show,
|
|
|
|
delayHide: delay.hide,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<BootstrapVersionSwitcher
|
|
|
|
bs3={<BS3Tooltip {...bs3TooltipProps} />}
|
|
|
|
bs5={<Tooltip {...bs5Props} />}
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2024-05-15 10:31:00 -04:00
|
|
|
export default OLTooltip
|