@zenpatient-org/healthspan-marketing-ui 0.1.103 → 0.1.105
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/TextInput/TextInput.d.ts +1 -2
- package/dist/components/TextInput/index.d.ts +1 -0
- package/dist/components/Typography/Typography.cjs.js +1 -1
- package/dist/components/Typography/Typography.es.js +9 -9
- package/dist/healthspan-marketing-ui.css +1 -1
- package/dist/modules/AllInOne/AllInOne.cjs.js +1 -1
- package/dist/modules/AllInOne/AllInOne.es.js +193 -141
- package/dist/modules/AllInOne/allInOne.module.css.cjs.js +1 -1
- package/dist/modules/AllInOne/allInOne.module.css.es.js +14 -12
- package/dist/modules/CallToAction/CallToAction.cjs.js +1 -1
- package/dist/modules/CallToAction/CallToAction.es.js +21 -3
- package/dist/modules/HSModal/HSModal.cjs.js +1 -0
- package/dist/modules/HSModal/HSModal.d.ts +4 -0
- package/dist/modules/HSModal/HSModal.es.js +25 -0
- package/dist/modules/HSModal/components/MailchimpModal/MailchimpModal.cjs.js +1 -0
- package/dist/modules/HSModal/components/MailchimpModal/MailchimpModal.d.ts +3 -0
- package/dist/modules/HSModal/components/MailchimpModal/MailchimpModal.es.js +53 -0
- package/dist/modules/HSModal/components/MailchimpModal/components/Newsletter/Newsletter.cjs.js +1 -0
- package/dist/modules/HSModal/components/MailchimpModal/components/Newsletter/Newsletter.d.ts +8 -0
- package/dist/modules/HSModal/components/MailchimpModal/components/Newsletter/Newsletter.es.js +88 -0
- package/dist/modules/HSModal/components/MailchimpModal/components/Newsletter/index.d.ts +1 -0
- package/dist/modules/HSModal/components/MailchimpModal/components/Newsletter/newsletter.module.css.cjs.js +1 -0
- package/dist/modules/HSModal/components/MailchimpModal/components/Newsletter/newsletter.module.css.es.js +8 -0
- package/dist/modules/HSModal/components/MailchimpModal/components/index.d.ts +1 -0
- package/dist/modules/HSModal/components/MailchimpModal/index.d.ts +1 -0
- package/dist/modules/HSModal/components/MailchimpModal/mailchimpModal.module.css.cjs.js +1 -0
- package/dist/modules/HSModal/components/MailchimpModal/mailchimpModal.module.css.es.js +21 -0
- package/dist/modules/HSModal/components/index.d.ts +1 -0
- package/dist/modules/HSModal/hsModal.module.css.cjs.js +1 -0
- package/dist/modules/HSModal/hsModal.module.css.es.js +7 -0
- package/dist/modules/HSModal/index.d.ts +3 -0
- package/dist/modules/HSModal/types.d.ts +23 -0
- package/dist/modules/HSModal/useHSModal.cjs.js +1 -0
- package/dist/modules/HSModal/useHSModal.d.ts +20 -0
- package/dist/modules/HSModal/useHSModal.es.js +63 -0
- package/package.json +6 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("../../../../components/Typography/Typography.cjs.js"),s=require("../../../../utils/cn/cn.cjs.js"),y=require("./components/Newsletter/Newsletter.cjs.js"),a=require("./mailchimpModal.module.css.cjs.js"),f=({title:r,description:c,buttonText:d,image:n,layout:i="plain-column",colorScheme:t="light",onCloseCallback:o,onClickCallback:u,cancelButtonText:p="no, thanks",tags:m})=>{const h=g=>{g.stopPropagation()};return e.jsxs("div",{className:s.cn(a.default.contentWrapper,a.default[t]),"data-image-position":i,onClick:h,children:[e.jsxs("div",{className:s.cn(a.default.content,a.default[t]),children:[e.jsxs("div",{className:a.default.text,children:[e.jsx(l.Typography,{defaultVariant:"headingLg",children:r}),e.jsx(l.Typography,{defaultVariant:"bodySm",children:c})]}),e.jsx(y.Newsletter,{buttonText:d,cancelButtonText:p,colorScheme:t,onCloseCallback:o,onClickCallback:u,tags:m})]}),n&&i!=="plain-column"&&e.jsx("div",{className:a.default.imageWrapper,children:e.jsx("div",{style:{backgroundImage:`url(${n})`},className:a.default.image})})]})};exports.MailchimpModal=f;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { TMailchimpModal } from '../../types';
|
|
2
|
+
|
|
3
|
+
export declare const MailchimpModal: ({ title, description, buttonText, image, layout, colorScheme, onCloseCallback, onClickCallback, cancelButtonText, tags, }: Omit<TMailchimpModal, "id" | "type">) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as t, jsx as i } from "react/jsx-runtime";
|
|
3
|
+
import { Typography as l } from "../../../../components/Typography/Typography.es.js";
|
|
4
|
+
import { cn as o } from "../../../../utils/cn/cn.es.js";
|
|
5
|
+
import { Newsletter as N } from "./components/Newsletter/Newsletter.es.js";
|
|
6
|
+
import a from "./mailchimpModal.module.css.es.js";
|
|
7
|
+
const b = ({
|
|
8
|
+
title: s,
|
|
9
|
+
description: m,
|
|
10
|
+
buttonText: c,
|
|
11
|
+
image: e,
|
|
12
|
+
layout: r = "plain-column",
|
|
13
|
+
colorScheme: n = "light",
|
|
14
|
+
onCloseCallback: d,
|
|
15
|
+
onClickCallback: p,
|
|
16
|
+
cancelButtonText: h = "no, thanks",
|
|
17
|
+
tags: g
|
|
18
|
+
}) => {
|
|
19
|
+
const f = (u) => {
|
|
20
|
+
u.stopPropagation();
|
|
21
|
+
};
|
|
22
|
+
return /* @__PURE__ */ t(
|
|
23
|
+
"div",
|
|
24
|
+
{
|
|
25
|
+
className: o(a.contentWrapper, a[n]),
|
|
26
|
+
"data-image-position": r,
|
|
27
|
+
onClick: f,
|
|
28
|
+
children: [
|
|
29
|
+
/* @__PURE__ */ t("div", { className: o(a.content, a[n]), children: [
|
|
30
|
+
/* @__PURE__ */ t("div", { className: a.text, children: [
|
|
31
|
+
/* @__PURE__ */ i(l, { defaultVariant: "headingLg", children: s }),
|
|
32
|
+
/* @__PURE__ */ i(l, { defaultVariant: "bodySm", children: m })
|
|
33
|
+
] }),
|
|
34
|
+
/* @__PURE__ */ i(
|
|
35
|
+
N,
|
|
36
|
+
{
|
|
37
|
+
buttonText: c,
|
|
38
|
+
cancelButtonText: h,
|
|
39
|
+
colorScheme: n,
|
|
40
|
+
onCloseCallback: d,
|
|
41
|
+
onClickCallback: p,
|
|
42
|
+
tags: g
|
|
43
|
+
}
|
|
44
|
+
)
|
|
45
|
+
] }),
|
|
46
|
+
e && r !== "plain-column" && /* @__PURE__ */ i("div", { className: a.imageWrapper, children: /* @__PURE__ */ i("div", { style: { backgroundImage: `url(${e})` }, className: a.image }) })
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
export {
|
|
52
|
+
b as MailchimpModal
|
|
53
|
+
};
|
package/dist/modules/HSModal/components/MailchimpModal/components/Newsletter/Newsletter.cjs.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),u=require("react"),_=require("../../../../../../components/TextInput/TextInput.cjs.js"),I=require("../../../../../../node_modules/react-mailchimp-subscribe/es/index.cjs.js"),B=require("../../../../../../utils/isValidEmail.cjs.js"),v=require("../../../../../../components/Button/Button.cjs.js"),x=require("./newsletter.module.css.cjs.js"),M=e=>`//gethealthspan.us21.list-manage.com/subscribe/post?u=664ad54ec243b3582164cf116&id=2483a4d606&f_id=0050e6e6f0&tags=${e}`,N=({status:e,message:o,subscribe:c,buttonText:l,colorScheme:d,onCloseCallback:r,cancelButtonText:m,onClickCallback:a})=>{const[i,f]=u.useState(""),[p,s]=u.useState(!1),[y,n]=u.useState(""),[j,g]=u.useState(!1),q=h=>{f(h.target.value),p&&(s(!1),n("")),g(h.target.value.length>0)},E=()=>{if(!i){s(!0),n("Please enter your email address");return}if(!B.isValidEmail(i)){s(!0),n("Please enter a valid email address");return}s(!1),n(""),c({EMAIL:i}),a==null||a()};u.useEffect(()=>{e==="success"&&(f(""),s(!1),n(""),g(!1),r==null||r()),e==="error"&&typeof o=="string"&&(s(!0),n("Subscription failed. Please try again."))},[e,o]);const S=d==="light"?"primary":"primary-invert",T=d==="light"?"primary":"primary-invert";return t.jsxs("div",{className:x.default.interface,children:[t.jsx(_.TextInput,{placeholder:"Email",variant:S,value:i,handleChange:q,error:p,errorText:y,active:j}),t.jsxs("div",{className:x.default.buttonContainer,children:[t.jsx(v.Button,{size:"md",variant:T,onClick:E,children:e==="sending"?"submitting…":l}),t.jsx(v.Button,{size:"md",variant:"ghost",onClick:r,children:m})]})]})},P=({buttonText:e,colorScheme:o,onCloseCallback:c,cancelButtonText:l,tags:d,onClickCallback:r})=>t.jsx(I.default,{url:M(d),render:({subscribe:m,status:a,message:i})=>t.jsx(N,{status:a,message:i,subscribe:m,buttonText:e,colorScheme:o,onCloseCallback:c,onClickCallback:r,cancelButtonText:l})});exports.Newsletter=P;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const Newsletter: ({ buttonText, colorScheme, onCloseCallback, cancelButtonText, tags, onClickCallback, }: {
|
|
2
|
+
buttonText: string;
|
|
3
|
+
colorScheme: "light" | "dark";
|
|
4
|
+
onCloseCallback?: () => void;
|
|
5
|
+
cancelButtonText: string;
|
|
6
|
+
tags: string;
|
|
7
|
+
onClickCallback?: () => void;
|
|
8
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as n, jsxs as v } from "react/jsx-runtime";
|
|
3
|
+
import { useState as u, useEffect as T } from "react";
|
|
4
|
+
import { TextInput as V } from "../../../../../../components/TextInput/TextInput.es.js";
|
|
5
|
+
import j from "../../../../../../node_modules/react-mailchimp-subscribe/es/index.es.js";
|
|
6
|
+
import { isValidEmail as z } from "../../../../../../utils/isValidEmail.es.js";
|
|
7
|
+
import { Button as y } from "../../../../../../components/Button/Button.es.js";
|
|
8
|
+
import E from "./newsletter.module.css.es.js";
|
|
9
|
+
const A = (e) => `//gethealthspan.us21.list-manage.com/subscribe/post?u=664ad54ec243b3582164cf116&id=2483a4d606&f_id=0050e6e6f0&tags=${e}`, b = ({
|
|
10
|
+
status: e,
|
|
11
|
+
message: m,
|
|
12
|
+
subscribe: f,
|
|
13
|
+
buttonText: d,
|
|
14
|
+
colorScheme: o,
|
|
15
|
+
onCloseCallback: r,
|
|
16
|
+
cancelButtonText: p,
|
|
17
|
+
onClickCallback: a
|
|
18
|
+
}) => {
|
|
19
|
+
const [t, c] = u(""), [l, i] = u(!1), [x, s] = u(""), [M, h] = u(!1), I = (g) => {
|
|
20
|
+
c(g.target.value), l && (i(!1), s("")), h(g.target.value.length > 0);
|
|
21
|
+
}, N = () => {
|
|
22
|
+
if (!t) {
|
|
23
|
+
i(!0), s("Please enter your email address");
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (!z(t)) {
|
|
27
|
+
i(!0), s("Please enter a valid email address");
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
i(!1), s(""), f({
|
|
31
|
+
EMAIL: t
|
|
32
|
+
}), a == null || a();
|
|
33
|
+
};
|
|
34
|
+
T(() => {
|
|
35
|
+
e === "success" && (c(""), i(!1), s(""), h(!1), r == null || r()), e === "error" && typeof m == "string" && (i(!0), s("Subscription failed. Please try again."));
|
|
36
|
+
}, [e, m]);
|
|
37
|
+
const P = o === "light" ? "primary" : "primary-invert", S = o === "light" ? "primary" : "primary-invert";
|
|
38
|
+
return /* @__PURE__ */ v("div", { className: E.interface, children: [
|
|
39
|
+
/* @__PURE__ */ n(
|
|
40
|
+
V,
|
|
41
|
+
{
|
|
42
|
+
placeholder: "Email",
|
|
43
|
+
variant: P,
|
|
44
|
+
value: t,
|
|
45
|
+
handleChange: I,
|
|
46
|
+
error: l,
|
|
47
|
+
errorText: x,
|
|
48
|
+
active: M
|
|
49
|
+
}
|
|
50
|
+
),
|
|
51
|
+
/* @__PURE__ */ v("div", { className: E.buttonContainer, children: [
|
|
52
|
+
/* @__PURE__ */ n(y, { size: "md", variant: S, onClick: N, children: e === "sending" ? "submitting…" : d }),
|
|
53
|
+
/* @__PURE__ */ n(y, { size: "md", variant: "ghost", onClick: r, children: p })
|
|
54
|
+
] })
|
|
55
|
+
] });
|
|
56
|
+
}, q = ({
|
|
57
|
+
buttonText: e,
|
|
58
|
+
colorScheme: m,
|
|
59
|
+
onCloseCallback: f,
|
|
60
|
+
cancelButtonText: d,
|
|
61
|
+
tags: o,
|
|
62
|
+
onClickCallback: r
|
|
63
|
+
}) => /* @__PURE__ */ n(
|
|
64
|
+
j,
|
|
65
|
+
{
|
|
66
|
+
url: A(o),
|
|
67
|
+
render: ({
|
|
68
|
+
subscribe: p,
|
|
69
|
+
status: a,
|
|
70
|
+
message: t
|
|
71
|
+
}) => /* @__PURE__ */ n(
|
|
72
|
+
b,
|
|
73
|
+
{
|
|
74
|
+
status: a,
|
|
75
|
+
message: t,
|
|
76
|
+
subscribe: p,
|
|
77
|
+
buttonText: e,
|
|
78
|
+
colorScheme: m,
|
|
79
|
+
onCloseCallback: f,
|
|
80
|
+
onClickCallback: r,
|
|
81
|
+
cancelButtonText: d
|
|
82
|
+
}
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
export {
|
|
87
|
+
q as Newsletter
|
|
88
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Newsletter } from './Newsletter';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="newsletter-module__buttonContainer___Jn0WJ",t={interface:"newsletter-module__interface___dgwMa",buttonContainer:e};exports.buttonContainer=e;exports.default=t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Newsletter } from './Newsletter';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MailchimpModal } from './MailchimpModal';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="mailchimpModal-module__overlay___peQPr",t="mailchimpModal-module__contentWrapper___HpcOd",a="mailchimpModal-module__light___-lF5m",o="mailchimpModal-module__dark___7FKcx",_="mailchimpModal-module__content___xscO6",l="mailchimpModal-module__imageWrapper___lBCUP",m="mailchimpModal-module__text___t5kPi",i="mailchimpModal-module__image___2R979",c={overlay:e,contentWrapper:t,light:a,dark:o,content:_,imageWrapper:l,text:m,image:i};exports.content=_;exports.contentWrapper=t;exports.dark=o;exports.default=c;exports.image=i;exports.imageWrapper=l;exports.light=a;exports.overlay=e;exports.text=m;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const _ = "mailchimpModal-module__overlay___peQPr", a = "mailchimpModal-module__contentWrapper___HpcOd", e = "mailchimpModal-module__light___-lF5m", o = "mailchimpModal-module__dark___7FKcx", l = "mailchimpModal-module__content___xscO6", t = "mailchimpModal-module__imageWrapper___lBCUP", m = "mailchimpModal-module__text___t5kPi", c = "mailchimpModal-module__image___2R979", i = {
|
|
2
|
+
overlay: _,
|
|
3
|
+
contentWrapper: a,
|
|
4
|
+
light: e,
|
|
5
|
+
dark: o,
|
|
6
|
+
content: l,
|
|
7
|
+
imageWrapper: t,
|
|
8
|
+
text: m,
|
|
9
|
+
image: c
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
l as content,
|
|
13
|
+
a as contentWrapper,
|
|
14
|
+
o as dark,
|
|
15
|
+
i as default,
|
|
16
|
+
c as image,
|
|
17
|
+
t as imageWrapper,
|
|
18
|
+
e as light,
|
|
19
|
+
_ as overlay,
|
|
20
|
+
m as text
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MailchimpModal } from './MailchimpModal';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="hsModal-module__overlay___kdLCe",l={overlay:e};exports.default=l;exports.overlay=e;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
type TimerTrigger = {
|
|
2
|
+
type: 'timer';
|
|
3
|
+
delay: number;
|
|
4
|
+
};
|
|
5
|
+
type THSModal = {
|
|
6
|
+
id: string;
|
|
7
|
+
title: string;
|
|
8
|
+
description: string;
|
|
9
|
+
buttonText: string;
|
|
10
|
+
trigger?: TimerTrigger;
|
|
11
|
+
layout?: 'plain-column' | 'header-image' | 'side-image';
|
|
12
|
+
cancelButtonText?: string;
|
|
13
|
+
colorScheme?: 'light' | 'dark';
|
|
14
|
+
image?: string;
|
|
15
|
+
onCloseCallback?: () => void;
|
|
16
|
+
onClickCallback?: () => void;
|
|
17
|
+
initiallyOpen?: boolean;
|
|
18
|
+
};
|
|
19
|
+
export type TMailchimpModal = THSModal & {
|
|
20
|
+
type: 'mailchimp';
|
|
21
|
+
tags: string;
|
|
22
|
+
};
|
|
23
|
+
export type { THSModal };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),m=7,i=24*60*60*1e3,w=o=>{try{const n=localStorage.getItem(`popup_${o}_lastShown`);if(!n)return!0;const e=parseInt(n,10);return(new Date().getTime()-e)/i>=m}catch(n){return console.warn("Error checking popup cooldown:",n),!0}},E=({id:o,initiallyOpen:n=!1,trigger:e,onCloseCallback:r,onClickCallback:u})=>{const[c,S]=t.useState(n),a=t.useCallback(()=>{w(o)&&S(!0)},[o]),d=t.useCallback(()=>{S(!1),r==null||r()},[r]),y=t.useCallback(()=>{u==null||u()},[u]);t.useEffect(()=>{if((e==null?void 0:e.type)==="timer"&&!c){const s=setTimeout(()=>{a()},e.delay*1e3);return()=>clearTimeout(s)}},[e,c,a]),t.useEffect(()=>{if(!c)return;const s=new Date().getTime();localStorage.setItem(`popup_${o}_lastShown`,s.toString());const h=window.getComputedStyle(document.body).overflow;document.body.style.overflow="hidden";const p=l=>{l.key==="Escape"&&d()};return document.addEventListener("keydown",p),()=>{document.body.style.overflow=h,document.removeEventListener("keydown",p)}},[c,d,o]);const f=t.useCallback(s=>{s.target===s.currentTarget&&d()},[d]);return{isOpen:c,openModal:a,closeModal:d,handleClick:y,handleOverlayClick:f}};exports.shouldShowPopup=w;exports.useHSModal=E;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const shouldShowPopup: (id: string) => boolean;
|
|
2
|
+
export declare const getDaysUntilNextShow: (id: string) => number;
|
|
3
|
+
type UseHSModalProps = {
|
|
4
|
+
id: string;
|
|
5
|
+
initiallyOpen?: boolean;
|
|
6
|
+
trigger?: {
|
|
7
|
+
type: 'timer';
|
|
8
|
+
delay: number;
|
|
9
|
+
};
|
|
10
|
+
onCloseCallback?: () => void;
|
|
11
|
+
onClickCallback?: () => void;
|
|
12
|
+
};
|
|
13
|
+
export declare const useHSModal: ({ id, initiallyOpen, trigger, onCloseCallback, onClickCallback, }: UseHSModalProps) => {
|
|
14
|
+
isOpen: boolean;
|
|
15
|
+
openModal: () => void;
|
|
16
|
+
closeModal: () => void;
|
|
17
|
+
handleClick: () => void;
|
|
18
|
+
handleOverlayClick: (e: React.MouseEvent) => void;
|
|
19
|
+
};
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { useState as i, useCallback as d, useEffect as a } from "react";
|
|
2
|
+
const E = 7, _ = 24 * 60 * 60 * 1e3, v = (t) => {
|
|
3
|
+
try {
|
|
4
|
+
const o = localStorage.getItem(`popup_${t}_lastShown`);
|
|
5
|
+
if (!o)
|
|
6
|
+
return !0;
|
|
7
|
+
const e = parseInt(o, 10);
|
|
8
|
+
return ((/* @__PURE__ */ new Date()).getTime() - e) / _ >= E;
|
|
9
|
+
} catch (o) {
|
|
10
|
+
return console.warn("Error checking popup cooldown:", o), !0;
|
|
11
|
+
}
|
|
12
|
+
}, T = ({
|
|
13
|
+
id: t,
|
|
14
|
+
initiallyOpen: o = !1,
|
|
15
|
+
trigger: e,
|
|
16
|
+
onCloseCallback: s,
|
|
17
|
+
onClickCallback: r
|
|
18
|
+
}) => {
|
|
19
|
+
const [u, w] = i(o), p = d(() => {
|
|
20
|
+
v(t) && w(!0);
|
|
21
|
+
}, [t]), c = d(() => {
|
|
22
|
+
w(!1), s == null || s();
|
|
23
|
+
}, [s]), m = d(() => {
|
|
24
|
+
r == null || r();
|
|
25
|
+
}, [r]);
|
|
26
|
+
a(() => {
|
|
27
|
+
if ((e == null ? void 0 : e.type) === "timer" && !u) {
|
|
28
|
+
const n = setTimeout(() => {
|
|
29
|
+
p();
|
|
30
|
+
}, e.delay * 1e3);
|
|
31
|
+
return () => clearTimeout(n);
|
|
32
|
+
}
|
|
33
|
+
}, [e, u, p]), a(() => {
|
|
34
|
+
if (!u) return;
|
|
35
|
+
const n = (/* @__PURE__ */ new Date()).getTime();
|
|
36
|
+
localStorage.setItem(`popup_${t}_lastShown`, n.toString());
|
|
37
|
+
const f = window.getComputedStyle(document.body).overflow;
|
|
38
|
+
document.body.style.overflow = "hidden";
|
|
39
|
+
const S = (h) => {
|
|
40
|
+
h.key === "Escape" && c();
|
|
41
|
+
};
|
|
42
|
+
return document.addEventListener("keydown", S), () => {
|
|
43
|
+
document.body.style.overflow = f, document.removeEventListener("keydown", S);
|
|
44
|
+
};
|
|
45
|
+
}, [u, c, t]);
|
|
46
|
+
const y = d(
|
|
47
|
+
(n) => {
|
|
48
|
+
n.target === n.currentTarget && c();
|
|
49
|
+
},
|
|
50
|
+
[c]
|
|
51
|
+
);
|
|
52
|
+
return {
|
|
53
|
+
isOpen: u,
|
|
54
|
+
openModal: p,
|
|
55
|
+
closeModal: c,
|
|
56
|
+
handleClick: m,
|
|
57
|
+
handleOverlayClick: y
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
export {
|
|
61
|
+
v as shouldShowPopup,
|
|
62
|
+
T as useHSModal
|
|
63
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zenpatient-org/healthspan-marketing-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.105",
|
|
4
4
|
"description": "Design system",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.es.js",
|
|
@@ -536,6 +536,11 @@
|
|
|
536
536
|
"import": "./dist/modules/ContentHighlight/ContentHighlight.es.js",
|
|
537
537
|
"require": "./dist/modules/ContentHighlight/ContentHighlight.cjs.js"
|
|
538
538
|
},
|
|
539
|
+
"./HSModal": {
|
|
540
|
+
"types": "./dist/modules/HSModal/HSModal.d.ts",
|
|
541
|
+
"import": "./dist/modules/HSModal/HSModal.es.js",
|
|
542
|
+
"require": "./dist/modules/HSModal/HSModal.cjs.js"
|
|
543
|
+
},
|
|
539
544
|
"./Bubbles": {
|
|
540
545
|
"types": "./dist/pageComponents/Bubbles/Bubbles.d.ts",
|
|
541
546
|
"import": "./dist/pageComponents/Bubbles/Bubbles.es.js",
|