@atlaskit/link-picker 0.8.1 → 0.11.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.
- package/CHANGELOG.md +18 -0
- package/dist/cjs/ui/link-picker.js +62 -40
- package/dist/cjs/ui/{LinkSearchList.js → link-search-list/index.js} +15 -25
- package/dist/cjs/ui/link-search-list/styled.js +21 -0
- package/dist/cjs/ui/{LinkSearchListItem.js → list-item/index.js} +26 -24
- package/dist/cjs/ui/list-item/styled.js +59 -0
- package/dist/cjs/ui/styled.js +32 -0
- package/dist/cjs/ui/{PanelTextInput.js → text-input/index.js} +14 -17
- package/dist/cjs/ui/text-input/styled.js +25 -0
- package/dist/cjs/utils.js +1 -14
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/ui/link-picker.js +26 -14
- package/dist/es2019/ui/{LinkSearchList.js → link-search-list/index.js} +14 -19
- package/dist/es2019/ui/link-search-list/styled.js +13 -0
- package/dist/es2019/ui/list-item/index.js +88 -0
- package/dist/es2019/ui/list-item/styled.js +65 -0
- package/dist/es2019/ui/styled.js +28 -0
- package/dist/es2019/ui/{PanelTextInput.js → text-input/index.js} +15 -9
- package/dist/es2019/ui/text-input/styled.js +15 -0
- package/dist/es2019/utils.js +0 -11
- package/dist/es2019/version.json +1 -1
- package/dist/esm/ui/link-picker.js +49 -27
- package/dist/esm/ui/{LinkSearchList.js → link-search-list/index.js} +14 -13
- package/dist/esm/ui/link-search-list/styled.js +8 -0
- package/dist/esm/ui/{LinkSearchListItem.js → list-item/index.js} +25 -23
- package/dist/esm/ui/list-item/styled.js +37 -0
- package/dist/esm/ui/styled.js +16 -0
- package/dist/esm/ui/{PanelTextInput.js → text-input/index.js} +15 -9
- package/dist/esm/ui/text-input/styled.js +10 -0
- package/dist/esm/utils.js +0 -11
- package/dist/esm/version.json +1 -1
- package/dist/types/types.d.ts +6 -3
- package/dist/types/ui/{LinkSearchList.d.ts → link-search-list/index.d.ts} +4 -4
- package/dist/types/ui/link-search-list/styled.d.ts +3 -0
- package/dist/types/ui/{LinkSearchListItem.d.ts → list-item/index.d.ts} +1 -1
- package/dist/types/ui/list-item/styled.d.ts +7 -0
- package/dist/types/ui/styled.d.ts +4 -0
- package/dist/types/ui/{PanelTextInput.d.ts → text-input/index.d.ts} +2 -2
- package/dist/types/ui/text-input/styled.d.ts +2 -0
- package/dist/types/utils.d.ts +0 -1
- package/example-helpers/mock-data.ts +4 -0
- package/package.json +6 -5
- package/dist/cjs/styles.js +0 -90
- package/dist/es2019/styles.js +0 -93
- package/dist/es2019/ui/LinkSearchListItem.js +0 -88
- package/dist/esm/styles.js +0 -46
- package/dist/types/styles.d.ts +0 -18
|
@@ -3,22 +3,17 @@ import _createClass from "@babel/runtime/helpers/createClass";
|
|
|
3
3
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
4
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
-
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
7
|
-
|
|
8
|
-
var _templateObject, _templateObject2, _templateObject3;
|
|
9
6
|
|
|
10
7
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
11
8
|
|
|
12
9
|
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; } }
|
|
13
10
|
|
|
14
|
-
|
|
11
|
+
/** @jsx jsx */
|
|
15
12
|
import { PureComponent } from 'react';
|
|
13
|
+
import { jsx } from '@emotion/react';
|
|
16
14
|
import Spinner from '@atlaskit/spinner';
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
var ListContainer = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding-top: 0;\n"])));
|
|
20
|
-
var SpinnerContainer = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n text-align: center;\n min-height: 80px;\n margin-top: 30px;\n"])));
|
|
21
|
-
export var List = styled.ul(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n padding: 0;\n list-style: none;\n"])));
|
|
15
|
+
import LinkSearchListItem from '../list-item';
|
|
16
|
+
import { listContainerStyles, spinnerContainerStyles, listStyles } from './styled';
|
|
22
17
|
|
|
23
18
|
var LinkSearchList = /*#__PURE__*/function (_PureComponent) {
|
|
24
19
|
_inherits(LinkSearchList, _PureComponent);
|
|
@@ -50,13 +45,15 @@ var LinkSearchList = /*#__PURE__*/function (_PureComponent) {
|
|
|
50
45
|
var loadingContent;
|
|
51
46
|
|
|
52
47
|
if (items && items.length > 0) {
|
|
53
|
-
itemsContent =
|
|
48
|
+
itemsContent = jsx("ul", {
|
|
49
|
+
"data-testid": "link-search-list",
|
|
50
|
+
css: listStyles,
|
|
54
51
|
id: id,
|
|
55
52
|
role: role,
|
|
56
53
|
"aria-controls": ariaControls,
|
|
57
54
|
"aria-labelledby": ariaLabelledBy
|
|
58
55
|
}, items.map(function (item, index) {
|
|
59
|
-
return
|
|
56
|
+
return jsx(LinkSearchListItem, {
|
|
60
57
|
id: "link-search-list-item-".concat(index),
|
|
61
58
|
role: role && 'option',
|
|
62
59
|
item: item,
|
|
@@ -71,13 +68,17 @@ var LinkSearchList = /*#__PURE__*/function (_PureComponent) {
|
|
|
71
68
|
}
|
|
72
69
|
|
|
73
70
|
if (isLoading) {
|
|
74
|
-
loadingContent =
|
|
71
|
+
loadingContent = jsx("div", {
|
|
72
|
+
css: spinnerContainerStyles
|
|
73
|
+
}, jsx(Spinner, {
|
|
75
74
|
testId: "link-picker.results-loading-indicator",
|
|
76
75
|
size: "medium"
|
|
77
76
|
}));
|
|
78
77
|
}
|
|
79
78
|
|
|
80
|
-
return
|
|
79
|
+
return jsx("div", {
|
|
80
|
+
css: listContainerStyles
|
|
81
|
+
}, itemsContent, loadingContent);
|
|
81
82
|
}
|
|
82
83
|
}]);
|
|
83
84
|
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
|
|
3
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
4
|
+
|
|
5
|
+
import { css } from '@emotion/react';
|
|
6
|
+
export var listContainerStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding-top: 0;\n"])));
|
|
7
|
+
export var spinnerContainerStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n text-align: center;\n min-height: 80px;\n margin-top: 30px;\n"])));
|
|
8
|
+
export var listStyles = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n padding: 0;\n list-style: none;\n"])));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { Fragment } from 'react';
|
|
3
|
-
import { jsx } from '@emotion/
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
4
4
|
import { injectIntl } from 'react-intl-next';
|
|
5
|
-
import { transformTimeStamp } from '
|
|
6
|
-
import {
|
|
5
|
+
import { transformTimeStamp } from '../../transformTimeStamp';
|
|
6
|
+
import { itemNameStyles, itemIconStyles, listItemContextStyles, listItemNameStyles, composeListItemStyles, imgStyles } from './styled';
|
|
7
7
|
|
|
8
8
|
var LinkSearchListItem = function LinkSearchListItem(_ref) {
|
|
9
9
|
var item = _ref.item,
|
|
@@ -28,37 +28,35 @@ var LinkSearchListItem = function LinkSearchListItem(_ref) {
|
|
|
28
28
|
return onMouseLeave(item.objectId);
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
var container = item.container || null;
|
|
32
|
+
var date = transformTimeStamp(intl, item.lastViewedDate, item.lastUpdatedDate);
|
|
33
|
+
return jsx("div", {
|
|
34
|
+
css: composeListItemStyles(active, selected),
|
|
32
35
|
role: role,
|
|
33
36
|
id: id,
|
|
34
37
|
"aria-selected": selected,
|
|
35
38
|
"data-testid": "link-search-list-item",
|
|
36
|
-
selected: selected,
|
|
37
|
-
active: active,
|
|
38
39
|
onMouseEnter: handleMouseEnter,
|
|
39
40
|
onMouseLeave: handleMouseLeave,
|
|
40
41
|
onClick: handleSelect
|
|
41
42
|
}, jsx(ListItemIcon, {
|
|
42
43
|
item: item,
|
|
43
44
|
intl: intl
|
|
44
|
-
}), jsx(
|
|
45
|
-
|
|
46
|
-
}
|
|
45
|
+
}), jsx("div", {
|
|
46
|
+
css: itemNameStyles
|
|
47
|
+
}, jsx("div", {
|
|
48
|
+
"data-testid": "link-search-list-item-title",
|
|
49
|
+
css: listItemNameStyles
|
|
50
|
+
}, item.name), jsx("div", {
|
|
51
|
+
"data-testid": "link-search-list-item-subtitle",
|
|
52
|
+
css: listItemContextStyles
|
|
53
|
+
}, container, container && date && jsx(Fragment, null, "\xA0 \u2022\xA0 "), date && jsx(Fragment, null, formatDate(date)))));
|
|
47
54
|
};
|
|
48
55
|
|
|
49
56
|
export default injectIntl(LinkSearchListItem);
|
|
50
57
|
|
|
51
|
-
var
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if (!date) {
|
|
55
|
-
return null;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return jsx(Fragment, null, "\xA0 \u2022", jsx("span", {
|
|
59
|
-
className: "link-search-timestamp",
|
|
60
|
-
"data-test-id": "link-search-timestamp"
|
|
61
|
-
}, "\xA0 ", date.pageAction, " ", date.dateString, " ", date.timeSince || ''));
|
|
58
|
+
var formatDate = function formatDate(date) {
|
|
59
|
+
return [date.pageAction, date.dateString, date.timeSince].filter(Boolean).join(' ');
|
|
62
60
|
};
|
|
63
61
|
|
|
64
62
|
var ListItemIcon = function ListItemIcon(props) {
|
|
@@ -75,14 +73,18 @@ var ListItemIcon = function ListItemIcon(props) {
|
|
|
75
73
|
|
|
76
74
|
if (typeof icon !== 'string') {
|
|
77
75
|
var Glyph = icon;
|
|
78
|
-
return jsx(
|
|
76
|
+
return jsx("span", {
|
|
77
|
+
css: itemIconStyles
|
|
78
|
+
}, jsx(Glyph, {
|
|
79
79
|
alt: alt
|
|
80
80
|
}));
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
return jsx(
|
|
83
|
+
return jsx("span", {
|
|
84
|
+
css: itemIconStyles
|
|
85
|
+
}, jsx("img", {
|
|
84
86
|
src: icon,
|
|
85
87
|
alt: alt,
|
|
86
|
-
css:
|
|
88
|
+
css: imgStyles
|
|
87
89
|
}));
|
|
88
90
|
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
|
|
3
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
|
|
4
|
+
|
|
5
|
+
import { token } from '@atlaskit/tokens';
|
|
6
|
+
import { css } from '@emotion/react';
|
|
7
|
+
import { B50, N300, N800, N20, B400 } from '@atlaskit/theme/colors';
|
|
8
|
+
import { gridSize } from '@atlaskit/theme/constants'; // AFP-2532 TODO: Fix automatic suppressions below
|
|
9
|
+
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
10
|
+
|
|
11
|
+
import { fontSizeSmall, fontSize } from '@atlaskit/theme';
|
|
12
|
+
export var relativeFontSizeToBase16 = function relativeFontSizeToBase16(px) {
|
|
13
|
+
if (typeof px === 'string') {
|
|
14
|
+
px = parseInt(px);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (isNaN(px)) {
|
|
18
|
+
throw new Error("Invalid font size: '".concat(px, "'"));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return "".concat(px / 16, "rem");
|
|
22
|
+
};
|
|
23
|
+
var listItemBaseStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n padding: ", "px ", "px;\n margin: 0 -", "px;\n cursor: pointer;\n"])), gridSize(), gridSize() * 2, gridSize() * 2);
|
|
24
|
+
var listItemBoxShadow = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n box-shadow: inset 2px 0px 0px ", ";\n"])), token('color.border.selected', B400));
|
|
25
|
+
var listItemActive = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n background-color: ", ";\n"])), token('color.background.neutral.subtle.hovered', N20));
|
|
26
|
+
var listItemSelected = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n background-color: ", ";\n"])), token('color.background.selected', B50));
|
|
27
|
+
export var composeListItemStyles = function composeListItemStyles() {
|
|
28
|
+
var active = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
29
|
+
var selected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
30
|
+
var hasShadow = active || selected;
|
|
31
|
+
return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n ", ";\n ", ";\n ", ";\n ", ";\n "])), listItemBaseStyles, active && listItemActive, selected && listItemSelected, hasShadow && listItemBoxShadow);
|
|
32
|
+
};
|
|
33
|
+
export var itemNameStyles = css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n overflow: hidden;\n"])));
|
|
34
|
+
export var listItemNameStyles = css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n color: ", ";\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n line-height: 20px;\n"])), token('color.text', N800));
|
|
35
|
+
export var listItemContextStyles = css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n color: ", ";\n font-size: ", ";\n line-height: ", "px;\n"])), token('color.text', N300), relativeFontSizeToBase16(fontSizeSmall()), fontSize());
|
|
36
|
+
export var itemIconStyles = css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n min-width: ", "px;\n margin-top: 3px;\n margin-right: 12px;\n"])), gridSize() * 2);
|
|
37
|
+
export var imgStyles = css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n max-width: ", "px;\n"])), gridSize() * 2);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
|
|
3
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
4
|
+
|
|
5
|
+
import { token } from '@atlaskit/tokens';
|
|
6
|
+
import { css } from '@emotion/react';
|
|
7
|
+
import { N500 } from '@atlaskit/theme/colors'; // AFP-2532 TODO: Fix automatic suppressions below
|
|
8
|
+
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
9
|
+
|
|
10
|
+
import { typography } from '@atlaskit/theme';
|
|
11
|
+
import { gridSize } from '@atlaskit/theme/constants';
|
|
12
|
+
var LINK_PICKER_WIDTH_IN_PX = 342;
|
|
13
|
+
export var recentListStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: ", "px;\n"])), LINK_PICKER_WIDTH_IN_PX);
|
|
14
|
+
export var containerStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding: ", "px;\n width: 100%;\n overflow: hidden;\n line-height: initial;\n box-sizing: border-box;\n"])), gridSize() * 2);
|
|
15
|
+
export var searchIconStyles = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin-left: ", "px;\n color: ", ";\n cursor: default;\n"])), gridSize() / 2, token('color.icon', N500));
|
|
16
|
+
export var listTitleStyles = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n ", "\n text-transform: uppercase;\n margin-bottom: ", "px;\n"])), typography.h100(), gridSize() / 2);
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["name", "label", "autoFocus", "onSubmit", "onRedo", "onUndo", "onChange", "onKeyDown", "onClear", "clearLabel", "error"];
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
/** @jsx jsx */
|
|
6
|
+
import { useCallback, useRef, Fragment } from 'react';
|
|
7
|
+
import { jsx } from '@emotion/react';
|
|
5
8
|
import { ErrorMessage, Field } from '@atlaskit/form';
|
|
6
9
|
import Tooltip from '@atlaskit/tooltip';
|
|
7
10
|
import Textfield from '@atlaskit/textfield';
|
|
8
11
|
import Selectclear from '@atlaskit/icon/glyph/select-clear';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
12
|
+
import { isRedoEvent, isUndoEvent } from '../../utils';
|
|
13
|
+
import { clearTextButtonStyles, fieldStyles } from './styled';
|
|
11
14
|
|
|
12
15
|
var PanelTextInput = function PanelTextInput(props) {
|
|
13
16
|
var name = props.name,
|
|
@@ -64,27 +67,30 @@ var PanelTextInput = function PanelTextInput(props) {
|
|
|
64
67
|
onClear();
|
|
65
68
|
}
|
|
66
69
|
}, [onClear]);
|
|
67
|
-
var clearText = restProps.value !== '' &&
|
|
70
|
+
var clearText = restProps.value !== '' && jsx(Tooltip, {
|
|
68
71
|
content: clearLabel
|
|
69
|
-
},
|
|
72
|
+
}, jsx("button", {
|
|
73
|
+
css: clearTextButtonStyles,
|
|
70
74
|
onClick: handleClear,
|
|
71
75
|
"data-testid": "clear-text"
|
|
72
|
-
},
|
|
76
|
+
}, jsx(Selectclear, {
|
|
73
77
|
size: "medium",
|
|
74
78
|
label: clearLabel || ''
|
|
75
79
|
})));
|
|
76
|
-
return
|
|
80
|
+
return jsx("div", {
|
|
81
|
+
css: fieldStyles
|
|
82
|
+
}, jsx(Field, {
|
|
77
83
|
label: label,
|
|
78
84
|
name: name
|
|
79
85
|
}, function (_ref) {
|
|
80
86
|
var fieldProps = _ref.fieldProps;
|
|
81
|
-
return
|
|
87
|
+
return jsx(Fragment, null, jsx(Textfield, _extends({}, fieldProps, restProps, {
|
|
82
88
|
onKeyDown: handleKeydown,
|
|
83
89
|
onChange: handleChange,
|
|
84
90
|
ref: handleRef,
|
|
85
91
|
elemAfterInput: clearText,
|
|
86
92
|
isInvalid: !!error
|
|
87
|
-
})), error &&
|
|
93
|
+
})), error && jsx(ErrorMessage, {
|
|
88
94
|
testId: "link-error"
|
|
89
95
|
}, error));
|
|
90
96
|
}));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
|
|
3
|
+
var _templateObject, _templateObject2;
|
|
4
|
+
|
|
5
|
+
import { token } from '@atlaskit/tokens';
|
|
6
|
+
import { css } from '@emotion/react';
|
|
7
|
+
import { N500 } from '@atlaskit/theme/colors';
|
|
8
|
+
import { gridSize } from '@atlaskit/theme/constants';
|
|
9
|
+
export var clearTextButtonStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 0;\n margin-right: ", "px;\n color: ", ";\n background: transparent;\n border: none;\n cursor: pointer;\n"])), gridSize() / 2, token('color.icon.subtle', N500));
|
|
10
|
+
export var fieldStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin-bottom: ", "px;\n"])), gridSize() * 2);
|
package/dist/esm/utils.js
CHANGED
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
import { browser } from './browser';
|
|
2
|
-
export var relativeFontSizeToBase16 = function relativeFontSizeToBase16(px) {
|
|
3
|
-
if (typeof px === 'string') {
|
|
4
|
-
px = parseInt(px);
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
if (isNaN(px)) {
|
|
8
|
-
throw new Error("Invalid font size: '".concat(px, "'"));
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
return "".concat(px / 16, "rem");
|
|
12
|
-
};
|
|
13
2
|
var KeyZCode = 90;
|
|
14
3
|
var KeyYCode = 89;
|
|
15
4
|
export var isUndoEvent = function isUndoEvent(e) {
|
package/dist/esm/version.json
CHANGED
package/dist/types/types.d.ts
CHANGED
|
@@ -8,14 +8,14 @@ export interface LinkSearchListItemData {
|
|
|
8
8
|
name: string;
|
|
9
9
|
/** URL of the resource being linked to */
|
|
10
10
|
url: string;
|
|
11
|
-
/** Context to display in link result */
|
|
12
|
-
container: string;
|
|
13
11
|
/** Icon to display in link result */
|
|
14
12
|
icon: string | React.ComponentType<{
|
|
15
13
|
alt: string;
|
|
16
14
|
}>;
|
|
17
15
|
/** Alt text describing the icon */
|
|
18
16
|
iconAlt: string | MessageDescriptor;
|
|
17
|
+
/** Context to display in link result */
|
|
18
|
+
container?: string;
|
|
19
19
|
/** Optional last view date to display in link result */
|
|
20
20
|
lastViewedDate?: Date;
|
|
21
21
|
/** Optional last updated date to display in link result */
|
|
@@ -32,6 +32,9 @@ export interface LinkPickerState {
|
|
|
32
32
|
/** Current query string / URL input field value */
|
|
33
33
|
query: string;
|
|
34
34
|
}
|
|
35
|
+
export interface ResolveResult {
|
|
36
|
+
data: LinkSearchListItemData[];
|
|
37
|
+
}
|
|
35
38
|
export interface LinkPickerPlugin {
|
|
36
|
-
resolve: (state: LinkPickerState) => AsyncGenerator<
|
|
39
|
+
resolve: (state: LinkPickerState) => Promise<ResolveResult> | AsyncGenerator<ResolveResult, ResolveResult>;
|
|
37
40
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
/** @jsx jsx */
|
|
2
2
|
import { PureComponent } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
4
|
+
import { LinkSearchListItemData } from '../../types';
|
|
5
5
|
export interface Props {
|
|
6
6
|
items?: LinkSearchListItemData[];
|
|
7
7
|
isLoading: boolean;
|
|
@@ -16,5 +16,5 @@ export interface Props {
|
|
|
16
16
|
id?: string;
|
|
17
17
|
}
|
|
18
18
|
export default class LinkSearchList extends PureComponent<Props, {}> {
|
|
19
|
-
render(): JSX.Element;
|
|
19
|
+
render(): jsx.JSX.Element;
|
|
20
20
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { WrappedComponentProps } from 'react-intl-next';
|
|
3
|
-
import { LinkSearchListItemData } from '
|
|
3
|
+
import { LinkSearchListItemData } from '../../types';
|
|
4
4
|
export interface Props {
|
|
5
5
|
item: LinkSearchListItemData;
|
|
6
6
|
selected: boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const relativeFontSizeToBase16: (px: number | string) => string;
|
|
2
|
+
export declare const composeListItemStyles: (active?: boolean, selected?: boolean) => import("@emotion/react").SerializedStyles;
|
|
3
|
+
export declare const itemNameStyles: import("@emotion/react").SerializedStyles;
|
|
4
|
+
export declare const listItemNameStyles: import("@emotion/react").SerializedStyles;
|
|
5
|
+
export declare const listItemContextStyles: import("@emotion/react").SerializedStyles;
|
|
6
|
+
export declare const itemIconStyles: import("@emotion/react").SerializedStyles;
|
|
7
|
+
export declare const imgStyles: import("@emotion/react").SerializedStyles;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const recentListStyles: import("@emotion/react").SerializedStyles;
|
|
2
|
+
export declare const containerStyles: import("@emotion/react").SerializedStyles;
|
|
3
|
+
export declare const searchIconStyles: import("@emotion/react").SerializedStyles;
|
|
4
|
+
export declare const listTitleStyles: import("@emotion/react").SerializedStyles;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { jsx } from '@emotion/react';
|
|
2
2
|
import { TextFieldProps } from '@atlaskit/textfield';
|
|
3
3
|
export interface Props extends Omit<TextFieldProps, 'value' | 'onChange' | 'autoFocus' | 'onSubmit'> {
|
|
4
4
|
name: string;
|
|
@@ -13,5 +13,5 @@ export interface Props extends Omit<TextFieldProps, 'value' | 'onChange' | 'auto
|
|
|
13
13
|
clearLabel?: string;
|
|
14
14
|
error?: string | null;
|
|
15
15
|
}
|
|
16
|
-
declare const PanelTextInput: (props: Props) => JSX.Element;
|
|
16
|
+
declare const PanelTextInput: (props: Props) => jsx.JSX.Element;
|
|
17
17
|
export default PanelTextInput;
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { KeyboardEvent } from 'react';
|
|
2
|
-
export declare const relativeFontSizeToBase16: (px: number | string) => string;
|
|
3
2
|
export declare const isUndoEvent: (e: KeyboardEvent<HTMLInputElement>) => boolean;
|
|
4
3
|
export declare const isRedoEvent: (e: KeyboardEvent<HTMLInputElement>) => boolean;
|
|
@@ -33,6 +33,8 @@ const MOCK_DATA_V3: MockDataV3 = {
|
|
|
33
33
|
'ari:cloud:townsquare:a5a01d21-1cc3-4f29-9565-f2bb8cd969f5:project/cae6f0ae-bd95-439a-835f-d93907a63f23',
|
|
34
34
|
type: 'project',
|
|
35
35
|
product: 'townsquare',
|
|
36
|
+
rootContainerId:
|
|
37
|
+
'ari:cloud:platform::site/9a257bbc-b7c6-47c8-b1dc-c3db3dc8914b',
|
|
36
38
|
contributors: [
|
|
37
39
|
{
|
|
38
40
|
profile: {
|
|
@@ -178,6 +180,8 @@ const MOCK_DATA_V3: MockDataV3 = {
|
|
|
178
180
|
'ari:cloud:townsquare:a3a01d21-1cc3-4f29-9565-f2bb8cd969f5:project/cae6f0ae-bd95-439a-835f-d93907a63f53',
|
|
179
181
|
type: 'project',
|
|
180
182
|
product: 'townsquare',
|
|
183
|
+
rootContainerId:
|
|
184
|
+
'ari:cloud:platform::site/9a257bbc-b7c6-47c8-b1dc-c3db3dc8914b',
|
|
181
185
|
contributors: [
|
|
182
186
|
{
|
|
183
187
|
profile: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/link-picker",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Standalone link picker",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"publishConfig": {
|
|
@@ -36,14 +36,13 @@
|
|
|
36
36
|
"@atlaskit/tooltip": "^17.5.0",
|
|
37
37
|
"@atlaskit/visually-hidden": "^1.0.0",
|
|
38
38
|
"@babel/runtime": "^7.0.0",
|
|
39
|
-
"@emotion/
|
|
39
|
+
"@emotion/react": "^11.7.1",
|
|
40
40
|
"date-fns": "^2.17.0",
|
|
41
41
|
"linkify-it": "^2.0.3"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"react": "^16.8.0",
|
|
45
|
-
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
46
|
-
"styled-components": "^3.2.6"
|
|
45
|
+
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
47
46
|
},
|
|
48
47
|
"devDependencies": {
|
|
49
48
|
"@atlaskit/activity-provider": "^2.3.2",
|
|
@@ -56,11 +55,13 @@
|
|
|
56
55
|
"@atlaskit/visual-regression": "*",
|
|
57
56
|
"@atlaskit/webdriver-runner": "*",
|
|
58
57
|
"@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
|
|
59
|
-
"@atlassian/link-picker-atlassian-plugin": "^
|
|
58
|
+
"@atlassian/link-picker-atlassian-plugin": "^9.0.0",
|
|
60
59
|
"@atlassian/search-provider": "^2.3.0",
|
|
60
|
+
"@testing-library/dom": "^7.7.3",
|
|
61
61
|
"@testing-library/react": "^8.0.1",
|
|
62
62
|
"enzyme": "^3.10.0",
|
|
63
63
|
"fetch-mock": "^8.0.0",
|
|
64
|
+
"mockdate": "^3.0.2",
|
|
64
65
|
"react-dom": "^16.8.0",
|
|
65
66
|
"sinon": "^2.2.0",
|
|
66
67
|
"typescript": "4.2.4"
|
package/dist/cjs/styles.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.recentListStyles = exports.SearchIconWrapper = exports.ListTitleStyles = exports.ListItemWrapper = exports.ListItemName = exports.ListItemContext = exports.ItemNameWrapper = exports.ItemIconWrapper = exports.ImgStyles = exports.FieldWrapper = exports.Container = exports.ClearText = void 0;
|
|
9
|
-
|
|
10
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
11
|
-
|
|
12
|
-
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
13
|
-
|
|
14
|
-
var _tokens = require("@atlaskit/tokens");
|
|
15
|
-
|
|
16
|
-
var _core = require("@emotion/core");
|
|
17
|
-
|
|
18
|
-
var _colors = require("@atlaskit/theme/colors");
|
|
19
|
-
|
|
20
|
-
var _constants = require("@atlaskit/theme/constants");
|
|
21
|
-
|
|
22
|
-
var _utils = require("./utils");
|
|
23
|
-
|
|
24
|
-
var _theme = require("@atlaskit/theme");
|
|
25
|
-
|
|
26
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12;
|
|
27
|
-
|
|
28
|
-
var LINK_PICKER_WIDTH_IN_PX = 342;
|
|
29
|
-
var recentListStyles = (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: ", "px;\n"])), LINK_PICKER_WIDTH_IN_PX);
|
|
30
|
-
exports.recentListStyles = recentListStyles;
|
|
31
|
-
|
|
32
|
-
var Container = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n padding: ", "px;\n width: 100%;\n overflow: hidden;\n line-height: initial;\n box-sizing: border-box;\n"])), (0, _constants.gridSize)() * 2);
|
|
33
|
-
|
|
34
|
-
exports.Container = Container;
|
|
35
|
-
|
|
36
|
-
var ClearText = _styledComponents.default.button(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n padding: 0;\n margin-right: ", "px;\n color: ", ";\n background: transparent;\n border: none;\n cursor: pointer;\n"])), (0, _constants.gridSize)() / 2, (0, _tokens.token)('color.icon.subtle', _colors.N500));
|
|
37
|
-
|
|
38
|
-
exports.ClearText = ClearText;
|
|
39
|
-
|
|
40
|
-
var FieldWrapper = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n margin-bottom: ", "px;\n"])), (0, _constants.gridSize)() * 2);
|
|
41
|
-
|
|
42
|
-
exports.FieldWrapper = FieldWrapper;
|
|
43
|
-
|
|
44
|
-
var SearchIconWrapper = _styledComponents.default.span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n margin-left: ", "px;\n color: ", ";\n cursor: default;\n"])), (0, _constants.gridSize)() / 2, (0, _tokens.token)('color.icon', _colors.N500));
|
|
45
|
-
|
|
46
|
-
exports.SearchIconWrapper = SearchIconWrapper;
|
|
47
|
-
var ListTitleStyles = (0, _core.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n text-transform: uppercase;\n margin-bottom: ", "px;\n"])), _theme.typography.h100(), (0, _constants.gridSize)() / 2);
|
|
48
|
-
exports.ListTitleStyles = ListTitleStyles;
|
|
49
|
-
|
|
50
|
-
var ListItemWrapper = _styledComponents.default.li(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n padding: ", "px ", "px;\n margin: 0 -", "px;\n cursor: pointer;\n background-color: ", ";\n box-shadow: inset 2px 0px 0px\n ", ";\n"])), (0, _constants.gridSize)(), (0, _constants.gridSize)() * 2, (0, _constants.gridSize)() * 2, function (props) {
|
|
51
|
-
switch (true) {
|
|
52
|
-
case props.selected:
|
|
53
|
-
return (0, _tokens.token)('color.background.selected', _colors.B50);
|
|
54
|
-
|
|
55
|
-
case props.active:
|
|
56
|
-
return (0, _tokens.token)('color.background.neutral.subtle.hovered', _colors.N20);
|
|
57
|
-
|
|
58
|
-
default:
|
|
59
|
-
return 'transparent';
|
|
60
|
-
}
|
|
61
|
-
}, function (props) {
|
|
62
|
-
switch (true) {
|
|
63
|
-
case props.active:
|
|
64
|
-
case props.selected:
|
|
65
|
-
return (0, _tokens.token)('color.border.selected', _colors.B400);
|
|
66
|
-
|
|
67
|
-
default:
|
|
68
|
-
return 'transparent';
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
exports.ListItemWrapper = ListItemWrapper;
|
|
73
|
-
|
|
74
|
-
var ItemNameWrapper = _styledComponents.default.span(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)(["\n overflow: hidden;\n"])));
|
|
75
|
-
|
|
76
|
-
exports.ItemNameWrapper = ItemNameWrapper;
|
|
77
|
-
|
|
78
|
-
var ListItemName = _styledComponents.default.div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n line-height: 20px;\n"])), (0, _tokens.token)('color.text', _colors.N800));
|
|
79
|
-
|
|
80
|
-
exports.ListItemName = ListItemName;
|
|
81
|
-
|
|
82
|
-
var ListItemContext = _styledComponents.default.div(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n font-size: ", ";\n line-height: ", "px;\n"])), (0, _tokens.token)('color.text', _colors.N300), (0, _utils.relativeFontSizeToBase16)((0, _theme.fontSizeSmall)()), (0, _theme.fontSize)());
|
|
83
|
-
|
|
84
|
-
exports.ListItemContext = ListItemContext;
|
|
85
|
-
|
|
86
|
-
var ItemIconWrapper = _styledComponents.default.span(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2.default)(["\n min-width: ", "px;\n margin-top: 3px;\n margin-right: 12px;\n"])), (0, _constants.gridSize)() * 2);
|
|
87
|
-
|
|
88
|
-
exports.ItemIconWrapper = ItemIconWrapper;
|
|
89
|
-
var ImgStyles = (0, _core.css)(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2.default)(["\n max-width: ", "px;\n"])), (0, _constants.gridSize)() * 2);
|
|
90
|
-
exports.ImgStyles = ImgStyles;
|