@atlaskit/share 3.7.0 → 3.7.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/CHANGELOG.md +12 -0
- package/dist/cjs/clients/AtlassianUrlShortenerClient.js +0 -22
- package/dist/cjs/clients/ShareServiceClient.js +1 -12
- package/dist/cjs/clients/index.js +0 -1
- package/dist/cjs/components/CommentField.js +0 -9
- package/dist/cjs/components/CopyLinkButton.js +8 -48
- package/dist/cjs/components/ErrorBoundary.js +0 -26
- package/dist/cjs/components/IntegrationButton.js +3 -15
- package/dist/cjs/components/IntegrationForm.js +8 -17
- package/dist/cjs/components/LazyShareForm/LazyShareForm.js +38 -61
- package/dist/cjs/components/LazyShareForm/index.js +0 -2
- package/dist/cjs/components/LazyShareForm/lazy.js +4 -18
- package/dist/cjs/components/MessagesIntlProvider.js +1 -14
- package/dist/cjs/components/ShareButton.js +1 -9
- package/dist/cjs/components/ShareDialogContainer.js +56 -123
- package/dist/cjs/components/ShareDialogWithTrigger.js +85 -161
- package/dist/cjs/components/ShareForm.js +41 -100
- package/dist/cjs/components/ShareFormWrapper/ShareFormWrapper.js +5 -11
- package/dist/cjs/components/ShareFormWrapper/index.js +0 -2
- package/dist/cjs/components/ShareFormWrapper/styled.js +2 -9
- package/dist/cjs/components/ShareHeader.js +0 -14
- package/dist/cjs/components/SlackIcon.js +0 -4
- package/dist/cjs/components/SplitButton.js +18 -43
- package/dist/cjs/components/UserPickerField.js +20 -70
- package/dist/cjs/components/analytics/analytics.js +6 -39
- package/dist/cjs/components/analytics/ufoExperienceHelper.js +0 -4
- package/dist/cjs/components/analytics/ufoExperiences.js +0 -2
- package/dist/cjs/components/colorSlackIcon.js +0 -4
- package/dist/cjs/components/localStorageUtils.js +0 -11
- package/dist/cjs/components/monochromeSlackIcon.js +2 -4
- package/dist/cjs/components/styles.js +2 -16
- package/dist/cjs/components/utils.js +4 -19
- package/dist/cjs/i18n/cs.js +0 -1
- package/dist/cjs/i18n/da.js +1 -2
- package/dist/cjs/i18n/de.js +0 -1
- package/dist/cjs/i18n/en.js +29 -22
- package/dist/cjs/i18n/en_GB.js +29 -22
- package/dist/cjs/i18n/en_ZZ.js +0 -1
- package/dist/cjs/i18n/es.js +0 -1
- package/dist/cjs/i18n/et.js +0 -1
- package/dist/cjs/i18n/fi.js +0 -1
- package/dist/cjs/i18n/fr.js +0 -1
- package/dist/cjs/i18n/hu.js +0 -1
- package/dist/cjs/i18n/index.js +0 -31
- package/dist/cjs/i18n/is.js +0 -1
- package/dist/cjs/i18n/it.js +0 -1
- package/dist/cjs/i18n/ja.js +0 -1
- package/dist/cjs/i18n/ko.js +0 -1
- package/dist/cjs/i18n/languages.js +0 -1
- package/dist/cjs/i18n/nb.js +0 -1
- package/dist/cjs/i18n/nl.js +0 -1
- package/dist/cjs/i18n/pl.js +0 -1
- package/dist/cjs/i18n/pt_BR.js +0 -1
- package/dist/cjs/i18n/pt_PT.js +0 -1
- package/dist/cjs/i18n/ro.js +0 -1
- package/dist/cjs/i18n/ru.js +0 -1
- package/dist/cjs/i18n/sk.js +0 -1
- package/dist/cjs/i18n/sv.js +0 -1
- package/dist/cjs/i18n/th.js +0 -1
- package/dist/cjs/i18n/tr.js +0 -1
- package/dist/cjs/i18n/uk.js +0 -1
- package/dist/cjs/i18n/vi.js +0 -1
- package/dist/cjs/i18n/zh.js +0 -1
- package/dist/cjs/i18n/zh_TW.js +0 -1
- package/dist/cjs/i18n.js +2 -3
- package/dist/cjs/index.js +0 -3
- package/dist/cjs/types/ShareEntities.js +0 -1
- package/dist/cjs/types/index.js +0 -2
- package/dist/cjs/util/i18n-util.js +2 -8
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/clients/AtlassianUrlShortenerClient.js +0 -6
- package/dist/es2019/clients/ShareServiceClient.js +1 -4
- package/dist/es2019/components/CopyLinkButton.js +2 -13
- package/dist/es2019/components/ErrorBoundary.js +0 -10
- package/dist/es2019/components/IntegrationButton.js +0 -2
- package/dist/es2019/components/LazyShareForm/LazyShareForm.js +5 -14
- package/dist/es2019/components/LazyShareForm/lazy.js +3 -5
- package/dist/es2019/components/MessagesIntlProvider.js +2 -3
- package/dist/es2019/components/ShareDialogContainer.js +21 -59
- package/dist/es2019/components/ShareDialogWithTrigger.js +29 -68
- package/dist/es2019/components/ShareForm.js +4 -24
- package/dist/es2019/components/ShareFormWrapper/ShareFormWrapper.js +0 -2
- package/dist/es2019/components/ShareFormWrapper/styled.js +2 -1
- package/dist/es2019/components/SlackIcon.js +0 -2
- package/dist/es2019/components/SplitButton.js +2 -5
- package/dist/es2019/components/UserPickerField.js +2 -23
- package/dist/es2019/components/analytics/analytics.js +9 -13
- package/dist/es2019/components/analytics/ufoExperienceHelper.js +0 -2
- package/dist/es2019/components/colorSlackIcon.js +0 -2
- package/dist/es2019/components/localStorageUtils.js +0 -3
- package/dist/es2019/components/monochromeSlackIcon.js +2 -2
- package/dist/es2019/components/styles.js +3 -2
- package/dist/es2019/components/utils.js +7 -8
- package/dist/es2019/i18n/da.js +1 -1
- package/dist/es2019/i18n/en.js +29 -21
- package/dist/es2019/i18n/en_GB.js +29 -21
- package/dist/es2019/i18n.js +2 -1
- package/dist/es2019/index.js +2 -1
- package/dist/es2019/types/ShareEntities.js +1 -1
- package/dist/es2019/util/i18n-util.js +1 -5
- package/dist/es2019/version.json +1 -1
- package/dist/esm/clients/AtlassianUrlShortenerClient.js +0 -16
- package/dist/esm/clients/ShareServiceClient.js +1 -7
- package/dist/esm/components/CopyLinkButton.js +8 -31
- package/dist/esm/components/ErrorBoundary.js +0 -18
- package/dist/esm/components/IntegrationButton.js +3 -8
- package/dist/esm/components/IntegrationForm.js +8 -10
- package/dist/esm/components/LazyShareForm/LazyShareForm.js +38 -47
- package/dist/esm/components/LazyShareForm/lazy.js +5 -7
- package/dist/esm/components/MessagesIntlProvider.js +1 -6
- package/dist/esm/components/ShareButton.js +1 -2
- package/dist/esm/components/ShareDialogContainer.js +56 -108
- package/dist/esm/components/ShareDialogWithTrigger.js +89 -157
- package/dist/esm/components/ShareForm.js +41 -74
- package/dist/esm/components/ShareFormWrapper/ShareFormWrapper.js +5 -7
- package/dist/esm/components/ShareFormWrapper/styled.js +2 -1
- package/dist/esm/components/ShareHeader.js +0 -2
- package/dist/esm/components/SlackIcon.js +0 -2
- package/dist/esm/components/SplitButton.js +18 -24
- package/dist/esm/components/UserPickerField.js +20 -54
- package/dist/esm/components/analytics/analytics.js +6 -15
- package/dist/esm/components/analytics/ufoExperienceHelper.js +0 -2
- package/dist/esm/components/colorSlackIcon.js +0 -2
- package/dist/esm/components/localStorageUtils.js +0 -3
- package/dist/esm/components/monochromeSlackIcon.js +2 -2
- package/dist/esm/components/styles.js +2 -7
- package/dist/esm/components/utils.js +7 -8
- package/dist/esm/i18n/da.js +1 -1
- package/dist/esm/i18n/en.js +29 -21
- package/dist/esm/i18n/en_GB.js +29 -21
- package/dist/esm/i18n.js +2 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/types/ShareEntities.js +1 -1
- package/dist/esm/util/i18n-util.js +1 -5
- package/dist/esm/version.json +1 -1
- package/dist/types/components/LazyShareForm/LazyShareForm.d.ts +1 -1
- package/dist/types/i18n/en.d.ts +27 -19
- package/dist/types/i18n/en_GB.d.ts +27 -19
- package/dist/types/types/ShareForm.d.ts +0 -1
- package/package.json +2 -2
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
|
|
4
3
|
/** @jsx jsx */
|
|
5
4
|
import React from 'react';
|
|
6
5
|
import { css, jsx } from '@emotion/react';
|
|
@@ -13,8 +12,10 @@ import { layers } from '@atlaskit/theme/constants';
|
|
|
13
12
|
import Aktooltip from '@atlaskit/tooltip';
|
|
14
13
|
import { messages } from '../i18n';
|
|
15
14
|
import { OBJECT_SHARED } from '../types';
|
|
16
|
-
import { cancelShare, CHANNEL_ID, copyLinkButtonClicked, formShareSubmitted, screenEvent, shareSplitButtonEvent, shareTabClicked, shareTriggerButtonClicked
|
|
17
|
-
|
|
15
|
+
import { cancelShare, CHANNEL_ID, copyLinkButtonClicked, formShareSubmitted, screenEvent, shareSplitButtonEvent, shareTabClicked, shareTriggerButtonClicked
|
|
16
|
+
// type TabSubjectIdType,
|
|
17
|
+
} from './analytics/analytics';
|
|
18
|
+
// eslint-disable-next-line no-duplicate-imports
|
|
18
19
|
|
|
19
20
|
import { isValidFailedExperience } from './analytics/ufoExperienceHelper';
|
|
20
21
|
import { renderShareDialogExp, shareSubmitExp } from './analytics/ufoExperiences';
|
|
@@ -37,13 +38,9 @@ export const defaultShareContentState = {
|
|
|
37
38
|
export class ShareDialogWithTriggerInternal extends React.PureComponent {
|
|
38
39
|
constructor(...args) {
|
|
39
40
|
super(...args);
|
|
40
|
-
|
|
41
41
|
_defineProperty(this, "containerRef", /*#__PURE__*/React.createRef());
|
|
42
|
-
|
|
43
42
|
_defineProperty(this, "selectPortalRef", /*#__PURE__*/React.createRef());
|
|
44
|
-
|
|
45
43
|
_defineProperty(this, "start", 0);
|
|
46
|
-
|
|
47
44
|
_defineProperty(this, "state", {
|
|
48
45
|
isDialogOpen: false,
|
|
49
46
|
isSharing: false,
|
|
@@ -55,7 +52,6 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
|
|
|
55
52
|
tabIndex: 0,
|
|
56
53
|
isLoading: false
|
|
57
54
|
});
|
|
58
|
-
|
|
59
55
|
_defineProperty(this, "closeAndResetDialog", () => {
|
|
60
56
|
this.setState({
|
|
61
57
|
defaultValue: defaultShareContentState,
|
|
@@ -69,62 +65,55 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
|
|
|
69
65
|
onUserSelectionChange,
|
|
70
66
|
onDialogClose
|
|
71
67
|
} = this.props;
|
|
72
|
-
|
|
73
68
|
if (onUserSelectionChange) {
|
|
74
69
|
onUserSelectionChange(defaultShareContentState.users);
|
|
75
70
|
}
|
|
76
|
-
|
|
77
71
|
if (onDialogClose) {
|
|
78
72
|
onDialogClose();
|
|
79
73
|
}
|
|
80
74
|
});
|
|
81
|
-
|
|
82
75
|
_defineProperty(this, "createAndFireEvent", payload => {
|
|
83
76
|
const {
|
|
84
77
|
createAnalyticsEvent,
|
|
85
78
|
analyticsDecorator
|
|
86
79
|
} = this.props;
|
|
87
|
-
|
|
88
80
|
if (analyticsDecorator) {
|
|
89
81
|
payload = analyticsDecorator(payload);
|
|
90
82
|
}
|
|
91
|
-
|
|
92
83
|
if (createAnalyticsEvent) {
|
|
93
84
|
createAnalyticsEvent(payload).fire(CHANNEL_ID);
|
|
94
85
|
}
|
|
95
86
|
});
|
|
96
|
-
|
|
97
87
|
_defineProperty(this, "onTabChange", index => {
|
|
98
88
|
let subjectId = 'shareTab';
|
|
99
89
|
const {
|
|
100
90
|
shareContentType,
|
|
101
91
|
isJwmShareToSlackFFEnabled
|
|
102
92
|
} = this.props;
|
|
103
|
-
|
|
104
93
|
if (index === 1) {
|
|
105
94
|
subjectId = 'shareToSlackTab';
|
|
106
95
|
}
|
|
107
|
-
|
|
108
96
|
this.createAndFireEvent(shareTabClicked(subjectId, shareContentType, isJwmShareToSlackFFEnabled));
|
|
109
97
|
this.setState({
|
|
110
98
|
tabIndex: index
|
|
111
99
|
});
|
|
112
100
|
});
|
|
113
|
-
|
|
114
101
|
_defineProperty(this, "getFlags", () => {
|
|
115
102
|
const {
|
|
116
103
|
intl: {
|
|
117
104
|
formatMessage
|
|
118
105
|
}
|
|
119
|
-
} = this.props;
|
|
106
|
+
} = this.props;
|
|
107
|
+
|
|
108
|
+
// The reason for providing message property is that in jira,
|
|
120
109
|
// the Flag system takes only Message Descriptor as payload
|
|
121
110
|
// and formatMessage is called for every flag
|
|
122
111
|
// if the translation data is not provided, a translated default message
|
|
123
112
|
// will be displayed
|
|
124
|
-
|
|
125
113
|
return [{
|
|
126
114
|
appearance: 'success',
|
|
127
|
-
title: {
|
|
115
|
+
title: {
|
|
116
|
+
...messages.shareSuccessMessage,
|
|
128
117
|
defaultMessage: formatMessage(messages.shareSuccessMessage, {
|
|
129
118
|
object: this.props.shareContentType.toLowerCase()
|
|
130
119
|
})
|
|
@@ -132,19 +121,16 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
|
|
|
132
121
|
type: OBJECT_SHARED
|
|
133
122
|
}];
|
|
134
123
|
});
|
|
135
|
-
|
|
136
124
|
_defineProperty(this, "setIsLoading", isLoading => {
|
|
137
125
|
this.setState({
|
|
138
126
|
isLoading
|
|
139
127
|
});
|
|
140
128
|
});
|
|
141
|
-
|
|
142
129
|
_defineProperty(this, "focus", () => {
|
|
143
130
|
if (this.containerRef.current) {
|
|
144
131
|
this.containerRef.current.focus();
|
|
145
132
|
}
|
|
146
133
|
});
|
|
147
|
-
|
|
148
134
|
_defineProperty(this, "handleKeyDown", event => {
|
|
149
135
|
const {
|
|
150
136
|
isLoading,
|
|
@@ -153,12 +139,10 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
|
|
|
153
139
|
const {
|
|
154
140
|
shouldCloseOnEscapePress
|
|
155
141
|
} = this.props;
|
|
156
|
-
|
|
157
142
|
if (isLoading) {
|
|
158
143
|
event.stopPropagation();
|
|
159
144
|
this.focus();
|
|
160
145
|
}
|
|
161
|
-
|
|
162
146
|
if (isDialogOpen) {
|
|
163
147
|
switch (event.key) {
|
|
164
148
|
case 'Esc':
|
|
@@ -167,15 +151,14 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
|
|
|
167
151
|
// need to prevent that if the dialog is set to not close on `ESC`
|
|
168
152
|
if (!shouldCloseOnEscapePress) {
|
|
169
153
|
event.preventDefault();
|
|
170
|
-
event.stopPropagation();
|
|
154
|
+
event.stopPropagation();
|
|
155
|
+
// put the focus back onto the share dialog so that
|
|
171
156
|
// the user can press the escape key again to close the dialog
|
|
172
|
-
|
|
173
157
|
this.focus();
|
|
174
158
|
return;
|
|
175
|
-
}
|
|
159
|
+
}
|
|
160
|
+
// The dialog will auto-close in @atlaskit/popup, we just need to fire
|
|
176
161
|
// the right events.
|
|
177
|
-
|
|
178
|
-
|
|
179
162
|
if (shouldCloseOnEscapePress) {
|
|
180
163
|
// This experience should be aborted in a scenario when a user closes the dialog before the shareClient.getConfig() call is finished
|
|
181
164
|
// It is a race condition between the `SUCCEEDED` case and the `ABORTED` case of this experience
|
|
@@ -184,11 +167,9 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
|
|
|
184
167
|
this.createAndFireEvent(cancelShare(this.start));
|
|
185
168
|
this.closeAndResetDialog();
|
|
186
169
|
}
|
|
187
|
-
|
|
188
170
|
}
|
|
189
171
|
}
|
|
190
172
|
});
|
|
191
|
-
|
|
192
173
|
_defineProperty(this, "handleDialogOpen", () => {
|
|
193
174
|
this.setState(state => ({
|
|
194
175
|
isDialogOpen: !state.isDialogOpen,
|
|
@@ -203,42 +184,36 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
|
|
|
203
184
|
const {
|
|
204
185
|
isDialogOpen
|
|
205
186
|
} = this.state;
|
|
206
|
-
|
|
207
187
|
if (isDialogOpen) {
|
|
208
188
|
this.start = Date.now();
|
|
209
189
|
this.createAndFireEvent(screenEvent({
|
|
210
190
|
isPublicLink
|
|
211
191
|
}));
|
|
212
|
-
|
|
213
192
|
if (onDialogOpen) {
|
|
214
193
|
onDialogOpen();
|
|
215
194
|
}
|
|
216
|
-
|
|
217
195
|
this.focus();
|
|
218
196
|
}
|
|
219
197
|
});
|
|
220
198
|
});
|
|
221
|
-
|
|
222
199
|
_defineProperty(this, "onTriggerClick", () => {
|
|
223
200
|
const {
|
|
224
201
|
onTriggerButtonClick
|
|
225
202
|
} = this.props;
|
|
226
203
|
this.createAndFireEvent(shareTriggerButtonClicked());
|
|
227
204
|
this.handleDialogOpen();
|
|
228
|
-
|
|
229
205
|
if (onTriggerButtonClick) {
|
|
230
206
|
onTriggerButtonClick();
|
|
231
207
|
}
|
|
232
208
|
});
|
|
233
|
-
|
|
234
209
|
_defineProperty(this, "handleCloseDialog", () => {
|
|
235
210
|
if (this.props.onDialogClose) {
|
|
236
211
|
this.props.onDialogClose();
|
|
237
|
-
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// This experience should be aborted in a scenario when a user closes the dialog before the shareClient.getConfig() call is finished
|
|
238
215
|
// It is a race condition between the `SUCCEEDED` case and the `ABORTED` case of this experience
|
|
239
216
|
// UFO experiences can only have one FINAL state so it doesn't matter if we call .abort() after the experience has succeeded and vice versa
|
|
240
|
-
|
|
241
|
-
|
|
242
217
|
renderShareDialogExp.abort();
|
|
243
218
|
this.setState({
|
|
244
219
|
isDialogOpen: false,
|
|
@@ -247,7 +222,6 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
|
|
|
247
222
|
tabIndex: 0
|
|
248
223
|
});
|
|
249
224
|
});
|
|
250
|
-
|
|
251
225
|
_defineProperty(this, "handleShareSubmit", data => {
|
|
252
226
|
const {
|
|
253
227
|
onShareSubmit,
|
|
@@ -256,11 +230,9 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
|
|
|
256
230
|
showFlags,
|
|
257
231
|
isPublicLink
|
|
258
232
|
} = this.props;
|
|
259
|
-
|
|
260
233
|
if (!onShareSubmit) {
|
|
261
234
|
return;
|
|
262
235
|
}
|
|
263
|
-
|
|
264
236
|
shareSubmitExp.start();
|
|
265
237
|
this.setState({
|
|
266
238
|
isSharing: true
|
|
@@ -283,7 +255,6 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
|
|
|
283
255
|
isValidFailedExperience(shareSubmitExp, err);
|
|
284
256
|
});
|
|
285
257
|
});
|
|
286
|
-
|
|
287
258
|
_defineProperty(this, "handleFormDismiss", data => {
|
|
288
259
|
this.setState(({
|
|
289
260
|
ignoreIntermediateState
|
|
@@ -291,7 +262,6 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
|
|
|
291
262
|
defaultValue: data
|
|
292
263
|
});
|
|
293
264
|
});
|
|
294
|
-
|
|
295
265
|
_defineProperty(this, "handleCopyLink", () => {
|
|
296
266
|
const {
|
|
297
267
|
copyLinkOrigin,
|
|
@@ -301,7 +271,6 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
|
|
|
301
271
|
} = this.props;
|
|
302
272
|
this.createAndFireEvent(copyLinkButtonClicked(this.start, shareContentType, copyLinkOrigin, isPublicLink, shareAri));
|
|
303
273
|
});
|
|
304
|
-
|
|
305
274
|
_defineProperty(this, "handleIntegrationClick", integration => {
|
|
306
275
|
this.setState({
|
|
307
276
|
isUsingSplitButton: false,
|
|
@@ -310,7 +279,6 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
|
|
|
310
279
|
selectedIntegration: integration
|
|
311
280
|
});
|
|
312
281
|
});
|
|
313
|
-
|
|
314
282
|
_defineProperty(this, "renderShareTriggerButton", triggerProps => {
|
|
315
283
|
const {
|
|
316
284
|
isDialogOpen,
|
|
@@ -333,8 +301,9 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
|
|
|
333
301
|
dialogPlacement
|
|
334
302
|
} = this.props;
|
|
335
303
|
let button;
|
|
336
|
-
const ShareButtonIcon = triggerButtonIcon || ShareIcon;
|
|
304
|
+
const ShareButtonIcon = triggerButtonIcon || ShareIcon;
|
|
337
305
|
|
|
306
|
+
// Render a custom or standard button.
|
|
338
307
|
if (renderCustomTriggerButton) {
|
|
339
308
|
const {
|
|
340
309
|
shareError
|
|
@@ -357,18 +326,18 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
|
|
|
357
326
|
isSelected: isDialogOpen,
|
|
358
327
|
isDisabled: isDisabled
|
|
359
328
|
}, triggerProps));
|
|
360
|
-
}
|
|
361
|
-
|
|
329
|
+
}
|
|
362
330
|
|
|
331
|
+
// If the button only shows the icon, wrap it in a tooltip containing the button text.
|
|
363
332
|
if (triggerButtonStyle === 'icon-only') {
|
|
364
333
|
button = jsx(Aktooltip, {
|
|
365
334
|
content: !isUsingSplitButton ? triggerButtonTooltipText || formatMessage(messages.shareTriggerButtonTooltipText) : null,
|
|
366
335
|
position: triggerButtonTooltipPosition,
|
|
367
336
|
hideTooltipOnClick: true
|
|
368
337
|
}, button);
|
|
369
|
-
}
|
|
370
|
-
|
|
338
|
+
}
|
|
371
339
|
|
|
340
|
+
// If there are any integrations, wrap the share button in a split button with integrations.
|
|
372
341
|
if (integrationMode === 'split' && shareIntegrations !== null && shareIntegrations !== void 0 && shareIntegrations.length) {
|
|
373
342
|
button = jsx(SplitButton, {
|
|
374
343
|
shareButton: button,
|
|
@@ -383,36 +352,30 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
|
|
|
383
352
|
createAndFireEvent: this.createAndFireEvent
|
|
384
353
|
});
|
|
385
354
|
}
|
|
386
|
-
|
|
387
355
|
return button;
|
|
388
356
|
});
|
|
389
|
-
|
|
390
357
|
_defineProperty(this, "handleOpenSplitButton", () => {
|
|
391
358
|
this.setState({
|
|
392
359
|
isUsingSplitButton: true
|
|
393
360
|
}, () => this.handleCloseDialog());
|
|
394
361
|
this.createAndFireEvent(shareSplitButtonEvent());
|
|
395
362
|
});
|
|
396
|
-
|
|
397
363
|
_defineProperty(this, "handleCloseSplitButton", () => {
|
|
398
364
|
this.setState({
|
|
399
365
|
isUsingSplitButton: false
|
|
400
366
|
});
|
|
401
367
|
});
|
|
402
368
|
}
|
|
403
|
-
|
|
404
369
|
componentDidMount() {
|
|
405
370
|
if (this.props.isAutoOpenDialog) {
|
|
406
371
|
this.handleDialogOpen();
|
|
407
372
|
}
|
|
408
373
|
}
|
|
409
|
-
|
|
410
374
|
componentDidUpdate(prevProps) {
|
|
411
375
|
if (this.props.isAutoOpenDialog !== prevProps.isAutoOpenDialog && this.props.isAutoOpenDialog) {
|
|
412
376
|
this.handleDialogOpen();
|
|
413
377
|
}
|
|
414
378
|
}
|
|
415
|
-
|
|
416
379
|
render() {
|
|
417
380
|
const {
|
|
418
381
|
isDialogOpen,
|
|
@@ -446,14 +409,14 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
|
|
|
446
409
|
copyTooltipText,
|
|
447
410
|
integrationMode,
|
|
448
411
|
shareIntegrations,
|
|
449
|
-
isBrowseUsersDisabled
|
|
450
|
-
shareContentType
|
|
412
|
+
isBrowseUsersDisabled
|
|
451
413
|
} = this.props;
|
|
452
414
|
const style = typeof tabIndex !== 'undefined' && tabIndex >= 0 ? {
|
|
453
415
|
outline: 'none'
|
|
454
416
|
} : undefined;
|
|
455
|
-
const footer = resolveShareFooter(integrationMode, this.state.tabIndex, customFooter);
|
|
417
|
+
const footer = resolveShareFooter(integrationMode, this.state.tabIndex, customFooter);
|
|
456
418
|
|
|
419
|
+
// for performance purposes, we may want to have a loadable content i.e. ShareForm
|
|
457
420
|
return jsx("div", {
|
|
458
421
|
css: shareButtonWrapperStyles,
|
|
459
422
|
tabIndex: tabIndex,
|
|
@@ -475,7 +438,6 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
|
|
|
475
438
|
showTitle: integrationMode !== 'tabs' || !shareIntegrations || !shareIntegrations.length,
|
|
476
439
|
shareFormHelperMessage: shareFormHelperMessage,
|
|
477
440
|
shareError: shareError,
|
|
478
|
-
shareContentType: shareContentType,
|
|
479
441
|
defaultValue: defaultValue,
|
|
480
442
|
config: config,
|
|
481
443
|
isFetchingConfig: isFetchingConfig,
|
|
@@ -491,13 +453,15 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
|
|
|
491
453
|
isPublicLink: isPublicLink,
|
|
492
454
|
copyTooltipText: copyTooltipText,
|
|
493
455
|
integrationMode: integrationMode,
|
|
494
|
-
shareIntegrations: shareIntegrations
|
|
456
|
+
shareIntegrations: shareIntegrations
|
|
457
|
+
// actions
|
|
495
458
|
,
|
|
496
459
|
onLinkCopy: this.handleCopyLink,
|
|
497
460
|
onSubmit: this.handleShareSubmit,
|
|
498
461
|
onDismiss: this.handleFormDismiss,
|
|
499
462
|
onDialogClose: this.handleCloseDialog,
|
|
500
|
-
onTabChange: this.onTabChange
|
|
463
|
+
onTabChange: this.onTabChange
|
|
464
|
+
//ref
|
|
501
465
|
,
|
|
502
466
|
selectPortalRef: this.selectPortalRef,
|
|
503
467
|
isBrowseUsersDisabled: isBrowseUsersDisabled
|
|
@@ -513,9 +477,7 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
|
|
|
513
477
|
ref: this.selectPortalRef
|
|
514
478
|
})));
|
|
515
479
|
}
|
|
516
|
-
|
|
517
480
|
}
|
|
518
|
-
|
|
519
481
|
_defineProperty(ShareDialogWithTriggerInternal, "defaultProps", {
|
|
520
482
|
isDisabled: false,
|
|
521
483
|
dialogPlacement: 'bottom-end',
|
|
@@ -525,5 +487,4 @@ _defineProperty(ShareDialogWithTriggerInternal, "defaultProps", {
|
|
|
525
487
|
triggerButtonTooltipPosition: 'top',
|
|
526
488
|
dialogZIndex: layers.modal()
|
|
527
489
|
});
|
|
528
|
-
|
|
529
490
|
export const ShareDialogWithTrigger = withAnalyticsEvents()(injectIntl(ShareDialogWithTriggerInternal));
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
-
|
|
4
3
|
/** @jsx jsx */
|
|
5
4
|
import React from 'react';
|
|
6
5
|
import { css, jsx } from '@emotion/react';
|
|
@@ -58,22 +57,18 @@ const integrationIconWrapperStyles = css`
|
|
|
58
57
|
margin-bottom: -6px;
|
|
59
58
|
margin-right: 5px;
|
|
60
59
|
`;
|
|
61
|
-
|
|
62
60
|
const integrationTabText = integrationName => jsx(FormattedMessage, _extends({}, messages.shareInIntegrationButtonText, {
|
|
63
61
|
values: {
|
|
64
62
|
integrationName
|
|
65
63
|
}
|
|
66
64
|
}));
|
|
67
|
-
|
|
68
65
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
69
66
|
class InternalForm extends React.PureComponent {
|
|
70
67
|
constructor(...args) {
|
|
71
68
|
super(...args);
|
|
72
|
-
|
|
73
69
|
_defineProperty(this, "state", {
|
|
74
70
|
selectedTab: TabType.default
|
|
75
71
|
});
|
|
76
|
-
|
|
77
72
|
_defineProperty(this, "renderShareForm", () => {
|
|
78
73
|
const {
|
|
79
74
|
formProps,
|
|
@@ -143,7 +138,6 @@ class InternalForm extends React.PureComponent {
|
|
|
143
138
|
copiedToClipboardText: formatMessage(messages.copiedToClipboardMessage)
|
|
144
139
|
}), this.renderSubmitButton())));
|
|
145
140
|
});
|
|
146
|
-
|
|
147
141
|
_defineProperty(this, "renderSubmitButton", () => {
|
|
148
142
|
const {
|
|
149
143
|
intl: {
|
|
@@ -181,61 +175,51 @@ class InternalForm extends React.PureComponent {
|
|
|
181
175
|
isDisabled: isDisabled
|
|
182
176
|
}, jsx(ButtonLabelWrapper, null, submitButtonLabel || jsx(FormattedMessage, buttonLabel))));
|
|
183
177
|
});
|
|
184
|
-
|
|
185
178
|
_defineProperty(this, "renderMainTabTitle", () => {
|
|
186
179
|
const {
|
|
187
180
|
title,
|
|
188
181
|
product
|
|
189
182
|
} = this.props;
|
|
190
|
-
|
|
191
183
|
if (title) {
|
|
192
184
|
return title;
|
|
193
185
|
}
|
|
194
|
-
|
|
195
186
|
if (!product) {
|
|
196
187
|
return jsx(FormattedMessage, messages.formTitle);
|
|
197
188
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
} : {
|
|
189
|
+
const productShareType = product === 'jira' ? {
|
|
190
|
+
...messages.shareMainTabTextJira
|
|
191
|
+
} : {
|
|
192
|
+
...messages.shareMainTabTextConfluence
|
|
201
193
|
};
|
|
202
194
|
return jsx(FormattedMessage, productShareType);
|
|
203
195
|
});
|
|
204
|
-
|
|
205
196
|
_defineProperty(this, "changeTab", tab => {
|
|
206
197
|
var _this$props$onTabChan, _this$props;
|
|
207
|
-
|
|
208
198
|
this.setState({
|
|
209
199
|
selectedTab: tab
|
|
210
200
|
});
|
|
211
201
|
(_this$props$onTabChan = (_this$props = this.props).onTabChange) === null || _this$props$onTabChan === void 0 ? void 0 : _this$props$onTabChan.call(_this$props, tab);
|
|
212
202
|
});
|
|
213
203
|
}
|
|
214
|
-
|
|
215
204
|
componentWillUnmount() {
|
|
216
205
|
const {
|
|
217
206
|
onDismiss,
|
|
218
207
|
getValues
|
|
219
208
|
} = this.props;
|
|
220
|
-
|
|
221
209
|
if (onDismiss) {
|
|
222
210
|
onDismiss(getValues());
|
|
223
211
|
}
|
|
224
212
|
}
|
|
225
|
-
|
|
226
213
|
render() {
|
|
227
214
|
const {
|
|
228
215
|
integrationMode = 'off',
|
|
229
216
|
shareIntegrations,
|
|
230
217
|
handleCloseDialog
|
|
231
218
|
} = this.props;
|
|
232
|
-
|
|
233
219
|
if (integrationMode === 'off' || !shareIntegrations || !shareIntegrations.length) {
|
|
234
220
|
return this.renderShareForm();
|
|
235
221
|
}
|
|
236
|
-
|
|
237
222
|
const firstIntegration = shareIntegrations[0];
|
|
238
|
-
|
|
239
223
|
if (integrationMode === 'tabs') {
|
|
240
224
|
return jsx(Tabs, {
|
|
241
225
|
id: "ShareForm-Tabs-Integrations",
|
|
@@ -267,16 +251,12 @@ class InternalForm extends React.PureComponent {
|
|
|
267
251
|
changeTab: this.changeTab
|
|
268
252
|
})))));
|
|
269
253
|
}
|
|
270
|
-
|
|
271
254
|
return this.renderShareForm();
|
|
272
255
|
}
|
|
273
|
-
|
|
274
256
|
}
|
|
275
|
-
|
|
276
257
|
_defineProperty(InternalForm, "defaultProps", {
|
|
277
258
|
onSubmit: () => {}
|
|
278
259
|
});
|
|
279
|
-
|
|
280
260
|
const InternalFormWithIntl = injectIntl(InternalForm);
|
|
281
261
|
export const ShareForm = props => jsx(Form, {
|
|
282
262
|
onSubmit: props.onSubmit
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ShareHeader } from '../ShareHeader';
|
|
3
3
|
import { InlineDialogContentWrapper, InlineDialogFormWrapper } from './styled';
|
|
4
|
-
|
|
5
4
|
const ShareFormWrapper = ({
|
|
6
5
|
shareFormTitle,
|
|
7
6
|
shouldShowTitle,
|
|
@@ -10,5 +9,4 @@ const ShareFormWrapper = ({
|
|
|
10
9
|
}) => /*#__PURE__*/React.createElement(InlineDialogContentWrapper, null, /*#__PURE__*/React.createElement(InlineDialogFormWrapper, null, shouldShowTitle && /*#__PURE__*/React.createElement(ShareHeader, {
|
|
11
10
|
title: shareFormTitle
|
|
12
11
|
}), children), footer);
|
|
13
|
-
|
|
14
12
|
export default ShareFormWrapper;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
+
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import { jsx } from '@emotion/react';
|
|
4
5
|
import { gridSize } from '@atlaskit/theme/constants';
|
|
@@ -9,13 +10,13 @@ export const InlineDialogFormWrapper = ({
|
|
|
9
10
|
width: `${gridSize() * 44}px`
|
|
10
11
|
}
|
|
11
12
|
}, children);
|
|
13
|
+
|
|
12
14
|
/**
|
|
13
15
|
* Apply the same styling, as previous @atlaskit/inline-dialog had,
|
|
14
16
|
* compared to the @atlaskit/popup we are now using.
|
|
15
17
|
*
|
|
16
18
|
* packages/design-system/inline-dialog/src/InlineDialog/styled.ts:20:3
|
|
17
19
|
*/
|
|
18
|
-
|
|
19
20
|
export const InlineDialogContentWrapper = ({
|
|
20
21
|
children
|
|
21
22
|
}) => jsx("div", {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
4
3
|
import React, { useCallback } from 'react';
|
|
5
4
|
import { css, jsx } from '@emotion/react';
|
|
@@ -29,20 +28,19 @@ const dropdownMenuWrapperStyles = css`
|
|
|
29
28
|
button:hover {
|
|
30
29
|
border-radius: 0 ${borderRadius()}px ${borderRadius()}px 0;
|
|
31
30
|
}
|
|
32
|
-
`;
|
|
31
|
+
`;
|
|
33
32
|
|
|
33
|
+
// span
|
|
34
34
|
const dropDownIntegrationButtonWrapperStyles = css`
|
|
35
35
|
button:hover {
|
|
36
36
|
background: transparent;
|
|
37
37
|
}
|
|
38
38
|
`;
|
|
39
|
-
|
|
40
39
|
const integrationButtonText = integrationName => jsx(FormattedMessage, _extends({}, messages.shareToIntegrationButtonText, {
|
|
41
40
|
values: {
|
|
42
41
|
integrationName
|
|
43
42
|
}
|
|
44
43
|
}));
|
|
45
|
-
|
|
46
44
|
const SplitButtonDropdown = props => {
|
|
47
45
|
const {
|
|
48
46
|
triggerButtonAppearance,
|
|
@@ -97,7 +95,6 @@ const SplitButtonDropdown = props => {
|
|
|
97
95
|
IntegrationIcon: integration.Icon
|
|
98
96
|
})))))));
|
|
99
97
|
};
|
|
100
|
-
|
|
101
98
|
SplitButtonDropdown.displayName = 'SplitButtonDropdown';
|
|
102
99
|
export default function SplitButton({
|
|
103
100
|
shareButton,
|