@aws/mynah-ui 2.0.0-beta.1 → 2.0.0-beta.10.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 (55) hide show
  1. package/DEVELOPMENT.md +24 -0
  2. package/README.md +1 -1
  3. package/dist/components/chat-item/chat-item-card.d.ts +3 -3
  4. package/dist/components/chat-item/chat-item-followup.d.ts +2 -1
  5. package/dist/components/chat-item/chat-item-relevance-vote.d.ts +17 -0
  6. package/dist/components/{suggestion-card/suggestion-card-context-wrapper.d.ts → chat-item/chat-item-tree-view-wrapper.d.ts} +6 -4
  7. package/dist/components/chat-item/chat-item-tree-view.d.ts +22 -0
  8. package/dist/components/chat-item/chat-prompt-input.d.ts +12 -10
  9. package/dist/components/chat-item/chat-wrapper.d.ts +10 -9
  10. package/dist/components/feedback-form/feedback-form-comment.d.ts +2 -2
  11. package/dist/components/feedback-form/feedback-form.d.ts +5 -2
  12. package/dist/components/icon/icon-importer.d.ts +9 -0
  13. package/dist/components/icon.d.ts +6 -3
  14. package/dist/components/navigation-tabs.d.ts +7 -6
  15. package/dist/components/notification/notification.d.ts +0 -4
  16. package/dist/components/overlay/overlay.d.ts +4 -37
  17. package/dist/components/suggestion-card/suggestion-card-body.d.ts +2 -1
  18. package/dist/components/suggestion-card/suggestion-card-header.d.ts +2 -2
  19. package/dist/components/suggestion-card/suggestion-card.d.ts +1 -1
  20. package/dist/components/syntax-highlighter.d.ts +21 -3
  21. package/dist/components/toggle.d.ts +7 -5
  22. package/dist/helper/config.d.ts +6 -5
  23. package/dist/helper/date-time.d.ts +2 -2
  24. package/dist/helper/dom.d.ts +2 -0
  25. package/dist/helper/events.d.ts +0 -15
  26. package/dist/helper/file-tree.d.ts +16 -0
  27. package/dist/helper/store.d.ts +2 -38
  28. package/dist/helper/tabs-store.d.ts +40 -0
  29. package/dist/main.d.ts +30 -70
  30. package/dist/main.js +1 -1
  31. package/dist/main.js.LICENSE.txt +5 -0
  32. package/dist/main.js.map +1 -1
  33. package/dist/static.d.ts +78 -233
  34. package/package.json +12 -8
  35. package/dist/components/context-item.d.ts +0 -16
  36. package/dist/components/feedback-form/feedback-form-stars.d.ts +0 -15
  37. package/dist/components/main-container.d.ts +0 -20
  38. package/dist/components/navigation-tabs-vertical.d.ts +0 -13
  39. package/dist/components/prioritization-menu.d.ts +0 -18
  40. package/dist/components/query-text-short-view.d.ts +0 -10
  41. package/dist/components/search-block/autocomplete-card.d.ts +0 -20
  42. package/dist/components/search-block/autocomplete-content.d.ts +0 -32
  43. package/dist/components/search-block/search-api-help.d.ts +0 -14
  44. package/dist/components/search-block/search-card-header.d.ts +0 -11
  45. package/dist/components/search-block/search-card.d.ts +0 -19
  46. package/dist/components/search-block/search-context.d.ts +0 -30
  47. package/dist/components/search-block/search-history-card.d.ts +0 -16
  48. package/dist/components/search-block/search-history-content.d.ts +0 -19
  49. package/dist/components/search-block/search-input.d.ts +0 -22
  50. package/dist/components/search-block/search-live-toggle.d.ts +0 -15
  51. package/dist/components/suggestion-card/suggestion-card-relevance-vote.d.ts +0 -14
  52. package/dist/helper/find-language.d.ts +0 -17
  53. package/dist/helper/payload-transformer.d.ts +0 -13
  54. package/dist/translations/en.d.ts +0 -13
  55. package/dist/translations/i18n.d.ts +0 -17
package/DEVELOPMENT.md ADDED
@@ -0,0 +1,24 @@
1
+ # Mynah UI
2
+ This package is the whole UI of AWS Codewhisperer Chat extension UI for Web, VSCode and Intellij IDEs written in typescript without any framework or third-party UI library dependency. Purpose of the separated UI is to handle the interactions and look & feel of the UI from one single source.
3
+
4
+ ## How to release
5
+ ### Production
6
+ You need to create a new release from your desired branch with a tag which should follow the naming `v*.*` to release a production version to npm. The tag you're creating shouldn't be existed before.
7
+
8
+ ### Beta releases
9
+ If you need to release a beta version first you need to specify the version name inside `package.json` which should follow the versioning `2.0.0-beta.1`
10
+ After that you need to create a new release from your desired branch with a tag which should follow the naming `beta*.*` to release a beta version to npm. The tag you're creating shouldn't be existed before.
11
+
12
+ ``` console
13
+ please see publish.yml and beta.yml for releasing details.
14
+ ```
15
+
16
+
17
+ ## Security
18
+
19
+ See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.
20
+
21
+ ## License
22
+
23
+ This project is licensed under the Apache-2.0 License.
24
+
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Mynah UI
2
2
 
3
- This package is the whole UI of AWS Tookit Mynah extension UI for VSCode and Intellij IDEs written in typescript without any framework or third-party UI library dependency. Purpose of the separated UI is to handle the interactions and look & feel of the UI from one single source.
3
+ This package is the whole UI of AWS Codewhisperer Chat extension UI for Web, VSCode and Intellij IDEs written in typescript without any framework or third-party UI library dependency. Purpose of the separated UI is to handle the interactions and look & feel of the UI from one single source.
4
4
 
5
5
  ## How to install
6
6
 
@@ -6,11 +6,11 @@ import { ExtendedHTMLElement } from '../../helper/dom';
6
6
  import { ChatItem } from '../../static';
7
7
  import { SuggestionCardBody } from '../suggestion-card/suggestion-card-body';
8
8
  export interface ChatItemCardProps {
9
+ tabId: string;
9
10
  chatItem: ChatItem;
10
- onShowAllWebResultsClick?: () => void;
11
11
  }
12
12
  export declare class ChatItemCard {
13
- private readonly chatItem;
13
+ private readonly props;
14
14
  private readonly relatedContentWrapper;
15
15
  private readonly referencesWrapper;
16
16
  private readonly showMoreButtonBlock;
@@ -24,5 +24,5 @@ export declare class ChatItemCard {
24
24
  private readonly showLinkPreview;
25
25
  private readonly hideLinkPreview;
26
26
  private readonly getChatAvatar;
27
- readonly updateAnswerBody: (body: string) => void;
27
+ readonly updateAnswerBody: (body: ExtendedHTMLElement | HTMLElement | string) => void;
28
28
  }
@@ -5,10 +5,11 @@
5
5
  import { ExtendedHTMLElement } from '../../helper/dom';
6
6
  import { ChatItem } from '../../static';
7
7
  export interface ChatItemFollowUpProps {
8
+ tabId: string;
8
9
  chatItem: ChatItem;
9
10
  }
10
11
  export declare class ChatItemFollowUpContainer {
11
- private readonly chatItem;
12
+ private readonly props;
12
13
  render: ExtendedHTMLElement;
13
14
  constructor(props: ChatItemFollowUpProps);
14
15
  }
@@ -0,0 +1,17 @@
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 ChatItemRelevanceVoteProps {
7
+ tabId: string;
8
+ messageId: string;
9
+ }
10
+ export declare class ChatItemRelevanceVote {
11
+ private readonly votingId;
12
+ private sendFeedbackListenerId;
13
+ render: ExtendedHTMLElement;
14
+ props: ChatItemRelevanceVoteProps;
15
+ constructor(props: ChatItemRelevanceVoteProps);
16
+ private readonly handleVoteChange;
17
+ }
@@ -3,10 +3,12 @@
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
  import { ExtendedHTMLElement } from '../../helper/dom';
6
- export interface SuggestionCardContextWrapperProps {
7
- contextList: string[];
6
+ export interface ChatItemTreeViewWrapperProps {
7
+ tabId: string;
8
+ messageId: string;
9
+ files: string[];
8
10
  }
9
- export declare class SuggestionCardContextWrapper {
11
+ export declare class ChatItemTreeViewWrapper {
10
12
  render: ExtendedHTMLElement;
11
- constructor(props: SuggestionCardContextWrapperProps);
13
+ constructor(props: ChatItemTreeViewWrapperProps);
12
14
  }
@@ -0,0 +1,22 @@
1
+ import { ExtendedHTMLElement } from '../../helper/dom';
2
+ import { TreeNode } from '../../helper/file-tree';
3
+ export interface ChatItemTreeViewProps {
4
+ node: TreeNode;
5
+ depth?: number;
6
+ tabId: string;
7
+ messageId: string;
8
+ }
9
+ export declare class ChatItemTreeView {
10
+ private readonly node;
11
+ private isOpen;
12
+ private readonly depth;
13
+ private readonly tabId;
14
+ private readonly messageId;
15
+ render: ExtendedHTMLElement;
16
+ constructor(props: ChatItemTreeViewProps);
17
+ getClassNames(): string[];
18
+ updateTree(): void;
19
+ buildFolderChildren(): ExtendedHTMLElement[];
20
+ buildFolderNode(): ExtendedHTMLElement[];
21
+ buildFileNode(): ExtendedHTMLElement[];
22
+ }
@@ -3,25 +3,27 @@
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
  import { ExtendedHTMLElement } from '../../helper/dom';
6
- export interface CharPromptInputProps {
7
- onStopChatResponse?: () => void;
8
- showFeedbackButton?: boolean;
6
+ export interface ChatPromptInputProps {
7
+ tabId: string;
9
8
  }
10
9
  export declare class ChatPromptInput {
11
10
  render: ExtendedHTMLElement;
11
+ private readonly props;
12
12
  private readonly attachmentWrapper;
13
13
  private readonly promptTextInputWrapper;
14
14
  private readonly promptTextInput;
15
15
  private readonly promptTextInputSizer;
16
- private sendButton;
17
- private readonly clearButton;
18
- private readonly loading;
19
- private readonly onStopChatResponse;
16
+ private readonly sendButton;
17
+ private quickActionCommands;
18
+ private commandSelector;
19
+ private commandSelectorOpen;
20
+ private inputDisabled;
20
21
  private attachment?;
21
- constructor(props?: CharPromptInputProps);
22
- private readonly getButton;
22
+ private filteredCommandsList;
23
+ constructor(props: ChatPromptInputProps);
23
24
  private readonly handleInputKeydown;
25
+ private readonly getQuickCommandActions;
24
26
  private readonly calculateTextAreaHeight;
25
27
  private readonly resetTextAreaHeight;
26
- private readonly triggerSearch;
28
+ private readonly sendPrompt;
27
29
  }
@@ -3,21 +3,22 @@
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
  import { ExtendedHTMLElement } from '../../helper/dom';
6
+ import { Suggestion } from '../../static';
6
7
  export interface ChatWrapperProps {
7
- onStopChatResponse?: () => void;
8
- onShowAllWebResultsClick?: () => void;
9
- showFeedbackButton?: boolean;
8
+ onStopChatResponse?: (tabId: string) => void;
9
+ tabId: string;
10
10
  }
11
11
  export declare class ChatWrapper {
12
- private readonly props?;
12
+ private readonly props;
13
13
  private readonly chatItemsContainer;
14
- private readonly spinner;
14
+ private readonly intermediateBlockContainer;
15
15
  private readonly promptInput;
16
16
  private lastChatItemCard;
17
- private containerScollState;
18
17
  render: ExtendedHTMLElement;
19
- constructor(props?: ChatWrapperProps);
18
+ constructor(props: ChatWrapperProps);
20
19
  private readonly insertChatItem;
21
- private readonly scrollToStreamingCardBottom;
22
- removeAllExceptAnswersAndPrompts: () => void;
20
+ updateLastCharAnswerStream: (updateWith: string | {
21
+ title: string | boolean;
22
+ suggestions: Suggestion[];
23
+ }) => void;
23
24
  }
@@ -10,6 +10,6 @@ export interface FeedbackFormCommentProps {
10
10
  export declare class FeedbackFormComment {
11
11
  render: ExtendedHTMLElement;
12
12
  constructor(props: FeedbackFormCommentProps);
13
- setEnabled: (enabled: boolean) => void;
14
- setComment: (comment: string) => void;
13
+ getComment: () => string;
14
+ clear: () => void;
15
15
  }
@@ -9,11 +9,14 @@ export interface FeedbackFormProps {
9
9
  }
10
10
  export declare class FeedbackForm {
11
11
  private feedbackFormWrapper;
12
- private readonly feedbackStars;
12
+ private readonly feedbackSelect;
13
+ private readonly feedbackOptionsWrapper;
13
14
  private readonly feedbackComment;
14
- private feedbackPayload;
15
15
  private readonly feedbackSubmitButton;
16
+ private feedbackPayload;
16
17
  readonly feedbackFormContainer: ExtendedHTMLElement;
17
18
  constructor(props?: FeedbackFormProps);
18
19
  private readonly onFeedbackSet;
20
+ close: () => void;
21
+ show: () => void;
19
22
  }
@@ -0,0 +1,9 @@
1
+ /*!
2
+ * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ export declare class MynahUIIconImporter {
6
+ private static instance;
7
+ private constructor();
8
+ static getInstance: () => MynahUIIconImporter;
9
+ }
@@ -11,14 +11,15 @@ export declare enum MynahIcons {
11
11
  PLUS = "plus",
12
12
  CHAT = "chat",
13
13
  LINK = "link",
14
+ DOC = "doc",
14
15
  EXTERNAL = "external",
15
16
  CANCEL = "cancel",
16
17
  CALENDAR = "calendar",
17
18
  MEGAPHONE = "megaphone",
19
+ NOTIFICATION = "notification",
18
20
  EYE = "eye",
19
21
  ELLIPSIS = "ellipsis",
20
22
  OK = "ok",
21
- UP_CIRCLED = "up-circled",
22
23
  UP_OPEN = "up-open",
23
24
  DOWN_OPEN = "down-open",
24
25
  RIGHT_OPEN = "right-open",
@@ -35,13 +36,15 @@ export declare enum MynahIcons {
35
36
  STAR = "star",
36
37
  LIGHT_BULB = "light-bulb",
37
38
  ENVELOPE_SEND = "envelope-send",
38
- SEARCH_HISTORY = "search-history",
39
+ REFRESH = "refresh",
39
40
  USER = "user",
40
41
  PLAY = "play",
41
42
  PAUSE = "pause",
42
43
  CODE_BLOCK = "code-block",
43
44
  COPY = "copy",
44
- TEXT_SELECT = "text-select"
45
+ CURSOR_INSERT = "cursor-insert",
46
+ TEXT_SELECT = "text-select",
47
+ REVERT = "revert"
45
48
  }
46
49
  export interface IconProps {
47
50
  icon: MynahIcons;
@@ -3,14 +3,15 @@
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
  import { ExtendedHTMLElement } from '../helper/dom';
6
- export declare const getSelectedTabValueFromStore: () => string;
7
- export interface NavivationTabsProps {
8
- onChange?: (selectedValue: string) => void;
6
+ export interface TabsProps {
7
+ onChange?: (selectedTabId: string) => void;
9
8
  }
10
- export declare class NavivationTabs {
9
+ export declare class Tabs {
11
10
  render: ExtendedHTMLElement;
11
+ private tabIdSubscriptions;
12
+ private toggleGroup;
12
13
  private readonly props;
13
- constructor(props: NavivationTabsProps);
14
- private readonly setLoading;
14
+ constructor(props: TabsProps);
15
+ private readonly getTabOptionsFromTabStoreData;
15
16
  private readonly getTabsRender;
16
17
  }
@@ -20,10 +20,6 @@ export declare class Notification {
20
20
  private readonly props;
21
21
  constructor(props: NotificationProps);
22
22
  notify(): void;
23
- /**
24
- * Calculates the top according to the previously shown and still visible notifications
25
- * @returns number
26
- */
27
23
  private readonly getNextCalculatedTop;
28
24
  private readonly getChildren;
29
25
  }
@@ -4,58 +4,22 @@
4
4
  */
5
5
  import { DomBuilderObject, ExtendedHTMLElement } from '../../helper/dom';
6
6
  export declare const OVERLAY_MARGIN = 8;
7
- /**
8
- * The horizontal creation direction of the overlay
9
- */
10
7
  export declare enum OverlayHorizontalDirection {
11
- /**
12
- * starts from the left edge of the reference element and opens to left
13
- */
14
8
  TO_LEFT = "horizontal-direction-to-left",
15
- /**
16
- * starts from the right edge of the reference element and opens to left
17
- */
18
9
  END_TO_LEFT = "horizontal-direction-from-end-to-left",
19
- /**
20
- * starts from the right edge of the reference element and opens to right
21
- */
22
10
  TO_RIGHT = "horizontal-direction-to-right",
23
- /**
24
- * starts from the left edge of the reference element and opens to right
25
- */
26
11
  START_TO_RIGHT = "horizontal-direction-from-start-to-right",
27
- /**
28
- * starts and opens at the center of the reference element
29
- */
30
12
  CENTER = "horizontal-direction-at-center"
31
13
  }
32
- /**
33
- * The vertical creation direction of the overlay
34
- */
35
14
  export declare enum OverlayVerticalDirection {
36
- /**
37
- * starts from the bottom edge of the reference element and opens to bottom
38
- */
39
15
  TO_BOTTOM = "vertical-direction-to-bottom",
40
- /**
41
- * starts from the top edge of the reference element and opens to bottom
42
- */
43
16
  START_TO_BOTTOM = "vertical-direction-from-start-to-bottom",
44
- /**
45
- * starts from the top edge of the reference element and opens to top
46
- */
47
17
  TO_TOP = "vertical-direction-to-top",
48
- /**
49
- * starts from the bottom edge of the reference element and opens to top
50
- */
51
18
  END_TO_TOP = "vertical-direction-from-end-to-top",
52
- /**
53
- * starts and opens at the center of the reference element
54
- */
55
19
  CENTER = "vertical-direction-at-center"
56
20
  }
57
21
  export interface OverlayProps {
58
- referenceElement?: Element | ExtendedHTMLElement;
22
+ referenceElement?: HTMLElement | ExtendedHTMLElement;
59
23
  referencePoint?: {
60
24
  top: number;
61
25
  left: number;
@@ -63,10 +27,12 @@ export interface OverlayProps {
63
27
  children: Array<HTMLElement | ExtendedHTMLElement | DomBuilderObject>;
64
28
  horizontalDirection?: OverlayHorizontalDirection;
65
29
  verticalDirection?: OverlayVerticalDirection;
30
+ stretchWidth?: boolean;
66
31
  dimOutside?: boolean;
67
32
  closeOnOutsideClick?: boolean;
68
33
  background?: boolean;
69
34
  onClose?: () => void;
35
+ removeOtherOverlays?: boolean;
70
36
  }
71
37
  export declare class Overlay {
72
38
  render: ExtendedHTMLElement;
@@ -78,6 +44,7 @@ export declare class Overlay {
78
44
  close: () => void;
79
45
  private readonly windowBlurHandler;
80
46
  private readonly getCalculatedLeft;
47
+ private readonly getCalculatedWidth;
81
48
  private readonly getCalculatedTop;
82
49
  updateContent: (children: Array<string | DomBuilderObject | HTMLElement | ExtendedHTMLElement>) => void;
83
50
  }
@@ -13,10 +13,11 @@ export interface SuggestionCardBodyProps {
13
13
  export declare class SuggestionCardBody {
14
14
  render: ExtendedHTMLElement;
15
15
  cardBody: ExtendedHTMLElement;
16
- matchingLanguage: string;
17
16
  props: SuggestionCardBodyProps;
17
+ private readonly syntaxHighlighterHighlightWithTooltipRangeItems;
18
18
  constructor(props: SuggestionCardBodyProps);
19
19
  private readonly processNode;
20
20
  private readonly getCardBodyChildren;
21
21
  readonly updateCardBody: (body: string) => void;
22
+ readonly addToCardBody: (elementToAdd: ExtendedHTMLElement | HTMLElement | string) => void;
22
23
  }
@@ -3,11 +3,11 @@
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
  import { ExtendedHTMLElement } from '../../helper/dom';
6
- import { SuggestionMetaDataUnion } from '../../static';
6
+ import { SuggestionMetaData } from '../../static';
7
7
  export interface SuggestionCardHeaderProps {
8
8
  title: string;
9
9
  url: string;
10
- metadata?: SuggestionMetaDataUnion;
10
+ metadata?: Record<string, SuggestionMetaData>;
11
11
  onSuggestionTitleClick?: (e?: MouseEvent) => void;
12
12
  onSuggestionLinkCopy?: () => void;
13
13
  }
@@ -6,7 +6,7 @@ import { ExtendedHTMLElement } from '../../helper/dom';
6
6
  import { Suggestion } from '../../static';
7
7
  export interface SuggestionCardProps {
8
8
  suggestion: Suggestion;
9
- compact?: 'withBody' | true;
9
+ compact?: 'flat' | true;
10
10
  showFooterButtons?: boolean;
11
11
  }
12
12
  export declare class SuggestionCard {
@@ -9,7 +9,7 @@ import 'prismjs/components/prism-java';
9
9
  import 'prismjs/components/prism-javascript';
10
10
  import 'prismjs/components/prism-json';
11
11
  import 'prismjs/plugins/line-numbers/prism-line-numbers.js';
12
- import { OnCopiedToClipboardFunction, SupportedCodingLanguagesType } from '../static';
12
+ import { OnCopiedToClipboardFunction, OnInsertToCursorPositionFunction, ReferenceTrackerInformation } from '../static';
13
13
  export declare const highlighters: {
14
14
  start: {
15
15
  markup: string;
@@ -20,6 +20,16 @@ export declare const highlighters: {
20
20
  textReplacement: string;
21
21
  };
22
22
  };
23
+ export declare const highlightersWithTooltip: {
24
+ start: {
25
+ markup: string;
26
+ textReplacement: string;
27
+ };
28
+ end: {
29
+ markup: string;
30
+ textReplacement: string;
31
+ };
32
+ };
23
33
  export declare const ellipsis: {
24
34
  start: {
25
35
  markup: string;
@@ -32,18 +42,26 @@ export declare const ellipsis: {
32
42
  };
33
43
  export interface SyntaxHighlighterProps {
34
44
  codeStringWithMarkup: string;
35
- language?: SupportedCodingLanguagesType;
45
+ language?: string;
36
46
  keepHighlights?: boolean;
37
47
  showLineNumbers?: boolean;
38
48
  block?: boolean;
39
49
  startingLineNumber?: number;
40
50
  showCopyOptions?: boolean;
51
+ highlightRangeWithTooltip?: ReferenceTrackerInformation[];
41
52
  onCopiedToClipboard?: OnCopiedToClipboardFunction;
53
+ onInsertToCursorPosition?: OnInsertToCursorPositionFunction;
42
54
  }
43
55
  export declare class SyntaxHighlighter {
44
- private readonly code;
45
56
  private readonly onCopiedToClipboard?;
57
+ private readonly onInsertToCursorPosition?;
58
+ private readonly highlightRangeWithTooltip;
59
+ private highlightRangeTooltipTimeout;
60
+ private highlightRangeTooltip;
46
61
  render: ExtendedHTMLElement;
47
62
  constructor(props: SyntaxHighlighterProps);
63
+ private readonly showHighlightRangeTooltip;
64
+ private readonly hideHighlightRangeTooltip;
65
+ private readonly getSelectedCode;
48
66
  private readonly copyToClipboard;
49
67
  }
@@ -6,7 +6,6 @@ import { ExtendedHTMLElement } from '../helper/dom';
6
6
  import { MynahIcons } from './icon';
7
7
  export interface ToggleOption {
8
8
  label?: ExtendedHTMLElement | string | HTMLElement;
9
- color?: string;
10
9
  icon?: MynahIcons;
11
10
  disabled?: boolean;
12
11
  selected?: boolean;
@@ -15,22 +14,25 @@ export interface ToggleOption {
15
14
  }
16
15
  export interface ToggleProps {
17
16
  options: ToggleOption[];
18
- type?: 'switch' | 'tabs';
19
17
  direction?: 'horizontal' | 'vertical';
20
18
  value?: string | null;
21
19
  name: string;
22
20
  disabled?: boolean;
23
21
  onChange?: (selectedValue: string) => void;
22
+ onRemove?: (selectedValue: string) => void;
24
23
  }
25
24
  export declare class Toggle {
26
25
  render: ExtendedHTMLElement;
27
26
  private readonly props;
28
27
  private currentValue?;
29
- private readonly relocateTransitioner;
30
28
  constructor(props: ToggleProps);
29
+ private readonly transformScroll;
31
30
  private readonly getChildren;
32
- private readonly setRelocatePosition;
33
31
  private readonly updateSelectionRender;
34
32
  setValue: (value: string) => void;
35
- getValue: () => string | undefined;
33
+ addOption: (option: ToggleOption) => void;
34
+ removeOption: (value: string) => void;
35
+ updateOptionTitle: (value: string, title: string) => void;
36
+ snapToOption: (value: string) => void;
37
+ getValue: () => string | undefined | null;
36
38
  }
@@ -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
- export declare class MynahConfig {
6
- private config;
7
- constructor();
8
- getConfig: (configName: string) => any;
9
- setConfig: (configName: string, configValue: string) => void;
5
+ import { ConfigModel } from '../static';
6
+ export declare class Config {
7
+ private static instance;
8
+ config: ConfigModel;
9
+ private constructor();
10
+ static getInstance(config?: Partial<ConfigModel>): Config;
10
11
  }
@@ -2,11 +2,11 @@
2
2
  * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
- export declare const getTimeDiff: (differenceInMs: number, show?: 1 | {
5
+ export declare const getTimeDiff: (differenceInMs: number, show?: 1 | 2 | 5 | 3 | 4 | 6 | {
6
6
  years?: boolean | undefined;
7
7
  months?: boolean | undefined;
8
8
  weeks?: boolean | undefined;
9
9
  days?: boolean | undefined;
10
10
  hours?: boolean | undefined;
11
11
  minutes?: boolean | undefined;
12
- } | 2 | 3 | 4 | 5 | 6 | undefined, separator?: string | undefined) => string;
12
+ } | undefined, separator?: string | undefined) => string;
@@ -2,6 +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 { MynahPortalNames } from '../static';
5
6
  export declare const DS: typeof document.querySelectorAll;
6
7
  export interface DomBuilderObject {
7
8
  type: string;
@@ -48,5 +49,6 @@ export declare class DomBuilder {
48
49
  createPortal: (portalName: string, builderObject: DomBuilderObject, position: 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend') => ExtendedHTMLElement;
49
50
  getPortal: (portalName: string) => ExtendedHTMLElement;
50
51
  removePortal: (portalName: string) => void;
52
+ removeAllPortals: (portalsWithName: MynahPortalNames) => void;
51
53
  }
52
54
  export declare const htmlDecode: (input: string) => string;
@@ -9,22 +9,7 @@ export declare class MynahUIGlobalEvents {
9
9
  private readonly listeners;
10
10
  private constructor();
11
11
  static getInstance: () => MynahUIGlobalEvents;
12
- /**
13
- * Subscribe to value changes of a specific item in data store
14
- * @param eventKey One of the keys in MynahUIDataModel
15
- * @param handler function will be called with optional data field
16
- * @returns listenerId which will be necessary to removeListener
17
- */
18
12
  addListener: (eventKey: MynahEventNames, handler: (data?: any) => void) => string;
19
- /**
20
- * Unsubscribe from changes of a specific item in data store
21
- * @param eventKey One of the keys in MynahUIDataModel
22
- * @param listenerId listenerId which is returned from addListener function
23
- */
24
13
  removeListener: (eventKey: MynahEventNames, listenerId: string) => void;
25
- /**
26
- * Updates the store and informs the subscribers.
27
- * @param data A full or partial set of store data model with values.
28
- */
29
14
  dispatch: (eventKey: MynahEventNames, data?: any) => void;
30
15
  }
@@ -0,0 +1,16 @@
1
+ /*!
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ export declare type TreeNode = FolderNode | FileNode;
6
+ export interface FileNode {
7
+ name: string;
8
+ type: 'file';
9
+ filePath: string;
10
+ }
11
+ export interface FolderNode {
12
+ name: string;
13
+ type: 'folder';
14
+ children: Array<FolderNode | FileNode>;
15
+ }
16
+ export declare const fileListToTree: (filePaths: string[]) => TreeNode;