diff --git a/index.d.ts b/index.d.ts index 0a866ed..d4c5ac2 100644 --- a/index.d.ts +++ b/index.d.ts @@ -18,6 +18,7 @@ export const tippy: typeof tippyCore; export interface TippySingletonProps extends Partial { children: Array>; className?: string; + plugins?: Plugin[]; } export const TippySingleton: React.FunctionComponent; diff --git a/package-lock.json b/package-lock.json index 51ebf34..f52ab9d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14227,9 +14227,9 @@ "dev": true }, "tippy.js": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/tippy.js/-/tippy.js-5.0.1.tgz", - "integrity": "sha512-bE/7F04UpFMM/G57rr9lyZpsykmqsrhIDiCnb7SNA4GD9SFYyQtpPHRpLLZokZhSC4c/+DaW/vTjaWX/MK/K8A==", + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/tippy.js/-/tippy.js-5.0.2.tgz", + "integrity": "sha512-Zj7ihX2/uImDudNkfxw9jgcbtg9sUKT3QRmuH9WJtKkX6M96SwMG8FPdiObholc4SJP6wlnqk0nqByjXb8QZSA==", "requires": { "popper.js": "^1.15.0" } diff --git a/package.json b/package.json index 62b7053..9f600a1 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ }, "dependencies": { "prop-types": "^15.6.2", - "tippy.js": "^5.0.1" + "tippy.js": "^5.0.2" }, "peerDependencies": { "react": ">=16.8", diff --git a/src/TippySingleton.js b/src/TippySingleton.js index 24fb0b7..088173d 100644 --- a/src/TippySingleton.js +++ b/src/TippySingleton.js @@ -10,6 +10,7 @@ import { export default function TippySingleton({ children, className, + plugins, ignoreAttributes = true, ...restOfNativeProps }) { @@ -25,7 +26,7 @@ export default function TippySingleton({ useIsomorphicLayoutEffect(() => { const {instances} = component; - const instance = createSingleton(instances, props); + const instance = createSingleton(instances, props, plugins); component.instance = instance; diff --git a/src/hooks.js b/src/hooks.js index d255e23..46c44e7 100644 --- a/src/hooks.js +++ b/src/hooks.js @@ -33,6 +33,7 @@ export function useInstance(initialValue) { export function useSingleton({ className, + plugins, ignoreAttributes = true, ...restOfNativeProps } = {}) { @@ -49,7 +50,7 @@ export function useSingleton({ useIsomorphicLayoutEffect(() => { const {instances} = component; - const instance = createSingleton(instances, props); + const instance = createSingleton(instances, props, plugins); component.instance = instance; diff --git a/test/TippySingleton.test.js b/test/TippySingleton.test.js index 1c1c184..34c65d2 100644 --- a/test/TippySingleton.test.js +++ b/test/TippySingleton.test.js @@ -227,6 +227,23 @@ describe('', () => { expect(tooltip.classList.contains('one')).toBe(true); }); + + test('props.plugins', () => { + const plugins = [{fn: () => ({})}]; + + render( + + +