@zenpatient-org/healthspan-marketing-ui 0.1.55 → 0.1.56
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 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),H=require("../../node_modules/@gsap/react/src/index.cjs.js"),d=require("../../node_modules/gsap/index.cjs.js"),u=require("../../node_modules/gsap/ScrollTrigger.cjs.js"),w=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),H=require("../../node_modules/@gsap/react/src/index.cjs.js"),d=require("../../node_modules/gsap/index.cjs.js"),u=require("../../node_modules/gsap/ScrollTrigger.cjs.js"),w=require("react"),V=require("../../components/HighlightedTitle/HighlightedTitle.cjs.js"),n=require("../../components/Typography/Typography.cjs.js"),A=require("../../utils/debounce.cjs.js"),r=require("./expandingDetails.module.css.cjs.js");d.gsap.registerPlugin(u.ScrollTrigger);const $=({colorScheme:h,label:f,title:N,sections:P})=>{const s=w.useRef(null);return H.useGSAP(()=>{if(!s.current)return;const a=()=>{var x;d.gsap.killTweensOf("*"),u.ScrollTrigger.getAll().forEach(e=>e.kill());const o=d.gsap.utils.toArray('[data-scroll-id="section"]'),t=(x=s.current)==null?void 0:x.querySelector('[data-scroll-id="sections"]');if(!t)return;const p=d.gsap.timeline({scrollTrigger:{trigger:s.current,start:"top top",end:()=>`+=${o.length*500}`,scrub:1,markers:!1,pin:!0}}),y=t==null?void 0:t.querySelector('[data-scroll-id="heading"]');if(!y)return;d.gsap.set(t==null?void 0:t.querySelectorAll('[data-scroll-id="section"]'),{height:y.offsetHeight||0}),d.gsap.set(t==null?void 0:t.querySelectorAll('[data-scroll-id="protocol"]'),{scale:.5,yPercent:0}),d.gsap.set(t==null?void 0:t.querySelectorAll('[data-scroll-id="image-circle"]'),{scale:.5,yPercent:5});const m=window.innerWidth<768?1.2:2,S=window.innerWidth<768?1.2:2;o.forEach((e,E)=>{var q,T,j,b,v;const g=e==null?void 0:e.querySelector('[data-scroll-id="heading"]'),i=e==null?void 0:e.querySelector('[data-scroll-id="content"]');!g||!i||(p.to(e,{height:g.offsetHeight+i.offsetHeight}).to(e==null?void 0:e.querySelector('[data-scroll-id="section-title"]'),{scale:m,yPercent:50},"<").to(e==null?void 0:e.querySelector('[data-scroll-id="section-index"]'),{scale:S,yPercent:50},"<").to(i,{height:i.offsetHeight},"<").to(e==null?void 0:e.querySelector('[data-scroll-id="protocol"]'),{scale:1},"<").to(e==null?void 0:e.querySelector('[data-scroll-id="image-circle"]'),{scale:1,yPercent:5},"<"),E<o.length-1&&p.to(e,{height:g.offsetHeight,delay:.5}).to(e.nextElementSibling,{height:g.offsetHeight+i.offsetHeight},"<").to(((q=e.nextElementSibling)==null?void 0:q.querySelector('[data-scroll-id="section-title"]'))||null,{scale:m,yPercent:100},"<").to(((T=e.nextElementSibling)==null?void 0:T.querySelector('[data-scroll-id="section-index"]'))||null,{scale:S,yPercent:100},"<").to(((j=e.nextElementSibling)==null?void 0:j.querySelector('[data-scroll-id="content"]'))||null,{height:i.offsetHeight,yPercent:0},"<").to(((b=e.nextElementSibling)==null?void 0:b.querySelector('[data-scroll-id="protocol"]'))||null,{scale:1},"<").to(((v=e.nextElementSibling)==null?void 0:v.querySelector('[data-scroll-id="image-circle"]'))||null,{scale:1,yPercent:5},"<").to(e==null?void 0:e.querySelector('[data-scroll-id="section-title"]'),{scale:1,yPercent:-15},"<").to(e==null?void 0:e.querySelector('[data-scroll-id="section-index"]'),{scale:1,yPercent:-15},"<").to(i,{height:0,yPercent:0},"<").to(e==null?void 0:e.querySelector('[data-scroll-id="protocol"]'),{scale:0,yPercent:200},"<").to(e==null?void 0:e.querySelector('[data-scroll-id="image-circle"]'),{scale:0,yPercent:200},"<"))})};a();const c=A.default(()=>{a()},200);return window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c),u.ScrollTrigger.getAll().forEach(o=>o.kill()),d.gsap.killTweensOf("*")}},{scope:s,dependencies:[s]}),l.jsx("div",{ref:s,className:`${r.default.root} ${r.default[h]}`,children:l.jsxs("div",{className:r.default.expandingDetailsWrapper,children:[l.jsxs("header",{"data-scroll-id":"header",className:r.default.header,children:[f&&l.jsx(n.Typography,{as:"div",defaultVariant:"labelSm",emphasis:!0,className:r.default.label,children:f}),l.jsx(V.HighlightedTitle,{as:"div",defaultVariant:"displayMd",mobileVariant:"headingXl",colorScheme:h,className:r.default.title,title:N})]}),l.jsx("div",{"data-scroll-id":"sections",className:r.default.sections,children:P.map((a,c)=>l.jsxs("div",{id:`section-${c+1}`,"data-scroll-id":"section",className:r.default.section,children:[l.jsxs("div",{"data-scroll-id":"heading",className:r.default.heading,children:[l.jsx("div",{"data-scroll-id":"section-title",className:r.default.sectionTitleWrapper,children:l.jsx(n.Typography,{as:"h3",defaultVariant:"headingSm",className:r.default.sectionTitle,children:a.title})}),l.jsx("div",{"data-scroll-id":"section-index",className:r.default.sectionIndexWrapper,children:l.jsxs(n.Typography,{as:"p",defaultVariant:"headingSm",className:r.default.sectionIndex,children:["(",String(c+1).padStart(2,"0"),")"]})})]}),l.jsxs("div",{"data-scroll-id":"content",className:r.default.content,children:[l.jsxs("div",{"data-scroll-id":"protocol",className:r.default.protocolWrapper,children:[a.subtitle&&l.jsx(n.Typography,{as:"h4",defaultVariant:"headingLg",mobileVariant:"headingXs",children:a.subtitle}),l.jsx(n.Typography,{as:"p",defaultVariant:"bodyMd",mobileVariant:"bodySm",children:a.description})]}),l.jsx("div",{"data-scroll-id":"image-circle",className:r.default.imageCircle,children:l.jsx("img",{src:a.image,alt:a.title})})]}),l.jsx("div",{className:r.default.leftBorder}),l.jsx("div",{className:r.default.rightBorder})]},a.title))})]})})};exports.ExpandingDetails=$;
|
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { useGSAP as
|
|
3
|
-
import { gsap as
|
|
4
|
-
import { ScrollTrigger as
|
|
5
|
-
import { useRef as
|
|
1
|
+
import { jsx as t, jsxs as c } from "react/jsx-runtime";
|
|
2
|
+
import { useGSAP as V } from "../../node_modules/@gsap/react/src/index.es.js";
|
|
3
|
+
import { gsap as i } from "../../node_modules/gsap/index.es.js";
|
|
4
|
+
import { ScrollTrigger as m } from "../../node_modules/gsap/ScrollTrigger.es.js";
|
|
5
|
+
import { useRef as A } from "react";
|
|
6
6
|
import { HighlightedTitle as W } from "../../components/HighlightedTitle/HighlightedTitle.es.js";
|
|
7
|
-
import { Typography as
|
|
7
|
+
import { Typography as h } from "../../components/Typography/Typography.es.js";
|
|
8
8
|
import k from "../../utils/debounce.es.js";
|
|
9
9
|
import l from "./expandingDetails.module.css.es.js";
|
|
10
|
-
|
|
11
|
-
const O = ({ colorScheme: u, label:
|
|
12
|
-
const
|
|
13
|
-
return
|
|
10
|
+
i.registerPlugin(m);
|
|
11
|
+
const O = ({ colorScheme: u, label: f, title: w, sections: T }) => {
|
|
12
|
+
const o = A(null);
|
|
13
|
+
return V(
|
|
14
14
|
() => {
|
|
15
|
-
if (!
|
|
15
|
+
if (!o.current) return;
|
|
16
16
|
const a = () => {
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
const n =
|
|
17
|
+
var v;
|
|
18
|
+
i.killTweensOf("*"), m.getAll().forEach((e) => e.kill());
|
|
19
|
+
const n = i.utils.toArray('[data-scroll-id="section"]'), r = (v = o.current) == null ? void 0 : v.querySelector('[data-scroll-id="sections"]');
|
|
20
20
|
if (!r) return;
|
|
21
|
-
const
|
|
21
|
+
const p = i.timeline({
|
|
22
22
|
scrollTrigger: {
|
|
23
|
-
trigger:
|
|
23
|
+
trigger: o.current,
|
|
24
24
|
start: "top top",
|
|
25
25
|
end: () => `+=${n.length * 500}`,
|
|
26
26
|
scrub: 1,
|
|
27
27
|
markers: !1,
|
|
28
28
|
pin: !0
|
|
29
29
|
}
|
|
30
|
-
}),
|
|
31
|
-
if (!
|
|
32
|
-
|
|
33
|
-
height:
|
|
34
|
-
}),
|
|
30
|
+
}), y = r == null ? void 0 : r.querySelector('[data-scroll-id="heading"]');
|
|
31
|
+
if (!y) return;
|
|
32
|
+
i.set(r == null ? void 0 : r.querySelectorAll('[data-scroll-id="section"]'), {
|
|
33
|
+
height: y.offsetHeight || 0
|
|
34
|
+
}), i.set(r == null ? void 0 : r.querySelectorAll('[data-scroll-id="protocol"]'), {
|
|
35
35
|
scale: 0.5,
|
|
36
36
|
yPercent: 0
|
|
37
|
-
}),
|
|
37
|
+
}), i.set(r == null ? void 0 : r.querySelectorAll('[data-scroll-id="image-circle"]'), {
|
|
38
38
|
scale: 0.5,
|
|
39
39
|
yPercent: 5
|
|
40
40
|
});
|
|
41
|
-
const
|
|
41
|
+
const S = window.innerWidth < 768 ? 1.2 : 2, q = window.innerWidth < 768 ? 1.2 : 2;
|
|
42
42
|
n.forEach((e, H) => {
|
|
43
|
-
var
|
|
44
|
-
const
|
|
45
|
-
!
|
|
43
|
+
var x, N, b, P, E;
|
|
44
|
+
const g = e == null ? void 0 : e.querySelector('[data-scroll-id="heading"]'), d = e == null ? void 0 : e.querySelector('[data-scroll-id="content"]');
|
|
45
|
+
!g || !d || (p.to(e, { height: g.offsetHeight + d.offsetHeight }).to(
|
|
46
46
|
e == null ? void 0 : e.querySelector('[data-scroll-id="section-title"]'),
|
|
47
|
-
{ scale:
|
|
47
|
+
{ scale: S, yPercent: 50 },
|
|
48
48
|
"<"
|
|
49
49
|
).to(
|
|
50
50
|
e == null ? void 0 : e.querySelector('[data-scroll-id="section-index"]'),
|
|
51
|
-
{ scale:
|
|
51
|
+
{ scale: q, yPercent: 50 },
|
|
52
52
|
"<"
|
|
53
|
-
).to(
|
|
53
|
+
).to(d, { height: d.offsetHeight }, "<").to(e == null ? void 0 : e.querySelector('[data-scroll-id="protocol"]'), { scale: 1 }, "<").to(e == null ? void 0 : e.querySelector('[data-scroll-id="image-circle"]'), { scale: 1, yPercent: 5 }, "<"), H < n.length - 1 && p.to(e, { height: g.offsetHeight, delay: 0.5 }).to(
|
|
54
54
|
e.nextElementSibling,
|
|
55
|
-
{ height:
|
|
55
|
+
{ height: g.offsetHeight + d.offsetHeight },
|
|
56
56
|
"<"
|
|
57
57
|
).to(
|
|
58
|
-
((
|
|
59
|
-
{ scale:
|
|
58
|
+
((x = e.nextElementSibling) == null ? void 0 : x.querySelector('[data-scroll-id="section-title"]')) || null,
|
|
59
|
+
{ scale: S, yPercent: 100 },
|
|
60
60
|
"<"
|
|
61
61
|
).to(
|
|
62
62
|
((N = e.nextElementSibling) == null ? void 0 : N.querySelector('[data-scroll-id="section-index"]')) || null,
|
|
63
|
-
{ scale:
|
|
63
|
+
{ scale: q, yPercent: 100 },
|
|
64
64
|
"<"
|
|
65
65
|
).to(
|
|
66
|
-
((
|
|
67
|
-
{ height:
|
|
66
|
+
((b = e.nextElementSibling) == null ? void 0 : b.querySelector('[data-scroll-id="content"]')) || null,
|
|
67
|
+
{ height: d.offsetHeight, yPercent: 0 },
|
|
68
68
|
"<"
|
|
69
69
|
).to(
|
|
70
70
|
((P = e.nextElementSibling) == null ? void 0 : P.querySelector('[data-scroll-id="protocol"]')) || null,
|
|
71
71
|
{ scale: 1 },
|
|
72
72
|
"<"
|
|
73
73
|
).to(
|
|
74
|
-
((
|
|
74
|
+
((E = e.nextElementSibling) == null ? void 0 : E.querySelector('[data-scroll-id="image-circle"]')) || null,
|
|
75
75
|
{ scale: 1, yPercent: 5 },
|
|
76
76
|
"<"
|
|
77
77
|
).to(
|
|
@@ -82,7 +82,7 @@ const O = ({ colorScheme: u, label: E, title: w, sections: T }) => {
|
|
|
82
82
|
e == null ? void 0 : e.querySelector('[data-scroll-id="section-index"]'),
|
|
83
83
|
{ scale: 1, yPercent: -15 },
|
|
84
84
|
"<"
|
|
85
|
-
).to(
|
|
85
|
+
).to(d, { height: 0, yPercent: 0 }, "<").to(e == null ? void 0 : e.querySelector('[data-scroll-id="protocol"]'), { scale: 0, yPercent: 200 }, "<").to(
|
|
86
86
|
e == null ? void 0 : e.querySelector('[data-scroll-id="image-circle"]'),
|
|
87
87
|
{ scale: 0, yPercent: 200 },
|
|
88
88
|
"<"
|
|
@@ -94,16 +94,16 @@ const O = ({ colorScheme: u, label: E, title: w, sections: T }) => {
|
|
|
94
94
|
a();
|
|
95
95
|
}, 200);
|
|
96
96
|
return window.addEventListener("resize", s), () => {
|
|
97
|
-
window.removeEventListener("resize", s),
|
|
97
|
+
window.removeEventListener("resize", s), m.getAll().forEach((n) => n.kill()), i.killTweensOf("*");
|
|
98
98
|
};
|
|
99
99
|
},
|
|
100
100
|
{
|
|
101
|
-
scope:
|
|
102
|
-
dependencies: [
|
|
101
|
+
scope: o,
|
|
102
|
+
dependencies: [o]
|
|
103
103
|
}
|
|
104
|
-
), /* @__PURE__ */ t("div", { ref:
|
|
105
|
-
/* @__PURE__ */
|
|
106
|
-
/* @__PURE__ */ t(
|
|
104
|
+
), /* @__PURE__ */ t("div", { ref: o, className: `${l.root} ${l[u]}`, children: /* @__PURE__ */ c("div", { className: l.expandingDetailsWrapper, children: [
|
|
105
|
+
/* @__PURE__ */ c("header", { "data-scroll-id": "header", className: l.header, children: [
|
|
106
|
+
f && /* @__PURE__ */ t(h, { as: "div", defaultVariant: "labelSm", emphasis: !0, className: l.label, children: f }),
|
|
107
107
|
/* @__PURE__ */ t(
|
|
108
108
|
W,
|
|
109
109
|
{
|
|
@@ -116,32 +116,26 @@ const O = ({ colorScheme: u, label: E, title: w, sections: T }) => {
|
|
|
116
116
|
}
|
|
117
117
|
)
|
|
118
118
|
] }),
|
|
119
|
-
/* @__PURE__ */ t("div", { "data-scroll-id": "sections", className: l.sections, children: T.map((a, s) => /* @__PURE__ */
|
|
119
|
+
/* @__PURE__ */ t("div", { "data-scroll-id": "sections", className: l.sections, children: T.map((a, s) => /* @__PURE__ */ c(
|
|
120
120
|
"div",
|
|
121
121
|
{
|
|
122
122
|
id: `section-${s + 1}`,
|
|
123
123
|
"data-scroll-id": "section",
|
|
124
124
|
className: l.section,
|
|
125
125
|
children: [
|
|
126
|
-
/* @__PURE__ */
|
|
127
|
-
/* @__PURE__ */ t("div", { "data-scroll-id": "section-title", className: l.sectionTitleWrapper, children: /* @__PURE__ */ t(
|
|
128
|
-
/* @__PURE__ */ t("div", { "data-scroll-id": "section-index", className: l.sectionIndexWrapper, children: /* @__PURE__ */
|
|
126
|
+
/* @__PURE__ */ c("div", { "data-scroll-id": "heading", className: l.heading, children: [
|
|
127
|
+
/* @__PURE__ */ t("div", { "data-scroll-id": "section-title", className: l.sectionTitleWrapper, children: /* @__PURE__ */ t(h, { as: "h3", defaultVariant: "headingSm", className: l.sectionTitle, children: a.title }) }),
|
|
128
|
+
/* @__PURE__ */ t("div", { "data-scroll-id": "section-index", className: l.sectionIndexWrapper, children: /* @__PURE__ */ c(h, { as: "p", defaultVariant: "headingSm", className: l.sectionIndex, children: [
|
|
129
129
|
"(",
|
|
130
130
|
String(s + 1).padStart(2, "0"),
|
|
131
131
|
")"
|
|
132
132
|
] }) })
|
|
133
133
|
] }),
|
|
134
|
-
/* @__PURE__ */
|
|
135
|
-
/* @__PURE__ */
|
|
136
|
-
|
|
137
|
-
{
|
|
138
|
-
|
|
139
|
-
defaultVariant: "bodyMd",
|
|
140
|
-
mobileVariant: "bodySm",
|
|
141
|
-
className: l.protocol,
|
|
142
|
-
children: a.protocol
|
|
143
|
-
}
|
|
144
|
-
) }),
|
|
134
|
+
/* @__PURE__ */ c("div", { "data-scroll-id": "content", className: l.content, children: [
|
|
135
|
+
/* @__PURE__ */ c("div", { "data-scroll-id": "protocol", className: l.protocolWrapper, children: [
|
|
136
|
+
a.subtitle && /* @__PURE__ */ t(h, { as: "h4", defaultVariant: "headingLg", mobileVariant: "headingXs", children: a.subtitle }),
|
|
137
|
+
/* @__PURE__ */ t(h, { as: "p", defaultVariant: "bodyMd", mobileVariant: "bodySm", children: a.description })
|
|
138
|
+
] }),
|
|
145
139
|
/* @__PURE__ */ t("div", { "data-scroll-id": "image-circle", className: l.imageCircle, children: /* @__PURE__ */ t("img", { src: a.image, alt: a.title }) })
|
|
146
140
|
] }),
|
|
147
141
|
/* @__PURE__ */ t("div", { className: l.leftBorder }),
|
|
@@ -3,11 +3,12 @@ import { TColorScheme } from '../../types/common';
|
|
|
3
3
|
|
|
4
4
|
export type ExpandingDetailsProps = {
|
|
5
5
|
colorScheme: TColorScheme;
|
|
6
|
-
label
|
|
6
|
+
label?: string;
|
|
7
7
|
title: ReactNode;
|
|
8
|
-
sections: {
|
|
8
|
+
sections: Array<{
|
|
9
9
|
title: string;
|
|
10
|
-
|
|
10
|
+
subtitle?: string;
|
|
11
|
+
description?: string;
|
|
11
12
|
image: string;
|
|
12
|
-
}
|
|
13
|
+
}>;
|
|
13
14
|
};
|