@atlaskit/link-picker 1.6.1 → 1.7.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 +6 -0
- package/dist/cjs/{ui/error-boundary-fallback → common}/generic-error-svg/index.js +0 -0
- package/dist/cjs/{ui/error-boundary-fallback → common}/generic-error-svg/styled.js +0 -0
- package/dist/cjs/services/use-plugins/index.js +32 -35
- package/dist/cjs/services/use-search-query/index.js +41 -0
- package/dist/cjs/ui/error-boundary-fallback/index.js +1 -1
- package/dist/cjs/ui/link-picker/index.js +56 -40
- package/dist/cjs/ui/link-picker/link-search-error/index.js +27 -0
- package/dist/cjs/ui/link-picker/messages.js +10 -0
- package/dist/cjs/ui/link-picker/url.js +0 -5
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/{ui/error-boundary-fallback → common}/generic-error-svg/index.js +0 -0
- package/dist/es2019/{ui/error-boundary-fallback → common}/generic-error-svg/styled.js +0 -0
- package/dist/es2019/services/use-plugins/index.js +28 -38
- package/dist/es2019/services/use-search-query/index.js +32 -0
- package/dist/es2019/ui/error-boundary-fallback/index.js +1 -1
- package/dist/es2019/ui/link-picker/index.js +50 -39
- package/dist/es2019/ui/link-picker/link-search-error/index.js +10 -0
- package/dist/es2019/ui/link-picker/messages.js +10 -0
- package/dist/es2019/ui/link-picker/url.js +0 -5
- package/dist/es2019/version.json +1 -1
- package/dist/esm/{ui/error-boundary-fallback → common}/generic-error-svg/index.js +0 -0
- package/dist/esm/{ui/error-boundary-fallback → common}/generic-error-svg/styled.js +0 -0
- package/dist/esm/services/use-plugins/index.js +33 -35
- package/dist/esm/services/use-search-query/index.js +32 -0
- package/dist/esm/ui/error-boundary-fallback/index.js +1 -1
- package/dist/esm/ui/link-picker/index.js +52 -39
- package/dist/esm/ui/link-picker/link-search-error/index.js +14 -0
- package/dist/esm/ui/link-picker/messages.js +10 -0
- package/dist/esm/ui/link-picker/url.js +0 -5
- package/dist/esm/version.json +1 -1
- package/dist/types/{ui/error-boundary-fallback → common}/generic-error-svg/index.d.ts +0 -0
- package/dist/types/{ui/error-boundary-fallback → common}/generic-error-svg/styled.d.ts +0 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/services/use-plugins/index.d.ts +6 -5
- package/dist/types/services/use-search-query/index.d.ts +3 -0
- package/dist/types/ui/link-picker/index.d.ts +2 -0
- package/dist/types/ui/link-picker/link-search-error/index.d.ts +4 -0
- package/dist/types/ui/link-picker/messages.d.ts +10 -0
- package/dist/types/ui/types.d.ts +5 -2
- package/package.json +4 -4
- package/report.api.md +11 -5
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import EmptyState from '@atlaskit/empty-state';
|
|
4
|
+
import GenericErrorSVG from '../../../common/generic-error-svg';
|
|
5
|
+
|
|
6
|
+
var LinkSearchError = function LinkSearchError(props) {
|
|
7
|
+
return /*#__PURE__*/React.createElement(EmptyState, _extends({}, props, {
|
|
8
|
+
renderImage: function renderImage() {
|
|
9
|
+
return /*#__PURE__*/React.createElement(GenericErrorSVG, null);
|
|
10
|
+
}
|
|
11
|
+
}));
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default LinkSearchError;
|
|
@@ -104,5 +104,15 @@ export var messages = defineMessages({
|
|
|
104
104
|
id: 'fabric.linkPicker.button.save',
|
|
105
105
|
defaultMessage: 'Save',
|
|
106
106
|
description: 'Button to save edited link'
|
|
107
|
+
},
|
|
108
|
+
searchErrorHeader: {
|
|
109
|
+
id: 'fabric.linkPicker.search.error.heading',
|
|
110
|
+
defaultMessage: 'We’re having trouble loading data.',
|
|
111
|
+
description: 'Heading message shown when a search throws an error'
|
|
112
|
+
},
|
|
113
|
+
searchErrorDescription: {
|
|
114
|
+
id: 'fabric.linkPicker.search.error.description',
|
|
115
|
+
defaultMessage: 'Refresh the page, or contact <a>Atlassian Support</a> if this keeps happening.',
|
|
116
|
+
description: 'Describes possible actions when search throws an error'
|
|
107
117
|
}
|
|
108
118
|
});
|
|
@@ -64,11 +64,6 @@ var linkifyMatch = function linkifyMatch(text) {
|
|
|
64
64
|
|
|
65
65
|
export var isSafeUrl = function isSafeUrl(url) {
|
|
66
66
|
var urlTrimmed = url.trim();
|
|
67
|
-
|
|
68
|
-
if (urlTrimmed.length === 0) {
|
|
69
|
-
return true;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
67
|
return whitelistedURLPatterns.some(function (p) {
|
|
73
68
|
return p.test(urlTrimmed);
|
|
74
69
|
});
|
package/dist/esm/version.json
CHANGED
|
File without changes
|
|
File without changes
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { ComposedLinkPicker as LinkPicker } from './ui';
|
|
2
2
|
export type { LinkPickerProps } from './ui/link-picker';
|
|
3
|
-
export type { LinkInputType, LinkPickerPlugin, LinkPickerState, LinkSearchListItemData, } from './ui/types';
|
|
3
|
+
export type { LinkInputType, LinkPickerPlugin, LinkPickerState, LinkSearchListItemData, LinkPickerPluginErrorFallback, } from './ui/types';
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { LinkPickerPlugin, LinkSearchListItemData } from '../../ui/types';
|
|
1
|
+
import { LinkPickerPlugin, LinkPickerPluginErrorFallback, LinkPickerState, LinkSearchListItemData } from '../../ui/types';
|
|
3
2
|
export interface LinkPickerPluginsService {
|
|
4
|
-
items: LinkSearchListItemData[];
|
|
3
|
+
items: LinkSearchListItemData[] | null;
|
|
5
4
|
isLoading: boolean;
|
|
6
|
-
isSelectedItem: boolean;
|
|
7
5
|
isActivePlugin: boolean;
|
|
8
6
|
tabs: {
|
|
9
7
|
tabTitle: string;
|
|
10
8
|
}[];
|
|
9
|
+
error: unknown | null;
|
|
10
|
+
retry: () => void;
|
|
11
|
+
errorFallback?: LinkPickerPluginErrorFallback;
|
|
11
12
|
}
|
|
12
|
-
export declare function usePlugins(state:
|
|
13
|
+
export declare function usePlugins(state: LinkPickerState | null, activeTab: number, plugins?: LinkPickerPlugin[]): LinkPickerPluginsService;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx } from '@emotion/react';
|
|
2
2
|
import { LinkInputType, LinkPickerPlugin } from '../types';
|
|
3
3
|
export declare const RECENT_SEARCH_LIST_SIZE = 5;
|
|
4
|
+
export declare const CONTACT_SUPPORT_LINK = "https://support.atlassian.com/contact/";
|
|
4
5
|
export declare const testIds: {
|
|
5
6
|
linkPicker: string;
|
|
6
7
|
urlInputField: string;
|
|
@@ -17,6 +18,7 @@ export declare const testIds: {
|
|
|
17
18
|
urlError: string;
|
|
18
19
|
tabList: string;
|
|
19
20
|
tabItem: string;
|
|
21
|
+
searchError: string;
|
|
20
22
|
};
|
|
21
23
|
interface Meta {
|
|
22
24
|
/** Indicates how the link was picked. */
|
|
@@ -104,4 +104,14 @@ export declare const messages: {
|
|
|
104
104
|
defaultMessage: string;
|
|
105
105
|
description: string;
|
|
106
106
|
};
|
|
107
|
+
searchErrorHeader: {
|
|
108
|
+
id: string;
|
|
109
|
+
defaultMessage: string;
|
|
110
|
+
description: string;
|
|
111
|
+
};
|
|
112
|
+
searchErrorDescription: {
|
|
113
|
+
id: string;
|
|
114
|
+
defaultMessage: string;
|
|
115
|
+
description: string;
|
|
116
|
+
};
|
|
107
117
|
};
|
package/dist/types/ui/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { MessageDescriptor } from 'react-intl-next';
|
|
3
3
|
export declare type LinkInputType = 'manual' | 'typeAhead';
|
|
4
4
|
export interface LinkSearchListItemData {
|
|
@@ -36,9 +36,12 @@ export interface ResolveResult {
|
|
|
36
36
|
data: LinkSearchListItemData[];
|
|
37
37
|
}
|
|
38
38
|
export interface LinkPickerPlugin {
|
|
39
|
+
resolve: (state: LinkPickerState) => Promise<ResolveResult> | AsyncGenerator<ResolveResult, ResolveResult>;
|
|
39
40
|
/** Uniquely identify the tab */
|
|
40
41
|
tabKey?: string;
|
|
41
42
|
/** Human-readable label for the plugin */
|
|
42
43
|
tabTitle?: string;
|
|
43
|
-
|
|
44
|
+
/** Render function to customise the UI that is displayed when an error occurs resolving results */
|
|
45
|
+
errorFallback?: LinkPickerPluginErrorFallback;
|
|
44
46
|
}
|
|
47
|
+
export declare type LinkPickerPluginErrorFallback = (error: unknown, retry: () => void) => ReactNode;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/link-picker",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "Standalone link picker",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"publishConfig": {
|
|
@@ -54,15 +54,15 @@
|
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@atlaskit/activity-provider": "^2.3.2",
|
|
56
56
|
"@atlaskit/docs": "*",
|
|
57
|
-
"@atlaskit/link-test-helpers": "^1.
|
|
57
|
+
"@atlaskit/link-test-helpers": "^1.4.0",
|
|
58
58
|
"@atlaskit/popup": "^1.4.0",
|
|
59
59
|
"@atlaskit/ssr": "*",
|
|
60
60
|
"@atlaskit/toggle": "^12.4.0",
|
|
61
61
|
"@atlaskit/visual-regression": "*",
|
|
62
62
|
"@atlaskit/webdriver-runner": "*",
|
|
63
63
|
"@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
|
|
64
|
-
"@atlassian/link-picker-atlassian-plugin": "^
|
|
65
|
-
"@atlassian/link-picker-plugins": "^
|
|
64
|
+
"@atlassian/link-picker-atlassian-plugin": "^17.0.0",
|
|
65
|
+
"@atlassian/link-picker-plugins": "^4.0.0",
|
|
66
66
|
"@atlassian/search-provider": "^2.3.0",
|
|
67
67
|
"@testing-library/dom": "^7.7.3",
|
|
68
68
|
"@testing-library/jest-dom": "^4.1.0",
|
package/report.api.md
CHANGED
|
@@ -5,10 +5,9 @@
|
|
|
5
5
|
[Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
|
|
6
6
|
|
|
7
7
|
```ts
|
|
8
|
-
/// <reference types="react" />
|
|
9
|
-
|
|
10
8
|
import { MessageDescriptor } from 'react-intl-next';
|
|
11
9
|
import { default as React_2 } from 'react';
|
|
10
|
+
import { ReactNode } from 'react';
|
|
12
11
|
|
|
13
12
|
export declare type LinkInputType = 'manual' | 'typeAhead';
|
|
14
13
|
|
|
@@ -17,15 +16,22 @@ export declare const LinkPicker: React_2.MemoExoticComponent<(
|
|
|
17
16
|
) => JSX.Element>;
|
|
18
17
|
|
|
19
18
|
export declare interface LinkPickerPlugin {
|
|
19
|
+
resolve: (
|
|
20
|
+
state: LinkPickerState,
|
|
21
|
+
) => Promise<ResolveResult> | AsyncGenerator<ResolveResult, ResolveResult>;
|
|
20
22
|
/** Uniquely identify the tab */
|
|
21
23
|
tabKey?: string;
|
|
22
24
|
/** Human-readable label for the plugin */
|
|
23
25
|
tabTitle?: string;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
) => Promise<ResolveResult> | AsyncGenerator<ResolveResult, ResolveResult>;
|
|
26
|
+
/** Render function to customise the UI that is displayed when an error occurs resolving results */
|
|
27
|
+
errorFallback?: LinkPickerPluginErrorFallback;
|
|
27
28
|
}
|
|
28
29
|
|
|
30
|
+
export declare type LinkPickerPluginErrorFallback = (
|
|
31
|
+
error: unknown,
|
|
32
|
+
retry: () => void,
|
|
33
|
+
) => ReactNode;
|
|
34
|
+
|
|
29
35
|
export declare interface LinkPickerProps {
|
|
30
36
|
/** Callback to fire on form submission. */
|
|
31
37
|
onSubmit: (arg: OnSubmitParameter) => void;
|