@aws/mynah-ui 1.1.11 → 1.1.13
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 +16 -1
- package/dist/components/navigation-tabs.d.ts +14 -0
- package/dist/components/toggle.d.ts +1 -0
- package/dist/helper/store.d.ts +4 -0
- package/dist/main.d.ts +7 -0
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/static.d.ts +6 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ export const createMynahUI = () => {
|
|
|
19
19
|
// initial UI state data
|
|
20
20
|
// It doesn't have to be matched with backend data
|
|
21
21
|
// but to update the UI and rerender its desired parts,
|
|
22
|
-
// it expects the data in
|
|
22
|
+
// it expects the data in type of MynahUIDataModel.
|
|
23
23
|
storeData?: MynahUIDataModel;
|
|
24
24
|
|
|
25
25
|
// All below items trigger when;
|
|
@@ -51,6 +51,9 @@ export const createMynahUI = () => {
|
|
|
51
51
|
// Matching policy is changed (context items)
|
|
52
52
|
onChangeContext?: (changeType: ContextChangeType, queryContext: ContextType) => void;
|
|
53
53
|
|
|
54
|
+
// When navigation tab is changed
|
|
55
|
+
onNavigationTabChange?: (selectedTab: string) => void;
|
|
56
|
+
|
|
54
57
|
// User engages with a suggestion
|
|
55
58
|
onSuggestionEngagement?: (engagement: SuggestionEngagement) => void;
|
|
56
59
|
|
|
@@ -108,6 +111,18 @@ export const createMynahUI = () => {
|
|
|
108
111
|
...,
|
|
109
112
|
onSearch: getSuggestions
|
|
110
113
|
});
|
|
114
|
+
|
|
115
|
+
// to update the store fully or partially
|
|
116
|
+
mynahUI.updateStore(...);
|
|
117
|
+
|
|
118
|
+
// set default values for the UI data store fully or partially
|
|
119
|
+
mynahUI.setStoreDefaults(...);
|
|
120
|
+
|
|
121
|
+
// get current search payload
|
|
122
|
+
mynahUI.getSearchPayload();
|
|
123
|
+
|
|
124
|
+
// Show a notification balloon
|
|
125
|
+
mynahUI.notify(...);
|
|
111
126
|
}
|
|
112
127
|
```
|
|
113
128
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import { ExtendedHTMLElement } from '../helper/dom';
|
|
6
|
+
export interface NavivationTabsProps {
|
|
7
|
+
onChange?: (selectedValue: string) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare class NavivationTabs {
|
|
10
|
+
render: ExtendedHTMLElement;
|
|
11
|
+
private readonly props;
|
|
12
|
+
constructor(props: NavivationTabsProps);
|
|
13
|
+
private readonly getTabsRender;
|
|
14
|
+
}
|
package/dist/helper/store.d.ts
CHANGED
|
@@ -19,6 +19,10 @@ export declare class MynahUIDataStore {
|
|
|
19
19
|
* @param defaults partial set of MynahUIDataModel for defaults
|
|
20
20
|
*/
|
|
21
21
|
setDefaults: (defaults: MynahUIDataModel | null) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Get the defaults to use while generating an empty store data
|
|
24
|
+
*/
|
|
25
|
+
getDefaults: () => MynahUIDataModel | null;
|
|
22
26
|
/**
|
|
23
27
|
* Subscribe to value changes of a specific item in data store
|
|
24
28
|
* @param storeKey One of the keys in MynahUIDataModel
|
package/dist/main.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { SuggestionEngagement, Suggestion, SearchPayload, LiveSearchState, Sugge
|
|
|
6
6
|
import './styles/styles.scss';
|
|
7
7
|
export { AutocompleteItem, SearchPayloadCodeSelection, FeedbackPayload, RelevancyVoteType, LiveSearchState, SearchPayload, Suggestion, ContextType, SearchHistoryItem, EngagementType, SuggestionEngagement, SuggestionEventName, SearchHistoryFilters, MynahUIDataModel, ContextChangeType, ContextSource, ContextTypes, NotificationType, } from './static';
|
|
8
8
|
export interface MynahUIProps {
|
|
9
|
+
rootSelector?: string;
|
|
9
10
|
storeData?: MynahUIDataModel;
|
|
10
11
|
onSearch?: (searchPayload: SearchPayload, isFromHistory?: boolean, isFromAutocomplete?: boolean) => void;
|
|
11
12
|
onReady?: () => void;
|
|
@@ -22,6 +23,7 @@ export interface MynahUIProps {
|
|
|
22
23
|
}) => void;
|
|
23
24
|
onResetStore?: () => void;
|
|
24
25
|
onChangeContext?: (changeType: ContextChangeType, queryContext: ContextType) => void;
|
|
26
|
+
onNavigationTabChange?: (selectedTab: string) => void;
|
|
25
27
|
onSuggestionEngagement?: (engagement: SuggestionEngagement) => void;
|
|
26
28
|
onSuggestionClipboardInteraction?: (suggestionId: string, type?: string, text?: string) => void;
|
|
27
29
|
onSuggestionInteraction?: (eventName: SuggestionEventName, suggestion: Suggestion, mouseEvent?: MouseEvent) => void;
|
|
@@ -35,6 +37,7 @@ export declare class MynahUI {
|
|
|
35
37
|
private readonly props;
|
|
36
38
|
private readonly wrapper;
|
|
37
39
|
private readonly searchCard;
|
|
40
|
+
private readonly navTabs;
|
|
38
41
|
private readonly mainContainer;
|
|
39
42
|
private readonly config;
|
|
40
43
|
constructor(props: MynahUIProps);
|
|
@@ -50,6 +53,10 @@ export declare class MynahUI {
|
|
|
50
53
|
* @param defaults partial set of MynahUIDataModel for defaults
|
|
51
54
|
*/
|
|
52
55
|
setStoreDefaults: (defaults: MynahUIDataModel | null) => void;
|
|
56
|
+
/**
|
|
57
|
+
* Returns the current search payload
|
|
58
|
+
*/
|
|
59
|
+
getSearchPayload: () => SearchPayload;
|
|
53
60
|
/**
|
|
54
61
|
* Simply creates and shows a notification
|
|
55
62
|
* @param props NotificationProps
|