@twreporter/react-components 8.17.0-rc.1 → 8.17.0-rc.11
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 +304 -784
- package/lib/bookmark-list/bookmarks.js +18 -2
- package/lib/button/components/iconButton.js +7 -5
- package/lib/button/components/iconWithTextButton.js +7 -6
- package/lib/button/components/link.js +84 -0
- package/lib/button/components/pillButton.js +35 -17
- package/lib/button/components/textButton.js +17 -14
- package/lib/button/constants/index.js +2 -15
- package/lib/button/enums/index.js +22 -0
- package/lib/button/index.js +10 -1
- package/lib/button/stories/iconButton.stories.js +10 -8
- package/lib/button/stories/iconWithTextButton.stories.js +4 -4
- package/lib/button/stories/link.stories.js +81 -0
- package/lib/button/stories/pillButton.stories.js +51 -20
- package/lib/button/stories/textButton.stories.js +52 -23
- package/lib/button/utils/size.js +2 -2
- package/lib/button/utils/theme.js +85 -43
- package/lib/card/components/article-card.js +192 -0
- package/lib/card/components/dialog.js +6 -3
- package/lib/card/index.js +10 -1
- package/lib/card/stories/articleCard.stories.js +55 -0
- package/lib/card/stories/dialog.stories.js +7 -2
- package/lib/checkbox/checkbox.stories.js +39 -0
- package/lib/checkbox/index.js +99 -0
- package/lib/divider.js +8 -2
- package/lib/divider.stories.js +3 -3
- package/lib/empty-state/enums/index.js +12 -0
- package/lib/empty-state/index.js +114 -0
- package/lib/empty-state/stories/empty-guide.stories.js +42 -0
- package/lib/icon/enum/index.js +34 -0
- package/lib/icon/index.js +99 -222
- package/lib/icon/stories/arrow.stories.js +7 -7
- package/lib/icon/stories/article.stories.js +2 -2
- package/lib/icon/stories/bookmark.stories.js +6 -6
- package/lib/icon/stories/clock.stories.js +2 -2
- package/lib/icon/stories/copy.stories.js +2 -2
- package/lib/icon/stories/cross.stories.js +2 -2
- package/lib/icon/stories/hamburger.stories.js +2 -2
- package/lib/icon/stories/home.stories.js +2 -2
- package/lib/icon/stories/letter.stories.js +29 -0
- package/lib/icon/stories/loading.stories.js +2 -2
- package/lib/icon/stories/member.stories.js +2 -2
- package/lib/icon/stories/printer.stories.js +2 -2
- package/lib/icon/stories/search.stories.js +2 -2
- package/lib/icon/stories/share.stories.js +2 -2
- package/lib/icon/stories/socialMedia.stories.js +7 -25
- package/lib/icon/stories/text.stories.js +2 -2
- package/lib/icon/stories/topic.stories.js +2 -2
- package/lib/image-with-fallback.js +141 -0
- package/lib/input/components/search-bar.js +6 -4
- package/lib/input/enums/index.js +11 -0
- package/lib/input/stories/search-bar.stories.js +8 -7
- package/lib/input/utils/theme.js +5 -3
- package/lib/listing-page/components/card-list.js +165 -0
- package/lib/listing-page/components/image.js +3 -0
- package/lib/listing-page/components/list.js +13 -8
- package/lib/listing-page/constants/prop-types.js +25 -0
- package/lib/listing-page/index.js +10 -1
- package/lib/listing-page/stories/cardList.stories.js +83 -0
- package/lib/logo/components/logo-header.js +8 -2
- package/lib/logo/components/logo-loading-fallback.js +43 -0
- package/lib/logo/components/logo-symbol.js +9 -2
- package/lib/logo/index.js +10 -1
- package/lib/logo/stories/logoFooter.stories.js +2 -2
- package/lib/logo/stories/logoHeader.stories.js +3 -3
- package/lib/logo/stories/logoLoadingFallback.stories.js +29 -0
- package/lib/logo/stories/logoSymbol.stories.js +3 -3
- package/lib/logo/utils/path.js +5 -0
- package/lib/material-icon.js +53 -0
- package/lib/pagination/index.js +8 -5
- package/lib/shared-enum.js +11 -0
- package/lib/snack-bar/components/snack-bar.js +2 -1
- package/lib/snack-bar/stories/snackBar.stories.js +4 -4
- package/lib/storybook/constants/index.js +27 -0
- package/lib/storybook/utils/get-enum-arg.js +18 -0
- package/lib/text/constants/headline-type.js +5 -24
- package/lib/text/enums/index.js +17 -0
- package/lib/text/headline.js +5 -2
- package/lib/text/paragraph.js +9 -6
- package/lib/text/stories/headline.stories.js +5 -3
- package/lib/text/stories/paragraph.stories.js +5 -3
- package/lib/title-bar/components/bar.js +2 -2
- package/lib/title-bar/components/tab.js +2 -2
- package/package.json +5 -4
- package/lib/bookmark-list/empty-guide.js +0 -81
- package/lib/bookmark-list/stories/empty-guide.stories.js +0 -39
- package/lib/button/constants/size.js +0 -28
- package/lib/button/constants/type.js +0 -28
- package/lib/input/constants/type.js +0 -20
- package/lib/text/constants/font-weight.js +0 -29
- package/lib/text/link.js +0 -87
- package/lib/text/stories/link.stories.js +0 -42
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.WEIGHT_STORYBOOK_ARG_TYPE = exports.WEIGHT_PROP_TYPES = exports.WEIGHT = void 0;
|
|
7
|
-
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
|
|
12
|
-
var WEIGHT = {
|
|
13
|
-
extraLight: 'extraLight',
|
|
14
|
-
normal: 'normal',
|
|
15
|
-
bold: 'bold'
|
|
16
|
-
};
|
|
17
|
-
exports.WEIGHT = WEIGHT;
|
|
18
|
-
|
|
19
|
-
var WEIGHT_PROP_TYPES = _propTypes["default"].oneOf([WEIGHT.extraLight, WEIGHT.normal, WEIGHT.bold]);
|
|
20
|
-
|
|
21
|
-
exports.WEIGHT_PROP_TYPES = WEIGHT_PROP_TYPES;
|
|
22
|
-
var WEIGHT_STORYBOOK_ARG_TYPE = {
|
|
23
|
-
defaultValue: WEIGHT.normal,
|
|
24
|
-
options: [WEIGHT.extraLight, WEIGHT.normal, WEIGHT.bold],
|
|
25
|
-
control: {
|
|
26
|
-
type: 'radio'
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
exports.WEIGHT_STORYBOOK_ARG_TYPE = WEIGHT_STORYBOOK_ARG_TYPE;
|
package/lib/text/link.js
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
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
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
|
-
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
13
|
-
|
|
14
|
-
var _theme = require("@twreporter/core/lib/constants/theme");
|
|
15
|
-
|
|
16
|
-
var _color = require("@twreporter/core/lib/constants/color");
|
|
17
|
-
|
|
18
|
-
var _excluded = ["path", "name", "theme", "isBold"];
|
|
19
|
-
|
|
20
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
|
-
|
|
22
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
23
|
-
|
|
24
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
25
|
-
|
|
26
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
27
|
-
|
|
28
|
-
var getColorFromTheme = function getColorFromTheme(theme) {
|
|
29
|
-
switch (theme) {
|
|
30
|
-
case _theme.ARTICLE_THEME.v2.photo:
|
|
31
|
-
return _color.COLOR_ARTICLE.milkTea;
|
|
32
|
-
|
|
33
|
-
case _theme.ARTICLE_THEME.v2.pink:
|
|
34
|
-
return _color.COLOR_ARTICLE.blue;
|
|
35
|
-
|
|
36
|
-
case _theme.ARTICLE_THEME.v2["default"]:
|
|
37
|
-
default:
|
|
38
|
-
return _color.COLOR_ARTICLE.brown;
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
var Text = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
43
|
-
displayName: "link__Text",
|
|
44
|
-
componentId: "pki7nr-0"
|
|
45
|
-
})(["color:", ";display:inline-block;font-size:16px;line-height:1;padding:", ";&:hover{padding-bottom:2px;border-width:0 0 1px 0;border-style:solid;border-color:", ";}"], function (props) {
|
|
46
|
-
return props.color;
|
|
47
|
-
}, function (props) {
|
|
48
|
-
return props.padding;
|
|
49
|
-
}, function (props) {
|
|
50
|
-
return props.color;
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
var Anchor = /*#__PURE__*/_styledComponents["default"].a.withConfig({
|
|
54
|
-
displayName: "link__Anchor",
|
|
55
|
-
componentId: "pki7nr-1"
|
|
56
|
-
})(["text-decoration:none;"]);
|
|
57
|
-
|
|
58
|
-
var TextLink = function TextLink(_ref) {
|
|
59
|
-
var _ref$path = _ref.path,
|
|
60
|
-
path = _ref$path === void 0 ? '' : _ref$path,
|
|
61
|
-
_ref$name = _ref.name,
|
|
62
|
-
name = _ref$name === void 0 ? '' : _ref$name,
|
|
63
|
-
_ref$theme = _ref.theme,
|
|
64
|
-
theme = _ref$theme === void 0 ? _theme.ARTICLE_THEME.v2["default"] : _ref$theme,
|
|
65
|
-
_ref$isBold = _ref.isBold,
|
|
66
|
-
isBold = _ref$isBold === void 0 ? false : _ref$isBold,
|
|
67
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
68
|
-
|
|
69
|
-
var color = getColorFromTheme(theme);
|
|
70
|
-
return /*#__PURE__*/_react["default"].createElement(Anchor, {
|
|
71
|
-
href: path
|
|
72
|
-
}, /*#__PURE__*/_react["default"].createElement(Text, _extends({
|
|
73
|
-
color: color,
|
|
74
|
-
style: {
|
|
75
|
-
fontWeight: isBold ? 'bold' : 'normal'
|
|
76
|
-
}
|
|
77
|
-
}, props), name));
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
TextLink.propTypes = {
|
|
81
|
-
path: _propTypes["default"].string.isRequired,
|
|
82
|
-
name: _propTypes["default"].string,
|
|
83
|
-
theme: _propTypes["default"].string,
|
|
84
|
-
isBold: _propTypes["default"].bool
|
|
85
|
-
};
|
|
86
|
-
var _default = TextLink;
|
|
87
|
-
exports["default"] = _default;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.textLink = exports["default"] = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
|
-
var _link = _interopRequireDefault(require("../link"));
|
|
11
|
-
|
|
12
|
-
var _theme = require("@twreporter/core/lib/constants/theme");
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
-
|
|
16
|
-
var _default = {
|
|
17
|
-
title: 'Text/Link',
|
|
18
|
-
component: _link["default"],
|
|
19
|
-
argTypes: {
|
|
20
|
-
theme: {
|
|
21
|
-
defaultValue: _theme.ARTICLE_THEME.v2["default"],
|
|
22
|
-
options: [_theme.ARTICLE_THEME.v2["default"], _theme.ARTICLE_THEME.v2.pink, _theme.ARTICLE_THEME.v2.photo],
|
|
23
|
-
control: {
|
|
24
|
-
type: 'radio'
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
exports["default"] = _default;
|
|
30
|
-
|
|
31
|
-
var Template = function Template(args) {
|
|
32
|
-
return /*#__PURE__*/_react["default"].createElement(_link["default"], args);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
var textLink = Template.bind({});
|
|
36
|
-
exports.textLink = textLink;
|
|
37
|
-
textLink.args = {
|
|
38
|
-
name: '分類',
|
|
39
|
-
path: '/categories/human_rights_and_society',
|
|
40
|
-
theme: _theme.ARTICLE_THEME.v2["default"],
|
|
41
|
-
isBold: true
|
|
42
|
-
};
|