@aws/mynah-ui 4.12.0 → 4.14.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.
Files changed (145) hide show
  1. package/dist/components/button.d.ts +8 -6
  2. package/dist/components/card/card-body.d.ts +5 -7
  3. package/dist/components/card/card.d.ts +2 -1
  4. package/dist/components/chat-item/chat-item-buttons.d.ts +1 -1
  5. package/dist/components/chat-item/chat-item-card-content.d.ts +36 -0
  6. package/dist/components/chat-item/chat-item-card.d.ts +20 -18
  7. package/dist/components/chat-item/chat-item-form-items.d.ts +1 -0
  8. package/dist/components/chat-item/chat-item-relevance-vote.d.ts +1 -0
  9. package/dist/components/chat-item/chat-item-tree-view-wrapper.d.ts +1 -0
  10. package/dist/components/chat-item/chat-wrapper.d.ts +3 -0
  11. package/dist/components/chat-item/prompt-input/prompt-text-input.d.ts +2 -0
  12. package/dist/components/chat-item/prompt-input/send-button.d.ts +4 -5
  13. package/dist/components/collapsible-content.d.ts +1 -0
  14. package/dist/components/feedback-form/feedback-form.d.ts +1 -0
  15. package/dist/components/form-items/radio-group.d.ts +15 -1
  16. package/dist/components/form-items/select.d.ts +16 -1
  17. package/dist/components/form-items/stars.d.ts +1 -0
  18. package/dist/components/form-items/text-area.d.ts +15 -1
  19. package/dist/components/form-items/text-input.d.ts +16 -2
  20. package/dist/components/icon.d.ts +5 -1
  21. package/dist/components/navigation-tabs.d.ts +1 -0
  22. package/dist/components/no-tabs.d.ts +1 -0
  23. package/dist/components/notification.d.ts +1 -0
  24. package/dist/components/overlay.d.ts +1 -0
  25. package/dist/components/syntax-highlighter.d.ts +6 -4
  26. package/dist/components/toggle.d.ts +1 -0
  27. package/dist/helper/chat-item.d.ts +1 -0
  28. package/dist/helper/config.d.ts +2 -1
  29. package/dist/helper/dom.d.ts +2 -0
  30. package/dist/main.d.ts +19 -4
  31. package/dist/main.js +1 -1
  32. package/dist/main.js.map +1 -1
  33. package/dist/static.d.ts +38 -12
  34. package/docs/CONFIG.md +350 -0
  35. package/docs/DATAMODEL.md +2146 -0
  36. package/docs/DEVELOPER.md +499 -0
  37. package/docs/PROPERTIES.md +863 -0
  38. package/docs/STARTUP.md +51 -0
  39. package/docs/STYLING.md +195 -0
  40. package/docs/USAGE.md +502 -0
  41. package/docs/img/code-attachment.png +0 -0
  42. package/docs/img/customForm.png +0 -0
  43. package/docs/img/data-model/chatItems/actions.png +0 -0
  44. package/docs/img/data-model/chatItems/answer.png +0 -0
  45. package/docs/img/data-model/chatItems/answerStream.png +0 -0
  46. package/docs/img/data-model/chatItems/body.png +0 -0
  47. package/docs/img/data-model/chatItems/canBeVoted.png +0 -0
  48. package/docs/img/data-model/chatItems/codeBlockActions.png +0 -0
  49. package/docs/img/data-model/chatItems/codeInsertAndCopyButtons.png +0 -0
  50. package/docs/img/data-model/chatItems/codeInsertAndCopyButtonsThroughConfig.png +0 -0
  51. package/docs/img/data-model/chatItems/codeReference-1.png +0 -0
  52. package/docs/img/data-model/chatItems/codeReference-2.png +0 -0
  53. package/docs/img/data-model/chatItems/codeResult.png +0 -0
  54. package/docs/img/data-model/chatItems/customRenderer_html.png +0 -0
  55. package/docs/img/data-model/chatItems/customRenderer_json.png +0 -0
  56. package/docs/img/data-model/chatItems/followUp-1.png +0 -0
  57. package/docs/img/data-model/chatItems/followUp-2.png +0 -0
  58. package/docs/img/data-model/chatItems/footer.png +0 -0
  59. package/docs/img/data-model/chatItems/footer2.png +0 -0
  60. package/docs/img/data-model/chatItems/icon.png +0 -0
  61. package/docs/img/data-model/chatItems/notification-1.png +0 -0
  62. package/docs/img/data-model/chatItems/notification-2.png +0 -0
  63. package/docs/img/data-model/chatItems/notification-3.png +0 -0
  64. package/docs/img/data-model/chatItems/notification-4.png +0 -0
  65. package/docs/img/data-model/chatItems/options-all-filled.png +0 -0
  66. package/docs/img/data-model/chatItems/options-mandatory-filled.png +0 -0
  67. package/docs/img/data-model/chatItems/options-submitted.png +0 -0
  68. package/docs/img/data-model/chatItems/options.png +0 -0
  69. package/docs/img/data-model/chatItems/prompt.png +0 -0
  70. package/docs/img/data-model/chatItems/relatedContent-1.png +0 -0
  71. package/docs/img/data-model/chatItems/relatedContent-2.png +0 -0
  72. package/docs/img/data-model/chatItems/relatedContent-3.png +0 -0
  73. package/docs/img/data-model/chatItems/status.png +0 -0
  74. package/docs/img/data-model/chatItems/systemPrompt.png +0 -0
  75. package/docs/img/data-model/tabStore/contextCommands.png +0 -0
  76. package/docs/img/data-model/tabStore/loadingChat-1.png +0 -0
  77. package/docs/img/data-model/tabStore/loadingChat-2.png +0 -0
  78. package/docs/img/data-model/tabStore/promptInputDisabledState.png +0 -0
  79. package/docs/img/data-model/tabStore/promptInputPlaceholder.png +0 -0
  80. package/docs/img/data-model/tabStore/promptInputStickyCard.png +0 -0
  81. package/docs/img/data-model/tabStore/quickActionCommands.png +0 -0
  82. package/docs/img/data-model/tabStore/selectedCodeSnippet.png +0 -0
  83. package/docs/img/data-model/tabStore/stopChatResponse.png +0 -0
  84. package/docs/img/data-model/tabStore/tabBarButtons1.png +0 -0
  85. package/docs/img/data-model/tabStore/tabBarButtons2.png +0 -0
  86. package/docs/img/data-model/tabStore/tabTitle.png +0 -0
  87. package/docs/img/developer/comp0.png +0 -0
  88. package/docs/img/developer/comp1.png +0 -0
  89. package/docs/img/developer/comp2.png +0 -0
  90. package/docs/img/feedbackOptions.png +0 -0
  91. package/docs/img/maxTabs1.png +0 -0
  92. package/docs/img/noPrompt.png +0 -0
  93. package/docs/img/notification.png +0 -0
  94. package/docs/img/onBeforeTabRemove.png +0 -0
  95. package/docs/img/onBodyActionClicked.png +0 -0
  96. package/docs/img/onChatItemEngagement.png +0 -0
  97. package/docs/img/onChatPrompt.png +0 -0
  98. package/docs/img/onCodeInsertToCursorPosition.png +0 -0
  99. package/docs/img/onCopyCodeToClipboard.png +0 -0
  100. package/docs/img/onCustomFormAction.png +0 -0
  101. package/docs/img/onFileActionClick.png +0 -0
  102. package/docs/img/onFollowupClicked.png +0 -0
  103. package/docs/img/onInfoLinkClick.png +0 -0
  104. package/docs/img/onLinkClick.png +0 -0
  105. package/docs/img/onOpenDiff.png +0 -0
  106. package/docs/img/onSendFeedback-1.png +0 -0
  107. package/docs/img/onSendFeedback-2.png +0 -0
  108. package/docs/img/onSendFeedback-3.png +0 -0
  109. package/docs/img/onShowMoreClick.png +0 -0
  110. package/docs/img/onSourceLinkClick.png +0 -0
  111. package/docs/img/onStopChatResponse.png +0 -0
  112. package/docs/img/onTabAdd.png +0 -0
  113. package/docs/img/onTabChange.png +0 -0
  114. package/docs/img/onTabRemove.png +0 -0
  115. package/docs/img/onVote.png +0 -0
  116. package/docs/img/prompt-with-code-attached.png +0 -0
  117. package/docs/img/splash.gif +0 -0
  118. package/docs/img/texts/codeFileSuggestions.png +0 -0
  119. package/docs/img/texts/copyInsertToCursor.png +0 -0
  120. package/docs/img/texts/feedbackForm.png +0 -0
  121. package/docs/img/texts/fileTreeTitle.png +0 -0
  122. package/docs/img/texts/mainTitle.png +0 -0
  123. package/docs/img/texts/noMoreTabs.png +0 -0
  124. package/docs/img/texts/noTabsOpen.png +0 -0
  125. package/docs/img/texts/pleaseSelect.png +0 -0
  126. package/docs/img/texts/spinnerText.png +0 -0
  127. package/docs/img/texts/stopGenerating.png +0 -0
  128. package/docs/img/texts/tabCloseConfirmation.png +0 -0
  129. package/docs/img/texts/voteAndSourceActions.png +0 -0
  130. package/docs/img/theming-1.png +0 -0
  131. package/docs/img/theming-2.png +0 -0
  132. package/package.json +2 -2
  133. package/postinstall.js +4 -2
  134. package/dist/__test__/main.spec.d.ts +0 -1
  135. package/dist/components/__test__/button.spec.d.ts +0 -1
  136. package/dist/components/__test__/chat-item/chat-item-followup.spec.d.ts +0 -1
  137. package/dist/components/__test__/chat-item/chat-prompt-input.spec.d.ts +0 -1
  138. package/dist/components/__test__/feedback-form/feedback-form.spec.d.ts +0 -1
  139. package/dist/components/__test__/notification.spec.d.ts +0 -1
  140. package/dist/components/__test__/syntax-highlighter.spec.d.ts +0 -1
  141. package/dist/components/__test__/toggle.spec.d.ts +0 -1
  142. package/dist/helper/__test__/date-time.spec.d.ts +0 -1
  143. package/dist/helper/__test__/dom.spec.d.ts +0 -1
  144. package/dist/helper/__test__/events.spec.d.ts +0 -1
  145. package/dist/helper/__test__/file-tree.spec.d.ts +0 -1
@@ -4,10 +4,11 @@
4
4
  */
5
5
  import { ExtendedHTMLElement } from '../helper/dom';
6
6
  import { OverlayHorizontalDirection, OverlayVerticalDirection } from './overlay';
7
+ import '../styles/components/_button.scss';
7
8
  export interface ButtonProps {
8
9
  classNames?: string[];
9
10
  attributes?: Record<string, string>;
10
- icon?: HTMLElement | ExtendedHTMLElement | string;
11
+ icon?: HTMLElement | ExtendedHTMLElement;
11
12
  label?: HTMLElement | ExtendedHTMLElement | string;
12
13
  tooltip?: string;
13
14
  tooltipVerticalDirection?: OverlayVerticalDirection;
@@ -17,13 +18,14 @@ export interface ButtonProps {
17
18
  additionalEvents?: Record<string, (event?: any) => any>;
18
19
  onClick: (e: Event) => void;
19
20
  }
20
- export declare class Button {
21
+ export declare abstract class ButtonAbstract {
22
+ render: ExtendedHTMLElement;
23
+ updateLabel: (label: HTMLElement | ExtendedHTMLElement | string) => void;
24
+ setEnabled: (enabled: boolean) => void;
25
+ }
26
+ export declare class Button extends ButtonAbstract {
21
27
  render: ExtendedHTMLElement;
22
- private buttonTooltip;
23
- private buttonTooltipTimeout;
24
28
  constructor(props: ButtonProps);
25
- private readonly showButtonTooltip;
26
- readonly hideButtonTooltip: () => void;
27
29
  updateLabel: (label: HTMLElement | ExtendedHTMLElement | string) => void;
28
30
  setEnabled: (enabled: boolean) => void;
29
31
  }
@@ -3,7 +3,8 @@
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
  import { DomBuilderObject, ExtendedHTMLElement } from '../../helper/dom';
6
- import { OnCopiedToClipboardFunction, OnInsertToCursorPositionFunction, ReferenceTrackerInformation } from '../../static';
6
+ import { CodeBlockActions, OnCodeBlockActionFunction, OnCopiedToClipboardFunction, ReferenceTrackerInformation } from '../../static';
7
+ import '../../styles/components/card/_card.scss';
7
8
  export declare const highlightersWithTooltip: {
8
9
  start: {
9
10
  markupStart: string;
@@ -21,12 +22,14 @@ export interface CardBodyProps {
21
22
  children?: Array<ExtendedHTMLElement | HTMLElement | string | DomBuilderObject>;
22
23
  childLocation?: 'above-body' | 'below-body';
23
24
  highlightRangeWithTooltip?: ReferenceTrackerInformation[];
25
+ codeBlockActions?: CodeBlockActions;
24
26
  useParts?: boolean;
25
27
  codeBlockStartIndex?: number;
26
28
  processChildren?: boolean;
29
+ classNames?: string[];
27
30
  onLinkClick?: (url: string, e: MouseEvent) => void;
28
31
  onCopiedToClipboard?: OnCopiedToClipboardFunction;
29
- onInsertToCursorPosition?: OnInsertToCursorPositionFunction;
32
+ onCodeBlockAction?: OnCodeBlockActionFunction;
30
33
  }
31
34
  export declare class CardBody {
32
35
  render: ExtendedHTMLElement;
@@ -40,10 +43,5 @@ export declare class CardBody {
40
43
  private readonly getReferenceTrackerInformationFromElement;
41
44
  private readonly showHighlightRangeTooltip;
42
45
  private readonly hideHighlightRangeTooltip;
43
- /**
44
- * Returns extension additions
45
- * @returns marked options extensions
46
- */
47
- private readonly getMarkedExtensions;
48
46
  private readonly getContentBodyChildren;
49
47
  }
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import { DomBuilderObject, ExtendedHTMLElement } from '../../helper/dom';
6
6
  import { EngagementType } from '../../static';
7
+ import '../../styles/components/card/_card.scss';
7
8
  export interface CardProps extends Partial<DomBuilderObject> {
8
9
  border?: boolean;
9
10
  background?: boolean;
@@ -24,12 +25,12 @@ export interface CardProps extends Partial<DomBuilderObject> {
24
25
  }) => void;
25
26
  }
26
27
  export declare class Card {
28
+ render: ExtendedHTMLElement;
27
29
  private readonly props;
28
30
  private engagementStartTime;
29
31
  private totalMouseDistanceTraveled;
30
32
  private previousMousePosition;
31
33
  private mouseDownInfo;
32
- render: ExtendedHTMLElement;
33
34
  constructor(props: CardProps);
34
35
  private readonly resetEngagement;
35
36
  private readonly handleEngagement;
@@ -7,9 +7,9 @@ import { ChatItemButton } from '../../static';
7
7
  import { ChatItemFormItemsWrapper } from './chat-item-form-items';
8
8
  export interface ChatItemButtonsWrapperProps {
9
9
  tabId: string;
10
+ classNames?: string[];
10
11
  buttons: ChatItemButton[];
11
12
  formItems: ChatItemFormItemsWrapper | null;
12
- useButtonComponent?: boolean;
13
13
  onActionClick: (action: ChatItemButton, e?: Event) => void;
14
14
  }
15
15
  export declare class ChatItemButtonsWrapper {
@@ -0,0 +1,36 @@
1
+ /*!
2
+ * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import { DomBuilderObject, ExtendedHTMLElement } from '../../helper/dom';
6
+ import { CardRenderDetails, CodeBlockActions, OnCodeBlockActionFunction, OnCopiedToClipboardFunction, ReferenceTrackerInformation } from '../../static';
7
+ import { CardBody } from '../card/card-body';
8
+ export interface ChatItemCardContentProps {
9
+ body?: string;
10
+ renderAsStream?: boolean;
11
+ classNames?: string[];
12
+ codeReference?: ReferenceTrackerInformation[];
13
+ onAnimationStateChange?: (isAnimating: boolean) => void;
14
+ contentProperties?: {
15
+ codeBlockActions?: CodeBlockActions;
16
+ onLinkClick?: (url: string, e: MouseEvent) => void;
17
+ onCopiedToClipboard?: OnCopiedToClipboardFunction;
18
+ onCodeBlockAction?: OnCodeBlockActionFunction;
19
+ };
20
+ children?: Array<ExtendedHTMLElement | HTMLElement | string | DomBuilderObject>;
21
+ }
22
+ export declare class ChatItemCardContent {
23
+ private props;
24
+ render: ExtendedHTMLElement;
25
+ contentBody: CardBody | null;
26
+ private readonly updateStack;
27
+ private typewriterItemIndex;
28
+ private readonly typewriterId;
29
+ private lastAnimationDuration;
30
+ private updateTimer;
31
+ constructor(props: ChatItemCardContentProps);
32
+ private readonly getCardContent;
33
+ private readonly updateCard;
34
+ readonly updateCardStack: (updateWith: Partial<ChatItemCardContentProps>) => void;
35
+ readonly getRenderDetails: () => CardRenderDetails;
36
+ }
@@ -4,37 +4,39 @@
4
4
  */
5
5
  import { ExtendedHTMLElement } from '../../helper/dom';
6
6
  import { CardRenderDetails, ChatItem } from '../../static';
7
- import { CardBody } from '../card/card-body';
8
- import { ChatItemTreeViewWrapper } from './chat-item-tree-view-wrapper';
9
- import { ChatItemFormItemsWrapper } from './chat-item-form-items';
10
- import { ChatItemButtonsWrapper } from './chat-item-buttons';
11
7
  export interface ChatItemCardProps {
12
8
  tabId: string;
13
9
  chatItem: ChatItem;
10
+ inline?: boolean;
11
+ small?: boolean;
14
12
  }
15
13
  export declare class ChatItemCard {
16
14
  readonly props: ChatItemCardProps;
17
15
  render: ExtendedHTMLElement;
18
- contentBody: CardBody | null;
19
- chatAvatar: ExtendedHTMLElement;
20
- updateStack: Array<Partial<ChatItem>>;
21
- chatFormItems: ChatItemFormItemsWrapper | null;
22
- customRendererWrapper: CardBody | null;
23
- chatButtons: ChatItemButtonsWrapper | null;
24
- fileTreeWrapper: ChatItemTreeViewWrapper | null;
25
- typewriterItemIndex: number;
26
- previousTypewriterItemIndex: number;
27
- typewriterId: string;
28
- private updateTimer;
16
+ private readonly card;
17
+ private readonly updateStack;
18
+ private readonly initialSpinner;
19
+ private cardFooter;
20
+ private cardIcon;
21
+ private contentBody;
22
+ private chatAvatar;
23
+ private chatFormItems;
24
+ private customRendererWrapper;
25
+ private chatButtons;
26
+ private fileTreeWrapper;
27
+ private followUps;
28
+ private votes;
29
+ private footer;
29
30
  constructor(props: ChatItemCardProps);
31
+ private readonly getCardFooter;
30
32
  private readonly generateCard;
31
33
  private readonly getCardClasses;
32
- private readonly getCardContent;
34
+ private readonly updateCardContent;
33
35
  private readonly getChatAvatar;
34
- private readonly getInsertedTypewriterPartsCss;
35
- private readonly getInsertingTypewriterPartsCss;
36
+ private readonly canShowAvatar;
36
37
  private readonly checkCardSnap;
37
38
  readonly updateCard: () => void;
38
39
  readonly updateCardStack: (updateWith: Partial<ChatItem>) => void;
39
40
  readonly getRenderDetails: () => CardRenderDetails;
41
+ readonly cleanFollowupsAndRemoveIfEmpty: () => boolean;
40
42
  }
@@ -7,6 +7,7 @@ import { ChatItem } from '../../static';
7
7
  export interface ChatItemFormItemsWrapperProps {
8
8
  tabId: string;
9
9
  chatItem: Partial<ChatItem>;
10
+ classNames?: string[];
10
11
  }
11
12
  export declare class ChatItemFormItemsWrapper {
12
13
  private readonly props;
@@ -5,6 +5,7 @@
5
5
  import { ExtendedHTMLElement } from '../../helper/dom';
6
6
  export interface ChatItemRelevanceVoteProps {
7
7
  tabId: string;
8
+ classNames?: string[];
8
9
  messageId: string;
9
10
  }
10
11
  export declare class ChatItemRelevanceVote {
@@ -9,6 +9,7 @@ export interface ChatItemTreeViewWrapperProps {
9
9
  messageId: string;
10
10
  files: string[];
11
11
  cardTitle?: string;
12
+ classNames?: string[];
12
13
  rootTitle?: string;
13
14
  deletedFiles: string[];
14
15
  actions?: Record<string, FileNodeAction[]>;
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import { ExtendedHTMLElement } from '../../helper/dom';
6
6
  import { CardRenderDetails, ChatItem, PromptAttachmentType } from '../../static';
7
+ import '../../styles/components/chat/_chat-wrapper.scss';
7
8
  export declare const CONTAINER_GAP = 12;
8
9
  export interface ChatWrapperProps {
9
10
  onStopChatResponse?: (tabId: string) => void;
@@ -22,9 +23,11 @@ export declare class ChatWrapper {
22
23
  private allRenderedChatItems;
23
24
  render: ExtendedHTMLElement;
24
25
  constructor(props: ChatWrapperProps);
26
+ private readonly removeEmptyCardsAndFollowups;
25
27
  private readonly insertChatItem;
26
28
  private readonly checkLastAnswerStreamChange;
27
29
  updateLastChatAnswer: (updateWith: Partial<ChatItem>) => void;
30
+ getLastStreamingMessageId: () => string | null;
28
31
  getChatItem: (messageId: string) => {
29
32
  chatItem: ChatItem;
30
33
  render: ExtendedHTMLElement | HTMLElement;
@@ -2,6 +2,7 @@ import { ExtendedHTMLElement } from '../../../helper/dom';
2
2
  export interface PromptTextInputProps {
3
3
  tabId: string;
4
4
  initMaxLength: number;
5
+ contextReplacement?: boolean;
5
6
  onKeydown: (e: KeyboardEvent) => void;
6
7
  onInput?: (e: KeyboardEvent) => void;
7
8
  }
@@ -14,6 +15,7 @@ export declare class PromptTextInput {
14
15
  private keydownSupport;
15
16
  constructor(props: PromptTextInputProps);
16
17
  private readonly updatePromptTextInputSizer;
18
+ readonly setContextReplacement: (contextReplacement: boolean) => void;
17
19
  readonly getCursorPos: () => number;
18
20
  readonly getWordAndIndexOnCursorPos: () => {
19
21
  wordStartIndex: number;
@@ -1,11 +1,10 @@
1
1
  import { ExtendedHTMLElement } from '../../../helper/dom';
2
- export interface ISendButtonProps {
2
+ export interface SendButtonProps {
3
3
  tabId: string;
4
4
  onClick: () => void;
5
5
  }
6
6
  export declare class SendButton {
7
- private readonly _props;
8
- private readonly _render;
9
- constructor(props: ISendButtonProps);
10
- get render(): ExtendedHTMLElement;
7
+ render: ExtendedHTMLElement;
8
+ private readonly props;
9
+ constructor(props: SendButtonProps);
11
10
  }
@@ -3,6 +3,7 @@
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
  import { DomBuilderObject, ExtendedHTMLElement } from '../helper/dom';
6
+ import '../styles/components/_collapsible-content.scss';
6
7
  interface CollapsibleContentProps {
7
8
  title: string | ExtendedHTMLElement | HTMLElement | DomBuilderObject;
8
9
  children: Array<string | ExtendedHTMLElement | HTMLElement | DomBuilderObject>;
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import { FeedbackPayload } from '../../static';
6
6
  import { ExtendedHTMLElement } from '../../helper/dom';
7
+ import '../../styles/components/_feedback-form.scss';
7
8
  export interface FeedbackFormProps {
8
9
  initPayload?: FeedbackPayload;
9
10
  }
@@ -3,6 +3,7 @@
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
  import { ExtendedHTMLElement } from '../../helper/dom';
6
+ import '../../styles/components/_form-input.scss';
6
7
  interface SelectOption {
7
8
  value: string;
8
9
  label: string;
@@ -16,7 +17,13 @@ export interface RadioGroupProps {
16
17
  options?: SelectOption[];
17
18
  onChange?: (value: string) => void;
18
19
  }
19
- export declare class RadioGroup {
20
+ export declare abstract class RadioGroupAbstract {
21
+ render: ExtendedHTMLElement;
22
+ setValue: (value: string) => void;
23
+ getValue: () => string;
24
+ setEnabled: (enabled: boolean) => void;
25
+ }
26
+ export declare class RadioGroupInternal extends RadioGroupAbstract {
20
27
  private readonly radioGroupElement;
21
28
  private readonly groupName;
22
29
  render: ExtendedHTMLElement;
@@ -25,4 +32,11 @@ export declare class RadioGroup {
25
32
  getValue: () => string;
26
33
  setEnabled: (enabled: boolean) => void;
27
34
  }
35
+ export declare class RadioGroup extends RadioGroupAbstract {
36
+ render: ExtendedHTMLElement;
37
+ constructor(props: RadioGroupProps);
38
+ setValue: (value: string) => void;
39
+ getValue: () => string;
40
+ setEnabled: (enabled: boolean) => void;
41
+ }
28
42
  export {};
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import { ExtendedHTMLElement } from '../../helper/dom';
6
6
  import { MynahIcons } from '../icon';
7
+ import '../../styles/components/_form-input.scss';
7
8
  interface SelectOption {
8
9
  value: string;
9
10
  label: string;
@@ -16,9 +17,16 @@ export interface SelectProps {
16
17
  value?: string;
17
18
  optional?: boolean;
18
19
  options?: SelectOption[];
20
+ placeholder?: string;
19
21
  onChange?: (value: string) => void;
20
22
  }
21
- export declare class Select {
23
+ export declare abstract class SelectAbstract {
24
+ render: ExtendedHTMLElement;
25
+ setValue: (value: string) => void;
26
+ getValue: () => string;
27
+ setEnabled: (enabled: boolean) => void;
28
+ }
29
+ export declare class SelectInternal {
22
30
  private readonly selectElement;
23
31
  render: ExtendedHTMLElement;
24
32
  constructor(props: SelectProps);
@@ -26,4 +34,11 @@ export declare class Select {
26
34
  getValue: () => string;
27
35
  setEnabled: (enabled: boolean) => void;
28
36
  }
37
+ export declare class Select extends SelectAbstract {
38
+ render: ExtendedHTMLElement;
39
+ constructor(props: SelectProps);
40
+ setValue: (value: string) => void;
41
+ getValue: () => string;
42
+ setEnabled: (enabled: boolean) => void;
43
+ }
29
44
  export {};
@@ -3,6 +3,7 @@
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
  import { ExtendedHTMLElement } from '../../helper/dom';
6
+ import '../../styles/components/_form-input.scss';
6
7
  export type StarValues = 1 | 2 | 3 | 4 | 5;
7
8
  export interface StarsProps {
8
9
  classNames?: string[];
@@ -3,6 +3,7 @@
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
  import { ExtendedHTMLElement } from '../../helper/dom';
6
+ import '../../styles/components/_form-input.scss';
6
7
  export interface TextAreaProps {
7
8
  classNames?: string[];
8
9
  attributes?: Record<string, string>;
@@ -11,7 +12,13 @@ export interface TextAreaProps {
11
12
  value?: string;
12
13
  onChange?: (value: string) => void;
13
14
  }
14
- export declare class TextArea {
15
+ export declare abstract class TextAreaAbstract {
16
+ render: ExtendedHTMLElement;
17
+ setValue: (value: string) => void;
18
+ getValue: () => string;
19
+ setEnabled: (enabled: boolean) => void;
20
+ }
21
+ export declare class TextAreaInternal extends TextAreaAbstract {
15
22
  private readonly inputElement;
16
23
  render: ExtendedHTMLElement;
17
24
  constructor(props: TextAreaProps);
@@ -19,3 +26,10 @@ export declare class TextArea {
19
26
  getValue: () => string;
20
27
  setEnabled: (enabled: boolean) => void;
21
28
  }
29
+ export declare class TextArea extends TextAreaAbstract {
30
+ render: ExtendedHTMLElement;
31
+ constructor(props: TextAreaProps);
32
+ setValue: (value: string) => void;
33
+ getValue: () => string;
34
+ setEnabled: (enabled: boolean) => void;
35
+ }
@@ -3,16 +3,23 @@
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
  import { ExtendedHTMLElement } from '../../helper/dom';
6
+ import '../../styles/components/_form-input.scss';
6
7
  export interface TextInputProps {
7
8
  classNames?: string[];
8
9
  attributes?: Record<string, string>;
9
10
  label?: HTMLElement | ExtendedHTMLElement | string;
10
11
  placeholder?: string;
11
- numeric?: boolean;
12
+ type?: 'text' | 'number' | 'email';
12
13
  value?: string;
13
14
  onChange?: (value: string) => void;
14
15
  }
15
- export declare class TextInput {
16
+ export declare abstract class TextInputAbstract {
17
+ render: ExtendedHTMLElement;
18
+ setValue: (value: string) => void;
19
+ getValue: () => string;
20
+ setEnabled: (enabled: boolean) => void;
21
+ }
22
+ export declare class TextInputInternal extends TextInputAbstract {
16
23
  private readonly inputElement;
17
24
  render: ExtendedHTMLElement;
18
25
  constructor(props: TextInputProps);
@@ -20,3 +27,10 @@ export declare class TextInput {
20
27
  getValue: () => string;
21
28
  setEnabled: (enabled: boolean) => void;
22
29
  }
30
+ export declare class TextInput extends TextInputAbstract {
31
+ render: ExtendedHTMLElement;
32
+ constructor(props: TextInputProps);
33
+ setValue: (value: string) => void;
34
+ getValue: () => string;
35
+ setEnabled: (enabled: boolean) => void;
36
+ }
@@ -3,8 +3,9 @@
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
  import { ExtendedHTMLElement } from '../helper/dom';
6
+ import '../styles/components/_icon.scss';
6
7
  export declare enum MynahIcons {
7
- MYNAH = "mynah",
8
+ Q = "q",
8
9
  MENU = "menu",
9
10
  MINUS = "minus",
10
11
  SEARCH = "search",
@@ -14,6 +15,8 @@ export declare enum MynahIcons {
14
15
  TABS = "tabs",
15
16
  CHAT = "chat",
16
17
  LINK = "link",
18
+ FOLDER = "folder",
19
+ FILE = "file",
17
20
  DOC = "doc",
18
21
  EXTERNAL = "external",
19
22
  CANCEL = "cancel",
@@ -21,6 +24,7 @@ export declare enum MynahIcons {
21
24
  CALENDAR = "calendar",
22
25
  COMMENT = "comment",
23
26
  MEGAPHONE = "megaphone",
27
+ MAGIC = "magic",
24
28
  NOTIFICATION = "notification",
25
29
  EYE = "eye",
26
30
  ELLIPSIS = "ellipsis",
@@ -3,6 +3,7 @@
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
  import { ExtendedHTMLElement } from '../helper/dom';
6
+ import '../styles/components/_nav-tabs.scss';
6
7
  export interface TabsProps {
7
8
  onChange?: (selectedTabId: string) => void;
8
9
  onBeforeTabRemove?: (tabId: string) => boolean;
@@ -3,6 +3,7 @@
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
  import { ExtendedHTMLElement } from '../helper/dom';
6
+ import '../styles/components/_no-tabs.scss';
6
7
  export declare class NoTabs {
7
8
  render: ExtendedHTMLElement;
8
9
  constructor();
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import { DomBuilderObject, ExtendedHTMLElement } from '../helper/dom';
6
6
  import { NotificationType } from '../static';
7
+ import '../styles/components/_notification.scss';
7
8
  type NotificationContentType = string | ExtendedHTMLElement | HTMLElement | DomBuilderObject;
8
9
  export interface NotificationProps {
9
10
  duration?: number;
@@ -3,6 +3,7 @@
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
  import { DomBuilderObject, ExtendedHTMLElement } from '../helper/dom';
6
+ import '../styles/components/_overlay.scss';
6
7
  export declare const OVERLAY_MARGIN = 8;
7
8
  /**
8
9
  * The horizontal creation direction of the overlay
@@ -29,7 +29,8 @@ import 'prismjs/components/prism-less.min';
29
29
  import 'prismjs/plugins/line-numbers/prism-line-numbers.js';
30
30
  import 'prismjs/plugins/keep-markup/prism-keep-markup.js';
31
31
  import 'prismjs/plugins/diff-highlight/prism-diff-highlight.min';
32
- import { CodeSelectionType } from '../static';
32
+ import { CodeBlockActions, CodeSelectionType, OnCodeBlockActionFunction } from '../static';
33
+ import '../styles/components/_syntax-highlighter.scss';
33
34
  export declare const highlighters: {
34
35
  start: {
35
36
  markup: string;
@@ -57,16 +58,17 @@ export interface SyntaxHighlighterProps {
57
58
  showLineNumbers?: boolean;
58
59
  block?: boolean;
59
60
  startingLineNumber?: number;
60
- showCopyOptions?: boolean;
61
61
  index?: number;
62
+ codeBlockActions?: CodeBlockActions;
62
63
  onCopiedToClipboard?: (type?: CodeSelectionType, text?: string, codeBlockIndex?: number) => void;
63
- onInsertToCursorPosition?: (type?: CodeSelectionType, text?: string, codeBlockIndex?: number) => void;
64
+ onCodeBlockAction?: OnCodeBlockActionFunction;
64
65
  }
65
66
  export declare class SyntaxHighlighter {
66
67
  private readonly props?;
68
+ private readonly codeBlockButtons;
67
69
  render: ExtendedHTMLElement;
68
70
  constructor(props: SyntaxHighlighterProps);
69
71
  private readonly getSelectedCodeContextMenu;
70
72
  private readonly getSelectedCode;
71
- private readonly copyToClipboard;
73
+ private readonly onCopiedToClipboard;
72
74
  }
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import { ExtendedHTMLElement } from '../helper/dom';
6
6
  import { MynahIcons } from './icon';
7
+ import '../styles/components/_toggle.scss';
7
8
  export interface ToggleOption {
8
9
  label?: ExtendedHTMLElement | string | HTMLElement;
9
10
  icon?: MynahIcons;
@@ -1,2 +1,3 @@
1
1
  import { ChatItem } from '../static';
2
2
  export declare const chatItemHasContent: (chatItem: Partial<ChatItem>) => boolean;
3
+ export declare const copyToClipboard: (textToSendClipboard: string, onCopied?: () => void) => Promise<void>;
@@ -2,9 +2,10 @@
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, ConfigOptions, ConfigTexts } from '../static';
5
+ import { ComponentOverrides, ConfigModel, ConfigOptions, ConfigTexts } from '../static';
6
6
  interface ConfigFullModel extends ConfigOptions {
7
7
  texts: ConfigTexts;
8
+ componentClasses: ComponentOverrides;
8
9
  }
9
10
  export declare class Config {
10
11
  private static instance;
@@ -51,6 +51,7 @@ export declare class DomBuilder {
51
51
  private portals;
52
52
  private constructor();
53
53
  static getInstance(rootSelector?: string): DomBuilder;
54
+ setRoot: (rootSelector?: string) => void;
54
55
  addClass: (this: ExtendedHTMLElement, className: string) => ExtendedHTMLElement;
55
56
  removeClass: (this: ExtendedHTMLElement, className: string) => ExtendedHTMLElement;
56
57
  toggleClass: (this: ExtendedHTMLElement, className: string) => ExtendedHTMLElement;
@@ -66,4 +67,5 @@ export declare class DomBuilder {
66
67
  removeAllPortals: (portalsWithName: MynahPortalNames) => void;
67
68
  }
68
69
  export declare const htmlDecode: (input: string) => string;
70
+ export declare const getTypewriterPartsCss: (typewriterId: string, lastVisibleItemIndex: number, totalNumberOfItems: number, timeForEach: number) => ExtendedHTMLElement;
69
71
  export {};
package/dist/main.d.ts CHANGED
@@ -4,11 +4,19 @@
4
4
  */
5
5
  import { RelevancyVoteType, FeedbackPayload, MynahUIDataModel, NotificationType, ChatItem, ChatItemAction, ChatPrompt, MynahUITabStoreModel, MynahUITabStoreTab, ConfigModel, ReferenceTrackerInformation, CodeSelectionType, Engagement, ChatItemFormItem, ChatItemButton, CardRenderDetails, PromptAttachmentType } from './static';
6
6
  import './styles/styles.scss';
7
+ export { generateUID } from './helper/guid';
7
8
  export { ChatItemBodyRenderer, } from './helper/dom';
8
9
  export { AllowedAttributesInCustomRenderer, AllowedTagsInCustomRenderer } from './helper/sanitize';
9
- export { FeedbackPayload, RelevancyVoteType, EngagementType, Engagement, MynahUIDataModel, NotificationType, ChatItem, ChatItemAction, ChatItemType, ChatPrompt, SourceLink, } from './static';
10
+ export * from './static';
10
11
  export { ToggleOption } from './components/toggle';
11
12
  export { MynahIcons } from './components/icon';
13
+ export { DomBuilder, DomBuilderObject, ExtendedHTMLElement, } from './helper/dom';
14
+ export { ButtonProps, ButtonAbstract } from './components/button';
15
+ export { RadioGroupProps, RadioGroupAbstract } from './components/form-items/radio-group';
16
+ export { SelectProps, SelectAbstract } from './components/form-items/select';
17
+ export { TextInputProps, TextInputAbstract } from './components/form-items/text-input';
18
+ export { TextAreaProps, TextAreaAbstract } from './components/form-items/text-area';
19
+ export { ChatItemCardContent, ChatItemCardContentProps } from './components/chat-item/chat-item-card-content';
12
20
  export interface MynahUIProps {
13
21
  rootSelector?: string;
14
22
  defaults?: MynahUITabStoreTab;
@@ -35,8 +43,15 @@ export interface MynahUIProps {
35
43
  */
36
44
  onBeforeTabRemove?: (tabId: string, eventId?: string) => boolean;
37
45
  onChatItemEngagement?: (tabId: string, messageId: string, engagement: Engagement) => void;
38
- onCopyCodeToClipboard?: (tabId: string, messageId: string, code?: string, type?: CodeSelectionType, referenceTrackerInformation?: ReferenceTrackerInformation[], eventId?: string, codeBlockIndex?: number, totalCodeBlocks?: number) => void;
39
- onCodeInsertToCursorPosition?: (tabId: string, messageId: string, code?: string, type?: CodeSelectionType, referenceTrackerInformation?: ReferenceTrackerInformation[], eventId?: string, codeBlockIndex?: number, totalCodeBlocks?: number) => void;
46
+ onCodeBlockActionClicked?: (tabId: string, messageId: string, actionId: string, data?: string, code?: string, type?: CodeSelectionType, referenceTrackerInformation?: ReferenceTrackerInformation[], eventId?: string, codeBlockIndex?: number, totalCodeBlocks?: number) => void;
47
+ /**
48
+ * @deprecated since version 4.14.0. It will be only used for keyboard, context menu copy actions, not for button actions after version 5.x.x. Use {@link onCodeBlockActionClicked} instead
49
+ */
50
+ onCopyCodeToClipboard?: (tabId: string, messageId: string, code?: string, type?: CodeSelectionType, referenceTrackerInformation?: ReferenceTrackerInformation[], eventId?: string, codeBlockIndex?: number, totalCodeBlocks?: number, data?: any) => void;
51
+ /**
52
+ * @deprecated since version 4.14.0. Will be dropped after version 5.x.x. Use {@link onCodeBlockActionClicked} instead
53
+ */
54
+ onCodeInsertToCursorPosition?: (tabId: string, messageId: string, code?: string, type?: CodeSelectionType, referenceTrackerInformation?: ReferenceTrackerInformation[], eventId?: string, codeBlockIndex?: number, totalCodeBlocks?: number, data?: any) => void;
40
55
  onSourceLinkClick?: (tabId: string, messageId: string, link: string, mouseEvent?: MouseEvent, eventId?: string) => void;
41
56
  onLinkClick?: (tabId: string, messageId: string, link: string, mouseEvent?: MouseEvent, eventId?: string) => void;
42
57
  onInfoLinkClick?: (tabId: string, link: string, mouseEvent?: MouseEvent, eventId?: string) => void;
@@ -70,7 +85,7 @@ export declare class MynahUI {
70
85
  /**
71
86
  * Adds a new item to the chat window
72
87
  * @param tabId Corresponding tab ID.
73
- * @param answer An ChatItem object.
88
+ * @param answer ChatItem object.
74
89
  */
75
90
  addChatItem: (tabId: string, chatItem: ChatItem) => void;
76
91
  /**