@zenpatient-org/healthspan-marketing-ui 0.1.28 → 0.1.29

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 client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),l=require("react"),f=require("../../utils/cn/cn.cjs.js"),p=require("../Label/Label.cjs.js"),k=require("../ProgressButton/ProgressButton.cjs.js"),m=require("../Typography/Typography.cjs.js"),a=require("./stepsCarousel.module.css.cjs.js"),T=({steps:i,colorScheme:c})=>{const[n,o]=l.useState(0),h=l.useRef([]),u=l.useRef(null),d=l.useRef(null),g=l.useCallback(e=>{u.current=e.touches[0].clientX},[]),j=l.useCallback(e=>{d.current=e.touches[0].clientX},[]),y=l.useCallback(()=>{if(u.current!==null&&d.current!==null){const e=d.current-u.current,s=50;o(r=>e>s&&r>0?r-1:e<-s&&r<i.length-1?r+1:r)}u.current=null,d.current=null},[i.length]);return l.useEffect(()=>{var e;h.current[n]&&((e=h.current[n])==null||e.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"}))},[n]),t.jsxs("div",{className:a.default.root,"data-scheme":c,children:[t.jsx("div",{className:a.default.stepsContainer,"data-scheme":c,onTouchStart:g,onTouchMove:j,onTouchEnd:y,children:i.map((e,s)=>{const r=n===s;return t.jsxs("button",{ref:b=>{b&&(h.current[s]=b)},className:f.cn(a.default.card,r&&a.default.cardActive),onClick:()=>o(s),type:"button",children:[t.jsx("div",{className:f.cn(a.default.imageWrapper,r&&a.default.imageWrapperActive),children:t.jsx("img",{src:e.image,alt:e.title,className:a.default.image})}),t.jsx("div",{className:a.default.stepLabel,children:r?t.jsxs(t.Fragment,{children:[t.jsxs(p.Label,{size:"lg",className:a.default.desktop,color:c==="dark"?"white":"black",children:["Step ",s+1]}),t.jsxs(p.Label,{size:"sm",className:a.default.mobile,color:c==="dark"?"white":"black",children:["Step ",s+1]})]}):t.jsxs(m.Typography,{defaultVariant:"labelSm",mobileVariant:"labelXs",emphasis:!0,className:a.default.labelText,children:["Step ",s+1]})}),t.jsxs("div",{className:a.default.textContainer,children:[t.jsx(m.Typography,{as:"h3",defaultVariant:"headingXs",mobileVariant:"headingXxs",children:e.title}),e.description&&t.jsx(m.Typography,{as:"p",defaultVariant:"bodyMd",mobileVariant:"bodySm",className:a.default.cardDescription,children:e.description})]})]},`step-${s}`)})}),t.jsx("div",{className:f.cn(a.default.mobile,a.default.progressButtonContainer),children:t.jsx(k.ProgressButton,{invert:c==="dark",left:{disabled:n<=0,onClick:()=>o(e=>e-1)},right:{disabled:n>=i.length-1,onClick:()=>o(e=>e+1)}})})]})};exports.StepsCarousel=T;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("react"),h=require("../../utils/cn/cn.cjs.js"),g=require("../Label/Label.cjs.js"),C=require("../ProgressButton/ProgressButton.cjs.js"),m=require("../Typography/Typography.cjs.js"),a=require("./stepsCarousel.module.css.cjs.js"),T=({steps:o,colorScheme:n})=>{const[c,b]=r.useState(0),f=r.useRef([]),i=r.useRef(null),u=r.useRef(null),j=r.useCallback(t=>{i.current=t.touches[0].clientX},[]),y=r.useCallback(t=>{u.current=t.touches[0].clientX},[]),d=r.useCallback(t=>{var s;b(t),(s=f.current[t])==null||s.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"})},[]),k=r.useCallback(()=>{if(i.current!==null&&u.current!==null){const t=u.current-i.current,s=50;b(l=>t>s&&l>0?l-1:t<-s&&l<o.length-1?l+1:l)}i.current=null,u.current=null},[o.length]);return e.jsxs("div",{className:a.default.root,"data-scheme":n,children:[e.jsx("div",{className:a.default.stepsContainer,"data-scheme":n,onTouchStart:j,onTouchMove:y,onTouchEnd:k,children:o.map((t,s)=>{const l=c===s;return e.jsxs("button",{ref:p=>{p&&(f.current[s]=p)},className:h.cn(a.default.card,l&&a.default.cardActive),onClick:()=>d(s),type:"button",children:[e.jsx("div",{className:h.cn(a.default.imageWrapper,l&&a.default.imageWrapperActive),children:e.jsx("img",{src:t.image,alt:t.title,className:a.default.image})}),e.jsx("div",{className:a.default.stepLabel,children:l?e.jsxs(e.Fragment,{children:[e.jsxs(g.Label,{size:"lg",className:a.default.desktop,color:n==="dark"?"white":"black",children:["Step ",s+1]}),e.jsxs(g.Label,{size:"sm",className:a.default.mobile,color:n==="dark"?"white":"black",children:["Step ",s+1]})]}):e.jsxs(m.Typography,{defaultVariant:"labelSm",mobileVariant:"labelXs",emphasis:!0,className:a.default.labelText,children:["Step ",s+1]})}),e.jsxs("div",{className:a.default.textContainer,children:[e.jsx(m.Typography,{as:"h3",defaultVariant:"headingXs",mobileVariant:"headingXxs",children:t.title}),t.description&&e.jsx(m.Typography,{as:"p",defaultVariant:"bodyMd",mobileVariant:"bodySm",className:a.default.cardDescription,children:t.description})]})]},`step-${s}`)})}),e.jsx("div",{className:h.cn(a.default.mobile,a.default.progressButtonContainer),children:e.jsx(C.ProgressButton,{invert:n==="dark",left:{disabled:c<=0,onClick:()=>d(c-1)},right:{disabled:c>=o.length-1,onClick:()=>d(c+1)}})})]})};exports.StepsCarousel=T;
@@ -1,59 +1,55 @@
1
1
  "use client";
2
- import { jsxs as l, jsx as n, Fragment as T } from "react/jsx-runtime";
3
- import { useState as X, useRef as h, useCallback as b, useEffect as V } from "react";
4
- import { cn as f } from "../../utils/cn/cn.es.js";
5
- import { Label as N } from "../Label/Label.es.js";
2
+ import { jsxs as l, jsx as n, Fragment as X } from "react/jsx-runtime";
3
+ import { useState as V, useRef as m, useCallback as u } from "react";
4
+ import { cn as b } from "../../utils/cn/cn.es.js";
5
+ import { Label as k } from "../Label/Label.es.js";
6
6
  import { ProgressButton as y } from "../ProgressButton/ProgressButton.es.js";
7
7
  import { Typography as p } from "../Typography/Typography.es.js";
8
8
  import t from "./stepsCarousel.module.css.es.js";
9
- const B = ({ steps: s, colorScheme: i }) => {
10
- const [c, o] = X(0), m = h([]), u = h(null), d = h(null), k = b((e) => {
11
- u.current = e.touches[0].clientX;
12
- }, []), v = b((e) => {
9
+ const B = ({ steps: s, colorScheme: c }) => {
10
+ const [i, f] = V(0), g = m([]), o = m(null), d = m(null), v = u((e) => {
11
+ o.current = e.touches[0].clientX;
12
+ }, []), C = u((e) => {
13
13
  d.current = e.touches[0].clientX;
14
- }, []), C = b(() => {
15
- if (u.current !== null && d.current !== null) {
16
- const e = d.current - u.current, r = 50;
17
- o((a) => e > r && a > 0 ? a - 1 : e < -r && a < s.length - 1 ? a + 1 : a);
14
+ }, []), h = u((e) => {
15
+ var r;
16
+ f(e), (r = g.current[e]) == null || r.scrollIntoView({ behavior: "smooth", inline: "center", block: "nearest" });
17
+ }, []), T = u(() => {
18
+ if (o.current !== null && d.current !== null) {
19
+ const e = d.current - o.current, r = 50;
20
+ f((a) => e > r && a > 0 ? a - 1 : e < -r && a < s.length - 1 ? a + 1 : a);
18
21
  }
19
- u.current = null, d.current = null;
22
+ o.current = null, d.current = null;
20
23
  }, [s.length]);
21
- return V(() => {
22
- var e;
23
- m.current[c] && ((e = m.current[c]) == null || e.scrollIntoView({
24
- behavior: "smooth",
25
- inline: "center",
26
- block: "nearest"
27
- }));
28
- }, [c]), /* @__PURE__ */ l("div", { className: t.root, "data-scheme": i, children: [
24
+ return /* @__PURE__ */ l("div", { className: t.root, "data-scheme": c, children: [
29
25
  /* @__PURE__ */ n(
30
26
  "div",
31
27
  {
32
28
  className: t.stepsContainer,
33
- "data-scheme": i,
34
- onTouchStart: k,
35
- onTouchMove: v,
36
- onTouchEnd: C,
29
+ "data-scheme": c,
30
+ onTouchStart: v,
31
+ onTouchMove: C,
32
+ onTouchEnd: T,
37
33
  children: s.map((e, r) => {
38
- const a = c === r;
34
+ const a = i === r;
39
35
  return /* @__PURE__ */ l(
40
36
  "button",
41
37
  {
42
- ref: (g) => {
43
- g && (m.current[r] = g);
38
+ ref: (N) => {
39
+ N && (g.current[r] = N);
44
40
  },
45
- className: f(t.card, a && t.cardActive),
46
- onClick: () => o(r),
41
+ className: b(t.card, a && t.cardActive),
42
+ onClick: () => h(r),
47
43
  type: "button",
48
44
  children: [
49
- /* @__PURE__ */ n("div", { className: f(t.imageWrapper, a && t.imageWrapperActive), children: /* @__PURE__ */ n("img", { src: e.image, alt: e.title, className: t.image }) }),
50
- /* @__PURE__ */ n("div", { className: t.stepLabel, children: a ? /* @__PURE__ */ l(T, { children: [
45
+ /* @__PURE__ */ n("div", { className: b(t.imageWrapper, a && t.imageWrapperActive), children: /* @__PURE__ */ n("img", { src: e.image, alt: e.title, className: t.image }) }),
46
+ /* @__PURE__ */ n("div", { className: t.stepLabel, children: a ? /* @__PURE__ */ l(X, { children: [
51
47
  /* @__PURE__ */ l(
52
- N,
48
+ k,
53
49
  {
54
50
  size: "lg",
55
51
  className: t.desktop,
56
- color: i === "dark" ? "white" : "black",
52
+ color: c === "dark" ? "white" : "black",
57
53
  children: [
58
54
  "Step ",
59
55
  r + 1
@@ -61,11 +57,11 @@ const B = ({ steps: s, colorScheme: i }) => {
61
57
  }
62
58
  ),
63
59
  /* @__PURE__ */ l(
64
- N,
60
+ k,
65
61
  {
66
62
  size: "sm",
67
63
  className: t.mobile,
68
- color: i === "dark" ? "white" : "black",
64
+ color: c === "dark" ? "white" : "black",
69
65
  children: [
70
66
  "Step ",
71
67
  r + 1
@@ -105,17 +101,17 @@ const B = ({ steps: s, colorScheme: i }) => {
105
101
  })
106
102
  }
107
103
  ),
108
- /* @__PURE__ */ n("div", { className: f(t.mobile, t.progressButtonContainer), children: /* @__PURE__ */ n(
104
+ /* @__PURE__ */ n("div", { className: b(t.mobile, t.progressButtonContainer), children: /* @__PURE__ */ n(
109
105
  y,
110
106
  {
111
- invert: i === "dark",
107
+ invert: c === "dark",
112
108
  left: {
113
- disabled: c <= 0,
114
- onClick: () => o((e) => e - 1)
109
+ disabled: i <= 0,
110
+ onClick: () => h(i - 1)
115
111
  },
116
112
  right: {
117
- disabled: c >= s.length - 1,
118
- onClick: () => o((e) => e + 1)
113
+ disabled: i >= s.length - 1,
114
+ onClick: () => h(i + 1)
119
115
  }
120
116
  }
121
117
  ) })