@aws/mynah-ui 4.23.0-beta.4 → 4.23.0-beta.6
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/chat-item/chat-item-card.d.ts +3 -0
- package/dist/components/chat-item/chat-item-form-items.d.ts +1 -0
- package/dist/components/chat-item/chat-item-tree-view-wrapper.d.ts +2 -0
- package/dist/components/chat-item/chat-item-tree-view.d.ts +3 -0
- package/dist/components/chat-item/chat-prompt-input.d.ts +2 -0
- package/dist/components/chat-item/prompt-input/prompt-input-quick-pick-item.d.ts +13 -0
- package/dist/components/chat-item/prompt-input/prompt-input-quick-pick-selector.d.ts +18 -0
- package/dist/components/chat-item/prompt-input/prompt-text-input.d.ts +2 -1
- package/dist/components/form-items/text-area.d.ts +11 -0
- package/dist/components/form-items/text-input.d.ts +11 -0
- package/dist/helper/quick-pick-data-handler.d.ts +2 -3
- package/dist/helper/validator.d.ts +14 -0
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/static.d.ts +30 -10
- package/docs/DATAMODEL.md +42 -0
- package/docs/img/data-model/chatItems/header.png +0 -0
- package/package.json +1 -1
package/dist/static.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { ChatItemBodyRenderer } from './helper/dom';
|
|
|
7
7
|
import { SelectAbstract, SelectProps, RadioGroupAbstract, RadioGroupProps, ButtonAbstract, ButtonProps, TextInputProps, TextInputAbstract, TextAreaProps, TextAreaAbstract, ToggleOption } from './main';
|
|
8
8
|
export interface QuickActionCommand {
|
|
9
9
|
command: string;
|
|
10
|
+
id?: string;
|
|
10
11
|
label?: string;
|
|
11
12
|
disabled?: boolean;
|
|
12
13
|
icon?: MynahIcons | MynahIconsType;
|
|
@@ -15,17 +16,11 @@ export interface QuickActionCommand {
|
|
|
15
16
|
children?: QuickActionCommandGroup[];
|
|
16
17
|
route?: string[];
|
|
17
18
|
}
|
|
18
|
-
export interface QuickActionCommandInternal extends QuickActionCommand {
|
|
19
|
-
route?: string[];
|
|
20
|
-
}
|
|
21
19
|
export interface QuickActionCommandGroup {
|
|
22
20
|
groupName?: string;
|
|
23
21
|
actions?: Action[];
|
|
24
22
|
commands: QuickActionCommand[];
|
|
25
23
|
}
|
|
26
|
-
export interface QuickActionCommandGroupInternal extends QuickActionCommandGroup {
|
|
27
|
-
commands: QuickActionCommandInternal[];
|
|
28
|
-
}
|
|
29
24
|
/**
|
|
30
25
|
* data store model to update the mynah ui partially or fully
|
|
31
26
|
*/
|
|
@@ -233,6 +228,7 @@ export interface TreeNodeDetails {
|
|
|
233
228
|
clickable?: boolean;
|
|
234
229
|
}
|
|
235
230
|
export interface ChatItemContent {
|
|
231
|
+
header?: ChatItemContent | null;
|
|
236
232
|
body?: string | null;
|
|
237
233
|
customRenderer?: string | ChatItemBodyRenderer | ChatItemBodyRenderer[] | null;
|
|
238
234
|
followUp?: {
|
|
@@ -249,6 +245,8 @@ export interface ChatItemContent {
|
|
|
249
245
|
rootFolderTitle?: string;
|
|
250
246
|
filePaths?: string[];
|
|
251
247
|
deletedFiles?: string[];
|
|
248
|
+
collapsedByDefault?: boolean;
|
|
249
|
+
hideFileCount?: boolean;
|
|
252
250
|
actions?: Record<string, FileNodeAction[]>;
|
|
253
251
|
details?: Record<string, TreeNodeDetails>;
|
|
254
252
|
} | null;
|
|
@@ -283,23 +281,45 @@ export interface ChatItem extends ChatItemContent {
|
|
|
283
281
|
hoverEffect?: boolean;
|
|
284
282
|
status?: Status;
|
|
285
283
|
}
|
|
286
|
-
export interface
|
|
284
|
+
export interface ValidationPattern {
|
|
285
|
+
pattern: string | RegExp;
|
|
286
|
+
errorMessage?: string;
|
|
287
|
+
}
|
|
288
|
+
interface BaseFormItem {
|
|
287
289
|
id: string;
|
|
288
|
-
type: 'select' | 'textarea' | 'textinput' | 'numericinput' | 'stars' | 'radiogroup' | 'email';
|
|
289
290
|
mandatory?: boolean;
|
|
290
291
|
title?: string;
|
|
291
292
|
placeholder?: string;
|
|
292
293
|
value?: string;
|
|
294
|
+
}
|
|
295
|
+
export type TextBasedFormItem = BaseFormItem & {
|
|
296
|
+
type: 'textarea' | 'textinput' | 'numericinput' | 'email';
|
|
297
|
+
validationPatterns?: {
|
|
298
|
+
operator?: 'and' | 'or';
|
|
299
|
+
genericValidationErrorMessage?: string;
|
|
300
|
+
patterns: ValidationPattern[];
|
|
301
|
+
};
|
|
302
|
+
};
|
|
303
|
+
type SelectFormItem = BaseFormItem & {
|
|
304
|
+
type: 'select';
|
|
305
|
+
options: Array<{
|
|
306
|
+
value: string;
|
|
307
|
+
label: string;
|
|
308
|
+
}>;
|
|
309
|
+
};
|
|
310
|
+
type OtherFormItem = BaseFormItem & {
|
|
311
|
+
type: 'stars' | 'radiogroup';
|
|
293
312
|
options?: Array<{
|
|
294
313
|
value: string;
|
|
295
314
|
label: string;
|
|
296
315
|
}>;
|
|
297
|
-
}
|
|
316
|
+
};
|
|
317
|
+
export type ChatItemFormItem = TextBasedFormItem | SelectFormItem | OtherFormItem;
|
|
298
318
|
export interface ChatPrompt {
|
|
299
319
|
prompt?: string;
|
|
300
320
|
escapedPrompt?: string;
|
|
301
321
|
command?: string;
|
|
302
|
-
context?: string[] |
|
|
322
|
+
context?: string[] | QuickActionCommand[];
|
|
303
323
|
}
|
|
304
324
|
export interface ChatItemAction extends ChatPrompt {
|
|
305
325
|
type?: string;
|
package/docs/DATAMODEL.md
CHANGED
|
@@ -868,6 +868,7 @@ type CodeBlockActions = Record<'copy' | 'insert-to-cursor' | string, CodeBlockAc
|
|
|
868
868
|
|
|
869
869
|
// #################################
|
|
870
870
|
interface ChatItemContent {
|
|
871
|
+
header?: ChatItemContent | null;
|
|
871
872
|
body?: string | null;
|
|
872
873
|
customRenderer?: string | ChatItemBodyRenderer | ChatItemBodyRenderer[] | null;
|
|
873
874
|
followUp?: {
|
|
@@ -884,6 +885,8 @@ interface ChatItemContent {
|
|
|
884
885
|
rootFolderTitle?: string;
|
|
885
886
|
filePaths?: string[];
|
|
886
887
|
deletedFiles?: string[];
|
|
888
|
+
collapsedByDefault?: boolean;
|
|
889
|
+
hideFileCount?: boolean;
|
|
887
890
|
actions?: Record<string, FileNodeAction[]>;
|
|
888
891
|
details?: Record<string, TreeNodeDetails>;
|
|
889
892
|
} | null;
|
|
@@ -1075,6 +1078,43 @@ mynahUI.addChatItem('tab-1', {
|
|
|
1075
1078
|
|
|
1076
1079
|
---
|
|
1077
1080
|
|
|
1081
|
+
## `header`
|
|
1082
|
+
With this parameter, you can add a `ChatItem` at the top of a ChatItem, before the body, but still within the card itself.
|
|
1083
|
+
|
|
1084
|
+
```typescript
|
|
1085
|
+
const mynahUI = new MynahUI({
|
|
1086
|
+
tabs: {
|
|
1087
|
+
'tab-1': {
|
|
1088
|
+
...
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
});
|
|
1092
|
+
|
|
1093
|
+
mynahUI.addChatItem(tabId, {
|
|
1094
|
+
type: ChatItemType.ANSWER,
|
|
1095
|
+
body: `SOME CONTENT`,
|
|
1096
|
+
header: {
|
|
1097
|
+
fileList: { // For example, want to show which file is used to generate that answer
|
|
1098
|
+
rootFolderTitle: undefined,
|
|
1099
|
+
fileTreeTitle: '',
|
|
1100
|
+
filePaths: ['./src/index.ts'],
|
|
1101
|
+
details: {
|
|
1102
|
+
'./src/index.ts': {
|
|
1103
|
+
icon: MynahIcons.FILE,
|
|
1104
|
+
description: `SOME DESCRIPTION.`
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
});
|
|
1110
|
+
```
|
|
1111
|
+
|
|
1112
|
+
<p align="center">
|
|
1113
|
+
<img src="./img/data-model/chatItems/header.png" alt="header" style="max-width:600px; width:100%;border: 1px solid #e0e0e0;">
|
|
1114
|
+
</p>
|
|
1115
|
+
|
|
1116
|
+
---
|
|
1117
|
+
|
|
1078
1118
|
## `body`
|
|
1079
1119
|
Basically the body of the card. Which you can send a full markdown string. Allows code blocks, links etc.
|
|
1080
1120
|
|
|
@@ -1732,6 +1772,8 @@ mynahUI.addChatItem(tabId, {
|
|
|
1732
1772
|
deletedFiles: ['src/devfile.yaml'],
|
|
1733
1773
|
// fileTreeTitle: "Custom file tree card title";
|
|
1734
1774
|
// rootFolderTitle: "Custom root folder title";
|
|
1775
|
+
// collapsedByDefault: true // Collapse the root folder by default
|
|
1776
|
+
// hideFileCount: true // Hide the file counter next to folders
|
|
1735
1777
|
actions: {
|
|
1736
1778
|
'src/App.tsx': [
|
|
1737
1779
|
{
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws/mynah-ui",
|
|
3
3
|
"displayName": "AWS Mynah UI",
|
|
4
|
-
"version": "4.23.0-beta.
|
|
4
|
+
"version": "4.23.0-beta.6",
|
|
5
5
|
"description": "AWS Toolkit VSCode and Intellij IDE Extension Mynah UI",
|
|
6
6
|
"publisher": "Amazon Web Services",
|
|
7
7
|
"license": "Apache License 2.0",
|