@zenpatient-org/healthspan-marketing-ui 0.1.135 → 0.1.136

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,7 +1,7 @@
1
1
  import { default as React } from 'react';
2
2
  import { Swiper as SwiperType } from 'swiper';
3
3
 
4
- export type UseSwiperReturnProps = {
4
+ export type BaseSwiperReturnProps = {
5
5
  swiper: SwiperType | null;
6
6
  setSwiper: React.Dispatch<React.SetStateAction<SwiperType | null>>;
7
7
  activeIndex: number;
@@ -20,4 +20,11 @@ export type UseSwiperReturnProps = {
20
20
  onSwiperInit: (swiper: SwiperType) => void;
21
21
  handleSwiperResize: (swiper: SwiperType) => void;
22
22
  };
23
- export declare const useSwiper: () => UseSwiperReturnProps;
23
+ export type AutoPlaySwiperReturnProps = BaseSwiperReturnProps & {
24
+ isAutoPlay: boolean;
25
+ stopAutoPlay: () => void;
26
+ startAutoPlay: () => void;
27
+ handleUserInteraction: () => void;
28
+ };
29
+ export declare const useSwiper: () => BaseSwiperReturnProps;
30
+ export declare const useSwiperWithAutoPlay: (autoPlayInterval?: number) => AutoPlaySwiperReturnProps;
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("../../components/Button/Button.cjs.js"),m=require("../../components/HighlightedTitle/HighlightedTitle.cjs.js"),o=require("../../components/InfiniteScroll/InfiniteScroll.cjs.js"),n=require("../../components/Typography/Typography.cjs.js"),d=require("../../components/StudyGridCard/StudyGridCard.cjs.js"),t=require("./curiosity.module.css.cjs.js"),f=require("../../utils/cn/cn.cjs.js"),h=({title:c,description:r,studies:s,indexed:i})=>e.jsxs("div",{className:f.cn(t.default.root,{[t.default.notIndexed]:!i}),children:[e.jsxs("div",{className:t.default.contentContainer,children:[e.jsxs("div",{className:t.default.containerHeader,children:[e.jsx(m.HighlightedTitle,{title:c,className:t.default.title,defaultVariant:"displayXl",mobileVariant:"displayXs"}),e.jsxs("div",{className:t.default.contentTextContainer,children:[r&&e.jsx(n.Typography,{defaultVariant:"bodyLg",mobileVariant:"bodySm",className:t.default.contentText,children:r}),e.jsx("div",{className:t.default.buttonContainer,children:e.jsx(u.Button,{as:"a",href:"/research",variant:"muted",size:"lg",children:"View all studies"})})]})]}),i&&e.jsxs("div",{className:t.default.dividerContainer,children:[e.jsx(n.Typography,{defaultVariant:"labelMd",children:i.number}),e.jsx("div",{className:t.default.divider}),e.jsx(n.Typography,{defaultVariant:"labelMd",emphasis:!0,children:i.label})]})]}),e.jsxs("div",{className:t.default.containerBottom,children:[e.jsx(o.InfiniteScroll,{items:s,speed:50,contentClassName:t.default.infiniteScrollContent,itemClassName:t.default.infiniteScrollItem,rootClassName:t.default.infiniteScrollRoot,renderItem:(a,l)=>e.jsx(d.StudyGridCard,{...a,compressed:!0},l)}),e.jsx(o.InfiniteScroll,{items:s,speed:50,direction:"right",contentClassName:t.default.infiniteScrollContent,itemClassName:t.default.infiniteScrollItemTwo,rootClassName:t.default.infiniteScrollRoot,renderItem:(a,l)=>e.jsx(d.StudyGridCard,{...a,compressed:!0},l)})]})]});exports.Curiosity=h;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("../../components/Button/Button.cjs.js"),m=require("../../components/HighlightedTitle/HighlightedTitle.cjs.js"),o=require("../../components/InfiniteScroll/InfiniteScroll.cjs.js"),a=require("../../components/Typography/Typography.cjs.js"),d=require("../../components/StudyGridCard/StudyGridCard.cjs.js"),f=require("../../utils/cn/cn.cjs.js"),t=require("./curiosity.module.css.cjs.js"),h=({title:c,description:r,studies:s,indexed:i})=>e.jsxs("div",{className:f.cn(t.default.root,{[t.default.notIndexed]:!i}),children:[e.jsxs("div",{className:t.default.contentContainer,children:[e.jsxs("div",{className:t.default.containerHeader,children:[e.jsx(m.HighlightedTitle,{title:c,className:t.default.title,defaultVariant:"displayXl",mobileVariant:"displayXs"}),e.jsxs("div",{className:t.default.contentTextContainer,children:[r&&e.jsx(a.Typography,{defaultVariant:"bodyLg",mobileVariant:"bodySm",className:t.default.contentText,children:r}),e.jsx("div",{className:t.default.buttonContainer,children:e.jsx(u.Button,{as:"a",href:"/research",variant:"muted",size:"lg",children:"View all studies"})})]})]}),i&&e.jsxs("div",{className:t.default.dividerContainer,children:[e.jsx(a.Typography,{defaultVariant:"labelMd",children:i.number}),e.jsx("div",{className:t.default.divider}),e.jsx(a.Typography,{defaultVariant:"labelMd",emphasis:!0,children:i.label})]})]}),e.jsxs("div",{className:t.default.containerBottom,children:[e.jsx(o.InfiniteScroll,{items:s,speed:50,slowOnTouch:!0,enableManualScroll:!0,contentClassName:t.default.infiniteScrollContent,itemClassName:t.default.infiniteScrollItem,rootClassName:t.default.infiniteScrollRoot,renderItem:(l,n)=>e.jsx(d.StudyGridCard,{...l,compressed:!0},n)}),e.jsx(o.InfiniteScroll,{items:s,speed:50,direction:"right",slowOnTouch:!0,enableManualScroll:!0,contentClassName:t.default.infiniteScrollContent,itemClassName:t.default.infiniteScrollItemTwo,renderItem:(l,n)=>e.jsx(d.StudyGridCard,{...l,compressed:!0},n)})]})]});exports.Curiosity=h;
@@ -1,13 +1,13 @@
1
1
  "use client";
2
2
  import { jsxs as i, jsx as t } from "react/jsx-runtime";
3
- import { Button as f } from "../../components/Button/Button.es.js";
3
+ import { Button as u } from "../../components/Button/Button.es.js";
4
4
  import { HighlightedTitle as h } from "../../components/HighlightedTitle/HighlightedTitle.es.js";
5
5
  import { InfiniteScroll as m } from "../../components/InfiniteScroll/InfiniteScroll.es.js";
6
- import { Typography as l } from "../../components/Typography/Typography.es.js";
6
+ import { Typography as n } from "../../components/Typography/Typography.es.js";
7
7
  import { StudyGridCard as c } from "../../components/StudyGridCard/StudyGridCard.es.js";
8
+ import { cn as f } from "../../utils/cn/cn.es.js";
8
9
  import e from "./curiosity.module.css.es.js";
9
- import { cn as p } from "../../utils/cn/cn.es.js";
10
- const g = ({ title: d, description: o, studies: s, indexed: r }) => /* @__PURE__ */ i("div", { className: p(e.root, { [e.notIndexed]: !r }), children: [
10
+ const V = ({ title: d, description: o, studies: s, indexed: r }) => /* @__PURE__ */ i("div", { className: f(e.root, { [e.notIndexed]: !r }), children: [
11
11
  /* @__PURE__ */ i("div", { className: e.contentContainer, children: [
12
12
  /* @__PURE__ */ i("div", { className: e.containerHeader, children: [
13
13
  /* @__PURE__ */ t(
@@ -20,14 +20,14 @@ const g = ({ title: d, description: o, studies: s, indexed: r }) => /* @__PURE__
20
20
  }
21
21
  ),
22
22
  /* @__PURE__ */ i("div", { className: e.contentTextContainer, children: [
23
- o && /* @__PURE__ */ t(l, { defaultVariant: "bodyLg", mobileVariant: "bodySm", className: e.contentText, children: o }),
24
- /* @__PURE__ */ t("div", { className: e.buttonContainer, children: /* @__PURE__ */ t(f, { as: "a", href: "/research", variant: "muted", size: "lg", children: "View all studies" }) })
23
+ o && /* @__PURE__ */ t(n, { defaultVariant: "bodyLg", mobileVariant: "bodySm", className: e.contentText, children: o }),
24
+ /* @__PURE__ */ t("div", { className: e.buttonContainer, children: /* @__PURE__ */ t(u, { as: "a", href: "/research", variant: "muted", size: "lg", children: "View all studies" }) })
25
25
  ] })
26
26
  ] }),
27
27
  r && /* @__PURE__ */ i("div", { className: e.dividerContainer, children: [
28
- /* @__PURE__ */ t(l, { defaultVariant: "labelMd", children: r.number }),
28
+ /* @__PURE__ */ t(n, { defaultVariant: "labelMd", children: r.number }),
29
29
  /* @__PURE__ */ t("div", { className: e.divider }),
30
- /* @__PURE__ */ t(l, { defaultVariant: "labelMd", emphasis: !0, children: r.label })
30
+ /* @__PURE__ */ t(n, { defaultVariant: "labelMd", emphasis: !0, children: r.label })
31
31
  ] })
32
32
  ] }),
33
33
  /* @__PURE__ */ i("div", { className: e.containerBottom, children: [
@@ -36,10 +36,12 @@ const g = ({ title: d, description: o, studies: s, indexed: r }) => /* @__PURE__
36
36
  {
37
37
  items: s,
38
38
  speed: 50,
39
+ slowOnTouch: !0,
40
+ enableManualScroll: !0,
39
41
  contentClassName: e.infiniteScrollContent,
40
42
  itemClassName: e.infiniteScrollItem,
41
43
  rootClassName: e.infiniteScrollRoot,
42
- renderItem: (a, n) => /* @__PURE__ */ t(c, { ...a, compressed: !0 }, n)
44
+ renderItem: (a, l) => /* @__PURE__ */ t(c, { ...a, compressed: !0 }, l)
43
45
  }
44
46
  ),
45
47
  /* @__PURE__ */ t(
@@ -48,14 +50,15 @@ const g = ({ title: d, description: o, studies: s, indexed: r }) => /* @__PURE__
48
50
  items: s,
49
51
  speed: 50,
50
52
  direction: "right",
53
+ slowOnTouch: !0,
54
+ enableManualScroll: !0,
51
55
  contentClassName: e.infiniteScrollContent,
52
56
  itemClassName: e.infiniteScrollItemTwo,
53
- rootClassName: e.infiniteScrollRoot,
54
- renderItem: (a, n) => /* @__PURE__ */ t(c, { ...a, compressed: !0 }, n)
57
+ renderItem: (a, l) => /* @__PURE__ */ t(c, { ...a, compressed: !0 }, l)
55
58
  }
56
59
  )
57
60
  ] })
58
61
  ] });
59
62
  export {
60
- g as Curiosity
63
+ V as Curiosity
61
64
  };
@@ -1,4 +1,4 @@
1
- import { UseSwiperReturnProps } from '../../../../lib/useSwiper';
1
+ import { BaseSwiperReturnProps } from '../../../../lib/useSwiper';
2
2
 
3
3
  type ContentProps = {
4
4
  items: Array<{
@@ -8,7 +8,7 @@ type ContentProps = {
8
8
  }>;
9
9
  colorScheme: 'light' | 'dark';
10
10
  showBottomNav: boolean;
11
- swiper: UseSwiperReturnProps;
11
+ swiper: BaseSwiperReturnProps;
12
12
  };
13
13
  export declare const Content: ({ items, colorScheme, showBottomNav, swiper }: ContentProps) => import("react/jsx-runtime").JSX.Element;
14
14
  export {};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),x=()=>{const[n,c]=t.useState(null),[o,i]=t.useState(0),[u,l]=t.useState(!0),[S,s]=t.useState(!1),[g,d]=t.useState(!1),a=t.useCallback(e=>{i(e.activeIndex),s(e.isEnd),l(e.isBeginning)},[]),h=t.useCallback(()=>{n&&(n.slidePrev(),a(n))},[n,a]),k=t.useCallback(()=>{n&&(n.slideNext(),a(n))},[n,a]),C=t.useCallback(e=>{n&&(n.slideTo(e),a(n))},[n,a]),b=e=>{c(e),d(e==null?void 0:e.isLocked),a(e)},f=t.useCallback(e=>{s(e.isEnd),d(e==null?void 0:e.isLocked),a(e)},[a]),v=t.useCallback(()=>{s(!0),l(!1)},[]),r=t.useCallback(()=>{l(!0),s(!1)},[]);return{swiper:n,setSwiper:c,activeIndex:o,setActiveIndex:i,isEnd:S,setIsEnd:s,hideNav:g,handleSlideChange:a,handlePrevClick:h,handleNextClick:k,handleSlideTo:C,onSwiperInit:b,handleSwiperResize:f,isBeginning:u,setIsBeginning:l,handleReachEnd:v,handleReachBeginning:r}};exports.useSwiper=x;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),h=()=>{const[n,s]=e.useState(null),[u,r]=e.useState(0),[a,l]=e.useState(!0),[f,c]=e.useState(!1),[d,o]=e.useState(!1),i=e.useCallback(t=>{r(t.activeIndex),c(t.isEnd),l(t.isBeginning)},[]),b=e.useCallback(()=>{n&&(n.slidePrev(),i(n))},[n,i]),v=e.useCallback(()=>{n&&(n.slideNext(),i(n))},[n,i]),S=e.useCallback(t=>{n&&(n.slideTo(t),i(n))},[n,i]),g=t=>{s(t),o(t==null?void 0:t.isLocked),i(t)},k=e.useCallback(t=>{c(t.isEnd),o(t==null?void 0:t.isLocked),i(t)},[i]),C=e.useCallback(()=>{c(!0),l(!1)},[]),E=e.useCallback(()=>{l(!0),c(!1)},[]);return{swiper:n,setSwiper:s,activeIndex:u,setActiveIndex:r,isEnd:f,setIsEnd:c,hideNav:d,handleSlideChange:i,handlePrevClick:b,handleNextClick:v,handleSlideTo:S,onSwiperInit:g,handleSwiperResize:k,isBeginning:a,setIsBeginning:l,handleReachEnd:C,handleReachBeginning:E}},y=(n=3e3)=>{const s=h(),[u,r]=e.useState(!0),a=e.useRef(null),l=e.useCallback(()=>{r(!1),a.current&&(clearInterval(a.current),a.current=null)},[]),f=e.useCallback(()=>{r(!0)},[]),c=e.useCallback(()=>{l()},[l]);return e.useEffect(()=>{if(!(!u||!s.swiper||s.swiper.slides.length<=1))return a.current=setInterval(()=>{s.swiper&&(s.isEnd?s.swiper.slideTo(0):s.swiper.slideNext())},n),()=>{a.current&&(clearInterval(a.current),a.current=null)}},[u,s.swiper,s.isEnd,n]),e.useEffect(()=>{const d=()=>l(),o=()=>{document.hidden&&l()};return window.addEventListener("beforeunload",d),document.addEventListener("visibilitychange",o),()=>{window.removeEventListener("beforeunload",d),document.removeEventListener("visibilitychange",o)}},[l]),{...s,isAutoPlay:u,stopAutoPlay:l,startAutoPlay:f,handleUserInteraction:c}};exports.useSwiper=h;exports.useSwiperWithAutoPlay=y;
@@ -1,48 +1,78 @@
1
- import { useState as s, useCallback as d } from "react";
2
- const N = () => {
3
- const [n, l] = s(null), [h, o] = s(0), [g, c] = s(!0), [u, i] = s(!1), [f, a] = s(!1), t = d((e) => {
4
- o(e.activeIndex), i(e.isEnd), c(e.isBeginning);
5
- }, []), v = d(() => {
6
- n && (n.slidePrev(), t(n));
7
- }, [n, t]), S = d(() => {
8
- n && (n.slideNext(), t(n));
9
- }, [n, t]), x = d(
1
+ import { useState as c, useCallback as r, useRef as y, useEffect as v } from "react";
2
+ const A = () => {
3
+ const [n, t] = c(null), [d, a] = c(0), [l, i] = c(!0), [h, o] = c(!1), [f, u] = c(!1), s = r((e) => {
4
+ a(e.activeIndex), o(e.isEnd), i(e.isBeginning);
5
+ }, []), g = r(() => {
6
+ n && (n.slidePrev(), s(n));
7
+ }, [n, s]), E = r(() => {
8
+ n && (n.slideNext(), s(n));
9
+ }, [n, s]), S = r(
10
10
  (e) => {
11
- n && (n.slideTo(e), t(n));
11
+ n && (n.slideTo(e), s(n));
12
12
  },
13
- [n, t]
14
- ), k = (e) => {
15
- l(e), a(e == null ? void 0 : e.isLocked), t(e);
16
- }, E = d(
13
+ [n, s]
14
+ ), m = (e) => {
15
+ t(e), u(e == null ? void 0 : e.isLocked), s(e);
16
+ }, I = r(
17
17
  (e) => {
18
- i(e.isEnd), a(e == null ? void 0 : e.isLocked), t(e);
18
+ o(e.isEnd), u(e == null ? void 0 : e.isLocked), s(e);
19
19
  },
20
- [t]
21
- ), B = d(() => {
22
- i(!0), c(!1);
23
- }, []), C = d(() => {
24
- c(!0), i(!1);
20
+ [s]
21
+ ), b = r(() => {
22
+ o(!0), i(!1);
23
+ }, []), x = r(() => {
24
+ i(!0), o(!1);
25
25
  }, []);
26
26
  return {
27
27
  swiper: n,
28
- setSwiper: l,
29
- activeIndex: h,
30
- setActiveIndex: o,
31
- isEnd: u,
32
- setIsEnd: i,
28
+ setSwiper: t,
29
+ activeIndex: d,
30
+ setActiveIndex: a,
31
+ isEnd: h,
32
+ setIsEnd: o,
33
33
  hideNav: f,
34
- handleSlideChange: t,
35
- handlePrevClick: v,
36
- handleNextClick: S,
37
- handleSlideTo: x,
38
- onSwiperInit: k,
39
- handleSwiperResize: E,
40
- isBeginning: g,
41
- setIsBeginning: c,
42
- handleReachEnd: B,
43
- handleReachBeginning: C
34
+ handleSlideChange: s,
35
+ handlePrevClick: g,
36
+ handleNextClick: E,
37
+ handleSlideTo: S,
38
+ onSwiperInit: m,
39
+ handleSwiperResize: I,
40
+ isBeginning: l,
41
+ setIsBeginning: i,
42
+ handleReachEnd: b,
43
+ handleReachBeginning: x
44
+ };
45
+ }, P = (n = 3e3) => {
46
+ const t = A(), [d, a] = c(!0), l = y(null), i = r(() => {
47
+ a(!1), l.current && (clearInterval(l.current), l.current = null);
48
+ }, []), h = r(() => {
49
+ a(!0);
50
+ }, []), o = r(() => {
51
+ i();
52
+ }, [i]);
53
+ return v(() => {
54
+ if (!(!d || !t.swiper || t.swiper.slides.length <= 1))
55
+ return l.current = setInterval(() => {
56
+ t.swiper && (t.isEnd ? t.swiper.slideTo(0) : t.swiper.slideNext());
57
+ }, n), () => {
58
+ l.current && (clearInterval(l.current), l.current = null);
59
+ };
60
+ }, [d, t.swiper, t.isEnd, n]), v(() => {
61
+ const f = () => i(), u = () => {
62
+ document.hidden && i();
63
+ };
64
+ return window.addEventListener("beforeunload", f), document.addEventListener("visibilitychange", u), () => {
65
+ window.removeEventListener("beforeunload", f), document.removeEventListener("visibilitychange", u);
66
+ };
67
+ }, [i]), {
68
+ ...t,
69
+ isAutoPlay: d,
70
+ stopAutoPlay: i,
71
+ startAutoPlay: h,
72
+ handleUserInteraction: o
44
73
  };
45
74
  };
46
75
  export {
47
- N as useSwiper
76
+ A as useSwiper,
77
+ P as useSwiperWithAutoPlay
48
78
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenpatient-org/healthspan-marketing-ui",
3
- "version": "0.1.135",
3
+ "version": "0.1.136",
4
4
  "description": "Design system",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.es.js",