@kakadu/components 3.1.4 → 3.2.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.d.ts +4 -2
- package/build/components/button.js +1 -1
- package/build/components/button.mjs +59 -53
- package/build/components/icon-button.d.ts +2 -1
- package/build/components/icon-button.js +1 -1
- package/build/components/icon-button.mjs +41 -36
- package/build/components/modal.d.ts +1 -1
- package/build/components/modal.js +1 -1
- package/build/components/modal.mjs +67 -70
- package/build/components/popover-menu.d.ts +1 -1
- package/build/components/popover-menu.js +1 -1
- package/build/components/popover-menu.mjs +63 -62
- package/build/components/popover.d.ts +1 -1
- package/build/components/popover.js +1 -1
- package/build/components/popover.mjs +68 -72
- package/build/components/skeleton.js +1 -1
- package/build/components/skeleton.mjs +1 -1
- package/build/components/text-button.d.ts +2 -1
- package/build/components/text-button.js +1 -1
- package/build/components/text-button.mjs +39 -33
- package/build/components.css +1 -1
- package/build/hooks/use-fetch.d.ts +5 -2
- package/build/hooks/use-fetch.js +1 -1
- package/build/hooks/use-fetch.mjs +93 -77
- package/package.json +1 -1
|
@@ -1,103 +1,104 @@
|
|
|
1
1
|
import { j as n } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
2
2
|
import { cx as b } from "@kuma-ui/core";
|
|
3
|
-
import { useMemo as
|
|
4
|
-
import { buttonResetStyles as
|
|
3
|
+
import { useMemo as v, useState as h, useCallback as x, useEffect as y } from "react";
|
|
4
|
+
import { buttonResetStyles as M } from "../theme.mjs";
|
|
5
5
|
import g from "../icons/icon.mjs";
|
|
6
|
-
import
|
|
6
|
+
import E, { PopoverContainer as S, usePopover as K, usePopoverContext as w } from "./popover.mjs";
|
|
7
7
|
import F from "./atom.mjs";
|
|
8
8
|
import { Span as I } from "./text.mjs";
|
|
9
9
|
import A, { normalBlendStyles as D } from "./hover-gradient.mjs";
|
|
10
10
|
import H from "./click-ripples.mjs";
|
|
11
11
|
import z from "./separator.mjs";
|
|
12
|
-
import
|
|
13
|
-
const
|
|
12
|
+
import C from "./decorators.mjs";
|
|
13
|
+
const j = /* @__PURE__ */ new Set();
|
|
14
14
|
function N() {
|
|
15
|
-
const [e, t] = h(!1),
|
|
16
|
-
t(
|
|
17
|
-
for (const i of
|
|
18
|
-
i(
|
|
15
|
+
const [e, t] = h(!1), s = x((o) => {
|
|
16
|
+
t(o);
|
|
17
|
+
for (const i of j)
|
|
18
|
+
i(o);
|
|
19
19
|
}, []);
|
|
20
20
|
return y(() => {
|
|
21
|
-
const
|
|
21
|
+
const o = (i) => {
|
|
22
22
|
t(i);
|
|
23
23
|
};
|
|
24
|
-
return
|
|
25
|
-
|
|
24
|
+
return j.add(o), () => {
|
|
25
|
+
j.delete(o);
|
|
26
26
|
};
|
|
27
|
-
}, []),
|
|
27
|
+
}, []), v(() => ({
|
|
28
28
|
isKeyboardNavigating: e,
|
|
29
|
-
setIsKeyboardNavigating:
|
|
30
|
-
}), [e,
|
|
29
|
+
setIsKeyboardNavigating: s
|
|
30
|
+
}), [e, s]);
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function L({
|
|
33
33
|
label: e,
|
|
34
34
|
iconLeft: t,
|
|
35
|
-
iconRight:
|
|
36
|
-
href:
|
|
35
|
+
iconRight: s,
|
|
36
|
+
href: o,
|
|
37
37
|
shouldCloseOnClick: i = !0,
|
|
38
|
-
decorators:
|
|
39
|
-
submenu:
|
|
38
|
+
decorators: k = [],
|
|
39
|
+
submenu: d,
|
|
40
40
|
className: a,
|
|
41
|
-
onClick:
|
|
42
|
-
...
|
|
41
|
+
onClick: r,
|
|
42
|
+
...p
|
|
43
43
|
}) {
|
|
44
44
|
const {
|
|
45
|
-
isFocused:
|
|
46
|
-
close:
|
|
45
|
+
isFocused: u,
|
|
46
|
+
close: c
|
|
47
47
|
} = w(), {
|
|
48
|
-
isKeyboardNavigating:
|
|
49
|
-
} = N(),
|
|
50
|
-
|
|
51
|
-
}, [
|
|
48
|
+
isKeyboardNavigating: f
|
|
49
|
+
} = N(), m = x((P) => {
|
|
50
|
+
u && (r == null || r(P), d ? d.show() : i && (c == null || c()));
|
|
51
|
+
}, [u, r, i, c, d]), l = v(() => /* @__PURE__ */ n.jsxs(F, { as: o ? "a" : "button", ...p, type: o ? void 0 : "button", role: "menuitem", href: o, className: b(M, "kakadu-components-3114599304", f ? "kakadu-components-4096376656" : "kakadu-components-2554182777", a), onClick: m, children: [
|
|
52
52
|
/* @__PURE__ */ n.jsxs(I, { className: "kakadu-components-1109353535", children: [
|
|
53
53
|
t ? /* @__PURE__ */ n.jsx(g, { width: 12, height: 12, type: t }) : null,
|
|
54
54
|
/* @__PURE__ */ n.jsx("span", { className: "kakadu-components-913703148", children: e }),
|
|
55
|
-
|
|
55
|
+
s ? /* @__PURE__ */ n.jsx(g, { width: 12, height: 12, type: s }) : null
|
|
56
56
|
] }),
|
|
57
|
-
|
|
57
|
+
f ? null : /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
|
|
58
58
|
/* @__PURE__ */ n.jsx(A, { size: 150, className: D }),
|
|
59
59
|
/* @__PURE__ */ n.jsx(H, { size: 100 })
|
|
60
60
|
] })
|
|
61
|
-
] }), [
|
|
62
|
-
return /* @__PURE__ */ n.jsx(
|
|
61
|
+
] }), [f, p, o, a, m, t, e, s]);
|
|
62
|
+
return /* @__PURE__ */ n.jsx(C, { decorators: k, children: d ? /* @__PURE__ */ n.jsx(T, { menu: d.popoverMenu, className: "kakadu-components-1861176543", children: l }) : l });
|
|
63
63
|
}
|
|
64
|
-
function
|
|
64
|
+
function R(e) {
|
|
65
65
|
if ("type" in e) {
|
|
66
66
|
if (e.type === "separator")
|
|
67
67
|
return /* @__PURE__ */ n.jsx(z, {});
|
|
68
68
|
if (e.type === "group")
|
|
69
69
|
return /* @__PURE__ */ n.jsx(I, { className: "kakadu-components-1499037363", children: e.label });
|
|
70
70
|
}
|
|
71
|
-
return /* @__PURE__ */ n.jsx(
|
|
71
|
+
return /* @__PURE__ */ n.jsx(L, { ...e });
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function B({
|
|
74
74
|
items: e
|
|
75
75
|
}) {
|
|
76
76
|
const {
|
|
77
77
|
isFocused: t
|
|
78
|
-
} = w(), [
|
|
78
|
+
} = w(), [s, o] = h([]), {
|
|
79
79
|
setIsKeyboardNavigating: i
|
|
80
|
-
} = N(),
|
|
81
|
-
a &&
|
|
82
|
-
}, []),
|
|
80
|
+
} = N(), k = x((a) => {
|
|
81
|
+
a && o((r) => r.includes(a) ? r : [...r, a]);
|
|
82
|
+
}, []), d = x((a) => {
|
|
83
83
|
t && (a.currentTarget.focus(), i(!1));
|
|
84
84
|
}, [t, i]);
|
|
85
85
|
return y(() => {
|
|
86
86
|
if (!t)
|
|
87
87
|
return;
|
|
88
|
-
const a = (
|
|
89
|
-
const u =
|
|
88
|
+
const a = (r) => {
|
|
89
|
+
const p = s.filter((l) => l.isConnected), u = p.length;
|
|
90
90
|
if (u === 0)
|
|
91
91
|
return;
|
|
92
92
|
let c;
|
|
93
|
-
const
|
|
94
|
-
|
|
93
|
+
const f = document.activeElement;
|
|
94
|
+
let m = f ? p.indexOf(f) : -1;
|
|
95
|
+
switch (m === -1 && (m = 0), r.key) {
|
|
95
96
|
case "ArrowDown": {
|
|
96
|
-
c = (
|
|
97
|
+
c = (m + 1) % u;
|
|
97
98
|
break;
|
|
98
99
|
}
|
|
99
100
|
case "ArrowUp": {
|
|
100
|
-
c = (
|
|
101
|
+
c = (m - 1 + u) % u;
|
|
101
102
|
break;
|
|
102
103
|
}
|
|
103
104
|
case "Home": {
|
|
@@ -110,8 +111,8 @@ function C({
|
|
|
110
111
|
}
|
|
111
112
|
}
|
|
112
113
|
if (c !== void 0) {
|
|
113
|
-
|
|
114
|
-
const l =
|
|
114
|
+
r.preventDefault(), r.stopPropagation();
|
|
115
|
+
const l = p[c];
|
|
115
116
|
l && (l.focus(), i(!0));
|
|
116
117
|
}
|
|
117
118
|
};
|
|
@@ -122,41 +123,41 @@ function C({
|
|
|
122
123
|
capture: !0
|
|
123
124
|
});
|
|
124
125
|
};
|
|
125
|
-
}, [t,
|
|
126
|
-
|
|
126
|
+
}, [t, s, i]), /* @__PURE__ */ n.jsx(n.Fragment, { children: e.map((a, r) => /* @__PURE__ */ n.jsx(
|
|
127
|
+
R,
|
|
127
128
|
{
|
|
128
129
|
...a,
|
|
129
|
-
reference:
|
|
130
|
-
onMouseEnter:
|
|
130
|
+
reference: k,
|
|
131
|
+
onMouseEnter: d
|
|
131
132
|
},
|
|
132
|
-
|
|
133
|
+
r
|
|
133
134
|
)) });
|
|
134
135
|
}
|
|
135
136
|
function G({
|
|
136
137
|
items: e,
|
|
137
138
|
...t
|
|
138
139
|
}) {
|
|
139
|
-
return /* @__PURE__ */ n.jsx(
|
|
140
|
+
return /* @__PURE__ */ n.jsx(E, { ...t, as: "nav", role: "menu", innerClassName: "kakadu-components-3600436535", children: /* @__PURE__ */ n.jsx(B, { items: e }) });
|
|
140
141
|
}
|
|
141
142
|
function ee(e) {
|
|
142
|
-
const t =
|
|
143
|
+
const t = v(() => ({
|
|
143
144
|
items: e
|
|
144
145
|
}), [e]), {
|
|
145
|
-
show:
|
|
146
|
-
popover:
|
|
146
|
+
show: s,
|
|
147
|
+
popover: o
|
|
147
148
|
} = K(G, t);
|
|
148
|
-
return
|
|
149
|
-
show:
|
|
150
|
-
popoverMenu:
|
|
151
|
-
}), [
|
|
149
|
+
return v(() => ({
|
|
150
|
+
show: s,
|
|
151
|
+
popoverMenu: o
|
|
152
|
+
}), [s, o]);
|
|
152
153
|
}
|
|
153
154
|
function T({
|
|
154
155
|
menu: e,
|
|
155
156
|
className: t,
|
|
156
|
-
children:
|
|
157
|
+
children: s
|
|
157
158
|
}) {
|
|
158
159
|
return /* @__PURE__ */ n.jsxs(S, { className: t, children: [
|
|
159
|
-
|
|
160
|
+
s,
|
|
160
161
|
e
|
|
161
162
|
] });
|
|
162
163
|
}
|
|
@@ -22,7 +22,7 @@ type PopoverBaseProperties<PopoverResult> = Omit<PopoverProperties<PopoverResult
|
|
|
22
22
|
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;
|
|
23
23
|
export declare function usePopover<PopoverResult, PopoverProperties = PopoverBaseProperties<PopoverResult>>(PopoverComponent: ComponentType<PopoverProperties>, properties?: PopoverProperties): {
|
|
24
24
|
isVisible: boolean;
|
|
25
|
-
show: (
|
|
25
|
+
show: () => Promise<PopoverResult | undefined>;
|
|
26
26
|
popover: import("react/jsx-runtime").JSX.Element;
|
|
27
27
|
};
|
|
28
28
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("../jsx-runtime-BB_1_6y_.js"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("../jsx-runtime-BB_1_6y_.js"),l=require("@kuma-ui/core"),e=require("react"),H=require("../focus-trap-react-CcpTuiJi.js"),g=require("./atom.js"),z=e.createContext({isVisible:!1,isFocused:!1}),{Provider:U}=z;function G(){return e.useContext(z)}function J({as:r,className:s,...o}){return n.jsxRuntimeExports.jsx(g.default,{as:r??g.defaultAtomElementType,...o,className:l.cx("kakadu-components-2845019685",s)})}function K({as:r,isVisible:s,label:o,shouldCloseOnOutsideClick:f=!0,shouldCloseOnEscapePress:c=!0,children:m,className:p,innerClassName:x,onClose:a,...v}){const b=e.useRef(null),F=e.useRef(null),[I,k]=e.useState(!1),[S,B]=e.useState(!1),[u,R]=e.useState(!1),C=e.useCallback(t=>{b.current=t,R(!1)},[]),j=e.useRef(null),M=e.useCallback(t=>{t&&(j.current=t)},[]),W=e.useMemo(()=>({initialFocus:()=>j.current??void 0,onActivate(){var t;(t=j.current)==null||t.focus(),k(!0)},clickOutsideDeactivates:f,escapeDeactivates:c,onUnpause(){k(!0)},onPause(){k(!1)},onDeactivate(){R(!1),k(!1)}}),[f,c]),[q,N]=e.useState(s??!1),$=e.useMemo(()=>({isVisible:q,isFocused:I,setInitialFocus:M,close:C}),[q,I,M,C]),[i,L]=e.useState("center");return e.useEffect(()=>{const t=F.current;if(t){const w=()=>{const O=t.offsetParent,E=O instanceof HTMLElement?O.getBoundingClientRect():null,y=t.getBoundingClientRect();if(!E){L("center");return}const P=16,D=window.innerWidth-P,T=E.left+E.width/2-y.width/2,V=T+y.width,A=T<P,_=V>D;let d="center";if(A&&_){const h=P-T;d=V-D>h?"right":"left"}else _?d="right":A&&(d="left");L(h=>h===d?h:d)};return w(),window.addEventListener("resize",w),()=>{window.removeEventListener("resize",w)}}},[]),e.useEffect(()=>{s&&(B(!0),N(!0))},[s]),e.useEffect(()=>{if(s){const t=setTimeout(()=>{R(!0)},100);return()=>{clearTimeout(t)}}R(!1)},[s]),e.useEffect(()=>{if(S&&!u){const t=setTimeout(()=>{a==null||a(b.current??void 0),N(!1)},370);return()=>{clearTimeout(t)}}},[S,u,a]),n.jsxRuntimeExports.jsx(g.default,{reference:F,as:r??g.defaultAtomElementType,role:"dialog","aria-hidden":!u,"aria-label":o??"Popover",...v,className:l.cx("kakadu-components-3920007758",i==="left"&&"kakadu-components-611400930",i==="right"&&"kakadu-components-944244368",u&&"kakadu-components-1399012551",p),children:n.jsxRuntimeExports.jsxs("div",{className:l.cx("kakadu-components-1118152266",u&&"kakadu-components-231244945"),children:[n.jsxRuntimeExports.jsx("div",{className:l.cx("kakadu-components-1951789226",i==="left"&&"kakadu-components-1495725644",i==="right"&&"kakadu-components-4235689197")}),n.jsxRuntimeExports.jsx(H.focusTrapReactExports.FocusTrap,{active:u,focusTrapOptions:W,children:n.jsxRuntimeExports.jsxs("div",{className:l.cx("kakadu-components-2488426662",x),children:[n.jsxRuntimeExports.jsx(U,{value:$,children:m}),n.jsxRuntimeExports.jsx("div",{className:l.cx("kakadu-components-3252390100",i==="left"&&"kakadu-components-3754561431",i==="right"&&"kakadu-components-2265262600")})]})})]})})}function Q(r,s){const[o,f]=e.useState(!1),c=e.useRef(void 0),m=e.useCallback(async()=>(f(!0),new Promise(a=>{c.current=a})),[]),p=e.useCallback(a=>{var v;f(!1),(v=c.current)==null||v.call(c,a),c.current=void 0},[]),x=e.useMemo(()=>n.jsxRuntimeExports.jsx(r,{...s,isVisible:o,onClose:p}),[r,s,o,p]);return e.useMemo(()=>({isVisible:o,show:m,popover:x}),[o,m,x])}exports.PopoverContainer=J;exports.default=K;exports.usePopover=Q;exports.usePopoverContext=G;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { j as n } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
2
|
-
import { cx as
|
|
3
|
-
import { createContext as Y, useRef as
|
|
2
|
+
import { cx as u } from "@kuma-ui/core";
|
|
3
|
+
import { createContext as Y, useRef as j, useState as l, useCallback as R, useMemo as P, useEffect as w, useContext as Z } from "react";
|
|
4
4
|
import { f as _ } from "../focus-trap-react-DYXrtbDH.mjs";
|
|
5
5
|
import q, { defaultAtomElementType as G } from "./atom.mjs";
|
|
6
6
|
const J = Y({
|
|
@@ -9,125 +9,121 @@ const J = Y({
|
|
|
9
9
|
}), {
|
|
10
10
|
Provider: $
|
|
11
11
|
} = J;
|
|
12
|
-
function
|
|
12
|
+
function ce() {
|
|
13
13
|
return Z(J);
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
as:
|
|
15
|
+
function re({
|
|
16
|
+
as: c,
|
|
17
17
|
className: t,
|
|
18
18
|
...s
|
|
19
19
|
}) {
|
|
20
|
-
return /* @__PURE__ */ n.jsx(q, { as:
|
|
20
|
+
return /* @__PURE__ */ n.jsx(q, { as: c ?? G, ...s, className: u("kakadu-components-2845019685", t) });
|
|
21
21
|
}
|
|
22
22
|
function ie({
|
|
23
|
-
as:
|
|
23
|
+
as: c,
|
|
24
24
|
isVisible: t,
|
|
25
25
|
label: s,
|
|
26
|
-
shouldCloseOnOutsideClick:
|
|
26
|
+
shouldCloseOnOutsideClick: d = !0,
|
|
27
27
|
shouldCloseOnEscapePress: o = !0,
|
|
28
|
-
children:
|
|
29
|
-
className:
|
|
30
|
-
innerClassName:
|
|
31
|
-
onClose:
|
|
32
|
-
...
|
|
28
|
+
children: m,
|
|
29
|
+
className: p,
|
|
30
|
+
innerClassName: k,
|
|
31
|
+
onClose: a,
|
|
32
|
+
...v
|
|
33
33
|
}) {
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
}, []),
|
|
37
|
-
e && (
|
|
38
|
-
}, []), Q =
|
|
39
|
-
initialFocus: () =>
|
|
34
|
+
const N = j(null), L = j(null), [D, h] = l(!1), [O, K] = l(!1), [r, x] = l(!1), V = R((e) => {
|
|
35
|
+
N.current = e, x(!1);
|
|
36
|
+
}, []), T = j(null), A = R((e) => {
|
|
37
|
+
e && (T.current = e);
|
|
38
|
+
}, []), Q = P(() => ({
|
|
39
|
+
initialFocus: () => T.current ?? void 0,
|
|
40
40
|
onActivate() {
|
|
41
41
|
var e;
|
|
42
|
-
(e =
|
|
42
|
+
(e = T.current) == null || e.focus(), h(!0);
|
|
43
43
|
},
|
|
44
|
-
|
|
45
|
-
clickOutsideDeactivates: m,
|
|
44
|
+
clickOutsideDeactivates: d,
|
|
46
45
|
escapeDeactivates: o,
|
|
47
46
|
onUnpause() {
|
|
48
|
-
|
|
47
|
+
h(!0);
|
|
49
48
|
},
|
|
50
49
|
onPause() {
|
|
51
|
-
|
|
50
|
+
h(!1);
|
|
52
51
|
},
|
|
53
52
|
onDeactivate() {
|
|
54
|
-
|
|
53
|
+
x(!1), h(!1);
|
|
55
54
|
}
|
|
56
|
-
}), [
|
|
57
|
-
isVisible:
|
|
58
|
-
isFocused:
|
|
55
|
+
}), [d, o]), [y, z] = l(t ?? !1), X = P(() => ({
|
|
56
|
+
isVisible: y,
|
|
57
|
+
isFocused: D,
|
|
59
58
|
setInitialFocus: A,
|
|
60
59
|
close: V
|
|
61
|
-
}), [
|
|
62
|
-
return
|
|
63
|
-
const e =
|
|
60
|
+
}), [y, D, A, V]), [i, B] = l("center");
|
|
61
|
+
return w(() => {
|
|
62
|
+
const e = L.current;
|
|
64
63
|
if (e) {
|
|
65
|
-
const
|
|
66
|
-
const
|
|
67
|
-
if (!
|
|
68
|
-
|
|
64
|
+
const F = () => {
|
|
65
|
+
const C = e.offsetParent, I = C instanceof HTMLElement ? C.getBoundingClientRect() : null, M = e.getBoundingClientRect();
|
|
66
|
+
if (!I) {
|
|
67
|
+
B("center");
|
|
69
68
|
return;
|
|
70
69
|
}
|
|
71
|
-
const
|
|
72
|
-
let
|
|
70
|
+
const b = 16, W = window.innerWidth - b, E = I.left + I.width / 2 - M.width / 2, H = E + M.width, S = E < b, U = H > W;
|
|
71
|
+
let f = "center";
|
|
73
72
|
if (S && U) {
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
} else U ?
|
|
77
|
-
|
|
73
|
+
const g = b - E;
|
|
74
|
+
f = H - W > g ? "right" : "left";
|
|
75
|
+
} else U ? f = "right" : S && (f = "left");
|
|
76
|
+
B((g) => g === f ? g : f);
|
|
78
77
|
};
|
|
79
|
-
return
|
|
80
|
-
window.removeEventListener("resize",
|
|
78
|
+
return F(), window.addEventListener("resize", F), () => {
|
|
79
|
+
window.removeEventListener("resize", F);
|
|
81
80
|
};
|
|
82
81
|
}
|
|
83
|
-
}, []),
|
|
84
|
-
t && (K(!0),
|
|
85
|
-
}, [t]),
|
|
82
|
+
}, []), w(() => {
|
|
83
|
+
t && (K(!0), z(!0));
|
|
84
|
+
}, [t]), w(() => {
|
|
86
85
|
if (t) {
|
|
87
86
|
const e = setTimeout(() => {
|
|
88
|
-
|
|
87
|
+
x(!0);
|
|
89
88
|
}, 100);
|
|
90
89
|
return () => {
|
|
91
90
|
clearTimeout(e);
|
|
92
91
|
};
|
|
93
92
|
}
|
|
94
|
-
|
|
95
|
-
}, [t]),
|
|
96
|
-
if (O && !
|
|
93
|
+
x(!1);
|
|
94
|
+
}, [t]), w(() => {
|
|
95
|
+
if (O && !r) {
|
|
97
96
|
const e = setTimeout(() => {
|
|
98
|
-
|
|
97
|
+
a == null || a(N.current ?? void 0), z(!1);
|
|
99
98
|
}, 370);
|
|
100
99
|
return () => {
|
|
101
100
|
clearTimeout(e);
|
|
102
101
|
};
|
|
103
102
|
}
|
|
104
|
-
}, [O,
|
|
105
|
-
/* @__PURE__ */ n.jsx("div", { className:
|
|
106
|
-
/* @__PURE__ */ n.jsx(_.FocusTrap, { active:
|
|
107
|
-
/* @__PURE__ */ n.jsx($, { value: X, children:
|
|
108
|
-
/* @__PURE__ */ n.jsx("div", { className:
|
|
103
|
+
}, [O, r, a]), /* @__PURE__ */ n.jsx(q, { reference: L, as: c ?? G, role: "dialog", "aria-hidden": !r, "aria-label": s ?? "Popover", ...v, className: u("kakadu-components-3920007758", i === "left" && "kakadu-components-611400930", i === "right" && "kakadu-components-944244368", r && "kakadu-components-1399012551", p), children: /* @__PURE__ */ n.jsxs("div", { className: u("kakadu-components-1118152266", r && "kakadu-components-231244945"), children: [
|
|
104
|
+
/* @__PURE__ */ n.jsx("div", { className: u("kakadu-components-1951789226", i === "left" && "kakadu-components-1495725644", i === "right" && "kakadu-components-4235689197") }),
|
|
105
|
+
/* @__PURE__ */ n.jsx(_.FocusTrap, { active: r, focusTrapOptions: Q, children: /* @__PURE__ */ n.jsxs("div", { className: u("kakadu-components-2488426662", k), children: [
|
|
106
|
+
/* @__PURE__ */ n.jsx($, { value: X, children: m }),
|
|
107
|
+
/* @__PURE__ */ n.jsx("div", { className: u("kakadu-components-3252390100", i === "left" && "kakadu-components-3754561431", i === "right" && "kakadu-components-2265262600") })
|
|
109
108
|
] }) })
|
|
110
109
|
] }) });
|
|
111
110
|
}
|
|
112
|
-
function ue(
|
|
113
|
-
const [s,
|
|
114
|
-
o.current =
|
|
115
|
-
})), []),
|
|
116
|
-
var
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
}, []), c = T(() => /* @__PURE__ */ n.jsx(a, { ...t, isVisible: s, onClose: g }), [a, t, s, g]);
|
|
122
|
-
return T(() => ({
|
|
111
|
+
function ue(c, t) {
|
|
112
|
+
const [s, d] = l(!1), o = j(void 0), m = R(async () => (d(!0), new Promise((a) => {
|
|
113
|
+
o.current = a;
|
|
114
|
+
})), []), p = R((a) => {
|
|
115
|
+
var v;
|
|
116
|
+
d(!1), (v = o.current) == null || v.call(o, a), o.current = void 0;
|
|
117
|
+
}, []), k = P(() => /* @__PURE__ */ n.jsx(c, { ...t, isVisible: s, onClose: p }), [c, t, s, p]);
|
|
118
|
+
return P(() => ({
|
|
123
119
|
isVisible: s,
|
|
124
|
-
show:
|
|
125
|
-
popover:
|
|
126
|
-
}), [s,
|
|
120
|
+
show: m,
|
|
121
|
+
popover: k
|
|
122
|
+
}), [s, m, k]);
|
|
127
123
|
}
|
|
128
124
|
export {
|
|
129
|
-
|
|
125
|
+
re as PopoverContainer,
|
|
130
126
|
ie as default,
|
|
131
127
|
ue as usePopover,
|
|
132
|
-
|
|
128
|
+
ce as usePopoverContext
|
|
133
129
|
};
|
|
@@ -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"),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-
|
|
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-4254676273",n&&"kakadu-components-574297718",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;
|
|
@@ -10,7 +10,7 @@ function u({
|
|
|
10
10
|
isAnimated: a = !0,
|
|
11
11
|
...c
|
|
12
12
|
}) {
|
|
13
|
-
return /* @__PURE__ */ e.jsx("span", { ...c, "aria-label": n, className: l("kakadu-components-
|
|
13
|
+
return /* @__PURE__ */ e.jsx("span", { ...c, "aria-label": n, className: l("kakadu-components-4254676273", a && "kakadu-components-574297718", o), style: {
|
|
14
14
|
width: t,
|
|
15
15
|
height: r
|
|
16
16
|
}, children: s ?? /* @__PURE__ */ e.jsx(e.Fragment, { children: " " }) });
|
|
@@ -10,6 +10,7 @@ type BaseTextButtonProperties = Omit<HTMLProps<HTMLButtonElement>, 'children'> &
|
|
|
10
10
|
readonly variant?: TextButtonVariant;
|
|
11
11
|
readonly tooltip?: string;
|
|
12
12
|
readonly tooltipPosition?: ButtonTooltipPosition;
|
|
13
|
+
readonly isSkeleton?: boolean;
|
|
13
14
|
};
|
|
14
15
|
export type TextButtonProperties = BaseTextButtonProperties & ({
|
|
15
16
|
children: ReactNode;
|
|
@@ -18,5 +19,5 @@ export type TextButtonProperties = BaseTextButtonProperties & ({
|
|
|
18
19
|
children?: never;
|
|
19
20
|
label: string;
|
|
20
21
|
});
|
|
21
|
-
export default function TextButton({ iconLeft, iconRight, variant, tooltip, tooltipPosition, href, target, rel, disabled, className, children, label, ...properties }: TextButtonProperties): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export default function TextButton({ iconLeft, iconRight, variant, tooltip, tooltipPosition, href, target, rel, disabled, isSkeleton, className, children, label, ...properties }: TextButtonProperties): import("react/jsx-runtime").JSX.Element;
|
|
22
23
|
export {};
|
|
@@ -1 +1 @@
|
|
|
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"),
|
|
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"),i=require("../icons/icon.js"),m=require("./flex.js"),_=require("./text.js"),h=require("./click-ripples.js"),c=require("./hover-gradient.js"),B=require("./button-tooltip.js"),f=require("./aria-text.js"),b=require("./atom.js"),N=require("./skeleton.js");var p=(s=>(s.primary="primary",s.delete="delete",s))(p||{});const g="kakadu-components-4017654514";function w({iconLeft:s,iconRight:n,variant:d="primary",tooltip:u,tooltipPosition:j,href:x,target:k,rel:E,disabled:v,isSkeleton:r,className:R,children:t,label:y,...q}){const l=!!v||!!r,o=x&&!r;return e.jsxRuntimeExports.jsxs("div",{className:a.cx("kakadu-components-1400843519",t&&(s||n)?a.cx(!!s&&"kakadu-components-497190725",!!n&&"kakadu-components-3729381008"):"kakadu-components-3866032606"),children:[e.jsxRuntimeExports.jsxs(b.default,{...q,as:o?"a":"button",type:o?void 0:"button",href:o?x:void 0,target:o?k:void 0,rel:o?E:void 0,disabled:o?void 0:l,className:a.cx(_.textShadowStyles,"kakadu-components-2081390622",d==="delete"&&g,r&&"kakadu-components-2662775151",R),children:[e.jsxRuntimeExports.jsxs(m.default,{direction:"row",gap:.5,alignment:m.FlexAlignment.center,children:[s?e.jsxRuntimeExports.jsx("div",{className:a.cx("kakadu-components-743909038",t?"kakadu-components-1285017646":"kakadu-components-1475172827"),children:typeof s=="string"?e.jsxRuntimeExports.jsx(i.default,{width:14,height:14,type:s}):s}):null,t?e.jsxRuntimeExports.jsx("span",{className:"kakadu-components-3068418250",children:t}):e.jsxRuntimeExports.jsx(f.default,{children:y}),n?e.jsxRuntimeExports.jsx("div",{className:a.cx("kakadu-components-743909038",t?"kakadu-components-2421728947":"kakadu-components-1475172827"),children:typeof n=="string"?e.jsxRuntimeExports.jsx(i.default,{width:14,height:14,type:n}):n}):null]}),e.jsxRuntimeExports.jsxs("span",{className:"kakadu-components-1970948853",children:[l?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(h.default,{size:t?void 0:50}),e.jsxRuntimeExports.jsx(c.default,{size:t?void 0:50,className:c.normalBlendStyles})]}),u?e.jsxRuntimeExports.jsx(B.default,{label:u,position:j}):null]})]}),r?e.jsxRuntimeExports.jsx("div",{className:"kakadu-components-1970948853",children:e.jsxRuntimeExports.jsx(N.SkeletonInstance,{width:"100%",height:"100%"})}):null]})}exports.TextButtonVariant=p;exports.default=w;
|
|
@@ -1,46 +1,52 @@
|
|
|
1
1
|
import { j as o } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
2
2
|
import { cx as n } from "@kuma-ui/core";
|
|
3
3
|
import p from "../icons/icon.mjs";
|
|
4
|
-
import
|
|
5
|
-
import { textShadowStyles as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
4
|
+
import f, { FlexAlignment as B } from "./flex.mjs";
|
|
5
|
+
import { textShadowStyles as h } from "./text.mjs";
|
|
6
|
+
import N from "./click-ripples.mjs";
|
|
7
|
+
import b, { normalBlendStyles as g } from "./hover-gradient.mjs";
|
|
8
8
|
import w from "./button-tooltip.mjs";
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
import A from "./aria-text.mjs";
|
|
10
|
+
import F from "./atom.mjs";
|
|
11
|
+
import { SkeletonInstance as z } from "./skeleton.mjs";
|
|
12
|
+
var C = /* @__PURE__ */ ((e) => (e.primary = "primary", e.delete = "delete", e))(C || {});
|
|
13
|
+
const D = "kakadu-components-4017654514";
|
|
14
|
+
function P({
|
|
14
15
|
iconLeft: e,
|
|
15
16
|
iconRight: s,
|
|
16
|
-
variant:
|
|
17
|
-
tooltip:
|
|
18
|
-
tooltipPosition:
|
|
19
|
-
href:
|
|
20
|
-
target:
|
|
21
|
-
rel:
|
|
22
|
-
disabled:
|
|
23
|
-
|
|
17
|
+
variant: i = "primary",
|
|
18
|
+
tooltip: r,
|
|
19
|
+
tooltipPosition: k,
|
|
20
|
+
href: l,
|
|
21
|
+
target: u,
|
|
22
|
+
rel: c,
|
|
23
|
+
disabled: x,
|
|
24
|
+
isSkeleton: m,
|
|
25
|
+
className: j,
|
|
24
26
|
children: a,
|
|
25
|
-
label:
|
|
26
|
-
...
|
|
27
|
+
label: v,
|
|
28
|
+
...y
|
|
27
29
|
}) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
r ? null : /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
|
|
36
|
-
/* @__PURE__ */ o.jsx(B, { size: a ? void 0 : 50 }),
|
|
37
|
-
/* @__PURE__ */ o.jsx(f, { size: a ? void 0 : 50, className: N })
|
|
30
|
+
const d = !!x || !!m, t = l && !m;
|
|
31
|
+
return /* @__PURE__ */ o.jsxs("div", { className: n("kakadu-components-1400843519", a && (e || s) ? n(!!e && "kakadu-components-497190725", !!s && "kakadu-components-3729381008") : "kakadu-components-3866032606"), children: [
|
|
32
|
+
/* @__PURE__ */ o.jsxs(F, { ...y, as: t ? "a" : "button", type: t ? void 0 : "button", href: t ? l : void 0, target: t ? u : void 0, rel: t ? c : void 0, disabled: t ? void 0 : d, className: n(h, "kakadu-components-2081390622", i === "delete" && D, m && "kakadu-components-2662775151", j), children: [
|
|
33
|
+
/* @__PURE__ */ o.jsxs(f, { direction: "row", gap: 0.5, alignment: B.center, children: [
|
|
34
|
+
e ? /* @__PURE__ */ o.jsx("div", { className: n("kakadu-components-743909038", a ? "kakadu-components-1285017646" : "kakadu-components-1475172827"), children: typeof e == "string" ? /* @__PURE__ */ o.jsx(p, { width: 14, height: 14, type: e }) : e }) : null,
|
|
35
|
+
a ? /* @__PURE__ */ o.jsx("span", { className: "kakadu-components-3068418250", children: a }) : /* @__PURE__ */ o.jsx(A, { children: v }),
|
|
36
|
+
s ? /* @__PURE__ */ o.jsx("div", { className: n("kakadu-components-743909038", a ? "kakadu-components-2421728947" : "kakadu-components-1475172827"), children: typeof s == "string" ? /* @__PURE__ */ o.jsx(p, { width: 14, height: 14, type: s }) : s }) : null
|
|
38
37
|
] }),
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
/* @__PURE__ */ o.jsxs("span", { className: "kakadu-components-1970948853", children: [
|
|
39
|
+
d ? null : /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
|
|
40
|
+
/* @__PURE__ */ o.jsx(N, { size: a ? void 0 : 50 }),
|
|
41
|
+
/* @__PURE__ */ o.jsx(b, { size: a ? void 0 : 50, className: g })
|
|
42
|
+
] }),
|
|
43
|
+
r ? /* @__PURE__ */ o.jsx(w, { label: r, position: k }) : null
|
|
44
|
+
] })
|
|
45
|
+
] }),
|
|
46
|
+
m ? /* @__PURE__ */ o.jsx("div", { className: "kakadu-components-1970948853", children: /* @__PURE__ */ o.jsx(z, { width: "100%", height: "100%" }) }) : null
|
|
41
47
|
] });
|
|
42
48
|
}
|
|
43
49
|
export {
|
|
44
|
-
|
|
45
|
-
|
|
50
|
+
C as TextButtonVariant,
|
|
51
|
+
P as default
|
|
46
52
|
};
|