@aws/mynah-ui 4.15.11 → 4.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +36 -49
- package/.husky/pre-push +3 -0
- package/.prettierignore +9 -0
- package/.prettierrc +8 -0
- package/README.md +3 -2
- package/dist/components/button.d.ts +1 -0
- package/dist/components/card/card-body.d.ts +1 -0
- package/dist/components/chat-item/chat-item-buttons.d.ts +3 -3
- package/dist/components/chat-item/chat-item-card-content.d.ts +1 -0
- package/dist/components/chat-item/chat-prompt-input.d.ts +4 -1
- package/dist/components/chat-item/prompt-input/prompt-progress.d.ts +11 -0
- package/dist/components/chat-item/prompt-input/prompt-text-input.d.ts +1 -0
- package/dist/components/collapsible-content.d.ts +1 -0
- package/dist/components/form-items/radio-group.d.ts +2 -0
- package/dist/components/form-items/select.d.ts +2 -0
- package/dist/components/form-items/stars.d.ts +2 -0
- package/dist/components/form-items/text-area.d.ts +1 -0
- package/dist/components/form-items/text-input.d.ts +1 -0
- package/dist/components/icon.d.ts +8 -1
- package/dist/components/overlay.d.ts +1 -0
- package/dist/components/progress.d.ts +28 -0
- package/dist/components/toggle.d.ts +1 -0
- package/dist/helper/dom.d.ts +2 -0
- package/dist/helper/test-ids.d.ts +141 -0
- package/dist/main.d.ts +5 -0
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/static.d.ts +31 -1
- package/docs/CONFIG.md +18 -0
- package/docs/img/characterLimitWarning.png +0 -0
- package/jest.config.js +1 -0
- package/package.json +91 -97
- package/postinstall.js +5 -5
- package/ui-tests/dist/27f62b53b93858475a7f.ttf +0 -0
- package/ui-tests/dist/d50a80138ec4f2fb5e9f.ttf +0 -0
- package/ui-tests/dist/index.html +9 -0
- package/ui-tests/dist/main.js +1344 -0
- package/ui-tests/dist/main.js.map +1 -0
- package/ui-tests/jest.config.js +19 -0
- package/ui-tests/package.json +45 -0
- package/ui-tests/test-results/.last-run.json +4 -0
- package/dist/components/chat-item/chat-item-followup-option.d.ts +0 -21
package/.eslintrc.js
CHANGED
|
@@ -1,50 +1,37 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
{
|
|
39
|
-
"multiline": {
|
|
40
|
-
"delimiter": "semi",
|
|
41
|
-
"requireLast": true
|
|
42
|
-
},
|
|
43
|
-
"singleline": {
|
|
44
|
-
"delimiter": "semi",
|
|
45
|
-
"requireLast": false
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
]
|
|
49
|
-
}
|
|
50
|
-
}
|
|
2
|
+
env: {
|
|
3
|
+
browser: true,
|
|
4
|
+
es2021: true,
|
|
5
|
+
node: true,
|
|
6
|
+
},
|
|
7
|
+
extends: ['standard-with-typescript'],
|
|
8
|
+
parser: '@typescript-eslint/parser',
|
|
9
|
+
parserOptions: {
|
|
10
|
+
tsconfigRootDir: __dirname,
|
|
11
|
+
ecmaVersion: 'latest',
|
|
12
|
+
sourceType: 'module',
|
|
13
|
+
project: ['./tsconfig.json', './ui-tests/tsconfig.json'],
|
|
14
|
+
},
|
|
15
|
+
plugins: ['@typescript-eslint', 'prettier'],
|
|
16
|
+
rules: {
|
|
17
|
+
'no-case-declarations': 'off',
|
|
18
|
+
'@typescript-eslint/no-floating-promises': 'off',
|
|
19
|
+
'@typescript-eslint/semi': [2, 'always'],
|
|
20
|
+
'comma-dangle': [2, 'only-multiline'],
|
|
21
|
+
'array-bracket-spacing': [2, 'always'],
|
|
22
|
+
'no-useless-call': 'off',
|
|
23
|
+
'@typescript-eslint/member-delimiter-style': [
|
|
24
|
+
'error',
|
|
25
|
+
{
|
|
26
|
+
multiline: {
|
|
27
|
+
delimiter: 'semi',
|
|
28
|
+
requireLast: true,
|
|
29
|
+
},
|
|
30
|
+
singleline: {
|
|
31
|
+
delimiter: 'semi',
|
|
32
|
+
requireLast: false,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
};
|
package/.husky/pre-push
ADDED
package/.prettierignore
ADDED
package/.prettierrc
ADDED
package/README.md
CHANGED
|
@@ -30,9 +30,10 @@ Mynah UI operates independently of any framework or UI library, enabling seamles
|
|
|
30
30
|
> Local environment quick start
|
|
31
31
|
```console
|
|
32
32
|
git clone git@github.com:aws/mynah-ui.git
|
|
33
|
-
cd mynah-ui
|
|
34
|
-
npm
|
|
33
|
+
cd mynah-ui && npm install
|
|
34
|
+
cd example && npm install
|
|
35
35
|
```
|
|
36
|
+
Now run `npm watch` in both the `mynah-ui` and the `example` directories, and open `mynah-ui/example/dist/index.html` in a browser of choice.
|
|
36
37
|
|
|
37
38
|
#### Guides and documentation
|
|
38
39
|
Please refer to the following guides:
|
|
@@ -9,6 +9,7 @@ export interface ButtonProps {
|
|
|
9
9
|
classNames?: string[];
|
|
10
10
|
attributes?: Record<string, string>;
|
|
11
11
|
icon?: HTMLElement | ExtendedHTMLElement;
|
|
12
|
+
testId?: string;
|
|
12
13
|
label?: HTMLElement | ExtendedHTMLElement | string;
|
|
13
14
|
tooltip?: string;
|
|
14
15
|
tooltipVerticalDirection?: OverlayVerticalDirection;
|
|
@@ -19,6 +19,7 @@ export declare const PARTS_CLASS_NAME = "typewriter-part";
|
|
|
19
19
|
export declare const PARTS_CLASS_NAME_VISIBLE = "typewriter";
|
|
20
20
|
export interface CardBodyProps {
|
|
21
21
|
body?: string;
|
|
22
|
+
testId?: string;
|
|
22
23
|
children?: Array<ExtendedHTMLElement | HTMLElement | string | DomBuilderObject>;
|
|
23
24
|
childLocation?: 'above-body' | 'below-body';
|
|
24
25
|
highlightRangeWithTooltip?: ReferenceTrackerInformation[];
|
|
@@ -6,11 +6,11 @@ import { ExtendedHTMLElement } from '../../helper/dom';
|
|
|
6
6
|
import { ChatItemButton } from '../../static';
|
|
7
7
|
import { ChatItemFormItemsWrapper } from './chat-item-form-items';
|
|
8
8
|
export interface ChatItemButtonsWrapperProps {
|
|
9
|
-
tabId
|
|
9
|
+
tabId?: string;
|
|
10
10
|
classNames?: string[];
|
|
11
11
|
buttons: ChatItemButton[];
|
|
12
|
-
formItems
|
|
13
|
-
onActionClick
|
|
12
|
+
formItems?: ChatItemFormItemsWrapper | null;
|
|
13
|
+
onActionClick?: (action: ChatItemButton, e?: Event) => void;
|
|
14
14
|
}
|
|
15
15
|
export declare class ChatItemButtonsWrapper {
|
|
16
16
|
private readonly props;
|
|
@@ -7,6 +7,7 @@ import { CardRenderDetails, CodeBlockActions, OnCodeBlockActionFunction, OnCopie
|
|
|
7
7
|
import { CardBody } from '../card/card-body';
|
|
8
8
|
export interface ChatItemCardContentProps {
|
|
9
9
|
body?: string;
|
|
10
|
+
testId?: string;
|
|
10
11
|
renderAsStream?: boolean;
|
|
11
12
|
classNames?: string[];
|
|
12
13
|
codeReference?: ReferenceTrackerInformation[];
|
|
@@ -6,6 +6,7 @@ import { ExtendedHTMLElement } from '../../helper/dom';
|
|
|
6
6
|
import { PromptAttachmentType } from '../../static';
|
|
7
7
|
export declare const MAX_USER_INPUT_THRESHOLD = 96;
|
|
8
8
|
export declare const MAX_USER_INPUT: () => number;
|
|
9
|
+
export declare const INPUT_LENGTH_WARNING_THRESHOLD: () => number;
|
|
9
10
|
export interface ChatPromptInputProps {
|
|
10
11
|
tabId: string;
|
|
11
12
|
}
|
|
@@ -15,9 +16,11 @@ export declare class ChatPromptInput {
|
|
|
15
16
|
private readonly attachmentWrapper;
|
|
16
17
|
private readonly promptTextInput;
|
|
17
18
|
private readonly promptTextInputCommand;
|
|
18
|
-
private readonly remainingCharsIndicator;
|
|
19
19
|
private readonly sendButton;
|
|
20
|
+
private readonly progressIndicator;
|
|
20
21
|
private readonly promptAttachment;
|
|
22
|
+
private readonly chatPrompt;
|
|
23
|
+
private remainingCharsOverlay;
|
|
21
24
|
private quickPickTriggerIndex;
|
|
22
25
|
private quickPickType;
|
|
23
26
|
private textAfter;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ExtendedHTMLElement } from '../../../helper/dom';
|
|
2
|
+
export interface PromptInputProgressProps {
|
|
3
|
+
tabId: string;
|
|
4
|
+
}
|
|
5
|
+
export declare class PromptInputProgress {
|
|
6
|
+
render: ExtendedHTMLElement;
|
|
7
|
+
private readonly progressIndicator;
|
|
8
|
+
private progressData;
|
|
9
|
+
private readonly props;
|
|
10
|
+
constructor(props: PromptInputProgressProps);
|
|
11
|
+
}
|
|
@@ -6,6 +6,7 @@ import { DomBuilderObject, ExtendedHTMLElement } from '../helper/dom';
|
|
|
6
6
|
import '../styles/components/_collapsible-content.scss';
|
|
7
7
|
interface CollapsibleContentProps {
|
|
8
8
|
title: string | ExtendedHTMLElement | HTMLElement | DomBuilderObject;
|
|
9
|
+
testId?: string;
|
|
9
10
|
children: Array<string | ExtendedHTMLElement | HTMLElement | DomBuilderObject>;
|
|
10
11
|
classNames?: string[];
|
|
11
12
|
initialCollapsedState?: boolean;
|
|
@@ -16,6 +16,8 @@ export interface RadioGroupProps {
|
|
|
16
16
|
optional?: boolean;
|
|
17
17
|
options?: SelectOption[];
|
|
18
18
|
onChange?: (value: string) => void;
|
|
19
|
+
wrapperTestId?: string;
|
|
20
|
+
optionTestId?: string;
|
|
19
21
|
}
|
|
20
22
|
export declare abstract class RadioGroupAbstract {
|
|
21
23
|
render: ExtendedHTMLElement;
|
|
@@ -19,6 +19,8 @@ export interface SelectProps {
|
|
|
19
19
|
options?: SelectOption[];
|
|
20
20
|
placeholder?: string;
|
|
21
21
|
onChange?: (value: string) => void;
|
|
22
|
+
wrapperTestId?: string;
|
|
23
|
+
optionTestId?: string;
|
|
22
24
|
}
|
|
23
25
|
export declare abstract class SelectAbstract {
|
|
24
26
|
render: ExtendedHTMLElement;
|
|
@@ -55,7 +55,14 @@ export declare enum MynahIcons {
|
|
|
55
55
|
CURSOR_INSERT = "cursor-insert",
|
|
56
56
|
TEXT_SELECT = "text-select",
|
|
57
57
|
REVERT = "revert",
|
|
58
|
-
ASTERISK = "asterisk"
|
|
58
|
+
ASTERISK = "asterisk",
|
|
59
|
+
BUG = "bug",
|
|
60
|
+
CHECK_LIST = "check-list",
|
|
61
|
+
DEPLOY = "deploy",
|
|
62
|
+
HELP = "help",
|
|
63
|
+
MESSAGE = "message",
|
|
64
|
+
TRASH = "trash",
|
|
65
|
+
TRANSFORM = "transform"
|
|
59
66
|
}
|
|
60
67
|
export interface IconProps {
|
|
61
68
|
icon: MynahIcons;
|
|
@@ -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 '../styles/components/_collapsible-content.scss';
|
|
7
|
+
import { ChatItemButton, ProgressField } from '../static';
|
|
8
|
+
import '../styles/components/_progress.scss';
|
|
9
|
+
interface ProgressIndicatorProps extends ProgressField {
|
|
10
|
+
testId?: string;
|
|
11
|
+
classNames?: string[];
|
|
12
|
+
onClick?: () => void;
|
|
13
|
+
onActionClick?: (actionName: ChatItemButton, e?: Event) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare class ProgressIndicator {
|
|
16
|
+
render: ExtendedHTMLElement;
|
|
17
|
+
private readonly wrapper;
|
|
18
|
+
private readonly text;
|
|
19
|
+
private readonly valueText;
|
|
20
|
+
private readonly valueBar;
|
|
21
|
+
private buttonsWrapper;
|
|
22
|
+
private props;
|
|
23
|
+
constructor(props: ProgressIndicatorProps);
|
|
24
|
+
private readonly getButtonsWrapper;
|
|
25
|
+
isEmpty: () => boolean;
|
|
26
|
+
update: (props: Partial<ProgressField> | null) => void;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
package/dist/helper/dom.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export interface DomBuilderObject extends GenericDomBuilderAttributes {
|
|
|
25
25
|
type: string;
|
|
26
26
|
children?: Array<string | DomBuilderObject | HTMLElement | ExtendedHTMLElement> | undefined;
|
|
27
27
|
innerHTML?: string | undefined;
|
|
28
|
+
testId?: string;
|
|
28
29
|
persistent?: boolean | undefined;
|
|
29
30
|
}
|
|
30
31
|
export interface DomBuilderObjectFilled {
|
|
@@ -33,6 +34,7 @@ export interface DomBuilderObjectFilled {
|
|
|
33
34
|
events?: Record<string, (event?: any) => any>;
|
|
34
35
|
children?: Array<string | DomBuilderObject | HTMLElement | ExtendedHTMLElement>;
|
|
35
36
|
innerHTML?: string | undefined;
|
|
37
|
+
testId?: string;
|
|
36
38
|
persistent?: boolean;
|
|
37
39
|
}
|
|
38
40
|
export interface ExtendedHTMLElement extends HTMLInputElement {
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
selector: string;
|
|
3
|
+
prompt: {
|
|
4
|
+
wrapper: string;
|
|
5
|
+
attachmentWrapper: string;
|
|
6
|
+
attachment: string;
|
|
7
|
+
attachmentRemove: string;
|
|
8
|
+
send: string;
|
|
9
|
+
input: string;
|
|
10
|
+
inputWrapper: string;
|
|
11
|
+
remainingCharsIndicator: string;
|
|
12
|
+
selectedCommand: string;
|
|
13
|
+
quickPicksWrapper: string;
|
|
14
|
+
quickPicksGroup: string;
|
|
15
|
+
quickPicksGroupTitle: string;
|
|
16
|
+
quickPickItem: string;
|
|
17
|
+
footerInfo: string;
|
|
18
|
+
footerInfoBody: string;
|
|
19
|
+
stickyCard: string;
|
|
20
|
+
progress: string;
|
|
21
|
+
};
|
|
22
|
+
chat: {
|
|
23
|
+
wrapper: string;
|
|
24
|
+
chatItemsContainer: string;
|
|
25
|
+
middleBlockWrapper: string;
|
|
26
|
+
stopButton: string;
|
|
27
|
+
};
|
|
28
|
+
chatItem: {
|
|
29
|
+
type: {
|
|
30
|
+
any: string;
|
|
31
|
+
answer: string;
|
|
32
|
+
answerStream: string;
|
|
33
|
+
prompt: string;
|
|
34
|
+
aiPrompt: string;
|
|
35
|
+
systemPrompt: string;
|
|
36
|
+
};
|
|
37
|
+
card: string;
|
|
38
|
+
cardBody: string;
|
|
39
|
+
buttons: {
|
|
40
|
+
wrapper: string;
|
|
41
|
+
button: string;
|
|
42
|
+
};
|
|
43
|
+
chatItemFollowup: {
|
|
44
|
+
optionsWrapper: string;
|
|
45
|
+
optionButton: string;
|
|
46
|
+
title: string;
|
|
47
|
+
wrapper: string;
|
|
48
|
+
};
|
|
49
|
+
syntaxHighlighter: {
|
|
50
|
+
wrapper: string;
|
|
51
|
+
codeBlock: string;
|
|
52
|
+
lineNumbers: string;
|
|
53
|
+
language: string;
|
|
54
|
+
buttonsWrapper: string;
|
|
55
|
+
button: string;
|
|
56
|
+
};
|
|
57
|
+
chatItemForm: {
|
|
58
|
+
wrapper: string;
|
|
59
|
+
title: string;
|
|
60
|
+
itemSelectWrapper: string;
|
|
61
|
+
itemSelect: string;
|
|
62
|
+
itemRadioWrapper: string;
|
|
63
|
+
itemRadio: string;
|
|
64
|
+
itemInput: string;
|
|
65
|
+
itemStarsWrapper: string;
|
|
66
|
+
itemStars: string;
|
|
67
|
+
itemTextArea: string;
|
|
68
|
+
};
|
|
69
|
+
vote: {
|
|
70
|
+
wrapper: string;
|
|
71
|
+
upvote: string;
|
|
72
|
+
upvoteLabel: string;
|
|
73
|
+
downvote: string;
|
|
74
|
+
downvoteLabel: string;
|
|
75
|
+
reportButton: string;
|
|
76
|
+
thanks: string;
|
|
77
|
+
};
|
|
78
|
+
relatedLinks: {
|
|
79
|
+
showMore: string;
|
|
80
|
+
wrapper: string;
|
|
81
|
+
title: string;
|
|
82
|
+
linkWrapper: string;
|
|
83
|
+
link: string;
|
|
84
|
+
linkPreviewOverlay: string;
|
|
85
|
+
linkPreviewOverlayCard: string;
|
|
86
|
+
};
|
|
87
|
+
fileTree: {
|
|
88
|
+
wrapper: string;
|
|
89
|
+
title: string;
|
|
90
|
+
license: string;
|
|
91
|
+
folder: string;
|
|
92
|
+
file: string;
|
|
93
|
+
fileAction: string;
|
|
94
|
+
fileTooltipWrapper: string;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
feedbackForm: {
|
|
98
|
+
wrapper: string;
|
|
99
|
+
title: string;
|
|
100
|
+
optionsSelectWrapper: string;
|
|
101
|
+
optionsSelect: string;
|
|
102
|
+
comment: string;
|
|
103
|
+
closeButton: string;
|
|
104
|
+
cancelButton: string;
|
|
105
|
+
submitButton: string;
|
|
106
|
+
};
|
|
107
|
+
customFeedbackForm: {
|
|
108
|
+
wrapper: string;
|
|
109
|
+
title: string;
|
|
110
|
+
description: string;
|
|
111
|
+
closeButton: string;
|
|
112
|
+
};
|
|
113
|
+
tabBar: {
|
|
114
|
+
wrapper: string;
|
|
115
|
+
buttonsWrapper: string;
|
|
116
|
+
button: string;
|
|
117
|
+
menuButton: string;
|
|
118
|
+
menuOption: string;
|
|
119
|
+
tabsWrapper: string;
|
|
120
|
+
tabOptionWrapper: string;
|
|
121
|
+
tabOption: string;
|
|
122
|
+
tabOptionLabel: string;
|
|
123
|
+
tabOptionCloseButton: string;
|
|
124
|
+
tabAddButton: string;
|
|
125
|
+
maxTabsReachedOverlay: string;
|
|
126
|
+
tabCloseConfirmationOverlay: string;
|
|
127
|
+
tabCloseConfirmationBody: string;
|
|
128
|
+
tabCloseConfirmationCancelButton: string;
|
|
129
|
+
tabCloseConfirmationAcceptButton: string;
|
|
130
|
+
};
|
|
131
|
+
noTabs: {
|
|
132
|
+
wrapper: string;
|
|
133
|
+
newTabButton: string;
|
|
134
|
+
};
|
|
135
|
+
notification: {
|
|
136
|
+
wrapper: string;
|
|
137
|
+
title: string;
|
|
138
|
+
content: string;
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
export default _default;
|
package/dist/main.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export { SelectProps, SelectAbstract } from './components/form-items/select';
|
|
|
17
17
|
export { TextInputProps, TextInputAbstract } from './components/form-items/text-input';
|
|
18
18
|
export { TextAreaProps, TextAreaAbstract } from './components/form-items/text-area';
|
|
19
19
|
export { ChatItemCardContent, ChatItemCardContentProps } from './components/chat-item/chat-item-card-content';
|
|
20
|
+
export { default as MynahUITestIds } from './helper/test-ids';
|
|
20
21
|
export interface MynahUIProps {
|
|
21
22
|
rootSelector?: string;
|
|
22
23
|
defaults?: MynahUITabStoreTab;
|
|
@@ -29,6 +30,10 @@ export interface MynahUIProps {
|
|
|
29
30
|
onStopChatResponse?: (tabId: string, eventId?: string) => void;
|
|
30
31
|
onResetStore?: (tabId: string) => void;
|
|
31
32
|
onChatPrompt?: (tabId: string, prompt: ChatPrompt, eventId?: string) => void;
|
|
33
|
+
onChatPromptProgressActionButtonClicked?: (tabId: string, action: {
|
|
34
|
+
id: string;
|
|
35
|
+
text?: string;
|
|
36
|
+
}, eventId?: string) => void;
|
|
32
37
|
onFollowUpClicked?: (tabId: string, messageId: string, followUp: ChatItemAction, eventId?: string) => void;
|
|
33
38
|
onInBodyButtonClicked?: (tabId: string, messageId: string, action: {
|
|
34
39
|
id: string;
|