@zenpatient-org/healthspan-marketing-ui 0.2.72 → 0.2.73
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
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),B=require("react"),_=require("../../utils/cn/cn.cjs.js"),e=require("../../src/components/Button/button.module.css"),d=require("../Icon/Icon.cjs.js"),r=B.forwardRef(({variant:u="primary",size:m="md",as:j="button",disabled:s=!1,children:v,prefixIcon:c,suffixIcon:a,analyticsProps:i,loading:b,...t},x)=>{const y=e[u]||"",C=e[m]||"",h=s?e.disabled:"",q=N=>{var o,l;i&&((o=window.eventBus)==null||o.emit("analytics",i)),(l=t.onClick)==null||l.call(t,N)};return n.jsx(j,{ref:x,...t,className:_.cn(e.button,y,C,h),disabled:s,onClick:q,"data-type":"button","data-loading":b,children:n.jsxs("div",{className:e.content,children:[c&&n.jsx("div",{className:e.iconWrap,children:n.jsx(d.Icon,{name:c})}),n.jsx("div",{children:v}),a&&n.jsx("div",{className:e.iconWrap,children:n.jsx(d.Icon,{name:a})})]})})});r.displayName="Button";exports.Button=r;
|
|
@@ -11,6 +11,7 @@ interface BaseButtonProps {
|
|
|
11
11
|
prefixIcon?: EIconName;
|
|
12
12
|
suffixIcon?: EIconName;
|
|
13
13
|
analyticsProps?: TAnalyticsEvent;
|
|
14
|
+
loading?: boolean;
|
|
14
15
|
onClick?: (event: React.MouseEvent<HTMLButtonElement> | React.MouseEvent<HTMLAnchorElement>) => void;
|
|
15
16
|
}
|
|
16
17
|
export type ButtonProps = BaseButtonProps & ButtonHTMLAttributes<HTMLButtonElement> & AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
@@ -1,44 +1,46 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { cn as
|
|
2
|
+
import { jsx as a, jsxs as w } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as B } from "react";
|
|
4
|
+
import { cn as j } from "../../utils/cn/cn.es.js";
|
|
5
5
|
import t from "../../components/Button/button.module.css";
|
|
6
6
|
import { Icon as m } from "../Icon/Icon.es.js";
|
|
7
|
-
const
|
|
7
|
+
const W = B(
|
|
8
8
|
({
|
|
9
|
-
variant:
|
|
10
|
-
size:
|
|
9
|
+
variant: d = "primary",
|
|
10
|
+
size: r = "md",
|
|
11
11
|
as: u = "button",
|
|
12
|
-
disabled:
|
|
12
|
+
disabled: i = !1,
|
|
13
13
|
children: f,
|
|
14
|
-
prefixIcon:
|
|
14
|
+
prefixIcon: e,
|
|
15
15
|
suffixIcon: s,
|
|
16
16
|
analyticsProps: o,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
loading: v,
|
|
18
|
+
...n
|
|
19
|
+
}, C) => {
|
|
20
|
+
const h = t[d] || "", N = t[r] || "", b = i ? t.disabled : "", y = (k) => {
|
|
21
|
+
var l, c;
|
|
22
|
+
o && ((l = window.eventBus) == null || l.emit("analytics", o)), (c = n.onClick) == null || c.call(n, k);
|
|
22
23
|
};
|
|
23
|
-
return /* @__PURE__ */
|
|
24
|
+
return /* @__PURE__ */ a(
|
|
24
25
|
u,
|
|
25
26
|
{
|
|
26
|
-
ref:
|
|
27
|
-
...
|
|
28
|
-
className:
|
|
29
|
-
disabled:
|
|
30
|
-
onClick:
|
|
27
|
+
ref: C,
|
|
28
|
+
...n,
|
|
29
|
+
className: j(t.button, h, N, b),
|
|
30
|
+
disabled: i,
|
|
31
|
+
onClick: y,
|
|
31
32
|
"data-type": "button",
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
/* @__PURE__ */
|
|
35
|
-
|
|
33
|
+
"data-loading": v,
|
|
34
|
+
children: /* @__PURE__ */ w("div", { className: t.content, children: [
|
|
35
|
+
e && /* @__PURE__ */ a("div", { className: t.iconWrap, children: /* @__PURE__ */ a(m, { name: e }) }),
|
|
36
|
+
/* @__PURE__ */ a("div", { children: f }),
|
|
37
|
+
s && /* @__PURE__ */ a("div", { className: t.iconWrap, children: /* @__PURE__ */ a(m, { name: s }) })
|
|
36
38
|
] })
|
|
37
39
|
}
|
|
38
40
|
);
|
|
39
41
|
}
|
|
40
42
|
);
|
|
41
|
-
|
|
43
|
+
W.displayName = "Button";
|
|
42
44
|
export {
|
|
43
|
-
|
|
45
|
+
W as Button
|
|
44
46
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
.button {
|
|
2
|
+
position: relative;
|
|
2
3
|
text-align: center;
|
|
3
4
|
display: inline-flex;
|
|
4
5
|
align-items: center;
|
|
@@ -18,6 +19,7 @@
|
|
|
18
19
|
text-transform: uppercase;
|
|
19
20
|
font-weight: var(--font-weight-regular);
|
|
20
21
|
line-height: var(--line-height-xs);
|
|
22
|
+
--spinner-color: var(--color-text-primary);
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
.button:hover {
|
|
@@ -27,50 +29,59 @@
|
|
|
27
29
|
.primary {
|
|
28
30
|
background-color: var(--color-bg-fill-primary);
|
|
29
31
|
color: var(--color-text-primary-inverted);
|
|
32
|
+
--spinner-color: var(--color-text-primary-inverted);
|
|
30
33
|
}
|
|
31
34
|
|
|
32
35
|
.primary-invert {
|
|
33
36
|
background-color: var(--color-bg-fill-brand-inverse);
|
|
34
37
|
color: var(--color-text-primary);
|
|
38
|
+
--spinner-color: var(--color-text-primary);
|
|
35
39
|
}
|
|
36
40
|
|
|
37
41
|
.secondary {
|
|
38
42
|
background-color: var(--color-bg-fill-brand-solar);
|
|
39
43
|
color: var(--color-text-primary);
|
|
44
|
+
--spinner-color: var(--color-text-primary);
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
.tertiary {
|
|
43
48
|
background-color: var(--color-bg-fill-brand-indigo);
|
|
44
49
|
color: var(--color-text-primary);
|
|
50
|
+
--spinner-color: var(--color-text-primary);
|
|
45
51
|
}
|
|
46
52
|
|
|
47
53
|
.muted {
|
|
48
54
|
background-color: transparent;
|
|
49
55
|
color: var(--color-text-primary);
|
|
50
56
|
border-color: var(--border-color-alpha-black-20);
|
|
57
|
+
--spinner-color: var(--color-text-primary);
|
|
51
58
|
}
|
|
52
59
|
|
|
53
60
|
.muted:hover {
|
|
54
61
|
background-color: var(--color-bg-fill-primary);
|
|
55
62
|
border-color: var(--color-bg-fill-primary);
|
|
56
63
|
color: var(--color-text-primary-inverted);
|
|
64
|
+
--spinner-color: var(--color-text-primary-inverted);
|
|
57
65
|
}
|
|
58
66
|
|
|
59
67
|
.muted-invert {
|
|
60
68
|
background-color: transparent;
|
|
61
69
|
color: var(--color-text-primary-inverted);
|
|
62
70
|
border-color: var(--border-color-invert);
|
|
71
|
+
--spinner-color: var(--color-text-primary-inverted);
|
|
63
72
|
}
|
|
64
73
|
|
|
65
74
|
.muted-invert:hover {
|
|
66
75
|
background-color: var(--color-bg-fill-brand-inverse);
|
|
67
76
|
border-color: var(--border-color-invert);
|
|
68
77
|
color: var(--color-text-primary);
|
|
78
|
+
--spinner-color: var(--color-text-primary);
|
|
69
79
|
}
|
|
70
80
|
|
|
71
81
|
.ghost {
|
|
72
82
|
background-color: transparent;
|
|
73
83
|
color: var(--color-text-primary);
|
|
84
|
+
--spinner-color: var(--color-text-primary);
|
|
74
85
|
}
|
|
75
86
|
|
|
76
87
|
.xs {
|
|
@@ -167,3 +178,39 @@
|
|
|
167
178
|
height: 16px;
|
|
168
179
|
max-height: 16px;
|
|
169
180
|
}
|
|
181
|
+
|
|
182
|
+
.button[data-loading='true'] {
|
|
183
|
+
&, &:disabled, &:focus {
|
|
184
|
+
color: transparent;
|
|
185
|
+
pointer-events: none;
|
|
186
|
+
cursor: default;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
&:after {
|
|
190
|
+
content: "";
|
|
191
|
+
position: absolute;
|
|
192
|
+
top: 0;
|
|
193
|
+
left: 0;
|
|
194
|
+
right: 0;
|
|
195
|
+
bottom: 0;
|
|
196
|
+
display: block;
|
|
197
|
+
width: 1.5em;
|
|
198
|
+
height: 1.5em;
|
|
199
|
+
border-radius: 50%;
|
|
200
|
+
border: var(--border-width-md) solid var(--spinner-color);
|
|
201
|
+
border-bottom-color: transparent;
|
|
202
|
+
opacity: 0.6;
|
|
203
|
+
animation: button-loading-spinner 1s ease infinite;
|
|
204
|
+
margin: auto;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
@keyframes button-loading-spinner {
|
|
209
|
+
0% {
|
|
210
|
+
transform: rotate(0deg);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
100% {
|
|
214
|
+
transform: rotate(360deg);
|
|
215
|
+
}
|
|
216
|
+
}
|