@idkwebsites/components 0.1.18 → 0.1.20

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
@@ -1782,7 +1782,8 @@ function BookingWidgetPanel({
1782
1782
  closeIcon,
1783
1783
  categoryIcons,
1784
1784
  stepTitles,
1785
- linkComponent: LinkComp = DefaultLink
1785
+ linkComponent: LinkComp = DefaultLink,
1786
+ mobileHeader
1786
1787
  } = {}) {
1787
1788
  const widgetRef = (0, import_react9.useRef)(null);
1788
1789
  const formRef = (0, import_react9.useRef)(null);
@@ -1828,9 +1829,10 @@ function BookingWidgetPanel({
1828
1829
  }
1829
1830
  }
1830
1831
  }, [bw.isAvailabilityLoading, bw.selectedService?.id, bw.availabilityByDate, bw.selectedDate]);
1832
+ const hasCategories = bw.categories.length >= 1;
1831
1833
  const hasMultipleCategories = bw.categories.length > 1;
1832
1834
  (0, import_react9.useEffect)(() => {
1833
- if (hasMultipleCategories && bw.categoryFilter === "all") {
1835
+ if (hasCategories && bw.categoryFilter === "all") {
1834
1836
  bw.setCategoryFilter(bw.categories[0]);
1835
1837
  }
1836
1838
  }, [bw.categories.length]);
@@ -1846,7 +1848,7 @@ function BookingWidgetPanel({
1846
1848
  const scrollbars = [];
1847
1849
  const opts = {
1848
1850
  damping: 0.08,
1849
- continuousScrolling: false,
1851
+ continuousScrolling: true,
1850
1852
  alwaysShowTracks: false,
1851
1853
  plugins: {
1852
1854
  overscroll: { effect: "bounce", damping: 0.15, maxOverscroll: 80 }
@@ -1870,6 +1872,20 @@ function BookingWidgetPanel({
1870
1872
  };
1871
1873
  }, [isReady, mobileStep]);
1872
1874
  const initSvcScrollbar = (el) => {
1875
+ if (!el || typeof window !== "undefined" && window.matchMedia("(max-width: 1024px)").matches) {
1876
+ if (svcScrollbarRef.current) {
1877
+ try {
1878
+ svcScrollbarRef.current.destroy();
1879
+ } catch {
1880
+ }
1881
+ svcScrollbarRef.current = null;
1882
+ }
1883
+ return;
1884
+ }
1885
+ if (svcScrollbarRef.current && svcScrollbarRef.current.containerEl === el) {
1886
+ svcScrollbarRef.current.update();
1887
+ return;
1888
+ }
1873
1889
  if (svcScrollbarRef.current) {
1874
1890
  try {
1875
1891
  svcScrollbarRef.current.destroy();
@@ -1877,10 +1893,9 @@ function BookingWidgetPanel({
1877
1893
  }
1878
1894
  svcScrollbarRef.current = null;
1879
1895
  }
1880
- if (!el || typeof window !== "undefined" && window.matchMedia("(max-width: 1024px)").matches) return;
1881
1896
  svcScrollbarRef.current = import_smooth_scrollbar.default.init(el, {
1882
1897
  damping: 0.08,
1883
- continuousScrolling: false,
1898
+ continuousScrolling: true,
1884
1899
  alwaysShowTracks: false,
1885
1900
  plugins: {
1886
1901
  overscroll: { effect: "bounce", damping: 0.15, maxOverscroll: 80 }
@@ -2041,10 +2056,12 @@ function BookingWidgetPanel({
2041
2056
  svc.id
2042
2057
  );
2043
2058
  };
2059
+ const useLegacyNav = !mobileHeader && navLinks.length > 0;
2044
2060
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "bw", ref: widgetRef, children: [
2061
+ mobileHeader && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "bw-mobile-header", children: mobileHeader }),
2045
2062
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "bw-topbar", children: [
2046
2063
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "bw-dots", children: Array.from({ length: 4 }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `bw-dot ${mobileStep > i ? "is-filled" : ""}` }, i)) }),
2047
- navLinks.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2064
+ useLegacyNav && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2048
2065
  "button",
2049
2066
  {
2050
2067
  className: "bw-topbar-menu",
@@ -2054,7 +2071,7 @@ function BookingWidgetPanel({
2054
2071
  }
2055
2072
  )
2056
2073
  ] }),
2057
- navLinks.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_framer_motion.AnimatePresence, { children: navOpen && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2074
+ useLegacyNav && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_framer_motion.AnimatePresence, { children: navOpen && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2058
2075
  import_framer_motion.motion.div,
2059
2076
  {
2060
2077
  className: "bw-nav-overlay",