@atlaskit/reactions 21.5.1 → 21.6.1
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 +17 -0
- package/MockReactionsClient/package.json +14 -0
- package/dist/cjs/{client/MockReactionsClient.js → MockReactionsClient.js} +4 -6
- 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/client/index.js +1 -33
- 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 +39 -8
- package/dist/cjs/{components → shared}/i18n.js +1 -1
- package/dist/cjs/shared/index.js +11 -3
- package/dist/cjs/shared/utils.js +54 -0
- package/dist/cjs/store/{ReactionsStore.js → MemoryReactionsStore.js} +37 -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/{client/MockReactionsClient.js → MockReactionsClient.js} +4 -5
- 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/client/index.js +1 -2
- 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 -4
- package/dist/es2019/{components → shared}/i18n.js +1 -1
- package/dist/es2019/shared/index.js +6 -2
- package/dist/es2019/shared/utils.js +35 -0
- package/dist/es2019/store/{ReactionsStore.js → MemoryReactionsStore.js} +36 -17
- 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/{client/MockReactionsClient.js → MockReactionsClient.js} +4 -5
- 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/client/index.js +1 -2
- 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 -4
- package/dist/esm/{components → shared}/i18n.js +1 -1
- package/dist/esm/shared/index.js +6 -2
- package/dist/esm/shared/utils.js +41 -0
- package/dist/esm/store/{ReactionsStore.js → MemoryReactionsStore.js} +36 -20
- 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 -2
- 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 -3
- package/dist/types/shared/i18n.d.ts +22 -0
- package/dist/types/shared/index.d.ts +3 -1
- package/dist/types/shared/utils.d.ts +11 -0
- package/dist/types/store/MemoryReactionsStore.d.ts +94 -0
- 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 +3 -0
- 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 +4 -6
- package/dist/types/types/reaction.d.ts +82 -0
- package/dist/types/types/store.d.ts +63 -0
- package/dist/{types/client → types-ts4.0}/MockReactionsClient.d.ts +4 -5
- package/dist/types-ts4.0/analytics/analytics.d.ts +96 -0
- package/dist/types-ts4.0/analytics/constants.d.ts +1 -0
- package/dist/types-ts4.0/analytics/index.d.ts +2 -0
- package/dist/types-ts4.0/analytics/ufo.d.ts +40 -0
- package/dist/types-ts4.0/client/ReactionServiceClient.d.ts +35 -0
- package/dist/types-ts4.0/client/index.d.ts +1 -0
- package/dist/{types/components → types-ts4.0/components/Counter}/Counter.d.ts +15 -7
- package/dist/types-ts4.0/components/Counter/index.d.ts +3 -0
- package/dist/types-ts4.0/components/Counter/styles.d.ts +3 -0
- package/dist/types-ts4.0/components/EmojiButton/EmojiButton.d.ts +22 -0
- package/dist/types-ts4.0/components/EmojiButton/index.d.ts +2 -0
- package/dist/types-ts4.0/components/EmojiButton/styles.d.ts +1 -0
- package/dist/types-ts4.0/components/FlashAnimation/FlashAnimation.d.ts +20 -0
- package/dist/types-ts4.0/components/FlashAnimation/index.d.ts +2 -0
- package/dist/types-ts4.0/components/FlashAnimation/styles.d.ts +3 -0
- package/dist/types-ts4.0/components/Reaction/Reaction.d.ts +38 -0
- package/dist/types-ts4.0/components/Reaction/index.d.ts +2 -0
- package/dist/types-ts4.0/components/Reaction/styles.d.ts +10 -0
- package/dist/{types/components → types-ts4.0/components/ReactionPicker}/ReactionPicker.d.ts +12 -33
- package/dist/types-ts4.0/components/ReactionPicker/index.d.ts +2 -0
- package/dist/types-ts4.0/components/ReactionPicker/styles.d.ts +3 -0
- package/dist/types-ts4.0/components/ReactionTooltip/ReactionTooltip.d.ts +22 -0
- package/dist/types-ts4.0/components/ReactionTooltip/index.d.ts +2 -0
- package/dist/types-ts4.0/components/ReactionTooltip/styles.d.ts +4 -0
- package/dist/types-ts4.0/components/Reactions/Reactions.d.ts +64 -0
- package/dist/types-ts4.0/components/Reactions/index.d.ts +2 -0
- package/dist/types-ts4.0/components/Reactions/styles.d.ts +2 -0
- package/dist/types-ts4.0/components/Selector/Selector.d.ts +34 -0
- package/dist/types-ts4.0/components/Selector/index.d.ts +3 -0
- package/dist/types-ts4.0/components/Selector/styles.d.ts +10 -0
- package/dist/{types/components → types-ts4.0/components/ShowMore}/ShowMore.d.ts +14 -13
- package/dist/types-ts4.0/components/ShowMore/index.d.ts +2 -0
- package/dist/types-ts4.0/components/ShowMore/styles.d.ts +3 -0
- package/dist/types-ts4.0/components/Trigger/Trigger.d.ts +23 -0
- package/dist/types-ts4.0/components/Trigger/index.d.ts +2 -0
- package/dist/types-ts4.0/components/Trigger/styles.d.ts +5 -0
- package/dist/types-ts4.0/components/UfoErrorBoundary/UfoErrorBoundary.d.ts +16 -0
- package/dist/types-ts4.0/components/UfoErrorBoundary/index.d.ts +2 -0
- package/dist/types-ts4.0/components/index.d.ts +8 -0
- package/dist/types-ts4.0/containers/ConnectedReactionPicker/ConnectedReactionPicker.d.ts +27 -0
- package/dist/types-ts4.0/containers/ConnectedReactionPicker/index.d.ts +2 -0
- package/dist/types-ts4.0/containers/ConnectedReactionsView/ConnectedReactionsView.d.ts +52 -0
- package/dist/types-ts4.0/containers/ConnectedReactionsView/index.d.ts +2 -0
- package/dist/types-ts4.0/containers/index.d.ts +2 -0
- package/dist/types-ts4.0/hooks/index.d.ts +1 -0
- package/dist/types-ts4.0/hooks/useClickAway.d.ts +8 -0
- package/dist/types-ts4.0/i18n/cs.d.ts +13 -0
- package/dist/types-ts4.0/i18n/da.d.ts +13 -0
- package/dist/types-ts4.0/i18n/de.d.ts +13 -0
- package/dist/types-ts4.0/i18n/en.d.ts +7 -0
- package/dist/types-ts4.0/i18n/en_GB.d.ts +7 -0
- package/dist/types-ts4.0/i18n/en_ZZ.d.ts +13 -0
- package/dist/types-ts4.0/i18n/es.d.ts +13 -0
- package/dist/types-ts4.0/i18n/et.d.ts +12 -0
- package/dist/types-ts4.0/i18n/fi.d.ts +13 -0
- package/dist/types-ts4.0/i18n/fr.d.ts +13 -0
- package/dist/types-ts4.0/i18n/hu.d.ts +13 -0
- package/dist/types-ts4.0/i18n/index.d.ts +35 -0
- package/dist/types-ts4.0/i18n/is.d.ts +6 -0
- package/dist/types-ts4.0/i18n/it.d.ts +13 -0
- package/dist/types-ts4.0/i18n/ja.d.ts +13 -0
- package/dist/types-ts4.0/i18n/ko.d.ts +13 -0
- package/dist/types-ts4.0/i18n/languages.d.ts +27 -0
- package/dist/types-ts4.0/i18n/nb.d.ts +13 -0
- package/dist/types-ts4.0/i18n/nl.d.ts +13 -0
- package/dist/types-ts4.0/i18n/pl.d.ts +13 -0
- package/dist/types-ts4.0/i18n/pt_BR.d.ts +13 -0
- package/dist/types-ts4.0/i18n/pt_PT.d.ts +12 -0
- package/dist/types-ts4.0/i18n/ro.d.ts +6 -0
- package/dist/types-ts4.0/i18n/ru.d.ts +13 -0
- package/dist/types-ts4.0/i18n/sk.d.ts +12 -0
- package/dist/types-ts4.0/i18n/sv.d.ts +13 -0
- package/dist/types-ts4.0/i18n/th.d.ts +13 -0
- package/dist/types-ts4.0/i18n/tr.d.ts +13 -0
- package/dist/types-ts4.0/i18n/uk.d.ts +13 -0
- package/dist/types-ts4.0/i18n/vi.d.ts +13 -0
- package/dist/types-ts4.0/i18n/zh.d.ts +13 -0
- package/dist/types-ts4.0/i18n/zh_TW.d.ts +13 -0
- package/dist/types-ts4.0/index.d.ts +7 -0
- package/dist/types-ts4.0/shared/constants.d.ts +13 -0
- package/dist/{types/components → types-ts4.0/shared}/i18n.d.ts +0 -0
- package/dist/types-ts4.0/shared/index.d.ts +3 -0
- package/dist/types-ts4.0/shared/utils.d.ts +11 -0
- package/dist/{types/store/ReactionsStore.d.ts → types-ts4.0/store/MemoryReactionsStore.d.ts} +21 -61
- package/dist/types-ts4.0/store/ReactionConsumer.d.ts +57 -0
- package/dist/types-ts4.0/store/batched.d.ts +2 -0
- package/dist/types-ts4.0/store/index.d.ts +3 -0
- package/dist/types-ts4.0/store/utils.d.ts +11 -0
- package/dist/types-ts4.0/types/Actions.d.ts +27 -0
- package/dist/types-ts4.0/types/Updater.d.ts +1 -0
- package/dist/types-ts4.0/types/User.d.ts +10 -0
- package/dist/types-ts4.0/types/client.d.ts +38 -0
- package/dist/types-ts4.0/types/index.d.ts +7 -0
- package/dist/types-ts4.0/types/reaction.d.ts +82 -0
- package/dist/types-ts4.0/types/store.d.ts +63 -0
- package/extract-react-type/ConnectedReactionPicker.ts +2 -4
- package/extract-react-type/ConnectedReactionsView.ts +3 -5
- package/extract-react-type/Reaction.ts +2 -4
- package/extract-react-type/Reactions.ts +2 -4
- package/extract-react-type/actions.ts +1 -3
- package/extract-react-type/reactionClient.ts +3 -5
- package/extract-react-type/reactionsStore.ts +3 -5
- package/package.json +30 -7
- package/dist/cjs/components/EmojiButton.js +0 -100
- package/dist/cjs/components/Reaction.js +0 -229
- package/dist/cjs/components/ReactionPicker.js +0 -297
- 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 -53
- package/dist/cjs/containers/ConnectedReactionsView.js +0 -139
- package/dist/cjs/types/ReactionSource.js +0 -5
- package/dist/cjs/types/ReactionStatus.js +0 -19
- 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/components/EmojiButton.js +0 -50
- package/dist/es2019/components/Reaction.js +0 -183
- package/dist/es2019/components/ReactionPicker.js +0 -247
- 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 -36
- package/dist/es2019/containers/ConnectedReactionsView.js +0 -118
- package/dist/es2019/types/ReactionStatus.js +0 -11
- package/dist/es2019/types/Reactions.js +0 -1
- package/dist/es2019/types/ReactionsState.js +0 -1
- package/dist/esm/client/ReactionClient.js +0 -1
- package/dist/esm/components/EmojiButton.js +0 -77
- package/dist/esm/components/Reaction.js +0 -207
- package/dist/esm/components/ReactionPicker.js +0 -274
- 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 -38
- 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 -11
- 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/ReactionClient.d.ts +0 -28
- package/dist/types/components/EmojiButton.d.ts +0 -21
- package/dist/types/components/FlashAnimation.d.ts +0 -18
- package/dist/types/components/Reaction.d.ts +0 -44
- package/dist/types/components/ReactionTooltip.d.ts +0 -14
- package/dist/types/components/Reactions.d.ts +0 -83
- package/dist/types/components/Selector.d.ts +0 -39
- package/dist/types/components/Trigger.d.ts +0 -16
- 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 -16
- package/dist/types/containers/ConnectedReactionsView.d.ts +0 -31
- package/dist/types/types/DetailedReaction.d.ts +0 -7
- package/dist/types/types/ReactionSource.d.ts +0 -4
- package/dist/types/types/ReactionStatus.d.ts +0 -9
- 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 -20
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { jsx } from '@emotion/core';
|
|
4
|
+
import Tooltip from '@atlaskit/tooltip';
|
|
5
|
+
import { constants } from '../../shared';
|
|
6
|
+
import { EmojiButton } from '../EmojiButton';
|
|
7
|
+
import { ShowMore } from '../ShowMore';
|
|
8
|
+
import * as styles from './styles';
|
|
9
|
+
/**
|
|
10
|
+
* Test id for wrapper Selector div
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export const RENDER_SELECTOR_TESTID = 'render-selector';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Reactions picker panel part of the <ReactionPicker /> component
|
|
17
|
+
*/
|
|
18
|
+
export const Selector = ({
|
|
19
|
+
emojiProvider,
|
|
20
|
+
onMoreClick,
|
|
21
|
+
onSelection,
|
|
22
|
+
showMore,
|
|
23
|
+
pickerQuickReactionEmojiIds = constants.DefaultReactions
|
|
24
|
+
}) => {
|
|
25
|
+
const [selection, setSelection] = useState();
|
|
26
|
+
/**
|
|
27
|
+
* Collection of global DOM timeout ids when user selects emojis for animation display
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
const timeoutIds = useRef([]);
|
|
31
|
+
/**
|
|
32
|
+
* Clear the timeouts for the selected emojis when the component unmounts
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
const timeoutValues = timeoutIds.current;
|
|
37
|
+
return function cleanup() {
|
|
38
|
+
timeoutValues.forEach(clearTimeout);
|
|
39
|
+
};
|
|
40
|
+
}, []);
|
|
41
|
+
/**
|
|
42
|
+
* event handler when an emoji gets selected
|
|
43
|
+
* @param item selected emoji
|
|
44
|
+
* @param description depth detail of the selected emoji
|
|
45
|
+
* @param event Dom event data
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
const onSelected = (item, description, event) => {
|
|
49
|
+
timeoutIds.current.push(window.setTimeout(() => {
|
|
50
|
+
onSelection(item, description, event);
|
|
51
|
+
}, 250));
|
|
52
|
+
setSelection(item);
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* custom css styling for the emoji icon
|
|
56
|
+
* @param index location of the emoji in the rendered list of items
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
const emojiStyleAnimation = index => ({
|
|
61
|
+
animationDelay: `${index * 50}ms`
|
|
62
|
+
});
|
|
63
|
+
/**
|
|
64
|
+
* Render the default emoji icon
|
|
65
|
+
* @param emoji emoji item
|
|
66
|
+
* @param index location of the emoji in the array
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
const renderEmoji = (emoji, index) => {
|
|
71
|
+
var _emoji$id;
|
|
72
|
+
|
|
73
|
+
return jsx("div", {
|
|
74
|
+
key: (_emoji$id = emoji.id) !== null && _emoji$id !== void 0 ? _emoji$id : emoji.shortName,
|
|
75
|
+
className: emoji === selection ? 'selected' : undefined,
|
|
76
|
+
css: [styles.emojiStyle, styles.revealStyle],
|
|
77
|
+
style: emojiStyleAnimation(index),
|
|
78
|
+
"data-testid": RENDER_SELECTOR_TESTID
|
|
79
|
+
}, jsx(Tooltip, {
|
|
80
|
+
content: emoji.shortName
|
|
81
|
+
}, jsx(EmojiButton, {
|
|
82
|
+
emojiId: emoji,
|
|
83
|
+
emojiProvider: emojiProvider,
|
|
84
|
+
onClick: onSelected
|
|
85
|
+
})));
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
return jsx("div", {
|
|
89
|
+
css: styles.selectorStyle
|
|
90
|
+
}, pickerQuickReactionEmojiIds ? pickerQuickReactionEmojiIds.map(renderEmoji) : null, showMore ? jsx(ShowMore, {
|
|
91
|
+
key: "more",
|
|
92
|
+
buttonStyle: styles.revealStyle,
|
|
93
|
+
style: {
|
|
94
|
+
button: emojiStyleAnimation(constants.DefaultReactions.length)
|
|
95
|
+
},
|
|
96
|
+
onClick: onMoreClick
|
|
97
|
+
}) : null);
|
|
98
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { css, keyframes } from '@emotion/core';
|
|
3
|
+
export const selectorStyle = css({
|
|
4
|
+
boxSizing: 'border-box',
|
|
5
|
+
display: 'flex',
|
|
6
|
+
padding: 0
|
|
7
|
+
});
|
|
8
|
+
export const emojiStyle = css({
|
|
9
|
+
display: 'inline-block',
|
|
10
|
+
opacity: 0,
|
|
11
|
+
'&.selected': {
|
|
12
|
+
transition: 'transform 200ms ease-in-out ',
|
|
13
|
+
transform: 'translateY(-48px) scale(2.667)'
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
export const revealAnimation = keyframes({
|
|
17
|
+
'0%': {
|
|
18
|
+
opacity: 1,
|
|
19
|
+
transform: 'scale(0.5)'
|
|
20
|
+
},
|
|
21
|
+
'75%': {
|
|
22
|
+
transform: 'scale(1.25)'
|
|
23
|
+
},
|
|
24
|
+
'100%': {
|
|
25
|
+
opacity: 1,
|
|
26
|
+
transform: 'scale(1)'
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
export const revealStyle = css({
|
|
30
|
+
animation: `${revealAnimation} 150ms ease-in-out forwards`
|
|
31
|
+
});
|
|
32
|
+
/**
|
|
33
|
+
* custom css styling for the emoji icon
|
|
34
|
+
* @param index location of the emoji in the rendered list of items
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
export const emojiStyleAnimation = index => ({
|
|
38
|
+
animationDelay: `${index * 50}ms`
|
|
39
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { jsx } from '@emotion/core';
|
|
4
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
5
|
+
import EditorMoreIcon from '@atlaskit/icon/glyph/editor/more';
|
|
6
|
+
import Tooltip from '@atlaskit/tooltip';
|
|
7
|
+
import { i18n } from '../../shared';
|
|
8
|
+
import * as styles from './styles';
|
|
9
|
+
/**
|
|
10
|
+
* Test id for wrapper button
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export const RENDER_SHOWMORE_TESTID = 'show-more-button';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Show more custom emojis button
|
|
17
|
+
*/
|
|
18
|
+
export const ShowMore = ({
|
|
19
|
+
onClick,
|
|
20
|
+
style = {},
|
|
21
|
+
className = {},
|
|
22
|
+
buttonStyle
|
|
23
|
+
}) => {
|
|
24
|
+
return jsx("div", {
|
|
25
|
+
className: className.container,
|
|
26
|
+
css: styles.moreEmojiContainerStyle,
|
|
27
|
+
style: style.container
|
|
28
|
+
}, jsx("div", {
|
|
29
|
+
css: styles.separatorStyle
|
|
30
|
+
}), jsx(FormattedMessage, i18n.messages.moreEmoji, message => jsx(Tooltip, {
|
|
31
|
+
content: message
|
|
32
|
+
}, jsx("button", {
|
|
33
|
+
className: className.button,
|
|
34
|
+
css: [styles.moreButtonStyle, buttonStyle],
|
|
35
|
+
title: i18n.messages.moreEmoji.defaultMessage,
|
|
36
|
+
type: "button",
|
|
37
|
+
style: style.button,
|
|
38
|
+
onMouseDown: onClick,
|
|
39
|
+
"data-testid": RENDER_SHOWMORE_TESTID
|
|
40
|
+
}, jsx(EditorMoreIcon, {
|
|
41
|
+
label: "More"
|
|
42
|
+
})))));
|
|
43
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ShowMore, RENDER_SHOWMORE_TESTID } from './ShowMore';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { css } from '@emotion/core';
|
|
3
|
+
import { borderRadius } from '@atlaskit/theme/constants';
|
|
4
|
+
import { N30A } from '@atlaskit/theme/colors';
|
|
5
|
+
import { token } from '@atlaskit/tokens';
|
|
6
|
+
export const moreEmojiContainerStyle = css({
|
|
7
|
+
display: 'flex'
|
|
8
|
+
});
|
|
9
|
+
export const moreButtonStyle = css({
|
|
10
|
+
opacity: 0,
|
|
11
|
+
outline: 'none',
|
|
12
|
+
backgroundColor: 'transparent',
|
|
13
|
+
border: 0,
|
|
14
|
+
borderRadius: `${borderRadius()}px`,
|
|
15
|
+
cursor: 'pointer',
|
|
16
|
+
margin: '4px 4px 4px 0',
|
|
17
|
+
padding: '4px',
|
|
18
|
+
width: '38px',
|
|
19
|
+
verticalAlign: 'top',
|
|
20
|
+
'&:hover': {
|
|
21
|
+
backgroundColor: token('color.background.neutral.subtle.hovered', N30A)
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
export const separatorStyle = css({
|
|
25
|
+
backgroundColor: token('color.border', N30A),
|
|
26
|
+
margin: '8px 8px 8px 4px',
|
|
27
|
+
width: '1px',
|
|
28
|
+
height: '60%',
|
|
29
|
+
display: 'inline-block'
|
|
30
|
+
});
|
|
@@ -1,38 +1,33 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { jsx } from '@emotion/core';
|
|
3
4
|
import Button from '@atlaskit/button/standard-button';
|
|
4
5
|
import EmojiAddIcon from '@atlaskit/icon/glyph/emoji-add';
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
justifyContent: 'center',
|
|
11
|
-
alignItems: 'center',
|
|
12
|
-
lineHeight: '16px',
|
|
13
|
-
'&.miniMode': {
|
|
14
|
-
width: '24px',
|
|
15
|
-
height: '24px'
|
|
16
|
-
}
|
|
17
|
-
});
|
|
6
|
+
import * as styles from './styles';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Render a button to open the reactions picker
|
|
10
|
+
*/
|
|
18
11
|
export const Trigger = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
19
12
|
const {
|
|
20
13
|
miniMode,
|
|
21
14
|
disabled = false
|
|
22
15
|
} = props;
|
|
23
16
|
|
|
24
|
-
const handleMouseDown = () => {
|
|
25
|
-
if (props.onClick) {
|
|
26
|
-
props.onClick();
|
|
17
|
+
const handleMouseDown = (e, analyticsEvent) => {
|
|
18
|
+
if (props.onClick && !props.disabled) {
|
|
19
|
+
props.onClick(e, analyticsEvent);
|
|
27
20
|
}
|
|
28
21
|
};
|
|
29
22
|
|
|
30
23
|
return jsx(Button, {
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
css: styles.triggerStyle({
|
|
25
|
+
miniMode,
|
|
26
|
+
disabled
|
|
27
|
+
}),
|
|
33
28
|
appearance: "subtle",
|
|
34
29
|
onClick: handleMouseDown,
|
|
35
|
-
|
|
30
|
+
"aria-disabled": disabled,
|
|
36
31
|
iconBefore: jsx(EmojiAddIcon, {
|
|
37
32
|
size: "small",
|
|
38
33
|
label: "Add reaction"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Trigger } from './Trigger';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { css } from '@emotion/core';
|
|
3
|
+
import { token } from '@atlaskit/tokens';
|
|
4
|
+
import { N70 } from '@atlaskit/theme/colors';
|
|
5
|
+
export const DISABLED_BUTTON_COLOR = `${token('color.text.disabled', N70)} !important`;
|
|
6
|
+
export const triggerStyle = ({
|
|
7
|
+
miniMode = false,
|
|
8
|
+
disabled = false
|
|
9
|
+
}) => css({
|
|
10
|
+
width: '32px',
|
|
11
|
+
height: '32px',
|
|
12
|
+
display: 'flex',
|
|
13
|
+
justifyContent: 'center',
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
lineHeight: '16px',
|
|
16
|
+
...(miniMode && {
|
|
17
|
+
width: '24px',
|
|
18
|
+
height: '24px'
|
|
19
|
+
}),
|
|
20
|
+
...(disabled && {
|
|
21
|
+
color: DISABLED_BUTTON_COLOR,
|
|
22
|
+
cursor: 'not-allowed'
|
|
23
|
+
})
|
|
24
|
+
});
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Error boundary wrapper to notify "failure" for UFO events of components when there was a re-rendering exception caught inside the `componentDidCatch` event handler
|
|
5
|
+
*/
|
|
2
6
|
export class UfoErrorBoundary extends React.Component {
|
|
3
7
|
componentDidCatch(error, errorInfo) {
|
|
4
8
|
for (const exp of this.props.experiences) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { UfoErrorBoundary } from './UfoErrorBoundary';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { ReactionPicker, UfoErrorBoundary } from '../../components';
|
|
4
|
+
import { UFO } from '../../analytics';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Reaction Picker component
|
|
8
|
+
*/
|
|
9
|
+
export const ConnectedReactionPicker = props => {
|
|
10
|
+
/**
|
|
11
|
+
* callback event when an emoji item is selected
|
|
12
|
+
* @param emojiId unique id for the reaction emoji
|
|
13
|
+
*/
|
|
14
|
+
const onSelection = emojiId => {
|
|
15
|
+
(async () => {
|
|
16
|
+
const _store = await Promise.resolve(props.store);
|
|
17
|
+
|
|
18
|
+
_store.addReaction(props.containerAri, props.ari, emojiId);
|
|
19
|
+
})();
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
return /*#__PURE__*/React.createElement(UfoErrorBoundary, {
|
|
23
|
+
experiences: [UFO.PickerRender]
|
|
24
|
+
}, /*#__PURE__*/React.createElement(ReactionPicker, _extends({}, props, {
|
|
25
|
+
onSelection: onSelection
|
|
26
|
+
})));
|
|
27
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ConnectedReactionPicker } from './ConnectedReactionPicker';
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { FabricElementsAnalyticsContext } from '@atlaskit/analytics-namespaced-context';
|
|
4
|
+
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
5
|
+
import { Reactions, UfoErrorBoundary } from '../../components';
|
|
6
|
+
import { ufoExperiences } from '../../store';
|
|
7
|
+
import { ReactionStatus } from '../../types';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Export the mapper function outside the component so easier to do unit tests migration from Enzyme to React Testing Library
|
|
11
|
+
*/
|
|
12
|
+
export const mapStateToPropsHelper = (containerAri, ari, state) => {
|
|
13
|
+
const reactionsState = state && state.reactions[`${containerAri}|${ari}`];
|
|
14
|
+
|
|
15
|
+
if (!state || !reactionsState) {
|
|
16
|
+
return {
|
|
17
|
+
status: ReactionStatus.notLoaded,
|
|
18
|
+
reactions: []
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
switch (reactionsState.status) {
|
|
23
|
+
case ReactionStatus.ready:
|
|
24
|
+
return {
|
|
25
|
+
reactions: reactionsState.reactions,
|
|
26
|
+
status: reactionsState.status,
|
|
27
|
+
flash: state.flash[`${containerAri}|${ari}`]
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
case ReactionStatus.error:
|
|
31
|
+
return {
|
|
32
|
+
status: ReactionStatus.error,
|
|
33
|
+
reactions: []
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
default:
|
|
37
|
+
return {
|
|
38
|
+
status: ReactionStatus.loading,
|
|
39
|
+
reactions: []
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Export the mapper function outside the component so easier to do unit tests migration from Enzyme to React Testing Library
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
export const mapDispatchToPropsHelper = (actions, containerAri, ari) => {
|
|
48
|
+
return {
|
|
49
|
+
loadReaction: () => {
|
|
50
|
+
actions.getReactions(containerAri, ari);
|
|
51
|
+
},
|
|
52
|
+
onReactionClick: emojiId => {
|
|
53
|
+
actions.toggleReaction(containerAri, ari, emojiId);
|
|
54
|
+
},
|
|
55
|
+
onReactionHover: emojiId => {
|
|
56
|
+
actions.getDetailedReaction(containerAri, ari, emojiId);
|
|
57
|
+
},
|
|
58
|
+
onSelection: emojiId => {
|
|
59
|
+
actions.addReaction(containerAri, ari, emojiId);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
export const ConnectedReactionsView = props => {
|
|
64
|
+
const {
|
|
65
|
+
ari,
|
|
66
|
+
containerAri,
|
|
67
|
+
store
|
|
68
|
+
} = props;
|
|
69
|
+
/**
|
|
70
|
+
* Reference to the <Reactions /> component instance mandatory props
|
|
71
|
+
*/
|
|
72
|
+
|
|
73
|
+
const [stateData, setStateData] = useState();
|
|
74
|
+
const [dispatchData, setDispatchData] = useState(); // compose a UFO experience object
|
|
75
|
+
|
|
76
|
+
const experienceInstance = useRef();
|
|
77
|
+
const {
|
|
78
|
+
createAnalyticsEvent
|
|
79
|
+
} = useAnalyticsEvents();
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
experienceInstance.current = ufoExperiences.render(ari);
|
|
82
|
+
}, [ari]); // abort when component gets unmounted
|
|
83
|
+
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
return function cleanup() {
|
|
86
|
+
var _experienceInstance$c;
|
|
87
|
+
|
|
88
|
+
(_experienceInstance$c = experienceInstance.current) === null || _experienceInstance$c === void 0 ? void 0 : _experienceInstance$c.abort({
|
|
89
|
+
metadata: {
|
|
90
|
+
source: 'Connected-Reactions-View',
|
|
91
|
+
data: {
|
|
92
|
+
ari,
|
|
93
|
+
containerAri
|
|
94
|
+
},
|
|
95
|
+
reason: 'unmount'
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
}, [experienceInstance, containerAri, ari]);
|
|
100
|
+
/**
|
|
101
|
+
* Maps the store instance "reactions" data to the <Reactions /> component state data
|
|
102
|
+
* @param state store instance latest data
|
|
103
|
+
*/
|
|
104
|
+
|
|
105
|
+
const mapStateToProps = useCallback(state => {
|
|
106
|
+
return mapStateToPropsHelper(containerAri, ari, state);
|
|
107
|
+
}, [containerAri, ari]);
|
|
108
|
+
/**
|
|
109
|
+
* Map the store instance "actions" methods to the <Reactions /> component actions methods
|
|
110
|
+
* @param actions list of actions in the store instance
|
|
111
|
+
*/
|
|
112
|
+
|
|
113
|
+
const mapDispatchToProps = useCallback(actions => {
|
|
114
|
+
return mapDispatchToPropsHelper(actions, containerAri, ari);
|
|
115
|
+
}, [ari, containerAri]);
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
(async () => {
|
|
118
|
+
const _store = await Promise.resolve(store);
|
|
119
|
+
|
|
120
|
+
if (_store.setCreateAnalyticsEvent && createAnalyticsEvent) {
|
|
121
|
+
_store.setCreateAnalyticsEvent(createAnalyticsEvent);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const state = mapStateToProps(_store.getState());
|
|
125
|
+
const dispatch = mapDispatchToProps(_store);
|
|
126
|
+
setStateData(state);
|
|
127
|
+
setDispatchData(dispatch);
|
|
128
|
+
})();
|
|
129
|
+
}, [createAnalyticsEvent, store, ari, containerAri, mapStateToProps, mapDispatchToProps]);
|
|
130
|
+
/**
|
|
131
|
+
* Listen to changes on the store data.
|
|
132
|
+
* TODO: Needs to be refactored inside the MemoryReactionsStore to different pattern, currently it relies on internal callbacks variable to trigger changes to the store.
|
|
133
|
+
* The flow that each action method triggers a call to "setState" => "triggerOnChange" => calls the callback function registered by the onChange method and de-register by the "removeOnChangeListener" method
|
|
134
|
+
*/
|
|
135
|
+
|
|
136
|
+
useEffect(() => {
|
|
137
|
+
const onChangeCallback = state => {
|
|
138
|
+
const stateProps = mapStateToProps(state);
|
|
139
|
+
setStateData(stateProps);
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
(async () => {
|
|
143
|
+
const _store = await Promise.resolve(store);
|
|
144
|
+
|
|
145
|
+
_store.onChange(onChangeCallback);
|
|
146
|
+
})();
|
|
147
|
+
|
|
148
|
+
return function cleanup() {
|
|
149
|
+
(async () => {
|
|
150
|
+
const _store = await Promise.resolve(store);
|
|
151
|
+
|
|
152
|
+
_store.removeOnChangeListener(onChangeCallback);
|
|
153
|
+
})();
|
|
154
|
+
};
|
|
155
|
+
}, [mapStateToProps, store]);
|
|
156
|
+
return /*#__PURE__*/React.createElement(FabricElementsAnalyticsContext, {
|
|
157
|
+
data: {
|
|
158
|
+
containerAri,
|
|
159
|
+
ari
|
|
160
|
+
}
|
|
161
|
+
}, /*#__PURE__*/React.createElement(UfoErrorBoundary, {
|
|
162
|
+
experiences: experienceInstance.current ? [experienceInstance.current] : []
|
|
163
|
+
}, stateData && dispatchData ? /*#__PURE__*/React.createElement(Reactions, _extends({
|
|
164
|
+
key: `${props.containerAri}|${props.ari}`
|
|
165
|
+
}, props, dispatchData, stateData)) : null));
|
|
166
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ConnectedReactionsView } from './ConnectedReactionsView';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export * from './ConnectedReactionPicker';
|
|
2
|
+
export * from './ConnectedReactionsView';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useClickAway } from './useClickAway';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Custom hook to detect when user action is outside given container ref
|
|
4
|
+
* @param ref ref object to an html element
|
|
5
|
+
* @param callback event callback when detected a click outside the ref object
|
|
6
|
+
* @param type (Optional) type of event to listen to. @default click
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export function useClickAway(ref, callback, type = 'click') {
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
/**
|
|
12
|
+
* Alert if clicked on outside of element
|
|
13
|
+
*/
|
|
14
|
+
function handleClickOutside(event) {
|
|
15
|
+
if (ref.current && event.target instanceof Node && !ref.current.contains(event.target)) {
|
|
16
|
+
callback();
|
|
17
|
+
}
|
|
18
|
+
} // Bind the event listener
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
document.addEventListener(type, handleClickOutside);
|
|
22
|
+
return () => {
|
|
23
|
+
// Unbind the event listener on clean up
|
|
24
|
+
document.removeEventListener(type, handleClickOutside);
|
|
25
|
+
};
|
|
26
|
+
}, [ref, callback, type]);
|
|
27
|
+
}
|
package/dist/es2019/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { UFO } from './analytics';
|
|
2
|
-
export { ReactionServiceClient } from './client';
|
|
2
|
+
export { ReactionServiceClient } from './client'; // TODO: Convert all calls for ReactionRequest to Request, RequestClient to Client and ReactionsStore to Store
|
|
3
|
+
|
|
4
|
+
export { constants } from './shared';
|
|
3
5
|
export { Reaction, ReactionPicker, Reactions } from './components';
|
|
4
6
|
export { ConnectedReactionPicker, ConnectedReactionsView } from './containers';
|
|
5
7
|
export { MemoryReactionsStore, ReactionConsumer } from './store';
|
|
@@ -1,4 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export const
|
|
1
|
+
/**
|
|
2
|
+
* Initial list of emoji to pick from
|
|
3
|
+
*/
|
|
4
|
+
export const DefaultReactions = [{
|
|
5
|
+
id: '1f44d',
|
|
6
|
+
shortName: ':thumbsup:'
|
|
7
|
+
}, {
|
|
8
|
+
id: '1f44f',
|
|
9
|
+
shortName: ':clap:'
|
|
10
|
+
}, {
|
|
11
|
+
id: '1f525',
|
|
12
|
+
shortName: ':fire:'
|
|
13
|
+
}, {
|
|
14
|
+
id: '2764',
|
|
15
|
+
shortName: ':heart:'
|
|
16
|
+
}, {
|
|
17
|
+
id: '1f632',
|
|
18
|
+
shortName: ':astonished:'
|
|
19
|
+
}, {
|
|
20
|
+
id: '1f914',
|
|
21
|
+
shortName: ':thinking:'
|
|
22
|
+
}];
|
|
23
|
+
/**
|
|
24
|
+
* ES6 Map object from default emoji reactions (with key => shortName, value => entire emoji item)
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
export const DefaultReactionsByShortName = new Map(DefaultReactions.map(reaction => [reaction.shortName, reaction]));
|
|
28
|
+
/**
|
|
29
|
+
* Maximum number of users to show in the tooltip for an emoji reaction
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
export const TOOLTIP_USERS_LIMIT = 5;
|
|
@@ -12,7 +12,7 @@ export const messages = defineMessages({
|
|
|
12
12
|
},
|
|
13
13
|
unexpectedError: {
|
|
14
14
|
id: 'fabric.reactions.error.unexpected',
|
|
15
|
-
defaultMessage: '
|
|
15
|
+
defaultMessage: 'Reactions are temporarily unavailable',
|
|
16
16
|
description: 'Unexpected error message'
|
|
17
17
|
},
|
|
18
18
|
otherUsers: {
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
export {
|
|
1
|
+
import * as _constants from './constants';
|
|
2
|
+
export { _constants as constants };
|
|
3
|
+
import * as _utils from './utils';
|
|
4
|
+
export { _utils as utils };
|
|
5
|
+
import * as _i18n from './i18n';
|
|
6
|
+
export { _i18n as i18n };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { DefaultReactions } from './constants';
|
|
2
|
+
/**
|
|
3
|
+
* Is selected mouse event a left click
|
|
4
|
+
* @param event event data
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export const isLeftClick = event => event.button === 0 && !event.altKey && !event.ctrlKey && !event.metaKey && !event.shiftKey;
|
|
8
|
+
/**
|
|
9
|
+
* Does provided item part of the default emoji ids
|
|
10
|
+
* @param item selected emoji item
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export const isDefaultReaction = item => DefaultReactions.some(otherEmojiId => isEqualEmojiId(otherEmojiId, item));
|
|
14
|
+
/**
|
|
15
|
+
* compare 2 emoji items if they are same input
|
|
16
|
+
* @param a first emoji item
|
|
17
|
+
* @param b second emoji item
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
const isEqualEmojiId = (a, b) => {
|
|
21
|
+
if (isEmojiId(a) && isEmojiId(b)) {
|
|
22
|
+
return a === b || a && b && a.id === b.id && a.shortName === b.shortName;
|
|
23
|
+
} else {
|
|
24
|
+
return a === b;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Type guard if provided object is a string id or an object info collection for the emoji
|
|
29
|
+
* @param item given item
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
const isEmojiId = item => {
|
|
34
|
+
return item.id !== undefined;
|
|
35
|
+
};
|