@atlaskit/link-picker 1.10.2 → 1.10.3
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/link-picker/index.js +7 -7
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/ui/link-picker/index.js +7 -7
- package/dist/es2019/version.json +1 -1
- package/dist/esm/ui/link-picker/index.js +7 -7
- package/dist/esm/version.json +1 -1
- package/dist/types-ts4.0/analytics.codegen.d.ts +52 -0
- package/dist/types-ts4.0/common/analytics/context.d.ts +28 -0
- package/dist/types-ts4.0/common/analytics/index.d.ts +2 -0
- package/dist/types-ts4.0/common/analytics/input-field-tracking.d.ts +17 -0
- package/dist/types-ts4.0/common/constants.d.ts +2 -0
- package/dist/types-ts4.0/common/generic-error-svg/index.d.ts +4 -0
- package/dist/types-ts4.0/common/generic-error-svg/styled.d.ts +1 -0
- package/dist/types-ts4.0/common/utils/url.d.ts +5 -0
- package/dist/types-ts4.0/controllers/use-fix-height/index.d.ts +8 -0
- package/dist/types-ts4.0/index.d.ts +3 -0
- package/dist/types-ts4.0/services/use-plugins/index.d.ts +14 -0
- package/dist/types-ts4.0/services/use-plugins/reducer.d.ts +33 -0
- package/dist/types-ts4.0/services/use-plugins/utils.d.ts +18 -0
- package/dist/types-ts4.0/services/use-search-query/index.d.ts +3 -0
- package/dist/types-ts4.0/ui/error-boundary/index.d.ts +27 -0
- package/dist/types-ts4.0/ui/error-boundary-fallback/index.d.ts +3 -0
- package/dist/types-ts4.0/ui/index.d.ts +5 -0
- package/dist/types-ts4.0/ui/link-picker/announcer.d.ts +22 -0
- package/dist/types-ts4.0/ui/link-picker/browser.d.ts +15 -0
- package/dist/types-ts4.0/ui/link-picker/form-footer/index.d.ts +13 -0
- package/dist/types-ts4.0/ui/link-picker/form-footer/styled.d.ts +1 -0
- package/dist/types-ts4.0/ui/link-picker/index.d.ts +69 -0
- package/dist/types-ts4.0/ui/link-picker/link-search-error/index.d.ts +20 -0
- package/dist/types-ts4.0/ui/link-picker/link-search-list/index.d.ts +43 -0
- package/dist/types-ts4.0/ui/link-picker/link-search-list/link-search-no-results/index.d.ts +19 -0
- package/dist/types-ts4.0/ui/link-picker/link-search-list/link-search-no-results/no-results-svg/index.d.ts +4 -0
- package/dist/types-ts4.0/ui/link-picker/link-search-list/link-search-no-results/no-results-svg/styled.d.ts +1 -0
- package/dist/types-ts4.0/ui/link-picker/link-search-list/link-search-no-results/styled.d.ts +1 -0
- package/dist/types-ts4.0/ui/link-picker/link-search-list/styled.d.ts +4 -0
- package/dist/types-ts4.0/ui/link-picker/list-item/index.d.ts +17 -0
- package/dist/types-ts4.0/ui/link-picker/list-item/styled.d.ts +9 -0
- package/dist/types-ts4.0/ui/link-picker/messages.d.ts +85 -0
- package/dist/types-ts4.0/ui/link-picker/styled.d.ts +9 -0
- package/dist/types-ts4.0/ui/link-picker/text-input/index.d.ts +14 -0
- package/dist/types-ts4.0/ui/link-picker/text-input/styled.d.ts +2 -0
- package/dist/types-ts4.0/ui/link-picker/transformTimeStamp.d.ts +3 -0
- package/dist/types-ts4.0/ui/link-picker/utils.d.ts +10 -0
- package/dist/types-ts4.0/ui/loader-fallback/index.d.ts +3 -0
- package/dist/types-ts4.0/ui/types.d.ts +57 -0
- package/package.json +11 -4
- package/report.api.md +45 -65
package/CHANGELOG.md
CHANGED
|
@@ -201,9 +201,9 @@ function LinkPicker(_ref) {
|
|
|
201
201
|
});
|
|
202
202
|
}, []);
|
|
203
203
|
var handleKeyDown = (0, _react.useCallback)(function (event) {
|
|
204
|
-
var
|
|
205
|
-
var
|
|
206
|
-
var
|
|
204
|
+
var key = event.key;
|
|
205
|
+
var KEY_ARROW_DOWN = 'ArrowDown';
|
|
206
|
+
var KEY_ARROW_UP = 'ArrowUp';
|
|
207
207
|
|
|
208
208
|
if (!items || !items.length) {
|
|
209
209
|
return;
|
|
@@ -211,14 +211,14 @@ function LinkPicker(_ref) {
|
|
|
211
211
|
|
|
212
212
|
var updatedIndex = activeIndex;
|
|
213
213
|
|
|
214
|
-
switch (
|
|
215
|
-
case
|
|
214
|
+
switch (key) {
|
|
215
|
+
case KEY_ARROW_DOWN:
|
|
216
216
|
// down
|
|
217
217
|
event.preventDefault();
|
|
218
218
|
updatedIndex = (activeIndex + 1) % items.length;
|
|
219
219
|
break;
|
|
220
220
|
|
|
221
|
-
case
|
|
221
|
+
case KEY_ARROW_UP:
|
|
222
222
|
// up
|
|
223
223
|
event.preventDefault();
|
|
224
224
|
updatedIndex = activeIndex > 0 ? activeIndex - 1 : items.length - 1;
|
|
@@ -227,7 +227,7 @@ function LinkPicker(_ref) {
|
|
|
227
227
|
|
|
228
228
|
var item = items[updatedIndex];
|
|
229
229
|
|
|
230
|
-
if ([
|
|
230
|
+
if ([KEY_ARROW_DOWN, KEY_ARROW_UP].includes(key) && item) {
|
|
231
231
|
/**
|
|
232
232
|
* Manually track that the url has been updated using searchResult method
|
|
233
233
|
*/
|
package/dist/cjs/version.json
CHANGED
|
@@ -152,10 +152,10 @@ function LinkPicker({
|
|
|
152
152
|
}, []);
|
|
153
153
|
const handleKeyDown = useCallback(event => {
|
|
154
154
|
const {
|
|
155
|
-
|
|
155
|
+
key
|
|
156
156
|
} = event;
|
|
157
|
-
const
|
|
158
|
-
const
|
|
157
|
+
const KEY_ARROW_DOWN = 'ArrowDown';
|
|
158
|
+
const KEY_ARROW_UP = 'ArrowUp';
|
|
159
159
|
|
|
160
160
|
if (!items || !items.length) {
|
|
161
161
|
return;
|
|
@@ -163,14 +163,14 @@ function LinkPicker({
|
|
|
163
163
|
|
|
164
164
|
let updatedIndex = activeIndex;
|
|
165
165
|
|
|
166
|
-
switch (
|
|
167
|
-
case
|
|
166
|
+
switch (key) {
|
|
167
|
+
case KEY_ARROW_DOWN:
|
|
168
168
|
// down
|
|
169
169
|
event.preventDefault();
|
|
170
170
|
updatedIndex = (activeIndex + 1) % items.length;
|
|
171
171
|
break;
|
|
172
172
|
|
|
173
|
-
case
|
|
173
|
+
case KEY_ARROW_UP:
|
|
174
174
|
// up
|
|
175
175
|
event.preventDefault();
|
|
176
176
|
updatedIndex = activeIndex > 0 ? activeIndex - 1 : items.length - 1;
|
|
@@ -179,7 +179,7 @@ function LinkPicker({
|
|
|
179
179
|
|
|
180
180
|
const item = items[updatedIndex];
|
|
181
181
|
|
|
182
|
-
if ([
|
|
182
|
+
if ([KEY_ARROW_DOWN, KEY_ARROW_UP].includes(key) && item) {
|
|
183
183
|
/**
|
|
184
184
|
* Manually track that the url has been updated using searchResult method
|
|
185
185
|
*/
|
package/dist/es2019/version.json
CHANGED
|
@@ -158,9 +158,9 @@ function LinkPicker(_ref) {
|
|
|
158
158
|
});
|
|
159
159
|
}, []);
|
|
160
160
|
var handleKeyDown = useCallback(function (event) {
|
|
161
|
-
var
|
|
162
|
-
var
|
|
163
|
-
var
|
|
161
|
+
var key = event.key;
|
|
162
|
+
var KEY_ARROW_DOWN = 'ArrowDown';
|
|
163
|
+
var KEY_ARROW_UP = 'ArrowUp';
|
|
164
164
|
|
|
165
165
|
if (!items || !items.length) {
|
|
166
166
|
return;
|
|
@@ -168,14 +168,14 @@ function LinkPicker(_ref) {
|
|
|
168
168
|
|
|
169
169
|
var updatedIndex = activeIndex;
|
|
170
170
|
|
|
171
|
-
switch (
|
|
172
|
-
case
|
|
171
|
+
switch (key) {
|
|
172
|
+
case KEY_ARROW_DOWN:
|
|
173
173
|
// down
|
|
174
174
|
event.preventDefault();
|
|
175
175
|
updatedIndex = (activeIndex + 1) % items.length;
|
|
176
176
|
break;
|
|
177
177
|
|
|
178
|
-
case
|
|
178
|
+
case KEY_ARROW_UP:
|
|
179
179
|
// up
|
|
180
180
|
event.preventDefault();
|
|
181
181
|
updatedIndex = activeIndex > 0 ? activeIndex - 1 : items.length - 1;
|
|
@@ -184,7 +184,7 @@ function LinkPicker(_ref) {
|
|
|
184
184
|
|
|
185
185
|
var item = items[updatedIndex];
|
|
186
186
|
|
|
187
|
-
if ([
|
|
187
|
+
if ([KEY_ARROW_DOWN, KEY_ARROW_UP].includes(key) && item) {
|
|
188
188
|
/**
|
|
189
189
|
* Manually track that the url has been updated using searchResult method
|
|
190
190
|
*/
|
package/dist/esm/version.json
CHANGED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
+
*
|
|
4
|
+
* Generates analytics utilities from the package analytics spec yaml
|
|
5
|
+
*
|
|
6
|
+
* @codegen <<SignedSource::05d8b1c9e46066efd0d11fa9d19c32a9>>
|
|
7
|
+
* @codegenCommand yarn workspace @atlaskit/link-picker run codegen-analytics
|
|
8
|
+
*/
|
|
9
|
+
export declare type PackageMetaDataType = {
|
|
10
|
+
packageName: '@atlaskit/link-picker';
|
|
11
|
+
packageVersion: string;
|
|
12
|
+
source: 'linkPicker';
|
|
13
|
+
componentName: 'linkPicker';
|
|
14
|
+
};
|
|
15
|
+
export declare type LinkPickerAnalyticsContextType = {
|
|
16
|
+
linkState: 'editLink' | 'newLink';
|
|
17
|
+
linkFieldContent: 'url' | 'text_string' | null;
|
|
18
|
+
linkFieldContentInputMethod: 'manual' | 'paste' | 'searchResult' | null;
|
|
19
|
+
linkFieldContentInputSource: string | null;
|
|
20
|
+
displayTextFieldContent: 'text_string' | null;
|
|
21
|
+
displayTextFieldContentInputMethod: 'manual' | 'paste' | null;
|
|
22
|
+
};
|
|
23
|
+
export declare type FormSubmittedLinkPickerAttributesType = {};
|
|
24
|
+
export declare type InlineDialogViewedLinkPickerAttributesType = {};
|
|
25
|
+
export declare type InlineDialogClosedLinkPickerAttributesType = {};
|
|
26
|
+
export declare type TextFieldUpdatedLinkFieldAttributesType = {};
|
|
27
|
+
export declare type TextFieldUpdatedDisplayTextFieldAttributesType = {};
|
|
28
|
+
export declare type LinkPickerUnhandledErrorCaughtAttributesType = {
|
|
29
|
+
browserInfo: string;
|
|
30
|
+
error: string;
|
|
31
|
+
componentStack: string | null;
|
|
32
|
+
};
|
|
33
|
+
export declare type ResultsResolveFailedAttributesType = {
|
|
34
|
+
error: string;
|
|
35
|
+
};
|
|
36
|
+
declare type AnalyticsEventAttributes = {
|
|
37
|
+
'ui.form.submitted.linkPicker': FormSubmittedLinkPickerAttributesType;
|
|
38
|
+
'ui.inlineDialog.viewed.linkPicker': InlineDialogViewedLinkPickerAttributesType;
|
|
39
|
+
'ui.inlineDialog.closed.linkPicker': InlineDialogClosedLinkPickerAttributesType;
|
|
40
|
+
'ui.textField.updated.linkField': TextFieldUpdatedLinkFieldAttributesType;
|
|
41
|
+
'ui.textField.updated.displayTextField': TextFieldUpdatedDisplayTextFieldAttributesType;
|
|
42
|
+
'ui.linkPicker.unhandledErrorCaught': LinkPickerUnhandledErrorCaughtAttributesType;
|
|
43
|
+
'operational.resultsResolve.failed': ResultsResolveFailedAttributesType;
|
|
44
|
+
};
|
|
45
|
+
declare function createEventPayload<K extends keyof AnalyticsEventAttributes>(eventKey: K, attributes: AnalyticsEventAttributes[K]): {
|
|
46
|
+
eventType: string;
|
|
47
|
+
actionSubject: string;
|
|
48
|
+
action: string;
|
|
49
|
+
actionSubjectId: string;
|
|
50
|
+
attributes: AnalyticsEventAttributes[K];
|
|
51
|
+
};
|
|
52
|
+
export default createEventPayload;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { LinkPickerAnalyticsContextType } from '../../analytics.codegen';
|
|
3
|
+
export declare type TrackAttribute = <K extends keyof LinkPickerAnalyticsContextType>(attribute: K, value: LinkPickerAnalyticsContextType[K]) => void;
|
|
4
|
+
interface AnalyticsContextType {
|
|
5
|
+
/**
|
|
6
|
+
* Update a single attribute in the analytics context
|
|
7
|
+
*/
|
|
8
|
+
trackAttribute: TrackAttribute;
|
|
9
|
+
/**
|
|
10
|
+
* Update a set of attributes in the analytics context
|
|
11
|
+
*/
|
|
12
|
+
trackAttributes: (attributes: Partial<LinkPickerAnalyticsContextType>) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Retrieve the current set of attributes
|
|
15
|
+
* Can be used by components to derive/compute new attributes for specific events
|
|
16
|
+
*/
|
|
17
|
+
getAttributes: () => LinkPickerAnalyticsContextType;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Hook that exposes the context-level attribute getters and setters.
|
|
21
|
+
*/
|
|
22
|
+
export declare const useLinkPickerAnalytics: () => AnalyticsContextType;
|
|
23
|
+
/**
|
|
24
|
+
* Wraps a component with the analytics context + listener to update events with contextual-level attributes.
|
|
25
|
+
* Should be implemented once at the root of the link picker.
|
|
26
|
+
*/
|
|
27
|
+
export declare function withLinkPickerAnalyticsContext<P>(WrappedComponent: React.ComponentType<P>): React.ComponentType<P>;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { LinkPickerAnalyticsContextType } from '../../analytics.codegen';
|
|
3
|
+
declare type InputFields = 'link' | 'displayText';
|
|
4
|
+
/**
|
|
5
|
+
* Wraps an input field and connects it to the link picker analytics context to provide a baseline of analytics tracking
|
|
6
|
+
* @param WrappedComponent The input field to be tracked
|
|
7
|
+
* @param field The name of the field (ie matching actionSubjectId)
|
|
8
|
+
* @param filterOnChangeEventAttrs Function to hook into and filter/customise the default attribute tracking logic
|
|
9
|
+
* @returns HOC Input field with tracking
|
|
10
|
+
*/
|
|
11
|
+
export declare const withInputFieldTracking: <P extends {
|
|
12
|
+
onBlur?: ((e: React.FocusEvent<HTMLInputElement>) => void) | undefined;
|
|
13
|
+
onChange?: ((e: React.ChangeEvent<HTMLInputElement>) => void) | undefined;
|
|
14
|
+
onClear?: Function | undefined;
|
|
15
|
+
onFocus?: ((e: React.FocusEvent<HTMLInputElement>) => void) | undefined;
|
|
16
|
+
}, Field extends InputFields>(WrappedComponent: React.ComponentType<P>, field: Field, filterOnChangeEventAttrs?: <OnChangeAttributes extends Partial<LinkPickerAnalyticsContextType>>(event: React.ChangeEvent<HTMLInputElement>, attributes: OnChangeAttributes) => OnChangeAttributes) => React.ComponentType<P>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const genericErrorStyles: import("@emotion/react").SerializedStyles;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { LinkPickerPlugin, LinkPickerPluginErrorFallback, LinkPickerState, LinkSearchListItemData } from '../../ui/types';
|
|
2
|
+
export interface LinkPickerPluginsService {
|
|
3
|
+
items: LinkSearchListItemData[] | null;
|
|
4
|
+
isLoading: boolean;
|
|
5
|
+
isActivePlugin: boolean;
|
|
6
|
+
activePlugin?: LinkPickerPlugin;
|
|
7
|
+
tabs: {
|
|
8
|
+
tabTitle: string;
|
|
9
|
+
}[];
|
|
10
|
+
error: unknown | null;
|
|
11
|
+
retry: () => void;
|
|
12
|
+
errorFallback?: LinkPickerPluginErrorFallback;
|
|
13
|
+
}
|
|
14
|
+
export declare function usePlugins(state: LinkPickerState | null, activeTab: number, plugins?: LinkPickerPlugin[]): LinkPickerPluginsService;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { LinkSearchListItemData } from '../../ui/types';
|
|
3
|
+
export interface PluginState {
|
|
4
|
+
items: LinkSearchListItemData[] | null;
|
|
5
|
+
error: unknown | null;
|
|
6
|
+
isLoading: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const ACTION_CLEAR = "CLEAR";
|
|
9
|
+
export declare const ACTION_LOADING = "LOADING";
|
|
10
|
+
export declare const ACTION_SUCCESS = "SUCCESS";
|
|
11
|
+
export declare const ACTION_ERRORED = "ERROR";
|
|
12
|
+
interface ClearAction {
|
|
13
|
+
type: typeof ACTION_CLEAR;
|
|
14
|
+
}
|
|
15
|
+
interface ResolveLoadingAction {
|
|
16
|
+
type: typeof ACTION_LOADING;
|
|
17
|
+
}
|
|
18
|
+
interface ResolveSuccessAction {
|
|
19
|
+
type: typeof ACTION_SUCCESS;
|
|
20
|
+
payload: Pick<PluginState, 'items' | 'isLoading'>;
|
|
21
|
+
}
|
|
22
|
+
interface ResolveErrorAction {
|
|
23
|
+
type: typeof ACTION_ERRORED;
|
|
24
|
+
payload: PluginState['error'];
|
|
25
|
+
}
|
|
26
|
+
export declare type ReducerAction = ClearAction | ResolveLoadingAction | ResolveSuccessAction | ResolveErrorAction;
|
|
27
|
+
export declare const INITIAL_STATE: PluginState;
|
|
28
|
+
export declare function reducer(state: PluginState, action: ReducerAction): PluginState;
|
|
29
|
+
export declare const usePluginReducer: () => [
|
|
30
|
+
PluginState,
|
|
31
|
+
import("react").Dispatch<ReducerAction>
|
|
32
|
+
];
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { LinkPickerPlugin, LinkPickerState, ResolveResult } from '../../ui/types';
|
|
2
|
+
export declare class CancellationError extends Error {
|
|
3
|
+
}
|
|
4
|
+
export declare const cancellable: <T extends unknown>(promise: Promise<T>) => {
|
|
5
|
+
promise: Promise<T>;
|
|
6
|
+
cancel: () => void;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Wraps the resolve with a cancellation wrapper and makes promise + generator plugin resolves more compatible
|
|
10
|
+
* Calling cancel for generator plugin prevents it from yielding any further updates
|
|
11
|
+
*/
|
|
12
|
+
export declare const resolvePluginUpdates: (plugin: LinkPickerPlugin, state: LinkPickerState) => {
|
|
13
|
+
cancel: () => void;
|
|
14
|
+
next: () => Promise<{
|
|
15
|
+
done?: boolean;
|
|
16
|
+
value: ResolveResult;
|
|
17
|
+
}>;
|
|
18
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React, { Component, ReactNode } from 'react';
|
|
2
|
+
import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
3
|
+
declare type ErrorBoundaryErrorInfo = {
|
|
4
|
+
componentStack: string;
|
|
5
|
+
};
|
|
6
|
+
export interface ErrorBoundaryProps extends WithAnalyticsEventsProps {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
channel: string;
|
|
9
|
+
ErrorComponent?: React.ComponentType;
|
|
10
|
+
onError?: (error: Error, info?: ErrorBoundaryErrorInfo) => void;
|
|
11
|
+
}
|
|
12
|
+
declare type ErrorBoundaryPayload = {
|
|
13
|
+
error: Error | string;
|
|
14
|
+
info?: ErrorBoundaryErrorInfo;
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
};
|
|
17
|
+
declare type ErrorBoundaryState = {
|
|
18
|
+
hasError: boolean;
|
|
19
|
+
};
|
|
20
|
+
export declare class BaseErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
21
|
+
constructor(props: ErrorBoundaryProps);
|
|
22
|
+
fireAnalytics: (analyticsErrorPayload: ErrorBoundaryPayload) => void;
|
|
23
|
+
componentDidCatch(error: Error, info?: ErrorBoundaryErrorInfo): void;
|
|
24
|
+
render(): React.ReactNode;
|
|
25
|
+
}
|
|
26
|
+
declare const ErrorBoundary: React.ForwardRefExoticComponent<Omit<ErrorBoundaryProps, keyof WithAnalyticsEventsProps> & React.RefAttributes<any>>;
|
|
27
|
+
export default ErrorBoundary;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PackageMetaDataType } from '../analytics.codegen';
|
|
3
|
+
import { LinkPickerProps } from './link-picker';
|
|
4
|
+
export declare const PACKAGE_DATA: PackageMetaDataType;
|
|
5
|
+
export declare const ComposedLinkPicker: React.MemoExoticComponent<(props: LinkPickerProps) => JSX.Element>;
|
|
@@ -0,0 +1,22 @@
|
|
|
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;
|
|
@@ -0,0 +1,15 @@
|
|
|
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 };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/** @jsx jsx */
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
4
|
+
export declare const testIds: {
|
|
5
|
+
readonly insertButton: "link-picker-insert-button";
|
|
6
|
+
readonly cancelButton: "link-picker-cancel-button";
|
|
7
|
+
};
|
|
8
|
+
interface FormFooterProps extends React.HTMLAttributes<HTMLElement> {
|
|
9
|
+
isEditing?: boolean;
|
|
10
|
+
onCancel?: () => void;
|
|
11
|
+
}
|
|
12
|
+
declare const _default: import("react").MemoExoticComponent<({ isEditing, onCancel, ...restProps }: FormFooterProps) => jsx.JSX.Element>;
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const formFooterStyles: import("@emotion/react").SerializedStyles;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
3
|
+
import { LinkInputType, LinkPickerPlugin } from '../types';
|
|
4
|
+
export declare const RECENT_SEARCH_LIST_SIZE = 5;
|
|
5
|
+
export declare const testIds: {
|
|
6
|
+
readonly clearUrlButton: "clear-text";
|
|
7
|
+
readonly urlError: "link-error";
|
|
8
|
+
readonly tabList: "link-picker-tabs";
|
|
9
|
+
readonly tabItem: "link-picker-tab";
|
|
10
|
+
readonly resultListTitle: string;
|
|
11
|
+
readonly searchResultItem: string;
|
|
12
|
+
readonly searchResultList: string;
|
|
13
|
+
readonly searchResultLoadingIndicator: string;
|
|
14
|
+
readonly emptyResultPage: string;
|
|
15
|
+
readonly searchError: string;
|
|
16
|
+
readonly insertButton: "link-picker-insert-button";
|
|
17
|
+
readonly cancelButton: "link-picker-cancel-button";
|
|
18
|
+
readonly linkPicker: "link-picker";
|
|
19
|
+
readonly urlInputField: "link-url";
|
|
20
|
+
readonly textInputField: "link-text";
|
|
21
|
+
readonly searchIcon: "link-picker-search-icon";
|
|
22
|
+
};
|
|
23
|
+
interface Meta {
|
|
24
|
+
/** Indicates how the link was picked. */
|
|
25
|
+
inputMethod: LinkInputType;
|
|
26
|
+
}
|
|
27
|
+
interface OnSubmitParameter {
|
|
28
|
+
/** The `url` of the linked resource. */
|
|
29
|
+
url: string;
|
|
30
|
+
/** The desired text to be displayed alternatively to the title of the linked resource. */
|
|
31
|
+
displayText: string | null;
|
|
32
|
+
/** The resolved `title` of the resource at the time of link picking (if applicable, null if not known). */
|
|
33
|
+
title: string | null;
|
|
34
|
+
/** Meta data about the link picking submission. */
|
|
35
|
+
meta: Meta;
|
|
36
|
+
/**
|
|
37
|
+
* The input value of the `url` field at time of submission if inserted "manually".
|
|
38
|
+
* This can useful if the `url` was manually inserted with a value that is different from the normalised value returned as `url`.
|
|
39
|
+
* @example
|
|
40
|
+
* { url: 'https://google.com', rawUrl: 'google.com' }
|
|
41
|
+
*/
|
|
42
|
+
rawUrl?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface LinkPickerProps {
|
|
45
|
+
/**
|
|
46
|
+
* Callback to fire on form submission.
|
|
47
|
+
*/
|
|
48
|
+
onSubmit: (arg: OnSubmitParameter, analytic?: UIAnalyticsEvent | null) => void;
|
|
49
|
+
/** Callback to fire when the cancel button is clicked. */
|
|
50
|
+
onCancel: () => void;
|
|
51
|
+
/** Callback to fire when content is changed inside the link picker e.g. items, when loading, tabs */
|
|
52
|
+
onContentResize?: () => void;
|
|
53
|
+
/** The url of the linked resource for editing. */
|
|
54
|
+
url?: string;
|
|
55
|
+
/** The desired text to be displayed alternatively to the title of the linked resource for editing. */
|
|
56
|
+
displayText?: string | null;
|
|
57
|
+
/** Plugins that provide link suggestions / search capabilities. */
|
|
58
|
+
plugins?: LinkPickerPlugin[];
|
|
59
|
+
}
|
|
60
|
+
export interface PickerState {
|
|
61
|
+
selectedIndex: number;
|
|
62
|
+
activeIndex: number;
|
|
63
|
+
url: string;
|
|
64
|
+
displayText: string;
|
|
65
|
+
invalidUrl: boolean;
|
|
66
|
+
activeTab: number;
|
|
67
|
+
}
|
|
68
|
+
declare const _default: import("react").ComponentType<LinkPickerProps>;
|
|
69
|
+
export default _default;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
export declare const CONTACT_SUPPORT_LINK = "https://support.atlassian.com/contact/";
|
|
4
|
+
export declare const messages: {
|
|
5
|
+
searchErrorHeader: {
|
|
6
|
+
id: string;
|
|
7
|
+
defaultMessage: string;
|
|
8
|
+
description: string;
|
|
9
|
+
};
|
|
10
|
+
searchErrorDescription: {
|
|
11
|
+
id: string;
|
|
12
|
+
defaultMessage: string;
|
|
13
|
+
description: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export declare const testIds: {
|
|
17
|
+
searchError: string;
|
|
18
|
+
};
|
|
19
|
+
declare const LinkSearchError: () => jsx.JSX.Element;
|
|
20
|
+
export default LinkSearchError;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { LinkSearchListItemData } from '../../types';
|
|
3
|
+
export declare const messages: {
|
|
4
|
+
titleRecentlyViewed: {
|
|
5
|
+
id: string;
|
|
6
|
+
defaultMessage: string;
|
|
7
|
+
description: string;
|
|
8
|
+
};
|
|
9
|
+
titleResults: {
|
|
10
|
+
id: string;
|
|
11
|
+
defaultMessage: string;
|
|
12
|
+
description: string;
|
|
13
|
+
};
|
|
14
|
+
searchLinkResults: {
|
|
15
|
+
id: string;
|
|
16
|
+
defaultMessage: string;
|
|
17
|
+
description: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export declare const testIds: {
|
|
21
|
+
resultListTitle: string;
|
|
22
|
+
searchResultItem: string;
|
|
23
|
+
searchResultList: string;
|
|
24
|
+
searchResultLoadingIndicator: string;
|
|
25
|
+
emptyResultPage: string;
|
|
26
|
+
};
|
|
27
|
+
export interface LinkSearchListProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect' | 'onMouseEnter' | 'onMouseLeave'> {
|
|
28
|
+
items?: LinkSearchListItemData[] | null;
|
|
29
|
+
isLoading: boolean;
|
|
30
|
+
selectedIndex: number;
|
|
31
|
+
activeIndex: number;
|
|
32
|
+
onSelect: (objectId: string) => void;
|
|
33
|
+
onMouseEnter: (objectId: string) => void;
|
|
34
|
+
onMouseLeave: (objectId: string) => void;
|
|
35
|
+
ariaControls?: string;
|
|
36
|
+
ariaLabelledBy?: string;
|
|
37
|
+
role?: string;
|
|
38
|
+
id?: string;
|
|
39
|
+
error?: unknown;
|
|
40
|
+
hasSearchTerm?: boolean;
|
|
41
|
+
}
|
|
42
|
+
declare const LinkSearchList: import("react").ForwardRefExoticComponent<LinkSearchListProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
43
|
+
export default LinkSearchList;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
export declare const messages: {
|
|
4
|
+
noResults: {
|
|
5
|
+
id: string;
|
|
6
|
+
defaultMessage: string;
|
|
7
|
+
description: string;
|
|
8
|
+
};
|
|
9
|
+
noResultsDescription: {
|
|
10
|
+
id: string;
|
|
11
|
+
defaultMessage: string;
|
|
12
|
+
description: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export declare const testIds: {
|
|
16
|
+
emptyResultPage: string;
|
|
17
|
+
};
|
|
18
|
+
declare const NoResults: () => jsx.JSX.Element;
|
|
19
|
+
export default NoResults;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const noResultsSVGStyles: import("@emotion/react").SerializedStyles;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const emptyStateWrapperStyles: import("@emotion/react").SerializedStyles;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const listContainerStyles: import("@emotion/react").SerializedStyles;
|
|
2
|
+
export declare const spinnerContainerStyles: import("@emotion/react").SerializedStyles;
|
|
3
|
+
export declare const listStyles: import("@emotion/react").SerializedStyles;
|
|
4
|
+
export declare const listTitleStyles: import("@emotion/react").SerializedStyles;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { WrappedComponentProps } from 'react-intl-next';
|
|
3
|
+
import { LinkSearchListItemData } from '../../types';
|
|
4
|
+
export interface Props {
|
|
5
|
+
item: LinkSearchListItemData;
|
|
6
|
+
selected: boolean;
|
|
7
|
+
active: boolean;
|
|
8
|
+
onSelect: (objectId: string) => void;
|
|
9
|
+
onMouseEnter: (objectId: string) => void;
|
|
10
|
+
onMouseLeave: (objectId: string) => void;
|
|
11
|
+
id?: string;
|
|
12
|
+
role?: string;
|
|
13
|
+
}
|
|
14
|
+
declare const _default: import("react").FC<import("react-intl-next").WithIntlProps<WrappedComponentProps<"intl"> & Props>> & {
|
|
15
|
+
WrappedComponent: import("react").ComponentType<WrappedComponentProps<"intl"> & Props>;
|
|
16
|
+
};
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,9 @@
|
|
|
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 listItemContainerStyles: import("@emotion/react").SerializedStyles;
|
|
7
|
+
export declare const listItemContainerInnerStyles: import("@emotion/react").SerializedStyles;
|
|
8
|
+
export declare const itemIconStyles: import("@emotion/react").SerializedStyles;
|
|
9
|
+
export declare const imgStyles: import("@emotion/react").SerializedStyles;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
export declare const searchMessages: {
|
|
2
|
+
linkLabel: {
|
|
3
|
+
id: string;
|
|
4
|
+
defaultMessage: string;
|
|
5
|
+
description: string;
|
|
6
|
+
};
|
|
7
|
+
linkAriaLabel: {
|
|
8
|
+
id: string;
|
|
9
|
+
defaultMessage: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
linkPlaceholder: {
|
|
13
|
+
id: string;
|
|
14
|
+
defaultMessage: string;
|
|
15
|
+
description: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export declare const linkMessages: {
|
|
19
|
+
linkLabel: {
|
|
20
|
+
id: string;
|
|
21
|
+
defaultMessage: string;
|
|
22
|
+
description: string;
|
|
23
|
+
};
|
|
24
|
+
linkAriaLabel: {
|
|
25
|
+
id: string;
|
|
26
|
+
defaultMessage: string;
|
|
27
|
+
description: string;
|
|
28
|
+
};
|
|
29
|
+
linkPlaceholder: {
|
|
30
|
+
id: string;
|
|
31
|
+
defaultMessage: string;
|
|
32
|
+
description: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export declare const formMessages: {
|
|
36
|
+
linkInvalid: {
|
|
37
|
+
id: string;
|
|
38
|
+
defaultMessage: string;
|
|
39
|
+
description: string;
|
|
40
|
+
};
|
|
41
|
+
clearLink: {
|
|
42
|
+
id: string;
|
|
43
|
+
defaultMessage: string;
|
|
44
|
+
description: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
export declare const linkTextMessages: {
|
|
48
|
+
linkTextLabel: {
|
|
49
|
+
id: string;
|
|
50
|
+
defaultMessage: string;
|
|
51
|
+
description: string;
|
|
52
|
+
};
|
|
53
|
+
linkTextAriaLabel: {
|
|
54
|
+
id: string;
|
|
55
|
+
defaultMessage: string;
|
|
56
|
+
description: string;
|
|
57
|
+
};
|
|
58
|
+
linkTextPlaceholder: {
|
|
59
|
+
id: string;
|
|
60
|
+
defaultMessage: string;
|
|
61
|
+
description: string;
|
|
62
|
+
};
|
|
63
|
+
clearLinkText: {
|
|
64
|
+
id: string;
|
|
65
|
+
defaultMessage: string;
|
|
66
|
+
description: string;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
export declare const messages: {
|
|
70
|
+
timeUpdated: {
|
|
71
|
+
id: string;
|
|
72
|
+
defaultMessage: string;
|
|
73
|
+
description: string;
|
|
74
|
+
};
|
|
75
|
+
timeViewed: {
|
|
76
|
+
id: string;
|
|
77
|
+
defaultMessage: string;
|
|
78
|
+
description: string;
|
|
79
|
+
};
|
|
80
|
+
timeAgo: {
|
|
81
|
+
id: string;
|
|
82
|
+
defaultMessage: string;
|
|
83
|
+
description: string;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Half padding on the top as the form field has a `gridSize()` margin top that cannot be overridden
|
|
3
|
+
*/
|
|
4
|
+
export declare const rootContainerStyles: import("@emotion/react").SerializedStyles;
|
|
5
|
+
export declare const rootContainerStylesForLoader: import("@emotion/react").SerializedStyles;
|
|
6
|
+
export declare const searchIconStyles: import("@emotion/react").SerializedStyles;
|
|
7
|
+
export declare const tabsWrapperStyles: import("@emotion/react").SerializedStyles;
|
|
8
|
+
export declare const flexColumnStyles: import("@emotion/react").SerializedStyles;
|
|
9
|
+
export declare const formFooterMargin: import("@emotion/react").SerializedStyles;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx } from '@emotion/react';
|
|
2
|
+
import { TextFieldProps } from '@atlaskit/textfield';
|
|
3
|
+
export declare type TextInputProps = Omit<TextFieldProps, 'name' | 'value'> & {
|
|
4
|
+
name: string;
|
|
5
|
+
value: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
onUndo?: Function;
|
|
8
|
+
onRedo?: Function;
|
|
9
|
+
onClear?: (name: string) => void;
|
|
10
|
+
clearLabel?: string;
|
|
11
|
+
error?: string | null;
|
|
12
|
+
};
|
|
13
|
+
declare const TextInput: ({ name, label, autoFocus, onRedo, onUndo, onKeyDown, onClear, clearLabel, error, ...restProps }: TextInputProps) => jsx.JSX.Element;
|
|
14
|
+
export default TextInput;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { KeyboardEvent } from 'react';
|
|
2
|
+
import { IntlShape } from 'react-intl-next';
|
|
3
|
+
import { LinkPickerPlugin, LinkSearchListItemData } from '../types';
|
|
4
|
+
export declare const isUndoEvent: (e: KeyboardEvent<HTMLInputElement>) => boolean;
|
|
5
|
+
export declare const isRedoEvent: (e: KeyboardEvent<HTMLInputElement>) => boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Retrieve the data source for a link given the item and the plugin that resolved it
|
|
8
|
+
*/
|
|
9
|
+
export declare const getDataSource: (item: LinkSearchListItemData, plugin?: LinkPickerPlugin | undefined) => string;
|
|
10
|
+
export declare function getScreenReaderText(items: LinkSearchListItemData[], selectedIndex: number, intl: IntlShape): string | undefined;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ReactNode } from '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
|
+
/** Metadata about the result */
|
|
26
|
+
meta?: {
|
|
27
|
+
/** The data source that provided the result */
|
|
28
|
+
source?: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export declare type ListItemTimeStamp = {
|
|
32
|
+
pageAction: string;
|
|
33
|
+
dateString: string;
|
|
34
|
+
timeSince?: string | undefined;
|
|
35
|
+
};
|
|
36
|
+
export interface LinkPickerState {
|
|
37
|
+
/** Current query string / URL input field value */
|
|
38
|
+
query: string;
|
|
39
|
+
}
|
|
40
|
+
export interface ResolveResult {
|
|
41
|
+
data: LinkSearchListItemData[];
|
|
42
|
+
}
|
|
43
|
+
export interface LinkPickerPlugin {
|
|
44
|
+
resolve: (state: LinkPickerState) => Promise<ResolveResult> | AsyncGenerator<ResolveResult, ResolveResult>;
|
|
45
|
+
/** Uniquely identify the tab */
|
|
46
|
+
tabKey?: string;
|
|
47
|
+
/** Human-readable label for the plugin */
|
|
48
|
+
tabTitle?: string;
|
|
49
|
+
/** Render function to customise the UI that is displayed when an error occurs resolving results */
|
|
50
|
+
errorFallback?: LinkPickerPluginErrorFallback;
|
|
51
|
+
/** Metadata about the plugin */
|
|
52
|
+
meta?: {
|
|
53
|
+
/** The data source that provides all results provided by the plugin */
|
|
54
|
+
source?: string;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
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.10.
|
|
3
|
+
"version": "1.10.3",
|
|
4
4
|
"description": "Standalone link picker",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"publishConfig": {
|
|
@@ -20,6 +20,13 @@
|
|
|
20
20
|
"module": "dist/esm/index.js",
|
|
21
21
|
"module:es2019": "dist/es2019/index.js",
|
|
22
22
|
"types": "dist/types/index.d.ts",
|
|
23
|
+
"typesVersions": {
|
|
24
|
+
">=4.0 <4.5": {
|
|
25
|
+
"*": [
|
|
26
|
+
"dist/types-ts4.0/*"
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
},
|
|
23
30
|
"sideEffects": false,
|
|
24
31
|
"atlaskit:src": "src/index.ts",
|
|
25
32
|
"af:exports": {
|
|
@@ -72,8 +79,8 @@
|
|
|
72
79
|
"@testing-library/dom": "^8.17.1",
|
|
73
80
|
"@testing-library/jest-dom": "^5.16.5",
|
|
74
81
|
"@testing-library/react": "^12.1.5",
|
|
75
|
-
"@testing-library/react-hooks": "^
|
|
76
|
-
"@testing-library/user-event": "^
|
|
82
|
+
"@testing-library/react-hooks": "^8.0.1",
|
|
83
|
+
"@testing-library/user-event": "^14.4.3",
|
|
77
84
|
"@types/js-yaml": "^3.12.5",
|
|
78
85
|
"enzyme": "^3.10.0",
|
|
79
86
|
"fetch-mock": "^8.0.0",
|
|
@@ -83,7 +90,7 @@
|
|
|
83
90
|
"prettier": "^2.1.1",
|
|
84
91
|
"react-dom": "^16.8.0",
|
|
85
92
|
"sinon": "^2.2.0",
|
|
86
|
-
"typescript": "4.
|
|
93
|
+
"typescript": "4.5.5"
|
|
87
94
|
},
|
|
88
95
|
"techstack": {
|
|
89
96
|
"@repo/internal": {
|
package/report.api.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
## API Report File for "@atlaskit/link-picker"
|
|
1
|
+
## API Report File for "@atlaskit/link-picker"
|
|
2
2
|
|
|
3
|
-
> Do not edit this file.
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
<!--
|
|
6
|
+
Generated API Report version: 2.0
|
|
7
|
+
-->
|
|
4
8
|
|
|
5
9
|
[Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
|
|
6
10
|
|
|
@@ -12,115 +16,91 @@ import { default as React_2 } from 'react';
|
|
|
12
16
|
import { ReactNode } from 'react';
|
|
13
17
|
import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
14
18
|
|
|
15
|
-
|
|
19
|
+
// @public (undocumented)
|
|
20
|
+
export type LinkInputType = 'manual' | 'typeAhead';
|
|
16
21
|
|
|
17
|
-
|
|
22
|
+
// @public (undocumented)
|
|
23
|
+
export const LinkPicker: React_2.MemoExoticComponent<(
|
|
18
24
|
props: LinkPickerProps,
|
|
19
25
|
) => JSX.Element>;
|
|
20
26
|
|
|
21
|
-
|
|
27
|
+
// @public (undocumented)
|
|
28
|
+
export interface LinkPickerPlugin {
|
|
29
|
+
errorFallback?: LinkPickerPluginErrorFallback;
|
|
30
|
+
meta?: {
|
|
31
|
+
source?: string;
|
|
32
|
+
};
|
|
33
|
+
// (undocumented)
|
|
22
34
|
resolve: (
|
|
23
35
|
state: LinkPickerState,
|
|
24
36
|
) => Promise<ResolveResult> | AsyncGenerator<ResolveResult, ResolveResult>;
|
|
25
|
-
/** Uniquely identify the tab */
|
|
26
37
|
tabKey?: string;
|
|
27
|
-
/** Human-readable label for the plugin */
|
|
28
38
|
tabTitle?: string;
|
|
29
|
-
/** Render function to customise the UI that is displayed when an error occurs resolving results */
|
|
30
|
-
errorFallback?: LinkPickerPluginErrorFallback;
|
|
31
|
-
/** Metadata about the plugin */
|
|
32
|
-
meta?: {
|
|
33
|
-
/** The data source that provides all results provided by the plugin */
|
|
34
|
-
source?: string;
|
|
35
|
-
};
|
|
36
39
|
}
|
|
37
40
|
|
|
38
|
-
|
|
41
|
+
// @public (undocumented)
|
|
42
|
+
export type LinkPickerPluginErrorFallback = (
|
|
39
43
|
error: unknown,
|
|
40
44
|
retry: () => void,
|
|
41
45
|
) => ReactNode;
|
|
42
46
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
// @public (undocumented)
|
|
48
|
+
export interface LinkPickerProps {
|
|
49
|
+
displayText?: string | null;
|
|
50
|
+
onCancel: () => void;
|
|
51
|
+
onContentResize?: () => void;
|
|
47
52
|
onSubmit: (
|
|
48
53
|
arg: OnSubmitParameter,
|
|
49
54
|
analytic?: UIAnalyticsEvent | null,
|
|
50
55
|
) => void;
|
|
51
|
-
/** Callback to fire when the cancel button is clicked. */
|
|
52
|
-
onCancel: () => void;
|
|
53
|
-
/** Callback to fire when content is changed inside the link picker e.g. items, when loading, tabs */
|
|
54
|
-
onContentResize?: () => void;
|
|
55
|
-
/** The url of the linked resource for editing. */
|
|
56
|
-
url?: string;
|
|
57
|
-
/** The desired text to be displayed alternatively to the title of the linked resource for editing. */
|
|
58
|
-
displayText?: string | null;
|
|
59
|
-
/** Plugins that provide link suggestions / search capabilities. */
|
|
60
56
|
plugins?: LinkPickerPlugin[];
|
|
57
|
+
url?: string;
|
|
61
58
|
}
|
|
62
59
|
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
// @public (undocumented)
|
|
61
|
+
export interface LinkPickerState {
|
|
65
62
|
query: string;
|
|
66
63
|
}
|
|
67
64
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
/** Name / title / display text of the link */
|
|
72
|
-
name: string;
|
|
73
|
-
/** URL of the resource being linked to */
|
|
74
|
-
url: string;
|
|
75
|
-
/** Icon to display in link result */
|
|
65
|
+
// @public (undocumented)
|
|
66
|
+
export interface LinkSearchListItemData {
|
|
67
|
+
container?: string;
|
|
76
68
|
icon:
|
|
77
69
|
| string
|
|
78
70
|
| React.ComponentType<{
|
|
79
71
|
alt: string;
|
|
80
72
|
}>;
|
|
81
|
-
/** Alt text describing the icon */
|
|
82
73
|
iconAlt: string | MessageDescriptor;
|
|
83
|
-
/** Context to display in link result */
|
|
84
|
-
container?: string;
|
|
85
|
-
/** Optional last view date to display in link result */
|
|
86
|
-
lastViewedDate?: Date;
|
|
87
|
-
/** Optional last updated date to display in link result */
|
|
88
74
|
lastUpdatedDate?: Date;
|
|
89
|
-
|
|
90
|
-
prefetch?: boolean;
|
|
91
|
-
/** Metadata about the result */
|
|
75
|
+
lastViewedDate?: Date;
|
|
92
76
|
meta?: {
|
|
93
|
-
/** The data source that provided the result */
|
|
94
77
|
source?: string;
|
|
95
78
|
};
|
|
79
|
+
name: string;
|
|
80
|
+
objectId: string;
|
|
81
|
+
prefetch?: boolean;
|
|
82
|
+
url: string;
|
|
96
83
|
}
|
|
97
84
|
|
|
98
|
-
|
|
99
|
-
|
|
85
|
+
// @public (undocumented)
|
|
86
|
+
interface Meta {
|
|
100
87
|
inputMethod: LinkInputType;
|
|
101
88
|
}
|
|
102
89
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
url: string;
|
|
106
|
-
/** The desired text to be displayed alternatively to the title of the linked resource. */
|
|
90
|
+
// @public (undocumented)
|
|
91
|
+
interface OnSubmitParameter {
|
|
107
92
|
displayText: string | null;
|
|
108
|
-
/** The resolved `title` of the resource at the time of link picking (if applicable, null if not known). */
|
|
109
|
-
title: string | null;
|
|
110
|
-
/** Meta data about the link picking submission. */
|
|
111
93
|
meta: Meta;
|
|
112
|
-
/**
|
|
113
|
-
* The input value of the `url` field at time of submission if inserted "manually".
|
|
114
|
-
* This can useful if the `url` was manually inserted with a value that is different from the normalised value returned as `url`.
|
|
115
|
-
* @example
|
|
116
|
-
* { url: 'https://google.com', rawUrl: 'google.com' }
|
|
117
|
-
*/
|
|
118
94
|
rawUrl?: string;
|
|
95
|
+
title: string | null;
|
|
96
|
+
url: string;
|
|
119
97
|
}
|
|
120
98
|
|
|
121
|
-
|
|
99
|
+
// @public (undocumented)
|
|
100
|
+
interface ResolveResult {
|
|
101
|
+
// (undocumented)
|
|
122
102
|
data: LinkSearchListItemData[];
|
|
123
103
|
}
|
|
124
104
|
|
|
125
|
-
|
|
105
|
+
// (No @packageDocumentation comment for this package)
|
|
126
106
|
```
|