@aws/mynah-ui 1.3.2 → 2.0.0-beta.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/dist/components/button.d.ts +1 -0
- package/dist/components/chat-item/chat-item-card.d.ts +28 -0
- package/dist/components/chat-item/chat-item-followup.d.ts +14 -0
- package/dist/components/chat-item/chat-prompt-input.d.ts +27 -0
- package/dist/components/chat-item/chat-wrapper.d.ts +23 -0
- package/dist/components/feedback-form/feedback-form.d.ts +1 -3
- package/dist/components/icon.d.ts +2 -0
- package/dist/components/main-container.d.ts +4 -1
- package/dist/components/navigation-tabs-vertical.d.ts +13 -0
- package/dist/components/overlay/overlay.d.ts +1 -0
- package/dist/components/query-text-short-view.d.ts +10 -0
- package/dist/components/search-block/search-card-header.d.ts +0 -1
- package/dist/components/suggestion-card/suggestion-card-body.d.ts +10 -1
- package/dist/components/suggestion-card/suggestion-card-header.d.ts +0 -1
- package/dist/components/suggestion-card/suggestion-card.d.ts +2 -0
- package/dist/components/suggestion-card/suggestion-skeleton.d.ts +5 -0
- package/dist/components/syntax-highlighter.d.ts +1 -0
- package/dist/components/toggle.d.ts +3 -0
- package/dist/helper/date-time.d.ts +2 -2
- package/dist/helper/dom.d.ts +1 -0
- package/dist/helper/find-language.d.ts +1 -1
- package/dist/helper/url.d.ts +1 -0
- package/dist/main.d.ts +27 -4
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/static.d.ts +61 -3
- package/dist/translations/en.d.ts +4 -0
- package/dist/translations/i18n.d.ts +4 -0
- package/package.json +5 -3
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import { ExtendedHTMLElement } from '../../helper/dom';
|
|
6
|
+
import { ChatItem } from '../../static';
|
|
7
|
+
import { SuggestionCardBody } from '../suggestion-card/suggestion-card-body';
|
|
8
|
+
export interface ChatItemCardProps {
|
|
9
|
+
chatItem: ChatItem;
|
|
10
|
+
onShowAllWebResultsClick?: () => void;
|
|
11
|
+
}
|
|
12
|
+
export declare class ChatItemCard {
|
|
13
|
+
private readonly chatItem;
|
|
14
|
+
private readonly relatedContentWrapper;
|
|
15
|
+
private readonly referencesWrapper;
|
|
16
|
+
private readonly showMoreButtonBlock;
|
|
17
|
+
private relatedContentPreview;
|
|
18
|
+
private relatedContentPreviewTimeout;
|
|
19
|
+
render: ExtendedHTMLElement;
|
|
20
|
+
suggestionCardBody: SuggestionCardBody;
|
|
21
|
+
chatAvatar: ExtendedHTMLElement;
|
|
22
|
+
constructor(props: ChatItemCardProps);
|
|
23
|
+
private readonly checkIsMuted;
|
|
24
|
+
private readonly showLinkPreview;
|
|
25
|
+
private readonly hideLinkPreview;
|
|
26
|
+
private readonly getChatAvatar;
|
|
27
|
+
readonly updateAnswerBody: (body: string) => void;
|
|
28
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import { ExtendedHTMLElement } from '../../helper/dom';
|
|
6
|
+
import { ChatItem } from '../../static';
|
|
7
|
+
export interface ChatItemFollowUpProps {
|
|
8
|
+
chatItem: ChatItem;
|
|
9
|
+
}
|
|
10
|
+
export declare class ChatItemFollowUpContainer {
|
|
11
|
+
private readonly chatItem;
|
|
12
|
+
render: ExtendedHTMLElement;
|
|
13
|
+
constructor(props: ChatItemFollowUpProps);
|
|
14
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import { ExtendedHTMLElement } from '../../helper/dom';
|
|
6
|
+
export interface CharPromptInputProps {
|
|
7
|
+
onStopChatResponse?: () => void;
|
|
8
|
+
showFeedbackButton?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare class ChatPromptInput {
|
|
11
|
+
render: ExtendedHTMLElement;
|
|
12
|
+
private readonly attachmentWrapper;
|
|
13
|
+
private readonly promptTextInputWrapper;
|
|
14
|
+
private readonly promptTextInput;
|
|
15
|
+
private readonly promptTextInputSizer;
|
|
16
|
+
private sendButton;
|
|
17
|
+
private readonly clearButton;
|
|
18
|
+
private readonly loading;
|
|
19
|
+
private readonly onStopChatResponse;
|
|
20
|
+
private attachment?;
|
|
21
|
+
constructor(props?: CharPromptInputProps);
|
|
22
|
+
private readonly getButton;
|
|
23
|
+
private readonly handleInputKeydown;
|
|
24
|
+
private readonly calculateTextAreaHeight;
|
|
25
|
+
private readonly resetTextAreaHeight;
|
|
26
|
+
private readonly triggerSearch;
|
|
27
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import { ExtendedHTMLElement } from '../../helper/dom';
|
|
6
|
+
export interface ChatWrapperProps {
|
|
7
|
+
onStopChatResponse?: () => void;
|
|
8
|
+
onShowAllWebResultsClick?: () => void;
|
|
9
|
+
showFeedbackButton?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare class ChatWrapper {
|
|
12
|
+
private readonly props?;
|
|
13
|
+
private readonly chatItemsContainer;
|
|
14
|
+
private readonly spinner;
|
|
15
|
+
private readonly promptInput;
|
|
16
|
+
private lastChatItemCard;
|
|
17
|
+
private containerScollState;
|
|
18
|
+
render: ExtendedHTMLElement;
|
|
19
|
+
constructor(props?: ChatWrapperProps);
|
|
20
|
+
private readonly insertChatItem;
|
|
21
|
+
private readonly scrollToStreamingCardBottom;
|
|
22
|
+
removeAllExceptAnswersAndPrompts: () => void;
|
|
23
|
+
}
|
|
@@ -8,14 +8,12 @@ export interface FeedbackFormProps {
|
|
|
8
8
|
initPayload?: FeedbackPayload;
|
|
9
9
|
}
|
|
10
10
|
export declare class FeedbackForm {
|
|
11
|
-
private
|
|
11
|
+
private feedbackFormWrapper;
|
|
12
12
|
private readonly feedbackStars;
|
|
13
13
|
private readonly feedbackComment;
|
|
14
14
|
private feedbackPayload;
|
|
15
|
-
private readonly triggerButton;
|
|
16
15
|
private readonly feedbackSubmitButton;
|
|
17
16
|
readonly feedbackFormContainer: ExtendedHTMLElement;
|
|
18
|
-
readonly feedbackContainer: ExtendedHTMLElement;
|
|
19
17
|
constructor(props?: FeedbackFormProps);
|
|
20
18
|
private readonly onFeedbackSet;
|
|
21
19
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { ExtendedHTMLElement } from '../helper/dom';
|
|
6
6
|
export declare enum MynahIcons {
|
|
7
|
+
MYNAH = "mynah",
|
|
7
8
|
MENU = "menu",
|
|
8
9
|
MINUS = "minus",
|
|
9
10
|
SEARCH = "search",
|
|
@@ -15,6 +16,7 @@ export declare enum MynahIcons {
|
|
|
15
16
|
CALENDAR = "calendar",
|
|
16
17
|
MEGAPHONE = "megaphone",
|
|
17
18
|
EYE = "eye",
|
|
19
|
+
ELLIPSIS = "ellipsis",
|
|
18
20
|
OK = "ok",
|
|
19
21
|
UP_CIRCLED = "up-circled",
|
|
20
22
|
UP_OPEN = "up-open",
|
|
@@ -5,11 +5,14 @@
|
|
|
5
5
|
import { ExtendedHTMLElement } from '../helper/dom';
|
|
6
6
|
import { Suggestion } from '../static';
|
|
7
7
|
export interface MainContainerProps {
|
|
8
|
-
|
|
8
|
+
onNavigationTabChange?: (selectedTab: string) => void;
|
|
9
|
+
onCloseButtonClick?: () => void;
|
|
9
10
|
}
|
|
10
11
|
export declare class MainContainer {
|
|
12
|
+
private readonly navTabs;
|
|
11
13
|
private readonly cardsWrapper;
|
|
12
14
|
private readonly skeletonWrapper;
|
|
15
|
+
private readonly mainContainer;
|
|
13
16
|
render: ExtendedHTMLElement;
|
|
14
17
|
constructor(props: MainContainerProps);
|
|
15
18
|
clearCards: () => void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import { ExtendedHTMLElement } from '../helper/dom';
|
|
6
|
+
import { NavivationTabsProps } from './navigation-tabs';
|
|
7
|
+
export declare class NavivationTabsVertical {
|
|
8
|
+
render: ExtendedHTMLElement;
|
|
9
|
+
private readonly props;
|
|
10
|
+
constructor(props: NavivationTabsProps);
|
|
11
|
+
private readonly setLoading;
|
|
12
|
+
private readonly getTabsRender;
|
|
13
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import { ExtendedHTMLElement } from '../helper/dom';
|
|
6
|
+
export declare class QueryTextShortView {
|
|
7
|
+
render: ExtendedHTMLElement;
|
|
8
|
+
private readonly textBlock;
|
|
9
|
+
constructor();
|
|
10
|
+
}
|
|
@@ -5,9 +5,18 @@
|
|
|
5
5
|
import { ExtendedHTMLElement } from '../../helper/dom';
|
|
6
6
|
import { Suggestion } from '../../static';
|
|
7
7
|
export interface SuggestionCardBodyProps {
|
|
8
|
-
suggestion: Suggestion
|
|
8
|
+
suggestion: Partial<Suggestion>;
|
|
9
|
+
showFooterButtons?: boolean;
|
|
10
|
+
onLinkMouseEnter?: (e: MouseEvent, url: string) => void;
|
|
11
|
+
onLinkMouseLeave?: (e: MouseEvent, url: string) => void;
|
|
9
12
|
}
|
|
10
13
|
export declare class SuggestionCardBody {
|
|
11
14
|
render: ExtendedHTMLElement;
|
|
15
|
+
cardBody: ExtendedHTMLElement;
|
|
16
|
+
matchingLanguage: string;
|
|
17
|
+
props: SuggestionCardBodyProps;
|
|
12
18
|
constructor(props: SuggestionCardBodyProps);
|
|
19
|
+
private readonly processNode;
|
|
20
|
+
private readonly getCardBodyChildren;
|
|
21
|
+
readonly updateCardBody: (body: string) => void;
|
|
13
22
|
}
|
|
@@ -14,6 +14,5 @@ export interface SuggestionCardHeaderProps {
|
|
|
14
14
|
export declare class SuggestionCardHeader {
|
|
15
15
|
render: ExtendedHTMLElement;
|
|
16
16
|
constructor(props: SuggestionCardHeaderProps);
|
|
17
|
-
private readonly getSourceMetaBlockClassName;
|
|
18
17
|
private readonly getSourceMetaBlock;
|
|
19
18
|
}
|
|
@@ -6,6 +6,8 @@ import { ExtendedHTMLElement } from '../../helper/dom';
|
|
|
6
6
|
import { Suggestion } from '../../static';
|
|
7
7
|
export interface SuggestionCardProps {
|
|
8
8
|
suggestion: Suggestion;
|
|
9
|
+
compact?: 'withBody' | true;
|
|
10
|
+
showFooterButtons?: boolean;
|
|
9
11
|
}
|
|
10
12
|
export declare class SuggestionCard {
|
|
11
13
|
private engagementStartTime;
|
|
@@ -35,6 +35,7 @@ export interface SyntaxHighlighterProps {
|
|
|
35
35
|
language?: SupportedCodingLanguagesType;
|
|
36
36
|
keepHighlights?: boolean;
|
|
37
37
|
showLineNumbers?: boolean;
|
|
38
|
+
block?: boolean;
|
|
38
39
|
startingLineNumber?: number;
|
|
39
40
|
showCopyOptions?: boolean;
|
|
40
41
|
onCopiedToClipboard?: OnCopiedToClipboardFunction;
|
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
import { ExtendedHTMLElement } from '../helper/dom';
|
|
6
|
+
import { MynahIcons } from './icon';
|
|
6
7
|
export interface ToggleOption {
|
|
7
8
|
label?: ExtendedHTMLElement | string | HTMLElement;
|
|
8
9
|
color?: string;
|
|
10
|
+
icon?: MynahIcons;
|
|
9
11
|
disabled?: boolean;
|
|
10
12
|
selected?: boolean;
|
|
11
13
|
value: string;
|
|
@@ -14,6 +16,7 @@ export interface ToggleOption {
|
|
|
14
16
|
export interface ToggleProps {
|
|
15
17
|
options: ToggleOption[];
|
|
16
18
|
type?: 'switch' | 'tabs';
|
|
19
|
+
direction?: 'horizontal' | 'vertical';
|
|
17
20
|
value?: string | null;
|
|
18
21
|
name: string;
|
|
19
22
|
disabled?: boolean;
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
|
-
export declare const getTimeDiff: (differenceInMs: number, show?: {
|
|
5
|
+
export declare const getTimeDiff: (differenceInMs: number, show?: 1 | {
|
|
6
6
|
years?: boolean | undefined;
|
|
7
7
|
months?: boolean | undefined;
|
|
8
8
|
weeks?: boolean | undefined;
|
|
9
9
|
days?: boolean | undefined;
|
|
10
10
|
hours?: boolean | undefined;
|
|
11
11
|
minutes?: boolean | undefined;
|
|
12
|
-
} |
|
|
12
|
+
} | 2 | 3 | 4 | 5 | 6 | undefined, separator?: string | undefined) => string;
|
package/dist/helper/dom.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { Suggestion } from '../static';
|
|
|
8
8
|
* @param suggestion SuggestionType
|
|
9
9
|
* @returns string | undefined
|
|
10
10
|
*/
|
|
11
|
-
export declare const findLanguageFromSuggestion: (suggestion: Suggestion) => string | undefined;
|
|
11
|
+
export declare const findLanguageFromSuggestion: (suggestion: Partial<Suggestion>) => string | undefined;
|
|
12
12
|
/**
|
|
13
13
|
* Finds the coding language if there is a match within the supported languages from the given file name
|
|
14
14
|
* @param fileName string
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getOrigin: (site: string) => string;
|
package/dist/main.d.ts
CHANGED
|
@@ -2,14 +2,17 @@
|
|
|
2
2
|
* Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
|
-
import { SuggestionEngagement, Suggestion, SearchPayload, LiveSearchState, SuggestionEventName, RelevancyVoteType, FeedbackPayload, MynahUIDataModel, ContextChangeType, ContextType, SearchHistoryFilters, NotificationType } from './static';
|
|
5
|
+
import { SuggestionEngagement, Suggestion, SearchPayload, LiveSearchState, SuggestionEventName, RelevancyVoteType, FeedbackPayload, MynahUIDataModel, ContextChangeType, ContextType, SearchHistoryFilters, NotificationType, ChatItem, ChatItemFollowUp, ChatPrompt, MynahMode } from './static';
|
|
6
6
|
import './styles/styles.scss';
|
|
7
|
-
export { AutocompleteItem, SearchPayloadCodeSelection, FeedbackPayload, RelevancyVoteType, LiveSearchState, SearchPayload, Suggestion, ContextType, SearchHistoryItem, EngagementType, SuggestionEngagement, SuggestionEventName, SearchHistoryFilters, MynahUIDataModel, ContextChangeType, ContextSource, ContextTypes, NotificationType, } from './static';
|
|
7
|
+
export { AutocompleteItem, SearchPayloadCodeSelection, FeedbackPayload, RelevancyVoteType, LiveSearchState, SearchPayload, Suggestion, ContextType, SearchHistoryItem, EngagementType, SuggestionEngagement, SuggestionEventName, SearchHistoryFilters, MynahUIDataModel, ContextChangeType, ContextSource, ContextTypes, NotificationType, MynahMode, ChatItem, ChatItemFollowUp, ChatItemType, ChatPrompt } from './static';
|
|
8
|
+
export { ToggleOption } from './components/toggle';
|
|
9
|
+
export { MynahIcons } from './components/icon';
|
|
8
10
|
export { transformPayloadData, validateRulesOnPayloadData, PayloadTransformRule, } from './helper/payload-transformer';
|
|
9
11
|
export interface MynahUIProps {
|
|
10
12
|
rootSelector?: string;
|
|
11
13
|
storeData?: MynahUIDataModel;
|
|
12
14
|
onSearch?: ((searchPayload: SearchPayload, isFromHistory?: boolean, isFromAutocomplete?: boolean) => void) | ((searchPayload: SearchPayload, isFromHistory?: boolean, isFromAutocomplete?: boolean) => MynahUIDataModel);
|
|
15
|
+
onShowMoreWebResultsClick?: () => void;
|
|
13
16
|
onReady?: () => void;
|
|
14
17
|
onClickSuggestionVote?: (suggestion: Suggestion, vote: RelevancyVoteType) => void;
|
|
15
18
|
onClickCodeDetails?: (code: string, fileName?: string, range?: {
|
|
@@ -22,9 +25,15 @@ export interface MynahUIProps {
|
|
|
22
25
|
column?: string;
|
|
23
26
|
};
|
|
24
27
|
}) => void;
|
|
28
|
+
onClearChat?: () => void;
|
|
29
|
+
onStopChatResponse?: () => void;
|
|
25
30
|
onResetStore?: () => void;
|
|
26
31
|
onChangeContext?: (changeType: ContextChangeType, queryContext: ContextType) => void;
|
|
32
|
+
onChatPrompt?: (prompt: ChatPrompt) => void;
|
|
33
|
+
onFollowUpClicked?: (followUp: ChatItemFollowUp) => void;
|
|
34
|
+
onSuggestionAttachedToChatPrompt?: (attachment: Suggestion) => void;
|
|
27
35
|
onNavigationTabChange?: (selectedTab: string) => void;
|
|
36
|
+
onSideNavigationTabChange?: (selectedTab: string) => void;
|
|
28
37
|
onSuggestionEngagement?: (engagement: SuggestionEngagement) => void;
|
|
29
38
|
onSuggestionClipboardInteraction?: (suggestionId: string, type?: string, text?: string) => void;
|
|
30
39
|
onSuggestionInteraction?: (eventName: SuggestionEventName, suggestion: Suggestion, mouseEvent?: MouseEvent) => void;
|
|
@@ -37,17 +46,31 @@ export interface MynahUIProps {
|
|
|
37
46
|
export declare class MynahUI {
|
|
38
47
|
private readonly props;
|
|
39
48
|
private readonly wrapper;
|
|
40
|
-
private readonly
|
|
41
|
-
private readonly
|
|
49
|
+
private readonly sideNav;
|
|
50
|
+
private readonly feedbackForm?;
|
|
42
51
|
private readonly mainContainer;
|
|
52
|
+
private readonly chatWrapper;
|
|
43
53
|
private readonly config;
|
|
44
54
|
constructor(props: MynahUIProps);
|
|
55
|
+
private readonly sideNavigationTabChanged;
|
|
45
56
|
private readonly addGlobalListeners;
|
|
57
|
+
/**
|
|
58
|
+
* Adds a new answer on the chat window
|
|
59
|
+
* @param anwer An ChatItem object.
|
|
60
|
+
*/
|
|
61
|
+
addChatAnswer: (answer: ChatItem) => void;
|
|
62
|
+
getLastChatAnswer: () => ChatItem | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* Updates the body of the last ChatItemType.ANSWER_STREAM chat item
|
|
65
|
+
* @param body new body stream as string.
|
|
66
|
+
*/
|
|
67
|
+
updateLastChatAnswerStream: (body: string) => void;
|
|
46
68
|
/**
|
|
47
69
|
* Updates only the UI with the given data.
|
|
48
70
|
* @param data A full or partial set of data with values.
|
|
49
71
|
*/
|
|
50
72
|
updateStore: (data: MynahUIDataModel) => void;
|
|
73
|
+
getMode: () => MynahMode | undefined;
|
|
51
74
|
/**
|
|
52
75
|
* Sets store defaults to use while clearing the store
|
|
53
76
|
* To clear the defaults, send `null`
|