@atlaskit/link-picker 0.11.0 → 1.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/example-helpers/mock-data.ts +0 -2
- package/package.json +7 -4
- package/report.api.md +65 -0
- package/dist/cjs/browser.js +0 -39
- package/dist/cjs/index.js +0 -13
- package/dist/cjs/messages.js +0 -102
- package/dist/cjs/transformTimeStamp.js +0 -55
- package/dist/cjs/types.js +0 -5
- package/dist/cjs/ui/announcer.js +0 -64
- package/dist/cjs/ui/link-picker.js +0 -604
- package/dist/cjs/ui/link-search-list/index.js +0 -102
- package/dist/cjs/ui/link-search-list/styled.js +0 -21
- package/dist/cjs/ui/list-item/index.js +0 -103
- package/dist/cjs/ui/list-item/styled.js +0 -59
- package/dist/cjs/ui/styled.js +0 -32
- package/dist/cjs/ui/text-input/index.js +0 -116
- package/dist/cjs/ui/text-input/styled.js +0 -25
- package/dist/cjs/url.js +0 -104
- package/dist/cjs/utils.js +0 -27
- package/dist/cjs/version.json +0 -5
- package/dist/es2019/browser.js +0 -34
- package/dist/es2019/index.js +0 -1
- package/dist/es2019/messages.js +0 -93
- package/dist/es2019/transformTimeStamp.js +0 -41
- package/dist/es2019/types.js +0 -1
- package/dist/es2019/ui/announcer.js +0 -38
- package/dist/es2019/ui/link-picker.js +0 -493
- package/dist/es2019/ui/link-search-list/index.js +0 -60
- package/dist/es2019/ui/link-search-list/styled.js +0 -13
- package/dist/es2019/ui/list-item/index.js +0 -88
- package/dist/es2019/ui/list-item/styled.js +0 -65
- package/dist/es2019/ui/styled.js +0 -28
- package/dist/es2019/ui/text-input/index.js +0 -99
- package/dist/es2019/ui/text-input/styled.js +0 -15
- package/dist/es2019/url.js +0 -88
- package/dist/es2019/utils.js +0 -13
- package/dist/es2019/version.json +0 -5
- package/dist/esm/browser.js +0 -34
- package/dist/esm/index.js +0 -1
- package/dist/esm/messages.js +0 -93
- package/dist/esm/transformTimeStamp.js +0 -41
- package/dist/esm/types.js +0 -1
- package/dist/esm/ui/announcer.js +0 -51
- package/dist/esm/ui/link-picker.js +0 -582
- package/dist/esm/ui/link-search-list/index.js +0 -88
- package/dist/esm/ui/link-search-list/styled.js +0 -8
- package/dist/esm/ui/list-item/index.js +0 -90
- package/dist/esm/ui/list-item/styled.js +0 -37
- package/dist/esm/ui/styled.js +0 -16
- package/dist/esm/ui/text-input/index.js +0 -99
- package/dist/esm/ui/text-input/styled.js +0 -10
- package/dist/esm/url.js +0 -90
- package/dist/esm/utils.js +0 -13
- package/dist/esm/version.json +0 -5
- package/dist/types/browser.d.ts +0 -15
- package/dist/types/index.d.ts +0 -3
- package/dist/types/messages.d.ts +0 -92
- package/dist/types/transformTimeStamp.d.ts +0 -3
- package/dist/types/types.d.ts +0 -40
- package/dist/types/ui/announcer.d.ts +0 -22
- package/dist/types/ui/link-picker.d.ts +0 -51
- package/dist/types/ui/link-search-list/index.d.ts +0 -20
- package/dist/types/ui/link-search-list/styled.d.ts +0 -3
- package/dist/types/ui/list-item/index.d.ts +0 -17
- package/dist/types/ui/list-item/styled.d.ts +0 -7
- package/dist/types/ui/styled.d.ts +0 -4
- package/dist/types/ui/text-input/index.d.ts +0 -17
- package/dist/types/ui/text-input/styled.d.ts +0 -2
- package/dist/types/url.d.ts +0 -5
- package/dist/types/utils.d.ts +0 -3
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
4
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
-
|
|
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); }; }
|
|
8
|
-
|
|
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; } }
|
|
10
|
-
|
|
11
|
-
/** @jsx jsx */
|
|
12
|
-
import { PureComponent } from 'react';
|
|
13
|
-
import { jsx } from '@emotion/react';
|
|
14
|
-
import Spinner from '@atlaskit/spinner';
|
|
15
|
-
import LinkSearchListItem from '../list-item';
|
|
16
|
-
import { listContainerStyles, spinnerContainerStyles, listStyles } from './styled';
|
|
17
|
-
|
|
18
|
-
var LinkSearchList = /*#__PURE__*/function (_PureComponent) {
|
|
19
|
-
_inherits(LinkSearchList, _PureComponent);
|
|
20
|
-
|
|
21
|
-
var _super = _createSuper(LinkSearchList);
|
|
22
|
-
|
|
23
|
-
function LinkSearchList() {
|
|
24
|
-
_classCallCheck(this, LinkSearchList);
|
|
25
|
-
|
|
26
|
-
return _super.apply(this, arguments);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
_createClass(LinkSearchList, [{
|
|
30
|
-
key: "render",
|
|
31
|
-
value: function render() {
|
|
32
|
-
var _this$props = this.props,
|
|
33
|
-
onSelect = _this$props.onSelect,
|
|
34
|
-
onMouseEnter = _this$props.onMouseEnter,
|
|
35
|
-
onMouseLeave = _this$props.onMouseLeave,
|
|
36
|
-
items = _this$props.items,
|
|
37
|
-
activeIndex = _this$props.activeIndex,
|
|
38
|
-
selectedIndex = _this$props.selectedIndex,
|
|
39
|
-
isLoading = _this$props.isLoading,
|
|
40
|
-
ariaControls = _this$props.ariaControls,
|
|
41
|
-
ariaLabelledBy = _this$props.ariaLabelledBy,
|
|
42
|
-
role = _this$props.role,
|
|
43
|
-
id = _this$props.id;
|
|
44
|
-
var itemsContent;
|
|
45
|
-
var loadingContent;
|
|
46
|
-
|
|
47
|
-
if (items && items.length > 0) {
|
|
48
|
-
itemsContent = jsx("ul", {
|
|
49
|
-
"data-testid": "link-search-list",
|
|
50
|
-
css: listStyles,
|
|
51
|
-
id: id,
|
|
52
|
-
role: role,
|
|
53
|
-
"aria-controls": ariaControls,
|
|
54
|
-
"aria-labelledby": ariaLabelledBy
|
|
55
|
-
}, items.map(function (item, index) {
|
|
56
|
-
return jsx(LinkSearchListItem, {
|
|
57
|
-
id: "link-search-list-item-".concat(index),
|
|
58
|
-
role: role && 'option',
|
|
59
|
-
item: item,
|
|
60
|
-
selected: selectedIndex === index,
|
|
61
|
-
active: activeIndex === index,
|
|
62
|
-
onMouseEnter: onMouseEnter,
|
|
63
|
-
onMouseLeave: onMouseLeave,
|
|
64
|
-
onSelect: onSelect,
|
|
65
|
-
key: item.objectId
|
|
66
|
-
});
|
|
67
|
-
}));
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if (isLoading) {
|
|
71
|
-
loadingContent = jsx("div", {
|
|
72
|
-
css: spinnerContainerStyles
|
|
73
|
-
}, jsx(Spinner, {
|
|
74
|
-
testId: "link-picker.results-loading-indicator",
|
|
75
|
-
size: "medium"
|
|
76
|
-
}));
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return jsx("div", {
|
|
80
|
-
css: listContainerStyles
|
|
81
|
-
}, itemsContent, loadingContent);
|
|
82
|
-
}
|
|
83
|
-
}]);
|
|
84
|
-
|
|
85
|
-
return LinkSearchList;
|
|
86
|
-
}(PureComponent);
|
|
87
|
-
|
|
88
|
-
export { LinkSearchList as default };
|
|
@@ -1,8 +0,0 @@
|
|
|
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,90 +0,0 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
|
-
import { Fragment } from 'react';
|
|
3
|
-
import { jsx } from '@emotion/react';
|
|
4
|
-
import { injectIntl } from 'react-intl-next';
|
|
5
|
-
import { transformTimeStamp } from '../../transformTimeStamp';
|
|
6
|
-
import { itemNameStyles, itemIconStyles, listItemContextStyles, listItemNameStyles, composeListItemStyles, imgStyles } from './styled';
|
|
7
|
-
|
|
8
|
-
var LinkSearchListItem = function LinkSearchListItem(_ref) {
|
|
9
|
-
var item = _ref.item,
|
|
10
|
-
selected = _ref.selected,
|
|
11
|
-
active = _ref.active,
|
|
12
|
-
id = _ref.id,
|
|
13
|
-
role = _ref.role,
|
|
14
|
-
intl = _ref.intl,
|
|
15
|
-
onSelect = _ref.onSelect,
|
|
16
|
-
onMouseEnter = _ref.onMouseEnter,
|
|
17
|
-
onMouseLeave = _ref.onMouseLeave;
|
|
18
|
-
|
|
19
|
-
var handleSelect = function handleSelect() {
|
|
20
|
-
return onSelect(item.objectId);
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
var handleMouseEnter = function handleMouseEnter() {
|
|
24
|
-
return onMouseEnter(item.objectId);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
var handleMouseLeave = function handleMouseLeave() {
|
|
28
|
-
return onMouseLeave(item.objectId);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
var container = item.container || null;
|
|
32
|
-
var date = transformTimeStamp(intl, item.lastViewedDate, item.lastUpdatedDate);
|
|
33
|
-
return jsx("div", {
|
|
34
|
-
css: composeListItemStyles(active, selected),
|
|
35
|
-
role: role,
|
|
36
|
-
id: id,
|
|
37
|
-
"aria-selected": selected,
|
|
38
|
-
"data-testid": "link-search-list-item",
|
|
39
|
-
onMouseEnter: handleMouseEnter,
|
|
40
|
-
onMouseLeave: handleMouseLeave,
|
|
41
|
-
onClick: handleSelect
|
|
42
|
-
}, jsx(ListItemIcon, {
|
|
43
|
-
item: item,
|
|
44
|
-
intl: intl
|
|
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)))));
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export default injectIntl(LinkSearchListItem);
|
|
57
|
-
|
|
58
|
-
var formatDate = function formatDate(date) {
|
|
59
|
-
return [date.pageAction, date.dateString, date.timeSince].filter(Boolean).join(' ');
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
var ListItemIcon = function ListItemIcon(props) {
|
|
63
|
-
var item = props.item,
|
|
64
|
-
intl = props.intl;
|
|
65
|
-
var icon = item.icon,
|
|
66
|
-
iconAlt = item.iconAlt;
|
|
67
|
-
|
|
68
|
-
if (!icon) {
|
|
69
|
-
return null;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
var alt = typeof iconAlt === 'string' ? iconAlt : intl.formatMessage(iconAlt);
|
|
73
|
-
|
|
74
|
-
if (typeof icon !== 'string') {
|
|
75
|
-
var Glyph = icon;
|
|
76
|
-
return jsx("span", {
|
|
77
|
-
css: itemIconStyles
|
|
78
|
-
}, jsx(Glyph, {
|
|
79
|
-
alt: alt
|
|
80
|
-
}));
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return jsx("span", {
|
|
84
|
-
css: itemIconStyles
|
|
85
|
-
}, jsx("img", {
|
|
86
|
-
src: icon,
|
|
87
|
-
alt: alt,
|
|
88
|
-
css: imgStyles
|
|
89
|
-
}));
|
|
90
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
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);
|
package/dist/esm/ui/styled.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
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,99 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["name", "label", "autoFocus", "onSubmit", "onRedo", "onUndo", "onChange", "onKeyDown", "onClear", "clearLabel", "error"];
|
|
4
|
-
|
|
5
|
-
/** @jsx jsx */
|
|
6
|
-
import { useCallback, useRef, Fragment } from 'react';
|
|
7
|
-
import { jsx } from '@emotion/react';
|
|
8
|
-
import { ErrorMessage, Field } from '@atlaskit/form';
|
|
9
|
-
import Tooltip from '@atlaskit/tooltip';
|
|
10
|
-
import Textfield from '@atlaskit/textfield';
|
|
11
|
-
import Selectclear from '@atlaskit/icon/glyph/select-clear';
|
|
12
|
-
import { isRedoEvent, isUndoEvent } from '../../utils';
|
|
13
|
-
import { clearTextButtonStyles, fieldStyles } from './styled';
|
|
14
|
-
|
|
15
|
-
var PanelTextInput = function PanelTextInput(props) {
|
|
16
|
-
var name = props.name,
|
|
17
|
-
label = props.label,
|
|
18
|
-
autoFocus = props.autoFocus,
|
|
19
|
-
onSubmit = props.onSubmit,
|
|
20
|
-
onRedo = props.onRedo,
|
|
21
|
-
onUndo = props.onUndo,
|
|
22
|
-
onChange = props.onChange,
|
|
23
|
-
onKeyDown = props.onKeyDown,
|
|
24
|
-
onClear = props.onClear,
|
|
25
|
-
clearLabel = props.clearLabel,
|
|
26
|
-
error = props.error,
|
|
27
|
-
restProps = _objectWithoutProperties(props, _excluded);
|
|
28
|
-
|
|
29
|
-
var inputRef = useRef(null);
|
|
30
|
-
var handleRef = useCallback(function (input) {
|
|
31
|
-
if (input) {
|
|
32
|
-
inputRef.current = input;
|
|
33
|
-
|
|
34
|
-
if (autoFocus) {
|
|
35
|
-
// Need this to prevent jumping when we render TextInput inside Portal @see ED-2992
|
|
36
|
-
input.focus({
|
|
37
|
-
preventScroll: true
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}, [autoFocus]);
|
|
42
|
-
var handleChange = useCallback(function (e) {
|
|
43
|
-
onChange(e.currentTarget.value);
|
|
44
|
-
}, [onChange]);
|
|
45
|
-
var handleKeydown = useCallback(function (e) {
|
|
46
|
-
var value = e.currentTarget.value;
|
|
47
|
-
|
|
48
|
-
if (e.keyCode === 13 && onSubmit) {
|
|
49
|
-
e.preventDefault(); // Prevent from submitting if an editor is inside a form.
|
|
50
|
-
|
|
51
|
-
onSubmit(value);
|
|
52
|
-
} else if (typeof onUndo === 'function' && isUndoEvent(e)) {
|
|
53
|
-
e.preventDefault();
|
|
54
|
-
onUndo();
|
|
55
|
-
} else if (typeof onRedo === 'function' && isRedoEvent(e)) {
|
|
56
|
-
e.preventDefault();
|
|
57
|
-
onRedo();
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if (onKeyDown) {
|
|
61
|
-
onKeyDown(e);
|
|
62
|
-
}
|
|
63
|
-
}, [onSubmit, onUndo, onRedo, onKeyDown]);
|
|
64
|
-
var handleClear = useCallback(function () {
|
|
65
|
-
if (inputRef.current && onClear) {
|
|
66
|
-
inputRef.current.focus();
|
|
67
|
-
onClear();
|
|
68
|
-
}
|
|
69
|
-
}, [onClear]);
|
|
70
|
-
var clearText = restProps.value !== '' && jsx(Tooltip, {
|
|
71
|
-
content: clearLabel
|
|
72
|
-
}, jsx("button", {
|
|
73
|
-
css: clearTextButtonStyles,
|
|
74
|
-
onClick: handleClear,
|
|
75
|
-
"data-testid": "clear-text"
|
|
76
|
-
}, jsx(Selectclear, {
|
|
77
|
-
size: "medium",
|
|
78
|
-
label: clearLabel || ''
|
|
79
|
-
})));
|
|
80
|
-
return jsx("div", {
|
|
81
|
-
css: fieldStyles
|
|
82
|
-
}, jsx(Field, {
|
|
83
|
-
label: label,
|
|
84
|
-
name: name
|
|
85
|
-
}, function (_ref) {
|
|
86
|
-
var fieldProps = _ref.fieldProps;
|
|
87
|
-
return jsx(Fragment, null, jsx(Textfield, _extends({}, fieldProps, restProps, {
|
|
88
|
-
onKeyDown: handleKeydown,
|
|
89
|
-
onChange: handleChange,
|
|
90
|
-
ref: handleRef,
|
|
91
|
-
elemAfterInput: clearText,
|
|
92
|
-
isInvalid: !!error
|
|
93
|
-
})), error && jsx(ErrorMessage, {
|
|
94
|
-
testId: "link-error"
|
|
95
|
-
}, error));
|
|
96
|
-
}));
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
export default PanelTextInput;
|
|
@@ -1,10 +0,0 @@
|
|
|
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/url.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import LinkifyIt from 'linkify-it';
|
|
2
|
-
var linkify = LinkifyIt();
|
|
3
|
-
linkify.add('sourcetree:', 'http:');
|
|
4
|
-
var tlds = 'biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф'.split('|');
|
|
5
|
-
var tlds2Char = 'a[cdefgilmnoqrtuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrtuvwxyz]|n[acefgilopruz]|om|p[aefghkmnrtw]|qa|r[eosuw]|s[abcdegijklmnrtuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]';
|
|
6
|
-
tlds.push(tlds2Char);
|
|
7
|
-
linkify.tlds(tlds, false);
|
|
8
|
-
var whitelistedURLPatterns = [/^https?:\/\/[^\s]*$/im, /^ftps?:\/\//im, /^\//im, /^mailto:/im, /^skype:/im, /^callto:[^\s]*$/im, /^facetime:[^\s]*$/im, /^git:/im, /^irc6?:/im, /^news:/im, /^nntp:/im, /^feed:/im, /^cvs:/im, /^svn:/im, /^mvn:/im, /^ssh:/im, /^scp:\/\//im, /^sftp:\/\//im, /^itms:/im, /^notes:/im, /^hipchat:\/\//im, /^sourcetree:/im, /^urn:/im, /^tel:/im, /^xmpp:/im, /^telnet:/im, /^vnc:/im, /^rdp:/im, /^whatsapp:/im, /^slack:/im, /^sips?:/im, /^magnet:/im, /^foo:/im, /^#/im];
|
|
9
|
-
|
|
10
|
-
var normaliseLinkHref = function normaliseLinkHref(url) {
|
|
11
|
-
var match = getLinkMatch(url);
|
|
12
|
-
return match && match.url || null;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
var getLinkMatch = function getLinkMatch(str) {
|
|
16
|
-
if (!str) {
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
var match = linkifyMatch(str);
|
|
21
|
-
|
|
22
|
-
if (!match.length) {
|
|
23
|
-
match = linkify.match(str);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return match && match.length > 0 && match[0].index === 0 && match[0].lastIndex === str.trim().length ? match[0] : null;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
var LINK_REGEXP = /(https?|ftp):\/\/[^\s]+/;
|
|
30
|
-
|
|
31
|
-
var linkifyMatch = function linkifyMatch(text) {
|
|
32
|
-
var matches = [];
|
|
33
|
-
|
|
34
|
-
if (!LINK_REGEXP.test(text)) {
|
|
35
|
-
return matches;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
var startpos = 0;
|
|
39
|
-
var substr;
|
|
40
|
-
|
|
41
|
-
while (substr = text.substr(startpos)) {
|
|
42
|
-
var link = (substr.match(LINK_REGEXP) || [''])[0];
|
|
43
|
-
|
|
44
|
-
if (link) {
|
|
45
|
-
var index = substr.search(LINK_REGEXP);
|
|
46
|
-
var start = index >= 0 ? index + startpos : index;
|
|
47
|
-
var end = start + link.length;
|
|
48
|
-
matches.push({
|
|
49
|
-
index: start,
|
|
50
|
-
lastIndex: end,
|
|
51
|
-
raw: link,
|
|
52
|
-
url: link,
|
|
53
|
-
text: link,
|
|
54
|
-
schema: ''
|
|
55
|
-
});
|
|
56
|
-
startpos += end;
|
|
57
|
-
} else {
|
|
58
|
-
break;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return matches;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export var isSafeUrl = function isSafeUrl(url) {
|
|
66
|
-
var urlTrimmed = url.trim();
|
|
67
|
-
|
|
68
|
-
if (urlTrimmed.length === 0) {
|
|
69
|
-
return true;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return whitelistedURLPatterns.some(function (p) {
|
|
73
|
-
return p.test(urlTrimmed);
|
|
74
|
-
});
|
|
75
|
-
};
|
|
76
|
-
/**
|
|
77
|
-
* Adds protocol to url if needed.
|
|
78
|
-
*/
|
|
79
|
-
|
|
80
|
-
export function normalizeUrl(url) {
|
|
81
|
-
if (!url) {
|
|
82
|
-
return '';
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (isSafeUrl(url)) {
|
|
86
|
-
return url.trim();
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return normaliseLinkHref(url);
|
|
90
|
-
}
|
package/dist/esm/utils.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { browser } from './browser';
|
|
2
|
-
var KeyZCode = 90;
|
|
3
|
-
var KeyYCode = 89;
|
|
4
|
-
export var isUndoEvent = function isUndoEvent(e) {
|
|
5
|
-
return e.keyCode === KeyZCode && ( // cmd + z for mac
|
|
6
|
-
browser.mac && e.metaKey && !e.shiftKey || // ctrl + z for non-mac
|
|
7
|
-
!browser.mac && e.ctrlKey);
|
|
8
|
-
};
|
|
9
|
-
export var isRedoEvent = function isRedoEvent(e) {
|
|
10
|
-
return (// ctrl + y for non-mac
|
|
11
|
-
!browser.mac && e.ctrlKey && e.keyCode === KeyYCode || browser.mac && e.metaKey && e.shiftKey && e.keyCode === KeyZCode || e.ctrlKey && e.shiftKey && e.keyCode === KeyZCode
|
|
12
|
-
);
|
|
13
|
-
};
|
package/dist/esm/version.json
DELETED
package/dist/types/browser.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
declare const result: {
|
|
2
|
-
mac: boolean;
|
|
3
|
-
ie: boolean;
|
|
4
|
-
ie_version: number;
|
|
5
|
-
gecko: boolean;
|
|
6
|
-
chrome: boolean;
|
|
7
|
-
chrome_version: number;
|
|
8
|
-
android: boolean;
|
|
9
|
-
ios: boolean;
|
|
10
|
-
webkit: boolean;
|
|
11
|
-
safari: boolean;
|
|
12
|
-
supportsIntersectionObserver: boolean;
|
|
13
|
-
supportsResizeObserver: boolean;
|
|
14
|
-
};
|
|
15
|
-
export { result as browser };
|
package/dist/types/index.d.ts
DELETED
package/dist/types/messages.d.ts
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
export declare const messages: {
|
|
2
|
-
placeholder: {
|
|
3
|
-
id: string;
|
|
4
|
-
defaultMessage: string;
|
|
5
|
-
description: string;
|
|
6
|
-
};
|
|
7
|
-
linkPlaceholder: {
|
|
8
|
-
id: string;
|
|
9
|
-
defaultMessage: string;
|
|
10
|
-
description: string;
|
|
11
|
-
};
|
|
12
|
-
linkTextPlaceholder: {
|
|
13
|
-
id: string;
|
|
14
|
-
defaultMessage: string;
|
|
15
|
-
description: string;
|
|
16
|
-
};
|
|
17
|
-
linkLabel: {
|
|
18
|
-
id: string;
|
|
19
|
-
defaultMessage: string;
|
|
20
|
-
description: string;
|
|
21
|
-
};
|
|
22
|
-
linkInvalid: {
|
|
23
|
-
id: string;
|
|
24
|
-
defaultMessage: string;
|
|
25
|
-
description: string;
|
|
26
|
-
};
|
|
27
|
-
linkTextLabel: {
|
|
28
|
-
id: string;
|
|
29
|
-
defaultMessage: string;
|
|
30
|
-
description: string;
|
|
31
|
-
};
|
|
32
|
-
clearText: {
|
|
33
|
-
id: string;
|
|
34
|
-
defaultMessage: string;
|
|
35
|
-
description: string;
|
|
36
|
-
};
|
|
37
|
-
clearLink: {
|
|
38
|
-
id: string;
|
|
39
|
-
defaultMessage: string;
|
|
40
|
-
description: string;
|
|
41
|
-
};
|
|
42
|
-
searchLinkAriaDescription: {
|
|
43
|
-
id: string;
|
|
44
|
-
defaultMessage: string;
|
|
45
|
-
description: string;
|
|
46
|
-
};
|
|
47
|
-
searchLinkResults: {
|
|
48
|
-
id: string;
|
|
49
|
-
defaultMessage: string;
|
|
50
|
-
description: string;
|
|
51
|
-
};
|
|
52
|
-
linkAriaLabel: {
|
|
53
|
-
id: string;
|
|
54
|
-
defaultMessage: string;
|
|
55
|
-
description: string;
|
|
56
|
-
};
|
|
57
|
-
timeUpdated: {
|
|
58
|
-
id: string;
|
|
59
|
-
defaultMessage: string;
|
|
60
|
-
description: string;
|
|
61
|
-
};
|
|
62
|
-
timeViewed: {
|
|
63
|
-
id: string;
|
|
64
|
-
defaultMessage: string;
|
|
65
|
-
description: string;
|
|
66
|
-
};
|
|
67
|
-
timeAgo: {
|
|
68
|
-
id: string;
|
|
69
|
-
defaultMessage: string;
|
|
70
|
-
description: string;
|
|
71
|
-
};
|
|
72
|
-
titleRecentlyViewed: {
|
|
73
|
-
id: string;
|
|
74
|
-
defaultMessage: string;
|
|
75
|
-
description: string;
|
|
76
|
-
};
|
|
77
|
-
titleResults: {
|
|
78
|
-
id: string;
|
|
79
|
-
defaultMessage: string;
|
|
80
|
-
description: string;
|
|
81
|
-
};
|
|
82
|
-
cancelButton: {
|
|
83
|
-
id: string;
|
|
84
|
-
defaultMessage: string;
|
|
85
|
-
description: string;
|
|
86
|
-
};
|
|
87
|
-
insertButton: {
|
|
88
|
-
id: string;
|
|
89
|
-
defaultMessage: string;
|
|
90
|
-
description: string;
|
|
91
|
-
};
|
|
92
|
-
};
|
package/dist/types/types.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { MessageDescriptor } from 'react-intl-next';
|
|
3
|
-
export declare type LinkInputType = 'manual' | 'typeAhead';
|
|
4
|
-
export interface LinkSearchListItemData {
|
|
5
|
-
/** Unique identifiable attribute for the item */
|
|
6
|
-
objectId: string;
|
|
7
|
-
/** Name / title / display text of the link */
|
|
8
|
-
name: string;
|
|
9
|
-
/** URL of the resource being linked to */
|
|
10
|
-
url: string;
|
|
11
|
-
/** Icon to display in link result */
|
|
12
|
-
icon: string | React.ComponentType<{
|
|
13
|
-
alt: string;
|
|
14
|
-
}>;
|
|
15
|
-
/** Alt text describing the icon */
|
|
16
|
-
iconAlt: string | MessageDescriptor;
|
|
17
|
-
/** Context to display in link result */
|
|
18
|
-
container?: string;
|
|
19
|
-
/** Optional last view date to display in link result */
|
|
20
|
-
lastViewedDate?: Date;
|
|
21
|
-
/** Optional last updated date to display in link result */
|
|
22
|
-
lastUpdatedDate?: Date;
|
|
23
|
-
/** Whether the result is pre-fetched from activity provider */
|
|
24
|
-
prefetch?: boolean;
|
|
25
|
-
}
|
|
26
|
-
export declare type ListItemTimeStamp = {
|
|
27
|
-
pageAction: string;
|
|
28
|
-
dateString: string;
|
|
29
|
-
timeSince?: string | undefined;
|
|
30
|
-
};
|
|
31
|
-
export interface LinkPickerState {
|
|
32
|
-
/** Current query string / URL input field value */
|
|
33
|
-
query: string;
|
|
34
|
-
}
|
|
35
|
-
export interface ResolveResult {
|
|
36
|
-
data: LinkSearchListItemData[];
|
|
37
|
-
}
|
|
38
|
-
export interface LinkPickerPlugin {
|
|
39
|
-
resolve: (state: LinkPickerState) => Promise<ResolveResult> | AsyncGenerator<ResolveResult, ResolveResult>;
|
|
40
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React, { AriaAttributes, Ref } from 'react';
|
|
2
|
-
declare type AnnouncerProps = {
|
|
3
|
-
ref?: Ref<HTMLDivElement>;
|
|
4
|
-
/** Set 'false' for announcing only changed text
|
|
5
|
-
* (not announce duplicate part of string after second render),
|
|
6
|
-
* and 'true' for announcing all the string after each render */
|
|
7
|
-
ariaAtomic?: AriaAttributes['aria-atomic'];
|
|
8
|
-
/** Set politeness settings */
|
|
9
|
-
ariaLive?: AriaAttributes['aria-live'];
|
|
10
|
-
/** Used to describe what types of changes have occurred to an aria-live region */
|
|
11
|
-
ariaRelevant?: AriaAttributes['aria-relevant'];
|
|
12
|
-
/** Role used to set attribute role. See more details https://dequeuniversity.com/library/aria/liveregion-playground#configOptions */
|
|
13
|
-
role?: 'status' | 'log' | 'alert' | 'timer' | 'marquee';
|
|
14
|
-
/** Text message that will be announced */
|
|
15
|
-
text: string;
|
|
16
|
-
/** Debounce delay.
|
|
17
|
-
* Set delay (ms) to prevent announce the same string multiple times.
|
|
18
|
-
* It can be useful for cases when the parent component re-renders with the same announcer's text. */
|
|
19
|
-
delay?: number;
|
|
20
|
-
};
|
|
21
|
-
declare const _default: React.NamedExoticComponent<AnnouncerProps>;
|
|
22
|
-
export default _default;
|