@times-components/star-button 0.3.85 → 0.4.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 +27 -0
- package/babel.config.js +2 -5
- package/dist/star-button.js +73 -1
- package/dist/styles/index.js +70 -1
- package/package.json +12 -19
- package/rnw.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,33 @@
|
|
|
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.4.0](https://github.com/newsuk/times-components/compare/@times-components/star-button@0.3.87...@times-components/star-button@0.4.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
|
+
|
|
17
|
+
## [0.3.87](https://github.com/newsuk/times-components/compare/@times-components/star-button@0.3.86...@times-components/star-button@0.3.87) (2022-08-05)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @times-components/star-button
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## [0.3.86](https://github.com/newsuk/times-components/compare/@times-components/star-button@0.3.85...@times-components/star-button@0.3.86) (2022-07-19)
|
|
26
|
+
|
|
27
|
+
**Note:** Version bump only for package @times-components/star-button
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
6
33
|
## [0.3.85](https://github.com/newsuk/times-components/compare/@times-components/star-button@0.3.84...@times-components/star-button@0.3.85) (2022-07-18)
|
|
7
34
|
|
|
8
35
|
**Note:** Version bump only for package @times-components/star-button
|
package/babel.config.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
module.exports = api => {
|
|
2
2
|
api.cache(true);
|
|
3
3
|
return {
|
|
4
|
-
plugins: [
|
|
5
|
-
|
|
6
|
-
"@babel/plugin-transform-react-display-name"
|
|
7
|
-
],
|
|
8
|
-
presets: ["module:metro-react-native-babel-preset"]
|
|
4
|
+
plugins: ["babel-plugin-styled-components"],
|
|
5
|
+
presets: ["@babel/preset-env", "@babel/preset-react"]
|
|
9
6
|
};
|
|
10
7
|
};
|
package/dist/star-button.js
CHANGED
|
@@ -1 +1,73 @@
|
|
|
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"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
|
|
14
|
+
var _link = _interopRequireDefault(require("@times-components/link"));
|
|
15
|
+
|
|
16
|
+
var _icons = require("@times-components/icons");
|
|
17
|
+
|
|
18
|
+
var _styles = _interopRequireWildcard(require("./styles"));
|
|
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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
|
+
|
|
26
|
+
var StarButton = function StarButton(_ref) {
|
|
27
|
+
var disabled = _ref.disabled,
|
|
28
|
+
height = _ref.height,
|
|
29
|
+
isDark = _ref.isDark,
|
|
30
|
+
onPress = _ref.onPress,
|
|
31
|
+
selected = _ref.selected,
|
|
32
|
+
style = _ref.style;
|
|
33
|
+
var stars = (0, _styles.getTheme)({
|
|
34
|
+
isDark: isDark
|
|
35
|
+
});
|
|
36
|
+
var starState = disabled && "disabled" || selected && "selected" || "initial";
|
|
37
|
+
var _stars$starState = stars[starState],
|
|
38
|
+
fillColour = _stars$starState.fillColour,
|
|
39
|
+
opacity = _stars$starState.opacity,
|
|
40
|
+
strokeColour = _stars$starState.strokeColour;
|
|
41
|
+
return (
|
|
42
|
+
/*#__PURE__*/
|
|
43
|
+
// eslint-disable-next-line jsx-a11y/anchor-is-valid
|
|
44
|
+
_react["default"].createElement(_link["default"], {
|
|
45
|
+
disabled: disabled,
|
|
46
|
+
linkStyle: [_styles["default"].container, style],
|
|
47
|
+
onPress: onPress
|
|
48
|
+
}, /*#__PURE__*/_react["default"].createElement(_icons.IconStar, {
|
|
49
|
+
fillColour: fillColour,
|
|
50
|
+
height: height,
|
|
51
|
+
opacity: opacity,
|
|
52
|
+
strokeColour: strokeColour
|
|
53
|
+
}))
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
StarButton.propTypes = {
|
|
58
|
+
disabled: _propTypes["default"].bool,
|
|
59
|
+
height: _propTypes["default"].number,
|
|
60
|
+
isDark: _propTypes["default"].bool,
|
|
61
|
+
style: _propTypes["default"].shape({}),
|
|
62
|
+
onPress: _propTypes["default"].func.isRequired,
|
|
63
|
+
selected: _propTypes["default"].bool
|
|
64
|
+
};
|
|
65
|
+
StarButton.defaultProps = {
|
|
66
|
+
disabled: false,
|
|
67
|
+
height: 18,
|
|
68
|
+
isDark: false,
|
|
69
|
+
style: null,
|
|
70
|
+
selected: false
|
|
71
|
+
};
|
|
72
|
+
var _default = StarButton;
|
|
73
|
+
exports["default"] = _default;
|
package/dist/styles/index.js
CHANGED
|
@@ -1 +1,70 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = exports.getTheme = void 0;
|
|
7
|
+
|
|
8
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
9
|
+
|
|
10
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
11
|
+
|
|
12
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
|
+
|
|
14
|
+
var styles = {
|
|
15
|
+
container: {
|
|
16
|
+
borderRadius: 9999,
|
|
17
|
+
height: 28,
|
|
18
|
+
overflow: "hidden",
|
|
19
|
+
width: 28,
|
|
20
|
+
alignItems: "center",
|
|
21
|
+
justifyContent: "center"
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
var themes = {
|
|
25
|
+
dark: {
|
|
26
|
+
"default": "#CCC",
|
|
27
|
+
selected: "#3C81BE"
|
|
28
|
+
},
|
|
29
|
+
light: {
|
|
30
|
+
"default": "#696969",
|
|
31
|
+
selected: "#006699"
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var lightStar = {
|
|
35
|
+
disabled: {
|
|
36
|
+
fillColour: "none",
|
|
37
|
+
opacity: "0.4",
|
|
38
|
+
strokeColour: themes.light["default"]
|
|
39
|
+
},
|
|
40
|
+
initial: {
|
|
41
|
+
fillColour: "none",
|
|
42
|
+
opacity: "1",
|
|
43
|
+
strokeColour: themes.light["default"]
|
|
44
|
+
},
|
|
45
|
+
selected: {
|
|
46
|
+
fillColour: themes.light.selected,
|
|
47
|
+
opacity: "1",
|
|
48
|
+
strokeColour: "none"
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
var darkStar = {
|
|
52
|
+
disabled: _objectSpread(_objectSpread({}, lightStar.disabled), {}, {
|
|
53
|
+
strokeColour: themes.dark["default"]
|
|
54
|
+
}),
|
|
55
|
+
initial: _objectSpread(_objectSpread({}, lightStar.initial), {}, {
|
|
56
|
+
strokeColour: themes.dark["default"]
|
|
57
|
+
}),
|
|
58
|
+
selected: _objectSpread(_objectSpread({}, lightStar.selected), {}, {
|
|
59
|
+
fillColour: themes.dark.selected
|
|
60
|
+
})
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
var getTheme = function getTheme(_ref) {
|
|
64
|
+
var isDark = _ref.isDark;
|
|
65
|
+
return isDark ? darkStar : lightStar;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
exports.getTheme = getTheme;
|
|
69
|
+
var _default = styles;
|
|
70
|
+
exports["default"] = _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@times-components/star-button",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Star button",
|
|
5
5
|
"main": "dist/star-button",
|
|
6
6
|
"dev": "src/star-button",
|
|
@@ -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__/
|
|
12
|
+
"test:web": "jest --config='./__tests__/jest.config.js'",
|
|
13
13
|
"prepublishOnly": "yarn transpile && yarn bundle",
|
|
14
14
|
"cleanup-dist": "rm -rf dist",
|
|
15
15
|
"transpile": "yarn cleanup-dist && babel src -d dist",
|
|
@@ -21,10 +21,7 @@
|
|
|
21
21
|
"url": "git+https://github.com/newsuk/times-components.git"
|
|
22
22
|
},
|
|
23
23
|
"keywords": [
|
|
24
|
-
"react-native-web",
|
|
25
24
|
"react",
|
|
26
|
-
"native",
|
|
27
|
-
"web",
|
|
28
25
|
"star-button",
|
|
29
26
|
"component"
|
|
30
27
|
],
|
|
@@ -36,25 +33,23 @@
|
|
|
36
33
|
"devDependencies": {
|
|
37
34
|
"@babel/core": "7.4.4",
|
|
38
35
|
"@times-components/eslint-config-thetimes": "0.8.18",
|
|
39
|
-
"@times-components/jest-configurator": "
|
|
40
|
-
"@times-components/jest-serializer": "3.
|
|
41
|
-
"@times-components/storybook": "4.
|
|
42
|
-
"@times-components/test-utils": "2.
|
|
43
|
-
"@times-components/webpack-configurator": "2.0
|
|
36
|
+
"@times-components/jest-configurator-web": "0.8.0",
|
|
37
|
+
"@times-components/jest-serializer": "3.4.0",
|
|
38
|
+
"@times-components/storybook": "4.5.0",
|
|
39
|
+
"@times-components/test-utils": "2.4.0",
|
|
40
|
+
"@times-components/webpack-configurator": "2.1.0",
|
|
44
41
|
"babel-jest": "24.8.0",
|
|
45
42
|
"eslint": "5.9.0",
|
|
46
43
|
"jest": "24.8.0",
|
|
47
44
|
"prettier": "1.14.3",
|
|
48
45
|
"react": "16.9.0",
|
|
49
46
|
"react-dom": "16.9.0",
|
|
50
|
-
"react-native": "0.61.5",
|
|
51
47
|
"react-test-renderer": "16.9.0",
|
|
52
|
-
"webpack": "4.30.0"
|
|
53
|
-
"webpack-cli": "3.3.1"
|
|
48
|
+
"webpack": "4.30.0"
|
|
54
49
|
},
|
|
55
50
|
"dependencies": {
|
|
56
|
-
"@times-components/icons": "2.
|
|
57
|
-
"@times-components/link": "3.
|
|
51
|
+
"@times-components/icons": "2.19.0",
|
|
52
|
+
"@times-components/link": "3.11.0",
|
|
58
53
|
"prop-types": "15.7.2"
|
|
59
54
|
},
|
|
60
55
|
"resolutions": {
|
|
@@ -63,12 +58,10 @@
|
|
|
63
58
|
},
|
|
64
59
|
"peerDependencies": {
|
|
65
60
|
"react": ">=16.9",
|
|
66
|
-
"react-dom": ">=16.9"
|
|
67
|
-
"react-native": ">=0.59",
|
|
68
|
-
"react-native-web": "0.11.4"
|
|
61
|
+
"react-dom": ">=16.9"
|
|
69
62
|
},
|
|
70
63
|
"publishConfig": {
|
|
71
64
|
"access": "public"
|
|
72
65
|
},
|
|
73
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "fe2f12b7448a88662c53f840772282cd97756c5c"
|
|
74
67
|
}
|
package/rnw.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports=function(e){var t={};function r(
|
|
1
|
+
module.exports=function(e){var t={};function r(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(o,n,function(t){return e[t]}.bind(null,n));return o},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=4)}([function(e,t){e.exports=require("react")},function(e,t){e.exports=require("@times-components/link/rnw")},function(e,t){e.exports=require("@times-components/icons/rnw")},function(e,t){e.exports=require("prop-types")},function(e,t,r){"use strict";r.r(t);var o=r(0),n=r.n(o),i=(r(3),r(1)),l=r.n(i),u=r(2);function c(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?c(Object(r),!0).forEach((function(t){s(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var f={default:"#CCC",selected:"#3C81BE"},d={default:"#696969",selected:"#006699"},p={disabled:{fillColour:"none",opacity:"0.4",strokeColour:d.default},initial:{fillColour:"none",opacity:"1",strokeColour:d.default},selected:{fillColour:d.selected,opacity:"1",strokeColour:"none"}},b={disabled:a(a({},p.disabled),{},{strokeColour:f.default}),initial:a(a({},p.initial),{},{strokeColour:f.default}),selected:a(a({},p.selected),{},{fillColour:f.selected})},y={container:{borderRadius:9999,height:28,overflow:"hidden",width:28,alignItems:"center",justifyContent:"center"}},O=function(e){var t=e.disabled,r=e.height,o=e.isDark,i=e.onPress,c=e.selected,a=e.style,s=function(e){return e.isDark?b:p}({isDark:o})[(t?"disabled":c&&"selected")||"initial"],f=s.fillColour,d=s.opacity,O=s.strokeColour;return n.a.createElement(l.a,{disabled:t,linkStyle:[y.container,a],onPress:i},n.a.createElement(u.IconStar,{fillColour:f,height:r,opacity:d,strokeColour:O}))};O.defaultProps={disabled:!1,height:18,isDark:!1,style:null,selected:!1};t.default=O}]);
|