@kakadu/components 3.15.5 → 4.0.1
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 -4
- package/build/components/button-tooltip.js +1 -1
- package/build/components/button-tooltip.mjs +11 -11
- package/build/components/button.d.ts +2 -6
- package/build/components/button.js +1 -1
- package/build/components/button.mjs +51 -51
- package/build/components/card.js +1 -1
- package/build/components/card.mjs +22 -22
- package/build/components/combobox.d.ts +25 -0
- package/build/components/combobox.js +1 -0
- package/build/components/combobox.mjs +322 -0
- package/build/components/copy-icon-button.js +1 -1
- package/build/components/copy-icon-button.mjs +20 -21
- package/build/components/datum.js +1 -1
- package/build/components/datum.mjs +12 -12
- package/build/components/flex.d.ts +13 -9
- package/build/components/flex.js +1 -1
- package/build/components/flex.mjs +25 -15
- package/build/components/footer.d.ts +3 -6
- package/build/components/footer.js +1 -1
- package/build/components/footer.mjs +33 -33
- package/build/components/header.js +1 -1
- package/build/components/header.mjs +4 -5
- package/build/components/icon-button.d.ts +2 -6
- package/build/components/icon-button.js +1 -1
- package/build/components/icon-button.mjs +41 -41
- package/build/components/input.d.ts +12 -19
- package/build/components/input.js +2 -2
- package/build/components/input.mjs +122 -147
- package/build/components/kakadu-guide-logo.d.ts +2 -4
- package/build/components/kakadu-guide-logo.js +1 -1
- package/build/components/kakadu-guide-logo.mjs +13 -13
- package/build/components/modal.js +1 -1
- package/build/components/modal.mjs +65 -66
- package/build/components/notice.d.ts +2 -7
- package/build/components/notice.js +1 -1
- package/build/components/notice.mjs +16 -16
- package/build/components/notification.d.ts +2 -1
- package/build/components/notification.js +1 -1
- package/build/components/notification.mjs +9 -9
- package/build/components/popover-menu.js +1 -1
- package/build/components/popover-menu.mjs +98 -106
- package/build/components/popover.js +1 -1
- package/build/components/popover.mjs +1 -1
- package/build/components/select.d.ts +12 -0
- package/build/components/select.js +1 -0
- package/build/components/select.mjs +36 -0
- package/build/components/separator.js +1 -1
- package/build/components/separator.mjs +25 -25
- package/build/components/text-button.d.ts +2 -4
- package/build/components/text-button.js +1 -1
- package/build/components/text-button.mjs +26 -27
- package/build/components/text.d.ts +1 -1
- package/build/components/text.js +1 -1
- package/build/components/text.mjs +29 -30
- package/build/components/theme-setter.d.ts +1 -1
- package/build/components/wrapper.d.ts +3 -6
- package/build/components/wrapper.js +1 -1
- package/build/components/wrapper.mjs +25 -23
- package/build/components.css +1 -1
- package/build/{focus-trap-react-CcpTuiJi.js → focus-trap-react-CkKg4ubd.js} +5 -5
- package/build/{focus-trap-react-DYXrtbDH.mjs → focus-trap-react-DATIi_Ob.mjs} +34 -29
- package/build/hooks/use-synchronized-value.d.ts +4 -0
- package/build/icons/icon.d.ts +4 -42
- package/build/icons/icon.js +1 -1
- package/build/icons/icon.mjs +76 -76
- package/build/index.d.ts +4 -0
- package/build/index.js +1 -1
- package/build/index.mjs +248 -241
- package/build/use-synchronized-value-D0_rS5Wp.js +1 -0
- package/build/use-synchronized-value-XnIpeq1s.mjs +28 -0
- package/package.json +3 -1
|
@@ -2,76 +2,75 @@ import { j as t } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
|
2
2
|
import { createContext as q, useRef as j, useState as h, useCallback as f, useMemo as I, useEffect as m, useContext as z } from "react";
|
|
3
3
|
import { cx as w } from "@kuma-ui/core";
|
|
4
4
|
import { createPortal as G } from "react-dom";
|
|
5
|
-
import { f as J } from "../focus-trap-react-
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
const C = q({
|
|
5
|
+
import { f as J } from "../focus-trap-react-DATIi_Ob.mjs";
|
|
6
|
+
import K from "./text-button.mjs";
|
|
7
|
+
import F from "./decorators.mjs";
|
|
8
|
+
import C from "./flex.mjs";
|
|
9
|
+
import { defaultAtomElementType as Q } from "./atom.mjs";
|
|
10
|
+
import { Heading as U, defaultHeadingElementType as V } from "./text.mjs";
|
|
11
|
+
const A = q({
|
|
13
12
|
isVisible: !1,
|
|
14
13
|
isInteractive: !1
|
|
15
14
|
}), {
|
|
16
|
-
Provider:
|
|
17
|
-
} =
|
|
18
|
-
function
|
|
19
|
-
return z(
|
|
15
|
+
Provider: X
|
|
16
|
+
} = A;
|
|
17
|
+
function Y() {
|
|
18
|
+
return z(A);
|
|
20
19
|
}
|
|
21
|
-
function
|
|
20
|
+
function Z() {
|
|
22
21
|
const {
|
|
23
22
|
isInteractive: n,
|
|
24
23
|
close: o
|
|
25
|
-
} =
|
|
24
|
+
} = Y(), r = f(() => {
|
|
26
25
|
o == null || o();
|
|
27
26
|
}, [o]);
|
|
28
|
-
return /* @__PURE__ */ t.jsx("div", { className: "kakadu-components-2566044647", children: /* @__PURE__ */ t.jsx(
|
|
27
|
+
return /* @__PURE__ */ t.jsx("div", { className: "kakadu-components-2566044647", children: /* @__PURE__ */ t.jsx(K, { iconLeft: "times", label: "Close", disabled: !n, onClick: r }) });
|
|
29
28
|
}
|
|
30
|
-
function
|
|
31
|
-
return /* @__PURE__ */ t.jsx(
|
|
29
|
+
function ce(n) {
|
|
30
|
+
return /* @__PURE__ */ t.jsx(C, { gap: 2, ...n });
|
|
32
31
|
}
|
|
33
|
-
function
|
|
32
|
+
function ie({
|
|
34
33
|
as: n,
|
|
35
34
|
className: o,
|
|
36
|
-
...
|
|
35
|
+
...r
|
|
37
36
|
}) {
|
|
38
|
-
return /* @__PURE__ */ t.jsx(
|
|
37
|
+
return /* @__PURE__ */ t.jsx(U, { ...r, as: n ?? V, className: w("kakadu-components-4275938488", o) });
|
|
39
38
|
}
|
|
40
|
-
function
|
|
39
|
+
function ue({
|
|
41
40
|
as: n,
|
|
42
41
|
...o
|
|
43
42
|
}) {
|
|
44
|
-
return /* @__PURE__ */ t.jsx(
|
|
43
|
+
return /* @__PURE__ */ t.jsx(C, { direction: "row", gap: 1, preset: "end", ...o, as: n ?? Q });
|
|
45
44
|
}
|
|
46
|
-
function
|
|
45
|
+
function le({
|
|
47
46
|
root: n,
|
|
48
47
|
outerDecorators: o = [],
|
|
49
|
-
innerDecorators:
|
|
48
|
+
innerDecorators: r = [],
|
|
50
49
|
label: p,
|
|
51
50
|
maxWidth: a,
|
|
52
51
|
className: x,
|
|
53
|
-
isVisible:
|
|
54
|
-
isFullWidth:
|
|
52
|
+
isVisible: s,
|
|
53
|
+
isFullWidth: u = !1,
|
|
55
54
|
shouldCloseOnOutsideClick: i = !0,
|
|
56
|
-
shouldCloseOnEscapePress:
|
|
55
|
+
shouldCloseOnEscapePress: l = !0,
|
|
57
56
|
showCloseButton: H = !0,
|
|
58
57
|
onClose: k,
|
|
59
58
|
children: B
|
|
60
59
|
}) {
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
}, []), T = j(null),
|
|
60
|
+
const E = j(null), M = j(null), [g, P] = h(!1), [c, d] = h(!1), y = f((e) => {
|
|
61
|
+
E.current = e, d(!1);
|
|
62
|
+
}, []), T = j(null), L = f((e) => {
|
|
64
63
|
e && (T.current = e);
|
|
65
|
-
}, []), [
|
|
66
|
-
isVisible:
|
|
64
|
+
}, []), [N, R] = h(s ?? !1), D = I(() => ({
|
|
65
|
+
isVisible: N,
|
|
67
66
|
isInteractive: c,
|
|
68
|
-
setInitialFocus:
|
|
67
|
+
setInitialFocus: L,
|
|
69
68
|
close: y
|
|
70
|
-
}), [
|
|
69
|
+
}), [N, c, L, y]);
|
|
71
70
|
m(() => {
|
|
72
|
-
|
|
73
|
-
}, [
|
|
74
|
-
if (
|
|
71
|
+
s && (P(!0), R(!0));
|
|
72
|
+
}, [s]), m(() => {
|
|
73
|
+
if (s) {
|
|
75
74
|
const e = setTimeout(() => {
|
|
76
75
|
d(!0);
|
|
77
76
|
}, 100);
|
|
@@ -80,18 +79,18 @@ function fe({
|
|
|
80
79
|
};
|
|
81
80
|
}
|
|
82
81
|
d(!1);
|
|
83
|
-
}, [
|
|
84
|
-
if (
|
|
82
|
+
}, [s]), m(() => {
|
|
83
|
+
if (g && !c) {
|
|
85
84
|
const e = setTimeout(() => {
|
|
86
|
-
k == null || k(
|
|
85
|
+
k == null || k(E.current ?? void 0), R(!1);
|
|
87
86
|
}, 370);
|
|
88
87
|
return () => {
|
|
89
88
|
clearTimeout(e);
|
|
90
89
|
};
|
|
91
90
|
}
|
|
92
|
-
}, [
|
|
93
|
-
const e =
|
|
94
|
-
if (
|
|
91
|
+
}, [g, c, k]), m(() => {
|
|
92
|
+
const e = M.current;
|
|
93
|
+
if (s && i && e) {
|
|
95
94
|
const v = ($) => {
|
|
96
95
|
e === $.target && d(!1);
|
|
97
96
|
};
|
|
@@ -99,8 +98,8 @@ function fe({
|
|
|
99
98
|
e.removeEventListener("click", v);
|
|
100
99
|
};
|
|
101
100
|
}
|
|
102
|
-
}, [
|
|
103
|
-
if (!
|
|
101
|
+
}, [s, i]), m(() => {
|
|
102
|
+
if (!s || !l)
|
|
104
103
|
return;
|
|
105
104
|
const e = (v) => {
|
|
106
105
|
v.key === "Escape" && d(!1);
|
|
@@ -108,39 +107,39 @@ function fe({
|
|
|
108
107
|
return window.addEventListener("keydown", e), () => {
|
|
109
108
|
window.removeEventListener("keydown", e);
|
|
110
109
|
};
|
|
111
|
-
}, [
|
|
110
|
+
}, [s, l]);
|
|
112
111
|
const S = I(() => ({
|
|
113
112
|
initialFocus: () => T.current ?? void 0,
|
|
114
113
|
onActivate: () => {
|
|
115
114
|
var e;
|
|
116
115
|
return (e = T.current) == null ? void 0 : e.focus();
|
|
117
116
|
}
|
|
118
|
-
}), []),
|
|
117
|
+
}), []), b = /* @__PURE__ */ t.jsx(F, { decorators: o, children: /* @__PURE__ */ t.jsx("div", { "aria-hidden": !c, style: {
|
|
119
118
|
"--max-width": a ? `${a}px` : void 0
|
|
120
|
-
}, className: w("kakadu-components-4119461136", c && "kakadu-components-2522346797", x), children: /* @__PURE__ */ t.jsx(
|
|
121
|
-
H ? /* @__PURE__ */ t.jsx(
|
|
122
|
-
/* @__PURE__ */ t.jsx("div", { className: w("kakadu-components-633990035",
|
|
119
|
+
}, className: w("kakadu-components-4119461136", c && "kakadu-components-2522346797", x), children: /* @__PURE__ */ t.jsx(F, { decorators: r, children: /* @__PURE__ */ t.jsx(J.FocusTrap, { active: c, focusTrapOptions: S, children: /* @__PURE__ */ t.jsx("div", { ref: M, className: "kakadu-components-4011815997", children: /* @__PURE__ */ t.jsx("div", { role: "dialog", "aria-modal": "true", "aria-label": p ?? "Modal", className: w("kakadu-components-3324483532", u && "kakadu-components-3799971070", c && "kakadu-components-968755580"), children: /* @__PURE__ */ t.jsxs(X, { value: D, children: [
|
|
120
|
+
H ? /* @__PURE__ */ t.jsx(Z, {}) : null,
|
|
121
|
+
/* @__PURE__ */ t.jsx("div", { className: w("kakadu-components-633990035", u && "kakadu-components-171969824"), children: B })
|
|
123
122
|
] }) }) }) }) }) }) });
|
|
124
|
-
return n ? G(
|
|
123
|
+
return n ? G(b, n) : b;
|
|
125
124
|
}
|
|
126
|
-
function
|
|
127
|
-
const [
|
|
125
|
+
function de(n, o) {
|
|
126
|
+
const [r, p] = h(!1), a = j(void 0), x = f(async () => (p(!0), new Promise((i) => {
|
|
128
127
|
a.current = i;
|
|
129
|
-
})), []),
|
|
130
|
-
var
|
|
131
|
-
p(!1), (
|
|
132
|
-
}, []),
|
|
128
|
+
})), []), s = f((i) => {
|
|
129
|
+
var l;
|
|
130
|
+
p(!1), (l = a.current) == null || l.call(a, i), a.current = void 0;
|
|
131
|
+
}, []), u = I(() => /* @__PURE__ */ t.jsx(n, { ...o, isVisible: r, onClose: s }), [n, o, r, s]);
|
|
133
132
|
return I(() => ({
|
|
134
|
-
isVisible:
|
|
133
|
+
isVisible: r,
|
|
135
134
|
show: x,
|
|
136
|
-
modal:
|
|
137
|
-
}), [
|
|
135
|
+
modal: u
|
|
136
|
+
}), [r, x, u]);
|
|
138
137
|
}
|
|
139
138
|
export {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
139
|
+
ue as ModalActions,
|
|
140
|
+
ce as ModalContent,
|
|
141
|
+
ie as ModalHeading,
|
|
142
|
+
le as default,
|
|
143
|
+
de as useModal,
|
|
144
|
+
Y as useModalContext
|
|
146
145
|
};
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import { type HTMLProps } from 'react';
|
|
2
2
|
import { type IconType } from '../icons/icon';
|
|
3
|
-
export declare
|
|
4
|
-
|
|
5
|
-
success = "success",
|
|
6
|
-
information = "information",
|
|
7
|
-
warning = "warning",
|
|
8
|
-
danger = "danger"
|
|
9
|
-
}
|
|
3
|
+
export declare const noticeTypes: readonly ["default", "success", "information", "warning", "danger"];
|
|
4
|
+
export type NoticeType = (typeof noticeTypes)[number];
|
|
10
5
|
export type NoticeProperties = HTMLProps<HTMLDivElement> & {
|
|
11
6
|
readonly type?: NoticeType;
|
|
12
7
|
readonly icon?: IconType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("../jsx-runtime-BB_1_6y_.js"),a=require("@kuma-ui/core"),c=require("../icons/icon.js"),x=require("./text.js"),l=["default","success","information","warning","danger"];function j({type:e="default",icon:o,className:i,children:t,...r}){const u=e==="success",d=e==="information",m=e==="warning",k=e==="danger",n=!!o,p=!!t;return s.jsxRuntimeExports.jsxs("aside",{...r,className:a.cx("kakadu-components-1434967310",n&&"kakadu-components-2945174293",u&&(n?"kakadu-components-2585123369":"kakadu-components-1387450724"),d&&(n?"kakadu-components-3663522234":"kakadu-components-728842914"),m&&(n?"kakadu-components-3502407303":"kakadu-components-1612824642"),k&&(n?"kakadu-components-314765189":"kakadu-components-4209515987"),i),children:[s.jsxRuntimeExports.jsx("div",{"data-theme":"dark",className:a.cx("kakadu-components-3327291559",n&&"kakadu-components-3906762683"),children:o&&s.jsxRuntimeExports.jsx(c.default,{width:14,height:14,type:o,className:c.iconShadowStyles})}),s.jsxRuntimeExports.jsx(x.Span,{className:"kakadu-components-1969958615",children:p?t:s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:" "})})]})}exports.default=j;exports.noticeTypes=l;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { cx as
|
|
3
|
-
import
|
|
1
|
+
import { j as o } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
2
|
+
import { cx as t } from "@kuma-ui/core";
|
|
3
|
+
import p, { iconShadowStyles as l } from "../icons/icon.mjs";
|
|
4
4
|
import { Span as f } from "./text.mjs";
|
|
5
|
-
|
|
6
|
-
function
|
|
7
|
-
type:
|
|
8
|
-
icon:
|
|
9
|
-
className:
|
|
10
|
-
children:
|
|
11
|
-
...
|
|
5
|
+
const N = ["default", "success", "information", "warning", "danger"];
|
|
6
|
+
function w({
|
|
7
|
+
type: a = "default",
|
|
8
|
+
icon: s,
|
|
9
|
+
className: c,
|
|
10
|
+
children: e,
|
|
11
|
+
...m
|
|
12
12
|
}) {
|
|
13
|
-
const
|
|
14
|
-
return /* @__PURE__ */
|
|
15
|
-
/* @__PURE__ */
|
|
16
|
-
/* @__PURE__ */
|
|
13
|
+
const r = a === "success", d = a === "information", i = a === "warning", k = a === "danger", n = !!s, u = !!e;
|
|
14
|
+
return /* @__PURE__ */ o.jsxs("aside", { ...m, className: t("kakadu-components-1434967310", n && "kakadu-components-2945174293", r && (n ? "kakadu-components-2585123369" : "kakadu-components-1387450724"), d && (n ? "kakadu-components-3663522234" : "kakadu-components-728842914"), i && (n ? "kakadu-components-3502407303" : "kakadu-components-1612824642"), k && (n ? "kakadu-components-314765189" : "kakadu-components-4209515987"), c), children: [
|
|
15
|
+
/* @__PURE__ */ o.jsx("div", { "data-theme": "dark", className: t("kakadu-components-3327291559", n && "kakadu-components-3906762683"), children: s && /* @__PURE__ */ o.jsx(p, { width: 14, height: 14, type: s, className: l }) }),
|
|
16
|
+
/* @__PURE__ */ o.jsx(f, { className: "kakadu-components-1969958615", children: u ? e : /* @__PURE__ */ o.jsx(o.Fragment, { children: " " }) })
|
|
17
17
|
] });
|
|
18
18
|
}
|
|
19
19
|
export {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
w as default,
|
|
21
|
+
N as noticeTypes
|
|
22
22
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type HTMLProps, type ReactNode } from 'react';
|
|
2
2
|
import { type IconType } from '../icons/icon';
|
|
3
3
|
import { type NoticeType } from './notice';
|
|
4
|
-
export {
|
|
4
|
+
export { noticeTypes as notificationTypes } from './notice';
|
|
5
|
+
export type { NoticeType as NotificationType } from './notice';
|
|
5
6
|
export type NotificationProperties = {
|
|
6
7
|
readonly id?: string;
|
|
7
8
|
readonly type?: NoticeType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("../jsx-runtime-BB_1_6y_.js"),e=require("react"),p=require("@kuma-ui/core"),M=require("../utilities/generate-random-id.js"),j=require("./notice.js");function E({type:n,icon:d,index:u,className:c,children:m,onDismiss:s,...o}){const[t,a]=e.useState(!1),[l,C]=e.useState(!1),[f,k]=e.useState(!1);e.useEffect(()=>{const r=setTimeout(()=>{a(!0)},250);return()=>{clearTimeout(r)}},[]);const N=e.useRef(0),v=e.useRef(0),R=e.useCallback(()=>{k(!0)},[]),b=e.useCallback(()=>{k(!1)},[]);e.useEffect(()=>{if(f){v.current+=Date.now()-N.current;return}if(t){N.current=Date.now();const r=6e3-v.current,h=setTimeout(()=>{a(!1),C(!0)},r);return()=>{clearTimeout(h)}}},[f,t]);const x=u??0;return e.useEffect(()=>{if(l&&!t){const r=setTimeout(()=>{s==null||s(x)},300);return()=>{clearTimeout(r)}}},[l,t,s,x]),i.jsxRuntimeExports.jsx("div",{...o,style:{"--index":x},className:p.cx("kakadu-components-1727618227",t&&"kakadu-components-3003995416",c),children:i.jsxRuntimeExports.jsxs(j.default,{role:"status","aria-live":"polite","aria-atomic":"true",type:n,icon:d,className:p.cx("kakadu-components-3423716848",t&&"kakadu-components-2837603142"),onMouseEnter:R,onMouseLeave:b,children:[m,i.jsxRuntimeExports.jsx("div",{className:"kakadu-components-2751825161",children:i.jsxRuntimeExports.jsx("div",{className:p.cx("kakadu-components-47664046",f?"kakadu-components-758522476":"kakadu-components-3914681513")})})]})})}const T=e.createContext({createNotification(){throw new Error("useCreateNotification must be used within a NotificationProvider")}});function S(){const{createNotification:n}=e.useContext(T);return n}function q({children:n}){const[d,u]=e.useState([]),c=e.useCallback(o=>{const t=M.default();u(a=>[...a,{...o,id:t}])},[]),m=e.useCallback(o=>{u(t=>t.filter((a,l)=>l!==o))},[]),s=e.useMemo(()=>({createNotification:c}),[c]);return i.jsxRuntimeExports.jsxs(T.Provider,{value:s,children:[n,d.map((o,t)=>i.jsxRuntimeExports.jsx(E,{...o,index:t,onDismiss:m},o.id))]})}exports.
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("../jsx-runtime-BB_1_6y_.js"),e=require("react"),p=require("@kuma-ui/core"),M=require("../utilities/generate-random-id.js"),j=require("./notice.js");function E({type:n,icon:d,index:u,className:c,children:m,onDismiss:s,...o}){const[t,a]=e.useState(!1),[l,C]=e.useState(!1),[f,k]=e.useState(!1);e.useEffect(()=>{const r=setTimeout(()=>{a(!0)},250);return()=>{clearTimeout(r)}},[]);const N=e.useRef(0),v=e.useRef(0),R=e.useCallback(()=>{k(!0)},[]),b=e.useCallback(()=>{k(!1)},[]);e.useEffect(()=>{if(f){v.current+=Date.now()-N.current;return}if(t){N.current=Date.now();const r=6e3-v.current,h=setTimeout(()=>{a(!1),C(!0)},r);return()=>{clearTimeout(h)}}},[f,t]);const x=u??0;return e.useEffect(()=>{if(l&&!t){const r=setTimeout(()=>{s==null||s(x)},300);return()=>{clearTimeout(r)}}},[l,t,s,x]),i.jsxRuntimeExports.jsx("div",{...o,style:{"--index":x},className:p.cx("kakadu-components-1727618227",t&&"kakadu-components-3003995416",c),children:i.jsxRuntimeExports.jsxs(j.default,{role:"status","aria-live":"polite","aria-atomic":"true",type:n,icon:d,className:p.cx("kakadu-components-3423716848",t&&"kakadu-components-2837603142"),onMouseEnter:R,onMouseLeave:b,children:[m,i.jsxRuntimeExports.jsx("div",{className:"kakadu-components-2751825161",children:i.jsxRuntimeExports.jsx("div",{className:p.cx("kakadu-components-47664046",f?"kakadu-components-758522476":"kakadu-components-3914681513")})})]})})}const T=e.createContext({createNotification(){throw new Error("useCreateNotification must be used within a NotificationProvider")}});function S(){const{createNotification:n}=e.useContext(T);return n}function q({children:n}){const[d,u]=e.useState([]),c=e.useCallback(o=>{const t=M.default();u(a=>[...a,{...o,id:t}])},[]),m=e.useCallback(o=>{u(t=>t.filter((a,l)=>l!==o))},[]),s=e.useMemo(()=>({createNotification:c}),[c]);return i.jsxRuntimeExports.jsxs(T.Provider,{value:s,children:[n,d.map((o,t)=>i.jsxRuntimeExports.jsx(E,{...o,index:t,onDismiss:m},o.id))]})}exports.notificationTypes=j.noticeTypes;exports.NotificationProvider=q;exports.default=E;exports.useCreateNotification=S;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { j as i } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
2
|
-
import { createContext as b, useState as m, useEffect as
|
|
3
|
-
import { cx as
|
|
2
|
+
import { createContext as b, useState as m, useEffect as x, useRef as j, useCallback as d, useContext as y, useMemo as P } from "react";
|
|
3
|
+
import { cx as N } from "@kuma-ui/core";
|
|
4
4
|
import R from "../utilities/generate-random-id.mjs";
|
|
5
5
|
import D from "./notice.mjs";
|
|
6
|
-
import {
|
|
6
|
+
import { noticeTypes as G } from "./notice.mjs";
|
|
7
7
|
function H({
|
|
8
8
|
type: n,
|
|
9
9
|
icon: f,
|
|
@@ -14,7 +14,7 @@ function H({
|
|
|
14
14
|
...e
|
|
15
15
|
}) {
|
|
16
16
|
const [t, s] = m(!1), [u, E] = m(!1), [p, v] = m(!1);
|
|
17
|
-
|
|
17
|
+
x(() => {
|
|
18
18
|
const a = setTimeout(() => {
|
|
19
19
|
s(!0);
|
|
20
20
|
}, 250);
|
|
@@ -27,7 +27,7 @@ function H({
|
|
|
27
27
|
}, []), I = d(() => {
|
|
28
28
|
v(!1);
|
|
29
29
|
}, []);
|
|
30
|
-
|
|
30
|
+
x(() => {
|
|
31
31
|
if (p) {
|
|
32
32
|
h.current += Date.now() - T.current;
|
|
33
33
|
return;
|
|
@@ -43,7 +43,7 @@ function H({
|
|
|
43
43
|
}
|
|
44
44
|
}, [p, t]);
|
|
45
45
|
const k = r ?? 0;
|
|
46
|
-
return
|
|
46
|
+
return x(() => {
|
|
47
47
|
if (u && !t) {
|
|
48
48
|
const a = setTimeout(() => {
|
|
49
49
|
o == null || o(k);
|
|
@@ -54,9 +54,9 @@ function H({
|
|
|
54
54
|
}
|
|
55
55
|
}, [u, t, o, k]), /* @__PURE__ */ i.jsx("div", { ...e, style: {
|
|
56
56
|
"--index": k
|
|
57
|
-
}, className:
|
|
57
|
+
}, className: N("kakadu-components-1727618227", t && "kakadu-components-3003995416", c), children: /* @__PURE__ */ i.jsxs(D, { role: "status", "aria-live": "polite", "aria-atomic": "true", type: n, icon: f, className: N("kakadu-components-3423716848", t && "kakadu-components-2837603142"), onMouseEnter: w, onMouseLeave: I, children: [
|
|
58
58
|
l,
|
|
59
|
-
/* @__PURE__ */ i.jsx("div", { className: "kakadu-components-2751825161", children: /* @__PURE__ */ i.jsx("div", { className:
|
|
59
|
+
/* @__PURE__ */ i.jsx("div", { className: "kakadu-components-2751825161", children: /* @__PURE__ */ i.jsx("div", { className: N("kakadu-components-47664046", p ? "kakadu-components-758522476" : "kakadu-components-3914681513") }) })
|
|
60
60
|
] }) });
|
|
61
61
|
}
|
|
62
62
|
const C = b({
|
|
@@ -91,7 +91,7 @@ function A({
|
|
|
91
91
|
}
|
|
92
92
|
export {
|
|
93
93
|
A as NotificationProvider,
|
|
94
|
-
G as NotificationType,
|
|
95
94
|
H as default,
|
|
95
|
+
G as notificationTypes,
|
|
96
96
|
z as useCreateNotification
|
|
97
97
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../jsx-runtime-BB_1_6y_.js"),N=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"),N=require("@kuma-ui/core"),a=require("react"),S=require("../theme.js"),b=require("../icons/icon.js"),C=require("../use-synchronized-value-D0_rS5Wp.js"),f=require("./popover.js"),F=require("./atom.js"),P=require("./text.js"),w=require("./hover-gradient.js"),z=require("./click-ripples.js"),K=require("./separator.js"),V=require("./decorators.js"),M=require("./spinner.js"),A=require("./skeleton.js"),D=require("./aria-text.js");function q(){const{value:t,setValue:n}=C.useSynchronizedValue("isKeyboardNavigating");return a.useMemo(()=>({isKeyboardNavigating:t,setIsKeyboardNavigating:n}),[t,n])}const T="kakadu-components-949294122";function H({isLoading:t,label:n,iconLeft:u,iconRight:x,href:o,target:m,shouldCloseOnClick:E=!0,decorators:i=[],submenu:s,className:d,onClick:c,...p}){const{isVisible:j,isPreparingFocus:l,isFocused:r,close:k}=f.usePopoverContext(),{isKeyboardNavigating:v}=q(),R=a.useRef(!0),h=a.useCallback(()=>{R.current=r},[r]),y=a.useCallback(_=>{!v&&!R.current||r&&(c==null||c(_),s?s.show():E&&(k==null||k()))},[v,r,c,s,E,k]),g=a.useMemo(()=>e.jsxRuntimeExports.jsxs(F.default,{as:o&&!t?"a":"button",...p,type:o&&!t?void 0:"button",role:"menuitem",href:o,target:m,inert:!j&&!l||t,disabled:o?void 0:!j&&!l||t,className:N.cx(S.buttonResetStyles,"kakadu-components-1772835671",r&&"kakadu-components-3160069815",v?"kakadu-components-2254977234":r&&"kakadu-components-278139688",d),onClick:y,onPointerDownCapture:h,children:[e.jsxRuntimeExports.jsx(P.Span,{className:"kakadu-components-1109353535",children:t?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(D.default,{children:n}),u?e.jsxRuntimeExports.jsx(M.default,{size:12}):null,e.jsxRuntimeExports.jsx(A.SkeletonInstance,{height:"1em",width:"100%"}),x?e.jsxRuntimeExports.jsx(M.default,{size:12}):null]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[u?e.jsxRuntimeExports.jsx(b.default,{width:12,height:12,type:u}):null,e.jsxRuntimeExports.jsx("span",{className:"kakadu-components-4055589237",children:n}),x?e.jsxRuntimeExports.jsx(b.default,{width:12,height:12,type:x}):null]})}),v||t?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(z.default,{isActive:r,size:100}),e.jsxRuntimeExports.jsx(w.default,{isActive:r,size:150,className:w.normalBlendStyles})]})]}),[o,t,p,m,j,l,r,v,d,y,h,u,n,x]);return e.jsxRuntimeExports.jsx(V.default,{decorators:i,children:s?e.jsxRuntimeExports.jsx(I,{menu:s.popoverMenu,className:"kakadu-components-1861176543",children:g}):g})}function $(t){if("type"in t){if(t.type==="separator")return e.jsxRuntimeExports.jsx(K.default,{});if(t.type==="group")return e.jsxRuntimeExports.jsx(P.Span,{className:"kakadu-components-1499037363",children:t.label})}return e.jsxRuntimeExports.jsx(H,{...t})}function B({items:t}){const{isFocused:n}=f.usePopoverContext(),[u,x]=a.useState([]),{setIsKeyboardNavigating:o}=q(),m=a.useCallback(i=>{i&&x(s=>s.includes(i)?s:[...s,i])},[]),E=a.useCallback(i=>{n&&(i.currentTarget.focus(),o(!1))},[n,o]);return a.useEffect(()=>{if(!n)return;const i=s=>{const d=u.filter(r=>r.isConnected),c=d.length;if(c===0)return;let p;const j=document.activeElement;let l=j?d.indexOf(j):-1;switch(l===-1&&(l=0),s.key){case"ArrowDown":{p=(l+1)%c;break}case"ArrowUp":{p=(l-1+c)%c;break}case"Home":{p=0;break}case"End":{p=c-1;break}case"Tab":{o(!0);return}}if(p!==void 0){s.preventDefault(),s.stopPropagation();const r=d[p];r&&(r.focus(),o(!0))}};return window.addEventListener("keydown",i,{capture:!0}),()=>{window.removeEventListener("keydown",i,{capture:!0})}},[n,u,o]),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:t.map((i,s)=>e.jsxRuntimeExports.jsx($,{...i,reference:m,onMouseEnter:E},s))})}function G({items:t,...n}){return e.jsxRuntimeExports.jsx(f.default,{...n,as:"nav",role:"menu",innerClassName:"kakadu-components-3600436535",children:e.jsxRuntimeExports.jsx(B,{items:t})})}function O(t){const n=a.useMemo(()=>({items:t}),[t]),{isVisible:u,show:x,close:o,popover:m}=f.usePopover(G,n);return a.useMemo(()=>({isVisible:u,show:x,close:o,popoverMenu:m}),[u,x,o,m])}function I({menu:t,className:n,children:u}){return e.jsxRuntimeExports.jsxs(f.PopoverContainer,{className:n,children:[u,t]})}exports.dangerPopoverMenuItemStyles=T;exports.default=I;exports.usePopoverMenu=O;
|