@atlaskit/share 3.3.1 → 3.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/cjs/components/CopyLinkButton.js +21 -19
- package/dist/cjs/components/IntegrationButton.js +10 -10
- package/dist/cjs/components/IntegrationForm.js +7 -6
- package/dist/cjs/components/LazyShareForm/LazyShareForm.js +5 -0
- package/dist/cjs/components/LazyShareForm/lazy.js +9 -2
- package/dist/cjs/components/ShareDialogWithTrigger.js +49 -33
- package/dist/cjs/components/ShareForm.js +53 -42
- package/dist/cjs/components/ShareHeader.js +14 -7
- package/dist/cjs/components/SplitButton.js +19 -15
- package/dist/cjs/components/analytics/analytics.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/CopyLinkButton.js +20 -13
- package/dist/es2019/components/IntegrationButton.js +11 -8
- package/dist/es2019/components/IntegrationForm.js +6 -3
- package/dist/es2019/components/LazyShareForm/LazyShareForm.js +4 -0
- package/dist/es2019/components/LazyShareForm/lazy.js +14 -7
- package/dist/es2019/components/ShareDialogWithTrigger.js +39 -21
- package/dist/es2019/components/ShareForm.js +51 -31
- package/dist/es2019/components/ShareHeader.js +13 -5
- package/dist/es2019/components/SplitButton.js +21 -13
- package/dist/es2019/components/analytics/analytics.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/CopyLinkButton.js +19 -13
- package/dist/esm/components/IntegrationButton.js +11 -9
- package/dist/esm/components/IntegrationForm.js +6 -3
- package/dist/esm/components/LazyShareForm/LazyShareForm.js +4 -0
- package/dist/esm/components/LazyShareForm/lazy.js +7 -2
- package/dist/esm/components/ShareDialogWithTrigger.js +51 -31
- package/dist/esm/components/ShareForm.js +50 -30
- package/dist/esm/components/ShareHeader.js +12 -4
- package/dist/esm/components/SplitButton.js +20 -13
- package/dist/esm/components/analytics/analytics.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/components/CopyLinkButton.d.ts +5 -3
- package/dist/types/components/IntegrationButton.d.ts +1 -0
- package/dist/types/components/IntegrationForm.d.ts +4 -2
- package/dist/types/components/LazyShareForm/LazyShareForm.d.ts +1 -0
- package/dist/types/components/ShareDialogWithTrigger.d.ts +5 -1
- package/dist/types/components/ShareForm.d.ts +3 -2
- package/dist/types/components/ShareHeader.d.ts +3 -1
- package/dist/types/components/SplitButton.d.ts +1 -0
- package/dist/types/types/ShareDialogWithTrigger.d.ts +1 -0
- package/package.json +4 -3
- package/tsconfig.json +0 -1
|
@@ -5,15 +5,15 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.getFormHeaderTitleStyles = exports.ShareHeader = void 0;
|
|
9
9
|
|
|
10
10
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
11
11
|
|
|
12
12
|
var _react = _interopRequireDefault(require("react"));
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _react2 = require("@emotion/react");
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _reactIntlNext = require("react-intl-next");
|
|
17
17
|
|
|
18
18
|
var _constants = require("@atlaskit/theme/constants");
|
|
19
19
|
|
|
@@ -23,15 +23,22 @@ var _i18n = require("../i18n");
|
|
|
23
23
|
|
|
24
24
|
var _templateObject, _templateObject2;
|
|
25
25
|
|
|
26
|
-
var
|
|
26
|
+
var headerWrapperStyles = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n justify-content: space-between;\n"])));
|
|
27
27
|
|
|
28
|
-
var
|
|
28
|
+
var getFormHeaderTitleStyles = function getFormHeaderTitleStyles(theme) {
|
|
29
|
+
return (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n line-height: ", "px;\n margin-right: ", "px;\n margin-top: ", "px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n\n > span {\n font-size: initial;\n }\n"])), (0, _typography.h500)(theme), (0, _constants.gridSize)() * 4, (0, _constants.gridSize)() * 4, (0, _constants.gridSize)() * 4);
|
|
30
|
+
};
|
|
29
31
|
|
|
30
|
-
exports.
|
|
32
|
+
exports.getFormHeaderTitleStyles = getFormHeaderTitleStyles;
|
|
31
33
|
|
|
32
34
|
var ShareHeader = function ShareHeader(_ref) {
|
|
33
35
|
var title = _ref.title;
|
|
34
|
-
|
|
36
|
+
var theme = (0, _react2.useTheme)();
|
|
37
|
+
return (0, _react2.jsx)("div", {
|
|
38
|
+
css: headerWrapperStyles
|
|
39
|
+
}, (0, _react2.jsx)("h1", {
|
|
40
|
+
css: getFormHeaderTitleStyles(theme)
|
|
41
|
+
}, title || (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _i18n.messages.formTitle)));
|
|
35
42
|
};
|
|
36
43
|
|
|
37
44
|
exports.ShareHeader = ShareHeader;
|
|
@@ -17,9 +17,9 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
|
|
|
17
17
|
|
|
18
18
|
var _react = _interopRequireWildcard(require("react"));
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _react2 = require("@emotion/react");
|
|
21
21
|
|
|
22
|
-
var
|
|
22
|
+
var _reactIntlNext = require("react-intl-next");
|
|
23
23
|
|
|
24
24
|
var _standardButton = _interopRequireDefault(require("@atlaskit/button/standard-button"));
|
|
25
25
|
|
|
@@ -47,14 +47,13 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
47
47
|
|
|
48
48
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
49
49
|
|
|
50
|
-
var
|
|
51
|
-
|
|
52
|
-
var DropdownMenuWrapper = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n margin-left: 1px;\n button {\n border-radius: 0 ", "px ", "px 0;\n }\n button:hover {\n border-radius: 0 ", "px ", "px 0;\n }\n"])), (0, _constants.borderRadius)(), (0, _constants.borderRadius)(), (0, _constants.borderRadius)(), (0, _constants.borderRadius)());
|
|
50
|
+
var splitButtonWrapperStyles = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n button {\n border-radius: ", "px 0 0 ", "px;\n }\n button:hover {\n border-radius: ", "px 0 0 ", "px;\n }\n"])), (0, _constants.borderRadius)(), (0, _constants.borderRadius)(), (0, _constants.borderRadius)(), (0, _constants.borderRadius)());
|
|
51
|
+
var dropdownMenuWrapperStyles = (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n margin-left: 1px;\n button {\n border-radius: 0 ", "px ", "px 0;\n }\n button:hover {\n border-radius: 0 ", "px ", "px 0;\n }\n"])), (0, _constants.borderRadius)(), (0, _constants.borderRadius)(), (0, _constants.borderRadius)(), (0, _constants.borderRadius)()); // span
|
|
53
52
|
|
|
54
|
-
var
|
|
53
|
+
var dropDownIntegrationButtonWrapperStyles = (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n button:hover {\n background: transparent;\n }\n"])));
|
|
55
54
|
|
|
56
55
|
var integrationButtonText = function integrationButtonText(integrationName) {
|
|
57
|
-
return
|
|
56
|
+
return (0, _react2.jsx)(_reactIntlNext.FormattedMessage, (0, _extends2.default)({}, _i18n.messages.shareToIntegrationButtonText, {
|
|
58
57
|
values: {
|
|
59
58
|
integrationName: integrationName
|
|
60
59
|
}
|
|
@@ -82,14 +81,16 @@ var SplitButtonDropdown = function SplitButtonDropdown(props) {
|
|
|
82
81
|
onIntegrationClick(integration);
|
|
83
82
|
createAndFireEvent((0, _analytics.shareIntegrationButtonEvent)(integration.type));
|
|
84
83
|
}, [createAndFireEvent, onIntegrationClick]);
|
|
85
|
-
return
|
|
84
|
+
return (0, _react2.jsx)("div", {
|
|
85
|
+
css: dropdownMenuWrapperStyles
|
|
86
|
+
}, (0, _react2.jsx)(_dropdownMenu.default, {
|
|
86
87
|
testId: "split-button-dropdown",
|
|
87
88
|
trigger: function trigger(_ref2) {
|
|
88
89
|
var triggerRef = _ref2.triggerRef,
|
|
89
90
|
providedProps = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
|
|
90
|
-
return
|
|
91
|
+
return (0, _react2.jsx)(_standardButton.default, (0, _extends2.default)({}, providedProps, {
|
|
91
92
|
ref: triggerRef,
|
|
92
|
-
iconBefore:
|
|
93
|
+
iconBefore: (0, _react2.jsx)(_chevronDown.default, {
|
|
93
94
|
label: ""
|
|
94
95
|
}),
|
|
95
96
|
appearance: triggerButtonAppearance
|
|
@@ -98,11 +99,13 @@ var SplitButtonDropdown = function SplitButtonDropdown(props) {
|
|
|
98
99
|
placement: "bottom-end",
|
|
99
100
|
isOpen: isUsingSplitButton,
|
|
100
101
|
onOpenChange: onOpenChange
|
|
101
|
-
},
|
|
102
|
-
return
|
|
102
|
+
}, (0, _react2.jsx)(_dropdownMenu.DropdownItemGroup, null, shareIntegrations.map(function (integration) {
|
|
103
|
+
return (0, _react2.jsx)(_dropdownMenu.DropdownItem, {
|
|
103
104
|
key: integration.type,
|
|
104
105
|
testId: "split-button-dropdownitem-".concat(integration.type)
|
|
105
|
-
},
|
|
106
|
+
}, (0, _react2.jsx)("span", {
|
|
107
|
+
css: dropDownIntegrationButtonWrapperStyles
|
|
108
|
+
}, (0, _react2.jsx)(_IntegrationButton.default, {
|
|
106
109
|
textColor: (0, _tokens.token)('color.text', _colors.N800),
|
|
107
110
|
appearance: "subtle",
|
|
108
111
|
onClick: function onClick() {
|
|
@@ -128,9 +131,10 @@ function SplitButton(_ref3) {
|
|
|
128
131
|
dialogZIndex = _ref3.dialogZIndex,
|
|
129
132
|
dialogPlacement = _ref3.dialogPlacement,
|
|
130
133
|
createAndFireEvent = _ref3.createAndFireEvent;
|
|
131
|
-
return
|
|
134
|
+
return (0, _react2.jsx)("div", {
|
|
135
|
+
css: splitButtonWrapperStyles,
|
|
132
136
|
"data-testid": "split-button"
|
|
133
|
-
}, shareButton,
|
|
137
|
+
}, shareButton, (0, _react2.jsx)(SplitButtonDropdown, {
|
|
134
138
|
shareIntegrations: shareIntegrations,
|
|
135
139
|
triggerButtonAppearance: triggerButtonAppearance,
|
|
136
140
|
isUsingSplitButton: isUsingSplitButton,
|
|
@@ -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.
|
|
22
|
+
packageVersion: "3.4.2"
|
|
23
23
|
}, attributes);
|
|
24
24
|
};
|
|
25
25
|
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
|
|
4
|
+
/** @jsx jsx */
|
|
3
5
|
import React from 'react';
|
|
6
|
+
import { css, jsx } from '@emotion/react';
|
|
4
7
|
import { FormattedMessage, injectIntl } from 'react-intl-next';
|
|
5
|
-
import styled from 'styled-components';
|
|
6
8
|
import CheckCircleIcon from '@atlaskit/icon/glyph/check-circle';
|
|
7
9
|
import LinkFilledIcon from '@atlaskit/icon/glyph/link-filled';
|
|
8
10
|
import Popup from '@atlaskit/popup';
|
|
@@ -16,17 +18,17 @@ import Button from './styles';
|
|
|
16
18
|
const Z_INDEX = layers.modal();
|
|
17
19
|
const AUTO_DISMISS_SECONDS = 8;
|
|
18
20
|
export const AUTO_DISMISS_MS = AUTO_DISMISS_SECONDS * 1000;
|
|
19
|
-
export const
|
|
21
|
+
export const messageContainerStyle = css`
|
|
20
22
|
display: flex;
|
|
21
23
|
align-items: center;
|
|
22
24
|
margin: -8px -16px;
|
|
23
25
|
`;
|
|
24
26
|
const isSafari = navigator.userAgent.indexOf('Safari');
|
|
25
|
-
const
|
|
27
|
+
const messageTextStyle = css`
|
|
26
28
|
text-indent: 6px;
|
|
27
29
|
`;
|
|
28
30
|
export const HiddenInput = /*#__PURE__*/React.forwardRef( // we need a hidden input to reliably copy to clipboard across all browsers.
|
|
29
|
-
(props, ref) =>
|
|
31
|
+
(props, ref) => jsx("input", {
|
|
30
32
|
style: {
|
|
31
33
|
position: 'absolute',
|
|
32
34
|
left: '-9999px'
|
|
@@ -90,16 +92,16 @@ export class CopyLinkButton extends React.Component {
|
|
|
90
92
|
isDisabled,
|
|
91
93
|
isPublicLink
|
|
92
94
|
} = this.props;
|
|
93
|
-
return
|
|
95
|
+
return jsx(Button, _extends({
|
|
94
96
|
"aria-label": formatMessage(isPublicLink ? messages.copyPublicLinkButtonText : messages.copyLinkButtonText),
|
|
95
97
|
isDisabled: isDisabled,
|
|
96
98
|
appearance: "subtle-link",
|
|
97
|
-
iconBefore:
|
|
99
|
+
iconBefore: jsx(LinkFilledIcon, {
|
|
98
100
|
label: "",
|
|
99
101
|
size: "medium"
|
|
100
102
|
}),
|
|
101
103
|
onClick: this.handleClick
|
|
102
|
-
}, triggerProps),
|
|
104
|
+
}, triggerProps), jsx(FormattedMessage, isPublicLink ? messages.copyPublicLinkButtonText : messages.copyLinkButtonText));
|
|
103
105
|
});
|
|
104
106
|
}
|
|
105
107
|
|
|
@@ -117,22 +119,27 @@ export class CopyLinkButton extends React.Component {
|
|
|
117
119
|
},
|
|
118
120
|
copyTooltipText
|
|
119
121
|
} = this.props;
|
|
120
|
-
return
|
|
122
|
+
return jsx(React.Fragment, null, isSafari && jsx("div", {
|
|
121
123
|
className: "assistive",
|
|
122
124
|
"aria-live": "assertive"
|
|
123
|
-
}, shouldShowCopiedMessage && formatMessage(messages.copiedToClipboardMessage)),
|
|
125
|
+
}, shouldShowCopiedMessage && formatMessage(messages.copiedToClipboardMessage)), jsx(HiddenInput, {
|
|
124
126
|
ref: this.inputRef,
|
|
125
127
|
text: this.props.link
|
|
126
|
-
}),
|
|
128
|
+
}), jsx(Popup, {
|
|
127
129
|
zIndex: Z_INDEX,
|
|
128
|
-
content: () =>
|
|
130
|
+
content: () => jsx(InlineDialogContentWrapper, null, jsx("div", {
|
|
131
|
+
css: messageContainerStyle,
|
|
132
|
+
"data-testid": "message-container"
|
|
133
|
+
}, jsx(CheckCircleIcon, {
|
|
129
134
|
label: "",
|
|
130
135
|
primaryColor: token('color.icon.success', G300)
|
|
131
|
-
}),
|
|
136
|
+
}), jsx("span", {
|
|
137
|
+
css: messageTextStyle
|
|
138
|
+
}, jsx(FormattedMessage, messages.copiedToClipboardMessage)))),
|
|
132
139
|
isOpen: shouldShowCopiedMessage,
|
|
133
140
|
onClose: this.handleDismissCopiedMessage,
|
|
134
141
|
placement: "top-start",
|
|
135
|
-
trigger: triggerProps => copyTooltipText ?
|
|
142
|
+
trigger: triggerProps => copyTooltipText ? jsx(Tooltip, {
|
|
136
143
|
content: copyTooltipText,
|
|
137
144
|
position: "bottom-start"
|
|
138
145
|
}, this.renderTriggerButton(triggerProps)) : this.renderTriggerButton(triggerProps)
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
1
2
|
import React from 'react';
|
|
2
|
-
import
|
|
3
|
+
import { css, jsx } from '@emotion/react';
|
|
3
4
|
import Button from '@atlaskit/button/custom-theme-button';
|
|
4
5
|
import { N500 } from '@atlaskit/theme/colors';
|
|
5
6
|
import { token } from '@atlaskit/tokens';
|
|
6
|
-
const
|
|
7
|
-
color: ${props => props.theme.textColor || token('color.text', N500)};
|
|
7
|
+
const integrationButtonCopyWrapperStyle = css`
|
|
8
8
|
display: flex;
|
|
9
9
|
justify-content: left;
|
|
10
10
|
`;
|
|
11
|
-
const
|
|
11
|
+
const integrationIconWrapperStyle = css`
|
|
12
12
|
margin: 1px 8px 0 0;
|
|
13
13
|
`;
|
|
14
14
|
|
|
@@ -19,11 +19,14 @@ const IntegrationButton = props => {
|
|
|
19
19
|
IntegrationIcon,
|
|
20
20
|
...restProps
|
|
21
21
|
} = props;
|
|
22
|
-
return
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
return jsx(Button, restProps, jsx("span", {
|
|
23
|
+
css: integrationButtonCopyWrapperStyle,
|
|
24
|
+
style: {
|
|
25
|
+
color: textColor || token('color.text', N500)
|
|
25
26
|
}
|
|
26
|
-
},
|
|
27
|
+
}, jsx("span", {
|
|
28
|
+
css: integrationIconWrapperStyle
|
|
29
|
+
}, jsx(IntegrationIcon, null)), jsx("span", null, text)));
|
|
27
30
|
};
|
|
28
31
|
|
|
29
32
|
IntegrationButton.displayName = 'IntegrationButton';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
1
2
|
import React from 'react';
|
|
2
|
-
import
|
|
3
|
+
import { css, jsx } from '@emotion/react';
|
|
3
4
|
import { h500 } from '@atlaskit/theme/typography';
|
|
4
|
-
export const
|
|
5
|
+
export const formWrapperStyle = css`
|
|
5
6
|
[class^='FormHeader__FormHeaderWrapper'] {
|
|
6
7
|
h1:first-child {
|
|
7
8
|
${h500()}
|
|
@@ -33,7 +34,9 @@ export const IntegrationForm = ({
|
|
|
33
34
|
Content,
|
|
34
35
|
onIntegrationClose = () => undefined,
|
|
35
36
|
changeTab = () => undefined
|
|
36
|
-
}) =>
|
|
37
|
+
}) => jsx("div", {
|
|
38
|
+
css: formWrapperStyle
|
|
39
|
+
}, Content && jsx(Content, {
|
|
37
40
|
onClose: onIntegrationClose,
|
|
38
41
|
changeTab: changeTab
|
|
39
42
|
}));
|
|
@@ -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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
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)));
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
|
|
4
|
+
/** @jsx jsx */
|
|
3
5
|
import React from 'react';
|
|
6
|
+
import { css, jsx } from '@emotion/react';
|
|
4
7
|
import { FormattedMessage, injectIntl } from 'react-intl-next';
|
|
5
|
-
import styled from 'styled-components';
|
|
6
8
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
7
9
|
import ShareIcon from '@atlaskit/icon/glyph/share';
|
|
8
10
|
import Popup from '@atlaskit/popup';
|
|
@@ -20,7 +22,7 @@ import LazyShareFormLazy from './LazyShareForm/lazy';
|
|
|
20
22
|
import ShareButton from './ShareButton';
|
|
21
23
|
import SplitButton from './SplitButton';
|
|
22
24
|
import { generateSelectZIndex, resolveShareFooter } from './utils';
|
|
23
|
-
const
|
|
25
|
+
const shareButtonWrapperStyles = css`
|
|
24
26
|
display: inline-flex;
|
|
25
27
|
outline: none;
|
|
26
28
|
`;
|
|
@@ -50,7 +52,8 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
|
|
|
50
52
|
isUsingSplitButton: false,
|
|
51
53
|
showIntegrationForm: false,
|
|
52
54
|
selectedIntegration: null,
|
|
53
|
-
tabIndex: 0
|
|
55
|
+
tabIndex: 0,
|
|
56
|
+
isLoading: false
|
|
54
57
|
});
|
|
55
58
|
|
|
56
59
|
_defineProperty(this, "closeAndResetDialog", () => {
|
|
@@ -126,14 +129,32 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
|
|
|
126
129
|
}];
|
|
127
130
|
});
|
|
128
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
|
+
|
|
129
144
|
_defineProperty(this, "handleKeyDown", event => {
|
|
130
145
|
const {
|
|
146
|
+
isLoading,
|
|
131
147
|
isDialogOpen
|
|
132
148
|
} = this.state;
|
|
133
149
|
const {
|
|
134
150
|
shouldCloseOnEscapePress
|
|
135
151
|
} = this.props;
|
|
136
152
|
|
|
153
|
+
if (isLoading) {
|
|
154
|
+
event.stopPropagation();
|
|
155
|
+
this.focus();
|
|
156
|
+
}
|
|
157
|
+
|
|
137
158
|
if (isDialogOpen) {
|
|
138
159
|
switch (event.key) {
|
|
139
160
|
case 'Esc':
|
|
@@ -145,10 +166,7 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
|
|
|
145
166
|
event.stopPropagation(); // put the focus back onto the share dialog so that
|
|
146
167
|
// the user can press the escape key again to close the dialog
|
|
147
168
|
|
|
148
|
-
|
|
149
|
-
this.containerRef.current.focus();
|
|
150
|
-
}
|
|
151
|
-
|
|
169
|
+
this.focus();
|
|
152
170
|
return;
|
|
153
171
|
} // The dialog will auto-close in @atlaskit/popup, we just need to fire
|
|
154
172
|
// the right events.
|
|
@@ -192,9 +210,7 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
|
|
|
192
210
|
onDialogOpen();
|
|
193
211
|
}
|
|
194
212
|
|
|
195
|
-
|
|
196
|
-
this.containerRef.current.focus();
|
|
197
|
-
}
|
|
213
|
+
this.focus();
|
|
198
214
|
}
|
|
199
215
|
});
|
|
200
216
|
});
|
|
@@ -326,12 +342,12 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
|
|
|
326
342
|
onClick: this.onTriggerClick
|
|
327
343
|
}, triggerProps);
|
|
328
344
|
} else {
|
|
329
|
-
button =
|
|
345
|
+
button = jsx(ShareButton, _extends({
|
|
330
346
|
appearance: triggerButtonAppearance,
|
|
331
|
-
text: triggerButtonStyle !== 'icon-only' ?
|
|
347
|
+
text: triggerButtonStyle !== 'icon-only' ? jsx(FormattedMessage, messages.shareTriggerButtonText) : null,
|
|
332
348
|
"aria-label": formatMessage(messages.shareTriggerButtonText),
|
|
333
349
|
onClick: this.onTriggerClick,
|
|
334
|
-
iconBefore: triggerButtonStyle !== 'text-only' ?
|
|
350
|
+
iconBefore: triggerButtonStyle !== 'text-only' ? jsx(ShareButtonIcon, {
|
|
335
351
|
label: ""
|
|
336
352
|
}) : undefined,
|
|
337
353
|
isSelected: isDialogOpen,
|
|
@@ -341,7 +357,7 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
|
|
|
341
357
|
|
|
342
358
|
|
|
343
359
|
if (triggerButtonStyle === 'icon-only') {
|
|
344
|
-
button =
|
|
360
|
+
button = jsx(Aktooltip, {
|
|
345
361
|
content: !isUsingSplitButton ? triggerButtonTooltipText || formatMessage(messages.shareTriggerButtonTooltipText) : null,
|
|
346
362
|
position: triggerButtonTooltipPosition,
|
|
347
363
|
hideTooltipOnClick: true
|
|
@@ -350,7 +366,7 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
|
|
|
350
366
|
|
|
351
367
|
|
|
352
368
|
if (integrationMode === 'split' && shareIntegrations !== null && shareIntegrations !== void 0 && shareIntegrations.length) {
|
|
353
|
-
button =
|
|
369
|
+
button = jsx(SplitButton, {
|
|
354
370
|
shareButton: button,
|
|
355
371
|
handleOpenSplitButton: this.handleOpenSplitButton,
|
|
356
372
|
handleCloseSplitButton: this.handleCloseSplitButton,
|
|
@@ -432,14 +448,15 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
|
|
|
432
448
|
} : undefined;
|
|
433
449
|
const footer = resolveShareFooter(integrationMode, this.state.tabIndex, customFooter); // for performance purposes, we may want to have a loadable content i.e. ShareForm
|
|
434
450
|
|
|
435
|
-
return
|
|
451
|
+
return jsx("div", {
|
|
452
|
+
css: shareButtonWrapperStyles,
|
|
436
453
|
tabIndex: tabIndex,
|
|
437
454
|
onKeyDown: this.handleKeyDown,
|
|
438
455
|
style: style
|
|
439
|
-
},
|
|
440
|
-
content: () =>
|
|
456
|
+
}, jsx(Popup, {
|
|
457
|
+
content: () => jsx("div", {
|
|
441
458
|
ref: this.containerRef
|
|
442
|
-
},
|
|
459
|
+
}, jsx(LazyShareFormLazy, {
|
|
443
460
|
Content: selectedIntegration && selectedIntegration.Content,
|
|
444
461
|
selectedIntegration: selectedIntegration,
|
|
445
462
|
copyLink: copyLink,
|
|
@@ -455,6 +472,7 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
|
|
|
455
472
|
defaultValue: defaultValue,
|
|
456
473
|
config: config,
|
|
457
474
|
isFetchingConfig: isFetchingConfig,
|
|
475
|
+
setIsLoading: this.setIsLoading,
|
|
458
476
|
submitButtonLabel: submitButtonLabel,
|
|
459
477
|
product: product,
|
|
460
478
|
enableSmartUserPicker: enableSmartUserPicker,
|
|
@@ -481,9 +499,9 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
|
|
|
481
499
|
placement: dialogPlacement,
|
|
482
500
|
trigger: this.renderShareTriggerButton,
|
|
483
501
|
zIndex: dialogZIndex
|
|
484
|
-
}),
|
|
502
|
+
}), jsx(Portal, {
|
|
485
503
|
zIndex: generateSelectZIndex(dialogZIndex)
|
|
486
|
-
},
|
|
504
|
+
}, jsx("div", {
|
|
487
505
|
ref: this.selectPortalRef
|
|
488
506
|
})));
|
|
489
507
|
}
|