box-ui-elements 20.0.0 → 20.0.1-beta.2
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/dist/explorer.css +1 -1
- package/dist/explorer.js +1 -1
- package/dist/openwith.js +1 -1
- package/dist/picker.js +1 -1
- package/dist/preview.css +1 -1
- package/dist/preview.js +1 -1
- package/dist/sharing.js +1 -1
- package/dist/sidebar.css +1 -1
- package/dist/sidebar.js +1 -1
- package/dist/uploader.js +1 -1
- package/es/components/contact-datalist-item/ContactDatalistItem.js +4 -2
- package/es/components/contact-datalist-item/ContactDatalistItem.js.map +1 -1
- package/es/components/pill-selector-dropdown/PillSelector.js +2 -1
- package/es/components/pill-selector-dropdown/PillSelector.js.flow +1 -0
- package/es/components/pill-selector-dropdown/PillSelector.js.map +1 -1
- package/es/components/pill-selector-dropdown/RoundPill.js +4 -2
- package/es/components/pill-selector-dropdown/RoundPill.js.flow +3 -2
- package/es/components/pill-selector-dropdown/RoundPill.js.map +1 -1
- package/es/components/pill-selector-dropdown/flowTypes.js.flow +1 -0
- package/es/components/pill-selector-dropdown/flowTypes.js.map +1 -1
- package/es/elements/common/messages.js +1 -1
- package/es/elements/common/messages.js.flow +1 -1
- package/es/elements/common/messages.js.map +1 -1
- package/es/elements/content-sidebar/additional-tabs/AdditionalTab.scss +2 -0
- package/es/features/unified-share-modal/ContactsField.js +3 -1
- package/es/features/unified-share-modal/ContactsField.js.flow +2 -1
- package/es/features/unified-share-modal/ContactsField.js.map +1 -1
- package/es/src/components/contact-datalist-item/ContactDatalistItem.d.ts +1 -0
- package/es/src/features/unified-share-modal/types.d.ts +1 -1
- package/i18n/en-CA.js +1 -1
- package/i18n/en-CA.properties +1 -1
- package/i18n/en-US.js +1 -1
- package/i18n/en-US.properties +1 -1
- package/i18n/en-x-pseudo.js +955 -955
- package/i18n/en-x-pseudo.properties +968 -942
- package/package.json +1 -1
- package/src/components/contact-datalist-item/ContactDatalistItem.tsx +3 -1
- package/src/components/contact-datalist-item/__tests__/ContactDatalistItem.test.tsx +29 -0
- package/src/components/pill-selector-dropdown/PillSelector.js +1 -0
- package/src/components/pill-selector-dropdown/RoundPill.js +3 -2
- package/src/components/pill-selector-dropdown/__tests__/RoundPill.test.js +19 -1
- package/src/components/pill-selector-dropdown/flowTypes.js +1 -0
- package/src/elements/common/messages.js +1 -1
- package/src/elements/content-preview/__tests__/__snapshots__/PreviewError.test.js.snap +1 -1
- package/src/elements/content-sidebar/additional-tabs/AdditionalTab.scss +2 -0
- package/src/features/unified-share-modal/ContactsField.js +2 -1
- package/src/features/unified-share-modal/__tests__/__snapshots__/ContactsField.test.js.snap +9 -0
- package/src/features/unified-share-modal/types.ts +1 -1
package/package.json
CHANGED
|
@@ -15,6 +15,7 @@ export interface ContactDatalistItemProps {
|
|
|
15
15
|
name: string | null | undefined;
|
|
16
16
|
showAvatar?: boolean;
|
|
17
17
|
subtitle?: React.ReactNode;
|
|
18
|
+
type?: string | null | undefined;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
interface ContactDatalistItemState {
|
|
@@ -48,11 +49,12 @@ class ContactDatalistItem extends React.PureComponent<ContactDatalistItemProps,
|
|
|
48
49
|
* @return {void}
|
|
49
50
|
*/
|
|
50
51
|
getAvatarUrl() {
|
|
51
|
-
const { getContactAvatarUrl, id } = this.props;
|
|
52
|
+
const { getContactAvatarUrl, id, type } = this.props;
|
|
52
53
|
Promise.resolve(
|
|
53
54
|
getContactAvatarUrl && id
|
|
54
55
|
? getContactAvatarUrl({
|
|
55
56
|
id,
|
|
57
|
+
type,
|
|
56
58
|
})
|
|
57
59
|
: undefined,
|
|
58
60
|
)
|
|
@@ -79,5 +79,34 @@ describe('components/contact-datalist-item/ContactDatalistItem', () => {
|
|
|
79
79
|
expect(wrapper.find(Avatar).length).toBe(1);
|
|
80
80
|
expect(wrapper.find(Avatar).props().avatarUrl).toBeUndefined();
|
|
81
81
|
});
|
|
82
|
+
|
|
83
|
+
test.each([['user'], [undefined], [null]])('should have avatar URL when the type prop is %s', type => {
|
|
84
|
+
const contactID = '123';
|
|
85
|
+
const getContactAvatarUrlMock = jest
|
|
86
|
+
.fn()
|
|
87
|
+
.mockImplementation(() => Promise.resolve(`/test?id=${contactID}`));
|
|
88
|
+
const wrapper = shallow(
|
|
89
|
+
<ContactDatalistItem
|
|
90
|
+
name="name"
|
|
91
|
+
id={contactID}
|
|
92
|
+
type={type}
|
|
93
|
+
showAvatar
|
|
94
|
+
getContactAvatarUrl={getContactAvatarUrlMock}
|
|
95
|
+
/>,
|
|
96
|
+
);
|
|
97
|
+
expect(wrapper.state('avatarUrl')).toBe(undefined);
|
|
98
|
+
const instance = wrapper.instance();
|
|
99
|
+
|
|
100
|
+
if (instance.componentDidMount) {
|
|
101
|
+
instance.componentDidMount();
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
setImmediate(() => {
|
|
105
|
+
wrapper.update();
|
|
106
|
+
expect(wrapper.find('LabelPillIcon').length).toBe(2);
|
|
107
|
+
expect(wrapper.find('LabelPillIcon[avatarUrl]').length).toBe(1);
|
|
108
|
+
expect(getContactAvatarUrlMock).toHaveBeenCalledWith({ id: contactID, type });
|
|
109
|
+
});
|
|
110
|
+
});
|
|
82
111
|
});
|
|
83
112
|
});
|
|
@@ -22,6 +22,7 @@ type Props = {
|
|
|
22
22
|
onRemove: () => any,
|
|
23
23
|
showAvatar?: boolean,
|
|
24
24
|
text: string,
|
|
25
|
+
type?: string | null,
|
|
25
26
|
};
|
|
26
27
|
|
|
27
28
|
type State = {
|
|
@@ -82,8 +83,8 @@ class RoundPill extends React.PureComponent<Props, State> {
|
|
|
82
83
|
* @return {void}
|
|
83
84
|
*/
|
|
84
85
|
getAvatarUrl() {
|
|
85
|
-
const { getPillImageUrl, id } = this.props;
|
|
86
|
-
Promise.resolve(getPillImageUrl && id ? getPillImageUrl({ id }) : undefined)
|
|
86
|
+
const { getPillImageUrl, id, type } = this.props;
|
|
87
|
+
Promise.resolve(getPillImageUrl && id ? getPillImageUrl({ id, type }) : undefined)
|
|
87
88
|
.then(this.getAvatarUrlHandler)
|
|
88
89
|
.catch(() => {
|
|
89
90
|
// noop
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
2
|
import RoundPill from '../RoundPill';
|
|
4
3
|
|
|
5
4
|
describe('components/RoundPill-selector-dropdown/RoundPill', () => {
|
|
@@ -113,4 +112,23 @@ describe('components/RoundPill-selector-dropdown/RoundPill', () => {
|
|
|
113
112
|
expect(wrapper.find('LabelPillIcon').length).toBe(2);
|
|
114
113
|
expect(wrapper.find('LabelPillIcon[avatarUrl]').length).toBe(0);
|
|
115
114
|
});
|
|
115
|
+
|
|
116
|
+
test.each([['user'], [undefined], [null]])('should have avatar URL when the type prop is %s', type => {
|
|
117
|
+
const contactID = '123';
|
|
118
|
+
const getPillImageUrlMock = jest.fn().mockImplementation(() => Promise.resolve(`/test?id=${contactID}`));
|
|
119
|
+
const wrapper = shallow(
|
|
120
|
+
<RoundPill name="name" id={contactID} type={type} showAvatar getPillImageUrl={getPillImageUrlMock} />,
|
|
121
|
+
);
|
|
122
|
+
expect(wrapper.state('avatarUrl')).toBe(undefined);
|
|
123
|
+
const instance = wrapper.instance();
|
|
124
|
+
|
|
125
|
+
instance.componentDidMount();
|
|
126
|
+
|
|
127
|
+
setImmediate(() => {
|
|
128
|
+
wrapper.update();
|
|
129
|
+
expect(wrapper.find('LabelPillIcon').length).toBe(2);
|
|
130
|
+
expect(wrapper.find('LabelPillIcon[avatarUrl]').length).toBe(1);
|
|
131
|
+
expect(getPillImageUrlMock).toHaveBeenCalledWith({ id: contactID, type });
|
|
132
|
+
});
|
|
133
|
+
});
|
|
116
134
|
});
|
|
@@ -35,7 +35,7 @@ const messages = defineMessages({
|
|
|
35
35
|
previewError: {
|
|
36
36
|
id: 'be.previewError',
|
|
37
37
|
description: 'Error message when Preview fails due to the files call.',
|
|
38
|
-
defaultMessage: '
|
|
38
|
+
defaultMessage: 'This preview didn’t load. Please try to open or download the file to view.',
|
|
39
39
|
},
|
|
40
40
|
previewErrorBlockedByPolicy: {
|
|
41
41
|
id: 'be.previewErrorBlockedByPolicy',
|
|
@@ -12,7 +12,7 @@ exports[`elements/content-preview/PreviewError render() should render correctly
|
|
|
12
12
|
className="bcpr-PreviewError-message"
|
|
13
13
|
>
|
|
14
14
|
<FormattedMessage
|
|
15
|
-
defaultMessage="
|
|
15
|
+
defaultMessage="This preview didn’t load. Please try to open or download the file to view."
|
|
16
16
|
id="be.previewError"
|
|
17
17
|
/>
|
|
18
18
|
</div>
|
|
@@ -215,11 +215,12 @@ class ContactsField extends React.Component<Props, State> {
|
|
|
215
215
|
validateForError={validateForError}
|
|
216
216
|
validator={validator}
|
|
217
217
|
>
|
|
218
|
-
{contacts.map(({ email, isExternalUser, text = null, id }) => (
|
|
218
|
+
{contacts.map(({ email, isExternalUser, text = null, id, type }) => (
|
|
219
219
|
<ContactDatalistItem
|
|
220
220
|
getContactAvatarUrl={getContactAvatarUrl}
|
|
221
221
|
key={id}
|
|
222
222
|
id={id}
|
|
223
|
+
type={type}
|
|
223
224
|
isExternal={isExternalUser}
|
|
224
225
|
name={text}
|
|
225
226
|
subtitle={email || groupLabel}
|
|
@@ -155,6 +155,7 @@ exports[`features/unified-share-modal/ContactsField render should have scrollabl
|
|
|
155
155
|
showAvatar={false}
|
|
156
156
|
subtitle="w@example.com"
|
|
157
157
|
title="W User"
|
|
158
|
+
type="user"
|
|
158
159
|
/>
|
|
159
160
|
<ContactDatalistItem
|
|
160
161
|
id="12345"
|
|
@@ -164,6 +165,7 @@ exports[`features/unified-share-modal/ContactsField render should have scrollabl
|
|
|
164
165
|
showAvatar={false}
|
|
165
166
|
subtitle="x@example.com"
|
|
166
167
|
title="X User"
|
|
168
|
+
type="group"
|
|
167
169
|
/>
|
|
168
170
|
<ContactDatalistItem
|
|
169
171
|
id="23456"
|
|
@@ -173,6 +175,7 @@ exports[`features/unified-share-modal/ContactsField render should have scrollabl
|
|
|
173
175
|
showAvatar={false}
|
|
174
176
|
subtitle="y@example.com"
|
|
175
177
|
title="Y User"
|
|
178
|
+
type="user"
|
|
176
179
|
/>
|
|
177
180
|
<ContactDatalistItem
|
|
178
181
|
id="34567"
|
|
@@ -182,6 +185,7 @@ exports[`features/unified-share-modal/ContactsField render should have scrollabl
|
|
|
182
185
|
showAvatar={false}
|
|
183
186
|
subtitle="z@example.com"
|
|
184
187
|
title="Z User"
|
|
188
|
+
type="user"
|
|
185
189
|
/>
|
|
186
190
|
<ContactDatalistItem
|
|
187
191
|
id="12"
|
|
@@ -191,6 +195,7 @@ exports[`features/unified-share-modal/ContactsField render should have scrollabl
|
|
|
191
195
|
showAvatar={false}
|
|
192
196
|
subtitle="a@example.com"
|
|
193
197
|
title="a b"
|
|
198
|
+
type="user"
|
|
194
199
|
/>
|
|
195
200
|
<ContactDatalistItem
|
|
196
201
|
id="13"
|
|
@@ -200,6 +205,7 @@ exports[`features/unified-share-modal/ContactsField render should have scrollabl
|
|
|
200
205
|
showAvatar={false}
|
|
201
206
|
subtitle="b@example.com"
|
|
202
207
|
title="a b"
|
|
208
|
+
type="user"
|
|
203
209
|
/>
|
|
204
210
|
<ContactDatalistItem
|
|
205
211
|
id="14"
|
|
@@ -209,6 +215,7 @@ exports[`features/unified-share-modal/ContactsField render should have scrollabl
|
|
|
209
215
|
showAvatar={false}
|
|
210
216
|
subtitle="c@example.com"
|
|
211
217
|
title="a c"
|
|
218
|
+
type="user"
|
|
212
219
|
/>
|
|
213
220
|
<ContactDatalistItem
|
|
214
221
|
id="14"
|
|
@@ -218,6 +225,7 @@ exports[`features/unified-share-modal/ContactsField render should have scrollabl
|
|
|
218
225
|
showAvatar={false}
|
|
219
226
|
subtitle="d@example.com"
|
|
220
227
|
title="a d"
|
|
228
|
+
type="user"
|
|
221
229
|
/>
|
|
222
230
|
<ContactDatalistItem
|
|
223
231
|
id="14"
|
|
@@ -227,6 +235,7 @@ exports[`features/unified-share-modal/ContactsField render should have scrollabl
|
|
|
227
235
|
showAvatar={false}
|
|
228
236
|
subtitle="e@example.com"
|
|
229
237
|
title="a e"
|
|
238
|
+
type="user"
|
|
230
239
|
/>
|
|
231
240
|
</PillSelectorDropdown>
|
|
232
241
|
`;
|