@atlaskit/share 3.4.0 → 3.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/share
2
2
 
3
+ ## 3.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`620f202bc02`](https://bitbucket.org/atlassian/atlassian-frontend/commits/620f202bc02) - Prevent event propagation in Share loading state
8
+
3
9
  ## 3.4.0
4
10
 
5
11
  ### Minor Changes
@@ -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,
@@ -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.4.1"
23
23
  }, attributes);
24
24
  };
25
25
 
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/share",
3
- "version": "3.4.0"
3
+ "version": "3.4.1"
4
4
  }
@@ -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,
@@ -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.4.1",
6
6
  ...attributes
7
7
  });
8
8
 
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/share",
3
- "version": "3.4.0"
3
+ "version": "3.4.1"
4
4
  }
@@ -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,
@@ -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.4.1"
14
14
  }, attributes);
15
15
  };
16
16
 
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/share",
3
- "version": "3.4.0"
3
+ "version": "3.4.1"
4
4
  }
@@ -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;
@@ -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.4.1",
4
4
  "description": "Fabric Share Element",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"