@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.
- package/dist/components/ImageGallery/ImageGallery.cjs.js +1 -1
- package/dist/components/ImageGallery/ImageGallery.es.js +36 -19
- package/dist/components/InfiniteScroll/InfiniteScroll.cjs.js +1 -1
- package/dist/components/InfiniteScroll/InfiniteScroll.d.ts +2 -0
- package/dist/components/InfiniteScroll/InfiniteScroll.es.js +138 -67
- package/dist/components/InfiniteScroll/infiniteScroll.module.css.cjs.js +1 -1
- package/dist/components/InfiniteScroll/infiniteScroll.module.css.es.js +8 -6
- package/dist/healthspan-marketing-ui.css +1 -1
- package/dist/lib/useSwiper.d.ts +9 -2
- package/dist/modules/Curiosity/Curiosity.cjs.js +1 -1
- package/dist/modules/Curiosity/Curiosity.es.js +15 -12
- package/dist/modules/HowItWorks/components/Content/Content.d.ts +2 -2
- package/dist/utils/useSwiper/useSwiper.cjs.js +1 -1
- package/dist/utils/useSwiper/useSwiper.es.js +66 -36
- package/package.json +1 -1
package/dist/lib/useSwiper.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
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"),
|
|
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
|
|
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
|
|
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
|
-
|
|
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(
|
|
24
|
-
/* @__PURE__ */ t("div", { className: e.buttonContainer, children: /* @__PURE__ */ t(
|
|
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(
|
|
28
|
+
/* @__PURE__ */ t(n, { defaultVariant: "labelMd", children: r.number }),
|
|
29
29
|
/* @__PURE__ */ t("div", { className: e.divider }),
|
|
30
|
-
/* @__PURE__ */ t(
|
|
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,
|
|
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
|
-
|
|
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
|
-
|
|
63
|
+
V as Curiosity
|
|
61
64
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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:
|
|
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
|
|
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
|
|
2
|
-
const
|
|
3
|
-
const [n,
|
|
4
|
-
|
|
5
|
-
}, []),
|
|
6
|
-
n && (n.slidePrev(),
|
|
7
|
-
}, [n,
|
|
8
|
-
n && (n.slideNext(),
|
|
9
|
-
}, [n,
|
|
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),
|
|
11
|
+
n && (n.slideTo(e), s(n));
|
|
12
12
|
},
|
|
13
|
-
[n,
|
|
14
|
-
),
|
|
15
|
-
|
|
16
|
-
},
|
|
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
|
-
|
|
18
|
+
o(e.isEnd), u(e == null ? void 0 : e.isLocked), s(e);
|
|
19
19
|
},
|
|
20
|
-
[
|
|
21
|
-
),
|
|
22
|
-
|
|
23
|
-
}, []),
|
|
24
|
-
|
|
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:
|
|
29
|
-
activeIndex:
|
|
30
|
-
setActiveIndex:
|
|
31
|
-
isEnd:
|
|
32
|
-
setIsEnd:
|
|
28
|
+
setSwiper: t,
|
|
29
|
+
activeIndex: d,
|
|
30
|
+
setActiveIndex: a,
|
|
31
|
+
isEnd: h,
|
|
32
|
+
setIsEnd: o,
|
|
33
33
|
hideNav: f,
|
|
34
|
-
handleSlideChange:
|
|
35
|
-
handlePrevClick:
|
|
36
|
-
handleNextClick:
|
|
37
|
-
handleSlideTo:
|
|
38
|
-
onSwiperInit:
|
|
39
|
-
handleSwiperResize:
|
|
40
|
-
isBeginning:
|
|
41
|
-
setIsBeginning:
|
|
42
|
-
handleReachEnd:
|
|
43
|
-
handleReachBeginning:
|
|
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
|
-
|
|
76
|
+
A as useSwiper,
|
|
77
|
+
P as useSwiperWithAutoPlay
|
|
48
78
|
};
|