@kapiuara/ui 0.6.0 → 0.7.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.
Files changed (46) hide show
  1. package/README.md +69 -4
  2. package/dist/components/chat/KapiComposer.d.ts +2 -2
  3. package/dist/components/chat/KapiComposer.js +47 -45
  4. package/dist/components/data/KapiTable.d.ts +25 -1
  5. package/dist/components/data/KapiTable.js +408 -390
  6. package/dist/components/data/index.d.ts +1 -1
  7. package/dist/components/data/tableLogic.d.ts +7 -0
  8. package/dist/components/data/tableLogic.js +21 -16
  9. package/dist/components/inputs/KapiButton.d.ts +9 -2
  10. package/dist/components/inputs/KapiButton.js +25 -15
  11. package/dist/components/inputs/KapiFacetedSearch.d.ts +29 -5
  12. package/dist/components/inputs/KapiFacetedSearch.js +161 -119
  13. package/dist/components/inputs/KapiSegmented.d.ts +2 -1
  14. package/dist/components/inputs/KapiSegmented.js +45 -44
  15. package/dist/components/inputs/facetedSearchLogic.d.ts +40 -9
  16. package/dist/components/inputs/facetedSearchLogic.js +38 -20
  17. package/dist/components/inputs/index.d.ts +2 -2
  18. package/dist/components/layout/KapiRail.d.ts +1 -1
  19. package/dist/components/layout/KapiRail.js +57 -50
  20. package/dist/components/layout/KapiShell.d.ts +9 -2
  21. package/dist/components/layout/KapiShell.js +22 -22
  22. package/dist/components/navigation/KapiTabs.d.ts +3 -1
  23. package/dist/components/navigation/KapiTabs.js +47 -46
  24. package/dist/components/overlays/KapiCanvasForm.js +2 -6
  25. package/dist/components/overlays/KapiConfirm.js +1 -6
  26. package/dist/hooks/colorLogic.d.ts +26 -0
  27. package/dist/hooks/colorLogic.js +53 -0
  28. package/dist/hooks/index.d.ts +6 -0
  29. package/dist/hooks/numberFormatLogic.d.ts +6 -0
  30. package/dist/hooks/numberFormatLogic.js +7 -0
  31. package/dist/hooks/rightClick.d.ts +10 -0
  32. package/dist/hooks/rightClick.js +10 -4
  33. package/dist/hooks/themeColorsLogic.d.ts +11 -0
  34. package/dist/hooks/themeColorsLogic.js +37 -0
  35. package/dist/hooks/themeContrastLogic.d.ts +23 -0
  36. package/dist/hooks/themeContrastLogic.js +46 -0
  37. package/dist/hooks/themeDeriveLogic.d.ts +52 -0
  38. package/dist/hooks/themeDeriveLogic.js +103 -0
  39. package/dist/hooks/useDragScroll.js +26 -23
  40. package/dist/hooks/useGlobalRightClick.js +28 -25
  41. package/dist/hooks/useKapiTheme.d.ts +28 -4
  42. package/dist/hooks/useKapiTheme.js +82 -50
  43. package/dist/index.js +129 -126
  44. package/dist/kapi.css +1 -1
  45. package/dist/kapi.layered.css +1 -1
  46. package/package.json +3 -3
@@ -4,24 +4,26 @@ import { rafThrottle as n } from "../../hooks/rafThrottle.js";
4
4
  import { KapiSelect as r } from "../inputs/KapiSelect.js";
5
5
  import { joinClasses as i } from "../rootProps.js";
6
6
  /* empty css */
7
- import { applyRangeSelection as a, buildCsv as o, clampColumnWidth as s, computePagination as c, computeStickyOffsets as ee, computeVisibleRange as te, csvFileName as ne, csvHeaderOf as re, effectiveColumnWidth as ie, filterRows as ae, filterSearchColumns as l, lastStickyIndex as oe, nextScrollWindow as se, nextSortState as ce, rangeBetween as le, readCell as u, resizeColumn as ue, rowSelectLabel as d, selectionState as de, sortRowsByColumn as fe, toggleAllIds as pe, toggleColumnVisibility as me, toggleId as he, visibleColumnsOf as ge } from "./tableLogic.js";
8
- import { KapiContextMenu as _e } from "../overlays/KapiContextMenu.js";
9
- import { downloadBlob as ve } from "../../hooks/downloadLogic.js";
10
- import { useDragScroll as ye } from "../../hooks/useDragScroll.js";
11
- import { draftStickyLefts as be, endResizeDrag as xe, moveResizeDrag as Se, needsDraftLeftPaint as Ce, startResizeDrag as we } from "./tableResizeLogic.js";
12
- import { KapiSkeleton as Te } from "../feedback/KapiSkeleton.js";
13
- import { KapiBulkBar as Ee } from "../feedback/KapiBulkBar.js";
14
- import { DEFAULT_TABLE_FILTER_LABELS as f, KapiTableFilter as De } from "./KapiTableFilter.js";
7
+ import { applyRangeSelection as a, buildCsv as o, clampColumnWidth as ee, computePagination as s, computeStickyOffsets as te, computeVisibleRange as ne, csvFileName as re, csvHeaderOf as ie, effectiveColumnWidth as ae, filterRows as oe, filterSearchColumns as c, lastStickyIndex as se, nextScrollWindow as ce, nextSortState as le, rangeBetween as ue, readCell as l, resizeColumn as de, rowSelectLabel as u, selectOnlyWithin as fe, selectionState as pe, sortRowsByColumn as me, toggleAllIds as he, toggleColumnVisibility as ge, toggleId as _e, visibleColumnsOf as ve } from "./tableLogic.js";
8
+ import { KapiContextMenu as ye } from "../overlays/KapiContextMenu.js";
9
+ import { KapiMenuButton as be } from "../overlays/KapiMenuButton.js";
10
+ import { downloadBlob as xe } from "../../hooks/downloadLogic.js";
11
+ import { useDragScroll as Se } from "../../hooks/useDragScroll.js";
12
+ import { draftStickyLefts as Ce, endResizeDrag as we, moveResizeDrag as Te, needsDraftLeftPaint as Ee, startResizeDrag as De } from "./tableResizeLogic.js";
13
+ import { KapiSkeleton as Oe } from "../feedback/KapiSkeleton.js";
14
+ import { KapiBulkBar as ke } from "../feedback/KapiBulkBar.js";
15
+ import { DEFAULT_TABLE_FILTER_LABELS as d, KapiTableFilter as Ae } from "./KapiTableFilter.js";
15
16
  /* empty css */
16
- import { Fragment as Oe, jsx as p, jsxs as m } from "react/jsx-runtime";
17
- import { memo as h, useCallback as ke, useEffect as g, useLayoutEffect as Ae, useMemo as _, useRef as v, useState as y } from "react";
18
- import { Check as je, ChevronDown as Me, ChevronLeft as Ne, ChevronRight as Pe, ChevronUp as b, ChevronsUpDown as Fe, Columns3 as Ie, Copy as Le, Download as Re, Loader2 as ze, MoreHorizontal as x } from "lucide-react";
17
+ import { Fragment as je, jsx as f, jsxs as p } from "react/jsx-runtime";
18
+ import { memo as m, useCallback as Me, useEffect as h, useLayoutEffect as Ne, useMemo as g, useRef as _, useState as v } from "react";
19
+ import { Check as Pe, ChevronDown as Fe, ChevronLeft as Ie, ChevronRight as Le, ChevronUp as y, ChevronsUpDown as Re, Columns3 as ze, Copy as Be, Download as Ve, Loader2 as He, MoreHorizontal as Ue } from "lucide-react";
19
20
  //#region src/components/data/KapiTable.tsx
20
- var Be = {
21
- region: f.region,
21
+ var We = {
22
+ region: d.region,
22
23
  empty: "Sin resultados",
23
24
  loading: "Cargando…",
24
25
  selectAll: "Seleccionar todo",
26
+ selectMatching: "Seleccionar por condición",
25
27
  selectRow: "Seleccionar fila",
26
28
  selectRowNamed: "Seleccionar",
27
29
  copy: "Copiar",
@@ -41,20 +43,20 @@ var Be = {
41
43
  filterAll: "Todas",
42
44
  of: "de",
43
45
  exportCsv: "Exportar CSV"
44
- }, Ve = "button, a, input, select, textarea, label, [role=button]", He = 600, Ue = 5, We = [
46
+ }, Ge = "button, a, input, select, textarea, label, [role=button]", Ke = 600, qe = 5, Je = [
45
47
  96,
46
48
  72,
47
49
  84,
48
50
  60
49
- ], Ge = {
51
+ ], Ye = {
50
52
  text: "",
51
53
  column: null
52
- }, Ke = (e, t) => {
54
+ }, Xe = (e, t) => {
53
55
  try {
54
56
  navigator.clipboard?.writeText(String(e))?.catch(() => void 0);
55
57
  } catch {}
56
58
  t?.(e);
57
- }, qe = (e) => typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e) : e.replace(/["\\]/g, "\\$&"), Je = (e, t, n) => {
59
+ }, Ze = (e) => typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e) : e.replace(/["\\]/g, "\\$&"), Qe = (e, t, n) => {
58
60
  let r = n[e.key];
59
61
  return r === void 0 ? t === "th" ? {
60
62
  width: e.flex ? "100%" : e.width,
@@ -68,242 +70,252 @@ var Be = {
68
70
  minWidth: r,
69
71
  maxWidth: r
70
72
  };
71
- }, Ye = (e, t = !1) => `${e.sticky ? "is-sticky" : ""}${e.sticky && t ? " is-sticky-last" : ""}${e.flex ? " is-flex" : ""}${e.align ? ` is-align-${e.align}` : ""}`, Xe = (e, t, n, r) => {
72
- let i = e.render ? e.render(t) : u(t, e.key);
73
+ }, $e = (e, t = !1) => `${e.sticky ? "is-sticky" : ""}${e.sticky && t ? " is-sticky-last" : ""}${e.flex ? " is-flex" : ""}${e.align ? ` is-align-${e.align}` : ""}`, et = (e, t, n, r) => {
74
+ let i = e.render ? e.render(t) : l(t, e.key);
73
75
  if (!e.copyable) return i;
74
- let a = e.copyValue ? e.copyValue(t) : u(t, e.key);
75
- return /* @__PURE__ */ m("span", {
76
+ let a = e.copyValue ? e.copyValue(t) : l(t, e.key);
77
+ return /* @__PURE__ */ p("span", {
76
78
  className: "kapi-cell",
77
- children: [/* @__PURE__ */ p("span", {
79
+ children: [/* @__PURE__ */ f("span", {
78
80
  className: "kapi-cell__v",
79
81
  children: i
80
- }), /* @__PURE__ */ p("button", {
82
+ }), /* @__PURE__ */ f("button", {
81
83
  type: "button",
82
84
  className: "kapi-cell__copy",
83
85
  "aria-label": n.copy,
84
86
  onClick: (e) => {
85
- e.stopPropagation(), Ke(a, r);
87
+ e.stopPropagation(), Xe(a, r);
86
88
  },
87
- children: /* @__PURE__ */ p(Le, {
89
+ children: /* @__PURE__ */ f(Be, {
88
90
  size: 13,
89
91
  strokeWidth: 2
90
92
  })
91
93
  })]
92
94
  });
93
- }, Ze = (e) => e === "asc" ? /* @__PURE__ */ p(b, {
95
+ }, tt = (e) => e === "asc" ? /* @__PURE__ */ f(y, {
94
96
  size: 13,
95
97
  strokeWidth: 2.4
96
- }) : e === "desc" ? /* @__PURE__ */ p(Me, {
98
+ }) : e === "desc" ? /* @__PURE__ */ f(Fe, {
97
99
  size: 13,
98
100
  strokeWidth: 2.4
99
- }) : /* @__PURE__ */ p(Fe, {
101
+ }) : /* @__PURE__ */ f(Re, {
100
102
  size: 13,
101
103
  strokeWidth: 2
102
104
  });
103
- function Qe({ columns: f, rows: h, keyField: b = "id", maxHeight: Fe = "58vh", fill: Le = !1, bulkActionsPlacement: x = "bottom", className: Ve, style: Ke, id: Xe, labels: Qe, actions: $e, rowMenu: S, contextMenu: tt, onCopy: nt, selectable: C = !1, rowSelect: rt = !1, rowLabel: it, selectedIds: at, onSelectedIdsChange: ot, bulkActions: st, rangeSelect: ct = !0, virtual: w = !1, rowHeight: T = 46, sort: lt, defaultSort: ut = null, onSortChange: dt, manualSort: ft = !1, pagination: E, loading: D = !1, loadingRows: pt = Ue, card: mt = !1, emptyMessage: ht, loadingMessage: gt, isRowSelectable: O, renderSubComponent: _t, expandedIds: vt, onExpandedIdsChange: yt, density: bt = "default", rowHover: xt = !1, columnToggle: St = !1, columnVisibility: Ct, defaultColumnVisibility: wt, onColumnVisibilityChange: Tt, resizableColumns: Et = !1, columnWidths: Dt, defaultColumnWidths: Ot, onColumnWidthsChange: kt, filterable: At = !1, filter: jt, defaultFilter: Mt = Ge, onFilterChange: Nt, manualFilter: k = !1, filterDebounce: Pt = 300, exportCsv: A, mobileCards: Ft = !1 }) {
104
- let j = t("table", Be, Qe), It = ht === void 0 ? j.empty : ht, Lt = gt === void 0 ? j.loading : gt, Rt = e(), [zt, Bt] = y(null), [M, Vt] = y(null), [Ht, Ut] = y({
105
+ function nt({ columns: d, rows: m, keyField: y = "id", maxHeight: Re = "58vh", fill: Be = !1, bulkActionsPlacement: Ue = "bottom", className: Ge, style: Xe, id: et, labels: nt, actions: rt, rowMenu: b, contextMenu: at, onCopy: ot, selectable: x = !1, rowSelect: st = !1, rowLabel: ct, selectedIds: lt, onSelectedIdsChange: ut, bulkActions: dt, rangeSelect: ft = !0, selectionPresets: S, virtual: C = !1, rowHeight: w = 46, sort: pt, defaultSort: mt = null, onSortChange: ht, manualSort: gt = !1, pagination: T, loading: E = !1, loadingRows: _t = qe, card: vt = !1, emptyMessage: yt, loadingMessage: bt, isRowSelectable: D, renderSubComponent: xt, expandedIds: St, onExpandedIdsChange: Ct, density: wt = "default", rowHover: Tt = !1, columnToggle: Et = !1, columnVisibility: Dt, defaultColumnVisibility: Ot, onColumnVisibilityChange: kt, resizableColumns: At = !1, columnWidths: jt, defaultColumnWidths: Mt, onColumnWidthsChange: Nt, filterable: Pt = !1, filter: Ft, defaultFilter: It = Ye, onFilterChange: Lt, manualFilter: O = !1, filterDebounce: Rt = 300, exportCsv: k, toolbar: zt, mobileCards: Bt = !1 }) {
106
+ let A = t("table", We, nt), Vt = yt === void 0 ? A.empty : yt, Ht = bt === void 0 ? A.loading : bt, Ut = e(), [Wt, Gt] = v(null), [j, Kt] = v(null), [qt, Jt] = v({
105
107
  scrollTop: 0,
106
- viewHeight: He
107
- }), N = ye({ onMenu: tt ? (e, t) => Bt({
108
+ viewHeight: Ke
109
+ }), M = Se({ onMenu: at ? (e, t) => Gt({
108
110
  x: e,
109
111
  y: t
110
- }) : void 0 }), Wt = at !== void 0, [Gt, Kt] = y(() => /* @__PURE__ */ new Set()), P = _(() => Wt ? new Set(at) : Gt, [
111
- Wt,
112
- at,
113
- Gt
114
- ]), F = (e) => {
115
- Wt || Kt(e), ot?.([...e]);
116
- }, qt = () => F(/* @__PURE__ */ new Set()), Jt = [...P], Yt = v(null), Xt = lt !== void 0, [Zt, Qt] = y(ut), I = Xt ? lt : Zt, $t = (e) => {
117
- let t = ce(I, e);
118
- Xt || Qt(t), dt?.(t);
119
- }, L = !!_t && !w, en = vt !== void 0, [tn, nn] = y(() => /* @__PURE__ */ new Set()), rn = _(() => en ? new Set(vt) : tn, [
120
- en,
121
- vt,
122
- tn
123
- ]), an = (e) => {
124
- let t = he(rn, e);
125
- en || nn(t), yt?.([...t]);
126
- }, on = Ct !== void 0, [sn, cn] = y(wt ?? {}), R = on ? Ct : sn, [ln, un] = y(!1), dn = (e) => {
127
- let t = me(R, e);
128
- on || cn(t), Tt?.(t);
129
- }, fn = Dt !== void 0, [pn, mn] = y(Ot ?? {}), z = fn ? Dt : pn, hn = (e) => {
130
- fn || mn(e), kt?.(e);
131
- }, B = v(null), gn = v(null), V = _(() => ge(f, R), [f, R]), _n = jt !== void 0, [vn, yn] = y(Mt), H = _n ? jt : vn, bn = (e) => {
112
+ }) : void 0 }), Yt = lt !== void 0, [Xt, Zt] = v(() => /* @__PURE__ */ new Set()), N = g(() => Yt ? new Set(lt) : Xt, [
113
+ Yt,
114
+ lt,
115
+ Xt
116
+ ]), P = (e) => {
117
+ Yt || Zt(e), ut?.([...e]);
118
+ }, Qt = () => P(/* @__PURE__ */ new Set()), $t = [...N], en = _(null), tn = pt !== void 0, [nn, rn] = v(mt), F = tn ? pt : nn, an = (e) => {
119
+ let t = le(F, e);
120
+ tn || rn(t), ht?.(t);
121
+ }, I = !!xt && !C, on = St !== void 0, [sn, cn] = v(() => /* @__PURE__ */ new Set()), ln = g(() => on ? new Set(St) : sn, [
122
+ on,
123
+ St,
124
+ sn
125
+ ]), un = (e) => {
126
+ let t = _e(ln, e);
127
+ on || cn(t), Ct?.([...t]);
128
+ }, dn = Dt !== void 0, [fn, pn] = v(Ot ?? {}), L = dn ? Dt : fn, [mn, hn] = v(!1), gn = (e) => {
129
+ let t = ge(L, e);
130
+ dn || pn(t), kt?.(t);
131
+ }, _n = jt !== void 0, [vn, yn] = v(Mt ?? {}), R = _n ? jt : vn, bn = (e) => {
132
132
  _n || yn(e), Nt?.(e);
133
- }, xn = _(() => {
134
- if (k) return h;
135
- let e = l(V, H.column);
136
- return ae(h, (t) => e.map((e) => e.filterValue ? e.filterValue(t) : u(t, e.key)), H.text);
133
+ }, z = _(null), xn = _(null), B = g(() => ve(d, L), [d, L]), Sn = Ft !== void 0, [Cn, wn] = v(It), V = Sn ? Ft : Cn, Tn = (e) => {
134
+ Sn || wn(e), Lt?.(e);
135
+ }, En = g(() => {
136
+ if (O) return m;
137
+ let e = c(B, V.column);
138
+ return oe(m, (t) => e.map((e) => e.filterValue ? e.filterValue(t) : l(t, e.key)), V.text);
137
139
  }, [
138
- h,
140
+ m,
141
+ B,
139
142
  V,
140
- H,
141
- k
142
- ]), U = _(() => ft ? xn : fe(xn, f, I, Rt), [
143
- xn,
144
- f,
145
- I,
146
- ft,
147
- Rt
148
- ]), W = _(() => ee(V.map((e) => ({
143
+ O
144
+ ]), H = g(() => gt ? En : me(En, d, F, Ut), [
145
+ En,
146
+ d,
147
+ F,
148
+ gt,
149
+ Ut
150
+ ]), U = x && S !== void 0 && S.length > 0, Dn = U ? 80 : 46, W = g(() => te(B.map((e) => ({
149
151
  sticky: e.sticky,
150
- width: ie(e, z)
151
- })), (C ? 46 : 0) + (L ? 44 : 0)), [
152
- V,
153
- z,
154
- C,
155
- L
156
- ]), Sn = _(() => oe(V), [V]), Cn = f.filter((e) => e.hideable !== !1), G = !!($e || S), K = V.length + +!!C + +!!G + +!!L, wn = _(() => U.filter((e) => !O || O(e)).map((e) => e[b]), [
152
+ width: ae(e, R)
153
+ })), (x ? Dn : 0) + (I ? 44 : 0)), [
154
+ B,
155
+ R,
156
+ x,
157
+ Dn,
158
+ I
159
+ ]), On = g(() => se(B), [B]), kn = d.filter((e) => e.hideable !== !1), G = !!(rt || b), K = B.length + +!!x + +!!G + +!!I, q = g(() => H.filter((e) => !D || D(e)), [H, D]), J = g(() => q.map((e) => e[y]), [q, y]), An = g(() => U && S ? S.map((e) => ({
160
+ preset: e,
161
+ matching: q.filter(e.match).map((e) => e[y])
162
+ })) : [], [
157
163
  U,
158
- b,
159
- O
160
- ]), Tn = de(wn, P), En = (e, t) => {
161
- let n = !P.has(e), r = Yt.current;
162
- if (ct && t && r !== null && r !== e) {
163
- let t = le(wn, r, e);
164
+ S,
165
+ q,
166
+ y
167
+ ]).map(({ preset: e, matching: t }) => ({
168
+ label: e.label,
169
+ ...e.icon !== void 0 && { icon: e.icon },
170
+ disabled: t.length === 0,
171
+ onClick: () => P(fe(N, J, t))
172
+ })), jn = pe(J, N), Mn = (e, t) => {
173
+ let n = !N.has(e), r = en.current;
174
+ if (ft && t && r !== null && r !== e) {
175
+ let t = ue(J, r, e);
164
176
  if (t.length > 0) {
165
- F(a(P, t, n));
177
+ P(a(N, t, n));
166
178
  return;
167
179
  }
168
180
  }
169
- Yt.current = e, F(he(P, e));
170
- }, { start: Dn, end: On, padTop: kn, padBottom: An } = w ? te({
171
- total: U.length,
172
- rowHeight: T,
173
- ...Ht
181
+ en.current = e, P(_e(N, e));
182
+ }, { start: Nn, end: Pn, padTop: Fn, padBottom: In } = C ? ne({
183
+ total: H.length,
184
+ rowHeight: w,
185
+ ...qt
174
186
  }) : {
175
187
  start: 0,
176
- end: U.length,
188
+ end: H.length,
177
189
  padTop: 0,
178
190
  padBottom: 0
179
- }, jn = U.slice(Dn, On), Mn = E ? Math.max(0, E.page - 1) * E.pageSize : 0, Nn = v({
180
- total: U.length,
181
- rowHeight: T
191
+ }, Ln = H.slice(Nn, Pn), Rn = T ? Math.max(0, T.page - 1) * T.pageSize : 0, zn = _({
192
+ total: H.length,
193
+ rowHeight: w
182
194
  });
183
- Nn.current = {
184
- total: U.length,
185
- rowHeight: T
195
+ zn.current = {
196
+ total: H.length,
197
+ rowHeight: w
186
198
  };
187
- let q = ke((e) => {
199
+ let Bn = Me((e) => {
188
200
  let t = {
189
201
  scrollTop: e.scrollTop,
190
- viewHeight: e.clientHeight || He
202
+ viewHeight: e.clientHeight || Ke
191
203
  };
192
- Ut((e) => se(e, t, Nn.current));
193
- }, []), J = ke(() => {
194
- let e = N.current;
195
- e && q(e);
196
- }, [N, q]);
197
- Ae(() => {
198
- w && J();
204
+ Jt((e) => ce(e, t, zn.current));
205
+ }, []), Y = Me(() => {
206
+ let e = M.current;
207
+ e && Bn(e);
208
+ }, [M, Bn]);
209
+ Ne(() => {
210
+ C && Y();
199
211
  }, [
212
+ C,
213
+ Re,
200
214
  w,
201
- Fe,
202
- T,
203
- J
204
- ]), g(() => {
205
- let e = N.current;
206
- if (!w || !e || typeof ResizeObserver > "u") return;
207
- let t = new ResizeObserver(J);
215
+ Y
216
+ ]), h(() => {
217
+ let e = M.current;
218
+ if (!C || !e || typeof ResizeObserver > "u") return;
219
+ let t = new ResizeObserver(Y);
208
220
  return t.observe(e), () => t.disconnect();
209
221
  }, [
210
- w,
211
- N,
212
- J
222
+ C,
223
+ M,
224
+ Y
213
225
  ]);
214
- let Pn = (e) => {
215
- w && q(e.currentTarget);
216
- }, Fn = v(!0);
217
- g(() => {
218
- if (Fn.current) {
219
- Fn.current = !1;
226
+ let Vn = (e) => {
227
+ C && Bn(e.currentTarget);
228
+ }, Hn = _(!0);
229
+ h(() => {
230
+ if (Hn.current) {
231
+ Hn.current = !1;
220
232
  return;
221
233
  }
222
- let e = N.current;
234
+ let e = M.current;
223
235
  e && e.scrollTop > 0 && (e.scrollTop = 0);
224
236
  }, [
225
- H.text,
226
- H.column,
227
- N
237
+ V.text,
238
+ V.column,
239
+ M
228
240
  ]);
229
- let In = typeof A == "object" ? A : {}, Ln = () => {
230
- let e = V.map(re), t = In.rows, n = (t === void 0 ? U : typeof t == "function" ? t() : t).map((e) => V.map((t) => t.csvValue ? t.csvValue(e) : t.copyValue ? t.copyValue(e) : u(e, t.key)));
231
- ve(new Blob([`\uFEFF${o(e, n, In.separator)}`], { type: "text/csv;charset=utf-8" }), ne(In.fileName));
232
- }, Rn = Ft && !w, zn = (e, t) => {
233
- if (!S) return;
241
+ let Un = typeof k == "object" ? k : {}, Wn = () => {
242
+ let e = B.map(ie), t = Un.rows, n = (t === void 0 ? H : typeof t == "function" ? t() : t).map((e) => B.map((t) => t.csvValue ? t.csvValue(e) : t.copyValue ? t.copyValue(e) : l(e, t.key)));
243
+ xe(new Blob([`\uFEFF${o(e, n, Un.separator)}`], { type: "text/csv;charset=utf-8" }), re(Un.fileName));
244
+ }, Gn = Bt && !C, Kn = (e, t) => {
245
+ if (!b) return;
234
246
  let n = e.currentTarget.getBoundingClientRect();
235
- Vt({
247
+ Kt({
236
248
  x: n.right,
237
249
  y: n.bottom + 4,
238
- items: S(t)
250
+ items: b(t)
239
251
  });
240
- }, Y = v({
241
- activateRow: En,
242
- toggleExpanded: an,
243
- openRowMenu: zn
252
+ }, X = _({
253
+ activateRow: Mn,
254
+ toggleExpanded: un,
255
+ openRowMenu: Kn
244
256
  });
245
- Y.current = {
246
- activateRow: En,
247
- toggleExpanded: an,
248
- openRowMenu: zn
257
+ X.current = {
258
+ activateRow: Mn,
259
+ toggleExpanded: un,
260
+ openRowMenu: Kn
249
261
  };
250
- let Bn = _(() => ({
251
- activate: (e, t) => Y.current.activateRow(e, t),
252
- toggleExpanded: (e) => Y.current.toggleExpanded(e),
253
- openMenu: (e, t) => Y.current.openRowMenu(e, t)
254
- }), []), Vn = (e) => {
262
+ let qn = g(() => ({
263
+ activate: (e, t) => X.current.activateRow(e, t),
264
+ toggleExpanded: (e) => X.current.toggleExpanded(e),
265
+ openMenu: (e, t) => X.current.openRowMenu(e, t)
266
+ }), []), Jn = (e) => {
255
267
  if (!e.sortable) return e.label;
256
- let t = I?.key === e.key ? I.direction : "none";
257
- return /* @__PURE__ */ m("button", {
268
+ let t = F?.key === e.key ? F.direction : "none";
269
+ return /* @__PURE__ */ p("button", {
258
270
  type: "button",
259
271
  className: `kapi-thsort${t === "none" ? "" : " is-active"}`,
260
- onClick: () => $t(e.key),
261
- title: typeof e.label == "string" ? `${j.sortBy} ${e.label}` : void 0,
262
- children: [/* @__PURE__ */ p("span", { children: e.label }), Ze(t)]
272
+ onClick: () => an(e.key),
273
+ title: typeof e.label == "string" ? `${A.sortBy} ${e.label}` : void 0,
274
+ children: [/* @__PURE__ */ f("span", { children: e.label }), tt(t)]
263
275
  });
264
- }, Hn = (e) => {
265
- if (e.sortable) return I?.key === e.key ? I.direction === "asc" ? "ascending" : "descending" : "none";
266
- }, Un = (e) => e.resizable ?? Et, X = (e) => e.minWidth ?? 60, [Wn, Gn] = y({}), Kn = (e) => s(z[e.key] ?? e.width ?? Wn[e.key] ?? X(e), X(e)), qn = ke(() => {
267
- let e = gn.current;
276
+ }, Yn = (e) => {
277
+ if (e.sortable) return F?.key === e.key ? F.direction === "asc" ? "ascending" : "descending" : "none";
278
+ }, Xn = (e) => e.resizable ?? At, Z = (e) => e.minWidth ?? 60, [Zn, Qn] = v({}), $n = (e) => ee(R[e.key] ?? e.width ?? Zn[e.key] ?? Z(e), Z(e)), er = Me(() => {
279
+ let e = xn.current;
268
280
  if (!e) return;
269
281
  let t = {};
270
282
  for (let n of e.querySelectorAll(":scope > thead .kapi-colresize[data-col]")) {
271
283
  let e = n.dataset.col, r = n.parentElement?.getBoundingClientRect().width;
272
284
  e && r && (t[e] = Math.round(r));
273
285
  }
274
- Gn((e) => {
286
+ Qn((e) => {
275
287
  let n = Object.keys(t);
276
288
  return n.length === Object.keys(e).length && n.every((n) => e[n] === t[n]) ? e : t;
277
289
  });
278
290
  }, []);
279
- Ae(qn, [
280
- qn,
281
- V,
282
- z
291
+ Ne(er, [
292
+ er,
293
+ B,
294
+ R
283
295
  ]);
284
- let Jn = v({
285
- visibleColumns: V,
286
- widths: z,
296
+ let tr = _({
297
+ visibleColumns: B,
298
+ widths: R,
287
299
  lefts: W,
288
300
  offset: 0
289
301
  });
290
- Jn.current = {
291
- visibleColumns: V,
292
- widths: z,
302
+ tr.current = {
303
+ visibleColumns: B,
304
+ widths: R,
293
305
  lefts: W,
294
- offset: (C ? 46 : 0) + (L ? 44 : 0)
306
+ offset: (x ? Dn : 0) + (I ? 44 : 0)
295
307
  };
296
- let Z = v(/* @__PURE__ */ new Map()), Yn = v(/* @__PURE__ */ new Map()), [Q] = y(() => n((e) => {
297
- let t = gn.current;
308
+ let Q = _(/* @__PURE__ */ new Map()), nr = _(/* @__PURE__ */ new Map()), [rr] = v(() => n((e) => {
309
+ let t = xn.current;
298
310
  if (!t) return;
299
- let n = Jn.current, r = be(n.visibleColumns, n.widths, e.key, e.width, n.offset);
311
+ let n = tr.current, r = Ce(n.visibleColumns, n.widths, e.key, e.width, n.offset);
300
312
  n.visibleColumns.forEach((i, a) => {
301
- let o = i.key === e.key, s = Yn.current.get(i.key);
302
- if (!o && !Ce(r[a], n.lefts[a], s)) return;
303
- Yn.current.set(i.key, r[a]);
304
- let c = `[data-col="${qe(i.key)}"]`;
305
- t.querySelectorAll(`:scope > thead > tr > ${c}, :scope > tbody > tr > ${c}`).forEach((t) => {
306
- if (Z.current.has(t) || Z.current.set(t, t.style.cssText), o) {
313
+ let o = i.key === e.key, ee = nr.current.get(i.key);
314
+ if (!o && !Ee(r[a], n.lefts[a], ee)) return;
315
+ nr.current.set(i.key, r[a]);
316
+ let s = `[data-col="${Ze(i.key)}"]`;
317
+ t.querySelectorAll(`:scope > thead > tr > ${s}, :scope > tbody > tr > ${s}`).forEach((t) => {
318
+ if (Q.current.has(t) || Q.current.set(t, t.style.cssText), o) {
307
319
  let n = `${e.width}px`;
308
320
  t.style.width = n, t.style.minWidth = n, t.style.maxWidth = n;
309
321
  }
@@ -311,106 +323,106 @@ function Qe({ columns: f, rows: h, keyField: b = "id", maxHeight: Fe = "58vh", f
311
323
  n !== void 0 && (t.style.left = `${n}px`);
312
324
  });
313
325
  });
314
- })), Xn = () => {
315
- Q.cancel(), Z.current.forEach((e, t) => {
326
+ })), ir = () => {
327
+ rr.cancel(), Q.current.forEach((e, t) => {
316
328
  t.style.cssText = e;
317
- }), Z.current.clear(), Yn.current.clear();
329
+ }), Q.current.clear(), nr.current.clear();
318
330
  };
319
- g(() => () => Q.cancel(), [Q]);
320
- let Zn = (e, t) => {
331
+ h(() => () => rr.cancel(), [rr]);
332
+ let ar = (e, t) => {
321
333
  if (e.button !== 0) return;
322
334
  e.preventDefault(), e.stopPropagation();
323
335
  let n = e.currentTarget.parentElement, r = n ? n.getBoundingClientRect().width : t.width ?? 120;
324
- B.current = we(t.key, e.clientX, r, X(t)), e.currentTarget.setPointerCapture(e.pointerId);
325
- }, Qn = (e) => {
326
- let t = B.current;
336
+ z.current = De(t.key, e.clientX, r, Z(t)), e.currentTarget.setPointerCapture(e.pointerId);
337
+ }, or = (e) => {
338
+ let t = z.current;
327
339
  if (!t) return;
328
- let n = Se(t, e.clientX);
329
- n && (B.current = n, Q(n));
330
- }, $n = (e) => {
331
- let t = B.current;
332
- if (B.current = null, e.currentTarget.hasPointerCapture(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId), !t) return;
333
- Xn();
334
- let n = e.type === "pointercancel" ? t : Se(t, e.clientX) ?? t, r = xe(n, z, e.type === "pointercancel" ? "cancel" : "commit");
335
- r && hn(r);
336
- }, er = (e, t) => {
340
+ let n = Te(t, e.clientX);
341
+ n && (z.current = n, rr(n));
342
+ }, sr = (e) => {
343
+ let t = z.current;
344
+ if (z.current = null, e.currentTarget.hasPointerCapture(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId), !t) return;
345
+ ir();
346
+ let n = e.type === "pointercancel" ? t : Te(t, e.clientX) ?? t, r = we(n, R, e.type === "pointercancel" ? "cancel" : "commit");
347
+ r && bn(r);
348
+ }, cr = (e, t) => {
337
349
  if (e.key !== "ArrowLeft" && e.key !== "ArrowRight") return;
338
350
  e.preventDefault();
339
- let n = e.currentTarget.parentElement, r = z[t.key] ?? (n ? n.getBoundingClientRect().width : t.width ?? 120), i = e.key === "ArrowRight" ? 16 : -16;
340
- hn(ue(z, t.key, r, i, X(t)));
341
- }, tr = (e) => {
342
- if (!Un(e)) return null;
351
+ let n = e.currentTarget.parentElement, r = R[t.key] ?? (n ? n.getBoundingClientRect().width : t.width ?? 120), i = e.key === "ArrowRight" ? 16 : -16;
352
+ bn(de(R, t.key, r, i, Z(t)));
353
+ }, lr = (e) => {
354
+ if (!Xn(e)) return null;
343
355
  let t = typeof e.label == "string" ? ` ${e.label}` : "";
344
- return /* @__PURE__ */ p("div", {
356
+ return /* @__PURE__ */ f("div", {
345
357
  role: "separator",
346
358
  "aria-orientation": "vertical",
347
- "aria-label": `${j.resizeColumn}${t}`,
348
- "aria-valuemin": X(e),
349
- "aria-valuenow": Kn(e),
359
+ "aria-label": `${A.resizeColumn}${t}`,
360
+ "aria-valuemin": Z(e),
361
+ "aria-valuenow": $n(e),
350
362
  tabIndex: 0,
351
363
  className: "kapi-colresize",
352
364
  "data-col": e.key,
353
- onFocus: qn,
354
- onPointerDown: (t) => Zn(t, e),
355
- onPointerMove: Qn,
356
- onPointerUp: $n,
357
- onPointerCancel: $n,
365
+ onFocus: er,
366
+ onPointerDown: (t) => ar(t, e),
367
+ onPointerMove: or,
368
+ onPointerUp: sr,
369
+ onPointerCancel: sr,
358
370
  onClick: (e) => e.stopPropagation(),
359
- onKeyDown: (t) => er(t, e)
371
+ onKeyDown: (t) => cr(t, e)
360
372
  });
361
- }, $ = E ? c(E) : null, nr = E && $ && $.page !== E.page ? $.page : null, rr = v(E?.onPageChange);
362
- rr.current = E?.onPageChange, g(() => {
363
- nr !== null && rr.current?.(nr);
364
- }, [nr]);
365
- let ir = (e, t = !1) => /* @__PURE__ */ p("tr", {
373
+ }, $ = T ? s(T) : null, ur = T && $ && $.page !== T.page ? $.page : null, dr = _(T?.onPageChange);
374
+ dr.current = T?.onPageChange, h(() => {
375
+ ur !== null && dr.current?.(ur);
376
+ }, [ur]);
377
+ let fr = (e, t = !1) => /* @__PURE__ */ f("tr", {
366
378
  className: "kapi-table-staterow",
367
- children: /* @__PURE__ */ m("td", {
379
+ children: /* @__PURE__ */ p("td", {
368
380
  colSpan: K,
369
381
  className: "kapi-table-state",
370
- children: [t && /* @__PURE__ */ p(ze, {
382
+ children: [t && /* @__PURE__ */ f(He, {
371
383
  size: 16,
372
384
  strokeWidth: 2.2,
373
385
  className: "kapi-table-spin",
374
386
  "aria-hidden": !0
375
- }), /* @__PURE__ */ p("span", { children: e })]
387
+ }), /* @__PURE__ */ f("span", { children: e })]
376
388
  })
377
- }), ar = (e, t, n) => {
389
+ }), pr = (e, t, n) => {
378
390
  let r = e.flex ? `${[
379
391
  70,
380
392
  55,
381
393
  80
382
- ][n % 3]}%` : Math.max(32, Math.min(We[(t + n) % We.length] ?? 72, (e.width ?? 120) - 36));
383
- return /* @__PURE__ */ p(Te, {
394
+ ][n % 3]}%` : Math.max(32, Math.min(Je[(t + n) % Je.length] ?? 72, (e.width ?? 120) - 36));
395
+ return /* @__PURE__ */ f(Oe, {
384
396
  width: r,
385
397
  height: 14,
386
398
  radius: 6
387
399
  });
388
- }, or = Array.from({ length: pt }, (e, t) => /* @__PURE__ */ m("tr", {
400
+ }, mr = Array.from({ length: _t }, (e, t) => /* @__PURE__ */ p("tr", {
389
401
  className: "kapi-table-skrow",
390
402
  "aria-hidden": !0,
391
403
  children: [
392
- C && /* @__PURE__ */ p("td", {
404
+ x && /* @__PURE__ */ f("td", {
393
405
  className: "is-sticky kapi-cbcol",
394
406
  style: { left: 0 },
395
- children: /* @__PURE__ */ p(Te, {
407
+ children: /* @__PURE__ */ f(Oe, {
396
408
  width: 16,
397
409
  height: 16,
398
410
  radius: 5
399
411
  })
400
412
  }),
401
- L && /* @__PURE__ */ p("td", { className: "kapi-expandcol" }),
402
- V.map((e, n) => /* @__PURE__ */ p("td", {
413
+ I && /* @__PURE__ */ f("td", { className: "kapi-expandcol" }),
414
+ B.map((e, n) => /* @__PURE__ */ f("td", {
403
415
  "data-col": e.key,
404
- className: Ye(e, n === Sn),
416
+ className: $e(e, n === On),
405
417
  style: {
406
418
  left: W[n],
407
- ...Je(e, "td", z)
419
+ ...Qe(e, "td", R)
408
420
  },
409
- children: ar(e, n, t)
421
+ children: pr(e, n, t)
410
422
  }, e.key)),
411
- G && /* @__PURE__ */ p("td", {
423
+ G && /* @__PURE__ */ f("td", {
412
424
  className: "kapi-actcol",
413
- children: /* @__PURE__ */ p(Te, {
425
+ children: /* @__PURE__ */ f(Oe, {
414
426
  width: 28,
415
427
  height: 14,
416
428
  radius: 6,
@@ -418,89 +430,90 @@ function Qe({ columns: f, rows: h, keyField: b = "id", maxHeight: Fe = "58vh", f
418
430
  })
419
431
  })
420
432
  ]
421
- }, `sk-${t}`)), sr = C && st && Jt.length > 0 ? /* @__PURE__ */ p(Ee, {
422
- count: Jt.length,
423
- onClear: qt,
424
- placement: x,
425
- children: st({
426
- ids: Jt,
427
- clear: qt
433
+ }, `sk-${t}`)), hr = x && dt && $t.length > 0 ? /* @__PURE__ */ f(ke, {
434
+ count: $t.length,
435
+ onClear: Qt,
436
+ placement: Ue,
437
+ children: dt({
438
+ ids: $t,
439
+ clear: Qt
428
440
  })
429
- }) : null;
430
- return /* @__PURE__ */ m("div", {
431
- id: Xe,
432
- style: Ke,
433
- className: i("kapi-table-shell", mt && "kapi-table-shell--card", Le && "kapi-table-shell--fill", Rn && "kapi-table-shell--cards", Ve),
441
+ }) : null, gr = zt != null && typeof zt != "boolean";
442
+ return /* @__PURE__ */ p("div", {
443
+ id: et,
444
+ style: Xe,
445
+ className: i("kapi-table-shell", vt && "kapi-table-shell--card", Be && "kapi-table-shell--fill", Gn && "kapi-table-shell--cards", Ge),
434
446
  children: [
435
- x === "top" && sr,
436
- (At || A || St && Cn.length > 0) && /* @__PURE__ */ m("div", {
447
+ Ue === "top" && hr,
448
+ (Pt || gr || k || Et && kn.length > 0) && /* @__PURE__ */ p("div", {
437
449
  className: "kapi-tabletools",
438
450
  children: [
439
- At && /* @__PURE__ */ p(De, {
440
- value: H,
441
- onChange: bn,
442
- columns: V,
443
- count: k ? void 0 : {
444
- shown: U.length,
445
- total: h.length
451
+ Pt && /* @__PURE__ */ f(Ae, {
452
+ value: V,
453
+ onChange: Tn,
454
+ columns: B,
455
+ count: O ? void 0 : {
456
+ shown: H.length,
457
+ total: m.length
446
458
  },
447
- debounce: k ? Pt : 0,
448
- labels: j
459
+ debounce: O ? Rt : 0,
460
+ labels: A
449
461
  }),
450
- A && /* @__PURE__ */ m("button", {
462
+ zt,
463
+ k && /* @__PURE__ */ p("button", {
451
464
  type: "button",
452
465
  className: "kapi-filterchip",
453
- onClick: Ln,
454
- children: [/* @__PURE__ */ p(Re, {
466
+ onClick: Wn,
467
+ children: [/* @__PURE__ */ f(Ve, {
455
468
  size: 14,
456
469
  strokeWidth: 2.2
457
- }), /* @__PURE__ */ p("span", {
470
+ }), /* @__PURE__ */ f("span", {
458
471
  className: "kapi-strong",
459
- children: j.exportCsv
472
+ children: A.exportCsv
460
473
  })]
461
474
  }),
462
- St && Cn.length > 0 && /* @__PURE__ */ m("div", {
475
+ Et && kn.length > 0 && /* @__PURE__ */ p("div", {
463
476
  className: "kapi-dropdown",
464
477
  onKeyDown: (e) => {
465
- e.key === "Escape" && un(!1);
478
+ e.key === "Escape" && hn(!1);
466
479
  },
467
- children: [/* @__PURE__ */ m("button", {
480
+ children: [/* @__PURE__ */ p("button", {
468
481
  type: "button",
469
482
  className: "kapi-filterchip",
470
- onClick: () => un((e) => !e),
483
+ onClick: () => hn((e) => !e),
471
484
  "aria-haspopup": "menu",
472
- "aria-expanded": ln,
485
+ "aria-expanded": mn,
473
486
  children: [
474
- /* @__PURE__ */ p(Ie, {
487
+ /* @__PURE__ */ f(ze, {
475
488
  size: 14,
476
489
  strokeWidth: 2.2
477
490
  }),
478
- /* @__PURE__ */ p("span", {
491
+ /* @__PURE__ */ f("span", {
479
492
  className: "kapi-strong",
480
- children: j.columns
493
+ children: A.columns
481
494
  }),
482
- /* @__PURE__ */ p(Me, {
495
+ /* @__PURE__ */ f(Fe, {
483
496
  size: 14,
484
497
  strokeWidth: 2.2,
485
498
  color: "var(--kapi-muted-2)"
486
499
  })
487
500
  ]
488
- }), ln && /* @__PURE__ */ m(Oe, { children: [/* @__PURE__ */ p("div", {
501
+ }), mn && /* @__PURE__ */ p(je, { children: [/* @__PURE__ */ f("div", {
489
502
  className: "kapi-dropdown__backdrop",
490
- onClick: () => un(!1)
491
- }), /* @__PURE__ */ p("div", {
503
+ onClick: () => hn(!1)
504
+ }), /* @__PURE__ */ f("div", {
492
505
  className: "kapi-menu kapi-dropdown__menu kapi-dropdown__menu--down kapi-tabletools__menu",
493
506
  role: "menu",
494
- "aria-label": j.columns,
495
- children: Cn.map((e) => {
496
- let t = R[e.key] !== !1;
497
- return /* @__PURE__ */ m("button", {
507
+ "aria-label": A.columns,
508
+ children: kn.map((e) => {
509
+ let t = L[e.key] !== !1;
510
+ return /* @__PURE__ */ p("button", {
498
511
  type: "button",
499
512
  role: "menuitemcheckbox",
500
513
  "aria-checked": t,
501
514
  className: `kapi-menu__item${t ? " kapi-menu__item--on" : ""}`,
502
- onClick: () => dn(e.key),
503
- children: [/* @__PURE__ */ p("span", { children: e.label }), t && /* @__PURE__ */ p(je, {
515
+ onClick: () => gn(e.key),
516
+ children: [/* @__PURE__ */ f("span", { children: e.label }), t && /* @__PURE__ */ f(Pe, {
504
517
  size: 14,
505
518
  strokeWidth: 2.6,
506
519
  color: "var(--kapi-primary)"
@@ -511,179 +524,184 @@ function Qe({ columns: f, rows: h, keyField: b = "id", maxHeight: Fe = "58vh", f
511
524
  })
512
525
  ]
513
526
  }),
514
- /* @__PURE__ */ m("div", {
527
+ /* @__PURE__ */ p("div", {
515
528
  className: "kapi-tablewrap",
516
- ref: N,
529
+ ref: M,
517
530
  tabIndex: 0,
518
- style: Le ? void 0 : { maxHeight: Fe },
519
- onScroll: Pn,
531
+ style: Be ? void 0 : { maxHeight: Re },
532
+ onScroll: Vn,
520
533
  children: [
521
- /* @__PURE__ */ m("table", {
522
- ref: gn,
523
- className: `kapi-table2${w ? " is-virtual" : ""}${bt === "card" ? " kapi-table2--card" : ""}${xt ? " kapi-table2--hover" : ""}`,
524
- children: [/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [
525
- C && /* @__PURE__ */ p("th", {
526
- className: "is-sticky kapi-cbcol",
534
+ /* @__PURE__ */ p("table", {
535
+ ref: xn,
536
+ className: `kapi-table2${C ? " is-virtual" : ""}${wt === "card" ? " kapi-table2--card" : ""}${Tt ? " kapi-table2--hover" : ""}`,
537
+ children: [/* @__PURE__ */ f("thead", { children: /* @__PURE__ */ p("tr", { children: [
538
+ x && /* @__PURE__ */ p("th", {
539
+ className: `is-sticky kapi-cbcol${U ? " kapi-cbcol--presets" : ""}`,
527
540
  style: { left: 0 },
528
- children: /* @__PURE__ */ p("label", {
541
+ children: [/* @__PURE__ */ f("label", {
529
542
  className: "kapi-check kapi-check--block",
530
- children: /* @__PURE__ */ p("input", {
543
+ children: /* @__PURE__ */ f("input", {
531
544
  type: "checkbox",
532
- checked: Tn === "all",
545
+ checked: jn === "all",
533
546
  ref: (e) => {
534
- e && (e.indeterminate = Tn === "some");
547
+ e && (e.indeterminate = jn === "some");
535
548
  },
536
- onChange: () => F(pe(P, wn)),
537
- "aria-label": j.selectAll
549
+ onChange: () => P(he(N, J)),
550
+ "aria-label": A.selectAll
538
551
  })
539
- })
552
+ }), U && /* @__PURE__ */ f(be, {
553
+ label: null,
554
+ "aria-label": A.selectMatching,
555
+ variant: "ghost",
556
+ items: An
557
+ })]
540
558
  }),
541
- L && /* @__PURE__ */ p("th", {
559
+ I && /* @__PURE__ */ f("th", {
542
560
  className: "kapi-expandcol",
543
- children: /* @__PURE__ */ p("span", {
561
+ children: /* @__PURE__ */ f("span", {
544
562
  className: "kapi-sr-only",
545
- children: j.expandColumn
563
+ children: A.expandColumn
546
564
  })
547
565
  }),
548
- V.map((e, t) => /* @__PURE__ */ m("th", {
566
+ B.map((e, t) => /* @__PURE__ */ p("th", {
549
567
  "data-col": e.key,
550
- className: `${Ye(e, t === Sn)}${e.sortable ? " is-sortable" : ""}`,
551
- "aria-sort": Hn(e),
568
+ className: `${$e(e, t === On)}${e.sortable ? " is-sortable" : ""}`,
569
+ "aria-sort": Yn(e),
552
570
  style: {
553
571
  left: W[t],
554
- ...Je(e, "th", z),
572
+ ...Qe(e, "th", R),
555
573
  textAlign: e.align
556
574
  },
557
- children: [Vn(e), tr(e)]
575
+ children: [Jn(e), lr(e)]
558
576
  }, e.key)),
559
- G && /* @__PURE__ */ p("th", {
577
+ G && /* @__PURE__ */ f("th", {
560
578
  className: "kapi-actcol",
561
- children: j.actions
579
+ children: A.actions
562
580
  })
563
- ] }) }), /* @__PURE__ */ m("tbody", { children: [
564
- D && (pt > 0 ? or : ir(Lt, !0)),
565
- !D && U.length === 0 && ir(It),
566
- !D && U.length > 0 && kn > 0 && /* @__PURE__ */ p("tr", {
581
+ ] }) }), /* @__PURE__ */ p("tbody", { children: [
582
+ E && (_t > 0 ? mr : fr(Ht, !0)),
583
+ !E && H.length === 0 && fr(Vt),
584
+ !E && H.length > 0 && Fn > 0 && /* @__PURE__ */ f("tr", {
567
585
  "aria-hidden": !0,
568
- style: { height: kn },
569
- children: /* @__PURE__ */ p("td", {
586
+ style: { height: Fn },
587
+ children: /* @__PURE__ */ f("td", {
570
588
  colSpan: K,
571
589
  className: "kapi-table-pad"
572
590
  })
573
591
  }),
574
- !D && jn.map((e, t) => {
575
- let n = e[b], r = !O || O(e), i = Mn + Dn + t + 1;
576
- return /* @__PURE__ */ p(et, {
592
+ !E && Ln.map((e, t) => {
593
+ let n = e[y], r = !D || D(e), i = Rn + Nn + t + 1;
594
+ return /* @__PURE__ */ f(it, {
577
595
  row: e,
578
596
  id: n,
579
- selected: P.has(n),
580
- selectLabel: C ? d(e, V, i, j, it) : "",
581
- open: L && rn.has(n),
597
+ selected: N.has(n),
598
+ selectLabel: x ? u(e, B, i, A, ct) : "",
599
+ open: I && ln.has(n),
582
600
  canSelect: r,
583
- clickSelect: C && rt && r,
584
- rangeSelect: ct,
585
- selectable: C,
586
- expandable: L,
587
- rowHeight: w ? T : void 0,
588
- columns: V,
601
+ clickSelect: x && st && r,
602
+ rangeSelect: ft,
603
+ selectable: x,
604
+ expandable: I,
605
+ rowHeight: C ? w : void 0,
606
+ columns: B,
589
607
  lefts: W,
590
- lastSticky: Sn,
591
- widths: z,
592
- text: j,
593
- onCopy: nt,
608
+ lastSticky: On,
609
+ widths: R,
610
+ text: A,
611
+ onCopy: ot,
594
612
  hasActions: G,
595
- actions: $e,
596
- rowMenu: S,
597
- renderSubComponent: _t,
613
+ actions: rt,
614
+ rowMenu: b,
615
+ renderSubComponent: xt,
598
616
  colSpan: K,
599
- handlers: Bn
617
+ handlers: qn
600
618
  }, n);
601
619
  }),
602
- !D && U.length > 0 && An > 0 && /* @__PURE__ */ p("tr", {
620
+ !E && H.length > 0 && In > 0 && /* @__PURE__ */ f("tr", {
603
621
  "aria-hidden": !0,
604
- style: { height: An },
605
- children: /* @__PURE__ */ p("td", {
622
+ style: { height: In },
623
+ children: /* @__PURE__ */ f("td", {
606
624
  colSpan: K,
607
625
  className: "kapi-table-pad"
608
626
  })
609
627
  })
610
628
  ] })]
611
629
  }),
612
- zt && tt && /* @__PURE__ */ p(_e, {
630
+ Wt && at && /* @__PURE__ */ f(ye, {
613
631
  open: !0,
614
- x: zt.x,
615
- y: zt.y,
616
- items: tt,
617
- onClose: () => Bt(null)
632
+ x: Wt.x,
633
+ y: Wt.y,
634
+ items: at,
635
+ onClose: () => Gt(null)
618
636
  }),
619
- M && /* @__PURE__ */ p(_e, {
637
+ j && /* @__PURE__ */ f(ye, {
620
638
  open: !0,
621
- x: M.x,
622
- y: M.y,
623
- items: M.items,
624
- onClose: () => Vt(null)
639
+ x: j.x,
640
+ y: j.y,
641
+ items: j.items,
642
+ onClose: () => Kt(null)
625
643
  })
626
644
  ]
627
645
  }),
628
- x === "bottom" && sr,
629
- E && $ && /* @__PURE__ */ m("div", {
646
+ Ue === "bottom" && hr,
647
+ T && $ && /* @__PURE__ */ p("div", {
630
648
  className: "kapi-tablefoot",
631
- children: [/* @__PURE__ */ m("div", {
649
+ children: [/* @__PURE__ */ p("div", {
632
650
  className: "kapi-tablefoot__l",
633
- children: [/* @__PURE__ */ m("span", { children: [
651
+ children: [/* @__PURE__ */ p("span", { children: [
634
652
  $.from,
635
653
  "–",
636
654
  $.to,
637
655
  " ",
638
- j.of,
656
+ A.of,
639
657
  " ",
640
- E.total
641
- ] }), E.pageSizeOptions && E.onPageSizeChange && /* @__PURE__ */ m("div", {
658
+ T.total
659
+ ] }), T.pageSizeOptions && T.onPageSizeChange && /* @__PURE__ */ p("div", {
642
660
  className: "kapi-tablefoot__size",
643
- children: [/* @__PURE__ */ p("span", { children: j.rowsPerPage }), /* @__PURE__ */ p(r, {
661
+ children: [/* @__PURE__ */ f("span", { children: A.rowsPerPage }), /* @__PURE__ */ f(r, {
644
662
  size: "sm",
645
663
  searchable: !1,
646
- "aria-label": j.rowsPerPage,
647
- options: E.pageSizeOptions.map((e) => ({
664
+ "aria-label": A.rowsPerPage,
665
+ options: T.pageSizeOptions.map((e) => ({
648
666
  value: String(e),
649
667
  label: String(e)
650
668
  })),
651
- value: String(E.pageSize),
669
+ value: String(T.pageSize),
652
670
  onChange: (e) => {
653
- e !== null && E.onPageSizeChange?.(Number(e));
671
+ e !== null && T.onPageSizeChange?.(Number(e));
654
672
  }
655
673
  })]
656
674
  })]
657
- }), /* @__PURE__ */ m("div", {
675
+ }), /* @__PURE__ */ p("div", {
658
676
  className: "kapi-tablefoot__r",
659
677
  children: [
660
- /* @__PURE__ */ p("button", {
678
+ /* @__PURE__ */ f("button", {
661
679
  type: "button",
662
680
  className: "kapi-tablefoot__btn",
663
- "aria-label": j.prevPage,
681
+ "aria-label": A.prevPage,
664
682
  "aria-disabled": !$.canPrev || void 0,
665
683
  onClick: () => {
666
- $.canPrev && E.onPageChange($.page - 1);
684
+ $.canPrev && T.onPageChange($.page - 1);
667
685
  },
668
- children: /* @__PURE__ */ p(Ne, {
686
+ children: /* @__PURE__ */ f(Ie, {
669
687
  size: 16,
670
688
  strokeWidth: 2
671
689
  })
672
690
  }),
673
- /* @__PURE__ */ m("span", { children: [
691
+ /* @__PURE__ */ p("span", { children: [
674
692
  $.page,
675
693
  " / ",
676
694
  $.totalPages
677
695
  ] }),
678
- /* @__PURE__ */ p("button", {
696
+ /* @__PURE__ */ f("button", {
679
697
  type: "button",
680
698
  className: "kapi-tablefoot__btn",
681
- "aria-label": j.nextPage,
699
+ "aria-label": A.nextPage,
682
700
  "aria-disabled": !$.canNext || void 0,
683
701
  onClick: () => {
684
- $.canNext && E.onPageChange($.page + 1);
702
+ $.canNext && T.onPageChange($.page + 1);
685
703
  },
686
- children: /* @__PURE__ */ p(Pe, {
704
+ children: /* @__PURE__ */ f(Le, {
687
705
  size: 16,
688
706
  strokeWidth: 2
689
707
  })
@@ -694,69 +712,69 @@ function Qe({ columns: f, rows: h, keyField: b = "id", maxHeight: Fe = "58vh", f
694
712
  ]
695
713
  });
696
714
  }
697
- function $e({ row: e, id: t, selected: n, selectLabel: r, open: i, canSelect: a, clickSelect: o, rangeSelect: s, selectable: c, expandable: ee, rowHeight: te, columns: ne, lefts: re, lastSticky: ie, widths: ae, text: l, onCopy: oe, hasActions: se, actions: ce, rowMenu: le, renderSubComponent: u, colSpan: ue, handlers: d }) {
698
- return /* @__PURE__ */ m(Oe, { children: [/* @__PURE__ */ m("tr", {
715
+ function rt({ row: e, id: t, selected: n, selectLabel: r, open: i, canSelect: a, clickSelect: o, rangeSelect: ee, selectable: s, expandable: te, rowHeight: ne, columns: re, lefts: ie, lastSticky: ae, widths: oe, text: c, onCopy: se, hasActions: ce, actions: le, rowMenu: ue, renderSubComponent: l, colSpan: de, handlers: u }) {
716
+ return /* @__PURE__ */ p(je, { children: [/* @__PURE__ */ p("tr", {
699
717
  className: `${n ? "is-selected" : ""}${o ? " is-rowsel" : ""}`,
700
- style: te === void 0 ? void 0 : { height: te },
718
+ style: ne === void 0 ? void 0 : { height: ne },
701
719
  onClick: o ? (e) => {
702
- e.target.closest(Ve) || d.activate(t, e.shiftKey);
720
+ e.target.closest(Ge) || u.activate(t, e.shiftKey);
703
721
  } : void 0,
704
722
  onMouseDown: o ? (e) => {
705
- s && e.shiftKey && e.preventDefault();
723
+ ee && e.shiftKey && e.preventDefault();
706
724
  } : void 0,
707
725
  children: [
708
- c && /* @__PURE__ */ p("td", {
726
+ s && /* @__PURE__ */ f("td", {
709
727
  className: "is-sticky kapi-cbcol",
710
728
  style: { left: 0 },
711
- children: /* @__PURE__ */ p("label", {
729
+ children: /* @__PURE__ */ f("label", {
712
730
  className: "kapi-check kapi-check--block",
713
- children: /* @__PURE__ */ p("input", {
731
+ children: /* @__PURE__ */ f("input", {
714
732
  type: "checkbox",
715
733
  checked: n,
716
734
  disabled: !a,
717
735
  onClick: (e) => {
718
- a && d.activate(t, e.shiftKey);
736
+ a && u.activate(t, e.shiftKey);
719
737
  },
720
738
  onChange: () => void 0,
721
739
  "aria-label": r
722
740
  })
723
741
  })
724
742
  }),
725
- ee && /* @__PURE__ */ p("td", {
743
+ te && /* @__PURE__ */ f("td", {
726
744
  className: "kapi-expandcol",
727
- children: /* @__PURE__ */ p("button", {
745
+ children: /* @__PURE__ */ f("button", {
728
746
  type: "button",
729
747
  className: "kapi-expandcol__btn",
730
- "aria-label": l.expandRow,
748
+ "aria-label": c.expandRow,
731
749
  "aria-expanded": i,
732
- onClick: () => d.toggleExpanded(t),
733
- children: p(i ? Me : Pe, {
750
+ onClick: () => u.toggleExpanded(t),
751
+ children: f(i ? Fe : Le, {
734
752
  size: 16,
735
753
  strokeWidth: 2
736
754
  })
737
755
  })
738
756
  }),
739
- ne.map((t, n) => /* @__PURE__ */ p("td", {
757
+ re.map((t, n) => /* @__PURE__ */ f("td", {
740
758
  "data-col": t.key,
741
- className: Ye(t, n === ie),
759
+ className: $e(t, n === ae),
742
760
  style: {
743
- left: re[n],
744
- ...Je(t, "td", ae),
761
+ left: ie[n],
762
+ ...Qe(t, "td", oe),
745
763
  textAlign: t.align
746
764
  },
747
765
  "data-label": typeof t.label == "string" || typeof t.label == "number" ? String(t.label) : void 0,
748
- children: Xe(t, e, l, oe)
766
+ children: et(t, e, c, se)
749
767
  }, t.key)),
750
- se && /* @__PURE__ */ p("td", {
768
+ ce && /* @__PURE__ */ f("td", {
751
769
  className: "kapi-actcol",
752
- children: /* @__PURE__ */ m("div", {
770
+ children: /* @__PURE__ */ p("div", {
753
771
  className: "kapi-actcol__in",
754
- children: [ce ? ce(e) : null, le && /* @__PURE__ */ p("button", {
772
+ children: [le ? le(e) : null, ue && /* @__PURE__ */ f("button", {
755
773
  type: "button",
756
774
  className: "kapi-actcol__dots",
757
- "aria-label": l.moreActions,
758
- onClick: (t) => d.openMenu(t, e),
759
- children: /* @__PURE__ */ p(x, {
775
+ "aria-label": c.moreActions,
776
+ onClick: (t) => u.openMenu(t, e),
777
+ children: /* @__PURE__ */ f(Ue, {
760
778
  size: 16,
761
779
  strokeWidth: 2
762
780
  })
@@ -764,14 +782,14 @@ function $e({ row: e, id: t, selected: n, selectLabel: r, open: i, canSelect: a,
764
782
  })
765
783
  })
766
784
  ]
767
- }), i && u && /* @__PURE__ */ p("tr", {
785
+ }), i && l && /* @__PURE__ */ f("tr", {
768
786
  className: "kapi-subrow",
769
- children: /* @__PURE__ */ p("td", {
770
- colSpan: ue,
771
- children: u(e)
787
+ children: /* @__PURE__ */ f("td", {
788
+ colSpan: de,
789
+ children: l(e)
772
790
  })
773
791
  })] });
774
792
  }
775
- var et = h($e);
793
+ var it = m(rt);
776
794
  //#endregion
777
- export { Be as DEFAULT_TABLE_LABELS, Qe as KapiTable };
795
+ export { We as DEFAULT_TABLE_LABELS, nt as KapiTable };