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