@webitel/ui-chats 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/ui-chats",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Reusable Webitel Frontend Code for Chats UI",
5
5
  "workspaces": [
6
6
  "../../",
@@ -1,51 +1,47 @@
1
1
  <template>
2
2
  <section class="the-chat-container">
3
- <!-- <slot name="header">
4
- header goes here
5
- </slot> -->
6
- <slot name="main">
7
- <dropzone
8
- v-if="!isDropzoneDisabled && isDropzoneVisible"
9
- @dragenter.prevent
10
- @dragleave.prevent="handleDragLeave"
11
- @drop="sendFile"
3
+ <slot name="main">
4
+ <dropzone
5
+ v-if="!isDropzoneDisabled && isDropzoneVisible"
6
+ @dragenter.prevent
7
+ @dragleave.prevent="handleDragLeave"
8
+ @drop="sendFile"
9
+ />
10
+ <messages-container
11
+ :messages="props.messages"
12
+ :next="props.canLoadNextMessages"
13
+ :is-loading="props.isNextMessagesLoading"
14
+ :without-avatars="props.withoutAvatars"
15
+ @[ChatAction.LoadNextMessages]="emit(ChatAction.LoadNextMessages)"
16
+ />
17
+ </slot>
18
+ <slot name="footer">
19
+ <chat-footer-wrapper v-if="!props.readonly">
20
+ <template #default>
21
+ <chat-text-field
22
+ v-model:text="draft"
23
+ @enter="sendMessage"
12
24
  />
13
- <messages-container
14
- :messages="props.messages"
15
- :next="props.canLoadNextMessages"
16
- :is-loading="props.isNextMessagesLoading"
17
- :without-avatars="props.withoutAvatars"
18
- @[ChatAction.LoadNextMessages]="emit(ChatAction.LoadNextMessages)"
25
+ <chat-input-actions-bar
26
+ :actions="props.chatActions"
27
+ @[ChatAction.SendMessage]="sendMessage"
19
28
  @[ChatAction.AttachFiles]="sendFile"
20
- />
21
- </slot>
22
- <slot name="footer">
23
- <chat-footer-wrapper>
24
- <template #default>
25
- <chat-text-field
26
- v-model:text="draft"
27
- @enter="sendMessage"
29
+ >
30
+ <template
31
+ v-for="action in slottedChatActions"
32
+ :key="action"
33
+ #[action]="{ size }"
34
+ >
35
+ <slot
36
+ :name="`action:${action}`"
37
+ v-bind="{ size }"
28
38
  />
29
- <chat-input-actions-bar
30
- :actions="props.chatActions"
31
- @[ChatAction.SendMessage]="sendMessage"
32
- @[ChatAction.AttachFiles]="sendFile"
33
- >
34
- <template
35
- v-for="action in slottedChatActions"
36
- :key="action"
37
- #[action]="{ size }"
38
- >
39
- <slot
40
- :name="`action:${action}`"
41
- v-bind="{ size }"
42
- />
43
- </template>
44
- </chat-input-actions-bar>
45
39
  </template>
46
- </chat-footer-wrapper>
47
- </slot>
48
- </section>
40
+ </chat-input-actions-bar>
41
+ </template>
42
+ </chat-footer-wrapper>
43
+ </slot>
44
+ </section>
49
45
  </template>
50
46
 
51
47
  <script setup lang="ts">
@@ -75,15 +71,15 @@ const props = withDefaults(
75
71
  canLoadNextMessages?: boolean; // 'next'
76
72
  isNextMessagesLoading?: boolean;
77
73
  withoutAvatars?: boolean;
74
+ readonly?: boolean; // hide chat footer with textarea and action-buttons
78
75
  }>(),
79
76
  {
80
77
  size: ComponentSize.MD,
81
78
  withoutAvatars: false,
82
- chatActions: () => [
83
- ChatAction.SendMessage,
84
- ],
79
+ chatActions: () => [],
85
80
  canLoadNextMessages: false,
86
81
  isNextMessagesLoading: false,
82
+ readonly: false,
87
83
  },
88
84
  );
89
85