@atlaskit/emoji 64.4.1 → 64.5.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 +10 -0
- package/dist/cjs/components/common/CachingEmoji.js +8 -6
- package/dist/cjs/components/common/ResourcedEmojiComponent.js +12 -17
- package/dist/cjs/components/picker/EmojiPickerComponent.js +11 -16
- package/dist/cjs/components/picker/EmojiPickerList.js +0 -20
- package/dist/cjs/components/typeahead/EmojiTypeAheadComponent.js +11 -16
- package/dist/cjs/components/typeahead/EmojiTypeAheadItem.js +4 -2
- package/dist/cjs/context/EmojiContext.js +11 -0
- package/dist/cjs/context/EmojiContextProvider.js +29 -0
- package/dist/cjs/context/LegacyEmojiContextProvider.js +76 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/common/CachingEmoji.js +7 -5
- package/dist/es2019/components/common/ResourcedEmojiComponent.js +11 -16
- package/dist/es2019/components/picker/EmojiPickerComponent.js +10 -15
- package/dist/es2019/components/picker/EmojiPickerList.js +0 -19
- package/dist/es2019/components/typeahead/EmojiTypeAheadComponent.js +10 -15
- package/dist/es2019/components/typeahead/EmojiTypeAheadItem.js +3 -2
- package/dist/es2019/context/EmojiContext.js +2 -0
- package/dist/es2019/context/EmojiContextProvider.js +11 -0
- package/dist/es2019/context/LegacyEmojiContextProvider.js +32 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/common/CachingEmoji.js +7 -5
- package/dist/esm/components/common/ResourcedEmojiComponent.js +10 -16
- package/dist/esm/components/picker/EmojiPickerComponent.js +10 -16
- package/dist/esm/components/picker/EmojiPickerList.js +0 -21
- package/dist/esm/components/typeahead/EmojiTypeAheadComponent.js +10 -16
- package/dist/esm/components/typeahead/EmojiTypeAheadItem.js +3 -2
- package/dist/esm/context/EmojiContext.js +2 -0
- package/dist/esm/context/EmojiContextProvider.js +12 -0
- package/dist/esm/context/LegacyEmojiContextProvider.js +57 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/components/common/CachingEmoji.d.ts +6 -8
- package/dist/types/components/common/ResourcedEmojiComponent.d.ts +0 -6
- package/dist/types/components/picker/EmojiPickerComponent.d.ts +0 -6
- package/dist/types/components/picker/EmojiPickerList.d.ts +0 -10
- package/dist/types/components/typeahead/EmojiTypeAheadComponent.d.ts +0 -6
- package/dist/types/context/EmojiContext.d.ts +4 -0
- package/dist/types/context/EmojiContextProvider.d.ts +7 -0
- package/dist/types/context/LegacyEmojiContextProvider.d.ts +22 -0
- package/package.json +3 -2
|
@@ -2,7 +2,6 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import { jsx } from '@emotion/core';
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
6
5
|
import React from 'react';
|
|
7
6
|
import { PureComponent } from 'react';
|
|
8
7
|
import { List as VirtualList } from 'react-virtualized/dist/commonjs/List';
|
|
@@ -198,16 +197,6 @@ export default class EmojiPickerVirtualList extends PureComponent {
|
|
|
198
197
|
this.buildVirtualItems(_props, this.state);
|
|
199
198
|
}
|
|
200
199
|
|
|
201
|
-
getChildContext() {
|
|
202
|
-
const {
|
|
203
|
-
emoji
|
|
204
|
-
} = this.context;
|
|
205
|
-
return {
|
|
206
|
-
emoji: { ...emoji
|
|
207
|
-
}
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
|
|
211
200
|
UNSAFE_componentWillUpdate(nextProps, nextState) {
|
|
212
201
|
if (this.props.emojis !== nextProps.emojis || this.props.selectedTone !== nextProps.selectedTone || this.props.loading !== nextProps.loading || this.props.query !== nextProps.query) {
|
|
213
202
|
if (!nextProps.query) {
|
|
@@ -289,14 +278,6 @@ export default class EmojiPickerVirtualList extends PureComponent {
|
|
|
289
278
|
|
|
290
279
|
}
|
|
291
280
|
|
|
292
|
-
_defineProperty(EmojiPickerVirtualList, "contextTypes", {
|
|
293
|
-
emoji: PropTypes.object
|
|
294
|
-
});
|
|
295
|
-
|
|
296
|
-
_defineProperty(EmojiPickerVirtualList, "childContextTypes", {
|
|
297
|
-
emoji: PropTypes.object
|
|
298
|
-
});
|
|
299
|
-
|
|
300
281
|
_defineProperty(EmojiPickerVirtualList, "defaultProps", {
|
|
301
282
|
onEmojiSelected: () => {},
|
|
302
283
|
onEmojiActive: () => {},
|
|
@@ -3,7 +3,6 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import { jsx } from '@emotion/core';
|
|
5
5
|
import uuid from 'uuid';
|
|
6
|
-
import PropTypes from 'prop-types';
|
|
7
6
|
import { PureComponent } from 'react';
|
|
8
7
|
import { defaultListLimit } from '../../util/constants';
|
|
9
8
|
import { toEmojiId } from '../../util/type-helpers';
|
|
@@ -13,6 +12,7 @@ import { typeaheadCancelledEvent, typeaheadSelectedEvent, typeaheadRenderedEvent
|
|
|
13
12
|
import { createRecordSelectionDefault } from '../common/RecordSelectionDefault';
|
|
14
13
|
import EmojiList from './EmojiTypeAheadList';
|
|
15
14
|
import { emojiTypeAhead } from './styles';
|
|
15
|
+
import LegacyEmojiContextProvider from '../../context/LegacyEmojiContextProvider';
|
|
16
16
|
|
|
17
17
|
const isFullShortName = query => query && query.length > 1 && query.charAt(0) === ':' && query.charAt(query.length - 1) === ':';
|
|
18
18
|
|
|
@@ -150,14 +150,6 @@ export default class EmojiTypeAheadComponent extends PureComponent {
|
|
|
150
150
|
this.selected = false;
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
getChildContext() {
|
|
154
|
-
return {
|
|
155
|
-
emoji: {
|
|
156
|
-
emojiProvider: this.props.emojiProvider
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
|
|
161
153
|
componentDidMount() {
|
|
162
154
|
const {
|
|
163
155
|
emojiProvider
|
|
@@ -265,7 +257,14 @@ export default class EmojiTypeAheadComponent extends PureComponent {
|
|
|
265
257
|
const style = {
|
|
266
258
|
display: visible ? 'block' : 'none'
|
|
267
259
|
};
|
|
268
|
-
|
|
260
|
+
const emojiContextValue = {
|
|
261
|
+
emoji: {
|
|
262
|
+
emojiProvider: this.props.emojiProvider
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
return jsx(LegacyEmojiContextProvider, {
|
|
266
|
+
emojiContextValue: emojiContextValue
|
|
267
|
+
}, jsx("div", {
|
|
269
268
|
style: style,
|
|
270
269
|
className: 'ak-emoji-typeahead',
|
|
271
270
|
css: emojiTypeAhead
|
|
@@ -274,15 +273,11 @@ export default class EmojiTypeAheadComponent extends PureComponent {
|
|
|
274
273
|
onEmojiSelected: recordUsageOnSelection,
|
|
275
274
|
ref: this.onEmojiListRef,
|
|
276
275
|
loading: loading
|
|
277
|
-
}));
|
|
276
|
+
})));
|
|
278
277
|
}
|
|
279
278
|
|
|
280
279
|
}
|
|
281
280
|
|
|
282
|
-
_defineProperty(EmojiTypeAheadComponent, "childContextTypes", {
|
|
283
|
-
emoji: PropTypes.object
|
|
284
|
-
});
|
|
285
|
-
|
|
286
281
|
_defineProperty(EmojiTypeAheadComponent, "defaultProps", {
|
|
287
282
|
onSelection: () => {},
|
|
288
283
|
onOpen: () => {},
|
|
@@ -8,6 +8,7 @@ import { toEmojiId } from '../../util/type-helpers';
|
|
|
8
8
|
import { leftClick } from '../../util/mouse';
|
|
9
9
|
import { EmojiPreviewComponent } from '../common/EmojiPreviewComponent';
|
|
10
10
|
import { typeAheadItem, selected as selectedStyles, typeAheadItemRow, typeaheadSelected } from './styles';
|
|
11
|
+
import LegacyEmojiContextProvider from '../../context/LegacyEmojiContextProvider';
|
|
11
12
|
export default class EmojiTypeAheadItem extends PureComponent {
|
|
12
13
|
constructor(...args) {
|
|
13
14
|
super(...args);
|
|
@@ -42,7 +43,7 @@ export default class EmojiTypeAheadItem extends PureComponent {
|
|
|
42
43
|
emoji
|
|
43
44
|
} = this.props;
|
|
44
45
|
const classes = [typeAheadItem, selected && selectedStyles];
|
|
45
|
-
return jsx("div", {
|
|
46
|
+
return jsx(LegacyEmojiContextProvider, null, jsx("div", {
|
|
46
47
|
className: `ak-emoji-typeahead-item ${selected ? typeaheadSelected : ''}`,
|
|
47
48
|
css: classes,
|
|
48
49
|
onMouseDown: this.onEmojiSelected,
|
|
@@ -52,7 +53,7 @@ export default class EmojiTypeAheadItem extends PureComponent {
|
|
|
52
53
|
css: typeAheadItemRow
|
|
53
54
|
}, emoji && jsx(EmojiPreviewComponent, {
|
|
54
55
|
emoji: emoji
|
|
55
|
-
})));
|
|
56
|
+
}))));
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { EmojiContext } from './EmojiContext';
|
|
3
|
+
export const EmojiContextProvider = ({
|
|
4
|
+
children,
|
|
5
|
+
emojiContextValue
|
|
6
|
+
}) => {
|
|
7
|
+
const memoizedEmojiContextValue = useMemo(() => emojiContextValue, [emojiContextValue]);
|
|
8
|
+
return /*#__PURE__*/React.createElement(EmojiContext.Provider, {
|
|
9
|
+
value: memoizedEmojiContextValue
|
|
10
|
+
}, children);
|
|
11
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import React, { Component } from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { EmojiContextProvider } from './EmojiContextProvider';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Legacy Context Priority Passthrough ...
|
|
8
|
+
* If component finds legacy context, then use it, otherwise use the passed through context
|
|
9
|
+
*/
|
|
10
|
+
export default class LegacyEmojiContextProvider extends Component {
|
|
11
|
+
constructor(props, context) {
|
|
12
|
+
super(props, context);
|
|
13
|
+
this.state = {
|
|
14
|
+
prioritisedContextValue: context.emoji ? context : this.props.emojiContextValue
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
render() {
|
|
19
|
+
if (this.state.prioritisedContextValue) {
|
|
20
|
+
return /*#__PURE__*/React.createElement(EmojiContextProvider, {
|
|
21
|
+
emojiContextValue: this.state.prioritisedContextValue
|
|
22
|
+
}, this.props.children);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return this.props.children;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
_defineProperty(LegacyEmojiContextProvider, "contextTypes", {
|
|
31
|
+
emoji: PropTypes.object
|
|
32
|
+
});
|
package/dist/es2019/version.json
CHANGED
|
@@ -14,7 +14,6 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
14
14
|
|
|
15
15
|
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; } }
|
|
16
16
|
|
|
17
|
-
import PropTypes from 'prop-types';
|
|
18
17
|
import React from 'react';
|
|
19
18
|
import { PureComponent } from 'react';
|
|
20
19
|
import { shouldUseAltRepresentation } from '../../api/EmojiUtils';
|
|
@@ -25,6 +24,7 @@ import EmojiPlaceholder from './EmojiPlaceholder';
|
|
|
25
24
|
import { UfoErrorBoundary } from './UfoErrorBoundary';
|
|
26
25
|
import { sampledUfoRenderedEmoji, ufoExperiences, useSampledUFOComponentExperience } from '../../util/analytics';
|
|
27
26
|
import { SAMPLING_RATE_EMOJI_RENDERED_EXP } from '../../util/constants';
|
|
27
|
+
import { EmojiContext } from '../../context/EmojiContext';
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* Renders an emoji from a cached image, if required.
|
|
@@ -67,7 +67,7 @@ export var CachingMediaEmoji = /*#__PURE__*/function (_PureComponent) {
|
|
|
67
67
|
|
|
68
68
|
_classCallCheck(this, CachingMediaEmoji);
|
|
69
69
|
|
|
70
|
-
_this = _super.call(this, props
|
|
70
|
+
_this = _super.call(this, props);
|
|
71
71
|
|
|
72
72
|
_defineProperty(_assertThisInitialized(_this), "mounted", false);
|
|
73
73
|
|
|
@@ -122,6 +122,10 @@ export var CachingMediaEmoji = /*#__PURE__*/function (_PureComponent) {
|
|
|
122
122
|
value: function loadEmoji(emoji, context, forceLoad) {
|
|
123
123
|
var _this2 = this;
|
|
124
124
|
|
|
125
|
+
if (!context) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
|
|
125
129
|
if (!context.emoji) {
|
|
126
130
|
return undefined;
|
|
127
131
|
}
|
|
@@ -215,8 +219,6 @@ export var CachingMediaEmoji = /*#__PURE__*/function (_PureComponent) {
|
|
|
215
219
|
return CachingMediaEmoji;
|
|
216
220
|
}(PureComponent);
|
|
217
221
|
|
|
218
|
-
_defineProperty(CachingMediaEmoji, "
|
|
219
|
-
emoji: PropTypes.object
|
|
220
|
-
});
|
|
222
|
+
_defineProperty(CachingMediaEmoji, "contextType", EmojiContext);
|
|
221
223
|
|
|
222
224
|
export default CachingEmoji;
|
|
@@ -10,7 +10,6 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
10
10
|
|
|
11
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
12
|
|
|
13
|
-
import PropTypes from 'prop-types';
|
|
14
13
|
import React from 'react';
|
|
15
14
|
import { Component } from 'react';
|
|
16
15
|
import { defaultEmojiHeight } from '../../util/constants';
|
|
@@ -18,6 +17,7 @@ import { isPromise } from '../../util/type-helpers';
|
|
|
18
17
|
import CachingEmoji from './CachingEmoji';
|
|
19
18
|
import EmojiPlaceholder from './EmojiPlaceholder';
|
|
20
19
|
import { sampledUfoRenderedEmoji } from '../../util/analytics';
|
|
20
|
+
import LegacyEmojiContextProvider from '../../context/LegacyEmojiContextProvider';
|
|
21
21
|
|
|
22
22
|
var ResourcedEmojiComponent = /*#__PURE__*/function (_Component) {
|
|
23
23
|
_inherits(ResourcedEmojiComponent, _Component);
|
|
@@ -41,15 +41,6 @@ var ResourcedEmojiComponent = /*#__PURE__*/function (_Component) {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
_createClass(ResourcedEmojiComponent, [{
|
|
44
|
-
key: "getChildContext",
|
|
45
|
-
value: function getChildContext() {
|
|
46
|
-
return {
|
|
47
|
-
emoji: {
|
|
48
|
-
emojiProvider: this.props.emojiProvider
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
}, {
|
|
53
44
|
key: "refreshEmoji",
|
|
54
45
|
value: function refreshEmoji(emojiProvider, emojiId) {
|
|
55
46
|
var _this2 = this;
|
|
@@ -153,19 +144,22 @@ var ResourcedEmojiComponent = /*#__PURE__*/function (_Component) {
|
|
|
153
144
|
shortName = _this$props$emojiId.shortName,
|
|
154
145
|
id = _this$props$emojiId.id,
|
|
155
146
|
fallback = _this$props$emojiId.fallback;
|
|
156
|
-
|
|
147
|
+
var emojiContextValue = {
|
|
148
|
+
emoji: {
|
|
149
|
+
emojiProvider: this.props.emojiProvider
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
return /*#__PURE__*/React.createElement(LegacyEmojiContextProvider, {
|
|
153
|
+
emojiContextValue: emojiContextValue
|
|
154
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
157
155
|
"data-emoji-id": id,
|
|
158
156
|
"data-emoji-short-name": shortName,
|
|
159
157
|
"data-emoji-text": fallback || shortName
|
|
160
|
-
}, element);
|
|
158
|
+
}, element));
|
|
161
159
|
}
|
|
162
160
|
}]);
|
|
163
161
|
|
|
164
162
|
return ResourcedEmojiComponent;
|
|
165
163
|
}(Component);
|
|
166
164
|
|
|
167
|
-
_defineProperty(ResourcedEmojiComponent, "childContextTypes", {
|
|
168
|
-
emoji: PropTypes.object
|
|
169
|
-
});
|
|
170
|
-
|
|
171
165
|
export { ResourcedEmojiComponent as default };
|
|
@@ -17,7 +17,6 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
17
17
|
|
|
18
18
|
/** @jsx jsx */
|
|
19
19
|
import { jsx } from '@emotion/core';
|
|
20
|
-
import PropTypes from 'prop-types';
|
|
21
20
|
import { PureComponent } from 'react';
|
|
22
21
|
import { FormattedMessage } from 'react-intl-next';
|
|
23
22
|
import { getEmojiVariation } from '../../api/EmojiRepository';
|
|
@@ -35,6 +34,7 @@ import EmojiPickerFooter from './EmojiPickerFooter';
|
|
|
35
34
|
import EmojiPickerList from './EmojiPickerList';
|
|
36
35
|
import { createAndFireEventInElementsChannel, categoryClickedEvent, closedPickerEvent, deleteBeginEvent, deleteCancelEvent, deleteConfirmEvent, openedPickerEvent, pickerClickedEvent, pickerSearchedEvent, selectedFileEvent, uploadBeginButton, uploadCancelButton, uploadConfirmButton, toneSelectorClosedEvent, ufoExperiences } from '../../util/analytics';
|
|
37
36
|
import { emojiPicker } from './styles';
|
|
37
|
+
import LegacyEmojiContextProvider from '../../context/LegacyEmojiContextProvider';
|
|
38
38
|
var FREQUENTLY_USED_MAX = 16;
|
|
39
39
|
|
|
40
40
|
var EmojiPickerComponent = /*#__PURE__*/function (_PureComponent) {
|
|
@@ -378,15 +378,6 @@ var EmojiPickerComponent = /*#__PURE__*/function (_PureComponent) {
|
|
|
378
378
|
}
|
|
379
379
|
|
|
380
380
|
_createClass(EmojiPickerComponent, [{
|
|
381
|
-
key: "getChildContext",
|
|
382
|
-
value: function getChildContext() {
|
|
383
|
-
return {
|
|
384
|
-
emoji: {
|
|
385
|
-
emojiProvider: this.props.emojiProvider
|
|
386
|
-
}
|
|
387
|
-
};
|
|
388
|
-
}
|
|
389
|
-
}, {
|
|
390
381
|
key: "UNSAFE_componentWillMount",
|
|
391
382
|
value: function UNSAFE_componentWillMount() {
|
|
392
383
|
this.openTime = Date.now();
|
|
@@ -561,7 +552,14 @@ var EmojiPickerComponent = /*#__PURE__*/function (_PureComponent) {
|
|
|
561
552
|
return _this4.fireAnalytics(analytic('picker'));
|
|
562
553
|
});
|
|
563
554
|
var formattedErrorMessage = uploadErrorMessage ? jsx(FormattedMessage, uploadErrorMessage) : null;
|
|
564
|
-
var
|
|
555
|
+
var emojiContextValue = {
|
|
556
|
+
emoji: {
|
|
557
|
+
emojiProvider: this.props.emojiProvider
|
|
558
|
+
}
|
|
559
|
+
};
|
|
560
|
+
var picker = jsx(LegacyEmojiContextProvider, {
|
|
561
|
+
emojiContextValue: emojiContextValue
|
|
562
|
+
}, jsx("div", {
|
|
565
563
|
css: emojiPicker,
|
|
566
564
|
ref: this.handlePickerRef,
|
|
567
565
|
"data-emoji-picker-container": true
|
|
@@ -599,7 +597,7 @@ var EmojiPickerComponent = /*#__PURE__*/function (_PureComponent) {
|
|
|
599
597
|
}), jsx(EmojiPickerFooter, {
|
|
600
598
|
selectedEmoji: selectedEmoji,
|
|
601
599
|
isUploading: uploading
|
|
602
|
-
}));
|
|
600
|
+
})));
|
|
603
601
|
return picker;
|
|
604
602
|
}
|
|
605
603
|
}]);
|
|
@@ -607,10 +605,6 @@ var EmojiPickerComponent = /*#__PURE__*/function (_PureComponent) {
|
|
|
607
605
|
return EmojiPickerComponent;
|
|
608
606
|
}(PureComponent);
|
|
609
607
|
|
|
610
|
-
_defineProperty(EmojiPickerComponent, "childContextTypes", {
|
|
611
|
-
emoji: PropTypes.object
|
|
612
|
-
});
|
|
613
|
-
|
|
614
608
|
_defineProperty(EmojiPickerComponent, "defaultProps", {
|
|
615
609
|
onSelection: function onSelection() {}
|
|
616
610
|
});
|
|
@@ -7,17 +7,12 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
7
7
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
8
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
9
|
|
|
10
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
11
|
-
|
|
12
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
13
|
-
|
|
14
10
|
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); }; }
|
|
15
11
|
|
|
16
12
|
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; } }
|
|
17
13
|
|
|
18
14
|
/** @jsx jsx */
|
|
19
15
|
import { jsx } from '@emotion/core';
|
|
20
|
-
import PropTypes from 'prop-types';
|
|
21
16
|
import React from 'react';
|
|
22
17
|
import { PureComponent } from 'react';
|
|
23
18
|
import { List as VirtualList } from 'react-virtualized/dist/commonjs/List';
|
|
@@ -233,14 +228,6 @@ var EmojiPickerVirtualList = /*#__PURE__*/function (_PureComponent) {
|
|
|
233
228
|
}
|
|
234
229
|
|
|
235
230
|
_createClass(EmojiPickerVirtualList, [{
|
|
236
|
-
key: "getChildContext",
|
|
237
|
-
value: function getChildContext() {
|
|
238
|
-
var emoji = this.context.emoji;
|
|
239
|
-
return {
|
|
240
|
-
emoji: _objectSpread({}, emoji)
|
|
241
|
-
};
|
|
242
|
-
}
|
|
243
|
-
}, {
|
|
244
231
|
key: "UNSAFE_componentWillUpdate",
|
|
245
232
|
value: function UNSAFE_componentWillUpdate(nextProps, nextState) {
|
|
246
233
|
if (this.props.emojis !== nextProps.emojis || this.props.selectedTone !== nextProps.selectedTone || this.props.loading !== nextProps.loading || this.props.query !== nextProps.query) {
|
|
@@ -328,14 +315,6 @@ var EmojiPickerVirtualList = /*#__PURE__*/function (_PureComponent) {
|
|
|
328
315
|
return EmojiPickerVirtualList;
|
|
329
316
|
}(PureComponent);
|
|
330
317
|
|
|
331
|
-
_defineProperty(EmojiPickerVirtualList, "contextTypes", {
|
|
332
|
-
emoji: PropTypes.object
|
|
333
|
-
});
|
|
334
|
-
|
|
335
|
-
_defineProperty(EmojiPickerVirtualList, "childContextTypes", {
|
|
336
|
-
emoji: PropTypes.object
|
|
337
|
-
});
|
|
338
|
-
|
|
339
318
|
_defineProperty(EmojiPickerVirtualList, "defaultProps", {
|
|
340
319
|
onEmojiSelected: function onEmojiSelected() {},
|
|
341
320
|
onEmojiActive: function onEmojiActive() {},
|
|
@@ -19,7 +19,6 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
19
19
|
/** @jsx jsx */
|
|
20
20
|
import { jsx } from '@emotion/core';
|
|
21
21
|
import uuid from 'uuid';
|
|
22
|
-
import PropTypes from 'prop-types';
|
|
23
22
|
import { PureComponent } from 'react';
|
|
24
23
|
import { defaultListLimit } from '../../util/constants';
|
|
25
24
|
import { toEmojiId } from '../../util/type-helpers';
|
|
@@ -29,6 +28,7 @@ import { typeaheadCancelledEvent, typeaheadSelectedEvent, typeaheadRenderedEvent
|
|
|
29
28
|
import { createRecordSelectionDefault } from '../common/RecordSelectionDefault';
|
|
30
29
|
import EmojiList from './EmojiTypeAheadList';
|
|
31
30
|
import { emojiTypeAhead } from './styles';
|
|
31
|
+
import LegacyEmojiContextProvider from '../../context/LegacyEmojiContextProvider';
|
|
32
32
|
|
|
33
33
|
var isFullShortName = function isFullShortName(query) {
|
|
34
34
|
return query && query.length > 1 && query.charAt(0) === ':' && query.charAt(query.length - 1) === ':';
|
|
@@ -192,15 +192,6 @@ var EmojiTypeAheadComponent = /*#__PURE__*/function (_PureComponent) {
|
|
|
192
192
|
}
|
|
193
193
|
|
|
194
194
|
_createClass(EmojiTypeAheadComponent, [{
|
|
195
|
-
key: "getChildContext",
|
|
196
|
-
value: function getChildContext() {
|
|
197
|
-
return {
|
|
198
|
-
emoji: {
|
|
199
|
-
emojiProvider: this.props.emojiProvider
|
|
200
|
-
}
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
}, {
|
|
204
195
|
key: "componentDidMount",
|
|
205
196
|
value: function componentDidMount() {
|
|
206
197
|
var emojiProvider = this.props.emojiProvider;
|
|
@@ -307,7 +298,14 @@ var EmojiTypeAheadComponent = /*#__PURE__*/function (_PureComponent) {
|
|
|
307
298
|
var style = {
|
|
308
299
|
display: visible ? 'block' : 'none'
|
|
309
300
|
};
|
|
310
|
-
|
|
301
|
+
var emojiContextValue = {
|
|
302
|
+
emoji: {
|
|
303
|
+
emojiProvider: this.props.emojiProvider
|
|
304
|
+
}
|
|
305
|
+
};
|
|
306
|
+
return jsx(LegacyEmojiContextProvider, {
|
|
307
|
+
emojiContextValue: emojiContextValue
|
|
308
|
+
}, jsx("div", {
|
|
311
309
|
style: style,
|
|
312
310
|
className: 'ak-emoji-typeahead',
|
|
313
311
|
css: emojiTypeAhead
|
|
@@ -316,17 +314,13 @@ var EmojiTypeAheadComponent = /*#__PURE__*/function (_PureComponent) {
|
|
|
316
314
|
onEmojiSelected: recordUsageOnSelection,
|
|
317
315
|
ref: this.onEmojiListRef,
|
|
318
316
|
loading: loading
|
|
319
|
-
}));
|
|
317
|
+
})));
|
|
320
318
|
}
|
|
321
319
|
}]);
|
|
322
320
|
|
|
323
321
|
return EmojiTypeAheadComponent;
|
|
324
322
|
}(PureComponent);
|
|
325
323
|
|
|
326
|
-
_defineProperty(EmojiTypeAheadComponent, "childContextTypes", {
|
|
327
|
-
emoji: PropTypes.object
|
|
328
|
-
});
|
|
329
|
-
|
|
330
324
|
_defineProperty(EmojiTypeAheadComponent, "defaultProps", {
|
|
331
325
|
onSelection: function onSelection() {},
|
|
332
326
|
onOpen: function onOpen() {},
|
|
@@ -18,6 +18,7 @@ import { toEmojiId } from '../../util/type-helpers';
|
|
|
18
18
|
import { leftClick } from '../../util/mouse';
|
|
19
19
|
import { EmojiPreviewComponent } from '../common/EmojiPreviewComponent';
|
|
20
20
|
import { typeAheadItem, selected as selectedStyles, typeAheadItemRow, typeaheadSelected } from './styles';
|
|
21
|
+
import LegacyEmojiContextProvider from '../../context/LegacyEmojiContextProvider';
|
|
21
22
|
|
|
22
23
|
var EmojiTypeAheadItem = /*#__PURE__*/function (_PureComponent) {
|
|
23
24
|
_inherits(EmojiTypeAheadItem, _PureComponent);
|
|
@@ -66,7 +67,7 @@ var EmojiTypeAheadItem = /*#__PURE__*/function (_PureComponent) {
|
|
|
66
67
|
selected = _this$props3.selected,
|
|
67
68
|
emoji = _this$props3.emoji;
|
|
68
69
|
var classes = [typeAheadItem, selected && selectedStyles];
|
|
69
|
-
return jsx("div", {
|
|
70
|
+
return jsx(LegacyEmojiContextProvider, null, jsx("div", {
|
|
70
71
|
className: "ak-emoji-typeahead-item ".concat(selected ? typeaheadSelected : ''),
|
|
71
72
|
css: classes,
|
|
72
73
|
onMouseDown: this.onEmojiSelected,
|
|
@@ -76,7 +77,7 @@ var EmojiTypeAheadItem = /*#__PURE__*/function (_PureComponent) {
|
|
|
76
77
|
css: typeAheadItemRow
|
|
77
78
|
}, emoji && jsx(EmojiPreviewComponent, {
|
|
78
79
|
emoji: emoji
|
|
79
|
-
})));
|
|
80
|
+
}))));
|
|
80
81
|
}
|
|
81
82
|
}]);
|
|
82
83
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { EmojiContext } from './EmojiContext';
|
|
3
|
+
export var EmojiContextProvider = function EmojiContextProvider(_ref) {
|
|
4
|
+
var children = _ref.children,
|
|
5
|
+
emojiContextValue = _ref.emojiContextValue;
|
|
6
|
+
var memoizedEmojiContextValue = useMemo(function () {
|
|
7
|
+
return emojiContextValue;
|
|
8
|
+
}, [emojiContextValue]);
|
|
9
|
+
return /*#__PURE__*/React.createElement(EmojiContext.Provider, {
|
|
10
|
+
value: memoizedEmojiContextValue
|
|
11
|
+
}, children);
|
|
12
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
import React, { Component } from 'react';
|
|
13
|
+
import PropTypes from 'prop-types';
|
|
14
|
+
import { EmojiContextProvider } from './EmojiContextProvider';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Legacy Context Priority Passthrough ...
|
|
18
|
+
* If component finds legacy context, then use it, otherwise use the passed through context
|
|
19
|
+
*/
|
|
20
|
+
var LegacyEmojiContextProvider = /*#__PURE__*/function (_Component) {
|
|
21
|
+
_inherits(LegacyEmojiContextProvider, _Component);
|
|
22
|
+
|
|
23
|
+
var _super = _createSuper(LegacyEmojiContextProvider);
|
|
24
|
+
|
|
25
|
+
function LegacyEmojiContextProvider(props, context) {
|
|
26
|
+
var _this;
|
|
27
|
+
|
|
28
|
+
_classCallCheck(this, LegacyEmojiContextProvider);
|
|
29
|
+
|
|
30
|
+
_this = _super.call(this, props, context);
|
|
31
|
+
_this.state = {
|
|
32
|
+
prioritisedContextValue: context.emoji ? context : _this.props.emojiContextValue
|
|
33
|
+
};
|
|
34
|
+
return _this;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
_createClass(LegacyEmojiContextProvider, [{
|
|
38
|
+
key: "render",
|
|
39
|
+
value: function render() {
|
|
40
|
+
if (this.state.prioritisedContextValue) {
|
|
41
|
+
return /*#__PURE__*/React.createElement(EmojiContextProvider, {
|
|
42
|
+
emojiContextValue: this.state.prioritisedContextValue
|
|
43
|
+
}, this.props.children);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return this.props.children;
|
|
47
|
+
}
|
|
48
|
+
}]);
|
|
49
|
+
|
|
50
|
+
return LegacyEmojiContextProvider;
|
|
51
|
+
}(Component);
|
|
52
|
+
|
|
53
|
+
_defineProperty(LegacyEmojiContextProvider, "contextTypes", {
|
|
54
|
+
emoji: PropTypes.object
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
export { LegacyEmojiContextProvider as default };
|
package/dist/esm/version.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React, { ContextType } from 'react';
|
|
2
2
|
import { PureComponent } from 'react';
|
|
3
3
|
import { EmojiDescription } from '../../types';
|
|
4
4
|
import { Props as EmojiProps } from './Emoji';
|
|
5
|
-
import { EmojiContext } from '
|
|
5
|
+
import { EmojiContext, EmojiContextType } from '../../context/EmojiContext';
|
|
6
6
|
export interface State {
|
|
7
7
|
cachedEmoji?: EmojiDescription;
|
|
8
8
|
invalidImage?: boolean;
|
|
@@ -19,15 +19,13 @@ export declare const CachingEmoji: (props: CachingEmojiProps) => JSX.Element;
|
|
|
19
19
|
* rendering paths depending on caching strategy.
|
|
20
20
|
*/
|
|
21
21
|
export declare class CachingMediaEmoji extends PureComponent<CachingEmojiProps, State> {
|
|
22
|
-
static contextTypes: {
|
|
23
|
-
emoji: PropTypes.Requireable<any>;
|
|
24
|
-
};
|
|
25
22
|
private mounted;
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
static contextType: React.Context<EmojiContextType>;
|
|
24
|
+
context: ContextType<typeof EmojiContext>;
|
|
25
|
+
constructor(props: EmojiProps, context: ContextType<typeof EmojiContext>);
|
|
28
26
|
componentDidMount(): void;
|
|
29
27
|
componentWillUnmount(): void;
|
|
30
|
-
UNSAFE_componentWillReceiveProps(nextProps: EmojiProps, nextContext:
|
|
28
|
+
UNSAFE_componentWillReceiveProps(nextProps: EmojiProps, nextContext: EmojiContextType): void;
|
|
31
29
|
private loadEmoji;
|
|
32
30
|
private handleLoadError;
|
|
33
31
|
render(): JSX.Element;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
1
|
import { Component } from 'react';
|
|
3
2
|
import EmojiProvider from '../../api/EmojiResource';
|
|
4
3
|
import { EmojiId, OptionalEmojiDescription } from '../../types';
|
|
5
|
-
import { EmojiContext } from './internal-types';
|
|
6
4
|
import { State as LoadingState } from './LoadingEmojiComponent';
|
|
7
5
|
export interface BaseResourcedEmojiProps {
|
|
8
6
|
emojiId: EmojiId;
|
|
@@ -17,12 +15,8 @@ export interface State extends LoadingState {
|
|
|
17
15
|
loaded: boolean;
|
|
18
16
|
}
|
|
19
17
|
export default class ResourcedEmojiComponent extends Component<Props, State> {
|
|
20
|
-
static childContextTypes: {
|
|
21
|
-
emoji: PropTypes.Requireable<any>;
|
|
22
|
-
};
|
|
23
18
|
private ready;
|
|
24
19
|
constructor(props: Props);
|
|
25
|
-
getChildContext(): EmojiContext;
|
|
26
20
|
private refreshEmoji;
|
|
27
21
|
UNSAFE_componentWillMount(): void;
|
|
28
22
|
componentWillUnmount(): void;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
1
|
import { PureComponent } from 'react';
|
|
3
2
|
import { MessageDescriptor } from 'react-intl-next';
|
|
4
3
|
import { EmojiProvider } from '../../api/EmojiResource';
|
|
5
4
|
import { EmojiDescription, EmojiId, OnEmojiEvent, OptionalEmojiDescription, OptionalEmojiDescriptionWithVariations, ToneSelection } from '../../types';
|
|
6
|
-
import { EmojiContext } from '../common/internal-types';
|
|
7
5
|
import { CategoryId } from './categories';
|
|
8
6
|
import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
9
7
|
export interface PickerRefHandler {
|
|
@@ -34,15 +32,11 @@ export interface State {
|
|
|
34
32
|
loading: boolean;
|
|
35
33
|
}
|
|
36
34
|
export default class EmojiPickerComponent extends PureComponent<Props, State> {
|
|
37
|
-
static childContextTypes: {
|
|
38
|
-
emoji: PropTypes.Requireable<any>;
|
|
39
|
-
};
|
|
40
35
|
static defaultProps: {
|
|
41
36
|
onSelection: () => void;
|
|
42
37
|
};
|
|
43
38
|
constructor(props: Props);
|
|
44
39
|
openTime: number;
|
|
45
|
-
getChildContext(): EmojiContext;
|
|
46
40
|
UNSAFE_componentWillMount(): void;
|
|
47
41
|
componentDidMount(): void;
|
|
48
42
|
componentWillUnmount(): void;
|