@aws/mynah-ui 4.35.6 → 4.35.7

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.
Files changed (38) hide show
  1. package/dist/components/chat-item/chat-prompt-input.d.ts +3 -0
  2. package/dist/components/chat-item/chat-wrapper.d.ts +7 -0
  3. package/dist/components/chat-item/prompt-input/prompt-text-input.d.ts +4 -0
  4. package/dist/components/icon.d.ts +2 -1
  5. package/dist/main.d.ts +3 -0
  6. package/dist/main.js +1 -1
  7. package/dist/main.js.map +1 -1
  8. package/dist/static.d.ts +24 -1
  9. package/docs/DATAMODEL.md +42 -1
  10. package/docs/PROPERTIES.md +63 -0
  11. package/docs/USAGE.md +32 -1
  12. package/docs/img/data-model/chatItems/formItemsTooltip.png +0 -0
  13. package/docs/img/data-model/chatItems/options-all-filled.png +0 -0
  14. package/docs/img/data-model/chatItems/options-mandatory-filled.png +0 -0
  15. package/docs/img/data-model/chatItems/options-submitted.png +0 -0
  16. package/docs/img/data-model/chatItems/options.png +0 -0
  17. package/docs/img/data-model/tabStore/quickActionCommandsHeader.png +0 -0
  18. package/package.json +1 -1
  19. package/ui-tests/__snapshots__/chromium/Open-MynahUI-Forms-should-render-form-elements-correctly/Open-MynahUI-Forms-should-render-form-elements-correctly-1.png +0 -0
  20. package/ui-tests/__snapshots__/chromium/Open-MynahUI-Quick-Action-Commands-Header-should-handle-quick-action-commands-header-interaction/quick-action-commands-header-hover.png +0 -0
  21. package/ui-tests/__snapshots__/chromium/Open-MynahUI-Quick-Action-Commands-Header-should-not-render-header-when-not-applicable/quick-action-commands-header-not-present.png +0 -0
  22. package/ui-tests/__snapshots__/chromium/Open-MynahUI-Quick-Action-Commands-Header-should-render-header-with-correct-status-styling/quick-action-commands-header-status.png +0 -0
  23. package/ui-tests/__snapshots__/chromium/Open-MynahUI-Quick-Action-Commands-Header-should-render-the-quick-action-commands-header/quick-action-commands-header.png +0 -0
  24. package/ui-tests/__snapshots__/chromium/Open-MynahUI-should-keep-the-content-inside-window-boundaries/Open-MynahUI-should-keep-the-content-inside-window-boundaries-1.png +0 -0
  25. package/ui-tests/__snapshots__/chromium/Open-MynahUI-should-keep-the-content-inside-window-boundaries/Open-MynahUI-should-keep-the-content-inside-window-boundaries-2.png +0 -0
  26. package/ui-tests/__snapshots__/chromium/Open-MynahUI-should-keep-the-content-inside-window-boundaries/Open-MynahUI-should-keep-the-content-inside-window-boundaries-3.png +0 -0
  27. package/ui-tests/__snapshots__/chromium/Open-MynahUI-should-parse-markdown/Open-MynahUI-should-parse-markdown-1.png +0 -0
  28. package/ui-tests/__snapshots__/chromium/Open-MynahUI-should-render-information-cards-correctly/Open-MynahUI-should-render-information-cards-correctly-1.png +0 -0
  29. package/ui-tests/__snapshots__/webkit/Open-MynahUI-Forms-should-render-form-elements-correctly/Open-MynahUI-Forms-should-render-form-elements-correctly-1.png +0 -0
  30. package/ui-tests/__snapshots__/webkit/Open-MynahUI-Quick-Action-Commands-Header-should-handle-quick-action-commands-header-interaction/quick-action-commands-header-hover.png +0 -0
  31. package/ui-tests/__snapshots__/webkit/Open-MynahUI-Quick-Action-Commands-Header-should-not-render-header-when-not-applicable/quick-action-commands-header-not-present.png +0 -0
  32. package/ui-tests/__snapshots__/webkit/Open-MynahUI-Quick-Action-Commands-Header-should-render-header-with-correct-status-styling/quick-action-commands-header-status.png +0 -0
  33. package/ui-tests/__snapshots__/webkit/Open-MynahUI-Quick-Action-Commands-Header-should-render-the-quick-action-commands-header/quick-action-commands-header.png +0 -0
  34. package/ui-tests/__snapshots__/webkit/Open-MynahUI-should-keep-the-content-inside-window-boundaries/Open-MynahUI-should-keep-the-content-inside-window-boundaries-1.png +0 -0
  35. package/ui-tests/__snapshots__/webkit/Open-MynahUI-should-keep-the-content-inside-window-boundaries/Open-MynahUI-should-keep-the-content-inside-window-boundaries-2.png +0 -0
  36. package/ui-tests/__snapshots__/webkit/Open-MynahUI-should-keep-the-content-inside-window-boundaries/Open-MynahUI-should-keep-the-content-inside-window-boundaries-3.png +0 -0
  37. package/ui-tests/__snapshots__/webkit/Open-MynahUI-should-parse-markdown/Open-MynahUI-should-parse-markdown-1.png +0 -0
  38. package/ui-tests/__snapshots__/webkit/Open-MynahUI-should-render-information-cards-correctly/Open-MynahUI-should-render-information-cards-correctly-1.png +0 -0
package/dist/static.d.ts CHANGED
@@ -19,12 +19,21 @@ export interface QuickActionCommand {
19
19
  children?: QuickActionCommandGroup[];
20
20
  route?: string[];
21
21
  }
22
+ export interface CustomQuickActionCommand extends QuickActionCommand {
23
+ content?: Uint8Array;
24
+ }
22
25
  export interface QuickActionCommandGroup {
23
26
  groupName?: string;
24
27
  icon?: MynahIcons | MynahIconsType;
25
28
  actions?: Action[];
26
29
  commands: QuickActionCommand[];
27
30
  }
31
+ export interface QuickActionCommandsHeader {
32
+ icon?: MynahIcons | MynahIconsType;
33
+ title?: string;
34
+ description?: string;
35
+ status?: Status;
36
+ }
28
37
  /**
29
38
  * data store model to update the mynah ui partially or fully
30
39
  */
@@ -74,6 +83,10 @@ export interface MynahUIDataModel {
74
83
  */
75
84
  quickActionCommands?: QuickActionCommandGroup[];
76
85
  /**
86
+ * Quick Action commands header information block
87
+ */
88
+ quickActionCommandsHeader?: QuickActionCommandsHeader;
89
+ /**
77
90
  * Context commands to show when user hits @ to the input any point
78
91
  */
79
92
  contextCommands?: QuickActionCommandGroup[];
@@ -157,6 +170,10 @@ export interface MynahUIDataModel {
157
170
  tabMetadata?: {
158
171
  [key: string]: string | boolean | number;
159
172
  };
173
+ /**
174
+ * Custom context commands to be inserted into the prompt input.
175
+ */
176
+ customContextCommand?: QuickActionCommand[];
160
177
  }
161
178
  export interface MynahUITabStoreTab {
162
179
  /**
@@ -213,10 +230,14 @@ export declare enum MynahEventNames {
213
230
  PROMPT_PROGRESS_ACTION_CLICK = "promptProgressActionClick",
214
231
  ROOT_RESIZE = "rootResize",
215
232
  CONTEXT_SELECTED = "contextSelected",
233
+ OPEN_FILE_SYSTEM = "openFileSystem",
234
+ ADD_CUSTOM_CONTEXT = "addCustomContext",
216
235
  TOP_BAR_ITEM_ADD = "promptInputTopBarItemAdd",
217
236
  TOP_BAR_ITEM_REMOVE = "promptInputTopBarItemRemove",
218
237
  TOP_BAR_BUTTON_CLICK = "promptInputTopBarButtonClick",
219
- CONTEXT_PINNED = "contextPinned"
238
+ CONTEXT_PINNED = "contextPinned",
239
+ FILES_DROPPED = "filesDropped",
240
+ CONTEXT_INSERTED = "contextInserted"
220
241
  }
221
242
  export declare enum MynahPortalNames {
222
243
  WRAPPER = "wrapper",
@@ -421,6 +442,8 @@ export interface ChatItem extends ChatItemContent {
421
442
  hoverEffect?: boolean;
422
443
  status?: Status;
423
444
  shimmer?: boolean;
445
+ collapse?: boolean;
446
+ border?: boolean;
424
447
  }
425
448
  export interface ValidationPattern {
426
449
  pattern: string | RegExp;
package/docs/DATAMODEL.md CHANGED
@@ -122,6 +122,10 @@ interface MynahUIDataModel {
122
122
  * application state management for that purpose.
123
123
  */
124
124
  tabMetadata?: { [key: string]: string | boolean | number };
125
+ /**
126
+ * Custom context commands to be inserted into the prompt input.
127
+ */
128
+ customContextCommand: []
125
129
  }
126
130
  ```
127
131
 
@@ -3562,4 +3566,41 @@ export interface DetailedListItem {
3562
3566
  keywords?: string[];
3563
3567
  }
3564
3568
  }
3565
- ```
3569
+ ```
3570
+
3571
+ ---
3572
+
3573
+ ### `quickActionCommandsHeader` (default: `{}`)
3574
+ Quick action commands header displays an informational banner above the quick action commands list when users hit `/` in the input. This is useful for providing additional context, warnings, or guidance about the available commands.
3575
+
3576
+ The header supports various status styles (info, success, warning, error) and can include an icon, title, and description.
3577
+
3578
+ ```typescript
3579
+ const mynahUI = new MynahUI({
3580
+ tabs: {
3581
+ 'tab-1': {
3582
+ ...
3583
+ }
3584
+ }
3585
+ });
3586
+
3587
+ mynahUI.updateStore('tab-1', {
3588
+ quickActionCommands: [
3589
+ // ... your commands here
3590
+ ],
3591
+ quickActionCommandsHeader: {
3592
+ status: 'warning',
3593
+ icon: MynahIcons.INFO,
3594
+ title: 'New agentic capabilities',
3595
+ description: 'You can now ask Q directly in the chat. You don\'t need to explicitly use /dev, /test, or /doc commands anymore.',
3596
+ }
3597
+ })
3598
+ ```
3599
+
3600
+ <p align="center">
3601
+ <img src="./img/data-model/tabStore/quickActionCommandsHeader.png" alt="quickActionCommandsHeader" style="max-width:500px; width:100%;border: 1px solid #e0e0e0;">
3602
+ </p>
3603
+
3604
+ The header will appear above the quick action commands list and provides information to users about new features.
3605
+
3606
+ ---
@@ -189,6 +189,16 @@ export interface MynahUIProps {
189
189
  tabId: string,
190
190
  topBarButton: ChatItemButton,
191
191
  eventId?: string) => void;
192
+ onOpenFileDialogClick?: (
193
+ tabId: string,
194
+ fileType: string,
195
+ insertPosition: number
196
+ ) => void;
197
+ onFilesDropped?: (
198
+ tabId: string,
199
+ files: FileList,
200
+ insertPosition: number
201
+ ) => void;
192
202
  }
193
203
  ```
194
204
  _Let's deep dive into each property you can set._
@@ -1233,3 +1243,56 @@ onPromptTopBarButtonClick?: (
1233
1243
  };
1234
1244
  ...
1235
1245
  ```
1246
+
1247
+ ---
1248
+
1249
+ ### `onOpenFileDialogClick`
1250
+
1251
+ This event will be fired when the user triggers the open file dialog action (for example, by typing `@image:`). It passes the `tabId` of the current tab, the `fileType` (such as 'image', 'file', etc.), and the `insertPosition` indicating where in the prompt input the file should be inserted.
1252
+
1253
+ ```typescript
1254
+ ...
1255
+ onOpenFileDialogClick?: (
1256
+ tabId: string,
1257
+ fileType: string,
1258
+ insertPosition: number
1259
+ ) => void;
1260
+ ...
1261
+ ```
1262
+
1263
+ **Example:**
1264
+ ```typescript
1265
+ onOpenFileDialogClick: (tabId, fileType, insertPosition) => {
1266
+ console.log(`Open file dialog for type '${fileType}' in tab '${tabId}' at position ${insertPosition}`);
1267
+ // You can open your own file picker here
1268
+ },
1269
+ ```
1270
+
1271
+ ---
1272
+
1273
+ ### `onFilesDropped`
1274
+
1275
+ This event will be fired when the user drops files into the chat window. It passes the `tabId` of the current tab, the `files` (as a FileList), and the `insertPosition` indicating where in the prompt input the files should be inserted.
1276
+
1277
+ ```typescript
1278
+ ...
1279
+ onFilesDropped?: (
1280
+ tabId: string,
1281
+ files: FileList,
1282
+ insertPosition: number
1283
+ ) => void;
1284
+ ...
1285
+ ```
1286
+
1287
+ **Example:**
1288
+ ```typescript
1289
+ onFilesDropped: (tabId, files, insertPosition) => {
1290
+ console.log(`Files dropped in tab '${tabId}' at position ${insertPosition}`);
1291
+ for (const file of files) {
1292
+ console.log(`File: ${file.name}`);
1293
+ }
1294
+ // Handle the dropped files as needed
1295
+ },
1296
+ ```
1297
+
1298
+ ---
package/docs/USAGE.md CHANGED
@@ -29,6 +29,7 @@ mynahUI.notify(...);
29
29
  mynahUI.showCustomForm(...);
30
30
  mynahUI.updateTabDefaults(...);
31
31
  mynahUI.toggleSplashLoader(...);
32
+ mynahUI.addCustomContextToPrompt(...);
32
33
  mynahUI.destroy();
33
34
  ```
34
35
 
@@ -678,4 +679,34 @@ The overlay will appear positioned relative to the specified top bar button, dis
678
679
 
679
680
  <p align="center">
680
681
  <img src="./img/topBarButtonOverlay.png" alt="Top Bar Button Overlay" style="max-width:500px; width:100%;border: 1px solid #e0e0e0;">
681
- </p>
682
+ </p>
683
+
684
+ # Adding Custom Context to Prompt (`addCustomContextToPrompt`)
685
+
686
+ You can programmatically add custom context items to the prompt input of a specific tab using the `addCustomContextToPrompt` function. This is useful for injecting custom context directly into the user's prompt field, and ensures the context is also tracked in the tab's data store.
687
+
688
+ ```typescript
689
+ mynahUI.addCustomContextToPrompt(
690
+ tabId, // The ID of the tab to add the context to
691
+ [
692
+ {
693
+ command: 'sampleimage.png',
694
+ label: 'image',
695
+ description: 'This is a custom context item.',
696
+ icon: MynahIcons.IMAGE,
697
+ },
698
+ // ... more QuickActionCommand objects if needed
699
+ ],
700
+ 0 // (Optional) Insert position in the prompt input. If omitted, appends to the end.
701
+ );
702
+ ```
703
+
704
+ - **tabId**: The string ID of the tab where the context should be added.
705
+ - **contextItem**: An array of `QuickActionCommand` objects to insert. Each object can include `command`, `label`, `description`, `icon`, and other properties as defined in the data model.
706
+ - **insertPosition** (optional): The position in the prompt input where the context should be inserted. If not provided, the context is appended to the end.
707
+
708
+ When called, this function will:
709
+ - Insert the provided context items as context pills in the prompt input field of the specified tab.
710
+ - Update the tab's data store so that the custom context is tracked and can be referenced or removed later.
711
+
712
+ **Note:** If the prompt input is not currently visible or the tab does not exist, the function will have no effect.
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.35.6",
4
+ "version": "4.35.7",
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",