@eshal-bot/chat-widget 0.1.104 → 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-DpoyZhy6.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";
@@ -17196,8 +17196,11 @@
17196
17196
  questionDisplay = true
17197
17197
  } = _ref;
17198
17198
  const scrollRef = reactExports.useRef(null);
17199
- const [canScrollLeft, setCanScrollLeft] = reactExports.useState(false);
17200
- 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);
17201
17204
  const updateScrollState = reactExports.useCallback(() => {
17202
17205
  const el = scrollRef.current;
17203
17206
  if (!el) return;
@@ -17206,8 +17209,8 @@
17206
17209
  scrollWidth,
17207
17210
  clientWidth
17208
17211
  } = el;
17209
- setCanScrollLeft(Math.abs(scrollLeft) > 1);
17210
- setCanScrollRight(Math.abs(scrollLeft) + clientWidth < scrollWidth - 1);
17212
+ setCanScrollToStart(Math.abs(scrollLeft) > 1);
17213
+ setCanScrollToEnd(Math.abs(scrollLeft) + clientWidth < scrollWidth - 1);
17211
17214
  }, []);
17212
17215
  reactExports.useEffect(() => {
17213
17216
  updateScrollState();
@@ -17217,10 +17220,10 @@
17217
17220
  observer.observe(el);
17218
17221
  return () => observer.disconnect();
17219
17222
  }, [updateScrollState, suggestions]);
17220
- const scroll = reactExports.useCallback(direction => {
17223
+ const scroll = reactExports.useCallback(toward => {
17221
17224
  const el = scrollRef.current;
17222
17225
  if (!el) return;
17223
- const amount = direction === "left" ? -SCROLL_AMOUNT$1 : SCROLL_AMOUNT$1;
17226
+ const amount = toward === "start" ? -SCROLL_AMOUNT$1 : SCROLL_AMOUNT$1;
17224
17227
  el.scrollBy({
17225
17228
  left: isRtl ? -amount : amount,
17226
17229
  behavior: "smooth"
@@ -17230,25 +17233,40 @@
17230
17233
  const arrowColor = isDark ? "#e5e7eb" : "#374151";
17231
17234
  const arrowBorder = isDark ? "#4b5563" : "#d1d5db";
17232
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");
17233
17251
  return /*#__PURE__*/jsxRuntimeExports.jsx("div", {
17234
17252
  className: "mb-2 px-5",
17235
17253
  children: /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
17236
17254
  className: "flex items-center gap-1.5",
17237
17255
  children: [/*#__PURE__*/jsxRuntimeExports.jsx("button", {
17238
17256
  type: "button",
17239
- onClick: () => scroll("left"),
17240
- disabled: !canScrollLeft,
17241
- "aria-label": t("scrollLeft"),
17257
+ onClick: () => scroll("start"),
17258
+ disabled: !canScrollToStart,
17259
+ "aria-label": startArrowLabel,
17242
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",
17243
17261
  style: {
17244
17262
  backgroundColor: arrowBg,
17245
17263
  border: "1px solid ".concat(arrowBorder),
17246
17264
  color: arrowColor,
17247
17265
  backdropFilter: "blur(4px)",
17248
- opacity: canScrollLeft ? 1 : arrowDisabledOpacity,
17249
- cursor: canScrollLeft ? "pointer" : "default"
17266
+ opacity: canScrollToStart ? 1 : arrowDisabledOpacity,
17267
+ cursor: canScrollToStart ? "pointer" : "default"
17250
17268
  },
17251
- children: /*#__PURE__*/jsxRuntimeExports.jsx(ChevronLeft, {
17269
+ children: /*#__PURE__*/jsxRuntimeExports.jsx(StartChevron, {
17252
17270
  size: 16
17253
17271
  })
17254
17272
  }), /*#__PURE__*/jsxRuntimeExports.jsx("div", {
@@ -17293,19 +17311,19 @@
17293
17311
  })
17294
17312
  }), /*#__PURE__*/jsxRuntimeExports.jsx("button", {
17295
17313
  type: "button",
17296
- onClick: () => scroll("right"),
17297
- disabled: !canScrollRight,
17298
- "aria-label": t("scrollRight"),
17314
+ onClick: () => scroll("end"),
17315
+ disabled: !canScrollToEnd,
17316
+ "aria-label": endArrowLabel,
17299
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",
17300
17318
  style: {
17301
17319
  backgroundColor: arrowBg,
17302
17320
  border: "1px solid ".concat(arrowBorder),
17303
17321
  color: arrowColor,
17304
17322
  backdropFilter: "blur(4px)",
17305
- opacity: canScrollRight ? 1 : arrowDisabledOpacity,
17306
- cursor: canScrollRight ? "pointer" : "default"
17323
+ opacity: canScrollToEnd ? 1 : arrowDisabledOpacity,
17324
+ cursor: canScrollToEnd ? "pointer" : "default"
17307
17325
  },
17308
- children: /*#__PURE__*/jsxRuntimeExports.jsx(ChevronRight, {
17326
+ children: /*#__PURE__*/jsxRuntimeExports.jsx(EndChevron, {
17309
17327
  size: 16
17310
17328
  })
17311
17329
  })]