@webitel/ui-chats 0.1.4 → 0.1.6

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.4",
3
+ "version": "0.1.6",
4
4
  "description": "Reusable Webitel Frontend Code for Chats UI",
5
5
  "workspaces": [
6
6
  "../../",
@@ -16,9 +16,9 @@
16
16
  </template>
17
17
 
18
18
  <script setup lang="ts">
19
- import { computed, defineEmits, defineProps } from "vue";
19
+ import { computed, defineEmits, defineProps } from 'vue';
20
20
 
21
- import type { ChatMessageFile } from "../../../../types/ChatMessage.types";
21
+ import type { ChatMessageFile } from '../../../../types/ChatMessage.types';
22
22
 
23
23
  const props = defineProps<{
24
24
  file: ChatMessageFile;
@@ -36,11 +36,13 @@ const emit = defineEmits<{
36
36
  const mediaUrl = computed(() => props.file.streamUrl || props.file.url);
37
37
 
38
38
  function handlePlayerInitialize(player) {
39
- emit("initialized", player);
39
+ emit('initialized', player);
40
40
  }
41
41
  </script>
42
42
 
43
43
  <style lang="scss" scoped>
44
+ $chat-file-max-width: 280px;
45
+ $chat-file-max-height: 280px;
44
46
  .chat-message-player {
45
47
  .wt-player :deep(.plyr) {
46
48
  .wt-player__close-icon,
@@ -49,8 +51,8 @@ function handlePlayerInitialize(player) {
49
51
  }
50
52
 
51
53
  &.plyr--video {
52
- max-height: var(--chat-file-max-height);
53
- max-width: var(--chat-file-max-width);
54
+ max-height: $chat-file-max-height;
55
+ max-width: $chat-file-max-width;
54
56
  }
55
57
  }
56
58
  }
@@ -1,53 +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
- v-if="chatActions.includes(ChatAction.SendMessage)"
25
29
  >
26
- <template #default>
27
- <chat-text-field
28
- v-model:text="draft"
29
- @enter="sendMessage"
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 }"
30
38
  />
31
- <chat-input-actions-bar
32
- :actions="props.chatActions"
33
- @[ChatAction.SendMessage]="sendMessage"
34
- @[ChatAction.AttachFiles]="sendFile"
35
- >
36
- <template
37
- v-for="action in slottedChatActions"
38
- :key="action"
39
- #[action]="{ size }"
40
- >
41
- <slot
42
- :name="`action:${action}`"
43
- v-bind="{ size }"
44
- />
45
- </template>
46
- </chat-input-actions-bar>
47
39
  </template>
48
- </chat-footer-wrapper>
49
- </slot>
50
- </section>
40
+ </chat-input-actions-bar>
41
+ </template>
42
+ </chat-footer-wrapper>
43
+ </slot>
44
+ </section>
51
45
  </template>
52
46
 
53
47
  <script setup lang="ts">
@@ -77,6 +71,7 @@ const props = withDefaults(
77
71
  canLoadNextMessages?: boolean; // 'next'
78
72
  isNextMessagesLoading?: boolean;
79
73
  withoutAvatars?: boolean;
74
+ readonly?: boolean; // hide chat footer with textarea and action-buttons
80
75
  }>(),
81
76
  {
82
77
  size: ComponentSize.MD,
@@ -84,6 +79,7 @@ const props = withDefaults(
84
79
  chatActions: () => [],
85
80
  canLoadNextMessages: false,
86
81
  isNextMessagesLoading: false,
82
+ readonly: false,
87
83
  },
88
84
  );
89
85
 
@@ -1,4 +1,4 @@
1
- import type { ChatMessageFile } from "../../../../types/ChatMessage.types";
1
+ import type { ChatMessageFile } from '../../../../types/ChatMessage.types';
2
2
  type __VLS_Props = {
3
3
  file: ChatMessageFile;
4
4
  type: string;