@atlaskit/reactions 21.4.0 → 21.6.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 +28 -0
- package/MockReactionsClient/package.json +7 -0
- package/dist/cjs/MockReactionsClient.js +276 -0
- package/dist/cjs/analytics/analytics.js +141 -0
- package/dist/cjs/analytics/index.js +4 -134
- package/dist/cjs/client/ReactionServiceClient.js +29 -6
- package/dist/cjs/components/{Counter.js → Counter/Counter.js} +32 -39
- package/dist/cjs/components/Counter/index.js +36 -0
- package/dist/cjs/components/Counter/styles.js +33 -0
- package/dist/cjs/components/EmojiButton/EmojiButton.js +58 -0
- package/dist/cjs/components/EmojiButton/index.js +19 -0
- package/dist/cjs/components/EmojiButton/styles.js +25 -0
- package/dist/cjs/components/FlashAnimation/FlashAnimation.js +42 -0
- package/dist/cjs/components/FlashAnimation/index.js +19 -0
- package/dist/cjs/components/{FlashAnimation.js → FlashAnimation/styles.js} +7 -26
- package/dist/cjs/components/Reaction/Reaction.js +163 -0
- package/dist/cjs/components/Reaction/index.js +19 -0
- package/dist/cjs/components/Reaction/styles.js +70 -0
- package/dist/cjs/components/ReactionPicker/ReactionPicker.js +272 -0
- package/dist/cjs/components/ReactionPicker/index.js +19 -0
- package/dist/cjs/components/ReactionPicker/styles.js +37 -0
- package/dist/cjs/components/ReactionTooltip/ReactionTooltip.js +71 -0
- package/dist/cjs/components/ReactionTooltip/index.js +19 -0
- package/dist/cjs/components/ReactionTooltip/styles.js +46 -0
- package/dist/cjs/components/Reactions/Reactions.js +200 -0
- package/dist/cjs/components/Reactions/index.js +25 -0
- package/dist/cjs/components/Reactions/styles.js +29 -0
- package/dist/cjs/components/Selector/Selector.js +132 -0
- package/dist/cjs/components/Selector/index.js +30 -0
- package/dist/cjs/components/Selector/styles.js +56 -0
- package/dist/cjs/components/ShowMore/ShowMore.js +71 -0
- package/dist/cjs/components/ShowMore/index.js +19 -0
- package/dist/cjs/components/ShowMore/styles.js +44 -0
- package/dist/cjs/components/Trigger/Trigger.js +59 -0
- package/dist/cjs/components/Trigger/index.js +13 -0
- package/dist/cjs/components/Trigger/styles.js +46 -0
- package/dist/cjs/components/{UfoErrorBoundary.js → UfoErrorBoundary/UfoErrorBoundary.js} +3 -0
- package/dist/cjs/components/UfoErrorBoundary/index.js +13 -0
- package/dist/cjs/containers/ConnectedReactionPicker/ConnectedReactionPicker.js +62 -0
- package/dist/cjs/containers/ConnectedReactionPicker/index.js +13 -0
- package/dist/cjs/containers/ConnectedReactionsView/ConnectedReactionsView.js +258 -0
- package/dist/cjs/containers/ConnectedReactionsView/index.js +13 -0
- package/dist/cjs/containers/index.js +23 -13
- package/dist/cjs/hooks/index.js +13 -0
- package/dist/cjs/hooks/useClickAway.js +35 -0
- package/dist/cjs/index.js +8 -0
- package/dist/cjs/shared/constants.js +44 -0
- package/dist/cjs/{components → shared}/i18n.js +1 -1
- package/dist/cjs/shared/index.js +24 -0
- package/dist/cjs/shared/utils.js +54 -0
- package/dist/cjs/store/{ReactionsStore.js → MemoryReactionsStore.js} +41 -18
- package/dist/cjs/store/ReactionConsumer.js +43 -15
- package/dist/cjs/store/index.js +8 -2
- package/dist/cjs/store/utils.js +4 -10
- package/dist/cjs/{client/ReactionClient.js → types/client.js} +0 -0
- package/dist/cjs/types/index.js +2 -2
- package/dist/cjs/types/reaction.js +43 -0
- package/dist/cjs/types/{DetailedReaction.js → store.js} +0 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/MockReactionsClient.js +126 -0
- package/dist/es2019/analytics/analytics.js +64 -0
- package/dist/es2019/analytics/index.js +3 -65
- package/dist/es2019/analytics/ufo.js +0 -1
- package/dist/es2019/client/ReactionServiceClient.js +31 -6
- package/dist/es2019/components/{Counter.js → Counter/Counter.js} +26 -31
- package/dist/es2019/components/Counter/index.js +3 -0
- package/dist/es2019/components/Counter/styles.js +20 -0
- package/dist/es2019/components/EmojiButton/EmojiButton.js +35 -0
- package/dist/es2019/components/EmojiButton/index.js +1 -0
- package/dist/es2019/components/EmojiButton/styles.js +16 -0
- package/dist/es2019/components/FlashAnimation/FlashAnimation.js +18 -0
- package/dist/es2019/components/FlashAnimation/index.js +1 -0
- package/dist/es2019/components/{FlashAnimation.js → FlashAnimation/styles.js} +6 -17
- package/dist/es2019/components/Reaction/Reaction.js +104 -0
- package/dist/es2019/components/Reaction/index.js +1 -0
- package/dist/es2019/components/Reaction/styles.js +55 -0
- package/dist/es2019/components/ReactionPicker/ReactionPicker.js +208 -0
- package/dist/es2019/components/ReactionPicker/index.js +1 -0
- package/dist/es2019/components/ReactionPicker/styles.js +23 -0
- package/dist/es2019/components/ReactionTooltip/ReactionTooltip.js +46 -0
- package/dist/es2019/components/ReactionTooltip/index.js +1 -0
- package/dist/es2019/components/ReactionTooltip/styles.js +32 -0
- package/dist/es2019/components/Reactions/Reactions.js +156 -0
- package/dist/es2019/components/Reactions/index.js +1 -0
- package/dist/es2019/components/Reactions/styles.js +19 -0
- package/dist/es2019/components/Selector/Selector.js +98 -0
- package/dist/es2019/components/Selector/index.js +3 -0
- package/dist/es2019/components/Selector/styles.js +39 -0
- package/dist/es2019/components/ShowMore/ShowMore.js +43 -0
- package/dist/es2019/components/ShowMore/index.js +1 -0
- package/dist/es2019/components/ShowMore/styles.js +30 -0
- package/dist/es2019/components/{Trigger.js → Trigger/Trigger.js} +15 -20
- package/dist/es2019/components/Trigger/index.js +1 -0
- package/dist/es2019/components/Trigger/styles.js +24 -0
- package/dist/es2019/components/{UfoErrorBoundary.js → UfoErrorBoundary/UfoErrorBoundary.js} +4 -0
- package/dist/es2019/components/UfoErrorBoundary/index.js +1 -0
- package/dist/es2019/containers/ConnectedReactionPicker/ConnectedReactionPicker.js +27 -0
- package/dist/es2019/containers/ConnectedReactionPicker/index.js +1 -0
- package/dist/es2019/containers/ConnectedReactionsView/ConnectedReactionsView.js +166 -0
- package/dist/es2019/containers/ConnectedReactionsView/index.js +1 -0
- package/dist/es2019/containers/index.js +2 -2
- package/dist/es2019/hooks/index.js +1 -0
- package/dist/es2019/hooks/useClickAway.js +27 -0
- package/dist/es2019/index.js +3 -1
- package/dist/es2019/shared/constants.js +32 -0
- package/dist/es2019/{components → shared}/i18n.js +1 -1
- package/dist/es2019/shared/index.js +6 -0
- package/dist/es2019/shared/utils.js +35 -0
- package/dist/es2019/store/{ReactionsStore.js → MemoryReactionsStore.js} +40 -14
- package/dist/es2019/store/ReactionConsumer.js +18 -12
- package/dist/es2019/store/index.js +1 -1
- package/dist/es2019/store/utils.js +8 -4
- package/dist/es2019/{client/ReactionClient.js → types/client.js} +0 -0
- package/dist/es2019/types/index.js +1 -1
- package/dist/es2019/types/reaction.js +34 -0
- package/dist/es2019/types/{DetailedReaction.js → store.js} +0 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/MockReactionsClient.js +257 -0
- package/dist/esm/analytics/analytics.js +99 -0
- package/dist/esm/analytics/index.js +3 -99
- package/dist/esm/analytics/ufo.js +0 -1
- package/dist/esm/client/ReactionServiceClient.js +30 -6
- package/dist/esm/components/{Counter.js → Counter/Counter.js} +26 -31
- package/dist/esm/components/Counter/index.js +3 -0
- package/dist/esm/components/Counter/styles.js +20 -0
- package/dist/esm/components/EmojiButton/EmojiButton.js +35 -0
- package/dist/esm/components/EmojiButton/index.js +1 -0
- package/dist/esm/components/EmojiButton/styles.js +16 -0
- package/dist/esm/components/FlashAnimation/FlashAnimation.js +20 -0
- package/dist/esm/components/FlashAnimation/index.js +1 -0
- package/dist/esm/components/{FlashAnimation.js → FlashAnimation/styles.js} +6 -19
- package/dist/esm/components/Reaction/Reaction.js +131 -0
- package/dist/esm/components/Reaction/index.js +1 -0
- package/dist/esm/components/Reaction/styles.js +55 -0
- package/dist/esm/components/ReactionPicker/ReactionPicker.js +243 -0
- package/dist/esm/components/ReactionPicker/index.js +1 -0
- package/dist/esm/components/ReactionPicker/styles.js +23 -0
- package/dist/esm/components/ReactionTooltip/ReactionTooltip.js +46 -0
- package/dist/esm/components/ReactionTooltip/index.js +1 -0
- package/dist/esm/components/ReactionTooltip/styles.js +32 -0
- package/dist/esm/components/Reactions/Reactions.js +166 -0
- package/dist/esm/components/Reactions/index.js +1 -0
- package/dist/esm/components/Reactions/styles.js +19 -0
- package/dist/esm/components/Selector/Selector.js +107 -0
- package/dist/esm/components/Selector/index.js +3 -0
- package/dist/esm/components/Selector/styles.js +41 -0
- package/dist/esm/components/ShowMore/ShowMore.js +46 -0
- package/dist/esm/components/ShowMore/index.js +1 -0
- package/dist/esm/components/ShowMore/styles.js +30 -0
- package/dist/esm/components/{Trigger.js → Trigger/Trigger.js} +15 -20
- package/dist/esm/components/Trigger/index.js +1 -0
- package/dist/esm/components/Trigger/styles.js +31 -0
- package/dist/esm/components/{UfoErrorBoundary.js → UfoErrorBoundary/UfoErrorBoundary.js} +4 -0
- package/dist/esm/components/UfoErrorBoundary/index.js +1 -0
- package/dist/esm/containers/ConnectedReactionPicker/ConnectedReactionPicker.js +46 -0
- package/dist/esm/containers/ConnectedReactionPicker/index.js +1 -0
- package/dist/esm/containers/ConnectedReactionsView/ConnectedReactionsView.js +227 -0
- package/dist/esm/containers/ConnectedReactionsView/index.js +1 -0
- package/dist/esm/containers/index.js +2 -2
- package/dist/esm/hooks/index.js +1 -0
- package/dist/esm/hooks/useClickAway.js +28 -0
- package/dist/esm/index.js +3 -1
- package/dist/esm/shared/constants.js +34 -0
- package/dist/esm/{components → shared}/i18n.js +1 -1
- package/dist/esm/shared/index.js +6 -0
- package/dist/esm/shared/utils.js +41 -0
- package/dist/esm/store/{ReactionsStore.js → MemoryReactionsStore.js} +40 -17
- package/dist/esm/store/ReactionConsumer.js +42 -15
- package/dist/esm/store/index.js +1 -1
- package/dist/esm/store/utils.js +8 -4
- package/dist/{es2019/types/ReactionSource.js → esm/types/client.js} +0 -0
- package/dist/esm/types/index.js +1 -1
- package/dist/esm/types/reaction.js +34 -0
- package/dist/{es2019/types/ReactionSummary.js → esm/types/store.js} +0 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/MockReactionsClient.d.ts +20 -0
- package/dist/types/analytics/analytics.d.ts +96 -0
- package/dist/types/analytics/index.d.ts +1 -96
- package/dist/types/client/ReactionServiceClient.d.ts +27 -10
- package/dist/types/client/index.d.ts +0 -1
- package/dist/types/components/Counter/Counter.d.ts +40 -0
- package/dist/types/components/Counter/index.d.ts +3 -0
- package/dist/types/components/Counter/styles.d.ts +3 -0
- package/dist/types/components/EmojiButton/EmojiButton.d.ts +22 -0
- package/dist/types/components/EmojiButton/index.d.ts +2 -0
- package/dist/types/components/EmojiButton/styles.d.ts +1 -0
- package/dist/types/components/FlashAnimation/FlashAnimation.d.ts +20 -0
- package/dist/types/components/FlashAnimation/index.d.ts +2 -0
- package/dist/types/components/FlashAnimation/styles.d.ts +3 -0
- package/dist/types/components/Reaction/Reaction.d.ts +38 -0
- package/dist/types/components/Reaction/index.d.ts +2 -0
- package/dist/types/components/Reaction/styles.d.ts +10 -0
- package/dist/types/components/ReactionPicker/ReactionPicker.d.ts +53 -0
- package/dist/types/components/ReactionPicker/index.d.ts +2 -0
- package/dist/types/components/ReactionPicker/styles.d.ts +3 -0
- package/dist/types/components/ReactionTooltip/ReactionTooltip.d.ts +22 -0
- package/dist/types/components/ReactionTooltip/index.d.ts +2 -0
- package/dist/types/components/ReactionTooltip/styles.d.ts +4 -0
- package/dist/types/components/Reactions/Reactions.d.ts +64 -0
- package/dist/types/components/Reactions/index.d.ts +2 -0
- package/dist/types/components/Reactions/styles.d.ts +2 -0
- package/dist/types/components/Selector/Selector.d.ts +34 -0
- package/dist/types/components/Selector/index.d.ts +3 -0
- package/dist/types/components/Selector/styles.d.ts +10 -0
- package/dist/types/components/ShowMore/ShowMore.d.ts +34 -0
- package/dist/types/components/ShowMore/index.d.ts +2 -0
- package/dist/types/components/ShowMore/styles.d.ts +3 -0
- package/dist/types/components/Trigger/Trigger.d.ts +23 -0
- package/dist/types/components/Trigger/index.d.ts +2 -0
- package/dist/types/components/Trigger/styles.d.ts +5 -0
- package/dist/types/components/UfoErrorBoundary/UfoErrorBoundary.d.ts +16 -0
- package/dist/types/components/UfoErrorBoundary/index.d.ts +2 -0
- package/dist/types/components/index.d.ts +4 -1
- package/dist/types/containers/ConnectedReactionPicker/ConnectedReactionPicker.d.ts +27 -0
- package/dist/types/containers/ConnectedReactionPicker/index.d.ts +2 -0
- package/dist/types/containers/ConnectedReactionsView/ConnectedReactionsView.d.ts +52 -0
- package/dist/types/containers/ConnectedReactionsView/index.d.ts +2 -0
- package/dist/types/containers/index.d.ts +2 -2
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/hooks/useClickAway.d.ts +8 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/shared/constants.d.ts +13 -0
- package/dist/types/{components → shared}/i18n.d.ts +0 -0
- package/dist/types/shared/index.d.ts +3 -0
- package/dist/types/shared/utils.d.ts +11 -0
- package/dist/types/store/{ReactionsStore.d.ts → MemoryReactionsStore.d.ts} +23 -26
- package/dist/types/store/ReactionConsumer.d.ts +47 -19
- package/dist/types/store/index.d.ts +2 -2
- package/dist/types/store/utils.d.ts +3 -7
- package/dist/types/types/Actions.d.ts +20 -4
- package/dist/types/types/User.d.ts +6 -0
- package/dist/types/types/client.d.ts +38 -0
- package/dist/types/types/index.d.ts +5 -7
- package/dist/types/types/reaction.d.ts +82 -0
- package/dist/types/types/store.d.ts +63 -0
- package/docs/0-intro.tsx +118 -27
- package/docs/1-connected-reaction-picker.tsx +133 -0
- package/docs/2-connected-reactions-view.tsx +130 -0
- package/docs/3-reactions-store.tsx +71 -0
- package/docs/4-reaction-service-client.tsx +42 -0
- package/extract-react-type/ConnectedReactionPicker.ts +6 -0
- package/extract-react-type/ConnectedReactionsView.ts +6 -0
- package/extract-react-type/Reaction.ts +6 -0
- package/extract-react-type/Reactions.ts +6 -0
- package/extract-react-type/actions.ts +6 -0
- package/extract-react-type/reactionClient.ts +6 -0
- package/extract-react-type/reactionsStore.ts +6 -0
- package/package.json +24 -7
- package/dist/cjs/client/MockReactionsClient.js +0 -183
- package/dist/cjs/components/EmojiButton.js +0 -100
- package/dist/cjs/components/Reaction.js +0 -226
- package/dist/cjs/components/ReactionPicker.js +0 -289
- package/dist/cjs/components/ReactionTooltip.js +0 -82
- package/dist/cjs/components/Reactions.js +0 -194
- package/dist/cjs/components/Selector.js +0 -189
- package/dist/cjs/components/ShowMore.js +0 -119
- package/dist/cjs/components/Trigger.js +0 -58
- package/dist/cjs/components/utils.js +0 -28
- package/dist/cjs/containers/ConnectedReactionPicker.js +0 -44
- package/dist/cjs/containers/ConnectedReactionsView.js +0 -139
- package/dist/cjs/types/ReactionSource.js +0 -5
- package/dist/cjs/types/ReactionStatus.js +0 -15
- package/dist/cjs/types/ReactionSummary.js +0 -5
- package/dist/cjs/types/Reactions.js +0 -5
- package/dist/cjs/types/ReactionsState.js +0 -5
- package/dist/es2019/client/MockReactionsClient.js +0 -123
- package/dist/es2019/components/EmojiButton.js +0 -50
- package/dist/es2019/components/Reaction.js +0 -180
- package/dist/es2019/components/ReactionPicker.js +0 -239
- package/dist/es2019/components/ReactionTooltip.js +0 -66
- package/dist/es2019/components/Reactions.js +0 -150
- package/dist/es2019/components/Selector.js +0 -127
- package/dist/es2019/components/ShowMore.js +0 -71
- package/dist/es2019/components/utils.js +0 -13
- package/dist/es2019/containers/ConnectedReactionPicker.js +0 -27
- package/dist/es2019/containers/ConnectedReactionsView.js +0 -118
- package/dist/es2019/types/ReactionStatus.js +0 -8
- package/dist/es2019/types/Reactions.js +0 -1
- package/dist/es2019/types/ReactionsState.js +0 -1
- package/dist/esm/client/MockReactionsClient.js +0 -164
- package/dist/esm/client/ReactionClient.js +0 -1
- package/dist/esm/components/EmojiButton.js +0 -77
- package/dist/esm/components/Reaction.js +0 -204
- package/dist/esm/components/ReactionPicker.js +0 -266
- package/dist/esm/components/ReactionTooltip.js +0 -63
- package/dist/esm/components/Reactions.js +0 -180
- package/dist/esm/components/Selector.js +0 -160
- package/dist/esm/components/ShowMore.js +0 -95
- package/dist/esm/components/utils.js +0 -15
- package/dist/esm/containers/ConnectedReactionPicker.js +0 -29
- package/dist/esm/containers/ConnectedReactionsView.js +0 -116
- package/dist/esm/types/DetailedReaction.js +0 -1
- package/dist/esm/types/ReactionSource.js +0 -1
- package/dist/esm/types/ReactionStatus.js +0 -8
- package/dist/esm/types/ReactionSummary.js +0 -1
- package/dist/esm/types/Reactions.js +0 -1
- package/dist/esm/types/ReactionsState.js +0 -1
- package/dist/types/client/MockReactionsClient.d.ts +0 -28
- package/dist/types/client/ReactionClient.d.ts +0 -25
- package/dist/types/components/Counter.d.ts +0 -14
- package/dist/types/components/EmojiButton.d.ts +0 -12
- package/dist/types/components/FlashAnimation.d.ts +0 -13
- package/dist/types/components/Reaction.d.ts +0 -25
- package/dist/types/components/ReactionPicker.d.ts +0 -39
- package/dist/types/components/ReactionTooltip.d.ts +0 -9
- package/dist/types/components/Reactions.d.ts +0 -49
- package/dist/types/components/Selector.d.ts +0 -27
- package/dist/types/components/ShowMore.d.ts +0 -21
- package/dist/types/components/Trigger.d.ts +0 -7
- package/dist/types/components/UfoErrorBoundary.d.ts +0 -9
- package/dist/types/components/utils.d.ts +0 -4
- package/dist/types/containers/ConnectedReactionPicker.d.ts +0 -10
- package/dist/types/containers/ConnectedReactionsView.d.ts +0 -19
- package/dist/types/types/DetailedReaction.d.ts +0 -7
- package/dist/types/types/ReactionSource.d.ts +0 -1
- package/dist/types/types/ReactionStatus.d.ts +0 -6
- package/dist/types/types/ReactionSummary.d.ts +0 -10
- package/dist/types/types/Reactions.d.ts +0 -4
- package/dist/types/types/ReactionsState.d.ts +0 -17
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
4
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
|
|
9
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
10
|
-
|
|
11
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
12
|
-
|
|
13
|
-
/** @jsx jsx */
|
|
14
|
-
import { jsx, css } from '@emotion/core';
|
|
15
|
-
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
16
|
-
import Tooltip from '@atlaskit/tooltip';
|
|
17
|
-
import React from 'react';
|
|
18
|
-
import { FormattedMessage } from 'react-intl-next';
|
|
19
|
-
import { createAndFireSafe, createPickerButtonClickedEvent, createPickerCancelledEvent, createPickerMoreClickedEvent, createReactionSelectionEvent, createReactionsRenderedEvent } from '../analytics';
|
|
20
|
-
import { ReactionStatus } from '../types/ReactionStatus';
|
|
21
|
-
import { messages } from './i18n';
|
|
22
|
-
import { Reaction } from './Reaction';
|
|
23
|
-
import { ReactionPicker } from './ReactionPicker';
|
|
24
|
-
var reactionStyle = css({
|
|
25
|
-
display: 'inline-block',
|
|
26
|
-
// top margin of 2px to allow spacing between rows when wrapped (paired with top margin in reactionsStyle)
|
|
27
|
-
margin: '2px 4px 0 4px'
|
|
28
|
-
});
|
|
29
|
-
var wrapperStyle = css({
|
|
30
|
-
display: 'flex',
|
|
31
|
-
flexWrap: 'wrap',
|
|
32
|
-
position: 'relative',
|
|
33
|
-
alignItems: 'center',
|
|
34
|
-
borderRadius: '15px',
|
|
35
|
-
// To allow to row spacing of 2px on wrap, and 0px on first row
|
|
36
|
-
marginTop: '-2px',
|
|
37
|
-
'> :first-of-type > :first-child': {
|
|
38
|
-
marginLeft: 0
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
export var ReactionsWithoutAnalytics = /*#__PURE__*/function (_React$PureComponent) {
|
|
42
|
-
_inherits(ReactionsWithoutAnalytics, _React$PureComponent);
|
|
43
|
-
|
|
44
|
-
var _super = _createSuper(ReactionsWithoutAnalytics);
|
|
45
|
-
|
|
46
|
-
function ReactionsWithoutAnalytics(props) {
|
|
47
|
-
var _this;
|
|
48
|
-
|
|
49
|
-
_classCallCheck(this, ReactionsWithoutAnalytics);
|
|
50
|
-
|
|
51
|
-
_this = _super.call(this, props);
|
|
52
|
-
|
|
53
|
-
_defineProperty(_assertThisInitialized(_this), "componentDidUpdate", function () {
|
|
54
|
-
if (_this.props.status === ReactionStatus.ready && _this.renderTime) {
|
|
55
|
-
createAndFireSafe(_this.props.createAnalyticsEvent, createReactionsRenderedEvent, _this.renderTime);
|
|
56
|
-
_this.renderTime = undefined;
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
_defineProperty(_assertThisInitialized(_this), "isDisabled", function () {
|
|
61
|
-
return _this.props.status !== ReactionStatus.ready;
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
_defineProperty(_assertThisInitialized(_this), "getTooltip", function () {
|
|
65
|
-
var _this$props = _this.props,
|
|
66
|
-
status = _this$props.status,
|
|
67
|
-
errorMessage = _this$props.errorMessage;
|
|
68
|
-
|
|
69
|
-
switch (status) {
|
|
70
|
-
case ReactionStatus.error:
|
|
71
|
-
return errorMessage ? errorMessage : jsx(FormattedMessage, messages.unexpectedError);
|
|
72
|
-
|
|
73
|
-
case ReactionStatus.loading:
|
|
74
|
-
case ReactionStatus.notLoaded:
|
|
75
|
-
return jsx(FormattedMessage, messages.loadingReactions);
|
|
76
|
-
|
|
77
|
-
default:
|
|
78
|
-
return undefined;
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
_defineProperty(_assertThisInitialized(_this), "handleReactionMouseEnter", function (reaction) {
|
|
83
|
-
if (_this.props.onReactionHover) {
|
|
84
|
-
_this.props.onReactionHover(reaction.emojiId);
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
_defineProperty(_assertThisInitialized(_this), "handlePickerOpen", function () {
|
|
89
|
-
_this.openTime = Date.now();
|
|
90
|
-
createAndFireSafe(_this.props.createAnalyticsEvent, createPickerButtonClickedEvent, _this.props.reactions.length);
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
_defineProperty(_assertThisInitialized(_this), "handleOnCancel", function () {
|
|
94
|
-
createAndFireSafe(_this.props.createAnalyticsEvent, createPickerCancelledEvent, _this.openTime);
|
|
95
|
-
_this.openTime = undefined;
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
_defineProperty(_assertThisInitialized(_this), "handleOnMore", function () {
|
|
99
|
-
createAndFireSafe(_this.props.createAnalyticsEvent, createPickerMoreClickedEvent, _this.openTime);
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
_defineProperty(_assertThisInitialized(_this), "handleOnSelection", function (emojiId, source) {
|
|
103
|
-
createAndFireSafe(_this.props.createAnalyticsEvent, createReactionSelectionEvent, source, emojiId, _this.props.reactions.find(function (reaction) {
|
|
104
|
-
return reaction.emojiId === emojiId;
|
|
105
|
-
}), _this.openTime);
|
|
106
|
-
_this.openTime = undefined;
|
|
107
|
-
|
|
108
|
-
if (_this.props.onSelection) {
|
|
109
|
-
_this.props.onSelection(emojiId);
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
_defineProperty(_assertThisInitialized(_this), "renderReaction", function (reaction) {
|
|
114
|
-
return jsx(Reaction, {
|
|
115
|
-
key: reaction.emojiId,
|
|
116
|
-
css: reactionStyle,
|
|
117
|
-
reaction: reaction,
|
|
118
|
-
emojiProvider: _this.props.emojiProvider,
|
|
119
|
-
onClick: _this.props.onReactionClick,
|
|
120
|
-
onMouseEnter: _this.handleReactionMouseEnter,
|
|
121
|
-
flash: _this.props.flash[reaction.emojiId]
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
if (props.status !== ReactionStatus.ready) {
|
|
126
|
-
_this.renderTime = Date.now();
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
return _this;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
_createClass(ReactionsWithoutAnalytics, [{
|
|
133
|
-
key: "componentDidMount",
|
|
134
|
-
value: function componentDidMount() {
|
|
135
|
-
if (this.props.status === ReactionStatus.notLoaded) {
|
|
136
|
-
this.props.loadReaction();
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}, {
|
|
140
|
-
key: "renderPicker",
|
|
141
|
-
value: function renderPicker() {
|
|
142
|
-
var _this$props2 = this.props,
|
|
143
|
-
emojiProvider = _this$props2.emojiProvider,
|
|
144
|
-
boundariesElement = _this$props2.boundariesElement,
|
|
145
|
-
allowAllEmojis = _this$props2.allowAllEmojis;
|
|
146
|
-
return jsx(Tooltip, {
|
|
147
|
-
content: this.getTooltip()
|
|
148
|
-
}, jsx(ReactionPicker, {
|
|
149
|
-
css: reactionStyle,
|
|
150
|
-
emojiProvider: emojiProvider,
|
|
151
|
-
miniMode: true,
|
|
152
|
-
boundariesElement: boundariesElement,
|
|
153
|
-
allowAllEmojis: allowAllEmojis,
|
|
154
|
-
disabled: this.isDisabled(),
|
|
155
|
-
onSelection: this.handleOnSelection,
|
|
156
|
-
onOpen: this.handlePickerOpen,
|
|
157
|
-
onCancel: this.handleOnCancel,
|
|
158
|
-
onMore: this.handleOnMore
|
|
159
|
-
}));
|
|
160
|
-
}
|
|
161
|
-
}, {
|
|
162
|
-
key: "render",
|
|
163
|
-
value: function render() {
|
|
164
|
-
return jsx("div", {
|
|
165
|
-
css: wrapperStyle
|
|
166
|
-
}, this.props.reactions.map(this.renderReaction), this.renderPicker());
|
|
167
|
-
}
|
|
168
|
-
}]);
|
|
169
|
-
|
|
170
|
-
return ReactionsWithoutAnalytics;
|
|
171
|
-
}(React.PureComponent);
|
|
172
|
-
|
|
173
|
-
_defineProperty(ReactionsWithoutAnalytics, "defaultProps", {
|
|
174
|
-
flash: {},
|
|
175
|
-
reactions: []
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
_defineProperty(ReactionsWithoutAnalytics, "displayName", 'Reactions');
|
|
179
|
-
|
|
180
|
-
export var Reactions = withAnalyticsEvents()(ReactionsWithoutAnalytics);
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
4
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
|
|
9
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
10
|
-
|
|
11
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
12
|
-
|
|
13
|
-
/** @jsx jsx */
|
|
14
|
-
import { jsx, css, keyframes } from '@emotion/core';
|
|
15
|
-
import Tooltip from '@atlaskit/tooltip';
|
|
16
|
-
import React from 'react';
|
|
17
|
-
import { PureComponent } from 'react';
|
|
18
|
-
import { EmojiButton } from './EmojiButton';
|
|
19
|
-
import { ShowMore } from './ShowMore';
|
|
20
|
-
import { equalEmojiId } from './utils';
|
|
21
|
-
export var renderEmojiTestId = 'render-emoji';
|
|
22
|
-
var selectorStyle = css({
|
|
23
|
-
boxSizing: 'border-box',
|
|
24
|
-
display: 'flex',
|
|
25
|
-
padding: 0
|
|
26
|
-
});
|
|
27
|
-
var emojiStyle = css({
|
|
28
|
-
display: 'inline-block',
|
|
29
|
-
opacity: 0,
|
|
30
|
-
'&.selected': {
|
|
31
|
-
transition: 'transform 200ms ease-in-out ',
|
|
32
|
-
transform: 'translateY(-48px) scale(2.667)'
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
var revealAnimation = keyframes({
|
|
36
|
-
'0%': {
|
|
37
|
-
opacity: 1,
|
|
38
|
-
transform: 'scale(0.5)'
|
|
39
|
-
},
|
|
40
|
-
'75%': {
|
|
41
|
-
transform: 'scale(1.25)'
|
|
42
|
-
},
|
|
43
|
-
'100%': {
|
|
44
|
-
opacity: 1,
|
|
45
|
-
transform: 'scale(1)'
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
export var revealStyle = css({
|
|
49
|
-
animation: "".concat(revealAnimation, " 150ms ease-in-out forwards")
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
var revealDelay = function revealDelay(index) {
|
|
53
|
-
return {
|
|
54
|
-
animationDelay: "".concat(index * 50, "ms")
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export var defaultReactions = [{
|
|
59
|
-
id: '1f44d',
|
|
60
|
-
shortName: ':thumbsup:'
|
|
61
|
-
}, {
|
|
62
|
-
id: '1f44f',
|
|
63
|
-
shortName: ':clap:'
|
|
64
|
-
}, {
|
|
65
|
-
id: '1f525',
|
|
66
|
-
shortName: ':fire:'
|
|
67
|
-
}, {
|
|
68
|
-
id: '2764',
|
|
69
|
-
shortName: ':heart:'
|
|
70
|
-
}, {
|
|
71
|
-
id: '1f632',
|
|
72
|
-
shortName: ':astonished:'
|
|
73
|
-
}, {
|
|
74
|
-
id: '1f914',
|
|
75
|
-
shortName: ':thinking:'
|
|
76
|
-
}];
|
|
77
|
-
export var defaultReactionsByShortName = new Map(defaultReactions.map(function (reaction) {
|
|
78
|
-
return [reaction.shortName, reaction];
|
|
79
|
-
}));
|
|
80
|
-
export var isDefaultReaction = function isDefaultReaction(emojiId) {
|
|
81
|
-
return defaultReactions.filter(function (otherEmojiId) {
|
|
82
|
-
return equalEmojiId(otherEmojiId, emojiId);
|
|
83
|
-
}).length > 0;
|
|
84
|
-
};
|
|
85
|
-
export var Selector = /*#__PURE__*/function (_PureComponent) {
|
|
86
|
-
_inherits(Selector, _PureComponent);
|
|
87
|
-
|
|
88
|
-
var _super = _createSuper(Selector);
|
|
89
|
-
|
|
90
|
-
function Selector(props) {
|
|
91
|
-
var _this;
|
|
92
|
-
|
|
93
|
-
_classCallCheck(this, Selector);
|
|
94
|
-
|
|
95
|
-
_this = _super.call(this, props);
|
|
96
|
-
|
|
97
|
-
_defineProperty(_assertThisInitialized(_this), "onEmojiSelected", function (emojiId, emoji, event) {
|
|
98
|
-
_this.timeouts.push(window.setTimeout(function () {
|
|
99
|
-
return _this.props.onSelection(emojiId, emoji, event);
|
|
100
|
-
}, 250));
|
|
101
|
-
|
|
102
|
-
_this.setState({
|
|
103
|
-
selection: emojiId
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
_defineProperty(_assertThisInitialized(_this), "renderEmoji", function (emojiId, index) {
|
|
108
|
-
var emojiProvider = _this.props.emojiProvider;
|
|
109
|
-
var key = emojiId.id || emojiId.shortName;
|
|
110
|
-
var style = revealDelay(index);
|
|
111
|
-
return jsx("div", {
|
|
112
|
-
key: key,
|
|
113
|
-
className: emojiId === _this.state.selection ? 'selected' : '',
|
|
114
|
-
css: [emojiStyle, revealStyle],
|
|
115
|
-
style: style,
|
|
116
|
-
"data-testid": renderEmojiTestId
|
|
117
|
-
}, jsx(Tooltip, {
|
|
118
|
-
content: emojiId.shortName
|
|
119
|
-
}, jsx(EmojiButton, {
|
|
120
|
-
emojiId: emojiId,
|
|
121
|
-
emojiProvider: emojiProvider,
|
|
122
|
-
onClick: _this.onEmojiSelected
|
|
123
|
-
})));
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
_defineProperty(_assertThisInitialized(_this), "renderShowMore", function () {
|
|
127
|
-
return jsx(ShowMore, {
|
|
128
|
-
key: "more",
|
|
129
|
-
revealStyle: revealStyle,
|
|
130
|
-
style: {
|
|
131
|
-
button: revealDelay(defaultReactions.length)
|
|
132
|
-
},
|
|
133
|
-
onClick: _this.props.onMoreClick
|
|
134
|
-
});
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
_this.timeouts = [];
|
|
138
|
-
_this.state = {
|
|
139
|
-
selection: undefined
|
|
140
|
-
};
|
|
141
|
-
return _this;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
_createClass(Selector, [{
|
|
145
|
-
key: "componentWillUnmount",
|
|
146
|
-
value: function componentWillUnmount() {
|
|
147
|
-
this.timeouts.forEach(clearTimeout);
|
|
148
|
-
}
|
|
149
|
-
}, {
|
|
150
|
-
key: "render",
|
|
151
|
-
value: function render() {
|
|
152
|
-
var showMore = this.props.showMore;
|
|
153
|
-
return jsx("div", {
|
|
154
|
-
css: selectorStyle
|
|
155
|
-
}, defaultReactions.map(this.renderEmoji), showMore ? this.renderShowMore() : null);
|
|
156
|
-
}
|
|
157
|
-
}]);
|
|
158
|
-
|
|
159
|
-
return Selector;
|
|
160
|
-
}(PureComponent);
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
4
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
7
|
-
|
|
8
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
9
|
-
|
|
10
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
11
|
-
|
|
12
|
-
/** @jsx jsx */
|
|
13
|
-
import { jsx, css } from '@emotion/core';
|
|
14
|
-
import EditorMoreIcon from '@atlaskit/icon/glyph/editor/more';
|
|
15
|
-
import { borderRadius } from '@atlaskit/theme/constants';
|
|
16
|
-
import { N30A } from '@atlaskit/theme/colors';
|
|
17
|
-
import { token } from '@atlaskit/tokens';
|
|
18
|
-
import Tooltip from '@atlaskit/tooltip';
|
|
19
|
-
import React from 'react';
|
|
20
|
-
import { messages } from './i18n';
|
|
21
|
-
import { FormattedMessage } from 'react-intl-next';
|
|
22
|
-
import { revealStyle } from './Selector';
|
|
23
|
-
var moreEmojiContainerStyle = css({
|
|
24
|
-
display: 'flex'
|
|
25
|
-
});
|
|
26
|
-
var moreButtonStyle = css({
|
|
27
|
-
opacity: 0,
|
|
28
|
-
outline: 'none',
|
|
29
|
-
backgroundColor: 'transparent',
|
|
30
|
-
border: 0,
|
|
31
|
-
borderRadius: "".concat(borderRadius(), "px"),
|
|
32
|
-
cursor: 'pointer',
|
|
33
|
-
margin: '4px 4px 4px 0',
|
|
34
|
-
padding: '4px',
|
|
35
|
-
width: '38px',
|
|
36
|
-
verticalAlign: 'top',
|
|
37
|
-
'&:hover': {
|
|
38
|
-
backgroundColor: token('color.background.neutral.subtle.hovered', N30A)
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
var separatorStyle = css({
|
|
42
|
-
backgroundColor: token('color.border', N30A),
|
|
43
|
-
margin: '8px 8px 8px 4px',
|
|
44
|
-
width: '1px',
|
|
45
|
-
height: '60%',
|
|
46
|
-
display: 'inline-block'
|
|
47
|
-
});
|
|
48
|
-
export var showMoreTestId = 'show-more-button';
|
|
49
|
-
export var ShowMore = /*#__PURE__*/function (_React$PureComponent) {
|
|
50
|
-
_inherits(ShowMore, _React$PureComponent);
|
|
51
|
-
|
|
52
|
-
var _super = _createSuper(ShowMore);
|
|
53
|
-
|
|
54
|
-
function ShowMore() {
|
|
55
|
-
_classCallCheck(this, ShowMore);
|
|
56
|
-
|
|
57
|
-
return _super.apply(this, arguments);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
_createClass(ShowMore, [{
|
|
61
|
-
key: "render",
|
|
62
|
-
value: function render() {
|
|
63
|
-
var _this$props = this.props,
|
|
64
|
-
style = _this$props.style,
|
|
65
|
-
onClick = _this$props.onClick,
|
|
66
|
-
classNameProp = _this$props.className;
|
|
67
|
-
return jsx("div", {
|
|
68
|
-
className: classNameProp.container,
|
|
69
|
-
css: moreEmojiContainerStyle,
|
|
70
|
-
style: style.container
|
|
71
|
-
}, jsx("div", {
|
|
72
|
-
css: separatorStyle
|
|
73
|
-
}), jsx(FormattedMessage, messages.moreEmoji, function (text) {
|
|
74
|
-
return jsx(Tooltip, {
|
|
75
|
-
content: text
|
|
76
|
-
}, jsx("button", {
|
|
77
|
-
className: classNameProp.button,
|
|
78
|
-
css: [moreButtonStyle, revealStyle],
|
|
79
|
-
style: style.button,
|
|
80
|
-
onMouseDown: onClick,
|
|
81
|
-
"data-testid": showMoreTestId
|
|
82
|
-
}, jsx(EditorMoreIcon, {
|
|
83
|
-
label: "More"
|
|
84
|
-
})));
|
|
85
|
-
}));
|
|
86
|
-
}
|
|
87
|
-
}]);
|
|
88
|
-
|
|
89
|
-
return ShowMore;
|
|
90
|
-
}(React.PureComponent);
|
|
91
|
-
|
|
92
|
-
_defineProperty(ShowMore, "defaultProps", {
|
|
93
|
-
className: {},
|
|
94
|
-
style: {}
|
|
95
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export var akHeight = 24;
|
|
2
|
-
export var isLeftClick = function isLeftClick(event) {
|
|
3
|
-
return event.button === 0 && !event.altKey && !event.ctrlKey && !event.metaKey && !event.shiftKey;
|
|
4
|
-
};
|
|
5
|
-
export var equalEmojiId = function equalEmojiId(l, r) {
|
|
6
|
-
if (isEmojiId(l) && isEmojiId(r)) {
|
|
7
|
-
return l === r || l && r && l.id === r.id && l.shortName === r.shortName;
|
|
8
|
-
} else {
|
|
9
|
-
return l === r;
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
var isEmojiId = function isEmojiId(emojiId) {
|
|
14
|
-
return emojiId.id !== undefined;
|
|
15
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { ReactionPicker, UfoErrorBoundary } from '../components';
|
|
4
|
-
import { ReactionConsumer } from '../store/ReactionConsumer';
|
|
5
|
-
import { UFO } from '../analytics';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* UFO Instance for picker
|
|
9
|
-
*/
|
|
10
|
-
export var ConnectedReactionPicker = function ConnectedReactionPicker(props) {
|
|
11
|
-
var renderChild = function renderChild(innerProps) {
|
|
12
|
-
return /*#__PURE__*/React.createElement(ReactionPicker, _extends({}, props, innerProps));
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
var actionsMapper = function actionsMapper(actions) {
|
|
16
|
-
return {
|
|
17
|
-
onSelection: function onSelection(emojiId) {
|
|
18
|
-
actions.addReaction(props.containerAri, props.ari, emojiId);
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
return /*#__PURE__*/React.createElement(UfoErrorBoundary, {
|
|
24
|
-
experiences: [UFO.PickerRender]
|
|
25
|
-
}, /*#__PURE__*/React.createElement(ReactionConsumer, {
|
|
26
|
-
store: props.store,
|
|
27
|
-
actionsMapper: actionsMapper
|
|
28
|
-
}, renderChild));
|
|
29
|
-
};
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React, { useEffect, useRef } from 'react';
|
|
3
|
-
import { FabricElementsAnalyticsContext } from '@atlaskit/analytics-namespaced-context';
|
|
4
|
-
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
5
|
-
import { Reactions, UfoErrorBoundary } from '../components';
|
|
6
|
-
import { ReactionConsumer } from '../store/ReactionConsumer';
|
|
7
|
-
import { ReactionStatus } from '../types/ReactionStatus';
|
|
8
|
-
import { ufoExperiences } from '../store/ReactionsStore';
|
|
9
|
-
|
|
10
|
-
var ReactionsView = function ReactionsView(props) {
|
|
11
|
-
// // compose a UFO experience object
|
|
12
|
-
var experienceInstance = useRef();
|
|
13
|
-
var ari = props.ari,
|
|
14
|
-
createAnalyticsEvent = props.createAnalyticsEvent,
|
|
15
|
-
store = props.store,
|
|
16
|
-
containerAri = props.containerAri;
|
|
17
|
-
useEffect(function () {
|
|
18
|
-
experienceInstance.current = ufoExperiences.render(ari);
|
|
19
|
-
}, [ari]);
|
|
20
|
-
useEffect(function () {
|
|
21
|
-
Promise.resolve(store).then(function (_store) {
|
|
22
|
-
if (_store.setCreateAnalyticsEvent && createAnalyticsEvent) {
|
|
23
|
-
_store.setCreateAnalyticsEvent(createAnalyticsEvent);
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}, [createAnalyticsEvent, store]); // abort when component gets unmounted
|
|
27
|
-
|
|
28
|
-
useEffect(function () {
|
|
29
|
-
return function cleanup() {
|
|
30
|
-
var _experienceInstance$c;
|
|
31
|
-
|
|
32
|
-
(_experienceInstance$c = experienceInstance.current) === null || _experienceInstance$c === void 0 ? void 0 : _experienceInstance$c.abort({
|
|
33
|
-
metadata: {
|
|
34
|
-
source: 'Connected-Reactions-View',
|
|
35
|
-
data: {
|
|
36
|
-
ari: ari,
|
|
37
|
-
containerAri: containerAri
|
|
38
|
-
},
|
|
39
|
-
reason: 'unmount'
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
}, [experienceInstance, containerAri, ari]);
|
|
44
|
-
|
|
45
|
-
var renderChildren = function renderChildren(innerProps) {
|
|
46
|
-
return /*#__PURE__*/React.createElement(FabricElementsAnalyticsContext, {
|
|
47
|
-
data: {
|
|
48
|
-
containerAri: containerAri,
|
|
49
|
-
ari: ari
|
|
50
|
-
}
|
|
51
|
-
}, /*#__PURE__*/React.createElement(Reactions, _extends({
|
|
52
|
-
key: "".concat(props.containerAri, "|").concat(props.ari)
|
|
53
|
-
}, props, innerProps)));
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
var stateMapper = function stateMapper(state) {
|
|
57
|
-
var containerAri = props.containerAri,
|
|
58
|
-
ari = props.ari;
|
|
59
|
-
var reactionsState = state && state.reactions["".concat(containerAri, "|").concat(ari)];
|
|
60
|
-
|
|
61
|
-
if (!state || !reactionsState) {
|
|
62
|
-
return {
|
|
63
|
-
status: ReactionStatus.notLoaded,
|
|
64
|
-
reactions: []
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
switch (reactionsState.status) {
|
|
69
|
-
case ReactionStatus.ready:
|
|
70
|
-
return {
|
|
71
|
-
reactions: reactionsState.reactions,
|
|
72
|
-
status: reactionsState.status,
|
|
73
|
-
flash: state.flash["".concat(containerAri, "|").concat(ari)]
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
case ReactionStatus.error:
|
|
77
|
-
return {
|
|
78
|
-
status: ReactionStatus.error,
|
|
79
|
-
reactions: []
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
default:
|
|
83
|
-
return {
|
|
84
|
-
status: ReactionStatus.loading,
|
|
85
|
-
reactions: []
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
var actionsMapper = function actionsMapper(actions) {
|
|
91
|
-
return {
|
|
92
|
-
loadReaction: function loadReaction() {
|
|
93
|
-
actions.getReactions(props.containerAri, props.ari);
|
|
94
|
-
},
|
|
95
|
-
onReactionClick: function onReactionClick(emojiId) {
|
|
96
|
-
actions.toggleReaction(props.containerAri, props.ari, emojiId);
|
|
97
|
-
},
|
|
98
|
-
onReactionHover: function onReactionHover(emojiId) {
|
|
99
|
-
actions.getDetailedReaction(props.containerAri, props.ari, emojiId);
|
|
100
|
-
},
|
|
101
|
-
onSelection: function onSelection(emojiId) {
|
|
102
|
-
actions.addReaction(props.containerAri, props.ari, emojiId);
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
return /*#__PURE__*/React.createElement(UfoErrorBoundary, {
|
|
108
|
-
experiences: experienceInstance.current ? [experienceInstance.current] : []
|
|
109
|
-
}, /*#__PURE__*/React.createElement(ReactionConsumer, {
|
|
110
|
-
store: props.store,
|
|
111
|
-
actionsMapper: actionsMapper,
|
|
112
|
-
stateMapper: stateMapper
|
|
113
|
-
}, renderChildren));
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
export var ConnectedReactionsView = withAnalyticsEvents()(ReactionsView);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export var ReactionStatus;
|
|
2
|
-
|
|
3
|
-
(function (ReactionStatus) {
|
|
4
|
-
ReactionStatus["ready"] = "READY";
|
|
5
|
-
ReactionStatus["loading"] = "LOADING";
|
|
6
|
-
ReactionStatus["error"] = "ERROR";
|
|
7
|
-
ReactionStatus["notLoaded"] = "NOT_LOADED";
|
|
8
|
-
})(ReactionStatus || (ReactionStatus = {}));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Reactions } from '../types/Reactions';
|
|
2
|
-
import { ReactionSummary } from '../types/ReactionSummary';
|
|
3
|
-
import { ReactionClient } from './ReactionClient';
|
|
4
|
-
export declare const containerAri: string;
|
|
5
|
-
export declare const ari: string;
|
|
6
|
-
export declare const reaction: (shortName: string, count: number, reacted: boolean) => {
|
|
7
|
-
ari: string;
|
|
8
|
-
containerAri: string;
|
|
9
|
-
emojiId: string;
|
|
10
|
-
count: number;
|
|
11
|
-
reacted: boolean;
|
|
12
|
-
};
|
|
13
|
-
export declare const user: (id: string, displayName: string) => {
|
|
14
|
-
id: string;
|
|
15
|
-
displayName: string;
|
|
16
|
-
};
|
|
17
|
-
export declare class MockReactionsClient implements ReactionClient {
|
|
18
|
-
private delay;
|
|
19
|
-
mockData: {
|
|
20
|
-
[key: string]: ReactionSummary[];
|
|
21
|
-
};
|
|
22
|
-
constructor(delay?: number);
|
|
23
|
-
private delayPromise;
|
|
24
|
-
getReactions(containerAri: string, aris: string[]): Promise<Reactions>;
|
|
25
|
-
getDetailedReaction(containerAri: string, ari: string, emojiId: string): Promise<ReactionSummary>;
|
|
26
|
-
addReaction(containerAri: string, ari: string, emojiId: string): Promise<ReactionSummary[]>;
|
|
27
|
-
deleteReaction(containerAri: string, ari: string, emojiId: string): Promise<ReactionSummary[]>;
|
|
28
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Reactions } from '../types/Reactions';
|
|
2
|
-
import { ReactionSummary } from '../types/ReactionSummary';
|
|
3
|
-
export declare type ReactionRequest<T> = (containerAri: string, ari: string, emojiId: string, metadata?: {
|
|
4
|
-
[k: string]: any;
|
|
5
|
-
}) => Promise<T>;
|
|
6
|
-
export interface ReactionClient {
|
|
7
|
-
/**
|
|
8
|
-
* Fetch list of reactions for a given ARI.
|
|
9
|
-
* @param containerAri F
|
|
10
|
-
* @param aris
|
|
11
|
-
*/
|
|
12
|
-
getReactions(containerAri: string, aris: string[]): Promise<Reactions>;
|
|
13
|
-
/**
|
|
14
|
-
* Fetch details for a given reaction.
|
|
15
|
-
*/
|
|
16
|
-
getDetailedReaction: ReactionRequest<ReactionSummary>;
|
|
17
|
-
/**
|
|
18
|
-
* Fetch request when adding a reaction to a container.
|
|
19
|
-
*/
|
|
20
|
-
addReaction: ReactionRequest<ReactionSummary[]>;
|
|
21
|
-
/**
|
|
22
|
-
* Fetch request when removing a reaction from a container.
|
|
23
|
-
*/
|
|
24
|
-
deleteReaction: ReactionRequest<ReactionSummary[]>;
|
|
25
|
-
}
|