@iframe-resizer/react 5.2.2-beta.4 → 5.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -2,7 +2,7 @@ Iframe Resizer Version 5
2
2
 
3
3
  This JavaScript library is Copyright © 2013-2024 David J. Bradshaw and is distributed under the GPL V3 for non-commercial use. A commercial license is available upon request.
4
4
 
5
- For more information on commercial licensing contact dave@bradshaw.net
5
+ For more information on commercial licensing see https://iframe-resizer.com/pricing/
6
6
 
7
7
  --
8
8
 
package/README.md CHANGED
@@ -22,4 +22,4 @@ yarn add @iframe-resizer/react
22
22
 
23
23
  ---
24
24
 
25
- _iframe-resizer version 5.2.2-beta.4 2024-07-27 - 10:58:26.764Z_
25
+ _iframe-resizer version 5.2.3 2024-08-05 - 15:01:03.526Z_
package/index.cjs.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * @preserve
3
3
  *
4
- * @module iframe-resizer/react 5.2.2-beta.4 (cjs) - 2024-07-27
4
+ * @module iframe-resizer/react 5.2.3 (cjs) - 2024-08-05
5
5
  *
6
6
  * @license GPL-3.0 for non-commercial use only.
7
7
  * For commercial use, you must purchase a license from
@@ -20,84 +20,70 @@
20
20
  'use strict';
21
21
 
22
22
  const _extends = require('@babel/runtime/helpers/extends');
23
- const _defineProperty = require('@babel/runtime/helpers/defineProperty');
24
- const _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
25
23
  const connectResizer = require('@iframe-resizer/core');
26
24
  const React = require('react');
27
25
  const warning = require('warning');
28
26
 
29
- var _excluded$1 = ["license", "bodyBackground", "bodyMargin", "bodyPadding", "checkOrigin", "direction", "inPageLinks", "log", "offset", "offsetHeight", "offsetWidth", "scrolling", "tolerance", "warningTimeout", "waitForLoad", "onClosed", "onReady", "onMessage", "onResized"];
30
- const filterIframeAttribs = (function (props) {
31
- props.license;
32
- props.bodyBackground;
33
- props.bodyMargin;
34
- props.bodyPadding;
35
- props.checkOrigin;
36
- props.direction;
37
- props.inPageLinks;
38
- props.log;
39
- props.offset;
40
- props.offsetHeight;
41
- props.offsetWidth;
42
- props.scrolling;
43
- props.tolerance;
44
- props.warningTimeout;
45
- props.waitForLoad;
46
- props.onClosed;
47
- props.onReady;
48
- props.onMessage;
49
- props.onResized;
50
- var iframeProps = _objectWithoutProperties(props, _excluded$1);
27
+ const filterIframeAttribs = (props => {
28
+ const {
29
+ license,
30
+ bodyBackground,
31
+ bodyMargin,
32
+ bodyPadding,
33
+ checkOrigin,
34
+ direction,
35
+ inPageLinks,
36
+ log,
37
+ offset,
38
+ offsetHeight,
39
+ offsetWidth,
40
+ scrolling,
41
+ tolerance,
42
+ warningTimeout,
43
+ waitForLoad,
44
+ onClosed,
45
+ onReady,
46
+ onMessage,
47
+ onResized,
48
+ ...iframeProps
49
+ } = props;
51
50
  return iframeProps;
52
51
  });
53
52
 
54
- var _excluded = ["title", "forwardRef"];
55
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
56
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
57
53
  function IframeResizer(props) {
58
54
  // eslint-disable-next-line react/prop-types
59
- var title = props.title,
60
- forwardRef = props.forwardRef,
61
- rest = _objectWithoutProperties(props, _excluded);
62
- var filteredProps = filterIframeAttribs(rest);
63
- var iframeRef = React.useRef(null);
64
- var onClose = function onClose() {
65
- var _iframeRef$current;
66
- warning(!iframeRef.current, "[iframe-resizer/react][".concat(iframeRef === null || iframeRef === void 0 || (_iframeRef$current = iframeRef.current) === null || _iframeRef$current === void 0 ? void 0 : _iframeRef$current.id, "] Close event ignored, to remove the iframe update your React component."));
55
+ const {
56
+ title,
57
+ forwardRef,
58
+ ...rest
59
+ } = props;
60
+ const filteredProps = filterIframeAttribs(rest);
61
+ const iframeRef = React.useRef(null);
62
+ const onClose = () => {
63
+ warning(!iframeRef.current, `[iframe-resizer/react][${iframeRef?.current?.id}] Close event ignored, to remove the iframe update your React component.`);
67
64
  return !iframeRef.current; // Allow React to close this
68
65
  };
69
66
 
70
67
  // This hook is only run once, as once iframe-resizer is bound, it will
71
68
  // deal with changes to the element and does not need recalling
72
- React.useEffect(function () {
73
- var iframe = iframeRef.current;
74
- var resizer = connectResizer(_objectSpread(_objectSpread({}, rest), {}, {
75
- onClose: onClose
76
- }))(iframe);
77
- return function () {
78
- return resizer === null || resizer === void 0 ? void 0 : resizer.disconnect();
79
- };
69
+ React.useEffect(() => {
70
+ const iframe = iframeRef.current;
71
+ const resizer = connectResizer({
72
+ ...rest,
73
+ onClose
74
+ })(iframe);
75
+ return () => resizer?.disconnect();
80
76
  }, []); // eslint-disable-line react-hooks/exhaustive-deps
81
77
 
82
- React.useImperativeHandle(forwardRef, function () {
83
- return {
84
- getRef: function getRef() {
85
- return iframeRef;
86
- },
87
- getElement: function getElement() {
88
- return iframeRef.current;
89
- },
90
- resize: function resize() {
91
- return iframeRef.current.iframeResizer.resize();
92
- },
93
- moveToAnchor: function moveToAnchor(anchor) {
94
- return iframeRef.current.iframeResizer.moveToAnchor(anchor);
95
- },
96
- sendMessage: function sendMessage(message, targetOrigin) {
97
- iframeRef.current.iframeResizer.sendMessage(message, targetOrigin);
98
- }
99
- };
100
- });
78
+ React.useImperativeHandle(forwardRef, () => ({
79
+ getRef: () => iframeRef,
80
+ getElement: () => iframeRef.current,
81
+ resize: () => iframeRef.current.iframeResizer.resize(),
82
+ moveToAnchor: anchor => iframeRef.current.iframeResizer.moveToAnchor(anchor),
83
+ sendMessage: (message, targetOrigin) => {
84
+ iframeRef.current.iframeResizer.sendMessage(message, targetOrigin);
85
+ }
86
+ }));
101
87
  return /*#__PURE__*/React.createElement("iframe", _extends({
102
88
  title: title
103
89
  }, filteredProps, {
package/index.esm.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * @preserve
3
3
  *
4
- * @module iframe-resizer/react 5.2.2-beta.4 (esm) - 2024-07-27
4
+ * @module iframe-resizer/react 5.2.3 (esm) - 2024-08-05
5
5
  *
6
6
  * @license GPL-3.0 for non-commercial use only.
7
7
  * For commercial use, you must purchase a license from
@@ -18,84 +18,70 @@
18
18
 
19
19
 
20
20
  import _extends from '@babel/runtime/helpers/extends';
21
- import _defineProperty from '@babel/runtime/helpers/defineProperty';
22
- import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
23
21
  import connectResizer from '@iframe-resizer/core';
24
22
  import React, { useRef, useEffect, useImperativeHandle } from 'react';
25
23
  import warning from 'warning';
26
24
 
27
- var _excluded$1 = ["license", "bodyBackground", "bodyMargin", "bodyPadding", "checkOrigin", "direction", "inPageLinks", "log", "offset", "offsetHeight", "offsetWidth", "scrolling", "tolerance", "warningTimeout", "waitForLoad", "onClosed", "onReady", "onMessage", "onResized"];
28
- const filterIframeAttribs = (function (props) {
29
- props.license;
30
- props.bodyBackground;
31
- props.bodyMargin;
32
- props.bodyPadding;
33
- props.checkOrigin;
34
- props.direction;
35
- props.inPageLinks;
36
- props.log;
37
- props.offset;
38
- props.offsetHeight;
39
- props.offsetWidth;
40
- props.scrolling;
41
- props.tolerance;
42
- props.warningTimeout;
43
- props.waitForLoad;
44
- props.onClosed;
45
- props.onReady;
46
- props.onMessage;
47
- props.onResized;
48
- var iframeProps = _objectWithoutProperties(props, _excluded$1);
25
+ const filterIframeAttribs = (props => {
26
+ const {
27
+ license,
28
+ bodyBackground,
29
+ bodyMargin,
30
+ bodyPadding,
31
+ checkOrigin,
32
+ direction,
33
+ inPageLinks,
34
+ log,
35
+ offset,
36
+ offsetHeight,
37
+ offsetWidth,
38
+ scrolling,
39
+ tolerance,
40
+ warningTimeout,
41
+ waitForLoad,
42
+ onClosed,
43
+ onReady,
44
+ onMessage,
45
+ onResized,
46
+ ...iframeProps
47
+ } = props;
49
48
  return iframeProps;
50
49
  });
51
50
 
52
- var _excluded = ["title", "forwardRef"];
53
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
54
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
55
51
  function IframeResizer(props) {
56
52
  // eslint-disable-next-line react/prop-types
57
- var title = props.title,
58
- forwardRef = props.forwardRef,
59
- rest = _objectWithoutProperties(props, _excluded);
60
- var filteredProps = filterIframeAttribs(rest);
61
- var iframeRef = useRef(null);
62
- var onClose = function onClose() {
63
- var _iframeRef$current;
64
- warning(!iframeRef.current, "[iframe-resizer/react][".concat(iframeRef === null || iframeRef === void 0 || (_iframeRef$current = iframeRef.current) === null || _iframeRef$current === void 0 ? void 0 : _iframeRef$current.id, "] Close event ignored, to remove the iframe update your React component."));
53
+ const {
54
+ title,
55
+ forwardRef,
56
+ ...rest
57
+ } = props;
58
+ const filteredProps = filterIframeAttribs(rest);
59
+ const iframeRef = useRef(null);
60
+ const onClose = () => {
61
+ warning(!iframeRef.current, `[iframe-resizer/react][${iframeRef?.current?.id}] Close event ignored, to remove the iframe update your React component.`);
65
62
  return !iframeRef.current; // Allow React to close this
66
63
  };
67
64
 
68
65
  // This hook is only run once, as once iframe-resizer is bound, it will
69
66
  // deal with changes to the element and does not need recalling
70
- useEffect(function () {
71
- var iframe = iframeRef.current;
72
- var resizer = connectResizer(_objectSpread(_objectSpread({}, rest), {}, {
73
- onClose: onClose
74
- }))(iframe);
75
- return function () {
76
- return resizer === null || resizer === void 0 ? void 0 : resizer.disconnect();
77
- };
67
+ useEffect(() => {
68
+ const iframe = iframeRef.current;
69
+ const resizer = connectResizer({
70
+ ...rest,
71
+ onClose
72
+ })(iframe);
73
+ return () => resizer?.disconnect();
78
74
  }, []); // eslint-disable-line react-hooks/exhaustive-deps
79
75
 
80
- useImperativeHandle(forwardRef, function () {
81
- return {
82
- getRef: function getRef() {
83
- return iframeRef;
84
- },
85
- getElement: function getElement() {
86
- return iframeRef.current;
87
- },
88
- resize: function resize() {
89
- return iframeRef.current.iframeResizer.resize();
90
- },
91
- moveToAnchor: function moveToAnchor(anchor) {
92
- return iframeRef.current.iframeResizer.moveToAnchor(anchor);
93
- },
94
- sendMessage: function sendMessage(message, targetOrigin) {
95
- iframeRef.current.iframeResizer.sendMessage(message, targetOrigin);
96
- }
97
- };
98
- });
76
+ useImperativeHandle(forwardRef, () => ({
77
+ getRef: () => iframeRef,
78
+ getElement: () => iframeRef.current,
79
+ resize: () => iframeRef.current.iframeResizer.resize(),
80
+ moveToAnchor: anchor => iframeRef.current.iframeResizer.moveToAnchor(anchor),
81
+ sendMessage: (message, targetOrigin) => {
82
+ iframeRef.current.iframeResizer.sendMessage(message, targetOrigin);
83
+ }
84
+ }));
99
85
  return /*#__PURE__*/React.createElement("iframe", _extends({
100
86
  title: title
101
87
  }, filteredProps, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iframe-resizer/react",
3
- "version": "5.2.2-beta.4",
3
+ "version": "5.2.3",
4
4
  "license": "GPL-3.0",
5
5
  "homepage": "https://iframe-resizer.com",
6
6
  "author": {
@@ -21,8 +21,8 @@
21
21
  "module": "index.esm.js",
22
22
  "types": "iframe-resizer.react.d.ts",
23
23
  "peerDependencies": {
24
- "react": "^16.8.0 || ^17.0.0 || ^18.0.0",
25
- "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
24
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
25
+ "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
26
26
  },
27
27
  "keywords": [
28
28
  "iframe",
@@ -44,7 +44,7 @@
44
44
  ],
45
45
  "dependencies": {
46
46
  "@babel/runtime": "^7.25.0",
47
- "@iframe-resizer/core": "5.2.2-beta.4",
47
+ "@iframe-resizer/core": "5.2.3",
48
48
  "warning": "^4.0.3"
49
49
  }
50
50
  }