@aws/mynah-ui 4.36.2 → 4.36.3

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/static.d.ts CHANGED
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import { CheckboxAbstract, CheckboxProps } from './components/form-items/checkbox';
6
6
  import { FormItemListAbstract, FormItemListProps } from './components/form-items/form-item-list';
7
+ import { FormItemPillBoxAbstract, FormItemPillBoxProps } from './components/form-items/form-item-pill-box';
7
8
  import { SwitchAbstract, SwitchProps } from './components/form-items/switch';
8
9
  import { CustomIcon, MynahIcons, MynahIconsType } from './components/icon';
9
10
  import { ChatItemBodyRenderer } from './helper/dom';
@@ -398,6 +399,7 @@ export interface ChatItemContent {
398
399
  hideFileCount?: boolean;
399
400
  actions?: Record<string, FileNodeAction[]>;
400
401
  details?: Record<string, TreeNodeDetails>;
402
+ renderAsPills?: boolean;
401
403
  } | null;
402
404
  buttons?: ChatItemButton[] | null;
403
405
  formItems?: ChatItemFormItem[] | null;
@@ -462,7 +464,7 @@ interface BaseFormItem {
462
464
  boldTitle?: boolean;
463
465
  }
464
466
  export type TextBasedFormItem = BaseFormItem & {
465
- type: 'textarea' | 'textinput' | 'numericinput' | 'email';
467
+ type: 'textarea' | 'textinput' | 'numericinput' | 'email' | 'pillbox';
466
468
  autoFocus?: boolean;
467
469
  checkModifierEnterKeyPress?: boolean;
468
470
  validationPatterns?: {
@@ -728,6 +730,7 @@ export interface ComponentOverrides {
728
730
  TextInput?: new (props: TextInputProps) => ExtractMethods<TextInputAbstract>;
729
731
  TextArea?: new (props: TextAreaProps) => ExtractMethods<TextAreaAbstract>;
730
732
  FormItemList?: new (props: FormItemListProps) => ExtractMethods<FormItemListAbstract>;
733
+ FormItemPillBox?: new (props: FormItemPillBoxProps) => ExtractMethods<FormItemPillBoxAbstract>;
731
734
  }
732
735
  export interface ConfigOptions {
733
736
  feedbackOptions: Array<{
package/docs/DATAMODEL.md CHANGED
@@ -1153,7 +1153,7 @@ interface ChatItemButton {
1153
1153
  icon?: MynahIcons;
1154
1154
  }
1155
1155
 
1156
- type ChatItemFormItem = TextBasedFormItem | DropdownFormItem | RadioGroupFormItem | CheckboxFormItem | ListFormItem | Stars;
1156
+ type ChatItemFormItem = TextBasedFormItem | DropdownFormItem | RadioGroupFormItem | CheckboxFormItem | ListFormItem | Stars | PillboxFormItem;
1157
1157
 
1158
1158
  export interface ValidationPattern {
1159
1159
  pattern: string | RegExp;
@@ -1240,6 +1240,11 @@ export interface ListItemEntry {
1240
1240
  value: Record<string, string>;
1241
1241
  }
1242
1242
 
1243
+ type PillboxFormItem = BaseFormItem & {
1244
+ type: 'pillbox';
1245
+ value?: string;
1246
+ };
1247
+
1243
1248
  interface FileNodeAction {
1244
1249
  name: string;
1245
1250
  label?: string;
@@ -1338,6 +1343,7 @@ interface ChatItemContent {
1338
1343
  folderIcon?: MynahIcons | MynahIconsType | null;
1339
1344
  collapsed?: boolean;
1340
1345
  hideFileCount?: boolean;
1346
+ renderAsPills?: boolean; // When true (header only), renders files as inline pills instead of tree
1341
1347
  actions?: Record<string, FileNodeAction[]>;
1342
1348
  details?: Record<string, TreeNodeDetails>;
1343
1349
  } | null;
@@ -2481,10 +2487,80 @@ mynahUI.addChatItem(tabId, {
2481
2487
 
2482
2488
  **NOTE 4:** In case you want a flat list, where all subfolders are not rendered but just all the files, you can pass `true` to the `flatList` prop.
2483
2489
 
2490
+ **NOTE 5:** When using `renderAsPills: true` in a header's fileList, files will be displayed as inline pills instead of a traditional file tree. This is useful for showing a compact list of files that were processed or referenced.
2491
+
2484
2492
  <p align="center">
2485
2493
  <img src="./img/data-model/chatItems/codeResult.png" alt="mainTitle" style="max-width:500px; width:100%;border: 1px solid #e0e0e0;">
2486
2494
  </p>
2487
2495
 
2496
+ #### `renderAsPills` (default: `false`)
2497
+ When set to `true` in a header's fileList, files will be rendered as inline pills next to the header text instead of a traditional file tree. This creates a compact display perfect for showing files that were read, processed, or referenced.
2498
+
2499
+ **Features:**
2500
+ - Files appear as clickable pills inline with the header text and icon
2501
+ - Uses `visibleName` from details as pill text (falls back to full file path)
2502
+ - Deleted files get special styling with `mynah-chat-item-tree-file-pill-deleted` class
2503
+ - Pills support hover tooltips when `description` is provided in details
2504
+ - Header icon is automatically included in the custom renderer for proper alignment
2505
+ - Pills dispatch `FILE_CLICK` events when clicked, same as regular file tree items
2506
+ - Only works when `renderAsPills: true` is set in a header's fileList (not main fileList)
2507
+
2508
+ **Important Notes:**
2509
+ - This feature only works within a `header.fileList`, not in the main chat item `fileList`
2510
+ - When `renderAsPills: true`, the traditional file tree is replaced with inline pills
2511
+ - The header's `body`, `icon`, and file pills are all rendered together in a custom renderer
2512
+ - Empty `filePaths` array will result in no pills being rendered
2513
+
2514
+ ```typescript
2515
+ mynahUI.addChatItem('tab-1', {
2516
+ type: ChatItemType.ANSWER,
2517
+ header: {
2518
+ icon: MynahIcons.EYE,
2519
+ body: '5 files read',
2520
+ fileList: {
2521
+ filePaths: ['package.json', 'tsconfig.json', 'src/index.ts'],
2522
+ renderAsPills: true,
2523
+ details: {
2524
+ 'package.json': {
2525
+ visibleName: 'package',
2526
+ description: 'Project configuration'
2527
+ },
2528
+ 'tsconfig.json': {
2529
+ visibleName: 'tsconfig',
2530
+ description: 'TypeScript configuration'
2531
+ },
2532
+ 'src/index.ts': {
2533
+ visibleName: 'index.ts',
2534
+ description: 'Main entry point'
2535
+ }
2536
+ },
2537
+ deletedFiles: ['src/index.ts'] // Will show with deleted styling
2538
+ }
2539
+ },
2540
+ });
2541
+ ```
2542
+
2543
+ <p align="center">
2544
+ <img src="./img/data-model/chatItems/renderAsPills.png" alt="renderAsPills" style="max-width:500px; width:100%;border: 1px solid #e0e0e0;">
2545
+ </p>
2546
+
2547
+ **Comparison with regular file tree:**
2548
+
2549
+ ```typescript
2550
+ // Regular file tree (renderAsPills: false or undefined)
2551
+ mynahUI.addChatItem('tab-1', {
2552
+ type: ChatItemType.ANSWER,
2553
+ header: {
2554
+ icon: MynahIcons.EYE,
2555
+ body: 'Files analyzed',
2556
+ fileList: {
2557
+ filePaths: ['package.json', 'src/index.ts'],
2558
+ renderAsPills: false // or omit this property
2559
+ }
2560
+ }
2561
+ });
2562
+ ```
2563
+
2488
2564
 
2489
2565
  #### File `details`
2490
2566
 
@@ -2791,7 +2867,7 @@ Let's take a look to the data type of a form item:
2791
2867
  ```typescript
2792
2868
  interface ChatItemFormItem {
2793
2869
  id: string; // id is mandatory to understand to get the specific values for each form item when a button is clicked
2794
- type: 'select' | 'textarea' | 'textinput' | 'numericinput' | 'stars' | 'radiogroup' | 'toggle' | 'checkbox' | 'switch' ; // type (see below for each of them)
2870
+ type: 'select' | 'textarea' | 'textinput' | 'numericinput' | 'stars' | 'radiogroup' | 'toggle' | 'checkbox' | 'switch' | 'pillbox' ; // type (see below for each of them)
2795
2871
  mandatory?: boolean; // If it is set to true, buttons in the same card with waitMandatoryFormItems set to true will wait them to be filled
2796
2872
  hideMandatoryIcon?: boolean; // If it is set to true, it won't render an asterisk icon next to the form label
2797
2873
  title?: string; // Label of the input
@@ -2978,6 +3054,14 @@ mynahUI.addChatItem(tabId, {
2978
3054
  type: 'stars',
2979
3055
  title: `How do feel about our AI assistant in general?`,
2980
3056
  },
3057
+ {
3058
+ id: 'skills',
3059
+ type: 'pillbox',
3060
+ title: 'Programming Languages & Technologies',
3061
+ description: 'Add your programming languages and technologies (press Enter to add)',
3062
+ placeholder: 'Type a skill and press Enter',
3063
+ value: 'JavaScript,TypeScript,React,Node.js',
3064
+ },
2981
3065
  {
2982
3066
  id: 'description',
2983
3067
  type: 'textarea',
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.36.2",
4
+ "version": "4.36.3",
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",