@aws/mynah-ui 4.18.1 → 4.20.0
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/README.md +1 -1
- package/dist/components/button.d.ts +1 -0
- package/dist/components/spinner/spinner.d.ts +10 -0
- package/dist/components/syntax-highlighter.d.ts +4 -0
- package/dist/helper/dom.d.ts +1 -1
- package/dist/helper/tabs-store.d.ts +6 -1
- package/dist/main.d.ts +15 -0
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/static.d.ts +4 -0
- package/docs/CONFIG.md +1 -1
- package/docs/DATAMODEL.md +25 -0
- package/docs/DEVELOPER.md +1 -1
- package/docs/PROPERTIES.md +1 -1
- package/docs/USAGE.md +40 -3
- package/docs/img/data-model/chatItems/fillState-hover.png +0 -0
- package/docs/img/data-model/chatItems/fillState.png +0 -0
- package/docs/img/splashLoader.png +0 -0
- package/package.json +1 -1
- package/postinstall.js +1 -0
- package/ui-tests/dist/main.js +5 -1
- package/ui-tests/dist/main.js.map +1 -1
- package/ui-tests/jest.config.js +1 -1
package/dist/static.d.ts
CHANGED
|
@@ -239,6 +239,9 @@ export interface ChatItemContent {
|
|
|
239
239
|
actions?: Record<string, FileNodeAction[]>;
|
|
240
240
|
details?: Record<string, TreeNodeDetails>;
|
|
241
241
|
} | null;
|
|
242
|
+
/**
|
|
243
|
+
* @deprecated starting from version v5.0.0, it will no longer render the buttons in a reversed order, but rather in the order of the array.
|
|
244
|
+
*/
|
|
242
245
|
buttons?: ChatItemButton[] | null;
|
|
243
246
|
formItems?: ChatItemFormItem[] | null;
|
|
244
247
|
footer?: ChatItemContent | null;
|
|
@@ -302,6 +305,7 @@ export interface ChatItemButton {
|
|
|
302
305
|
description?: string;
|
|
303
306
|
status?: 'main' | 'primary' | 'clear' | Status;
|
|
304
307
|
flash?: 'infinite' | 'once';
|
|
308
|
+
fillState?: 'hover' | 'always';
|
|
305
309
|
icon?: MynahIcons;
|
|
306
310
|
position?: 'inside' | 'outside';
|
|
307
311
|
}
|
package/docs/CONFIG.md
CHANGED
|
@@ -113,7 +113,7 @@ const mynahUI = new MynahUI({
|
|
|
113
113
|
|
|
114
114
|
# `texts`
|
|
115
115
|
All static texts will be shown on UI.
|
|
116
|
-
Please take a look at each image to identify which text
|
|
116
|
+
Please take a look at each image to identify which text belongs to which item on UI.
|
|
117
117
|
|
|
118
118
|
## mainTitle
|
|
119
119
|
Default tab title text if it is not set through store data for that tab.
|
package/docs/DATAMODEL.md
CHANGED
|
@@ -1876,6 +1876,7 @@ interface ChatItemButton {
|
|
|
1876
1876
|
description?: string; // A text to be shown inside a tooltip and it can be markdown
|
|
1877
1877
|
status?: 'main' | 'primary' | 'clear' | Status;
|
|
1878
1878
|
flash?: 'infinite' | 'once'; // Flashes the card
|
|
1879
|
+
fillState?: 'hover' | 'always'; // background is filled always or only when hover
|
|
1879
1880
|
icon?: MynahIcons; // in case if you want to put an icon to the button.
|
|
1880
1881
|
position?: 'inside' | 'outside'; // Whether the button shows up inside or oustide a card, default is 'inside'
|
|
1881
1882
|
}
|
|
@@ -1995,6 +1996,30 @@ mynahUI.addChatItem(tabId, {
|
|
|
1995
1996
|
<img src="./img/data-model/chatItems/buttonFlash.png" alt="button flash" style="max-width:500px; width:100%;border: 1px solid #e0e0e0;">
|
|
1996
1997
|
</p>
|
|
1997
1998
|
|
|
1999
|
+
#### Button fillState
|
|
2000
|
+
|
|
2001
|
+
You can make the filled buttons filled always or filled only on hover.
|
|
2002
|
+
|
|
2003
|
+
```typescript
|
|
2004
|
+
mynahUI.addChatItem(tabId, {
|
|
2005
|
+
type: ChatItemType.ANSWER,
|
|
2006
|
+
...
|
|
2007
|
+
buttons: [
|
|
2008
|
+
{
|
|
2009
|
+
...
|
|
2010
|
+
fillState: 'hover',
|
|
2011
|
+
...
|
|
2012
|
+
},
|
|
2013
|
+
...,
|
|
2014
|
+
],
|
|
2015
|
+
});
|
|
2016
|
+
```
|
|
2017
|
+
|
|
2018
|
+
<p align="center">
|
|
2019
|
+
<img src="./img/data-model/chatItems/fillState.png" alt="button fill when hover" style="max-width:500px; width:100%;border: 1px solid #e0e0e0;">
|
|
2020
|
+
<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;">
|
|
2021
|
+
</p>
|
|
2022
|
+
|
|
1998
2023
|
---
|
|
1999
2024
|
|
|
2000
2025
|
## `formItems`
|
package/docs/DEVELOPER.md
CHANGED
|
@@ -254,7 +254,7 @@ Ok, now it is getting better but let's also add some icons. For the answer's we
|
|
|
254
254
|
|
|
255
255
|
Assuming that you alread find your `svg` file which is the only supported type for `mynah-ui` because of the responsive design concerns. Then navigate to folder `src/components/icon/icons` and rename your file to match the pattern with others, no spaces allowed.
|
|
256
256
|
|
|
257
|
-
And then open the `icon-
|
|
257
|
+
And then open the `icon-importer.ts` placed in one parent folder and add your import and name with the same pattern with others.
|
|
258
258
|
|
|
259
259
|
```typescript
|
|
260
260
|
// ICONS
|
package/docs/PROPERTIES.md
CHANGED
|
@@ -149,7 +149,7 @@ export interface MynahUIProps {
|
|
|
149
149
|
_Let's deep dive into each property you can set._
|
|
150
150
|
|
|
151
151
|
### But before that, what is `eventId`?
|
|
152
|
-
You may notice that a
|
|
152
|
+
You may notice that a vast majority of the event functions have `eventId` property. We're sending a unique `eventId` **for all real intended user actions** like clicks, prompts or tab related actions.
|
|
153
153
|
It is mandatory to send it as an argument for some functions like `mynahUI.selectTab`.You need to send the incoming `eventId` from the connected event function to change a tab programmatically. Because without a user intent, you cannot change a tab.
|
|
154
154
|
|
|
155
155
|
And those kind of functions **will only work** with the last `eventId`. So you cannot store an id and send it after several different user actions.
|
package/docs/USAGE.md
CHANGED
|
@@ -25,6 +25,8 @@ mynahUI.getSelectedTabId(...);
|
|
|
25
25
|
mynahUI.getAllTabs(...);
|
|
26
26
|
mynahUI.notify(...);
|
|
27
27
|
mynahUI.showCustomForm(...);
|
|
28
|
+
mynahUI.updateTabDefaults(...);
|
|
29
|
+
mynahUI.toggleSplashLoader(...);
|
|
28
30
|
```
|
|
29
31
|
|
|
30
32
|
<p><br/></p>
|
|
@@ -58,7 +60,7 @@ So if it reached to the max number of tabs can be opened, it will return undefin
|
|
|
58
60
|
```typescript
|
|
59
61
|
const mynahUI = new MynahUI({...});
|
|
60
62
|
|
|
61
|
-
const newTabId:
|
|
63
|
+
const newTabId: string | undefined = mynahUI.updateStore('', {
|
|
62
64
|
tabTitle: 'My new tab!'
|
|
63
65
|
});
|
|
64
66
|
if(typeof newTabId !== string){
|
|
@@ -424,7 +426,7 @@ And when user sends the prompt attached code will be appended to the bottom.
|
|
|
424
426
|
|
|
425
427
|
## Getting all tabs with their store data (`getAllTabs`)
|
|
426
428
|
|
|
427
|
-
You can get all tabs and their latest updated store data. Do not use this function to handle the data. This function aims to help you
|
|
429
|
+
You can get all tabs and their latest updated store data. Do not use this function to handle the data. This function aims to help you with your test scenarios which you can grab the data and do your comparisons.
|
|
428
430
|
|
|
429
431
|
```typescript
|
|
430
432
|
mynahUI.getAllTabs();
|
|
@@ -499,4 +501,39 @@ mynahUI.showCustomForm(
|
|
|
499
501
|
<img src="./img/customForm.png" alt="mainTitle" style="max-width:500px; width:100%;border: 1px solid #e0e0e0;">
|
|
500
502
|
</p>
|
|
501
503
|
|
|
502
|
-
To see the form item objects structure and the buttons structure, please go take a look to [DATAMODEL / formItems](./DATAMODEL.md#formItems) and [DATAMODEL / buttons](./DATAMODEL.md#buttons) ** because the structure of the items are identical. **
|
|
504
|
+
To see the form item objects structure and the buttons structure, please go take a look to [DATAMODEL / formItems](./DATAMODEL.md#formItems) and [DATAMODEL / buttons](./DATAMODEL.md#buttons) ** because the structure of the items are identical. **
|
|
505
|
+
|
|
506
|
+
|
|
507
|
+
|
|
508
|
+
<p><br/></p>
|
|
509
|
+
|
|
510
|
+
# Update tab defaults (`updateTabDefaults`)
|
|
511
|
+
|
|
512
|
+
You can use this method by providing the same value for the construcor property (`defaults`) to update the tab default values. **Do not foget that it will not effect anything in an already created tab**.
|
|
513
|
+
|
|
514
|
+
```typescript
|
|
515
|
+
mynahUI.updateTabDefaults({store: {
|
|
516
|
+
chatItems: [
|
|
517
|
+
{
|
|
518
|
+
...,
|
|
519
|
+
body: 'Hello!',
|
|
520
|
+
...
|
|
521
|
+
}
|
|
522
|
+
]
|
|
523
|
+
}});
|
|
524
|
+
```
|
|
525
|
+
<p align="center">
|
|
526
|
+
</br>
|
|
527
|
+
</p>
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
# Show splash screen spinner (`toggleSplashLoader`)
|
|
531
|
+
|
|
532
|
+
You can enable or disable window wide splash screen spinner with or without text.
|
|
533
|
+
|
|
534
|
+
```typescript
|
|
535
|
+
mynahUI.toggleSplashLoader(true, 'Initializing');
|
|
536
|
+
```
|
|
537
|
+
<p align="center">
|
|
538
|
+
<img src="./img/splashLoader.png" alt="mainTitle" style="max-width:500px; width:100%;border: 1px solid #e0e0e0;">
|
|
539
|
+
</p>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
package/postinstall.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const deprecationList = [
|
|
2
2
|
'Config.texts.clickFileToViewDiff will be deprecated after 5.x.x',
|
|
3
3
|
'MynahUIProps.onOpenDiff will be deprecated after 5.x.x',
|
|
4
|
+
'ChatItemContent.buttons will render in the order of the array starting from v5.0.0, instead of reverse order.',
|
|
4
5
|
'MynahUIProps.onCodeInsertToCursorPosition will be deprecated after 5.x.x',
|
|
5
6
|
'MynahUIProps.onCopyCodeToClipboard will be changed to be used only on keyboard and context menu copy actions after 5.x.x',
|
|
6
7
|
];
|