@zenpatient-org/healthspan-marketing-ui 0.1.125 → 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.
- package/dist/healthspan-marketing-ui.css +1 -1
- package/dist/modules/TrackProgress/components/TimelineContent/TimelineContent.cjs.js +1 -1
- package/dist/modules/TrackProgress/components/TimelineContent/TimelineContent.es.js +87 -89
- package/dist/modules/TrackProgress/components/TimelineContent/timelineContent.module.css.cjs.js +1 -1
- package/dist/modules/TrackProgress/components/TimelineContent/timelineContent.module.css.es.js +22 -20
- package/dist/modules/TrackProgress/components/TimelineContent/utils.cjs.js +1 -0
- package/dist/modules/TrackProgress/components/TimelineContent/utils.d.ts +3 -0
- package/dist/modules/TrackProgress/components/TimelineContent/utils.es.js +34 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
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
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
{
|
|
17
|
-
|
|
18
|
-
|
|
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__ */
|
|
44
|
-
/* @__PURE__ */
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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:
|
|
90
|
-
onClick: () => t
|
|
91
|
-
children: /* @__PURE__ */
|
|
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
|
-
|
|
91
|
+
i.label
|
|
94
92
|
)) })
|
|
95
93
|
] }) });
|
|
96
94
|
};
|
|
97
95
|
export {
|
|
98
|
-
|
|
96
|
+
X as TimelineContent
|
|
99
97
|
};
|
package/dist/modules/TrackProgress/components/TimelineContent/timelineContent.module.css.cjs.js
CHANGED
|
@@ -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",
|
|
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;
|
package/dist/modules/TrackProgress/components/TimelineContent/timelineContent.module.css.es.js
CHANGED
|
@@ -1,27 +1,29 @@
|
|
|
1
|
-
const t = "timelineContent-module__root___5V2gz", e = "timelineContent-module__container___DSrBq", n = "timelineContent-
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
16
|
-
|
|
16
|
+
m as canvas,
|
|
17
|
+
l as circle,
|
|
17
18
|
e as container,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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,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
|
+
};
|