@twreporter/react-components 8.13.1-rc.2 → 8.14.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 +16 -0
- package/lib/button/components/iconButton.js +22 -8
- package/lib/button/components/iconWithTextButton.js +4 -2
- package/lib/button/components/pillButton.js +17 -11
- package/lib/button/components/textButton.js +114 -0
- package/lib/button/constants/size.js +28 -0
- package/lib/button/constants/type.js +28 -0
- package/lib/button/index.js +10 -1
- package/lib/button/stories/iconButton.stories.js +13 -5
- package/lib/button/stories/iconWithTextButton.stories.js +8 -3
- package/lib/button/stories/pillButton.stories.js +18 -7
- package/lib/button/stories/textButton.stories.js +59 -0
- package/lib/button/utils/theme.js +118 -6
- package/lib/card/components/dialog.js +61 -0
- package/lib/card/index.js +21 -0
- package/lib/card/stories/dialog.stories.js +39 -0
- package/lib/icon/index.js +24 -26
- package/lib/icon/stories/arrow.stories.js +2 -12
- package/lib/icon/stories/article.stories.js +2 -12
- package/lib/icon/stories/bookmark.stories.js +2 -12
- package/lib/icon/stories/clock.stories.js +2 -12
- package/lib/icon/stories/copy.stories.js +2 -12
- package/lib/icon/stories/cross.stories.js +2 -12
- package/lib/icon/stories/hamburger.stories.js +2 -12
- package/lib/icon/stories/home.stories.js +2 -12
- package/lib/icon/stories/loading.stories.js +2 -12
- package/lib/icon/stories/member.stories.js +2 -12
- package/lib/icon/stories/printer.stories.js +2 -12
- package/lib/icon/stories/search.stories.js +2 -12
- package/lib/icon/stories/share.stories.js +2 -12
- package/lib/icon/stories/socialMedia.stories.js +3 -16
- package/lib/icon/stories/text.stories.js +2 -12
- package/lib/icon/stories/topic.stories.js +2 -12
- package/lib/input/components/search-bar.js +204 -0
- package/lib/input/index.js +21 -0
- package/lib/input/stories/search-bar.stories.js +52 -0
- package/lib/input/utils/theme.js +48 -0
- package/lib/logo/components/logo-footer.js +3 -5
- package/lib/logo/components/logo-header.js +3 -5
- package/lib/logo/stories/logoFooter.stories.js +2 -8
- package/lib/logo/stories/logoHeader.stories.js +2 -8
- package/lib/snack-bar/components/snack-bar.js +5 -2
- package/lib/snack-bar/stories/snackBar.stories.js +8 -2
- package/lib/text/constants/font-weight.js +29 -0
- package/lib/text/constants/headline-type.js +36 -0
- package/lib/text/headline.js +32 -24
- package/lib/text/paragraph.js +10 -8
- package/lib/text/stories/headline.stories.js +43 -7
- package/lib/text/stories/paragraph.stories.js +27 -2
- package/package.json +4 -4
|
@@ -13,9 +13,7 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
|
13
13
|
|
|
14
14
|
var _path = _interopRequireDefault(require("../utils/path"));
|
|
15
15
|
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
var _releaseBranch = _interopRequireDefault(require("@twreporter/core/lib/constants/release-branch"));
|
|
16
|
+
var _releaseBranch = require("@twreporter/core/lib/constants/release-branch");
|
|
19
17
|
|
|
20
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
19
|
|
|
@@ -60,11 +58,11 @@ var LogoHeader = function LogoHeader(_ref) {
|
|
|
60
58
|
|
|
61
59
|
LogoHeader.propTypes = {
|
|
62
60
|
type: _propTypes["default"].oneOf(['default', 'white']),
|
|
63
|
-
releaseBranch:
|
|
61
|
+
releaseBranch: _releaseBranch.BRANCH_PROP_TYPES
|
|
64
62
|
};
|
|
65
63
|
LogoHeader.defaultProps = {
|
|
66
64
|
type: 'default',
|
|
67
|
-
releaseBranch: _releaseBranch
|
|
65
|
+
releaseBranch: _releaseBranch.BRANCH.master
|
|
68
66
|
};
|
|
69
67
|
var _default = LogoHeader;
|
|
70
68
|
exports["default"] = _default;
|
|
@@ -9,7 +9,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
|
|
10
10
|
var _logoFooter = _interopRequireDefault(require("../components/logo-footer"));
|
|
11
11
|
|
|
12
|
-
var _releaseBranch =
|
|
12
|
+
var _releaseBranch = require("@twreporter/core/lib/constants/release-branch");
|
|
13
13
|
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
15
|
|
|
@@ -17,13 +17,7 @@ var _default = {
|
|
|
17
17
|
title: 'Logo/Footer',
|
|
18
18
|
component: _logoFooter["default"],
|
|
19
19
|
argTypes: {
|
|
20
|
-
releaseBranch:
|
|
21
|
-
defaultValue: _releaseBranch["default"].master,
|
|
22
|
-
options: [_releaseBranch["default"].master, _releaseBranch["default"].staging, _releaseBranch["default"].preview, _releaseBranch["default"].release],
|
|
23
|
-
control: {
|
|
24
|
-
type: 'radio'
|
|
25
|
-
}
|
|
26
|
-
}
|
|
20
|
+
releaseBranch: _releaseBranch.BRANCH_STORYBOOK_ARG_TYPE
|
|
27
21
|
}
|
|
28
22
|
};
|
|
29
23
|
exports["default"] = _default;
|
|
@@ -9,7 +9,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
|
|
10
10
|
var _logoHeader = _interopRequireDefault(require("../components/logo-header"));
|
|
11
11
|
|
|
12
|
-
var _releaseBranch =
|
|
12
|
+
var _releaseBranch = require("@twreporter/core/lib/constants/release-branch");
|
|
13
13
|
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
15
|
|
|
@@ -17,13 +17,7 @@ var _default = {
|
|
|
17
17
|
title: 'Logo/Header',
|
|
18
18
|
component: _logoHeader["default"],
|
|
19
19
|
argTypes: {
|
|
20
|
-
releaseBranch:
|
|
21
|
-
defaultValue: _releaseBranch["default"].master,
|
|
22
|
-
options: [_releaseBranch["default"].master, _releaseBranch["default"].staging, _releaseBranch["default"].preview, _releaseBranch["default"].release],
|
|
23
|
-
control: {
|
|
24
|
-
type: 'radio'
|
|
25
|
-
}
|
|
26
|
-
}
|
|
20
|
+
releaseBranch: _releaseBranch.BRANCH_STORYBOOK_ARG_TYPE
|
|
27
21
|
}
|
|
28
22
|
};
|
|
29
23
|
exports["default"] = _default;
|
|
@@ -15,10 +15,13 @@ var _theme = require("../utils/theme");
|
|
|
15
15
|
|
|
16
16
|
var _paragraph = require("../../text/paragraph");
|
|
17
17
|
|
|
18
|
+
var _theme2 = require("@twreporter/core/lib/constants/theme");
|
|
19
|
+
|
|
18
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
21
|
|
|
20
22
|
// util
|
|
21
23
|
// component
|
|
24
|
+
// @twreporter
|
|
22
25
|
var SnackBarContainer = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
23
26
|
displayName: "snack-bar__SnackBarContainer",
|
|
24
27
|
componentId: "roennm-0"
|
|
@@ -32,7 +35,7 @@ var SnackBar = function SnackBar(_ref) {
|
|
|
32
35
|
var _ref$text = _ref.text,
|
|
33
36
|
text = _ref$text === void 0 ? '' : _ref$text,
|
|
34
37
|
_ref$theme = _ref.theme,
|
|
35
|
-
theme = _ref$theme === void 0 ?
|
|
38
|
+
theme = _ref$theme === void 0 ? _theme2.THEME.normal : _ref$theme;
|
|
36
39
|
|
|
37
40
|
var _getSnackBarTheme = (0, _theme.getSnackBarTheme)(theme),
|
|
38
41
|
color = _getSnackBarTheme.color,
|
|
@@ -48,7 +51,7 @@ var SnackBar = function SnackBar(_ref) {
|
|
|
48
51
|
|
|
49
52
|
SnackBar.propTypes = {
|
|
50
53
|
text: _propTypes["default"].string,
|
|
51
|
-
theme:
|
|
54
|
+
theme: _theme2.THEME_PROP_TYPES
|
|
52
55
|
};
|
|
53
56
|
var _default = SnackBar;
|
|
54
57
|
exports["default"] = _default;
|
|
@@ -17,19 +17,25 @@ var _snackBar = _interopRequireDefault(require("../components/snack-bar"));
|
|
|
17
17
|
|
|
18
18
|
var _button = require("../../button");
|
|
19
19
|
|
|
20
|
+
var _theme = require("@twreporter/core/lib/constants/theme");
|
|
21
|
+
|
|
20
22
|
var _random = _interopRequireDefault(require("lodash/random"));
|
|
21
23
|
|
|
22
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
23
25
|
|
|
24
26
|
// hooks
|
|
25
27
|
// components
|
|
28
|
+
// @twreporter
|
|
26
29
|
// lodash
|
|
27
30
|
var _ = {
|
|
28
31
|
random: _random["default"]
|
|
29
32
|
};
|
|
30
33
|
var _default = {
|
|
31
34
|
title: 'Snack Bar',
|
|
32
|
-
component: _snackBar["default"]
|
|
35
|
+
component: _snackBar["default"],
|
|
36
|
+
argTypes: {
|
|
37
|
+
theme: _theme.THEME_STORYBOOK_ARG_TYPE
|
|
38
|
+
}
|
|
33
39
|
};
|
|
34
40
|
exports["default"] = _default;
|
|
35
41
|
|
|
@@ -40,7 +46,7 @@ var snackBar = function snackBar(props) {
|
|
|
40
46
|
exports.snackBar = snackBar;
|
|
41
47
|
snackBar.args = {
|
|
42
48
|
text: '系統作業文字',
|
|
43
|
-
theme:
|
|
49
|
+
theme: _theme.THEME.normal
|
|
44
50
|
};
|
|
45
51
|
|
|
46
52
|
var Container = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
@@ -0,0 +1,29 @@
|
|
|
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;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TYPE_STORYBOOK_ARG_TYPE = exports.TYPE_FONT_FAMILY = exports.TYPE_PROP_TYPES = exports.TYPE = void 0;
|
|
7
|
+
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
|
|
10
|
+
var _font = require("@twreporter/core/lib/constants/font");
|
|
11
|
+
|
|
12
|
+
var _TYPE_FONT_FAMILY;
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
+
|
|
16
|
+
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; }
|
|
17
|
+
|
|
18
|
+
var TYPE = {
|
|
19
|
+
"default": 'default',
|
|
20
|
+
article: 'article'
|
|
21
|
+
};
|
|
22
|
+
exports.TYPE = TYPE;
|
|
23
|
+
|
|
24
|
+
var TYPE_PROP_TYPES = _propTypes["default"].oneOf([TYPE["default"], TYPE.article]);
|
|
25
|
+
|
|
26
|
+
exports.TYPE_PROP_TYPES = TYPE_PROP_TYPES;
|
|
27
|
+
var TYPE_FONT_FAMILY = (_TYPE_FONT_FAMILY = {}, _defineProperty(_TYPE_FONT_FAMILY, TYPE["default"], _font.fontFamily["default"]), _defineProperty(_TYPE_FONT_FAMILY, TYPE.article, _font.fontFamily.title), _TYPE_FONT_FAMILY);
|
|
28
|
+
exports.TYPE_FONT_FAMILY = TYPE_FONT_FAMILY;
|
|
29
|
+
var TYPE_STORYBOOK_ARG_TYPE = {
|
|
30
|
+
defaultValue: TYPE["default"],
|
|
31
|
+
options: [TYPE["default"], TYPE.article],
|
|
32
|
+
control: {
|
|
33
|
+
type: 'radio'
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
exports.TYPE_STORYBOOK_ARG_TYPE = TYPE_STORYBOOK_ARG_TYPE;
|
package/lib/text/headline.js
CHANGED
|
@@ -11,6 +11,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
11
11
|
|
|
12
12
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
13
13
|
|
|
14
|
+
var _headlineType = require("./constants/headline-type");
|
|
15
|
+
|
|
14
16
|
var _mediaQuery = _interopRequireDefault(require("@twreporter/core/lib/utils/media-query"));
|
|
15
17
|
|
|
16
18
|
var _font = require("@twreporter/core/lib/constants/font");
|
|
@@ -30,48 +32,49 @@ var H1Container = /*#__PURE__*/(0, _styledComponents["default"])(DefaultContaine
|
|
|
30
32
|
displayName: "headline__H1Container",
|
|
31
33
|
componentId: "axdp97-1"
|
|
32
34
|
})(["line-height:125%;font-size:36px;font-family:", ";", ""], function (props) {
|
|
33
|
-
return props.
|
|
35
|
+
return props.fontFamily;
|
|
34
36
|
}, _mediaQuery["default"].tabletAndBelow(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n font-size: 32px;\n "]))));
|
|
35
37
|
var H2Container = /*#__PURE__*/(0, _styledComponents["default"])(DefaultContainer).withConfig({
|
|
36
38
|
displayName: "headline__H2Container",
|
|
37
39
|
componentId: "axdp97-2"
|
|
38
40
|
})(["line-height:125%;font-size:32px;font-family:", ";", ""], function (props) {
|
|
39
|
-
return props.
|
|
41
|
+
return props.fontFamily;
|
|
40
42
|
}, _mediaQuery["default"].tabletAndBelow(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n font-size: 24px;\n "]))));
|
|
41
43
|
var H3Container = /*#__PURE__*/(0, _styledComponents["default"])(DefaultContainer).withConfig({
|
|
42
44
|
displayName: "headline__H3Container",
|
|
43
45
|
componentId: "axdp97-3"
|
|
44
46
|
})(["line-height:150%;font-size:28px;font-family:", ";", ""], function (props) {
|
|
45
|
-
return props.
|
|
47
|
+
return props.fontFamily;
|
|
46
48
|
}, _mediaQuery["default"].tabletAndBelow(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n font-size: 20px;\n "]))));
|
|
47
49
|
var H4Container = /*#__PURE__*/(0, _styledComponents["default"])(DefaultContainer).withConfig({
|
|
48
50
|
displayName: "headline__H4Container",
|
|
49
51
|
componentId: "axdp97-4"
|
|
50
52
|
})(["line-height:150%;font-size:22px;font-family:", ";", ""], function (props) {
|
|
51
|
-
return props.
|
|
53
|
+
return props.fontFamily;
|
|
52
54
|
}, _mediaQuery["default"].tabletAndBelow(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n font-size: 18px;\n "]))));
|
|
53
55
|
var H5Container = /*#__PURE__*/(0, _styledComponents["default"])(DefaultContainer).withConfig({
|
|
54
56
|
displayName: "headline__H5Container",
|
|
55
57
|
componentId: "axdp97-5"
|
|
56
58
|
})(["line-height:150%;font-size:18px;font-family:", ";", ""], function (props) {
|
|
57
|
-
return props.
|
|
59
|
+
return props.fontFamily;
|
|
58
60
|
}, _mediaQuery["default"].tabletAndBelow(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n font-size: 16px;\n "]))));
|
|
59
61
|
var H6Container = /*#__PURE__*/(0, _styledComponents["default"])(DefaultContainer).withConfig({
|
|
60
62
|
displayName: "headline__H6Container",
|
|
61
63
|
componentId: "axdp97-6"
|
|
62
64
|
})(["line-height:150%;font-size:16px;font-family:", ";", ""], function (props) {
|
|
63
|
-
return props.
|
|
65
|
+
return props.fontFamily;
|
|
64
66
|
}, _mediaQuery["default"].tabletAndBelow(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n font-size: 14px;\n "]))));
|
|
65
67
|
|
|
66
68
|
var H1 = function H1(_ref) {
|
|
67
69
|
var _ref$text = _ref.text,
|
|
68
70
|
text = _ref$text === void 0 ? '' : _ref$text,
|
|
69
71
|
_ref$type = _ref.type,
|
|
70
|
-
type = _ref$type === void 0 ?
|
|
72
|
+
type = _ref$type === void 0 ? _headlineType.TYPE["default"] : _ref$type,
|
|
71
73
|
_ref$className = _ref.className,
|
|
72
74
|
className = _ref$className === void 0 ? '' : _ref$className;
|
|
75
|
+
var fontFamily = _headlineType.TYPE_FONT_FAMILY[type];
|
|
73
76
|
return /*#__PURE__*/_react["default"].createElement(H1Container, {
|
|
74
|
-
|
|
77
|
+
fontFamily: fontFamily,
|
|
75
78
|
className: className
|
|
76
79
|
}, text);
|
|
77
80
|
};
|
|
@@ -79,7 +82,7 @@ var H1 = function H1(_ref) {
|
|
|
79
82
|
exports.H1 = H1;
|
|
80
83
|
H1.propTypes = {
|
|
81
84
|
text: _propTypes["default"].string,
|
|
82
|
-
type:
|
|
85
|
+
type: _headlineType.TYPE_PROP_TYPES,
|
|
83
86
|
className: _propTypes["default"].string
|
|
84
87
|
};
|
|
85
88
|
|
|
@@ -87,11 +90,12 @@ var H2 = function H2(_ref2) {
|
|
|
87
90
|
var _ref2$text = _ref2.text,
|
|
88
91
|
text = _ref2$text === void 0 ? '' : _ref2$text,
|
|
89
92
|
_ref2$type = _ref2.type,
|
|
90
|
-
type = _ref2$type === void 0 ?
|
|
93
|
+
type = _ref2$type === void 0 ? _headlineType.TYPE["default"] : _ref2$type,
|
|
91
94
|
_ref2$className = _ref2.className,
|
|
92
95
|
className = _ref2$className === void 0 ? '' : _ref2$className;
|
|
96
|
+
var fontFamily = _headlineType.TYPE_FONT_FAMILY[type];
|
|
93
97
|
return /*#__PURE__*/_react["default"].createElement(H2Container, {
|
|
94
|
-
|
|
98
|
+
fontFamily: fontFamily,
|
|
95
99
|
className: className
|
|
96
100
|
}, text);
|
|
97
101
|
};
|
|
@@ -99,7 +103,7 @@ var H2 = function H2(_ref2) {
|
|
|
99
103
|
exports.H2 = H2;
|
|
100
104
|
H2.propTypes = {
|
|
101
105
|
text: _propTypes["default"].string,
|
|
102
|
-
type:
|
|
106
|
+
type: _headlineType.TYPE_PROP_TYPES,
|
|
103
107
|
className: _propTypes["default"].string
|
|
104
108
|
};
|
|
105
109
|
|
|
@@ -107,11 +111,12 @@ var H3 = function H3(_ref3) {
|
|
|
107
111
|
var _ref3$text = _ref3.text,
|
|
108
112
|
text = _ref3$text === void 0 ? '' : _ref3$text,
|
|
109
113
|
_ref3$type = _ref3.type,
|
|
110
|
-
type = _ref3$type === void 0 ?
|
|
114
|
+
type = _ref3$type === void 0 ? _headlineType.TYPE["default"] : _ref3$type,
|
|
111
115
|
_ref3$className = _ref3.className,
|
|
112
116
|
className = _ref3$className === void 0 ? '' : _ref3$className;
|
|
117
|
+
var fontFamily = _headlineType.TYPE_FONT_FAMILY[type];
|
|
113
118
|
return /*#__PURE__*/_react["default"].createElement(H3Container, {
|
|
114
|
-
|
|
119
|
+
fontFamily: fontFamily,
|
|
115
120
|
className: className
|
|
116
121
|
}, text);
|
|
117
122
|
};
|
|
@@ -119,7 +124,7 @@ var H3 = function H3(_ref3) {
|
|
|
119
124
|
exports.H3 = H3;
|
|
120
125
|
H3.propTypes = {
|
|
121
126
|
text: _propTypes["default"].string,
|
|
122
|
-
type:
|
|
127
|
+
type: _headlineType.TYPE_PROP_TYPES,
|
|
123
128
|
className: _propTypes["default"].string
|
|
124
129
|
};
|
|
125
130
|
|
|
@@ -127,11 +132,12 @@ var H4 = function H4(_ref4) {
|
|
|
127
132
|
var _ref4$text = _ref4.text,
|
|
128
133
|
text = _ref4$text === void 0 ? '' : _ref4$text,
|
|
129
134
|
_ref4$type = _ref4.type,
|
|
130
|
-
type = _ref4$type === void 0 ?
|
|
135
|
+
type = _ref4$type === void 0 ? _headlineType.TYPE["default"] : _ref4$type,
|
|
131
136
|
_ref4$className = _ref4.className,
|
|
132
137
|
className = _ref4$className === void 0 ? '' : _ref4$className;
|
|
138
|
+
var fontFamily = _headlineType.TYPE_FONT_FAMILY[type];
|
|
133
139
|
return /*#__PURE__*/_react["default"].createElement(H4Container, {
|
|
134
|
-
|
|
140
|
+
fontFamily: fontFamily,
|
|
135
141
|
className: className
|
|
136
142
|
}, text);
|
|
137
143
|
};
|
|
@@ -139,7 +145,7 @@ var H4 = function H4(_ref4) {
|
|
|
139
145
|
exports.H4 = H4;
|
|
140
146
|
H4.propTypes = {
|
|
141
147
|
text: _propTypes["default"].string,
|
|
142
|
-
type:
|
|
148
|
+
type: _headlineType.TYPE_PROP_TYPES,
|
|
143
149
|
className: _propTypes["default"].string
|
|
144
150
|
};
|
|
145
151
|
|
|
@@ -147,11 +153,12 @@ var H5 = function H5(_ref5) {
|
|
|
147
153
|
var _ref5$text = _ref5.text,
|
|
148
154
|
text = _ref5$text === void 0 ? '' : _ref5$text,
|
|
149
155
|
_ref5$type = _ref5.type,
|
|
150
|
-
type = _ref5$type === void 0 ?
|
|
156
|
+
type = _ref5$type === void 0 ? _headlineType.TYPE["default"] : _ref5$type,
|
|
151
157
|
_ref5$className = _ref5.className,
|
|
152
158
|
className = _ref5$className === void 0 ? '' : _ref5$className;
|
|
159
|
+
var fontFamily = _headlineType.TYPE_FONT_FAMILY[type];
|
|
153
160
|
return /*#__PURE__*/_react["default"].createElement(H5Container, {
|
|
154
|
-
|
|
161
|
+
fontFamily: fontFamily,
|
|
155
162
|
className: className
|
|
156
163
|
}, text);
|
|
157
164
|
};
|
|
@@ -159,7 +166,7 @@ var H5 = function H5(_ref5) {
|
|
|
159
166
|
exports.H5 = H5;
|
|
160
167
|
H5.propTypes = {
|
|
161
168
|
text: _propTypes["default"].string,
|
|
162
|
-
type:
|
|
169
|
+
type: _headlineType.TYPE_PROP_TYPES,
|
|
163
170
|
className: _propTypes["default"].string
|
|
164
171
|
};
|
|
165
172
|
|
|
@@ -167,11 +174,12 @@ var H6 = function H6(_ref6) {
|
|
|
167
174
|
var _ref6$text = _ref6.text,
|
|
168
175
|
text = _ref6$text === void 0 ? '' : _ref6$text,
|
|
169
176
|
_ref6$type = _ref6.type,
|
|
170
|
-
type = _ref6$type === void 0 ?
|
|
177
|
+
type = _ref6$type === void 0 ? _headlineType.TYPE["default"] : _ref6$type,
|
|
171
178
|
_ref6$className = _ref6.className,
|
|
172
179
|
className = _ref6$className === void 0 ? '' : _ref6$className;
|
|
180
|
+
var fontFamily = _headlineType.TYPE_FONT_FAMILY[type];
|
|
173
181
|
return /*#__PURE__*/_react["default"].createElement(H6Container, {
|
|
174
|
-
|
|
182
|
+
fontFamily: fontFamily,
|
|
175
183
|
className: className
|
|
176
184
|
}, text);
|
|
177
185
|
};
|
|
@@ -179,7 +187,7 @@ var H6 = function H6(_ref6) {
|
|
|
179
187
|
exports.H6 = H6;
|
|
180
188
|
H6.propTypes = {
|
|
181
189
|
text: _propTypes["default"].string,
|
|
182
|
-
type:
|
|
190
|
+
type: _headlineType.TYPE_PROP_TYPES,
|
|
183
191
|
className: _propTypes["default"].string
|
|
184
192
|
};
|
|
185
193
|
var _default = {
|
package/lib/text/paragraph.js
CHANGED
|
@@ -11,6 +11,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
11
11
|
|
|
12
12
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
13
13
|
|
|
14
|
+
var _fontWeight = require("./constants/font-weight");
|
|
15
|
+
|
|
14
16
|
var _font = require("@twreporter/core/lib/constants/font");
|
|
15
17
|
|
|
16
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
@@ -43,7 +45,7 @@ var P1 = function P1(_ref) {
|
|
|
43
45
|
var _ref$text = _ref.text,
|
|
44
46
|
text = _ref$text === void 0 ? '' : _ref$text,
|
|
45
47
|
_ref$weight = _ref.weight,
|
|
46
|
-
weight = _ref$weight === void 0 ?
|
|
48
|
+
weight = _ref$weight === void 0 ? _fontWeight.WEIGHT.normal : _ref$weight,
|
|
47
49
|
_ref$className = _ref.className,
|
|
48
50
|
className = _ref$className === void 0 ? '' : _ref$className;
|
|
49
51
|
return /*#__PURE__*/_react["default"].createElement(P1Container, {
|
|
@@ -55,7 +57,7 @@ var P1 = function P1(_ref) {
|
|
|
55
57
|
exports.P1 = P1;
|
|
56
58
|
P1.propTypes = {
|
|
57
59
|
text: _propTypes["default"].string,
|
|
58
|
-
weight:
|
|
60
|
+
weight: _fontWeight.WEIGHT_PROP_TYPES,
|
|
59
61
|
className: _propTypes["default"].string
|
|
60
62
|
};
|
|
61
63
|
|
|
@@ -63,7 +65,7 @@ var P2 = function P2(_ref2) {
|
|
|
63
65
|
var _ref2$text = _ref2.text,
|
|
64
66
|
text = _ref2$text === void 0 ? '' : _ref2$text,
|
|
65
67
|
_ref2$weight = _ref2.weight,
|
|
66
|
-
weight = _ref2$weight === void 0 ?
|
|
68
|
+
weight = _ref2$weight === void 0 ? _fontWeight.WEIGHT.normal : _ref2$weight,
|
|
67
69
|
_ref2$className = _ref2.className,
|
|
68
70
|
className = _ref2$className === void 0 ? '' : _ref2$className;
|
|
69
71
|
return /*#__PURE__*/_react["default"].createElement(P2Container, {
|
|
@@ -75,7 +77,7 @@ var P2 = function P2(_ref2) {
|
|
|
75
77
|
exports.P2 = P2;
|
|
76
78
|
P2.propTypes = {
|
|
77
79
|
text: _propTypes["default"].string,
|
|
78
|
-
weight:
|
|
80
|
+
weight: _fontWeight.WEIGHT_PROP_TYPES,
|
|
79
81
|
className: _propTypes["default"].string
|
|
80
82
|
};
|
|
81
83
|
|
|
@@ -83,7 +85,7 @@ var P3 = function P3(_ref3) {
|
|
|
83
85
|
var _ref3$text = _ref3.text,
|
|
84
86
|
text = _ref3$text === void 0 ? '' : _ref3$text,
|
|
85
87
|
_ref3$weight = _ref3.weight,
|
|
86
|
-
weight = _ref3$weight === void 0 ?
|
|
88
|
+
weight = _ref3$weight === void 0 ? _fontWeight.WEIGHT.normal : _ref3$weight,
|
|
87
89
|
_ref3$className = _ref3.className,
|
|
88
90
|
className = _ref3$className === void 0 ? '' : _ref3$className;
|
|
89
91
|
return /*#__PURE__*/_react["default"].createElement(P3Container, {
|
|
@@ -95,7 +97,7 @@ var P3 = function P3(_ref3) {
|
|
|
95
97
|
exports.P3 = P3;
|
|
96
98
|
P3.propTypes = {
|
|
97
99
|
text: _propTypes["default"].string,
|
|
98
|
-
weight:
|
|
100
|
+
weight: _fontWeight.WEIGHT_PROP_TYPES,
|
|
99
101
|
className: _propTypes["default"].string
|
|
100
102
|
};
|
|
101
103
|
|
|
@@ -103,7 +105,7 @@ var P4 = function P4(_ref4) {
|
|
|
103
105
|
var _ref4$text = _ref4.text,
|
|
104
106
|
text = _ref4$text === void 0 ? '' : _ref4$text,
|
|
105
107
|
_ref4$weight = _ref4.weight,
|
|
106
|
-
weight = _ref4$weight === void 0 ?
|
|
108
|
+
weight = _ref4$weight === void 0 ? _fontWeight.WEIGHT.normal : _ref4$weight,
|
|
107
109
|
_ref4$className = _ref4.className,
|
|
108
110
|
className = _ref4$className === void 0 ? '' : _ref4$className;
|
|
109
111
|
return /*#__PURE__*/_react["default"].createElement(P4Container, {
|
|
@@ -115,7 +117,7 @@ var P4 = function P4(_ref4) {
|
|
|
115
117
|
exports.P4 = P4;
|
|
116
118
|
P4.propTypes = {
|
|
117
119
|
text: _propTypes["default"].string,
|
|
118
|
-
weight:
|
|
120
|
+
weight: _fontWeight.WEIGHT_PROP_TYPES,
|
|
119
121
|
className: _propTypes["default"].string
|
|
120
122
|
};
|
|
121
123
|
var _default = {
|
|
@@ -9,14 +9,20 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
|
|
10
10
|
var _headline = require("../headline");
|
|
11
11
|
|
|
12
|
+
var _headlineType = require("../constants/headline-type");
|
|
13
|
+
|
|
12
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
15
|
|
|
14
16
|
var _default = {
|
|
15
17
|
title: 'Text/Headline',
|
|
16
|
-
component: _headline.H1
|
|
18
|
+
component: _headline.H1,
|
|
19
|
+
argTypes: {
|
|
20
|
+
type: _headlineType.TYPE_STORYBOOK_ARG_TYPE
|
|
21
|
+
}
|
|
17
22
|
};
|
|
18
23
|
exports["default"] = _default;
|
|
19
24
|
var defaultText = '標題「標題」:標題,《標題》標題English標題123標題?';
|
|
25
|
+
var defaultType = _headlineType.TYPE["default"];
|
|
20
26
|
|
|
21
27
|
var h1 = function h1(args) {
|
|
22
28
|
return /*#__PURE__*/_react["default"].createElement(_headline.H1, args);
|
|
@@ -25,7 +31,12 @@ var h1 = function h1(args) {
|
|
|
25
31
|
exports.h1 = h1;
|
|
26
32
|
h1.args = {
|
|
27
33
|
text: defaultText,
|
|
28
|
-
type:
|
|
34
|
+
type: defaultType
|
|
35
|
+
};
|
|
36
|
+
h1.parameters = {
|
|
37
|
+
controls: {
|
|
38
|
+
exclude: ['className']
|
|
39
|
+
}
|
|
29
40
|
};
|
|
30
41
|
|
|
31
42
|
var h2 = function h2(args) {
|
|
@@ -35,7 +46,12 @@ var h2 = function h2(args) {
|
|
|
35
46
|
exports.h2 = h2;
|
|
36
47
|
h2.args = {
|
|
37
48
|
text: defaultText,
|
|
38
|
-
type:
|
|
49
|
+
type: defaultType
|
|
50
|
+
};
|
|
51
|
+
h2.parameters = {
|
|
52
|
+
controls: {
|
|
53
|
+
exclude: ['className']
|
|
54
|
+
}
|
|
39
55
|
};
|
|
40
56
|
|
|
41
57
|
var h3 = function h3(args) {
|
|
@@ -45,7 +61,12 @@ var h3 = function h3(args) {
|
|
|
45
61
|
exports.h3 = h3;
|
|
46
62
|
h3.args = {
|
|
47
63
|
text: defaultText,
|
|
48
|
-
type:
|
|
64
|
+
type: defaultType
|
|
65
|
+
};
|
|
66
|
+
h3.parameters = {
|
|
67
|
+
controls: {
|
|
68
|
+
exclude: ['className']
|
|
69
|
+
}
|
|
49
70
|
};
|
|
50
71
|
|
|
51
72
|
var h4 = function h4(args) {
|
|
@@ -55,7 +76,12 @@ var h4 = function h4(args) {
|
|
|
55
76
|
exports.h4 = h4;
|
|
56
77
|
h4.args = {
|
|
57
78
|
text: defaultText,
|
|
58
|
-
type:
|
|
79
|
+
type: defaultType
|
|
80
|
+
};
|
|
81
|
+
h4.parameters = {
|
|
82
|
+
controls: {
|
|
83
|
+
exclude: ['className']
|
|
84
|
+
}
|
|
59
85
|
};
|
|
60
86
|
|
|
61
87
|
var h5 = function h5(args) {
|
|
@@ -65,7 +91,12 @@ var h5 = function h5(args) {
|
|
|
65
91
|
exports.h5 = h5;
|
|
66
92
|
h5.args = {
|
|
67
93
|
text: defaultText,
|
|
68
|
-
type:
|
|
94
|
+
type: defaultType
|
|
95
|
+
};
|
|
96
|
+
h5.parameters = {
|
|
97
|
+
controls: {
|
|
98
|
+
exclude: ['className']
|
|
99
|
+
}
|
|
69
100
|
};
|
|
70
101
|
|
|
71
102
|
var h6 = function h6(args) {
|
|
@@ -75,5 +106,10 @@ var h6 = function h6(args) {
|
|
|
75
106
|
exports.h6 = h6;
|
|
76
107
|
h6.args = {
|
|
77
108
|
text: defaultText,
|
|
78
|
-
type:
|
|
109
|
+
type: defaultType
|
|
110
|
+
};
|
|
111
|
+
h6.parameters = {
|
|
112
|
+
controls: {
|
|
113
|
+
exclude: ['className']
|
|
114
|
+
}
|
|
79
115
|
};
|
|
@@ -9,15 +9,20 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
|
|
10
10
|
var _paragraph = require("../paragraph");
|
|
11
11
|
|
|
12
|
+
var _fontWeight = require("../constants/font-weight");
|
|
13
|
+
|
|
12
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
15
|
|
|
14
16
|
var _default = {
|
|
15
17
|
title: 'Text/Paragraph',
|
|
16
|
-
component: _paragraph.P1
|
|
18
|
+
component: _paragraph.P1,
|
|
19
|
+
argTypes: {
|
|
20
|
+
weight: _fontWeight.WEIGHT_STORYBOOK_ARG_TYPE
|
|
21
|
+
}
|
|
17
22
|
};
|
|
18
23
|
exports["default"] = _default;
|
|
19
24
|
var defaultText = '內文「內文」:內文,《內文》內文English內文123內文?';
|
|
20
|
-
var defaultWeight =
|
|
25
|
+
var defaultWeight = _fontWeight.WEIGHT.normal;
|
|
21
26
|
|
|
22
27
|
var p1 = function p1(args) {
|
|
23
28
|
return /*#__PURE__*/_react["default"].createElement(_paragraph.P1, args);
|
|
@@ -28,6 +33,11 @@ p1.args = {
|
|
|
28
33
|
text: defaultText,
|
|
29
34
|
weight: defaultWeight
|
|
30
35
|
};
|
|
36
|
+
p1.parameters = {
|
|
37
|
+
controls: {
|
|
38
|
+
exclude: ['className']
|
|
39
|
+
}
|
|
40
|
+
};
|
|
31
41
|
|
|
32
42
|
var p2 = function p2(args) {
|
|
33
43
|
return /*#__PURE__*/_react["default"].createElement(_paragraph.P2, args);
|
|
@@ -38,6 +48,11 @@ p2.args = {
|
|
|
38
48
|
text: defaultText,
|
|
39
49
|
weight: defaultWeight
|
|
40
50
|
};
|
|
51
|
+
p2.parameters = {
|
|
52
|
+
controls: {
|
|
53
|
+
exclude: ['className']
|
|
54
|
+
}
|
|
55
|
+
};
|
|
41
56
|
|
|
42
57
|
var p3 = function p3(args) {
|
|
43
58
|
return /*#__PURE__*/_react["default"].createElement(_paragraph.P3, args);
|
|
@@ -48,6 +63,11 @@ p3.args = {
|
|
|
48
63
|
text: defaultText,
|
|
49
64
|
weight: defaultWeight
|
|
50
65
|
};
|
|
66
|
+
p3.parameters = {
|
|
67
|
+
controls: {
|
|
68
|
+
exclude: ['className']
|
|
69
|
+
}
|
|
70
|
+
};
|
|
51
71
|
|
|
52
72
|
var p4 = function p4(args) {
|
|
53
73
|
return /*#__PURE__*/_react["default"].createElement(_paragraph.P4, args);
|
|
@@ -57,4 +77,9 @@ exports.p4 = p4;
|
|
|
57
77
|
p4.args = {
|
|
58
78
|
text: defaultText,
|
|
59
79
|
weight: defaultWeight
|
|
80
|
+
};
|
|
81
|
+
p4.parameters = {
|
|
82
|
+
controls: {
|
|
83
|
+
exclude: ['className']
|
|
84
|
+
}
|
|
60
85
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twreporter/react-components",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.14.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>",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"chromatic": "npx chromatic --exit-zero-on-changes"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@twreporter/core": "^1.7.0-rc.
|
|
19
|
-
"@twreporter/redux": "^7.4.0-rc.
|
|
18
|
+
"@twreporter/core": "^1.7.0-rc.3",
|
|
19
|
+
"@twreporter/redux": "^7.4.0-rc.3",
|
|
20
20
|
"fontfaceobserver-es": "^3.3.3",
|
|
21
21
|
"hoist-non-react-statics": "^2.3.1",
|
|
22
22
|
"lodash": "^4.0.0",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"babel-loader": "^8.2.4",
|
|
45
45
|
"chromatic": "^6.5.4"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "cec95c45a29a3fbfa91b3bf3a6f33a1cc983504d"
|
|
48
48
|
}
|