@aws/mynah-ui 4.9.1 → 4.10.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/cloudscape-wrapper/main.ts +3 -0
- package/cloudscape-wrapper/package.json +72 -0
- package/cloudscape-wrapper/test-config/__mocks__/empty.mock.js +1 -0
- package/cloudscape-wrapper/test-config/test-utils.ts +11 -0
- package/dist/components/button.d.ts +7 -6
- package/dist/components/card/card-body.d.ts +1 -0
- package/dist/components/card/card.d.ts +1 -1
- package/dist/components/chat-item/chat-item-buttons.d.ts +1 -0
- package/dist/components/chat-item/chat-item-card-content.d.ts +35 -0
- package/dist/components/chat-item/chat-item-card.d.ts +13 -18
- package/dist/components/chat-item/chat-item-form-items.d.ts +1 -0
- package/dist/components/chat-item/chat-item-relevance-vote.d.ts +1 -0
- package/dist/components/chat-item/chat-item-tree-view-wrapper.d.ts +1 -0
- package/dist/components/chat-item/chat-prompt-input.d.ts +3 -3
- package/dist/components/chat-item/chat-wrapper.d.ts +3 -2
- package/dist/components/chat-item/prompt-input/prompt-attachment.d.ts +14 -0
- package/dist/components/chat-item/prompt-input/{code-snippet-widget.d.ts → prompt-text-attachment.d.ts} +7 -6
- package/dist/components/chat-item/prompt-input/send-button.d.ts +4 -5
- package/dist/components/form-items/radio-group.d.ts +14 -1
- package/dist/components/form-items/select.d.ts +15 -1
- package/dist/components/form-items/text-area.d.ts +14 -1
- package/dist/components/form-items/text-input.d.ts +15 -2
- package/dist/components/syntax-highlighter.d.ts +1 -0
- package/dist/helper/config.d.ts +2 -1
- package/dist/helper/dom.d.ts +2 -0
- package/dist/main.d.ts +16 -8
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/static.d.ts +18 -3
- package/docs/CONFIG.md +311 -0
- package/docs/DATAMODEL.md +1988 -0
- package/docs/DEVELOPER.md +499 -0
- package/docs/PROPERTIES.md +862 -0
- package/docs/STARTUP.md +51 -0
- package/docs/STYLING.md +195 -0
- package/docs/USAGE.md +502 -0
- package/docs/img/code-attachment.png +0 -0
- package/docs/img/customForm.png +0 -0
- package/docs/img/data-model/chatItems/actions.png +0 -0
- package/docs/img/data-model/chatItems/answer.png +0 -0
- package/docs/img/data-model/chatItems/answerStream.png +0 -0
- package/docs/img/data-model/chatItems/body.png +0 -0
- package/docs/img/data-model/chatItems/canBeVoted.png +0 -0
- package/docs/img/data-model/chatItems/codeInsertAndCopyButtons.png +0 -0
- package/docs/img/data-model/chatItems/codeReference-1.png +0 -0
- package/docs/img/data-model/chatItems/codeReference-2.png +0 -0
- package/docs/img/data-model/chatItems/codeResult.png +0 -0
- package/docs/img/data-model/chatItems/customRenderer_html.png +0 -0
- package/docs/img/data-model/chatItems/customRenderer_json.png +0 -0
- package/docs/img/data-model/chatItems/followUp-1.png +0 -0
- package/docs/img/data-model/chatItems/followUp-2.png +0 -0
- package/docs/img/data-model/chatItems/icon.png +0 -0
- package/docs/img/data-model/chatItems/notification-1.png +0 -0
- package/docs/img/data-model/chatItems/notification-2.png +0 -0
- package/docs/img/data-model/chatItems/notification-3.png +0 -0
- package/docs/img/data-model/chatItems/notification-4.png +0 -0
- package/docs/img/data-model/chatItems/options-all-filled.png +0 -0
- package/docs/img/data-model/chatItems/options-mandatory-filled.png +0 -0
- package/docs/img/data-model/chatItems/options-submitted.png +0 -0
- package/docs/img/data-model/chatItems/options.png +0 -0
- package/docs/img/data-model/chatItems/prompt.png +0 -0
- package/docs/img/data-model/chatItems/relatedContent-1.png +0 -0
- package/docs/img/data-model/chatItems/relatedContent-2.png +0 -0
- package/docs/img/data-model/chatItems/relatedContent-3.png +0 -0
- package/docs/img/data-model/chatItems/status.png +0 -0
- package/docs/img/data-model/chatItems/systemPrompt.png +0 -0
- package/docs/img/data-model/tabStore/loadingChat-1.png +0 -0
- package/docs/img/data-model/tabStore/loadingChat-2.png +0 -0
- package/docs/img/data-model/tabStore/promptInputDisabledState.png +0 -0
- package/docs/img/data-model/tabStore/promptInputPlaceholder.png +0 -0
- package/docs/img/data-model/tabStore/promptInputStickyCard.png +0 -0
- package/docs/img/data-model/tabStore/quickActionCommands.png +0 -0
- package/docs/img/data-model/tabStore/selectedCodeSnippet.png +0 -0
- package/docs/img/data-model/tabStore/stopChatResponse.png +0 -0
- package/docs/img/data-model/tabStore/tabBarButtons1.png +0 -0
- package/docs/img/data-model/tabStore/tabBarButtons2.png +0 -0
- package/docs/img/data-model/tabStore/tabTitle.png +0 -0
- package/docs/img/developer/comp0.png +0 -0
- package/docs/img/developer/comp1.png +0 -0
- package/docs/img/developer/comp2.png +0 -0
- package/docs/img/feedbackOptions.png +0 -0
- package/docs/img/maxTabs1.png +0 -0
- package/docs/img/noPrompt.png +0 -0
- package/docs/img/notification.png +0 -0
- package/docs/img/onBeforeTabRemove.png +0 -0
- package/docs/img/onBodyActionClicked.png +0 -0
- package/docs/img/onChatItemEngagement.png +0 -0
- package/docs/img/onChatPrompt.png +0 -0
- package/docs/img/onCodeInsertToCursorPosition.png +0 -0
- package/docs/img/onCopyCodeToClipboard.png +0 -0
- package/docs/img/onCustomFormAction.png +0 -0
- package/docs/img/onFileActionClick.png +0 -0
- package/docs/img/onFollowupClicked.png +0 -0
- package/docs/img/onInfoLinkClick.png +0 -0
- package/docs/img/onLinkClick.png +0 -0
- package/docs/img/onOpenDiff.png +0 -0
- package/docs/img/onSendFeedback-1.png +0 -0
- package/docs/img/onSendFeedback-2.png +0 -0
- package/docs/img/onSendFeedback-3.png +0 -0
- package/docs/img/onShowMoreClick.png +0 -0
- package/docs/img/onSourceLinkClick.png +0 -0
- package/docs/img/onStopChatResponse.png +0 -0
- package/docs/img/onTabAdd.png +0 -0
- package/docs/img/onTabChange.png +0 -0
- package/docs/img/onTabRemove.png +0 -0
- package/docs/img/onVote.png +0 -0
- package/docs/img/prompt-with-code-attached.png +0 -0
- package/docs/img/splash.gif +0 -0
- package/docs/img/texts/codeFileSuggestions.png +0 -0
- package/docs/img/texts/copyInsertToCursor.png +0 -0
- package/docs/img/texts/feedbackForm.png +0 -0
- package/docs/img/texts/fileTreeTitle.png +0 -0
- package/docs/img/texts/mainTitle.png +0 -0
- package/docs/img/texts/noMoreTabs.png +0 -0
- package/docs/img/texts/noTabsOpen.png +0 -0
- package/docs/img/texts/pleaseSelect.png +0 -0
- package/docs/img/texts/spinnerText.png +0 -0
- package/docs/img/texts/stopGenerating.png +0 -0
- package/docs/img/texts/tabCloseConfirmation.png +0 -0
- package/docs/img/texts/voteAndSourceActions.png +0 -0
- package/docs/img/theming-1.png +0 -0
- package/docs/img/theming-2.png +0 -0
- package/package.json +11 -2
- package/dist/__test__/main.spec.d.ts +0 -1
- package/dist/components/__test__/button.spec.d.ts +0 -1
- package/dist/components/__test__/chat-item/chat-item-followup.spec.d.ts +0 -1
- package/dist/components/__test__/chat-item/chat-prompt-input.spec.d.ts +0 -1
- package/dist/components/__test__/feedback-form/feedback-form.spec.d.ts +0 -1
- package/dist/components/__test__/notification.spec.d.ts +0 -1
- package/dist/components/__test__/syntax-highlighter.spec.d.ts +0 -1
- package/dist/components/__test__/toggle.spec.d.ts +0 -1
- package/dist/components/chat-item/prompt-input/code-snippet.d.ts +0 -18
- package/dist/helper/__test__/date-time.spec.d.ts +0 -1
- package/dist/helper/__test__/dom.spec.d.ts +0 -1
- package/dist/helper/__test__/events.spec.d.ts +0 -1
- package/dist/helper/__test__/file-tree.spec.d.ts +0 -1
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aws/mynah-ui-cloudscape-wrapper",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "MynahUI React wrapper with Cloudscape elements",
|
|
5
|
+
"author": "",
|
|
6
|
+
"license": "UNLICENSED",
|
|
7
|
+
"repository": "ssh://git.amazon.com/pkg/MynahUICloudscapeReact",
|
|
8
|
+
"homepage": "https://code.amazon.com/packages/MynahUICloudscapeReact",
|
|
9
|
+
"main": "dist/main.js",
|
|
10
|
+
"typeDefs": "dist/main.d.ts",
|
|
11
|
+
"module": "dist/main.es.js",
|
|
12
|
+
"jsnext:main": "dist/main.es.js",
|
|
13
|
+
"scripts": {
|
|
14
|
+
"clean": "rm -rf build out dist node_modules",
|
|
15
|
+
"test": "jest",
|
|
16
|
+
"testclean": "cross-env BABEL_ENV=test jest -u --passWithNoTests",
|
|
17
|
+
"build": "cross-env BABEL_ENV=production rollup -c",
|
|
18
|
+
"start": "cross-env BABEL_ENV=production rollup -c -w",
|
|
19
|
+
"prepublishOnly": "npm run testclean && npm run build"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@aws/mynah-ui": "file:../"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"@cloudscape-design/components": "^3.0.615",
|
|
26
|
+
"@cloudscape-design/design-tokens": "^3.0.35",
|
|
27
|
+
"@cloudscape-design/global-styles": "^1.0.27",
|
|
28
|
+
"react": "^16.8 || ^17 || ^18",
|
|
29
|
+
"react-dom": "^16.8 || ^17 || ^18"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@babel/core": "^7.17.10",
|
|
33
|
+
"@babel/preset-env": "^7.17.10",
|
|
34
|
+
"@babel/preset-react": "^7.16.7",
|
|
35
|
+
"@babel/preset-typescript": "^7.16.7",
|
|
36
|
+
"@rollup/plugin-commonjs": "^26.0.1",
|
|
37
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
38
|
+
"@testing-library/jest-dom": "^5.16.5",
|
|
39
|
+
"@testing-library/react": "^13.2.0",
|
|
40
|
+
"@types/events": "^3.0.0",
|
|
41
|
+
"@types/jest": "^27.5.1",
|
|
42
|
+
"@types/react": "^18.0.9",
|
|
43
|
+
"@types/react-dom": "^18.0.4",
|
|
44
|
+
"babel-jest": "^28.1.0",
|
|
45
|
+
"babel-preset-jest": "^29.5.0",
|
|
46
|
+
"cross-env": "^7.0.3",
|
|
47
|
+
"jest": "^28.1.0",
|
|
48
|
+
"jest-environment-jsdom": "^28.1.0",
|
|
49
|
+
"rollup": "^2.73.0",
|
|
50
|
+
"rollup-plugin-commonjs": "^10.1.0",
|
|
51
|
+
"rollup-plugin-node-resolve": "^5.2.0",
|
|
52
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
53
|
+
"rollup-plugin-typescript": "^1.0.1",
|
|
54
|
+
"rollup-plugin-typescript2": "^0.31.2",
|
|
55
|
+
"sass": "^1.51.0",
|
|
56
|
+
"ts-jest": "^28.0.2",
|
|
57
|
+
"typescript": "^5.1.3"
|
|
58
|
+
},
|
|
59
|
+
"files": [
|
|
60
|
+
"dist"
|
|
61
|
+
],
|
|
62
|
+
"prettier": {
|
|
63
|
+
"jsxSingleQuote": true,
|
|
64
|
+
"singleQuote": true,
|
|
65
|
+
"trailingComma": "es5",
|
|
66
|
+
"tabWidth": 2
|
|
67
|
+
},
|
|
68
|
+
"npm-pretty-much": {
|
|
69
|
+
"runTest": "never",
|
|
70
|
+
"ciBuild": "always"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React, { ReactElement } from 'react'
|
|
2
|
+
import { render, RenderOptions } from '@testing-library/react';
|
|
3
|
+
|
|
4
|
+
const baseRender = (
|
|
5
|
+
ui: ReactElement,
|
|
6
|
+
options?: Omit<RenderOptions, 'wrapper'>,
|
|
7
|
+
): HTMLElement => render(ui, { wrapper: React.Fragment, ...options }).container.firstChild as HTMLElement
|
|
8
|
+
|
|
9
|
+
export * from '@testing-library/react';
|
|
10
|
+
export * from '@testing-library/jest-dom';
|
|
11
|
+
export { baseRender as renderElement };
|
|
@@ -7,7 +7,7 @@ import { OverlayHorizontalDirection, OverlayVerticalDirection } from './overlay'
|
|
|
7
7
|
export interface ButtonProps {
|
|
8
8
|
classNames?: string[];
|
|
9
9
|
attributes?: Record<string, string>;
|
|
10
|
-
icon?: HTMLElement | ExtendedHTMLElement
|
|
10
|
+
icon?: HTMLElement | ExtendedHTMLElement;
|
|
11
11
|
label?: HTMLElement | ExtendedHTMLElement | string;
|
|
12
12
|
tooltip?: string;
|
|
13
13
|
tooltipVerticalDirection?: OverlayVerticalDirection;
|
|
@@ -17,13 +17,14 @@ export interface ButtonProps {
|
|
|
17
17
|
additionalEvents?: Record<string, (event?: any) => any>;
|
|
18
18
|
onClick: (e: Event) => void;
|
|
19
19
|
}
|
|
20
|
-
export declare class
|
|
20
|
+
export declare abstract class ButtonAbstract {
|
|
21
|
+
render: ExtendedHTMLElement;
|
|
22
|
+
updateLabel: (label: HTMLElement | ExtendedHTMLElement | string) => void;
|
|
23
|
+
setEnabled: (enabled: boolean) => void;
|
|
24
|
+
}
|
|
25
|
+
export declare class Button extends ButtonAbstract {
|
|
21
26
|
render: ExtendedHTMLElement;
|
|
22
|
-
private buttonTooltip;
|
|
23
|
-
private buttonTooltipTimeout;
|
|
24
27
|
constructor(props: ButtonProps);
|
|
25
|
-
private readonly showButtonTooltip;
|
|
26
|
-
readonly hideButtonTooltip: () => void;
|
|
27
28
|
updateLabel: (label: HTMLElement | ExtendedHTMLElement | string) => void;
|
|
28
29
|
setEnabled: (enabled: boolean) => void;
|
|
29
30
|
}
|
|
@@ -24,6 +24,7 @@ export interface CardBodyProps {
|
|
|
24
24
|
useParts?: boolean;
|
|
25
25
|
codeBlockStartIndex?: number;
|
|
26
26
|
processChildren?: boolean;
|
|
27
|
+
classNames?: string[];
|
|
27
28
|
onLinkClick?: (url: string, e: MouseEvent) => void;
|
|
28
29
|
onCopiedToClipboard?: OnCopiedToClipboardFunction;
|
|
29
30
|
onInsertToCursorPosition?: OnInsertToCursorPositionFunction;
|
|
@@ -24,12 +24,12 @@ export interface CardProps extends Partial<DomBuilderObject> {
|
|
|
24
24
|
}) => void;
|
|
25
25
|
}
|
|
26
26
|
export declare class Card {
|
|
27
|
+
render: ExtendedHTMLElement;
|
|
27
28
|
private readonly props;
|
|
28
29
|
private engagementStartTime;
|
|
29
30
|
private totalMouseDistanceTraveled;
|
|
30
31
|
private previousMousePosition;
|
|
31
32
|
private mouseDownInfo;
|
|
32
|
-
render: ExtendedHTMLElement;
|
|
33
33
|
constructor(props: CardProps);
|
|
34
34
|
private readonly resetEngagement;
|
|
35
35
|
private readonly handleEngagement;
|
|
@@ -7,6 +7,7 @@ import { ChatItemButton } from '../../static';
|
|
|
7
7
|
import { ChatItemFormItemsWrapper } from './chat-item-form-items';
|
|
8
8
|
export interface ChatItemButtonsWrapperProps {
|
|
9
9
|
tabId: string;
|
|
10
|
+
classNames?: string[];
|
|
10
11
|
buttons: ChatItemButton[];
|
|
11
12
|
formItems: ChatItemFormItemsWrapper | null;
|
|
12
13
|
useButtonComponent?: boolean;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import { DomBuilderObject, ExtendedHTMLElement } from '../../helper/dom';
|
|
6
|
+
import { CardRenderDetails, OnCopiedToClipboardFunction, OnInsertToCursorPositionFunction, ReferenceTrackerInformation } from '../../static';
|
|
7
|
+
import { CardBody } from '../card/card-body';
|
|
8
|
+
export interface ChatItemCardContentProps {
|
|
9
|
+
body?: string;
|
|
10
|
+
renderAsStream?: boolean;
|
|
11
|
+
classNames?: string[];
|
|
12
|
+
codeReference?: ReferenceTrackerInformation[];
|
|
13
|
+
onAnimationStateChange?: (isAnimating: boolean) => void;
|
|
14
|
+
contentEvents?: {
|
|
15
|
+
onLinkClick?: (url: string, e: MouseEvent) => void;
|
|
16
|
+
onCopiedToClipboard?: OnCopiedToClipboardFunction;
|
|
17
|
+
onInsertToCursorPosition?: OnInsertToCursorPositionFunction;
|
|
18
|
+
};
|
|
19
|
+
children?: Array<ExtendedHTMLElement | HTMLElement | string | DomBuilderObject>;
|
|
20
|
+
}
|
|
21
|
+
export declare class ChatItemCardContent {
|
|
22
|
+
private props;
|
|
23
|
+
render: ExtendedHTMLElement;
|
|
24
|
+
contentBody: CardBody | null;
|
|
25
|
+
private readonly updateStack;
|
|
26
|
+
private typewriterItemIndex;
|
|
27
|
+
private readonly typewriterId;
|
|
28
|
+
private lastAnimationDuration;
|
|
29
|
+
private updateTimer;
|
|
30
|
+
constructor(props: ChatItemCardContentProps);
|
|
31
|
+
private readonly getCardContent;
|
|
32
|
+
private readonly updateCard;
|
|
33
|
+
readonly updateCardStack: (updateWith: Partial<ChatItemCardContentProps>) => void;
|
|
34
|
+
readonly getRenderDetails: () => CardRenderDetails;
|
|
35
|
+
}
|
|
@@ -4,10 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { ExtendedHTMLElement } from '../../helper/dom';
|
|
6
6
|
import { CardRenderDetails, ChatItem } from '../../static';
|
|
7
|
-
import { CardBody } from '../card/card-body';
|
|
8
|
-
import { ChatItemTreeViewWrapper } from './chat-item-tree-view-wrapper';
|
|
9
|
-
import { ChatItemFormItemsWrapper } from './chat-item-form-items';
|
|
10
|
-
import { ChatItemButtonsWrapper } from './chat-item-buttons';
|
|
11
7
|
export interface ChatItemCardProps {
|
|
12
8
|
tabId: string;
|
|
13
9
|
chatItem: ChatItem;
|
|
@@ -15,24 +11,23 @@ export interface ChatItemCardProps {
|
|
|
15
11
|
export declare class ChatItemCard {
|
|
16
12
|
readonly props: ChatItemCardProps;
|
|
17
13
|
render: ExtendedHTMLElement;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
private
|
|
14
|
+
private readonly card;
|
|
15
|
+
private readonly updateStack;
|
|
16
|
+
private readonly initialSpinner;
|
|
17
|
+
private cardIcon;
|
|
18
|
+
private contentBody;
|
|
19
|
+
private chatAvatar;
|
|
20
|
+
private chatFormItems;
|
|
21
|
+
private customRendererWrapper;
|
|
22
|
+
private chatButtons;
|
|
23
|
+
private fileTreeWrapper;
|
|
24
|
+
private followUps;
|
|
25
|
+
private votes;
|
|
29
26
|
constructor(props: ChatItemCardProps);
|
|
30
27
|
private readonly generateCard;
|
|
31
28
|
private readonly getCardClasses;
|
|
32
|
-
private readonly
|
|
29
|
+
private readonly updateCardContent;
|
|
33
30
|
private readonly getChatAvatar;
|
|
34
|
-
private readonly getInsertedTypewriterPartsCss;
|
|
35
|
-
private readonly getInsertingTypewriterPartsCss;
|
|
36
31
|
private readonly checkCardSnap;
|
|
37
32
|
readonly updateCard: () => void;
|
|
38
33
|
readonly updateCardStack: (updateWith: Partial<ChatItem>) => void;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
import { ExtendedHTMLElement } from '../../helper/dom';
|
|
6
|
+
import { PromptAttachmentType } from '../../static';
|
|
6
7
|
export declare const MAX_USER_INPUT_THRESHOLD = 96;
|
|
7
8
|
export declare const MAX_USER_INPUT: () => number;
|
|
8
9
|
export interface ChatPromptInputProps {
|
|
@@ -16,12 +17,11 @@ export declare class ChatPromptInput {
|
|
|
16
17
|
private readonly promptTextInputCommand;
|
|
17
18
|
private readonly remainingCharsIndicator;
|
|
18
19
|
private readonly sendButton;
|
|
19
|
-
private readonly
|
|
20
|
+
private readonly promptAttachment;
|
|
20
21
|
private quickActionCommands;
|
|
21
22
|
private commandSelector;
|
|
22
23
|
private commandSelectorOpen;
|
|
23
24
|
private selectedCommand;
|
|
24
|
-
private attachment?;
|
|
25
25
|
private filteredCommandsList;
|
|
26
26
|
constructor(props: ChatPromptInputProps);
|
|
27
27
|
private readonly updateAvailableCharactersIndicator;
|
|
@@ -29,6 +29,6 @@ export declare class ChatPromptInput {
|
|
|
29
29
|
private readonly getQuickCommandActions;
|
|
30
30
|
private readonly handleCommandSelection;
|
|
31
31
|
readonly clearTextArea: (keepAttachment?: boolean) => void;
|
|
32
|
-
readonly
|
|
32
|
+
readonly addAttachment: (attachmentContent: string, type?: PromptAttachmentType) => void;
|
|
33
33
|
private readonly sendPrompt;
|
|
34
34
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
import { ExtendedHTMLElement } from '../../helper/dom';
|
|
6
|
-
import { CardRenderDetails, ChatItem } from '../../static';
|
|
6
|
+
import { CardRenderDetails, ChatItem, PromptAttachmentType } from '../../static';
|
|
7
7
|
export declare const CONTAINER_GAP = 12;
|
|
8
8
|
export interface ChatWrapperProps {
|
|
9
9
|
onStopChatResponse?: (tabId: string) => void;
|
|
@@ -23,6 +23,7 @@ export declare class ChatWrapper {
|
|
|
23
23
|
render: ExtendedHTMLElement;
|
|
24
24
|
constructor(props: ChatWrapperProps);
|
|
25
25
|
private readonly insertChatItem;
|
|
26
|
+
private readonly checkLastAnswerStreamChange;
|
|
26
27
|
updateLastChatAnswer: (updateWith: Partial<ChatItem>) => void;
|
|
27
28
|
getChatItem: (messageId: string) => {
|
|
28
29
|
chatItem: ChatItem;
|
|
@@ -31,5 +32,5 @@ export declare class ChatWrapper {
|
|
|
31
32
|
} | undefined;
|
|
32
33
|
endStreamWithMessageId: (messageId: string, updateWith: Partial<ChatItem>) => void;
|
|
33
34
|
updateChatAnswerWithMessageId: (messageId: string, updateWith: Partial<ChatItem>) => void;
|
|
34
|
-
|
|
35
|
+
addAttachmentToPrompt: (textToAdd: string, type?: PromptAttachmentType) => void;
|
|
35
36
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ExtendedHTMLElement } from '../../../helper/dom';
|
|
2
|
+
import { PromptAttachmentType } from '../../../static';
|
|
3
|
+
export interface PromptAttachmentProps {
|
|
4
|
+
tabId: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class PromptAttachment {
|
|
7
|
+
render: ExtendedHTMLElement;
|
|
8
|
+
lastAttachmentContent: string;
|
|
9
|
+
private readonly props;
|
|
10
|
+
private attachmentItem;
|
|
11
|
+
constructor(props: PromptAttachmentProps);
|
|
12
|
+
readonly updateAttachment: (attachmentContent: string | undefined, type?: PromptAttachmentType) => void;
|
|
13
|
+
readonly clear: () => void;
|
|
14
|
+
}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { ExtendedHTMLElement } from '../../../helper/dom';
|
|
2
|
-
|
|
2
|
+
import { PromptAttachmentType } from '../../../static';
|
|
3
|
+
export interface PromptTextAttachmentProps {
|
|
3
4
|
tabId: string;
|
|
4
|
-
|
|
5
|
+
content: string;
|
|
6
|
+
type: PromptAttachmentType;
|
|
5
7
|
}
|
|
6
|
-
export declare class
|
|
8
|
+
export declare class PromptTextAttachment {
|
|
9
|
+
render: ExtendedHTMLElement;
|
|
7
10
|
private readonly props;
|
|
8
11
|
private previewOverlay;
|
|
9
|
-
|
|
10
|
-
constructor(props: ICodeSnippetWidgetProps);
|
|
12
|
+
constructor(props: PromptTextAttachmentProps);
|
|
11
13
|
private readonly showPreviewOverLay;
|
|
12
14
|
private readonly closePreviewOverLay;
|
|
13
|
-
private readonly renderCodeSnippetWidget;
|
|
14
15
|
readonly clear: () => void;
|
|
15
16
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { ExtendedHTMLElement } from '../../../helper/dom';
|
|
2
|
-
export interface
|
|
2
|
+
export interface SendButtonProps {
|
|
3
3
|
tabId: string;
|
|
4
4
|
onClick: () => void;
|
|
5
5
|
}
|
|
6
6
|
export declare class SendButton {
|
|
7
|
-
|
|
8
|
-
private readonly
|
|
9
|
-
constructor(props:
|
|
10
|
-
get render(): ExtendedHTMLElement;
|
|
7
|
+
render: ExtendedHTMLElement;
|
|
8
|
+
private readonly props;
|
|
9
|
+
constructor(props: SendButtonProps);
|
|
11
10
|
}
|
|
@@ -16,7 +16,13 @@ export interface RadioGroupProps {
|
|
|
16
16
|
options?: SelectOption[];
|
|
17
17
|
onChange?: (value: string) => void;
|
|
18
18
|
}
|
|
19
|
-
export declare class
|
|
19
|
+
export declare abstract class RadioGroupAbstract {
|
|
20
|
+
render: ExtendedHTMLElement;
|
|
21
|
+
setValue: (value: string) => void;
|
|
22
|
+
getValue: () => string;
|
|
23
|
+
setEnabled: (enabled: boolean) => void;
|
|
24
|
+
}
|
|
25
|
+
export declare class RadioGroupInternal extends RadioGroupAbstract {
|
|
20
26
|
private readonly radioGroupElement;
|
|
21
27
|
private readonly groupName;
|
|
22
28
|
render: ExtendedHTMLElement;
|
|
@@ -25,4 +31,11 @@ export declare class RadioGroup {
|
|
|
25
31
|
getValue: () => string;
|
|
26
32
|
setEnabled: (enabled: boolean) => void;
|
|
27
33
|
}
|
|
34
|
+
export declare class RadioGroup extends RadioGroupAbstract {
|
|
35
|
+
render: ExtendedHTMLElement;
|
|
36
|
+
constructor(props: RadioGroupProps);
|
|
37
|
+
setValue: (value: string) => void;
|
|
38
|
+
getValue: () => string;
|
|
39
|
+
setEnabled: (enabled: boolean) => void;
|
|
40
|
+
}
|
|
28
41
|
export {};
|
|
@@ -16,9 +16,16 @@ export interface SelectProps {
|
|
|
16
16
|
value?: string;
|
|
17
17
|
optional?: boolean;
|
|
18
18
|
options?: SelectOption[];
|
|
19
|
+
placeholder?: string;
|
|
19
20
|
onChange?: (value: string) => void;
|
|
20
21
|
}
|
|
21
|
-
export declare class
|
|
22
|
+
export declare abstract class SelectAbstract {
|
|
23
|
+
render: ExtendedHTMLElement;
|
|
24
|
+
setValue: (value: string) => void;
|
|
25
|
+
getValue: () => string;
|
|
26
|
+
setEnabled: (enabled: boolean) => void;
|
|
27
|
+
}
|
|
28
|
+
export declare class SelectInternal {
|
|
22
29
|
private readonly selectElement;
|
|
23
30
|
render: ExtendedHTMLElement;
|
|
24
31
|
constructor(props: SelectProps);
|
|
@@ -26,4 +33,11 @@ export declare class Select {
|
|
|
26
33
|
getValue: () => string;
|
|
27
34
|
setEnabled: (enabled: boolean) => void;
|
|
28
35
|
}
|
|
36
|
+
export declare class Select extends SelectAbstract {
|
|
37
|
+
render: ExtendedHTMLElement;
|
|
38
|
+
constructor(props: SelectProps);
|
|
39
|
+
setValue: (value: string) => void;
|
|
40
|
+
getValue: () => string;
|
|
41
|
+
setEnabled: (enabled: boolean) => void;
|
|
42
|
+
}
|
|
29
43
|
export {};
|
|
@@ -11,7 +11,13 @@ export interface TextAreaProps {
|
|
|
11
11
|
value?: string;
|
|
12
12
|
onChange?: (value: string) => void;
|
|
13
13
|
}
|
|
14
|
-
export declare class
|
|
14
|
+
export declare abstract class TextAreaAbstract {
|
|
15
|
+
render: ExtendedHTMLElement;
|
|
16
|
+
setValue: (value: string) => void;
|
|
17
|
+
getValue: () => string;
|
|
18
|
+
setEnabled: (enabled: boolean) => void;
|
|
19
|
+
}
|
|
20
|
+
export declare class TextAreaInternal extends TextAreaAbstract {
|
|
15
21
|
private readonly inputElement;
|
|
16
22
|
render: ExtendedHTMLElement;
|
|
17
23
|
constructor(props: TextAreaProps);
|
|
@@ -19,3 +25,10 @@ export declare class TextArea {
|
|
|
19
25
|
getValue: () => string;
|
|
20
26
|
setEnabled: (enabled: boolean) => void;
|
|
21
27
|
}
|
|
28
|
+
export declare class TextArea extends TextAreaAbstract {
|
|
29
|
+
render: ExtendedHTMLElement;
|
|
30
|
+
constructor(props: TextAreaProps);
|
|
31
|
+
setValue: (value: string) => void;
|
|
32
|
+
getValue: () => string;
|
|
33
|
+
setEnabled: (enabled: boolean) => void;
|
|
34
|
+
}
|
|
@@ -8,11 +8,17 @@ export interface TextInputProps {
|
|
|
8
8
|
attributes?: Record<string, string>;
|
|
9
9
|
label?: HTMLElement | ExtendedHTMLElement | string;
|
|
10
10
|
placeholder?: string;
|
|
11
|
-
|
|
11
|
+
type?: 'text' | 'number' | 'email';
|
|
12
12
|
value?: string;
|
|
13
13
|
onChange?: (value: string) => void;
|
|
14
14
|
}
|
|
15
|
-
export declare class
|
|
15
|
+
export declare abstract class TextInputAbstract {
|
|
16
|
+
render: ExtendedHTMLElement;
|
|
17
|
+
setValue: (value: string) => void;
|
|
18
|
+
getValue: () => string;
|
|
19
|
+
setEnabled: (enabled: boolean) => void;
|
|
20
|
+
}
|
|
21
|
+
export declare class TextInputInternal extends TextInputAbstract {
|
|
16
22
|
private readonly inputElement;
|
|
17
23
|
render: ExtendedHTMLElement;
|
|
18
24
|
constructor(props: TextInputProps);
|
|
@@ -20,3 +26,10 @@ export declare class TextInput {
|
|
|
20
26
|
getValue: () => string;
|
|
21
27
|
setEnabled: (enabled: boolean) => void;
|
|
22
28
|
}
|
|
29
|
+
export declare class TextInput extends TextInputAbstract {
|
|
30
|
+
render: ExtendedHTMLElement;
|
|
31
|
+
constructor(props: TextInputProps);
|
|
32
|
+
setValue: (value: string) => void;
|
|
33
|
+
getValue: () => string;
|
|
34
|
+
setEnabled: (enabled: boolean) => void;
|
|
35
|
+
}
|
|
@@ -62,6 +62,7 @@ export interface SyntaxHighlighterProps {
|
|
|
62
62
|
}
|
|
63
63
|
export declare class SyntaxHighlighter {
|
|
64
64
|
private readonly props?;
|
|
65
|
+
private readonly codeBlockButtons;
|
|
65
66
|
render: ExtendedHTMLElement;
|
|
66
67
|
constructor(props: SyntaxHighlighterProps);
|
|
67
68
|
private readonly getSelectedCodeContextMenu;
|
package/dist/helper/config.d.ts
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
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 { ConfigModel, ConfigOptions, ConfigTexts } from '../static';
|
|
5
|
+
import { ComponentOverrides, ConfigModel, ConfigOptions, ConfigTexts } from '../static';
|
|
6
6
|
interface ConfigFullModel extends ConfigOptions {
|
|
7
7
|
texts: ConfigTexts;
|
|
8
|
+
componentClasses: ComponentOverrides;
|
|
8
9
|
}
|
|
9
10
|
export declare class Config {
|
|
10
11
|
private static instance;
|
package/dist/helper/dom.d.ts
CHANGED
|
@@ -51,6 +51,7 @@ export declare class DomBuilder {
|
|
|
51
51
|
private portals;
|
|
52
52
|
private constructor();
|
|
53
53
|
static getInstance(rootSelector?: string): DomBuilder;
|
|
54
|
+
setRoot: (rootSelector?: string) => void;
|
|
54
55
|
addClass: (this: ExtendedHTMLElement, className: string) => ExtendedHTMLElement;
|
|
55
56
|
removeClass: (this: ExtendedHTMLElement, className: string) => ExtendedHTMLElement;
|
|
56
57
|
toggleClass: (this: ExtendedHTMLElement, className: string) => ExtendedHTMLElement;
|
|
@@ -66,4 +67,5 @@ export declare class DomBuilder {
|
|
|
66
67
|
removeAllPortals: (portalsWithName: MynahPortalNames) => void;
|
|
67
68
|
}
|
|
68
69
|
export declare const htmlDecode: (input: string) => string;
|
|
70
|
+
export declare const getTypewriterPartsCss: (typewriterId: string, lastVisibleItemIndex: number, totalNumberOfItems: number, timeForEach: number) => ExtendedHTMLElement;
|
|
69
71
|
export {};
|
package/dist/main.d.ts
CHANGED
|
@@ -2,13 +2,21 @@
|
|
|
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 { RelevancyVoteType, FeedbackPayload, MynahUIDataModel, NotificationType, ChatItem, ChatItemAction, ChatPrompt, MynahUITabStoreModel, MynahUITabStoreTab, ConfigModel, ReferenceTrackerInformation, CodeSelectionType, Engagement, ChatItemFormItem, ChatItemButton, CardRenderDetails } from './static';
|
|
5
|
+
import { RelevancyVoteType, FeedbackPayload, MynahUIDataModel, NotificationType, ChatItem, ChatItemAction, ChatPrompt, MynahUITabStoreModel, MynahUITabStoreTab, ConfigModel, ReferenceTrackerInformation, CodeSelectionType, Engagement, ChatItemFormItem, ChatItemButton, CardRenderDetails, PromptAttachmentType } from './static';
|
|
6
6
|
import './styles/styles.scss';
|
|
7
|
+
export { generateUID } from './helper/guid';
|
|
7
8
|
export { ChatItemBodyRenderer, } from './helper/dom';
|
|
8
9
|
export { AllowedAttributesInCustomRenderer, AllowedTagsInCustomRenderer } from './helper/sanitize';
|
|
9
|
-
export
|
|
10
|
+
export * from './static';
|
|
10
11
|
export { ToggleOption } from './components/toggle';
|
|
11
12
|
export { MynahIcons } from './components/icon';
|
|
13
|
+
export { DomBuilder, DomBuilderObject, ExtendedHTMLElement, } from './helper/dom';
|
|
14
|
+
export { ButtonProps, ButtonAbstract } from './components/button';
|
|
15
|
+
export { RadioGroupProps, RadioGroupAbstract } from './components/form-items/radio-group';
|
|
16
|
+
export { SelectProps, SelectAbstract } from './components/form-items/select';
|
|
17
|
+
export { TextInputProps, TextInputAbstract } from './components/form-items/text-input';
|
|
18
|
+
export { TextAreaProps, TextAreaAbstract } from './components/form-items/text-area';
|
|
19
|
+
export { ChatItemCardContent, ChatItemCardContentProps } from './components/chat-item/chat-item-card-content';
|
|
12
20
|
export interface MynahUIProps {
|
|
13
21
|
rootSelector?: string;
|
|
14
22
|
defaults?: MynahUITabStoreTab;
|
|
@@ -66,7 +74,7 @@ export declare class MynahUI {
|
|
|
66
74
|
private readonly getUserEventId;
|
|
67
75
|
private readonly focusToInput;
|
|
68
76
|
private readonly addGlobalListeners;
|
|
69
|
-
addToUserPrompt: (tabId: string,
|
|
77
|
+
addToUserPrompt: (tabId: string, attachmentContent: string, type?: PromptAttachmentType) => void;
|
|
70
78
|
/**
|
|
71
79
|
* Adds a new item to the chat window
|
|
72
80
|
* @param tabId Corresponding tab ID.
|
|
@@ -133,12 +141,12 @@ export declare class MynahUI {
|
|
|
133
141
|
/**
|
|
134
142
|
* -1 for infinite
|
|
135
143
|
*/
|
|
136
|
-
duration?: number
|
|
137
|
-
type?: NotificationType
|
|
138
|
-
title?: string
|
|
144
|
+
duration?: number;
|
|
145
|
+
type?: NotificationType;
|
|
146
|
+
title?: string;
|
|
139
147
|
content: string;
|
|
140
|
-
onNotificationClick?: (
|
|
141
|
-
onNotificationHide?: (
|
|
148
|
+
onNotificationClick?: (eventId: string) => void;
|
|
149
|
+
onNotificationHide?: (eventId: string) => void;
|
|
142
150
|
}) => void;
|
|
143
151
|
/**
|
|
144
152
|
* Simply creates and shows a notification
|