@kapiuara/ui 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -1
- package/dist/components/chat/KapiChatDivider.d.ts +15 -0
- package/dist/components/chat/KapiChatDivider.js +17 -0
- package/dist/components/chat/KapiChatList.d.ts +57 -0
- package/dist/components/chat/KapiChatList.js +71 -0
- package/dist/components/chat/KapiChatThread.d.ts +35 -0
- package/dist/components/chat/KapiChatThread.js +85 -0
- package/dist/components/chat/KapiComposer.d.ts +60 -0
- package/dist/components/chat/KapiComposer.js +89 -0
- package/dist/components/chat/KapiMessageBubble.d.ts +43 -0
- package/dist/components/chat/KapiMessageBubble.js +67 -0
- package/dist/components/chat/KapiTypingIndicator.d.ts +27 -0
- package/dist/components/chat/KapiTypingIndicator.js +34 -0
- package/dist/components/chat/chatLogic.d.ts +76 -0
- package/dist/components/chat/chatLogic.js +34 -0
- package/dist/components/chat/index.d.ts +14 -0
- package/dist/components/display/KapiCommentComposer.d.ts +4 -0
- package/dist/components/display/KapiCommentComposer.js +43 -46
- package/dist/components/display/commentLogic.d.ts +9 -2
- package/dist/components/display/commentLogic.js +1 -1
- package/dist/components/display/index.d.ts +1 -0
- package/dist/components/inputs/KapiFacetedSearch.d.ts +14 -1
- package/dist/components/inputs/KapiFacetedSearch.js +172 -110
- package/dist/components/inputs/KapiSelect.d.ts +7 -0
- package/dist/components/inputs/KapiSelect.js +233 -229
- package/dist/components/inputs/facetedSearchLogic.d.ts +12 -2
- package/dist/components/inputs/facetedSearchLogic.js +10 -7
- package/dist/components/layout/KapiPanelParts.js +9 -9
- package/dist/components/layout/KapiRail.js +8 -8
- package/dist/components/locale/labelRegistry.d.ts +10 -0
- package/dist/components/navigation/KapiContextPanel.js +86 -86
- package/dist/components/navigation/KapiPanelGroup.js +18 -18
- package/dist/components/navigation/KapiTabs.js +1 -1
- package/dist/components/navigation/MiniNavItem.js +1 -1
- package/dist/hooks/dateFormat.d.ts +7 -0
- package/dist/hooks/dateFormat.js +16 -2
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/useSubmitDraft.d.ts +34 -0
- package/dist/hooks/useSubmitDraft.js +28 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +83 -76
- package/dist/kapi.css +1 -1
- package/dist/kapi.layered.css +1 -1
- package/package.json +1 -1
|
@@ -5,23 +5,23 @@ import { resolveGroupSize as ee, selectControlId as te } from "./inputGroupLogic
|
|
|
5
5
|
import { useKapiInputGroup as ne } from "./KapiInputGroup.js";
|
|
6
6
|
import { useLabels as re } from "../locale/KapiLocaleProvider.js";
|
|
7
7
|
import { resolveKapiRoot as ie } from "../../hooks/kapiRoot.js";
|
|
8
|
-
import { SELECT_MENU_PLACEMENT as ae, displayLabel as oe, filterOptions as se, findTypeaheadIndex as ce, flattenOptions as le, indexEntries as ue, initialActiveIndex as de, nextActiveIndex as i, normalizeValue as
|
|
9
|
-
import { createLoadSequencer as
|
|
8
|
+
import { SELECT_MENU_PLACEMENT as ae, displayLabel as oe, filterOptions as se, findTypeaheadIndex as ce, flattenOptions as le, indexEntries as ue, initialActiveIndex as de, nextActiveIndex as i, normalizeValue as fe, selectedOptions as pe, toggleValue as me } from "./selectLogic.js";
|
|
9
|
+
import { createLoadSequencer as he, isCreateRow as ge, menuItems as _e, mergeKnownOptions as a, selectedFromKnown as ve, withCreated as ye } from "./asyncSelectLogic.js";
|
|
10
10
|
/* empty css */
|
|
11
|
-
import { usePlacement as
|
|
12
|
-
import { jsx as
|
|
13
|
-
import { useCallback as
|
|
14
|
-
import { Check as
|
|
15
|
-
import { createPortal as
|
|
11
|
+
import { usePlacement as be } from "../../hooks/usePlacement.js";
|
|
12
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
13
|
+
import { useCallback as c, useEffect as l, useId as xe, useLayoutEffect as Se, useMemo as u, useRef as d, useState as f } from "react";
|
|
14
|
+
import { Check as Ce, ChevronDown as we, X as Te } from "lucide-react";
|
|
15
|
+
import { createPortal as Ee } from "react-dom";
|
|
16
16
|
//#region src/components/inputs/KapiSelect.tsx
|
|
17
|
-
var
|
|
17
|
+
var De = 6, Oe = 500, ke = [], Ae = (e, t) => `${e} “${t.trim()}”`, je = ({ size: e = "md", open: t, disabled: n, multi: r, className: ee }) => [
|
|
18
18
|
"kapisel",
|
|
19
19
|
`kapisel--${e}`,
|
|
20
20
|
t && "kapisel--open",
|
|
21
21
|
n && "kapisel--disabled",
|
|
22
22
|
r && "kapisel--multi",
|
|
23
23
|
ee
|
|
24
|
-
].filter(Boolean).join(" "),
|
|
24
|
+
].filter(Boolean).join(" "), Me = {
|
|
25
25
|
clear: "Limpiar selección",
|
|
26
26
|
remove: "Quitar",
|
|
27
27
|
placeholder: "Seleccionar…",
|
|
@@ -30,222 +30,226 @@ var Ee = 6, De = 500, Oe = [], ke = (e, t) => `${e} “${t.trim()}”`, Ae = ({
|
|
|
30
30
|
loadError: "No se pudieron cargar las opciones",
|
|
31
31
|
createError: "No se pudo crear la opción",
|
|
32
32
|
create: "Crear"
|
|
33
|
-
},
|
|
34
|
-
let { options:
|
|
35
|
-
id:
|
|
36
|
-
fieldControlId:
|
|
37
|
-
autoId:
|
|
38
|
-
inGroup:
|
|
39
|
-
}),
|
|
40
|
-
|
|
41
|
-
}, [
|
|
42
|
-
|
|
43
|
-
}, [
|
|
33
|
+
}, Ne = (Ne) => {
|
|
34
|
+
let { options: p = ke, loadOptions: Pe, loadDelay: Fe = 300, reloadKey: m, onCreate: Ie, value: Le, defaultValue: Re, multiple: h = !1, searchable: g = !0, clearable: ze = !1, disabled: _ = !1, loading: Be = !1, placeholder: Ve, size: He, renderOption: Ue, noOptionsMessage: We, loadingMessage: Ge, name: Ke, id: qe, className: Je, style: Ye, "aria-label": Xe, labels: Ze, ref: v, onBlur: Qe } = Ne, $e = Ne.onChange, y = re("select", Me, Ze), et = Ve ?? y.placeholder, tt = We ?? y.noOptions, nt = Ge ?? y.loading, rt = ne(), it = ee(He, rt?.size) ?? "md", at = r(), ot = xe(), b = te({
|
|
35
|
+
id: qe,
|
|
36
|
+
fieldControlId: at?.controlId,
|
|
37
|
+
autoId: ot,
|
|
38
|
+
inGroup: rt !== null
|
|
39
|
+
}), st = `${b}-listbox`, ct = `${b}-value`, lt = (e) => `${b}-opt-${e}`, ut = Le !== void 0, [dt, ft] = f(() => fe(Re, h)), x = fe(ut ? Le : dt, h), S = u(() => fe(x, !0), [x]), [C, w] = f(!1), [T, E] = f(""), [pt, D] = f(-1), O = d(null), k = d(null), mt = d(null), ht = c((t) => {
|
|
40
|
+
k.current = t, e(v, t);
|
|
41
|
+
}, [v]), gt = c((t) => {
|
|
42
|
+
mt.current = t, e(v, t);
|
|
43
|
+
}, [v]), A = d(null), _t = d({
|
|
44
44
|
buffer: "",
|
|
45
45
|
timer: void 0
|
|
46
|
-
}),
|
|
47
|
-
|
|
48
|
-
let
|
|
46
|
+
}), j = Pe !== void 0, M = T.trim(), N = C && !_, P = j || Ie !== void 0, [vt, yt] = f(() => P ? a(/* @__PURE__ */ new Map(), p) : /* @__PURE__ */ new Map()), [bt, xt] = f(p);
|
|
47
|
+
P && bt !== p && (xt(p), yt((e) => a(e, p)));
|
|
48
|
+
let F = j && (M !== "" || p.length === 0), [I] = f(he), [L, R] = f(null), St = d(m);
|
|
49
|
+
l(() => {
|
|
50
|
+
Object.is(St.current, m) || (St.current = m, I.cancel(), R(null));
|
|
51
|
+
}, [m, I]);
|
|
52
|
+
let z = L?.query === M, B = F && N && !z, Ct = F && z && L.error, V = Be || B, [wt, Tt] = f(!1), Et = d(!1), [Dt, H] = f(!1), Ot = V || wt, U = u(() => P ? ve(vt, x) : pe(p, x), [
|
|
53
|
+
P,
|
|
54
|
+
vt,
|
|
55
|
+
p,
|
|
56
|
+
x
|
|
57
|
+
]), W = u(() => F ? z ? L.entries : [] : j ? p : g ? se(p, T) : p, [
|
|
49
58
|
F,
|
|
50
|
-
gt,
|
|
51
|
-
m,
|
|
52
|
-
S
|
|
53
|
-
]), W = d(() => I ? z ? L.entries : [] : M ? m : _ ? se(m, E) : m, [
|
|
54
|
-
I,
|
|
55
59
|
z,
|
|
56
60
|
L,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
]), G =
|
|
61
|
+
j,
|
|
62
|
+
p,
|
|
63
|
+
g,
|
|
64
|
+
T
|
|
65
|
+
]), G = Ie !== void 0 && g && !Be && !wt, K = u(() => _e(W, T, G && !B, Ae(y.create, T)), [
|
|
62
66
|
W,
|
|
63
|
-
|
|
67
|
+
T,
|
|
64
68
|
G,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
]),
|
|
68
|
-
current:
|
|
69
|
-
query:
|
|
69
|
+
B,
|
|
70
|
+
y.create
|
|
71
|
+
]), kt = u(() => ue(W), [W]), q = K.length > 0 && ge(K[K.length - 1]) ? K[K.length - 1] : null, J = pt >= 0 && pt < K.length ? pt : -1, Y = U.length > 0, At = g && T !== "", jt = V ? nt : Dt ? y.createError : Ct ? y.loadError : K.length === 0 ? tt : null, Mt = d(Pe), X = d({
|
|
72
|
+
current: x,
|
|
73
|
+
query: T,
|
|
70
74
|
createAllowed: G,
|
|
71
|
-
createPrefix:
|
|
75
|
+
createPrefix: y.create
|
|
72
76
|
});
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
current:
|
|
76
|
-
query:
|
|
77
|
+
l(() => {
|
|
78
|
+
Mt.current = Pe, X.current = {
|
|
79
|
+
current: x,
|
|
80
|
+
query: T,
|
|
77
81
|
createAllowed: G,
|
|
78
|
-
createPrefix:
|
|
82
|
+
createPrefix: y.create
|
|
79
83
|
};
|
|
80
|
-
}),
|
|
81
|
-
if (!
|
|
84
|
+
}), l(() => {
|
|
85
|
+
if (!F || !N || z) return;
|
|
82
86
|
let e = setTimeout(() => {
|
|
83
|
-
let e =
|
|
87
|
+
let e = Mt.current;
|
|
84
88
|
if (!e) return;
|
|
85
|
-
let t =
|
|
89
|
+
let t = I.start(), n;
|
|
86
90
|
try {
|
|
87
|
-
n = e(
|
|
91
|
+
n = e(M, { signal: t.signal });
|
|
88
92
|
} catch (e) {
|
|
89
93
|
n = Promise.reject(e);
|
|
90
94
|
}
|
|
91
95
|
n.then((e) => {
|
|
92
96
|
if (!t.isCurrent()) return;
|
|
93
|
-
|
|
94
|
-
query:
|
|
97
|
+
yt((t) => a(t, e)), R({
|
|
98
|
+
query: M,
|
|
95
99
|
entries: e,
|
|
96
100
|
error: !1
|
|
97
101
|
});
|
|
98
|
-
let { createAllowed: n, createPrefix: r } = X.current, ee =
|
|
99
|
-
|
|
102
|
+
let { createAllowed: n, createPrefix: r } = X.current, ee = _e(e, M, n, Ae(r, M));
|
|
103
|
+
D(i(-1, "first", ee));
|
|
100
104
|
}, () => {
|
|
101
|
-
t.isCurrent() &&
|
|
102
|
-
query:
|
|
105
|
+
t.isCurrent() && R({
|
|
106
|
+
query: M,
|
|
103
107
|
entries: [],
|
|
104
108
|
error: !0
|
|
105
109
|
});
|
|
106
110
|
});
|
|
107
|
-
},
|
|
111
|
+
}, Fe);
|
|
108
112
|
return () => clearTimeout(e);
|
|
109
113
|
}, [
|
|
110
|
-
|
|
111
|
-
P,
|
|
112
|
-
z,
|
|
114
|
+
F,
|
|
113
115
|
N,
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}, [
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
116
|
+
z,
|
|
117
|
+
M,
|
|
118
|
+
Fe,
|
|
119
|
+
I
|
|
120
|
+
]), l(() => (N || (I.cancel(), R((e) => e?.error ? null : e), H(!1)), () => I.cancel()), [N, I]);
|
|
121
|
+
let Nt = () => (g ? k.current : mt.current)?.focus();
|
|
122
|
+
l(() => () => {
|
|
123
|
+
clearTimeout(_t.current.timer);
|
|
124
|
+
}, []), l(() => {
|
|
125
|
+
_ && (w(!1), E(""));
|
|
126
|
+
}, [_]);
|
|
127
|
+
let Z = c((e) => {
|
|
128
|
+
ut || ft(e), $e?.(e);
|
|
129
|
+
}, [ut, $e]), Q = c(() => {
|
|
130
|
+
w(!1), E(""), D(-1);
|
|
127
131
|
}, []), $ = (e = "selected") => {
|
|
128
|
-
|
|
129
|
-
},
|
|
130
|
-
|
|
131
|
-
},
|
|
132
|
-
if (
|
|
132
|
+
_ || (w(!0), D(de(K, S, e)));
|
|
133
|
+
}, Pt = (e) => {
|
|
134
|
+
h ? (E(""), D(e === null ? -1 : de(le(p), [e], "selected")), k.current?.focus()) : Q();
|
|
135
|
+
}, Ft = (e) => {
|
|
136
|
+
if (Et.current) return;
|
|
133
137
|
let t = (t) => {
|
|
134
|
-
t && (
|
|
138
|
+
t && (yt((e) => a(e, [t])), Z(ye(X.current.current, t.value, h))), X.current.query.trim() === e && Pt(t ? t.value : null);
|
|
135
139
|
};
|
|
136
140
|
H(!1);
|
|
137
|
-
let n =
|
|
141
|
+
let n = Ie?.(e);
|
|
138
142
|
if (!(n instanceof Promise)) {
|
|
139
143
|
t(n);
|
|
140
144
|
return;
|
|
141
145
|
}
|
|
142
|
-
|
|
146
|
+
Et.current = !0, Tt(!0);
|
|
143
147
|
let r = () => {
|
|
144
|
-
|
|
148
|
+
Et.current = !1, Tt(!1);
|
|
145
149
|
};
|
|
146
150
|
n.then((e) => {
|
|
147
151
|
r(), t(e);
|
|
148
152
|
}, (e) => {
|
|
149
153
|
r(), H(!0), console.error(e);
|
|
150
154
|
});
|
|
151
|
-
},
|
|
155
|
+
}, It = (e) => {
|
|
152
156
|
if (e.disabled) return;
|
|
153
|
-
if (
|
|
154
|
-
|
|
157
|
+
if (ge(e)) {
|
|
158
|
+
Ft(M);
|
|
155
159
|
return;
|
|
156
160
|
}
|
|
157
|
-
let t =
|
|
158
|
-
!
|
|
159
|
-
},
|
|
160
|
-
Z(
|
|
161
|
-
},
|
|
162
|
-
Z(
|
|
163
|
-
}, { placement:
|
|
164
|
-
open:
|
|
165
|
-
anchor:
|
|
166
|
-
floatingRef:
|
|
161
|
+
let t = me(x, e.value, h);
|
|
162
|
+
!h && t === x ? Q() : (Z(t), Pt(e.value));
|
|
163
|
+
}, Lt = (e) => {
|
|
164
|
+
Z(S.filter((t) => t !== e));
|
|
165
|
+
}, Rt = () => {
|
|
166
|
+
Z(h ? [] : null), E(""), Nt();
|
|
167
|
+
}, { placement: zt, style: Bt, update: Vt } = be({
|
|
168
|
+
open: N,
|
|
169
|
+
anchor: O,
|
|
170
|
+
floatingRef: A,
|
|
167
171
|
...ae,
|
|
168
|
-
offset:
|
|
172
|
+
offset: De
|
|
169
173
|
});
|
|
170
|
-
|
|
171
|
-
|
|
174
|
+
Se(() => {
|
|
175
|
+
N && Vt();
|
|
172
176
|
}, [
|
|
173
|
-
|
|
177
|
+
N,
|
|
174
178
|
K.length,
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
]),
|
|
178
|
-
if (!
|
|
179
|
+
jt,
|
|
180
|
+
Vt
|
|
181
|
+
]), l(() => {
|
|
182
|
+
if (!N) return;
|
|
179
183
|
let e = (e) => {
|
|
180
184
|
let t = e.target;
|
|
181
|
-
t && (
|
|
185
|
+
t && (O.current?.contains(t) || A.current?.contains(t)) || Q();
|
|
182
186
|
};
|
|
183
187
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
184
|
-
}, [
|
|
185
|
-
if (!
|
|
186
|
-
let e =
|
|
188
|
+
}, [N, Q]), l(() => {
|
|
189
|
+
if (!N || J < 0) return;
|
|
190
|
+
let e = A.current?.querySelector(`[data-kapisel-index="${J}"]`);
|
|
187
191
|
e && typeof e.scrollIntoView == "function" && e.scrollIntoView({ block: "nearest" });
|
|
188
|
-
}, [
|
|
189
|
-
let
|
|
190
|
-
if (
|
|
192
|
+
}, [N, J]);
|
|
193
|
+
let Ht = (e) => {
|
|
194
|
+
if (_) return;
|
|
191
195
|
let t = e.target;
|
|
192
|
-
|
|
193
|
-
},
|
|
194
|
-
|
|
195
|
-
},
|
|
196
|
-
let t =
|
|
196
|
+
A.current?.contains(t) || (t.closest("[data-kapisel-action]") ? e.preventDefault() : t === k.current ? C || $() : (e.preventDefault(), Nt(), C ? Q() : $()));
|
|
197
|
+
}, Ut = (e) => {
|
|
198
|
+
E(e), w(!0), H(!1), D(j ? -1 : i(-1, "first", _e(se(p, e), e, G, Ae(y.create, e))));
|
|
199
|
+
}, Wt = (e) => {
|
|
200
|
+
let t = _t.current;
|
|
197
201
|
clearTimeout(t.timer), t.buffer += e, t.timer = setTimeout(() => {
|
|
198
202
|
t.buffer = "";
|
|
199
|
-
},
|
|
200
|
-
let n = ce(K, t.buffer,
|
|
201
|
-
n < 0 || (
|
|
202
|
-
},
|
|
203
|
-
if (!
|
|
203
|
+
}, Oe);
|
|
204
|
+
let n = ce(K, t.buffer, C ? J : K.findIndex((e) => S.includes(e.value)));
|
|
205
|
+
n < 0 || (C || w(!0), D(n));
|
|
206
|
+
}, Gt = (e) => {
|
|
207
|
+
if (!_) switch (e.key) {
|
|
204
208
|
case "ArrowDown":
|
|
205
209
|
case "ArrowUp":
|
|
206
|
-
if (e.preventDefault(), !
|
|
210
|
+
if (e.preventDefault(), !C) {
|
|
207
211
|
$(e.key === "ArrowDown" ? "selected" : "last");
|
|
208
212
|
return;
|
|
209
213
|
}
|
|
210
|
-
|
|
214
|
+
D(i(J, e.key === "ArrowDown" ? "next" : "prev", K));
|
|
211
215
|
break;
|
|
212
216
|
case "Home":
|
|
213
217
|
case "End":
|
|
214
|
-
if (!
|
|
215
|
-
e.preventDefault(),
|
|
218
|
+
if (!C) break;
|
|
219
|
+
e.preventDefault(), D(i(J, e.key === "Home" ? "first" : "last", K));
|
|
216
220
|
break;
|
|
217
221
|
case "Enter":
|
|
218
|
-
if (
|
|
222
|
+
if (C) {
|
|
219
223
|
e.preventDefault();
|
|
220
224
|
let t = J >= 0 ? K[J] : void 0;
|
|
221
|
-
t &&
|
|
222
|
-
} else
|
|
225
|
+
t && It(t);
|
|
226
|
+
} else g || (e.preventDefault(), $());
|
|
223
227
|
break;
|
|
224
228
|
case " ":
|
|
225
|
-
if (
|
|
226
|
-
if (e.preventDefault(), !
|
|
229
|
+
if (g) break;
|
|
230
|
+
if (e.preventDefault(), !C) $();
|
|
227
231
|
else {
|
|
228
232
|
let e = J >= 0 ? K[J] : void 0;
|
|
229
|
-
e &&
|
|
233
|
+
e && It(e);
|
|
230
234
|
}
|
|
231
235
|
break;
|
|
232
236
|
case "Escape":
|
|
233
|
-
|
|
237
|
+
C && (e.preventDefault(), e.stopPropagation(), Q());
|
|
234
238
|
break;
|
|
235
239
|
case "Tab":
|
|
236
|
-
|
|
240
|
+
C && Q();
|
|
237
241
|
break;
|
|
238
242
|
case "Backspace":
|
|
239
|
-
|
|
243
|
+
h && T === "" && S.length > 0 && (e.preventDefault(), Lt(S[S.length - 1]));
|
|
240
244
|
break;
|
|
241
|
-
default: !
|
|
245
|
+
default: !g && e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey && (e.preventDefault(), Wt(e.key));
|
|
242
246
|
}
|
|
243
|
-
},
|
|
244
|
-
n(e.relatedTarget,
|
|
245
|
-
},
|
|
246
|
-
let n =
|
|
247
|
-
return /* @__PURE__ */
|
|
248
|
-
id:
|
|
247
|
+
}, Kt = (e) => {
|
|
248
|
+
n(e.relatedTarget, O.current, A.current) && (C && Q(), Qe?.(e));
|
|
249
|
+
}, qt = N ? ie(O.current) : null, Jt = ({ option: e, index: t }) => {
|
|
250
|
+
let n = S.includes(e.value), r = t === J;
|
|
251
|
+
return /* @__PURE__ */ s("li", {
|
|
252
|
+
id: lt(t),
|
|
249
253
|
role: "option",
|
|
250
254
|
"aria-selected": n,
|
|
251
255
|
"aria-disabled": e.disabled || void 0,
|
|
@@ -258,186 +262,186 @@ var Ee = 6, De = 500, Oe = [], ke = (e, t) => `${e} “${t.trim()}”`, Ae = ({
|
|
|
258
262
|
e.disabled && "kapisel__opt--disabled"
|
|
259
263
|
].filter(Boolean).join(" "),
|
|
260
264
|
onMouseMove: () => {
|
|
261
|
-
!e.disabled && !r &&
|
|
265
|
+
!e.disabled && !r && D(t);
|
|
262
266
|
},
|
|
263
|
-
onClick: () =>
|
|
264
|
-
children: [/* @__PURE__ */
|
|
267
|
+
onClick: () => It(e),
|
|
268
|
+
children: [/* @__PURE__ */ o("span", {
|
|
265
269
|
className: "kapisel__opt-body",
|
|
266
|
-
children:
|
|
267
|
-
}), n && /* @__PURE__ */
|
|
270
|
+
children: Ue && e !== q ? Ue(e) : e.label
|
|
271
|
+
}), n && /* @__PURE__ */ o(Ce, {
|
|
268
272
|
className: "kapisel__check",
|
|
269
273
|
size: 15,
|
|
270
274
|
strokeWidth: 2.4,
|
|
271
275
|
"aria-hidden": "true"
|
|
272
276
|
})]
|
|
273
277
|
}, `${e.value}-${t}`);
|
|
274
|
-
},
|
|
278
|
+
}, Yt = {
|
|
275
279
|
role: "combobox",
|
|
276
|
-
...t(
|
|
277
|
-
id:
|
|
278
|
-
describedBy:
|
|
279
|
-
labelable:
|
|
280
|
-
ariaLabel:
|
|
280
|
+
...t(at, {
|
|
281
|
+
id: b,
|
|
282
|
+
describedBy: ct,
|
|
283
|
+
labelable: g,
|
|
284
|
+
ariaLabel: Xe
|
|
281
285
|
}),
|
|
282
286
|
"aria-haspopup": "listbox",
|
|
283
|
-
"aria-expanded":
|
|
284
|
-
"aria-controls":
|
|
285
|
-
"aria-activedescendant":
|
|
286
|
-
"aria-label":
|
|
287
|
-
"aria-disabled":
|
|
288
|
-
"aria-busy":
|
|
289
|
-
},
|
|
287
|
+
"aria-expanded": N,
|
|
288
|
+
"aria-controls": N ? st : void 0,
|
|
289
|
+
"aria-activedescendant": N && J >= 0 ? lt(J) : void 0,
|
|
290
|
+
"aria-label": Xe,
|
|
291
|
+
"aria-disabled": _ || void 0,
|
|
292
|
+
"aria-busy": Ot || void 0
|
|
293
|
+
}, Xt = !Y && !At && /* @__PURE__ */ o("span", {
|
|
290
294
|
className: "kapisel__placeholder",
|
|
291
295
|
"aria-hidden": "true",
|
|
292
|
-
children:
|
|
296
|
+
children: et
|
|
293
297
|
});
|
|
294
|
-
return /* @__PURE__ */
|
|
295
|
-
ref:
|
|
296
|
-
className:
|
|
297
|
-
size:
|
|
298
|
-
open:
|
|
299
|
-
disabled:
|
|
300
|
-
multi:
|
|
301
|
-
className:
|
|
298
|
+
return /* @__PURE__ */ s("div", {
|
|
299
|
+
ref: O,
|
|
300
|
+
className: je({
|
|
301
|
+
size: it,
|
|
302
|
+
open: N,
|
|
303
|
+
disabled: _,
|
|
304
|
+
multi: h,
|
|
305
|
+
className: Je
|
|
302
306
|
}),
|
|
303
|
-
style:
|
|
304
|
-
onMouseDown:
|
|
307
|
+
style: Ye,
|
|
308
|
+
onMouseDown: Ht,
|
|
305
309
|
children: [
|
|
306
|
-
/* @__PURE__ */
|
|
310
|
+
/* @__PURE__ */ s("div", {
|
|
307
311
|
className: "kapisel__values",
|
|
308
|
-
children: [
|
|
312
|
+
children: [h && U.map((e) => /* @__PURE__ */ s("span", {
|
|
309
313
|
className: "kapisel__chip",
|
|
310
|
-
children: [/* @__PURE__ */
|
|
314
|
+
children: [/* @__PURE__ */ o("span", {
|
|
311
315
|
className: "kapisel__chip-label",
|
|
312
316
|
children: e.label
|
|
313
|
-
}), /* @__PURE__ */
|
|
317
|
+
}), /* @__PURE__ */ o("button", {
|
|
314
318
|
type: "button",
|
|
315
319
|
tabIndex: -1,
|
|
316
320
|
"data-kapisel-action": !0,
|
|
317
321
|
className: "kapisel__chip-x",
|
|
318
|
-
"aria-label": `${
|
|
319
|
-
disabled:
|
|
320
|
-
onClick: () =>
|
|
321
|
-
children: /* @__PURE__ */
|
|
322
|
+
"aria-label": `${y.remove} ${e.label}`,
|
|
323
|
+
disabled: _,
|
|
324
|
+
onClick: () => Lt(e.value),
|
|
325
|
+
children: /* @__PURE__ */ o(Te, {
|
|
322
326
|
size: 12,
|
|
323
327
|
strokeWidth: 2.6,
|
|
324
328
|
"aria-hidden": "true"
|
|
325
329
|
})
|
|
326
330
|
})]
|
|
327
|
-
}, e.value)),
|
|
331
|
+
}, e.value)), g ? /* @__PURE__ */ s("div", {
|
|
328
332
|
className: "kapisel__inputwrap",
|
|
329
333
|
children: [
|
|
330
|
-
!
|
|
334
|
+
!h && Y && !At && /* @__PURE__ */ o("span", {
|
|
331
335
|
className: "kapisel__single",
|
|
332
336
|
"aria-hidden": "true",
|
|
333
337
|
children: U[0]?.label
|
|
334
338
|
}),
|
|
335
|
-
|
|
336
|
-
/* @__PURE__ */
|
|
337
|
-
...
|
|
338
|
-
ref:
|
|
339
|
+
Xt,
|
|
340
|
+
/* @__PURE__ */ o("input", {
|
|
341
|
+
...Yt,
|
|
342
|
+
ref: ht,
|
|
339
343
|
type: "text",
|
|
340
344
|
className: "kapisel__input",
|
|
341
345
|
autoComplete: "off",
|
|
342
346
|
"aria-autocomplete": "list",
|
|
343
|
-
disabled:
|
|
344
|
-
value:
|
|
345
|
-
onChange: (e) =>
|
|
346
|
-
onKeyDown:
|
|
347
|
-
onBlur:
|
|
347
|
+
disabled: _,
|
|
348
|
+
value: T,
|
|
349
|
+
onChange: (e) => Ut(e.target.value),
|
|
350
|
+
onKeyDown: Gt,
|
|
351
|
+
onBlur: Kt
|
|
348
352
|
})
|
|
349
353
|
]
|
|
350
|
-
}) : /* @__PURE__ */
|
|
351
|
-
...
|
|
352
|
-
ref:
|
|
354
|
+
}) : /* @__PURE__ */ s("div", {
|
|
355
|
+
...Yt,
|
|
356
|
+
ref: gt,
|
|
353
357
|
className: "kapisel__combo",
|
|
354
|
-
tabIndex:
|
|
355
|
-
onKeyDown:
|
|
356
|
-
onBlur:
|
|
357
|
-
children: [!
|
|
358
|
+
tabIndex: _ ? -1 : 0,
|
|
359
|
+
onKeyDown: Gt,
|
|
360
|
+
onBlur: Kt,
|
|
361
|
+
children: [!h && Y && /* @__PURE__ */ o("span", {
|
|
358
362
|
className: "kapisel__single",
|
|
359
363
|
"aria-hidden": "true",
|
|
360
364
|
children: U[0]?.label
|
|
361
|
-
}),
|
|
365
|
+
}), Xt]
|
|
362
366
|
})]
|
|
363
367
|
}),
|
|
364
|
-
/* @__PURE__ */
|
|
365
|
-
id:
|
|
368
|
+
/* @__PURE__ */ o("span", {
|
|
369
|
+
id: ct,
|
|
366
370
|
className: "kapisel__sr",
|
|
367
|
-
children: oe(U,
|
|
371
|
+
children: oe(U, et)
|
|
368
372
|
}),
|
|
369
|
-
|
|
373
|
+
Ot && /* @__PURE__ */ o("span", {
|
|
370
374
|
className: "kapisel__spinner kapi-spinner kapi-spinner--sm",
|
|
371
375
|
"aria-hidden": "true"
|
|
372
376
|
}),
|
|
373
|
-
|
|
377
|
+
ze && Y && !_ && /* @__PURE__ */ o("button", {
|
|
374
378
|
type: "button",
|
|
375
379
|
tabIndex: -1,
|
|
376
380
|
"data-kapisel-action": !0,
|
|
377
381
|
className: "kapisel__clear",
|
|
378
|
-
"aria-label":
|
|
379
|
-
onClick:
|
|
380
|
-
children: /* @__PURE__ */
|
|
382
|
+
"aria-label": y.clear,
|
|
383
|
+
onClick: Rt,
|
|
384
|
+
children: /* @__PURE__ */ o(Te, {
|
|
381
385
|
size: 15,
|
|
382
386
|
strokeWidth: 2.4,
|
|
383
387
|
"aria-hidden": "true"
|
|
384
388
|
})
|
|
385
389
|
}),
|
|
386
|
-
/* @__PURE__ */
|
|
390
|
+
/* @__PURE__ */ o("span", {
|
|
387
391
|
className: "kapisel__caret",
|
|
388
392
|
"aria-hidden": "true",
|
|
389
|
-
children: /* @__PURE__ */
|
|
393
|
+
children: /* @__PURE__ */ o(we, {
|
|
390
394
|
size: 17,
|
|
391
395
|
strokeWidth: 2.2
|
|
392
396
|
})
|
|
393
397
|
}),
|
|
394
|
-
|
|
398
|
+
Ke && (h ? S.map((e) => /* @__PURE__ */ o("input", {
|
|
395
399
|
type: "hidden",
|
|
396
|
-
name:
|
|
400
|
+
name: Ke,
|
|
397
401
|
value: e
|
|
398
|
-
}, e)) : /* @__PURE__ */
|
|
402
|
+
}, e)) : /* @__PURE__ */ o("input", {
|
|
399
403
|
type: "hidden",
|
|
400
|
-
name:
|
|
401
|
-
value:
|
|
404
|
+
name: Ke,
|
|
405
|
+
value: x ?? ""
|
|
402
406
|
})),
|
|
403
|
-
|
|
404
|
-
ref:
|
|
405
|
-
className: `kapisel__menu kapisel__menu--${
|
|
406
|
-
style:
|
|
407
|
+
qt && Ee(/* @__PURE__ */ s("div", {
|
|
408
|
+
ref: A,
|
|
409
|
+
className: `kapisel__menu kapisel__menu--${zt?.side === "top" ? "top" : "bottom"}${rt ? " kapisel__menu--hug" : ""}`,
|
|
410
|
+
style: Bt,
|
|
407
411
|
onMouseDown: (e) => e.preventDefault(),
|
|
408
|
-
children: [/* @__PURE__ */
|
|
409
|
-
id:
|
|
412
|
+
children: [/* @__PURE__ */ s("ul", {
|
|
413
|
+
id: st,
|
|
410
414
|
role: "listbox",
|
|
411
|
-
"aria-multiselectable":
|
|
412
|
-
"aria-label":
|
|
415
|
+
"aria-multiselectable": h || void 0,
|
|
416
|
+
"aria-label": Xe,
|
|
413
417
|
className: "kapisel__list",
|
|
414
|
-
hidden: K.length === 0 ||
|
|
415
|
-
children: [!
|
|
418
|
+
hidden: K.length === 0 || V,
|
|
419
|
+
children: [!V && kt.map((e) => e.kind === "option" ? Jt(e.item) : /* @__PURE__ */ s("li", {
|
|
416
420
|
role: "presentation",
|
|
417
421
|
className: "kapisel__group",
|
|
418
|
-
children: [/* @__PURE__ */
|
|
422
|
+
children: [/* @__PURE__ */ o("div", {
|
|
419
423
|
className: "kapisel__group-label",
|
|
420
424
|
"aria-hidden": "true",
|
|
421
425
|
children: e.label
|
|
422
|
-
}), /* @__PURE__ */
|
|
426
|
+
}), /* @__PURE__ */ o("ul", {
|
|
423
427
|
role: "group",
|
|
424
428
|
"aria-label": e.label,
|
|
425
429
|
className: "kapisel__group-list",
|
|
426
|
-
children: e.items.map(
|
|
430
|
+
children: e.items.map(Jt)
|
|
427
431
|
})]
|
|
428
|
-
}, e.key)), q &&
|
|
432
|
+
}, e.key)), q && Jt({
|
|
429
433
|
option: q,
|
|
430
434
|
index: K.length - 1
|
|
431
435
|
})]
|
|
432
|
-
}),
|
|
436
|
+
}), jt && /* @__PURE__ */ o("div", {
|
|
433
437
|
className: "kapisel__status",
|
|
434
438
|
role: "status",
|
|
435
439
|
"aria-live": "polite",
|
|
436
|
-
children:
|
|
440
|
+
children: jt
|
|
437
441
|
})]
|
|
438
|
-
}),
|
|
442
|
+
}), qt)
|
|
439
443
|
]
|
|
440
444
|
});
|
|
441
445
|
};
|
|
442
446
|
//#endregion
|
|
443
|
-
export {
|
|
447
|
+
export { Me as DEFAULT_SELECT_LABELS, Ne as KapiSelect, je as selectClasses };
|