@atlaskit/mention 22.1.1 → 22.1.2
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/version.json +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types-ts4.5/_constants.d.ts +1 -0
- package/dist/types-ts4.5/api/ContextMentionResource.d.ts +23 -0
- package/dist/types-ts4.5/api/MentionNameClient.d.ts +11 -0
- package/dist/types-ts4.5/api/MentionNameResolver.d.ts +23 -0
- package/dist/types-ts4.5/api/MentionResource.d.ts +93 -0
- package/dist/types-ts4.5/api/PresenceResource.d.ts +119 -0
- package/dist/types-ts4.5/api/TeamMentionResource.d.ts +33 -0
- package/dist/types-ts4.5/api/analytics.d.ts +17 -0
- package/dist/types-ts4.5/components/LockCircleIcon/index.d.ts +3 -0
- package/dist/types-ts4.5/components/Mention/PrimitiveMention.d.ts +7 -0
- package/dist/types-ts4.5/components/Mention/ResourcedMention.d.ts +27 -0
- package/dist/types-ts4.5/components/Mention/index.d.ts +31 -0
- package/dist/types-ts4.5/components/Mention/ufoExperiences.d.ts +9 -0
- package/dist/types-ts4.5/components/MentionDescriptionByline/TeamMentionDescriptionByline.d.ts +7 -0
- package/dist/types-ts4.5/components/MentionDescriptionByline/UserMentionDescriptionByline.d.ts +5 -0
- package/dist/types-ts4.5/components/MentionDescriptionByline/index.d.ts +5 -0
- package/dist/types-ts4.5/components/MentionDescriptionByline/styles.d.ts +5 -0
- package/dist/types-ts4.5/components/MentionDescriptionByline/types.d.ts +4 -0
- package/dist/types-ts4.5/components/MentionItem/MentionHighlightHelpers.d.ts +3 -0
- package/dist/types-ts4.5/components/MentionItem/index.d.ts +16 -0
- package/dist/types-ts4.5/components/MentionItem/styles.d.ts +46 -0
- package/dist/types-ts4.5/components/MentionList/index.d.ts +41 -0
- package/dist/types-ts4.5/components/MentionList/styles.d.ts +8 -0
- package/dist/types-ts4.5/components/MentionListError/GenericErrorIllustration.d.ts +7 -0
- package/dist/types-ts4.5/components/MentionListError/index.d.ts +13 -0
- package/dist/types-ts4.5/components/MentionListError/styles.d.ts +17 -0
- package/dist/types-ts4.5/components/MentionPicker/index.d.ts +77 -0
- package/dist/types-ts4.5/components/MentionPicker/styles.d.ts +12 -0
- package/dist/types-ts4.5/components/MessagesIntlProvider/index.d.ts +3 -0
- package/dist/types-ts4.5/components/NoAccessTooltip/index.d.ts +6 -0
- package/dist/types-ts4.5/components/NoAccessTooltip/main.d.ts +7 -0
- package/dist/types-ts4.5/components/Popup/index.d.ts +26 -0
- package/dist/types-ts4.5/components/ResourcedMentionList/index.d.ts +46 -0
- package/dist/types-ts4.5/components/Scrollable/index.d.ts +11 -0
- package/dist/types-ts4.5/components/Scrollable/styles.d.ts +5 -0
- package/dist/types-ts4.5/components/i18n.d.ts +57 -0
- package/dist/types-ts4.5/config/index.d.ts +5 -0
- package/dist/types-ts4.5/element.d.ts +3 -0
- package/dist/types-ts4.5/i18n/cs.d.ts +20 -0
- package/dist/types-ts4.5/i18n/da.d.ts +20 -0
- package/dist/types-ts4.5/i18n/de.d.ts +20 -0
- package/dist/types-ts4.5/i18n/en.d.ts +20 -0
- package/dist/types-ts4.5/i18n/en_GB.d.ts +20 -0
- package/dist/types-ts4.5/i18n/en_ZZ.d.ts +24 -0
- package/dist/types-ts4.5/i18n/es.d.ts +20 -0
- package/dist/types-ts4.5/i18n/et.d.ts +20 -0
- package/dist/types-ts4.5/i18n/fi.d.ts +20 -0
- package/dist/types-ts4.5/i18n/fr.d.ts +20 -0
- package/dist/types-ts4.5/i18n/hu.d.ts +20 -0
- package/dist/types-ts4.5/i18n/index.d.ts +35 -0
- package/dist/types-ts4.5/i18n/is.d.ts +24 -0
- package/dist/types-ts4.5/i18n/it.d.ts +20 -0
- package/dist/types-ts4.5/i18n/ja.d.ts +20 -0
- package/dist/types-ts4.5/i18n/ko.d.ts +20 -0
- package/dist/types-ts4.5/i18n/languages.d.ts +33 -0
- package/dist/types-ts4.5/i18n/nb.d.ts +20 -0
- package/dist/types-ts4.5/i18n/nl.d.ts +20 -0
- package/dist/types-ts4.5/i18n/pl.d.ts +20 -0
- package/dist/types-ts4.5/i18n/pt_BR.d.ts +20 -0
- package/dist/types-ts4.5/i18n/pt_PT.d.ts +20 -0
- package/dist/types-ts4.5/i18n/ro.d.ts +24 -0
- package/dist/types-ts4.5/i18n/ru.d.ts +20 -0
- package/dist/types-ts4.5/i18n/sk.d.ts +20 -0
- package/dist/types-ts4.5/i18n/sv.d.ts +20 -0
- package/dist/types-ts4.5/i18n/th.d.ts +20 -0
- package/dist/types-ts4.5/i18n/tr.d.ts +20 -0
- package/dist/types-ts4.5/i18n/uk.d.ts +20 -0
- package/dist/types-ts4.5/i18n/vi.d.ts +20 -0
- package/dist/types-ts4.5/i18n/zh.d.ts +20 -0
- package/dist/types-ts4.5/i18n/zh_TW.d.ts +20 -0
- package/dist/types-ts4.5/i18n.d.ts +1 -0
- package/dist/types-ts4.5/index.d.ts +17 -0
- package/dist/types-ts4.5/item.d.ts +2 -0
- package/dist/types-ts4.5/resource.d.ts +10 -0
- package/dist/types-ts4.5/shared-styles.d.ts +5 -0
- package/dist/types-ts4.5/team-resource.d.ts +8 -0
- package/dist/types-ts4.5/typeahead.d.ts +3 -0
- package/dist/types-ts4.5/types.d.ts +168 -0
- package/dist/types-ts4.5/util/analytics.d.ts +30 -0
- package/dist/types-ts4.5/util/i18n.d.ts +29 -0
- package/dist/types-ts4.5/util/id.d.ts +2 -0
- package/dist/types-ts4.5/util/index.d.ts +1 -0
- package/dist/types-ts4.5/util/logger.d.ts +4 -0
- package/dist/types-ts4.5/util/mouse.d.ts +8 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/dist/cjs/version.json
CHANGED
package/dist/es2019/version.json
CHANGED
package/dist/esm/version.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ELEMENTS_CHANNEL = "fabric-elements";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { MentionProvider, MentionContextIdentifier, ErrorCallback, InfoCallback, ResultCallback } from './MentionResource';
|
|
2
|
+
import { MentionDescription, InviteFromMentionProvider } from '../types';
|
|
3
|
+
export type { MentionDescription };
|
|
4
|
+
export type MentionProviderFunctions = Omit<{
|
|
5
|
+
[Key in keyof MentionProvider]: MentionProvider[Key] extends Function ? MentionProvider[Key] : never;
|
|
6
|
+
}, keyof InviteFromMentionProvider>;
|
|
7
|
+
/**
|
|
8
|
+
* This component is stateful and should be instantianted per contextIdentifiers.
|
|
9
|
+
*/
|
|
10
|
+
export default class ContextMentionResource implements MentionProvider {
|
|
11
|
+
private mentionProvider;
|
|
12
|
+
private contextIdentifier;
|
|
13
|
+
constructor(mentionProvider: MentionProvider, contextIdentifier: MentionContextIdentifier);
|
|
14
|
+
getContextIdentifier(): MentionContextIdentifier | undefined;
|
|
15
|
+
callWithContextIds: <K extends "subscribe" | "unsubscribe" | "filter" | "recordMentionSelection" | "shouldHighlightMention" | "isFiltering">(f: K, declaredArgs: number) => MentionProvider[K];
|
|
16
|
+
callDefault: <K extends "subscribe" | "unsubscribe" | "filter" | "recordMentionSelection" | "shouldHighlightMention" | "isFiltering">(f: K) => MentionProvider[K];
|
|
17
|
+
subscribe: (key: string, callback?: ResultCallback<MentionDescription[]> | undefined, errCallback?: ErrorCallback | undefined, infoCallback?: InfoCallback | undefined, allResultsCallback?: ResultCallback<MentionDescription[]> | undefined, analyticsCallback?: import("../types").AnalyticsCallback | undefined) => void;
|
|
18
|
+
unsubscribe: (key: string) => void;
|
|
19
|
+
filter: (query?: string | undefined, contextIdentifier?: MentionContextIdentifier | undefined) => void;
|
|
20
|
+
recordMentionSelection: (mention: MentionDescription, contextIdentifier?: MentionContextIdentifier | undefined) => void;
|
|
21
|
+
shouldHighlightMention: (mention: MentionDescription) => boolean;
|
|
22
|
+
isFiltering: (query: string) => boolean;
|
|
23
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { MentionNameDetails } from '../types';
|
|
2
|
+
export interface MentionNameClient {
|
|
3
|
+
getLookupLimit(): number;
|
|
4
|
+
lookupMentionNames(ids: string[]): Promise<MentionNameDetails[]>;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Supports the Atlassian Profile retrieval service.
|
|
8
|
+
*
|
|
9
|
+
* Uses:
|
|
10
|
+
* https://statlas.prod.atl-paas.net/swagger-ui-2.2.6/index.html?url=https://profile-retrieval-service.prod.atl-paas.net:443/api/swagger.yaml#!/default/getUsersByIds
|
|
11
|
+
*/
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
2
|
+
import { MentionNameDetails, MentionNameResolver } from '../types';
|
|
3
|
+
import { MentionNameClient } from './MentionNameClient';
|
|
4
|
+
export type { MentionNameResolver } from '../types';
|
|
5
|
+
export declare class DefaultMentionNameResolver implements MentionNameResolver {
|
|
6
|
+
static waitForBatch: number;
|
|
7
|
+
private client;
|
|
8
|
+
private nameCache;
|
|
9
|
+
private nameQueue;
|
|
10
|
+
private nameStartTime;
|
|
11
|
+
private processingQueue;
|
|
12
|
+
private debounce;
|
|
13
|
+
private fireHydrationEvent;
|
|
14
|
+
constructor(client: MentionNameClient, analyticsProps?: WithAnalyticsEventsProps);
|
|
15
|
+
lookupName(id: string): Promise<MentionNameDetails> | MentionNameDetails;
|
|
16
|
+
cacheName(id: string, name: string): void;
|
|
17
|
+
private scheduleProcessQueue;
|
|
18
|
+
private isQueueAtLimit;
|
|
19
|
+
private splitQueueAtLimit;
|
|
20
|
+
private resolveQueueItem;
|
|
21
|
+
private processQueue;
|
|
22
|
+
private fireAnalytics;
|
|
23
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { AnalyticsCallback, ErrorCallback, InfoCallback, InviteExperimentCohort, InviteFlow, MentionContextIdentifier, MentionDescription, MentionNameDetails, MentionProvider, MentionResourceConfig, MentionsResult, MentionStats, ResourceProvider, ResultCallback, UserRole } from '../types';
|
|
2
|
+
export type { MentionStats, ResultCallback, ErrorCallback, InfoCallback, MentionResourceConfig, ResourceProvider, MentionContextIdentifier, MentionProvider, } from '../types';
|
|
3
|
+
export interface TeamMentionResourceConfig extends MentionResourceConfig {
|
|
4
|
+
teamLinkResolver?: (teamId: string) => string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Support
|
|
8
|
+
*/
|
|
9
|
+
export interface ResolvingMentionProvider extends MentionProvider {
|
|
10
|
+
resolveMentionName(id: string): Promise<MentionNameDetails> | MentionNameDetails;
|
|
11
|
+
cacheMentionName(id: string, mentionName: string): void;
|
|
12
|
+
supportsMentionNameResolving(): boolean;
|
|
13
|
+
}
|
|
14
|
+
declare class AbstractResource<Result> implements ResourceProvider<Result> {
|
|
15
|
+
protected changeListeners: Map<string, ResultCallback<Result>>;
|
|
16
|
+
protected errListeners: Map<string, ErrorCallback>;
|
|
17
|
+
protected infoListeners: Map<string, InfoCallback>;
|
|
18
|
+
protected allResultsListeners: Map<string, ResultCallback<Result>>;
|
|
19
|
+
protected analyticsListeners: Map<string, AnalyticsCallback>;
|
|
20
|
+
constructor();
|
|
21
|
+
subscribe(key: string, callback?: ResultCallback<Result>, errCallback?: ErrorCallback, infoCallback?: InfoCallback, allResultsCallback?: ResultCallback<Result>, analyticsListeners?: AnalyticsCallback): void;
|
|
22
|
+
unsubscribe(key: string): void;
|
|
23
|
+
}
|
|
24
|
+
declare class AbstractMentionResource extends AbstractResource<MentionDescription[]> implements MentionProvider {
|
|
25
|
+
shouldHighlightMention(_mention: MentionDescription): boolean;
|
|
26
|
+
filter(query?: string): void;
|
|
27
|
+
recordMentionSelection(_mention: MentionDescription): void;
|
|
28
|
+
isFiltering(_query: string): boolean;
|
|
29
|
+
protected _notifyListeners(mentionsResult: MentionsResult, stats?: MentionStats): void;
|
|
30
|
+
protected _notifyAllResultsListeners(mentionsResult: MentionsResult): void;
|
|
31
|
+
protected _notifyErrorListeners(error: Error, query?: string): void;
|
|
32
|
+
protected _notifyInfoListeners(info: string): void;
|
|
33
|
+
protected _notifyAnalyticsListeners(event: string, actionSubject: string, action: string, attributes?: {
|
|
34
|
+
[key: string]: any;
|
|
35
|
+
}): void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Provides a Javascript API
|
|
39
|
+
*/
|
|
40
|
+
export declare class MentionResource extends AbstractMentionResource implements ResolvingMentionProvider {
|
|
41
|
+
private config;
|
|
42
|
+
private lastReturnedSearch;
|
|
43
|
+
private activeSearches;
|
|
44
|
+
productName?: string;
|
|
45
|
+
shouldEnableInvite: boolean;
|
|
46
|
+
inviteExperimentCohort?: InviteExperimentCohort;
|
|
47
|
+
userRole: UserRole;
|
|
48
|
+
onInviteItemClick?: (flow: InviteFlow) => void;
|
|
49
|
+
constructor(config: MentionResourceConfig);
|
|
50
|
+
shouldHighlightMention(mention: MentionDescription): boolean;
|
|
51
|
+
notify(searchTime: number, mentionResult: MentionsResult, query?: string): void;
|
|
52
|
+
notifyError(error: Error, query?: string): void;
|
|
53
|
+
filter(query?: string, contextIdentifier?: MentionContextIdentifier): Promise<void>;
|
|
54
|
+
recordMentionSelection(mention: MentionDescription, contextIdentifier?: MentionContextIdentifier): Promise<void>;
|
|
55
|
+
isFiltering(query: string): boolean;
|
|
56
|
+
resolveMentionName(id: string): Promise<MentionNameDetails> | MentionNameDetails;
|
|
57
|
+
cacheMentionName(id: string, mentionName: string): void;
|
|
58
|
+
supportsMentionNameResolving(): boolean;
|
|
59
|
+
protected updateActiveSearches(query: string): void;
|
|
60
|
+
protected verifyMentionConfig(config: MentionResourceConfig): void;
|
|
61
|
+
private initialState;
|
|
62
|
+
/**
|
|
63
|
+
* Clear a context object to generate query params by removing empty
|
|
64
|
+
* strings, `undefined` and empty values.
|
|
65
|
+
*
|
|
66
|
+
* @param contextIdentifier the current context identifier
|
|
67
|
+
* @returns a safe context for query encoding
|
|
68
|
+
*/
|
|
69
|
+
private clearContext;
|
|
70
|
+
private getQueryParams;
|
|
71
|
+
/**
|
|
72
|
+
* Returns the initial mention display list before a search is performed for the specified
|
|
73
|
+
* container.
|
|
74
|
+
*
|
|
75
|
+
* @param contextIdentifier
|
|
76
|
+
* @returns Promise
|
|
77
|
+
*/
|
|
78
|
+
protected remoteInitialState(contextIdentifier?: MentionContextIdentifier): Promise<MentionsResult>;
|
|
79
|
+
private search;
|
|
80
|
+
protected remoteSearch(query: string, contextIdentifier?: MentionContextIdentifier): Promise<MentionsResult>;
|
|
81
|
+
private transformServiceResponse;
|
|
82
|
+
recordSelection(mention: MentionDescription, contextIdentifier?: MentionContextIdentifier): Promise<void>;
|
|
83
|
+
}
|
|
84
|
+
export declare class HttpError implements Error {
|
|
85
|
+
name: string;
|
|
86
|
+
message: string;
|
|
87
|
+
statusCode: number;
|
|
88
|
+
stack?: string;
|
|
89
|
+
constructor(statusCode: number, statusMessage: string);
|
|
90
|
+
}
|
|
91
|
+
export declare const isResolvingMentionProvider: (p: any) => p is ResolvingMentionProvider;
|
|
92
|
+
export { AbstractResource, AbstractMentionResource };
|
|
93
|
+
export default MentionResource;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { Presence } from '../types';
|
|
2
|
+
import { AbstractResource, ResourceProvider } from './MentionResource';
|
|
3
|
+
export interface PresenceMap {
|
|
4
|
+
[userId: string]: Presence;
|
|
5
|
+
}
|
|
6
|
+
export interface PresenceResourceConfig {
|
|
7
|
+
url: string;
|
|
8
|
+
cloudId: string;
|
|
9
|
+
productId?: string;
|
|
10
|
+
cache?: PresenceCache;
|
|
11
|
+
cacheExpiry?: number;
|
|
12
|
+
parser?: PresenceParser;
|
|
13
|
+
}
|
|
14
|
+
export interface PresenceCache {
|
|
15
|
+
contains(userId: string): boolean;
|
|
16
|
+
get(userId: string): Presence;
|
|
17
|
+
getBulk(userIds: string[]): PresenceMap;
|
|
18
|
+
getMissingUserIds(userIds: string[]): string[];
|
|
19
|
+
update(presUpdate: PresenceMap): void;
|
|
20
|
+
}
|
|
21
|
+
export interface PresenceResponse {
|
|
22
|
+
data: Data;
|
|
23
|
+
}
|
|
24
|
+
export interface Data {
|
|
25
|
+
PresenceBulk: PresenceBulk[];
|
|
26
|
+
}
|
|
27
|
+
export interface PresenceBulk {
|
|
28
|
+
userId: string;
|
|
29
|
+
state: null | string;
|
|
30
|
+
type: null | string;
|
|
31
|
+
date: null | string;
|
|
32
|
+
message: null | string;
|
|
33
|
+
stateMetadata?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface PresenceParser {
|
|
36
|
+
mapState(state: string): string;
|
|
37
|
+
parse(response: PresenceResponse): PresenceMap;
|
|
38
|
+
}
|
|
39
|
+
export interface PresenceProvider extends ResourceProvider<PresenceMap> {
|
|
40
|
+
refreshPresence(userIds: string[]): void;
|
|
41
|
+
}
|
|
42
|
+
declare class AbstractPresenceResource extends AbstractResource<PresenceMap> implements PresenceProvider {
|
|
43
|
+
refreshPresence(userIds: string[]): void;
|
|
44
|
+
protected notifyListeners(presences: PresenceMap): void;
|
|
45
|
+
}
|
|
46
|
+
declare class PresenceResource extends AbstractPresenceResource {
|
|
47
|
+
private config;
|
|
48
|
+
private presenceCache;
|
|
49
|
+
private presenceParser;
|
|
50
|
+
constructor(config: PresenceResourceConfig);
|
|
51
|
+
refreshPresence(userIds: string[]): void;
|
|
52
|
+
private retrievePresence;
|
|
53
|
+
private queryDirectoryForPresences;
|
|
54
|
+
private static cleanUrl;
|
|
55
|
+
}
|
|
56
|
+
export declare class DefaultPresenceCache implements PresenceCache {
|
|
57
|
+
private static readonly defaultTimeout;
|
|
58
|
+
private static readonly defaultFlushTrigger;
|
|
59
|
+
private cache;
|
|
60
|
+
private size;
|
|
61
|
+
private expiryInMillis;
|
|
62
|
+
private flushTrigger;
|
|
63
|
+
constructor(cacheTimeout?: number, cacheTrigger?: number);
|
|
64
|
+
/**
|
|
65
|
+
* Precondition: _delete is only called internally if userId exists in cache
|
|
66
|
+
* Removes cache entry
|
|
67
|
+
* @param userId
|
|
68
|
+
*/
|
|
69
|
+
private _delete;
|
|
70
|
+
/**
|
|
71
|
+
* Checks a cache entry and calls delete if the info has expired
|
|
72
|
+
* @param userId
|
|
73
|
+
*/
|
|
74
|
+
private _deleteIfExpired;
|
|
75
|
+
/**
|
|
76
|
+
* Cleans expired entries from cache
|
|
77
|
+
*/
|
|
78
|
+
private _removeExpired;
|
|
79
|
+
/**
|
|
80
|
+
* Checks if a user exists in the cache
|
|
81
|
+
* @param userId
|
|
82
|
+
*/
|
|
83
|
+
contains(userId: string): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Retrieves a presence from the cache after checking for expired entries
|
|
86
|
+
* @param userId - to index the cache
|
|
87
|
+
* @returns Presence - the presence that matches the userId
|
|
88
|
+
*/
|
|
89
|
+
get(userId: string): Presence;
|
|
90
|
+
/**
|
|
91
|
+
* Retrieve multiple presences at once from the cache
|
|
92
|
+
* @param userIds - to index the cache
|
|
93
|
+
* @returns PresenceMap - A map of userIds to cached Presences
|
|
94
|
+
*/
|
|
95
|
+
getBulk(userIds: string[]): PresenceMap;
|
|
96
|
+
/**
|
|
97
|
+
* For a given list of ids, returns a subset
|
|
98
|
+
* of all the ids with missing cache entries.
|
|
99
|
+
* @param userIds - to index the cache
|
|
100
|
+
* @returns string[] - ids missing from the cache
|
|
101
|
+
*/
|
|
102
|
+
getMissingUserIds(userIds: string[]): string[];
|
|
103
|
+
/**
|
|
104
|
+
* Precondition: presMap only contains ids of users not in cache
|
|
105
|
+
* expired users must first be removed then reinserted with updated presence
|
|
106
|
+
* Updates the cache by adding the new Presence entries and setting the expiry time
|
|
107
|
+
* @param presMap
|
|
108
|
+
*/
|
|
109
|
+
update(presMap: PresenceMap): void;
|
|
110
|
+
}
|
|
111
|
+
export declare class DefaultPresenceParser implements PresenceParser {
|
|
112
|
+
static FOCUS_STATE: string;
|
|
113
|
+
mapState(state: string): string;
|
|
114
|
+
parse(response: PresenceResponse): PresenceMap;
|
|
115
|
+
private static extractState;
|
|
116
|
+
private static isFocusState;
|
|
117
|
+
}
|
|
118
|
+
export { AbstractPresenceResource };
|
|
119
|
+
export default PresenceResource;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { MentionsResult } from '../types';
|
|
2
|
+
import MentionResource, { MentionContextIdentifier, MentionResourceConfig, TeamMentionResourceConfig, MentionProvider } from './MentionResource';
|
|
3
|
+
/**
|
|
4
|
+
* Provides a Javascript API to fetch users and teams
|
|
5
|
+
* In future we will have a new endpoint to return both users and teams, we can
|
|
6
|
+
* remove this class at this point
|
|
7
|
+
*/
|
|
8
|
+
export default class TeamMentionResource extends MentionResource implements MentionProvider {
|
|
9
|
+
private readonly teamMentionConfig;
|
|
10
|
+
private lastSearchQuery?;
|
|
11
|
+
private lastReturnedSearchTeam;
|
|
12
|
+
constructor(userMentionConfig: MentionResourceConfig, teamMentionConfig: TeamMentionResourceConfig);
|
|
13
|
+
filter(query?: string, contextIdentifier?: MentionContextIdentifier): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Returns the initial mention display list before a search is performed for the specified
|
|
16
|
+
* container.
|
|
17
|
+
*/
|
|
18
|
+
private remoteInitialStateTeamAndUsers;
|
|
19
|
+
/**
|
|
20
|
+
* Both user and team requests are not blocked together
|
|
21
|
+
* If users request arrives first, show users. Show teams when team request arrives.
|
|
22
|
+
* If team request arrives first, block waiting for user request, then show both
|
|
23
|
+
* If one errors, show the non-erroring one
|
|
24
|
+
* If both error, show error
|
|
25
|
+
*/
|
|
26
|
+
private handleBothRequests;
|
|
27
|
+
notify(searchTime: number, mentionResult: MentionsResult, query?: string): void;
|
|
28
|
+
private getQueryParamsOfTeamMentionConfig;
|
|
29
|
+
private remoteUserSearch;
|
|
30
|
+
private remoteTeamSearch;
|
|
31
|
+
private convertTeamResultToMentionResult;
|
|
32
|
+
private trimTeamARI;
|
|
33
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { MentionContextIdentifier } from '../types';
|
|
2
|
+
export declare const SMART_EVENT_TYPE = "smart";
|
|
3
|
+
export declare enum Actions {
|
|
4
|
+
REQUESTED = "requested",
|
|
5
|
+
SUCCESSFUL = "successful",
|
|
6
|
+
SEARCHED = "searched",
|
|
7
|
+
FAILED = "failed",
|
|
8
|
+
SELECTED = "selected"
|
|
9
|
+
}
|
|
10
|
+
export type DefaultAttributes = {
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
context: string;
|
|
13
|
+
sessionId: string;
|
|
14
|
+
pickerType: 'mentions';
|
|
15
|
+
source: 'smarts';
|
|
16
|
+
};
|
|
17
|
+
export declare const defaultAttributes: (context?: MentionContextIdentifier) => DefaultAttributes;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MentionType } from '../../types';
|
|
2
|
+
import { HTMLAttributes } from 'react';
|
|
3
|
+
export interface PrimitiveMentionProps extends HTMLAttributes<HTMLSpanElement> {
|
|
4
|
+
mentionType: MentionType;
|
|
5
|
+
}
|
|
6
|
+
declare const PrimitiveMention: import("react").ForwardRefExoticComponent<PrimitiveMentionProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
7
|
+
export default PrimitiveMention;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MentionProvider } from '../../api/MentionResource';
|
|
3
|
+
import { MentionEventHandler } from '../../types';
|
|
4
|
+
export interface Props {
|
|
5
|
+
id: string;
|
|
6
|
+
text: string;
|
|
7
|
+
accessLevel?: string;
|
|
8
|
+
mentionProvider?: Promise<MentionProvider>;
|
|
9
|
+
onClick?: MentionEventHandler;
|
|
10
|
+
onMouseEnter?: MentionEventHandler;
|
|
11
|
+
onMouseLeave?: MentionEventHandler;
|
|
12
|
+
}
|
|
13
|
+
export interface State {
|
|
14
|
+
isHighlighted: boolean;
|
|
15
|
+
resolvedMentionName?: string;
|
|
16
|
+
}
|
|
17
|
+
export default class ResourcedMention extends React.PureComponent<Props, State> {
|
|
18
|
+
_isMounted: boolean;
|
|
19
|
+
constructor(props: Props);
|
|
20
|
+
componentDidMount(): void;
|
|
21
|
+
componentWillUnmount(): void;
|
|
22
|
+
UNSAFE_componentWillReceiveProps(nextProps: Props): void;
|
|
23
|
+
private setStateSafely;
|
|
24
|
+
private processName;
|
|
25
|
+
private handleMentionProvider;
|
|
26
|
+
render(): JSX.Element;
|
|
27
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MentionEventHandler } from '../../types';
|
|
3
|
+
import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
4
|
+
export declare const ANALYTICS_HOVER_DELAY = 1000;
|
|
5
|
+
export declare const UNKNOWN_USER_ID = "_|unknown|_";
|
|
6
|
+
export type OwnProps = {
|
|
7
|
+
id: string;
|
|
8
|
+
text: string;
|
|
9
|
+
isHighlighted?: boolean;
|
|
10
|
+
accessLevel?: string;
|
|
11
|
+
onClick?: MentionEventHandler;
|
|
12
|
+
onMouseEnter?: MentionEventHandler;
|
|
13
|
+
onMouseLeave?: MentionEventHandler;
|
|
14
|
+
onHover?: () => void;
|
|
15
|
+
};
|
|
16
|
+
export type Props = OwnProps & WithAnalyticsEventsProps;
|
|
17
|
+
export declare class MentionInternal extends React.PureComponent<Props, {}> {
|
|
18
|
+
private hoverTimeout?;
|
|
19
|
+
constructor(props: Props);
|
|
20
|
+
componentDidMount(): void;
|
|
21
|
+
private handleOnClick;
|
|
22
|
+
private handleOnMouseEnter;
|
|
23
|
+
private handleOnMouseLeave;
|
|
24
|
+
private getMentionType;
|
|
25
|
+
componentWillUnmount(): void;
|
|
26
|
+
renderUnknownUserError(id: string): JSX.Element;
|
|
27
|
+
render(): JSX.Element;
|
|
28
|
+
}
|
|
29
|
+
declare const Mention: React.ForwardRefExoticComponent<Omit<Props, keyof WithAnalyticsEventsProps> & React.RefAttributes<any>>;
|
|
30
|
+
type Mention = MentionInternal;
|
|
31
|
+
export default Mention;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ConcurrentExperience } from '@atlaskit/ufo';
|
|
3
|
+
export declare const mentionRenderedUfoExperience: ConcurrentExperience;
|
|
4
|
+
export declare class UfoErrorBoundary extends React.Component<{
|
|
5
|
+
id: string;
|
|
6
|
+
}> {
|
|
7
|
+
componentDidCatch(): void;
|
|
8
|
+
render(): React.ReactNode;
|
|
9
|
+
}
|
package/dist/types-ts4.5/components/MentionDescriptionByline/TeamMentionDescriptionByline.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DescriptionBylineProps } from './types';
|
|
3
|
+
export default class TeamMentionDescriptionByline extends React.PureComponent<DescriptionBylineProps> {
|
|
4
|
+
private renderByline;
|
|
5
|
+
private getBylineComponent;
|
|
6
|
+
render(): JSX.Element | null;
|
|
7
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const DescriptionBylineStyle: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
4
|
+
as?: import("react").ElementType<any> | undefined;
|
|
5
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MentionDescription, OnMentionEvent } from '../../types';
|
|
3
|
+
export { MENTION_ITEM_HEIGHT } from './styles';
|
|
4
|
+
export interface Props {
|
|
5
|
+
mention: MentionDescription;
|
|
6
|
+
selected?: boolean;
|
|
7
|
+
onMouseMove?: OnMentionEvent;
|
|
8
|
+
onMouseEnter?: OnMentionEvent;
|
|
9
|
+
onSelection?: OnMentionEvent;
|
|
10
|
+
}
|
|
11
|
+
export default class MentionItem extends React.PureComponent<Props, {}> {
|
|
12
|
+
private onMentionSelected;
|
|
13
|
+
private onMentionMenuItemMouseMove;
|
|
14
|
+
private onMentionMenuItemMouseEnter;
|
|
15
|
+
render(): JSX.Element;
|
|
16
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface MentionItemStyleProps {
|
|
3
|
+
selected?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export interface AvatarSectionStyleProps {
|
|
6
|
+
restricted?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface NameSectionStyleProps {
|
|
9
|
+
restricted?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface InfoSectionStyleProps {
|
|
12
|
+
restricted?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare const RowStyle: import("@emotion/styled").StyledComponent<{
|
|
15
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
16
|
+
as?: import("react").ElementType<any> | undefined;
|
|
17
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
18
|
+
export declare const AvatarStyle: import("@emotion/styled").StyledComponent<{
|
|
19
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
20
|
+
as?: import("react").ElementType<any> | undefined;
|
|
21
|
+
} & AvatarSectionStyleProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
22
|
+
export declare const NameSectionStyle: import("@emotion/styled").StyledComponent<{
|
|
23
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
24
|
+
as?: import("react").ElementType<any> | undefined;
|
|
25
|
+
} & NameSectionStyleProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
26
|
+
export declare const FullNameStyle: import("@emotion/styled").StyledComponent<{
|
|
27
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
28
|
+
as?: import("react").ElementType<any> | undefined;
|
|
29
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
30
|
+
export declare const InfoSectionStyle: import("@emotion/styled").StyledComponent<{
|
|
31
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
32
|
+
as?: import("react").ElementType<any> | undefined;
|
|
33
|
+
} & InfoSectionStyleProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
34
|
+
export declare const TimeStyle: import("@emotion/styled").StyledComponent<{
|
|
35
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
36
|
+
as?: import("react").ElementType<any> | undefined;
|
|
37
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
38
|
+
export declare const MENTION_ITEM_HEIGHT = 48;
|
|
39
|
+
export declare const MentionItemStyle: import("@emotion/styled").StyledComponent<{
|
|
40
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
41
|
+
as?: import("react").ElementType<any> | undefined;
|
|
42
|
+
} & MentionItemStyleProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
43
|
+
export declare const AccessSectionStyle: import("@emotion/styled").StyledComponent<{
|
|
44
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
45
|
+
as?: import("react").ElementType<any> | undefined;
|
|
46
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MentionDescription, OnMentionEvent } from '../../types';
|
|
3
|
+
import MentionItem from '../MentionItem';
|
|
4
|
+
export interface Props {
|
|
5
|
+
mentions: MentionDescription[];
|
|
6
|
+
resourceError?: Error;
|
|
7
|
+
onSelection?: OnMentionEvent;
|
|
8
|
+
initialHighlightElement?: React.ReactElement | null;
|
|
9
|
+
}
|
|
10
|
+
export interface State {
|
|
11
|
+
selectedKey?: string;
|
|
12
|
+
selectedIndex: number;
|
|
13
|
+
}
|
|
14
|
+
export interface Items {
|
|
15
|
+
[index: string]: MentionItem;
|
|
16
|
+
}
|
|
17
|
+
export default class MentionList extends React.PureComponent<Props, State> {
|
|
18
|
+
private lastMousePosition;
|
|
19
|
+
private scrollable?;
|
|
20
|
+
private items;
|
|
21
|
+
constructor(props: Props);
|
|
22
|
+
UNSAFE_componentWillReceiveProps(nextProps: Props): void;
|
|
23
|
+
componentDidUpdate(): void;
|
|
24
|
+
selectNext: () => void;
|
|
25
|
+
selectPrevious: () => void;
|
|
26
|
+
selectIndex: (index: number, callback?: () => any) => void;
|
|
27
|
+
selectId: (id: string, callback?: () => any) => void;
|
|
28
|
+
chooseCurrentSelection: () => void;
|
|
29
|
+
mentionsCount: () => number;
|
|
30
|
+
private revealItem;
|
|
31
|
+
/**
|
|
32
|
+
* The default selection state is to chose index 0 and not have any particular key selected
|
|
33
|
+
*/
|
|
34
|
+
private setDefaultSelectionState;
|
|
35
|
+
private selectIndexOnHover;
|
|
36
|
+
private itemSelected;
|
|
37
|
+
private renderItems;
|
|
38
|
+
private isSelectedMention;
|
|
39
|
+
private handleScrollableRef;
|
|
40
|
+
render(): JSX.Element;
|
|
41
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface MentionListStyleProps {
|
|
3
|
+
empty?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare const MentionListStyle: import("@emotion/styled").StyledComponent<{
|
|
6
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
7
|
+
as?: import("react").ElementType<any> | undefined;
|
|
8
|
+
} & MentionListStyleProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface Props {
|
|
3
|
+
error?: Error;
|
|
4
|
+
}
|
|
5
|
+
export default class MentionListError extends React.PureComponent<Props, {}> {
|
|
6
|
+
/**
|
|
7
|
+
* Translate the supplied Error into a message suitable for display in the MentionList.
|
|
8
|
+
*
|
|
9
|
+
* @param error the error to be displayed
|
|
10
|
+
*/
|
|
11
|
+
private static getAdvisedActionMessage;
|
|
12
|
+
render(): JSX.Element;
|
|
13
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const MentionListErrorStyle: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
4
|
+
as?: import("react").ElementType<any> | undefined;
|
|
5
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
6
|
+
export declare const GenericErrorVisualStyle: import("@emotion/styled").StyledComponent<{
|
|
7
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
8
|
+
as?: import("react").ElementType<any> | undefined;
|
|
9
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
10
|
+
export declare const MentionListErrorHeadlineStyle: import("@emotion/styled").StyledComponent<{
|
|
11
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
12
|
+
as?: import("react").ElementType<any> | undefined;
|
|
13
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
14
|
+
export declare const MentionListAdviceStyle: import("@emotion/styled").StyledComponent<{
|
|
15
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
16
|
+
as?: import("react").ElementType<any> | undefined;
|
|
17
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|