@twreporter/react-components 9.0.2 → 9.1.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 +22 -0
- package/lib/badge/badge.stories.js +3 -9
- package/lib/badge/index.js +8 -24
- package/lib/bookmark-list/bookmark.js +20 -69
- package/lib/bookmark-list/bookmarks.js +10 -40
- package/lib/bookmark-list/customized-link.js +4 -14
- package/lib/bookmark-list/image-wrapper.js +9 -36
- package/lib/bookmark-list/index.js +36 -91
- package/lib/bookmark-list/redirect-to-sign-in.js +1 -10
- package/lib/bookmark-list/stories/bookmark.stories.js +3 -9
- package/lib/bookmark-widget/index.js +91 -220
- package/lib/button/components/iconButton.js +15 -34
- package/lib/button/components/iconWithTextButton.js +16 -31
- package/lib/button/components/link.js +27 -45
- package/lib/button/components/menuButton.js +18 -38
- package/lib/button/components/pillButton.js +31 -60
- package/lib/button/components/textButton.js +29 -61
- package/lib/button/components/toggleButton.js +11 -31
- package/lib/button/enums/index.js +4 -7
- package/lib/button/index.js +5 -18
- package/lib/button/stories/iconButton.stories.js +4 -15
- package/lib/button/stories/iconWithTextButton.stories.js +4 -13
- package/lib/button/stories/link.stories.js +9 -27
- package/lib/button/stories/menuButton.stories.js +3 -10
- package/lib/button/stories/pillButton.stories.js +4 -15
- package/lib/button/stories/textButton.stories.js +4 -15
- package/lib/button/stories/toggleButton.stories.js +3 -8
- package/lib/button/utils/size.js +3 -8
- package/lib/button/utils/theme.js +11 -102
- package/lib/card/components/article-card.js +31 -59
- package/lib/card/components/dialog.js +7 -22
- package/lib/card/components/short-story.js +24 -44
- package/lib/card/index.js +2 -8
- package/lib/card/stories/articleCard.stories.js +3 -14
- package/lib/card/stories/dialog.stories.js +3 -11
- package/lib/card/stories/shortStory.stories.js +3 -16
- package/lib/checkbox/checkbox.stories.js +3 -8
- package/lib/checkbox/index.js +10 -31
- package/lib/color.stories.js +9 -34
- package/lib/confirmation/index.js +7 -29
- package/lib/customized-link.js +5 -18
- package/lib/divider.js +3 -19
- package/lib/divider.stories.js +5 -18
- package/lib/donation-link.js +2 -14
- package/lib/empty-state/enums/index.js +2 -3
- package/lib/empty-state/index.js +20 -41
- package/lib/empty-state/stories/empty-guide.stories.js +3 -11
- package/lib/error/index.js +3 -8
- package/lib/error/message.js +3 -44
- package/lib/footer/constants/links.js +10 -16
- package/lib/footer/footer.stories.js +3 -10
- package/lib/footer/index.js +5 -40
- package/lib/footer/link.js +15 -46
- package/lib/footer/logo.js +12 -32
- package/lib/hook/index.js +3 -18
- package/lib/hook/use-bookmark.js +21 -47
- package/lib/hook/use-font-face-observer.js +9 -24
- package/lib/hook/use-outside-click.js +4 -9
- package/lib/icon/enum/index.js +5 -9
- package/lib/icon/index.js +49 -105
- package/lib/icon/stories/arrow.stories.js +7 -16
- package/lib/icon/stories/article.stories.js +2 -7
- package/lib/icon/stories/bookmark.stories.js +6 -14
- package/lib/icon/stories/changeIconColor.stories.js +2 -12
- package/lib/icon/stories/clock.stories.js +2 -7
- package/lib/icon/stories/copy.stories.js +2 -7
- package/lib/icon/stories/cross.stories.js +2 -7
- package/lib/icon/stories/hamburger.stories.js +2 -7
- package/lib/icon/stories/home.stories.js +2 -7
- package/lib/icon/stories/letter.stories.js +2 -7
- package/lib/icon/stories/loading.stories.js +2 -7
- package/lib/icon/stories/member.stories.js +2 -7
- package/lib/icon/stories/printer.stories.js +2 -7
- package/lib/icon/stories/search.stories.js +2 -7
- package/lib/icon/stories/share.stories.js +2 -7
- package/lib/icon/stories/socialMedia.stories.js +2 -8
- package/lib/icon/stories/text.stories.js +2 -7
- package/lib/icon/stories/topic.stories.js +2 -7
- package/lib/image-with-fallback.js +22 -52
- package/lib/input/components/search-bar.js +40 -85
- package/lib/input/components/text-field.js +20 -40
- package/lib/input/enums/index.js +6 -8
- package/lib/input/index.js +2 -7
- package/lib/input/stories/search-bar.stories.js +3 -16
- package/lib/input/stories/text-field.stories.js +3 -14
- package/lib/input/utils/theme.js +2 -9
- package/lib/is-fetching-wrapper.js +16 -48
- package/lib/junior-link.js +6 -29
- package/lib/link-with-tracker.js +14 -47
- package/lib/listing-page/components/card-list.js +20 -51
- package/lib/listing-page/components/image.js +15 -46
- package/lib/listing-page/components/list-item.js +18 -65
- package/lib/listing-page/components/list.js +17 -61
- package/lib/listing-page/components/page-content.js +2 -12
- package/lib/listing-page/components/topics/index.js +26 -74
- package/lib/listing-page/components/topics/post-item.js +14 -47
- package/lib/listing-page/components/topics/posts.js +1 -10
- package/lib/listing-page/components/topics/section.js +3 -25
- package/lib/listing-page/components/topics/topic-item.js +17 -56
- package/lib/listing-page/constants/mockup-spec.js +2 -3
- package/lib/listing-page/constants/predefined-css.js +2 -10
- package/lib/listing-page/constants/prop-types.js +2 -7
- package/lib/listing-page/constants/topics.js +2 -3
- package/lib/listing-page/index.js +2 -8
- package/lib/listing-page/stories/cardList.stories.js +3 -10
- package/lib/logo/components/logo-footer.js +6 -21
- package/lib/logo/components/logo-header.js +7 -23
- package/lib/logo/components/logo-loading-fallback.js +4 -13
- package/lib/logo/components/logo-symbol.js +7 -23
- package/lib/logo/index.js +2 -9
- package/lib/logo/stories/logoFooter.stories.js +2 -8
- package/lib/logo/stories/logoHeader.stories.js +3 -9
- package/lib/logo/stories/logoLoadingFallback.stories.js +2 -8
- package/lib/logo/stories/logoSymbol.stories.js +3 -9
- package/lib/logo/utils/path.js +2 -9
- package/lib/material-icon.js +9 -17
- package/lib/mobile-member-role-card/index.js +22 -49
- package/lib/mobile-member-role-card/stories/member-role-card.stories.js +3 -12
- package/lib/mobile-pop-up-modal.js +10 -44
- package/lib/more.js +10 -37
- package/lib/pagination/index.js +17 -83
- package/lib/podcast-link.js +6 -29
- package/lib/rwd.js +6 -26
- package/lib/shared-enum.js +2 -3
- package/lib/side-bar/index.js +16 -59
- package/lib/simple-header/index.js +2 -12
- package/lib/simple-header/simpleHeader.stories.js +3 -8
- package/lib/snack-bar/components/snack-bar.js +9 -20
- package/lib/snack-bar/hooks/use-snack-bar.js +12 -25
- package/lib/snack-bar/index.js +2 -7
- package/lib/snack-bar/stories/snackBar.stories.js +12 -29
- package/lib/snack-bar/utils/theme.js +3 -9
- package/lib/storybook/constants/index.js +3 -11
- package/lib/storybook/utils/get-enum-arg.js +2 -5
- package/lib/table-of-contents/index.js +62 -128
- package/lib/text/constants/headline-type.js +5 -8
- package/lib/text/enums/index.js +3 -5
- package/lib/text/headline.js +14 -41
- package/lib/text/paragraph.js +13 -34
- package/lib/text/stories/headline.stories.js +8 -21
- package/lib/text/stories/paragraph.stories.js +6 -17
- package/lib/text/utils/webfonts.js +9 -22
- package/lib/title-bar/components/tab.js +27 -69
- package/lib/title-bar/components/title1.js +6 -17
- package/lib/title-bar/components/title2.js +7 -23
- package/lib/title-bar/index.js +2 -8
- package/lib/title-bar/stories/tab.stories.js +5 -12
- package/lib/title-bar/stories/title1.stories.js +5 -12
- package/lib/title-bar/stories/title2.stories.js +3 -11
- package/lib/utils/link-with-params.js +0 -5
- package/package.json +4 -4
- package/lib/hook/use-store.js +0 -46
|
@@ -4,36 +4,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = exports.InheritLinkButton = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
9
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
13
|
-
|
|
14
10
|
var _customizedLink = _interopRequireDefault(require("../../customized-link"));
|
|
15
|
-
|
|
16
11
|
var _paragraph = require("../../text/paragraph");
|
|
17
|
-
|
|
18
12
|
var _enums = require("../enums");
|
|
19
|
-
|
|
20
13
|
var _color2 = require("@twreporter/core/lib/constants/color");
|
|
21
|
-
|
|
22
14
|
var _excluded = ["type", "link", "text", "weight", "TextComponent", "disabled"],
|
|
23
|
-
|
|
24
|
-
|
|
15
|
+
_excluded2 = ["type", "link", "text"];
|
|
25
16
|
var _decoration, _color;
|
|
26
|
-
|
|
27
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
28
|
-
|
|
18
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
29
19
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
30
|
-
|
|
31
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; }
|
|
32
|
-
|
|
33
21
|
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; }
|
|
34
|
-
|
|
35
|
-
function
|
|
36
|
-
|
|
22
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
24
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } // component
|
|
25
|
+
// constant
|
|
26
|
+
// @twreporter
|
|
37
27
|
var style = {
|
|
38
28
|
decoration: (_decoration = {}, _defineProperty(_decoration, _enums.LinkType.DEFAULT, 'none'), _defineProperty(_decoration, _enums.LinkType.UNDERLINE, 'underline'), _decoration),
|
|
39
29
|
color: (_color = {}, _defineProperty(_color, _enums.LinkType.DEFAULT, _color2.COLOR_SEMANTIC.info), _defineProperty(_color, _enums.LinkType.UNDERLINE, _color2.colorGrayscale.gray600), _color)
|
|
@@ -56,22 +46,20 @@ var InheritLinkContainer = /*#__PURE__*/(0, _styledComponents["default"])(BaseCo
|
|
|
56
46
|
displayName: "link__InheritLinkContainer",
|
|
57
47
|
componentId: "g5z7t5-2"
|
|
58
48
|
})([""]);
|
|
59
|
-
|
|
60
49
|
var LinkButton = function LinkButton(_ref) {
|
|
61
50
|
var _ref$type = _ref.type,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
51
|
+
type = _ref$type === void 0 ? _enums.LinkType.DEFAULT : _ref$type,
|
|
52
|
+
_ref$link = _ref.link,
|
|
53
|
+
link = _ref$link === void 0 ? {} : _ref$link,
|
|
54
|
+
_ref$text = _ref.text,
|
|
55
|
+
text = _ref$text === void 0 ? '' : _ref$text,
|
|
56
|
+
_ref$weight = _ref.weight,
|
|
57
|
+
weight = _ref$weight === void 0 ? _paragraph.P1.Weight.NORMAL : _ref$weight,
|
|
58
|
+
_ref$TextComponent = _ref.TextComponent,
|
|
59
|
+
TextComponent = _ref$TextComponent === void 0 ? null : _ref$TextComponent,
|
|
60
|
+
_ref$disabled = _ref.disabled,
|
|
61
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
62
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
75
63
|
var textJSX = TextComponent ? /*#__PURE__*/_react["default"].createElement(TextComponent, {
|
|
76
64
|
text: text,
|
|
77
65
|
weight: weight
|
|
@@ -84,7 +72,6 @@ var LinkButton = function LinkButton(_ref) {
|
|
|
84
72
|
$disabled: disabled
|
|
85
73
|
}, link, props), textJSX);
|
|
86
74
|
};
|
|
87
|
-
|
|
88
75
|
LinkButton.propTypes = {
|
|
89
76
|
type: _propTypes["default"].oneOf(Object.values(_enums.LinkType)),
|
|
90
77
|
link: _propTypes["default"].object,
|
|
@@ -95,27 +82,22 @@ LinkButton.propTypes = {
|
|
|
95
82
|
};
|
|
96
83
|
LinkButton.Type = _enums.LinkType;
|
|
97
84
|
LinkButton.Weight = _paragraph.P1.Weight;
|
|
98
|
-
|
|
99
|
-
var InheritLinkButton = function InheritLinkButton(_ref2) {
|
|
85
|
+
var InheritLinkButton = exports.InheritLinkButton = function InheritLinkButton(_ref2) {
|
|
100
86
|
var _ref2$type = _ref2.type,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
87
|
+
type = _ref2$type === void 0 ? _enums.LinkType.DEFAULT : _ref2$type,
|
|
88
|
+
_ref2$link = _ref2.link,
|
|
89
|
+
link = _ref2$link === void 0 ? {} : _ref2$link,
|
|
90
|
+
_ref2$text = _ref2.text,
|
|
91
|
+
text = _ref2$text === void 0 ? '' : _ref2$text,
|
|
92
|
+
props = _objectWithoutProperties(_ref2, _excluded2);
|
|
108
93
|
return /*#__PURE__*/_react["default"].createElement(InheritLinkContainer, _extends({
|
|
109
94
|
$type: type
|
|
110
95
|
}, link, props), text);
|
|
111
96
|
};
|
|
112
|
-
|
|
113
|
-
exports.InheritLinkButton = InheritLinkButton;
|
|
114
97
|
InheritLinkButton.propTypes = {
|
|
115
98
|
type: _propTypes["default"].oneOf(Object.values(_enums.LinkType)),
|
|
116
99
|
link: _propTypes["default"].object,
|
|
117
100
|
text: _propTypes["default"].string.isRequired
|
|
118
101
|
};
|
|
119
102
|
InheritLinkButton.Type = _enums.LinkType;
|
|
120
|
-
var _default = LinkButton;
|
|
121
|
-
exports["default"] = _default;
|
|
103
|
+
var _default = exports["default"] = LinkButton;
|
|
@@ -4,40 +4,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
9
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
13
|
-
|
|
14
10
|
var _mediaQuery = _interopRequireDefault(require("@twreporter/core/lib/utils/media-query"));
|
|
15
|
-
|
|
16
11
|
var _color = require("@twreporter/core/lib/constants/color");
|
|
17
|
-
|
|
18
12
|
var _customizedLink = _interopRequireDefault(require("../../customized-link"));
|
|
19
|
-
|
|
20
13
|
var _paragraph = require("../../text/paragraph");
|
|
21
|
-
|
|
22
14
|
var _excluded = ["text", "link", "color", "fontWeight", "hoverBgColor", "activeBgColor", "paddingLeft", "paddingRight"];
|
|
23
|
-
|
|
24
|
-
var _templateObject;
|
|
25
|
-
|
|
15
|
+
var _templateObject; // @twreporter
|
|
26
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
27
|
-
|
|
28
17
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
29
|
-
|
|
30
18
|
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; }
|
|
31
|
-
|
|
32
19
|
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; }
|
|
33
|
-
|
|
34
20
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
35
|
-
|
|
36
21
|
var StyledP1 = /*#__PURE__*/(0, _styledComponents["default"])(_paragraph.P1).withConfig({
|
|
37
22
|
displayName: "menuButton__StyledP1",
|
|
38
23
|
componentId: "sc-1g6dn3b-0"
|
|
39
24
|
})([""]);
|
|
40
|
-
|
|
41
25
|
var ItemContainer = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
42
26
|
displayName: "menuButton__ItemContainer",
|
|
43
27
|
componentId: "sc-1g6dn3b-1"
|
|
@@ -54,26 +38,24 @@ var ItemContainer = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
|
54
38
|
}), function (props) {
|
|
55
39
|
return props.$activeBgColor;
|
|
56
40
|
});
|
|
57
|
-
|
|
58
41
|
var MenuButton = function MenuButton(_ref) {
|
|
59
42
|
var _ref$text = _ref.text,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
43
|
+
text = _ref$text === void 0 ? '' : _ref$text,
|
|
44
|
+
_ref$link = _ref.link,
|
|
45
|
+
link = _ref$link === void 0 ? {} : _ref$link,
|
|
46
|
+
_ref$color = _ref.color,
|
|
47
|
+
color = _ref$color === void 0 ? _color.colorGrayscale.gray800 : _ref$color,
|
|
48
|
+
_ref$fontWeight = _ref.fontWeight,
|
|
49
|
+
fontWeight = _ref$fontWeight === void 0 ? _paragraph.P1.Weight.NORMAL : _ref$fontWeight,
|
|
50
|
+
_ref$hoverBgColor = _ref.hoverBgColor,
|
|
51
|
+
hoverBgColor = _ref$hoverBgColor === void 0 ? _color.colorGrayscale.gray100 : _ref$hoverBgColor,
|
|
52
|
+
_ref$activeBgColor = _ref.activeBgColor,
|
|
53
|
+
activeBgColor = _ref$activeBgColor === void 0 ? _color.colorGrayscale.gray200 : _ref$activeBgColor,
|
|
54
|
+
_ref$paddingLeft = _ref.paddingLeft,
|
|
55
|
+
paddingLeft = _ref$paddingLeft === void 0 ? 32 : _ref$paddingLeft,
|
|
56
|
+
_ref$paddingRight = _ref.paddingRight,
|
|
57
|
+
paddingRight = _ref$paddingRight === void 0 ? 32 : _ref$paddingRight,
|
|
58
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
77
59
|
return /*#__PURE__*/_react["default"].createElement(ItemContainer, _extends({
|
|
78
60
|
$color: color,
|
|
79
61
|
$hoverBgColor: hoverBgColor,
|
|
@@ -85,7 +67,6 @@ var MenuButton = function MenuButton(_ref) {
|
|
|
85
67
|
weight: fontWeight
|
|
86
68
|
})));
|
|
87
69
|
};
|
|
88
|
-
|
|
89
70
|
MenuButton.propTypes = {
|
|
90
71
|
text: _propTypes["default"].string,
|
|
91
72
|
link: _propTypes["default"].object,
|
|
@@ -97,5 +78,4 @@ MenuButton.propTypes = {
|
|
|
97
78
|
paddingRight: _propTypes["default"].number
|
|
98
79
|
};
|
|
99
80
|
MenuButton.FontWeight = _paragraph.P1.Weight;
|
|
100
|
-
var _default = MenuButton;
|
|
101
|
-
exports["default"] = _default;
|
|
81
|
+
var _default = exports["default"] = MenuButton;
|
|
@@ -1,46 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(
|
|
4
|
-
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
|
|
14
10
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
15
|
-
|
|
16
11
|
var _paragraph = require("../../text/paragraph");
|
|
17
|
-
|
|
18
12
|
var _theme = require("../utils/theme");
|
|
19
|
-
|
|
20
13
|
var _size = require("../utils/size");
|
|
21
|
-
|
|
22
14
|
var _enums = require("../enums");
|
|
23
|
-
|
|
24
15
|
var _sharedEnum = require("../../shared-enum");
|
|
25
|
-
|
|
26
16
|
var _theme2 = require("@twreporter/core/lib/constants/theme");
|
|
27
|
-
|
|
28
17
|
var _color = require("@twreporter/core/lib/constants/color");
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
function _getRequireWildcardCache(
|
|
33
|
-
|
|
34
|
-
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; }
|
|
35
|
-
|
|
18
|
+
var _excluded = ["text", "leftIconComponent", "rightIconComponent", "size", "theme", "type", "style", "disabled", "loading"]; // utils
|
|
19
|
+
// enums
|
|
20
|
+
// @twreporter
|
|
21
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
22
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
36
23
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
37
|
-
|
|
38
24
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
39
|
-
|
|
40
25
|
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; }
|
|
41
|
-
|
|
42
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; }
|
|
43
|
-
|
|
44
27
|
var ButtonContainer = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
45
28
|
displayName: "pillButton__ButtonContainer",
|
|
46
29
|
componentId: "xa7tsy-0"
|
|
@@ -69,26 +52,21 @@ var ButtonContainer = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
|
69
52
|
}, function (props) {
|
|
70
53
|
return props.$hoverColor;
|
|
71
54
|
});
|
|
72
|
-
|
|
73
55
|
var IconContainer = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
74
56
|
displayName: "pillButton__IconContainer",
|
|
75
57
|
componentId: "xa7tsy-1"
|
|
76
58
|
})(["display:flex;align-items:center;&:first-child{margin-right:4px;}&:last-child{margin-left:4px;}"]);
|
|
77
|
-
|
|
78
59
|
var HideOnLoading = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
79
60
|
displayName: "pillButton__HideOnLoading",
|
|
80
61
|
componentId: "xa7tsy-2"
|
|
81
62
|
})(["opacity:", ";display:flex;align-items:center;justify-content:center;"], function (props) {
|
|
82
63
|
return props.$show ? 1 : 0;
|
|
83
64
|
});
|
|
84
|
-
|
|
85
65
|
var RelativeParent = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
86
66
|
displayName: "pillButton__RelativeParent",
|
|
87
67
|
componentId: "xa7tsy-3"
|
|
88
68
|
})(["position:relative;display:flex;align-items:center;justify-content:center;"]);
|
|
89
|
-
|
|
90
69
|
var spin = /*#__PURE__*/(0, _styledComponents.keyframes)(["0%{transform:rotate(0deg);}100%{transform:rotate(360deg);}"]);
|
|
91
|
-
|
|
92
70
|
var Loader = /*#__PURE__*/_styledComponents["default"].span.withConfig({
|
|
93
71
|
displayName: "pillButton__Loader",
|
|
94
72
|
componentId: "xa7tsy-4"
|
|
@@ -99,40 +77,35 @@ var Loader = /*#__PURE__*/_styledComponents["default"].span.withConfig({
|
|
|
99
77
|
}, function (props) {
|
|
100
78
|
return props.$size;
|
|
101
79
|
}, _color.colorGrayscale.gray400, _color.colorGrayscale.gray600, spin);
|
|
102
|
-
|
|
103
80
|
var PillButton = function PillButton(_ref) {
|
|
104
81
|
var _ref$text = _ref.text,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
82
|
+
text = _ref$text === void 0 ? '' : _ref$text,
|
|
83
|
+
_ref$leftIconComponen = _ref.leftIconComponent,
|
|
84
|
+
leftIconComponent = _ref$leftIconComponen === void 0 ? null : _ref$leftIconComponen,
|
|
85
|
+
_ref$rightIconCompone = _ref.rightIconComponent,
|
|
86
|
+
rightIconComponent = _ref$rightIconCompone === void 0 ? null : _ref$rightIconCompone,
|
|
87
|
+
_ref$size = _ref.size,
|
|
88
|
+
size = _ref$size === void 0 ? _sharedEnum.Size.S : _ref$size,
|
|
89
|
+
_ref$theme = _ref.theme,
|
|
90
|
+
theme = _ref$theme === void 0 ? _theme2.THEME.normal : _ref$theme,
|
|
91
|
+
_ref$type = _ref.type,
|
|
92
|
+
type = _ref$type === void 0 ? _enums.Type.PRIMARY : _ref$type,
|
|
93
|
+
_ref$style = _ref.style,
|
|
94
|
+
style = _ref$style === void 0 ? _enums.Style.BRAND : _ref$style,
|
|
95
|
+
_ref$disabled = _ref.disabled,
|
|
96
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
97
|
+
_ref$loading = _ref.loading,
|
|
98
|
+
loading = _ref$loading === void 0 ? false : _ref$loading,
|
|
99
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
124
100
|
var themeFunc = type === _enums.Type.PRIMARY ? _theme.getFilledPillButtonTheme : _theme.getOutlinePillButtonTheme;
|
|
125
|
-
|
|
126
101
|
var _themeFunc = themeFunc(theme, disabled, style),
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
102
|
+
color = _themeFunc.color,
|
|
103
|
+
bgColor = _themeFunc.bgColor,
|
|
104
|
+
hoverColor = _themeFunc.hoverColor,
|
|
105
|
+
hoverBgColor = _themeFunc.hoverBgColor;
|
|
132
106
|
var _getSizeStyle = (0, _size.getSizeStyle)(size),
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
107
|
+
padding = _getSizeStyle.padding,
|
|
108
|
+
iconSize = _getSizeStyle.iconSize;
|
|
136
109
|
var textJSX = size === _sharedEnum.Size.S ? /*#__PURE__*/_react["default"].createElement(_paragraph.P2, {
|
|
137
110
|
text: text,
|
|
138
111
|
weight: "bold"
|
|
@@ -158,7 +131,6 @@ var PillButton = function PillButton(_ref) {
|
|
|
158
131
|
$size: size === _sharedEnum.Size.S ? 18 : 24
|
|
159
132
|
})));
|
|
160
133
|
};
|
|
161
|
-
|
|
162
134
|
PillButton.propTypes = {
|
|
163
135
|
leftIconComponent: _propTypes["default"].element,
|
|
164
136
|
rightIconComponent: _propTypes["default"].element,
|
|
@@ -174,5 +146,4 @@ PillButton.THEME = _theme2.THEME;
|
|
|
174
146
|
PillButton.Type = _enums.Type;
|
|
175
147
|
PillButton.Size = _sharedEnum.Size;
|
|
176
148
|
PillButton.Style = _enums.Style;
|
|
177
|
-
var _default = PillButton;
|
|
178
|
-
exports["default"] = _default;
|
|
149
|
+
var _default = exports["default"] = PillButton;
|
|
@@ -1,52 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(
|
|
4
|
-
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
|
|
14
10
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
15
|
-
|
|
16
11
|
var _theme = require("../utils/theme");
|
|
17
|
-
|
|
18
12
|
var _size = require("../utils/size");
|
|
19
|
-
|
|
20
13
|
var _paragraph = require("../../text/paragraph");
|
|
21
|
-
|
|
22
14
|
var _enums = require("../enums");
|
|
23
|
-
|
|
24
15
|
var _sharedEnum = require("../../shared-enum");
|
|
25
|
-
|
|
26
16
|
var _mediaQuery = _interopRequireDefault(require("@twreporter/core/lib/utils/media-query"));
|
|
27
|
-
|
|
28
17
|
var _theme2 = require("@twreporter/core/lib/constants/theme");
|
|
29
|
-
|
|
30
18
|
var _color = require("@twreporter/core/lib/constants/color");
|
|
31
|
-
|
|
32
19
|
var _excluded = ["text", "leftIconComponent", "rightIconComponent", "size", "theme", "style", "active", "disabled", "loading"];
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
function _interopRequireWildcard(
|
|
39
|
-
|
|
20
|
+
var _templateObject; // util
|
|
21
|
+
// component
|
|
22
|
+
// enums
|
|
23
|
+
// @twreporter
|
|
24
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
25
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
40
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
41
|
-
|
|
42
27
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
43
|
-
|
|
44
28
|
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; }
|
|
45
|
-
|
|
46
29
|
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; }
|
|
47
|
-
|
|
48
30
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
49
|
-
|
|
50
31
|
var ButtonContainer = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
51
32
|
displayName: "textButton__ButtonContainer",
|
|
52
33
|
componentId: "sc-1lwyrq5-0"
|
|
@@ -65,28 +46,23 @@ var ButtonContainer = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
|
65
46
|
}, function (props) {
|
|
66
47
|
return props.$hoverColor;
|
|
67
48
|
}));
|
|
68
|
-
|
|
69
49
|
var IconContainer = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
70
50
|
displayName: "textButton__IconContainer",
|
|
71
51
|
componentId: "sc-1lwyrq5-1"
|
|
72
52
|
})(["display:flex;align-items:center;margin:", ";"], function (props) {
|
|
73
53
|
return props.$isLeft ? '0 4px 0 0' : '0 0 0 4px';
|
|
74
54
|
});
|
|
75
|
-
|
|
76
55
|
var HideOnLoading = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
77
56
|
displayName: "textButton__HideOnLoading",
|
|
78
57
|
componentId: "sc-1lwyrq5-2"
|
|
79
58
|
})(["opacity:", ";display:flex;align-items:center;justify-content:center;"], function (props) {
|
|
80
59
|
return props.$show ? 1 : 0;
|
|
81
60
|
});
|
|
82
|
-
|
|
83
61
|
var RelativeParent = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
84
62
|
displayName: "textButton__RelativeParent",
|
|
85
63
|
componentId: "sc-1lwyrq5-3"
|
|
86
64
|
})(["position:relative;display:flex;align-items:center;justify-content:center;"]);
|
|
87
|
-
|
|
88
65
|
var spin = /*#__PURE__*/(0, _styledComponents.keyframes)(["0%{transform:rotate(0deg);}100%{transform:rotate(360deg);}"]);
|
|
89
|
-
|
|
90
66
|
var Loader = /*#__PURE__*/_styledComponents["default"].span.withConfig({
|
|
91
67
|
displayName: "textButton__Loader",
|
|
92
68
|
componentId: "sc-1lwyrq5-4"
|
|
@@ -97,30 +73,27 @@ var Loader = /*#__PURE__*/_styledComponents["default"].span.withConfig({
|
|
|
97
73
|
}, function (props) {
|
|
98
74
|
return props.$size;
|
|
99
75
|
}, _color.colorGrayscale.gray400, _color.colorGrayscale.gray600, spin);
|
|
100
|
-
|
|
101
76
|
var TextButton = function TextButton(_ref) {
|
|
102
77
|
var _ref$text = _ref.text,
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
78
|
+
text = _ref$text === void 0 ? '' : _ref$text,
|
|
79
|
+
_ref$leftIconComponen = _ref.leftIconComponent,
|
|
80
|
+
leftIconComponent = _ref$leftIconComponen === void 0 ? null : _ref$leftIconComponen,
|
|
81
|
+
_ref$rightIconCompone = _ref.rightIconComponent,
|
|
82
|
+
rightIconComponent = _ref$rightIconCompone === void 0 ? null : _ref$rightIconCompone,
|
|
83
|
+
_ref$size = _ref.size,
|
|
84
|
+
size = _ref$size === void 0 ? _sharedEnum.Size.S : _ref$size,
|
|
85
|
+
_ref$theme = _ref.theme,
|
|
86
|
+
theme = _ref$theme === void 0 ? _theme2.THEME.normal : _ref$theme,
|
|
87
|
+
_ref$style = _ref.style,
|
|
88
|
+
style = _ref$style === void 0 ? _enums.Style.DARK : _ref$style,
|
|
89
|
+
_ref$active = _ref.active,
|
|
90
|
+
active = _ref$active === void 0 ? false : _ref$active,
|
|
91
|
+
_ref$disabled = _ref.disabled,
|
|
92
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
93
|
+
_ref$loading = _ref.loading,
|
|
94
|
+
loading = _ref$loading === void 0 ? false : _ref$loading,
|
|
95
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
122
96
|
var themeFunc;
|
|
123
|
-
|
|
124
97
|
if (disabled) {
|
|
125
98
|
themeFunc = _theme.getDisabledTextButtonTheme;
|
|
126
99
|
} else if (active) {
|
|
@@ -128,14 +101,11 @@ var TextButton = function TextButton(_ref) {
|
|
|
128
101
|
} else {
|
|
129
102
|
themeFunc = _theme.getTextButtonTheme;
|
|
130
103
|
}
|
|
131
|
-
|
|
132
104
|
var _themeFunc = themeFunc(theme, style),
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
105
|
+
color = _themeFunc.color,
|
|
106
|
+
hoverColor = _themeFunc.hoverColor;
|
|
136
107
|
var _getSizeStyle = (0, _size.getSizeStyle)(size),
|
|
137
|
-
|
|
138
|
-
|
|
108
|
+
iconSize = _getSizeStyle.iconSize;
|
|
139
109
|
var textJSX = size === _sharedEnum.Size.S ? /*#__PURE__*/_react["default"].createElement(_paragraph.P2, {
|
|
140
110
|
text: text,
|
|
141
111
|
weight: "bold"
|
|
@@ -157,7 +127,6 @@ var TextButton = function TextButton(_ref) {
|
|
|
157
127
|
$size: size === _sharedEnum.Size.S ? 18 : 24
|
|
158
128
|
})));
|
|
159
129
|
};
|
|
160
|
-
|
|
161
130
|
TextButton.propTypes = {
|
|
162
131
|
leftIconComponent: _propTypes["default"].element,
|
|
163
132
|
rightIconComponent: _propTypes["default"].element,
|
|
@@ -172,5 +141,4 @@ TextButton.propTypes = {
|
|
|
172
141
|
TextButton.THEME = _theme2.THEME;
|
|
173
142
|
TextButton.Size = _sharedEnum.Size;
|
|
174
143
|
TextButton.Style = _enums.Style;
|
|
175
|
-
var _default = TextButton;
|
|
176
|
-
exports["default"] = _default;
|
|
144
|
+
var _default = exports["default"] = TextButton;
|