@times-components/storybook 4.4.1 → 4.5.0
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/babel.config.js +6 -5
- package/dist/decorators.js +69 -1
- package/dist/new-tab.js +47 -1
- package/dist/sections.js +9 -1
- package/dist/showcase-to-storybook.js +101 -1
- package/dist/storybook.js +74 -1
- package/dist/styles.js +96 -1
- package/package.json +7 -10
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
|
+
# [4.5.0](https://github.com/newsuk/times-components/compare/@times-components/storybook@4.4.1...@times-components/storybook@4.5.0) (2022-08-18)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **TDP-1712:** remove react-native foreverrrrr ([#3064](https://github.com/newsuk/times-components/issues/3064)) ([2a20cb5](https://github.com/newsuk/times-components/commit/2a20cb5abc10a4e7ca2d62487967f8fcf4eccb62)), closes [#3037](https://github.com/newsuk/times-components/issues/3037) [#3045](https://github.com/newsuk/times-components/issues/3045) [#3050](https://github.com/newsuk/times-components/issues/3050) [#3056](https://github.com/newsuk/times-components/issues/3056) [#3057](https://github.com/newsuk/times-components/issues/3057) [#3066](https://github.com/newsuk/times-components/issues/3066) [#3065](https://github.com/newsuk/times-components/issues/3065) [#3037](https://github.com/newsuk/times-components/issues/3037) [#3045](https://github.com/newsuk/times-components/issues/3045) [#3045](https://github.com/newsuk/times-components/issues/3045) [#3056](https://github.com/newsuk/times-components/issues/3056) [#3066](https://github.com/newsuk/times-components/issues/3066) [#3069](https://github.com/newsuk/times-components/issues/3069) [#3068](https://github.com/newsuk/times-components/issues/3068) [#3070](https://github.com/newsuk/times-components/issues/3070) [#3072](https://github.com/newsuk/times-components/issues/3072) [#3073](https://github.com/newsuk/times-components/issues/3073) [#3071](https://github.com/newsuk/times-components/issues/3071) [#3074](https://github.com/newsuk/times-components/issues/3074) [#3076](https://github.com/newsuk/times-components/issues/3076) [#3079](https://github.com/newsuk/times-components/issues/3079) [#3078](https://github.com/newsuk/times-components/issues/3078) [#3083](https://github.com/newsuk/times-components/issues/3083) [#3087](https://github.com/newsuk/times-components/issues/3087) [#3091](https://github.com/newsuk/times-components/issues/3091) [#3096](https://github.com/newsuk/times-components/issues/3096) [#3102](https://github.com/newsuk/times-components/issues/3102) [#3105](https://github.com/newsuk/times-components/issues/3105) [#3108](https://github.com/newsuk/times-components/issues/3108) [#3111](https://github.com/newsuk/times-components/issues/3111) [#3112](https://github.com/newsuk/times-components/issues/3112) [#3113](https://github.com/newsuk/times-components/issues/3113) [#3114](https://github.com/newsuk/times-components/issues/3114) [#3120](https://github.com/newsuk/times-components/issues/3120) [#3119](https://github.com/newsuk/times-components/issues/3119) [#3112](https://github.com/newsuk/times-components/issues/3112) [#3126](https://github.com/newsuk/times-components/issues/3126) [#3112](https://github.com/newsuk/times-components/issues/3112) [#3126](https://github.com/newsuk/times-components/issues/3126) [#3127](https://github.com/newsuk/times-components/issues/3127) [#3116](https://github.com/newsuk/times-components/issues/3116) [#3128](https://github.com/newsuk/times-components/issues/3128) [#3132](https://github.com/newsuk/times-components/issues/3132) [#3133](https://github.com/newsuk/times-components/issues/3133)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [4.4.1](https://github.com/newsuk/times-components/compare/@times-components/storybook@4.4.0...@times-components/storybook@4.4.1) (2022-08-05)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @times-components/storybook
|
package/babel.config.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
module.exports = api => {
|
|
2
2
|
api.cache(true);
|
|
3
3
|
return {
|
|
4
|
-
plugins: [
|
|
5
|
-
|
|
6
|
-
"@babel/
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
plugins: ["babel-plugin-styled-components"],
|
|
5
|
+
presets: [
|
|
6
|
+
"@babel/preset-env",
|
|
7
|
+
"@babel/preset-react",
|
|
8
|
+
"@babel/preset-typescript"
|
|
9
|
+
]
|
|
9
10
|
};
|
|
10
11
|
};
|
package/dist/decorators.js
CHANGED
|
@@ -1 +1,69 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.WhiteBgColorDecorator = exports.LateralSpacingDecorator = exports.BarSpacingDecorator = exports.CenteredDecorator = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _utils = require("@times-components/utils");
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
+
|
|
14
|
+
var CenteredDecorator = function CenteredDecorator(storyFn) {
|
|
15
|
+
return /*#__PURE__*/_react["default"].createElement(_utils.TcView, {
|
|
16
|
+
style: {
|
|
17
|
+
alignItems: "center",
|
|
18
|
+
bottom: 0,
|
|
19
|
+
flex: 1,
|
|
20
|
+
flexDirection: "row",
|
|
21
|
+
justifyContent: "center",
|
|
22
|
+
left: 0,
|
|
23
|
+
position: "absolute",
|
|
24
|
+
right: 0,
|
|
25
|
+
top: 0
|
|
26
|
+
}
|
|
27
|
+
}, storyFn());
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
exports.CenteredDecorator = CenteredDecorator;
|
|
31
|
+
|
|
32
|
+
var BarSpacingDecorator = function BarSpacingDecorator(storyFn) {
|
|
33
|
+
return /*#__PURE__*/_react["default"].createElement(_utils.TcView, {
|
|
34
|
+
style: {
|
|
35
|
+
flex: 1,
|
|
36
|
+
marginTop: 20
|
|
37
|
+
}
|
|
38
|
+
}, storyFn());
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
exports.BarSpacingDecorator = BarSpacingDecorator;
|
|
42
|
+
|
|
43
|
+
var LateralSpacingDecorator = function LateralSpacingDecorator(storyFn) {
|
|
44
|
+
return /*#__PURE__*/_react["default"].createElement(_utils.TcView, {
|
|
45
|
+
style: {
|
|
46
|
+
flex: 1,
|
|
47
|
+
marginLeft: 20,
|
|
48
|
+
marginRight: 20
|
|
49
|
+
}
|
|
50
|
+
}, storyFn());
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
exports.LateralSpacingDecorator = LateralSpacingDecorator;
|
|
54
|
+
|
|
55
|
+
var WhiteBgColorDecorator = function WhiteBgColorDecorator(storyFn) {
|
|
56
|
+
return /*#__PURE__*/_react["default"].createElement(_utils.TcView, {
|
|
57
|
+
style: {
|
|
58
|
+
backgroundColor: "white",
|
|
59
|
+
bottom: 0,
|
|
60
|
+
flex: 1,
|
|
61
|
+
left: 0,
|
|
62
|
+
position: "absolute",
|
|
63
|
+
right: 0,
|
|
64
|
+
top: 0
|
|
65
|
+
}
|
|
66
|
+
}, storyFn());
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
exports.WhiteBgColorDecorator = WhiteBgColorDecorator;
|
package/dist/new-tab.js
CHANGED
|
@@ -1 +1,47 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
+
|
|
12
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
13
|
+
|
|
14
|
+
var newTabStyles = {
|
|
15
|
+
position: "fixed",
|
|
16
|
+
right: 90,
|
|
17
|
+
top: 0,
|
|
18
|
+
zIndex: 9999,
|
|
19
|
+
borderRadius: "0 0 5px 5px",
|
|
20
|
+
backgroundColor: "#28C",
|
|
21
|
+
height: "22.5px",
|
|
22
|
+
display: "flex",
|
|
23
|
+
alignItems: "center",
|
|
24
|
+
justifyContent: "center",
|
|
25
|
+
padding: "0 10px"
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
function NewTab() {
|
|
29
|
+
return (typeof document === "undefined" ? "undefined" : _typeof(document)) === "object" && window !== window.top && /*#__PURE__*/_react["default"].createElement("a", {
|
|
30
|
+
href: "/iframe.html".concat(window.top.location.search),
|
|
31
|
+
rel: "noopener noreferrer",
|
|
32
|
+
target: "_blank",
|
|
33
|
+
style: newTabStyles
|
|
34
|
+
}, /*#__PURE__*/_react["default"].createElement("svg", {
|
|
35
|
+
height: "14px",
|
|
36
|
+
viewBox: "0 0 475.082 475.081"
|
|
37
|
+
}, /*#__PURE__*/_react["default"].createElement("g", {
|
|
38
|
+
fill: "white"
|
|
39
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
40
|
+
d: "M469.658,133.333L360.029,23.697c-3.621-3.617-7.909-5.424-12.854-5.424c-2.275,0-4.661,0.476-7.132,1.425c-7.426,3.237-11.139,8.852-11.139,16.846v54.821h-45.683c-20.174,0-38.879,1.047-56.101,3.14c-17.224,2.092-32.404,4.993-45.537,8.708c-13.134,3.708-24.983,8.326-35.547,13.846c-10.562,5.518-19.555,11.372-26.98,17.559c-7.426,6.186-13.943,13.23-19.558,21.129c-5.618,7.898-10.088,15.653-13.422,23.267c-3.328,7.616-5.992,15.99-7.992,25.125c-2.002,9.137-3.333,17.701-3.999,25.693c-0.666,7.994-0.999,16.657-0.999,25.979c0,10.663,1.668,22.271,4.998,34.838c3.331,12.559,6.995,23.407,10.992,32.545c3.996,9.13,8.709,18.603,14.134,28.403c5.424,9.802,9.182,16.317,11.276,19.555c2.093,3.23,4.095,6.187,5.997,8.85c1.903,2.474,4.377,3.71,7.421,3.71c0.765,0,1.902-0.186,3.427-0.568c4.377-2.095,6.279-5.325,5.708-9.705c-8.564-63.954-1.52-108.973,21.128-135.047c21.892-24.934,63.575-37.403,125.051-37.403h45.686v54.816c0,8.001,3.71,13.613,11.136,16.851c2.471,0.951,4.853,1.424,7.132,1.424c5.14,0,9.425-1.807,12.854-5.421l109.633-109.637c3.613-3.619,5.424-7.898,5.424-12.847C475.082,141.23,473.271,136.944,469.658,133.333z"
|
|
41
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
42
|
+
d: "M395.996,292.356c-3.625-1.529-6.951-0.763-9.993,2.283c-4.948,4.568-10.092,8.093-15.42,10.564c-3.433,1.902-5.141,4.66-5.141,8.277v61.104c0,12.562-4.466,23.308-13.415,32.26c-8.945,8.946-19.704,13.419-32.264,13.419H82.222c-12.564,0-23.318-4.473-32.264-13.419c-8.947-8.952-13.418-19.697-13.418-32.26V137.039c0-12.563,4.471-23.313,13.418-32.259c8.945-8.947,19.699-13.418,32.264-13.418h31.977c1.141,0,2.666-0.383,4.568-1.143c10.66-6.473,23.313-12.185,37.972-17.133c4.949-0.95,7.423-3.994,7.423-9.136c0-2.474-0.903-4.611-2.712-6.423c-1.809-1.804-3.946-2.708-6.423-2.708H82.226c-22.65,0-42.018,8.042-58.102,24.125C8.042,95.026,0,114.394,0,137.044v237.537c0,22.651,8.042,42.018,24.125,58.102c16.084,16.084,35.452,24.126,58.102,24.126h237.541c22.647,0,42.017-8.042,58.101-24.126c16.085-16.084,24.127-35.45,24.127-58.102v-73.946C401.995,296.829,399.996,294.071,395.996,292.356z"
|
|
43
|
+
}))));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
var _default = NewTab;
|
|
47
|
+
exports["default"] = _default;
|
package/dist/sections.js
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var sections = ["Arts & Features", "Bricks & Mortar", "Business", "Comment", "Culture", "Driving", "Focus", "Gardening", "Home", "Ireland", "Law", "Money", "News", "News Review", "Puzzles", "Register", "Saturday Review", "Scotland", "Sport", "Style", "Tech & Games", "The Dish", "The Game", "The Sunday Times Magazine", "The Times Magazine", "Times2", "Today's Magazines", "Travel", "Weekend", "World"];
|
|
8
|
+
var _default = sections;
|
|
9
|
+
exports["default"] = _default;
|
|
@@ -1 +1,101 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = exports.isCorrectPlatform = exports.StrictWrapper = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _reactHelmetAsync = require("react-helmet-async");
|
|
13
|
+
|
|
14
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
+
|
|
16
|
+
var _userState = require("@times-components/user-state");
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
+
|
|
20
|
+
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); }
|
|
21
|
+
|
|
22
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
+
|
|
24
|
+
function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); }
|
|
25
|
+
|
|
26
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
27
|
+
|
|
28
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
29
|
+
|
|
30
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
31
|
+
|
|
32
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
33
|
+
|
|
34
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
35
|
+
|
|
36
|
+
_react["default"].Fragment = function (_ref) {
|
|
37
|
+
var children = _ref.children;
|
|
38
|
+
return children;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
_react["default"].Fragment.propTypes = {
|
|
42
|
+
children: _propTypes["default"].node.isRequired
|
|
43
|
+
};
|
|
44
|
+
_react["default"].Fragment.displayName = "React.Fragment"; // eslint-disable-next-line react/prop-types
|
|
45
|
+
|
|
46
|
+
var StrictWrapper = function StrictWrapper(_ref2) {
|
|
47
|
+
var children = _ref2.children;
|
|
48
|
+
return /*#__PURE__*/_react["default"].createElement(_react.StrictMode, null, /*#__PURE__*/_react["default"].createElement(_reactHelmetAsync.HelmetProvider, {
|
|
49
|
+
context: {}
|
|
50
|
+
}, children));
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
exports.StrictWrapper = StrictWrapper;
|
|
54
|
+
|
|
55
|
+
var addStories = function addStories(builder, knobs, actions, _ref3) {
|
|
56
|
+
var _ref4 = _toArray(_ref3),
|
|
57
|
+
child = _ref4[0],
|
|
58
|
+
children = _ref4.slice(1);
|
|
59
|
+
|
|
60
|
+
var strictMode = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
61
|
+
|
|
62
|
+
if (!child) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (child.type === "story") {
|
|
67
|
+
var args = [knobs, actions];
|
|
68
|
+
builder.add(child.name, function () {
|
|
69
|
+
(0, _userState.addUserStateKnobs)(child.defaultUserState);
|
|
70
|
+
return strictMode ? /*#__PURE__*/_react["default"].createElement(StrictWrapper, null, child.component.apply(child, args)) : child.component.apply(child, args);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (child.type === "decorator") {
|
|
75
|
+
builder.addDecorator(child.decorator);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
addStories(builder, knobs, actions, children);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
var isCorrectPlatform = function isCorrectPlatform(_ref5) {
|
|
82
|
+
var platform = _ref5.platform;
|
|
83
|
+
return !platform || platform;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
exports.isCorrectPlatform = isCorrectPlatform;
|
|
87
|
+
|
|
88
|
+
var converter = function converter(storiesOf, knobs, actions) {
|
|
89
|
+
return function (module) {
|
|
90
|
+
var _ref6 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
91
|
+
name = _ref6.name,
|
|
92
|
+
_ref6$children = _ref6.children,
|
|
93
|
+
children = _ref6$children === void 0 ? [] : _ref6$children;
|
|
94
|
+
|
|
95
|
+
var strictMode = arguments.length > 2 ? arguments[2] : undefined;
|
|
96
|
+
return addStories(storiesOf(name, module), knobs, actions, children.filter(isCorrectPlatform), strictMode);
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
var _default = converter;
|
|
101
|
+
exports["default"] = _default;
|
package/dist/storybook.js
CHANGED
|
@@ -1 +1,74 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
var _exportNames = {
|
|
9
|
+
BarSpacingDecorator: true,
|
|
10
|
+
CenteredDecorator: true,
|
|
11
|
+
LateralSpacingDecorator: true,
|
|
12
|
+
showcaseConverter: true,
|
|
13
|
+
WhiteBgColorDecorator: true,
|
|
14
|
+
sections: true,
|
|
15
|
+
NewTab: true
|
|
16
|
+
};
|
|
17
|
+
Object.defineProperty(exports, "sections", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function get() {
|
|
20
|
+
return _sections["default"];
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports, "NewTab", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function get() {
|
|
26
|
+
return _newTab["default"];
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
exports.WhiteBgColorDecorator = exports.showcaseConverter = exports.LateralSpacingDecorator = exports.CenteredDecorator = exports.BarSpacingDecorator = void 0;
|
|
30
|
+
|
|
31
|
+
var _react = require("@storybook/react");
|
|
32
|
+
|
|
33
|
+
var actions = _interopRequireWildcard(require("@storybook/addon-actions"));
|
|
34
|
+
|
|
35
|
+
var builtInKnobs = _interopRequireWildcard(require("@storybook/addon-knobs/react"));
|
|
36
|
+
|
|
37
|
+
var decorators = _interopRequireWildcard(require("./decorators"));
|
|
38
|
+
|
|
39
|
+
var _showcaseToStorybook = _interopRequireDefault(require("./showcase-to-storybook"));
|
|
40
|
+
|
|
41
|
+
var _sections = _interopRequireDefault(require("./sections"));
|
|
42
|
+
|
|
43
|
+
var _newTab = _interopRequireDefault(require("./new-tab"));
|
|
44
|
+
|
|
45
|
+
var _styles = require("./styles");
|
|
46
|
+
|
|
47
|
+
Object.keys(_styles).forEach(function (key) {
|
|
48
|
+
if (key === "default" || key === "__esModule") return;
|
|
49
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
50
|
+
if (key in exports && exports[key] === _styles[key]) return;
|
|
51
|
+
Object.defineProperty(exports, key, {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function get() {
|
|
54
|
+
return _styles[key];
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
60
|
+
|
|
61
|
+
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); }
|
|
62
|
+
|
|
63
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
64
|
+
|
|
65
|
+
var CenteredDecorator = decorators.CenteredDecorator,
|
|
66
|
+
BarSpacingDecorator = decorators.BarSpacingDecorator,
|
|
67
|
+
LateralSpacingDecorator = decorators.LateralSpacingDecorator,
|
|
68
|
+
WhiteBgColorDecorator = decorators.WhiteBgColorDecorator;
|
|
69
|
+
exports.WhiteBgColorDecorator = WhiteBgColorDecorator;
|
|
70
|
+
exports.LateralSpacingDecorator = LateralSpacingDecorator;
|
|
71
|
+
exports.BarSpacingDecorator = BarSpacingDecorator;
|
|
72
|
+
exports.CenteredDecorator = CenteredDecorator;
|
|
73
|
+
var showcaseConverter = (0, _showcaseToStorybook["default"])(_react.storiesOf, builtInKnobs, actions);
|
|
74
|
+
exports.showcaseConverter = showcaseConverter;
|
package/dist/styles.js
CHANGED
|
@@ -1 +1,96 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.createScopedGlobalStyle = createScopedGlobalStyle;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _styledComponents = require("styled-components");
|
|
13
|
+
|
|
14
|
+
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); }
|
|
15
|
+
|
|
16
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
+
|
|
18
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
19
|
+
|
|
20
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
21
|
+
|
|
22
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
23
|
+
|
|
24
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
25
|
+
|
|
26
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
27
|
+
|
|
28
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
29
|
+
|
|
30
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
31
|
+
|
|
32
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
33
|
+
|
|
34
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
35
|
+
|
|
36
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
37
|
+
|
|
38
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
39
|
+
|
|
40
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
41
|
+
|
|
42
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
43
|
+
|
|
44
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
45
|
+
|
|
46
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
47
|
+
|
|
48
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
49
|
+
|
|
50
|
+
function createScopedGlobalStyle(strings) {
|
|
51
|
+
var className = "scoped-style-".concat(Math.random().toString(36).substr(2, 5));
|
|
52
|
+
|
|
53
|
+
var copiedStrings = _toConsumableArray(strings);
|
|
54
|
+
|
|
55
|
+
copiedStrings[0] = ".".concat(className, " { ").concat(copiedStrings[0]);
|
|
56
|
+
copiedStrings[copiedStrings.length - 1] = "".concat(copiedStrings[copiedStrings.length - 1], " }");
|
|
57
|
+
|
|
58
|
+
for (var _len = arguments.length, attrs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
59
|
+
attrs[_key - 1] = arguments[_key];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
var InnerStyleComponent = _styledComponents.createGlobalStyle.apply(void 0, [copiedStrings].concat(attrs));
|
|
63
|
+
|
|
64
|
+
var GlobalStyle = /*#__PURE__*/function (_Component) {
|
|
65
|
+
_inherits(GlobalStyle, _Component);
|
|
66
|
+
|
|
67
|
+
var _super = _createSuper(GlobalStyle);
|
|
68
|
+
|
|
69
|
+
function GlobalStyle() {
|
|
70
|
+
_classCallCheck(this, GlobalStyle);
|
|
71
|
+
|
|
72
|
+
return _super.apply(this, arguments);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
_createClass(GlobalStyle, [{
|
|
76
|
+
key: "componentDidMount",
|
|
77
|
+
value: function componentDidMount() {
|
|
78
|
+
document.documentElement.classList.add(className);
|
|
79
|
+
}
|
|
80
|
+
}, {
|
|
81
|
+
key: "componentWillUnmount",
|
|
82
|
+
value: function componentWillUnmount() {
|
|
83
|
+
document.documentElement.classList.remove(className);
|
|
84
|
+
}
|
|
85
|
+
}, {
|
|
86
|
+
key: "render",
|
|
87
|
+
value: function render() {
|
|
88
|
+
return /*#__PURE__*/_react["default"].createElement(InnerStyleComponent, null);
|
|
89
|
+
}
|
|
90
|
+
}]);
|
|
91
|
+
|
|
92
|
+
return GlobalStyle;
|
|
93
|
+
}(_react.Component);
|
|
94
|
+
|
|
95
|
+
return GlobalStyle;
|
|
96
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@times-components/storybook",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0",
|
|
4
4
|
"description": "React storybook helpers for Times Components",
|
|
5
5
|
"main": "dist/storybook",
|
|
6
6
|
"dev": "src/storybook",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"prettier:diff": "prettier --list-different '**/*.*'",
|
|
10
10
|
"depcheck": "depcheck --ignores='@babel/*,babel-*,depcheck,eslint,jest,prettier,react-art,webpack*' --ignore-bin-package=false --skip-missing",
|
|
11
11
|
"lint": "eslint . && yarn prettier:diff && yarn depcheck",
|
|
12
|
-
"test:web": "jest --config='./__tests__/
|
|
12
|
+
"test:web": "jest --config='./__tests__/jest.config.js'",
|
|
13
13
|
"prepublishOnly": "yarn transpile",
|
|
14
14
|
"cleanup-dist": "rm -rf dist",
|
|
15
15
|
"transpile": "yarn cleanup-dist && babel src -d dist"
|
|
@@ -25,15 +25,12 @@
|
|
|
25
25
|
"homepage": "https://github.com/newsuk/times-components#readme",
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@babel/core": "7.4.4",
|
|
28
|
-
"@times-components/jest-configurator": "
|
|
28
|
+
"@times-components/jest-configurator-web": "0.8.0",
|
|
29
29
|
"babel-jest": "24.8.0",
|
|
30
|
-
"babel-plugin-add-react-displayname": "0.0.5",
|
|
31
|
-
"babel-plugin-styled-components": "1.10.6",
|
|
32
30
|
"depcheck": "0.6.9",
|
|
33
31
|
"eslint": "5.9.0",
|
|
34
32
|
"jest": "24.8.0",
|
|
35
33
|
"prettier": "1.14.3",
|
|
36
|
-
"react-art": "16.6.3",
|
|
37
34
|
"react-test-renderer": "16.9.0"
|
|
38
35
|
},
|
|
39
36
|
"dependencies": {
|
|
@@ -41,9 +38,9 @@
|
|
|
41
38
|
"@storybook/addon-actions": "5.3.18",
|
|
42
39
|
"@storybook/addon-knobs": "5.3.18",
|
|
43
40
|
"@storybook/react": "5.3.18",
|
|
44
|
-
"@times-components/schema": "0.7.
|
|
45
|
-
"@times-components/user-state": "0.
|
|
46
|
-
"@times-components/utils": "6.
|
|
41
|
+
"@times-components/schema": "0.7.3",
|
|
42
|
+
"@times-components/user-state": "0.4.0",
|
|
43
|
+
"@times-components/utils": "6.15.0",
|
|
47
44
|
"apollo-cache-inmemory": "1.5.1",
|
|
48
45
|
"apollo-client": "2.5.1",
|
|
49
46
|
"apollo-link-http": "1.5.14",
|
|
@@ -64,5 +61,5 @@
|
|
|
64
61
|
"publishConfig": {
|
|
65
62
|
"access": "public"
|
|
66
63
|
},
|
|
67
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "fe2f12b7448a88662c53f840772282cd97756c5c"
|
|
68
65
|
}
|