@progress/kendo-react-conversational-ui 6.1.1 → 7.0.0-develop.10

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 (109) hide show
  1. package/{dist/npm/ChatPropsAndState.d.ts → ChatPropsAndState.d.ts} +5 -2
  2. package/{dist/npm/Events.d.ts → Events.d.ts} +5 -1
  3. package/LICENSE.md +1 -1
  4. package/{dist/es/ViewItem.d.ts → ViewItem.d.ts} +6 -2
  5. package/{dist/npm/api → api}/action.interface.d.ts +5 -1
  6. package/{dist/es/api → api}/attachment.interface.d.ts +5 -1
  7. package/{dist/npm/api → api}/message.interface.d.ts +4 -0
  8. package/{dist/es/api → api}/user.interface.d.ts +4 -0
  9. package/{dist/npm/components → components}/Action.d.ts +6 -3
  10. package/{dist/npm/components → components}/ActionGroup.d.ts +5 -2
  11. package/{dist/npm/components → components}/Attachment.d.ts +6 -3
  12. package/{dist/npm/components → components}/AttachmentGroup.d.ts +5 -2
  13. package/{dist/es/components → components}/Chat.d.ts +6 -2
  14. package/{dist/npm/components → components}/ChatMessage.d.ts +5 -1
  15. package/components/DateMarker.d.ts +18 -0
  16. package/{dist/npm/components → components}/MessageGroup.d.ts +6 -2
  17. package/{dist/npm/components → components}/NewMessage.d.ts +6 -2
  18. package/components/Toolbar.d.ts +13 -0
  19. package/{dist/npm/components → components}/base/FocusableUponSelection.d.ts +4 -0
  20. package/{dist/es/components → components}/base/SelectableItemsContainer.d.ts +4 -0
  21. package/{dist/npm/components → components}/templates/HeroCard.d.ts +6 -2
  22. package/dist/cdn/js/kendo-react-conversational-ui.js +5 -1
  23. package/index.d.ts +15 -0
  24. package/index.js +5 -0
  25. package/index.mjs +671 -0
  26. package/{dist/npm/messages → messages}/index.d.ts +4 -0
  27. package/package-metadata.d.ts +9 -0
  28. package/package.json +29 -39
  29. package/utils.d.ts +9 -0
  30. package/about.md +0 -3
  31. package/dist/es/ChatPropsAndState.d.ts +0 -92
  32. package/dist/es/ChatPropsAndState.js +0 -1
  33. package/dist/es/Events.d.ts +0 -38
  34. package/dist/es/Events.js +0 -1
  35. package/dist/es/ViewItem.js +0 -90
  36. package/dist/es/api/action.interface.d.ts +0 -31
  37. package/dist/es/api/action.interface.js +0 -1
  38. package/dist/es/api/attachment.interface.js +0 -1
  39. package/dist/es/api/message.interface.d.ts +0 -56
  40. package/dist/es/api/message.interface.js +0 -1
  41. package/dist/es/api/user.interface.js +0 -1
  42. package/dist/es/components/Action.d.ts +0 -20
  43. package/dist/es/components/Action.js +0 -43
  44. package/dist/es/components/ActionGroup.d.ts +0 -24
  45. package/dist/es/components/ActionGroup.js +0 -40
  46. package/dist/es/components/Attachment.d.ts +0 -25
  47. package/dist/es/components/Attachment.js +0 -68
  48. package/dist/es/components/AttachmentGroup.d.ts +0 -24
  49. package/dist/es/components/AttachmentGroup.js +0 -92
  50. package/dist/es/components/Chat.js +0 -210
  51. package/dist/es/components/ChatMessage.d.ts +0 -68
  52. package/dist/es/components/ChatMessage.js +0 -83
  53. package/dist/es/components/DateMarker.d.ts +0 -14
  54. package/dist/es/components/DateMarker.js +0 -33
  55. package/dist/es/components/MessageGroup.d.ts +0 -25
  56. package/dist/es/components/MessageGroup.js +0 -61
  57. package/dist/es/components/NewMessage.d.ts +0 -34
  58. package/dist/es/components/NewMessage.js +0 -81
  59. package/dist/es/components/Toolbar.d.ts +0 -9
  60. package/dist/es/components/Toolbar.js +0 -31
  61. package/dist/es/components/base/FocusableUponSelection.d.ts +0 -20
  62. package/dist/es/components/base/FocusableUponSelection.js +0 -35
  63. package/dist/es/components/base/SelectableItemsContainer.js +0 -113
  64. package/dist/es/components/templates/HeroCard.d.ts +0 -41
  65. package/dist/es/components/templates/HeroCard.js +0 -64
  66. package/dist/es/main.d.ts +0 -11
  67. package/dist/es/main.js +0 -10
  68. package/dist/es/messages/index.d.ts +0 -30
  69. package/dist/es/messages/index.js +0 -31
  70. package/dist/es/package-metadata.d.ts +0 -5
  71. package/dist/es/package-metadata.js +0 -11
  72. package/dist/es/utils.d.ts +0 -5
  73. package/dist/es/utils.js +0 -6
  74. package/dist/npm/ChatPropsAndState.js +0 -2
  75. package/dist/npm/Events.js +0 -2
  76. package/dist/npm/ViewItem.d.ts +0 -57
  77. package/dist/npm/ViewItem.js +0 -94
  78. package/dist/npm/api/action.interface.js +0 -2
  79. package/dist/npm/api/attachment.interface.d.ts +0 -32
  80. package/dist/npm/api/attachment.interface.js +0 -2
  81. package/dist/npm/api/message.interface.js +0 -2
  82. package/dist/npm/api/user.interface.d.ts +0 -23
  83. package/dist/npm/api/user.interface.js +0 -2
  84. package/dist/npm/components/Action.js +0 -45
  85. package/dist/npm/components/ActionGroup.js +0 -42
  86. package/dist/npm/components/Attachment.js +0 -70
  87. package/dist/npm/components/AttachmentGroup.js +0 -94
  88. package/dist/npm/components/Chat.d.ts +0 -72
  89. package/dist/npm/components/Chat.js +0 -213
  90. package/dist/npm/components/ChatMessage.js +0 -86
  91. package/dist/npm/components/DateMarker.d.ts +0 -14
  92. package/dist/npm/components/DateMarker.js +0 -35
  93. package/dist/npm/components/MessageGroup.js +0 -63
  94. package/dist/npm/components/NewMessage.js +0 -83
  95. package/dist/npm/components/Toolbar.d.ts +0 -9
  96. package/dist/npm/components/Toolbar.js +0 -33
  97. package/dist/npm/components/base/FocusableUponSelection.js +0 -38
  98. package/dist/npm/components/base/SelectableItemsContainer.d.ts +0 -33
  99. package/dist/npm/components/base/SelectableItemsContainer.js +0 -116
  100. package/dist/npm/components/templates/HeroCard.js +0 -67
  101. package/dist/npm/main.d.ts +0 -11
  102. package/dist/npm/main.js +0 -27
  103. package/dist/npm/messages/index.js +0 -34
  104. package/dist/npm/package-metadata.d.ts +0 -5
  105. package/dist/npm/package-metadata.js +0 -14
  106. package/dist/npm/utils.d.ts +0 -5
  107. package/dist/npm/utils.js +0 -10
  108. package/dist/systemjs/kendo-react-conversational-ui.js +0 -1
  109. package/e2e-next/conversationalui.basic.tests.ts +0 -24
@@ -1,24 +0,0 @@
1
- /// <reference types="react" />
2
- import { AttachmentGroup as AttachmentGroupModel } from './../ViewItem';
3
- import { SelectableItemsContainer, SelectableItemsContainerProps, SelectableItemsContainerState } from './base/SelectableItemsContainer';
4
- /**
5
- * @hidden
6
- */
7
- export interface AttachmentGroupProps extends SelectableItemsContainerProps {
8
- group: AttachmentGroupModel;
9
- itemTemplate?: any;
10
- }
11
- /**
12
- * @hidden
13
- */
14
- export default class AttachmentGroup extends SelectableItemsContainer<AttachmentGroupProps, SelectableItemsContainerState> {
15
- render(): JSX.Element;
16
- protected get isKeyboardNavigationLeftRight(): boolean;
17
- private getLastItemIndex;
18
- private getLeftScrollBtn;
19
- private getRightScrollBtn;
20
- private onAttachmentClick;
21
- private onNavigateBtnClick;
22
- private isCardDeckLayout;
23
- private getClassNames;
24
- }
@@ -1,92 +0,0 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
- import * as React from 'react';
17
- import { classNames } from '@progress/kendo-react-common';
18
- import { chevronLeftIcon, chevronRightIcon } from '@progress/kendo-svg-icons';
19
- import Attachment from './Attachment';
20
- import { SelectableItemsContainer } from './base/SelectableItemsContainer';
21
- import { Button } from '@progress/kendo-react-buttons';
22
- /**
23
- * @hidden
24
- */
25
- var AttachmentGroup = /** @class */ (function (_super) {
26
- __extends(AttachmentGroup, _super);
27
- function AttachmentGroup() {
28
- return _super !== null && _super.apply(this, arguments) || this;
29
- }
30
- AttachmentGroup.prototype.render = function () {
31
- var _this = this;
32
- var isCardDeckLayout = this.isCardDeckLayout(this.props);
33
- var viewWithoutScrollButtons = (React.createElement("div", { className: this.getClassNames(), onKeyDown: isCardDeckLayout ? undefined : this.onKeyDown }, this.props.group.attachments.map(function (item, index) {
34
- return (React.createElement(Attachment, { item: item, template: _this.props.itemTemplate, selected: index === _this.state.selectedItemIndex, tabbable: _this.props.isLastGroup && index === _this.state.selectedItemIndex, isFirstItemInGroup: index === 0, isLastItemInGroup: index === _this.getLastItemIndex(), onClick: function () { return _this.onAttachmentClick(index); }, key: index }));
35
- })));
36
- if (isCardDeckLayout) {
37
- return (React.createElement("div", { className: "k-card-deck-scrollwrap", onKeyDown: this.onKeyDown },
38
- this.getLeftScrollBtn(),
39
- viewWithoutScrollButtons,
40
- this.getRightScrollBtn()));
41
- }
42
- else {
43
- return viewWithoutScrollButtons;
44
- }
45
- };
46
- Object.defineProperty(AttachmentGroup.prototype, "isKeyboardNavigationLeftRight", {
47
- // Overriding the default navigation.
48
- get: function () {
49
- return this.isCardDeckLayout(this.props);
50
- },
51
- enumerable: false,
52
- configurable: true
53
- });
54
- AttachmentGroup.prototype.getLastItemIndex = function () {
55
- return this.props.group.attachments.length - 1;
56
- };
57
- AttachmentGroup.prototype.getLeftScrollBtn = function () {
58
- var _this = this;
59
- var result = null;
60
- if (this.isCardDeckLayout(this.props) && this.state.selectedItemIndex) {
61
- result = (React.createElement(Button, { icon: "chevron-left", onClick: function () { return _this.onNavigateBtnClick(false); }, svgIcon: chevronLeftIcon }));
62
- }
63
- return result;
64
- };
65
- AttachmentGroup.prototype.getRightScrollBtn = function () {
66
- var _this = this;
67
- var result = null;
68
- if (this.isCardDeckLayout(this.props) && this.state.selectedItemIndex !== this.getLastItemIndex()) {
69
- result = (React.createElement(Button, { icon: "chevron-right", onClick: function () { return _this.onNavigateBtnClick(true); }, svgIcon: chevronRightIcon }));
70
- }
71
- return result;
72
- };
73
- AttachmentGroup.prototype.onAttachmentClick = function (attachmentIndex) {
74
- this.onRequestContainerSelection();
75
- this.setState({ selectedItemIndex: attachmentIndex });
76
- };
77
- AttachmentGroup.prototype.onNavigateBtnClick = function (incrementSelection) {
78
- this.onRequestContainerSelection();
79
- this.navigate(incrementSelection, 1);
80
- };
81
- AttachmentGroup.prototype.isCardDeckLayout = function (props) {
82
- return props.group.attachmentLayout !== 'list';
83
- };
84
- AttachmentGroup.prototype.getClassNames = function () {
85
- return classNames({
86
- 'k-card-list': this.props.group.attachmentLayout,
87
- 'k-card-deck': this.isCardDeckLayout(this.props)
88
- });
89
- };
90
- return AttachmentGroup;
91
- }(SelectableItemsContainer));
92
- export default AttachmentGroup;
@@ -1,210 +0,0 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
- import { Keys, classNames, dispatchEvent } from '@progress/kendo-react-common';
17
- import * as PropTypes from 'prop-types';
18
- import * as React from 'react';
19
- import { convertMsgsToViewItems } from './../ViewItem';
20
- import ActionGroup from './ActionGroup';
21
- import AttachmentGroup from './AttachmentGroup';
22
- import DateMarker from './DateMarker';
23
- import MessageGroup from './MessageGroup';
24
- import NewMessage from './NewMessage';
25
- import { ChatMessage } from './ChatMessage';
26
- import { validatePackage } from '@progress/kendo-react-common';
27
- import { packageMetadata } from '../package-metadata';
28
- import { ariaLabelMessageList, messages } from '../messages';
29
- import { provideLocalizationService } from '@progress/kendo-react-intl';
30
- /**
31
- * Represents the [KendoReact Chat component]({% slug overview_convui %}).
32
- */
33
- var Chat = /** @class */ (function (_super) {
34
- __extends(Chat, _super);
35
- function Chat(props) {
36
- var _this = _super.call(this, props) || this;
37
- _this.viewItems = [];
38
- _this.isDirectionRightToLeft = false;
39
- _this.scrollToBottomOnLoadingData = true;
40
- _this.onFocus = function () {
41
- clearTimeout(_this.timeoutIdForChatLosingFocus);
42
- };
43
- _this.onBlur = function () {
44
- // This is a hacky solution to clear the selection when the focus is lost
45
- // in favor of an element outside the Chat.
46
- // https://medium.com/@jessebeach/dealing-with-focus-and-blur-in-a-composite-widget-in-react-90d3c3b49a9b
47
- _this.timeoutIdForChatLosingFocus = window.setTimeout(function () { _this.setState({ selectedItemIndex: null }); }, 0);
48
- };
49
- _this.onSelectionRequested = function (clickedItemIndex) {
50
- _this.setState({ selectedItemIndex: clickedItemIndex });
51
- };
52
- _this.onKeyDown = function (event) {
53
- var newSelectedItemIndex = null;
54
- var currentSelectedItemIndex = _this.state.selectedItemIndex !== null ?
55
- _this.state.selectedItemIndex :
56
- _this.viewItems.lastSelectionIndex;
57
- if (event.keyCode === Keys.up) {
58
- if (currentSelectedItemIndex === null) {
59
- newSelectedItemIndex = 0;
60
- }
61
- else if (currentSelectedItemIndex > 0) {
62
- newSelectedItemIndex = currentSelectedItemIndex - 1;
63
- }
64
- }
65
- else if (event.keyCode === Keys.down) {
66
- if (currentSelectedItemIndex === null) {
67
- newSelectedItemIndex = 0;
68
- }
69
- else if (currentSelectedItemIndex < _this.viewItems.lastSelectionIndex) {
70
- newSelectedItemIndex = currentSelectedItemIndex + 1;
71
- }
72
- }
73
- if (newSelectedItemIndex !== null) {
74
- _this.setState({ selectedItemIndex: newSelectedItemIndex });
75
- // Prevent the default behavior of moving of the scrollbar
76
- // because scrolling is achieved through item focusing.
77
- event.preventDefault();
78
- }
79
- };
80
- _this.onMessageSend = function (message, event) {
81
- dispatchEvent(_this.props.onMessageSend, event, _this, { message: message });
82
- };
83
- _this.onActionExecute = function (action, event) {
84
- dispatchEvent(_this.props.onActionExecute, event, _this, { action: action });
85
- if (!event.isDefaultPrevented()) {
86
- switch (action.type) {
87
- case 'reply':
88
- _this.onMessageSend({
89
- author: _this.props.user,
90
- text: action.value,
91
- timestamp: new Date()
92
- }, event);
93
- break;
94
- case 'call':
95
- window.open('tel:' + action.value);
96
- break;
97
- case 'openUrl':
98
- window.open(action.value);
99
- break;
100
- default:
101
- break;
102
- }
103
- _this.newMsgComp.focusInput();
104
- }
105
- };
106
- validatePackage(packageMetadata);
107
- _this.state = { selectedItemIndex: null, isFirstRender: true };
108
- return _this;
109
- }
110
- /**
111
- * @hidden
112
- */
113
- Chat.prototype.render = function () {
114
- var _this = this;
115
- this.viewItems = this.getViewItemsFromMsgs(this.props.messages);
116
- this.isDirectionRightToLeft = this.checkIsDirectionRightToLeft(this.props);
117
- var localizationService = provideLocalizationService(this);
118
- return (React.createElement("div", { style: { width: this.props.width }, onKeyDown: this.onKeyDown, className: this.getClassNames(), ref: function (el) { return _this.chatWrapperEl = el; } },
119
- React.createElement("div", { className: "k-message-list k-avatars", onBlur: this.onBlur, onFocus: this.onFocus, role: "log", "aria-label": localizationService.toLanguageString(ariaLabelMessageList, messages[ariaLabelMessageList]), "aria-live": "polite", onScroll: function (e) {
120
- _this.scrollToBottomOnLoadingData =
121
- (e.currentTarget.scrollTop === e.currentTarget.scrollHeight - e.currentTarget.clientHeight);
122
- }, ref: function (el) { return _this.viewItemsWrapperEl = el; } },
123
- React.createElement("div", { className: "k-message-list-content" }, this.renderViewItems())),
124
- React.createElement(NewMessage, { user: this.props.user, onMessageSend: this.onMessageSend, isDirectionRightToLeft: this.isDirectionRightToLeft, ref: function (comp) { return _this.newMsgComp = comp; }, placeholder: this.props.placeholder, MessageBox: this.props.messageBox, toolbar: this.props.toolbar, onToolbarActionButtonClick: this.props.onToolbarActionExecute, showToolbar: this.props.showToolbar })));
125
- };
126
- /**
127
- * @hidden
128
- */
129
- Chat.prototype.componentDidMount = function () {
130
- var _this = this;
131
- this.setState({ isFirstRender: false }, function () {
132
- // W/o window.setTimeout the scrolling does not manage to go to the bottom, some offset is left.
133
- _this.nextTickId = window.setTimeout(function () { return _this.scrollViewItemsToBottom(); }, 250);
134
- });
135
- };
136
- /**
137
- * @hidden
138
- */
139
- Chat.prototype.componentWillUnmount = function () {
140
- clearTimeout(this.nextTickId);
141
- };
142
- /**
143
- * @hidden
144
- */
145
- Chat.prototype.componentDidUpdate = function (prevProps) {
146
- if (prevProps.messages.length !== this.props.messages.length && this.scrollToBottomOnLoadingData) {
147
- this.scrollViewItemsToBottom();
148
- }
149
- };
150
- Chat.prototype.getClassNames = function () {
151
- return classNames('k-chat', this.props.className, { 'k-rtl': this.isDirectionRightToLeft });
152
- };
153
- Chat.prototype.checkIsDirectionRightToLeft = function (props) {
154
- var result = props.dir !== undefined ? props.dir === 'rtl' :
155
- this.chatWrapperEl && getComputedStyle(this.chatWrapperEl).direction === 'rtl';
156
- return Boolean(result);
157
- };
158
- Chat.prototype.renderViewItems = function () {
159
- var _this = this;
160
- var lastViewItemIndex = this.viewItems.length - 1;
161
- return this.viewItems
162
- .map(function (viewItem, index) {
163
- if (viewItem.type === 'date-marker') {
164
- return React.createElement(DateMarker, { item: viewItem, key: index });
165
- }
166
- else if (viewItem.type === 'message-group') {
167
- return (React.createElement(MessageGroup, { group: viewItem, itemTemplate: _this.props.messageTemplate, attachmentTemplate: _this.props.attachmentTemplate, user: _this.props.user, selectedItemIndex: _this.state.selectedItemIndex, onRequestSelection: _this.onSelectionRequested, isLastGroup: index === lastViewItemIndex, key: index, message: _this.props.message || Chat.defaultProps.message }));
168
- }
169
- else if (viewItem.type === 'attachment-group') {
170
- return (React.createElement(AttachmentGroup, { group: viewItem, itemTemplate: _this.props.attachmentTemplate, onRequestSelection: _this.onSelectionRequested, selected: viewItem.selectionIndex === _this.state.selectedItemIndex, isLastGroup: index === lastViewItemIndex, key: index }));
171
- }
172
- else if (viewItem.type === 'action-group') {
173
- return (React.createElement(ActionGroup, { group: viewItem, onActionExecute: _this.onActionExecute, onRequestSelection: _this.onSelectionRequested, selected: viewItem.selectionIndex === _this.state.selectedItemIndex, isLastGroup: index === lastViewItemIndex, key: index }));
174
- }
175
- });
176
- };
177
- Chat.prototype.scrollViewItemsToBottom = function () {
178
- if (this.viewItemsWrapperEl) {
179
- this.viewItemsWrapperEl.scrollTop =
180
- this.viewItemsWrapperEl.scrollHeight - this.viewItemsWrapperEl.clientHeight;
181
- }
182
- };
183
- Chat.prototype.getViewItemsFromMsgs = function (msgs) {
184
- return msgs.length > 0 ? convertMsgsToViewItems(msgs) : [];
185
- };
186
- /**
187
- * @hidden
188
- */
189
- Chat.propTypes = {
190
- messages: PropTypes.arrayOf(PropTypes.object),
191
- user: PropTypes.object,
192
- messageTemplate: PropTypes.any,
193
- attachmentTemplate: PropTypes.any,
194
- width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
195
- onMessageSend: PropTypes.func,
196
- onActionExecute: PropTypes.func,
197
- dir: PropTypes.string,
198
- messageBox: PropTypes.any
199
- };
200
- /**
201
- * @hidden
202
- */
203
- Chat.defaultProps = {
204
- messages: [],
205
- dateFormat: 'g',
206
- message: ChatMessage
207
- };
208
- return Chat;
209
- }(React.Component));
210
- export { Chat };
@@ -1,68 +0,0 @@
1
- import * as React from 'react';
2
- import { MessageModel } from './../ViewItem';
3
- import { FocusableUponSelection, FocusableUponSelectionProps } from './base/FocusableUponSelection';
4
- /**
5
- * Represents the properties available to the `messageTemplate` custom component.
6
- *
7
- * For more information, refer to the [Message Template]({% slug message_templates_chat %}) article.
8
- */
9
- export interface ChatMessageTemplateProps {
10
- item: MessageModel;
11
- }
12
- /**
13
- * Represents the properties of [ChatMessage] (% slug api_conversational-ui_chatmessage %) component.
14
- */
15
- export interface ChatMessageProps extends FocusableUponSelectionProps {
16
- /**
17
- * Represents the data item of the `Message`.
18
- */
19
- item: MessageModel;
20
- /**
21
- * Represents the React Component rendered inside the `Message`.
22
- */
23
- template?: React.ComponentType<ChatMessageTemplateProps>;
24
- /**
25
- * @hidden
26
- */
27
- onRequestSelection: any;
28
- /**
29
- * Represents the tab index attribute.
30
- */
31
- tabIndex?: number;
32
- /**
33
- * @hidden
34
- */
35
- isFirstItemInGroup: boolean;
36
- /**
37
- * @hidden
38
- */
39
- isLastItemInGroup: boolean;
40
- /**
41
- * @hidden
42
- */
43
- isOnlyItemInGroup: boolean;
44
- /**
45
- * Represents the date format of the message date.
46
- */
47
- dateFormat?: string;
48
- }
49
- /**
50
- * Represents the ChatMessage component.
51
- */
52
- export declare class ChatMessage extends FocusableUponSelection<ChatMessageProps, {}> {
53
- /**
54
- * @hidden
55
- */
56
- static defaultProps: {
57
- dateFormat: string;
58
- tabIndex: number;
59
- };
60
- /**
61
- * @hidden
62
- */
63
- render(): JSX.Element;
64
- private getMainView;
65
- private getTimestampView;
66
- private getStatusView;
67
- private getClassNames;
68
- }
@@ -1,83 +0,0 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
- import * as React from 'react';
17
- import { classNames } from '@progress/kendo-react-common';
18
- import { provideIntlService, registerForIntl } from '@progress/kendo-react-intl';
19
- import { FocusableUponSelection } from './base/FocusableUponSelection';
20
- /**
21
- * Represents the ChatMessage component.
22
- */
23
- var ChatMessage = /** @class */ (function (_super) {
24
- __extends(ChatMessage, _super);
25
- function ChatMessage() {
26
- return _super !== null && _super.apply(this, arguments) || this;
27
- }
28
- /**
29
- * @hidden
30
- */
31
- ChatMessage.prototype.render = function () {
32
- var _this = this;
33
- return (React.createElement("div", { className: this.getClassNames(), tabIndex: this.props.tabIndex, onClick: function () { return _this.props.onRequestSelection(_this.props.item.selectionIndex); }, onFocus: function () { return _this.props.onRequestSelection(_this.props.item.selectionIndex); }, ref: function (el) { return _this.elementToFocus = el; } },
34
- this.getTimestampView(),
35
- this.getMainView(),
36
- this.getStatusView()));
37
- };
38
- ChatMessage.prototype.getMainView = function () {
39
- if (this.props.item.typing) {
40
- return (React.createElement("div", { className: "k-chat-bubble" },
41
- React.createElement("div", { className: "k-typing-indicator" },
42
- React.createElement("span", null),
43
- React.createElement("span", null),
44
- React.createElement("span", null))));
45
- }
46
- else if (this.props.template) {
47
- return React.createElement(this.props.template, { item: this.props.item });
48
- }
49
- else if (this.props.item.text) {
50
- return (React.createElement("div", { className: "k-chat-bubble" }, this.props.item.text));
51
- }
52
- else {
53
- return null;
54
- }
55
- };
56
- ChatMessage.prototype.getTimestampView = function () {
57
- var result = null;
58
- if (this.props.item.timestamp) {
59
- result = (React.createElement("time", { className: "k-message-time", "aria-hidden": !this.props.selected }, provideIntlService(this).formatDate(this.props.item.timestamp, this.props.dateFormat)));
60
- }
61
- return result;
62
- };
63
- ChatMessage.prototype.getStatusView = function () {
64
- var result = null;
65
- if (this.props.item.status) {
66
- result = (React.createElement("span", { className: "k-message-status" }, this.props.item.status));
67
- }
68
- return result;
69
- };
70
- ChatMessage.prototype.getClassNames = function () {
71
- return classNames({ 'k-only': this.props.isOnlyItemInGroup }, { 'k-first': this.props.isFirstItemInGroup && !this.props.isOnlyItemInGroup }, { 'k-last': this.props.isLastItemInGroup && !this.props.isOnlyItemInGroup }, { 'k-selected': this.props.selected }, { 'k-focus': this.props.selected }, 'k-message');
72
- };
73
- /**
74
- * @hidden
75
- */
76
- ChatMessage.defaultProps = {
77
- dateFormat: 'g',
78
- tabIndex: -1
79
- };
80
- return ChatMessage;
81
- }(FocusableUponSelection));
82
- export { ChatMessage };
83
- registerForIntl(ChatMessage);
@@ -1,14 +0,0 @@
1
- import * as React from 'react';
2
- import { DateMarker as DateMarkerModel } from './../ViewItem';
3
- /**
4
- * @hidden
5
- */
6
- export interface DateMarkerProps {
7
- item: DateMarkerModel;
8
- }
9
- /**
10
- * @hidden
11
- */
12
- export default class DateMarker extends React.Component<DateMarkerProps, {}> {
13
- render(): JSX.Element;
14
- }
@@ -1,33 +0,0 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
- import * as React from 'react';
17
- import { provideIntlService, registerForIntl } from '@progress/kendo-react-intl';
18
- /**
19
- * @hidden
20
- */
21
- var DateMarker = /** @class */ (function (_super) {
22
- __extends(DateMarker, _super);
23
- function DateMarker() {
24
- return _super !== null && _super.apply(this, arguments) || this;
25
- }
26
- DateMarker.prototype.render = function () {
27
- var item = this.props.item;
28
- return React.createElement("div", { className: "k-timestamp" }, provideIntlService(this).formatDate(item.timestamp, 'D'));
29
- };
30
- return DateMarker;
31
- }(React.Component));
32
- export default DateMarker;
33
- registerForIntl(DateMarker);
@@ -1,25 +0,0 @@
1
- import * as React from 'react';
2
- import { User } from './../main';
3
- import { MessageGroup as MessageGroupModel } from './../ViewItem';
4
- import { ChatMessageProps } from './ChatMessage';
5
- /**
6
- * @hidden
7
- */
8
- export interface MessageGroupProps {
9
- group: MessageGroupModel;
10
- user: User;
11
- itemTemplate?: any;
12
- attachmentTemplate?: any;
13
- onRequestSelection: any;
14
- selectedItemIndex: number | null;
15
- isLastGroup: boolean;
16
- message: React.ComponentType<ChatMessageProps>;
17
- }
18
- /**
19
- * @hidden
20
- */
21
- export default class MessageGroup extends React.Component<MessageGroupProps, {}> {
22
- render(): JSX.Element;
23
- private getMsgGroupClassNames;
24
- private getGroupMessagesView;
25
- }
@@ -1,61 +0,0 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
- import * as React from 'react';
17
- import { classNames } from '@progress/kendo-react-common';
18
- import { Avatar } from '@progress/kendo-react-layout';
19
- import Attachment from './Attachment';
20
- import { isAuthor } from './../utils';
21
- import { provideLocalizationService } from '@progress/kendo-react-intl';
22
- import { messages, avatarAlt } from '../messages';
23
- /**
24
- * @hidden
25
- */
26
- var MessageGroup = /** @class */ (function (_super) {
27
- __extends(MessageGroup, _super);
28
- function MessageGroup() {
29
- return _super !== null && _super.apply(this, arguments) || this;
30
- }
31
- MessageGroup.prototype.render = function () {
32
- var _a = this.props.group.author, avatarUrl = _a.avatarUrl, avatarAltText = _a.avatarAltText, name = _a.name;
33
- var localizationService = provideLocalizationService(this);
34
- return (React.createElement("div", { className: this.getMsgGroupClassNames() },
35
- name && (React.createElement("p", { className: "k-author" }, name)),
36
- avatarUrl && (React.createElement(Avatar, { type: 'image' },
37
- React.createElement("img", { src: avatarUrl, alt: avatarAltText !== undefined
38
- ? avatarAltText
39
- : localizationService.toLanguageString(avatarAlt, messages[avatarAlt]) }))),
40
- this.getGroupMessagesView()));
41
- };
42
- MessageGroup.prototype.getMsgGroupClassNames = function () {
43
- return classNames('k-message-group', {
44
- 'k-no-avatar': !this.props.group.author.avatarUrl,
45
- 'k-alt': isAuthor(this.props.user, this.props.group.messages[0])
46
- });
47
- };
48
- MessageGroup.prototype.getGroupMessagesView = function () {
49
- var _this = this;
50
- var lastItemIndex = this.props.group.messages.length - 1;
51
- return this.props.group.messages.map(function (msg, index) {
52
- var result = [(React.createElement(_this.props.message, { item: msg, template: _this.props.itemTemplate, selected: msg.selectionIndex === _this.props.selectedItemIndex, onRequestSelection: _this.props.onRequestSelection, tabIndex: index === lastItemIndex && _this.props.isLastGroup ? 0 : -1, isFirstItemInGroup: index === 0, isLastItemInGroup: index === lastItemIndex, isOnlyItemInGroup: lastItemIndex === 0, key: index }))];
53
- if (msg.attachments && msg.attachments.length === 1) {
54
- result.push(React.createElement(Attachment, { item: msg.attachments[0], template: _this.props.attachmentTemplate, selected: false, key: "att-".concat(index) }));
55
- }
56
- return result;
57
- });
58
- };
59
- return MessageGroup;
60
- }(React.Component));
61
- export default MessageGroup;
@@ -1,34 +0,0 @@
1
- import * as React from 'react';
2
- import { User } from './../main';
3
- import { ChatMessageBoxProps } from '../ChatPropsAndState';
4
- /**
5
- * @hidden
6
- */
7
- export interface NewMessageProps {
8
- onMessageSend: any;
9
- user: User;
10
- isDirectionRightToLeft: boolean | null;
11
- placeholder?: string;
12
- toolbar?: any;
13
- onToolbarActionButtonClick?: any;
14
- showToolbar?: boolean;
15
- MessageBox?: React.ComponentType<ChatMessageBoxProps>;
16
- }
17
- /**
18
- * @hidden
19
- */
20
- export interface NewMessageState {
21
- focused: boolean;
22
- }
23
- /**
24
- * @hidden
25
- */
26
- export default class NewMessage extends React.Component<NewMessageProps, NewMessageState> {
27
- readonly state: NewMessageState;
28
- private inputEl;
29
- render(): JSX.Element;
30
- focusInput(): void;
31
- private onInputKeyDown;
32
- private getClassNames;
33
- private sendMessage;
34
- }