@zenpatient-org/healthspan-marketing-ui 0.1.124 → 0.1.126

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 e=require("react/jsx-runtime"),u=require("react"),o=require("../../../../components/Typography/Typography.cjs.js"),b=require("../../../../utils/cn/cn.cjs.js"),l=require("./timelineContent.module.css.cjs.js");function T(r){const t=r.slice();for(let n=t.length-1;n>0;n--){const i=Math.floor(Math.random()*(n+1));[t[n],t[i]]=[t[i],t[n]]}return t}const j=[{key:"optimal",label:"Optimal"},{key:"inRange",label:"In Range"},{key:"outOfRange",label:"Out of Range"}],x=({tabs:r})=>{const[t,n]=u.useState(0),i=u.useRef(null),{optimal:h,inRange:m,outOfRange:f}=r[t],g=u.useMemo(()=>T([...Array(h).fill("optimal"),...Array(m).fill("inRange"),...Array(f).fill("outOfRange")]),[h,m,f]),p=u.useCallback(a=>{i.current=a.touches[0].clientX},[]),y=u.useCallback(a=>{if(i.current===null)return;const d=a.changedTouches[0].clientX-i.current;Math.abs(d)>50&&n(c=>d<0&&c<r.length-1?c+1:d>0&&c>0?c-1:c),i.current=null},[r.length]);return e.jsx("div",{className:l.default.root,children:e.jsxs("div",{className:l.default.container,children:[e.jsxs("div",{className:l.default.content,onTouchStart:p,onTouchEnd:y,children:[e.jsx("div",{className:l.default.metricsContainer,children:j.map((a,s)=>e.jsxs("div",{className:l.default.metric,children:[e.jsx(o.Typography,{defaultVariant:"displayLg",mobileVariant:"displaySm",weight:"regular",children:r[t][a.key]}),e.jsxs("div",{className:l.default.metricTitle,children:[e.jsx(o.Typography,{as:"p",defaultVariant:"labelSm",mobileVariant:"labelXs",emphasis:!0,weight:"regular",children:"("}),e.jsx(o.Typography,{as:"p",defaultVariant:"labelSm",mobileVariant:"labelXs",emphasis:!0,weight:"regular",children:a.label}),e.jsx("div",{className:l.default.circle,"data-value":a.key}),e.jsx(o.Typography,{as:"p",defaultVariant:"labelSm",mobileVariant:"labelXs",emphasis:!0,weight:"regular",children:")"})]})]},`${a.key}_${s}`))}),e.jsx("div",{className:l.default.canvas,children:g.map((a,s)=>e.jsx("div",{className:l.default.circle,"data-value":a},s))})]}),e.jsx("div",{className:l.default.tabsContainer,children:r.map((a,s)=>e.jsx("button",{className:b.cn(l.default.tab,t===s&&l.default.tabActive),onClick:()=>n(s),children:e.jsx(o.Typography,{defaultVariant:"labelMd",mobileVariant:"labelXs",emphasis:!0,weight:"regular",children:a.label})},a.label))})]})})};exports.TimelineContent=x;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),g=require("react"),d=require("../../../../node_modules/swiper/swiper-react.cjs.js");;/* empty css */const t=require("../../../../components/Typography/Typography.cjs.js"),y=require("../../../../utils/cn/cn.cjs.js"),f=require("../../../../utils/useSwiper/useSwiper.cjs.js"),b=require("./utils.cjs.js"),a=require("./timelineContent.module.css.cjs.js"),v=[{key:"optimal",label:"Optimal"},{key:"inRange",label:"In Range"},{key:"outOfRange",label:"Out of Range"}],S=({tabs:s})=>{const{activeIndex:c,onSwiperInit:o,handleSlideTo:u,handleSlideChange:p,handleSwiperResize:m}=f.useSwiper(),h=g.useMemo(()=>s.map(l=>b.distributePoints(l.optimal,l.inRange,l.outOfRange)),[s]);return e.jsx("div",{className:a.default.root,children:e.jsxs("div",{className:a.default.container,children:[e.jsx(d.Swiper,{onSwiper:o,onResize:m,onSlideChange:p,slidesPerView:1,allowTouchMove:s.length>1,spaceBetween:0,initialSlide:0,className:a.default.swiper,children:s.map((l,n)=>e.jsx(d.SwiperSlide,{children:e.jsxs("div",{className:a.default.content,children:[e.jsx("div",{className:a.default.metricsContainer,children:v.map((i,r)=>e.jsxs("div",{className:a.default.metric,children:[e.jsx(t.Typography,{defaultVariant:"displayLg",mobileVariant:"displaySm",weight:"regular",children:l[i.key]}),e.jsxs("div",{className:a.default.metricTitle,children:[e.jsx(t.Typography,{as:"div",defaultVariant:"labelSm",mobileVariant:"labelXs",emphasis:!0,weight:"regular",children:"("}),e.jsx(t.Typography,{as:"div",defaultVariant:"labelSm",mobileVariant:"labelXs",emphasis:!0,weight:"regular",children:i.label}),e.jsx("div",{className:a.default.circle,"data-value":i.key}),e.jsx(t.Typography,{as:"div",defaultVariant:"labelSm",mobileVariant:"labelXs",emphasis:!0,weight:"regular",children:")"})]})]},`${i.key}_${r}`))}),e.jsx("div",{className:a.default.canvas,children:h[n].map((i,r)=>e.jsx("div",{className:a.default.circle,"data-value":i},r))})]})},l.label))}),e.jsx("div",{className:a.default.tabsContainer,children:s.map((l,n)=>e.jsx("button",{className:y.cn(a.default.tab,c===n&&a.default.tabActive),onClick:()=>u(n),children:e.jsx(t.Typography,{defaultVariant:"labelMd",mobileVariant:"labelXs",emphasis:!0,weight:"regular",children:l.label})},l.label))})]})})};exports.TimelineContent=S;
@@ -1,99 +1,97 @@
1
1
  "use client";
2
- import { jsx as a, jsxs as u } from "react/jsx-runtime";
3
- import { useState as v, useRef as N, useMemo as T, useCallback as g } from "react";
4
- import { Typography as o } from "../../../../components/Typography/Typography.es.js";
5
- import { cn as R } from "../../../../utils/cn/cn.es.js";
6
- import l from "./timelineContent.module.css.es.js";
7
- function V(i) {
8
- const n = i.slice();
9
- for (let t = n.length - 1; t > 0; t--) {
10
- const r = Math.floor(Math.random() * (t + 1));
11
- [n[t], n[r]] = [n[r], n[t]];
12
- }
13
- return n;
14
- }
15
- const X = [
16
- {
17
- key: "optimal",
18
- label: "Optimal"
19
- },
20
- {
21
- key: "inRange",
22
- label: "In Range"
23
- },
24
- {
25
- key: "outOfRange",
26
- label: "Out of Range"
27
- }
28
- ], E = ({ tabs: i }) => {
29
- const [n, t] = v(0), r = N(null), { optimal: h, inRange: d, outOfRange: f } = i[n], b = T(() => V([
30
- ...Array(h).fill("optimal"),
31
- ...Array(d).fill("inRange"),
32
- ...Array(f).fill("outOfRange")
33
- ]), [h, d, f]), p = g((e) => {
34
- r.current = e.touches[0].clientX;
35
- }, []), y = g(
36
- (e) => {
37
- if (r.current === null) return;
38
- const m = e.changedTouches[0].clientX - r.current;
39
- Math.abs(m) > 50 && t((s) => m < 0 && s < i.length - 1 ? s + 1 : m > 0 && s > 0 ? s - 1 : s), r.current = null;
40
- },
41
- [i.length]
2
+ import { jsx as e, jsxs as s } from "react/jsx-runtime";
3
+ import { useMemo as g } from "react";
4
+ import { Swiper as v, SwiperSlide as b } from "../../../../node_modules/swiper/swiper-react.es.js";
5
+ /* empty css */
6
+ import { Typography as n } from "../../../../components/Typography/Typography.es.js";
7
+ import { cn as f } from "../../../../utils/cn/cn.es.js";
8
+ import { useSwiper as S } from "../../../../utils/useSwiper/useSwiper.es.js";
9
+ import { distributePoints as w } from "./utils.es.js";
10
+ import a from "./timelineContent.module.css.es.js";
11
+ const y = [
12
+ { key: "optimal", label: "Optimal" },
13
+ { key: "inRange", label: "In Range" },
14
+ { key: "outOfRange", label: "Out of Range" }
15
+ ], X = ({ tabs: r }) => {
16
+ const { activeIndex: m, onSwiperInit: d, handleSlideTo: c, handleSlideChange: p, handleSwiperResize: h } = S(), u = g(
17
+ () => r.map((i) => w(i.optimal, i.inRange, i.outOfRange)),
18
+ [r]
42
19
  );
43
- return /* @__PURE__ */ a("div", { className: l.root, children: /* @__PURE__ */ u("div", { className: l.container, children: [
44
- /* @__PURE__ */ u("div", { className: l.content, onTouchStart: p, onTouchEnd: y, children: [
45
- /* @__PURE__ */ a("div", { className: l.metricsContainer, children: X.map((e, c) => /* @__PURE__ */ u("div", { className: l.metric, children: [
46
- /* @__PURE__ */ a(o, { defaultVariant: "displayLg", mobileVariant: "displaySm", weight: "regular", children: i[n][e.key] }),
47
- /* @__PURE__ */ u("div", { className: l.metricTitle, children: [
48
- /* @__PURE__ */ a(
49
- o,
50
- {
51
- as: "p",
52
- defaultVariant: "labelSm",
53
- mobileVariant: "labelXs",
54
- emphasis: !0,
55
- weight: "regular",
56
- children: "("
57
- }
58
- ),
59
- /* @__PURE__ */ a(
60
- o,
61
- {
62
- as: "p",
63
- defaultVariant: "labelSm",
64
- mobileVariant: "labelXs",
65
- emphasis: !0,
66
- weight: "regular",
67
- children: e.label
68
- }
69
- ),
70
- /* @__PURE__ */ a("div", { className: l.circle, "data-value": e.key }),
71
- /* @__PURE__ */ a(
72
- o,
73
- {
74
- as: "p",
75
- defaultVariant: "labelSm",
76
- mobileVariant: "labelXs",
77
- emphasis: !0,
78
- weight: "regular",
79
- children: ")"
80
- }
81
- )
82
- ] })
83
- ] }, `${e.key}_${c}`)) }),
84
- /* @__PURE__ */ a("div", { className: l.canvas, children: b.map((e, c) => /* @__PURE__ */ a("div", { className: l.circle, "data-value": e }, c)) })
85
- ] }),
86
- /* @__PURE__ */ a("div", { className: l.tabsContainer, children: i.map((e, c) => /* @__PURE__ */ a(
20
+ return /* @__PURE__ */ e("div", { className: a.root, children: /* @__PURE__ */ s("div", { className: a.container, children: [
21
+ /* @__PURE__ */ e(
22
+ v,
23
+ {
24
+ onSwiper: d,
25
+ onResize: h,
26
+ onSlideChange: p,
27
+ slidesPerView: 1,
28
+ allowTouchMove: r.length > 1,
29
+ spaceBetween: 0,
30
+ initialSlide: 0,
31
+ className: a.swiper,
32
+ children: r.map((i, t) => /* @__PURE__ */ e(b, { children: /* @__PURE__ */ s("div", { className: a.content, children: [
33
+ /* @__PURE__ */ e("div", { className: a.metricsContainer, children: y.map((l, o) => /* @__PURE__ */ s("div", { className: a.metric, children: [
34
+ /* @__PURE__ */ e(
35
+ n,
36
+ {
37
+ defaultVariant: "displayLg",
38
+ mobileVariant: "displaySm",
39
+ weight: "regular",
40
+ children: i[l.key]
41
+ }
42
+ ),
43
+ /* @__PURE__ */ s("div", { className: a.metricTitle, children: [
44
+ /* @__PURE__ */ e(
45
+ n,
46
+ {
47
+ as: "div",
48
+ defaultVariant: "labelSm",
49
+ mobileVariant: "labelXs",
50
+ emphasis: !0,
51
+ weight: "regular",
52
+ children: "("
53
+ }
54
+ ),
55
+ /* @__PURE__ */ e(
56
+ n,
57
+ {
58
+ as: "div",
59
+ defaultVariant: "labelSm",
60
+ mobileVariant: "labelXs",
61
+ emphasis: !0,
62
+ weight: "regular",
63
+ children: l.label
64
+ }
65
+ ),
66
+ /* @__PURE__ */ e("div", { className: a.circle, "data-value": l.key }),
67
+ /* @__PURE__ */ e(
68
+ n,
69
+ {
70
+ as: "div",
71
+ defaultVariant: "labelSm",
72
+ mobileVariant: "labelXs",
73
+ emphasis: !0,
74
+ weight: "regular",
75
+ children: ")"
76
+ }
77
+ )
78
+ ] })
79
+ ] }, `${l.key}_${o}`)) }),
80
+ /* @__PURE__ */ e("div", { className: a.canvas, children: u[t].map((l, o) => /* @__PURE__ */ e("div", { className: a.circle, "data-value": l }, o)) })
81
+ ] }) }, i.label))
82
+ }
83
+ ),
84
+ /* @__PURE__ */ e("div", { className: a.tabsContainer, children: r.map((i, t) => /* @__PURE__ */ e(
87
85
  "button",
88
86
  {
89
- className: R(l.tab, n === c && l.tabActive),
90
- onClick: () => t(c),
91
- children: /* @__PURE__ */ a(o, { defaultVariant: "labelMd", mobileVariant: "labelXs", emphasis: !0, weight: "regular", children: e.label })
87
+ className: f(a.tab, m === t && a.tabActive),
88
+ onClick: () => c(t),
89
+ children: /* @__PURE__ */ e(n, { defaultVariant: "labelMd", mobileVariant: "labelXs", emphasis: !0, weight: "regular", children: i.label })
92
90
  },
93
- e.label
91
+ i.label
94
92
  )) })
95
93
  ] }) });
96
94
  };
97
95
  export {
98
- E as TimelineContent
96
+ X as TimelineContent
99
97
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t="timelineContent-module__root___5V2gz",e="timelineContent-module__container___DSrBq",n="timelineContent-module__content___HS3bJ",o="timelineContent-module__metricsContainer___Bl9Mq",i="timelineContent-module__metric___QgjTy",_="timelineContent-module__metricTitle___NgmIf",c="timelineContent-module__canvas___nyUmZ",r="timelineContent-module__circle___FOAjD",l="timelineContent-module__tabsContainer___drNVG",a="timelineContent-module__tab___sCTOs",m="timelineContent-module__tabActive___Oa023",s={root:t,container:e,content:n,metricsContainer:o,metric:i,metricTitle:_,canvas:c,circle:r,tabsContainer:l,tab:a,tabActive:m};exports.canvas=c;exports.circle=r;exports.container=e;exports.content=n;exports.default=s;exports.metric=i;exports.metricTitle=_;exports.metricsContainer=o;exports.root=t;exports.tab=a;exports.tabActive=m;exports.tabsContainer=l;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t="timelineContent-module__root___5V2gz",e="timelineContent-module__container___DSrBq",n="timelineContent-module__swiper___Pm56z",i="timelineContent-module__content___HS3bJ",o="timelineContent-module__metricsContainer___Bl9Mq",_="timelineContent-module__metric___QgjTy",c="timelineContent-module__metricTitle___NgmIf",r="timelineContent-module__canvas___nyUmZ",l="timelineContent-module__circle___FOAjD",m="timelineContent-module__tabsContainer___drNVG",a="timelineContent-module__tab___sCTOs",s="timelineContent-module__tabActive___Oa023",C={root:t,container:e,swiper:n,content:i,metricsContainer:o,metric:_,metricTitle:c,canvas:r,circle:l,tabsContainer:m,tab:a,tabActive:s};exports.canvas=r;exports.circle=l;exports.container=e;exports.content=i;exports.default=C;exports.metric=_;exports.metricTitle=c;exports.metricsContainer=o;exports.root=t;exports.swiper=n;exports.tab=a;exports.tabActive=s;exports.tabsContainer=m;
@@ -1,27 +1,29 @@
1
- const t = "timelineContent-module__root___5V2gz", e = "timelineContent-module__container___DSrBq", n = "timelineContent-module__content___HS3bJ", _ = "timelineContent-module__metricsContainer___Bl9Mq", o = "timelineContent-module__metric___QgjTy", i = "timelineContent-module__metricTitle___NgmIf", c = "timelineContent-module__canvas___nyUmZ", m = "timelineContent-module__circle___FOAjD", l = "timelineContent-module__tabsContainer___drNVG", a = "timelineContent-module__tab___sCTOs", r = "timelineContent-module__tabActive___Oa023", s = {
1
+ const t = "timelineContent-module__root___5V2gz", e = "timelineContent-module__container___DSrBq", n = "timelineContent-module__swiper___Pm56z", _ = "timelineContent-module__content___HS3bJ", o = "timelineContent-module__metricsContainer___Bl9Mq", i = "timelineContent-module__metric___QgjTy", c = "timelineContent-module__metricTitle___NgmIf", m = "timelineContent-module__canvas___nyUmZ", l = "timelineContent-module__circle___FOAjD", r = "timelineContent-module__tabsContainer___drNVG", s = "timelineContent-module__tab___sCTOs", a = "timelineContent-module__tabActive___Oa023", C = {
2
2
  root: t,
3
3
  container: e,
4
- content: n,
5
- metricsContainer: _,
6
- metric: o,
7
- metricTitle: i,
8
- canvas: c,
9
- circle: m,
10
- tabsContainer: l,
11
- tab: a,
12
- tabActive: r
4
+ swiper: n,
5
+ content: _,
6
+ metricsContainer: o,
7
+ metric: i,
8
+ metricTitle: c,
9
+ canvas: m,
10
+ circle: l,
11
+ tabsContainer: r,
12
+ tab: s,
13
+ tabActive: a
13
14
  };
14
15
  export {
15
- c as canvas,
16
- m as circle,
16
+ m as canvas,
17
+ l as circle,
17
18
  e as container,
18
- n as content,
19
- s as default,
20
- o as metric,
21
- i as metricTitle,
22
- _ as metricsContainer,
19
+ _ as content,
20
+ C as default,
21
+ i as metric,
22
+ c as metricTitle,
23
+ o as metricsContainer,
23
24
  t as root,
24
- a as tab,
25
- r as tabActive,
26
- l as tabsContainer
25
+ n as swiper,
26
+ s as tab,
27
+ a as tabActive,
28
+ r as tabsContainer
27
29
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function p(e){for(let t=e.length-1;t>0;t--){const n=Math.floor(Math.random()*(t+1));[e[t],e[n]]=[e[n],e[t]]}}function r(e,t){const n=[];for(let i=0;i<e.length;i++)e[i]===t&&n.push(i);return n}function c(e,t,n,i){p(t);for(let o=0;o<i&&o<t.length;o++)e[t[o]]=n}function a(e,t,n){const i=e+t+n,o=new Array(i).fill("optimal");let u=0,f=1,l=0;for(;Math.round(u)<i&&l<n;){const s=Math.round(u);o[s]==="optimal"&&(o[s]="outOfRange",l++),u+=f,f+=.3}if(l<n){const s=r(o,"optimal");c(o,s,"outOfRange",n-l)}const d=r(o,"optimal");return c(o,d,"inRange",t),o}exports.distributePoints=a;
@@ -0,0 +1,3 @@
1
+ type PointType = 'optimal' | 'inRange' | 'outOfRange';
2
+ export declare function distributePoints(optimal: number, inRange: number, outOfRange: number): PointType[];
3
+ export {};
@@ -0,0 +1,34 @@
1
+ function d(n) {
2
+ for (let t = n.length - 1; t > 0; t--) {
3
+ const o = Math.floor(Math.random() * (t + 1));
4
+ [n[t], n[o]] = [n[o], n[t]];
5
+ }
6
+ }
7
+ function u(n, t) {
8
+ const o = [];
9
+ for (let l = 0; l < n.length; l++)
10
+ n[l] === t && o.push(l);
11
+ return o;
12
+ }
13
+ function r(n, t, o, l) {
14
+ d(t);
15
+ for (let e = 0; e < l && e < t.length; e++)
16
+ n[t[e]] = o;
17
+ }
18
+ function h(n, t, o) {
19
+ const l = n + t + o, e = new Array(l).fill("optimal");
20
+ let c = 0, s = 1, i = 0;
21
+ for (; Math.round(c) < l && i < o; ) {
22
+ const f = Math.round(c);
23
+ e[f] === "optimal" && (e[f] = "outOfRange", i++), c += s, s += 0.3;
24
+ }
25
+ if (i < o) {
26
+ const f = u(e, "optimal");
27
+ r(e, f, "outOfRange", o - i);
28
+ }
29
+ const p = u(e, "optimal");
30
+ return r(e, p, "inRange", t), e;
31
+ }
32
+ export {
33
+ h as distributePoints
34
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenpatient-org/healthspan-marketing-ui",
3
- "version": "0.1.124",
3
+ "version": "0.1.126",
4
4
  "description": "Design system",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.es.js",