@atlaskit/smart-card 21.0.3 → 21.1.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 +18 -0
- package/dist/cjs/utils/token.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/BlockCard/components/Frame.js +1 -1
- package/dist/cjs/view/EmbedCard/components/styled.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/block/index.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/index.js +13 -4
- package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +4 -2
- package/dist/es2019/utils/token.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/BlockCard/components/Frame.js +1 -1
- package/dist/es2019/view/EmbedCard/components/styled.js +1 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/block/index.js +2 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/index.js +12 -2
- package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +11 -0
- package/dist/esm/utils/token.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/BlockCard/components/Frame.js +1 -1
- package/dist/esm/view/EmbedCard/components/styled.js +1 -1
- package/dist/esm/view/FlexibleCard/components/blocks/block/index.js +2 -2
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/index.js +13 -5
- package/dist/esm/view/FlexibleCard/components/blocks/utils.js +2 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/utils/token.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/blocks/title-block/types.d.ts +6 -1
- package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +3 -0
- package/dist/types/view/FlexibleCard/components/blocks/utils.d.ts +1 -0
- package/package.json +2 -2
- package/report.api.md +9 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 21.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`e6a3654a137`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e6a3654a137) - Fix bug where smart cards used `elevation.surface` instead of `elevation.surface.raised` design tokens for card backgrounds.
|
|
8
|
+
|
|
9
|
+
## 21.1.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`fa7f42de6c0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/fa7f42de6c0) - Flexible UI: Add onActionMenuOpenChange on TitleBlock to detect action dropdown menu open/close
|
|
14
|
+
|
|
15
|
+
## 21.0.4
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [`4347099f4ba`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4347099f4ba) - [ux] Blue highlight is removed for when a user right-clicks on a Flex UI Smart Link
|
|
20
|
+
|
|
3
21
|
## 21.0.3
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/cjs/utils/token.js
CHANGED
|
@@ -9,7 +9,7 @@ var _tokens = require("@atlaskit/tokens");
|
|
|
9
9
|
|
|
10
10
|
var tokens = {
|
|
11
11
|
actionIcon: (0, _tokens.token)('color.icon', '#44546F'),
|
|
12
|
-
background: (0, _tokens.token)('elevation.surface', '#FFFFFF'),
|
|
12
|
+
background: (0, _tokens.token)('elevation.surface.raised', '#FFFFFF'),
|
|
13
13
|
badgeIcon: (0, _tokens.token)('color.icon.subtle', '#626F86'),
|
|
14
14
|
badgeText: (0, _tokens.token)('color.text.subtlest', '#626F86'),
|
|
15
15
|
blackLink: (0, _tokens.token)('color.text.subtle', '#44546F'),
|
package/dist/cjs/version.json
CHANGED
|
@@ -37,7 +37,7 @@ var sharedFrameStyles = {
|
|
|
37
37
|
maxWidth: (0, _utils.gs)(95),
|
|
38
38
|
width: '100%',
|
|
39
39
|
display: 'flex',
|
|
40
|
-
backgroundColor: (0, _tokens.token)('elevation.surface', 'white')
|
|
40
|
+
backgroundColor: (0, _tokens.token)('elevation.surface.raised', 'white')
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
var ExpandedFrame = function ExpandedFrame(_ref) {
|
|
@@ -144,7 +144,7 @@ exports.TextWrapper = TextWrapper;
|
|
|
144
144
|
// NB: `overflow` is kept as `hidden` since
|
|
145
145
|
// the internal contents of the `iframe` should
|
|
146
146
|
// manage scrolling behaviour.
|
|
147
|
-
var Content = _styled.default.div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n ", "\n background-color: ", ";\n position: absolute;\n z-index: 1;\n width: 100%;\n top: ", ";\n overflow: hidden;\n height: calc(100% - ", ");\n transition: box-shadow 0.3s;\n\n > .calc-height > div > div {\n left: unset !important;\n width: unset !important;\n height: unset !important;\n position: initial !important;\n padding-bottom: unset !important;\n }\n > .embed-preview > div {\n margin: 0 auto;\n }\n\n ", ";\n"])), borderRadius, cardShadow, (0, _tokens.token)('elevation.surface', 'white'), (0, _utils.gs)(4), (0, _utils.gs)(4), function (_ref9) {
|
|
147
|
+
var Content = _styled.default.div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n ", "\n background-color: ", ";\n position: absolute;\n z-index: 1;\n width: 100%;\n top: ", ";\n overflow: hidden;\n height: calc(100% - ", ");\n transition: box-shadow 0.3s;\n\n > .calc-height > div > div {\n left: unset !important;\n width: unset !important;\n height: unset !important;\n position: initial !important;\n padding-bottom: unset !important;\n }\n > .embed-preview > div {\n margin: 0 auto;\n }\n\n ", ";\n"])), borderRadius, cardShadow, (0, _tokens.token)('elevation.surface.raised', 'white'), (0, _utils.gs)(4), (0, _utils.gs)(4), function (_ref9) {
|
|
148
148
|
var isInteractive = _ref9.isInteractive;
|
|
149
149
|
|
|
150
150
|
if (isInteractive) {
|
|
@@ -20,7 +20,7 @@ var _utils = require("../utils");
|
|
|
20
20
|
var _templateObject;
|
|
21
21
|
|
|
22
22
|
var getBlockStyles = function getBlockStyles(direction, size) {
|
|
23
|
-
return (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n ", "\n justify-content: flex-start;\n [data-separator] + [data-separator]:before {\n content: '\u2022';\n margin-right: ", "rem;\n }\n // Pull request elements: source branch \u2192 target branch\n [data-smart-element='", "']\n + [data-smart-element='", "']:before {\n content: '\u2192';\n }\n // Pull request elements: target branch \u2190 source branch\n [data-smart-element='", "']\n + [data-smart-element='", "']:before {\n content: '\u2190';\n }\n"])), (0, _utils.getBaseStyles)(direction, size), (0, _utils.getGapSize)(size), _constants.ElementName.SourceBranch, _constants.ElementName.TargetBranch, _constants.ElementName.TargetBranch, _constants.ElementName.SourceBranch);
|
|
23
|
+
return (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n ", "\n ", "\n justify-content: flex-start;\n [data-separator] + [data-separator]:before {\n content: '\u2022';\n margin-right: ", "rem;\n }\n // Pull request elements: source branch \u2192 target branch\n [data-smart-element='", "']\n + [data-smart-element='", "']:before {\n content: '\u2192';\n }\n // Pull request elements: target branch \u2190 source branch\n [data-smart-element='", "']\n + [data-smart-element='", "']:before {\n content: '\u2190';\n }\n"])), (0, _utils.getBaseStyles)(direction, size), _utils.highlightRemoveStyles, (0, _utils.getGapSize)(size), _constants.ElementName.SourceBranch, _constants.ElementName.TargetBranch, _constants.ElementName.TargetBranch, _constants.ElementName.SourceBranch);
|
|
24
24
|
};
|
|
25
25
|
/**
|
|
26
26
|
* A block represents a collection of elements and actions that are arranged
|
|
@@ -33,7 +33,7 @@ var _actionGroup = _interopRequireDefault(require("../action-group"));
|
|
|
33
33
|
|
|
34
34
|
var _elements = require("../../elements");
|
|
35
35
|
|
|
36
|
-
var _excluded = ["actions", "anchorTarget", "hideTitleTooltip", "maxLines", "onClick", "overrideCss", "status", "showActionOnHover", "testId", "text", "theme"];
|
|
36
|
+
var _excluded = ["actions", "anchorTarget", "hideTitleTooltip", "maxLines", "onActionMenuOpenChange", "onClick", "overrideCss", "status", "showActionOnHover", "testId", "text", "theme"];
|
|
37
37
|
|
|
38
38
|
var _templateObject, _templateObject2;
|
|
39
39
|
|
|
@@ -85,6 +85,7 @@ var TitleBlock = function TitleBlock(_ref) {
|
|
|
85
85
|
anchorTarget = _ref.anchorTarget,
|
|
86
86
|
hideTitleTooltip = _ref.hideTitleTooltip,
|
|
87
87
|
maxLines = _ref.maxLines,
|
|
88
|
+
onActionMenuOpenChange = _ref.onActionMenuOpenChange,
|
|
88
89
|
onClick = _ref.onClick,
|
|
89
90
|
overrideCss = _ref.overrideCss,
|
|
90
91
|
_ref$status = _ref.status,
|
|
@@ -101,12 +102,20 @@ var TitleBlock = function TitleBlock(_ref) {
|
|
|
101
102
|
actionDropdownOpen = _useState2[0],
|
|
102
103
|
setActionDropdownOpen = _useState2[1];
|
|
103
104
|
|
|
105
|
+
var onDropdownOpenChange = (0, _react.useCallback)(function (isOpen) {
|
|
106
|
+
setActionDropdownOpen(isOpen);
|
|
107
|
+
|
|
108
|
+
if (onActionMenuOpenChange) {
|
|
109
|
+
onActionMenuOpenChange({
|
|
110
|
+
isOpen: isOpen
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}, [onActionMenuOpenChange]);
|
|
114
|
+
|
|
104
115
|
var actionGroup = actions.length > 0 && /*#__PURE__*/_react.default.createElement(_actionGroup.default, {
|
|
105
116
|
items: actions,
|
|
106
117
|
visibleButtonsNum: showActionOnHover ? 1 : 2,
|
|
107
|
-
onDropdownOpenChange:
|
|
108
|
-
return setActionDropdownOpen(isOpen);
|
|
109
|
-
}
|
|
118
|
+
onDropdownOpenChange: onDropdownOpenChange
|
|
110
119
|
});
|
|
111
120
|
|
|
112
121
|
var actionStyles = getActionStyles(showActionOnHover, actionDropdownOpen);
|
|
@@ -7,7 +7,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
-
exports.renderElementItems = exports.renderChildren = exports.renderActionItems = exports.getGapSize = exports.getBaseStyles = exports.ElementDisplaySchema = void 0;
|
|
10
|
+
exports.renderElementItems = exports.renderChildren = exports.renderActionItems = exports.highlightRemoveStyles = exports.getGapSize = exports.getBaseStyles = exports.ElementDisplaySchema = void 0;
|
|
11
11
|
|
|
12
12
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
13
|
|
|
@@ -38,7 +38,7 @@ var _elementGroup = _interopRequireDefault(require("./element-group"));
|
|
|
38
38
|
var _excluded = ["name"],
|
|
39
39
|
_excluded2 = ["name", "hideContent", "hideIcon", "onClick"];
|
|
40
40
|
|
|
41
|
-
var _ElementDisplaySchema, _templateObject, _templateObject2, _templateObject3;
|
|
41
|
+
var _ElementDisplaySchema, _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
42
42
|
|
|
43
43
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
44
44
|
|
|
@@ -86,6 +86,8 @@ var getBaseStyles = function getBaseStyles(direction, size) {
|
|
|
86
86
|
};
|
|
87
87
|
|
|
88
88
|
exports.getBaseStyles = getBaseStyles;
|
|
89
|
+
var highlightRemoveStyles = (0, _core.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n outline: none !important;\n outline-color: inherit;\n color: inherit;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n"])));
|
|
90
|
+
exports.highlightRemoveStyles = highlightRemoveStyles;
|
|
89
91
|
|
|
90
92
|
var isActionGroup = function isActionGroup(node) {
|
|
91
93
|
return /*#__PURE__*/_react.default.isValidElement(node) && node.type === _actionGroup.default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { token } from '@atlaskit/tokens';
|
|
2
2
|
export const tokens = {
|
|
3
3
|
actionIcon: token('color.icon', '#44546F'),
|
|
4
|
-
background: token('elevation.surface', '#FFFFFF'),
|
|
4
|
+
background: token('elevation.surface.raised', '#FFFFFF'),
|
|
5
5
|
badgeIcon: token('color.icon.subtle', '#626F86'),
|
|
6
6
|
badgeText: token('color.text.subtlest', '#626F86'),
|
|
7
7
|
blackLink: token('color.text.subtle', '#44546F'),
|
package/dist/es2019/version.json
CHANGED
|
@@ -191,7 +191,7 @@ export const TextWrapper = styled.div`
|
|
|
191
191
|
export const Content = styled.div`
|
|
192
192
|
${borderRadius}
|
|
193
193
|
${cardShadow}
|
|
194
|
-
background-color: ${token('elevation.surface', 'white')};
|
|
194
|
+
background-color: ${token('elevation.surface.raised', 'white')};
|
|
195
195
|
position: absolute;
|
|
196
196
|
z-index: 1;
|
|
197
197
|
width: 100%;
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { css, jsx } from '@emotion/core';
|
|
4
4
|
import { ElementName, SmartLinkDirection, SmartLinkSize } from '../../../../../constants';
|
|
5
|
-
import { getBaseStyles, getGapSize, renderChildren } from '../utils';
|
|
5
|
+
import { getBaseStyles, getGapSize, highlightRemoveStyles, renderChildren } from '../utils';
|
|
6
6
|
|
|
7
7
|
const getBlockStyles = (direction, size) => css`
|
|
8
8
|
${getBaseStyles(direction, size)}
|
|
9
|
+
${highlightRemoveStyles}
|
|
9
10
|
justify-content: flex-start;
|
|
10
11
|
[data-separator] + [data-separator]:before {
|
|
11
12
|
content: '•';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React, { useState } from 'react';
|
|
2
|
+
import React, { useCallback, useState } from 'react';
|
|
3
3
|
import { css } from '@emotion/core';
|
|
4
4
|
import { SmartLinkStatus } from '../../../../../constants';
|
|
5
5
|
import TitleBlockResolvedView from './resolved';
|
|
@@ -60,6 +60,7 @@ const TitleBlock = ({
|
|
|
60
60
|
anchorTarget,
|
|
61
61
|
hideTitleTooltip,
|
|
62
62
|
maxLines,
|
|
63
|
+
onActionMenuOpenChange,
|
|
63
64
|
onClick,
|
|
64
65
|
overrideCss,
|
|
65
66
|
status = SmartLinkStatus.Fallback,
|
|
@@ -70,10 +71,19 @@ const TitleBlock = ({
|
|
|
70
71
|
...props
|
|
71
72
|
}) => {
|
|
72
73
|
const [actionDropdownOpen, setActionDropdownOpen] = useState(false);
|
|
74
|
+
const onDropdownOpenChange = useCallback(isOpen => {
|
|
75
|
+
setActionDropdownOpen(isOpen);
|
|
76
|
+
|
|
77
|
+
if (onActionMenuOpenChange) {
|
|
78
|
+
onActionMenuOpenChange({
|
|
79
|
+
isOpen
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}, [onActionMenuOpenChange]);
|
|
73
83
|
const actionGroup = actions.length > 0 && /*#__PURE__*/React.createElement(ActionGroup, {
|
|
74
84
|
items: actions,
|
|
75
85
|
visibleButtonsNum: showActionOnHover ? 1 : 2,
|
|
76
|
-
onDropdownOpenChange:
|
|
86
|
+
onDropdownOpenChange: onDropdownOpenChange
|
|
77
87
|
});
|
|
78
88
|
const actionStyles = getActionStyles(showActionOnHover, actionDropdownOpen);
|
|
79
89
|
const combinedCss = css`
|
|
@@ -84,6 +84,17 @@ export const getBaseStyles = (direction, size) => css`
|
|
|
84
84
|
min-width: fit-content;
|
|
85
85
|
}
|
|
86
86
|
`;
|
|
87
|
+
export const highlightRemoveStyles = css`
|
|
88
|
+
outline: none !important;
|
|
89
|
+
outline-color: inherit;
|
|
90
|
+
color: inherit;
|
|
91
|
+
-webkit-tap-highlight-color: transparent;
|
|
92
|
+
-webkit-touch-callout: none;
|
|
93
|
+
-webkit-user-select: none;
|
|
94
|
+
-moz-user-select: none;
|
|
95
|
+
-ms-user-select: none;
|
|
96
|
+
user-select: none;
|
|
97
|
+
`;
|
|
87
98
|
|
|
88
99
|
const isActionGroup = node => /*#__PURE__*/React.isValidElement(node) && node.type === ActionGroup;
|
|
89
100
|
|
package/dist/esm/utils/token.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { token } from '@atlaskit/tokens';
|
|
2
2
|
export var tokens = {
|
|
3
3
|
actionIcon: token('color.icon', '#44546F'),
|
|
4
|
-
background: token('elevation.surface', '#FFFFFF'),
|
|
4
|
+
background: token('elevation.surface.raised', '#FFFFFF'),
|
|
5
5
|
badgeIcon: token('color.icon.subtle', '#626F86'),
|
|
6
6
|
badgeText: token('color.text.subtlest', '#626F86'),
|
|
7
7
|
blackLink: token('color.text.subtle', '#44546F'),
|
package/dist/esm/version.json
CHANGED
|
@@ -22,7 +22,7 @@ var sharedFrameStyles = {
|
|
|
22
22
|
maxWidth: gs(95),
|
|
23
23
|
width: '100%',
|
|
24
24
|
display: 'flex',
|
|
25
|
-
backgroundColor: token('elevation.surface', 'white')
|
|
25
|
+
backgroundColor: token('elevation.surface.raised', 'white')
|
|
26
26
|
};
|
|
27
27
|
export var ExpandedFrame = function ExpandedFrame(_ref) {
|
|
28
28
|
var children = _ref.children,
|
|
@@ -99,7 +99,7 @@ export var TextWrapper = styled.div(_templateObject5 || (_templateObject5 = _tag
|
|
|
99
99
|
// NB: `overflow` is kept as `hidden` since
|
|
100
100
|
// the internal contents of the `iframe` should
|
|
101
101
|
// manage scrolling behaviour.
|
|
102
|
-
export var Content = styled.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n ", "\n ", "\n background-color: ", ";\n position: absolute;\n z-index: 1;\n width: 100%;\n top: ", ";\n overflow: hidden;\n height: calc(100% - ", ");\n transition: box-shadow 0.3s;\n\n > .calc-height > div > div {\n left: unset !important;\n width: unset !important;\n height: unset !important;\n position: initial !important;\n padding-bottom: unset !important;\n }\n > .embed-preview > div {\n margin: 0 auto;\n }\n\n ", ";\n"])), borderRadius, cardShadow, token('elevation.surface', 'white'), gridSize(4), gridSize(4), function (_ref9) {
|
|
102
|
+
export var Content = styled.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n ", "\n ", "\n background-color: ", ";\n position: absolute;\n z-index: 1;\n width: 100%;\n top: ", ";\n overflow: hidden;\n height: calc(100% - ", ");\n transition: box-shadow 0.3s;\n\n > .calc-height > div > div {\n left: unset !important;\n width: unset !important;\n height: unset !important;\n position: initial !important;\n padding-bottom: unset !important;\n }\n > .embed-preview > div {\n margin: 0 auto;\n }\n\n ", ";\n"])), borderRadius, cardShadow, token('elevation.surface.raised', 'white'), gridSize(4), gridSize(4), function (_ref9) {
|
|
103
103
|
var isInteractive = _ref9.isInteractive;
|
|
104
104
|
|
|
105
105
|
if (isInteractive) {
|
|
@@ -6,10 +6,10 @@ var _templateObject;
|
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import { css, jsx } from '@emotion/core';
|
|
8
8
|
import { ElementName, SmartLinkDirection, SmartLinkSize } from '../../../../../constants';
|
|
9
|
-
import { getBaseStyles, getGapSize, renderChildren } from '../utils';
|
|
9
|
+
import { getBaseStyles, getGapSize, highlightRemoveStyles, renderChildren } from '../utils';
|
|
10
10
|
|
|
11
11
|
var getBlockStyles = function getBlockStyles(direction, size) {
|
|
12
|
-
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n justify-content: flex-start;\n [data-separator] + [data-separator]:before {\n content: '\u2022';\n margin-right: ", "rem;\n }\n // Pull request elements: source branch \u2192 target branch\n [data-smart-element='", "']\n + [data-smart-element='", "']:before {\n content: '\u2192';\n }\n // Pull request elements: target branch \u2190 source branch\n [data-smart-element='", "']\n + [data-smart-element='", "']:before {\n content: '\u2190';\n }\n"])), getBaseStyles(direction, size), getGapSize(size), ElementName.SourceBranch, ElementName.TargetBranch, ElementName.TargetBranch, ElementName.SourceBranch);
|
|
12
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n ", "\n justify-content: flex-start;\n [data-separator] + [data-separator]:before {\n content: '\u2022';\n margin-right: ", "rem;\n }\n // Pull request elements: source branch \u2192 target branch\n [data-smart-element='", "']\n + [data-smart-element='", "']:before {\n content: '\u2192';\n }\n // Pull request elements: target branch \u2190 source branch\n [data-smart-element='", "']\n + [data-smart-element='", "']:before {\n content: '\u2190';\n }\n"])), getBaseStyles(direction, size), highlightRemoveStyles, getGapSize(size), ElementName.SourceBranch, ElementName.TargetBranch, ElementName.TargetBranch, ElementName.SourceBranch);
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
15
|
* A block represents a collection of elements and actions that are arranged
|
|
@@ -2,11 +2,11 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
4
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
5
|
-
var _excluded = ["actions", "anchorTarget", "hideTitleTooltip", "maxLines", "onClick", "overrideCss", "status", "showActionOnHover", "testId", "text", "theme"];
|
|
5
|
+
var _excluded = ["actions", "anchorTarget", "hideTitleTooltip", "maxLines", "onActionMenuOpenChange", "onClick", "overrideCss", "status", "showActionOnHover", "testId", "text", "theme"];
|
|
6
6
|
|
|
7
7
|
var _templateObject, _templateObject2;
|
|
8
8
|
|
|
9
|
-
import React, { useState } from 'react';
|
|
9
|
+
import React, { useCallback, useState } from 'react';
|
|
10
10
|
import { css } from '@emotion/core';
|
|
11
11
|
import { SmartLinkStatus } from '../../../../../constants';
|
|
12
12
|
import TitleBlockResolvedView from './resolved';
|
|
@@ -59,6 +59,7 @@ var TitleBlock = function TitleBlock(_ref) {
|
|
|
59
59
|
anchorTarget = _ref.anchorTarget,
|
|
60
60
|
hideTitleTooltip = _ref.hideTitleTooltip,
|
|
61
61
|
maxLines = _ref.maxLines,
|
|
62
|
+
onActionMenuOpenChange = _ref.onActionMenuOpenChange,
|
|
62
63
|
onClick = _ref.onClick,
|
|
63
64
|
overrideCss = _ref.overrideCss,
|
|
64
65
|
_ref$status = _ref.status,
|
|
@@ -75,12 +76,19 @@ var TitleBlock = function TitleBlock(_ref) {
|
|
|
75
76
|
actionDropdownOpen = _useState2[0],
|
|
76
77
|
setActionDropdownOpen = _useState2[1];
|
|
77
78
|
|
|
79
|
+
var onDropdownOpenChange = useCallback(function (isOpen) {
|
|
80
|
+
setActionDropdownOpen(isOpen);
|
|
81
|
+
|
|
82
|
+
if (onActionMenuOpenChange) {
|
|
83
|
+
onActionMenuOpenChange({
|
|
84
|
+
isOpen: isOpen
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}, [onActionMenuOpenChange]);
|
|
78
88
|
var actionGroup = actions.length > 0 && /*#__PURE__*/React.createElement(ActionGroup, {
|
|
79
89
|
items: actions,
|
|
80
90
|
visibleButtonsNum: showActionOnHover ? 1 : 2,
|
|
81
|
-
onDropdownOpenChange:
|
|
82
|
-
return setActionDropdownOpen(isOpen);
|
|
83
|
-
}
|
|
91
|
+
onDropdownOpenChange: onDropdownOpenChange
|
|
84
92
|
});
|
|
85
93
|
var actionStyles = getActionStyles(showActionOnHover, actionDropdownOpen);
|
|
86
94
|
var combinedCss = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", " ", "\n "])), actionStyles, overrideCss);
|
|
@@ -6,7 +6,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
6
6
|
var _excluded = ["name"],
|
|
7
7
|
_excluded2 = ["name", "hideContent", "hideIcon", "onClick"];
|
|
8
8
|
|
|
9
|
-
var _ElementDisplaySchema, _templateObject, _templateObject2, _templateObject3;
|
|
9
|
+
var _ElementDisplaySchema, _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
10
10
|
|
|
11
11
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
12
12
|
|
|
@@ -52,6 +52,7 @@ export var getGapSize = function getGapSize(size) {
|
|
|
52
52
|
export var getBaseStyles = function getBaseStyles(direction, size) {
|
|
53
53
|
return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n align-items: center;\n display: flex;\n gap: ", "rem;\n line-height: 1rem;\n min-width: 0;\n overflow: hidden;\n ", ";\n &:empty {\n display: none;\n }\n & > * {\n min-width: 0;\n }\n & > [data-fit-to-content] {\n min-width: fit-content;\n }\n"])), getGapSize(size), getDirectionStyles(direction));
|
|
54
54
|
};
|
|
55
|
+
export var highlightRemoveStyles = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n outline: none !important;\n outline-color: inherit;\n color: inherit;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n"])));
|
|
55
56
|
|
|
56
57
|
var isActionGroup = function isActionGroup(node) {
|
|
57
58
|
return /*#__PURE__*/React.isValidElement(node) && node.type === ActionGroup;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -18,5 +18,5 @@ export { contentFooterClassName, metadataListClassName, blockCardResolvingViewCl
|
|
|
18
18
|
export { loadingPlaceholderClassName } from './view/CardWithUrl/component-lazy/LazyFallback';
|
|
19
19
|
export { ActionName, ElementName, SmartLinkDirection, SmartLinkPosition, SmartLinkSize, SmartLinkTheme, } from './constants';
|
|
20
20
|
export { MetadataBlock, PreviewBlock, SnippetBlock, TitleBlock, FooterBlock, } from './view/FlexibleCard/components/blocks';
|
|
21
|
-
export type { ActionItem, ElementItem, } from './view/FlexibleCard/components/blocks/types';
|
|
21
|
+
export type { ActionItem, ElementItem, OnActionMenuOpenChangeOptions, } from './view/FlexibleCard/components/blocks/types';
|
|
22
22
|
export type { AnalyticsAction, AnalyticsActionSubject, AnalyticsPayload, AnalyticsHandler, } from './utils/types';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ActionItem, BlockProps, ElementItem } from '../types';
|
|
2
|
+
import { ActionItem, BlockProps, ElementItem, OnActionMenuOpenChangeOptions } from '../types';
|
|
3
3
|
import { SmartLinkPosition, SmartLinkTheme } from '../../../../../constants';
|
|
4
4
|
import { RetryOptions } from '../../../types';
|
|
5
5
|
import { AnchorTarget } from '../../types';
|
|
@@ -34,6 +34,11 @@ export declare type TitleBlockProps = {
|
|
|
34
34
|
* @see ElementItem
|
|
35
35
|
*/
|
|
36
36
|
metadata?: ElementItem[];
|
|
37
|
+
/**
|
|
38
|
+
* Called when the action dropdown menu (if present) is open/closed.
|
|
39
|
+
* Receives an object with `isOpen` state.
|
|
40
|
+
*/
|
|
41
|
+
onActionMenuOpenChange?: (options: OnActionMenuOpenChangeOptions) => void;
|
|
37
42
|
/**
|
|
38
43
|
* Determines the position of the link icon in relative to the vertical
|
|
39
44
|
* height of the TitleBlock. It can either be centred or placed on “top”.
|
|
@@ -100,6 +100,9 @@ export declare type CustomActionItem = BaseActionItem & {
|
|
|
100
100
|
name: ActionName.CustomAction;
|
|
101
101
|
} & ((Required<Pick<ActionProps, 'icon' | 'iconPosition'>> & Pick<ActionProps, 'content'>) | ((Required<Pick<ActionProps, 'content'>> & Pick<ActionProps, 'icon' | 'iconPosition'>) & Pick<ActionProps, 'tooltipMessage'>));
|
|
102
102
|
export declare type ActionItem = NamedActionItem | CustomActionItem;
|
|
103
|
+
export declare type OnActionMenuOpenChangeOptions = {
|
|
104
|
+
isOpen: boolean;
|
|
105
|
+
};
|
|
103
106
|
/**
|
|
104
107
|
* A type that contains all the possible combinations of elements with their corresponding props.
|
|
105
108
|
*/
|
|
@@ -7,6 +7,7 @@ export declare type ElementDisplaySchemaType = 'inline' | 'block';
|
|
|
7
7
|
export declare const ElementDisplaySchema: Record<ElementName, ElementDisplaySchemaType[]>;
|
|
8
8
|
export declare const getGapSize: (size: SmartLinkSize) => number;
|
|
9
9
|
export declare const getBaseStyles: (direction: SmartLinkDirection, size: SmartLinkSize) => SerializedStyles;
|
|
10
|
+
export declare const highlightRemoveStyles: SerializedStyles;
|
|
10
11
|
export declare const renderChildren: (children: React.ReactNode, size: SmartLinkSize) => React.ReactNode;
|
|
11
12
|
export declare const renderElementItems: (items?: ElementItem[], display?: ElementDisplaySchemaType) => React.ReactNode | undefined;
|
|
12
13
|
export declare const renderActionItems: (items?: ActionItem[], size?: SmartLinkSize, appearance?: Appearance | undefined, asDropDownItems?: boolean | undefined, onActionItemClick?: (() => void) | undefined) => React.ReactNode | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "21.
|
|
3
|
+
"version": "21.1.1",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"@atlaskit/radio": "^5.3.0",
|
|
80
80
|
"@atlaskit/range": "^6.0.0",
|
|
81
81
|
"@atlaskit/section-message": "^6.1.5",
|
|
82
|
-
"@atlaskit/select": "^15.
|
|
82
|
+
"@atlaskit/select": "^15.6.0",
|
|
83
83
|
"@atlaskit/table-tree": "^9.1.0",
|
|
84
84
|
"@atlaskit/tabs": "^13.2.10",
|
|
85
85
|
"@atlaskit/textarea": "^4.3.0",
|
package/report.api.md
CHANGED
|
@@ -641,6 +641,10 @@ declare type NamedActionItem = BaseActionItem & {
|
|
|
641
641
|
name: Exclude<ActionName, ActionName.CustomAction>;
|
|
642
642
|
};
|
|
643
643
|
|
|
644
|
+
export declare type OnActionMenuOpenChangeOptions = {
|
|
645
|
+
isOpen: boolean;
|
|
646
|
+
};
|
|
647
|
+
|
|
644
648
|
declare type OnErrorCallback = (data: {
|
|
645
649
|
status: Extract<CardType, ErrorCardType>;
|
|
646
650
|
url: string;
|
|
@@ -911,6 +915,11 @@ declare type TitleBlockProps = {
|
|
|
911
915
|
* @see ElementItem
|
|
912
916
|
*/
|
|
913
917
|
metadata?: ElementItem[];
|
|
918
|
+
/**
|
|
919
|
+
* Called when the action dropdown menu (if present) is open/closed.
|
|
920
|
+
* Receives an object with `isOpen` state.
|
|
921
|
+
*/
|
|
922
|
+
onActionMenuOpenChange?: (options: OnActionMenuOpenChangeOptions) => void;
|
|
914
923
|
/**
|
|
915
924
|
* Determines the position of the link icon in relative to the vertical
|
|
916
925
|
* height of the TitleBlock. It can either be centred or placed on “top”.
|