@twreporter/react-components 8.12.0-rc.0 → 8.12.1-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 +34 -0
- package/lib/customized-link.js +49 -0
- package/lib/title-bar/components/bar.js +48 -0
- package/lib/title-bar/components/tab.js +197 -0
- package/lib/title-bar/index.js +30 -0
- package/lib/title-bar/stories/bar.stories.js +40 -0
- package/lib/title-bar/stories/tab.stories.js +277 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,40 @@
|
|
|
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.12.1-rc.0](https://github.com/twreporter/twreporter-npm-packages/compare/@twreporter/react-components@8.12.0...@twreporter/react-components@8.12.1-rc.0) (2022-08-17)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @twreporter/react-components
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [8.12.0](https://github.com/twreporter/twreporter-npm-packages/compare/@twreporter/react-components@8.12.0-rc.1...@twreporter/react-components@8.12.0) (2022-08-11)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @twreporter/react-components
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# [8.12.0-rc.1](https://github.com/twreporter/twreporter-npm-packages/compare/@twreporter/react-components@8.12.0-rc.0...@twreporter/react-components@8.12.0-rc.1) (2022-08-10)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* add releaseBranch props for icon component ([bad00f5](https://github.com/twreporter/twreporter-npm-packages/commit/bad00f59878b08d15d52a58ac876f1fb210d101b))
|
|
28
|
+
* address code review ([13aad8e](https://github.com/twreporter/twreporter-npm-packages/commit/13aad8ec84d702af53be830d1ecdb482c15efd3a))
|
|
29
|
+
* remove DesktopTab in TitleTab component ([cde0983](https://github.com/twreporter/twreporter-npm-packages/commit/cde098305d6bdf9ebe847aebf9d70f253520608c))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Features
|
|
33
|
+
|
|
34
|
+
* add title bar component for design guideline ([b96bdde](https://github.com/twreporter/twreporter-npm-packages/commit/b96bdde414bf068eb9521a627ce0414eb95867e2))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
6
40
|
# [8.12.0-rc.0](https://github.com/twreporter/twreporter-npm-packages/compare/@twreporter/react-components@8.11.1...@twreporter/react-components@8.12.0-rc.0) (2022-08-10)
|
|
7
41
|
|
|
8
42
|
|
|
@@ -0,0 +1,49 @@
|
|
|
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 _reactRouterDom = require("react-router-dom");
|
|
13
|
+
|
|
14
|
+
var _excluded = ["isExternal", "to"];
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
|
+
|
|
18
|
+
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); }
|
|
19
|
+
|
|
20
|
+
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; }
|
|
21
|
+
|
|
22
|
+
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; }
|
|
23
|
+
|
|
24
|
+
var CustomizedLink = function CustomizedLink(_ref) {
|
|
25
|
+
var isExternal = _ref.isExternal,
|
|
26
|
+
to = _ref.to,
|
|
27
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
28
|
+
|
|
29
|
+
if (isExternal) {
|
|
30
|
+
return /*#__PURE__*/_react["default"].createElement("a", _extends({
|
|
31
|
+
href: to
|
|
32
|
+
}, rest));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return /*#__PURE__*/_react["default"].createElement(_reactRouterDom.Link, _extends({
|
|
36
|
+
to: to
|
|
37
|
+
}, rest));
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
CustomizedLink.propTypes = {
|
|
41
|
+
isExternal: _propTypes["default"].bool,
|
|
42
|
+
to: _propTypes["default"].string
|
|
43
|
+
};
|
|
44
|
+
CustomizedLink.defaultProps = {
|
|
45
|
+
isExternal: true,
|
|
46
|
+
to: ''
|
|
47
|
+
};
|
|
48
|
+
var _default = CustomizedLink;
|
|
49
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,48 @@
|
|
|
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 _headline = require("../../text/headline");
|
|
15
|
+
|
|
16
|
+
var _paragraph = require("../../text/paragraph");
|
|
17
|
+
|
|
18
|
+
var _divider = _interopRequireDefault(require("../../divider"));
|
|
19
|
+
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
|
+
|
|
22
|
+
// component
|
|
23
|
+
var BarContainer = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
24
|
+
displayName: "bar__BarContainer",
|
|
25
|
+
componentId: "sc-18ncllq-0"
|
|
26
|
+
})(["display:flex;width:100%;flex-direction:column;& > div{margin-bottom:16px;&:last-child{margin-bottom:0;}}"]);
|
|
27
|
+
|
|
28
|
+
var TitleBar = function TitleBar(_ref) {
|
|
29
|
+
var _ref$title = _ref.title,
|
|
30
|
+
title = _ref$title === void 0 ? '' : _ref$title,
|
|
31
|
+
_ref$subtitle = _ref.subtitle,
|
|
32
|
+
subtitle = _ref$subtitle === void 0 ? '' : _ref$subtitle;
|
|
33
|
+
return /*#__PURE__*/_react["default"].createElement(BarContainer, null, /*#__PURE__*/_react["default"].createElement(_headline.H1, {
|
|
34
|
+
text: title
|
|
35
|
+
}), /*#__PURE__*/_react["default"].createElement(_paragraph.P1, {
|
|
36
|
+
text: subtitle,
|
|
37
|
+
weight: "bold"
|
|
38
|
+
}), /*#__PURE__*/_react["default"].createElement(_divider["default"], {
|
|
39
|
+
direction: "horizontal"
|
|
40
|
+
}));
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
TitleBar.propTypes = {
|
|
44
|
+
title: _propTypes["default"].string,
|
|
45
|
+
subtitle: _propTypes["default"].string
|
|
46
|
+
};
|
|
47
|
+
var _default = TitleBar;
|
|
48
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,197 @@
|
|
|
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 = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
|
|
14
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
15
|
+
|
|
16
|
+
var _headline = require("../../text/headline");
|
|
17
|
+
|
|
18
|
+
var _paragraph = require("../../text/paragraph");
|
|
19
|
+
|
|
20
|
+
var _divider = _interopRequireDefault(require("../../divider"));
|
|
21
|
+
|
|
22
|
+
var _customizedLink = _interopRequireDefault(require("../../customized-link"));
|
|
23
|
+
|
|
24
|
+
var _color = require("@twreporter/core/lib/constants/color");
|
|
25
|
+
|
|
26
|
+
var _excluded = ["tab"];
|
|
27
|
+
|
|
28
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
29
|
+
|
|
30
|
+
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); }
|
|
31
|
+
|
|
32
|
+
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; }
|
|
33
|
+
|
|
34
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
35
|
+
|
|
36
|
+
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."); }
|
|
37
|
+
|
|
38
|
+
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); }
|
|
39
|
+
|
|
40
|
+
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; }
|
|
41
|
+
|
|
42
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
43
|
+
|
|
44
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
45
|
+
|
|
46
|
+
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); }
|
|
47
|
+
|
|
48
|
+
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; }
|
|
49
|
+
|
|
50
|
+
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; }
|
|
51
|
+
|
|
52
|
+
// const
|
|
53
|
+
var gradientMask = 'linear-gradient(to left, rgba(241, 241, 241, 0), #F1F1F1 48px)';
|
|
54
|
+
|
|
55
|
+
var tabPropType = _propTypes["default"].shape({
|
|
56
|
+
text: _propTypes["default"].string,
|
|
57
|
+
link: _propTypes["default"].string,
|
|
58
|
+
isExternal: _propTypes["default"]["boolean"],
|
|
59
|
+
isActive: _propTypes["default"]["boolean"]
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
var BarContainer = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
63
|
+
displayName: "tab__BarContainer",
|
|
64
|
+
componentId: "ywb8e-0"
|
|
65
|
+
})(["display:flex;width:100%;flex-direction:column;& > div{margin-bottom:16px;&:last-child{margin-bottom:0;}}"]);
|
|
66
|
+
|
|
67
|
+
var TabItemContainer = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
68
|
+
displayName: "tab__TabItemContainer",
|
|
69
|
+
componentId: "ywb8e-1"
|
|
70
|
+
})(["display:flex;flex-shrink:0;color:", ";a{color:unset;text-decoration:none;}"], function (props) {
|
|
71
|
+
return props.isActive ? _color.colorBrand.heavy : 'inherit';
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
var MobileTabContainer = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
75
|
+
displayName: "tab__MobileTabContainer",
|
|
76
|
+
componentId: "ywb8e-2"
|
|
77
|
+
})(["display:flex;overflow:scroll;scrollbar-width:none;&::-webkit-scrollbar{display:none;}-webkit-mask-image:", ";& > div{margin-right:24px;}"], function (props) {
|
|
78
|
+
return props.showGradientMask ? gradientMask : 'none';
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
var TabItem = function TabItem(_ref) {
|
|
82
|
+
var _ref$tab = _ref.tab,
|
|
83
|
+
tab = _ref$tab === void 0 ? {} : _ref$tab,
|
|
84
|
+
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
85
|
+
|
|
86
|
+
var text = tab.text,
|
|
87
|
+
link = tab.link,
|
|
88
|
+
isExternal = tab.isExternal,
|
|
89
|
+
isActive = tab.isActive;
|
|
90
|
+
return /*#__PURE__*/_react["default"].createElement(TabItemContainer, _extends({
|
|
91
|
+
isActive: isActive
|
|
92
|
+
}, restProps), /*#__PURE__*/_react["default"].createElement(_customizedLink["default"], {
|
|
93
|
+
to: link,
|
|
94
|
+
isExternal: isExternal
|
|
95
|
+
}, /*#__PURE__*/_react["default"].createElement(_paragraph.P1, {
|
|
96
|
+
text: text,
|
|
97
|
+
weight: "bold"
|
|
98
|
+
})));
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
TabItem.propTypes = {
|
|
102
|
+
tab: tabPropType
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
var useScrollStatus = function useScrollStatus(setShowNext) {
|
|
106
|
+
var ref = (0, _react.useRef)();
|
|
107
|
+
(0, _react.useEffect)(function () {
|
|
108
|
+
if (ref.current.scrollWidth > ref.current.clientWidth) {
|
|
109
|
+
// scrollbar occur
|
|
110
|
+
setShowNext(true);
|
|
111
|
+
}
|
|
112
|
+
}, [ref, setShowNext]);
|
|
113
|
+
(0, _react.useEffect)(function () {
|
|
114
|
+
var refEle = ref.current;
|
|
115
|
+
|
|
116
|
+
var handleScroll = function handleScroll(event) {
|
|
117
|
+
if (refEle.offsetWidth + refEle.scrollLeft >= refEle.scrollWidth) {
|
|
118
|
+
// scroll to end
|
|
119
|
+
setShowNext(false);
|
|
120
|
+
} else {
|
|
121
|
+
setShowNext(true);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
refEle.addEventListener('scroll', handleScroll);
|
|
126
|
+
return function () {
|
|
127
|
+
refEle.removeEventListener('scroll', handleScroll);
|
|
128
|
+
};
|
|
129
|
+
}, [ref, setShowNext]);
|
|
130
|
+
return ref;
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
var MobileTab = function MobileTab(_ref2) {
|
|
134
|
+
var _ref2$tabs = _ref2.tabs,
|
|
135
|
+
tabs = _ref2$tabs === void 0 ? [] : _ref2$tabs,
|
|
136
|
+
_ref2$activeTabIndex = _ref2.activeTabIndex,
|
|
137
|
+
activeTabIndex = _ref2$activeTabIndex === void 0 ? 0 : _ref2$activeTabIndex;
|
|
138
|
+
|
|
139
|
+
var _useState = (0, _react.useState)(activeTabIndex),
|
|
140
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
141
|
+
activeIndex = _useState2[0],
|
|
142
|
+
setActiveIndex = _useState2[1];
|
|
143
|
+
|
|
144
|
+
var _useState3 = (0, _react.useState)(false),
|
|
145
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
146
|
+
showGradientMask = _useState4[0],
|
|
147
|
+
setShowGradientMask = _useState4[1];
|
|
148
|
+
|
|
149
|
+
var ref = useScrollStatus(setShowGradientMask);
|
|
150
|
+
var tabJSX = tabs.map(function (tab, index) {
|
|
151
|
+
tab.isActive = index === activeIndex;
|
|
152
|
+
|
|
153
|
+
var handleClick = function handleClick() {
|
|
154
|
+
setActiveIndex(index);
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
return /*#__PURE__*/_react["default"].createElement(TabItem, {
|
|
158
|
+
key: index,
|
|
159
|
+
tab: tab,
|
|
160
|
+
onClick: handleClick
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
return /*#__PURE__*/_react["default"].createElement(MobileTabContainer, {
|
|
164
|
+
ref: ref,
|
|
165
|
+
showGradientMask: showGradientMask
|
|
166
|
+
}, tabJSX);
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
MobileTab.propTypes = {
|
|
170
|
+
tabs: _propTypes["default"].arrayOf(tabPropType),
|
|
171
|
+
activeTabIndex: _propTypes["default"].number
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
var TitleTab = function TitleTab(_ref3) {
|
|
175
|
+
var _ref3$title = _ref3.title,
|
|
176
|
+
title = _ref3$title === void 0 ? '' : _ref3$title,
|
|
177
|
+
_ref3$tabs = _ref3.tabs,
|
|
178
|
+
tabs = _ref3$tabs === void 0 ? [] : _ref3$tabs,
|
|
179
|
+
_ref3$activeTabIndex = _ref3.activeTabIndex,
|
|
180
|
+
activeTabIndex = _ref3$activeTabIndex === void 0 ? 0 : _ref3$activeTabIndex;
|
|
181
|
+
return /*#__PURE__*/_react["default"].createElement(BarContainer, null, /*#__PURE__*/_react["default"].createElement(_headline.H1, {
|
|
182
|
+
text: title
|
|
183
|
+
}), /*#__PURE__*/_react["default"].createElement(MobileTab, {
|
|
184
|
+
tabs: tabs,
|
|
185
|
+
activeTabIndex: activeTabIndex
|
|
186
|
+
}), /*#__PURE__*/_react["default"].createElement(_divider["default"], {
|
|
187
|
+
direction: "horizontal"
|
|
188
|
+
}));
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
TitleTab.propTypes = {
|
|
192
|
+
title: _propTypes["default"].string,
|
|
193
|
+
tabs: _propTypes["default"].arrayOf(tabPropType),
|
|
194
|
+
activeTabIndex: _propTypes["default"].number
|
|
195
|
+
};
|
|
196
|
+
var _default = TitleTab;
|
|
197
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "TitleBar", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _bar["default"];
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "TitleTab", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _tab["default"];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
exports["default"] = void 0;
|
|
19
|
+
|
|
20
|
+
var _bar = _interopRequireDefault(require("./components/bar"));
|
|
21
|
+
|
|
22
|
+
var _tab = _interopRequireDefault(require("./components/tab"));
|
|
23
|
+
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
|
+
|
|
26
|
+
var _default = {
|
|
27
|
+
TitleBar: _bar["default"],
|
|
28
|
+
TitleTab: _tab["default"]
|
|
29
|
+
};
|
|
30
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.bookmarkBar = exports.tagBar = exports.bar = exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _bar = _interopRequireDefault(require("../components/bar"));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
+
|
|
14
|
+
var _default = {
|
|
15
|
+
title: 'Title Bar/Bar',
|
|
16
|
+
component: _bar["default"]
|
|
17
|
+
};
|
|
18
|
+
exports["default"] = _default;
|
|
19
|
+
|
|
20
|
+
var Template = function Template(args) {
|
|
21
|
+
return /*#__PURE__*/_react["default"].createElement(_bar["default"], args);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
var bar = Template.bind({});
|
|
25
|
+
exports.bar = bar;
|
|
26
|
+
bar.args = {
|
|
27
|
+
title: '標題',
|
|
28
|
+
subtitle: '副標'
|
|
29
|
+
};
|
|
30
|
+
var tagBar = Template.bind({});
|
|
31
|
+
exports.tagBar = tagBar;
|
|
32
|
+
tagBar.args = {
|
|
33
|
+
title: 'Tag'
|
|
34
|
+
};
|
|
35
|
+
var bookmarkBar = Template.bind({});
|
|
36
|
+
exports.bookmarkBar = bookmarkBar;
|
|
37
|
+
bookmarkBar.args = {
|
|
38
|
+
title: '我的書籤',
|
|
39
|
+
subtitle: '全部 55'
|
|
40
|
+
};
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.animalTab = exports.humanRightsTab = exports.tab = exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _tab = _interopRequireDefault(require("../components/tab"));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
+
|
|
14
|
+
var _default = {
|
|
15
|
+
title: 'Title Bar/Tab',
|
|
16
|
+
component: _tab["default"]
|
|
17
|
+
};
|
|
18
|
+
exports["default"] = _default;
|
|
19
|
+
|
|
20
|
+
var Template = function Template(args) {
|
|
21
|
+
return /*#__PURE__*/_react["default"].createElement(_tab["default"], args);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
var tab = Template.bind({});
|
|
25
|
+
exports.tab = tab;
|
|
26
|
+
tab.args = {
|
|
27
|
+
title: '主分類',
|
|
28
|
+
tabs: [{
|
|
29
|
+
text: '子分類1',
|
|
30
|
+
isExternal: true,
|
|
31
|
+
link: 'https://www.google.com'
|
|
32
|
+
}, {
|
|
33
|
+
text: '子分類2',
|
|
34
|
+
isExternal: true,
|
|
35
|
+
link: 'https://www.google.com'
|
|
36
|
+
}, {
|
|
37
|
+
text: '子分類3',
|
|
38
|
+
isExternal: true,
|
|
39
|
+
link: 'https://www.google.com'
|
|
40
|
+
}, {
|
|
41
|
+
text: '子分類4',
|
|
42
|
+
isExternal: true,
|
|
43
|
+
link: 'https://www.google.com'
|
|
44
|
+
}, {
|
|
45
|
+
text: '子分類5',
|
|
46
|
+
isExternal: true,
|
|
47
|
+
link: 'https://www.google.com'
|
|
48
|
+
}, {
|
|
49
|
+
text: '子分類6',
|
|
50
|
+
isExternal: true,
|
|
51
|
+
link: 'https://www.google.com'
|
|
52
|
+
}]
|
|
53
|
+
};
|
|
54
|
+
var humanRightsTab = Template.bind({});
|
|
55
|
+
exports.humanRightsTab = humanRightsTab;
|
|
56
|
+
humanRightsTab.args = {
|
|
57
|
+
title: '人權司法',
|
|
58
|
+
tabs: [{
|
|
59
|
+
text: '全部',
|
|
60
|
+
isExternal: true,
|
|
61
|
+
link: 'https://www.google.com'
|
|
62
|
+
}, {
|
|
63
|
+
text: '性別',
|
|
64
|
+
isExternal: true,
|
|
65
|
+
link: 'https://www.google.com'
|
|
66
|
+
}, {
|
|
67
|
+
text: '勞動',
|
|
68
|
+
isExternal: true,
|
|
69
|
+
link: 'https://www.google.com'
|
|
70
|
+
}, {
|
|
71
|
+
text: '移工與移民',
|
|
72
|
+
isExternal: true,
|
|
73
|
+
link: 'https://www.google.com'
|
|
74
|
+
}, {
|
|
75
|
+
text: '居住正義',
|
|
76
|
+
isExternal: true,
|
|
77
|
+
link: 'https://www.google.com'
|
|
78
|
+
}, {
|
|
79
|
+
text: '轉型正義',
|
|
80
|
+
isExternal: true,
|
|
81
|
+
link: 'https://www.google.com'
|
|
82
|
+
}, {
|
|
83
|
+
text: '精神疾病',
|
|
84
|
+
isExternal: true,
|
|
85
|
+
link: 'https://www.google.com'
|
|
86
|
+
}, {
|
|
87
|
+
text: '司法改革',
|
|
88
|
+
isExternal: true,
|
|
89
|
+
link: 'https://www.google.com'
|
|
90
|
+
}, {
|
|
91
|
+
text: '數位人權',
|
|
92
|
+
isExternal: true,
|
|
93
|
+
link: 'https://www.google.com'
|
|
94
|
+
}]
|
|
95
|
+
};
|
|
96
|
+
var animalTab = Template.bind({});
|
|
97
|
+
exports.animalTab = animalTab;
|
|
98
|
+
animalTab.args = {
|
|
99
|
+
title: '動物',
|
|
100
|
+
tabs: [{
|
|
101
|
+
text: '長頸鹿',
|
|
102
|
+
isExternal: true,
|
|
103
|
+
link: 'https://www.google.com'
|
|
104
|
+
}, {
|
|
105
|
+
text: '海豚',
|
|
106
|
+
isExternal: true,
|
|
107
|
+
link: 'https://www.google.com'
|
|
108
|
+
}, {
|
|
109
|
+
text: '猴子',
|
|
110
|
+
isExternal: true,
|
|
111
|
+
link: 'https://www.google.com'
|
|
112
|
+
}, {
|
|
113
|
+
text: '熊貓',
|
|
114
|
+
isExternal: true,
|
|
115
|
+
link: 'https://www.google.com'
|
|
116
|
+
}, {
|
|
117
|
+
text: '刺蝟',
|
|
118
|
+
isExternal: true,
|
|
119
|
+
link: 'https://www.google.com'
|
|
120
|
+
}, {
|
|
121
|
+
text: '天竺鼠',
|
|
122
|
+
isExternal: true,
|
|
123
|
+
link: 'https://www.google.com'
|
|
124
|
+
}, {
|
|
125
|
+
text: '比目魚',
|
|
126
|
+
isExternal: true,
|
|
127
|
+
link: 'https://www.google.com'
|
|
128
|
+
}, {
|
|
129
|
+
text: '眼鏡蛇',
|
|
130
|
+
isExternal: true,
|
|
131
|
+
link: 'https://www.google.com'
|
|
132
|
+
}, {
|
|
133
|
+
text: '虎鯨',
|
|
134
|
+
isExternal: true,
|
|
135
|
+
link: 'https://www.google.com'
|
|
136
|
+
}, {
|
|
137
|
+
text: '台北樹蛙',
|
|
138
|
+
isExternal: true,
|
|
139
|
+
link: 'https://www.google.com'
|
|
140
|
+
}, {
|
|
141
|
+
text: '雨傘節',
|
|
142
|
+
isExternal: true,
|
|
143
|
+
link: 'https://www.google.com'
|
|
144
|
+
}, {
|
|
145
|
+
text: '獨角獸',
|
|
146
|
+
isExternal: true,
|
|
147
|
+
link: 'https://www.google.com'
|
|
148
|
+
}, {
|
|
149
|
+
text: '蠑螈',
|
|
150
|
+
isExternal: true,
|
|
151
|
+
link: 'https://www.google.com'
|
|
152
|
+
}, {
|
|
153
|
+
text: '珊瑚蟲',
|
|
154
|
+
isExternal: true,
|
|
155
|
+
link: 'https://www.google.com'
|
|
156
|
+
}, {
|
|
157
|
+
text: '老鼠',
|
|
158
|
+
isExternal: true,
|
|
159
|
+
link: 'https://www.google.com'
|
|
160
|
+
}, {
|
|
161
|
+
text: '皮卡丘',
|
|
162
|
+
isExternal: true,
|
|
163
|
+
link: 'https://www.google.com'
|
|
164
|
+
}, {
|
|
165
|
+
text: '犀牛',
|
|
166
|
+
isExternal: true,
|
|
167
|
+
link: 'https://www.google.com'
|
|
168
|
+
}, {
|
|
169
|
+
text: '馬來膜',
|
|
170
|
+
isExternal: true,
|
|
171
|
+
link: 'https://www.google.com'
|
|
172
|
+
}, {
|
|
173
|
+
text: '孔雀',
|
|
174
|
+
isExternal: true,
|
|
175
|
+
link: 'https://www.google.com'
|
|
176
|
+
}, {
|
|
177
|
+
text: '臺灣黑熊',
|
|
178
|
+
isExternal: true,
|
|
179
|
+
link: 'https://www.google.com'
|
|
180
|
+
}, {
|
|
181
|
+
text: '黑面琵鷺',
|
|
182
|
+
isExternal: true,
|
|
183
|
+
link: 'https://www.google.com'
|
|
184
|
+
}, {
|
|
185
|
+
text: '大笨鳥',
|
|
186
|
+
isExternal: true,
|
|
187
|
+
link: 'https://www.google.com'
|
|
188
|
+
}, {
|
|
189
|
+
text: '麻雀',
|
|
190
|
+
isExternal: true,
|
|
191
|
+
link: 'https://www.google.com'
|
|
192
|
+
}, {
|
|
193
|
+
text: '綠繡眼',
|
|
194
|
+
isExternal: true,
|
|
195
|
+
link: 'https://www.google.com'
|
|
196
|
+
}, {
|
|
197
|
+
text: '五色鳥',
|
|
198
|
+
isExternal: true,
|
|
199
|
+
link: 'https://www.google.com'
|
|
200
|
+
}, {
|
|
201
|
+
text: '赤腹松鼠',
|
|
202
|
+
isExternal: true,
|
|
203
|
+
link: 'https://www.google.com'
|
|
204
|
+
}, {
|
|
205
|
+
text: '狐蒙',
|
|
206
|
+
isExternal: true,
|
|
207
|
+
link: 'https://www.google.com'
|
|
208
|
+
}, {
|
|
209
|
+
text: '無尾熊',
|
|
210
|
+
isExternal: true,
|
|
211
|
+
link: 'https://www.google.com'
|
|
212
|
+
}, {
|
|
213
|
+
text: '鼴鼠',
|
|
214
|
+
isExternal: true,
|
|
215
|
+
link: 'https://www.google.com'
|
|
216
|
+
}, {
|
|
217
|
+
text: '福壽螺',
|
|
218
|
+
isExternal: true,
|
|
219
|
+
link: 'https://www.google.com'
|
|
220
|
+
}, {
|
|
221
|
+
text: '羊駝',
|
|
222
|
+
isExternal: true,
|
|
223
|
+
link: 'https://www.google.com'
|
|
224
|
+
}, {
|
|
225
|
+
text: '孔雀魚',
|
|
226
|
+
isExternal: true,
|
|
227
|
+
link: 'https://www.google.com'
|
|
228
|
+
}, {
|
|
229
|
+
text: '紅嘴灰鵯',
|
|
230
|
+
isExternal: true,
|
|
231
|
+
link: 'https://www.google.com'
|
|
232
|
+
}, {
|
|
233
|
+
text: '津田氏竹節蟲',
|
|
234
|
+
isExternal: true,
|
|
235
|
+
link: 'https://www.google.com'
|
|
236
|
+
}, {
|
|
237
|
+
text: '田鼠',
|
|
238
|
+
isExternal: true,
|
|
239
|
+
link: 'https://www.google.com'
|
|
240
|
+
}, {
|
|
241
|
+
text: '曙光鳳蝶',
|
|
242
|
+
isExternal: true,
|
|
243
|
+
link: 'https://www.google.com'
|
|
244
|
+
}, {
|
|
245
|
+
text: '雙髻鯊',
|
|
246
|
+
isExternal: true,
|
|
247
|
+
link: 'https://www.google.com'
|
|
248
|
+
}, {
|
|
249
|
+
text: '北極熊',
|
|
250
|
+
isExternal: true,
|
|
251
|
+
link: 'https://www.google.com'
|
|
252
|
+
}, {
|
|
253
|
+
text: '人面蜘蛛',
|
|
254
|
+
isExternal: true,
|
|
255
|
+
link: 'https://www.google.com'
|
|
256
|
+
}, {
|
|
257
|
+
text: '吳郭魚',
|
|
258
|
+
isExternal: true,
|
|
259
|
+
link: 'https://www.google.com'
|
|
260
|
+
}, {
|
|
261
|
+
text: '狐狸',
|
|
262
|
+
isExternal: true,
|
|
263
|
+
link: 'https://www.google.com'
|
|
264
|
+
}, {
|
|
265
|
+
text: '黃鶯',
|
|
266
|
+
isExternal: true,
|
|
267
|
+
link: 'https://www.google.com'
|
|
268
|
+
}, {
|
|
269
|
+
text: '燕子',
|
|
270
|
+
isExternal: true,
|
|
271
|
+
link: 'https://www.google.com'
|
|
272
|
+
}, {
|
|
273
|
+
text: '鴿子',
|
|
274
|
+
isExternal: true,
|
|
275
|
+
link: 'https://www.google.com'
|
|
276
|
+
}]
|
|
277
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twreporter/react-components",
|
|
3
|
-
"version": "8.12.
|
|
3
|
+
"version": "8.12.1-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,7 +15,7 @@
|
|
|
15
15
|
"chromatic": "npx chromatic --exit-zero-on-changes"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@twreporter/core": "^1.
|
|
18
|
+
"@twreporter/core": "^1.6.0-rc.0",
|
|
19
19
|
"@twreporter/redux": "^7.2.2",
|
|
20
20
|
"fontfaceobserver-es": "^3.3.3",
|
|
21
21
|
"hoist-non-react-statics": "^2.3.1",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"babel-loader": "^8.2.4",
|
|
45
45
|
"chromatic": "^6.5.4"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "e7da8e5190f107cffbfb73e24c20619ec19470c2"
|
|
48
48
|
}
|