@aws/mynah-ui 4.35.0-beta.6 → 4.35.0-beta.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.
package/docs/DATAMODEL.md CHANGED
@@ -1063,18 +1063,84 @@ interface ChatItemButton {
1063
1063
  icon?: MynahIcons;
1064
1064
  }
1065
1065
 
1066
- interface ChatItemFormItem {
1066
+ type ChatItemFormItem = TextBasedFormItem | DropdownFormItem | RadioGroupFormItem | CheckboxFormItem | ListFormItem | Stars;
1067
+
1068
+ export interface ValidationPattern {
1069
+ pattern: string | RegExp;
1070
+ errorMessage?: string;
1071
+ }
1072
+
1073
+ interface BaseFormItem {
1067
1074
  id: string;
1068
- type: 'select' | 'textarea' | 'textinput' | 'numericinput' | 'stars' | 'radiogroup';
1069
1075
  mandatory?: boolean;
1070
- icon?: MynahIcons;
1071
1076
  title?: string;
1072
1077
  placeholder?: string;
1073
1078
  value?: string;
1079
+ description?: string;
1080
+ tooltip?: string;
1081
+ icon?: MynahIcons | MynahIconsType;
1082
+ }
1083
+
1084
+ export type TextBasedFormItem = BaseFormItem & {
1085
+ type: 'textarea' | 'textinput' | 'numericinput' | 'email';
1086
+ autoFocus?: boolean;
1087
+ checkModifierEnterKeyPress?: boolean;
1088
+ validationPatterns?: {
1089
+ operator?: 'and' | 'or';
1090
+ genericValidationErrorMessage?: string;
1091
+ patterns: ValidationPattern[];
1092
+ };
1093
+ };
1094
+
1095
+ type DropdownFormItem = BaseFormItem & {
1096
+ type: 'select';
1097
+ border?: boolean;
1098
+ autoWidth?: boolean;
1099
+ options?: Array<{
1100
+ value: string;
1101
+ label: string;
1102
+ }>;
1103
+ };
1104
+
1105
+ type Stars = BaseFormItem & {
1106
+ type: 'stars';
1074
1107
  options?: Array<{
1075
1108
  value: string;
1076
1109
  label: string;
1077
1110
  }>;
1111
+ };
1112
+
1113
+ type RadioGroupFormItem = BaseFormItem & {
1114
+ type: 'radiogroup' | 'toggle';
1115
+ options?: Array<{
1116
+ value: string;
1117
+ label?: string;
1118
+ icon?: MynahIcons | MynahIconsType;
1119
+ }>;
1120
+ };
1121
+
1122
+ type CheckboxFormItem = BaseFormItem & {
1123
+ type: 'switch' | 'checkbox';
1124
+ value?: 'true' | 'false';
1125
+ label?: string;
1126
+ alternateTooltip?: string;
1127
+ };
1128
+
1129
+ export interface ListFormItem {
1130
+ type: 'list';
1131
+ id: string;
1132
+ mandatory?: boolean;
1133
+ title?: string;
1134
+ description?: string;
1135
+ tooltip?: string;
1136
+ icon?: MynahIcons | MynahIconsType;
1137
+ items: SingularFormItem[];
1138
+ value: ListItemEntry[];
1139
+ };
1140
+
1141
+ export interface ListItemEntry {
1142
+ persistent?: boolean;
1143
+ value: Record<string, string>;
1078
1144
  }
1079
1145
 
1080
1146
  interface FileNodeAction {
@@ -1141,10 +1207,13 @@ type CodeBlockActions = Record<'copy' | 'insert-to-cursor' | string, CodeBlockAc
1141
1207
  // #################################
1142
1208
  interface ChatItemContent {
1143
1209
  header?: (ChatItemContent & {
1144
- icon?: MynahIcons | MynahIconsType;
1210
+ icon?: MynahIcons | MynahIconsType | CustomIcon;
1145
1211
  iconStatus?: 'main' | 'primary' | 'clear' | Status;
1212
+ iconForegroundStatus?: Status;
1146
1213
  status?: {
1147
1214
  status?: Status;
1215
+ position?: 'left' | 'right';
1216
+ description?: string;
1148
1217
  icon?: MynahIcons | MynahIconsType;
1149
1218
  text?: string;
1150
1219
  };
@@ -1163,6 +1232,9 @@ interface ChatItemContent {
1163
1232
  fileList?: {
1164
1233
  fileTreeTitle?: string;
1165
1234
  rootFolderTitle?: string;
1235
+ rootFolderStatusIcon?: MynahIcons | MynahIconsType;
1236
+ rootFolderStatusIconForegroundStatus?: Status;
1237
+ rootFolderLabel?: string;
1166
1238
  filePaths?: string[];
1167
1239
  deletedFiles?: string[];
1168
1240
  flatList?: boolean;
@@ -1179,17 +1251,26 @@ interface ChatItemContent {
1179
1251
  title?: string;
1180
1252
  status?: {
1181
1253
  status?: Status;
1182
- icon?: MynahIcons;
1254
+ icon?: MynahIcons | MynahIconsType;
1183
1255
  body?: string;
1184
1256
  };
1185
1257
  description?: string;
1186
- icon?: MynahIcons;
1258
+ icon?: MynahIcons | MynahIconsType;
1187
1259
  content: ChatItemContent;
1188
1260
  } | null;
1261
+ summary?: {
1262
+ isCollapsed?: boolean;
1263
+ content?: ChatItemContent;
1264
+ collapsedContent?: ChatItemContent[];
1265
+ } | null;
1189
1266
  tabbedContent?: Array<ToggleOption & {
1190
1267
  content: ChatItemContent;
1191
1268
  }> | null;
1192
1269
  codeBlockActions?: CodeBlockActions | null;
1270
+ fullWidth?: boolean;
1271
+ padding?: boolean;
1272
+ wrapCodes?: boolean;
1273
+ muted?: boolean;
1193
1274
  }
1194
1275
 
1195
1276
  interface ChatItem extends ChatItemContent {
@@ -1197,12 +1278,10 @@ interface ChatItem extends ChatItemContent {
1197
1278
  messageId?: string;
1198
1279
  snapToTop?: boolean;
1199
1280
  autoCollapse?: boolean;
1281
+ contentHorizontalAlignment?: 'default' | 'center';
1200
1282
  canBeVoted?: boolean;
1201
1283
  canBeDismissed?: boolean;
1202
1284
  title?: string;
1203
- fullWidth?: boolean;
1204
- padding?: boolean;
1205
- muted?: boolean;
1206
1285
  icon?: MynahIcons | MynahIconsType | CustomIcon;
1207
1286
  iconForegroundStatus?: Status;
1208
1287
  iconStatus?: 'main' | 'primary' | 'clear' | Status;
@@ -2017,6 +2096,8 @@ mynahUI.addChatItem(tabId, {
2017
2096
  <img src="./img/data-model/chatItems/shimmer.gif" alt="shimmer" style="max-width:200px; width:100%;border: 1px solid #e0e0e0;">
2018
2097
  </p>
2019
2098
 
2099
+ ---
2100
+
2020
2101
  ## `padding`
2021
2102
  It will allow you to control the padding, by default it is `true`. If you set it to `false`, it will not show any paddings around the contents.
2022
2103
 
@@ -2038,6 +2119,31 @@ mkdir -p src/ lalalaaaa
2038
2119
 
2039
2120
  **Note:** Keep in mind that, if the `padding` is set to `false`, code blocks inside body will not show language if there are also no actions specified for them. So, if you turn of `copy` and `insert-to-cursor` by setting them to `null` in `codeBlockActions`, it will also hide the language bar if the card padding is false.
2040
2121
 
2122
+ ---
2123
+
2124
+ ## `summary`
2125
+ Specifying summary will render a clickable header with collapsible content.
2126
+
2127
+ ```typescript
2128
+ mynahUI.addChatItem(tabId, {
2129
+ padding: false,
2130
+ type: ChatItemType.ANSWER,
2131
+ summary: {
2132
+ content: {
2133
+ // Some ChatItem here
2134
+ },
2135
+ collapsedContent: [
2136
+ // One or multiple ChatItems here
2137
+ ]
2138
+ }
2139
+ });
2140
+ `,
2141
+ });
2142
+ ```
2143
+
2144
+ <p align="center">
2145
+ <img src="./img/data-model/chatItems/summary.png" alt="summary" style="max-width:500px; width:100%;border: 1px solid #e0e0e0;">
2146
+ </p>
2041
2147
 
2042
2148
  ---
2043
2149
 
@@ -2556,6 +2662,27 @@ mynahUI.addChatItem(tabId, {
2556
2662
  <img src="./img/data-model/chatItems/fillState-hover.png" alt="button fill when hover (on hover)" style="max-width:500px; width:100%;border: 1px solid #e0e0e0;">
2557
2663
  </p>
2558
2664
 
2665
+ #### Button / Action confirmations
2666
+ You can add confirmations on any `Action` by e.g. specifying the following for an Action:
2667
+
2668
+ ```typescript
2669
+ {
2670
+ id: 'mcp-delete-tool',
2671
+ icon: MynahIcons.TRASH,
2672
+ text: 'Delete',
2673
+ confirmation: {
2674
+ cancelButtonText: 'Cancel',
2675
+ confirmButtonText: 'Delete',
2676
+ title: 'Delete Filesystem MCP server',
2677
+ description:
2678
+ 'This configuration will be deleted and no longer available in Q. \n\n **This cannot be undone.**',
2679
+ },
2680
+ },
2681
+ ```
2682
+ <p align="center">
2683
+ <img src="./img/data-model/chatItems/confirmation.png" alt="confirmation" style="max-width:500px; width:100%;border: 1px solid #e0e0e0;">
2684
+ </p>
2685
+
2559
2686
  ---
2560
2687
 
2561
2688
  ## `formItems`
package/docs/USAGE.md CHANGED
@@ -581,10 +581,10 @@ mynahUI.updateTabDefaults({store: {
581
581
 
582
582
  # Show splash screen spinner (`toggleSplashLoader`)
583
583
 
584
- You can enable or disable window wide splash screen spinner with or without text.
584
+ You can enable or disable window wide splash overlay with or without text.
585
585
 
586
586
  ```typescript
587
- mynahUI.toggleSplashLoader(true, 'Initializing');
587
+ mynahUI.toggleSplashLoader(true, 'Showing splash loader...');
588
588
  ```
589
589
  <p align="center">
590
590
  <img src="./img/splashLoader.png" alt="mainTitle" style="max-width:500px; width:100%;border: 1px solid #e0e0e0;">
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.35.0-beta.6",
4
+ "version": "4.35.0-beta.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",