@aws/mynah-ui 4.36.4-beta.1 → 4.36.4
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/chat-item/chat-item-card.d.ts +1 -0
- package/dist/components/dropdown-form/base-dropdown.d.ts +52 -0
- package/dist/components/dropdown-form/dropdown-list.d.ts +18 -0
- package/dist/components/dropdown-form/dropdown-wrapper.d.ts +20 -0
- package/dist/helper/test-ids.d.ts +11 -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 +26 -0
- package/docs/DATAMODEL.md +101 -2
- package/docs/PROPERTIES.md +47 -0
- package/docs/img/data-model/chatItems/dropdown-list.png +0 -0
- package/docs/img/onDropDownLinkClick.png +0 -0
- package/docs/img/onDropDownOptionChange.png +0 -0
- package/package.json +1 -1
- package/ui-tests/__snapshots__/chromium/Open-MynahUI-Dropdown-list-should-open-and-close-dropdown/dropdown-closed.png +0 -0
- package/ui-tests/__snapshots__/chromium/Open-MynahUI-Dropdown-list-should-open-and-close-dropdown/dropdown-initial.png +0 -0
- package/ui-tests/__snapshots__/chromium/Open-MynahUI-Dropdown-list-should-open-and-close-dropdown/dropdown-open.png +0 -0
- package/ui-tests/__snapshots__/chromium/Open-MynahUI-Dropdown-list-should-select-dropdown-option/dropdown-select-final.png +0 -0
- package/ui-tests/__snapshots__/chromium/Open-MynahUI-Dropdown-list-should-select-dropdown-option/dropdown-select-initial.png +0 -0
- package/ui-tests/__snapshots__/chromium/Open-MynahUI-Dropdown-list-should-select-dropdown-option/dropdown-select-open.png +0 -0
- package/ui-tests/__snapshots__/webkit/Open-MynahUI-Dropdown-list-should-open-and-close-dropdown/dropdown-closed.png +0 -0
- package/ui-tests/__snapshots__/webkit/Open-MynahUI-Dropdown-list-should-open-and-close-dropdown/dropdown-initial.png +0 -0
- package/ui-tests/__snapshots__/webkit/Open-MynahUI-Dropdown-list-should-open-and-close-dropdown/dropdown-open.png +0 -0
- package/ui-tests/__snapshots__/webkit/Open-MynahUI-Dropdown-list-should-select-dropdown-option/dropdown-select-final.png +0 -0
- package/ui-tests/__snapshots__/webkit/Open-MynahUI-Dropdown-list-should-select-dropdown-option/dropdown-select-initial.png +0 -0
- package/ui-tests/__snapshots__/webkit/Open-MynahUI-Dropdown-list-should-select-dropdown-option/dropdown-select-open.png +0 -0
|
@@ -52,6 +52,7 @@ export declare class ChatItemCard {
|
|
|
52
52
|
private readonly updateCardContent;
|
|
53
53
|
private readonly getChatAvatar;
|
|
54
54
|
private readonly canShowAvatar;
|
|
55
|
+
private readonly shouldShowQuickSettings;
|
|
55
56
|
private readonly showTooltip;
|
|
56
57
|
readonly hideTooltip: () => void;
|
|
57
58
|
readonly updateCard: () => void;
|
|
@@ -0,0 +1,52 @@
|
|
|
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 BaseDropdownProps<T> {
|
|
7
|
+
description?: string;
|
|
8
|
+
descriptionLink?: {
|
|
9
|
+
id: string;
|
|
10
|
+
text: string;
|
|
11
|
+
destination: string;
|
|
12
|
+
onClick?: () => void;
|
|
13
|
+
};
|
|
14
|
+
items: T[];
|
|
15
|
+
onChange?: (selectedItems: T[]) => void;
|
|
16
|
+
tabId?: string;
|
|
17
|
+
messageId?: string;
|
|
18
|
+
classNames?: string[];
|
|
19
|
+
}
|
|
20
|
+
export declare abstract class BaseDropdown<T = any> {
|
|
21
|
+
render: ExtendedHTMLElement;
|
|
22
|
+
protected readonly props: BaseDropdownProps<T>;
|
|
23
|
+
protected readonly tabId: string;
|
|
24
|
+
protected readonly messageId: string;
|
|
25
|
+
protected dropdownContent: ExtendedHTMLElement | null;
|
|
26
|
+
protected dropdownPortal: ExtendedHTMLElement | null;
|
|
27
|
+
protected readonly uid: string;
|
|
28
|
+
protected isOpen: boolean;
|
|
29
|
+
protected selectedItems: T[];
|
|
30
|
+
protected dropdownIcon: ExtendedHTMLElement;
|
|
31
|
+
protected readonly sheetOpenListenerId: string | null;
|
|
32
|
+
protected abstract createItemElement(item: T): ExtendedHTMLElement;
|
|
33
|
+
protected abstract handleItemSelection(item: T): void;
|
|
34
|
+
protected abstract getItemSelectionState(item: T): boolean;
|
|
35
|
+
protected abstract getDisplayLabel(): string;
|
|
36
|
+
protected getCSSVariableValue(variableName: string, fallback: number): number;
|
|
37
|
+
constructor(props: BaseDropdownProps<T>);
|
|
38
|
+
protected getInitialSelection(): T[];
|
|
39
|
+
protected readonly updateUI: () => void;
|
|
40
|
+
protected abstract getItemId(item: T): string;
|
|
41
|
+
protected readonly onLinkClick: (buttonId: string) => void;
|
|
42
|
+
protected readonly toggleDropdown: (e: Event) => void;
|
|
43
|
+
protected readonly openDropdown: () => void;
|
|
44
|
+
protected readonly isElementVisible: (element: Element) => boolean;
|
|
45
|
+
protected readonly updateDropdownPosition: () => void;
|
|
46
|
+
protected readonly closeDropdown: () => void;
|
|
47
|
+
protected readonly handleClickOutside: (e: MouseEvent) => void;
|
|
48
|
+
readonly getSelectedItems: () => T[];
|
|
49
|
+
readonly setSelectedItems: (itemIds: string[]) => void;
|
|
50
|
+
protected readonly dispatchChangeEvent: () => void;
|
|
51
|
+
readonly destroy: () => void;
|
|
52
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
import { DropdownListOption, DropdownListProps } from '../../static';
|
|
7
|
+
import { BaseDropdown } from './base-dropdown';
|
|
8
|
+
export declare class DropdownList extends BaseDropdown<DropdownListOption> {
|
|
9
|
+
constructor(props: DropdownListProps);
|
|
10
|
+
protected getInitialSelection(): DropdownListOption[];
|
|
11
|
+
protected createItemElement(option: DropdownListOption): ExtendedHTMLElement;
|
|
12
|
+
protected handleItemSelection(option: DropdownListOption): void;
|
|
13
|
+
protected getItemSelectionState(option: DropdownListOption): boolean;
|
|
14
|
+
protected getDisplayLabel(): string;
|
|
15
|
+
protected getItemId(option: DropdownListOption): string;
|
|
16
|
+
readonly getSelectedOptions: () => DropdownListOption[];
|
|
17
|
+
readonly setSelectedOptions: (optionIds: string[]) => void;
|
|
18
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
import { DropdownFactoryProps, DropdownListOption } from '../../static';
|
|
7
|
+
export interface DropdownWrapperProps {
|
|
8
|
+
dropdownProps: DropdownFactoryProps;
|
|
9
|
+
classNames?: string[];
|
|
10
|
+
}
|
|
11
|
+
export declare class DropdownWrapper {
|
|
12
|
+
private readonly props;
|
|
13
|
+
private dropdown;
|
|
14
|
+
render: ExtendedHTMLElement;
|
|
15
|
+
constructor(props: DropdownWrapperProps);
|
|
16
|
+
private readonly createDropdownComponent;
|
|
17
|
+
readonly getSelectedItems: () => DropdownListOption[];
|
|
18
|
+
readonly setSelectedItems: (itemIds: string[]) => void;
|
|
19
|
+
readonly destroy: () => void;
|
|
20
|
+
}
|
|
@@ -164,5 +164,16 @@ declare const _default: {
|
|
|
164
164
|
title: string;
|
|
165
165
|
content: string;
|
|
166
166
|
};
|
|
167
|
+
dropdownList: {
|
|
168
|
+
wrapper: string;
|
|
169
|
+
button: string;
|
|
170
|
+
portal: string;
|
|
171
|
+
content: string;
|
|
172
|
+
title: string;
|
|
173
|
+
description: string;
|
|
174
|
+
option: string;
|
|
175
|
+
optionLabel: string;
|
|
176
|
+
checkIcon: string;
|
|
177
|
+
};
|
|
167
178
|
};
|
|
168
179
|
export default _default;
|
package/dist/main.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
|
-
import { RelevancyVoteType, FeedbackPayload, MynahUIDataModel, NotificationType, ChatItem, ChatItemAction, ChatPrompt, MynahUITabStoreModel, MynahUITabStoreTab, ConfigModel, ReferenceTrackerInformation, CodeSelectionType, Engagement, ChatItemFormItem, ChatItemButton, CardRenderDetails, PromptAttachmentType, QuickActionCommand, DetailedList, TreeNodeDetails, Action } from './static';
|
|
5
|
+
import { RelevancyVoteType, FeedbackPayload, MynahUIDataModel, NotificationType, ChatItem, ChatItemAction, ChatPrompt, MynahUITabStoreModel, MynahUITabStoreTab, ConfigModel, ReferenceTrackerInformation, CodeSelectionType, Engagement, ChatItemFormItem, ChatItemButton, CardRenderDetails, PromptAttachmentType, QuickActionCommand, DetailedList, TreeNodeDetails, Action, DropdownListOption } from './static';
|
|
6
6
|
import { DetailedListSheetProps } from './components/detailed-list/detailed-list-sheet';
|
|
7
7
|
import { MynahUIDataStore } from './helper/store';
|
|
8
8
|
import { TopBarButtonOverlayProps } from './components/chat-item/prompt-input/prompt-top-bar/top-bar-button';
|
|
@@ -82,6 +82,8 @@ export interface MynahUIProps {
|
|
|
82
82
|
text?: string;
|
|
83
83
|
formItemValues?: Record<string, string>;
|
|
84
84
|
}, eventId?: string) => void;
|
|
85
|
+
onDropDownOptionChange?: (tabId: string, messageId: string, value: DropdownListOption[]) => void;
|
|
86
|
+
onDropDownLinkClick?: (tabId: string, actionId: string, destination: string) => void;
|
|
85
87
|
onPromptInputOptionChange?: (tabId: string, optionsValues: Record<string, string>, eventId?: string) => void;
|
|
86
88
|
onPromptInputButtonClick?: (tabId: string, buttonId: string, eventId?: string) => void;
|
|
87
89
|
onPromptTopBarItemAdded?: (tabId: string, item: QuickActionCommand, eventId?: string) => void;
|