@eshal-bot/chat-widget 0.1.103 → 0.1.105

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
- export{S as default}from"./chat-widget-index-2LNAzlMS.esm.js";import"react";import"react-dom/client";import"react-dom";import"react/jsx-runtime";
1
+ export{S as default}from"./chat-widget-index-Ccm0r0y5.esm.js";import"react";import"react-dom/client";import"react-dom";import"react/jsx-runtime";
@@ -14295,8 +14295,13 @@
14295
14295
  // EV-2351: Unicode ranges for RTL scripts (Arabic, Hebrew, and their
14296
14296
  // Extended-A blocks + Arabic Presentation Forms) and for common LTR scripts.
14297
14297
  // Used by detectTextDirection's "first strong character" scan below.
14298
- const RTL_CHAR_RANGE = /[֐-׿؀-ۿ܀-ݏݐ-ݿࢠ-ࣿיִ-ﭏﭐ-﷿ﹰ-]/;
14299
- const LTR_CHAR_RANGE = /[A-Za-zÀ-ɏͰ-ϿЀ-ӿ]/;
14298
+ const RTL_CHAR_RANGE =
14299
+ // Escaped ON PURPOSE. This copy's bound was always right, but the raw
14300
+ // glyphs did not survive being pasted into the frontend's two copies -
14301
+ // the precomposed U+FB1D arrived as U+05D9 U+05B4, read as the range
14302
+ // U+05B4-U+FB4F. Escapes cannot be mangled that way.
14303
+ /[\u0590-\u05ff\u0600-\u06ff\u0700-\u074f\u0750-\u077f\u08a0-\u08ff\ufb1d-\ufb4f\ufb50-\ufdff\ufe70-\ufeff]/;
14304
+ const LTR_CHAR_RANGE = /[A-Za-z\u00c0-\u024f\u0370-\u03ff\u0400-\u04ff]/;
14300
14305
 
14301
14306
  /**
14302
14307
  * EV-2351: detect the writing direction of a piece of TEXT, not the
@@ -17191,8 +17196,11 @@
17191
17196
  questionDisplay = true
17192
17197
  } = _ref;
17193
17198
  const scrollRef = reactExports.useRef(null);
17194
- const [canScrollLeft, setCanScrollLeft] = reactExports.useState(false);
17195
- const [canScrollRight, setCanScrollRight] = reactExports.useState(false);
17199
+ // EV-2993: these are LOGICAL, not physical - "can I go back toward the
17200
+ // start of the strip" / "on toward its end". `scrollLeft` counts down
17201
+ // from 0 in an RTL container, hence Math.abs.
17202
+ const [canScrollToStart, setCanScrollToStart] = reactExports.useState(false);
17203
+ const [canScrollToEnd, setCanScrollToEnd] = reactExports.useState(false);
17196
17204
  const updateScrollState = reactExports.useCallback(() => {
17197
17205
  const el = scrollRef.current;
17198
17206
  if (!el) return;
@@ -17201,8 +17209,8 @@
17201
17209
  scrollWidth,
17202
17210
  clientWidth
17203
17211
  } = el;
17204
- setCanScrollLeft(Math.abs(scrollLeft) > 1);
17205
- setCanScrollRight(Math.abs(scrollLeft) + clientWidth < scrollWidth - 1);
17212
+ setCanScrollToStart(Math.abs(scrollLeft) > 1);
17213
+ setCanScrollToEnd(Math.abs(scrollLeft) + clientWidth < scrollWidth - 1);
17206
17214
  }, []);
17207
17215
  reactExports.useEffect(() => {
17208
17216
  updateScrollState();
@@ -17212,10 +17220,10 @@
17212
17220
  observer.observe(el);
17213
17221
  return () => observer.disconnect();
17214
17222
  }, [updateScrollState, suggestions]);
17215
- const scroll = reactExports.useCallback(direction => {
17223
+ const scroll = reactExports.useCallback(toward => {
17216
17224
  const el = scrollRef.current;
17217
17225
  if (!el) return;
17218
- const amount = direction === "left" ? -SCROLL_AMOUNT$1 : SCROLL_AMOUNT$1;
17226
+ const amount = toward === "start" ? -SCROLL_AMOUNT$1 : SCROLL_AMOUNT$1;
17219
17227
  el.scrollBy({
17220
17228
  left: isRtl ? -amount : amount,
17221
17229
  behavior: "smooth"
@@ -17225,25 +17233,40 @@
17225
17233
  const arrowColor = isDark ? "#e5e7eb" : "#374151";
17226
17234
  const arrowBorder = isDark ? "#4b5563" : "#d1d5db";
17227
17235
  const arrowDisabledOpacity = 0.35;
17236
+
17237
+ // EV-2993: the two nav buttons are LOGICAL - "back toward the start of
17238
+ // the strip" and "on toward its end" - and DOM order (start first)
17239
+ // already lands them on the correct physical edges, because the row is
17240
+ // a flex container that reverses under dir="rtl". What never reversed
17241
+ // was the presentation: both buttons kept a hard-coded chevron glyph
17242
+ // and a hard-coded scrollLeft/scrollRight label, so an RTL tenant saw
17243
+ // a LEFT-pointing chevron sitting on the RIGHT edge that scrolled the
17244
+ // content rightward. Mirror glyph and label off the SAME `isRtl` the
17245
+ // scroll maths above uses, so the arrow can never disagree with the
17246
+ // nudge it triggers. LTR rendering is unchanged.
17247
+ const StartChevron = isRtl ? ChevronRight : ChevronLeft;
17248
+ const EndChevron = isRtl ? ChevronLeft : ChevronRight;
17249
+ const startArrowLabel = t(isRtl ? "scrollRight" : "scrollLeft");
17250
+ const endArrowLabel = t(isRtl ? "scrollLeft" : "scrollRight");
17228
17251
  return /*#__PURE__*/jsxRuntimeExports.jsx("div", {
17229
17252
  className: "mb-2 px-5",
17230
17253
  children: /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
17231
17254
  className: "flex items-center gap-1.5",
17232
17255
  children: [/*#__PURE__*/jsxRuntimeExports.jsx("button", {
17233
17256
  type: "button",
17234
- onClick: () => scroll("left"),
17235
- disabled: !canScrollLeft,
17236
- "aria-label": t("scrollLeft"),
17257
+ onClick: () => scroll("start"),
17258
+ disabled: !canScrollToStart,
17259
+ "aria-label": startArrowLabel,
17237
17260
  className: "flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-full shadow-sm transition-all duration-200 hover:shadow-md active:scale-95",
17238
17261
  style: {
17239
17262
  backgroundColor: arrowBg,
17240
17263
  border: "1px solid ".concat(arrowBorder),
17241
17264
  color: arrowColor,
17242
17265
  backdropFilter: "blur(4px)",
17243
- opacity: canScrollLeft ? 1 : arrowDisabledOpacity,
17244
- cursor: canScrollLeft ? "pointer" : "default"
17266
+ opacity: canScrollToStart ? 1 : arrowDisabledOpacity,
17267
+ cursor: canScrollToStart ? "pointer" : "default"
17245
17268
  },
17246
- children: /*#__PURE__*/jsxRuntimeExports.jsx(ChevronLeft, {
17269
+ children: /*#__PURE__*/jsxRuntimeExports.jsx(StartChevron, {
17247
17270
  size: 16
17248
17271
  })
17249
17272
  }), /*#__PURE__*/jsxRuntimeExports.jsx("div", {
@@ -17288,19 +17311,19 @@
17288
17311
  })
17289
17312
  }), /*#__PURE__*/jsxRuntimeExports.jsx("button", {
17290
17313
  type: "button",
17291
- onClick: () => scroll("right"),
17292
- disabled: !canScrollRight,
17293
- "aria-label": t("scrollRight"),
17314
+ onClick: () => scroll("end"),
17315
+ disabled: !canScrollToEnd,
17316
+ "aria-label": endArrowLabel,
17294
17317
  className: "flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-full shadow-sm transition-all duration-200 hover:shadow-md active:scale-95",
17295
17318
  style: {
17296
17319
  backgroundColor: arrowBg,
17297
17320
  border: "1px solid ".concat(arrowBorder),
17298
17321
  color: arrowColor,
17299
17322
  backdropFilter: "blur(4px)",
17300
- opacity: canScrollRight ? 1 : arrowDisabledOpacity,
17301
- cursor: canScrollRight ? "pointer" : "default"
17323
+ opacity: canScrollToEnd ? 1 : arrowDisabledOpacity,
17324
+ cursor: canScrollToEnd ? "pointer" : "default"
17302
17325
  },
17303
- children: /*#__PURE__*/jsxRuntimeExports.jsx(ChevronRight, {
17326
+ children: /*#__PURE__*/jsxRuntimeExports.jsx(EndChevron, {
17304
17327
  size: 16
17305
17328
  })
17306
17329
  })]