@atlaskit/share 3.4.0 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/copy-link-button/package.json +7 -0
  3. package/dist/cjs/components/CopyLinkButton.js +14 -19
  4. package/dist/cjs/components/LazyShareForm/LazyShareForm.js +5 -0
  5. package/dist/cjs/components/LazyShareForm/lazy.js +9 -2
  6. package/dist/cjs/components/ShareDialogWithTrigger.js +34 -18
  7. package/dist/cjs/components/ShareForm.js +5 -3
  8. package/dist/cjs/components/analytics/analytics.js +1 -1
  9. package/dist/cjs/index.js +8 -0
  10. package/dist/cjs/version.json +1 -1
  11. package/dist/es2019/components/CopyLinkButton.js +14 -19
  12. package/dist/es2019/components/LazyShareForm/LazyShareForm.js +4 -0
  13. package/dist/es2019/components/LazyShareForm/lazy.js +14 -7
  14. package/dist/es2019/components/ShareDialogWithTrigger.js +23 -8
  15. package/dist/es2019/components/ShareForm.js +7 -3
  16. package/dist/es2019/components/analytics/analytics.js +1 -1
  17. package/dist/es2019/index.js +1 -0
  18. package/dist/es2019/version.json +1 -1
  19. package/dist/esm/components/CopyLinkButton.js +14 -15
  20. package/dist/esm/components/LazyShareForm/LazyShareForm.js +4 -0
  21. package/dist/esm/components/LazyShareForm/lazy.js +7 -2
  22. package/dist/esm/components/ShareDialogWithTrigger.js +36 -18
  23. package/dist/esm/components/ShareForm.js +5 -3
  24. package/dist/esm/components/analytics/analytics.js +1 -1
  25. package/dist/esm/index.js +1 -0
  26. package/dist/esm/version.json +1 -1
  27. package/dist/types/components/CopyLinkButton.d.ts +7 -8
  28. package/dist/types/components/LazyShareForm/LazyShareForm.d.ts +1 -0
  29. package/dist/types/components/ShareDialogWithTrigger.d.ts +2 -0
  30. package/dist/types/index.d.ts +1 -0
  31. package/dist/types/types/ShareDialogWithTrigger.d.ts +1 -0
  32. package/package.json +11 -10
  33. package/report.api.md +32 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/share
2
2
 
3
+ ## 3.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`76c73df383f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/76c73df383f) - Exposed CopyLinkButton from share component and made it generic.
8
+
9
+ ## 3.4.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [`8d4228767b0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8d4228767b0) - Upgrade Typescript from `4.2.4` to `4.3.5`.
14
+
15
+ ## 3.4.1
16
+
17
+ ### Patch Changes
18
+
19
+ - [`620f202bc02`](https://bitbucket.org/atlassian/atlassian-frontend/commits/620f202bc02) - Prevent event propagation in Share loading state
20
+
3
21
  ## 3.4.0
4
22
 
5
23
  ### Minor Changes
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "@atlaskit/share/copy-link-button",
3
+ "main": "../dist/cjs/components/CopyLinkButton.js",
4
+ "module": "../dist/esm/components/CopyLinkButton.js",
5
+ "module:es2019": "../dist/es2019/components/CopyLinkButton.js",
6
+ "types": "../dist/types/components/CopyLinkButton.d.ts"
7
+ }
@@ -29,8 +29,6 @@ var _react = _interopRequireDefault(require("react"));
29
29
 
30
30
  var _react2 = require("@emotion/react");
31
31
 
32
- var _reactIntlNext = require("react-intl-next");
33
-
34
32
  var _checkCircle = _interopRequireDefault(require("@atlaskit/icon/glyph/check-circle"));
35
33
 
36
34
  var _linkFilled = _interopRequireDefault(require("@atlaskit/icon/glyph/link-filled"));
@@ -45,8 +43,6 @@ var _tokens = require("@atlaskit/tokens");
45
43
 
46
44
  var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
47
45
 
48
- var _i18n = require("../i18n");
49
-
50
46
  var _styled = require("./ShareFormWrapper/styled");
51
47
 
52
48
  var _styles = _interopRequireDefault(require("./styles"));
@@ -64,8 +60,8 @@ var AUTO_DISMISS_MS = AUTO_DISMISS_SECONDS * 1000;
64
60
  exports.AUTO_DISMISS_MS = AUTO_DISMISS_MS;
65
61
  var messageContainerStyle = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n align-items: center;\n margin: -8px -16px;\n"])));
66
62
  exports.messageContainerStyle = messageContainerStyle;
67
- var isSafari = navigator.userAgent.indexOf('Safari');
68
63
  var messageTextStyle = (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n text-indent: 6px;\n"])));
64
+ var isSafari = navigator.userAgent.indexOf('Safari');
69
65
 
70
66
  var HiddenInput = /*#__PURE__*/_react.default.forwardRef( // we need a hidden input to reliably copy to clipboard across all browsers.
71
67
  function (props, ref) {
@@ -140,19 +136,20 @@ var CopyLinkButton = /*#__PURE__*/function (_React$Component) {
140
136
  });
141
137
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderTriggerButton", function (triggerProps) {
142
138
  var _this$props = _this.props,
143
- formatMessage = _this$props.intl.formatMessage,
144
139
  isDisabled = _this$props.isDisabled,
145
- isPublicLink = _this$props.isPublicLink;
140
+ copyLinkButtonText = _this$props.copyLinkButtonText,
141
+ children = _this$props.children,
142
+ iconBefore = _this$props.iconBefore;
146
143
  return (0, _react2.jsx)(_styles.default, (0, _extends2.default)({
147
- "aria-label": formatMessage(isPublicLink ? _i18n.messages.copyPublicLinkButtonText : _i18n.messages.copyLinkButtonText),
144
+ "aria-label": copyLinkButtonText,
148
145
  isDisabled: isDisabled,
149
146
  appearance: "subtle-link",
150
- iconBefore: (0, _react2.jsx)(_linkFilled.default, {
147
+ iconBefore: iconBefore || (0, _react2.jsx)(_linkFilled.default, {
151
148
  label: "",
152
149
  size: "medium"
153
150
  }),
154
151
  onClick: _this.handleClick
155
- }, triggerProps), (0, _react2.jsx)(_reactIntlNext.FormattedMessage, isPublicLink ? _i18n.messages.copyPublicLinkButtonText : _i18n.messages.copyLinkButtonText));
152
+ }, triggerProps), children || copyLinkButtonText);
156
153
  });
157
154
  return _this;
158
155
  }
@@ -169,12 +166,12 @@ var CopyLinkButton = /*#__PURE__*/function (_React$Component) {
169
166
 
170
167
  var shouldShowCopiedMessage = this.state.shouldShowCopiedMessage;
171
168
  var _this$props2 = this.props,
172
- formatMessage = _this$props2.intl.formatMessage,
173
- copyTooltipText = _this$props2.copyTooltipText;
169
+ copyTooltipText = _this$props2.copyTooltipText,
170
+ copiedToClipboardText = _this$props2.copiedToClipboardText;
174
171
  return (0, _react2.jsx)(_react.default.Fragment, null, isSafari && (0, _react2.jsx)("div", {
175
172
  className: "assistive",
176
173
  "aria-live": "assertive"
177
- }, shouldShowCopiedMessage && formatMessage(_i18n.messages.copiedToClipboardMessage)), (0, _react2.jsx)(HiddenInput, {
174
+ }, shouldShowCopiedMessage && copiedToClipboardText), (0, _react2.jsx)(HiddenInput, {
178
175
  ref: this.inputRef,
179
176
  text: this.props.link
180
177
  }), (0, _react2.jsx)(_popup.default, {
@@ -183,12 +180,12 @@ var CopyLinkButton = /*#__PURE__*/function (_React$Component) {
183
180
  return (0, _react2.jsx)(_styled.InlineDialogContentWrapper, null, (0, _react2.jsx)("div", {
184
181
  css: messageContainerStyle,
185
182
  "data-testid": "message-container"
186
- }, (0, _react2.jsx)(_checkCircle.default, {
183
+ }, (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)(_checkCircle.default, {
187
184
  label: "",
188
185
  primaryColor: (0, _tokens.token)('color.icon.success', _colors.G300)
189
- }), (0, _react2.jsx)("span", {
186
+ }), (0, _react2.jsx)("div", {
190
187
  css: messageTextStyle
191
- }, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _i18n.messages.copiedToClipboardMessage))));
188
+ }, copiedToClipboardText))));
192
189
  },
193
190
  isOpen: shouldShowCopiedMessage,
194
191
  onClose: this.handleDismissCopiedMessage,
@@ -206,7 +203,5 @@ var CopyLinkButton = /*#__PURE__*/function (_React$Component) {
206
203
  }(_react.default.Component);
207
204
 
208
205
  exports.CopyLinkButton = CopyLinkButton;
209
-
210
- var _default = (0, _reactIntlNext.injectIntl)(CopyLinkButton);
211
-
206
+ var _default = CopyLinkButton;
212
207
  exports.default = _default;
@@ -29,6 +29,7 @@ function LazyShareForm(props) {
29
29
  var copyLink = props.copyLink,
30
30
  config = props.config,
31
31
  isFetchingConfig = props.isFetchingConfig,
32
+ setIsLoading = props.setIsLoading,
32
33
  loadOptions = props.loadOptions,
33
34
  shareFormTitle = props.shareFormTitle,
34
35
  shareFormHelperMessage = props.shareFormHelperMessage,
@@ -61,6 +62,10 @@ function LazyShareForm(props) {
61
62
 
62
63
  var footer = /*#__PURE__*/_react.default.createElement("div", null, bottomMessage ? /*#__PURE__*/_react.default.createElement(_styled.BottomMessageWrapper, null, bottomMessage) : null, customFooter && selectedIntegration === null && /*#__PURE__*/_react.default.createElement(_styled.CustomFooterWrapper, null, customFooter));
63
64
 
65
+ _react.default.useEffect(function () {
66
+ setIsLoading(false);
67
+ });
68
+
64
69
  return /*#__PURE__*/_react.default.createElement(_ShareFormWrapper.ShareFormWrapper, {
65
70
  footer: footer // form title will be determined by `title` and `showTitle` prop passed to `ShareForm`,
66
71
  // so we don't need to show title via ShareFormWrapper
@@ -33,7 +33,13 @@ var LazyShareFormLazy = (0, _reactLooselyLazy.lazyForPaint)(function () {
33
33
 
34
34
  var LoadingDialog = function LoadingDialog(_ref) {
35
35
  var shareFormTitle = _ref.shareFormTitle,
36
- showTitle = _ref.showTitle;
36
+ showTitle = _ref.showTitle,
37
+ setIsLoading = _ref.setIsLoading;
38
+
39
+ _react.default.useEffect(function () {
40
+ setIsLoading(true);
41
+ });
42
+
37
43
  return /*#__PURE__*/_react.default.createElement(_ShareFormWrapper.ShareFormWrapper, {
38
44
  shareFormTitle: shareFormTitle // if `showTitle` is passed, we use it. Otherwise, we will show title for loading dialog.
39
45
  ,
@@ -45,7 +51,8 @@ var _default = function _default(props) {
45
51
  return /*#__PURE__*/_react.default.createElement(_reactLooselyLazy.LazySuspense, {
46
52
  fallback: /*#__PURE__*/_react.default.createElement(LoadingDialog, {
47
53
  shareFormTitle: props.shareFormTitle,
48
- showTitle: props.showTitle
54
+ showTitle: props.showTitle,
55
+ setIsLoading: props.setIsLoading
49
56
  })
50
57
  }, /*#__PURE__*/_react.default.createElement(LazyShareFormLazy, props));
51
58
  };
@@ -108,7 +108,8 @@ var ShareDialogWithTriggerInternal = /*#__PURE__*/function (_React$PureComponent
108
108
  isUsingSplitButton: false,
109
109
  showIntegrationForm: false,
110
110
  selectedIntegration: null,
111
- tabIndex: 0
111
+ tabIndex: 0,
112
+ isLoading: false
112
113
  });
113
114
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "closeAndResetDialog", function () {
114
115
  _this.setState({
@@ -175,10 +176,28 @@ var ShareDialogWithTriggerInternal = /*#__PURE__*/function (_React$PureComponent
175
176
  type: _types.OBJECT_SHARED
176
177
  }];
177
178
  });
179
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "setIsLoading", function (isLoading) {
180
+ _this.setState({
181
+ isLoading: isLoading
182
+ });
183
+ });
184
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "focus", function () {
185
+ if (_this.containerRef.current) {
186
+ _this.containerRef.current.focus();
187
+ }
188
+ });
178
189
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleKeyDown", function (event) {
179
- var isDialogOpen = _this.state.isDialogOpen;
190
+ var _this$state = _this.state,
191
+ isLoading = _this$state.isLoading,
192
+ isDialogOpen = _this$state.isDialogOpen;
180
193
  var shouldCloseOnEscapePress = _this.props.shouldCloseOnEscapePress;
181
194
 
195
+ if (isLoading) {
196
+ event.stopPropagation();
197
+
198
+ _this.focus();
199
+ }
200
+
182
201
  if (isDialogOpen) {
183
202
  switch (event.key) {
184
203
  case 'Esc':
@@ -190,9 +209,7 @@ var ShareDialogWithTriggerInternal = /*#__PURE__*/function (_React$PureComponent
190
209
  event.stopPropagation(); // put the focus back onto the share dialog so that
191
210
  // the user can press the escape key again to close the dialog
192
211
 
193
- if (_this.containerRef.current) {
194
- _this.containerRef.current.focus();
195
- }
212
+ _this.focus();
196
213
 
197
214
  return;
198
215
  } // The dialog will auto-close in @atlaskit/popup, we just need to fire
@@ -238,9 +255,7 @@ var ShareDialogWithTriggerInternal = /*#__PURE__*/function (_React$PureComponent
238
255
  onDialogOpen();
239
256
  }
240
257
 
241
- if (_this.containerRef.current) {
242
- _this.containerRef.current.focus();
243
- }
258
+ _this.focus();
244
259
  }
245
260
  });
246
261
  });
@@ -339,9 +354,9 @@ var ShareDialogWithTriggerInternal = /*#__PURE__*/function (_React$PureComponent
339
354
  });
340
355
  });
341
356
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderShareTriggerButton", function (triggerProps) {
342
- var _this$state = _this.state,
343
- isDialogOpen = _this$state.isDialogOpen,
344
- isUsingSplitButton = _this$state.isUsingSplitButton;
357
+ var _this$state2 = _this.state,
358
+ isDialogOpen = _this$state2.isDialogOpen,
359
+ isUsingSplitButton = _this$state2.isUsingSplitButton;
345
360
  var _this$props6 = _this.props,
346
361
  formatMessage = _this$props6.intl.formatMessage,
347
362
  isDisabled = _this$props6.isDisabled,
@@ -443,13 +458,13 @@ var ShareDialogWithTriggerInternal = /*#__PURE__*/function (_React$PureComponent
443
458
  value: function render() {
444
459
  var _this2 = this;
445
460
 
446
- var _this$state2 = this.state,
447
- isDialogOpen = _this$state2.isDialogOpen,
448
- isSharing = _this$state2.isSharing,
449
- shareError = _this$state2.shareError,
450
- defaultValue = _this$state2.defaultValue,
451
- showIntegrationForm = _this$state2.showIntegrationForm,
452
- selectedIntegration = _this$state2.selectedIntegration;
461
+ var _this$state3 = this.state,
462
+ isDialogOpen = _this$state3.isDialogOpen,
463
+ isSharing = _this$state3.isSharing,
464
+ shareError = _this$state3.shareError,
465
+ defaultValue = _this$state3.defaultValue,
466
+ showIntegrationForm = _this$state3.showIntegrationForm,
467
+ selectedIntegration = _this$state3.selectedIntegration;
453
468
  var _this$props7 = this.props,
454
469
  copyLink = _this$props7.copyLink,
455
470
  dialogPlacement = _this$props7.dialogPlacement,
@@ -504,6 +519,7 @@ var ShareDialogWithTriggerInternal = /*#__PURE__*/function (_React$PureComponent
504
519
  defaultValue: defaultValue,
505
520
  config: config,
506
521
  isFetchingConfig: isFetchingConfig,
522
+ setIsLoading: _this2.setIsLoading,
507
523
  submitButtonLabel: submitButtonLabel,
508
524
  product: product,
509
525
  enableSmartUserPicker: enableSmartUserPicker,
@@ -142,7 +142,8 @@ var InternalForm = /*#__PURE__*/function (_React$PureComponent) {
142
142
  isPublicLink = _this$props.isPublicLink,
143
143
  copyTooltipText = _this$props.copyTooltipText,
144
144
  helperMessage = _this$props.helperMessage,
145
- orgId = _this$props.orgId;
145
+ orgId = _this$props.orgId,
146
+ formatMessage = _this$props.intl.formatMessage;
146
147
  return (0, _react2.jsx)(_analyticsNext.AnalyticsContext, {
147
148
  data: {
148
149
  source: _analytics.ANALYTICS_SOURCE
@@ -177,8 +178,9 @@ var InternalForm = /*#__PURE__*/function (_React$PureComponent) {
177
178
  isDisabled: isDisabled,
178
179
  onLinkCopy: onLinkCopy,
179
180
  link: copyLink,
180
- isPublicLink: isPublicLink,
181
- copyTooltipText: copyTooltipText
181
+ copyTooltipText: copyTooltipText,
182
+ copyLinkButtonText: formatMessage(isPublicLink ? _i18n.messages.copyPublicLinkButtonText : _i18n.messages.copyLinkButtonText),
183
+ copiedToClipboardText: formatMessage(_i18n.messages.copiedToClipboardMessage)
182
184
  }), _this.renderSubmitButton())));
183
185
  });
184
186
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderSubmitButton", function () {
@@ -19,7 +19,7 @@ var buildAttributes = function buildAttributes() {
19
19
  var attributes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
20
20
  return _objectSpread({
21
21
  packageName: "@atlaskit/share",
22
- packageVersion: "3.4.0"
22
+ packageVersion: "3.5.0"
23
23
  }, attributes);
24
24
  };
25
25
 
package/dist/cjs/index.js CHANGED
@@ -9,6 +9,12 @@ Object.defineProperty(exports, "ADMIN_NOTIFIED", {
9
9
  return _types.ADMIN_NOTIFIED;
10
10
  }
11
11
  });
12
+ Object.defineProperty(exports, "CopyLinkButton", {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _CopyLinkButton.CopyLinkButton;
16
+ }
17
+ });
12
18
  Object.defineProperty(exports, "OBJECT_SHARED", {
13
19
  enumerable: true,
14
20
  get: function get() {
@@ -24,4 +30,6 @@ Object.defineProperty(exports, "ShareDialogContainer", {
24
30
 
25
31
  var _ShareDialogContainer = require("./components/ShareDialogContainer");
26
32
 
33
+ var _CopyLinkButton = require("./components/CopyLinkButton");
34
+
27
35
  var _types = require("./types");
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/share",
3
- "version": "3.4.0"
3
+ "version": "3.5.0"
4
4
  }
@@ -4,7 +4,6 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
4
  /** @jsx jsx */
5
5
  import React from 'react';
6
6
  import { css, jsx } from '@emotion/react';
7
- import { FormattedMessage, injectIntl } from 'react-intl-next';
8
7
  import CheckCircleIcon from '@atlaskit/icon/glyph/check-circle';
9
8
  import LinkFilledIcon from '@atlaskit/icon/glyph/link-filled';
10
9
  import Popup from '@atlaskit/popup';
@@ -12,7 +11,6 @@ import { G300 } from '@atlaskit/theme/colors';
12
11
  import { layers } from '@atlaskit/theme/constants';
13
12
  import { token } from '@atlaskit/tokens';
14
13
  import Tooltip from '@atlaskit/tooltip';
15
- import { messages } from '../i18n';
16
14
  import { InlineDialogContentWrapper } from './ShareFormWrapper/styled';
17
15
  import Button from './styles';
18
16
  const Z_INDEX = layers.modal();
@@ -23,10 +21,10 @@ export const messageContainerStyle = css`
23
21
  align-items: center;
24
22
  margin: -8px -16px;
25
23
  `;
26
- const isSafari = navigator.userAgent.indexOf('Safari');
27
24
  const messageTextStyle = css`
28
25
  text-indent: 6px;
29
26
  `;
27
+ const isSafari = navigator.userAgent.indexOf('Safari');
30
28
  export const HiddenInput = /*#__PURE__*/React.forwardRef( // we need a hidden input to reliably copy to clipboard across all browsers.
31
29
  (props, ref) => jsx("input", {
32
30
  style: {
@@ -86,22 +84,21 @@ export class CopyLinkButton extends React.Component {
86
84
 
87
85
  _defineProperty(this, "renderTriggerButton", triggerProps => {
88
86
  const {
89
- intl: {
90
- formatMessage
91
- },
92
87
  isDisabled,
93
- isPublicLink
88
+ copyLinkButtonText,
89
+ children,
90
+ iconBefore
94
91
  } = this.props;
95
92
  return jsx(Button, _extends({
96
- "aria-label": formatMessage(isPublicLink ? messages.copyPublicLinkButtonText : messages.copyLinkButtonText),
93
+ "aria-label": copyLinkButtonText,
97
94
  isDisabled: isDisabled,
98
95
  appearance: "subtle-link",
99
- iconBefore: jsx(LinkFilledIcon, {
96
+ iconBefore: iconBefore || jsx(LinkFilledIcon, {
100
97
  label: "",
101
98
  size: "medium"
102
99
  }),
103
100
  onClick: this.handleClick
104
- }, triggerProps), jsx(FormattedMessage, isPublicLink ? messages.copyPublicLinkButtonText : messages.copyLinkButtonText));
101
+ }, triggerProps), children || copyLinkButtonText);
105
102
  });
106
103
  }
107
104
 
@@ -114,15 +111,13 @@ export class CopyLinkButton extends React.Component {
114
111
  shouldShowCopiedMessage
115
112
  } = this.state;
116
113
  const {
117
- intl: {
118
- formatMessage
119
- },
120
- copyTooltipText
114
+ copyTooltipText,
115
+ copiedToClipboardText
121
116
  } = this.props;
122
117
  return jsx(React.Fragment, null, isSafari && jsx("div", {
123
118
  className: "assistive",
124
119
  "aria-live": "assertive"
125
- }, shouldShowCopiedMessage && formatMessage(messages.copiedToClipboardMessage)), jsx(HiddenInput, {
120
+ }, shouldShowCopiedMessage && copiedToClipboardText), jsx(HiddenInput, {
126
121
  ref: this.inputRef,
127
122
  text: this.props.link
128
123
  }), jsx(Popup, {
@@ -130,12 +125,12 @@ export class CopyLinkButton extends React.Component {
130
125
  content: () => jsx(InlineDialogContentWrapper, null, jsx("div", {
131
126
  css: messageContainerStyle,
132
127
  "data-testid": "message-container"
133
- }, jsx(CheckCircleIcon, {
128
+ }, jsx(React.Fragment, null, jsx(CheckCircleIcon, {
134
129
  label: "",
135
130
  primaryColor: token('color.icon.success', G300)
136
- }), jsx("span", {
131
+ }), jsx("div", {
137
132
  css: messageTextStyle
138
- }, jsx(FormattedMessage, messages.copiedToClipboardMessage)))),
133
+ }, copiedToClipboardText)))),
139
134
  isOpen: shouldShowCopiedMessage,
140
135
  onClose: this.handleDismissCopiedMessage,
141
136
  placement: "top-start",
@@ -147,4 +142,4 @@ export class CopyLinkButton extends React.Component {
147
142
  }
148
143
 
149
144
  }
150
- export default injectIntl(CopyLinkButton);
145
+ export default CopyLinkButton;
@@ -15,6 +15,7 @@ function LazyShareForm(props) {
15
15
  copyLink,
16
16
  config,
17
17
  isFetchingConfig,
18
+ setIsLoading,
18
19
  loadOptions,
19
20
  shareFormTitle,
20
21
  shareFormHelperMessage,
@@ -49,6 +50,9 @@ function LazyShareForm(props) {
49
50
  orgId
50
51
  } = props;
51
52
  const footer = /*#__PURE__*/React.createElement("div", null, bottomMessage ? /*#__PURE__*/React.createElement(BottomMessageWrapper, null, bottomMessage) : null, customFooter && selectedIntegration === null && /*#__PURE__*/React.createElement(CustomFooterWrapper, null, customFooter));
53
+ React.useEffect(() => {
54
+ setIsLoading(false);
55
+ });
52
56
  return /*#__PURE__*/React.createElement(ShareFormWrapper, {
53
57
  footer: footer // form title will be determined by `title` and `showTitle` prop passed to `ShareForm`,
54
58
  // so we don't need to show title via ShareFormWrapper
@@ -11,16 +11,23 @@ const LazyShareFormLazy = lazyForPaint(() => import(
11
11
 
12
12
  const LoadingDialog = ({
13
13
  shareFormTitle,
14
- showTitle
15
- }) => /*#__PURE__*/React.createElement(ShareFormWrapper, {
16
- shareFormTitle: shareFormTitle // if `showTitle` is passed, we use it. Otherwise, we will show title for loading dialog.
17
- ,
18
- shouldShowTitle: typeof showTitle === 'boolean' ? showTitle : true
19
- }, /*#__PURE__*/React.createElement(SpinnerWrapper, null, /*#__PURE__*/React.createElement(Spinner, null)));
14
+ showTitle,
15
+ setIsLoading
16
+ }) => {
17
+ React.useEffect(() => {
18
+ setIsLoading(true);
19
+ });
20
+ return /*#__PURE__*/React.createElement(ShareFormWrapper, {
21
+ shareFormTitle: shareFormTitle // if `showTitle` is passed, we use it. Otherwise, we will show title for loading dialog.
22
+ ,
23
+ shouldShowTitle: typeof showTitle === 'boolean' ? showTitle : true
24
+ }, /*#__PURE__*/React.createElement(SpinnerWrapper, null, /*#__PURE__*/React.createElement(Spinner, null)));
25
+ };
20
26
 
21
27
  export default (props => /*#__PURE__*/React.createElement(LazySuspense, {
22
28
  fallback: /*#__PURE__*/React.createElement(LoadingDialog, {
23
29
  shareFormTitle: props.shareFormTitle,
24
- showTitle: props.showTitle
30
+ showTitle: props.showTitle,
31
+ setIsLoading: props.setIsLoading
25
32
  })
26
33
  }, /*#__PURE__*/React.createElement(LazyShareFormLazy, props)));
@@ -52,7 +52,8 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
52
52
  isUsingSplitButton: false,
53
53
  showIntegrationForm: false,
54
54
  selectedIntegration: null,
55
- tabIndex: 0
55
+ tabIndex: 0,
56
+ isLoading: false
56
57
  });
57
58
 
58
59
  _defineProperty(this, "closeAndResetDialog", () => {
@@ -128,14 +129,32 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
128
129
  }];
129
130
  });
130
131
 
132
+ _defineProperty(this, "setIsLoading", isLoading => {
133
+ this.setState({
134
+ isLoading
135
+ });
136
+ });
137
+
138
+ _defineProperty(this, "focus", () => {
139
+ if (this.containerRef.current) {
140
+ this.containerRef.current.focus();
141
+ }
142
+ });
143
+
131
144
  _defineProperty(this, "handleKeyDown", event => {
132
145
  const {
146
+ isLoading,
133
147
  isDialogOpen
134
148
  } = this.state;
135
149
  const {
136
150
  shouldCloseOnEscapePress
137
151
  } = this.props;
138
152
 
153
+ if (isLoading) {
154
+ event.stopPropagation();
155
+ this.focus();
156
+ }
157
+
139
158
  if (isDialogOpen) {
140
159
  switch (event.key) {
141
160
  case 'Esc':
@@ -147,10 +166,7 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
147
166
  event.stopPropagation(); // put the focus back onto the share dialog so that
148
167
  // the user can press the escape key again to close the dialog
149
168
 
150
- if (this.containerRef.current) {
151
- this.containerRef.current.focus();
152
- }
153
-
169
+ this.focus();
154
170
  return;
155
171
  } // The dialog will auto-close in @atlaskit/popup, we just need to fire
156
172
  // the right events.
@@ -194,9 +210,7 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
194
210
  onDialogOpen();
195
211
  }
196
212
 
197
- if (this.containerRef.current) {
198
- this.containerRef.current.focus();
199
- }
213
+ this.focus();
200
214
  }
201
215
  });
202
216
  });
@@ -458,6 +472,7 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
458
472
  defaultValue: defaultValue,
459
473
  config: config,
460
474
  isFetchingConfig: isFetchingConfig,
475
+ setIsLoading: this.setIsLoading,
461
476
  submitButtonLabel: submitButtonLabel,
462
477
  product: product,
463
478
  enableSmartUserPicker: enableSmartUserPicker,
@@ -98,7 +98,10 @@ class InternalForm extends React.PureComponent {
98
98
  isPublicLink,
99
99
  copyTooltipText,
100
100
  helperMessage,
101
- orgId
101
+ orgId,
102
+ intl: {
103
+ formatMessage
104
+ }
102
105
  } = this.props;
103
106
  return jsx(AnalyticsContext, {
104
107
  data: {
@@ -134,8 +137,9 @@ class InternalForm extends React.PureComponent {
134
137
  isDisabled: isDisabled,
135
138
  onLinkCopy: onLinkCopy,
136
139
  link: copyLink,
137
- isPublicLink: isPublicLink,
138
- copyTooltipText: copyTooltipText
140
+ copyTooltipText: copyTooltipText,
141
+ copyLinkButtonText: formatMessage(isPublicLink ? messages.copyPublicLinkButtonText : messages.copyLinkButtonText),
142
+ copiedToClipboardText: formatMessage(messages.copiedToClipboardMessage)
139
143
  }), this.renderSubmitButton())));
140
144
  });
141
145
 
@@ -2,7 +2,7 @@ import { isEmail, isTeam, isUser } from '@atlaskit/smart-user-picker';
2
2
 
3
3
  const buildAttributes = (attributes = {}) => ({
4
4
  packageName: "@atlaskit/share",
5
- packageVersion: "3.4.0",
5
+ packageVersion: "3.5.0",
6
6
  ...attributes
7
7
  });
8
8
 
@@ -1,3 +1,4 @@
1
1
  export { ShareDialogContainer } from './components/ShareDialogContainer';
2
+ export { CopyLinkButton } from './components/CopyLinkButton';
2
3
  export { // Constants
3
4
  ADMIN_NOTIFIED, OBJECT_SHARED } from './types';
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/share",
3
- "version": "3.4.0"
3
+ "version": "3.5.0"
4
4
  }
@@ -17,7 +17,6 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
17
17
  /** @jsx jsx */
18
18
  import React from 'react';
19
19
  import { css, jsx } from '@emotion/react';
20
- import { FormattedMessage, injectIntl } from 'react-intl-next';
21
20
  import CheckCircleIcon from '@atlaskit/icon/glyph/check-circle';
22
21
  import LinkFilledIcon from '@atlaskit/icon/glyph/link-filled';
23
22
  import Popup from '@atlaskit/popup';
@@ -25,15 +24,14 @@ import { G300 } from '@atlaskit/theme/colors';
25
24
  import { layers } from '@atlaskit/theme/constants';
26
25
  import { token } from '@atlaskit/tokens';
27
26
  import Tooltip from '@atlaskit/tooltip';
28
- import { messages } from '../i18n';
29
27
  import { InlineDialogContentWrapper } from './ShareFormWrapper/styled';
30
28
  import Button from './styles';
31
29
  var Z_INDEX = layers.modal();
32
30
  var AUTO_DISMISS_SECONDS = 8;
33
31
  export var AUTO_DISMISS_MS = AUTO_DISMISS_SECONDS * 1000;
34
32
  export var messageContainerStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n margin: -8px -16px;\n"])));
35
- var isSafari = navigator.userAgent.indexOf('Safari');
36
33
  var messageTextStyle = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n text-indent: 6px;\n"])));
34
+ var isSafari = navigator.userAgent.indexOf('Safari');
37
35
  export var HiddenInput = /*#__PURE__*/React.forwardRef( // we need a hidden input to reliably copy to clipboard across all browsers.
38
36
  function (props, ref) {
39
37
  return jsx("input", {
@@ -110,19 +108,20 @@ export var CopyLinkButton = /*#__PURE__*/function (_React$Component) {
110
108
 
111
109
  _defineProperty(_assertThisInitialized(_this), "renderTriggerButton", function (triggerProps) {
112
110
  var _this$props = _this.props,
113
- formatMessage = _this$props.intl.formatMessage,
114
111
  isDisabled = _this$props.isDisabled,
115
- isPublicLink = _this$props.isPublicLink;
112
+ copyLinkButtonText = _this$props.copyLinkButtonText,
113
+ children = _this$props.children,
114
+ iconBefore = _this$props.iconBefore;
116
115
  return jsx(Button, _extends({
117
- "aria-label": formatMessage(isPublicLink ? messages.copyPublicLinkButtonText : messages.copyLinkButtonText),
116
+ "aria-label": copyLinkButtonText,
118
117
  isDisabled: isDisabled,
119
118
  appearance: "subtle-link",
120
- iconBefore: jsx(LinkFilledIcon, {
119
+ iconBefore: iconBefore || jsx(LinkFilledIcon, {
121
120
  label: "",
122
121
  size: "medium"
123
122
  }),
124
123
  onClick: _this.handleClick
125
- }, triggerProps), jsx(FormattedMessage, isPublicLink ? messages.copyPublicLinkButtonText : messages.copyLinkButtonText));
124
+ }, triggerProps), children || copyLinkButtonText);
126
125
  });
127
126
 
128
127
  return _this;
@@ -140,12 +139,12 @@ export var CopyLinkButton = /*#__PURE__*/function (_React$Component) {
140
139
 
141
140
  var shouldShowCopiedMessage = this.state.shouldShowCopiedMessage;
142
141
  var _this$props2 = this.props,
143
- formatMessage = _this$props2.intl.formatMessage,
144
- copyTooltipText = _this$props2.copyTooltipText;
142
+ copyTooltipText = _this$props2.copyTooltipText,
143
+ copiedToClipboardText = _this$props2.copiedToClipboardText;
145
144
  return jsx(React.Fragment, null, isSafari && jsx("div", {
146
145
  className: "assistive",
147
146
  "aria-live": "assertive"
148
- }, shouldShowCopiedMessage && formatMessage(messages.copiedToClipboardMessage)), jsx(HiddenInput, {
147
+ }, shouldShowCopiedMessage && copiedToClipboardText), jsx(HiddenInput, {
149
148
  ref: this.inputRef,
150
149
  text: this.props.link
151
150
  }), jsx(Popup, {
@@ -154,12 +153,12 @@ export var CopyLinkButton = /*#__PURE__*/function (_React$Component) {
154
153
  return jsx(InlineDialogContentWrapper, null, jsx("div", {
155
154
  css: messageContainerStyle,
156
155
  "data-testid": "message-container"
157
- }, jsx(CheckCircleIcon, {
156
+ }, jsx(React.Fragment, null, jsx(CheckCircleIcon, {
158
157
  label: "",
159
158
  primaryColor: token('color.icon.success', G300)
160
- }), jsx("span", {
159
+ }), jsx("div", {
161
160
  css: messageTextStyle
162
- }, jsx(FormattedMessage, messages.copiedToClipboardMessage))));
161
+ }, copiedToClipboardText))));
163
162
  },
164
163
  isOpen: shouldShowCopiedMessage,
165
164
  onClose: this.handleDismissCopiedMessage,
@@ -176,4 +175,4 @@ export var CopyLinkButton = /*#__PURE__*/function (_React$Component) {
176
175
 
177
176
  return CopyLinkButton;
178
177
  }(React.Component);
179
- export default injectIntl(CopyLinkButton);
178
+ export default CopyLinkButton;
@@ -14,6 +14,7 @@ function LazyShareForm(props) {
14
14
  var copyLink = props.copyLink,
15
15
  config = props.config,
16
16
  isFetchingConfig = props.isFetchingConfig,
17
+ setIsLoading = props.setIsLoading,
17
18
  loadOptions = props.loadOptions,
18
19
  shareFormTitle = props.shareFormTitle,
19
20
  shareFormHelperMessage = props.shareFormHelperMessage,
@@ -44,6 +45,9 @@ function LazyShareForm(props) {
44
45
  showTitle = props.showTitle,
45
46
  orgId = props.orgId;
46
47
  var footer = /*#__PURE__*/React.createElement("div", null, bottomMessage ? /*#__PURE__*/React.createElement(BottomMessageWrapper, null, bottomMessage) : null, customFooter && selectedIntegration === null && /*#__PURE__*/React.createElement(CustomFooterWrapper, null, customFooter));
48
+ React.useEffect(function () {
49
+ setIsLoading(false);
50
+ });
47
51
  return /*#__PURE__*/React.createElement(ShareFormWrapper, {
48
52
  footer: footer // form title will be determined by `title` and `showTitle` prop passed to `ShareForm`,
49
53
  // so we don't need to show title via ShareFormWrapper
@@ -13,7 +13,11 @@ var LazyShareFormLazy = lazyForPaint(function () {
13
13
 
14
14
  var LoadingDialog = function LoadingDialog(_ref) {
15
15
  var shareFormTitle = _ref.shareFormTitle,
16
- showTitle = _ref.showTitle;
16
+ showTitle = _ref.showTitle,
17
+ setIsLoading = _ref.setIsLoading;
18
+ React.useEffect(function () {
19
+ setIsLoading(true);
20
+ });
17
21
  return /*#__PURE__*/React.createElement(ShareFormWrapper, {
18
22
  shareFormTitle: shareFormTitle // if `showTitle` is passed, we use it. Otherwise, we will show title for loading dialog.
19
23
  ,
@@ -25,7 +29,8 @@ export default (function (props) {
25
29
  return /*#__PURE__*/React.createElement(LazySuspense, {
26
30
  fallback: /*#__PURE__*/React.createElement(LoadingDialog, {
27
31
  shareFormTitle: props.shareFormTitle,
28
- showTitle: props.showTitle
32
+ showTitle: props.showTitle,
33
+ setIsLoading: props.setIsLoading
29
34
  })
30
35
  }, /*#__PURE__*/React.createElement(LazyShareFormLazy, props));
31
36
  });
@@ -78,7 +78,8 @@ export var ShareDialogWithTriggerInternal = /*#__PURE__*/function (_React$PureCo
78
78
  isUsingSplitButton: false,
79
79
  showIntegrationForm: false,
80
80
  selectedIntegration: null,
81
- tabIndex: 0
81
+ tabIndex: 0,
82
+ isLoading: false
82
83
  });
83
84
 
84
85
  _defineProperty(_assertThisInitialized(_this), "closeAndResetDialog", function () {
@@ -150,10 +151,30 @@ export var ShareDialogWithTriggerInternal = /*#__PURE__*/function (_React$PureCo
150
151
  }];
151
152
  });
152
153
 
154
+ _defineProperty(_assertThisInitialized(_this), "setIsLoading", function (isLoading) {
155
+ _this.setState({
156
+ isLoading: isLoading
157
+ });
158
+ });
159
+
160
+ _defineProperty(_assertThisInitialized(_this), "focus", function () {
161
+ if (_this.containerRef.current) {
162
+ _this.containerRef.current.focus();
163
+ }
164
+ });
165
+
153
166
  _defineProperty(_assertThisInitialized(_this), "handleKeyDown", function (event) {
154
- var isDialogOpen = _this.state.isDialogOpen;
167
+ var _this$state = _this.state,
168
+ isLoading = _this$state.isLoading,
169
+ isDialogOpen = _this$state.isDialogOpen;
155
170
  var shouldCloseOnEscapePress = _this.props.shouldCloseOnEscapePress;
156
171
 
172
+ if (isLoading) {
173
+ event.stopPropagation();
174
+
175
+ _this.focus();
176
+ }
177
+
157
178
  if (isDialogOpen) {
158
179
  switch (event.key) {
159
180
  case 'Esc':
@@ -165,9 +186,7 @@ export var ShareDialogWithTriggerInternal = /*#__PURE__*/function (_React$PureCo
165
186
  event.stopPropagation(); // put the focus back onto the share dialog so that
166
187
  // the user can press the escape key again to close the dialog
167
188
 
168
- if (_this.containerRef.current) {
169
- _this.containerRef.current.focus();
170
- }
189
+ _this.focus();
171
190
 
172
191
  return;
173
192
  } // The dialog will auto-close in @atlaskit/popup, we just need to fire
@@ -214,9 +233,7 @@ export var ShareDialogWithTriggerInternal = /*#__PURE__*/function (_React$PureCo
214
233
  onDialogOpen();
215
234
  }
216
235
 
217
- if (_this.containerRef.current) {
218
- _this.containerRef.current.focus();
219
- }
236
+ _this.focus();
220
237
  }
221
238
  });
222
239
  });
@@ -321,9 +338,9 @@ export var ShareDialogWithTriggerInternal = /*#__PURE__*/function (_React$PureCo
321
338
  });
322
339
 
323
340
  _defineProperty(_assertThisInitialized(_this), "renderShareTriggerButton", function (triggerProps) {
324
- var _this$state = _this.state,
325
- isDialogOpen = _this$state.isDialogOpen,
326
- isUsingSplitButton = _this$state.isUsingSplitButton;
341
+ var _this$state2 = _this.state,
342
+ isDialogOpen = _this$state2.isDialogOpen,
343
+ isUsingSplitButton = _this$state2.isUsingSplitButton;
327
344
  var _this$props6 = _this.props,
328
345
  formatMessage = _this$props6.intl.formatMessage,
329
346
  isDisabled = _this$props6.isDisabled,
@@ -428,13 +445,13 @@ export var ShareDialogWithTriggerInternal = /*#__PURE__*/function (_React$PureCo
428
445
  value: function render() {
429
446
  var _this2 = this;
430
447
 
431
- var _this$state2 = this.state,
432
- isDialogOpen = _this$state2.isDialogOpen,
433
- isSharing = _this$state2.isSharing,
434
- shareError = _this$state2.shareError,
435
- defaultValue = _this$state2.defaultValue,
436
- showIntegrationForm = _this$state2.showIntegrationForm,
437
- selectedIntegration = _this$state2.selectedIntegration;
448
+ var _this$state3 = this.state,
449
+ isDialogOpen = _this$state3.isDialogOpen,
450
+ isSharing = _this$state3.isSharing,
451
+ shareError = _this$state3.shareError,
452
+ defaultValue = _this$state3.defaultValue,
453
+ showIntegrationForm = _this$state3.showIntegrationForm,
454
+ selectedIntegration = _this$state3.selectedIntegration;
438
455
  var _this$props7 = this.props,
439
456
  copyLink = _this$props7.copyLink,
440
457
  dialogPlacement = _this$props7.dialogPlacement,
@@ -489,6 +506,7 @@ export var ShareDialogWithTriggerInternal = /*#__PURE__*/function (_React$PureCo
489
506
  defaultValue: defaultValue,
490
507
  config: config,
491
508
  isFetchingConfig: isFetchingConfig,
509
+ setIsLoading: _this2.setIsLoading,
492
510
  submitButtonLabel: submitButtonLabel,
493
511
  product: product,
494
512
  enableSmartUserPicker: enableSmartUserPicker,
@@ -100,7 +100,8 @@ var InternalForm = /*#__PURE__*/function (_React$PureComponent) {
100
100
  isPublicLink = _this$props.isPublicLink,
101
101
  copyTooltipText = _this$props.copyTooltipText,
102
102
  helperMessage = _this$props.helperMessage,
103
- orgId = _this$props.orgId;
103
+ orgId = _this$props.orgId,
104
+ formatMessage = _this$props.intl.formatMessage;
104
105
  return jsx(AnalyticsContext, {
105
106
  data: {
106
107
  source: ANALYTICS_SOURCE
@@ -135,8 +136,9 @@ var InternalForm = /*#__PURE__*/function (_React$PureComponent) {
135
136
  isDisabled: isDisabled,
136
137
  onLinkCopy: onLinkCopy,
137
138
  link: copyLink,
138
- isPublicLink: isPublicLink,
139
- copyTooltipText: copyTooltipText
139
+ copyTooltipText: copyTooltipText,
140
+ copyLinkButtonText: formatMessage(isPublicLink ? messages.copyPublicLinkButtonText : messages.copyLinkButtonText),
141
+ copiedToClipboardText: formatMessage(messages.copiedToClipboardMessage)
140
142
  }), _this.renderSubmitButton())));
141
143
  });
142
144
 
@@ -10,7 +10,7 @@ var buildAttributes = function buildAttributes() {
10
10
  var attributes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
11
11
  return _objectSpread({
12
12
  packageName: "@atlaskit/share",
13
- packageVersion: "3.4.0"
13
+ packageVersion: "3.5.0"
14
14
  }, attributes);
15
15
  };
16
16
 
package/dist/esm/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export { ShareDialogContainer } from './components/ShareDialogContainer';
2
+ export { CopyLinkButton } from './components/CopyLinkButton';
2
3
  export { // Constants
3
4
  ADMIN_NOTIFIED, OBJECT_SHARED } from './types';
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/share",
3
- "version": "3.4.0"
3
+ "version": "3.5.0"
4
4
  }
@@ -1,7 +1,6 @@
1
1
  /** @jsx jsx */
2
- import React from 'react';
2
+ import React, { ReactElement } from 'react';
3
3
  import { jsx } from '@emotion/react';
4
- import { WrappedComponentProps } from 'react-intl-next';
5
4
  import { TriggerProps } from '@atlaskit/popup';
6
5
  export declare const AUTO_DISMISS_MS: number;
7
6
  export declare const messageContainerStyle: import("@emotion/react").SerializedStyles;
@@ -13,13 +12,16 @@ export declare type Props = {
13
12
  onLinkCopy?: (link: string) => void;
14
13
  link: string;
15
14
  isDisabled?: boolean;
16
- isPublicLink?: boolean;
17
15
  copyTooltipText?: string;
16
+ children?: string | ReactElement;
17
+ copyLinkButtonText: string;
18
+ copiedToClipboardText: string;
19
+ iconBefore?: ReactElement;
18
20
  };
19
21
  export declare type State = {
20
22
  shouldShowCopiedMessage: boolean;
21
23
  };
22
- export declare class CopyLinkButton extends React.Component<Props & WrappedComponentProps, State> {
24
+ export declare class CopyLinkButton extends React.Component<Props, State> {
23
25
  private autoDismiss;
24
26
  private inputRef;
25
27
  state: {
@@ -32,7 +34,4 @@ export declare class CopyLinkButton extends React.Component<Props & WrappedCompo
32
34
  renderTriggerButton: (triggerProps: TriggerProps) => jsx.JSX.Element;
33
35
  render(): jsx.JSX.Element;
34
36
  }
35
- declare const _default: React.FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps<"intl">>> & {
36
- WrappedComponent: React.ComponentType<Props & WrappedComponentProps<"intl">>;
37
- };
38
- export default _default;
37
+ export default CopyLinkButton;
@@ -10,6 +10,7 @@ export declare type LazyShareFormProps = Pick<ShareDialogWithTriggerProps, 'copy
10
10
  loadOptions?: LoadOptions;
11
11
  selectPortalRef: any;
12
12
  showTitle: boolean;
13
+ setIsLoading: (isLoading: boolean) => void;
13
14
  };
14
15
  /**
15
16
  * A Share form content which is lazy-loaded.
@@ -24,6 +24,8 @@ export declare class ShareDialogWithTriggerInternal extends React.PureComponent<
24
24
  private createAndFireEvent;
25
25
  private onTabChange;
26
26
  private getFlags;
27
+ private setIsLoading;
28
+ private focus;
27
29
  private handleKeyDown;
28
30
  private handleDialogOpen;
29
31
  private onTriggerClick;
@@ -1,3 +1,4 @@
1
1
  export { ShareDialogContainer } from './components/ShareDialogContainer';
2
+ export { CopyLinkButton } from './components/CopyLinkButton';
2
3
  export { ADMIN_NOTIFIED, OBJECT_SHARED, } from './types';
3
4
  export type { Comment, Content, DialogContentState, DialogPlacement, Flag, FlagType, FormChildrenArgs, KeysOfType, MessageDescriptor, MetaData, OriginAnalyticAttributes, OriginTracing, OriginTracingFactory, OriginTracingForSubSequentEvents, OriginTracingWithIdGenerated, ProductId, ProductName, RenderCustomTriggerButton, ShareButtonStyle, ShareContentState, ShareError, ShareRequest, ShareResponse, ConfigResponse, TooltipPosition, User, UserWithEmail, UserWithId, ShareDialogContainerProps, } from './types';
@@ -32,6 +32,7 @@ export declare type ShareDialogWithTriggerProps = Pick<ShareDialogContainerProps
32
32
  submitButtonLabel?: React.ReactNode;
33
33
  };
34
34
  export declare type ShareDialogWithTriggerStates = {
35
+ isLoading: boolean;
35
36
  isDialogOpen: boolean;
36
37
  isSharing: boolean;
37
38
  shareError?: ShareError;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/share",
3
- "version": "3.4.0",
3
+ "version": "3.5.0",
4
4
  "description": "Fabric Share Element",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -32,16 +32,16 @@
32
32
  "dependencies": {
33
33
  "@atlaskit/analytics-next": "^8.2.0",
34
34
  "@atlaskit/button": "^16.3.0",
35
- "@atlaskit/dropdown-menu": "^11.3.0",
35
+ "@atlaskit/dropdown-menu": "^11.4.0",
36
36
  "@atlaskit/form": "^8.5.0",
37
37
  "@atlaskit/icon": "^21.10.0",
38
38
  "@atlaskit/popup": "^1.4.0",
39
39
  "@atlaskit/portal": "^4.0.0",
40
40
  "@atlaskit/smart-user-picker": "^6.0.0",
41
41
  "@atlaskit/spinner": "^15.1.4",
42
- "@atlaskit/tabs": "^13.2.3",
42
+ "@atlaskit/tabs": "^13.3.0",
43
43
  "@atlaskit/textarea": "^4.3.0",
44
- "@atlaskit/theme": "^12.1.0",
44
+ "@atlaskit/theme": "^12.2.0",
45
45
  "@atlaskit/tokens": "^0.10.0",
46
46
  "@atlaskit/tooltip": "^17.5.0",
47
47
  "@atlaskit/ufo": "^0.1.0",
@@ -62,17 +62,17 @@
62
62
  "devDependencies": {
63
63
  "@atlaskit/docs": "^9.0.0",
64
64
  "@atlaskit/editor-test-helpers": "^17.1.0",
65
- "@atlaskit/flag": "^14.6.0",
66
- "@atlaskit/section-message": "^6.0.0",
67
- "@atlaskit/select": "^15.5.0",
68
- "@atlaskit/toggle": "^12.4.0",
65
+ "@atlaskit/flag": "^14.7.0",
66
+ "@atlaskit/section-message": "^6.2.0",
67
+ "@atlaskit/select": "^15.7.0",
68
+ "@atlaskit/toggle": "^12.5.0",
69
69
  "@atlaskit/util-data-test": "^17.5.0",
70
70
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
71
71
  "enzyme": "^3.10.0",
72
72
  "enzyme-adapter-react-16": "^1.15.1",
73
73
  "enzyme-react-intl": "^2.0.6",
74
74
  "react": "^16.8.0",
75
- "typescript": "4.2.4"
75
+ "typescript": "4.3.5"
76
76
  },
77
77
  "keywords": [
78
78
  "ui",
@@ -104,7 +104,8 @@
104
104
  },
105
105
  "af:exports": {
106
106
  ".": "./src/index.ts",
107
- "./clients": "./src/clients/index.ts"
107
+ "./clients": "./src/clients/index.ts",
108
+ "./copy-link-button": "./src/components/CopyLinkButton.tsx"
108
109
  },
109
110
  "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
110
111
  }
package/report.api.md CHANGED
@@ -9,11 +9,13 @@
9
9
 
10
10
  import type { Appearance } from '@atlaskit/button/types';
11
11
  import type { IconProps } from '@atlaskit/icon';
12
+ import { jsx } from '@emotion/react';
12
13
  import type { LoadOptions } from '@atlaskit/smart-user-picker';
13
14
  import { OptionData } from '@atlaskit/smart-user-picker';
14
15
  import type { Placement } from '@atlaskit/popper';
15
16
  import { default as React_2 } from 'react';
16
- import type { TriggerProps } from '@atlaskit/popup';
17
+ import { ReactElement } from 'react';
18
+ import { TriggerProps } from '@atlaskit/popup';
17
19
  import type { Value } from '@atlaskit/smart-user-picker';
18
20
  import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
19
21
 
@@ -36,6 +38,20 @@ export declare type Content = {
36
38
  type: string;
37
39
  };
38
40
 
41
+ export declare class CopyLinkButton extends React_2.Component<Props, State> {
42
+ private autoDismiss;
43
+ private inputRef;
44
+ state: {
45
+ shouldShowCopiedMessage: boolean;
46
+ };
47
+ componentWillUnmount(): void;
48
+ private clearAutoDismiss;
49
+ private handleClick;
50
+ private handleDismissCopiedMessage;
51
+ renderTriggerButton: (triggerProps: TriggerProps) => jsx.JSX.Element;
52
+ render(): jsx.JSX.Element;
53
+ }
54
+
39
55
  export declare type DialogContentState = {
40
56
  users: OptionData[];
41
57
  comment: Comment_2;
@@ -130,6 +146,17 @@ export declare type ProductId =
130
146
 
131
147
  export declare type ProductName = 'jira' | 'confluence';
132
148
 
149
+ declare type Props = {
150
+ onLinkCopy?: (link: string) => void;
151
+ link: string;
152
+ isDisabled?: boolean;
153
+ copyTooltipText?: string;
154
+ children?: string | ReactElement;
155
+ copyLinkButtonText: string;
156
+ copiedToClipboardText: string;
157
+ iconBefore?: ReactElement;
158
+ };
159
+
133
160
  export declare type RenderCustomTriggerButton = (
134
161
  args: {
135
162
  error?: ShareError;
@@ -390,6 +417,10 @@ declare interface ShortenResponse {
390
417
  shortUrl: string;
391
418
  }
392
419
 
420
+ declare type State = {
421
+ shouldShowCopiedMessage: boolean;
422
+ };
423
+
393
424
  declare enum TabType {
394
425
  default = 0,
395
426
  Slack = 1,