@times-components/interactive-wrapper 0.9.90 → 0.9.91
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/CHANGELOG.md +11 -0
- package/dist/interactive-wrapper.js +8 -7
- package/dist/styles.js +47 -0
- package/package.json +5 -4
- package/rnw.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.9.91](https://github.com/newsuk/times-components/compare/@times-components/interactive-wrapper@0.9.90...@times-components/interactive-wrapper@0.9.91) (2024-12-12)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **TMRS-575:** iframe component heights ([#4006](https://github.com/newsuk/times-components/issues/4006)) ([f4c3691](https://github.com/newsuk/times-components/commit/f4c36910a5a5d7e82dcfd10acfa62e3b3278154f))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [0.9.90](https://github.com/newsuk/times-components/compare/@times-components/interactive-wrapper@0.9.89...@times-components/interactive-wrapper@0.9.90) (2024-11-05)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @times-components/interactive-wrapper
|
|
@@ -12,6 +12,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
12
12
|
|
|
13
13
|
var _image = require("@times-components/image");
|
|
14
14
|
|
|
15
|
+
var _styles = require("./styles");
|
|
16
|
+
|
|
15
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
18
|
|
|
17
19
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -114,14 +116,13 @@ class InteractiveWrapper extends _react.Component {
|
|
|
114
116
|
}
|
|
115
117
|
|
|
116
118
|
render() {
|
|
117
|
-
|
|
119
|
+
const attributes = this.props.attributes;
|
|
120
|
+
return /*#__PURE__*/_react.default.createElement(_styles.InteractiveWrapperContainer, null, /*#__PURE__*/_react.default.createElement(_styles.Container, {
|
|
118
121
|
ref: this.placeholder,
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}, /*#__PURE__*/_react.default.createElement(_image.Placeholder, null)), /*#__PURE__*/_react.default.createElement("div", {
|
|
124
|
-
ref: this.component
|
|
122
|
+
$height: attributes.height
|
|
123
|
+
}, /*#__PURE__*/_react.default.createElement(_image.Placeholder, null)), /*#__PURE__*/_react.default.createElement(_styles.InteractiveContainer, {
|
|
124
|
+
ref: this.component,
|
|
125
|
+
$height: attributes.height
|
|
125
126
|
}));
|
|
126
127
|
}
|
|
127
128
|
|
package/dist/styles.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.InteractiveWrapperContainer = exports.InteractiveContainer = exports.Container = void 0;
|
|
7
|
+
|
|
8
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
const Container = _styledComponents.default.div.withConfig({
|
|
13
|
+
displayName: "styles__Container",
|
|
14
|
+
componentId: "sc-1rzy94h-0"
|
|
15
|
+
})(["position:", ";width:100%;height:", "px;", " ", " ", ""], _ref => {
|
|
16
|
+
let $height = _ref.$height;
|
|
17
|
+
return $height && $height.xs ? "absolute" : "relative";
|
|
18
|
+
}, _ref2 => {
|
|
19
|
+
let $height = _ref2.$height;
|
|
20
|
+
return $height && $height.xs ? $height.xs : 150;
|
|
21
|
+
}, _ref3 => {
|
|
22
|
+
let $height = _ref3.$height;
|
|
23
|
+
return $height && $height.sm && "\n media (min-width: 520px) {\n height: ".concat($height.sm, "px;\n }\n ");
|
|
24
|
+
}, _ref4 => {
|
|
25
|
+
let $height = _ref4.$height;
|
|
26
|
+
return $height && $height.md && "\n @media (min-width: 768px) {\n height: ".concat($height.md, "px;\n }\n ");
|
|
27
|
+
}, _ref5 => {
|
|
28
|
+
let $height = _ref5.$height;
|
|
29
|
+
return $height && $height.lg && "\n @media (min-width: 1024px) {\n height: ".concat($height.lg, "px;\n }\n ");
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
exports.Container = Container;
|
|
33
|
+
const InteractiveContainer = (0, _styledComponents.default)(Container).withConfig({
|
|
34
|
+
displayName: "styles__InteractiveContainer",
|
|
35
|
+
componentId: "sc-1rzy94h-1"
|
|
36
|
+
})(["position:relative;height:", ";"], _ref6 => {
|
|
37
|
+
let $height = _ref6.$height;
|
|
38
|
+
return $height && $height.xs ? "".concat($height.xs, "px") : "auto";
|
|
39
|
+
});
|
|
40
|
+
exports.InteractiveContainer = InteractiveContainer;
|
|
41
|
+
|
|
42
|
+
const InteractiveWrapperContainer = _styledComponents.default.div.withConfig({
|
|
43
|
+
displayName: "styles__InteractiveWrapperContainer",
|
|
44
|
+
componentId: "sc-1rzy94h-2"
|
|
45
|
+
})(["position:relative;"]);
|
|
46
|
+
|
|
47
|
+
exports.InteractiveWrapperContainer = InteractiveWrapperContainer;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@times-components/interactive-wrapper",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.91",
|
|
4
4
|
"description": "Wrapper for legacy Interactive components ",
|
|
5
5
|
"main": "dist/interactive-wrapper",
|
|
6
6
|
"dev": "src/interactive-wrapper",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"fmt": "eslint . --fix && prettier --write '**/*.*'",
|
|
10
10
|
"prettier:diff": "prettier --list-different '**/*.*'",
|
|
11
11
|
"lint": "eslint . && yarn prettier:diff && yarn depcheck",
|
|
12
|
-
"test:web": "jest --config='./__tests__/jest.config.js'",
|
|
12
|
+
"test:web": "jest -u --config='./__tests__/jest.config.js'",
|
|
13
13
|
"test:web:updatesnapshot": "yarn test:web -u",
|
|
14
14
|
"prepublishOnly": "yarn transpile && yarn bundle",
|
|
15
15
|
"watch": "watch 'yarn bundle' ./src --ignoreDotFiles --ignoreUnreadable",
|
|
@@ -52,7 +52,8 @@
|
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@times-components/image": "6.18.2",
|
|
55
|
-
"prop-types": "15.7.2"
|
|
55
|
+
"prop-types": "15.7.2",
|
|
56
|
+
"styled-components": "4.3.2"
|
|
56
57
|
},
|
|
57
58
|
"resolutions": {
|
|
58
59
|
"react": "16.9.0",
|
|
@@ -65,5 +66,5 @@
|
|
|
65
66
|
"publishConfig": {
|
|
66
67
|
"access": "public"
|
|
67
68
|
},
|
|
68
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "18e7ddecdf3cc7fe7509f4fe7809344dcda06365"
|
|
69
70
|
}
|
package/rnw.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=
|
|
1
|
+
module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=4)}([function(e,t){e.exports=require("react")},function(e,t){e.exports=require("styled-components")},function(e,t){e.exports=require("@times-components/image/rnw")},function(e,t){e.exports=require("prop-types")},function(e,t,n){"use strict";n.r(t);var r=n(0),o=n.n(r),i=(n(3),n(2)),c=n(1),s=n.n(c);const l=s.a.div.withConfig({displayName:"styles__Container",componentId:"sc-1rzy94h-0"})(["position:",";width:100%;height:","px;"," "," ",""],e=>{let t=e.$height;return t&&t.xs?"absolute":"relative"},e=>{let t=e.$height;return t&&t.xs?t.xs:150},e=>{let t=e.$height;return t&&t.sm&&"\n media (min-width: 520px) {\n height: ".concat(t.sm,"px;\n }\n ")},e=>{let t=e.$height;return t&&t.md&&"\n @media (min-width: 768px) {\n height: ".concat(t.md,"px;\n }\n ")},e=>{let t=e.$height;return t&&t.lg&&"\n @media (min-width: 1024px) {\n height: ".concat(t.lg,"px;\n }\n ")}),u=s()(l).withConfig({displayName:"styles__InteractiveContainer",componentId:"sc-1rzy94h-1"})(["position:relative;height:",";"],e=>{let t=e.$height;return t&&t.xs?"".concat(t.xs,"px"):"auto"}),a=s.a.div.withConfig({displayName:"styles__InteractiveWrapperContainer",componentId:"sc-1rzy94h-2"})(["position:relative;"]);function p(e,t,n,r,o,i,c){try{var s=e[i](c),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function d(e,t){return document.body.querySelector(e)?Promise.resolve(null):new Promise((e,n)=>{const r=t();r.onload=e,r.onerror=n,document.body.appendChild(r)})}function m(){const e="import"in document.createElement("link"),t=!!document.registerElement;return e&&t?Promise.resolve():Promise.all([(n="https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/0.7.24/webcomponents-lite.min.js",d('script[src="'.concat(n,'"]'),()=>{const e=document.createElement("script");return e.setAttribute("async","async"),e.setAttribute("src",n),e})),new Promise(e=>{window.addEventListener("WebComponentsReady",e)})]);var n}n.d(t,"polyfillWCIfNecessary",(function(){return m})),n.d(t,"default",(function(){return h}));class h extends r.Component{constructor(e){super(e),this.placeholder=o.a.createRef(null),this.component=o.a.createRef(null)}componentDidMount(){(0,this.props.fetchPolyfill)().then(()=>{this.insertComponent()})}componentDidUpdate(){this.insertComponent()}insertComponent(){var e,t=this;return(e=function*(){const e=t.props,n=e.attributes,r=e.element,o=e.source,i=t.placeholder.current,c=t.component.current;c.innerHTML="",i.style.cssText+="display: block !important",c.innerHTML="";const s=document.createElement(r);var l;Object.keys(n).forEach(e=>s.setAttribute(e,n[e])),c.appendChild(s),s.outerHTML+="",i.style.cssText+="display: none !important",yield(l=o,d('link[href="'.concat(l,'"]'),()=>{const e=document.createElement("link");return e.setAttribute("href",l),e.setAttribute("rel","import"),e}))},function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function c(e){p(i,r,o,c,s,"next",e)}function s(e){p(i,r,o,c,s,"throw",e)}c(void 0)}))})()}render(){const e=this.props.attributes;return o.a.createElement(a,null,o.a.createElement(l,{ref:this.placeholder,$height:e.height},o.a.createElement(i.Placeholder,null)),o.a.createElement(u,{ref:this.component,$height:e.height}))}}h.defaultProps={attributes:{},fetchPolyfill:m}}]);
|