@kapiuara/ui 0.13.0 → 0.15.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 +239 -1
- package/dist/components/chat/KapiChatDivider.d.ts +7 -3
- package/dist/components/chat/KapiChatDivider.js +6 -6
- package/dist/components/chat/KapiChatList.js +19 -19
- package/dist/components/chat/KapiChatThread.js +23 -23
- package/dist/components/chat/KapiComposer.js +19 -19
- package/dist/components/chat/KapiMessageBubble.js +4 -4
- package/dist/components/chat/KapiTypingIndicator.js +4 -4
- package/dist/components/chat/index.d.ts +1 -1
- package/dist/components/closeReason.d.ts +34 -0
- package/dist/components/data/KapiBarChart.js +1 -1
- package/dist/components/data/KapiDataTable.js +31 -31
- package/dist/components/data/KapiEventCalendar.js +78 -78
- package/dist/components/data/KapiHeatmap.js +23 -23
- package/dist/components/data/KapiLineChart.js +1 -1
- package/dist/components/data/KapiPagination.js +4 -4
- package/dist/components/data/KapiSparkline.js +1 -1
- package/dist/components/data/KapiTable.js +122 -122
- package/dist/components/data/KapiTableFilter.js +18 -18
- package/dist/components/data/KapiTableRow.js +24 -24
- package/dist/components/data/KapiTableToolbar.js +49 -49
- package/dist/components/data/chartFrame.js +21 -21
- package/dist/components/data/useColumnResize.js +8 -8
- package/dist/components/data/useTableSelection.js +8 -8
- package/dist/components/display/KapiAnnotation.js +55 -55
- package/dist/components/display/KapiComment.js +4 -4
- package/dist/components/display/KapiCommentComposer.js +16 -16
- package/dist/components/display/KapiFileItem.js +6 -6
- package/dist/components/display/KapiFileViewer.js +9 -9
- package/dist/components/display/KapiTruncate.js +7 -7
- package/dist/components/feedback/KapiAlert.d.ts +2 -1
- package/dist/components/feedback/KapiAlert.js +8 -8
- package/dist/components/feedback/KapiCountdown.js +8 -8
- package/dist/components/feedback/KapiFab.js +30 -30
- package/dist/components/feedback/KapiOfflineBanner.js +8 -8
- package/dist/components/feedback/KapiToastContainer.js +25 -25
- package/dist/components/feedback/KapiTour.d.ts +2 -1
- package/dist/components/feedback/KapiTour.js +35 -35
- package/dist/components/inputs/KapiAutocomplete.js +14 -14
- package/dist/components/inputs/KapiButton.d.ts +17 -1
- package/dist/components/inputs/KapiButton.js +41 -25
- package/dist/components/inputs/KapiCalendar.js +5 -5
- package/dist/components/inputs/KapiCalendarGrid.js +10 -10
- package/dist/components/inputs/KapiChecklist.js +71 -71
- package/dist/components/inputs/KapiDatePicker.js +124 -122
- package/dist/components/inputs/KapiDateRangePicker.js +138 -136
- package/dist/components/inputs/KapiFacetedSearch.js +29 -29
- package/dist/components/inputs/KapiField.js +14 -14
- package/dist/components/inputs/KapiFileUpload.js +27 -27
- package/dist/components/inputs/KapiIconButton.d.ts +9 -1
- package/dist/components/inputs/KapiIconButton.js +27 -10
- package/dist/components/inputs/KapiInput.js +21 -21
- package/dist/components/inputs/KapiInputGroup.js +8 -8
- package/dist/components/inputs/KapiMaskedInput.d.ts +8 -3
- package/dist/components/inputs/KapiMaskedInput.js +64 -51
- package/dist/components/inputs/KapiNumberStepper.js +29 -29
- package/dist/components/inputs/KapiRating.js +61 -59
- package/dist/components/inputs/KapiSearchChip.js +8 -8
- package/dist/components/inputs/KapiSegmented.js +74 -64
- package/dist/components/inputs/KapiSelect.js +232 -222
- package/dist/components/inputs/KapiSelectMenu.js +60 -60
- package/dist/components/inputs/KapiSlider.js +1 -1
- package/dist/components/inputs/KapiSwitch.js +6 -6
- package/dist/components/inputs/KapiTagInput.js +83 -81
- package/dist/components/inputs/KapiTextarea.js +8 -8
- package/dist/components/inputs/misuseWarnings.d.ts +37 -0
- package/dist/components/inputs/misuseWarnings.js +36 -0
- package/dist/components/inputs/numberStepLogic.d.ts +10 -0
- package/dist/components/inputs/numberStepLogic.js +16 -7
- package/dist/components/inputs/ownField.js +4 -4
- package/dist/components/layout/KapiAccountMenu.d.ts +2 -1
- package/dist/components/layout/KapiAccountMenu.js +53 -53
- package/dist/components/layout/KapiContextSlot.js +35 -35
- package/dist/components/layout/KapiMasonry.js +6 -6
- package/dist/components/layout/KapiNotificationBell.js +60 -60
- package/dist/components/layout/KapiPageHeader.js +19 -19
- package/dist/components/layout/KapiRail.js +60 -60
- package/dist/components/layout/KapiRailAccount.js +9 -9
- package/dist/components/layout/KapiRoot.js +21 -21
- package/dist/components/layout/KapiScrollArea.js +11 -11
- package/dist/components/layout/KapiShell.js +12 -12
- package/dist/components/locale/KapiLocaleProvider.js +13 -13
- package/dist/components/navigation/CtxSlidingList.js +4 -4
- package/dist/components/navigation/KapiAccordion.js +12 -12
- package/dist/components/navigation/KapiBreadcrumb.js +11 -11
- package/dist/components/navigation/KapiCollapsiblePanel.js +23 -23
- package/dist/components/navigation/KapiContextPanel.js +76 -76
- package/dist/components/navigation/KapiFilterChips.js +9 -9
- package/dist/components/navigation/KapiNavBadge.d.ts +4 -2
- package/dist/components/navigation/KapiNavBadge.js +11 -10
- package/dist/components/navigation/KapiPanelGroup.js +25 -25
- package/dist/components/navigation/KapiSteps.js +4 -4
- package/dist/components/navigation/KapiTabs.d.ts +4 -1
- package/dist/components/navigation/KapiTabs.js +63 -55
- package/dist/components/navigation/KapiTree.js +75 -75
- package/dist/components/navigation/KapiWizard.d.ts +2 -1
- package/dist/components/navigation/KapiWizard.js +30 -30
- package/dist/components/overlays/KapiCanvasForm.d.ts +6 -2
- package/dist/components/overlays/KapiCanvasForm.js +12 -12
- package/dist/components/overlays/KapiCommandPalette.d.ts +2 -1
- package/dist/components/overlays/KapiCommandPalette.js +23 -23
- package/dist/components/overlays/KapiConfirm.d.ts +2 -1
- package/dist/components/overlays/KapiConfirm.js +12 -12
- package/dist/components/overlays/KapiContextMenu.d.ts +2 -1
- package/dist/components/overlays/KapiContextMenu.js +18 -18
- package/dist/components/overlays/KapiDialogHost.js +22 -22
- package/dist/components/overlays/KapiLoading.js +16 -16
- package/dist/components/overlays/KapiMenuButton.js +15 -15
- package/dist/components/overlays/KapiModal.d.ts +2 -1
- package/dist/components/overlays/KapiModal.js +28 -28
- package/dist/components/overlays/KapiOffcanvas.d.ts +3 -2
- package/dist/components/overlays/KapiOffcanvas.js +63 -63
- package/dist/components/overlays/KapiOffcanvasStack.js +38 -38
- package/dist/components/overlays/KapiPhotoView.js +15 -15
- package/dist/components/overlays/KapiPopover.d.ts +2 -1
- package/dist/components/overlays/KapiPopover.js +10 -10
- package/dist/components/overlays/KapiShapeSheet.js +20 -20
- package/dist/components/overlays/KapiSplitModal.js +29 -29
- package/dist/components/overlays/KapiTooltip.js +21 -21
- package/dist/components/overlays/menuList.js +60 -60
- package/dist/components/renderSlot.d.ts +27 -0
- package/dist/components/renderSlot.js +23 -0
- package/dist/css/components/chat/chat.css +1 -1
- package/dist/hooks/portalRoot.js +6 -6
- package/dist/hooks/useControllableState.d.ts +6 -2
- package/dist/hooks/useControllableState.js +14 -11
- package/dist/hooks/useFormReset.d.ts +22 -0
- package/dist/hooks/useFormReset.js +17 -0
- package/dist/index.d.ts +2 -0
- package/dist/kapi.css +1 -1
- package/dist/kapi.layered.css +1 -1
- package/package.json +5 -2
|
@@ -6,30 +6,33 @@ import { resolveGroupSize as a, selectControlId as ee } from "./inputGroupLogic.
|
|
|
6
6
|
import { useKapiInputGroup as te } from "./KapiInputGroup.js";
|
|
7
7
|
import { useLabels as ne } from "../locale/KapiLocaleProvider.js";
|
|
8
8
|
import { useRangeSelect as re } from "../../hooks/useRangeSelect.js";
|
|
9
|
-
import { SELECT_MENU_PLACEMENT as ie, displayLabel as ae, filterOptions as oe, findTypeaheadIndex as se, flattenOptions as ce, indexEntries as le, initialActiveIndex as ue, nextActiveIndex as
|
|
10
|
-
import { useControllableState as
|
|
11
|
-
import { resolveKapiRoot as
|
|
12
|
-
import { isCreateRow as
|
|
9
|
+
import { SELECT_MENU_PLACEMENT as ie, displayLabel as ae, filterOptions as oe, findTypeaheadIndex as se, flattenOptions as ce, indexEntries as le, initialActiveIndex as ue, nextActiveIndex as o, normalizeValue as de, resolveChipLabel as fe, resolveVirtualMenu as pe, toggleValue as me, withUnknownValues as he } from "./selectLogic.js";
|
|
10
|
+
import { useControllableState as ge } from "../../hooks/useControllableState.js";
|
|
11
|
+
import { resolveKapiRoot as _e } from "../../hooks/kapiRoot.js";
|
|
12
|
+
import { isCreateRow as ve, menuItems as ye, withCreated as be } from "./asyncSelectLogic.js";
|
|
13
13
|
/* empty css */
|
|
14
14
|
import { usePlacement as xe } from "../../hooks/usePlacement.js";
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
15
|
+
import { useDuplicateValueWarning as Se, useMutedControlWarning as Ce } from "./misuseWarnings.js";
|
|
16
|
+
import { useFormReset as we } from "../../hooks/useFormReset.js";
|
|
17
|
+
import { useMergedRefs as Te } from "../../hooks/mergeRefs.js";
|
|
18
|
+
import { useOutsidePress as Ee } from "../../hooks/useOutsidePress.js";
|
|
19
|
+
import { useTypeahead as De } from "../../hooks/useTypeahead.js";
|
|
20
|
+
import { selectKeyAction as Oe } from "./selectKeyLogic.js";
|
|
21
|
+
import { useSelectSource as ke } from "./useSelectSource.js";
|
|
22
|
+
import { useSelectCreate as Ae } from "./useSelectCreate.js";
|
|
23
|
+
import { KapiSelectMenu as je } from "./KapiSelectMenu.js";
|
|
24
|
+
import { useCallback as Me, useEffect as Ne, useId as Pe, useLayoutEffect as Fe, useMemo as s, useRef as c, useState as l } from "react";
|
|
25
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
26
|
+
import { ChevronDown as Ie, X as Le } from "lucide-react";
|
|
24
27
|
//#region src/components/inputs/KapiSelect.tsx
|
|
25
|
-
var
|
|
28
|
+
var Re = 6, ze = [], f = "\0kapisel-all", p = (e, t) => `${e} “${t.trim()}”`, Be = ({ size: e = "md", open: t, disabled: n, readOnly: r, multi: i, chip: a, className: ee }) => [
|
|
26
29
|
...a ? ["kapi-filterchip", "kapisel--chip"] : ["kapisel", `kapisel--${e}`],
|
|
27
30
|
t && "kapisel--open",
|
|
28
31
|
n && "kapisel--disabled",
|
|
29
32
|
r && "kapisel--readonly",
|
|
30
33
|
i && "kapisel--multi",
|
|
31
34
|
ee
|
|
32
|
-
].filter(Boolean).join(" "),
|
|
35
|
+
].filter(Boolean).join(" "), Ve = {
|
|
33
36
|
clear: "Limpiar selección",
|
|
34
37
|
remove: "Quitar",
|
|
35
38
|
placeholder: "Seleccionar…",
|
|
@@ -39,130 +42,137 @@ var Pe = 6, Fe = [], f = "\0kapisel-all", Ie = (e, t) => `${e} “${t.trim()}”
|
|
|
39
42
|
createError: "No se pudo crear la opción",
|
|
40
43
|
create: "Crear",
|
|
41
44
|
all: "Todas"
|
|
42
|
-
},
|
|
43
|
-
let { options:
|
|
45
|
+
}, m = (m) => {
|
|
46
|
+
let { options: h = ze, loadOptions: He, loadDelay: Ue = 300, reloadKey: We, onCreate: Ge, value: Ke, defaultValue: qe, multiple: g = !1, variant: Je = "field", icon: Ye, label: Xe, chipLabel: Ze, help: Qe, fieldClassName: $e, clearable: et = !1, disabled: _ = !1, invalid: tt, required: nt, readOnly: rt, loading: v = !1, placeholder: it, size: at, renderOption: ot, renderValue: st, virtual: ct, emptyMessage: lt, noOptionsMessage: ut, loadingMessage: dt, name: y, id: ft, className: pt, style: mt, "aria-label": ht, labels: gt, ref: b, onBlur: _t } = m, x = Je === "chip", S = m.searchable ?? !x, vt = m.onChange, C = ne("select", Ve, gt), yt = it ?? C.placeholder, w = g ? void 0 : m.allOption, T = w !== void 0 && w !== !1, bt = typeof w == "string" ? w : C.all, E = s(() => ({
|
|
44
47
|
value: f,
|
|
45
|
-
label:
|
|
46
|
-
}), [
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
]),
|
|
52
|
-
chip:
|
|
53
|
-
chipLabel:
|
|
54
|
-
label:
|
|
55
|
-
}),
|
|
56
|
-
id:
|
|
57
|
-
label:
|
|
58
|
-
help:
|
|
59
|
-
required:
|
|
60
|
-
invalid:
|
|
61
|
-
readOnly:
|
|
62
|
-
fieldClassName:
|
|
63
|
-
}),
|
|
64
|
-
id:
|
|
65
|
-
fieldControlId:
|
|
66
|
-
autoId:
|
|
67
|
-
inGroup:
|
|
68
|
-
}),
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
48
|
+
label: bt
|
|
49
|
+
}), [bt]), xt = s(() => T && !(He && h.length === 0) ? [E, ...h] : h, [
|
|
50
|
+
T,
|
|
51
|
+
He,
|
|
52
|
+
h,
|
|
53
|
+
E
|
|
54
|
+
]), St = lt ?? ut ?? C.noOptions, Ct = dt ?? C.loading, wt = te(), Tt = a(at, wt?.size) ?? "md", { chipLabel: Et, fieldLabel: Dt } = fe({
|
|
55
|
+
chip: x,
|
|
56
|
+
chipLabel: Ze,
|
|
57
|
+
label: Xe
|
|
58
|
+
}), Ot = i({
|
|
59
|
+
id: ft,
|
|
60
|
+
label: Dt,
|
|
61
|
+
help: Qe,
|
|
62
|
+
required: nt,
|
|
63
|
+
invalid: tt,
|
|
64
|
+
readOnly: rt,
|
|
65
|
+
fieldClassName: $e
|
|
66
|
+
}), D = Ot.field, O = r(rt, D), kt = ht ?? (x && !D ? Et : void 0), At = Pe(), k = ee({
|
|
67
|
+
id: ft,
|
|
68
|
+
fieldControlId: D?.controlId,
|
|
69
|
+
autoId: At,
|
|
70
|
+
inGroup: wt !== null
|
|
71
|
+
}), jt = `${k}-listbox`, Mt = `${k}-value`, Nt = (e) => `${k}-opt-${e}`, [Pt, Ft, , It] = ge(Ke, () => de(qe, g), vt), Lt = s(() => ce(h).map((e) => e.value), [h]);
|
|
72
|
+
Se("KapiSelect", Lt), Ce("KapiSelect", {
|
|
73
|
+
controlled: Ke !== void 0,
|
|
74
|
+
hasOnChange: !!vt,
|
|
75
|
+
readOnly: O,
|
|
76
|
+
disabled: _
|
|
77
|
+
});
|
|
78
|
+
let A = (e) => Ft(T && e === f ? null : e), Rt = de(Pt, g), j = T && Rt === null ? f : Rt, M = j === f, N = s(() => de(j, !0), [j]), [P, F] = l(!1), [I, L] = l(""), [zt, R] = l(-1), z = c(null), Bt = Te(z, we(It)), B = c(null), Vt = c(null), Ht = Me((t) => {
|
|
79
|
+
B.current = t, e(b, t);
|
|
80
|
+
}, [b]), Ut = Me((t) => {
|
|
81
|
+
Vt.current = t, e(b, t);
|
|
82
|
+
}, [b]), V = c(null), Wt = De(500), H = s(() => new Set(N), [N]), Gt = re(), Kt = I.trim(), U = P && !_ && !O, W = ke({
|
|
83
|
+
options: xt,
|
|
84
|
+
loadOptions: He,
|
|
85
|
+
loadDelay: Ue,
|
|
86
|
+
reloadKey: We,
|
|
87
|
+
creatable: Ge !== void 0,
|
|
88
|
+
searchable: S,
|
|
79
89
|
query: I,
|
|
80
|
-
open:
|
|
90
|
+
open: U,
|
|
81
91
|
current: j,
|
|
82
|
-
onLoaded: (e, t) => R(
|
|
83
|
-
}), { isAsync:
|
|
92
|
+
onLoaded: (e, t) => R(o(-1, "first", ye(e, t, J, p(C.create, t))))
|
|
93
|
+
}), { isAsync: qt, filtered: G, asyncLoading: Jt, loadError: Yt } = W, K = s(() => M ? [E] : v ? W.selected : he(W.selected, j), [
|
|
84
94
|
M,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
95
|
+
E,
|
|
96
|
+
W.selected,
|
|
97
|
+
v,
|
|
88
98
|
j
|
|
89
|
-
]),
|
|
90
|
-
onCreate:
|
|
91
|
-
open:
|
|
99
|
+
]), q = Ae({
|
|
100
|
+
onCreate: Ge,
|
|
101
|
+
open: U,
|
|
92
102
|
onSettled: (e, t) => {
|
|
93
|
-
e && (
|
|
103
|
+
e && (W.remember([e]), A(be(j, e.value, g))), I.trim() === t && an(e ? e.value : null);
|
|
94
104
|
}
|
|
95
|
-
}),
|
|
96
|
-
|
|
105
|
+
}), Xt = v || Jt, Zt = Xt || q.creating, J = Ge !== void 0 && S && !v && !q.creating, Y = s(() => ye(G, I, J && !Jt, p(C.create, I)), [
|
|
106
|
+
G,
|
|
97
107
|
I,
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
]),
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}, [
|
|
105
|
-
let
|
|
108
|
+
J,
|
|
109
|
+
Jt,
|
|
110
|
+
C.create
|
|
111
|
+
]), Qt = s(() => le(G), [G]), $t = Y.length > 0 && ve(Y[Y.length - 1]) ? Y[Y.length - 1] : null, X = zt >= 0 && zt < Y.length ? zt : -1, Z = K.length > 0, en = S && I !== "", tn = Xt ? Ct : q.failed ? C.createError : Yt ? C.loadError : Y.length === 0 ? St : null, nn = () => (S ? B.current : Vt.current)?.focus();
|
|
112
|
+
Ne(() => {
|
|
113
|
+
_ && (F(!1), L(""));
|
|
114
|
+
}, [_]);
|
|
115
|
+
let Q = Me(() => {
|
|
106
116
|
F(!1), L(""), R(-1);
|
|
107
|
-
}, []),
|
|
108
|
-
|
|
109
|
-
},
|
|
110
|
-
|
|
111
|
-
},
|
|
117
|
+
}, []), rn = (e = "selected") => {
|
|
118
|
+
_ || O || (F(!0), R(ue(Y, N, e)));
|
|
119
|
+
}, an = (e) => {
|
|
120
|
+
g ? (L(""), R(e === null ? -1 : ue(ce(h), [e], "selected")), B.current?.focus()) : Q();
|
|
121
|
+
}, on = (e, t = !1) => {
|
|
112
122
|
if (e.disabled) return;
|
|
113
|
-
if (
|
|
114
|
-
|
|
123
|
+
if (ve(e)) {
|
|
124
|
+
q.create(Kt);
|
|
115
125
|
return;
|
|
116
126
|
}
|
|
117
|
-
if (
|
|
118
|
-
let n =
|
|
119
|
-
selected: new Set(
|
|
127
|
+
if (g) {
|
|
128
|
+
let n = Y.filter((e) => !ve(e)), r = n.map((e) => e.value), i = new Set(n.filter((e) => !e.disabled).map((e) => e.value)), a = Gt.toggle({
|
|
129
|
+
selected: new Set(H),
|
|
120
130
|
ids: r,
|
|
121
131
|
target: e.value,
|
|
122
132
|
shift: t,
|
|
123
133
|
isSelectable: (e) => i.has(e)
|
|
124
134
|
});
|
|
125
|
-
A([...N.filter((e) => a.has(e)), ...r.filter((e) => a.has(e) && !
|
|
135
|
+
A([...N.filter((e) => a.has(e)), ...r.filter((e) => a.has(e) && !H.has(e))]), an(e.value);
|
|
126
136
|
return;
|
|
127
137
|
}
|
|
128
|
-
let n =
|
|
129
|
-
n === j ?
|
|
130
|
-
},
|
|
131
|
-
A(
|
|
132
|
-
}, { placement:
|
|
133
|
-
open:
|
|
138
|
+
let n = me(j, e.value, g);
|
|
139
|
+
n === j ? Q() : (A(n), an(e.value));
|
|
140
|
+
}, sn = (e) => A(N.filter((t) => t !== e)), cn = () => {
|
|
141
|
+
A(g ? [] : null), L(""), nn();
|
|
142
|
+
}, { placement: ln, style: un, update: dn } = xe({
|
|
143
|
+
open: U,
|
|
134
144
|
anchor: z,
|
|
135
145
|
floatingRef: V,
|
|
136
146
|
...ie,
|
|
137
|
-
offset:
|
|
147
|
+
offset: Re
|
|
138
148
|
});
|
|
139
|
-
|
|
140
|
-
|
|
149
|
+
Fe(() => {
|
|
150
|
+
U && dn();
|
|
141
151
|
}, [
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
]),
|
|
147
|
-
if (!
|
|
148
|
-
let e = V.current?.querySelector(`[data-kapisel-index="${
|
|
152
|
+
U,
|
|
153
|
+
Y.length,
|
|
154
|
+
tn,
|
|
155
|
+
dn
|
|
156
|
+
]), Ee(U, [z, V], Q), Ne(() => {
|
|
157
|
+
if (!U || X < 0) return;
|
|
158
|
+
let e = V.current?.querySelector(`[data-kapisel-index="${X}"]`);
|
|
149
159
|
e && typeof e.scrollIntoView == "function" && e.scrollIntoView({ block: "nearest" });
|
|
150
|
-
}, [
|
|
151
|
-
let
|
|
152
|
-
if (
|
|
160
|
+
}, [U, X]);
|
|
161
|
+
let fn = (e) => {
|
|
162
|
+
if (_) return;
|
|
153
163
|
let t = e.target;
|
|
154
|
-
V.current?.contains(t) || (t.closest("[data-kapisel-action]") ? e.preventDefault() : t === B.current ? P ||
|
|
155
|
-
},
|
|
156
|
-
L(e), F(!0),
|
|
157
|
-
},
|
|
158
|
-
let t = se(
|
|
164
|
+
V.current?.contains(t) || (t.closest("[data-kapisel-action]") ? e.preventDefault() : t === B.current ? P || rn() : (e.preventDefault(), nn(), P ? Q() : rn()));
|
|
165
|
+
}, pn = (e) => {
|
|
166
|
+
L(e), F(!0), q.resetError(), R(qt ? -1 : o(-1, "first", ye(oe(xt, e), e, J, p(C.create, e))));
|
|
167
|
+
}, mn = (e) => {
|
|
168
|
+
let t = se(Y, Wt(e), P ? X : Y.findIndex((e) => H.has(e.value)));
|
|
159
169
|
t < 0 || (P || F(!0), R(t));
|
|
160
|
-
},
|
|
161
|
-
if (
|
|
162
|
-
let t =
|
|
170
|
+
}, hn = (e) => {
|
|
171
|
+
if (_ || O) return;
|
|
172
|
+
let t = Oe(e, {
|
|
163
173
|
open: P,
|
|
164
|
-
searchable:
|
|
165
|
-
multiple:
|
|
174
|
+
searchable: S,
|
|
175
|
+
multiple: g,
|
|
166
176
|
query: I,
|
|
167
177
|
valueCount: N.length
|
|
168
178
|
});
|
|
@@ -171,207 +181,207 @@ var Pe = 6, Fe = [], f = "\0kapisel-all", Ie = (e, t) => `${e} “${t.trim()}”
|
|
|
171
181
|
let { intent: n } = t;
|
|
172
182
|
switch (n.type) {
|
|
173
183
|
case "open":
|
|
174
|
-
|
|
184
|
+
rn(n.edge);
|
|
175
185
|
break;
|
|
176
186
|
case "move":
|
|
177
|
-
R(
|
|
187
|
+
R(o(X, n.to, Y));
|
|
178
188
|
break;
|
|
179
189
|
case "choose": {
|
|
180
|
-
let e =
|
|
181
|
-
e &&
|
|
190
|
+
let e = X >= 0 ? Y[X] : void 0;
|
|
191
|
+
e && on(e);
|
|
182
192
|
break;
|
|
183
193
|
}
|
|
184
194
|
case "close":
|
|
185
|
-
|
|
195
|
+
Q();
|
|
186
196
|
break;
|
|
187
197
|
case "removeLast":
|
|
188
|
-
|
|
198
|
+
sn(N[N.length - 1]);
|
|
189
199
|
break;
|
|
190
|
-
case "typeahead":
|
|
200
|
+
case "typeahead": mn(n.key);
|
|
191
201
|
}
|
|
192
|
-
},
|
|
193
|
-
n(e.relatedTarget, z.current, V.current) && (P &&
|
|
194
|
-
},
|
|
195
|
-
virtual:
|
|
196
|
-
count:
|
|
197
|
-
contentSized:
|
|
198
|
-
customRows:
|
|
199
|
-
}),
|
|
202
|
+
}, gn = (e) => {
|
|
203
|
+
n(e.relatedTarget, z.current, V.current) && (P && Q(), _t?.(e));
|
|
204
|
+
}, _n = U ? _e(z.current) : null, vn = wt !== null || x, yn = pe({
|
|
205
|
+
virtual: ct,
|
|
206
|
+
count: Y.length,
|
|
207
|
+
contentSized: vn,
|
|
208
|
+
customRows: ot !== void 0
|
|
209
|
+
}), bn = {
|
|
200
210
|
role: "combobox",
|
|
201
|
-
...t(
|
|
211
|
+
...t(D, {
|
|
202
212
|
id: k,
|
|
203
|
-
describedBy:
|
|
204
|
-
invalid:
|
|
205
|
-
required:
|
|
206
|
-
labelable:
|
|
207
|
-
ariaLabel:
|
|
213
|
+
describedBy: Mt,
|
|
214
|
+
invalid: tt,
|
|
215
|
+
required: nt,
|
|
216
|
+
labelable: S,
|
|
217
|
+
ariaLabel: kt
|
|
208
218
|
}),
|
|
209
219
|
"aria-haspopup": "listbox",
|
|
210
|
-
"aria-expanded":
|
|
211
|
-
"aria-controls":
|
|
212
|
-
"aria-activedescendant":
|
|
213
|
-
"aria-label":
|
|
214
|
-
"aria-disabled":
|
|
215
|
-
"aria-readonly":
|
|
216
|
-
"aria-busy":
|
|
217
|
-
}, $ =
|
|
220
|
+
"aria-expanded": U,
|
|
221
|
+
"aria-controls": U ? jt : void 0,
|
|
222
|
+
"aria-activedescendant": U && X >= 0 ? Nt(X) : void 0,
|
|
223
|
+
"aria-label": kt,
|
|
224
|
+
"aria-disabled": _ || void 0,
|
|
225
|
+
"aria-readonly": O || void 0,
|
|
226
|
+
"aria-busy": Zt || void 0
|
|
227
|
+
}, $ = st && Z && !M ? st(K) : null, xn = !Z && !en && /* @__PURE__ */ u("span", {
|
|
218
228
|
className: "kapisel__placeholder",
|
|
219
229
|
"aria-hidden": "true",
|
|
220
|
-
children:
|
|
230
|
+
children: yt
|
|
221
231
|
});
|
|
222
|
-
return
|
|
223
|
-
ref:
|
|
224
|
-
className:
|
|
225
|
-
size:
|
|
226
|
-
open:
|
|
227
|
-
disabled:
|
|
228
|
-
readOnly:
|
|
229
|
-
multi:
|
|
230
|
-
chip:
|
|
231
|
-
className:
|
|
232
|
+
return Ot.wrap(/* @__PURE__ */ d("div", {
|
|
233
|
+
ref: Bt,
|
|
234
|
+
className: Be({
|
|
235
|
+
size: Tt,
|
|
236
|
+
open: U,
|
|
237
|
+
disabled: _,
|
|
238
|
+
readOnly: O,
|
|
239
|
+
multi: g,
|
|
240
|
+
chip: x,
|
|
241
|
+
className: pt
|
|
232
242
|
}),
|
|
233
|
-
style:
|
|
234
|
-
onMouseDown:
|
|
243
|
+
style: mt,
|
|
244
|
+
onMouseDown: fn,
|
|
235
245
|
children: [
|
|
236
|
-
|
|
237
|
-
|
|
246
|
+
x && Ye,
|
|
247
|
+
x && Et && /* @__PURE__ */ d("span", {
|
|
238
248
|
className: "kapisel__chiplabel",
|
|
239
249
|
"aria-hidden": "true",
|
|
240
|
-
children: [
|
|
250
|
+
children: [Et, ":"]
|
|
241
251
|
}),
|
|
242
|
-
/* @__PURE__ */
|
|
252
|
+
/* @__PURE__ */ d("div", {
|
|
243
253
|
className: "kapisel__values",
|
|
244
254
|
children: [
|
|
245
|
-
|
|
255
|
+
g && $ !== null && /* @__PURE__ */ u("span", {
|
|
246
256
|
className: "kapisel__single",
|
|
247
257
|
"aria-hidden": "true",
|
|
248
258
|
children: $
|
|
249
259
|
}),
|
|
250
|
-
|
|
260
|
+
g && $ === null && K.map((e) => /* @__PURE__ */ d("span", {
|
|
251
261
|
className: "kapisel__chip",
|
|
252
|
-
children: [/* @__PURE__ */
|
|
262
|
+
children: [/* @__PURE__ */ u("span", {
|
|
253
263
|
className: "kapisel__chip-label",
|
|
254
264
|
children: e.label
|
|
255
|
-
}), /* @__PURE__ */
|
|
265
|
+
}), /* @__PURE__ */ u("button", {
|
|
256
266
|
type: "button",
|
|
257
267
|
tabIndex: -1,
|
|
258
268
|
"data-kapisel-action": !0,
|
|
259
269
|
className: "kapisel__chip-x",
|
|
260
|
-
"aria-label": `${
|
|
261
|
-
disabled:
|
|
262
|
-
hidden:
|
|
263
|
-
onClick: () =>
|
|
264
|
-
children: /* @__PURE__ */
|
|
270
|
+
"aria-label": `${C.remove} ${e.label}`,
|
|
271
|
+
disabled: _,
|
|
272
|
+
hidden: O || void 0,
|
|
273
|
+
onClick: () => sn(e.value),
|
|
274
|
+
children: /* @__PURE__ */ u(Le, {
|
|
265
275
|
size: 12,
|
|
266
276
|
strokeWidth: 2.6,
|
|
267
277
|
"aria-hidden": "true"
|
|
268
278
|
})
|
|
269
279
|
})]
|
|
270
280
|
}, e.value)),
|
|
271
|
-
|
|
281
|
+
S ? /* @__PURE__ */ d("div", {
|
|
272
282
|
className: "kapisel__inputwrap",
|
|
273
283
|
children: [
|
|
274
|
-
!
|
|
284
|
+
!g && Z && !en && /* @__PURE__ */ u("span", {
|
|
275
285
|
className: "kapisel__single",
|
|
276
286
|
"aria-hidden": "true",
|
|
277
|
-
children: $ ??
|
|
287
|
+
children: $ ?? K[0]?.label
|
|
278
288
|
}),
|
|
279
|
-
|
|
280
|
-
/* @__PURE__ */
|
|
281
|
-
...
|
|
282
|
-
ref:
|
|
289
|
+
xn,
|
|
290
|
+
/* @__PURE__ */ u("input", {
|
|
291
|
+
...bn,
|
|
292
|
+
ref: Ht,
|
|
283
293
|
type: "text",
|
|
284
294
|
className: "kapisel__input",
|
|
285
295
|
autoComplete: "off",
|
|
286
296
|
"aria-autocomplete": "list",
|
|
287
|
-
disabled:
|
|
288
|
-
readOnly:
|
|
297
|
+
disabled: _,
|
|
298
|
+
readOnly: O || void 0,
|
|
289
299
|
value: I,
|
|
290
|
-
onChange: (e) =>
|
|
291
|
-
onKeyDown:
|
|
292
|
-
onBlur:
|
|
300
|
+
onChange: (e) => pn(e.target.value),
|
|
301
|
+
onKeyDown: hn,
|
|
302
|
+
onBlur: gn
|
|
293
303
|
})
|
|
294
304
|
]
|
|
295
|
-
}) : /* @__PURE__ */
|
|
296
|
-
...
|
|
297
|
-
ref:
|
|
305
|
+
}) : /* @__PURE__ */ d("div", {
|
|
306
|
+
...bn,
|
|
307
|
+
ref: Ut,
|
|
298
308
|
className: "kapisel__combo",
|
|
299
|
-
tabIndex:
|
|
300
|
-
onKeyDown:
|
|
301
|
-
onBlur:
|
|
302
|
-
children: [!
|
|
309
|
+
tabIndex: _ ? -1 : 0,
|
|
310
|
+
onKeyDown: hn,
|
|
311
|
+
onBlur: gn,
|
|
312
|
+
children: [!g && Z && /* @__PURE__ */ u("span", {
|
|
303
313
|
className: "kapisel__single",
|
|
304
314
|
"aria-hidden": "true",
|
|
305
|
-
children: $ ??
|
|
306
|
-
}),
|
|
315
|
+
children: $ ?? K[0]?.label
|
|
316
|
+
}), xn]
|
|
307
317
|
})
|
|
308
318
|
]
|
|
309
319
|
}),
|
|
310
|
-
/* @__PURE__ */
|
|
311
|
-
id:
|
|
320
|
+
/* @__PURE__ */ u("span", {
|
|
321
|
+
id: Mt,
|
|
312
322
|
className: "kapisel__sr",
|
|
313
|
-
children: ae(
|
|
323
|
+
children: ae(K, yt)
|
|
314
324
|
}),
|
|
315
|
-
|
|
325
|
+
Zt && /* @__PURE__ */ u("span", {
|
|
316
326
|
className: "kapisel__spinner kapi-spinner kapi-spinner--sm",
|
|
317
327
|
"aria-hidden": "true"
|
|
318
328
|
}),
|
|
319
|
-
|
|
329
|
+
et && Z && !M && !_ && !O && /* @__PURE__ */ u("button", {
|
|
320
330
|
type: "button",
|
|
321
331
|
tabIndex: -1,
|
|
322
332
|
"data-kapisel-action": !0,
|
|
323
333
|
className: "kapisel__clear",
|
|
324
|
-
"aria-label":
|
|
325
|
-
onClick:
|
|
326
|
-
children: /* @__PURE__ */
|
|
334
|
+
"aria-label": C.clear,
|
|
335
|
+
onClick: cn,
|
|
336
|
+
children: /* @__PURE__ */ u(Le, {
|
|
327
337
|
size: 15,
|
|
328
338
|
strokeWidth: 2.4,
|
|
329
339
|
"aria-hidden": "true"
|
|
330
340
|
})
|
|
331
341
|
}),
|
|
332
|
-
/* @__PURE__ */
|
|
342
|
+
/* @__PURE__ */ u("span", {
|
|
333
343
|
className: "kapisel__caret",
|
|
334
344
|
"aria-hidden": "true",
|
|
335
|
-
children: /* @__PURE__ */
|
|
336
|
-
size:
|
|
345
|
+
children: /* @__PURE__ */ u(Ie, {
|
|
346
|
+
size: x ? 14 : 17,
|
|
337
347
|
strokeWidth: 2.2
|
|
338
348
|
})
|
|
339
349
|
}),
|
|
340
|
-
|
|
350
|
+
y && (g ? N.map((e) => /* @__PURE__ */ u("input", {
|
|
341
351
|
type: "hidden",
|
|
342
|
-
name:
|
|
352
|
+
name: y,
|
|
343
353
|
value: e
|
|
344
|
-
}, e)) : /* @__PURE__ */
|
|
354
|
+
}, e)) : /* @__PURE__ */ u("input", {
|
|
345
355
|
type: "hidden",
|
|
346
|
-
name:
|
|
356
|
+
name: y,
|
|
347
357
|
value: M ? "" : j ?? ""
|
|
348
358
|
})),
|
|
349
|
-
|
|
350
|
-
root:
|
|
359
|
+
_n && /* @__PURE__ */ u(je, {
|
|
360
|
+
root: _n,
|
|
351
361
|
ref: V,
|
|
352
|
-
side:
|
|
353
|
-
hug:
|
|
354
|
-
style:
|
|
355
|
-
listboxId:
|
|
356
|
-
optionId:
|
|
357
|
-
multiple:
|
|
358
|
-
"aria-label":
|
|
359
|
-
rows:
|
|
360
|
-
createRow:
|
|
361
|
-
createIndex:
|
|
362
|
-
loading:
|
|
363
|
-
empty:
|
|
364
|
-
message:
|
|
365
|
-
active:
|
|
362
|
+
side: ln?.side === "top" ? "top" : "bottom",
|
|
363
|
+
hug: vn,
|
|
364
|
+
style: un,
|
|
365
|
+
listboxId: jt,
|
|
366
|
+
optionId: Nt,
|
|
367
|
+
multiple: g,
|
|
368
|
+
"aria-label": kt,
|
|
369
|
+
rows: Qt,
|
|
370
|
+
createRow: $t,
|
|
371
|
+
createIndex: Y.length - 1,
|
|
372
|
+
loading: Xt,
|
|
373
|
+
empty: Y.length === 0,
|
|
374
|
+
message: tn,
|
|
375
|
+
active: X,
|
|
366
376
|
values: N,
|
|
367
|
-
renderOption:
|
|
377
|
+
renderOption: ot,
|
|
368
378
|
query: I,
|
|
369
|
-
virtual:
|
|
379
|
+
virtual: yn,
|
|
370
380
|
onHover: R,
|
|
371
|
-
onChoose:
|
|
381
|
+
onChoose: on
|
|
372
382
|
})
|
|
373
383
|
]
|
|
374
384
|
}));
|
|
375
385
|
};
|
|
376
386
|
//#endregion
|
|
377
|
-
export {
|
|
387
|
+
export { Ve as DEFAULT_SELECT_LABELS, m as KapiSelect, Be as selectClasses };
|