@typeform/embed-react
Advanced tools
Comparing version 3.20.0 to 4.0.0
@@ -1,3 +0,4 @@ | ||
import React, { CSSProperties, ReactNode, ReactHTML, AriaAttributes } from 'react'; | ||
import React, { AriaAttributes, CSSProperties, MutableRefObject, ReactHTML, ReactNode } from 'react'; | ||
import { ButtonProps } from '@typeform/embed'; | ||
import { GenericEmbed } from '../utils'; | ||
type ButtonComponentBaseProps = { | ||
@@ -10,2 +11,3 @@ id: string; | ||
children?: ReactNode; | ||
embedRef?: MutableRefObject<GenericEmbed | undefined>; | ||
}; | ||
@@ -15,9 +17,4 @@ export type ButtonComponentProps<T> = T & ButtonComponentBaseProps; | ||
type CreateFn<T> = (id: string, props: CreateFnProps<T>) => GenericEmbed; | ||
export type GenericEmbed = { | ||
unmount: () => void; | ||
open: () => void; | ||
}; | ||
export declare const emptyEmbed: GenericEmbed; | ||
declare function makeButtonComponent<T>(createFn: CreateFn<T>, cssFilename: string): React.ForwardRefExoticComponent<React.PropsWithoutRef<T & ButtonComponentBaseProps> & React.RefAttributes<unknown>>; | ||
declare function makeButtonComponent<T>(createFn: CreateFn<T>, cssFilename: string): ({ id, children, as, style, className, buttonProps, embedRef, ...props }: ButtonComponentProps<T>) => React.JSX.Element; | ||
export { makeButtonComponent }; | ||
//# sourceMappingURL=make-button-component.d.ts.map |
@@ -1,4 +0,6 @@ | ||
import React from 'react'; | ||
import React, { MutableRefObject } from 'react'; | ||
import { GenericEmbed } from '../utils'; | ||
type InitializerComponentBaseProps = { | ||
id: string; | ||
embedRef?: MutableRefObject<GenericEmbed | undefined>; | ||
}; | ||
@@ -8,7 +10,4 @@ export type InitializerComponentProps<T> = T & InitializerComponentBaseProps; | ||
type CreateFn<T> = (id: string, props: CreateFnProps<T>) => GenericEmbed; | ||
type GenericEmbed = { | ||
unmount: () => void; | ||
}; | ||
declare function makeInitializerComponent<T>(createFn: CreateFn<T>, cssFilename: string): React.ForwardRefExoticComponent<React.PropsWithoutRef<T & InitializerComponentBaseProps> & React.RefAttributes<unknown>>; | ||
declare function makeInitializerComponent<T>(createFn: CreateFn<T>, cssFilename: string): ({ id, embedRef, ...props }: InitializerComponentProps<T>) => React.JSX.Element; | ||
export { makeInitializerComponent }; | ||
//# sourceMappingURL=make-initializer-component.d.ts.map |
import { PopupOptions, SliderOptions, PopoverOptions, SidetabOptions } from '@typeform/embed'; | ||
import { ButtonComponentProps, InitializerComponentProps, WidgetProps } from './components'; | ||
export { WidgetProps }; | ||
import { GenericEmbed } from './utils'; | ||
export { WidgetProps, GenericEmbed }; | ||
export declare const Widget: import("react").MemoExoticComponent<import("react").FC<WidgetProps>>; | ||
@@ -5,0 +6,0 @@ export type PopupButtonProps = ButtonComponentProps<PopupOptions>; |
@@ -0,2 +1,3 @@ | ||
export * from './generic-embed'; | ||
export * from './memo-component'; | ||
//# sourceMappingURL=index.d.ts.map |
{ | ||
"name": "@typeform/embed-react", | ||
"version": "3.20.0", | ||
"version": "4.0.0", | ||
"main": "./build/index.js", | ||
@@ -27,3 +27,3 @@ "types": "./build/index.d.ts", | ||
"dependencies": { | ||
"@typeform/embed": "4.10.3", | ||
"@typeform/embed": "5.0.0", | ||
"fast-deep-equal": "^3.1.3" | ||
@@ -30,0 +30,0 @@ }, |
@@ -9,3 +9,3 @@ # ⚛ Typeform React Embed Library | ||
- node >= 14 (for node v12 use [v1.21.0](https://www.npmjs.com/package/@typeform/embed-react/v/1.21.0)) | ||
- node >= 18 | ||
- yarn or npm | ||
@@ -101,7 +101,7 @@ | ||
### Passing a custom ref | ||
### Passing a custom ref as `embedRef` | ||
For some custom use cases it may be convenient to open the popup programmatically (without the button being clicked). | ||
To do this, pass a ref to `PopupButton`, `SliderButton`, `Popover` and `Sidetab` components and then use `ref.current.open()` to trigger the popup to open. | ||
To do this, pass an `embedRef` prop to `PopupButton`, `SliderButton`, `Popover` and `Sidetab` components and then use `ref.current.open()` to trigger the popup to open. | ||
@@ -116,3 +116,3 @@ Example: | ||
id="<form-id>" | ||
ref={ref} | ||
embedRef={ref} | ||
> | ||
@@ -136,3 +136,3 @@ click to open | ||
- node >= 14 (for node 12 use [v1.21.0](https://www.npmjs.com/package/@typeform/embed-react/v/1.21.0)) | ||
- node >= 18 | ||
- yarn | ||
@@ -139,0 +139,0 @@ |
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 too big to display
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
86451
23
72
+ Added@typeform/embed@5.0.0(transitive)
- Removed@typeform/embed@4.10.3(transitive)
Updated@typeform/embed@5.0.0