@medipha/chat 1.0.31 → 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 }) {
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", {
@@ -9889,7 +9889,14 @@ function Bm({ searchTerm: e, onSearchTermChange: t, activeFilter: n, onActiveFil
9889
9889
  children: /* @__PURE__ */ w(at, { "aria-hidden": "true" })
9890
9890
  }) : null
9891
9891
  ]
9892
- }), /* @__PURE__ */ w(N, {
9892
+ }), a ? /* @__PURE__ */ w("button", {
9893
+ className: "conversation-icon-button",
9894
+ type: "button",
9895
+ "aria-label": "Tạo cuộc trò chuyện",
9896
+ title: "Tạo cuộc trò chuyện",
9897
+ onClick: i,
9898
+ children: /* @__PURE__ */ w(xr, {})
9899
+ }) : /* @__PURE__ */ w(N, {
9893
9900
  title: "Tạo cuộc trò chuyện",
9894
9901
  children: /* @__PURE__ */ w("button", {
9895
9902
  className: "conversation-icon-button",
@@ -10273,15 +10280,15 @@ function oh(e, t) {
10273
10280
  let n = Number(e.unreadCount ?? 0);
10274
10281
  return n > 0 ? n : 0;
10275
10282
  }
10276
- function sh({ headerAction: e, footerAction: t, isCompact: n = !1 } = {}) {
10277
- 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(() => {
10278
- let e = ua(h.trim());
10279
- 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));
10280
10287
  }, [
10281
- g,
10288
+ _,
10289
+ c,
10282
10290
  s,
10283
- o,
10284
- h
10291
+ g
10285
10292
  ]);
10286
10293
  return /* @__PURE__ */ T("aside", {
10287
10294
  className: "conversation-sidebar",
@@ -10289,37 +10296,38 @@ function sh({ headerAction: e, footerAction: t, isCompact: n = !1 } = {}) {
10289
10296
  children: [
10290
10297
  /* @__PURE__ */ w(Im, { trailingAction: e }),
10291
10298
  /* @__PURE__ */ w(Bm, {
10292
- searchTerm: p,
10293
- onSearchTermChange: m,
10294
- activeFilter: g,
10295
- onActiveFilterChange: _,
10296
- onOpenCreate: () => b(!0)
10299
+ searchTerm: m,
10300
+ onSearchTermChange: h,
10301
+ activeFilter: _,
10302
+ onActiveFilterChange: v,
10303
+ onOpenCreate: () => S(!0),
10304
+ disableTooltip: r
10297
10305
  }),
10298
10306
  /* @__PURE__ */ w(th, {
10299
- conversations: S,
10300
- isLoading: c,
10301
- error: l,
10302
- currentUserId: o,
10303
- activeConversationId: r,
10307
+ conversations: C,
10308
+ isLoading: l,
10309
+ error: u,
10310
+ currentUserId: s,
10311
+ activeConversationId: i,
10304
10312
  isCompact: n,
10305
- buildConversationPath: i,
10313
+ buildConversationPath: a,
10306
10314
  onSelectConversation: (e) => {
10307
10315
  let t = $r(e);
10308
- t && a(String(t), { conversation: e });
10316
+ t && o(String(t), { conversation: e });
10309
10317
  },
10310
- onTogglePin: d,
10311
- onClearConversation: f
10318
+ onTogglePin: f,
10319
+ onClearConversation: p
10312
10320
  }),
10313
10321
  t ? /* @__PURE__ */ w("div", {
10314
10322
  className: "conversation-sidebar-footer",
10315
10323
  children: t
10316
10324
  }) : null,
10317
- v ? /* @__PURE__ */ w(Fm, {
10318
- currentUserId: o,
10319
- onClose: () => b(!1),
10325
+ b ? /* @__PURE__ */ w(Fm, {
10326
+ currentUserId: s,
10327
+ onClose: () => S(!1),
10320
10328
  onCreated: async (e) => {
10321
10329
  let t = $r(e);
10322
- b(!1), t && (await u().catch(() => {}), a(t, { conversation: e }));
10330
+ S(!1), t && (await d().catch(() => {}), o(t, { conversation: e }));
10323
10331
  }
10324
10332
  }) : null
10325
10333
  ]
@@ -75201,6 +75209,7 @@ function r8({ isWindowVisible: e, isExpanded: t, onToggleExpand: n, onOpenFullPa
75201
75209
  return /* @__PURE__ */ T(C, { children: [
75202
75210
  /* @__PURE__ */ w(sh, {
75203
75211
  isCompact: !t,
75212
+ disableTooltips: !0,
75204
75213
  headerAction: /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w("button", {
75205
75214
  type: "button",
75206
75215
  className: "conversation-widget-expand",
@@ -75260,24 +75269,35 @@ function i8(e) {
75260
75269
  return e + (n > 0 ? n : 0);
75261
75270
  }, 0);
75262
75271
  }
75263
- function a8(e) {
75264
- 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;
75265
75275
  return h(() => {
75266
75276
  n?.(s);
75267
75277
  }, [s, n]), h(() => {
75268
- o?.(d);
75269
- }, [d, o]), h(() => {
75278
+ o?.(m);
75279
+ }, [m, o]), h(() => {
75270
75280
  r?.(l);
75271
- }, [l, r]), /* @__PURE__ */ w(e8, {
75281
+ }, [l, r]), h(() => () => {
75282
+ p.current && clearTimeout(p.current);
75283
+ }, []), /* @__PURE__ */ w(e8, {
75272
75284
  runtimeProps: e,
75273
- rootClassName: `med-chat-widget${l ? " is-rail-expanded" : ""}`,
75285
+ rootClassName: `med-chat-widget${g ? " is-rail-expanded" : ""}${d ? " is-rail-closing" : ""}`,
75274
75286
  children: /* @__PURE__ */ w(n8, {
75275
75287
  activeConversationId: s,
75276
75288
  onActiveConversationIdChange: c,
75277
75289
  children: /* @__PURE__ */ w(r8, {
75278
75290
  isWindowVisible: t,
75279
- isExpanded: l,
75280
- 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
+ },
75281
75301
  onOpenFullPage: i ? () => i(s) : void 0,
75282
75302
  onOpenAllConversations: i ? () => i(void 0) : void 0,
75283
75303
  onRequestClose: a
@@ -75286,4 +75306,4 @@ function a8(e) {
75286
75306
  });
75287
75307
  }
75288
75308
  //#endregion
75289
- 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,9 +5,7 @@ interface SidebarFilterProps {
5
5
  activeFilter: SidebarConversationFilter;
6
6
  onActiveFilterChange: (filter: SidebarConversationFilter) => void;
7
7
  onOpenCreate: () => void;
8
+ disableTooltip?: boolean;
8
9
  }
9
- /** Sidebar search input, "Tạo cuộc trò chuyện" entry point, and the Tất cả/Chưa đọc/Tích
10
- * xanh filter row. Controlled — the actual conversation list it filters lives in the
11
- * sibling sidbar-conversation-list component, driven from the same state one level up. */
12
- export declare function SidebarFilter({ searchTerm, onSearchTermChange, activeFilter, onActiveFilterChange, onOpenCreate, }: 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;
13
11
  export {};