@aws/mynah-ui 4.23.0-beta.6 → 4.23.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/dist/components/form-items/radio-group.d.ts +1 -0
- package/dist/components/form-items/select.d.ts +1 -0
- package/dist/components/form-items/stars.d.ts +1 -0
- package/dist/components/form-items/text-area.d.ts +2 -0
- package/dist/components/form-items/text-input.d.ts +2 -0
- package/dist/helper/test-ids.d.ts +1 -0
- package/dist/main.d.ts +3 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/static.d.ts +5 -1
- package/docs/DATAMODEL.md +3 -0
- package/docs/PROPERTIES.md +47 -0
- package/docs/STARTUP.md +1 -0
- package/package.json +1 -1
package/dist/static.d.ts
CHANGED
|
@@ -158,11 +158,13 @@ export declare enum MynahEventNames {
|
|
|
158
158
|
FILE_ACTION_CLICK = "fileActionClick",
|
|
159
159
|
TAB_FOCUS = "tabFocus",
|
|
160
160
|
CUSTOM_FORM_ACTION_CLICK = "customFormActionClick",
|
|
161
|
+
FORM_MODIFIER_ENTER_PRESS = "formModifierEnterPress",
|
|
161
162
|
ADD_ATTACHMENT = "addAttachment",
|
|
162
163
|
REMOVE_ATTACHMENT = "removeAttachment",
|
|
163
164
|
TAB_BAR_BUTTON_CLICK = "tabBarButtonClick",
|
|
164
165
|
PROMPT_PROGRESS_ACTION_CLICK = "promptProgressActionClick",
|
|
165
|
-
ROOT_RESIZE = "rootResize"
|
|
166
|
+
ROOT_RESIZE = "rootResize",
|
|
167
|
+
CONTEXT_SELECTED = "contextSelected"
|
|
166
168
|
}
|
|
167
169
|
export declare enum MynahPortalNames {
|
|
168
170
|
WRAPPER = "wrapper",
|
|
@@ -291,9 +293,11 @@ interface BaseFormItem {
|
|
|
291
293
|
title?: string;
|
|
292
294
|
placeholder?: string;
|
|
293
295
|
value?: string;
|
|
296
|
+
description?: string;
|
|
294
297
|
}
|
|
295
298
|
export type TextBasedFormItem = BaseFormItem & {
|
|
296
299
|
type: 'textarea' | 'textinput' | 'numericinput' | 'email';
|
|
300
|
+
checkModifierEnterKeyPress?: boolean;
|
|
297
301
|
validationPatterns?: {
|
|
298
302
|
operator?: 'and' | 'or';
|
|
299
303
|
genericValidationErrorMessage?: string;
|
package/docs/DATAMODEL.md
CHANGED
|
@@ -2076,8 +2076,10 @@ interface ChatItemFormItem {
|
|
|
2076
2076
|
type: 'select' | 'textarea' | 'textinput' | 'numericinput' | 'stars' | 'radiogroup'; // type (see below for each of them)
|
|
2077
2077
|
mandatory?: boolean; // If it is set to true, buttons in the same card with waitMandatoryFormItems set to true will wait them to be filled
|
|
2078
2078
|
title?: string; // Label of the input
|
|
2079
|
+
description?: string; // The description, showing under the input field itself
|
|
2079
2080
|
placeholder?: string; // Placeholder for input, but only applicable to textarea, textinput and numericinput
|
|
2080
2081
|
value?: string; // Initial value of the item. All types of form items will get and return string values, conversion of the value type is up to you
|
|
2082
|
+
checkModifierEnterKeyPress?: boolean; // Only applicable to textual inputs: whether the onFormModifierEnterPress event can be triggered from this input field
|
|
2081
2083
|
options?: Array<{ // Only applicable to select and radiogroup types
|
|
2082
2084
|
value: string;
|
|
2083
2085
|
label: string;
|
|
@@ -2164,6 +2166,7 @@ mynahUI.addChatItem(tabId, {
|
|
|
2164
2166
|
mandatory: true,
|
|
2165
2167
|
title: `Email`,
|
|
2166
2168
|
placeholder: 'email',
|
|
2169
|
+
checkModifierEnterKeyPress: true
|
|
2167
2170
|
},
|
|
2168
2171
|
{
|
|
2169
2172
|
id: 'name',
|
package/docs/PROPERTIES.md
CHANGED
|
@@ -45,6 +45,9 @@ export interface MynahUIProps {
|
|
|
45
45
|
onTabAdd?: (
|
|
46
46
|
tabId: string,
|
|
47
47
|
eventId?: string) => void;
|
|
48
|
+
onContextSelected?: (
|
|
49
|
+
contextItem: QuickActionCommand,
|
|
50
|
+
) => boolean;
|
|
48
51
|
onTabRemove?: (
|
|
49
52
|
tabId: string,
|
|
50
53
|
eventId?: string) => void;
|
|
@@ -115,6 +118,10 @@ export interface MynahUIProps {
|
|
|
115
118
|
tabId: string,
|
|
116
119
|
feedbackPayload: FeedbackPayload,
|
|
117
120
|
eventId?: string) => void;
|
|
121
|
+
onFormModifierEnterPress?: (
|
|
122
|
+
formData: Record<string, string>,
|
|
123
|
+
tabId: string,
|
|
124
|
+
eventId?: string) => void;
|
|
118
125
|
onCustomFormAction?: (
|
|
119
126
|
tabId: string,
|
|
120
127
|
action: {
|
|
@@ -512,6 +519,26 @@ onTabAdd?: (tabId: string):void => {
|
|
|
512
519
|
|
|
513
520
|
---
|
|
514
521
|
|
|
522
|
+
### `onContextSelected`
|
|
523
|
+
|
|
524
|
+
This event will be fired whenever a user selects an item from the context (`@`) list either using mouse click or keyboard actions. It is only triggered for items without children, i.e. only leaves in the tree. The data of the selected context item can be accessed through the `contextItem`. This event handler expects a boolean return:
|
|
525
|
+
- Returning `true` indicates that the context item should be added to the prompt input text.
|
|
526
|
+
- Returning `false` indicates that nothing should be added to the prompt input, and the triggering string should be cleared. E.g. if a user types `@wor` and presses tab on the `@workspace` action, the `@wor` would be removed from the prompt input and no context item will be added.
|
|
527
|
+
|
|
528
|
+
```typescript
|
|
529
|
+
...
|
|
530
|
+
onContextSelected(contextItem: QuickActionCommand) {
|
|
531
|
+
if (contextItem.command === 'add_prompt') {
|
|
532
|
+
Log('Custom context action triggered for adding a prompt!')
|
|
533
|
+
return false;
|
|
534
|
+
}
|
|
535
|
+
return true;
|
|
536
|
+
},
|
|
537
|
+
...
|
|
538
|
+
```
|
|
539
|
+
|
|
540
|
+
---
|
|
541
|
+
|
|
515
542
|
### `onBeforeTabRemove`
|
|
516
543
|
|
|
517
544
|
This event will be fired when user clicks the close button but before actually closing the tab. You have **partial control over the tab close**. If you return false to this function, it will not immediately close the tab and will ask an approval from the user. Otherwise it will close the tab. You can set the texts which will be appeared on the confirmation overlay on **[Config/TEXTS](./CONFIG.md#texts)**. It will only pass `tabId` for the closed tab as argument.
|
|
@@ -826,6 +853,26 @@ onSendFeedback?: (
|
|
|
826
853
|
};
|
|
827
854
|
...
|
|
828
855
|
```
|
|
856
|
+
|
|
857
|
+
---
|
|
858
|
+
|
|
859
|
+
### `onFormModifierEnterPress`
|
|
860
|
+
|
|
861
|
+
This event will be fired when the user presses the modifier key (`cmd` on macOS, and `ctrl` on Windows / Linux) and the `enter` key at the same time, while focused on a textual form input field. The event will only be triggered for input fields that have set `checkModifierEnterKeyPress: true`, and it will only be triggered if the form is valid and can be submitted. An example use case for this would be submitting the form through a keyboard hotkey action.
|
|
862
|
+
|
|
863
|
+
```typescript
|
|
864
|
+
...
|
|
865
|
+
onFormModifierEnterPress?: (
|
|
866
|
+
formData: Record<string, string>,
|
|
867
|
+
tabId: string,
|
|
868
|
+
eventId?: string): void => {
|
|
869
|
+
console.log(`Form modifier enter pressed on tab <b>${tabId}</b>:<br/>
|
|
870
|
+
Form data: <b>${JSON.stringify(formData)}</b><br/>
|
|
871
|
+
`);
|
|
872
|
+
},
|
|
873
|
+
...
|
|
874
|
+
```
|
|
875
|
+
|
|
829
876
|
---
|
|
830
877
|
|
|
831
878
|
### `onCustomFormAction`
|
package/docs/STARTUP.md
CHANGED
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.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",
|