@kakadu/components 2.2.1 → 2.3.0
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/build/components/button-tooltip.d.ts +2 -1
- package/build/components/button-tooltip.js +1 -1
- package/build/components/button-tooltip.mjs +7 -6
- package/build/components/button.js +1 -1
- package/build/components/button.mjs +44 -44
- package/build/components/collapsible.js +1 -1
- package/build/components/collapsible.mjs +12 -12
- package/build/components/icon-button.js +1 -1
- package/build/components/icon-button.mjs +29 -29
- package/build/components/modal.d.ts +3 -2
- package/build/components/modal.js +1 -9
- package/build/components/modal.mjs +105 -1226
- package/build/components/moving-gradients.js +1 -1
- package/build/components/moving-gradients.mjs +2 -2
- package/build/components/moving-stars.js +1 -1
- package/build/components/moving-stars.mjs +17 -17
- package/build/components/notification.js +1 -1
- package/build/components/notification.mjs +12 -12
- package/build/components/popover-menu.d.ts +19 -0
- package/build/components/popover-menu.js +1 -0
- package/build/components/popover-menu.mjs +68 -0
- package/build/components/popover.d.ts +26 -0
- package/build/components/popover.js +1 -0
- package/build/components/popover.mjs +95 -0
- package/build/components/skeleton.js +1 -1
- package/build/components/skeleton.mjs +23 -23
- package/build/components/spinner.js +1 -1
- package/build/components/spinner.mjs +1 -1
- package/build/components/text-button.js +1 -1
- package/build/components/text-button.mjs +14 -14
- package/build/components.css +1 -1
- package/build/focus-trap-react-CcpTuiJi.js +9 -0
- package/build/focus-trap-react-DYXrtbDH.mjs +1130 -0
- package/build/icons/icon.js +1 -1
- package/build/icons/icon.mjs +11 -11
- package/build/index.d.ts +4 -0
- package/build/index.js +1 -1
- package/build/index.mjs +161 -154
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const N=require("../jsx-runtime-BB_1_6y_.js"),i=require("react"),_=require("@kuma-ui/core"),D=["rgb(46, 75, 164)","rgb(58, 125, 159)","rgb(42, 81, 142)","rgb(48, 132, 168)","rgb(45, 64, 157)"];function L(S){return S.map(C=>{var n;const[m,b,X]=((n=C.match(/\d+/g))==null?void 0:n.map(Number))??[];return[m,b,X]})}function O({className:S,colors:C=D,maximumGradientsCount:m=10,speed:b=1,opacity:X=.2}){const n=i.useRef(null),[h,z]=i.useState(),[g,H]=i.useState(0),[p,W]=i.useState(0),q=i.useMemo(()=>L(C),[C]),$=i.useMemo(()=>q.length,[q]),Y=i.useCallback(()=>{const f=Math.random(),y=q[Math.floor($*f)],
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const N=require("../jsx-runtime-BB_1_6y_.js"),i=require("react"),_=require("@kuma-ui/core"),D=["rgb(46, 75, 164)","rgb(58, 125, 159)","rgb(42, 81, 142)","rgb(48, 132, 168)","rgb(45, 64, 157)"];function L(S){return S.map(C=>{var n;const[m,b,X]=((n=C.match(/\d+/g))==null?void 0:n.map(Number))??[];return[m,b,X]})}function O({className:S,colors:C=D,maximumGradientsCount:m=10,speed:b=1,opacity:X=.2}){const n=i.useRef(null),[h,z]=i.useState(),[g,H]=i.useState(0),[p,W]=i.useState(0),q=i.useMemo(()=>L(C),[C]),$=i.useMemo(()=>q.length,[q]),Y=i.useCallback(()=>{const f=Math.random(),y=q[Math.floor($*f)],r=g*1.25,M=g*.25,v=p*1.25,e=p*.25,t=r*Math.random()-M,s=v*Math.random()-e,o=Math.max(r,v);return{color:y,size:o*f+o/2,opacity:0,speed:Math.max(.1,f/2*b),startPosition:[t,s],currentPosition:[t,s],targetPosition:[r*Math.random()-M,v*Math.random()-e]}},[q,$,g,p,b]);return i.useEffect(()=>{const a=Array.from({length:m}).map(()=>Y());let f=m,y=!1,r;function M(){if(!y){if(!h){r=requestAnimationFrame(M);return}h.clearRect(0,0,g,p);for(let e=a.length;e;e-=1){const t=a[e-1],[s,o]=t.startPosition,[c,l]=t.currentPosition,[u,d]=t.targetPosition;let x=!0;if(s>u?c>u&&(x=!1):c<u&&(x=!1),o>d?l>d&&(x=!1):l<d&&(x=!1),x){a.splice(e-1,1),f-=1;continue}const k=(s+u)/2-s,w=c-s,G=(o+d)/2-o,I=l-o,j=(w/k+I/G)/2;t.opacity=j>1?2-j:j;const R=t.size/2,A=h.createRadialGradient(c,l,R,c,l,0);if(A.addColorStop(0,`rgba(${t.color.join(",")},0)`),A.addColorStop(1,`rgba(${t.color.join(",")},${t.opacity})`),h.fillStyle=A,h.fillRect(c-R,l-R,t.size,t.size),c!==u){const E=Math.abs(s-u),F=Math.abs(o-d),P=Math.min(1,E/F);c<u?t.currentPosition[0]+=t.speed*P:t.currentPosition[0]-=t.speed*P}if(l!==d){const E=Math.abs(s-u),F=Math.abs(o-d),P=Math.min(1,F/E);l<d?t.currentPosition[1]+=t.speed*P:t.currentPosition[1]-=t.speed*P}}r=requestAnimationFrame(M)}}r=requestAnimationFrame(M);const v=setInterval(()=>{let e=m-f;if(e>0)for(;e;)a.push(Y()),e-=1,f+=1},1500);return()=>{y=!0,r&&cancelAnimationFrame(r),clearInterval(v)}},[m,Y,h,g,p,b]),i.useEffect(()=>{if(n.current){const a=n.current.getContext("2d");a&&z(a),H(n.current.offsetWidth),W(n.current.offsetHeight)}},[n]),N.jsxRuntimeExports.jsx("canvas",{ref:n,"aria-hidden":!0,role:"presentation",width:g,height:p,style:{"--opacity":X},className:_.cx("kakadu-components-4131181690",S)})}exports.default=O;
|
|
@@ -77,9 +77,9 @@ function Z({
|
|
|
77
77
|
const i = n.current.getContext("2d");
|
|
78
78
|
i && k(i), w(n.current.offsetWidth), $(n.current.offsetHeight);
|
|
79
79
|
}
|
|
80
|
-
}, [n]), /* @__PURE__ */ L.jsx("canvas", { ref: n, width: h, height: p, style: {
|
|
80
|
+
}, [n]), /* @__PURE__ */ L.jsx("canvas", { ref: n, "aria-hidden": !0, role: "presentation", width: h, height: p, style: {
|
|
81
81
|
"--opacity": Y
|
|
82
|
-
}, className: K("kakadu-components-
|
|
82
|
+
}, className: K("kakadu-components-4131181690", X) });
|
|
83
83
|
}
|
|
84
84
|
export {
|
|
85
85
|
Z as default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const N=require("../jsx-runtime-BB_1_6y_.js"),u=require("react"),T=require("@kuma-ui/core");function B({color:y,opacity:R,className:W,minimumSize:A=1,maximumSize:S=5,maximumStarsCount:x=50,speed:C=1,hasMask:j=!1}){const e=u.useRef(null),[r,z]=u.useState(),[f,F]=u.useState(0),[d,H]=u.useState(0),q=u.useCallback(()=>{const n=f*1.5,s=f*.25,a=d*1.5,o=d*.25,M=n*Math.random()-s,h=a*Math.random()-o;return{size:Math.max(A,S*Math.random()),opacity:0,speed:Math.max(.1,Math.random()/2*C),startPosition:[M,h],currentPosition:[M,h],targetPosition:[n*Math.random()-s,a*Math.random()-o]}},[f,d,A,S,C]),w=u.useCallback(()=>y??(e.current?getComputedStyle(e.current).color:"#000"),[y,e]);return u.useEffect(()=>{const n=Array.from({length:x}).map(()=>q());let s=x,a=!1,o,M=w();function h(){if(!a){if(!r){o=requestAnimationFrame(h);return}r.clearRect(0,0,f,d);for(let i=n.length;i;i-=1){const t=n[i-1],[v,
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const N=require("../jsx-runtime-BB_1_6y_.js"),u=require("react"),T=require("@kuma-ui/core");function B({color:y,opacity:R,className:W,minimumSize:A=1,maximumSize:S=5,maximumStarsCount:x=50,speed:C=1,hasMask:j=!1}){const e=u.useRef(null),[r,z]=u.useState(),[f,F]=u.useState(0),[d,H]=u.useState(0),q=u.useCallback(()=>{const n=f*1.5,s=f*.25,a=d*1.5,o=d*.25,M=n*Math.random()-s,h=a*Math.random()-o;return{size:Math.max(A,S*Math.random()),opacity:0,speed:Math.max(.1,Math.random()/2*C),startPosition:[M,h],currentPosition:[M,h],targetPosition:[n*Math.random()-s,a*Math.random()-o]}},[f,d,A,S,C]),w=u.useCallback(()=>y??(e.current?getComputedStyle(e.current).color:"#000"),[y,e]);return u.useEffect(()=>{const n=Array.from({length:x}).map(()=>q());let s=x,a=!1,o,M=w();function h(){if(!a){if(!r){o=requestAnimationFrame(h);return}r.clearRect(0,0,f,d);for(let i=n.length;i;i-=1){const t=n[i-1],[v,p]=t.startPosition,[g,m]=t.currentPosition,[c,l]=t.targetPosition;let P=!0;if(v>c?g>c&&(P=!1):g<c&&(P=!1),p>l?m>l&&(P=!1):m<l&&(P=!1),P){n.splice(i-1,1),s-=1;continue}const L=(v+c)/2-v,O=g-v,_=(p+l)/2-p,$=m-p,X=(O/L+$/_)/2;t.opacity=X>1?2-X:X;const Y=t.size/2;if(r.beginPath(),r.arc(g-Y,m-Y,Y,0,2*Math.PI,!1),r.globalAlpha=t.opacity,r.fillStyle=M,r.fill(),g!==c){const E=Math.abs(v-c),k=Math.abs(p-l),b=Math.min(1,E/k);g<c?t.currentPosition[0]+=t.speed*b:t.currentPosition[0]-=t.speed*b}if(m!==l){const E=Math.abs(v-c),k=Math.abs(p-l),b=Math.min(1,k/E);m<l?t.currentPosition[1]+=t.speed*b:t.currentPosition[1]-=t.speed*b}}o=requestAnimationFrame(h)}}o=requestAnimationFrame(h);const I=setInterval(()=>{M=w();let i=x-s;if(i>0)for(;i;)n.push(q()),i-=1,s+=1},500);return()=>{a=!0,o&&cancelAnimationFrame(o),clearInterval(I)}},[x,q,w,r,f,d,C]),u.useEffect(()=>{if(e.current){const n=e.current.getContext("2d");n&&z(n),F(e.current.offsetWidth),H(e.current.offsetHeight);const s=()=>{e.current&&(F(e.current.offsetWidth),H(e.current.offsetHeight))},a=new ResizeObserver(s);return a.observe(e.current),window.addEventListener("resize",s,{passive:!0}),()=>{a.disconnect(),window.removeEventListener("resize",s)}}},[e]),N.jsxRuntimeExports.jsx("canvas",{ref:e,"aria-hidden":!0,role:"presentation",style:{"--color":y,"--opacity":R},className:T.cx("kakadu-components-3366903902",j&&"kakadu-components-4049648322",W),width:f,height:d})}exports.default=B;
|
|
@@ -11,40 +11,40 @@ function Z({
|
|
|
11
11
|
speed: y = 1,
|
|
12
12
|
hasMask: L = !1
|
|
13
13
|
}) {
|
|
14
|
-
const e = K(null), [
|
|
15
|
-
const n = f * 1.5,
|
|
14
|
+
const e = K(null), [s, S] = k(), [f, H] = k(0), [u, W] = k(0), C = R(() => {
|
|
15
|
+
const n = f * 1.5, r = f * 0.25, o = u * 1.5, a = u * 0.25, g = n * Math.random() - r, d = o * Math.random() - a;
|
|
16
16
|
return {
|
|
17
17
|
size: Math.max(q, F * Math.random()),
|
|
18
18
|
opacity: 0,
|
|
19
19
|
speed: Math.max(0.1, Math.random() / 2 * y),
|
|
20
20
|
startPosition: [g, d],
|
|
21
21
|
currentPosition: [g, d],
|
|
22
|
-
targetPosition: [n * Math.random() -
|
|
22
|
+
targetPosition: [n * Math.random() - r, o * Math.random() - a]
|
|
23
23
|
};
|
|
24
24
|
}, [f, u, q, F, y]), w = R(() => b ?? (e.current ? getComputedStyle(e.current).color : "#000"), [b, e]);
|
|
25
25
|
return j(() => {
|
|
26
26
|
const n = Array.from({
|
|
27
27
|
length: x
|
|
28
28
|
}).map(() => C());
|
|
29
|
-
let
|
|
29
|
+
let r = x, o = !1, a, g = w();
|
|
30
30
|
function d() {
|
|
31
31
|
if (!o) {
|
|
32
|
-
if (!
|
|
32
|
+
if (!s) {
|
|
33
33
|
a = requestAnimationFrame(d);
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
s.clearRect(0, 0, f, u);
|
|
37
37
|
for (let i = n.length; i; i -= 1) {
|
|
38
38
|
const t = n[i - 1], [h, p] = t.startPosition, [m, v] = t.currentPosition, [c, l] = t.targetPosition;
|
|
39
39
|
let M = !0;
|
|
40
40
|
if (h > c ? m > c && (M = !1) : m < c && (M = !1), p > l ? v > l && (M = !1) : v < l && (M = !1), M) {
|
|
41
|
-
n.splice(i - 1, 1),
|
|
41
|
+
n.splice(i - 1, 1), r -= 1;
|
|
42
42
|
continue;
|
|
43
43
|
}
|
|
44
44
|
const O = (h + c) / 2 - h, B = m - h, D = (p + l) / 2 - p, G = v - p, X = (B / O + G / D) / 2;
|
|
45
45
|
t.opacity = X > 1 ? 2 - X : X;
|
|
46
46
|
const Y = t.size / 2;
|
|
47
|
-
if (
|
|
47
|
+
if (s.beginPath(), s.arc(m - Y, v - Y, Y, 0, 2 * Math.PI, !1), s.globalAlpha = t.opacity, s.fillStyle = g, s.fill(), m !== c) {
|
|
48
48
|
const A = Math.abs(h - c), E = Math.abs(p - l), P = Math.min(1, A / E);
|
|
49
49
|
m < c ? t.currentPosition[0] += t.speed * P : t.currentPosition[0] -= t.speed * P;
|
|
50
50
|
}
|
|
@@ -59,31 +59,31 @@ function Z({
|
|
|
59
59
|
a = requestAnimationFrame(d);
|
|
60
60
|
const N = setInterval(() => {
|
|
61
61
|
g = w();
|
|
62
|
-
let i = x -
|
|
62
|
+
let i = x - r;
|
|
63
63
|
if (i > 0)
|
|
64
64
|
for (; i; )
|
|
65
|
-
n.push(C()), i -= 1,
|
|
65
|
+
n.push(C()), i -= 1, r += 1;
|
|
66
66
|
}, 500);
|
|
67
67
|
return () => {
|
|
68
68
|
o = !0, a && cancelAnimationFrame(a), clearInterval(N);
|
|
69
69
|
};
|
|
70
|
-
}, [x, C, w,
|
|
70
|
+
}, [x, C, w, s, f, u, y]), j(() => {
|
|
71
71
|
if (e.current) {
|
|
72
72
|
const n = e.current.getContext("2d");
|
|
73
73
|
n && S(n), H(e.current.offsetWidth), W(e.current.offsetHeight);
|
|
74
|
-
const
|
|
74
|
+
const r = () => {
|
|
75
75
|
e.current && (H(e.current.offsetWidth), W(e.current.offsetHeight));
|
|
76
|
-
}, o = new ResizeObserver(
|
|
77
|
-
return o.observe(e.current), window.addEventListener("resize",
|
|
76
|
+
}, o = new ResizeObserver(r);
|
|
77
|
+
return o.observe(e.current), window.addEventListener("resize", r, {
|
|
78
78
|
passive: !0
|
|
79
79
|
}), () => {
|
|
80
|
-
o.disconnect(), window.removeEventListener("resize",
|
|
80
|
+
o.disconnect(), window.removeEventListener("resize", r);
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
-
}, [e]), /* @__PURE__ */ J.jsx("canvas", { ref: e, style: {
|
|
83
|
+
}, [e]), /* @__PURE__ */ J.jsx("canvas", { ref: e, "aria-hidden": !0, role: "presentation", style: {
|
|
84
84
|
"--color": b,
|
|
85
85
|
"--opacity": z
|
|
86
|
-
}, className: Q("kakadu-components-
|
|
86
|
+
}, className: Q("kakadu-components-3366903902", L && "kakadu-components-4049648322", I), width: f, height: u });
|
|
87
87
|
}
|
|
88
88
|
export {
|
|
89
89
|
Z as default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("../jsx-runtime-BB_1_6y_.js"),t=require("react"),k=require("@kuma-ui/core"),v=require("../utilities/generate-random-id.js"),x=require("./notice.js");function N({type:n,icon:f,index:
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("../jsx-runtime-BB_1_6y_.js"),t=require("react"),k=require("@kuma-ui/core"),v=require("../utilities/generate-random-id.js"),x=require("./notice.js");function N({type:n,icon:f,index:c,className:u,children:d,onDismiss:o,...i}){const[e,r]=t.useState(!1),[l,j]=t.useState(!1);t.useEffect(()=>{const a=setTimeout(()=>{r(!0)},250);return()=>{clearTimeout(a)}},[]),t.useEffect(()=>{if(e){const a=setTimeout(()=>{r(!1),j(!0)},6e3);return()=>{clearTimeout(a)}}},[e]);const m=c??0;return t.useEffect(()=>{if(l&&!e){const a=setTimeout(()=>{o==null||o(m)},300);return()=>{clearTimeout(a)}}},[l,e,o,m]),s.jsxRuntimeExports.jsx("div",{...i,style:{"--index":m},className:k.cx("kakadu-components-258945758",e&&"kakadu-components-3003995416",u),children:s.jsxRuntimeExports.jsxs(x.default,{role:"status","aria-live":"polite","aria-atomic":"true",type:n,icon:f,className:"kakadu-components-1639448689",children:[d,s.jsxRuntimeExports.jsx("div",{className:"kakadu-components-2751825161",children:s.jsxRuntimeExports.jsx("div",{className:"kakadu-components-1939222061"})})]})})}const p=t.createContext({createNotification(){throw new Error("useCreateNotification must be used within a NotificationProvider")}});function E(){const{createNotification:n}=t.useContext(p);return n}function T({children:n}){const[f,c]=t.useState([]),u=t.useCallback(i=>{const e=v.default();c(r=>[...r,{...i,id:e}])},[]),d=t.useCallback(i=>{c(e=>e.filter((r,l)=>l!==i))},[]),o=t.useMemo(()=>({createNotification:u}),[u]);return s.jsxRuntimeExports.jsxs(p.Provider,{value:o,children:[n,f.map((i,e)=>s.jsxRuntimeExports.jsx(N,{...i,index:e,onDismiss:d},i.id))]})}exports.NotificationType=x.NoticeType;exports.NotificationProvider=T;exports.default=N;exports.useCreateNotification=E;
|
|
@@ -13,37 +13,37 @@ function I({
|
|
|
13
13
|
onDismiss: o,
|
|
14
14
|
...e
|
|
15
15
|
}) {
|
|
16
|
-
const [t,
|
|
16
|
+
const [t, a] = p(!1), [u, k] = p(!1);
|
|
17
17
|
l(() => {
|
|
18
|
-
const
|
|
19
|
-
|
|
18
|
+
const n = setTimeout(() => {
|
|
19
|
+
a(!0);
|
|
20
20
|
}, 250);
|
|
21
21
|
return () => {
|
|
22
|
-
clearTimeout(
|
|
22
|
+
clearTimeout(n);
|
|
23
23
|
};
|
|
24
24
|
}, []), l(() => {
|
|
25
25
|
if (t) {
|
|
26
|
-
const
|
|
27
|
-
|
|
26
|
+
const n = setTimeout(() => {
|
|
27
|
+
a(!1), k(!0);
|
|
28
28
|
}, 6e3);
|
|
29
29
|
return () => {
|
|
30
|
-
clearTimeout(
|
|
30
|
+
clearTimeout(n);
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
}, [t]);
|
|
34
34
|
const d = r ?? 0;
|
|
35
35
|
return l(() => {
|
|
36
36
|
if (u && !t) {
|
|
37
|
-
const
|
|
37
|
+
const n = setTimeout(() => {
|
|
38
38
|
o == null || o(d);
|
|
39
39
|
}, 300);
|
|
40
40
|
return () => {
|
|
41
|
-
clearTimeout(
|
|
41
|
+
clearTimeout(n);
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
}, [u, t, o, d]), /* @__PURE__ */ i.jsx("div", { ...e, style: {
|
|
45
45
|
"--index": d
|
|
46
|
-
}, className: h("kakadu-components-258945758", t && "kakadu-components-3003995416", c), children: /* @__PURE__ */ i.jsxs(b, { "aria-live": "polite", type: s, icon: m, className: "kakadu-components-1639448689", children: [
|
|
46
|
+
}, className: h("kakadu-components-258945758", t && "kakadu-components-3003995416", c), children: /* @__PURE__ */ i.jsxs(b, { role: "status", "aria-live": "polite", "aria-atomic": "true", type: s, icon: m, className: "kakadu-components-1639448689", children: [
|
|
47
47
|
f,
|
|
48
48
|
/* @__PURE__ */ i.jsx("div", { className: "kakadu-components-2751825161", children: /* @__PURE__ */ i.jsx("div", { className: "kakadu-components-1939222061" }) })
|
|
49
49
|
] }) });
|
|
@@ -64,12 +64,12 @@ function g({
|
|
|
64
64
|
}) {
|
|
65
65
|
const [m, r] = p([]), c = N((e) => {
|
|
66
66
|
const t = C();
|
|
67
|
-
r((
|
|
67
|
+
r((a) => [...a, {
|
|
68
68
|
...e,
|
|
69
69
|
id: t
|
|
70
70
|
}]);
|
|
71
71
|
}, []), f = N((e) => {
|
|
72
|
-
r((t) => t.filter((
|
|
72
|
+
r((t) => t.filter((a, u) => u !== e));
|
|
73
73
|
}, []), o = T(() => ({
|
|
74
74
|
createNotification: c
|
|
75
75
|
}), [c]);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type MouseEvent, type ReactNode } from 'react';
|
|
2
|
+
import { type IconType } from '../icons/icon';
|
|
3
|
+
export type PopoverMenuItemProperties = {
|
|
4
|
+
readonly label: ReactNode;
|
|
5
|
+
readonly iconLeft?: IconType;
|
|
6
|
+
readonly iconRight?: IconType;
|
|
7
|
+
readonly href?: string;
|
|
8
|
+
readonly shouldCloseOnClick?: boolean;
|
|
9
|
+
readonly onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
10
|
+
};
|
|
11
|
+
export declare function usePopoverMenu(items: PopoverMenuItemProperties[]): {
|
|
12
|
+
show: (reference?: HTMLElement) => Promise<void | undefined>;
|
|
13
|
+
popoverMenu: import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
};
|
|
15
|
+
export type PopoverMenuProperties = {
|
|
16
|
+
readonly menu: ReactNode;
|
|
17
|
+
readonly children: ReactNode;
|
|
18
|
+
};
|
|
19
|
+
export default function PopoverMenu({ menu, children }: PopoverMenuProperties): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../jsx-runtime-BB_1_6y_.js"),j=require("@kuma-ui/core"),a=require("react"),v=require("../theme.js"),c=require("../icons/icon.js"),i=require("./popover.js"),R=require("./atom.js"),h=require("./text.js"),m=require("./hover-gradient.js"),q=require("./click-ripples.js");function f({label:t,iconLeft:s,iconRight:o,href:n,shouldCloseOnClick:p=!0,onClick:r,...x}){const{close:u}=i.usePopoverContext(),l=a.useCallback(d=>{r==null||r(d),p&&(u==null||u())},[r,p,u]);return e.jsxRuntimeExports.jsxs(R.default,{as:n?"a":"button",...x,type:n?void 0:"button",role:"menuitem",href:n,className:j.cx(v.buttonResetStyles,"kakadu-components-3983689191"),onClick:l,children:[e.jsxRuntimeExports.jsxs(h.Span,{className:"kakadu-components-2008173413",children:[s?e.jsxRuntimeExports.jsx(c.default,{width:12,height:12,type:s}):null,e.jsxRuntimeExports.jsx("span",{className:"kakadu-components-3911899222",children:t}),o?e.jsxRuntimeExports.jsx(c.default,{width:12,height:12,type:o}):null]}),e.jsxRuntimeExports.jsx(m.default,{size:100,className:m.normalBlendStyles}),e.jsxRuntimeExports.jsx(q.default,{size:100})]})}function E({items:t,...s}){return e.jsxRuntimeExports.jsx(i.default,{...s,as:"nav",role:"menu",innerClassName:"kakadu-components-3719863410",children:t.map((o,n)=>e.jsxRuntimeExports.jsx(f,{...o},n))})}function M(t){const s=a.useMemo(()=>({items:t}),[t]),{show:o,popover:n}=i.usePopover(E,s);return a.useMemo(()=>({show:o,popoverMenu:n}),[o,n])}function k({menu:t,children:s}){return e.jsxRuntimeExports.jsxs("div",{className:"kakadu-components-768919721",children:[s,t]})}exports.default=k;exports.usePopoverMenu=M;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { j as e } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
2
|
+
import { cx as d } from "@kuma-ui/core";
|
|
3
|
+
import { useMemo as p, useCallback as x } from "react";
|
|
4
|
+
import { buttonResetStyles as f } from "../theme.mjs";
|
|
5
|
+
import u from "../icons/icon.mjs";
|
|
6
|
+
import v, { usePopover as j, usePopoverContext as h } from "./popover.mjs";
|
|
7
|
+
import k from "./atom.mjs";
|
|
8
|
+
import { Span as P } from "./text.mjs";
|
|
9
|
+
import M, { normalBlendStyles as N } from "./hover-gradient.mjs";
|
|
10
|
+
import y from "./click-ripples.mjs";
|
|
11
|
+
function b({
|
|
12
|
+
label: o,
|
|
13
|
+
iconLeft: t,
|
|
14
|
+
iconRight: s,
|
|
15
|
+
href: r,
|
|
16
|
+
shouldCloseOnClick: a = !0,
|
|
17
|
+
onClick: n,
|
|
18
|
+
...i
|
|
19
|
+
}) {
|
|
20
|
+
const {
|
|
21
|
+
close: m
|
|
22
|
+
} = h(), c = x((l) => {
|
|
23
|
+
n == null || n(l), a && (m == null || m());
|
|
24
|
+
}, [n, a, m]);
|
|
25
|
+
return /* @__PURE__ */ e.jsxs(k, { as: r ? "a" : "button", ...i, type: r ? void 0 : "button", role: "menuitem", href: r, className: d(f, "kakadu-components-3983689191"), onClick: c, children: [
|
|
26
|
+
/* @__PURE__ */ e.jsxs(P, { className: "kakadu-components-2008173413", children: [
|
|
27
|
+
t ? /* @__PURE__ */ e.jsx(u, { width: 12, height: 12, type: t }) : null,
|
|
28
|
+
/* @__PURE__ */ e.jsx("span", { className: "kakadu-components-3911899222", children: o }),
|
|
29
|
+
s ? /* @__PURE__ */ e.jsx(u, { width: 12, height: 12, type: s }) : null
|
|
30
|
+
] }),
|
|
31
|
+
/* @__PURE__ */ e.jsx(M, { size: 100, className: N }),
|
|
32
|
+
/* @__PURE__ */ e.jsx(y, { size: 100 })
|
|
33
|
+
] });
|
|
34
|
+
}
|
|
35
|
+
function w({
|
|
36
|
+
items: o,
|
|
37
|
+
...t
|
|
38
|
+
}) {
|
|
39
|
+
return /* @__PURE__ */ e.jsx(v, { ...t, as: "nav", role: "menu", innerClassName: "kakadu-components-3719863410", children: o.map((s, r) => (
|
|
40
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
41
|
+
/* @__PURE__ */ e.jsx(b, { ...s }, r)
|
|
42
|
+
)) });
|
|
43
|
+
}
|
|
44
|
+
function q(o) {
|
|
45
|
+
const t = p(() => ({
|
|
46
|
+
items: o
|
|
47
|
+
}), [o]), {
|
|
48
|
+
show: s,
|
|
49
|
+
popover: r
|
|
50
|
+
} = j(w, t);
|
|
51
|
+
return p(() => ({
|
|
52
|
+
show: s,
|
|
53
|
+
popoverMenu: r
|
|
54
|
+
}), [s, r]);
|
|
55
|
+
}
|
|
56
|
+
function D({
|
|
57
|
+
menu: o,
|
|
58
|
+
children: t
|
|
59
|
+
}) {
|
|
60
|
+
return /* @__PURE__ */ e.jsxs("div", { className: "kakadu-components-768919721", children: [
|
|
61
|
+
t,
|
|
62
|
+
o
|
|
63
|
+
] });
|
|
64
|
+
}
|
|
65
|
+
export {
|
|
66
|
+
D as default,
|
|
67
|
+
q as usePopoverMenu
|
|
68
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type ComponentType } from 'react';
|
|
2
|
+
import { type AtomElementType, type AtomProperties, type DefaultAtomElementType } from './atom';
|
|
3
|
+
type InitialFocusElement = HTMLElement | null;
|
|
4
|
+
type PopoverProviderProperties<Data = any> = {
|
|
5
|
+
isVisible: boolean;
|
|
6
|
+
setInitialFocus?: (initialFocus?: InitialFocusElement) => void;
|
|
7
|
+
close?: (data?: Data) => void;
|
|
8
|
+
};
|
|
9
|
+
export declare function usePopoverContext<Data = any>(): PopoverProviderProperties<Data>;
|
|
10
|
+
export type PopoverProperties<Data = any, Type extends AtomElementType = DefaultAtomElementType> = AtomProperties<Type> & {
|
|
11
|
+
readonly innerClassName?: string;
|
|
12
|
+
readonly label?: string;
|
|
13
|
+
readonly isVisible?: boolean;
|
|
14
|
+
readonly initialFocus?: HTMLElement;
|
|
15
|
+
readonly shouldCloseOnOutsideClick?: boolean;
|
|
16
|
+
readonly shouldCloseOnEscapePress?: boolean;
|
|
17
|
+
readonly onClose?: (data?: Data) => void;
|
|
18
|
+
};
|
|
19
|
+
type PopoverBaseProperties<PopoverResult> = Omit<PopoverProperties<PopoverResult>, 'isVisible' | 'onClose'>;
|
|
20
|
+
export default function Popover<Data = any, Type extends AtomElementType = DefaultAtomElementType>({ as, isVisible, label, shouldCloseOnOutsideClick, shouldCloseOnEscapePress, children, className, innerClassName, onClose, ...properties }: PopoverProperties<Data, Type>): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare function usePopover<PopoverResult, PopoverProperties = PopoverBaseProperties<PopoverResult>>(PopoverComponent: ComponentType<PopoverProperties>, properties?: PopoverProperties): {
|
|
22
|
+
isVisible: boolean;
|
|
23
|
+
show: (reference?: HTMLElement) => Promise<PopoverResult | undefined>;
|
|
24
|
+
popover: import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
};
|
|
26
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../jsx-runtime-BB_1_6y_.js"),j=require("@kuma-ui/core"),e=require("react"),F=require("../focus-trap-react-CcpTuiJi.js"),h=require("./atom.js"),I=e.createContext({isVisible:!1}),{Provider:N}=I;function C(){return e.useContext(I)}function V({as:d,isVisible:s,label:r,shouldCloseOnOutsideClick:l=!0,shouldCloseOnEscapePress:n=!0,children:a,className:m,innerClassName:x,onClose:u,...f}){const c=e.useRef(null),p=e.useRef(null),[k,q]=e.useState(!1),[i,v]=e.useState(!1),E=e.useCallback(t=>{c.current=t,v(!1)},[]),R=e.useRef(null),b=e.useCallback(t=>{t&&(R.current=t)},[]),M=e.useMemo(()=>({initialFocus:()=>R.current??void 0,onActivate:()=>{var t;return(t=R.current)==null?void 0:t.focus()},clickOutsideDeactivates:l,escapeDeactivates:n,onDeactivate(){v(!1)}}),[l,n]),[T,P]=e.useState(s??!1),S=e.useMemo(()=>({isVisible:T,setInitialFocus:b,close:E}),[T,b,E]);return e.useEffect(()=>{s&&(q(!0),P(!0))},[s]),e.useEffect(()=>{if(s){const t=setTimeout(()=>{v(!0)},100);return()=>{clearTimeout(t)}}v(!1)},[s]),e.useEffect(()=>{if(k&&!i){const t=setTimeout(()=>{u==null||u(c.current??void 0),P(!1)},370);return()=>{clearTimeout(t)}}},[k,i,u]),o.jsxRuntimeExports.jsx(h.default,{reference:p,as:d??h.defaultAtomElementType,role:"dialog","aria-hidden":!i,"aria-label":r??"Popover",...f,className:j.cx("kakadu-components-3573963023",i&&"kakadu-components-1399012551",m),children:o.jsxRuntimeExports.jsxs("div",{className:j.cx("kakadu-components-1118152266",i&&"kakadu-components-231244945"),children:[o.jsxRuntimeExports.jsx("div",{className:"kakadu-components-343234026"}),o.jsxRuntimeExports.jsx(F.focusTrapReactExports.FocusTrap,{active:i,focusTrapOptions:M,children:o.jsxRuntimeExports.jsxs("div",{className:j.cx("kakadu-components-3905822111",x),children:[o.jsxRuntimeExports.jsx(N,{value:S,children:a}),o.jsxRuntimeExports.jsx("div",{className:"kakadu-components-2014365216"})]})})]})})}function g(d,s){const[r,l]=e.useState(!1),n=e.useRef(void 0),a=e.useRef(null),m=e.useCallback(async f=>(l(!0),a.current=f??document.activeElement,new Promise(c=>{n.current=c})),[]),x=e.useCallback(f=>{var c;if(l(!1),(c=n.current)==null||c.call(n,f),n.current=void 0,a.current){const p=a.current;p.isConnected&&p.focus(),a.current=null}},[]),u=e.useMemo(()=>o.jsxRuntimeExports.jsx(d,{...s,isVisible:r,onClose:x}),[d,s,r,x]);return e.useMemo(()=>({isVisible:r,show:m,popover:u}),[r,m,u])}exports.default=V;exports.usePopover=g;exports.usePopoverContext=C;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { j as n } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
2
|
+
import { cx as I } from "@kuma-ui/core";
|
|
3
|
+
import { createContext as y, useRef as f, useState as k, useCallback as j, useMemo as T, useEffect as b, useContext as g } from "react";
|
|
4
|
+
import { f as M } from "../focus-trap-react-DYXrtbDH.mjs";
|
|
5
|
+
import S, { defaultAtomElementType as W } from "./atom.mjs";
|
|
6
|
+
const V = y({
|
|
7
|
+
isVisible: !1
|
|
8
|
+
}), {
|
|
9
|
+
Provider: q
|
|
10
|
+
} = V;
|
|
11
|
+
function J() {
|
|
12
|
+
return g(V);
|
|
13
|
+
}
|
|
14
|
+
function K({
|
|
15
|
+
as: m,
|
|
16
|
+
isVisible: t,
|
|
17
|
+
label: a,
|
|
18
|
+
shouldCloseOnOutsideClick: u = !0,
|
|
19
|
+
shouldCloseOnEscapePress: s = !0,
|
|
20
|
+
children: r,
|
|
21
|
+
className: d,
|
|
22
|
+
innerClassName: p,
|
|
23
|
+
onClose: o,
|
|
24
|
+
...l
|
|
25
|
+
}) {
|
|
26
|
+
const c = f(null), v = f(null), [R, w] = k(!1), [i, x] = k(!1), F = j((e) => {
|
|
27
|
+
c.current = e, x(!1);
|
|
28
|
+
}, []), h = f(null), N = j((e) => {
|
|
29
|
+
e && (h.current = e);
|
|
30
|
+
}, []), A = T(() => ({
|
|
31
|
+
initialFocus: () => h.current ?? void 0,
|
|
32
|
+
onActivate: () => {
|
|
33
|
+
var e;
|
|
34
|
+
return (e = h.current) == null ? void 0 : e.focus();
|
|
35
|
+
},
|
|
36
|
+
clickOutsideDeactivates: u,
|
|
37
|
+
escapeDeactivates: s,
|
|
38
|
+
onDeactivate() {
|
|
39
|
+
x(!1);
|
|
40
|
+
}
|
|
41
|
+
}), [u, s]), [P, E] = k(t ?? !1), D = T(() => ({
|
|
42
|
+
isVisible: P,
|
|
43
|
+
setInitialFocus: N,
|
|
44
|
+
close: F
|
|
45
|
+
}), [P, N, F]);
|
|
46
|
+
return b(() => {
|
|
47
|
+
t && (w(!0), E(!0));
|
|
48
|
+
}, [t]), b(() => {
|
|
49
|
+
if (t) {
|
|
50
|
+
const e = setTimeout(() => {
|
|
51
|
+
x(!0);
|
|
52
|
+
}, 100);
|
|
53
|
+
return () => {
|
|
54
|
+
clearTimeout(e);
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
x(!1);
|
|
58
|
+
}, [t]), b(() => {
|
|
59
|
+
if (R && !i) {
|
|
60
|
+
const e = setTimeout(() => {
|
|
61
|
+
o == null || o(c.current ?? void 0), E(!1);
|
|
62
|
+
}, 370);
|
|
63
|
+
return () => {
|
|
64
|
+
clearTimeout(e);
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
}, [R, i, o]), /* @__PURE__ */ n.jsx(S, { reference: v, as: m ?? W, role: "dialog", "aria-hidden": !i, "aria-label": a ?? "Popover", ...l, className: I("kakadu-components-3573963023", i && "kakadu-components-1399012551", d), children: /* @__PURE__ */ n.jsxs("div", { className: I("kakadu-components-1118152266", i && "kakadu-components-231244945"), children: [
|
|
68
|
+
/* @__PURE__ */ n.jsx("div", { className: "kakadu-components-343234026" }),
|
|
69
|
+
/* @__PURE__ */ n.jsx(M.FocusTrap, { active: i, focusTrapOptions: A, children: /* @__PURE__ */ n.jsxs("div", { className: I("kakadu-components-3905822111", p), children: [
|
|
70
|
+
/* @__PURE__ */ n.jsx(q, { value: D, children: r }),
|
|
71
|
+
/* @__PURE__ */ n.jsx("div", { className: "kakadu-components-2014365216" })
|
|
72
|
+
] }) })
|
|
73
|
+
] }) });
|
|
74
|
+
}
|
|
75
|
+
function L(m, t) {
|
|
76
|
+
const [a, u] = k(!1), s = f(void 0), r = f(null), d = j(async (l) => (u(!0), r.current = l ?? document.activeElement, new Promise((c) => {
|
|
77
|
+
s.current = c;
|
|
78
|
+
})), []), p = j((l) => {
|
|
79
|
+
var c;
|
|
80
|
+
if (u(!1), (c = s.current) == null || c.call(s, l), s.current = void 0, r.current) {
|
|
81
|
+
const v = r.current;
|
|
82
|
+
v.isConnected && v.focus(), r.current = null;
|
|
83
|
+
}
|
|
84
|
+
}, []), o = T(() => /* @__PURE__ */ n.jsx(m, { ...t, isVisible: a, onClose: p }), [m, t, a, p]);
|
|
85
|
+
return T(() => ({
|
|
86
|
+
isVisible: a,
|
|
87
|
+
show: d,
|
|
88
|
+
popover: o
|
|
89
|
+
}), [a, d, o]);
|
|
90
|
+
}
|
|
91
|
+
export {
|
|
92
|
+
K as default,
|
|
93
|
+
L as usePopover,
|
|
94
|
+
J as usePopoverContext
|
|
95
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../jsx-runtime-BB_1_6y_.js"),x=require("react"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../jsx-runtime-BB_1_6y_.js"),x=require("react"),l=require("@kuma-ui/core");function o({label:u,width:t,height:s,className:a,children:r,isAnimated:n=!0,...c}){return e.jsxRuntimeExports.jsx("span",{...c,"aria-label":u,className:l.cx("kakadu-components-4149648046",n&&"kakadu-components-2124144438",a),style:{width:t,height:s},children:r??e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:" "})})}const i="kakadu-components-3140855657";function m({label:u,lines:t=1,isAnimated:s=!0}){const a=x.useMemo(()=>{const r=[];if(t<=1)return r;for(let n=1;n<t;n+=1)r.push(e.jsxRuntimeExports.jsx(o,{"aria-hidden":!0,width:"100%",height:"1em",isAnimated:s,className:i},n));return r},[t,s]);return t<1?null:t===1?e.jsxRuntimeExports.jsx(o,{"aria-busy":!0,label:u,width:"100%",height:"1em",isAnimated:s,role:"status",className:i}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[a,e.jsxRuntimeExports.jsx(o,{"aria-busy":!0,label:u,width:"60%",height:"1em",isAnimated:s,role:"status",className:i})]})}exports.SkeletonInstance=o;exports.default=m;
|
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
import { j as e } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
2
2
|
import { useMemo as i } from "react";
|
|
3
|
-
import { cx as
|
|
3
|
+
import { cx as l } from "@kuma-ui/core";
|
|
4
4
|
function u({
|
|
5
|
-
label:
|
|
5
|
+
label: n,
|
|
6
6
|
width: t,
|
|
7
|
-
height:
|
|
8
|
-
className:
|
|
9
|
-
children:
|
|
10
|
-
isAnimated:
|
|
7
|
+
height: r,
|
|
8
|
+
className: o,
|
|
9
|
+
children: s,
|
|
10
|
+
isAnimated: a = !0,
|
|
11
11
|
...c
|
|
12
12
|
}) {
|
|
13
|
-
return /* @__PURE__ */ e.jsx("span", { ...c, "aria-
|
|
13
|
+
return /* @__PURE__ */ e.jsx("span", { ...c, "aria-label": n, className: l("kakadu-components-4149648046", a && "kakadu-components-2124144438", o), style: {
|
|
14
14
|
width: t,
|
|
15
|
-
height:
|
|
16
|
-
}, children:
|
|
15
|
+
height: r
|
|
16
|
+
}, children: s ?? /* @__PURE__ */ e.jsx(e.Fragment, { children: " " }) });
|
|
17
17
|
}
|
|
18
18
|
const m = "kakadu-components-3140855657";
|
|
19
|
-
function
|
|
20
|
-
label:
|
|
19
|
+
function p({
|
|
20
|
+
label: n,
|
|
21
21
|
lines: t = 1,
|
|
22
|
-
isAnimated:
|
|
22
|
+
isAnimated: r = !0
|
|
23
23
|
}) {
|
|
24
|
-
const
|
|
25
|
-
const
|
|
24
|
+
const o = i(() => {
|
|
25
|
+
const s = [];
|
|
26
26
|
if (t <= 1)
|
|
27
|
-
return
|
|
28
|
-
for (let
|
|
29
|
-
|
|
30
|
-
return
|
|
31
|
-
}, [t, r
|
|
32
|
-
return t < 1 ? null : t === 1 ? /* @__PURE__ */ e.jsx(u, { label:
|
|
33
|
-
|
|
34
|
-
/* @__PURE__ */ e.jsx(u, { label:
|
|
27
|
+
return s;
|
|
28
|
+
for (let a = 1; a < t; a += 1)
|
|
29
|
+
s.push(/* @__PURE__ */ e.jsx(u, { "aria-hidden": !0, width: "100%", height: "1em", isAnimated: r, className: m }, a));
|
|
30
|
+
return s;
|
|
31
|
+
}, [t, r]);
|
|
32
|
+
return t < 1 ? null : t === 1 ? /* @__PURE__ */ e.jsx(u, { "aria-busy": !0, label: n, width: "100%", height: "1em", isAnimated: r, role: "status", className: m }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
33
|
+
o,
|
|
34
|
+
/* @__PURE__ */ e.jsx(u, { "aria-busy": !0, label: n, width: "60%", height: "1em", isAnimated: r, role: "status", className: m })
|
|
35
35
|
] });
|
|
36
36
|
}
|
|
37
37
|
export {
|
|
38
38
|
u as SkeletonInstance,
|
|
39
|
-
|
|
39
|
+
p as default
|
|
40
40
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("../jsx-runtime-BB_1_6y_.js"),t=require("react"),l=require("@kuma-ui/core");function i({size:e=18,strokeWidth:o=2.5,isAnimated:c=!0}){const s=t.useMemo(()=>e/2,[e]),n=t.useMemo(()=>s-o/2,[s,o]),r=t.useMemo(()=>2*Math.PI*n,[n]),a=t.useMemo(()=>r*.33,[r]),m=t.useMemo(()=>r-a,[r,a]),d=t.useMemo(()=>-m/2,[m]);return u.jsxRuntimeExports.jsx("svg",{width:e,height:e,preserveAspectRatio:"xMidYMid meet",viewBox:`0 0 ${e} ${e}`,fill:"none",className:"kakadu-components-1569667551",children:u.jsxRuntimeExports.jsx("circle",{cx:s,cy:s,r:n,stroke:"currentColor",strokeWidth:o,strokeLinecap:"round",strokeDasharray:`${m} ${a}`,strokeDashoffset:d,className:c?"kakadu-components-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("../jsx-runtime-BB_1_6y_.js"),t=require("react"),l=require("@kuma-ui/core");function i({size:e=18,strokeWidth:o=2.5,isAnimated:c=!0}){const s=t.useMemo(()=>e/2,[e]),n=t.useMemo(()=>s-o/2,[s,o]),r=t.useMemo(()=>2*Math.PI*n,[n]),a=t.useMemo(()=>r*.33,[r]),m=t.useMemo(()=>r-a,[r,a]),d=t.useMemo(()=>-m/2,[m]);return u.jsxRuntimeExports.jsx("svg",{width:e,height:e,preserveAspectRatio:"xMidYMid meet",viewBox:`0 0 ${e} ${e}`,fill:"none",className:"kakadu-components-1569667551",children:u.jsxRuntimeExports.jsx("circle",{cx:s,cy:s,r:n,stroke:"currentColor",strokeWidth:o,strokeLinecap:"round",strokeDasharray:`${m} ${a}`,strokeDashoffset:d,className:c?"kakadu-components-2544259022":void 0})})}function x({isVisible:e,...o}){const[c,s]=t.useState(e);return t.useEffect(()=>{if(e)s(!0);else{const n=setTimeout(()=>{s(!1)},370);return()=>{clearTimeout(n)}}},[e]),u.jsxRuntimeExports.jsx("div",{className:l.cx("kakadu-components-3913140600",e&&"kakadu-components-2895791158"),children:u.jsxRuntimeExports.jsx(i,{isAnimated:c,...o})})}exports.RevealSpinner=x;exports.default=i;
|
|
@@ -7,7 +7,7 @@ function l({
|
|
|
7
7
|
isAnimated: c = !0
|
|
8
8
|
}) {
|
|
9
9
|
const t = o(() => e / 2, [e]), s = o(() => t - n / 2, [t, n]), r = o(() => 2 * Math.PI * s, [s]), u = o(() => r * 0.33, [r]), m = o(() => r - u, [r, u]), f = o(() => -m / 2, [m]);
|
|
10
|
-
return /* @__PURE__ */ a.jsx("svg", { width: e, height: e, preserveAspectRatio: "xMidYMid meet", viewBox: `0 0 ${e} ${e}`, fill: "none", className: "kakadu-components-1569667551", children: /* @__PURE__ */ a.jsx("circle", { cx: t, cy: t, r: s, stroke: "currentColor", strokeWidth: n, strokeLinecap: "round", strokeDasharray: `${m} ${u}`, strokeDashoffset: f, className: c ? "kakadu-components-
|
|
10
|
+
return /* @__PURE__ */ a.jsx("svg", { width: e, height: e, preserveAspectRatio: "xMidYMid meet", viewBox: `0 0 ${e} ${e}`, fill: "none", className: "kakadu-components-1569667551", children: /* @__PURE__ */ a.jsx("circle", { cx: t, cy: t, r: s, stroke: "currentColor", strokeWidth: n, strokeLinecap: "round", strokeDasharray: `${m} ${u}`, strokeDashoffset: f, className: c ? "kakadu-components-2544259022" : void 0 }) });
|
|
11
11
|
}
|
|
12
12
|
function j({
|
|
13
13
|
isVisible: e,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../jsx-runtime-BB_1_6y_.js"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../jsx-runtime-BB_1_6y_.js"),a=require("@kuma-ui/core"),x=require("../icons/icon.js"),l=require("./flex.js"),R=require("./text.js"),q=require("./click-ripples.js"),m=require("./hover-gradient.js"),v=require("./button-tooltip.js"),_=require("./aria-text.js"),B=require("./atom.js");var p=(t=>(t.primary="primary",t.delete="delete",t))(p||{});const b="kakadu-components-4017654514";function f({iconLeft:t,iconRight:n,variant:i="primary",tooltip:u,tooltipPosition:c,href:o,target:d,rel:j,disabled:r,className:k,children:s,label:E,...y}){return e.jsxRuntimeExports.jsxs(B.default,{...y,as:o?"a":"button",type:o?void 0:"button",href:o,target:d,rel:j,disabled:o?void 0:r,className:a.cx(R.textShadowStyles,"kakadu-components-1202323410",s&&(t||n)?a.cx(!!t&&"kakadu-components-497190725",!!n&&"kakadu-components-3729381008"):"kakadu-components-3866032606",i==="delete"&&b,k),children:[e.jsxRuntimeExports.jsxs(l.default,{direction:"row",gap:.5,alignment:l.FlexAlignment.center,children:[t?e.jsxRuntimeExports.jsx("div",{className:a.cx("kakadu-components-2031441451",s?"kakadu-components-2885581246":"kakadu-components-611756781"),children:typeof t=="string"?e.jsxRuntimeExports.jsx(x.default,{width:14,height:14,type:t}):t}):null,s?e.jsxRuntimeExports.jsx("span",{className:"kakadu-components-2362298521",children:s}):e.jsxRuntimeExports.jsx(_.default,{children:E}),n?e.jsxRuntimeExports.jsx("div",{className:a.cx("kakadu-components-2031441451",s?"kakadu-components-2285425267":"kakadu-components-611756781"),children:typeof n=="string"?e.jsxRuntimeExports.jsx(x.default,{width:14,height:14,type:n}):n}):null]}),e.jsxRuntimeExports.jsxs("span",{className:"kakadu-components-1343580459",children:[r?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(q.default,{size:s?void 0:50}),e.jsxRuntimeExports.jsx(m.default,{size:s?void 0:50,className:m.normalBlendStyles})]}),u?e.jsxRuntimeExports.jsx(v.default,{label:u,position:c}):null]})]})}exports.TextButtonVariant=p;exports.default=f;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { j as o } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
2
|
-
import { cx as
|
|
2
|
+
import { cx as n } from "@kuma-ui/core";
|
|
3
3
|
import p from "../icons/icon.mjs";
|
|
4
4
|
import j, { FlexAlignment as y } from "./flex.mjs";
|
|
5
|
-
import { textShadowStyles as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
5
|
+
import { textShadowStyles as v } from "./text.mjs";
|
|
6
|
+
import B from "./click-ripples.mjs";
|
|
7
|
+
import f, { normalBlendStyles as N } from "./hover-gradient.mjs";
|
|
8
8
|
import w from "./button-tooltip.mjs";
|
|
9
9
|
import S from "./aria-text.mjs";
|
|
10
|
-
import
|
|
11
|
-
var
|
|
12
|
-
const
|
|
10
|
+
import b from "./atom.mjs";
|
|
11
|
+
var g = /* @__PURE__ */ ((e) => (e.primary = "primary", e.delete = "delete", e))(g || {});
|
|
12
|
+
const A = "kakadu-components-4017654514";
|
|
13
13
|
function q({
|
|
14
14
|
iconLeft: e,
|
|
15
15
|
iconRight: s,
|
|
16
16
|
variant: l = "primary",
|
|
17
17
|
tooltip: m,
|
|
18
18
|
tooltipPosition: d,
|
|
19
|
-
href:
|
|
19
|
+
href: t,
|
|
20
20
|
target: k,
|
|
21
21
|
rel: u,
|
|
22
22
|
disabled: r,
|
|
@@ -25,22 +25,22 @@ function q({
|
|
|
25
25
|
label: x,
|
|
26
26
|
...c
|
|
27
27
|
}) {
|
|
28
|
-
return /* @__PURE__ */ o.jsxs(
|
|
28
|
+
return /* @__PURE__ */ o.jsxs(b, { ...c, as: t ? "a" : "button", type: t ? void 0 : "button", href: t, target: k, rel: u, disabled: t ? void 0 : r, className: n(v, "kakadu-components-1202323410", a && (e || s) ? n(!!e && "kakadu-components-497190725", !!s && "kakadu-components-3729381008") : "kakadu-components-3866032606", l === "delete" && A, i), children: [
|
|
29
29
|
/* @__PURE__ */ o.jsxs(j, { direction: "row", gap: 0.5, alignment: y.center, children: [
|
|
30
|
-
e ? /* @__PURE__ */ o.jsx("div", { className:
|
|
30
|
+
e ? /* @__PURE__ */ o.jsx("div", { className: n("kakadu-components-2031441451", a ? "kakadu-components-2885581246" : "kakadu-components-611756781"), children: typeof e == "string" ? /* @__PURE__ */ o.jsx(p, { width: 14, height: 14, type: e }) : e }) : null,
|
|
31
31
|
a ? /* @__PURE__ */ o.jsx("span", { className: "kakadu-components-2362298521", children: a }) : /* @__PURE__ */ o.jsx(S, { children: x }),
|
|
32
|
-
s ? /* @__PURE__ */ o.jsx("div", { className:
|
|
32
|
+
s ? /* @__PURE__ */ o.jsx("div", { className: n("kakadu-components-2031441451", a ? "kakadu-components-2285425267" : "kakadu-components-611756781"), children: typeof s == "string" ? /* @__PURE__ */ o.jsx(p, { width: 14, height: 14, type: s }) : s }) : null
|
|
33
33
|
] }),
|
|
34
34
|
/* @__PURE__ */ o.jsxs("span", { className: "kakadu-components-1343580459", children: [
|
|
35
35
|
r ? null : /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
|
|
36
|
-
/* @__PURE__ */ o.jsx(
|
|
37
|
-
/* @__PURE__ */ o.jsx(
|
|
36
|
+
/* @__PURE__ */ o.jsx(B, { size: a ? void 0 : 50 }),
|
|
37
|
+
/* @__PURE__ */ o.jsx(f, { size: a ? void 0 : 50, className: N })
|
|
38
38
|
] }),
|
|
39
39
|
m ? /* @__PURE__ */ o.jsx(w, { label: m, position: d }) : null
|
|
40
40
|
] })
|
|
41
41
|
] });
|
|
42
42
|
}
|
|
43
43
|
export {
|
|
44
|
-
|
|
44
|
+
g as TextButtonVariant,
|
|
45
45
|
q as default
|
|
46
46
|
};
|