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