@swift-food-services/catering-widget 0.2.0-beta.0 → 0.2.0-beta.2

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.cjs CHANGED
@@ -3557,12 +3557,12 @@ styleInject(`/*! tailwindcss v4.2.4 | MIT License | https://tailwindcss.com */
3557
3557
  .swift-catering-widget .right-8 {
3558
3558
  right: calc(var(--spacing) * 8);
3559
3559
  }
3560
+ .swift-catering-widget .right-96 {
3561
+ right: calc(var(--spacing) * 96);
3562
+ }
3560
3563
  .swift-catering-widget .right-\\[-45px\\] {
3561
3564
  right: -45px;
3562
3565
  }
3563
- .swift-catering-widget .right-\\[calc\\(24rem\\+0\\.5rem\\)\\] {
3564
- right: 24.5rem;
3565
- }
3566
3566
  .swift-catering-widget .bottom-0 {
3567
3567
  bottom: calc(var(--spacing) * 0);
3568
3568
  }
@@ -4472,6 +4472,9 @@ styleInject(`/*! tailwindcss v4.2.4 | MIT License | https://tailwindcss.com */
4472
4472
  .swift-catering-widget .overflow-y-auto {
4473
4473
  overflow-y: auto;
4474
4474
  }
4475
+ .swift-catering-widget .overscroll-contain {
4476
+ overscroll-behavior: contain;
4477
+ }
4475
4478
  .swift-catering-widget .overscroll-none {
4476
4479
  overscroll-behavior: none;
4477
4480
  }
@@ -16819,7 +16822,7 @@ function AIChatBody() {
16819
16822
  await applyEditField(field, value, idx);
16820
16823
  }
16821
16824
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "swift-chat-design bg-white rounded-xl shadow-sm border border-base-200 flex h-full min-h-0 flex-col overflow-hidden", children: [
16822
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-3 py-2.5 flex items-center gap-3 border-b border-base-200", children: [
16825
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-shrink-0 px-3 py-2.5 flex items-center gap-3 border-b border-base-200", children: [
16823
16826
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-9 h-9 rounded-full bg-primary flex items-center justify-center flex-shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Sparkles, { className: "w-4 h-4 text-white" }) }),
16824
16827
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 min-w-0", children: [
16825
16828
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-semibold text-gray-800", children: "AI Assistant" }),
@@ -16857,7 +16860,7 @@ function AIChatBody() {
16857
16860
  {
16858
16861
  ref: messagesScrollRef,
16859
16862
  onScroll: handleMessagesScroll,
16860
- className: "absolute inset-0 overflow-y-auto p-3",
16863
+ className: "absolute inset-0 overflow-y-auto overscroll-contain p-3",
16861
16864
  children: /* @__PURE__ */ jsxRuntime.jsx(ChatMessagesView, {})
16862
16865
  }
16863
16866
  ),
@@ -16877,8 +16880,8 @@ function AIChatBody() {
16877
16880
  }
16878
16881
  ) })
16879
16882
  ] }),
16880
- actionChips.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-t border-base-200 px-3 py-2", children: /* @__PURE__ */ jsxRuntime.jsx(ChipGroup, { chips: actionChips, onAction: handleChipClick }) }),
16881
- missingFields && missingFields.fields.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
16883
+ actionChips.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-shrink-0 border-t border-base-200 px-3 py-2", children: /* @__PURE__ */ jsxRuntime.jsx(ChipGroup, { chips: actionChips, onAction: handleChipClick }) }),
16884
+ missingFields && missingFields.fields.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(
16882
16885
  MissingFieldsClarifier,
16883
16886
  {
16884
16887
  missing: missingFields,
@@ -16891,8 +16894,8 @@ function AIChatBody() {
16891
16894
  setEditValue(void 0);
16892
16895
  }
16893
16896
  }
16894
- ),
16895
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-t border-base-200 p-2.5", children: /* @__PURE__ */ jsxRuntime.jsx(react$1.AnimatePresence, { mode: "wait", initial: false, children: editField !== null ? /* @__PURE__ */ jsxRuntime.jsx(
16897
+ ) }),
16898
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-shrink-0 border-t border-base-200 p-2.5", children: /* @__PURE__ */ jsxRuntime.jsx(react$1.AnimatePresence, { mode: "wait", initial: false, children: editField !== null ? /* @__PURE__ */ jsxRuntime.jsx(
16896
16899
  react$1.motion.div,
16897
16900
  {
16898
16901
  initial: { opacity: 0, y: 8 },
@@ -19836,17 +19839,34 @@ function resolveDraftItems(mealSessionParts, aiMealSessions, activeMealSessionIn
19836
19839
  function SuggestionsOverlay({ onClose }) {
19837
19840
  const { stickyTopOffset = 0 } = useCateringConfig();
19838
19841
  react.useEffect(() => {
19839
- const prev = document.body.style.overflow;
19840
- document.body.style.overflow = "hidden";
19842
+ const body = document.body;
19843
+ const scrollY = window.scrollY;
19844
+ const prev = {
19845
+ position: body.style.position,
19846
+ top: body.style.top,
19847
+ left: body.style.left,
19848
+ right: body.style.right,
19849
+ width: body.style.width
19850
+ };
19851
+ body.style.position = "fixed";
19852
+ body.style.top = `-${scrollY}px`;
19853
+ body.style.left = "0";
19854
+ body.style.right = "0";
19855
+ body.style.width = "100%";
19841
19856
  return () => {
19842
- document.body.style.overflow = prev;
19857
+ body.style.position = prev.position;
19858
+ body.style.top = prev.top;
19859
+ body.style.left = prev.left;
19860
+ body.style.right = prev.right;
19861
+ body.style.width = prev.width;
19862
+ window.scrollTo(0, scrollY);
19843
19863
  };
19844
19864
  }, []);
19845
19865
  if (typeof document === "undefined") return null;
19846
19866
  const overlay = /* @__PURE__ */ jsxRuntime.jsxs(
19847
19867
  react$1.motion.div,
19848
19868
  {
19849
- className: "fixed bottom-0 left-2 right-[calc(24rem+0.5rem)] z-50 hidden md:block",
19869
+ className: "fixed bottom-0 left-2 right-96 z-50 hidden md:block",
19850
19870
  style: { top: stickyTopOffset },
19851
19871
  initial: { opacity: 0 },
19852
19872
  animate: { opacity: 1 },
@@ -26700,6 +26720,7 @@ function CateringOrderBuilder() {
26700
26720
  };
26701
26721
  const { stickyTopOffset = 0, publishableKey, aiEnabled = false } = useCateringConfig();
26702
26722
  const effectiveRightPanelTab = aiEnabled ? rightPanelTab : "cart";
26723
+ const [overlayVisible, setOverlayVisible] = react.useState(false);
26703
26724
  const basketColumnRef = react.useRef(null);
26704
26725
  const [basketHeight, setBasketHeight] = react.useState("100vh");
26705
26726
  react.useEffect(() => {
@@ -27522,17 +27543,24 @@ function CateringOrderBuilder() {
27522
27543
  onRegisterMobileSearchSetter: handleRegisterMobileSearchSetter
27523
27544
  }
27524
27545
  ),
27525
- /* @__PURE__ */ jsxRuntime.jsx(SuggestionsOverlayBridge, { active: effectiveRightPanelTab === "ai" })
27546
+ /* @__PURE__ */ jsxRuntime.jsx(
27547
+ SuggestionsOverlayBridge,
27548
+ {
27549
+ active: effectiveRightPanelTab === "ai",
27550
+ onVisibleChange: setOverlayVisible
27551
+ }
27552
+ )
27526
27553
  ] })
27527
27554
  ] }),
27528
27555
  /* @__PURE__ */ jsxRuntime.jsx(
27529
27556
  "div",
27530
27557
  {
27531
27558
  ref: basketColumnRef,
27532
- className: "hidden md:flex md:w-96 flex-shrink-0 flex-col sticky overflow-hidden py-2 px-1",
27559
+ className: `hidden md:flex md:w-96 flex-shrink-0 flex-col overflow-hidden py-2 px-1 ${overlayVisible ? "fixed z-50 bg-base-100" : "sticky"}`,
27533
27560
  style: {
27534
27561
  top: stickyTopOffset,
27535
- height: basketHeight,
27562
+ right: overlayVisible ? 0 : void 0,
27563
+ height: overlayVisible ? `calc(100dvh - ${stickyTopOffset}px)` : basketHeight,
27536
27564
  alignSelf: "flex-start"
27537
27565
  },
27538
27566
  children: mealSessions[activeSessionIndex] && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full flex-col gap-2 overflow-hidden", children: [
@@ -28345,7 +28373,10 @@ function MobileAIInput({
28345
28373
  )
28346
28374
  ] });
28347
28375
  }
28348
- function SuggestionsOverlayBridge({ active }) {
28376
+ function SuggestionsOverlayBridge({
28377
+ active,
28378
+ onVisibleChange
28379
+ }) {
28349
28380
  const {
28350
28381
  hasResults,
28351
28382
  suggestionsOverlayDismissed,
@@ -28354,6 +28385,9 @@ function SuggestionsOverlayBridge({ active }) {
28354
28385
  } = useChatSessionContext();
28355
28386
  const hasContent = hasResults || activeViewedPreview !== null;
28356
28387
  const visible = active && hasContent && !suggestionsOverlayDismissed;
28388
+ react.useEffect(() => {
28389
+ onVisibleChange?.(visible);
28390
+ }, [visible, onVisibleChange]);
28357
28391
  return /* @__PURE__ */ jsxRuntime.jsx(react$1.AnimatePresence, { children: visible && /* @__PURE__ */ jsxRuntime.jsx(
28358
28392
  SuggestionsOverlay,
28359
28393
  {