@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.d.cts CHANGED
@@ -443,14 +443,14 @@ interface BookingWidgetProps$1 {
443
443
  declare function BookingWidget({ className, title, subtitle, serviceSearchPlaceholder, categoryLabel, serviceListMaxHeight, serviceLayout, serviceColumns, showServicePagination, staffLayout, staffColumns, showStaffPagination, timeLayout, showFullyBookedLabel, calendarVariant, enableServiceSearch, enableCategoryFilter, enableDatePaging, disabledWeekdays, ...hookProps }: BookingWidgetProps$1): react_jsx_runtime.JSX.Element;
444
444
 
445
445
  interface BookingWidgetProps {
446
- /** Navigation links shown in the mobile menu overlay. Omit to hide hamburger. */
446
+ /** Navigation links shown in the mobile menu overlay. Omit to hide hamburger. @deprecated Use `mobileHeader` instead. */
447
447
  navLinks?: {
448
448
  label: string;
449
449
  href: string;
450
450
  }[];
451
- /** Custom icon for the mobile menu open button (default: lucide Menu) */
451
+ /** Custom icon for the mobile menu open button (default: lucide Menu) @deprecated Use `mobileHeader` instead. */
452
452
  menuIcon?: ReactNode;
453
- /** Custom icon for the mobile menu close button (default: lucide X) */
453
+ /** Custom icon for the mobile menu close button (default: lucide X) @deprecated Use `mobileHeader` instead. */
454
454
  closeIcon?: ReactNode;
455
455
  /** Override the category → icon mapping (keyword → React component) */
456
456
  categoryIcons?: Record<string, typeof Scissors>;
@@ -459,6 +459,7 @@ interface BookingWidgetProps {
459
459
  /**
460
460
  * Link component for mobile nav. Defaults to a plain `<a>` tag.
461
461
  * Next.js sites should pass `Link` from `next/link` for client-side navigation.
462
+ * @deprecated Use `mobileHeader` instead.
462
463
  */
463
464
  linkComponent?: ComponentType<{
464
465
  href: string;
@@ -466,8 +467,14 @@ interface BookingWidgetProps {
466
467
  onClick?: () => void;
467
468
  children: ReactNode;
468
469
  }>;
470
+ /**
471
+ * Site's mobile header/navbar component. Rendered inside the widget on mobile,
472
+ * replacing the built-in hamburger menu. Pass your SiteHeader component here
473
+ * so the booking widget uses the same navigation design as the rest of the site.
474
+ */
475
+ mobileHeader?: ReactNode;
469
476
  }
470
- declare function BookingWidgetPanel({ navLinks, menuIcon, closeIcon, categoryIcons, stepTitles, linkComponent: LinkComp, }?: BookingWidgetProps): react_jsx_runtime.JSX.Element;
477
+ declare function BookingWidgetPanel({ navLinks, menuIcon, closeIcon, categoryIcons, stepTitles, linkComponent: LinkComp, mobileHeader, }?: BookingWidgetProps): react_jsx_runtime.JSX.Element;
471
478
 
472
479
  interface AvailabilityPickerProps {
473
480
  serviceId: string;
package/dist/index.d.ts CHANGED
@@ -443,14 +443,14 @@ interface BookingWidgetProps$1 {
443
443
  declare function BookingWidget({ className, title, subtitle, serviceSearchPlaceholder, categoryLabel, serviceListMaxHeight, serviceLayout, serviceColumns, showServicePagination, staffLayout, staffColumns, showStaffPagination, timeLayout, showFullyBookedLabel, calendarVariant, enableServiceSearch, enableCategoryFilter, enableDatePaging, disabledWeekdays, ...hookProps }: BookingWidgetProps$1): react_jsx_runtime.JSX.Element;
444
444
 
445
445
  interface BookingWidgetProps {
446
- /** Navigation links shown in the mobile menu overlay. Omit to hide hamburger. */
446
+ /** Navigation links shown in the mobile menu overlay. Omit to hide hamburger. @deprecated Use `mobileHeader` instead. */
447
447
  navLinks?: {
448
448
  label: string;
449
449
  href: string;
450
450
  }[];
451
- /** Custom icon for the mobile menu open button (default: lucide Menu) */
451
+ /** Custom icon for the mobile menu open button (default: lucide Menu) @deprecated Use `mobileHeader` instead. */
452
452
  menuIcon?: ReactNode;
453
- /** Custom icon for the mobile menu close button (default: lucide X) */
453
+ /** Custom icon for the mobile menu close button (default: lucide X) @deprecated Use `mobileHeader` instead. */
454
454
  closeIcon?: ReactNode;
455
455
  /** Override the category → icon mapping (keyword → React component) */
456
456
  categoryIcons?: Record<string, typeof Scissors>;
@@ -459,6 +459,7 @@ interface BookingWidgetProps {
459
459
  /**
460
460
  * Link component for mobile nav. Defaults to a plain `<a>` tag.
461
461
  * Next.js sites should pass `Link` from `next/link` for client-side navigation.
462
+ * @deprecated Use `mobileHeader` instead.
462
463
  */
463
464
  linkComponent?: ComponentType<{
464
465
  href: string;
@@ -466,8 +467,14 @@ interface BookingWidgetProps {
466
467
  onClick?: () => void;
467
468
  children: ReactNode;
468
469
  }>;
470
+ /**
471
+ * Site's mobile header/navbar component. Rendered inside the widget on mobile,
472
+ * replacing the built-in hamburger menu. Pass your SiteHeader component here
473
+ * so the booking widget uses the same navigation design as the rest of the site.
474
+ */
475
+ mobileHeader?: ReactNode;
469
476
  }
470
- declare function BookingWidgetPanel({ navLinks, menuIcon, closeIcon, categoryIcons, stepTitles, linkComponent: LinkComp, }?: BookingWidgetProps): react_jsx_runtime.JSX.Element;
477
+ declare function BookingWidgetPanel({ navLinks, menuIcon, closeIcon, categoryIcons, stepTitles, linkComponent: LinkComp, mobileHeader, }?: BookingWidgetProps): react_jsx_runtime.JSX.Element;
471
478
 
472
479
  interface AvailabilityPickerProps {
473
480
  serviceId: string;
package/dist/index.js CHANGED
@@ -1747,7 +1747,8 @@ function BookingWidgetPanel({
1747
1747
  closeIcon,
1748
1748
  categoryIcons,
1749
1749
  stepTitles,
1750
- linkComponent: LinkComp = DefaultLink
1750
+ linkComponent: LinkComp = DefaultLink,
1751
+ mobileHeader
1751
1752
  } = {}) {
1752
1753
  const widgetRef = useRef3(null);
1753
1754
  const formRef = useRef3(null);
@@ -1793,9 +1794,10 @@ function BookingWidgetPanel({
1793
1794
  }
1794
1795
  }
1795
1796
  }, [bw.isAvailabilityLoading, bw.selectedService?.id, bw.availabilityByDate, bw.selectedDate]);
1797
+ const hasCategories = bw.categories.length >= 1;
1796
1798
  const hasMultipleCategories = bw.categories.length > 1;
1797
1799
  useEffect2(() => {
1798
- if (hasMultipleCategories && bw.categoryFilter === "all") {
1800
+ if (hasCategories && bw.categoryFilter === "all") {
1799
1801
  bw.setCategoryFilter(bw.categories[0]);
1800
1802
  }
1801
1803
  }, [bw.categories.length]);
@@ -1811,7 +1813,7 @@ function BookingWidgetPanel({
1811
1813
  const scrollbars = [];
1812
1814
  const opts = {
1813
1815
  damping: 0.08,
1814
- continuousScrolling: false,
1816
+ continuousScrolling: true,
1815
1817
  alwaysShowTracks: false,
1816
1818
  plugins: {
1817
1819
  overscroll: { effect: "bounce", damping: 0.15, maxOverscroll: 80 }
@@ -1835,6 +1837,20 @@ function BookingWidgetPanel({
1835
1837
  };
1836
1838
  }, [isReady, mobileStep]);
1837
1839
  const initSvcScrollbar = (el) => {
1840
+ if (!el || typeof window !== "undefined" && window.matchMedia("(max-width: 1024px)").matches) {
1841
+ if (svcScrollbarRef.current) {
1842
+ try {
1843
+ svcScrollbarRef.current.destroy();
1844
+ } catch {
1845
+ }
1846
+ svcScrollbarRef.current = null;
1847
+ }
1848
+ return;
1849
+ }
1850
+ if (svcScrollbarRef.current && svcScrollbarRef.current.containerEl === el) {
1851
+ svcScrollbarRef.current.update();
1852
+ return;
1853
+ }
1838
1854
  if (svcScrollbarRef.current) {
1839
1855
  try {
1840
1856
  svcScrollbarRef.current.destroy();
@@ -1842,10 +1858,9 @@ function BookingWidgetPanel({
1842
1858
  }
1843
1859
  svcScrollbarRef.current = null;
1844
1860
  }
1845
- if (!el || typeof window !== "undefined" && window.matchMedia("(max-width: 1024px)").matches) return;
1846
1861
  svcScrollbarRef.current = Scrollbar.init(el, {
1847
1862
  damping: 0.08,
1848
- continuousScrolling: false,
1863
+ continuousScrolling: true,
1849
1864
  alwaysShowTracks: false,
1850
1865
  plugins: {
1851
1866
  overscroll: { effect: "bounce", damping: 0.15, maxOverscroll: 80 }
@@ -2006,10 +2021,12 @@ function BookingWidgetPanel({
2006
2021
  svc.id
2007
2022
  );
2008
2023
  };
2024
+ const useLegacyNav = !mobileHeader && navLinks.length > 0;
2009
2025
  return /* @__PURE__ */ jsxs5("div", { className: "bw", ref: widgetRef, children: [
2026
+ mobileHeader && /* @__PURE__ */ jsx9("div", { className: "bw-mobile-header", children: mobileHeader }),
2010
2027
  /* @__PURE__ */ jsxs5("div", { className: "bw-topbar", children: [
2011
2028
  /* @__PURE__ */ jsx9("div", { className: "bw-dots", children: Array.from({ length: 4 }, (_, i) => /* @__PURE__ */ jsx9("div", { className: `bw-dot ${mobileStep > i ? "is-filled" : ""}` }, i)) }),
2012
- navLinks.length > 0 && /* @__PURE__ */ jsx9(
2029
+ useLegacyNav && /* @__PURE__ */ jsx9(
2013
2030
  "button",
2014
2031
  {
2015
2032
  className: "bw-topbar-menu",
@@ -2019,7 +2036,7 @@ function BookingWidgetPanel({
2019
2036
  }
2020
2037
  )
2021
2038
  ] }),
2022
- navLinks.length > 0 && /* @__PURE__ */ jsx9(AnimatePresence, { children: navOpen && /* @__PURE__ */ jsx9(
2039
+ useLegacyNav && /* @__PURE__ */ jsx9(AnimatePresence, { children: navOpen && /* @__PURE__ */ jsx9(
2023
2040
  motion.div,
2024
2041
  {
2025
2042
  className: "bw-nav-overlay",