@webitel/ui-chats 0.1.37 → 0.1.39

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.37",
3
+ "version": "0.1.39",
4
4
  "description": "Reusable Webitel Frontend Code for Chats UI",
5
5
  "workspaces": [
6
6
  "../../",
@@ -24,7 +24,7 @@
24
24
  "insert-text-at-cursor": "^0.3.0"
25
25
  },
26
26
  "devDependencies": {
27
- "@biomejs/biome": "2.4.10",
27
+ "@biomejs/biome": "2.4.16",
28
28
  "@types/node": "^24.10.0",
29
29
  "@vitejs/plugin-vue": "^6.0.1",
30
30
  "@vue/tsconfig": "^0.8.1",
package/src/css/main.css CHANGED
@@ -4,4 +4,7 @@
4
4
  --chat-audio-player-min-width: 250px;
5
5
  --chat-video-player-height: 201px;
6
6
  --chat-video-player-width: 256px;
7
+ --chat-message-timestamp-spacer-width: 2rem;
8
+ --chat-message-timestamp-spacer-height: 1.5rem;
9
+ --chat-message-timestamp-bottom-offset: 0.75rem;
7
10
  }
@@ -27,7 +27,7 @@
27
27
  :self-side="isSelfSide"
28
28
  @click.stop
29
29
  />
30
- <div v-else @click.stop>
30
+ <div class="chat-message__body" v-else @click.stop>
31
31
  <message-player
32
32
  v-if="media"
33
33
  :file="media"
@@ -45,12 +45,23 @@
45
45
  :file="document"
46
46
  :self-side="isSelfSide"
47
47
  />
48
- <message-text
48
+ <div
49
49
  v-if="props.message?.text"
50
- :text="props.message.text"
50
+ class="chat-message-text-wrapper"
51
+ >
52
+ <message-text
53
+ :text="props.message.text"
54
+ :with-timestamp-spacer="true"
55
+ />
56
+ <message-time :date="props.message.createdAt" />
57
+ </div>
58
+ <message-time
59
+ v-else
60
+ :date="props.message.createdAt"
51
61
  />
52
62
  </div>
53
63
  <message-time
64
+ v-if="message.file?.malware || isFileSizeExceeded"
54
65
  :date="props.message.createdAt"
55
66
  />
56
67
  </div>
@@ -165,10 +176,32 @@ function handlePlayerInitialize(player) {
165
176
  margin: 0 var(--spacing-2xs) 0 var(--spacing-md);
166
177
  }
167
178
 
168
- .chat-message--right .chat-message-text {
179
+ .chat-message--right .chat-message__body {
169
180
  background: var(--secondary-light-color);
170
181
  color: var(--secondary-on-color);
171
182
  place-self: flex-end;
172
183
  }
173
184
 
185
+ .chat-message__body {
186
+ position: relative;
187
+ overflow-wrap: anywhere;
188
+ white-space: pre-line;
189
+ padding: var(--spacing-xs);
190
+ border-radius: var(--border-radius);
191
+ background: var(--primary-light-color);
192
+ color: var(--primary-on-color);
193
+ place-self: flex-start;
194
+ }
195
+
196
+ .chat-message-time {
197
+ margin-top: var(--p-player-chat-message-gap);
198
+ }
199
+
200
+ .chat-message-text-wrapper .chat-message-time {
201
+ position: absolute;
202
+ right: var(--spacing-xs);
203
+ bottom: var(--chat-message-timestamp-bottom-offset);
204
+ pointer-events: none;
205
+ }
206
+
174
207
  </style>
@@ -8,6 +8,7 @@
8
8
  :size="ComponentSize.SM"
9
9
  :src="mediaSrc"
10
10
  :title="file.name"
11
+ countdown-time-mode
11
12
  static
12
13
  hide-expand
13
14
  stretch
@@ -17,6 +18,7 @@
17
18
  :src="mediaSrc"
18
19
  :autoplay="false"
19
20
  :closable="false"
21
+ countdown-time-mode
20
22
  hide-volume-slider
21
23
  hide-mute-button
22
24
  class="chat-message-player__audio"
@@ -1,8 +1,12 @@
1
1
  <template>
2
- <p
3
- class="chat-message-text typo-body-1"
4
- v-html="text"
5
- />
2
+ <p class="chat-message-text typo-body-1">
3
+ <span v-html="linkedText" />
4
+ <span
5
+ v-if="withTimestampSpacer"
6
+ class="chat-message-text__timestamp-spacer"
7
+ aria-hidden="true"
8
+ />
9
+ </p>
6
10
  </template>
7
11
 
8
12
  <script
@@ -10,13 +14,14 @@
10
14
  lang="ts"
11
15
  >
12
16
  import Autolinker from 'autolinker';
13
- import { computed, defineProps } from 'vue';
17
+ import { computed } from 'vue';
14
18
 
15
19
  const props = defineProps<{
16
20
  text: string;
21
+ withTimestampSpacer?: boolean;
17
22
  }>();
18
23
 
19
- const text = computed(() => {
24
+ const linkedText = computed(() => {
20
25
  // ATTENTION: not all libs are suitable for this case, because we want to preserve "<" signs
21
26
  // https://my.webitel.com/browse/DEV-2848
22
27
  return Autolinker.link(props.text, {
@@ -32,18 +37,20 @@ const text = computed(() => {
32
37
  scoped
33
38
  >
34
39
  .chat-message-text {
35
- overflow-wrap: anywhere;
36
- white-space: pre-line; // read \n as "new line"
37
- padding: var(--spacing-xs);
38
- border-radius: var(--border-radius);
39
- background: var(--primary-light-color);
40
- color: var(--primary-on-color);
41
- place-self: flex-start;
42
-
43
40
  // reset links inside text
44
41
  :deep(.chat-message-text__link) {
45
42
  color: revert;
46
43
  text-decoration: revert;
47
44
  }
45
+
46
+ /* @author @Oleksandr Palonnyi */
47
+ /* https://webitel.atlassian.net/browse/WTEL-9588?focusedCommentId=763440 */
48
+ /* [WTEL-9588](https://webitel.atlassian.net/browse/WTEL-9588) */
49
+ :deep(.chat-message-text__timestamp-spacer) {
50
+ display: inline-block;
51
+ width: var(--chat-message-timestamp-spacer-width);
52
+ height: var(--chat-message-timestamp-spacer-height);
53
+ vertical-align: bottom;
54
+ }
48
55
  }
49
56
  </style>
@@ -6,11 +6,11 @@ type __VLS_Props = {
6
6
  username?: string;
7
7
  agentName?: string;
8
8
  };
9
- declare var __VLS_1: {}, __VLS_52: {};
9
+ declare var __VLS_1: {}, __VLS_62: {};
10
10
  type __VLS_Slots = {} & {
11
11
  'before-message'?: (props: typeof __VLS_1) => any;
12
12
  } & {
13
- 'after-message'?: (props: typeof __VLS_52) => any;
13
+ 'after-message'?: (props: typeof __VLS_62) => any;
14
14
  };
15
15
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
16
16
  clickOnImage: () => any;
@@ -1,5 +1,6 @@
1
1
  type __VLS_Props = {
2
2
  text: string;
3
+ withTimestampSpacer?: boolean;
3
4
  };
4
5
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
5
6
  declare const _default: typeof __VLS_export;