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