@medipha/chat 1.0.32 → 1.0.33

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/dist/index.js CHANGED
@@ -9866,7 +9866,7 @@ var zm = [
9866
9866
  label: "Tích xanh"
9867
9867
  }
9868
9868
  ];
9869
- function Bm({ searchTerm: e, onSearchTermChange: t, activeFilter: n, onActiveFilterChange: r, onOpenCreate: i, isCompact: a = !1 }) {
9869
+ function Bm({ searchTerm: e, onSearchTermChange: t, activeFilter: n, onActiveFilterChange: r, onOpenCreate: i, disableTooltip: a = !1 }) {
9870
9870
  return /* @__PURE__ */ T("div", {
9871
9871
  className: "conversation-search-panel",
9872
9872
  children: [/* @__PURE__ */ T("div", {
@@ -10280,15 +10280,15 @@ function oh(e, t) {
10280
10280
  let n = Number(e.unreadCount ?? 0);
10281
10281
  return n > 0 ? n : 0;
10282
10282
  }
10283
- function sh({ headerAction: e, footerAction: t, isCompact: n = !1 } = {}) {
10284
- let { activeConversationId: r, buildConversationPath: i, openConversation: a } = Nr(), o = Ur((e) => e.userId), { conversations: s, isLoading: c, error: l, reload: u, togglePin: d, clearConversationForUser: f } = ih(), [p, m] = x(""), h = Pr(p, 450), [g, _] = x("all"), [v, b] = x(!1), S = y(() => {
10285
- let e = ua(h.trim());
10286
- return s.filter((t) => g === "unread" && oh(t, o) === 0 || g === "verified" && !ah(t) ? !1 : !e || ua(oi(t, o)).includes(e));
10283
+ function sh({ headerAction: e, footerAction: t, isCompact: n = !1, disableTooltips: r = !1 } = {}) {
10284
+ let { activeConversationId: i, buildConversationPath: a, openConversation: o } = Nr(), s = Ur((e) => e.userId), { conversations: c, isLoading: l, error: u, reload: d, togglePin: f, clearConversationForUser: p } = ih(), [m, h] = x(""), g = Pr(m, 450), [_, v] = x("all"), [b, S] = x(!1), C = y(() => {
10285
+ let e = ua(g.trim());
10286
+ return c.filter((t) => _ === "unread" && oh(t, s) === 0 || _ === "verified" && !ah(t) ? !1 : !e || ua(oi(t, s)).includes(e));
10287
10287
  }, [
10288
- g,
10288
+ _,
10289
+ c,
10289
10290
  s,
10290
- o,
10291
- h
10291
+ g
10292
10292
  ]);
10293
10293
  return /* @__PURE__ */ T("aside", {
10294
10294
  className: "conversation-sidebar",
@@ -10296,38 +10296,38 @@ function sh({ headerAction: e, footerAction: t, isCompact: n = !1 } = {}) {
10296
10296
  children: [
10297
10297
  /* @__PURE__ */ w(Im, { trailingAction: e }),
10298
10298
  /* @__PURE__ */ w(Bm, {
10299
- searchTerm: p,
10300
- onSearchTermChange: m,
10301
- activeFilter: g,
10302
- onActiveFilterChange: _,
10303
- onOpenCreate: () => b(!0),
10304
- isCompact: n
10299
+ searchTerm: m,
10300
+ onSearchTermChange: h,
10301
+ activeFilter: _,
10302
+ onActiveFilterChange: v,
10303
+ onOpenCreate: () => S(!0),
10304
+ disableTooltip: r
10305
10305
  }),
10306
10306
  /* @__PURE__ */ w(th, {
10307
- conversations: S,
10308
- isLoading: c,
10309
- error: l,
10310
- currentUserId: o,
10311
- activeConversationId: r,
10307
+ conversations: C,
10308
+ isLoading: l,
10309
+ error: u,
10310
+ currentUserId: s,
10311
+ activeConversationId: i,
10312
10312
  isCompact: n,
10313
- buildConversationPath: i,
10313
+ buildConversationPath: a,
10314
10314
  onSelectConversation: (e) => {
10315
10315
  let t = $r(e);
10316
- t && a(String(t), { conversation: e });
10316
+ t && o(String(t), { conversation: e });
10317
10317
  },
10318
- onTogglePin: d,
10319
- onClearConversation: f
10318
+ onTogglePin: f,
10319
+ onClearConversation: p
10320
10320
  }),
10321
10321
  t ? /* @__PURE__ */ w("div", {
10322
10322
  className: "conversation-sidebar-footer",
10323
10323
  children: t
10324
10324
  }) : null,
10325
- v ? /* @__PURE__ */ w(Fm, {
10326
- currentUserId: o,
10327
- onClose: () => b(!1),
10325
+ b ? /* @__PURE__ */ w(Fm, {
10326
+ currentUserId: s,
10327
+ onClose: () => S(!1),
10328
10328
  onCreated: async (e) => {
10329
10329
  let t = $r(e);
10330
- b(!1), t && (await u().catch(() => {}), a(t, { conversation: e }));
10330
+ S(!1), t && (await d().catch(() => {}), o(t, { conversation: e }));
10331
10331
  }
10332
10332
  }) : null
10333
10333
  ]
@@ -75209,6 +75209,7 @@ function r8({ isWindowVisible: e, isExpanded: t, onToggleExpand: n, onOpenFullPa
75209
75209
  return /* @__PURE__ */ T(C, { children: [
75210
75210
  /* @__PURE__ */ w(sh, {
75211
75211
  isCompact: !t,
75212
+ disableTooltips: !0,
75212
75213
  headerAction: /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w("button", {
75213
75214
  type: "button",
75214
75215
  className: "conversation-widget-expand",
@@ -75268,24 +75269,35 @@ function i8(e) {
75268
75269
  return e + (n > 0 ? n : 0);
75269
75270
  }, 0);
75270
75271
  }
75271
- function a8(e) {
75272
- let { isOpen: t = !0, onActiveConversationChange: n, onExpandChange: r, onOpenFullPage: i, onRequestClose: a, onUnreadTotalChange: o } = e, [s, c] = x(void 0), [l, u] = x(!1), d = gm((e) => i8(e.conversations));
75272
+ var a8 = 200;
75273
+ function o8(e) {
75274
+ let { isOpen: t = !0, onActiveConversationChange: n, onExpandChange: r, onOpenFullPage: i, onRequestClose: a, onUnreadTotalChange: o } = e, [s, c] = x(void 0), [l, u] = x(!1), [d, f] = x(!1), p = b(null), m = gm((e) => i8(e.conversations)), g = l || d;
75273
75275
  return h(() => {
75274
75276
  n?.(s);
75275
75277
  }, [s, n]), h(() => {
75276
- o?.(d);
75277
- }, [d, o]), h(() => {
75278
+ o?.(m);
75279
+ }, [m, o]), h(() => {
75278
75280
  r?.(l);
75279
- }, [l, r]), /* @__PURE__ */ w(e8, {
75281
+ }, [l, r]), h(() => () => {
75282
+ p.current && clearTimeout(p.current);
75283
+ }, []), /* @__PURE__ */ w(e8, {
75280
75284
  runtimeProps: e,
75281
- rootClassName: `med-chat-widget${l ? " is-rail-expanded" : ""}`,
75285
+ rootClassName: `med-chat-widget${g ? " is-rail-expanded" : ""}${d ? " is-rail-closing" : ""}`,
75282
75286
  children: /* @__PURE__ */ w(n8, {
75283
75287
  activeConversationId: s,
75284
75288
  onActiveConversationIdChange: c,
75285
75289
  children: /* @__PURE__ */ w(r8, {
75286
75290
  isWindowVisible: t,
75287
- isExpanded: l,
75288
- onToggleExpand: () => u((e) => !e),
75291
+ isExpanded: g,
75292
+ onToggleExpand: () => {
75293
+ if (p.current &&= (clearTimeout(p.current), null), !l) {
75294
+ f(!1), u(!0);
75295
+ return;
75296
+ }
75297
+ f(!0), p.current = setTimeout(() => {
75298
+ u(!1), f(!1), p.current = null;
75299
+ }, a8);
75300
+ },
75289
75301
  onOpenFullPage: i ? () => i(s) : void 0,
75290
75302
  onOpenAllConversations: i ? () => i(void 0) : void 0,
75291
75303
  onRequestClose: a
@@ -75294,4 +75306,4 @@ function a8(e) {
75294
75306
  });
75295
75307
  }
75296
75308
  //#endregion
75297
- export { t8 as ChatModule, a8 as ChatWidget };
75309
+ export { t8 as ChatModule, o8 as ChatWidget };
@@ -4,9 +4,10 @@ interface ConversationSidebarProps {
4
4
  footerAction?: ReactNode;
5
5
  /** Avatar-only rail: rows carry no visible name, so each one needs a hover title. */
6
6
  isCompact?: boolean;
7
+ disableTooltips?: boolean;
7
8
  }
8
9
  /** Left rail listing conversations with search, unread filter, and creation entry. Owns the
9
10
  * search/filter state shared by its filter row and list, and the conversation feed itself —
10
11
  * its 3 sub-parts (header-infor, filter, conversation-list) are otherwise independent. */
11
- export declare function ConversationSidebar({ headerAction, footerAction, isCompact, }?: ConversationSidebarProps): import("react/jsx-runtime").JSX.Element;
12
+ export declare function ConversationSidebar({ headerAction, footerAction, isCompact, disableTooltips, }?: ConversationSidebarProps): import("react/jsx-runtime").JSX.Element;
12
13
  export {};
@@ -5,7 +5,7 @@ interface SidebarFilterProps {
5
5
  activeFilter: SidebarConversationFilter;
6
6
  onActiveFilterChange: (filter: SidebarConversationFilter) => void;
7
7
  onOpenCreate: () => void;
8
- isCompact?: boolean;
8
+ disableTooltip?: boolean;
9
9
  }
10
- export declare function SidebarFilter({ searchTerm, onSearchTermChange, activeFilter, onActiveFilterChange, onOpenCreate, isCompact, }: SidebarFilterProps): import("react/jsx-runtime").JSX.Element;
10
+ export declare function SidebarFilter({ searchTerm, onSearchTermChange, activeFilter, onActiveFilterChange, onOpenCreate, disableTooltip, }: SidebarFilterProps): import("react/jsx-runtime").JSX.Element;
11
11
  export {};