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