Skip to content
This repository was archived by the owner on Nov 9, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Instance, Options, GroupOptions } from 'tippy.js'
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>

export interface TippyProps extends Omit<Options, 'content'> {
content: React.ReactElement<any> | string
content: React.ReactChild | React.ReactChild[]
children: React.ReactElement<any>
onCreate?: (instance: Instance) => void
/** @deprecated Use `visible` instead */
Expand Down
27 changes: 17 additions & 10 deletions src/Tippy.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,23 @@ function Tippy({
)
}

Tippy.propTypes = {
content: PropTypes.oneOfType([PropTypes.string, PropTypes.element])
.isRequired,
children: PropTypes.element.isRequired,
onCreate: PropTypes.func,
isVisible: PropTypes.bool, // deprecated
isEnabled: PropTypes.bool, // deprecated
visible: PropTypes.bool,
enabled: PropTypes.bool,
className: PropTypes.string,
if (process.env.NODE_ENV !== 'production') {
const ContentType = PropTypes.oneOfType([
PropTypes.number,
PropTypes.string,
PropTypes.element,
])
Tippy.propTypes = {
content: PropTypes.oneOf([ContentType, PropTypes.arrayOf(ContentType)])
.isRequired,
children: PropTypes.element.isRequired,
onCreate: PropTypes.func,
isVisible: PropTypes.bool, // deprecated
isEnabled: PropTypes.bool, // deprecated
visible: PropTypes.bool,
enabled: PropTypes.bool,
className: PropTypes.string,
}
}

export default forwardRef(function TippyWrapper({ children, ...props }, ref) {
Expand Down
6 changes: 4 additions & 2 deletions src/TippyGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ export default function TippyGroup({ children, ...props }) {
})
}

TippyGroup.propTypes = {
children: PropTypes.arrayOf(PropTypes.element).isRequired,
if (process.env.NODE_ENV !== 'production') {
TippyGroup.propTypes = {
children: PropTypes.arrayOf(PropTypes.element).isRequired,
}
}