react-iframe
Advanced tools
Comparing version 1.7.10 to 1.7.11
@@ -5,2 +5,6 @@ # Change Log | ||
## [1.7.11](https://github.com/svenanders/react-iframe/compare/v1.7.10...v1.7.11) (2019-04-11) | ||
## [1.7.10](https://github.com/svenanders/react-iframe/compare/v1.7.9...v1.7.10) (2019-04-11) | ||
@@ -7,0 +11,0 @@ |
@@ -1,19 +0,52 @@ | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const react_1 = __importDefault(require("react")); | ||
const iframe_1 = __importDefault(require("../iframe")); | ||
const react_test_renderer_1 = __importDefault(require("react-test-renderer")); | ||
"use strict" | ||
var __importDefault = | ||
(this && this.__importDefault) || | ||
function(mod) { | ||
return mod && mod.__esModule ? mod : { default: mod } | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }) | ||
const react_1 = __importDefault(require("react")) | ||
const iframe_1 = __importDefault(require("../iframe")) | ||
const react_test_renderer_1 = __importDefault(require("react-test-renderer")) | ||
test("Render default iframe", () => { | ||
const component = react_test_renderer_1.default.create(react_1.default.createElement(iframe_1.default, { position: "relative", url: "http://www.foobar.com" })); | ||
let tree = component.toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
const component = react_test_renderer_1.default.create( | ||
react_1.default.createElement(iframe_1.default, { position: "relative", url: "http://www.foobar.com" }) | ||
) | ||
let tree = component.toJSON() | ||
expect(tree).toMatchSnapshot() | ||
}) | ||
test("Render iframe with title", () => { | ||
const component = react_test_renderer_1.default.create(react_1.default.createElement(iframe_1.default, { position: "relative", title: "A foobared iframe", url: "http://www.foobar.com", ariaHidden: true, ariaLabel: "someLabel", ariaLabelledby: "someId", allow: "encrypted-media", sandbox: "allow-scripts", allowFullScreen: false, className: "myIframeClass", frameBorder: 2, overflow: "auto", onLoad: () => { console.log("hello"); }, onMouseOut: () => { console.log("goodbye"); }, onMouseOver: () => { console.log("hi"); }, display: "inline-block", id: "myIframeId", name: "My Iframe name", scrolling: "yes", styles: { background: "red" }, target: "_self" })); | ||
let tree = component.toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
//# sourceMappingURL=test.js.map | ||
const component = react_test_renderer_1.default.create( | ||
react_1.default.createElement(iframe_1.default, { | ||
position: "relative", | ||
title: "A foobared iframe", | ||
url: "http://www.foobar.com", | ||
ariaHidden: true, | ||
ariaLabel: "someLabel", | ||
ariaLabelledby: "someId", | ||
allow: "encrypted-media", | ||
sandbox: "allow-scripts", | ||
allowFullScreen: false, | ||
className: "myIframeClass", | ||
frameBorder: 2, | ||
overflow: "auto", | ||
onLoad: () => { | ||
console.log("hello") | ||
}, | ||
onMouseOut: () => { | ||
console.log("goodbye") | ||
}, | ||
onMouseOver: () => { | ||
console.log("hi") | ||
}, | ||
display: "inline-block", | ||
id: "myIframeId", | ||
name: "My Iframe name", | ||
scrolling: "yes", | ||
styles: { background: "red" }, | ||
target: "_self" | ||
}) | ||
) | ||
let tree = component.toJSON() | ||
expect(tree).toMatchSnapshot() | ||
}) |
@@ -1,55 +0,84 @@ | ||
"use strict"; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const react_1 = __importStar(require("react")); | ||
"use strict" | ||
var __importStar = | ||
(this && this.__importStar) || | ||
function(mod) { | ||
if (mod && mod.__esModule) return mod | ||
var result = {} | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k] | ||
result["default"] = mod | ||
return result | ||
} | ||
var __importDefault = | ||
(this && this.__importDefault) || | ||
function(mod) { | ||
return mod && mod.__esModule ? mod : { default: mod } | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }) | ||
const react_1 = __importStar(require("react")) | ||
// @ts-ignore | ||
const object_assign_1 = __importDefault(require("object-assign")); | ||
const Iframe = ({ url, allowFullScreen, position, display, height, width, overflow, styles, onLoad, onMouseOver, onMouseOut, scrolling, id, frameBorder, ariaHidden, sandbox, allow, className, title, ariaLabel, ariaLabelledby, name, target }) => { | ||
const iFrameRef = react_1.createRef(); | ||
const defaultProps = object_assign_1.default({ | ||
ref: iFrameRef, | ||
src: url, | ||
target: target || "_parent", | ||
allowFullScreen: allowFullScreen || false, | ||
style: { | ||
position: position || "absolute", | ||
display: display || "block", | ||
height: height || "100%", | ||
width: width || "100%", | ||
overflow: overflow || "hidden" | ||
}, | ||
scrolling: scrolling || "no", | ||
frameBorder: frameBorder || 0, | ||
height: height || "100%", | ||
sandbox: sandbox || null, | ||
name: name || null, | ||
className: className || null, | ||
title: title || null, | ||
allow: allow || null, | ||
id: id || null, | ||
"aria-labelledby": ariaLabelledby || null, | ||
"aria-hidden": ariaHidden || null, | ||
width: width || "100%", | ||
onLoad: onLoad || null, | ||
onMouseOver: onMouseOver || null, | ||
onMouseOut: onMouseOut || null | ||
}); | ||
let props = Object.create(null); | ||
for (let prop of Object.keys(defaultProps)) { | ||
if (defaultProps[prop] != null) { | ||
props[prop] = defaultProps[prop]; | ||
} | ||
} | ||
return react_1.default.createElement("iframe", Object.assign({}, props)); | ||
}; | ||
exports.default = Iframe; | ||
//# sourceMappingURL=iframe.js.map | ||
const object_assign_1 = __importDefault(require("object-assign")) | ||
const Iframe = ({ | ||
url, | ||
allowFullScreen, | ||
position, | ||
display, | ||
height, | ||
width, | ||
overflow, | ||
styles, | ||
onLoad, | ||
onMouseOver, | ||
onMouseOut, | ||
scrolling, | ||
id, | ||
frameBorder, | ||
ariaHidden, | ||
sandbox, | ||
allow, | ||
className, | ||
title, | ||
ariaLabel, | ||
ariaLabelledby, | ||
name, | ||
target | ||
}) => { | ||
const iFrameRef = react_1.createRef() | ||
const defaultProps = object_assign_1.default({ | ||
ref: iFrameRef, | ||
src: url, | ||
target: target || "_parent", | ||
allowFullScreen: allowFullScreen || false, | ||
style: { | ||
position: position || "absolute", | ||
display: display || "block", | ||
height: height || "100%", | ||
width: width || "100%", | ||
overflow: overflow || "hidden" | ||
}, | ||
scrolling: scrolling || "no", | ||
frameBorder: frameBorder || 0, | ||
height: height || "100%", | ||
sandbox: sandbox || null, | ||
styles: styles || null, | ||
name: name || null, | ||
className: className || null, | ||
title: title || null, | ||
allow: allow || null, | ||
id: id || null, | ||
"aria-labelledby": ariaLabelledby || null, | ||
"aria-hidden": ariaHidden || null, | ||
"aria-label": ariaLabel || null, | ||
width: width || "100%", | ||
onLoad: onLoad || null, | ||
onMouseOver: onMouseOver || null, | ||
onMouseOut: onMouseOut || null | ||
}) | ||
let props = Object.create(null) | ||
for (let prop of Object.keys(defaultProps)) { | ||
if (defaultProps[prop] != null) { | ||
props[prop] = defaultProps[prop] | ||
} | ||
} | ||
return react_1.default.createElement("iframe", Object.assign({}, props)) | ||
} | ||
exports.default = Iframe |
@@ -1,14 +0,43 @@ | ||
import React from "react"; | ||
import Iframe from "../iframe"; | ||
import renderer from "react-test-renderer"; | ||
import React from "react" | ||
import Iframe from "../iframe" | ||
import renderer from "react-test-renderer" | ||
test("Render default iframe", () => { | ||
const component = renderer.create(React.createElement(Iframe, { position: "relative", url: "http://www.foobar.com" })); | ||
let tree = component.toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
const component = renderer.create(React.createElement(Iframe, { position: "relative", url: "http://www.foobar.com" })) | ||
let tree = component.toJSON() | ||
expect(tree).toMatchSnapshot() | ||
}) | ||
test("Render iframe with title", () => { | ||
const component = renderer.create(React.createElement(Iframe, { position: "relative", title: "A foobared iframe", url: "http://www.foobar.com", ariaHidden: true, ariaLabel: "someLabel", ariaLabelledby: "someId", allow: "encrypted-media", sandbox: "allow-scripts", allowFullScreen: false, className: "myIframeClass", frameBorder: 2, overflow: "auto", onLoad: () => { console.log("hello"); }, onMouseOut: () => { console.log("goodbye"); }, onMouseOver: () => { console.log("hi"); }, display: "inline-block", id: "myIframeId", name: "My Iframe name", scrolling: "yes", styles: { background: "red" }, target: "_self" })); | ||
let tree = component.toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
//# sourceMappingURL=test.js.map | ||
const component = renderer.create( | ||
React.createElement(Iframe, { | ||
position: "relative", | ||
title: "A foobared iframe", | ||
url: "http://www.foobar.com", | ||
ariaHidden: true, | ||
ariaLabel: "someLabel", | ||
ariaLabelledby: "someId", | ||
allow: "encrypted-media", | ||
sandbox: "allow-scripts", | ||
allowFullScreen: false, | ||
className: "myIframeClass", | ||
frameBorder: 2, | ||
overflow: "auto", | ||
onLoad: () => { | ||
console.log("hello") | ||
}, | ||
onMouseOut: () => { | ||
console.log("goodbye") | ||
}, | ||
onMouseOver: () => { | ||
console.log("hi") | ||
}, | ||
display: "inline-block", | ||
id: "myIframeId", | ||
name: "My Iframe name", | ||
scrolling: "yes", | ||
styles: { background: "red" }, | ||
target: "_self" | ||
}) | ||
) | ||
let tree = component.toJSON() | ||
expect(tree).toMatchSnapshot() | ||
}) |
@@ -1,43 +0,68 @@ | ||
import React, { createRef } from "react"; | ||
import React, { createRef } from "react" | ||
// @ts-ignore | ||
import objectAssign from "object-assign"; | ||
const Iframe = ({ url, allowFullScreen, position, display, height, width, overflow, styles, onLoad, onMouseOver, onMouseOut, scrolling, id, frameBorder, ariaHidden, sandbox, allow, className, title, ariaLabel, ariaLabelledby, name, target }) => { | ||
const iFrameRef = createRef(); | ||
const defaultProps = objectAssign({ | ||
ref: iFrameRef, | ||
src: url, | ||
target: target || "_parent", | ||
allowFullScreen: allowFullScreen || false, | ||
style: { | ||
position: position || "absolute", | ||
display: display || "block", | ||
height: height || "100%", | ||
width: width || "100%", | ||
overflow: overflow || "hidden" | ||
}, | ||
scrolling: scrolling || "no", | ||
frameBorder: frameBorder || 0, | ||
height: height || "100%", | ||
sandbox: sandbox || null, | ||
name: name || null, | ||
className: className || null, | ||
title: title || null, | ||
allow: allow || null, | ||
id: id || null, | ||
"aria-labelledby": ariaLabelledby || null, | ||
"aria-hidden": ariaHidden || null, | ||
width: width || "100%", | ||
onLoad: onLoad || null, | ||
onMouseOver: onMouseOver || null, | ||
onMouseOut: onMouseOut || null | ||
}); | ||
let props = Object.create(null); | ||
for (let prop of Object.keys(defaultProps)) { | ||
if (defaultProps[prop] != null) { | ||
props[prop] = defaultProps[prop]; | ||
} | ||
} | ||
return React.createElement("iframe", Object.assign({}, props)); | ||
}; | ||
export default Iframe; | ||
//# sourceMappingURL=iframe.js.map | ||
import objectAssign from "object-assign" | ||
const Iframe = ({ | ||
url, | ||
allowFullScreen, | ||
position, | ||
display, | ||
height, | ||
width, | ||
overflow, | ||
styles, | ||
onLoad, | ||
onMouseOver, | ||
onMouseOut, | ||
scrolling, | ||
id, | ||
frameBorder, | ||
ariaHidden, | ||
sandbox, | ||
allow, | ||
className, | ||
title, | ||
ariaLabel, | ||
ariaLabelledby, | ||
name, | ||
target | ||
}) => { | ||
const iFrameRef = createRef() | ||
const defaultProps = objectAssign({ | ||
ref: iFrameRef, | ||
src: url, | ||
target: target || "_parent", | ||
allowFullScreen: allowFullScreen || false, | ||
style: { | ||
position: position || "absolute", | ||
display: display || "block", | ||
height: height || "100%", | ||
width: width || "100%", | ||
overflow: overflow || "hidden" | ||
}, | ||
scrolling: scrolling || "no", | ||
frameBorder: frameBorder || 0, | ||
height: height || "100%", | ||
sandbox: sandbox || null, | ||
styles: styles || null, | ||
name: name || null, | ||
className: className || null, | ||
title: title || null, | ||
allow: allow || null, | ||
id: id || null, | ||
"aria-labelledby": ariaLabelledby || null, | ||
"aria-hidden": ariaHidden || null, | ||
"aria-label": ariaLabel || null, | ||
width: width || "100%", | ||
onLoad: onLoad || null, | ||
onMouseOver: onMouseOver || null, | ||
onMouseOut: onMouseOut || null | ||
}) | ||
let props = Object.create(null) | ||
for (let prop of Object.keys(defaultProps)) { | ||
if (defaultProps[prop] != null) { | ||
props[prop] = defaultProps[prop] | ||
} | ||
} | ||
return React.createElement("iframe", Object.assign({}, props)) | ||
} | ||
export default Iframe |
{ | ||
"name": "react-iframe", | ||
"version": "1.7.10", | ||
"version": "1.7.11", | ||
"description": "Easy peasy lemon squeezy iframes with react", | ||
@@ -83,3 +83,3 @@ "main": "dist/cjs/iframe.js", | ||
"ts:all": "yarn ts:cjs && yarn ts:es && yarn ts:typedefs && cp src/types.d.ts .", | ||
"test": "jest -c ./jest.config.json", | ||
"test": "jest -c ./jest.config.json src/__tests__/*.tsx", | ||
"lint": "eslint index.js --config .eslintrc.json", | ||
@@ -101,6 +101,7 @@ "release-patch": "standard-version --release-as patch", | ||
"!<rootDir>/node_modules/", | ||
"!<rootDir>/dist/", | ||
"!<rootDir>/target/" | ||
], | ||
"testMatch": [ | ||
"**/__tests__/*.(ts|tsx)" | ||
"src/__tests__/*.tsx" | ||
], | ||
@@ -107,0 +108,0 @@ "transform": { |
export interface IIframe { | ||
url: string | ||
allowFullScreen?: boolean | ||
target?: string | ||
position?: string | ||
display?: string | ||
height?: string | ||
width?: string | ||
overflow?: string | ||
styles?: object | ||
name?: string | ||
onLoad?: () => void | ||
onMouseOver?: () => void | ||
onMouseOut?: () => void | ||
frameBorder?: number | ||
scrolling?: string | ||
id?: string | ||
ariaHidden?: boolean | ||
ariaLabel?: string | ||
ariaLabelledby?: string | ||
sandbox?: string | ||
allow?: string | ||
className?: string | ||
url: string, | ||
allowFullScreen?: boolean, | ||
target?: string, | ||
position?: string, | ||
display?: string, | ||
height?: string, | ||
width?: string, | ||
overflow?: string, | ||
styles?: object, | ||
name?: string, | ||
onLoad?: () => void, | ||
onMouseOver?: () => void, | ||
onMouseOut?: () => void, | ||
frameBorder?: number, | ||
scrolling?: string, | ||
id?: string, | ||
ariaHidden?: boolean, | ||
ariaLabel?: string, | ||
ariaLabelledby?: string, | ||
sandbox?: string, | ||
allow?: string, | ||
className?: string, | ||
title?: string | ||
} |
@@ -12,5 +12,3 @@ { | ||
"jsx": "react", | ||
"baseUrl": "", | ||
"sourceRoot": "src", | ||
"sourceMap": true | ||
"baseUrl": "" | ||
}, | ||
@@ -17,0 +15,0 @@ "include": [ |
export interface IIframe { | ||
url: string | ||
allowFullScreen?: boolean | ||
target?: string | ||
position?: string | ||
display?: string | ||
height?: string | ||
width?: string | ||
overflow?: string | ||
styles?: object | ||
name?: string | ||
onLoad?: () => void | ||
onMouseOver?: () => void | ||
onMouseOut?: () => void | ||
frameBorder?: number | ||
scrolling?: string | ||
id?: string | ||
ariaHidden?: boolean | ||
ariaLabel?: string | ||
ariaLabelledby?: string | ||
sandbox?: string | ||
allow?: string | ||
className?: string | ||
url: string, | ||
allowFullScreen?: boolean, | ||
target?: string, | ||
position?: string, | ||
display?: string, | ||
height?: string, | ||
width?: string, | ||
overflow?: string, | ||
styles?: object, | ||
name?: string, | ||
onLoad?: () => void, | ||
onMouseOver?: () => void, | ||
onMouseOut?: () => void, | ||
frameBorder?: number, | ||
scrolling?: string, | ||
id?: string, | ||
ariaHidden?: boolean, | ||
ariaLabel?: string, | ||
ariaLabelledby?: string, | ||
sandbox?: string, | ||
allow?: string, | ||
className?: string, | ||
title?: string | ||
} |
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 not supported yet
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
8335
363228
49