@aws/mynah-ui 4.0.2 → 4.0.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.
@@ -9,7 +9,8 @@ export interface ChatItemButtonsWrapperProps {
9
9
  tabId: string;
10
10
  buttons: ChatItemButton[];
11
11
  formItems: ChatItemFormItemsWrapper | null;
12
- onActionClick: (action: ChatItemButton) => void;
12
+ useButtonComponent?: boolean;
13
+ onActionClick: (action: ChatItemButton, e?: Event) => void;
13
14
  }
14
15
  export declare class ChatItemButtonsWrapper {
15
16
  private readonly props;
@@ -6,7 +6,7 @@ import { ExtendedHTMLElement } from '../../helper/dom';
6
6
  import { ChatItem } from '../../static';
7
7
  export interface ChatItemFormItemsWrapperProps {
8
8
  tabId: string;
9
- chatItem: ChatItem;
9
+ chatItem: Partial<ChatItem>;
10
10
  }
11
11
  export declare class ChatItemFormItemsWrapper {
12
12
  private readonly props;
@@ -3,12 +3,14 @@
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
  import { ExtendedHTMLElement } from '../../helper/dom';
6
- import { ReferenceTrackerInformation } from '../../static';
6
+ import { FileNodeAction, ReferenceTrackerInformation, TreeNodeDetails } from '../../static';
7
7
  export interface ChatItemTreeViewWrapperProps {
8
8
  tabId: string;
9
9
  messageId: string;
10
10
  files: string[];
11
11
  deletedFiles: string[];
12
+ actions?: Record<string, FileNodeAction[]>;
13
+ details?: Record<string, TreeNodeDetails>;
12
14
  referenceSuggestionLabel: string;
13
15
  references: ReferenceTrackerInformation[];
14
16
  }
@@ -3,8 +3,8 @@
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
  import { ExtendedHTMLElement } from '../../helper/dom';
6
- export declare const MAX_USER_INPUT = 4000;
7
6
  export declare const MAX_USER_INPUT_THRESHOLD = 96;
7
+ export declare const MAX_USER_INPUT: () => number;
8
8
  export interface ChatPromptInputProps {
9
9
  tabId: string;
10
10
  }
@@ -17,9 +17,11 @@ export declare class ChatWrapper {
17
17
  private readonly promptInfo;
18
18
  private readonly promptStickyCard;
19
19
  private lastChatItemCard;
20
+ private allRenderedChatItems;
20
21
  render: ExtendedHTMLElement;
21
22
  constructor(props: ChatWrapperProps);
22
23
  private readonly insertChatItem;
23
24
  updateLastChatAnswer: (updateWith: Partial<ChatItem>) => void;
25
+ updateChatAnswerWithMessageId: (messageId: string, updateWith: Partial<ChatItem>) => void;
24
26
  addToPrompt: (textToAdd: string) => void;
25
27
  }
@@ -0,0 +1,24 @@
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 { ChatItem } from '../../static';
7
+ import { ChatItemFormItemsWrapper } from '../chat-item/chat-item-form-items';
8
+ import { ChatItemButtonsWrapper } from '../chat-item/chat-item-buttons';
9
+ export interface CustomFormWrapperProps {
10
+ tabId: string;
11
+ chatItem: Partial<ChatItem>;
12
+ title?: string;
13
+ description?: string;
14
+ onFormAction?: (actionName: string, formData: Record<string, string>) => void;
15
+ onCloseButtonClick?: (e: Event) => void;
16
+ }
17
+ export declare class CustomFormWrapper {
18
+ readonly props: CustomFormWrapperProps;
19
+ render: ExtendedHTMLElement;
20
+ chatFormItems: ChatItemFormItemsWrapper | null;
21
+ chatButtons: ChatItemButtonsWrapper | null;
22
+ constructor(props: CustomFormWrapperProps);
23
+ private readonly getFormItems;
24
+ }
@@ -14,7 +14,9 @@ export declare enum MynahIcons {
14
14
  DOC = "doc",
15
15
  EXTERNAL = "external",
16
16
  CANCEL = "cancel",
17
+ CANCEL_CIRCLE = "cancel-circle",
17
18
  CALENDAR = "calendar",
19
+ COMMENT = "comment",
18
20
  MEGAPHONE = "megaphone",
19
21
  NOTIFICATION = "notification",
20
22
  EYE = "eye",
@@ -39,6 +41,7 @@ export declare enum MynahIcons {
39
41
  REFRESH = "refresh",
40
42
  USER = "user",
41
43
  PLAY = "play",
44
+ PENCIL = "pencil",
42
45
  PAUSE = "pause",
43
46
  CODE_BLOCK = "code-block",
44
47
  COPY = "copy",
@@ -5,6 +5,7 @@
5
5
  import { ExtendedHTMLElement } from '../helper/dom';
6
6
  export interface TabsProps {
7
7
  onChange?: (selectedTabId: string) => void;
8
+ onBeforeTabRemove?: (tabId: string) => boolean;
8
9
  }
9
10
  export declare class Tabs {
10
11
  render: ExtendedHTMLElement;
@@ -12,12 +13,15 @@ export declare class Tabs {
12
13
  private tabIdChatItemsSubscriptions;
13
14
  private toggleGroup;
14
15
  private maxReachedOverlay;
16
+ private closeConfirmationOverlay;
15
17
  private readonly props;
16
18
  constructor(props: TabsProps);
17
19
  private readonly getTabOptionsFromTabStoreData;
18
20
  private readonly getTabsRender;
19
21
  private readonly showMaxReachedOverLay;
20
22
  private readonly hideMaxReachedOverLay;
23
+ private readonly showCloseTabConfirmationOverLay;
24
+ private readonly hideshowCloseTabConfirmationOverLay;
21
25
  private readonly assignListener;
22
26
  private readonly removeListenerAssignments;
23
27
  }
@@ -19,7 +19,7 @@ export interface ToggleProps {
19
19
  name: string;
20
20
  disabled?: boolean;
21
21
  onChange?: (selectedValue: string) => void;
22
- onRemove?: (selectedValue: string) => void;
22
+ onRemove?: (selectedValue: string, domElement: ExtendedHTMLElement) => void;
23
23
  }
24
24
  export declare class Toggle {
25
25
  render: ExtendedHTMLElement;
@@ -2,10 +2,14 @@
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 { ConfigModel } from '../static';
5
+ import { ConfigModel, ConfigOptions, ConfigTexts } from '../static';
6
+ interface ConfigFullModel extends ConfigOptions {
7
+ texts: ConfigTexts;
8
+ }
6
9
  export declare class Config {
7
10
  private static instance;
8
- config: ConfigModel;
11
+ config: ConfigFullModel;
9
12
  private constructor();
10
13
  static getInstance(config?: Partial<ConfigModel>): Config;
11
14
  }
15
+ export {};
@@ -4,11 +4,16 @@
4
4
  */
5
5
  import { MynahPortalNames } from '../static';
6
6
  export declare const DS: typeof document.querySelectorAll;
7
+ type DomBuilderEventHandler = (event?: any) => any;
8
+ interface DomBuilderEventHandlerWithOptions {
9
+ handler: DomBuilderEventHandler;
10
+ options?: AddEventListenerOptions;
11
+ }
7
12
  export interface DomBuilderObject {
8
13
  type: string;
9
14
  attributes?: Record<string, string> | undefined;
10
15
  classNames?: string[] | undefined;
11
- events?: Record<string, (event?: any) => any> | undefined;
16
+ events?: Record<string, DomBuilderEventHandler | DomBuilderEventHandlerWithOptions> | undefined;
12
17
  children?: Array<string | DomBuilderObject | HTMLElement | ExtendedHTMLElement> | undefined;
13
18
  innerHTML?: string | undefined;
14
19
  persistent?: boolean | undefined;
@@ -52,3 +57,4 @@ export declare class DomBuilder {
52
57
  removeAllPortals: (portalsWithName: MynahPortalNames) => void;
53
58
  }
54
59
  export declare const htmlDecode: (input: string) => string;
60
+ export {};
@@ -2,16 +2,20 @@
2
2
  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
+ import { FileNodeAction, TreeNodeDetails } from '../static';
5
6
  export type TreeNode = FolderNode | FileNode;
6
7
  export interface FileNode {
7
8
  name: string;
8
9
  type: 'file';
9
10
  filePath: string;
10
11
  deleted: boolean;
12
+ actions?: FileNodeAction[];
13
+ details?: TreeNodeDetails;
11
14
  }
12
15
  export interface FolderNode {
13
16
  name: string;
14
17
  type: 'folder';
18
+ details?: TreeNodeDetails;
15
19
  children: Array<FolderNode | FileNode>;
16
20
  }
17
- export declare const fileListToTree: (modifiedFilePaths: string[], deletedFilePaths?: string[]) => TreeNode;
21
+ export declare const fileListToTree: (modifiedFilePaths: string[], deletedFilePaths?: string[], actions?: Record<string, FileNodeAction[]>, details?: Record<string, TreeNodeDetails>) => TreeNode;
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 } from './static';
5
+ import { RelevancyVoteType, FeedbackPayload, MynahUIDataModel, NotificationType, ChatItem, ChatItemAction, ChatPrompt, MynahUITabStoreModel, MynahUITabStoreTab, ConfigModel, ReferenceTrackerInformation, CodeSelectionType, Engagement, ChatItemFormItem, ChatItemButton } from './static';
6
6
  import './styles/styles.scss';
7
7
  export { FeedbackPayload, RelevancyVoteType, EngagementType, Engagement, MynahUIDataModel, NotificationType, ChatItem, ChatItemAction, ChatItemType, ChatPrompt, SourceLink } from './static';
8
8
  export { ToggleOption } from './components/toggle';
@@ -27,6 +27,7 @@ export interface MynahUIProps {
27
27
  onTabChange?: (tabId: string) => void;
28
28
  onTabAdd?: (tabId: string) => void;
29
29
  onTabRemove?: (tabId: string) => void;
30
+ onBeforeTabRemove?: (tabId: string) => boolean;
30
31
  onChatItemEngagement?: (tabId: string, messageId: string, engagement: Engagement) => void;
31
32
  onCopyCodeToClipboard?: (tabId: string, messageId: string, code?: string, type?: CodeSelectionType, referenceTrackerInformation?: ReferenceTrackerInformation[]) => void;
32
33
  onCodeInsertToCursorPosition?: (tabId: string, messageId: string, code?: string, type?: CodeSelectionType, referenceTrackerInformation?: ReferenceTrackerInformation[]) => void;
@@ -34,7 +35,13 @@ export interface MynahUIProps {
34
35
  onLinkClick?: (tabId: string, messageId: string, link: string, mouseEvent?: MouseEvent) => void;
35
36
  onInfoLinkClick?: (tabId: string, link: string, mouseEvent?: MouseEvent) => void;
36
37
  onSendFeedback?: (tabId: string, feedbackPayload: FeedbackPayload) => void;
38
+ onCustomFormAction?: (tabId: string, action: {
39
+ id: string;
40
+ text?: string;
41
+ formItemValues?: Record<string, string>;
42
+ }) => void;
37
43
  onOpenDiff?: (tabId: string, filePath: string, deleted: boolean, messageId?: string) => void;
44
+ onFileActionClick?: (tabId: string, messageId: string, filePath: string, actionName: string) => void;
38
45
  }
39
46
  export declare class MynahUI {
40
47
  private readonly props;
@@ -48,6 +55,7 @@ export declare class MynahUI {
48
55
  addToUserPrompt: (tabId: string, prompt: string) => void;
49
56
  addChatItem: (tabId: string, chatItem: ChatItem) => void;
50
57
  updateLastChatAnswer: (tabId: string, updateWith: Partial<ChatItem>) => void;
58
+ updateChatAnswerWithMessageId: (tabId: string, messageId: string, updateWith: Partial<ChatItem>) => void;
51
59
  updateStore: (tabId: string | '', data: MynahUIDataModel) => string | undefined;
52
60
  getSelectedTabId: () => string | undefined;
53
61
  getAllTabs: () => MynahUITabStoreModel;
@@ -59,4 +67,5 @@ export declare class MynahUI {
59
67
  onNotificationClick?: () => void;
60
68
  onNotificationHide?: () => void;
61
69
  }) => void;
70
+ showCustomForm: (tabId: string, formItems?: ChatItemFormItem[], buttons?: ChatItemButton[], title?: string, description?: string) => void;
62
71
  }