@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
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
export declare
|
|
2
|
-
|
|
3
|
-
bottom = "bottom"
|
|
4
|
-
}
|
|
1
|
+
export declare const buttonTooltipPositions: readonly ["top", "bottom"];
|
|
2
|
+
export type ButtonTooltipPosition = (typeof buttonTooltipPositions)[number];
|
|
5
3
|
export type ButtonTooltipProperties = {
|
|
6
4
|
readonly id?: string;
|
|
7
5
|
readonly label: string;
|
|
@@ -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 e=require("../jsx-runtime-BB_1_6y_.js"),n=require("@kuma-ui/core"),a=["top","bottom"];function c({id:s,label:u,position:o="top",className:t}){return e.jsxRuntimeExports.jsx("div",{id:s,role:"tooltip",className:n.cx("kakadu-components-982005200",o==="top"&&"kakadu-components-430823771",o==="bottom"&&"kakadu-components-2189175034",t),children:e.jsxRuntimeExports.jsx("span",{className:n.cx("kakadu-components-3316581213",o==="top"&&"kakadu-components-2481216458",o==="bottom"&&"kakadu-components-637471806",t),children:u})})}exports.buttonTooltipPositions=a;exports.default=c;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { cx as
|
|
3
|
-
|
|
4
|
-
function
|
|
5
|
-
id:
|
|
6
|
-
label:
|
|
7
|
-
position:
|
|
8
|
-
className:
|
|
1
|
+
import { j as n } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
2
|
+
import { cx as a } from "@kuma-ui/core";
|
|
3
|
+
const c = ["top", "bottom"];
|
|
4
|
+
function k({
|
|
5
|
+
id: m,
|
|
6
|
+
label: p,
|
|
7
|
+
position: o = "top",
|
|
8
|
+
className: t
|
|
9
9
|
}) {
|
|
10
|
-
return /* @__PURE__ */
|
|
10
|
+
return /* @__PURE__ */ n.jsx("div", { id: m, role: "tooltip", className: a("kakadu-components-982005200", o === "top" && "kakadu-components-430823771", o === "bottom" && "kakadu-components-2189175034", t), children: /* @__PURE__ */ n.jsx("span", { className: a("kakadu-components-3316581213", o === "top" && "kakadu-components-2481216458", o === "bottom" && "kakadu-components-637471806", t), children: p }) });
|
|
11
11
|
}
|
|
12
12
|
export {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
c as buttonTooltipPositions,
|
|
14
|
+
k as default
|
|
15
15
|
};
|
|
@@ -6,12 +6,8 @@ export declare function ButtonLoader({ isLoading, size, className, }: {
|
|
|
6
6
|
readonly size?: number;
|
|
7
7
|
readonly className?: string;
|
|
8
8
|
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
export declare
|
|
10
|
-
|
|
11
|
-
secondary = "secondary",
|
|
12
|
-
warning = "warning",
|
|
13
|
-
danger = "danger"
|
|
14
|
-
}
|
|
9
|
+
export declare const buttonVariants: readonly ["primary", "secondary", "warning", "danger"];
|
|
10
|
+
export type ButtonVariant = (typeof buttonVariants)[number];
|
|
15
11
|
export declare const buttonSecondaryStyles: string;
|
|
16
12
|
export declare const buttonSuccessStyles: string;
|
|
17
13
|
export declare const buttonWarningStyles: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../jsx-runtime-BB_1_6y_.js"),R=require("react"),u=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"),R=require("react"),u=require("@kuma-ui/core"),A=require("../theme.js"),W=require("../icons/icon.js"),$=require("./spinner.js"),C=require("./moving-gradients.js"),F=require("./moving-stars.js"),O=require("./theme-setter.js"),P=require("./click-ripples.js"),b=require("./hover-gradient.js"),H=require("./button-tooltip.js"),J=require("./aria-text.js"),K=require("./atom.js"),Q=require("./skeleton.js");function f({isLoading:t,size:s,className:a}){return e.jsxRuntimeExports.jsx("div",{className:u.cx("kakadu-components-2832510379",t&&"kakadu-components-4114685569",a),children:e.jsxRuntimeExports.jsx("div",{className:"kakadu-components-920467642",children:e.jsxRuntimeExports.jsx($.RevealSpinner,{isVisible:t,size:s})})})}const U=["primary","secondary","warning","danger"];function E({icon:t,variant:s="primary",className:a,...c}){return e.jsxRuntimeExports.jsx("div",{...c,className:u.cx("kakadu-components-2658660333",s==="secondary"&&"kakadu-components-3469662110",a),children:typeof t=="string"?e.jsxRuntimeExports.jsx(W.default,{width:14,height:14,type:t}):t})}const v="kakadu-components-2244098950",X="kakadu-components-3923184173",S="kakadu-components-317965671",q="kakadu-components-1978976872";function Y({type:t,variant:s="primary",href:a,target:c,rel:g,disabled:h,className:_,children:n,label:N,tooltip:i,tooltipPosition:B,iconLeft:m,iconRight:x,isLoading:l,isSkeleton:r,isSkeletonAnimated:w=!0,hasMovingGradients:M=!1,movingGradientsCount:p=4,hasMovingStars:D=!1,movingStarsCount:k=10,...I}){const j=R.useId(),y=R.useRef(null),T=O.useIsDarkMode(y),G=t??"button",V=M&&p>0,z=D&&k>0,o=a&&!r,d=!!h||!!l||!!r;return e.jsxRuntimeExports.jsxs("div",{className:"kakadu-components-3559664923",children:[e.jsxRuntimeExports.jsxs(K.default,{...I,as:o?"a":"button",type:o?void 0:G,href:o?a:void 0,target:o?c:void 0,rel:o?g:void 0,"aria-describedby":i?j:void 0,disabled:o?void 0:d,inert:o?d:void 0,className:u.cx(A.effectStyles,"kakadu-components-4212105756",!!m&&"kakadu-components-2735110382",!n&&"kakadu-components-3621693630",s==="secondary"&&v,s==="warning"&&S,s==="danger"&&q,r&&"kakadu-components-2662775151",_),children:[m?e.jsxRuntimeExports.jsx(E,{variant:s,icon:m,className:n?"kakadu-components-136489413":void 0}):null,n?e.jsxRuntimeExports.jsx("div",{ref:y,className:"kakadu-components-207477259",children:n}):e.jsxRuntimeExports.jsx(J.default,{children:N}),x?e.jsxRuntimeExports.jsx(E,{variant:s,icon:x,className:n?"kakadu-components-3631501803":void 0}):null,e.jsxRuntimeExports.jsx(f,{isLoading:l}),V&&e.jsxRuntimeExports.jsx(C.default,{opacity:T?.4:.3,maximumGradientsCount:p,className:u.cx("kakadu-components-2055737617",s==="secondary"&&"kakadu-components-2972748387")}),z&&e.jsxRuntimeExports.jsx(F.default,{maximumStarsCount:k,className:"kakadu-components-1226008615"}),d?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(P.default,{size:n?void 0:50}),e.jsxRuntimeExports.jsx(b.default,{size:n?void 0:50,className:s==="secondary"?b.normalBlendStyles:void 0})]}),i?e.jsxRuntimeExports.jsx(H.default,{id:j,label:i,position:B}):null]}),r?e.jsxRuntimeExports.jsx("div",{className:"kakadu-components-3422055155",children:e.jsxRuntimeExports.jsx(Q.SkeletonInstance,{width:"100%",height:"100%",isAnimated:w})}):null]})}exports.ButtonLoader=f;exports.buttonDangerStyles=q;exports.buttonSecondaryStyles=v;exports.buttonSuccessStyles=X;exports.buttonVariants=U;exports.buttonWarningStyles=S;exports.default=Y;
|
|
@@ -3,80 +3,80 @@ import { useId as R, useRef as T } from "react";
|
|
|
3
3
|
import { cx as m } from "@kuma-ui/core";
|
|
4
4
|
import { effectStyles as z } from "../theme.mjs";
|
|
5
5
|
import C from "../icons/icon.mjs";
|
|
6
|
-
import { RevealSpinner as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { useIsDarkMode as
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import { SkeletonInstance as
|
|
16
|
-
function
|
|
17
|
-
isLoading:
|
|
18
|
-
size:
|
|
19
|
-
className:
|
|
6
|
+
import { RevealSpinner as V } from "./spinner.mjs";
|
|
7
|
+
import E from "./moving-gradients.mjs";
|
|
8
|
+
import F from "./moving-stars.mjs";
|
|
9
|
+
import { useIsDarkMode as H } from "./theme-setter.mjs";
|
|
10
|
+
import W from "./click-ripples.mjs";
|
|
11
|
+
import q, { normalBlendStyles as J } from "./hover-gradient.mjs";
|
|
12
|
+
import K from "./button-tooltip.mjs";
|
|
13
|
+
import O from "./aria-text.mjs";
|
|
14
|
+
import P from "./atom.mjs";
|
|
15
|
+
import { SkeletonInstance as Q } from "./skeleton.mjs";
|
|
16
|
+
function U({
|
|
17
|
+
isLoading: n,
|
|
18
|
+
size: s,
|
|
19
|
+
className: e
|
|
20
20
|
}) {
|
|
21
|
-
return /* @__PURE__ */ o.jsx("div", { className: m("kakadu-components-2832510379",
|
|
21
|
+
return /* @__PURE__ */ o.jsx("div", { className: m("kakadu-components-2832510379", n && "kakadu-components-4114685569", e), children: /* @__PURE__ */ o.jsx("div", { className: "kakadu-components-920467642", children: /* @__PURE__ */ o.jsx(V, { isVisible: n, size: s }) }) });
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
function
|
|
25
|
-
icon:
|
|
26
|
-
variant:
|
|
27
|
-
className:
|
|
28
|
-
...
|
|
23
|
+
const lo = ["primary", "secondary", "warning", "danger"];
|
|
24
|
+
function y({
|
|
25
|
+
icon: n,
|
|
26
|
+
variant: s = "primary",
|
|
27
|
+
className: e,
|
|
28
|
+
...c
|
|
29
29
|
}) {
|
|
30
|
-
return /* @__PURE__ */ o.jsx("div", { ...
|
|
30
|
+
return /* @__PURE__ */ o.jsx("div", { ...c, className: m("kakadu-components-2658660333", s === "secondary" && "kakadu-components-3469662110", e), children: typeof n == "string" ? /* @__PURE__ */ o.jsx(C, { width: 14, height: 14, type: n }) : n });
|
|
31
31
|
}
|
|
32
|
-
const
|
|
32
|
+
const X = "kakadu-components-2244098950", ko = "kakadu-components-3923184173", Y = "kakadu-components-317965671", Z = "kakadu-components-1978976872";
|
|
33
33
|
function xo({
|
|
34
|
-
type:
|
|
35
|
-
variant:
|
|
36
|
-
href:
|
|
37
|
-
target:
|
|
34
|
+
type: n,
|
|
35
|
+
variant: s = "primary",
|
|
36
|
+
href: e,
|
|
37
|
+
target: c,
|
|
38
38
|
rel: v,
|
|
39
39
|
disabled: b,
|
|
40
|
-
className:
|
|
41
|
-
children:
|
|
42
|
-
label:
|
|
43
|
-
tooltip:
|
|
40
|
+
className: N,
|
|
41
|
+
children: t,
|
|
42
|
+
label: g,
|
|
43
|
+
tooltip: d,
|
|
44
44
|
tooltipPosition: h,
|
|
45
45
|
iconLeft: i,
|
|
46
46
|
iconRight: p,
|
|
47
47
|
isLoading: l,
|
|
48
48
|
isSkeleton: r,
|
|
49
|
-
isSkeletonAnimated:
|
|
50
|
-
hasMovingGradients:
|
|
49
|
+
isSkeletonAnimated: B = !0,
|
|
50
|
+
hasMovingGradients: S = !1,
|
|
51
51
|
movingGradientsCount: k = 4,
|
|
52
|
-
hasMovingStars:
|
|
52
|
+
hasMovingStars: w = !1,
|
|
53
53
|
movingStarsCount: x = 10,
|
|
54
54
|
...I
|
|
55
55
|
}) {
|
|
56
|
-
const f = R(),
|
|
56
|
+
const f = R(), j = T(null), M = H(j), A = n ?? "button", D = S && k > 0, G = w && x > 0, a = e && !r, u = !!b || !!l || !!r;
|
|
57
57
|
return /* @__PURE__ */ o.jsxs("div", { className: "kakadu-components-3559664923", children: [
|
|
58
|
-
/* @__PURE__ */ o.jsxs(
|
|
59
|
-
i ? /* @__PURE__ */ o.jsx(
|
|
60
|
-
|
|
61
|
-
p ? /* @__PURE__ */ o.jsx(
|
|
62
|
-
/* @__PURE__ */ o.jsx(
|
|
63
|
-
D && /* @__PURE__ */ o.jsx(
|
|
64
|
-
G && /* @__PURE__ */ o.jsx(
|
|
58
|
+
/* @__PURE__ */ o.jsxs(P, { ...I, as: a ? "a" : "button", type: a ? void 0 : A, href: a ? e : void 0, target: a ? c : void 0, rel: a ? v : void 0, "aria-describedby": d ? f : void 0, disabled: a ? void 0 : u, inert: a ? u : void 0, className: m(z, "kakadu-components-4212105756", !!i && "kakadu-components-2735110382", !t && "kakadu-components-3621693630", s === "secondary" && X, s === "warning" && Y, s === "danger" && Z, r && "kakadu-components-2662775151", N), children: [
|
|
59
|
+
i ? /* @__PURE__ */ o.jsx(y, { variant: s, icon: i, className: t ? "kakadu-components-136489413" : void 0 }) : null,
|
|
60
|
+
t ? /* @__PURE__ */ o.jsx("div", { ref: j, className: "kakadu-components-207477259", children: t }) : /* @__PURE__ */ o.jsx(O, { children: g }),
|
|
61
|
+
p ? /* @__PURE__ */ o.jsx(y, { variant: s, icon: p, className: t ? "kakadu-components-3631501803" : void 0 }) : null,
|
|
62
|
+
/* @__PURE__ */ o.jsx(U, { isLoading: l }),
|
|
63
|
+
D && /* @__PURE__ */ o.jsx(E, { opacity: M ? 0.4 : 0.3, maximumGradientsCount: k, className: m("kakadu-components-2055737617", s === "secondary" && "kakadu-components-2972748387") }),
|
|
64
|
+
G && /* @__PURE__ */ o.jsx(F, { maximumStarsCount: x, className: "kakadu-components-1226008615" }),
|
|
65
65
|
u ? null : /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
|
|
66
|
-
/* @__PURE__ */ o.jsx(
|
|
67
|
-
/* @__PURE__ */ o.jsx(
|
|
66
|
+
/* @__PURE__ */ o.jsx(W, { size: t ? void 0 : 50 }),
|
|
67
|
+
/* @__PURE__ */ o.jsx(q, { size: t ? void 0 : 50, className: s === "secondary" ? J : void 0 })
|
|
68
68
|
] }),
|
|
69
|
-
|
|
69
|
+
d ? /* @__PURE__ */ o.jsx(K, { id: f, label: d, position: h }) : null
|
|
70
70
|
] }),
|
|
71
|
-
r ? /* @__PURE__ */ o.jsx("div", { className: "kakadu-components-3422055155", children: /* @__PURE__ */ o.jsx(
|
|
71
|
+
r ? /* @__PURE__ */ o.jsx("div", { className: "kakadu-components-3422055155", children: /* @__PURE__ */ o.jsx(Q, { width: "100%", height: "100%", isAnimated: B }) }) : null
|
|
72
72
|
] });
|
|
73
73
|
}
|
|
74
74
|
export {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
Z as buttonSecondaryStyles,
|
|
75
|
+
U as ButtonLoader,
|
|
76
|
+
Z as buttonDangerStyles,
|
|
77
|
+
X as buttonSecondaryStyles,
|
|
79
78
|
ko as buttonSuccessStyles,
|
|
80
|
-
|
|
79
|
+
lo as buttonVariants,
|
|
80
|
+
Y as buttonWarningStyles,
|
|
81
81
|
xo as default
|
|
82
82
|
};
|
package/build/components/card.js
CHANGED
|
@@ -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"),r=require("@kuma-ui/core"),j=require("../theme.js"),a=require("../icons/icon.js"),s=require("./flex.js"),n=require("./text.js"),k=require("./click-ripples.js"),c=require("./hover-gradient.js"),h=require("./button.js"),R=require("./atom.js");function f({icon:o,title:u,description:i,action:l,href:t,target:m,rel:x,className:d,...p}){return e.jsxRuntimeExports.jsxs(R.default,{...p,as:t?"a":"button",type:t?void 0:"button",href:t,target:m,rel:x,className:r.cx(j.effectStyles,h.buttonSecondaryStyles,"kakadu-components-1387630570",d),children:[e.jsxRuntimeExports.jsxs(s.default,{gap:.5,direction:"column",children:[e.jsxRuntimeExports.jsx(n.Span,{className:"kakadu-components-1301774894",children:e.jsxRuntimeExports.jsxs(s.default,{gap:.5,direction:"row",preset:"start",children:[o?e.jsxRuntimeExports.jsx(a.default,{width:16,height:16,type:o,className:r.cx(a.iconShadowStyles,"kakadu-components-782417605")}):null,u]})}),e.jsxRuntimeExports.jsx(n.Paragraph,{className:"kakadu-components-3061837309",children:i}),e.jsxRuntimeExports.jsx(s.default,{preset:"end",children:e.jsxRuntimeExports.jsx(n.Span,{className:"kakadu-components-777975485",children:l})})]}),e.jsxRuntimeExports.jsx(k.default,{size:250,className:"kakadu-components-2967167444"}),e.jsxRuntimeExports.jsx(c.default,{size:300,className:c.normalBlendStyles})]})}exports.default=f;
|
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
import { j as o } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
2
2
|
import { cx as a } from "@kuma-ui/core";
|
|
3
3
|
import { effectStyles as u } from "../theme.mjs";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { Span as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
4
|
+
import x, { iconShadowStyles as k } from "../icons/icon.mjs";
|
|
5
|
+
import e from "./flex.mjs";
|
|
6
|
+
import { Span as r, Paragraph as f } from "./text.mjs";
|
|
7
|
+
import j from "./click-ripples.mjs";
|
|
8
|
+
import h, { normalBlendStyles as y } from "./hover-gradient.mjs";
|
|
9
9
|
import { buttonSecondaryStyles as N } from "./button.mjs";
|
|
10
10
|
import S from "./atom.mjs";
|
|
11
|
-
function
|
|
11
|
+
function F({
|
|
12
12
|
icon: t,
|
|
13
|
-
title:
|
|
14
|
-
description:
|
|
15
|
-
action:
|
|
16
|
-
href:
|
|
13
|
+
title: m,
|
|
14
|
+
description: n,
|
|
15
|
+
action: i,
|
|
16
|
+
href: s,
|
|
17
17
|
target: c,
|
|
18
18
|
rel: p,
|
|
19
|
-
className:
|
|
20
|
-
...
|
|
19
|
+
className: l,
|
|
20
|
+
...d
|
|
21
21
|
}) {
|
|
22
|
-
return /* @__PURE__ */ o.jsxs(S, { ...
|
|
23
|
-
/* @__PURE__ */ o.jsxs(
|
|
24
|
-
/* @__PURE__ */ o.jsx(
|
|
25
|
-
t ? /* @__PURE__ */ o.jsx(
|
|
26
|
-
|
|
22
|
+
return /* @__PURE__ */ o.jsxs(S, { ...d, as: s ? "a" : "button", type: s ? void 0 : "button", href: s, target: c, rel: p, className: a(u, N, "kakadu-components-1387630570", l), children: [
|
|
23
|
+
/* @__PURE__ */ o.jsxs(e, { gap: 0.5, direction: "column", children: [
|
|
24
|
+
/* @__PURE__ */ o.jsx(r, { className: "kakadu-components-1301774894", children: /* @__PURE__ */ o.jsxs(e, { gap: 0.5, direction: "row", preset: "start", children: [
|
|
25
|
+
t ? /* @__PURE__ */ o.jsx(x, { width: 16, height: 16, type: t, className: a(k, "kakadu-components-782417605") }) : null,
|
|
26
|
+
m
|
|
27
27
|
] }) }),
|
|
28
|
-
/* @__PURE__ */ o.jsx(
|
|
29
|
-
/* @__PURE__ */ o.jsx(
|
|
28
|
+
/* @__PURE__ */ o.jsx(f, { className: "kakadu-components-3061837309", children: n }),
|
|
29
|
+
/* @__PURE__ */ o.jsx(e, { preset: "end", children: /* @__PURE__ */ o.jsx(r, { className: "kakadu-components-777975485", children: i }) })
|
|
30
30
|
] }),
|
|
31
|
-
/* @__PURE__ */ o.jsx(
|
|
32
|
-
/* @__PURE__ */ o.jsx(
|
|
31
|
+
/* @__PURE__ */ o.jsx(j, { size: 250, className: "kakadu-components-2967167444" }),
|
|
32
|
+
/* @__PURE__ */ o.jsx(h, { size: 300, className: y })
|
|
33
33
|
] });
|
|
34
34
|
}
|
|
35
35
|
export {
|
|
36
|
-
|
|
36
|
+
F as default
|
|
37
37
|
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type ChangeEvent, type HTMLProps, type ReactNode } from 'react';
|
|
2
|
+
import { type InputType, type InputLabelControllerProperties } from './input';
|
|
3
|
+
export type ComboboxOption<Type> = {
|
|
4
|
+
readonly value: Type;
|
|
5
|
+
} & ({
|
|
6
|
+
readonly label: string;
|
|
7
|
+
} | {
|
|
8
|
+
readonly text: string;
|
|
9
|
+
readonly label: ReactNode;
|
|
10
|
+
});
|
|
11
|
+
export declare function getComboboxOptionString<Type>(option: ComboboxOption<Type>): string;
|
|
12
|
+
export type ComboboxOptionsItemProperties<Type> = ComboboxOption<Type> & {
|
|
13
|
+
readonly id?: string;
|
|
14
|
+
readonly isSelected?: boolean;
|
|
15
|
+
readonly onSelect: (value: Type) => void;
|
|
16
|
+
readonly onHover: (value: Type) => void;
|
|
17
|
+
};
|
|
18
|
+
export type ComboboxProperties<Type> = Omit<InputLabelControllerProperties & HTMLProps<HTMLInputElement>, 'onChange' | 'onSelect' | 'value'> & {
|
|
19
|
+
readonly isLoading?: boolean;
|
|
20
|
+
readonly value?: Type;
|
|
21
|
+
readonly options: Array<ComboboxOption<Type>>;
|
|
22
|
+
readonly onChange?: (value: string, event?: ChangeEvent<InputType>) => void;
|
|
23
|
+
readonly onSelect?: (value?: Type) => void;
|
|
24
|
+
};
|
|
25
|
+
export default function Combobox<Type>({ isLoading, label, options, error, warning, information, footnote, className, onChange, onSelect, ...properties }: ComboboxProperties<Type>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const I=require("../jsx-runtime-BB_1_6y_.js"),o=require("react"),P=require("../focus-trap-react-CkKg4ubd.js"),U=require("@kuma-ui/core"),oe=require("../use-synchronized-value-D0_rS5Wp.js"),re=require("../icons/icon.js"),ce=require("./input.js"),K=require("./text.js"),X=require("./flex.js"),ae=require("./skeleton.js");var z={exports:{}};const M=new Uint32Array(65536),ie=(t,a)=>{const r=t.length,p=a.length,i=1<<r-1;let l=-1,d=0,x=r,n=r;for(;n--;)M[t.charCodeAt(n)]|=1<<n;for(n=0;n<p;n++){let m=M[a.charCodeAt(n)];const h=m|d;m|=(m&l)+l^l,d|=~(m|l),l&=m,d&i&&x++,l&i&&x--,d=d<<1|1,l=l<<1|~(h|d),d&=h}for(n=r;n--;)M[t.charCodeAt(n)]=0;return x},le=(t,a)=>{const r=a.length,p=t.length,i=[],l=[],d=Math.ceil(r/32),x=Math.ceil(p/32);for(let e=0;e<d;e++)l[e]=-1,i[e]=0;let n=0;for(;n<x-1;n++){let e=0,u=-1;const b=n*32,g=Math.min(32,p)+b;for(let s=b;s<g;s++)M[t.charCodeAt(s)]|=1<<s;for(let s=0;s<r;s++){const v=M[a.charCodeAt(s)],k=l[s/32|0]>>>s&1,w=i[s/32|0]>>>s&1,N=v|e,E=((v|w)&u)+u^u|v|w;let O=e|~(E|u),A=u&E;O>>>31^k&&(l[s/32|0]^=1<<s),A>>>31^w&&(i[s/32|0]^=1<<s),O=O<<1|k,A=A<<1|w,u=A|~(N|O),e=O&N}for(let s=b;s<g;s++)M[t.charCodeAt(s)]=0}let m=0,h=-1;const R=n*32,C=Math.min(32,p-R)+R;for(let e=R;e<C;e++)M[t.charCodeAt(e)]|=1<<e;let q=p;for(let e=0;e<r;e++){const u=M[a.charCodeAt(e)],b=l[e/32|0]>>>e&1,g=i[e/32|0]>>>e&1,s=u|m,v=((u|g)&h)+h^h|u|g;let k=m|~(v|h),w=h&v;q+=k>>>p-1&1,q-=w>>>p-1&1,k>>>31^b&&(l[e/32|0]^=1<<e),w>>>31^g&&(i[e/32|0]^=1<<e),k=k<<1|b,w=w<<1|g,h=w|~(s|k),m=k&s}for(let e=R;e<C;e++)M[t.charCodeAt(e)]=0;return q},G=(t,a)=>{if(t.length<a.length){const r=a;a=t,t=r}return a.length===0?t.length:t.length<=32?ie(t,a):le(t,a)},ue=(t,a)=>{let r=1/0,p=0;for(let i=0;i<a.length;i++){const l=G(t,a[i]);l<r&&(r=l,p=i)}return a[p]},fe=Object.freeze(Object.defineProperty({__proto__:null,closest:ue,distance:G},Symbol.toStringTag,{value:"Module"})),de=P.getAugmentedNamespace(fe);var Y;function me(){return Y||(Y=1,(function(t,a){(function(){var r;try{r=typeof Intl<"u"&&typeof Intl.Collator<"u"?Intl.Collator("generic",{sensitivity:"base"}):null}catch{console.log("Collator could not be initialized and wouldn't be used")}var p=de,i=[],l=[],d={get:function(x,n,m){var h=m&&r&&m.useCollator;if(h){var R=x.length,C=n.length;if(R===0)return C;if(C===0)return R;var q,e,u,b,g;for(u=0;u<C;++u)i[u]=u,l[u]=n.charCodeAt(u);i[C]=C;var s;for(u=0;u<R;++u){for(e=u+1,b=0;b<C;++b)q=e,s=r.compare(x.charAt(u),String.fromCharCode(l[b]))===0,e=i[b]+(s?0:1),g=q+1,e>g&&(e=g),g=i[b+1]+1,e>g&&(e=g),i[b]=q;i[b]=e}return e}return p.distance(x,n)}};t!==null&&t.exports===a?t.exports=d:typeof self<"u"&&typeof self.postMessage=="function"&&typeof self.importScripts=="function"?self.Levenshtein=d:typeof window<"u"&&window!==null&&(window.Levenshtein=d)})()})(z,z.exports)),z.exports}var pe=me();const he=P.getDefaultExportFromCjs(pe);function J(){const{value:t,setValue:a}=oe.useSynchronizedValue("isKeyboardNavigating");return o.useMemo(()=>({isKeyboardNavigating:t,setIsKeyboardNavigating:a}),[t,a])}function F(t){return"text"in t?t.text:t.label}const $="kakadu-components-1144794361",B="kakadu-components-2911184744";function ve({isSelected:t,id:a,value:r,label:p,onSelect:i,onHover:l}){const{isKeyboardNavigating:d}=J(),x=o.useCallback(()=>{i(r)},[i,r]),n=o.useCallback(h=>{d||h.movementX===0&&h.movementY===0||l(r)},[d,l,r]),m=o.useRef(null);return o.useEffect(()=>{const h=m.current;t&&h&&d&&setTimeout(()=>{h.scrollIntoView({behavior:"smooth",block:"nearest"})},0)},[t,d]),I.jsxRuntimeExports.jsx("li",{ref:m,id:a,role:"option","aria-selected":t,tabIndex:-1,className:U.cx($,"kakadu-components-4130497639",d?"kakadu-components-962373561":"kakadu-components-1109598791"),onClick:x,onMouseMove:n,children:I.jsxRuntimeExports.jsx(K.Span,{className:U.cx(B,typeof p=="string"&&"kakadu-components-154286052"),children:p})})}function xe({isLoading:t,id:a,activeOptionId:r,selectedValue:p,options:i,onSelect:l,onHover:d}){const x=o.useRef(null);return o.useEffect(()=>{const n=x.current;n&&n.scrollIntoView({behavior:"smooth",block:"nearest"})},[]),I.jsxRuntimeExports.jsxs("ul",{ref:x,id:a,role:"listbox","aria-label":"Options",className:"kakadu-components-970856892",children:[i.length===0?t?null:I.jsxRuntimeExports.jsxs(X.default,{"aria-atomic":!0,as:"li",role:"status","aria-live":"polite",direction:"row",preset:"start",gap:.5,className:$,children:[I.jsxRuntimeExports.jsx(re.default,{size:15,type:"exclamationTriangle"}),I.jsxRuntimeExports.jsx(K.Span,{className:B,children:"No results."})]}):i.map((n,m)=>I.jsxRuntimeExports.jsx(ve,{...n,id:n.value===p?r:void 0,isSelected:n.value===p,onSelect:l,onHover:d},F(n)+m)),t?I.jsxRuntimeExports.jsx(X.default,{as:"li",alignment:"center",className:$,children:I.jsxRuntimeExports.jsx(K.Span,{className:B,children:I.jsxRuntimeExports.jsx(ae.SkeletonInstance,{width:"100%",height:"1.3em"})})}):null]})}function be({isLoading:t,label:a,options:r,error:p,warning:i,information:l,footnote:d,className:x,onChange:n,onSelect:m,...h}){const R=o.useRef(null),C=o.useId(),q=o.useId(),[e,u]=o.useState(!1),b=o.useCallback(()=>{u(!0)},[]),g=o.useCallback(c=>{var f;(f=R.current)!=null&&f.contains(c.relatedTarget)||u(!1)},[]),[s,v]=o.useState(!1);o.useEffect(()=>{v(e)},[e]);const[k,w]=o.useState(""),{value:N}=h,[E,O]=o.useState(N),[A,Q]=o.useState(N),H=o.useRef(A),j=o.useCallback(c=>{Q(c),H.current=c},[]);o.useEffect(()=>{O(N),j(N)},[N,j]);const W=o.useCallback(()=>{E&&(w(""),j(void 0))},[E,j]),Z=o.useCallback((c,f)=>{w(c),n==null||n(c,f),v(!0),O(void 0)},[n]),ee=o.useCallback(c=>{var f;(f=R.current)!=null&&f.contains(c.target)&&v(!0)},[]),T=o.useCallback(c=>{const f=c==null?void 0:c.value;j(f),c?w(F(c)):(w(""),n==null||n("")),m==null||m(f)},[j,n,m]),te=o.useCallback(c=>{const f=r.find(y=>y.value===c);T(f),O(c),v(!1)},[r,T]),ne=o.useCallback(c=>{j(c)},[j]),S=o.useMemo(()=>E||k.length===0?r:r.filter(c=>{const y=F(c).toLowerCase(),_=k.toLowerCase();return!!(y.includes(_)||_.includes(y)||he.get(y,_,{useCollator:!0})<=2)}),[E,r,k]);o.useEffect(()=>{!E&&k.length>0&&S.length>0&&!S.some(c=>A===c.value)&&j(S[0].value)},[E,k,S,A,j]);const{setIsKeyboardNavigating:D}=J();o.useEffect(()=>{if(!e)return;const c=f=>{f.movementX===0&&f.movementY===0||D(!1)};return window.addEventListener("mousemove",c,{capture:!0}),()=>{window.removeEventListener("mousemove",c,{capture:!0})}},[e,D]),o.useEffect(()=>{if(!e)return;const c=f=>{let y;const _=S.length,L=S.findIndex(V=>V.value===H.current);switch(f.key){case"Enter":{const V=S[L];V&&(f.preventDefault(),f.stopPropagation(),D(!0),v(!1),T(V),O(V.value));break}case"Escape":{s?(E?j(void 0):T(void 0),v(!1)):E?(v(!0),T(void 0)):(u(!1),f.target instanceof HTMLInputElement&&f.target.blur());return}case"ArrowDown":{y=L+1,v(!0);break}case"ArrowUp":{y=L-1,v(!0),y<0&&(y=_-1);break}case"Home":{v(!0),y=0;break}case"End":{v(!0),y=_-1;break}case"Backspace":{S.some(V=>V.value===E)&&(f.preventDefault(),f.stopPropagation(),T(void 0),v(!0));break}}if(y!==void 0&&(f.preventDefault(),f.stopPropagation(),D(!0),_>0)){const V=S[y%_];V&&j(V.value)}};return window.addEventListener("keydown",c,{capture:!0}),()=>{window.removeEventListener("keydown",c,{capture:!0})}},[e,S,D,v,T,O,s,E,j]);const se=o.useMemo(()=>({clickOutsideDeactivates:!0}),[]);return I.jsxRuntimeExports.jsx(P.focusTrapReactExports.FocusTrap,{active:s,focusTrapOptions:se,children:I.jsxRuntimeExports.jsx(ce.default,{...h,ref:R,role:"combobox",autoComplete:"off","aria-controls":C,"aria-expanded":s,"aria-activedescendant":s?q:void 0,label:a,value:k,error:p,warning:i,information:l,footnote:d,attachments:s?I.jsxRuntimeExports.jsx(xe,{isLoading:t,id:C,activeOptionId:q,selectedValue:A,options:S,onSelect:te,onHover:ne}):null,className:x,onMouseDown:ee,onChange:Z,onBeforeInput:W,onFocus:b,onBlur:g})})}exports.default=be;exports.getComboboxOptionString=F;
|