@atlaskit/share 5.0.0 → 6.0.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.
Files changed (88) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/afm-cc/tsconfig.json +3 -0
  3. package/afm-jira/tsconfig.json +3 -0
  4. package/dist/cjs/components/CopyLinkButton.js +11 -7
  5. package/dist/cjs/components/CopyLinkButtonNext.compiled.css +8 -0
  6. package/dist/cjs/components/CopyLinkButtonNext.js +180 -0
  7. package/dist/cjs/components/IntegrationButton.js +10 -1
  8. package/dist/cjs/components/IntegrationButtonNext.compiled.css +7 -0
  9. package/dist/cjs/components/IntegrationButtonNext.js +38 -0
  10. package/dist/cjs/components/LazyShareForm/LazyShareFormNext.compiled.css +5 -0
  11. package/dist/cjs/components/LazyShareForm/LazyShareFormNext.js +138 -0
  12. package/dist/cjs/components/LazyShareForm/lazy.js +3 -1
  13. package/dist/cjs/components/LazyShareForm/lazyNext.compiled.css +5 -0
  14. package/dist/cjs/components/LazyShareForm/lazyNext.js +58 -0
  15. package/dist/cjs/components/ShareDialogWithTrigger.js +12 -8
  16. package/dist/cjs/components/ShareDialogWithTriggerNext.compiled.css +4 -0
  17. package/dist/cjs/components/ShareDialogWithTriggerNext.js +653 -0
  18. package/dist/cjs/components/ShareFormNext.compiled.css +21 -0
  19. package/dist/cjs/components/ShareFormNext.js +473 -0
  20. package/dist/cjs/components/ShareFormWrapper/ShareFormWrapper.js +6 -2
  21. package/dist/cjs/components/ShareFormWrapper/compiled.compiled.css +7 -0
  22. package/dist/cjs/components/ShareFormWrapper/compiled.js +48 -0
  23. package/dist/cjs/components/SplitButton.js +25 -17
  24. package/dist/cjs/components/UserPickerField.js +3 -1
  25. package/dist/cjs/components/analytics/analytics.js +1 -1
  26. package/dist/es2019/components/CopyLinkButton.js +3 -1
  27. package/dist/es2019/components/CopyLinkButtonNext.compiled.css +8 -0
  28. package/dist/es2019/components/CopyLinkButtonNext.js +151 -0
  29. package/dist/es2019/components/IntegrationButton.js +9 -1
  30. package/dist/es2019/components/IntegrationButtonNext.compiled.css +7 -0
  31. package/dist/es2019/components/IntegrationButtonNext.js +33 -0
  32. package/dist/es2019/components/LazyShareForm/LazyShareFormNext.compiled.css +5 -0
  33. package/dist/es2019/components/LazyShareForm/LazyShareFormNext.js +136 -0
  34. package/dist/es2019/components/LazyShareForm/lazy.js +3 -1
  35. package/dist/es2019/components/LazyShareForm/lazyNext.compiled.css +5 -0
  36. package/dist/es2019/components/LazyShareForm/lazyNext.js +43 -0
  37. package/dist/es2019/components/ShareDialogWithTrigger.js +4 -2
  38. package/dist/es2019/components/ShareDialogWithTriggerNext.compiled.css +4 -0
  39. package/dist/es2019/components/ShareDialogWithTriggerNext.js +593 -0
  40. package/dist/es2019/components/ShareFormNext.compiled.css +21 -0
  41. package/dist/es2019/components/ShareFormNext.js +417 -0
  42. package/dist/es2019/components/ShareFormWrapper/ShareFormWrapper.js +6 -2
  43. package/dist/es2019/components/ShareFormWrapper/compiled.compiled.css +7 -0
  44. package/dist/es2019/components/ShareFormWrapper/compiled.js +41 -0
  45. package/dist/es2019/components/SplitButton.js +9 -3
  46. package/dist/es2019/components/UserPickerField.js +3 -1
  47. package/dist/es2019/components/analytics/analytics.js +1 -1
  48. package/dist/esm/components/CopyLinkButton.js +10 -6
  49. package/dist/esm/components/CopyLinkButtonNext.compiled.css +8 -0
  50. package/dist/esm/components/CopyLinkButtonNext.js +173 -0
  51. package/dist/esm/components/IntegrationButton.js +11 -1
  52. package/dist/esm/components/IntegrationButtonNext.compiled.css +7 -0
  53. package/dist/esm/components/IntegrationButtonNext.js +31 -0
  54. package/dist/esm/components/LazyShareForm/LazyShareFormNext.compiled.css +5 -0
  55. package/dist/esm/components/LazyShareForm/LazyShareFormNext.js +131 -0
  56. package/dist/esm/components/LazyShareForm/lazy.js +3 -1
  57. package/dist/esm/components/LazyShareForm/lazyNext.compiled.css +5 -0
  58. package/dist/esm/components/LazyShareForm/lazyNext.js +46 -0
  59. package/dist/esm/components/ShareDialogWithTrigger.js +11 -7
  60. package/dist/esm/components/ShareDialogWithTriggerNext.compiled.css +4 -0
  61. package/dist/esm/components/ShareDialogWithTriggerNext.js +646 -0
  62. package/dist/esm/components/ShareFormNext.compiled.css +21 -0
  63. package/dist/esm/components/ShareFormNext.js +463 -0
  64. package/dist/esm/components/ShareFormWrapper/ShareFormWrapper.js +6 -2
  65. package/dist/esm/components/ShareFormWrapper/compiled.compiled.css +7 -0
  66. package/dist/esm/components/ShareFormWrapper/compiled.js +41 -0
  67. package/dist/esm/components/SplitButton.js +25 -17
  68. package/dist/esm/components/UserPickerField.js +3 -1
  69. package/dist/esm/components/analytics/analytics.js +1 -1
  70. package/dist/types/components/CopyLinkButton.d.ts +2 -1
  71. package/dist/types/components/CopyLinkButtonNext.d.ts +35 -0
  72. package/dist/types/components/IntegrationButtonNext.d.ts +11 -0
  73. package/dist/types/components/LazyShareForm/LazyShareFormNext.d.ts +21 -0
  74. package/dist/types/components/LazyShareForm/lazyNext.d.ts +4 -0
  75. package/dist/types/components/ShareDialogWithTrigger.d.ts +3 -3
  76. package/dist/types/components/ShareDialogWithTriggerNext.d.ts +47 -0
  77. package/dist/types/components/ShareFormNext.d.ts +9 -0
  78. package/dist/types/components/ShareFormWrapper/compiled.d.ts +10 -0
  79. package/dist/types-ts4.5/components/CopyLinkButton.d.ts +2 -1
  80. package/dist/types-ts4.5/components/CopyLinkButtonNext.d.ts +35 -0
  81. package/dist/types-ts4.5/components/IntegrationButtonNext.d.ts +11 -0
  82. package/dist/types-ts4.5/components/LazyShareForm/LazyShareFormNext.d.ts +21 -0
  83. package/dist/types-ts4.5/components/LazyShareForm/lazyNext.d.ts +4 -0
  84. package/dist/types-ts4.5/components/ShareDialogWithTrigger.d.ts +3 -3
  85. package/dist/types-ts4.5/components/ShareDialogWithTriggerNext.d.ts +47 -0
  86. package/dist/types-ts4.5/components/ShareFormNext.d.ts +9 -0
  87. package/dist/types-ts4.5/components/ShareFormWrapper/compiled.d.ts +10 -0
  88. package/package.json +29 -25
@@ -0,0 +1,463 @@
1
+ /* ShareFormNext.tsx generated by @compiled/babel-plugin v0.36.1 */
2
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
+ import _createClass from "@babel/runtime/helpers/createClass";
4
+ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
5
+ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
+ import _inherits from "@babel/runtime/helpers/inherits";
7
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
+ import _extends from "@babel/runtime/helpers/extends";
9
+ import "./ShareFormNext.compiled.css";
10
+ import { ax, ix } from "@compiled/react/runtime";
11
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
12
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
13
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
14
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
15
+ import React from 'react';
16
+ import { FormattedMessage, injectIntl } from 'react-intl-next';
17
+ import { AnalyticsContext } from '@atlaskit/analytics-next';
18
+ import Button from '@atlaskit/button/new';
19
+ import { cx } from '@atlaskit/css';
20
+ import Form, { RequiredAsterisk } from '@atlaskit/form';
21
+ import EmailIcon from '@atlaskit/icon/core/migration/email';
22
+ import ErrorIcon from '@atlaskit/icon/core/migration/error';
23
+ import { MenuGroup } from '@atlaskit/menu';
24
+ import { fg } from '@atlaskit/platform-feature-flags';
25
+ import { Box } from '@atlaskit/primitives/compiled';
26
+ import Tabs, { Tab, TabList, TabPanel } from '@atlaskit/tabs';
27
+ import { N300, R400 } from '@atlaskit/theme/colors';
28
+ import Tooltip from '@atlaskit/tooltip';
29
+ import { messages } from '../i18n';
30
+ import { TabType } from '../types';
31
+ import { ANALYTICS_SOURCE, INTEGRATION_MODAL_SOURCE } from './analytics/analytics';
32
+ import { CommentField } from './CommentField';
33
+ import CopyLinkButton from './CopyLinkButton';
34
+ import { IntegrationForm } from './IntegrationForm';
35
+ import { ShareHeader } from './ShareHeader';
36
+ import { ShareMenuItem } from './ShareMenuItem';
37
+ import { UserPickerField } from './UserPickerField';
38
+ var styles = {
39
+ submitButtonWrapperStyles: "_1e0c1txw _18u01wug",
40
+ centerAlignedIconWrapperStyles: "_1rjcze3t _18zrutpp _1e0c1txw _1wpz1h6o",
41
+ formWrapperStyles: "_19pku2gc _1bsb1osq",
42
+ formFooterStyles: "_1e0c1txw _1bah1y6m",
43
+ formFieldStyles: "_otyrutpp",
44
+ integrationWrapperStyles: "_1e0c1txw _4cvr1h6o",
45
+ integrationIconWrapperStyles: "_otyr196n _2hwx1b66",
46
+ requiredFieldInfoStyles: "_11c81vlj _otyrpxbi _syaz1n3s",
47
+ menuGroupContainerStyles: "_2rkoglpi _1moux0bf _195g10v4 _syaz1fxt _4cvr1y6m _1bsb1w81"
48
+ };
49
+ var integrationTabText = function integrationTabText(integrationName) {
50
+ return /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.shareInIntegrationButtonText, {
51
+ values: {
52
+ integrationName: integrationName
53
+ }
54
+ }));
55
+ };
56
+ // eslint-disable-next-line @repo/internal/react/no-class-components
57
+ var InternalForm = /*#__PURE__*/function (_React$PureComponent) {
58
+ function InternalForm() {
59
+ var _this;
60
+ _classCallCheck(this, InternalForm);
61
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
62
+ args[_key] = arguments[_key];
63
+ }
64
+ _this = _callSuper(this, InternalForm, [].concat(args));
65
+ _defineProperty(_this, "state", {
66
+ selectedTab: TabType.default,
67
+ selectedMenuItem: 'none'
68
+ });
69
+ _defineProperty(_this, "renderShareForm", function () {
70
+ var _this$props = _this.props,
71
+ formProps = _this$props.formProps,
72
+ title = _this$props.title,
73
+ _this$props$showTitle = _this$props.showTitle,
74
+ showTitle = _this$props$showTitle === void 0 ? true : _this$props$showTitle,
75
+ loadOptions = _this$props.loadOptions,
76
+ onLinkCopy = _this$props.onLinkCopy,
77
+ copyLink = _this$props.copyLink,
78
+ defaultValue = _this$props.defaultValue,
79
+ config = _this$props.config,
80
+ isFetchingConfig = _this$props.isFetchingConfig,
81
+ product = _this$props.product,
82
+ onUserInputChange = _this$props.onUserInputChange,
83
+ enableSmartUserPicker = _this$props.enableSmartUserPicker,
84
+ loggedInAccountId = _this$props.loggedInAccountId,
85
+ cloudId = _this$props.cloudId,
86
+ onUserSelectionChange = _this$props.onUserSelectionChange,
87
+ fieldsFooter = _this$props.fieldsFooter,
88
+ selectPortalRef = _this$props.selectPortalRef,
89
+ isDisabled = _this$props.isDisabled,
90
+ isPublicLink = _this$props.isPublicLink,
91
+ copyTooltipText = _this$props.copyTooltipText,
92
+ helperMessage = _this$props.helperMessage,
93
+ orgId = _this$props.orgId,
94
+ isBrowseUsersDisabled = _this$props.isBrowseUsersDisabled,
95
+ formatMessage = _this$props.intl.formatMessage,
96
+ shareError = _this$props.shareError,
97
+ userPickerOptions = _this$props.userPickerOptions,
98
+ productAttributes = _this$props.productAttributes;
99
+ return /*#__PURE__*/React.createElement(AnalyticsContext, {
100
+ data: {
101
+ source: ANALYTICS_SOURCE
102
+ }
103
+ }, /*#__PURE__*/React.createElement("form", formProps, showTitle && /*#__PURE__*/React.createElement(ShareHeader, {
104
+ title: title
105
+ }), /*#__PURE__*/React.createElement(Box, {
106
+ xcss: cx(styles.requiredFieldInfoStyles)
107
+ }, /*#__PURE__*/React.createElement(FormattedMessage, messages.requiredFieldSummary), /*#__PURE__*/React.createElement(RequiredAsterisk, null)), /*#__PURE__*/React.createElement(Box, {
108
+ xcss: cx(styles.formFieldStyles)
109
+ }, /*#__PURE__*/React.createElement(UserPickerField, {
110
+ onInputChange: onUserInputChange,
111
+ onChange: onUserSelectionChange,
112
+ loadOptions: loadOptions,
113
+ defaultValue: defaultValue && defaultValue.users,
114
+ config: config,
115
+ isLoading: isFetchingConfig,
116
+ product: product || 'confluence',
117
+ enableSmartUserPicker: enableSmartUserPicker,
118
+ loggedInAccountId: loggedInAccountId,
119
+ cloudId: cloudId,
120
+ selectPortalRef: selectPortalRef,
121
+ isPublicLink: isPublicLink,
122
+ helperMessage: helperMessage,
123
+ orgId: orgId,
124
+ isBrowseUsersDisabled: isBrowseUsersDisabled,
125
+ shareError: shareError,
126
+ userPickerOptions: userPickerOptions,
127
+ productAttributes: productAttributes
128
+ })), /*#__PURE__*/React.createElement(Box, {
129
+ xcss: cx(styles.formFieldStyles)
130
+ }, /*#__PURE__*/React.createElement(CommentField, {
131
+ defaultValue: defaultValue && defaultValue.comment
132
+ })), fieldsFooter, /*#__PURE__*/React.createElement(Box, {
133
+ xcss: cx(styles.formFooterStyles),
134
+ testId: "form-footer"
135
+ }, /*#__PURE__*/React.createElement(CopyLinkButton, {
136
+ isDisabled: isDisabled,
137
+ onLinkCopy: onLinkCopy,
138
+ link: copyLink,
139
+ copyTooltipText: copyTooltipText,
140
+ copyLinkButtonText: formatMessage(isPublicLink ? messages.copyPublicLinkButtonText : messages.copyLinkButtonText),
141
+ copiedToClipboardText: formatMessage(messages.copiedToClipboardMessage)
142
+ }), _this.renderSubmitButton())));
143
+ });
144
+ _defineProperty(_this, "renderSubmitButton", function () {
145
+ var _this$props2 = _this.props,
146
+ formatMessage = _this$props2.intl.formatMessage,
147
+ isSharing = _this$props2.isSharing,
148
+ shareError = _this$props2.shareError,
149
+ submitButtonLabel = _this$props2.submitButtonLabel,
150
+ isDisabled = _this$props2.isDisabled,
151
+ isPublicLink = _this$props2.isPublicLink,
152
+ integrationMode = _this$props2.integrationMode,
153
+ isSubmitShareDisabled = _this$props2.isSubmitShareDisabled;
154
+ var isRetryableError = !!(shareError !== null && shareError !== void 0 && shareError.retryable);
155
+ var isNonRetryableError = shareError && !shareError.retryable;
156
+ var shouldShowWarning = isRetryableError && !isSharing;
157
+ var buttonAppearance = !shouldShowWarning ? 'primary' : 'warning';
158
+ var tabMode = integrationMode === 'tabs';
159
+ var formPublicLabel = tabMode ? messages.formSharePublic : messages.formSendPublic;
160
+ var formSendLabel = messages.formShare;
161
+ var sendLabel = isPublicLink ? formPublicLabel : formSendLabel;
162
+ var buttonLabel = isRetryableError ? messages.formRetry : sendLabel;
163
+ var buttonDisabled = isDisabled || isNonRetryableError || isSubmitShareDisabled && fg('plans_outgoing_mail_fix');
164
+ var ButtonLabelWrapper = buttonAppearance === 'warning' ? 'strong' : React.Fragment;
165
+ return /*#__PURE__*/React.createElement(Box, {
166
+ xcss: cx(styles.submitButtonWrapperStyles)
167
+ }, /*#__PURE__*/React.createElement(Box, {
168
+ xcss: cx(styles.centerAlignedIconWrapperStyles)
169
+ }, shouldShowWarning && /*#__PURE__*/React.createElement(Tooltip, {
170
+ content: /*#__PURE__*/React.createElement(FormattedMessage, messages.shareFailureMessage),
171
+ position: "top"
172
+ }, /*#__PURE__*/React.createElement(ErrorIcon, {
173
+ spacing: "spacious",
174
+ label: formatMessage(messages.shareFailureIconLabel),
175
+ color: "var(--ds-icon-danger, ".concat(R400, ")")
176
+ }))), /*#__PURE__*/React.createElement(Button, {
177
+ appearance: buttonAppearance,
178
+ type: "submit",
179
+ isLoading: isSharing,
180
+ isDisabled: buttonDisabled
181
+ }, /*#__PURE__*/React.createElement(ButtonLabelWrapper, null, submitButtonLabel || /*#__PURE__*/React.createElement(FormattedMessage, buttonLabel))));
182
+ });
183
+ _defineProperty(_this, "renderMainTabTitle", function () {
184
+ var _this$props3 = _this.props,
185
+ title = _this$props3.title,
186
+ product = _this$props3.product;
187
+ if (title) {
188
+ return title;
189
+ }
190
+ if (!product) {
191
+ return /*#__PURE__*/React.createElement(FormattedMessage, messages.formTitle);
192
+ }
193
+ var productShareType = product === 'jira' ? _objectSpread({}, messages.shareMainTabTextJira) : _objectSpread({}, messages.shareMainTabTextConfluence);
194
+ return /*#__PURE__*/React.createElement(FormattedMessage, productShareType);
195
+ });
196
+ _defineProperty(_this, "changeTab", function (tab) {
197
+ var _this$props$onTabChan, _this$props4;
198
+ _this.setState({
199
+ selectedTab: tab
200
+ });
201
+ (_this$props$onTabChan = (_this$props4 = _this.props).onTabChange) === null || _this$props$onTabChan === void 0 || _this$props$onTabChan.call(_this$props4, tab);
202
+ });
203
+ _defineProperty(_this, "changeMenuItem", function (menuItem) {
204
+ var _this$props$onMenuIte, _this$props5;
205
+ _this.setState({
206
+ selectedMenuItem: menuItem
207
+ });
208
+ (_this$props$onMenuIte = (_this$props5 = _this.props).onMenuItemChange) === null || _this$props$onMenuIte === void 0 || _this$props$onMenuIte.call(_this$props5, menuItem);
209
+ });
210
+ return _this;
211
+ }
212
+ _inherits(InternalForm, _React$PureComponent);
213
+ return _createClass(InternalForm, [{
214
+ key: "componentWillUnmount",
215
+ value: function componentWillUnmount() {
216
+ var _this$props6 = this.props,
217
+ onDismiss = _this$props6.onDismiss,
218
+ getValues = _this$props6.getValues;
219
+ if (onDismiss) {
220
+ onDismiss(getValues());
221
+ }
222
+ }
223
+ }, {
224
+ key: "render",
225
+ value: function render() {
226
+ var _this2 = this;
227
+ var _this$props7 = this.props,
228
+ _this$props7$integrat = _this$props7.integrationMode,
229
+ integrationMode = _this$props7$integrat === void 0 ? 'off' : _this$props7$integrat,
230
+ shareIntegrations = _this$props7.shareIntegrations,
231
+ additionalTabs = _this$props7.additionalTabs,
232
+ builtInTabContentWidth = _this$props7.builtInTabContentWidth,
233
+ handleCloseDialog = _this$props7.handleCloseDialog;
234
+ var selectedMenuItem = this.state.selectedMenuItem;
235
+ if (fg('plans_outgoing_mail_fix')) {
236
+ var hasShareIntegrations = shareIntegrations && shareIntegrations.length;
237
+ var hasAdditionalTabs = additionalTabs && additionalTabs.length;
238
+ if (integrationMode === 'off' || !hasShareIntegrations && !hasAdditionalTabs) {
239
+ return this.renderShareForm();
240
+ }
241
+ if (selectedMenuItem === 'default') {
242
+ return this.renderShareForm();
243
+ }
244
+ if (hasShareIntegrations) {
245
+ var _firstIntegration = shareIntegrations[0];
246
+ if (selectedMenuItem === 'Slack') {
247
+ return /*#__PURE__*/React.createElement(IntegrationForm, {
248
+ Content: _firstIntegration.Content,
249
+ onIntegrationClose: function onIntegrationClose() {
250
+ return handleCloseDialog === null || handleCloseDialog === void 0 ? void 0 : handleCloseDialog();
251
+ }
252
+ });
253
+ }
254
+ if (integrationMode === 'menu') {
255
+ return /*#__PURE__*/React.createElement(Box, {
256
+ xcss: cx(styles.menuGroupContainerStyles),
257
+ backgroundColor: "elevation.surface.overlay"
258
+ }, /*#__PURE__*/React.createElement(MenuGroup, null, /*#__PURE__*/React.createElement(ShareMenuItem, {
259
+ iconName: /*#__PURE__*/React.createElement(_firstIntegration.Icon, null),
260
+ labelId: messages.slackMenuItemText,
261
+ onClickHandler: function onClickHandler() {
262
+ return _this2.changeMenuItem('Slack');
263
+ }
264
+ }), /*#__PURE__*/React.createElement(ShareMenuItem, {
265
+ iconName: /*#__PURE__*/React.createElement(EmailIcon, {
266
+ color: "currentColor",
267
+ label: "",
268
+ LEGACY_size: "medium",
269
+ spacing: "spacious"
270
+ }),
271
+ labelId: messages.emailMenuItemText,
272
+ onClickHandler: function onClickHandler() {
273
+ return _this2.changeMenuItem('default');
274
+ }
275
+ })));
276
+ }
277
+ }
278
+ if (integrationMode === 'tabs') {
279
+ var DEFAULT_TAB_CONTENT_WIDTH = 304;
280
+ return /*#__PURE__*/React.createElement(Tabs, {
281
+ id: "ShareForm-Tabs-Integrations",
282
+ onChange: this.changeTab,
283
+ selected: this.state.selectedTab
284
+ }, /*#__PURE__*/React.createElement(TabList, null, /*#__PURE__*/React.createElement(Tab, {
285
+ key: "share-tab-default"
286
+ }, this.renderMainTabTitle()), shareIntegrations === null || shareIntegrations === void 0 ? void 0 : shareIntegrations.map(function (integration) {
287
+ return /*#__PURE__*/React.createElement(Tab, {
288
+ key: "share-tab-".concat(integration.type)
289
+ }, /*#__PURE__*/React.createElement(Box, {
290
+ xcss: cx(styles.integrationWrapperStyles)
291
+ }, /*#__PURE__*/React.createElement(Box, {
292
+ as: "span",
293
+ xcss: cx(styles.integrationIconWrapperStyles)
294
+ }, /*#__PURE__*/React.createElement(integration.Icon, null)), integrationTabText(integration.type)));
295
+ }), fg('smart_links_for_plans_platform') && (additionalTabs === null || additionalTabs === void 0 ? void 0 : additionalTabs.map(function (tab) {
296
+ return /*#__PURE__*/React.createElement(Tab, {
297
+ key: "share-tab-".concat(tab.label)
298
+ }, tab.label);
299
+ }))), /*#__PURE__*/React.createElement(TabPanel, {
300
+ key: "share-tabPanel-default"
301
+ }, /*#__PURE__*/React.createElement(Box, {
302
+ xcss: cx(styles.formWrapperStyles)
303
+ }, /*#__PURE__*/React.createElement("div", {
304
+ style: {
305
+ width: "".concat(builtInTabContentWidth || DEFAULT_TAB_CONTENT_WIDTH, "px")
306
+ }
307
+ }, this.renderShareForm()))), shareIntegrations === null || shareIntegrations === void 0 ? void 0 : shareIntegrations.map(function (integration) {
308
+ return /*#__PURE__*/React.createElement(TabPanel, {
309
+ key: "share-tabPanel-integration"
310
+ }, /*#__PURE__*/React.createElement(AnalyticsContext, {
311
+ data: {
312
+ source: INTEGRATION_MODAL_SOURCE
313
+ }
314
+ }, /*#__PURE__*/React.createElement(Box, {
315
+ xcss: cx(styles.formWrapperStyles)
316
+ }, /*#__PURE__*/React.createElement("div", {
317
+ style: {
318
+ width: "".concat(builtInTabContentWidth || DEFAULT_TAB_CONTENT_WIDTH, "px")
319
+ }
320
+ }, /*#__PURE__*/React.createElement(IntegrationForm, {
321
+ Content: integration.Content,
322
+ onIntegrationClose: function onIntegrationClose() {
323
+ return handleCloseDialog === null || handleCloseDialog === void 0 ? void 0 : handleCloseDialog();
324
+ },
325
+ changeTab: _this2.changeTab
326
+ })))));
327
+ }), fg('smart_links_for_plans_platform') && (additionalTabs === null || additionalTabs === void 0 ? void 0 : additionalTabs.map(function (tab) {
328
+ return /*#__PURE__*/React.createElement(TabPanel, {
329
+ key: "share-tabPanel-".concat(tab.label)
330
+ }, /*#__PURE__*/React.createElement(Box, {
331
+ xcss: cx(styles.formWrapperStyles)
332
+ }, /*#__PURE__*/React.createElement(IntegrationForm, {
333
+ Content: tab.Content,
334
+ onIntegrationClose: function onIntegrationClose() {
335
+ return handleCloseDialog === null || handleCloseDialog === void 0 ? void 0 : handleCloseDialog();
336
+ },
337
+ changeTab: _this2.changeTab
338
+ })));
339
+ })));
340
+ }
341
+ }
342
+ if (integrationMode === 'off' || !shareIntegrations || !shareIntegrations.length) {
343
+ return this.renderShareForm();
344
+ }
345
+ var firstIntegration = shareIntegrations[0];
346
+ if (selectedMenuItem === 'default') {
347
+ return this.renderShareForm();
348
+ }
349
+ if (selectedMenuItem === 'Slack') {
350
+ return /*#__PURE__*/React.createElement(IntegrationForm, {
351
+ Content: firstIntegration.Content,
352
+ onIntegrationClose: function onIntegrationClose() {
353
+ return handleCloseDialog === null || handleCloseDialog === void 0 ? void 0 : handleCloseDialog();
354
+ }
355
+ });
356
+ }
357
+ if (integrationMode === 'menu') {
358
+ return /*#__PURE__*/React.createElement(Box, {
359
+ xcss: cx(styles.menuGroupContainerStyles),
360
+ backgroundColor: "elevation.surface.overlay"
361
+ }, /*#__PURE__*/React.createElement(MenuGroup, null, /*#__PURE__*/React.createElement(ShareMenuItem, {
362
+ iconName: /*#__PURE__*/React.createElement(firstIntegration.Icon, null),
363
+ labelId: messages.slackMenuItemText,
364
+ onClickHandler: function onClickHandler() {
365
+ return _this2.changeMenuItem('Slack');
366
+ }
367
+ }), /*#__PURE__*/React.createElement(ShareMenuItem, {
368
+ iconName: /*#__PURE__*/React.createElement(EmailIcon, {
369
+ color: "currentColor",
370
+ label: "",
371
+ LEGACY_size: "medium",
372
+ spacing: "spacious"
373
+ }),
374
+ labelId: messages.emailMenuItemText,
375
+ onClickHandler: function onClickHandler() {
376
+ return _this2.changeMenuItem('default');
377
+ }
378
+ })));
379
+ }
380
+ if (integrationMode === 'tabs') {
381
+ var _DEFAULT_TAB_CONTENT_WIDTH = 304;
382
+ return /*#__PURE__*/React.createElement(Tabs, {
383
+ id: "ShareForm-Tabs-Integrations",
384
+ onChange: this.changeTab,
385
+ selected: this.state.selectedTab
386
+ }, /*#__PURE__*/React.createElement(TabList, null, /*#__PURE__*/React.createElement(Tab, {
387
+ key: "share-tab-default"
388
+ }, this.renderMainTabTitle()), /*#__PURE__*/React.createElement(Tab, {
389
+ key: "share-tab-".concat(firstIntegration.type)
390
+ }, /*#__PURE__*/React.createElement(Box, {
391
+ xcss: cx(styles.integrationWrapperStyles)
392
+ }, /*#__PURE__*/React.createElement(Box, {
393
+ as: "span",
394
+ xcss: cx(styles.integrationIconWrapperStyles)
395
+ }, /*#__PURE__*/React.createElement(firstIntegration.Icon, null)), integrationTabText(firstIntegration.type))), fg('smart_links_for_plans_platform') && (additionalTabs === null || additionalTabs === void 0 ? void 0 : additionalTabs.map(function (tab) {
396
+ return /*#__PURE__*/React.createElement(Tab, {
397
+ key: "share-tab-".concat(tab.label)
398
+ }, tab.label);
399
+ }))), /*#__PURE__*/React.createElement(TabPanel, {
400
+ key: "share-tabPanel-default"
401
+ }, /*#__PURE__*/React.createElement(Box, {
402
+ xcss: cx(styles.formWrapperStyles)
403
+ }, /*#__PURE__*/React.createElement("div", {
404
+ style: {
405
+ width: "".concat(builtInTabContentWidth || _DEFAULT_TAB_CONTENT_WIDTH, "px")
406
+ }
407
+ }, this.renderShareForm()))), /*#__PURE__*/React.createElement(TabPanel, {
408
+ key: "share-tabPanel-integration"
409
+ }, /*#__PURE__*/React.createElement(AnalyticsContext, {
410
+ data: {
411
+ source: INTEGRATION_MODAL_SOURCE
412
+ }
413
+ }, /*#__PURE__*/React.createElement(Box, {
414
+ xcss: cx(styles.formWrapperStyles)
415
+ }, /*#__PURE__*/React.createElement("div", {
416
+ style: {
417
+ width: "".concat(builtInTabContentWidth || _DEFAULT_TAB_CONTENT_WIDTH, "px")
418
+ }
419
+ }, /*#__PURE__*/React.createElement(IntegrationForm, {
420
+ Content: firstIntegration.Content,
421
+ onIntegrationClose: function onIntegrationClose() {
422
+ return handleCloseDialog === null || handleCloseDialog === void 0 ? void 0 : handleCloseDialog();
423
+ },
424
+ changeTab: this.changeTab
425
+ }))))), fg('smart_links_for_plans_platform') && (additionalTabs === null || additionalTabs === void 0 ? void 0 : additionalTabs.map(function (tab) {
426
+ return /*#__PURE__*/React.createElement(TabPanel, {
427
+ key: "share-tabPanel-".concat(tab.label)
428
+ }, /*#__PURE__*/React.createElement(Box, {
429
+ xcss: cx(styles.formWrapperStyles)
430
+ }, /*#__PURE__*/React.createElement(IntegrationForm, {
431
+ Content: tab.Content,
432
+ onIntegrationClose: function onIntegrationClose() {
433
+ return handleCloseDialog === null || handleCloseDialog === void 0 ? void 0 : handleCloseDialog();
434
+ },
435
+ changeTab: _this2.changeTab
436
+ })));
437
+ })));
438
+ }
439
+ return this.renderShareForm();
440
+ }
441
+ }]);
442
+ }(React.PureComponent);
443
+ _defineProperty(InternalForm, "defaultProps", {
444
+ onSubmit: function onSubmit() {}
445
+ });
446
+ var InternalFormWithIntl = injectIntl(InternalForm);
447
+ export var ShareForm = function ShareForm(props) {
448
+ return /*#__PURE__*/React.createElement(Form, {
449
+ onSubmit: props.onSubmit
450
+ }, function (_ref) {
451
+ var formProps = _ref.formProps,
452
+ getValues = _ref.getValues;
453
+ return /*#__PURE__*/React.createElement(InternalFormWithIntl, _extends({}, props, {
454
+ formProps: formProps,
455
+ getValues: getValues
456
+ }));
457
+ });
458
+ };
459
+ ShareForm.defaultProps = {
460
+ isSharing: false,
461
+ product: 'confluence',
462
+ onSubmit: function onSubmit() {}
463
+ };
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
2
  import { useIntl } from 'react-intl-next';
3
+ import { fg } from '@atlaskit/platform-feature-flags';
3
4
  import { messages } from '../../i18n';
4
5
  import { ShareHeader } from '../ShareHeader';
6
+ import { InlineDialogContentWrapper as InlineDialogContentWrapperCompiled, InlineDialogFormWrapper as InlineDialogFormWrapperCompiled } from './compiled';
5
7
  import { InlineDialogContentWrapper, InlineDialogFormWrapper } from './styled';
6
8
  var ShareFormWrapper = function ShareFormWrapper(_ref) {
7
9
  var shareFormTitle = _ref.shareFormTitle,
@@ -16,9 +18,11 @@ var ShareFormWrapper = function ShareFormWrapper(_ref) {
16
18
  isMenuItemSelected = _ref$isMenuItemSelect === void 0 ? false : _ref$isMenuItemSelect;
17
19
  var _useIntl = useIntl(),
18
20
  formatMessage = _useIntl.formatMessage;
19
- return /*#__PURE__*/React.createElement(InlineDialogContentWrapper, {
21
+ var ContentWrapper = fg('share-compiled-migration') ? InlineDialogContentWrapperCompiled : InlineDialogContentWrapper;
22
+ var FormWrapper = fg('share-compiled-migration') ? InlineDialogFormWrapperCompiled : InlineDialogFormWrapper;
23
+ return /*#__PURE__*/React.createElement(ContentWrapper, {
20
24
  label: formatMessage(messages.formTitle)
21
- }, /*#__PURE__*/React.createElement(InlineDialogFormWrapper, {
25
+ }, /*#__PURE__*/React.createElement(FormWrapper, {
22
26
  integrationMode: integrationMode,
23
27
  isMenuItemSelected: isMenuItemSelected
24
28
  }, shouldShowTitle && /*#__PURE__*/React.createElement(ShareHeader, {
@@ -0,0 +1,7 @@
1
+ ._19bv1ejb{padding-left:var(--ds-space-300,24px)}
2
+ ._1bsb1j89{width:22pc}
3
+ ._1bsb1wug{width:auto}
4
+ ._1bsbpk3t{width:102px}
5
+ ._ca0qpxbi{padding-top:var(--ds-space-200,1pc)}
6
+ ._n3tdpxbi{padding-bottom:var(--ds-space-200,1pc)}
7
+ ._u5f31ejb{padding-right:var(--ds-space-300,24px)}
@@ -0,0 +1,41 @@
1
+ /* compiled.tsx generated by @compiled/babel-plugin v0.36.1 */
2
+ import "./compiled.compiled.css";
3
+ import { ax, ix } from "@compiled/react/runtime";
4
+ import React from 'react';
5
+ import { cx } from '@atlaskit/css';
6
+ import { fg } from '@atlaskit/platform-feature-flags';
7
+ import { Box } from '@atlaskit/primitives/compiled';
8
+ var styles = {
9
+ menuNotSelectedAndMenuIntegration: "_1bsbpk3t",
10
+ tabsIntegration: "_1bsb1wug",
11
+ default: "_1bsb1j89",
12
+ inlineDialogContentWrapper: "_ca0qpxbi _u5f31ejb _n3tdpxbi _19bv1ejb"
13
+ };
14
+ export var InlineDialogFormWrapper = function InlineDialogFormWrapper(_ref) {
15
+ var children = _ref.children,
16
+ integrationMode = _ref.integrationMode,
17
+ isMenuItemSelected = _ref.isMenuItemSelected;
18
+ if (!isMenuItemSelected && integrationMode === 'menu') {
19
+ return /*#__PURE__*/React.createElement(Box, {
20
+ xcss: cx(styles.menuNotSelectedAndMenuIntegration)
21
+ }, children);
22
+ }
23
+ if (fg('smart_links_for_plans_platform')) {
24
+ if (integrationMode === 'tabs') {
25
+ return /*#__PURE__*/React.createElement(Box, {
26
+ xcss: cx(styles.tabsIntegration)
27
+ }, children);
28
+ }
29
+ }
30
+ return /*#__PURE__*/React.createElement(Box, {
31
+ xcss: cx(styles.default)
32
+ }, children);
33
+ };
34
+ export var InlineDialogContentWrapper = function InlineDialogContentWrapper(_ref2) {
35
+ var children = _ref2.children,
36
+ label = _ref2.label;
37
+ return /*#__PURE__*/React.createElement(Box, {
38
+ "aria-label": label,
39
+ xcss: styles.inlineDialogContentWrapper
40
+ }, children);
41
+ };
@@ -14,6 +14,7 @@ import { FormattedMessage } from 'react-intl-next';
14
14
  import { SplitButton as AKSplitButton, IconButton } from '@atlaskit/button/new';
15
15
  import DropdownMenu, { DropdownItem, DropdownItemGroup } from '@atlaskit/dropdown-menu';
16
16
  import ChevronDownIcon from '@atlaskit/icon/utility/migration/chevron-down';
17
+ import { fg } from '@atlaskit/platform-feature-flags';
17
18
  import { N800 } from '@atlaskit/theme/colors';
18
19
  import { messages } from '../i18n';
19
20
  import { shareIntegrationButtonEvent } from './analytics/analytics';
@@ -30,6 +31,15 @@ var integrationButtonText = function integrationButtonText(integrationName) {
30
31
  }
31
32
  }));
32
33
  };
34
+ var IntegrationButtonWrapper = function IntegrationButtonWrapper(_ref) {
35
+ var children = _ref.children;
36
+ return (
37
+ // The css has no discernible effect on the button, so it is not included in the migration
38
+ fg('share-compiled-migration') ? jsx("span", null, children) : jsx("span", {
39
+ css: dropDownIntegrationButtonWrapperStyles
40
+ }, children)
41
+ );
42
+ };
33
43
  var SplitButtonDropdown = function SplitButtonDropdown(props) {
34
44
  var triggerButtonAppearance = props.triggerButtonAppearance,
35
45
  isUsingSplitButton = props.isUsingSplitButton,
@@ -38,8 +48,8 @@ var SplitButtonDropdown = function SplitButtonDropdown(props) {
38
48
  shareIntegrations = props.shareIntegrations,
39
49
  onIntegrationClick = props.onIntegrationClick,
40
50
  createAndFireEvent = props.createAndFireEvent;
41
- var onOpenChange = useCallback(function (_ref) {
42
- var isOpen = _ref.isOpen;
51
+ var onOpenChange = useCallback(function (_ref2) {
52
+ var isOpen = _ref2.isOpen;
43
53
  if (isOpen) {
44
54
  handleOpenSplitButton();
45
55
  } else {
@@ -52,9 +62,9 @@ var SplitButtonDropdown = function SplitButtonDropdown(props) {
52
62
  }, [createAndFireEvent, onIntegrationClick]);
53
63
  return jsx(DropdownMenu, {
54
64
  testId: "split-button-dropdown",
55
- trigger: function trigger(_ref2) {
56
- var triggerRef = _ref2.triggerRef,
57
- providedProps = _objectWithoutProperties(_ref2, _excluded);
65
+ trigger: function trigger(_ref3) {
66
+ var triggerRef = _ref3.triggerRef,
67
+ providedProps = _objectWithoutProperties(_ref3, _excluded);
58
68
  return jsx(IconButton, _extends({
59
69
  label: ""
60
70
  }, providedProps, {
@@ -70,9 +80,7 @@ var SplitButtonDropdown = function SplitButtonDropdown(props) {
70
80
  return jsx(DropdownItem, {
71
81
  key: integration.type,
72
82
  testId: "split-button-dropdownitem-".concat(integration.type)
73
- }, jsx("span", {
74
- css: dropDownIntegrationButtonWrapperStyles
75
- }, jsx(IntegrationButton, {
83
+ }, jsx(IntegrationButtonWrapper, null, jsx(IntegrationButton, {
76
84
  textColor: "var(--ds-text, ".concat(N800, ")"),
77
85
  appearance: "subtle",
78
86
  onClick: function onClick() {
@@ -85,15 +93,15 @@ var SplitButtonDropdown = function SplitButtonDropdown(props) {
85
93
  })));
86
94
  };
87
95
  SplitButtonDropdown.displayName = 'SplitButtonDropdown';
88
- export default function SplitButton(_ref3) {
89
- var shareButton = _ref3.shareButton,
90
- handleOpenSplitButton = _ref3.handleOpenSplitButton,
91
- handleCloseSplitButton = _ref3.handleCloseSplitButton,
92
- isUsingSplitButton = _ref3.isUsingSplitButton,
93
- shareIntegrations = _ref3.shareIntegrations,
94
- onIntegrationClick = _ref3.onIntegrationClick,
95
- triggerButtonAppearance = _ref3.triggerButtonAppearance,
96
- createAndFireEvent = _ref3.createAndFireEvent;
96
+ export default function SplitButton(_ref4) {
97
+ var shareButton = _ref4.shareButton,
98
+ handleOpenSplitButton = _ref4.handleOpenSplitButton,
99
+ handleCloseSplitButton = _ref4.handleCloseSplitButton,
100
+ isUsingSplitButton = _ref4.isUsingSplitButton,
101
+ shareIntegrations = _ref4.shareIntegrations,
102
+ onIntegrationClick = _ref4.onIntegrationClick,
103
+ triggerButtonAppearance = _ref4.triggerButtonAppearance,
104
+ createAndFireEvent = _ref4.createAndFireEvent;
97
105
  return jsx(AKSplitButton, {
98
106
  "data-testid": "split-button",
99
107
  appearance: triggerButtonAppearance
@@ -293,7 +293,9 @@ export var UserPickerFieldComponent = /*#__PURE__*/function (_React$Component) {
293
293
  }, /*#__PURE__*/React.createElement(FormattedMessage, getPlaceHolderMessage(product, allowEmail, isBrowseUsersDisabled))),
294
294
  menuPortalTarget: menuPortalTarget,
295
295
  inputId: fieldProps.id
296
- })), helperMessage && !wasValidationOrShareError && /*#__PURE__*/React.createElement(HelperMessage, null, helperMessage), !fieldValid && fieldValidationError === REQUIRED && /*#__PURE__*/React.createElement(ErrorMessage, null, /*#__PURE__*/React.createElement(FormattedMessage, requiredMessage)), shareError && shareError.errorCode && /*#__PURE__*/React.createElement(ErrorMessage, null, shareError.message, "\xA0", shareError.helpUrl && /*#__PURE__*/React.createElement(Link, {
296
+ })), helperMessage && !wasValidationOrShareError && /*#__PURE__*/React.createElement(HelperMessage, {
297
+ testId: "user-picker"
298
+ }, helperMessage), !fieldValid && fieldValidationError === REQUIRED && /*#__PURE__*/React.createElement(ErrorMessage, null, /*#__PURE__*/React.createElement(FormattedMessage, requiredMessage)), shareError && shareError.errorCode && /*#__PURE__*/React.createElement(ErrorMessage, null, shareError.message, "\xA0", shareError.helpUrl && /*#__PURE__*/React.createElement(Link, {
297
299
  target: "_blank",
298
300
  href: shareError.helpUrl,
299
301
  rel: "help"
@@ -6,7 +6,7 @@ var buildAttributes = function buildAttributes() {
6
6
  var attributes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7
7
  return _objectSpread({
8
8
  packageName: "@atlaskit/share",
9
- packageVersion: "5.0.0"
9
+ packageVersion: "6.0.0"
10
10
  }, attributes);
11
11
  };
12
12
  var createEvent = function createEvent(eventType, source, action, actionSubject, actionSubjectId) {
@@ -25,7 +25,7 @@ export type Props = {
25
25
  export type State = {
26
26
  shouldShowCopiedMessage: boolean;
27
27
  };
28
- export declare class CopyLinkButton extends React.Component<Props, State> {
28
+ export declare class CopyLinkButtonInner extends React.Component<Props, State> {
29
29
  private autoDismiss;
30
30
  private inputRef;
31
31
  state: {
@@ -38,4 +38,5 @@ export declare class CopyLinkButton extends React.Component<Props, State> {
38
38
  renderTriggerButton: (triggerProps: TriggerProps) => jsx.JSX.Element;
39
39
  render(): jsx.JSX.Element;
40
40
  }
41
+ export declare const CopyLinkButton: (props: Props) => jsx.JSX.Element;
41
42
  export default CopyLinkButton;