@kakadu/components 6.2.0 → 6.3.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/click-ripples.js +1 -1
- package/build/components/click-ripples.mjs +50 -45
- package/build/components/combobox.js +1 -1
- package/build/components/combobox.mjs +161 -159
- package/build/components/hover-gradient.js +1 -1
- package/build/components/hover-gradient.mjs +49 -42
- package/build/components/modal.js +1 -1
- package/build/components/modal.mjs +86 -85
- package/build/components/moving-gradients.js +1 -1
- package/build/components/moving-gradients.mjs +80 -70
- package/build/components/moving-stars.js +1 -1
- package/build/components/moving-stars.mjs +77 -74
- package/build/components/notification.js +1 -1
- package/build/components/notification.mjs +2 -2
- package/build/components/popover-menu.js +1 -1
- package/build/components/popover-menu.mjs +131 -129
- package/build/components/popover.js +1 -1
- package/build/components/popover.mjs +82 -73
- package/build/hooks/use-is-document-focused.js +1 -1
- package/build/hooks/use-is-document-focused.mjs +30 -14
- package/build/index.d.ts +2 -0
- package/build/index.js +1 -1
- package/build/index.mjs +19 -17
- package/build/utilities/listeners.d.ts +5 -0
- package/build/utilities/listeners.js +1 -0
- package/build/utilities/listeners.mjs +16 -0
- package/package.json +1 -1
|
@@ -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 f=require("../jsx-runtime-BB_1_6y_.js"),r=require("react"),R=require("@kuma-ui/core"),v=require("../hooks/use-is-in-view.js"),q=require("../utilities/listeners.js");function y({id:e,x:o,y:u,onEnd:i}){return r.useEffect(()=>{const n=setTimeout(()=>{i(e)},370);return()=>{clearTimeout(n)}},[i,e]),f.jsxRuntimeExports.jsx("div",{style:{top:u,left:o},className:"kakadu-components-3828473824"})}const b=q.default(e=>{window.addEventListener("pointerdown",e,{passive:!0})},e=>{window.removeEventListener("pointerdown",e)});function g({isActive:e=!0,size:o=150,className:u,...i}){const n=r.useRef(null),c=v.default(n),[x,l]=r.useState([]);r.useEffect(()=>{if(!e||!c){l([]);return}return b(t=>{if(n.current){const a=n.current.getBoundingClientRect(),{clientX:s,clientY:d}=t,{left:m,right:j,top:p,bottom:k}=a;s>m&&s<j&&d>p&&d<k&&l(E=>[...E,{id:Date.now()+Math.random()*1e3,x:s-m,y:d-p}])}})},[e,c]);const w=r.useCallback(t=>{l(a=>a.filter(s=>s.id!==t))},[]);return f.jsxRuntimeExports.jsx("div",{...i,ref:n,style:{"--size":`${o}px`},className:R.cx("kakadu-components-4189236582",u),children:c?x.map(t=>f.jsxRuntimeExports.jsx(y,{id:t.id,x:t.x,y:t.y,onEnd:w},t.id)):null})}exports.default=g;
|
|
@@ -1,65 +1,70 @@
|
|
|
1
1
|
import { j as m } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { cx as
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import { useRef as y, useState as E, useEffect as p, useCallback as R } from "react";
|
|
3
|
+
import { cx as h } from "@kuma-ui/core";
|
|
4
|
+
import C from "../hooks/use-is-in-view.mjs";
|
|
5
|
+
import L from "../utilities/listeners.mjs";
|
|
6
|
+
function b({
|
|
7
|
+
id: e,
|
|
8
|
+
x: s,
|
|
9
|
+
y: i,
|
|
9
10
|
onEnd: o
|
|
10
11
|
}) {
|
|
11
|
-
return
|
|
12
|
-
const
|
|
13
|
-
o(
|
|
12
|
+
return p(() => {
|
|
13
|
+
const n = setTimeout(() => {
|
|
14
|
+
o(e);
|
|
14
15
|
}, 370);
|
|
15
16
|
return () => {
|
|
16
|
-
clearTimeout(
|
|
17
|
+
clearTimeout(n);
|
|
17
18
|
};
|
|
18
|
-
}, [o,
|
|
19
|
-
top:
|
|
20
|
-
left:
|
|
19
|
+
}, [o, e]), /* @__PURE__ */ m.jsx("div", { style: {
|
|
20
|
+
top: i,
|
|
21
|
+
left: s
|
|
21
22
|
}, className: "kakadu-components-3828473824" });
|
|
22
23
|
}
|
|
24
|
+
const g = L((e) => {
|
|
25
|
+
window.addEventListener("pointerdown", e, {
|
|
26
|
+
passive: !0
|
|
27
|
+
});
|
|
28
|
+
}, (e) => {
|
|
29
|
+
window.removeEventListener("pointerdown", e);
|
|
30
|
+
});
|
|
23
31
|
function V({
|
|
24
|
-
isActive:
|
|
25
|
-
size:
|
|
26
|
-
className:
|
|
32
|
+
isActive: e = !0,
|
|
33
|
+
size: s = 150,
|
|
34
|
+
className: i,
|
|
27
35
|
...o
|
|
28
36
|
}) {
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
if (!
|
|
32
|
-
|
|
37
|
+
const n = y(null), c = C(n), [x, u] = E([]);
|
|
38
|
+
p(() => {
|
|
39
|
+
if (!e || !c) {
|
|
40
|
+
u([]);
|
|
33
41
|
return;
|
|
34
42
|
}
|
|
35
|
-
|
|
36
|
-
if (
|
|
37
|
-
const
|
|
38
|
-
clientX:
|
|
39
|
-
clientY:
|
|
40
|
-
} =
|
|
41
|
-
left:
|
|
42
|
-
right:
|
|
43
|
-
top:
|
|
44
|
-
bottom:
|
|
45
|
-
} =
|
|
46
|
-
|
|
43
|
+
return g((t) => {
|
|
44
|
+
if (n.current) {
|
|
45
|
+
const a = n.current.getBoundingClientRect(), {
|
|
46
|
+
clientX: r,
|
|
47
|
+
clientY: l
|
|
48
|
+
} = t, {
|
|
49
|
+
left: d,
|
|
50
|
+
right: k,
|
|
51
|
+
top: f,
|
|
52
|
+
bottom: j
|
|
53
|
+
} = a;
|
|
54
|
+
r > d && r < k && l > f && l < j && u((v) => [...v, {
|
|
47
55
|
id: Date.now() + Math.random() * 1e3,
|
|
48
|
-
x:
|
|
49
|
-
y:
|
|
56
|
+
x: r - d,
|
|
57
|
+
y: l - f
|
|
50
58
|
}]);
|
|
51
59
|
}
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}, [n, i]);
|
|
57
|
-
const k = v((e) => {
|
|
58
|
-
c((u) => u.filter((l) => l.id !== e));
|
|
60
|
+
});
|
|
61
|
+
}, [e, c]);
|
|
62
|
+
const w = R((t) => {
|
|
63
|
+
u((a) => a.filter((r) => r.id !== t));
|
|
59
64
|
}, []);
|
|
60
|
-
return /* @__PURE__ */ m.jsx("div", { ...o, ref:
|
|
61
|
-
"--size": `${
|
|
62
|
-
}, className:
|
|
65
|
+
return /* @__PURE__ */ m.jsx("div", { ...o, ref: n, style: {
|
|
66
|
+
"--size": `${s}px`
|
|
67
|
+
}, className: h("kakadu-components-4189236582", i), children: c ? x.map((t) => /* @__PURE__ */ m.jsx(b, { id: t.id, x: t.x, y: t.y, onEnd: w }, t.id)) : null });
|
|
63
68
|
}
|
|
64
69
|
export {
|
|
65
70
|
V as default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("../jsx-runtime-BB_1_6y_.js"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("../jsx-runtime-BB_1_6y_.js"),t=require("react"),_=require("@kuma-ui/core"),se=require("../hooks/use-synchronized-value.js"),ne=require("../icons/icon.js"),oe=require("../icons/chevron-up.js"),ae=require("../utilities/search.js"),X=require("../utilities/listeners.js"),re=require("./input.js"),K=require("./text.js"),U=require("./flex.js"),ue=require("./skeleton.js"),ce=X.default(s=>{window.addEventListener("mousemove",s,{capture:!0})},s=>{window.removeEventListener("mousemove",s,{capture:!0})}),ie=X.default(s=>{window.addEventListener("keydown",s,{capture:!0})},s=>{window.removeEventListener("keydown",s,{capture:!0})});function Y(){const{value:s,setValue:x}=se.default("isKeyboardNavigating");return t.useMemo(()=>({isKeyboardNavigating:s,setIsKeyboardNavigating:x}),[s,x])}function O(s){return"text"in s?s.text:s.label}const B="kakadu-components-1144794361",D="kakadu-components-2911184744";function le({isSelected:s,id:x,value:b,label:a,onSelect:k,onHover:E}){const{isKeyboardNavigating:p}=Y(),j=t.useCallback(()=>{k(b)},[k,b]),l=t.useCallback(f=>{p||f.movementX===0&&f.movementY===0||E(b)},[p,E,b]),r=t.useRef(null);return t.useEffect(()=>{const f=r.current;s&&f&&p&&setTimeout(()=>{f.scrollIntoView({behavior:"smooth",block:"nearest"})},0)},[s,p]),i.jsxRuntimeExports.jsx("li",{ref:r,id:x,role:"option","aria-selected":s,tabIndex:-1,className:_.cx(B,"kakadu-components-4130497639",p?"kakadu-components-962373561":"kakadu-components-1109598791"),onClick:j,onMouseMove:l,children:i.jsxRuntimeExports.jsx(K.Span,{className:_.cx(D,typeof a=="string"&&"kakadu-components-154286052"),children:a})})}function de({isLoading:s,id:x,activeOptionId:b,selectedValue:a,options:k,onSelect:E,onHover:p}){const j=t.useRef(null);return t.useEffect(()=>{const l=j.current;l&&l.scrollIntoView({behavior:"smooth",block:"nearest"})},[]),i.jsxRuntimeExports.jsxs("ul",{ref:j,id:x,role:"listbox","aria-label":"Options",tabIndex:-1,className:"kakadu-components-3718330689",children:[k.length===0?s?null:i.jsxRuntimeExports.jsxs(U.default,{"aria-atomic":!0,as:"li",role:"status","aria-live":"polite",direction:"row",preset:"start",gap:.5,className:B,children:[i.jsxRuntimeExports.jsx(ne.default,{size:15,type:"exclamationTriangle"}),i.jsxRuntimeExports.jsx(K.Span,{className:D,children:"No results."})]}):k.map((l,r)=>i.jsxRuntimeExports.jsx(le,{...l,id:l.value===a?b:void 0,isSelected:l.value===a,onSelect:E,onHover:p},O(l)+r)),s?i.jsxRuntimeExports.jsx(U.default,{as:"li",alignment:"center",className:B,children:i.jsxRuntimeExports.jsx(K.Span,{className:_.cx(D,"kakadu-components-2015848015"),children:i.jsxRuntimeExports.jsx(ue.SkeletonInstance,{width:"100%",height:"1.3em"})})}):null]})}function fe({isLoading:s,shouldFilterOptions:x=!0,label:b,options:a,error:k,warning:E,information:p,footnote:j,className:l,onChange:r,onSelect:f,...T}){const S=t.useRef(null),F=t.useId(),H=t.useId(),[g,C]=t.useState(!1),$=t.useCallback(()=>{C(!0)},[]),G=t.useCallback(e=>{var n;(n=S.current)!=null&&n.contains(e.relatedTarget)||C(!1)},[]),[y,u]=t.useState(!1);t.useEffect(()=>{u(g)},[g]);const[P,w]=t.useState(""),{value:v}=T,[m,N]=t.useState(v),[q,J]=t.useState(v),A=t.useRef(q),c=t.useCallback(e=>{J(e),A.current=e},[]);t.useEffect(()=>{N(v),c(v)},[v,c]),t.useEffect(()=>{const e=a.find(n=>n.value===v);e?w(O(e)):v===void 0&&w("")},[a,v]);const Q=t.useCallback(()=>{m&&(w(""),c(void 0))},[m,c]),W=t.useCallback((e,n)=>{w(e),r==null||r(e,n),u(!0),N(void 0)},[r]),Z=t.useCallback(e=>{var n;(n=S.current)!=null&&n.contains(e.target)&&u(!0)},[]),h=t.useCallback(e=>{const n=e==null?void 0:e.value;c(n),e?w(O(e)):(w(""),r==null||r("")),f==null||f(n)},[c,r,f]),ee=t.useCallback(e=>{const n=a.find(I=>I.value===e);h(n),N(e),u(!1)},[a,h]),te=t.useCallback(e=>{c(e)},[c]),M=t.useDeferredValue(P),d=t.useMemo(()=>!x||m?a:ae.default(M,a,O),[x,m,a,M]);t.useEffect(()=>{!m&&M.length>0&&d.length>0&&!d.some(e=>q===e.value)&&c(d[0].value)},[m,M,d,q,c]);const{setIsKeyboardNavigating:V}=Y();return t.useEffect(()=>{if(g)return ce(e=>{e.movementX===0&&e.movementY===0||V(!1)})},[g,V]),t.useEffect(()=>{if(g)return ie(e=>{var z;let n;const I=d.length,L=d.findIndex(o=>o.value===A.current),R=()=>{e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation()};switch(e.key){case"Enter":{const o=d[L];o&&(R(),V(!0),u(!1),h(o),N(o.value));break}case"Escape":{if(y)R(),m?c(void 0):h(void 0),u(!1);else if(m)R(),u(!0),h(void 0);else{R(),C(!1);const o=document.activeElement;o instanceof HTMLElement&&((z=S.current)!=null&&z.contains(o))&&o.blur()}return}case"ArrowDown":{n=L+1,u(!0);break}case"ArrowUp":{n=L-1,u(!0),n<0&&(n=I-1);break}case"Home":{u(!0),n=0;break}case"End":{u(!0),n=I-1;break}case"Backspace":{d.some(o=>o.value===m)&&(R(),h(void 0),u(!0));break}}if(n!==void 0&&(R(),V(!0),I>0)){const o=d[n%I];o&&c(o.value)}})},[g,d,V,u,h,N,y,m,c]),i.jsxRuntimeExports.jsx(re.default,{...T,ref:S,role:"combobox",autoComplete:"off","aria-controls":F,"aria-expanded":y,"aria-activedescendant":y?H:void 0,label:b,value:P,error:k,warning:E,information:p,footnote:j,attachments:y?i.jsxRuntimeExports.jsx(de,{isLoading:s,id:F,activeOptionId:H,selectedValue:q,options:d,onSelect:ee,onHover:te}):null,className:_.cx(l,"kakadu-components-879486679"),onMouseDown:Z,onChange:W,onBeforeInput:Q,onFocus:$,onBlur:G,children:i.jsxRuntimeExports.jsx(oe.default,{width:14,height:14,className:"kakadu-components-158931186"})})}exports.default=fe;exports.getComboboxOptionString=O;
|
|
@@ -1,219 +1,221 @@
|
|
|
1
1
|
import { j as i } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { cx as
|
|
2
|
+
import { useRef as F, useId as J, useState as M, useCallback as m, useEffect as x, useDeferredValue as ce, useMemo as W } from "react";
|
|
3
|
+
import { cx as H } from "@kuma-ui/core";
|
|
4
4
|
import ie from "../hooks/use-synchronized-value.mjs";
|
|
5
5
|
import le from "../icons/icon.mjs";
|
|
6
6
|
import ue from "../icons/chevron-up.mjs";
|
|
7
7
|
import me from "../utilities/search.mjs";
|
|
8
|
+
import Z from "../utilities/listeners.mjs";
|
|
8
9
|
import de from "./input.mjs";
|
|
9
|
-
import { Span as
|
|
10
|
-
import
|
|
10
|
+
import { Span as P } from "./text.mjs";
|
|
11
|
+
import Q from "./flex.mjs";
|
|
11
12
|
import { SkeletonInstance as fe } from "./skeleton.mjs";
|
|
13
|
+
const pe = Z((t) => {
|
|
14
|
+
window.addEventListener("mousemove", t, {
|
|
15
|
+
capture: !0
|
|
16
|
+
});
|
|
17
|
+
}, (t) => {
|
|
18
|
+
window.removeEventListener("mousemove", t, {
|
|
19
|
+
capture: !0
|
|
20
|
+
});
|
|
21
|
+
}), ve = Z((t) => {
|
|
22
|
+
window.addEventListener("keydown", t, {
|
|
23
|
+
capture: !0
|
|
24
|
+
});
|
|
25
|
+
}, (t) => {
|
|
26
|
+
window.removeEventListener("keydown", t, {
|
|
27
|
+
capture: !0
|
|
28
|
+
});
|
|
29
|
+
});
|
|
12
30
|
function _() {
|
|
13
31
|
const {
|
|
14
|
-
value:
|
|
15
|
-
setValue:
|
|
32
|
+
value: t,
|
|
33
|
+
setValue: p
|
|
16
34
|
} = ie("isKeyboardNavigating");
|
|
17
|
-
return
|
|
18
|
-
isKeyboardNavigating:
|
|
19
|
-
setIsKeyboardNavigating:
|
|
20
|
-
}), [
|
|
35
|
+
return W(() => ({
|
|
36
|
+
isKeyboardNavigating: t,
|
|
37
|
+
setIsKeyboardNavigating: p
|
|
38
|
+
}), [t, p]);
|
|
21
39
|
}
|
|
22
|
-
function
|
|
23
|
-
return "text" in
|
|
40
|
+
function D(t) {
|
|
41
|
+
return "text" in t ? t.text : t.label;
|
|
24
42
|
}
|
|
25
|
-
const
|
|
26
|
-
function
|
|
27
|
-
isSelected:
|
|
28
|
-
id:
|
|
29
|
-
value:
|
|
43
|
+
const R = "kakadu-components-1144794361", z = "kakadu-components-2911184744";
|
|
44
|
+
function be({
|
|
45
|
+
isSelected: t,
|
|
46
|
+
id: p,
|
|
47
|
+
value: b,
|
|
30
48
|
label: o,
|
|
31
|
-
onSelect:
|
|
32
|
-
onHover:
|
|
49
|
+
onSelect: h,
|
|
50
|
+
onHover: I
|
|
33
51
|
}) {
|
|
34
52
|
const {
|
|
35
|
-
isKeyboardNavigating:
|
|
36
|
-
} = _(),
|
|
37
|
-
|
|
38
|
-
}, [
|
|
39
|
-
|
|
40
|
-
}, [
|
|
41
|
-
return
|
|
53
|
+
isKeyboardNavigating: v
|
|
54
|
+
} = _(), g = m(() => {
|
|
55
|
+
h(b);
|
|
56
|
+
}, [h, b]), l = m((d) => {
|
|
57
|
+
v || d.movementX === 0 && d.movementY === 0 || I(b);
|
|
58
|
+
}, [v, I, b]), r = F(null);
|
|
59
|
+
return x(() => {
|
|
42
60
|
const d = r.current;
|
|
43
|
-
|
|
61
|
+
t && d && v && setTimeout(() => {
|
|
44
62
|
d.scrollIntoView({
|
|
45
63
|
behavior: "smooth",
|
|
46
64
|
block: "nearest"
|
|
47
65
|
});
|
|
48
66
|
}, 0);
|
|
49
|
-
}, [
|
|
67
|
+
}, [t, v]), /* @__PURE__ */ i.jsx("li", { ref: r, id: p, role: "option", "aria-selected": t, tabIndex: -1, className: H(R, "kakadu-components-4130497639", v ? "kakadu-components-962373561" : "kakadu-components-1109598791"), onClick: g, onMouseMove: l, children: /* @__PURE__ */ i.jsx(P, { className: H(z, typeof o == "string" && "kakadu-components-154286052"), children: o }) });
|
|
50
68
|
}
|
|
51
|
-
function
|
|
52
|
-
isLoading:
|
|
53
|
-
id:
|
|
54
|
-
activeOptionId:
|
|
69
|
+
function ke({
|
|
70
|
+
isLoading: t,
|
|
71
|
+
id: p,
|
|
72
|
+
activeOptionId: b,
|
|
55
73
|
selectedValue: o,
|
|
56
|
-
options:
|
|
57
|
-
onSelect:
|
|
58
|
-
onHover:
|
|
74
|
+
options: h,
|
|
75
|
+
onSelect: I,
|
|
76
|
+
onHover: v
|
|
59
77
|
}) {
|
|
60
|
-
const
|
|
61
|
-
return
|
|
62
|
-
const l =
|
|
78
|
+
const g = F(null);
|
|
79
|
+
return x(() => {
|
|
80
|
+
const l = g.current;
|
|
63
81
|
l && l.scrollIntoView({
|
|
64
82
|
behavior: "smooth",
|
|
65
83
|
block: "nearest"
|
|
66
84
|
});
|
|
67
|
-
}, []), /* @__PURE__ */ i.jsxs("ul", { ref:
|
|
68
|
-
|
|
85
|
+
}, []), /* @__PURE__ */ i.jsxs("ul", { ref: g, id: p, role: "listbox", "aria-label": "Options", tabIndex: -1, className: "kakadu-components-3718330689", children: [
|
|
86
|
+
h.length === 0 ? t ? null : /* @__PURE__ */ i.jsxs(Q, { "aria-atomic": !0, as: "li", role: "status", "aria-live": "polite", direction: "row", preset: "start", gap: 0.5, className: R, children: [
|
|
69
87
|
/* @__PURE__ */ i.jsx(le, { size: 15, type: "exclamationTriangle" }),
|
|
70
|
-
/* @__PURE__ */ i.jsx(
|
|
71
|
-
] }) :
|
|
72
|
-
|
|
88
|
+
/* @__PURE__ */ i.jsx(P, { className: z, children: "No results." })
|
|
89
|
+
] }) : h.map((l, r) => /* @__PURE__ */ i.jsx(
|
|
90
|
+
be,
|
|
73
91
|
{
|
|
74
92
|
...l,
|
|
75
|
-
id: l.value === o ?
|
|
93
|
+
id: l.value === o ? b : void 0,
|
|
76
94
|
isSelected: l.value === o,
|
|
77
|
-
onSelect:
|
|
78
|
-
onHover:
|
|
95
|
+
onSelect: I,
|
|
96
|
+
onHover: v
|
|
79
97
|
},
|
|
80
|
-
|
|
98
|
+
D(l) + r
|
|
81
99
|
)),
|
|
82
|
-
|
|
100
|
+
t ? /* @__PURE__ */ i.jsx(Q, { as: "li", alignment: "center", className: R, children: /* @__PURE__ */ i.jsx(P, { className: H(z, "kakadu-components-2015848015"), children: /* @__PURE__ */ i.jsx(fe, { width: "100%", height: "1.3em" }) }) }) : null
|
|
83
101
|
] });
|
|
84
102
|
}
|
|
85
|
-
function
|
|
86
|
-
isLoading:
|
|
87
|
-
shouldFilterOptions:
|
|
88
|
-
label:
|
|
103
|
+
function Me({
|
|
104
|
+
isLoading: t,
|
|
105
|
+
shouldFilterOptions: p = !0,
|
|
106
|
+
label: b,
|
|
89
107
|
options: o,
|
|
90
|
-
error:
|
|
91
|
-
warning:
|
|
92
|
-
information:
|
|
93
|
-
footnote:
|
|
108
|
+
error: h,
|
|
109
|
+
warning: I,
|
|
110
|
+
information: v,
|
|
111
|
+
footnote: g,
|
|
94
112
|
className: l,
|
|
95
113
|
onChange: r,
|
|
96
114
|
onSelect: d,
|
|
97
|
-
...
|
|
115
|
+
...U
|
|
98
116
|
}) {
|
|
99
|
-
const
|
|
100
|
-
|
|
117
|
+
const K = F(null), X = J(), Y = J(), [N, T] = M(!1), $ = m(() => {
|
|
118
|
+
T(!0);
|
|
101
119
|
}, []), ee = m((e) => {
|
|
102
|
-
var
|
|
103
|
-
(
|
|
104
|
-
}, []), [O, a] =
|
|
105
|
-
|
|
106
|
-
a(
|
|
107
|
-
}, [
|
|
108
|
-
const [
|
|
109
|
-
value:
|
|
110
|
-
} =
|
|
111
|
-
te(e),
|
|
120
|
+
var n;
|
|
121
|
+
(n = K.current) != null && n.contains(e.relatedTarget) || T(!1);
|
|
122
|
+
}, []), [O, a] = M(!1);
|
|
123
|
+
x(() => {
|
|
124
|
+
a(N);
|
|
125
|
+
}, [N]);
|
|
126
|
+
const [q, V] = M(""), {
|
|
127
|
+
value: k
|
|
128
|
+
} = U, [f, E] = M(k), [S, te] = M(k), C = F(S), c = m((e) => {
|
|
129
|
+
te(e), C.current = e;
|
|
112
130
|
}, []);
|
|
113
|
-
|
|
114
|
-
E(
|
|
115
|
-
}, [
|
|
116
|
-
const e = o.find((
|
|
117
|
-
e ?
|
|
118
|
-
}, [o,
|
|
131
|
+
x(() => {
|
|
132
|
+
E(k), c(k);
|
|
133
|
+
}, [k, c]), x(() => {
|
|
134
|
+
const e = o.find((n) => n.value === k);
|
|
135
|
+
e ? V(D(e)) : k === void 0 && V("");
|
|
136
|
+
}, [o, k]);
|
|
119
137
|
const ne = m(() => {
|
|
120
|
-
f && (
|
|
121
|
-
}, [f, c]), se = m((e,
|
|
122
|
-
|
|
138
|
+
f && (V(""), c(void 0));
|
|
139
|
+
}, [f, c]), se = m((e, n) => {
|
|
140
|
+
V(e), r == null || r(e, n), a(!0), E(void 0);
|
|
123
141
|
}, [r]), oe = m((e) => {
|
|
124
|
-
var
|
|
125
|
-
(
|
|
126
|
-
}, []),
|
|
127
|
-
const
|
|
128
|
-
c(
|
|
142
|
+
var n;
|
|
143
|
+
(n = K.current) != null && n.contains(e.target) && a(!0);
|
|
144
|
+
}, []), w = m((e) => {
|
|
145
|
+
const n = e == null ? void 0 : e.value;
|
|
146
|
+
c(n), e ? V(D(e)) : (V(""), r == null || r("")), d == null || d(n);
|
|
129
147
|
}, [c, r, d]), re = m((e) => {
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
}, [o,
|
|
148
|
+
const n = o.find((j) => j.value === e);
|
|
149
|
+
w(n), E(e), a(!1);
|
|
150
|
+
}, [o, w]), ae = m((e) => {
|
|
133
151
|
c(e);
|
|
134
|
-
}, [c]), B = ce(
|
|
135
|
-
|
|
152
|
+
}, [c]), B = ce(q), u = W(() => !p || f ? o : me(B, o, D), [p, f, o, B]);
|
|
153
|
+
x(() => {
|
|
136
154
|
!f && B.length > 0 && u.length > 0 && !u.some((e) => S === e.value) && c(u[0].value);
|
|
137
155
|
}, [f, B, u, S, c]);
|
|
138
156
|
const {
|
|
139
157
|
setIsKeyboardNavigating: L
|
|
140
158
|
} = _();
|
|
141
|
-
return
|
|
142
|
-
if (
|
|
143
|
-
return
|
|
144
|
-
|
|
145
|
-
t.movementX === 0 && t.movementY === 0 || L(!1);
|
|
146
|
-
};
|
|
147
|
-
return window.addEventListener("mousemove", e, {
|
|
148
|
-
capture: !0
|
|
149
|
-
}), () => {
|
|
150
|
-
window.removeEventListener("mousemove", e, {
|
|
151
|
-
capture: !0
|
|
159
|
+
return x(() => {
|
|
160
|
+
if (N)
|
|
161
|
+
return pe((e) => {
|
|
162
|
+
e.movementX === 0 && e.movementY === 0 || L(!1);
|
|
152
163
|
});
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
164
|
+
}, [N, L]), x(() => {
|
|
165
|
+
if (N)
|
|
166
|
+
return ve((e) => {
|
|
167
|
+
var G;
|
|
168
|
+
let n;
|
|
169
|
+
const j = u.length, A = u.findIndex((s) => s.value === C.current), y = () => {
|
|
170
|
+
e.preventDefault(), e.stopPropagation(), e.stopImmediatePropagation();
|
|
171
|
+
};
|
|
172
|
+
switch (e.key) {
|
|
173
|
+
case "Enter": {
|
|
174
|
+
const s = u[A];
|
|
175
|
+
s && (y(), L(!0), a(!1), w(s), E(s.value));
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
case "Escape": {
|
|
179
|
+
if (O)
|
|
180
|
+
y(), f ? c(void 0) : w(void 0), a(!1);
|
|
181
|
+
else if (f)
|
|
182
|
+
y(), a(!0), w(void 0);
|
|
183
|
+
else {
|
|
184
|
+
y(), T(!1);
|
|
185
|
+
const s = document.activeElement;
|
|
186
|
+
s instanceof HTMLElement && ((G = K.current) != null && G.contains(s)) && s.blur();
|
|
187
|
+
}
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
case "ArrowDown": {
|
|
191
|
+
n = A + 1, a(!0);
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
case "ArrowUp": {
|
|
195
|
+
n = A - 1, a(!0), n < 0 && (n = j - 1);
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
198
|
+
case "Home": {
|
|
199
|
+
a(!0), n = 0;
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
case "End": {
|
|
203
|
+
a(!0), n = j - 1;
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
case "Backspace": {
|
|
207
|
+
u.some((s) => s.value === f) && (y(), w(void 0), a(!0));
|
|
208
|
+
break;
|
|
178
209
|
}
|
|
179
|
-
return;
|
|
180
|
-
}
|
|
181
|
-
case "ArrowDown": {
|
|
182
|
-
p = P + 1, a(!0);
|
|
183
|
-
break;
|
|
184
|
-
}
|
|
185
|
-
case "ArrowUp": {
|
|
186
|
-
p = P - 1, a(!0), p < 0 && (p = D - 1);
|
|
187
|
-
break;
|
|
188
|
-
}
|
|
189
|
-
case "Home": {
|
|
190
|
-
a(!0), p = 0;
|
|
191
|
-
break;
|
|
192
|
-
}
|
|
193
|
-
case "End": {
|
|
194
|
-
a(!0), p = D - 1;
|
|
195
|
-
break;
|
|
196
210
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
211
|
+
if (n !== void 0 && (y(), L(!0), j > 0)) {
|
|
212
|
+
const s = u[n % j];
|
|
213
|
+
s && c(s.value);
|
|
200
214
|
}
|
|
201
|
-
}
|
|
202
|
-
if (p !== void 0 && (y(), L(!0), D > 0)) {
|
|
203
|
-
const s = u[p % D];
|
|
204
|
-
s && c(s.value);
|
|
205
|
-
}
|
|
206
|
-
};
|
|
207
|
-
return window.addEventListener("keydown", e, {
|
|
208
|
-
capture: !0
|
|
209
|
-
}), () => {
|
|
210
|
-
window.removeEventListener("keydown", e, {
|
|
211
|
-
capture: !0
|
|
212
215
|
});
|
|
213
|
-
|
|
214
|
-
}, [V, u, L, a, I, E, O, f, c]), /* @__PURE__ */ i.jsx(de, { ...X, ref: M, role: "combobox", autoComplete: "off", "aria-controls": Y, "aria-expanded": O, "aria-activedescendant": O ? q : void 0, label: k, value: C, error: w, warning: g, information: b, footnote: N, attachments: O ? /* @__PURE__ */ i.jsx(ve, { isLoading: n, id: Y, activeOptionId: q, selectedValue: S, options: u, onSelect: re, onHover: ae }) : null, className: T(l, "kakadu-components-879486679"), onMouseDown: oe, onChange: se, onBeforeInput: ne, onFocus: $, onBlur: ee, children: /* @__PURE__ */ i.jsx(ue, { width: 14, height: 14, className: "kakadu-components-158931186" }) });
|
|
216
|
+
}, [N, u, L, a, w, E, O, f, c]), /* @__PURE__ */ i.jsx(de, { ...U, ref: K, role: "combobox", autoComplete: "off", "aria-controls": X, "aria-expanded": O, "aria-activedescendant": O ? Y : void 0, label: b, value: q, error: h, warning: I, information: v, footnote: g, attachments: O ? /* @__PURE__ */ i.jsx(ke, { isLoading: t, id: X, activeOptionId: Y, selectedValue: S, options: u, onSelect: re, onHover: ae }) : null, className: H(l, "kakadu-components-879486679"), onMouseDown: oe, onChange: se, onBeforeInput: ne, onFocus: $, onBlur: ee, children: /* @__PURE__ */ i.jsx(ue, { width: 14, height: 14, className: "kakadu-components-158931186" }) });
|
|
215
217
|
}
|
|
216
218
|
export {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
+
Me as default,
|
|
220
|
+
D as getComboboxOptionString
|
|
219
221
|
};
|
|
@@ -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 p=require("../jsx-runtime-BB_1_6y_.js"),s=require("react"),x=require("@kuma-ui/core"),y=require("../hooks/use-is-in-view.js"),R=require("../utilities/listeners.js"),$="kakadu-components-2608453841",I=R.default(e=>{window.addEventListener("mousemove",e,{passive:!0})},e=>{window.removeEventListener("mousemove",e)});function V({isActive:e=!0,size:k=200,className:E,...g}){const o=s.useRef(null),r=y.default(o),n=s.useRef(null),[L,i]=s.useState(!1),[u,b]=s.useState();return s.useEffect(()=>{if(!e||!r){i(!1);return}const a=o.current;if(!a)return;n.current||(n.current=a.parentElement);const t=n.current;if(!t)return;const j=I(m=>{const q=m.target;if(!t.contains(q))return;const w=t.getBoundingClientRect(),{clientX:c,clientY:l}=m,{left:f,right:M,top:v,bottom:S}=w;c>f&&c<M&&l>v&&l<S&&(i(!0),b([c-f,l-v]))}),d=()=>{i(!1)};return t.addEventListener("mouseleave",d),()=>{j(),t.removeEventListener("mouseleave",d)}},[e,r]),p.jsxRuntimeExports.jsx("div",{...g,ref:o,className:x.cx("kakadu-components-1237006455",E),children:u&&r?p.jsxRuntimeExports.jsx("div",{style:{"--size":`${k}px`,"--offset-x":`${u[0]}px`,"--offset-y":`${u[1]}px`},className:x.cx("kakadu-components-611160091",L&&"kakadu-components-3627966847")}):null})}exports.default=V;exports.normalBlendStyles=$;
|