@automattic/agenttic-ui 0.1.63 → 0.1.64

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 +1 @@
1
- {"version":3,"file":"Messages.d.ts","sourceRoot":"","sources":["../../../src/components/chat/Messages.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,aAAa,CAAC;AAS1D,UAAU,aAAa;IACtB,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B,eAAe,CAAC,EAAE,aAAa,CAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAE,CAAC;IACxD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;CACpC;AAED,wBAAgB,QAAQ,CAAE,EACzB,QAAQ,EACR,YAAY,EACZ,KAAK,EACL,SAAS,EACT,eAAe,EACf,eAAe,EACf,gBAAwB,GACxB,EAAE,aAAa,kDAqGf"}
1
+ {"version":3,"file":"Messages.d.ts","sourceRoot":"","sources":["../../../src/components/chat/Messages.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,aAAa,CAAC;AAS1D,UAAU,aAAa;IACtB,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B,eAAe,CAAC,EAAE,aAAa,CAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAE,CAAC;IACxD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;CACpC;AAED,wBAAgB,QAAQ,CAAE,EACzB,QAAQ,EACR,YAAY,EACZ,KAAK,EACL,SAAS,EACT,eAAe,EACf,eAAe,EACf,gBAAwB,GACxB,EAAE,aAAa,kDAuGf"}
package/dist/index.js CHANGED
@@ -1669,9 +1669,9 @@ function dr(t, e) {
1669
1669
  const o = (i = c.locale_data) == null ? void 0 : i.messages;
1670
1670
  if (o) {
1671
1671
  const n = "", s = Object.fromEntries(
1672
- Object.entries(o).map(([l, d]) => {
1672
+ Object.entries(o).map(([d, l]) => {
1673
1673
  var h;
1674
- if (l === "")
1674
+ if (d === "")
1675
1675
  return [
1676
1676
  "",
1677
1677
  {
@@ -1680,8 +1680,8 @@ function dr(t, e) {
1680
1680
  lang: ((h = o[""]) == null ? void 0 : h.lang) || t
1681
1681
  }
1682
1682
  ];
1683
- const u = l.indexOf(n);
1684
- return [u > -1 ? l.slice(u + 1) : l, d];
1683
+ const u = d.indexOf(n);
1684
+ return [u > -1 ? d.slice(u + 1) : d, l];
1685
1685
  })
1686
1686
  );
1687
1687
  kt(s, r);
@@ -1720,7 +1720,7 @@ function Oa(t) {
1720
1720
  i(e);
1721
1721
  }, [e]), s = v(() => {
1722
1722
  i(
1723
- (l) => l === "collapsed" ? "compact" : "collapsed"
1723
+ (d) => d === "collapsed" ? "compact" : "collapsed"
1724
1724
  );
1725
1725
  }, []);
1726
1726
  return {
@@ -1742,12 +1742,12 @@ function Na({
1742
1742
  floatingChatState: o,
1743
1743
  disabled: n = !1
1744
1744
  }) {
1745
- const s = E(null), l = v(() => {
1745
+ const s = E(null), d = v(() => {
1746
1746
  e(""), s.current && (s.current.style.height = "auto", setTimeout(() => {
1747
1747
  var g;
1748
1748
  (g = s.current) == null || g.focus();
1749
1749
  }, 100));
1750
- }, [e]), d = v(() => {
1750
+ }, [e]), l = v(() => {
1751
1751
  const g = s.current;
1752
1752
  if (!g)
1753
1753
  return;
@@ -1759,19 +1759,19 @@ function Na({
1759
1759
  )}px`;
1760
1760
  }, []), u = v(
1761
1761
  (g) => {
1762
- g.key === "Enter" && !g.shiftKey && !i && !c && !n && (g.preventDefault(), r(t.trim()), l());
1762
+ g.key === "Enter" && !g.shiftKey && !i && !c && !n && (g.preventDefault(), r(t.trim()), d());
1763
1763
  },
1764
- [t, i, c, r, l, n]
1764
+ [t, i, c, r, d, n]
1765
1765
  );
1766
1766
  return O(() => {
1767
- d();
1768
- }, [t, o, d]), {
1767
+ l();
1768
+ }, [t, o, l]), {
1769
1769
  value: t,
1770
1770
  setValue: e,
1771
- clear: l,
1771
+ clear: d,
1772
1772
  textareaRef: s,
1773
1773
  handleKeyDown: u,
1774
- adjustHeight: d
1774
+ adjustHeight: l
1775
1775
  };
1776
1776
  }
1777
1777
  function gr() {
@@ -1891,13 +1891,13 @@ const hr = "button-module_button", fr = "button-module_pressed", vr = "button-mo
1891
1891
  children: o,
1892
1892
  asChild: n = !1,
1893
1893
  pressed: s = !1,
1894
- ...l
1895
- }, d) {
1894
+ ...d
1895
+ }, l) {
1896
1896
  const u = n ? yn : "button", g = !!c, h = i || (g && !o ? "icon" : void 0);
1897
1897
  return /* @__PURE__ */ w(
1898
1898
  u,
1899
1899
  {
1900
- ref: d,
1900
+ ref: l,
1901
1901
  "data-slot": "button",
1902
1902
  className: ne(
1903
1903
  Be.button,
@@ -1908,7 +1908,7 @@ const hr = "button-module_button", fr = "button-module_pressed", vr = "button-mo
1908
1908
  e
1909
1909
  ),
1910
1910
  "aria-pressed": s,
1911
- ...l,
1911
+ ...d,
1912
1912
  children: [
1913
1913
  c,
1914
1914
  o
@@ -2120,8 +2120,8 @@ function ft({
2120
2120
  placeholder: o = $("Ask anything", "a8c-agenttic"),
2121
2121
  isProcessing: n,
2122
2122
  onBlur: s,
2123
- onFocus: l,
2124
- onClick: d,
2123
+ onFocus: d,
2124
+ onClick: l,
2125
2125
  fromCompact: u = !1,
2126
2126
  onExpand: g,
2127
2127
  showExpandButton: h = !0,
@@ -2233,8 +2233,8 @@ function ft({
2233
2233
  onChange: (M) => e(M.target.value),
2234
2234
  onKeyDown: Z,
2235
2235
  onBlur: s,
2236
- onFocus: l,
2237
- onClick: d,
2236
+ onFocus: d,
2237
+ onClick: l,
2238
2238
  placeholder: x ? "" : Q,
2239
2239
  rows: 1,
2240
2240
  "aria-label": $("Chat input", "a8c-agenttic")
@@ -2283,14 +2283,14 @@ const Vr = "Suggestions-module_container", Br = "Suggestions-module_vertical", H
2283
2283
  onMouseLeave: n,
2284
2284
  translateY: s = "-100%"
2285
2285
  }) => {
2286
- const { variant: l } = we(), d = Ge(
2287
- () => l === "floating" ? e == null ? void 0 : e.slice(0, 3) : e,
2288
- [e, l]
2286
+ const { variant: d } = we(), l = Ge(
2287
+ () => d === "floating" ? e == null ? void 0 : e.slice(0, 3) : e,
2288
+ [e, d]
2289
2289
  ), u = async (g, h) => {
2290
2290
  let N = !0;
2291
2291
  g.action && (N = await g.action()), N && r && g.prompt && r(g, h);
2292
2292
  };
2293
- return !d || d.length === 0 ? null : /* @__PURE__ */ a(Ye, { children: c && /* @__PURE__ */ a(
2293
+ return !l || l.length === 0 ? null : /* @__PURE__ */ a(Ye, { children: c && /* @__PURE__ */ a(
2294
2294
  ee.div,
2295
2295
  {
2296
2296
  "data-slot": "suggestions",
@@ -2305,7 +2305,7 @@ const Vr = "Suggestions-module_container", Br = "Suggestions-module_vertical", H
2305
2305
  transition: rt,
2306
2306
  onMouseEnter: o,
2307
2307
  onMouseLeave: n,
2308
- children: d.map(
2308
+ children: l.map(
2309
2309
  (g, h) => /* @__PURE__ */ a(
2310
2310
  ee.div,
2311
2311
  {
@@ -2322,7 +2322,7 @@ const Vr = "Suggestions-module_container", Br = "Suggestions-module_vertical", H
2322
2322
  onClick: (N) => {
2323
2323
  N.stopPropagation(), u(
2324
2324
  g,
2325
- d
2325
+ l
2326
2326
  );
2327
2327
  },
2328
2328
  variant: "outline",
@@ -2344,8 +2344,8 @@ function Zr() {
2344
2344
  }, []), r = v(
2345
2345
  (o, n, s) => {
2346
2346
  e(o);
2347
- const l = setTimeout(n, s);
2348
- return t.current.set(o, l), l;
2347
+ const d = setTimeout(n, s);
2348
+ return t.current.set(o, d), d;
2349
2349
  },
2350
2350
  [e]
2351
2351
  ), i = v(() => {
@@ -2370,8 +2370,8 @@ function Ua({
2370
2370
  placeholder: o,
2371
2371
  isProcessing: n,
2372
2372
  onBlur: s,
2373
- onFocus: l,
2374
- onExpand: d,
2373
+ onFocus: d,
2374
+ onExpand: l,
2375
2375
  showExpandButton: u = !0,
2376
2376
  focusOnMount: g = !1,
2377
2377
  customActions: h,
@@ -2391,8 +2391,8 @@ function Ua({
2391
2391
  zr
2392
2392
  );
2393
2393
  }, [m]), U = v(() => {
2394
- _ && d && !t && d();
2395
- }, [_, d, t]);
2394
+ _ && l && !t && l();
2395
+ }, [_, l, t]);
2396
2396
  return O(() => {
2397
2397
  if (j(), t) {
2398
2398
  P(!1);
@@ -2422,9 +2422,9 @@ function Ua({
2422
2422
  placeholder: o,
2423
2423
  isProcessing: n,
2424
2424
  onBlur: s,
2425
- onFocus: l,
2425
+ onFocus: d,
2426
2426
  onClick: U,
2427
- onExpand: d,
2427
+ onExpand: l,
2428
2428
  showExpandButton: u,
2429
2429
  focusOnMount: g,
2430
2430
  customActions: h,
@@ -2489,8 +2489,8 @@ function Va({
2489
2489
  variant: o = "floating",
2490
2490
  triggerIcon: n,
2491
2491
  placeholder: s,
2492
- notice: l,
2493
- onOpen: d,
2492
+ notice: d,
2493
+ onOpen: l,
2494
2494
  onExpand: u,
2495
2495
  onClose: g,
2496
2496
  onStop: h,
@@ -2577,8 +2577,8 @@ function Va({
2577
2577
  },
2578
2578
  [k, c, y, L]
2579
2579
  ), yt = v(() => {
2580
- se.current = !0, f.open(), d == null || d(), u == null || u();
2581
- }, [f, d, u]), Ue = v(() => {
2580
+ se.current = !0, f.open(), l == null || l(), u == null || u();
2581
+ }, [f, l, u]), Ue = v(() => {
2582
2582
  var B, te, ae;
2583
2583
  const I = (te = (B = ye.current) == null ? void 0 : B.ownerDocument) == null ? void 0 : te.activeElement;
2584
2584
  return !(I && ((ae = ye.current) != null && ae.contains(I)) || G.trim());
@@ -2679,7 +2679,7 @@ function Va({
2679
2679
  ),
2680
2680
  dismissible: !1,
2681
2681
  status: "error"
2682
- } : l, Tt = {
2682
+ } : d, Tt = {
2683
2683
  // Core data
2684
2684
  messages: e,
2685
2685
  isProcessing: r,
@@ -2893,9 +2893,9 @@ function no({
2893
2893
  }) {
2894
2894
  const r = E(0), i = E(!0), c = E(!0), o = E(0), n = E(null), s = v(() => {
2895
2895
  cancelAnimationFrame(o.current), o.current = 0, n.current = null;
2896
- }, []), l = v(() => {
2896
+ }, []), d = v(() => {
2897
2897
  s();
2898
- const d = () => {
2898
+ const l = () => {
2899
2899
  const u = t.current;
2900
2900
  if (!u || !c.current) {
2901
2901
  s();
@@ -2915,47 +2915,47 @@ function no({
2915
2915
  u.scrollTop = g, s();
2916
2916
  return;
2917
2917
  }
2918
- u.scrollTop += Math.ceil(h * to), n.current = u.scrollTop, o.current = requestAnimationFrame(d);
2918
+ u.scrollTop += Math.ceil(h * to), n.current = u.scrollTop, o.current = requestAnimationFrame(l);
2919
2919
  };
2920
- o.current = requestAnimationFrame(d);
2920
+ o.current = requestAnimationFrame(l);
2921
2921
  }, [t, s]);
2922
2922
  O(() => {
2923
- const d = t.current;
2924
- if (!d)
2923
+ const l = t.current;
2924
+ if (!l)
2925
2925
  return;
2926
2926
  const u = () => {
2927
2927
  c.current = !1, s();
2928
2928
  };
2929
- return d.addEventListener("wheel", u, {
2929
+ return l.addEventListener("wheel", u, {
2930
2930
  passive: !0
2931
- }), d.addEventListener("touchmove", u, {
2931
+ }), l.addEventListener("touchmove", u, {
2932
2932
  passive: !0
2933
2933
  }), () => {
2934
- d.removeEventListener("wheel", u), d.removeEventListener("touchmove", u);
2934
+ l.removeEventListener("wheel", u), l.removeEventListener("touchmove", u);
2935
2935
  };
2936
2936
  }, [t, s]), O(() => s, [s]), O(() => {
2937
- const d = t.current;
2938
- if (!d || e.length === 0) {
2937
+ const l = t.current;
2938
+ if (!l || e.length === 0) {
2939
2939
  r.current = e.length;
2940
2940
  return;
2941
2941
  }
2942
2942
  const u = e.length > r.current, g = e[e.length - 1];
2943
2943
  if (i.current) {
2944
- d.scrollTop = d.scrollHeight, i.current = !1, r.current = e.length;
2944
+ l.scrollTop = l.scrollHeight, i.current = !1, r.current = e.length;
2945
2945
  return;
2946
2946
  }
2947
2947
  if (u && g.role === "user" && (c.current = !0, s()), !c.current) {
2948
2948
  r.current = e.length;
2949
2949
  return;
2950
2950
  }
2951
- g.role === "agent" ? o.current || l() : u && d.scrollTo({
2952
- top: d.scrollHeight,
2951
+ g.role === "agent" ? o.current || d() : u && l.scrollTo({
2952
+ top: l.scrollHeight,
2953
2953
  behavior: "smooth"
2954
2954
  }), r.current = e.length;
2955
2955
  }, [
2956
2956
  e,
2957
2957
  t,
2958
- l,
2958
+ d,
2959
2959
  s
2960
2960
  ]);
2961
2961
  }
@@ -3024,9 +3024,9 @@ const io = "Message-module_message", co = "Message-module_user", so = "Message-m
3024
3024
  if (n.type === "text" && n.text)
3025
3025
  return /* @__PURE__ */ a(r, { children: n.text }, s);
3026
3026
  if (n.type === "component" && n.component) {
3027
- const l = n.component;
3027
+ const d = n.component;
3028
3028
  return /* @__PURE__ */ a(
3029
- l,
3029
+ d,
3030
3030
  {
3031
3031
  ...n.componentProps || {}
3032
3032
  },
@@ -3113,15 +3113,15 @@ function Wa({
3113
3113
  thinkingMessage: o,
3114
3114
  messagesPosition: n = "top"
3115
3115
  }) {
3116
- const s = E(null), l = wo(t);
3117
- no({ scrollAreaRef: s, visibleMessages: l });
3118
- const d = l.length > 0 && l[l.length - 1].role === "agent", u = Ge(() => {
3119
- const h = l.filter(
3116
+ const s = E(null), d = wo(t);
3117
+ no({ scrollAreaRef: s, visibleMessages: d });
3118
+ const l = Ge(() => {
3119
+ const h = d.filter(
3120
3120
  (D) => D.role === "agent"
3121
3121
  );
3122
3122
  return h.length ? h[h.length - 1].content.filter((D) => D.type === "text").map((D) => D.text).join(" ") : "";
3123
- }, [l]), [g] = bn(u, 1e3);
3124
- return l.length === 0 && !e ? i ? /* @__PURE__ */ a(
3123
+ }, [d]), [u] = bn(l, 1e3), g = l !== u;
3124
+ return d.length === 0 && !e ? i ? /* @__PURE__ */ a(
3125
3125
  "div",
3126
3126
  {
3127
3127
  "data-slot": "messages",
@@ -3142,7 +3142,7 @@ function Wa({
3142
3142
  height: "1px",
3143
3143
  overflow: "hidden"
3144
3144
  },
3145
- children: g
3145
+ children: u
3146
3146
  }
3147
3147
  ),
3148
3148
  /* @__PURE__ */ a(
@@ -3155,7 +3155,7 @@ function Wa({
3155
3155
  ),
3156
3156
  ref: s,
3157
3157
  children: /* @__PURE__ */ w(Ye, { mode: "popLayout", children: [
3158
- l.map((h) => /* @__PURE__ */ a(
3158
+ d.map((h) => /* @__PURE__ */ a(
3159
3159
  mo,
3160
3160
  {
3161
3161
  message: h,
@@ -3163,7 +3163,7 @@ function Wa({
3163
3163
  },
3164
3164
  h.reactKey || h.id
3165
3165
  )),
3166
- e && !d && /* @__PURE__ */ a(bo, { content: o }),
3166
+ e && !g && /* @__PURE__ */ a(bo, { content: o }),
3167
3167
  r && /* @__PURE__ */ a(
3168
3168
  "div",
3169
3169
  {
@@ -3236,8 +3236,8 @@ function za({
3236
3236
  } = {}) {
3237
3237
  const {
3238
3238
  inputValue: s,
3239
- setInputValue: l,
3240
- handleSubmit: d,
3239
+ setInputValue: d,
3240
+ handleSubmit: l,
3241
3241
  handleKeyDown: u,
3242
3242
  textareaRef: g,
3243
3243
  placeholder: h,
@@ -3265,8 +3265,8 @@ function za({
3265
3265
  ft,
3266
3266
  {
3267
3267
  value: s,
3268
- onChange: l,
3269
- onSubmit: d,
3268
+ onChange: d,
3269
+ onSubmit: l,
3270
3270
  onKeyDown: m,
3271
3271
  onFocus: S,
3272
3272
  onBlur: P,
@@ -3297,8 +3297,8 @@ function Ga({
3297
3297
  inputValue: o,
3298
3298
  messages: n,
3299
3299
  variant: s,
3300
- emptyView: l
3301
- } = we(), d = v(
3300
+ emptyView: d
3301
+ } = we(), l = v(
3302
3302
  (u, g) => {
3303
3303
  try {
3304
3304
  const h = u.prompt ?? u.label;
@@ -3310,11 +3310,11 @@ function Ga({
3310
3310
  },
3311
3311
  [r, c]
3312
3312
  );
3313
- return o && !e || l && ["floating", "embedded"].includes(s) && n.length === 0 && !o ? null : /* @__PURE__ */ a(
3313
+ return o && !e || d && ["floating", "embedded"].includes(s) && n.length === 0 && !o ? null : /* @__PURE__ */ a(
3314
3314
  it,
3315
3315
  {
3316
3316
  suggestions: i,
3317
- onSubmit: d,
3317
+ onSubmit: l,
3318
3318
  className: t
3319
3319
  }
3320
3320
  );
@@ -3413,7 +3413,7 @@ function Ya({
3413
3413
  className: o,
3414
3414
  status: n
3415
3415
  }) {
3416
- const l = v(() => {
3416
+ const d = v(() => {
3417
3417
  if (ce.isValidElement(t))
3418
3418
  return t;
3419
3419
  if (t === !1 || t === null)
@@ -3442,14 +3442,14 @@ function Ya({
3442
3442
  ),
3443
3443
  children: [
3444
3444
  /* @__PURE__ */ w("div", { className: be.content, children: [
3445
- l && /* @__PURE__ */ a("div", { className: be.icon, children: l }),
3445
+ d && /* @__PURE__ */ a("div", { className: be.icon, children: d }),
3446
3446
  /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(
3447
3447
  ht,
3448
3448
  {
3449
3449
  allowedElements: ["p", "strong", "em", "a", "br"],
3450
3450
  unwrapDisallowed: !0,
3451
3451
  components: {
3452
- a: ({ node: d, ...u }) => /* @__PURE__ */ a(
3452
+ a: ({ node: l, ...u }) => /* @__PURE__ */ a(
3453
3453
  "a",
3454
3454
  {
3455
3455
  ...u,
@@ -3593,7 +3593,7 @@ function Vo({
3593
3593
  label: i,
3594
3594
  disabled: c
3595
3595
  } = {}) {
3596
- const [o, n] = z(!1), s = E(null), l = ce.useId(), d = () => {
3596
+ const [o, n] = z(!1), s = E(null), d = ce.useId(), l = () => {
3597
3597
  n((C) => !C);
3598
3598
  }, u = () => {
3599
3599
  n(!1);
@@ -3638,7 +3638,7 @@ function Vo({
3638
3638
  o && ((C = g.floating) != null && C.current) && ((y = (k = g.floating) == null ? void 0 : k.current) == null || y.focus());
3639
3639
  }, [o]);
3640
3640
  const N = (C) => {
3641
- (C.key === "Enter" || C.key === " ") && (C.preventDefault(), d());
3641
+ (C.key === "Enter" || C.key === " ") && (C.preventDefault(), l());
3642
3642
  }, D = i ?? "Input Toolbar";
3643
3643
  return /* @__PURE__ */ a("div", { ref: s, className: e, children: /* @__PURE__ */ w("div", { className: We.container, children: [
3644
3644
  /* @__PURE__ */ w(
@@ -3646,12 +3646,12 @@ function Vo({
3646
3646
  {
3647
3647
  ref: g.setReference,
3648
3648
  type: "button",
3649
- onClick: d,
3649
+ onClick: l,
3650
3650
  onKeyDown: N,
3651
3651
  className: We.button,
3652
3652
  "aria-expanded": o,
3653
3653
  "aria-haspopup": "true",
3654
- "aria-controls": o ? l : void 0,
3654
+ "aria-controls": o ? d : void 0,
3655
3655
  "aria-label": D,
3656
3656
  disabled: c,
3657
3657
  children: [
@@ -3684,7 +3684,7 @@ function Vo({
3684
3684
  "div",
3685
3685
  {
3686
3686
  ref: g.setFloating,
3687
- id: l,
3687
+ id: d,
3688
3688
  className: We.dropdown,
3689
3689
  role: "dialog",
3690
3690
  "aria-label": D,
@@ -3733,8 +3733,8 @@ function Ho({
3733
3733
  placeholder: o,
3734
3734
  isProcessing: n,
3735
3735
  onStop: s,
3736
- fromCompact: l = !1,
3737
- onExpand: d,
3736
+ fromCompact: d = !1,
3737
+ onExpand: l,
3738
3738
  disabled: u,
3739
3739
  notice: g,
3740
3740
  suggestions: h,
@@ -3788,8 +3788,8 @@ function Ho({
3788
3788
  placeholder: o,
3789
3789
  isProcessing: n,
3790
3790
  onStop: s,
3791
- fromCompact: l,
3792
- onExpand: d,
3791
+ fromCompact: d,
3792
+ onExpand: l,
3793
3793
  showExpandButton: !1,
3794
3794
  focusOnMount: D,
3795
3795
  customActions: C,
@@ -3810,8 +3810,8 @@ function Lt({
3810
3810
  onKeyDown: o,
3811
3811
  textareaRef: n,
3812
3812
  placeholder: s,
3813
- isProcessing: l,
3814
- onStop: d,
3813
+ isProcessing: d,
3814
+ onStop: l,
3815
3815
  fromCompact: u = !1,
3816
3816
  showHeader: g = !1,
3817
3817
  onClose: h,
@@ -3839,7 +3839,7 @@ function Lt({
3839
3839
  Wa,
3840
3840
  {
3841
3841
  messages: t,
3842
- isProcessing: l,
3842
+ isProcessing: d,
3843
3843
  error: e,
3844
3844
  emptyView: C,
3845
3845
  messageRenderer: _
@@ -3854,8 +3854,8 @@ function Lt({
3854
3854
  onKeyDown: o,
3855
3855
  textareaRef: n,
3856
3856
  placeholder: s,
3857
- isProcessing: l,
3858
- onStop: d,
3857
+ isProcessing: d,
3858
+ onStop: l,
3859
3859
  fromCompact: u,
3860
3860
  onExpand: N,
3861
3861
  notice: D,
@@ -3877,8 +3877,8 @@ function Gi({
3877
3877
  triggerIcon: o,
3878
3878
  placeholder: n = $("Ask anything", "a8c-agenttic"),
3879
3879
  notice: s,
3880
- onOpen: l,
3881
- onExpand: d,
3880
+ onOpen: d,
3881
+ onExpand: l,
3882
3882
  onClose: u,
3883
3883
  onStop: g,
3884
3884
  emptyView: h,
@@ -3901,15 +3901,15 @@ function Gi({
3901
3901
  value: S,
3902
3902
  setValue: P,
3903
3903
  onSubmit: async (b) => {
3904
- m.state !== "expanded" && (d == null || d()), m.setState("expanded"), await i(b);
3904
+ m.state !== "expanded" && (l == null || l()), m.setState("expanded"), await i(b);
3905
3905
  },
3906
3906
  isProcessing: e,
3907
3907
  floatingChatState: m.state
3908
3908
  }), [Q, re] = z(56), [q, de] = z(
3909
3909
  Ea
3910
3910
  ), me = E(null), M = E(null), G = E(null), Ne = q === "right" ? window.innerWidth - T.COMPACT_WIDTH - T.VIEWPORT_OFFSET * 2 : 0, f = at(Ne), se = at(0), pe = xt(), Ie = v(() => {
3911
- j.current = !0, m.open(), l == null || l(), d == null || d();
3912
- }, [m, l, d]), le = v(() => {
3911
+ j.current = !0, m.open(), d == null || d(), l == null || l();
3912
+ }, [m, d, l]), le = v(() => {
3913
3913
  var F, L, oe;
3914
3914
  const b = (L = (F = G.current) == null ? void 0 : F.ownerDocument) == null ? void 0 : L.activeElement;
3915
3915
  return !(b && ((oe = G.current) != null && oe.contains(b)) || S.trim());
@@ -3930,11 +3930,11 @@ function Gi({
3930
3930
  }, [m, le]), Ce = v(async () => {
3931
3931
  if (x.value.trim()) {
3932
3932
  const b = x.value.trim();
3933
- x.clear(), m.state !== "expanded" && (d == null || d()), m.setState("expanded"), await i(b);
3933
+ x.clear(), m.state !== "expanded" && (l == null || l()), m.setState("expanded"), await i(b);
3934
3934
  }
3935
- }, [x, i, m, d]), _e = v(() => {
3936
- U.current = !0, d == null || d(), m.setState("expanded");
3937
- }, [d, m]), Ee = v(() => {
3935
+ }, [x, i, m, l]), _e = v(() => {
3936
+ U.current = !0, l == null || l(), m.setState("expanded");
3937
+ }, [l, m]), Ee = v(() => {
3938
3938
  H.current = !0, x.clear(), m.close(), u && u();
3939
3939
  }, [x, m, u]), p = v(
3940
3940
  (b) => {
@@ -4176,14 +4176,14 @@ const Wo = "ImageUploader-module_container", Zo = "ImageUploader-module_active",
4176
4176
  {
4177
4177
  className: J.previewItem,
4178
4178
  draggable: e,
4179
- onDragStart: (l) => i(t, l),
4180
- onDragEnd: (l) => c(t, l),
4179
+ onDragStart: (d) => i(t, d),
4180
+ onDragEnd: (d) => c(t, d),
4181
4181
  children: [
4182
4182
  /* @__PURE__ */ a(
4183
4183
  "button",
4184
4184
  {
4185
4185
  className: J.removeButton,
4186
- onClick: (l) => o(l, t),
4186
+ onClick: (d) => o(d, t),
4187
4187
  "aria-label": $("Remove image", "a8c-agenttic"),
4188
4188
  type: "button",
4189
4189
  children: /* @__PURE__ */ a(
@@ -4240,8 +4240,8 @@ const Wo = "ImageUploader-module_container", Zo = "ImageUploader-module_active",
4240
4240
  onDrop: o,
4241
4241
  onPaste: n,
4242
4242
  onRemoveImage: s,
4243
- onImageDragStart: l,
4244
- onImageDragEnd: d,
4243
+ onImageDragStart: d,
4244
+ onImageDragEnd: l,
4245
4245
  acceptedFileTypes: u = ["image/jpeg", "image/png"],
4246
4246
  maxFileSize: g,
4247
4247
  maxFiles: h,
@@ -4392,14 +4392,14 @@ const Wo = "ImageUploader-module_container", Zo = "ImageUploader-module_active",
4392
4392
  (p = X.current) == null || p.click();
4393
4393
  }, se = v(
4394
4394
  (p, R) => {
4395
- l == null || l(p, R);
4395
+ d == null || d(p, R);
4396
4396
  },
4397
- [l]
4397
+ [d]
4398
4398
  ), pe = v(
4399
4399
  (p, R) => {
4400
- d == null || d(p, R);
4400
+ l == null || l(p, R);
4401
4401
  },
4402
- [d]
4402
+ [l]
4403
4403
  ), Ie = v(
4404
4404
  (p, R) => {
4405
4405
  p.stopPropagation(), s(R);
@@ -4585,42 +4585,42 @@ const qi = ({
4585
4585
  header: r,
4586
4586
  disabled: i = !1
4587
4587
  }) => {
4588
- const [c, o] = z(null), n = E(null), s = (l) => {
4589
- o(l.url), e(l);
4588
+ const [c, o] = z(null), n = E(null), s = (d) => {
4589
+ o(d.url), e(d);
4590
4590
  };
4591
4591
  return O(() => {
4592
4592
  if (i || !c)
4593
4593
  return;
4594
- const l = (d) => {
4595
- n.current && !n.current.contains(d.target) && (o(null), e(null));
4594
+ const d = (l) => {
4595
+ n.current && !n.current.contains(l.target) && (o(null), e(null));
4596
4596
  };
4597
- return window.addEventListener("click", l, !0), () => window.removeEventListener("click", l, !0);
4597
+ return window.addEventListener("click", d, !0), () => window.removeEventListener("click", d, !0);
4598
4598
  }, [e, i, c]), /* @__PURE__ */ w(ee.div, { children: [
4599
4599
  r || /* @__PURE__ */ w("div", { className: Pe.header, children: [
4600
4600
  /* @__PURE__ */ a(Ii, {}),
4601
4601
  " Done"
4602
4602
  ] }),
4603
- /* @__PURE__ */ a("div", { className: Pe.container, ref: n, children: t.map((l) => /* @__PURE__ */ a(
4603
+ /* @__PURE__ */ a("div", { className: Pe.container, ref: n, children: t.map((d) => /* @__PURE__ */ a(
4604
4604
  "button",
4605
4605
  {
4606
4606
  className: ne(
4607
4607
  Pe.imageButton,
4608
- !i && c === l.url ? Pe.selected : "",
4608
+ !i && c === d.url ? Pe.selected : "",
4609
4609
  i ? Pe.disabled : ""
4610
4610
  ),
4611
- onClick: () => s(l),
4611
+ onClick: () => s(d),
4612
4612
  disabled: i,
4613
4613
  type: "button",
4614
4614
  children: /* @__PURE__ */ a(
4615
4615
  "img",
4616
4616
  {
4617
- src: l.url,
4618
- alt: l.alt,
4617
+ src: d.url,
4618
+ alt: d.alt,
4619
4619
  className: Pe.image
4620
4620
  }
4621
4621
  )
4622
4622
  },
4623
- l.url
4623
+ d.url
4624
4624
  )) })
4625
4625
  ] });
4626
4626
  };
@@ -4917,8 +4917,8 @@ const ki = (t, e = "") => {
4917
4917
  if (n instanceof Date)
4918
4918
  s = n;
4919
4919
  else if (typeof n == "string") {
4920
- const l = new Date(n);
4921
- isNaN(l.getTime()) || (s = l);
4920
+ const d = new Date(n);
4921
+ isNaN(d.getTime()) || (s = d);
4922
4922
  }
4923
4923
  return s ? `${(s.getMonth() + 1).toString().padStart(2, "0")}/${s.getDate().toString().padStart(2, "0")}` : String(n || "");
4924
4924
  },
@@ -4948,16 +4948,16 @@ const ki = (t, e = "") => {
4948
4948
  renderTooltip: o,
4949
4949
  margin: n,
4950
4950
  mode: s = "time-comparison",
4951
- truncateLabels: l = !0,
4952
- maxLabelLength: d = 15,
4951
+ truncateLabels: d = !0,
4952
+ maxLabelLength: l = 15,
4953
4953
  error: u,
4954
4954
  ...g
4955
- } = t, h = (_, S) => !l || _.length <= S ? _ : _.substring(0, S - 3) + "...", N = () => {
4955
+ } = t, h = (_, S) => !d || _.length <= S ? _ : _.substring(0, S - 3) + "...", N = () => {
4956
4956
  if (s === "item-comparison" && e && e.length > 0) {
4957
4957
  let _ = "";
4958
4958
  return e.forEach((S) => {
4959
4959
  S != null && S.data && S.data.forEach((P) => {
4960
- const m = P.label || "", j = h(m, d);
4960
+ const m = P.label || "", j = h(m, l);
4961
4961
  j.length > _.length && (_ = j);
4962
4962
  });
4963
4963
  }), pt(80, 6, 25, _.length);
@@ -4974,7 +4974,7 @@ const ki = (t, e = "") => {
4974
4974
  axis: {
4975
4975
  x: {
4976
4976
  orientation: "bottom",
4977
- tickFormat: (_) => h(_, d),
4977
+ tickFormat: (_) => h(_, l),
4978
4978
  tickLabelProps: {
4979
4979
  fontSize: 11,
4980
4980
  textAnchor: "end",
@@ -5070,8 +5070,8 @@ const Mi = (t) => {
5070
5070
  renderTooltip: o,
5071
5071
  margin: n,
5072
5072
  withGradientFill: s = !0,
5073
- error: l,
5074
- ...d
5073
+ error: d,
5074
+ ...l
5075
5075
  } = t, u = {
5076
5076
  ...Qa(),
5077
5077
  bottom: 80
@@ -5097,9 +5097,9 @@ const Mi = (t) => {
5097
5097
  }
5098
5098
  },
5099
5099
  ...r && { currency: r },
5100
- ...d
5100
+ ...l
5101
5101
  };
5102
- return /* @__PURE__ */ a(qa, { error: l, children: /* @__PURE__ */ a(Ln, { ...g }) });
5102
+ return /* @__PURE__ */ a(qa, { error: d, children: /* @__PURE__ */ a(Ln, { ...g }) });
5103
5103
  }, Li = ({
5104
5104
  data: t,
5105
5105
  className: e = "",
@@ -5107,7 +5107,7 @@ const Mi = (t) => {
5107
5107
  }) => {
5108
5108
  const [i, c] = z(null), [o, n] = z(
5109
5109
  null
5110
- ), [s, l] = z(300), d = E(null), u = v(
5110
+ ), [s, d] = z(300), l = E(null), u = v(
5111
5111
  (y) => {
5112
5112
  var U;
5113
5113
  const { tooltipData: _ } = y, S = (U = _ == null ? void 0 : _.nearestDatum) == null ? void 0 : U.datum;
@@ -5271,21 +5271,21 @@ const Mi = (t) => {
5271
5271
  }
5272
5272
  }, [t]);
5273
5273
  const g = v((y) => {
5274
- if (d.current && d.current.disconnect(), y) {
5274
+ if (l.current && l.current.disconnect(), y) {
5275
5275
  const { width: _ } = y.getBoundingClientRect(), S = Math.max(280, _ - 4);
5276
- l(S), d.current = new ResizeObserver((P) => {
5276
+ d(S), l.current = new ResizeObserver((P) => {
5277
5277
  for (const m of P) {
5278
5278
  const j = m.contentRect.width, H = Math.max(
5279
5279
  280,
5280
5280
  j - 4
5281
5281
  );
5282
- l(H);
5282
+ d(H);
5283
5283
  }
5284
- }), d.current.observe(y);
5284
+ }), l.current.observe(y);
5285
5285
  }
5286
5286
  }, []);
5287
5287
  if (O(() => () => {
5288
- d.current && (d.current.disconnect(), d.current = null);
5288
+ l.current && (l.current.disconnect(), l.current = null);
5289
5289
  }, []), i)
5290
5290
  return /* @__PURE__ */ a(ze, { message: i.message, details: i.details });
5291
5291
  if (!o)
@@ -5390,20 +5390,20 @@ function cc(t = {}) {
5390
5390
  o.components,
5391
5391
  e
5392
5392
  ), s = [...o.remarkPlugins, ...i];
5393
- return function({ children: d }) {
5394
- const [u, g] = ce.useState(d);
5393
+ return function({ children: l }) {
5394
+ const [u, g] = ce.useState(l);
5395
5395
  return ce.useEffect(() => {
5396
5396
  c ? Ei().then(async (h) => {
5397
- const D = (await h.parseMarkdownIntoBlocks(d)).map((C) => h.parseIncompleteMarkdown(
5397
+ const D = (await h.parseMarkdownIntoBlocks(l)).map((C) => h.parseIncompleteMarkdown(
5398
5398
  C.trim()
5399
5399
  )).join(`
5400
5400
 
5401
5401
  `);
5402
5402
  g(D);
5403
5403
  }).catch(() => {
5404
- g(d);
5405
- }) : g(d);
5406
- }, [d]), /* @__PURE__ */ a(
5404
+ g(l);
5405
+ }) : g(l);
5406
+ }, [l]), /* @__PURE__ */ a(
5407
5407
  ht,
5408
5408
  {
5409
5409
  components: n,
@@ -5423,8 +5423,8 @@ const sc = (t) => {
5423
5423
  getActionsForMessage: (n) => {
5424
5424
  if (!e(n))
5425
5425
  return [];
5426
- const s = r[n.id], l = [];
5427
- return l.push({
5426
+ const s = r[n.id], d = [];
5427
+ return d.push({
5428
5428
  id: "feedback-up",
5429
5429
  icon: t.icons.up,
5430
5430
  label: "Good response",
@@ -5435,7 +5435,7 @@ const sc = (t) => {
5435
5435
  pressed: s === "up",
5436
5436
  disabled: s === "down"
5437
5437
  // Disable if other is selected
5438
- }), l.push({
5438
+ }), d.push({
5439
5439
  id: "feedback-down",
5440
5440
  icon: t.icons.down,
5441
5441
  label: "Bad response",
@@ -5446,7 +5446,7 @@ const sc = (t) => {
5446
5446
  pressed: s === "down",
5447
5447
  disabled: s === "up"
5448
5448
  // Disable if other is selected
5449
- }), l;
5449
+ }), d;
5450
5450
  },
5451
5451
  clearFeedback: (n) => {
5452
5452
  delete r[n], c();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/agenttic-ui",
3
- "version": "0.1.63",
3
+ "version": "0.1.64",
4
4
  "type": "module",
5
5
  "description": "UI components for the Agenttic framework",
6
6
  "main": "dist/index.js",