@atlaskit/emoji 64.2.1 → 64.4.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 +27 -0
- package/dist/cjs/api/media/SiteEmojiResource.js +10 -2
- package/dist/cjs/components/common/CachingEmoji.js +6 -8
- package/dist/cjs/components/common/DeleteButton.js +9 -13
- package/dist/cjs/components/common/Emoji.js +18 -36
- package/dist/cjs/components/common/EmojiActions.js +26 -31
- package/dist/cjs/components/common/EmojiButton.js +7 -7
- package/dist/cjs/components/common/EmojiDeletePreview.js +20 -26
- package/dist/cjs/components/common/EmojiErrorMessage.js +10 -14
- package/dist/cjs/components/common/EmojiPlaceholder.js +5 -12
- package/dist/cjs/components/common/EmojiPreview.js +20 -40
- package/dist/cjs/components/common/EmojiPreviewComponent.js +34 -0
- package/dist/cjs/components/common/EmojiUploadPicker.js +26 -24
- package/dist/cjs/components/common/EmojiUploadPreview.js +22 -28
- package/dist/cjs/components/common/RecordSelectionDefault.js +8 -2
- package/dist/cjs/components/common/ResourcedEmojiComponent.js +17 -12
- package/dist/cjs/components/common/RetryableButton.js +12 -18
- package/dist/cjs/components/common/Scrollable.js +5 -10
- package/dist/cjs/components/common/UploadEmoji.js +8 -0
- package/dist/cjs/components/common/styles.js +210 -266
- package/dist/cjs/components/picker/CategorySelector.js +13 -12
- package/dist/cjs/components/picker/EmojiPicker.js +17 -6
- package/dist/cjs/components/picker/EmojiPickerCategoryHeading.js +8 -14
- package/dist/cjs/components/picker/EmojiPickerComponent.js +51 -30
- package/dist/cjs/components/picker/EmojiPickerEmojiRow.js +8 -12
- package/dist/cjs/components/picker/EmojiPickerFooter.js +8 -14
- package/dist/cjs/components/picker/EmojiPickerList.js +28 -9
- package/dist/cjs/components/picker/EmojiPickerListSearch.js +10 -8
- package/dist/cjs/components/picker/EmojiPickerVirtualItems.js +9 -15
- package/dist/cjs/components/picker/styles.js +113 -161
- package/dist/cjs/components/typeahead/EmojiTypeAheadComponent.js +40 -24
- package/dist/cjs/components/typeahead/EmojiTypeAheadItem.js +10 -13
- package/dist/cjs/components/typeahead/EmojiTypeAheadList.js +17 -22
- package/dist/cjs/components/typeahead/styles.js +17 -19
- package/dist/cjs/components/uploader/EmojiUploadComponent.js +22 -15
- package/dist/cjs/components/uploader/styles.js +4 -4
- package/dist/cjs/index.js +21 -3
- package/dist/cjs/types.js +23 -2
- package/dist/cjs/util/analytics/analytics.js +11 -41
- package/dist/cjs/util/analytics/index.js +16 -14
- package/dist/cjs/util/analytics/ufoExperiences.js +48 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/api/media/SiteEmojiResource.js +10 -2
- package/dist/es2019/components/common/CachingEmoji.js +5 -7
- package/dist/es2019/components/common/DeleteButton.js +8 -6
- package/dist/es2019/components/common/Emoji.js +19 -34
- package/dist/es2019/components/common/EmojiActions.js +26 -24
- package/dist/es2019/components/common/EmojiButton.js +6 -6
- package/dist/es2019/components/common/EmojiDeletePreview.js +20 -20
- package/dist/es2019/components/common/EmojiErrorMessage.js +9 -8
- package/dist/es2019/components/common/EmojiPlaceholder.js +5 -8
- package/dist/es2019/components/common/EmojiPreview.js +19 -35
- package/dist/es2019/components/common/EmojiPreviewComponent.js +21 -0
- package/dist/es2019/components/common/EmojiUploadPicker.js +25 -22
- package/dist/es2019/components/common/EmojiUploadPreview.js +22 -22
- package/dist/es2019/components/common/RecordSelectionDefault.js +9 -2
- package/dist/es2019/components/common/ResourcedEmojiComponent.js +16 -11
- package/dist/es2019/components/common/RetryableButton.js +10 -11
- package/dist/es2019/components/common/Scrollable.js +6 -10
- package/dist/es2019/components/common/UploadEmoji.js +4 -0
- package/dist/es2019/components/common/styles.js +195 -262
- package/dist/es2019/components/picker/CategorySelector.js +15 -12
- package/dist/es2019/components/picker/EmojiPicker.js +15 -6
- package/dist/es2019/components/picker/EmojiPickerCategoryHeading.js +8 -8
- package/dist/es2019/components/picker/EmojiPickerComponent.js +46 -22
- package/dist/es2019/components/picker/EmojiPickerEmojiRow.js +8 -7
- package/dist/es2019/components/picker/EmojiPickerFooter.js +8 -8
- package/dist/es2019/components/picker/EmojiPickerList.js +28 -8
- package/dist/es2019/components/picker/EmojiPickerListSearch.js +11 -8
- package/dist/es2019/components/picker/EmojiPickerVirtualItems.js +10 -8
- package/dist/es2019/components/picker/styles.js +112 -160
- package/dist/es2019/components/typeahead/EmojiTypeAheadComponent.js +35 -17
- package/dist/es2019/components/typeahead/EmojiTypeAheadItem.js +12 -13
- package/dist/es2019/components/typeahead/EmojiTypeAheadList.js +18 -19
- package/dist/es2019/components/typeahead/styles.js +14 -15
- package/dist/es2019/components/uploader/EmojiUploadComponent.js +19 -9
- package/dist/es2019/components/uploader/styles.js +4 -4
- package/dist/es2019/index.js +5 -4
- package/dist/es2019/types.js +20 -1
- package/dist/es2019/util/analytics/analytics.js +16 -37
- package/dist/es2019/util/analytics/index.js +2 -1
- package/dist/es2019/util/analytics/ufoExperiences.js +35 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/api/media/SiteEmojiResource.js +10 -2
- package/dist/esm/components/common/CachingEmoji.js +5 -7
- package/dist/esm/components/common/DeleteButton.js +8 -6
- package/dist/esm/components/common/Emoji.js +18 -27
- package/dist/esm/components/common/EmojiActions.js +26 -25
- package/dist/esm/components/common/EmojiButton.js +6 -6
- package/dist/esm/components/common/EmojiDeletePreview.js +19 -20
- package/dist/esm/components/common/EmojiErrorMessage.js +9 -8
- package/dist/esm/components/common/EmojiPlaceholder.js +5 -8
- package/dist/esm/components/common/EmojiPreview.js +19 -33
- package/dist/esm/components/common/EmojiPreviewComponent.js +20 -0
- package/dist/esm/components/common/EmojiUploadPicker.js +27 -25
- package/dist/esm/components/common/EmojiUploadPreview.js +21 -22
- package/dist/esm/components/common/RecordSelectionDefault.js +6 -3
- package/dist/esm/components/common/ResourcedEmojiComponent.js +16 -10
- package/dist/esm/components/common/RetryableButton.js +11 -12
- package/dist/esm/components/common/Scrollable.js +6 -10
- package/dist/esm/components/common/UploadEmoji.js +4 -0
- package/dist/esm/components/common/styles.js +192 -242
- package/dist/esm/components/picker/CategorySelector.js +14 -12
- package/dist/esm/components/picker/EmojiPicker.js +13 -6
- package/dist/esm/components/picker/EmojiPickerCategoryHeading.js +8 -8
- package/dist/esm/components/picker/EmojiPickerComponent.js +47 -22
- package/dist/esm/components/picker/EmojiPickerEmojiRow.js +8 -7
- package/dist/esm/components/picker/EmojiPickerFooter.js +8 -8
- package/dist/esm/components/picker/EmojiPickerList.js +29 -8
- package/dist/esm/components/picker/EmojiPickerListSearch.js +10 -8
- package/dist/esm/components/picker/EmojiPickerVirtualItems.js +9 -8
- package/dist/esm/components/picker/styles.js +108 -149
- package/dist/esm/components/typeahead/EmojiTypeAheadComponent.js +35 -17
- package/dist/esm/components/typeahead/EmojiTypeAheadItem.js +11 -13
- package/dist/esm/components/typeahead/EmojiTypeAheadList.js +17 -19
- package/dist/esm/components/typeahead/styles.js +14 -14
- package/dist/esm/components/uploader/EmojiUploadComponent.js +19 -9
- package/dist/esm/components/uploader/styles.js +4 -4
- package/dist/esm/index.js +5 -4
- package/dist/esm/types.js +20 -1
- package/dist/esm/util/analytics/analytics.js +8 -33
- package/dist/esm/util/analytics/index.js +2 -1
- package/dist/esm/util/analytics/ufoExperiences.js +35 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/components/common/CachingEmoji.d.ts +8 -6
- package/dist/types/components/common/EmojiActions.d.ts +2 -3
- package/dist/types/components/common/EmojiDeletePreview.d.ts +3 -3
- package/dist/types/components/common/EmojiErrorMessage.d.ts +2 -1
- package/dist/types/components/common/EmojiPreview.d.ts +2 -3
- package/dist/types/components/common/EmojiPreviewComponent.d.ts +7 -0
- package/dist/types/components/common/EmojiUploadPreview.d.ts +3 -3
- package/dist/types/components/common/ResourcedEmojiComponent.d.ts +6 -0
- package/dist/types/components/common/RetryableButton.d.ts +0 -2
- package/dist/types/components/common/styles.d.ts +44 -44
- package/dist/types/components/picker/EmojiPicker.d.ts +2 -3
- package/dist/types/components/picker/EmojiPickerComponent.d.ts +6 -0
- package/dist/types/components/picker/EmojiPickerList.d.ts +10 -0
- package/dist/types/components/picker/styles.d.ts +17 -18
- package/dist/types/components/typeahead/EmojiTypeAheadComponent.d.ts +6 -0
- package/dist/types/components/typeahead/styles.d.ts +8 -7
- package/dist/types/components/uploader/EmojiUploadComponent.d.ts +1 -0
- package/dist/types/components/uploader/styles.d.ts +2 -2
- package/dist/types/index.d.ts +4 -4
- package/dist/types/types.d.ts +13 -0
- package/dist/types/util/analytics/analytics.d.ts +3 -7
- package/dist/types/util/analytics/index.d.ts +3 -2
- package/dist/types/util/analytics/ufoExperiences.d.ts +11 -0
- package/package.json +9 -10
- package/dist/cjs/components/picker/EmojiPickerPreview.js +0 -87
- package/dist/cjs/context/EmojiContext.js +0 -11
- package/dist/cjs/context/EmojiContextProvider.js +0 -22
- package/dist/es2019/components/picker/EmojiPickerPreview.js +0 -43
- package/dist/es2019/context/EmojiContext.js +0 -2
- package/dist/es2019/context/EmojiContextProvider.js +0 -10
- package/dist/esm/components/picker/EmojiPickerPreview.js +0 -67
- package/dist/esm/context/EmojiContext.js +0 -2
- package/dist/esm/context/EmojiContextProvider.js +0 -9
- package/dist/types/components/picker/EmojiPickerPreview.d.ts +0 -9
- package/dist/types/context/EmojiContext.d.ts +0 -4
- package/dist/types/context/EmojiContextProvider.d.ts +0 -7
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { css } from '@emotion/core';
|
|
2
2
|
import { token } from '@atlaskit/tokens';
|
|
3
3
|
import { borderRadius } from '@atlaskit/theme/constants';
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import { emojiSprite, placeholder, emojiNode } from '../common/styles';
|
|
4
|
+
import { emojiPickerBorderColor, emojiPickerBoxShadow } from '../../util/shared-styles';
|
|
5
|
+
import { emojiSprite, placeholder, emojiNodeStyles } from '../common/styles';
|
|
7
6
|
import { emojiPickerHeight, emojiPickerWidth } from '../../util/constants';
|
|
8
|
-
|
|
9
|
-
export const disable = 'emoji-picker-disable'; // Level 1 - picker
|
|
7
|
+
import { B200, B300, N100A, N200, N30, N30A, N50, N900 } from '@atlaskit/theme/colors'; // Level 1 - picker
|
|
10
8
|
|
|
11
|
-
export const emojiPicker =
|
|
9
|
+
export const emojiPicker = css({
|
|
12
10
|
display: 'flex',
|
|
13
11
|
flexDirection: 'column',
|
|
14
12
|
justifyContent: 'space-between',
|
|
@@ -24,73 +22,64 @@ export const emojiPicker = style({
|
|
|
24
22
|
/// Category Selector
|
|
25
23
|
|
|
26
24
|
export const addButton = 'emoji-picker-add-button';
|
|
27
|
-
export const categorySelector =
|
|
25
|
+
export const categorySelector = css({
|
|
28
26
|
flex: '0 0 auto',
|
|
29
|
-
backgroundColor: token('elevation.surface.sunken',
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
$nest: {
|
|
44
|
-
button: {
|
|
45
|
-
verticalAlign: 'middle'
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
[`.${addButton}`]: {
|
|
50
|
-
color: token('color.text.subtlest', colors.N200),
|
|
51
|
-
margin: '0 0 0 5px',
|
|
27
|
+
backgroundColor: token('elevation.surface.sunken', N30),
|
|
28
|
+
ul: {
|
|
29
|
+
listStyle: 'none',
|
|
30
|
+
margin: '0 4px',
|
|
31
|
+
padding: '3px 0',
|
|
32
|
+
display: 'flex',
|
|
33
|
+
flexDirection: 'row',
|
|
34
|
+
justifyContent: 'space-around'
|
|
35
|
+
},
|
|
36
|
+
li: {
|
|
37
|
+
display: 'inline-block',
|
|
38
|
+
margin: 0,
|
|
39
|
+
padding: 0,
|
|
40
|
+
button: {
|
|
52
41
|
verticalAlign: 'middle'
|
|
53
42
|
}
|
|
43
|
+
},
|
|
44
|
+
[`.${addButton}`]: {
|
|
45
|
+
color: token('color.text.subtlest', N200),
|
|
46
|
+
margin: '0 0 0 5px',
|
|
47
|
+
verticalAlign: 'middle'
|
|
54
48
|
}
|
|
55
49
|
});
|
|
56
|
-
export const
|
|
50
|
+
export const active = css({
|
|
51
|
+
color: token('color.text.selected', B300),
|
|
52
|
+
['&:hover']: {
|
|
53
|
+
color: token('color.text.selected', B300)
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
export const disable = css({
|
|
57
|
+
color: token('color.text.subtlest', N50),
|
|
58
|
+
cursor: 'default',
|
|
59
|
+
['&:hover']: {
|
|
60
|
+
color: token('color.text.subtlest', N50)
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
export const categoryStyles = css({
|
|
57
64
|
backgroundColor: 'transparent',
|
|
58
65
|
border: 0,
|
|
59
|
-
color: token('color.text.subtlest',
|
|
66
|
+
color: token('color.text.subtlest', N100A),
|
|
60
67
|
cursor: 'pointer',
|
|
61
68
|
margin: '2px 0',
|
|
62
69
|
padding: 0,
|
|
63
70
|
transition: 'color 0.2s ease',
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
$nest: {
|
|
73
|
-
['&:hover']: {
|
|
74
|
-
color: token('color.text.brand', colors.B300)
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
['&:hover']: {
|
|
79
|
-
color: token('color.text.brand', colors.B200)
|
|
80
|
-
},
|
|
81
|
-
[`&.${disable}`]: {
|
|
82
|
-
color: token('color.text.subtlest', colors.N50),
|
|
83
|
-
cursor: 'default',
|
|
84
|
-
$nest: {
|
|
85
|
-
['&:hover']: {
|
|
86
|
-
color: token('color.text.subtlest', colors.N50)
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
71
|
+
|
|
72
|
+
/* Firefox */
|
|
73
|
+
['&::-moz-focus-inner']: {
|
|
74
|
+
border: '0 none',
|
|
75
|
+
padding: 0
|
|
76
|
+
},
|
|
77
|
+
['&:hover']: {
|
|
78
|
+
color: token('color.text.selected', B200)
|
|
90
79
|
}
|
|
91
80
|
}); /// EmojiPickerList
|
|
92
81
|
|
|
93
|
-
export const emojiPickerList =
|
|
82
|
+
export const emojiPickerList = css({
|
|
94
83
|
display: 'flex',
|
|
95
84
|
flexDirection: 'column',
|
|
96
85
|
flex: '1 1 auto',
|
|
@@ -98,139 +87,102 @@ export const emojiPickerList = style({
|
|
|
98
87
|
height: '0'
|
|
99
88
|
}); // react-virtualized enables focus style by default - turn it off
|
|
100
89
|
|
|
101
|
-
export const virtualList =
|
|
102
|
-
|
|
103
|
-
'
|
|
104
|
-
outline: 'none'
|
|
105
|
-
}
|
|
90
|
+
export const virtualList = css({
|
|
91
|
+
'&:focus': {
|
|
92
|
+
outline: 'none'
|
|
106
93
|
}
|
|
107
94
|
}); //// Search
|
|
108
95
|
|
|
109
|
-
export const searchIcon =
|
|
110
|
-
|
|
111
|
-
|
|
96
|
+
export const searchIcon = css({
|
|
97
|
+
opacity: 0.5
|
|
98
|
+
});
|
|
99
|
+
export const input = css({
|
|
112
100
|
boxSizing: 'border-box',
|
|
113
|
-
|
|
101
|
+
color: 'inherit',
|
|
102
|
+
cursor: 'inherit',
|
|
103
|
+
fontSize: '14px',
|
|
104
|
+
outline: 'none',
|
|
105
|
+
padding: '1px 0 2px 6px',
|
|
114
106
|
width: '100%',
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
boxSizing: 'border-box',
|
|
121
|
-
color: 'inherit',
|
|
122
|
-
cursor: 'inherit',
|
|
123
|
-
fontSize: '14px',
|
|
124
|
-
outline: 'none',
|
|
125
|
-
padding: '1px 0 2px 6px',
|
|
126
|
-
width: '100%',
|
|
127
|
-
$nest: {
|
|
128
|
-
['&:invalid']: {
|
|
129
|
-
boxShadow: 'none'
|
|
130
|
-
},
|
|
131
|
-
['&::-ms-clear']: {
|
|
132
|
-
display: 'none'
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
107
|
+
['&:invalid']: {
|
|
108
|
+
boxShadow: 'none'
|
|
109
|
+
},
|
|
110
|
+
['&::-ms-clear']: {
|
|
111
|
+
display: 'none'
|
|
136
112
|
}
|
|
113
|
+
});
|
|
114
|
+
export const pickerSearch = css({
|
|
115
|
+
boxSizing: 'border-box',
|
|
116
|
+
padding: '10px 10px 11px 10px',
|
|
117
|
+
width: '100%'
|
|
137
118
|
}); //// Loading/Spinner
|
|
138
119
|
|
|
139
|
-
export const emojiPickerSpinner =
|
|
120
|
+
export const emojiPickerSpinner = css({
|
|
140
121
|
display: 'flex',
|
|
141
122
|
width: '100%',
|
|
142
123
|
height: '150px',
|
|
143
124
|
justifyContent: 'center',
|
|
144
125
|
alignItems: 'center',
|
|
145
|
-
|
|
146
|
-
'
|
|
147
|
-
flex: '0 0 auto'
|
|
148
|
-
}
|
|
126
|
+
'>div': {
|
|
127
|
+
flex: '0 0 auto'
|
|
149
128
|
}
|
|
150
129
|
}); //// Category/Result
|
|
151
130
|
|
|
152
|
-
export const emojiPickerRow =
|
|
131
|
+
export const emojiPickerRow = css({
|
|
153
132
|
marginLeft: '8px'
|
|
154
133
|
});
|
|
155
|
-
export const emojiCategoryTitle =
|
|
134
|
+
export const emojiCategoryTitle = css({
|
|
156
135
|
boxSizing: 'border-box',
|
|
157
|
-
color: token('color.text',
|
|
136
|
+
color: token('color.text', N900),
|
|
158
137
|
fontSize: '14px',
|
|
159
138
|
padding: '5px 8px',
|
|
160
139
|
textTransform: 'lowercase',
|
|
161
|
-
|
|
162
|
-
'
|
|
163
|
-
textTransform: 'uppercase'
|
|
164
|
-
}
|
|
140
|
+
'&:first-letter': {
|
|
141
|
+
textTransform: 'uppercase'
|
|
165
142
|
}
|
|
166
143
|
});
|
|
167
|
-
export const emojiItem =
|
|
144
|
+
export const emojiItem = css({
|
|
168
145
|
display: 'inline-block',
|
|
169
146
|
textAlign: 'center',
|
|
170
147
|
width: '40px',
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
margin: '7px',
|
|
199
|
-
minWidth: '24px',
|
|
200
|
-
maxWidth: '24px'
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
|
-
export const addEmoji = style({
|
|
205
|
-
border: '2px dashed #ccc',
|
|
206
|
-
borderRadius: `${borderRadius()}px`,
|
|
207
|
-
backgroundColor: 'transparent',
|
|
208
|
-
width: '32px',
|
|
209
|
-
height: '32px',
|
|
210
|
-
padding: 0,
|
|
211
|
-
margin: '4px',
|
|
212
|
-
verticalAlign: 'middle',
|
|
213
|
-
$nest: {
|
|
214
|
-
'&:hover': {
|
|
215
|
-
backgroundColor: akEmojiSelectedBackgroundColor
|
|
216
|
-
},
|
|
217
|
-
'&:focus': {
|
|
218
|
-
outline: '0'
|
|
219
|
-
},
|
|
220
|
-
span: {
|
|
221
|
-
backgroundColor: 'inherit'
|
|
222
|
-
}
|
|
148
|
+
[`& .${emojiNodeStyles}`]: {
|
|
149
|
+
cursor: 'pointer',
|
|
150
|
+
padding: '8px',
|
|
151
|
+
borderRadius: '5px',
|
|
152
|
+
width: '24px',
|
|
153
|
+
height: '24px'
|
|
154
|
+
},
|
|
155
|
+
[`& .${placeholder}`]: {
|
|
156
|
+
padding: '0',
|
|
157
|
+
margin: '7px',
|
|
158
|
+
minWidth: '24px',
|
|
159
|
+
maxWidth: '24px'
|
|
160
|
+
},
|
|
161
|
+
// Fit non-square emoji to square
|
|
162
|
+
[`& .${emojiNodeStyles} > img`]: {
|
|
163
|
+
position: 'relative',
|
|
164
|
+
left: '50%',
|
|
165
|
+
top: '50%',
|
|
166
|
+
transform: 'translateX(-50%) translateY(-50%)',
|
|
167
|
+
maxHeight: '24px',
|
|
168
|
+
maxWidth: '24px',
|
|
169
|
+
display: 'block'
|
|
170
|
+
},
|
|
171
|
+
// Scale sprite to fit regardless of default emoji size
|
|
172
|
+
[`& .${emojiNodeStyles} > .${emojiSprite}`]: {
|
|
173
|
+
height: '24px',
|
|
174
|
+
width: '24px'
|
|
223
175
|
}
|
|
224
176
|
}); /// Footer
|
|
225
177
|
|
|
226
|
-
export const emojiPickerFooter =
|
|
178
|
+
export const emojiPickerFooter = css({
|
|
227
179
|
flex: '0 0 auto'
|
|
228
180
|
});
|
|
229
|
-
export const emojiPickerFooterWithTopShadow =
|
|
230
|
-
borderTop: `2px solid ${token('color.border',
|
|
181
|
+
export const emojiPickerFooterWithTopShadow = css({
|
|
182
|
+
borderTop: `2px solid ${token('color.border', N30A)}`,
|
|
231
183
|
boxShadow: `0px -1px 1px 0px ${token('color.border', 'rgba(0, 0, 0, 0.1)')}`
|
|
232
184
|
});
|
|
233
|
-
export const emojiActionsContainerWithBottomShadow =
|
|
234
|
-
borderBottom: `2px solid ${token('color.border',
|
|
185
|
+
export const emojiActionsContainerWithBottomShadow = css({
|
|
186
|
+
borderBottom: `2px solid ${token('color.border', N30A)}`,
|
|
235
187
|
boxShadow: `0px 1px 1px 0px ${token('color.border', 'rgba(0, 0, 0, 0.1)')}`
|
|
236
188
|
});
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
4
|
+
import { jsx } from '@emotion/core';
|
|
4
5
|
import uuid from 'uuid';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
5
7
|
import { PureComponent } from 'react';
|
|
6
8
|
import { defaultListLimit } from '../../util/constants';
|
|
7
9
|
import { toEmojiId } from '../../util/type-helpers';
|
|
8
10
|
import { SearchSort } from '../../types';
|
|
9
11
|
import debug from '../../util/logger';
|
|
10
|
-
import { typeaheadCancelledEvent, typeaheadSelectedEvent, typeaheadRenderedEvent } from '../../util/analytics';
|
|
12
|
+
import { typeaheadCancelledEvent, typeaheadSelectedEvent, typeaheadRenderedEvent, ufoExperiences } from '../../util/analytics';
|
|
11
13
|
import { createRecordSelectionDefault } from '../common/RecordSelectionDefault';
|
|
12
14
|
import EmojiList from './EmojiTypeAheadList';
|
|
13
|
-
import
|
|
14
|
-
import { EmojiContextProvider } from '../../context/EmojiContextProvider';
|
|
15
|
+
import { emojiTypeAhead } from './styles';
|
|
15
16
|
|
|
16
17
|
const isFullShortName = query => query && query.length > 1 && query.charAt(0) === ':' && query.charAt(query.length - 1) === ':';
|
|
17
18
|
|
|
@@ -88,6 +89,11 @@ export default class EmojiTypeAheadComponent extends PureComponent {
|
|
|
88
89
|
const wasVisible = this.state.visible;
|
|
89
90
|
const visible = emojis.length > 0;
|
|
90
91
|
this.fireAnalyticsEvent(typeaheadRenderedEvent(Date.now() - this.renderStartTime, query, emojis));
|
|
92
|
+
ufoExperiences['emoji-searched'].success({
|
|
93
|
+
metadata: {
|
|
94
|
+
emojisLength: emojis.length
|
|
95
|
+
}
|
|
96
|
+
});
|
|
91
97
|
debug('emoji-typeahead.applyPropChanges', emojis.length, wasVisible, visible);
|
|
92
98
|
this.setState({
|
|
93
99
|
emojis: emojis,
|
|
@@ -144,6 +150,14 @@ export default class EmojiTypeAheadComponent extends PureComponent {
|
|
|
144
150
|
this.selected = false;
|
|
145
151
|
}
|
|
146
152
|
|
|
153
|
+
getChildContext() {
|
|
154
|
+
return {
|
|
155
|
+
emoji: {
|
|
156
|
+
emojiProvider: this.props.emojiProvider
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
|
|
147
161
|
componentDidMount() {
|
|
148
162
|
const {
|
|
149
163
|
emojiProvider
|
|
@@ -166,6 +180,8 @@ export default class EmojiTypeAheadComponent extends PureComponent {
|
|
|
166
180
|
this.fireAnalyticsEvent(typeaheadCancelledEvent(Date.now() - this.openTime, query, emojis));
|
|
167
181
|
}
|
|
168
182
|
|
|
183
|
+
ufoExperiences['emoji-searched'].abort();
|
|
184
|
+
ufoExperiences['emoji-selection-recorded'].abort();
|
|
169
185
|
this.sessionId = uuid();
|
|
170
186
|
this.selected = false;
|
|
171
187
|
}
|
|
@@ -209,6 +225,11 @@ export default class EmojiTypeAheadComponent extends PureComponent {
|
|
|
209
225
|
options.sort = SearchSort.UsageFrequency;
|
|
210
226
|
}
|
|
211
227
|
|
|
228
|
+
ufoExperiences['emoji-searched'].start();
|
|
229
|
+
ufoExperiences['emoji-searched'].addMetadata({
|
|
230
|
+
queryLength: (query === null || query === void 0 ? void 0 : query.length) || 0,
|
|
231
|
+
source: 'typeahead'
|
|
232
|
+
});
|
|
212
233
|
this.renderStartTime = Date.now();
|
|
213
234
|
emojiProvider.filter(query, options);
|
|
214
235
|
}
|
|
@@ -244,27 +265,24 @@ export default class EmojiTypeAheadComponent extends PureComponent {
|
|
|
244
265
|
const style = {
|
|
245
266
|
display: visible ? 'block' : 'none'
|
|
246
267
|
};
|
|
247
|
-
|
|
248
|
-
const emojiContextValue = {
|
|
249
|
-
emoji: {
|
|
250
|
-
emojiProvider: this.props.emojiProvider
|
|
251
|
-
}
|
|
252
|
-
};
|
|
253
|
-
return /*#__PURE__*/React.createElement(EmojiContextProvider, {
|
|
254
|
-
emojiContextValue: emojiContextValue
|
|
255
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
268
|
+
return jsx("div", {
|
|
256
269
|
style: style,
|
|
257
|
-
className:
|
|
258
|
-
|
|
270
|
+
className: 'ak-emoji-typeahead',
|
|
271
|
+
css: emojiTypeAhead
|
|
272
|
+
}, jsx(EmojiList, {
|
|
259
273
|
emojis: emojis,
|
|
260
274
|
onEmojiSelected: recordUsageOnSelection,
|
|
261
275
|
ref: this.onEmojiListRef,
|
|
262
276
|
loading: loading
|
|
263
|
-
}))
|
|
277
|
+
}));
|
|
264
278
|
}
|
|
265
279
|
|
|
266
280
|
}
|
|
267
281
|
|
|
282
|
+
_defineProperty(EmojiTypeAheadComponent, "childContextTypes", {
|
|
283
|
+
emoji: PropTypes.object
|
|
284
|
+
});
|
|
285
|
+
|
|
268
286
|
_defineProperty(EmojiTypeAheadComponent, "defaultProps", {
|
|
269
287
|
onSelection: () => {},
|
|
270
288
|
onOpen: () => {},
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
4
|
+
import { jsx } from '@emotion/core';
|
|
3
5
|
import React from 'react';
|
|
4
6
|
import { PureComponent } from 'react';
|
|
5
7
|
import { toEmojiId } from '../../util/type-helpers';
|
|
6
8
|
import { leftClick } from '../../util/mouse';
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
+
import { EmojiPreviewComponent } from '../common/EmojiPreviewComponent';
|
|
10
|
+
import { typeAheadItem, selected as selectedStyles, typeAheadItemRow, typeaheadSelected } from './styles';
|
|
9
11
|
export default class EmojiTypeAheadItem extends PureComponent {
|
|
10
12
|
constructor(...args) {
|
|
11
13
|
super(...args);
|
|
@@ -39,19 +41,16 @@ export default class EmojiTypeAheadItem extends PureComponent {
|
|
|
39
41
|
selected,
|
|
40
42
|
emoji
|
|
41
43
|
} = this.props;
|
|
42
|
-
const classes =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
});
|
|
47
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
48
|
-
className: classes,
|
|
44
|
+
const classes = [typeAheadItem, selected && selectedStyles];
|
|
45
|
+
return jsx("div", {
|
|
46
|
+
className: `ak-emoji-typeahead-item ${selected ? typeaheadSelected : ''}`,
|
|
47
|
+
css: classes,
|
|
49
48
|
onMouseDown: this.onEmojiSelected,
|
|
50
49
|
onMouseMove: this.onEmojiMenuItemMouseMove,
|
|
51
50
|
"data-emoji-id": emoji.shortName
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
},
|
|
51
|
+
}, jsx("div", {
|
|
52
|
+
css: typeAheadItemRow
|
|
53
|
+
}, emoji && jsx(EmojiPreviewComponent, {
|
|
55
54
|
emoji: emoji
|
|
56
55
|
})));
|
|
57
56
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
4
|
+
import { jsx } from '@emotion/core';
|
|
2
5
|
import Spinner from '@atlaskit/spinner';
|
|
3
|
-
import classNames from 'classnames';
|
|
4
6
|
import React from 'react';
|
|
5
7
|
import { PureComponent } from 'react';
|
|
6
8
|
import { emojiTypeAheadMaxHeight } from '../../util/shared-styles';
|
|
@@ -9,7 +11,7 @@ import debug from '../../util/logger';
|
|
|
9
11
|
import { actualMouseMove, mouseLocation } from '../../util/mouse';
|
|
10
12
|
import Scrollable from '../common/Scrollable';
|
|
11
13
|
import EmojiItem from './EmojiTypeAheadItem';
|
|
12
|
-
import
|
|
14
|
+
import { emojiTypeAheadSpinner, emojiTypeAheadSpinnerContainer, typeAheadEmpty, typeAheadList, typeAheadListContainer } from './styles';
|
|
13
15
|
|
|
14
16
|
function wrapIndex(emojis, index) {
|
|
15
17
|
const len = emojis.length;
|
|
@@ -192,9 +194,9 @@ export default class EmojiTypeAheadList extends PureComponent {
|
|
|
192
194
|
renderItems(emojis) {
|
|
193
195
|
if (emojis && emojis.length) {
|
|
194
196
|
this.items = {};
|
|
195
|
-
return
|
|
197
|
+
return jsx("div", null, emojis.map((emoji, idx) => {
|
|
196
198
|
const key = getKey(emoji);
|
|
197
|
-
const item =
|
|
199
|
+
const item = jsx(EmojiItem, {
|
|
198
200
|
emoji: emoji,
|
|
199
201
|
key: key,
|
|
200
202
|
selected: this.isSelectedEmoji(emoji, idx),
|
|
@@ -228,30 +230,27 @@ export default class EmojiTypeAheadList extends PureComponent {
|
|
|
228
230
|
loading
|
|
229
231
|
} = this.props;
|
|
230
232
|
const hasEmoji = emojis && emojis.length;
|
|
231
|
-
const classes =
|
|
232
|
-
'ak-emoji-typeahead-list': true,
|
|
233
|
-
[styles.typeAheadList]: true,
|
|
234
|
-
[styles.typeAheadEmpty]: !hasEmoji && !loading
|
|
235
|
-
});
|
|
233
|
+
const classes = [typeAheadList, !hasEmoji && !loading && typeAheadEmpty];
|
|
236
234
|
let listBody;
|
|
237
235
|
|
|
238
236
|
if (loading) {
|
|
239
|
-
listBody =
|
|
240
|
-
|
|
241
|
-
},
|
|
242
|
-
|
|
243
|
-
},
|
|
237
|
+
listBody = jsx("div", {
|
|
238
|
+
css: emojiTypeAheadSpinnerContainer
|
|
239
|
+
}, jsx("div", {
|
|
240
|
+
css: emojiTypeAheadSpinner
|
|
241
|
+
}, jsx(Spinner, {
|
|
244
242
|
size: "medium"
|
|
245
243
|
})));
|
|
246
244
|
} else {
|
|
247
245
|
listBody = this.renderItems(emojis);
|
|
248
246
|
}
|
|
249
247
|
|
|
250
|
-
return
|
|
251
|
-
|
|
252
|
-
},
|
|
253
|
-
className:
|
|
254
|
-
|
|
248
|
+
return jsx("div", {
|
|
249
|
+
css: typeAheadListContainer
|
|
250
|
+
}, jsx("div", {
|
|
251
|
+
className: 'ak-emoji-typeahead-list',
|
|
252
|
+
css: classes
|
|
253
|
+
}, jsx(Scrollable, {
|
|
255
254
|
ref: this.handleScrollableRef,
|
|
256
255
|
maxHeight: `${emojiTypeAheadMaxHeight}px`
|
|
257
256
|
}, listBody)));
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { css } from '@emotion/core';
|
|
2
2
|
import { token } from '@atlaskit/tokens';
|
|
3
3
|
import { emojiPreviewSelectedColor, emojiTypeAheadMaxHeight, emojiTypeAheadWidth, noDialogContainerBorderColor, noDialogContainerBorderRadius, noDialogContainerBoxShadow } from '../../util/shared-styles';
|
|
4
|
-
export const selected = 'emoji-typeahead-selected';
|
|
5
4
|
export const emojiTypeAhead = 'emoji-typeahead-element';
|
|
6
|
-
export const typeAheadListContainer = 'emoji-typeahead-list-container';
|
|
7
|
-
|
|
5
|
+
export const typeAheadListContainer = 'emoji-typeahead-list-container'; // editor-core is using this static class name for testing
|
|
6
|
+
|
|
7
|
+
export const typeaheadSelected = 'emoji-typeahead-selected';
|
|
8
|
+
export const typeAheadList = css({
|
|
8
9
|
background: token('elevation.surface.overlay', 'white'),
|
|
9
10
|
border: `1px solid ${noDialogContainerBorderColor}`,
|
|
10
11
|
borderRadius: noDialogContainerBorderRadius,
|
|
@@ -12,33 +13,31 @@ export const typeAheadList = style({
|
|
|
12
13
|
color: token('color.text.subtle', '#333'),
|
|
13
14
|
width: emojiTypeAheadWidth
|
|
14
15
|
});
|
|
15
|
-
export const typeAheadEmpty =
|
|
16
|
+
export const typeAheadEmpty = css({
|
|
16
17
|
display: 'none'
|
|
17
18
|
});
|
|
18
|
-
export const
|
|
19
|
+
export const selected = css({
|
|
20
|
+
backgroundColor: emojiPreviewSelectedColor
|
|
21
|
+
});
|
|
22
|
+
export const typeAheadItem = css({
|
|
19
23
|
cursor: 'pointer',
|
|
20
24
|
display: 'block',
|
|
21
25
|
listStyleType: 'none',
|
|
22
26
|
overflow: 'hidden',
|
|
23
|
-
width: emojiTypeAheadWidth
|
|
24
|
-
$nest: {
|
|
25
|
-
[`&.${selected}`]: {
|
|
26
|
-
backgroundColor: emojiPreviewSelectedColor
|
|
27
|
-
}
|
|
28
|
-
}
|
|
27
|
+
width: emojiTypeAheadWidth
|
|
29
28
|
});
|
|
30
|
-
export const typeAheadItemRow =
|
|
29
|
+
export const typeAheadItemRow = css({
|
|
31
30
|
display: 'flex',
|
|
32
31
|
flexDirection: 'row',
|
|
33
32
|
flexWrap: 'wrap',
|
|
34
33
|
verticalAlign: 'middle'
|
|
35
34
|
});
|
|
36
|
-
export const emojiTypeAheadSpinnerContainer =
|
|
35
|
+
export const emojiTypeAheadSpinnerContainer = css({
|
|
37
36
|
position: 'relative',
|
|
38
37
|
height: `${emojiTypeAheadMaxHeight}px`,
|
|
39
38
|
paddingTop: `${((emojiTypeAheadMaxHeight - 30) / 2).toFixed()}px`,
|
|
40
39
|
boxSizing: 'border-box'
|
|
41
40
|
});
|
|
42
|
-
export const emojiTypeAheadSpinner =
|
|
41
|
+
export const emojiTypeAheadSpinner = css({
|
|
43
42
|
textAlign: 'center'
|
|
44
43
|
});
|