-
-
Notifications
You must be signed in to change notification settings - Fork 533
fix: wrapper element changing after first render #935
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ const Tooltip = ({ | |
events = ['hover'], | ||
positionStrategy = 'absolute', | ||
middlewares, | ||
wrapper: WrapperElement = 'div', | ||
wrapper: WrapperElement, | ||
children = null, | ||
delayShow = 0, | ||
delayHide = 0, | ||
|
@@ -38,7 +38,7 @@ const Tooltip = ({ | |
setIsOpen, | ||
}: ITooltip) => { | ||
const tooltipRef = useRef<HTMLElement>(null) | ||
const tooltipArrowRef = useRef<HTMLDivElement>(null) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. updated to match other possible elements |
||
const tooltipArrowRef = useRef<HTMLElement>(null) | ||
const tooltipShowDelayTimerRef = useRef<NodeJS.Timeout | null>(null) | ||
const tooltipHideDelayTimerRef = useRef<NodeJS.Timeout | null>(null) | ||
const [inlineStyles, setInlineStyles] = useState({}) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,7 @@ export interface ITooltip { | |
id?: string | ||
variant?: VariantType | ||
anchorId?: string | ||
wrapper?: WrapperType | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. possible |
||
wrapper: WrapperType | ||
children?: ChildrenType | ||
events?: EventsType[] | ||
positionStrategy?: PositionStrategy | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,7 +85,7 @@ const TooltipController = ({ | |
setTooltipOffset(value === null ? offset : Number(value)) | ||
}, | ||
wrapper: (value) => { | ||
setTooltipWrapper((value as WrapperType) ?? 'div') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the fix. when the component start to check anchor attributes and there's no |
||
setTooltipWrapper((value as WrapperType) ?? wrapper) | ||
}, | ||
events: (value) => { | ||
const parsed = value?.split(' ') as EventsType[] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default value removed because there's no way to use Tooltip component directly without Controller and Controller always passes a
wrapper
to Tooltip