@uzum-tech/ui 1.8.0 → 1.8.1

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.
@@ -1,5 +1,5 @@
1
- import { h, defineComponent, computed } from 'vue';
2
- import { MessageStatus } from './interface';
1
+ import { h, defineComponent, computed, inject } from 'vue';
2
+ import { MessageStatus, chatInjectionKey } from './interface';
3
3
  import { UEmpty } from '../../empty';
4
4
  import { UAvatar } from '../../avatar';
5
5
  import { UListItem, UList } from '../../list';
@@ -52,10 +52,11 @@ export const chatListItemsProps = Object.assign(Object.assign({}, useTheme.props
52
52
  export default defineComponent({
53
53
  name: 'ChatListItems',
54
54
  props: chatListItemsProps,
55
- emits: ['chat-select'],
56
- setup(props, { slots, emit }) {
55
+ setup(props, { slots }) {
56
+ var _a;
57
+ const UChat = inject(chatInjectionKey, null);
57
58
  const { mergedClsPrefixRef } = useConfig(props);
58
- const themeRef = useTheme('Chat', '-chat', style, chatLight, props, mergedClsPrefixRef);
59
+ const themeRef = (_a = UChat === null || UChat === void 0 ? void 0 : UChat.mergedThemeRef) !== null && _a !== void 0 ? _a : useTheme('Chat', '-chat', style, chatLight, props, mergedClsPrefixRef);
59
60
  const { localeRef } = useLocale('Chat');
60
61
  const cssVarsRef = computed(() => {
61
62
  const { common: { cubicBezierEaseInOut, brandPrimary500, staticGreen, staticRed, textPrimary, textSecondary, textTertiary }, self: { backgroundColor, borderColor, sidebarBackgroundColor, sidebarBorderColor, sidebarItemBackgroundColor, sidebarItemBackgroundColorHover, sidebarItemBackgroundColorSelected, sidebarItemTextColor, sidebarItemTextColorSelected, sidebarItemSubtitleColor, sidebarItemTimeColor, unreadNotificationBackgroundColor, borderRadius } } = themeRef.value;
@@ -86,7 +87,6 @@ export default defineComponent({
86
87
  const mergedTypingTextRef = computed(() => { var _a; return (_a = props.typingText) !== null && _a !== void 0 ? _a : localeRef.value.typingText; });
87
88
  const handleChatSelect = (chatId) => {
88
89
  var _a;
89
- emit('chat-select', chatId);
90
90
  (_a = props.onChatSelect) === null || _a === void 0 ? void 0 : _a.call(props, chatId);
91
91
  };
92
92
  const renderChatItem = (item) => {
@@ -101,7 +101,7 @@ export default defineComponent({
101
101
  `${mergedClsPrefixRef.value}-chat-sidebar__item--selected`,
102
102
  isTyping && `${mergedClsPrefixRef.value}-chat-sidebar__item--typing`
103
103
  ] }, {
104
- prefix: () => (h(UAvatar, Object.assign({ size: "medium", src: typeof item.avatar === 'string' ? item.avatar : undefined }, props.avatarProps), {
104
+ prefix: () => (h(UAvatar, Object.assign({ size: "medium", src: typeof item.avatar === 'string' ? item.avatar : undefined }, props.avatarProps, { theme: themeRef.value.peers.Avatar, themeOverrides: themeRef.value.peerOverrides.Avatar }), {
105
105
  default: () => {
106
106
  var _a;
107
107
  return typeof item.avatar === 'function'
@@ -141,13 +141,14 @@ export default defineComponent({
141
141
  statusIconMapper[item.messageStatus] ? (h(UIcon, { size: 16, component: statusIconMapper[item.messageStatus], class: [
142
142
  `${mergedClsPrefixRef.value}-chat-sidebar__item-status-icon`,
143
143
  `${mergedClsPrefixRef.value}-chat-sidebar__item-status-icon--${item.messageStatus}`
144
- ] })) : null),
145
- !lastMessageIsOwn && hasUnreadIncoming && (h(UBadge, Object.assign({ value: displayUnreadCount }, props.badgeProps))))));
144
+ ], theme: themeRef.value.peers.Icon, themeOverrides: themeRef.value.peerOverrides.Icon })) : null),
145
+ !lastMessageIsOwn && hasUnreadIncoming && (h(UBadge, Object.assign({ value: displayUnreadCount }, props.badgeProps, { theme: themeRef.value.peers.Badge, themeOverrides: themeRef.value.peerOverrides.Badge }))))));
146
146
  }
147
147
  }));
148
148
  };
149
149
  return {
150
150
  mergedClsPrefixRef,
151
+ mergedTheme: themeRef,
151
152
  renderChatItem,
152
153
  cssVars: cssVarsRef,
153
154
  themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass,
@@ -161,16 +162,16 @@ export default defineComponent({
161
162
  const content = (() => {
162
163
  var _a;
163
164
  if (this.loading) {
164
- return (h(UList, { loading: true }, {
165
+ return (h(UList, { loading: true, theme: this.mergedTheme.peers.List, themeOverrides: this.mergedTheme.peerOverrides.List }, {
165
166
  default: () => Array.from({ length: this.loadingCount || 10 }).map((_, index) => (h(UListItem, { key: index, avatar: { icon: PersonOutline }, description: { text: 'Loading...' }, header: { text: 'Loading...' } })))
166
167
  }));
167
168
  }
168
169
  if ((_a = this.chatItems) === null || _a === void 0 ? void 0 : _a.length) {
169
- return (h(UList, { showIcon: false }, {
170
+ return (h(UList, { showIcon: false, theme: this.mergedTheme.peers.List, themeOverrides: this.mergedTheme.peerOverrides.List }, {
170
171
  default: () => { var _a; return (_a = this.chatItems) === null || _a === void 0 ? void 0 : _a.map((item) => renderChatItem(item)); }
171
172
  }));
172
173
  }
173
- return h(UEmpty, Object.assign({}, this.emptyProps));
174
+ return (h(UEmpty, Object.assign({}, this.emptyProps, { theme: this.mergedTheme.peers.Empty, themeOverrides: this.mergedTheme.peerOverrides.Empty })));
174
175
  })();
175
176
  return (h("div", { class: [`${mergedClsPrefixRef}-chat`, this.themeClass], style: this.cssVars },
176
177
  h("div", { class: `${mergedClsPrefixRef}-chat-sidebar`, style: {