@atlaskit/share 1.0.3 → 2.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 (73) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/clients/package.json +7 -0
  3. package/dist/cjs/clients/index.js +13 -0
  4. package/dist/cjs/components/CopyLinkButton.js +4 -8
  5. package/dist/cjs/components/IntegrationForm.js +5 -2
  6. package/dist/cjs/components/LazyShareForm/LazyShareForm.js +105 -0
  7. package/dist/cjs/components/LazyShareForm/index.js +15 -0
  8. package/dist/cjs/components/LazyShareForm/lazy.js +53 -0
  9. package/dist/cjs/components/LazyShareForm/styled.js +28 -0
  10. package/dist/cjs/components/ShareDialogWithTrigger.js +26 -38
  11. package/dist/cjs/components/ShareForm.js +3 -3
  12. package/dist/cjs/components/ShareFormWrapper/ShareFormWrapper.js +29 -0
  13. package/dist/cjs/components/ShareFormWrapper/index.js +15 -0
  14. package/dist/cjs/components/ShareFormWrapper/styled.js +31 -0
  15. package/dist/cjs/components/styles.js +1 -20
  16. package/dist/cjs/index.js +0 -8
  17. package/dist/cjs/types/ShareDialogContainer.js +5 -0
  18. package/dist/cjs/types/ShareForm.js +5 -0
  19. package/dist/cjs/version.json +1 -1
  20. package/dist/es2019/clients/index.js +1 -0
  21. package/dist/es2019/components/CopyLinkButton.js +2 -1
  22. package/dist/es2019/components/IntegrationForm.js +2 -2
  23. package/dist/es2019/components/LazyShareForm/LazyShareForm.js +92 -0
  24. package/dist/es2019/components/LazyShareForm/index.js +1 -0
  25. package/dist/es2019/components/LazyShareForm/lazy.js +26 -0
  26. package/dist/es2019/components/LazyShareForm/styled.js +16 -0
  27. package/dist/es2019/components/ShareDialogWithTrigger.js +27 -39
  28. package/dist/es2019/components/ShareForm.js +2 -2
  29. package/dist/es2019/components/ShareFormWrapper/ShareFormWrapper.js +14 -0
  30. package/dist/es2019/components/ShareFormWrapper/index.js +1 -0
  31. package/dist/es2019/components/ShareFormWrapper/styled.js +15 -0
  32. package/dist/es2019/components/styles.js +1 -15
  33. package/dist/es2019/index.js +0 -1
  34. package/dist/es2019/types/ShareDialogContainer.js +1 -0
  35. package/dist/es2019/types/ShareForm.js +1 -0
  36. package/dist/es2019/version.json +1 -1
  37. package/dist/esm/clients/index.js +1 -0
  38. package/dist/esm/components/CopyLinkButton.js +2 -1
  39. package/dist/esm/components/IntegrationForm.js +5 -2
  40. package/dist/esm/components/LazyShareForm/LazyShareForm.js +87 -0
  41. package/dist/esm/components/LazyShareForm/index.js +1 -0
  42. package/dist/esm/components/LazyShareForm/lazy.js +31 -0
  43. package/dist/esm/components/LazyShareForm/styled.js +9 -0
  44. package/dist/esm/components/ShareDialogWithTrigger.js +28 -35
  45. package/dist/esm/components/ShareForm.js +2 -2
  46. package/dist/esm/components/ShareFormWrapper/ShareFormWrapper.js +17 -0
  47. package/dist/esm/components/ShareFormWrapper/index.js +1 -0
  48. package/dist/esm/components/ShareFormWrapper/styled.js +15 -0
  49. package/dist/esm/components/styles.js +1 -16
  50. package/dist/esm/index.js +0 -1
  51. package/dist/esm/types/ShareDialogContainer.js +1 -0
  52. package/dist/esm/types/ShareForm.js +1 -0
  53. package/dist/esm/version.json +1 -1
  54. package/dist/types/clients/index.d.ts +2 -0
  55. package/dist/types/components/IntegrationForm.d.ts +4 -5
  56. package/dist/types/components/LazyShareForm/LazyShareForm.d.ts +19 -0
  57. package/dist/types/components/LazyShareForm/index.d.ts +1 -0
  58. package/dist/types/components/LazyShareForm/lazy.d.ts +4 -0
  59. package/dist/types/components/LazyShareForm/styled.d.ts +4 -0
  60. package/dist/types/components/ShareDialogContainer.d.ts +10 -148
  61. package/dist/types/components/ShareDialogWithTrigger.d.ts +10 -71
  62. package/dist/types/components/ShareForm.d.ts +3 -44
  63. package/dist/types/components/ShareFormWrapper/ShareFormWrapper.d.ts +9 -0
  64. package/dist/types/components/ShareFormWrapper/index.d.ts +1 -0
  65. package/dist/types/components/ShareFormWrapper/styled.d.ts +9 -0
  66. package/dist/types/components/styles.d.ts +0 -7
  67. package/dist/types/index.d.ts +1 -4
  68. package/dist/types/types/ShareContentState.d.ts +2 -2
  69. package/dist/types/types/ShareDialogContainer.d.ts +147 -0
  70. package/dist/types/types/ShareDialogWithTrigger.d.ts +30 -3
  71. package/dist/types/types/ShareForm.d.ts +31 -0
  72. package/dist/types/types/index.d.ts +4 -2
  73. package/package.json +5 -2
@@ -0,0 +1,92 @@
1
+ import React from 'react';
2
+ import { AnalyticsContext } from '@atlaskit/analytics-next';
3
+ import { ShareForm } from '../ShareForm';
4
+ import { ANALYTICS_SOURCE } from '../analytics';
5
+ import { IntegrationForm } from '../IntegrationForm';
6
+ import { BottomMessageWrapper, CustomFooterWrapper } from './styled';
7
+ import { ShareFormWrapper } from '../ShareFormWrapper';
8
+
9
+ /**
10
+ * A Share form content which is lazy-loaded.
11
+ * Make sure this component is not exported inside main entry points `src/index.ts`
12
+ */
13
+ function LazyShareForm(props) {
14
+ const {
15
+ copyLink,
16
+ config,
17
+ isFetchingConfig,
18
+ loadOptions,
19
+ shareFormTitle,
20
+ shareFormHelperMessage,
21
+ bottomMessage,
22
+ submitButtonLabel,
23
+ product,
24
+ customFooter,
25
+ enableSmartUserPicker,
26
+ loggedInAccountId,
27
+ cloudId,
28
+ shareFieldsFooter,
29
+ onUserSelectionChange,
30
+ isPublicLink,
31
+ copyTooltipText,
32
+ shareIntegrations,
33
+ integrationMode,
34
+ // actions
35
+ onLinkCopy,
36
+ onDismiss,
37
+ onSubmit,
38
+ onDialogClose,
39
+ // ref
40
+ selectPortalRef,
41
+ // props from states of parent:
42
+ showIntegrationForm,
43
+ selectedIntegration,
44
+ isSharing,
45
+ shareError,
46
+ defaultValue,
47
+ showTitle
48
+ } = props;
49
+ const footer = /*#__PURE__*/React.createElement("div", null, bottomMessage ? /*#__PURE__*/React.createElement(BottomMessageWrapper, null, bottomMessage) : null, customFooter && /*#__PURE__*/React.createElement(CustomFooterWrapper, null, customFooter));
50
+ return /*#__PURE__*/React.createElement(AnalyticsContext, {
51
+ data: {
52
+ source: ANALYTICS_SOURCE
53
+ }
54
+ }, /*#__PURE__*/React.createElement(ShareFormWrapper, {
55
+ footer: footer // form title will be determined by `title` and `showTitle` prop passed to `ShareForm`,
56
+ // so we don't need to show title via ShareFormWrapper
57
+ ,
58
+ shouldShowTitle: false
59
+ }, showIntegrationForm && selectedIntegration !== null ? /*#__PURE__*/React.createElement(IntegrationForm, {
60
+ Content: selectedIntegration.Content,
61
+ onIntegrationClose: onDialogClose
62
+ }) : /*#__PURE__*/React.createElement(ShareForm, {
63
+ copyLink: copyLink,
64
+ loadOptions: loadOptions,
65
+ title: shareFormTitle,
66
+ showTitle: showTitle,
67
+ helperMessage: shareFormHelperMessage,
68
+ shareError: shareError,
69
+ defaultValue: defaultValue,
70
+ config: config,
71
+ submitButtonLabel: submitButtonLabel,
72
+ product: product,
73
+ enableSmartUserPicker: enableSmartUserPicker,
74
+ loggedInAccountId: loggedInAccountId,
75
+ cloudId: cloudId,
76
+ fieldsFooter: shareFieldsFooter,
77
+ selectPortalRef: selectPortalRef,
78
+ copyTooltipText: copyTooltipText,
79
+ integrationMode: integrationMode,
80
+ shareIntegrations: shareIntegrations,
81
+ isSharing: isSharing,
82
+ isFetchingConfig: isFetchingConfig,
83
+ isPublicLink: isPublicLink,
84
+ onSubmit: onSubmit,
85
+ onDismiss: onDismiss,
86
+ onLinkCopy: onLinkCopy,
87
+ onUserSelectionChange: onUserSelectionChange,
88
+ handleCloseDialog: onDialogClose
89
+ })));
90
+ }
91
+
92
+ export default LazyShareForm;
@@ -0,0 +1 @@
1
+ export { default } from './LazyShareForm';
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import { LazySuspense, lazyForPaint } from 'react-loosely-lazy';
3
+ import Spinner from '@atlaskit/spinner';
4
+ import { SpinnerWrapper } from './styled';
5
+ import { ShareFormWrapper } from '../ShareFormWrapper';
6
+ const LazyShareFormLazy = lazyForPaint(() => import(
7
+ /* webpackChunkName: "@atlaskit-internal_share-form" */
8
+ './LazyShareForm'), {
9
+ ssr: false
10
+ });
11
+
12
+ const LoadingDialog = ({
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)));
20
+
21
+ export default (props => /*#__PURE__*/React.createElement(LazySuspense, {
22
+ fallback: /*#__PURE__*/React.createElement(LoadingDialog, {
23
+ shareFormTitle: props.shareFormTitle,
24
+ showTitle: props.showTitle
25
+ })
26
+ }, /*#__PURE__*/React.createElement(LazyShareFormLazy, props)));
@@ -0,0 +1,16 @@
1
+ import styled from 'styled-components';
2
+ import { gridSize } from '@atlaskit/theme/constants';
3
+ export const BottomMessageWrapper = styled.div`
4
+ width: ${gridSize() * 44}px;
5
+ `;
6
+ export const CustomFooterWrapper = styled.div`
7
+ /* Must match inline dialog padding. */
8
+ margin: 0 ${-gridSize() * 3}px ${-gridSize() * 2}px ${-gridSize() * 3}px;
9
+ `;
10
+ export const SpinnerWrapper = styled.div`
11
+ widht: 100%;
12
+ height: 100%;
13
+ display: flex;
14
+ justify-content: center;
15
+ align-content: center;
16
+ `;
@@ -1,37 +1,25 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
- import { AnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
3
+ import React from 'react';
4
+ import { withAnalyticsEvents } from '@atlaskit/analytics-next';
4
5
  import SplitButton from './SplitButton';
5
6
  import ShareIcon from '@atlaskit/icon/glyph/share';
6
7
  import Popup from '@atlaskit/popup';
7
8
  import Portal from '@atlaskit/portal';
8
9
  import Aktooltip from '@atlaskit/tooltip';
9
- import { gridSize, layers } from '@atlaskit/theme/constants';
10
- import React from 'react';
10
+ import { layers } from '@atlaskit/theme/constants';
11
11
  import { FormattedMessage, injectIntl } from 'react-intl-next';
12
12
  import styled from 'styled-components';
13
13
  import { messages } from '../i18n';
14
14
  import { OBJECT_SHARED } from '../types';
15
- import { cancelShare, CHANNEL_ID, copyLinkButtonClicked, formShareSubmitted, screenEvent, shareTriggerButtonClicked, shareSplitButtonEvent, ANALYTICS_SOURCE, shareTabClicked } from './analytics';
15
+ import { cancelShare, CHANNEL_ID, copyLinkButtonClicked, screenEvent, shareTriggerButtonClicked, shareSplitButtonEvent, shareTabClicked, formShareSubmitted } from './analytics';
16
16
  import ShareButton from './ShareButton';
17
- import { ShareForm } from './ShareForm';
18
17
  import { generateSelectZIndex } from './utils';
19
- import { InlineDialogContentWrapper } from './styles';
20
- import { IntegrationForm } from './IntegrationForm';
18
+ import LazyShareFormLazy from './LazyShareForm/lazy';
21
19
  const ShareButtonWrapper = styled.div`
22
20
  display: inline-flex;
23
21
  outline: none;
24
22
  `;
25
- const InlineDialogFormWrapper = styled.div`
26
- width: 352px;
27
- `;
28
- const BottomMessageWrapper = styled.div`
29
- width: 352px;
30
- `;
31
- const CustomFooterWrapper = styled.div`
32
- /* Must match inline dialog padding. */
33
- margin: 0 ${-gridSize() * 3}px ${-gridSize() * 2}px ${-gridSize() * 3}px;
34
- `;
35
23
  export const defaultShareContentState = {
36
24
  users: [],
37
25
  comment: {
@@ -425,48 +413,48 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
425
413
  onKeyDown: this.handleKeyDown,
426
414
  style: style
427
415
  }, /*#__PURE__*/React.createElement(Popup, {
428
- content: () => /*#__PURE__*/React.createElement(AnalyticsContext, {
429
- data: {
430
- source: ANALYTICS_SOURCE
431
- }
432
- }, /*#__PURE__*/React.createElement(InlineDialogContentWrapper, {
433
- innerRef: this.containerRef
434
- }, showIntegrationForm && selectedIntegration !== null ? /*#__PURE__*/React.createElement(InlineDialogFormWrapper, null, /*#__PURE__*/React.createElement(IntegrationForm, {
435
- Content: selectedIntegration.Content,
436
- onIntegrationClose: this.handleCloseDialog
437
- })) : /*#__PURE__*/React.createElement(InlineDialogFormWrapper, null, /*#__PURE__*/React.createElement(ShareForm, {
416
+ content: () => /*#__PURE__*/React.createElement("div", {
417
+ ref: this.containerRef
418
+ }, /*#__PURE__*/React.createElement(LazyShareFormLazy, {
419
+ Content: selectedIntegration && selectedIntegration.Content,
420
+ selectedIntegration: selectedIntegration,
438
421
  copyLink: copyLink,
422
+ showIntegrationForm: showIntegrationForm,
423
+ bottomMessage: bottomMessage,
424
+ customFooter: customFooter,
439
425
  loadOptions: loadUserOptions,
440
426
  isSharing: isSharing,
441
- onSubmit: this.handleShareSubmit,
442
- title: shareFormTitle,
427
+ shareFormTitle: shareFormTitle,
443
428
  showTitle: integrationMode !== 'tabs' || !shareIntegrations || !shareIntegrations.length,
444
- onTabChange: this.onTabChange,
445
- helperMessage: shareFormHelperMessage,
429
+ shareFormHelperMessage: shareFormHelperMessage,
446
430
  shareError: shareError,
447
- onDismiss: this.handleFormDismiss,
448
431
  defaultValue: defaultValue,
449
432
  config: config,
450
433
  isFetchingConfig: isFetchingConfig,
451
- onLinkCopy: this.handleCopyLink,
452
434
  submitButtonLabel: submitButtonLabel,
453
435
  product: product,
454
436
  enableSmartUserPicker: enableSmartUserPicker,
455
437
  loggedInAccountId: loggedInAccountId,
456
438
  cloudId: cloudId,
457
439
  onUserSelectionChange: onUserSelectionChange,
458
- fieldsFooter: shareFieldsFooter,
459
- selectPortalRef: this.selectPortalRef,
440
+ shareFieldsFooter: shareFieldsFooter,
460
441
  isPublicLink: isPublicLink,
461
442
  copyTooltipText: copyTooltipText,
462
443
  integrationMode: integrationMode,
463
- handleCloseDialog: this.handleCloseDialog,
464
- shareIntegrations: shareIntegrations
465
- })), bottomMessage ? /*#__PURE__*/React.createElement(BottomMessageWrapper, null, bottomMessage) : null, customFooter && /*#__PURE__*/React.createElement(CustomFooterWrapper, null, customFooter))),
444
+ shareIntegrations: shareIntegrations // actions
445
+ ,
446
+ onLinkCopy: this.handleCopyLink,
447
+ onSubmit: this.handleShareSubmit,
448
+ onDismiss: this.handleFormDismiss,
449
+ onDialogClose: this.handleCloseDialog,
450
+ onTabChange: this.onTabChange //ref
451
+ ,
452
+ selectPortalRef: this.selectPortalRef
453
+ })),
466
454
  isOpen: isDialogOpen,
467
455
  onClose: this.handleCloseDialog,
468
456
  placement: dialogPlacement,
469
- trigger: triggerProps => this.renderShareTriggerButton(triggerProps),
457
+ trigger: this.renderShareTriggerButton,
470
458
  zIndex: dialogZIndex
471
459
  }), /*#__PURE__*/React.createElement(Portal, {
472
460
  zIndex: generateSelectZIndex(dialogZIndex)
@@ -1,5 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
+ import React from 'react';
3
4
  import Button from '@atlaskit/button/custom-theme-button';
4
5
  import Form from '@atlaskit/form';
5
6
  import ErrorIcon from '@atlaskit/icon/glyph/error';
@@ -7,7 +8,6 @@ import { R400 } from '@atlaskit/theme/colors';
7
8
  import { gridSize } from '@atlaskit/theme/constants';
8
9
  import Tooltip from '@atlaskit/tooltip';
9
10
  import Tabs, { Tab, TabList, TabPanel } from '@atlaskit/tabs';
10
- import React from 'react';
11
11
  import { FormattedMessage, injectIntl } from 'react-intl-next';
12
12
  import styled from 'styled-components';
13
13
  import { messages } from '../i18n';
@@ -97,7 +97,7 @@ class InternalForm extends React.PureComponent {
97
97
  defaultValue: defaultValue && defaultValue.users,
98
98
  config: config,
99
99
  isLoading: isFetchingConfig,
100
- product: product,
100
+ product: product || 'confluence',
101
101
  enableSmartUserPicker: enableSmartUserPicker,
102
102
  loggedInAccountId: loggedInAccountId,
103
103
  cloudId: cloudId,
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { InlineDialogFormWrapper, InlineDialogContentWrapper } from './styled';
3
+ import { ShareHeader } from '../ShareHeader';
4
+
5
+ const ShareFormWrapper = ({
6
+ shareFormTitle,
7
+ shouldShowTitle,
8
+ children = null,
9
+ footer = null
10
+ }) => /*#__PURE__*/React.createElement(InlineDialogContentWrapper, null, /*#__PURE__*/React.createElement(InlineDialogFormWrapper, null, shouldShowTitle && /*#__PURE__*/React.createElement(ShareHeader, {
11
+ title: shareFormTitle
12
+ }), children), footer);
13
+
14
+ export default ShareFormWrapper;
@@ -0,0 +1 @@
1
+ export { default as ShareFormWrapper } from './ShareFormWrapper';
@@ -0,0 +1,15 @@
1
+ import styled from 'styled-components';
2
+ import { gridSize } from '@atlaskit/theme/constants';
3
+ export const InlineDialogFormWrapper = styled.div`
4
+ width: ${gridSize() * 44}px;
5
+ `;
6
+ /**
7
+ * Apply the same styling, as previous @atlaskit/inline-dialog had,
8
+ * compared to the @atlaskit/popup we are now using.
9
+ *
10
+ * packages/design-system/inline-dialog/src/InlineDialog/styled.ts:20:3
11
+ */
12
+
13
+ export const InlineDialogContentWrapper = styled.div`
14
+ padding: ${gridSize() * 2}px ${gridSize() * 3}px;
15
+ `;
@@ -1,21 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import React from 'react'; // AFP-2532 TODO: Fix automatic suppressions below
3
- // eslint-disable-next-line @atlassian/tangerine/import/entry-points
4
-
5
- import { gridSize } from '@atlaskit/theme/constants';
2
+ import React from 'react';
6
3
  import Button from '@atlaskit/button/custom-theme-button';
7
- import styled from 'styled-components';
8
4
  export const MAX_PICKER_HEIGHT = 102;
9
- /**
10
- * Apply the same styling, as previous @atlaskit/inline-dialog had,
11
- * compared to the @atlaskit/popup we are now using.
12
- *
13
- * packages/design-system/inline-dialog/src/InlineDialog/styled.ts:20:3
14
- */
15
-
16
- export const InlineDialogContentWrapper = styled.div`
17
- padding: ${gridSize() * 2}px ${gridSize() * 3}px;
18
- `;
19
5
  const StyledButton = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement(Button, _extends({
20
6
  ref: ref
21
7
  }, props, {
@@ -1,4 +1,3 @@
1
- export { ShareServiceClient } from './clients/ShareServiceClient';
2
1
  export { ShareDialogContainer } from './components/ShareDialogContainer';
3
2
  export { // Constants
4
3
  ADMIN_NOTIFIED, OBJECT_SHARED } from './types';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/share",
3
- "version": "1.0.3"
3
+ "version": "2.0.0"
4
4
  }
@@ -0,0 +1 @@
1
+ export { ShareServiceClient } from './ShareServiceClient';
@@ -23,8 +23,9 @@ import Tooltip from '@atlaskit/tooltip';
23
23
  import React from 'react';
24
24
  import { FormattedMessage, injectIntl } from 'react-intl-next';
25
25
  import styled from 'styled-components';
26
- import Button, { InlineDialogContentWrapper } from './styles';
26
+ import Button from './styles';
27
27
  import { messages } from '../i18n';
28
+ import { InlineDialogContentWrapper } from './ShareFormWrapper/styled';
28
29
  var Z_INDEX = layers.modal();
29
30
  var AUTO_DISMISS_SECONDS = 8;
30
31
  export var AUTO_DISMISS_MS = AUTO_DISMISS_SECONDS * 1000;
@@ -8,8 +8,11 @@ import { h500 } from '@atlaskit/theme/typography';
8
8
  export var FormWrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n [class^='FormHeader__FormHeaderWrapper'] {\n h1:first-child {\n ", "\n\n > span {\n /* jira has a class override font settings on h1 > span in gh-custom-field-pickers.css */\n font-size: inherit !important;\n line-height: inherit !important;\n letter-spacing: inherit !important;\n }\n }\n }\n\n [class^='FormSection__FormSectionWrapper'] {\n margin-top: 0px;\n }\n\n [class^='FormFooter__FormFooterWrapper'] {\n justify-content: space-between;\n margin-top: 12px;\n margin-bottom: 24px;\n }\n\n [class^='Field__FieldWrapper']:not(:first-child) {\n margin-top: 12px;\n }\n"])), h500());
9
9
  export var IntegrationForm = function IntegrationForm(_ref) {
10
10
  var Content = _ref.Content,
11
- onIntegrationClose = _ref.onIntegrationClose;
12
- return /*#__PURE__*/React.createElement(FormWrapper, null, /*#__PURE__*/React.createElement(Content, {
11
+ _ref$onIntegrationClo = _ref.onIntegrationClose,
12
+ onIntegrationClose = _ref$onIntegrationClo === void 0 ? function () {
13
+ return undefined;
14
+ } : _ref$onIntegrationClo;
15
+ return /*#__PURE__*/React.createElement(FormWrapper, null, Content && /*#__PURE__*/React.createElement(Content, {
13
16
  onClose: onIntegrationClose
14
17
  }));
15
18
  };
@@ -0,0 +1,87 @@
1
+ import React from 'react';
2
+ import { AnalyticsContext } from '@atlaskit/analytics-next';
3
+ import { ShareForm } from '../ShareForm';
4
+ import { ANALYTICS_SOURCE } from '../analytics';
5
+ import { IntegrationForm } from '../IntegrationForm';
6
+ import { BottomMessageWrapper, CustomFooterWrapper } from './styled';
7
+ import { ShareFormWrapper } from '../ShareFormWrapper';
8
+
9
+ /**
10
+ * A Share form content which is lazy-loaded.
11
+ * Make sure this component is not exported inside main entry points `src/index.ts`
12
+ */
13
+ function LazyShareForm(props) {
14
+ var copyLink = props.copyLink,
15
+ config = props.config,
16
+ isFetchingConfig = props.isFetchingConfig,
17
+ loadOptions = props.loadOptions,
18
+ shareFormTitle = props.shareFormTitle,
19
+ shareFormHelperMessage = props.shareFormHelperMessage,
20
+ bottomMessage = props.bottomMessage,
21
+ submitButtonLabel = props.submitButtonLabel,
22
+ product = props.product,
23
+ customFooter = props.customFooter,
24
+ enableSmartUserPicker = props.enableSmartUserPicker,
25
+ loggedInAccountId = props.loggedInAccountId,
26
+ cloudId = props.cloudId,
27
+ shareFieldsFooter = props.shareFieldsFooter,
28
+ onUserSelectionChange = props.onUserSelectionChange,
29
+ isPublicLink = props.isPublicLink,
30
+ copyTooltipText = props.copyTooltipText,
31
+ shareIntegrations = props.shareIntegrations,
32
+ integrationMode = props.integrationMode,
33
+ onLinkCopy = props.onLinkCopy,
34
+ onDismiss = props.onDismiss,
35
+ onSubmit = props.onSubmit,
36
+ onDialogClose = props.onDialogClose,
37
+ selectPortalRef = props.selectPortalRef,
38
+ showIntegrationForm = props.showIntegrationForm,
39
+ selectedIntegration = props.selectedIntegration,
40
+ isSharing = props.isSharing,
41
+ shareError = props.shareError,
42
+ defaultValue = props.defaultValue,
43
+ showTitle = props.showTitle;
44
+ var footer = /*#__PURE__*/React.createElement("div", null, bottomMessage ? /*#__PURE__*/React.createElement(BottomMessageWrapper, null, bottomMessage) : null, customFooter && /*#__PURE__*/React.createElement(CustomFooterWrapper, null, customFooter));
45
+ return /*#__PURE__*/React.createElement(AnalyticsContext, {
46
+ data: {
47
+ source: ANALYTICS_SOURCE
48
+ }
49
+ }, /*#__PURE__*/React.createElement(ShareFormWrapper, {
50
+ footer: footer // form title will be determined by `title` and `showTitle` prop passed to `ShareForm`,
51
+ // so we don't need to show title via ShareFormWrapper
52
+ ,
53
+ shouldShowTitle: false
54
+ }, showIntegrationForm && selectedIntegration !== null ? /*#__PURE__*/React.createElement(IntegrationForm, {
55
+ Content: selectedIntegration.Content,
56
+ onIntegrationClose: onDialogClose
57
+ }) : /*#__PURE__*/React.createElement(ShareForm, {
58
+ copyLink: copyLink,
59
+ loadOptions: loadOptions,
60
+ title: shareFormTitle,
61
+ showTitle: showTitle,
62
+ helperMessage: shareFormHelperMessage,
63
+ shareError: shareError,
64
+ defaultValue: defaultValue,
65
+ config: config,
66
+ submitButtonLabel: submitButtonLabel,
67
+ product: product,
68
+ enableSmartUserPicker: enableSmartUserPicker,
69
+ loggedInAccountId: loggedInAccountId,
70
+ cloudId: cloudId,
71
+ fieldsFooter: shareFieldsFooter,
72
+ selectPortalRef: selectPortalRef,
73
+ copyTooltipText: copyTooltipText,
74
+ integrationMode: integrationMode,
75
+ shareIntegrations: shareIntegrations,
76
+ isSharing: isSharing,
77
+ isFetchingConfig: isFetchingConfig,
78
+ isPublicLink: isPublicLink,
79
+ onSubmit: onSubmit,
80
+ onDismiss: onDismiss,
81
+ onLinkCopy: onLinkCopy,
82
+ onUserSelectionChange: onUserSelectionChange,
83
+ handleCloseDialog: onDialogClose
84
+ })));
85
+ }
86
+
87
+ export default LazyShareForm;
@@ -0,0 +1 @@
1
+ export { default } from './LazyShareForm';
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import { LazySuspense, lazyForPaint } from 'react-loosely-lazy';
3
+ import Spinner from '@atlaskit/spinner';
4
+ import { SpinnerWrapper } from './styled';
5
+ import { ShareFormWrapper } from '../ShareFormWrapper';
6
+ var LazyShareFormLazy = lazyForPaint(function () {
7
+ return import(
8
+ /* webpackChunkName: "@atlaskit-internal_share-form" */
9
+ './LazyShareForm');
10
+ }, {
11
+ ssr: false
12
+ });
13
+
14
+ var LoadingDialog = function LoadingDialog(_ref) {
15
+ var shareFormTitle = _ref.shareFormTitle,
16
+ showTitle = _ref.showTitle;
17
+ return /*#__PURE__*/React.createElement(ShareFormWrapper, {
18
+ shareFormTitle: shareFormTitle // if `showTitle` is passed, we use it. Otherwise, we will show title for loading dialog.
19
+ ,
20
+ shouldShowTitle: typeof showTitle === 'boolean' ? showTitle : true
21
+ }, /*#__PURE__*/React.createElement(SpinnerWrapper, null, /*#__PURE__*/React.createElement(Spinner, null)));
22
+ };
23
+
24
+ export default (function (props) {
25
+ return /*#__PURE__*/React.createElement(LazySuspense, {
26
+ fallback: /*#__PURE__*/React.createElement(LoadingDialog, {
27
+ shareFormTitle: props.shareFormTitle,
28
+ showTitle: props.showTitle
29
+ })
30
+ }, /*#__PURE__*/React.createElement(LazyShareFormLazy, props));
31
+ });
@@ -0,0 +1,9 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
+
3
+ var _templateObject, _templateObject2, _templateObject3;
4
+
5
+ import styled from 'styled-components';
6
+ import { gridSize } from '@atlaskit/theme/constants';
7
+ export var BottomMessageWrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: ", "px;\n"])), gridSize() * 44);
8
+ export var CustomFooterWrapper = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n /* Must match inline dialog padding. */\n margin: 0 ", "px ", "px ", "px;\n"])), -gridSize() * 3, -gridSize() * 2, -gridSize() * 3);
9
+ export var SpinnerWrapper = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n widht: 100%;\n height: 100%;\n display: flex;\n justify-content: center;\n align-content: center;\n"])));
@@ -8,7 +8,7 @@ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
8
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
9
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
10
10
 
11
- var _templateObject, _templateObject2, _templateObject3, _templateObject4;
11
+ var _templateObject;
12
12
 
13
13
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
14
14
 
@@ -18,28 +18,23 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
18
18
 
19
19
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
20
20
 
21
- import { AnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
21
+ import React from 'react';
22
+ import { withAnalyticsEvents } from '@atlaskit/analytics-next';
22
23
  import SplitButton from './SplitButton';
23
24
  import ShareIcon from '@atlaskit/icon/glyph/share';
24
25
  import Popup from '@atlaskit/popup';
25
26
  import Portal from '@atlaskit/portal';
26
27
  import Aktooltip from '@atlaskit/tooltip';
27
- import { gridSize, layers } from '@atlaskit/theme/constants';
28
- import React from 'react';
28
+ import { layers } from '@atlaskit/theme/constants';
29
29
  import { FormattedMessage, injectIntl } from 'react-intl-next';
30
30
  import styled from 'styled-components';
31
31
  import { messages } from '../i18n';
32
32
  import { OBJECT_SHARED } from '../types';
33
- import { cancelShare, CHANNEL_ID, copyLinkButtonClicked, formShareSubmitted, screenEvent, shareTriggerButtonClicked, shareSplitButtonEvent, ANALYTICS_SOURCE, shareTabClicked } from './analytics';
33
+ import { cancelShare, CHANNEL_ID, copyLinkButtonClicked, screenEvent, shareTriggerButtonClicked, shareSplitButtonEvent, shareTabClicked, formShareSubmitted } from './analytics';
34
34
  import ShareButton from './ShareButton';
35
- import { ShareForm } from './ShareForm';
36
35
  import { generateSelectZIndex } from './utils';
37
- import { InlineDialogContentWrapper } from './styles';
38
- import { IntegrationForm } from './IntegrationForm';
36
+ import LazyShareFormLazy from './LazyShareForm/lazy';
39
37
  var ShareButtonWrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-flex;\n outline: none;\n"])));
40
- var InlineDialogFormWrapper = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: 352px;\n"])));
41
- var BottomMessageWrapper = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n width: 352px;\n"])));
42
- var CustomFooterWrapper = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n /* Must match inline dialog padding. */\n margin: 0 ", "px ", "px ", "px;\n"])), -gridSize() * 3, -gridSize() * 2, -gridSize() * 3);
43
38
  export var defaultShareContentState = {
44
39
  users: [],
45
40
  comment: {
@@ -445,51 +440,49 @@ export var ShareDialogWithTriggerInternal = /*#__PURE__*/function (_React$PureCo
445
440
  style: style
446
441
  }, /*#__PURE__*/React.createElement(Popup, {
447
442
  content: function content() {
448
- return /*#__PURE__*/React.createElement(AnalyticsContext, {
449
- data: {
450
- source: ANALYTICS_SOURCE
451
- }
452
- }, /*#__PURE__*/React.createElement(InlineDialogContentWrapper, {
453
- innerRef: _this2.containerRef
454
- }, showIntegrationForm && selectedIntegration !== null ? /*#__PURE__*/React.createElement(InlineDialogFormWrapper, null, /*#__PURE__*/React.createElement(IntegrationForm, {
455
- Content: selectedIntegration.Content,
456
- onIntegrationClose: _this2.handleCloseDialog
457
- })) : /*#__PURE__*/React.createElement(InlineDialogFormWrapper, null, /*#__PURE__*/React.createElement(ShareForm, {
443
+ return /*#__PURE__*/React.createElement("div", {
444
+ ref: _this2.containerRef
445
+ }, /*#__PURE__*/React.createElement(LazyShareFormLazy, {
446
+ Content: selectedIntegration && selectedIntegration.Content,
447
+ selectedIntegration: selectedIntegration,
458
448
  copyLink: copyLink,
449
+ showIntegrationForm: showIntegrationForm,
450
+ bottomMessage: bottomMessage,
451
+ customFooter: customFooter,
459
452
  loadOptions: loadUserOptions,
460
453
  isSharing: isSharing,
461
- onSubmit: _this2.handleShareSubmit,
462
- title: shareFormTitle,
454
+ shareFormTitle: shareFormTitle,
463
455
  showTitle: integrationMode !== 'tabs' || !shareIntegrations || !shareIntegrations.length,
464
- onTabChange: _this2.onTabChange,
465
- helperMessage: shareFormHelperMessage,
456
+ shareFormHelperMessage: shareFormHelperMessage,
466
457
  shareError: shareError,
467
- onDismiss: _this2.handleFormDismiss,
468
458
  defaultValue: defaultValue,
469
459
  config: config,
470
460
  isFetchingConfig: isFetchingConfig,
471
- onLinkCopy: _this2.handleCopyLink,
472
461
  submitButtonLabel: submitButtonLabel,
473
462
  product: product,
474
463
  enableSmartUserPicker: enableSmartUserPicker,
475
464
  loggedInAccountId: loggedInAccountId,
476
465
  cloudId: cloudId,
477
466
  onUserSelectionChange: onUserSelectionChange,
478
- fieldsFooter: shareFieldsFooter,
479
- selectPortalRef: _this2.selectPortalRef,
467
+ shareFieldsFooter: shareFieldsFooter,
480
468
  isPublicLink: isPublicLink,
481
469
  copyTooltipText: copyTooltipText,
482
470
  integrationMode: integrationMode,
483
- handleCloseDialog: _this2.handleCloseDialog,
484
- shareIntegrations: shareIntegrations
485
- })), bottomMessage ? /*#__PURE__*/React.createElement(BottomMessageWrapper, null, bottomMessage) : null, customFooter && /*#__PURE__*/React.createElement(CustomFooterWrapper, null, customFooter)));
471
+ shareIntegrations: shareIntegrations // actions
472
+ ,
473
+ onLinkCopy: _this2.handleCopyLink,
474
+ onSubmit: _this2.handleShareSubmit,
475
+ onDismiss: _this2.handleFormDismiss,
476
+ onDialogClose: _this2.handleCloseDialog,
477
+ onTabChange: _this2.onTabChange //ref
478
+ ,
479
+ selectPortalRef: _this2.selectPortalRef
480
+ }));
486
481
  },
487
482
  isOpen: isDialogOpen,
488
483
  onClose: this.handleCloseDialog,
489
484
  placement: dialogPlacement,
490
- trigger: function trigger(triggerProps) {
491
- return _this2.renderShareTriggerButton(triggerProps);
492
- },
485
+ trigger: this.renderShareTriggerButton,
493
486
  zIndex: dialogZIndex
494
487
  }), /*#__PURE__*/React.createElement(Portal, {
495
488
  zIndex: generateSelectZIndex(dialogZIndex)