@twreporter/react-components 8.18.1 → 8.19.0-rc.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 +12 -0
- package/lib/button/components/link.js +10 -4
- package/lib/button/stories/link.stories.js +16 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
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
|
+
# [8.19.0-rc.0](https://github.com/twreporter/twreporter-npm-packages/compare/@twreporter/react-components@8.18.1...@twreporter/react-components@8.19.0-rc.0) (2023-09-04)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* add disabled style for button/link ([aa54a66](https://github.com/twreporter/twreporter-npm-packages/commit/aa54a66dc1b8f73fa0ff4c373e3450b86117f8cb))
|
|
12
|
+
* add disabled style for LinkButton ([51e42e7](https://github.com/twreporter/twreporter-npm-packages/commit/51e42e7e45d21a0f7c27fa8c6e1bb798c91708f6))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
6
18
|
## [8.18.1](https://github.com/twreporter/twreporter-npm-packages/compare/@twreporter/react-components@8.18.1-rc.11...@twreporter/react-components@8.18.1) (2023-08-31)
|
|
7
19
|
|
|
8
20
|
**Note:** Version bump only for package @twreporter/react-components
|
|
@@ -19,7 +19,7 @@ var _enums = require("../enums");
|
|
|
19
19
|
|
|
20
20
|
var _color2 = require("@twreporter/core/lib/constants/color");
|
|
21
21
|
|
|
22
|
-
var _excluded = ["type", "link", "text", "weight", "TextComponent"];
|
|
22
|
+
var _excluded = ["type", "link", "text", "weight", "TextComponent", "disabled"];
|
|
23
23
|
|
|
24
24
|
var _decoration, _color;
|
|
25
25
|
|
|
@@ -40,10 +40,12 @@ var style = {
|
|
|
40
40
|
var LinkContainer = /*#__PURE__*/(0, _styledComponents["default"])(_customizedLink["default"]).withConfig({
|
|
41
41
|
displayName: "link__LinkContainer",
|
|
42
42
|
componentId: "g5z7t5-0"
|
|
43
|
-
})(["display:flex;align-items:center;text-underline-offset:4px;text-decoration-line:", ";color:", "
|
|
43
|
+
})(["display:flex;align-items:center;text-underline-offset:4px;text-decoration-line:", ";color:", ";", ""], function (props) {
|
|
44
44
|
return style.decoration[props.type];
|
|
45
45
|
}, function (props) {
|
|
46
46
|
return style.color[props.type];
|
|
47
|
+
}, function (props) {
|
|
48
|
+
return props.disabled ? "\n opacity: 0.5;\n cursor: auto;\n " : "\n &:hover {\n text-decoration-line: underline;\n }\n ";
|
|
47
49
|
});
|
|
48
50
|
|
|
49
51
|
var LinkButton = function LinkButton(_ref) {
|
|
@@ -57,6 +59,8 @@ var LinkButton = function LinkButton(_ref) {
|
|
|
57
59
|
weight = _ref$weight === void 0 ? _paragraph.P1.Weight.NORMAL : _ref$weight,
|
|
58
60
|
_ref$TextComponent = _ref.TextComponent,
|
|
59
61
|
TextComponent = _ref$TextComponent === void 0 ? null : _ref$TextComponent,
|
|
62
|
+
_ref$disabled = _ref.disabled,
|
|
63
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
60
64
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
61
65
|
|
|
62
66
|
var textJSX = TextComponent ? /*#__PURE__*/_react["default"].createElement(TextComponent, {
|
|
@@ -67,7 +71,8 @@ var LinkButton = function LinkButton(_ref) {
|
|
|
67
71
|
weight: weight
|
|
68
72
|
});
|
|
69
73
|
return /*#__PURE__*/_react["default"].createElement(LinkContainer, _extends({
|
|
70
|
-
type: type
|
|
74
|
+
type: type,
|
|
75
|
+
disabled: disabled
|
|
71
76
|
}, link, props), textJSX);
|
|
72
77
|
};
|
|
73
78
|
|
|
@@ -76,7 +81,8 @@ LinkButton.propTypes = {
|
|
|
76
81
|
link: _propTypes["default"].object,
|
|
77
82
|
text: _propTypes["default"].string.isRequired,
|
|
78
83
|
weight: _paragraph.P1.propTypes.weight,
|
|
79
|
-
TextComponent: _propTypes["default"].elementType
|
|
84
|
+
TextComponent: _propTypes["default"].elementType,
|
|
85
|
+
disabled: _propTypes["default"].bool
|
|
80
86
|
};
|
|
81
87
|
LinkButton.Type = _enums.LinkType;
|
|
82
88
|
LinkButton.Weight = _paragraph.P1.Weight;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.changeTextComponent = exports.link = exports["default"] = void 0;
|
|
6
|
+
exports.disabledLink = exports.changeTextComponent = exports.link = exports["default"] = void 0;
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
@@ -78,4 +78,19 @@ changeTextComponent.parameters = {
|
|
|
78
78
|
controls: {
|
|
79
79
|
exclude: ['TextComponent']
|
|
80
80
|
}
|
|
81
|
+
};
|
|
82
|
+
var disabledLink = Template.bind({});
|
|
83
|
+
exports.disabledLink = disabledLink;
|
|
84
|
+
disabledLink.args = {
|
|
85
|
+
text: '文字',
|
|
86
|
+
type: _link["default"].Type.DEFAULT,
|
|
87
|
+
link: {
|
|
88
|
+
to: 'https://www.twreporter.org'
|
|
89
|
+
},
|
|
90
|
+
disabled: true
|
|
91
|
+
};
|
|
92
|
+
disabledLink.parameters = {
|
|
93
|
+
controls: {
|
|
94
|
+
exclude: ['textComponent', 'disabled']
|
|
95
|
+
}
|
|
81
96
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twreporter/react-components",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.19.0-rc.0",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"repository": "https://github.com/twreporter/twreporter-npm-packages.git",
|
|
6
6
|
"author": "twreporter <developer@twreporter.org>",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"babel-loader": "^8.2.4",
|
|
45
45
|
"chromatic": "^6.5.4"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "a7aa816ea3278b40999c959a369905b73173013e"
|
|
48
48
|
}
|