@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,39 +4,26 @@ 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 _headline = require("../../text/headline");
|
|
15
|
-
|
|
16
11
|
var _paragraph = require("../../text/paragraph");
|
|
17
|
-
|
|
18
12
|
var _divider = _interopRequireDefault(require("../../divider"));
|
|
19
|
-
|
|
20
13
|
var _color = require("@twreporter/core/lib/constants/color");
|
|
21
|
-
|
|
22
14
|
var _mediaQuery = _interopRequireDefault(require("@twreporter/core/lib/utils/media-query"));
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
var _templateObject; // component
|
|
16
|
+
// @twreporter
|
|
26
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
27
|
-
|
|
28
18
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
29
|
-
|
|
30
19
|
var BarContainer = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
31
20
|
displayName: "title2__BarContainer",
|
|
32
21
|
componentId: "t8u2lz-0"
|
|
33
22
|
})(["width:100%;display:flex;align-self:stretch;margin-bottom:16px;justify-content:space-between;", ""], _mediaQuery["default"].tabletAndBelow(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin-bottom: 8px;\n "]))));
|
|
34
|
-
|
|
35
23
|
var Text = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
36
24
|
displayName: "title2__Text",
|
|
37
25
|
componentId: "t8u2lz-1"
|
|
38
26
|
})(["display:flex;align-items:baseline;gap:16px;"]);
|
|
39
|
-
|
|
40
27
|
var H5Gray800 = /*#__PURE__*/(0, _styledComponents["default"])(_headline.H5).withConfig({
|
|
41
28
|
displayName: "title2__H5Gray800",
|
|
42
29
|
componentId: "t8u2lz-2"
|
|
@@ -49,13 +36,12 @@ var DividerGray800 = /*#__PURE__*/(0, _styledComponents["default"])(_divider["de
|
|
|
49
36
|
displayName: "title2__DividerGray800",
|
|
50
37
|
componentId: "t8u2lz-4"
|
|
51
38
|
})(["border-color:", ";"], _color.colorGrayscale.gray800);
|
|
52
|
-
|
|
53
39
|
var Title2 = function Title2(_ref) {
|
|
54
40
|
var _ref$title = _ref.title,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
41
|
+
title = _ref$title === void 0 ? '' : _ref$title,
|
|
42
|
+
_ref$subtitle = _ref.subtitle,
|
|
43
|
+
subtitle = _ref$subtitle === void 0 ? '' : _ref$subtitle,
|
|
44
|
+
renderButton = _ref.renderButton;
|
|
59
45
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(BarContainer, null, /*#__PURE__*/_react["default"].createElement(Text, null, /*#__PURE__*/_react["default"].createElement(H5Gray800, {
|
|
60
46
|
text: title
|
|
61
47
|
}), subtitle ? /*#__PURE__*/_react["default"].createElement(P2Gray600, {
|
|
@@ -64,11 +50,9 @@ var Title2 = function Title2(_ref) {
|
|
|
64
50
|
direction: _divider["default"].Direction.HORIZONTAL
|
|
65
51
|
}));
|
|
66
52
|
};
|
|
67
|
-
|
|
68
53
|
Title2.propTypes = {
|
|
69
54
|
title: _propTypes["default"].string.isRequired,
|
|
70
55
|
subtitle: _propTypes["default"].string,
|
|
71
56
|
renderButton: _propTypes["default"].element
|
|
72
57
|
};
|
|
73
|
-
var _default = Title2;
|
|
74
|
-
exports["default"] = _default;
|
|
58
|
+
var _default = exports["default"] = Title2;
|
package/lib/title-bar/index.js
CHANGED
|
@@ -22,18 +22,12 @@ Object.defineProperty(exports, "TitleTab", {
|
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
exports["default"] = void 0;
|
|
25
|
-
|
|
26
25
|
var _title = _interopRequireDefault(require("./components/title1"));
|
|
27
|
-
|
|
28
26
|
var _title2 = _interopRequireDefault(require("./components/title2"));
|
|
29
|
-
|
|
30
27
|
var _tab = _interopRequireDefault(require("./components/tab"));
|
|
31
|
-
|
|
32
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
33
|
-
|
|
34
|
-
var _default = {
|
|
29
|
+
var _default = exports["default"] = {
|
|
35
30
|
Title1: _title["default"],
|
|
36
31
|
Title2: _title2["default"],
|
|
37
32
|
TitleTab: _tab["default"]
|
|
38
|
-
};
|
|
39
|
-
exports["default"] = _default;
|
|
33
|
+
};
|
|
@@ -4,17 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.tab = exports.humanRightsTab = exports["default"] = exports.animalTab = void 0;
|
|
7
|
-
|
|
8
7
|
var _tab = _interopRequireDefault(require("../components/tab"));
|
|
9
|
-
|
|
10
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
|
|
12
|
-
var _default = {
|
|
9
|
+
var _default = exports["default"] = {
|
|
13
10
|
title: 'Title Bar/Tab',
|
|
14
11
|
component: _tab["default"]
|
|
15
12
|
};
|
|
16
|
-
exports
|
|
17
|
-
var tab = {
|
|
13
|
+
var tab = exports.tab = {
|
|
18
14
|
args: {
|
|
19
15
|
title: '主分類',
|
|
20
16
|
tabs: [{
|
|
@@ -44,8 +40,7 @@ var tab = {
|
|
|
44
40
|
}]
|
|
45
41
|
}
|
|
46
42
|
};
|
|
47
|
-
exports.
|
|
48
|
-
var humanRightsTab = {
|
|
43
|
+
var humanRightsTab = exports.humanRightsTab = {
|
|
49
44
|
args: {
|
|
50
45
|
title: '人權司法',
|
|
51
46
|
tabs: [{
|
|
@@ -87,8 +82,7 @@ var humanRightsTab = {
|
|
|
87
82
|
}]
|
|
88
83
|
}
|
|
89
84
|
};
|
|
90
|
-
exports.
|
|
91
|
-
var animalTab = {
|
|
85
|
+
var animalTab = exports.animalTab = {
|
|
92
86
|
args: {
|
|
93
87
|
title: '動物',
|
|
94
88
|
tabs: [{
|
|
@@ -269,5 +263,4 @@ var animalTab = {
|
|
|
269
263
|
link: 'https://www.google.com'
|
|
270
264
|
}]
|
|
271
265
|
}
|
|
272
|
-
};
|
|
273
|
-
exports.animalTab = animalTab;
|
|
266
|
+
};
|
|
@@ -4,33 +4,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.tagBar = exports["default"] = exports.bookmarkBar = exports.bar = void 0;
|
|
7
|
-
|
|
8
7
|
var _title = _interopRequireDefault(require("../components/title1"));
|
|
9
|
-
|
|
10
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
|
|
12
|
-
var _default = {
|
|
9
|
+
var _default = exports["default"] = {
|
|
13
10
|
title: 'Title Bar/Title 1',
|
|
14
11
|
component: _title["default"]
|
|
15
12
|
};
|
|
16
|
-
exports
|
|
17
|
-
var bar = {
|
|
13
|
+
var bar = exports.bar = {
|
|
18
14
|
args: {
|
|
19
15
|
title: '標題',
|
|
20
16
|
subtitle: '副標'
|
|
21
17
|
}
|
|
22
18
|
};
|
|
23
|
-
exports.
|
|
24
|
-
var tagBar = {
|
|
19
|
+
var tagBar = exports.tagBar = {
|
|
25
20
|
args: {
|
|
26
21
|
title: 'Tag'
|
|
27
22
|
}
|
|
28
23
|
};
|
|
29
|
-
exports.
|
|
30
|
-
var bookmarkBar = {
|
|
24
|
+
var bookmarkBar = exports.bookmarkBar = {
|
|
31
25
|
args: {
|
|
32
26
|
title: '我的書籤',
|
|
33
27
|
subtitle: '全部 55'
|
|
34
28
|
}
|
|
35
|
-
};
|
|
36
|
-
exports.bookmarkBar = bookmarkBar;
|
|
29
|
+
};
|
|
@@ -4,19 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.title2 = exports["default"] = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _title = _interopRequireDefault(require("../components/title2"));
|
|
11
|
-
|
|
12
9
|
var _textButton = _interopRequireDefault(require("../../button/components/textButton"));
|
|
13
|
-
|
|
14
10
|
var _icon = require("../../icon");
|
|
15
|
-
|
|
16
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
|
-
|
|
18
12
|
/* eslint react/display-name:0 */
|
|
19
|
-
var _default = {
|
|
13
|
+
var _default = exports["default"] = {
|
|
20
14
|
title: 'Title Bar/Title 2',
|
|
21
15
|
component: _title["default"],
|
|
22
16
|
argTypes: {
|
|
@@ -29,8 +23,7 @@ var _default = {
|
|
|
29
23
|
}
|
|
30
24
|
}
|
|
31
25
|
};
|
|
32
|
-
exports
|
|
33
|
-
var title2 = {
|
|
26
|
+
var title2 = exports.title2 = {
|
|
34
27
|
render: function render(args) {
|
|
35
28
|
args.renderButton = args.showButton ? /*#__PURE__*/_react["default"].createElement(_textButton["default"], {
|
|
36
29
|
text: "NOT RWD \u6309\u9215",
|
|
@@ -50,5 +43,4 @@ var title2 = {
|
|
|
50
43
|
exclude: ['renderButton']
|
|
51
44
|
}
|
|
52
45
|
}
|
|
53
|
-
};
|
|
54
|
-
exports.title2 = title2;
|
|
46
|
+
};
|
|
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = linkWithParams;
|
|
7
|
-
|
|
8
7
|
var _url = _interopRequireDefault(require("url"));
|
|
9
|
-
|
|
10
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
|
|
12
9
|
/**
|
|
13
10
|
* @param { string } originalUrl - The original url
|
|
14
11
|
* @param { Object } params - search params to be set
|
|
@@ -16,12 +13,10 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
16
13
|
*/
|
|
17
14
|
function linkWithParams(originalUrl, params) {
|
|
18
15
|
var urlObj = new URL(originalUrl);
|
|
19
|
-
|
|
20
16
|
for (var key in params) {
|
|
21
17
|
if (params[key]) {
|
|
22
18
|
urlObj.searchParams.set(key, params[key]);
|
|
23
19
|
}
|
|
24
20
|
}
|
|
25
|
-
|
|
26
21
|
return _url["default"].format(urlObj);
|
|
27
22
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twreporter/react-components",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.1.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>",
|
|
@@ -16,14 +16,14 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@twreporter/core": "^1.22.1",
|
|
19
|
-
"@twreporter/redux": "^8.0.
|
|
19
|
+
"@twreporter/redux": "^8.0.3-rc.0",
|
|
20
20
|
"fontfaceobserver-es": "^3.3.3",
|
|
21
21
|
"hoist-non-react-statics": "^2.3.1",
|
|
22
22
|
"lodash": "^4.0.0",
|
|
23
23
|
"memoize-one": "^5.0.5",
|
|
24
24
|
"prop-types": "^15.0.0",
|
|
25
25
|
"react": "^18.2.0",
|
|
26
|
-
"react-redux": "^
|
|
26
|
+
"react-redux": "^9.1.2",
|
|
27
27
|
"react-router-dom": "^5.1.2",
|
|
28
28
|
"react-transition-group": "^4.4.5",
|
|
29
29
|
"react-waypoint": "^10.3.0",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"react-dom": "^18.2.0",
|
|
53
53
|
"storybook": "^7.5.2"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "df79295a50f202d6ed016de4e91bbbc0899a3882"
|
|
56
56
|
}
|
package/lib/hook/use-store.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
|
|
10
|
-
var _reactRedux = require("react-redux");
|
|
11
|
-
|
|
12
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
13
|
-
|
|
14
|
-
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."); }
|
|
15
|
-
|
|
16
|
-
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); }
|
|
17
|
-
|
|
18
|
-
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; }
|
|
19
|
-
|
|
20
|
-
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; }
|
|
21
|
-
|
|
22
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
23
|
-
|
|
24
|
-
function useStore() {
|
|
25
|
-
var _useContext = (0, _react.useContext)(_reactRedux.ReactReduxContext),
|
|
26
|
-
store = _useContext.store;
|
|
27
|
-
|
|
28
|
-
var getState = store.getState,
|
|
29
|
-
dispatch = store.dispatch,
|
|
30
|
-
subscribe = store.subscribe;
|
|
31
|
-
|
|
32
|
-
var _useState = (0, _react.useState)(getState()),
|
|
33
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
34
|
-
storeState = _useState2[0],
|
|
35
|
-
setStoreState = _useState2[1];
|
|
36
|
-
|
|
37
|
-
(0, _react.useEffect)(function () {
|
|
38
|
-
return subscribe(function () {
|
|
39
|
-
setStoreState(getState());
|
|
40
|
-
}, []);
|
|
41
|
-
});
|
|
42
|
-
return [storeState, dispatch];
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
var _default = useStore;
|
|
46
|
-
exports["default"] = _default;
|