@kapiuara/ui 0.15.3 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +19 -15
- package/README.md +338 -6
- package/dist/components/data/KapiDataTable.d.ts +1 -1
- package/dist/components/data/KapiDataTable.js +22 -22
- package/dist/components/data/KapiPaginationFooter.js +1 -1
- package/dist/components/data/KapiSheet.d.ts +105 -0
- package/dist/components/data/KapiSheet.js +75 -0
- package/dist/components/data/KapiTable.d.ts +2 -2
- package/dist/components/data/KapiTable.js +347 -329
- package/dist/components/data/KapiTableFooter.d.ts +22 -0
- package/dist/components/data/KapiTableFooter.js +55 -0
- package/dist/components/data/KapiTableRow.js +53 -52
- package/dist/components/data/KapiTableToolbar.d.ts +4 -2
- package/dist/components/data/KapiTableToolbar.js +71 -69
- package/dist/components/data/index.d.ts +3 -1
- package/dist/components/data/tableCells.d.ts +5 -4
- package/dist/components/data/tableCells.js +42 -41
- package/dist/components/data/tableLogic.d.ts +2 -0
- package/dist/components/data/tableLogic.js +66 -66
- package/dist/components/data/tableSlots.d.ts +9 -0
- package/dist/components/data/tableSlots.js +12 -0
- package/dist/components/data/tableSpanLogic.d.ts +35 -0
- package/dist/components/data/tableSpanLogic.js +47 -0
- package/dist/components/data/tableTypes.d.ts +54 -1
- package/dist/components/data/useTableSelection.d.ts +4 -2
- package/dist/components/data/useTableSelection.js +27 -23
- package/dist/components/display/KapiAnchor.d.ts +36 -0
- package/dist/components/display/KapiAnchor.js +36 -0
- package/dist/components/display/KapiBadge.d.ts +6 -5
- package/dist/components/display/KapiBadge.js +25 -19
- package/dist/components/display/KapiText.d.ts +43 -0
- package/dist/components/display/KapiText.js +33 -0
- package/dist/components/display/KapiTitle.d.ts +33 -0
- package/dist/components/display/KapiTitle.js +29 -0
- package/dist/components/display/index.d.ts +7 -0
- package/dist/components/display/textLogic.d.ts +32 -0
- package/dist/components/display/textLogic.js +19 -0
- package/dist/components/feedback/KapiAlert.d.ts +8 -4
- package/dist/components/feedback/KapiAlert.js +39 -34
- package/dist/components/inputs/KapiButton.d.ts +7 -4
- package/dist/components/inputs/KapiButton.js +47 -42
- package/dist/components/inputs/KapiSelect.d.ts +12 -0
- package/dist/components/inputs/KapiSelect.js +215 -212
- package/dist/components/inputs/KapiSelectMenu.d.ts +4 -2
- package/dist/components/inputs/KapiSelectMenu.js +131 -133
- package/dist/components/inputs/fieldLogic.d.ts +2 -2
- package/dist/components/inputs/index.d.ts +1 -1
- package/dist/components/inputs/selectSlots.d.ts +24 -0
- package/dist/components/inputs/selectSlots.js +27 -0
- package/dist/components/layout/KapiBox.d.ts +31 -0
- package/dist/components/layout/KapiBox.js +26 -0
- package/dist/components/layout/KapiCard.d.ts +16 -4
- package/dist/components/layout/KapiCard.js +46 -34
- package/dist/components/layout/KapiCenter.d.ts +13 -0
- package/dist/components/layout/KapiCenter.js +23 -0
- package/dist/components/layout/KapiCol.d.ts +22 -0
- package/dist/components/layout/KapiCol.js +23 -0
- package/dist/components/layout/KapiGrid.d.ts +29 -3
- package/dist/components/layout/KapiGrid.js +39 -17
- package/dist/components/layout/KapiPageHeader.d.ts +10 -1
- package/dist/components/layout/KapiPageHeader.js +82 -80
- package/dist/components/layout/KapiPanelParts.d.ts +11 -2
- package/dist/components/layout/KapiPanelParts.js +73 -56
- package/dist/components/layout/KapiRail.d.ts +10 -1
- package/dist/components/layout/KapiRail.js +123 -120
- package/dist/components/layout/KapiRoot.d.ts +35 -5
- package/dist/components/layout/KapiRoot.js +54 -39
- package/dist/components/layout/KapiShell.d.ts +36 -3
- package/dist/components/layout/KapiShell.js +53 -50
- package/dist/components/layout/cardSlots.d.ts +9 -0
- package/dist/components/layout/cardSlots.js +12 -0
- package/dist/components/layout/gridSpanLogic.d.ts +46 -0
- package/dist/components/layout/gridSpanLogic.js +39 -0
- package/dist/components/layout/index.d.ts +11 -4
- package/dist/components/layout/layoutPrimitives.d.ts +11 -0
- package/dist/components/layout/layoutPrimitives.js +12 -1
- package/dist/components/layout/pageHeaderSlots.d.ts +12 -0
- package/dist/components/layout/pageHeaderSlots.js +15 -0
- package/dist/components/layout/railLogic.d.ts +16 -3
- package/dist/components/layout/railSlots.d.ts +12 -0
- package/dist/components/layout/railSlots.js +15 -0
- package/dist/components/layout/shellSlots.d.ts +6 -0
- package/dist/components/layout/shellSlots.js +9 -0
- package/dist/components/layout/useGridBreakpoint.d.ts +12 -0
- package/dist/components/layout/useGridBreakpoint.js +35 -0
- package/dist/components/navigation/KapiBreadcrumb.d.ts +18 -2
- package/dist/components/navigation/KapiBreadcrumb.js +23 -16
- package/dist/components/navigation/KapiContextPanel.d.ts +17 -4
- package/dist/components/navigation/KapiContextPanel.js +151 -135
- package/dist/components/navigation/KapiPanelGroup.d.ts +16 -4
- package/dist/components/navigation/KapiPanelGroup.js +66 -65
- package/dist/components/navigation/KapiTabs.d.ts +12 -0
- package/dist/components/navigation/KapiTabs.js +87 -71
- package/dist/components/navigation/MiniNavItem.d.ts +7 -2
- package/dist/components/navigation/MiniNavItem.js +41 -36
- package/dist/components/navigation/breadcrumbLogic.d.ts +4 -2
- package/dist/components/navigation/breadcrumbLogic.js +1 -1
- package/dist/components/navigation/navLink.d.ts +21 -0
- package/dist/components/navigation/navLink.js +26 -0
- package/dist/components/navigation/navLinkLogic.d.ts +18 -0
- package/dist/components/navigation/navLinkLogic.js +22 -0
- package/dist/components/overlays/KapiContextMenu.d.ts +8 -0
- package/dist/components/overlays/KapiModal.d.ts +9 -0
- package/dist/components/overlays/KapiModal.js +77 -75
- package/dist/components/overlays/index.d.ts +1 -1
- package/dist/components/overlays/menuList.js +123 -113
- package/dist/components/overlays/modalSlots.d.ts +11 -0
- package/dist/components/overlays/modalSlots.js +14 -0
- package/dist/components/slotCatalog.d.ts +90 -0
- package/dist/components/slotCatalog.js +19 -0
- package/dist/components/slotsLogic.d.ts +34 -0
- package/dist/components/slotsLogic.js +18 -0
- package/dist/components/tone.d.ts +26 -0
- package/dist/components/tone.js +15 -14
- package/dist/css/base.css +1 -1
- package/dist/css/components/data/KapiEventCalendar.css +1 -1
- package/dist/css/components/data/KapiTable.css +1 -1
- package/dist/css/components/display/display.css +1 -1
- package/dist/css/components/display/typography.css +1 -0
- package/dist/css/components/feedback/feedback.css +1 -1
- package/dist/css/components/inputs/KapiButton.css +1 -1
- package/dist/css/components/inputs/KapiDatePicker.css +1 -1
- package/dist/css/components/layout/KapiBox.css +1 -0
- package/dist/css/components/layout/KapiRail.css +1 -1
- package/dist/css/components/layout/gridSpan.css +1 -0
- package/dist/css/components/navigation/navigation.css +1 -1
- package/dist/hooks/densityLogic.d.ts +15 -0
- package/dist/hooks/densityLogic.js +4 -0
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/themeColorsLogic.d.ts +19 -0
- package/dist/hooks/themeColorsLogic.js +4 -2
- package/dist/hooks/themeDeriveLogic.d.ts +16 -0
- package/dist/hooks/themeDeriveLogic.js +27 -17
- package/dist/hooks/toneFamilyLogic.d.ts +122 -0
- package/dist/hooks/toneFamilyLogic.js +151 -0
- package/dist/hooks/useKapiTheme.d.ts +8 -2
- package/dist/hooks/useKapiTheme.js +116 -103
- package/dist/hooks/useToneFamilies.d.ts +30 -0
- package/dist/hooks/useToneFamilies.js +46 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +213 -204
- package/dist/kapi.css +1 -1
- package/dist/kapi.layered.css +1 -1
- package/dist/styles/rawHeights.d.ts +8 -0
- package/package.json +2 -2
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type StickyLayout } from "./tableCells.js";
|
|
2
|
+
import type { KapiTableColumnWidths } from "./tableLogic.js";
|
|
3
|
+
import type { KapiTableColumn, KapiTableFooterRow } from "./tableTypes.js";
|
|
4
|
+
type TableFooterProps<T> = {
|
|
5
|
+
rows: ReadonlyArray<KapiTableFooterRow>;
|
|
6
|
+
columns: ReadonlyArray<KapiTableColumn<T>>;
|
|
7
|
+
layout: StickyLayout;
|
|
8
|
+
widths: KapiTableColumnWidths;
|
|
9
|
+
/** La tabla tiene columna de checkboxes: el pie le deja su hueco (fijo, como en el cuerpo). */
|
|
10
|
+
selectable: boolean;
|
|
11
|
+
/** La tabla tiene columna del expansor. */
|
|
12
|
+
expandable: boolean;
|
|
13
|
+
/** La tabla tiene columna de acciones. */
|
|
14
|
+
hasActions: boolean;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Las columnas de checkboxes, expansor y acciones no llevan celdas propias en el pie: se rellenan con
|
|
18
|
+
* una celda vacía para que las cifras queden bajo su columna. Las columnas visibles que ninguna celda
|
|
19
|
+
* cubre también se rellenan, de a una, para que una fijada conserve su celda (y su opacidad).
|
|
20
|
+
*/
|
|
21
|
+
export declare function TableFooter<T>({ rows, columns, layout, widths, selectable, expandable, hasActions }: TableFooterProps<T>): import("react").JSX.Element;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { joinClasses as e } from "../rootProps.js";
|
|
3
|
+
import { columnAlign as t } from "./tableLogic.js";
|
|
4
|
+
import { actColClass as n, cellClass as r, columnBoxStyle as i, stickyInset as a } from "./tableCells.js";
|
|
5
|
+
import { layoutFooterRow as o } from "./tableSpanLogic.js";
|
|
6
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/data/KapiTableFooter.tsx
|
|
8
|
+
function l({ rows: l, columns: u, layout: d, widths: f, selectable: p, expandable: m, hasActions: h }) {
|
|
9
|
+
let g = u.map((e) => e.key);
|
|
10
|
+
return /* @__PURE__ */ s("tfoot", { children: l.map((l, _) => /* @__PURE__ */ c("tr", { children: [
|
|
11
|
+
p && /* @__PURE__ */ s("td", {
|
|
12
|
+
className: "is-sticky kapi-cbcol",
|
|
13
|
+
style: { insetInlineStart: 0 }
|
|
14
|
+
}),
|
|
15
|
+
m && /* @__PURE__ */ s("td", { className: "kapi-expandcol" }),
|
|
16
|
+
o(l, g).flatMap((n) => {
|
|
17
|
+
let o = u[n.start];
|
|
18
|
+
if (!n.cell) return u.slice(n.start, n.start + n.span).map((e, t) => {
|
|
19
|
+
let o = n.start + t;
|
|
20
|
+
return /* @__PURE__ */ s("td", {
|
|
21
|
+
className: r(e, o, d),
|
|
22
|
+
style: {
|
|
23
|
+
...a(o, d),
|
|
24
|
+
...i(e, "td", f)
|
|
25
|
+
}
|
|
26
|
+
}, e.key);
|
|
27
|
+
});
|
|
28
|
+
let { cell: c, start: l, span: p } = n, m = t(c.align ?? o.align), h = p === 1, g = {
|
|
29
|
+
...h ? {
|
|
30
|
+
...a(l, d),
|
|
31
|
+
...i(o, "td", f)
|
|
32
|
+
} : {},
|
|
33
|
+
textAlign: m
|
|
34
|
+
}, _ = h ? r({
|
|
35
|
+
...o,
|
|
36
|
+
align: c.align ?? o.align
|
|
37
|
+
}, l, d) : e(m && `is-align-${m}`), v = `${l}:${p}`, y = h ? void 0 : p;
|
|
38
|
+
return [c.header ? /* @__PURE__ */ s("th", {
|
|
39
|
+
scope: "row",
|
|
40
|
+
colSpan: y,
|
|
41
|
+
className: _,
|
|
42
|
+
style: g,
|
|
43
|
+
children: c.content
|
|
44
|
+
}, v) : /* @__PURE__ */ s("td", {
|
|
45
|
+
colSpan: y,
|
|
46
|
+
className: _,
|
|
47
|
+
style: g,
|
|
48
|
+
children: c.content
|
|
49
|
+
}, v)];
|
|
50
|
+
}),
|
|
51
|
+
h && /* @__PURE__ */ s("td", { className: n(d) })
|
|
52
|
+
] }, _)) });
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
export { l as TableFooter };
|
|
@@ -2,17 +2,18 @@
|
|
|
2
2
|
import { winOf as e } from "../../hooks/ownerDocument.js";
|
|
3
3
|
import { actColClass as t, bodyCell as n } from "./tableCells.js";
|
|
4
4
|
import { isRowActivationKey as r, mergeRowProps as i, shouldFireRowClick as a } from "./rowClickLogic.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { rowColSpans as o } from "./tableSpanLogic.js";
|
|
6
|
+
import { memo as s } from "react";
|
|
7
|
+
import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
8
|
+
import { ChevronDown as d, ChevronRight as f, MoreHorizontal as p } from "lucide-react";
|
|
8
9
|
//#region src/components/data/KapiTableRow.tsx
|
|
9
|
-
var
|
|
10
|
-
function
|
|
11
|
-
let
|
|
12
|
-
a(t.target, t.currentTarget, e(t.currentTarget)?.getSelection() ?? null) &&
|
|
13
|
-
} :
|
|
14
|
-
e.target.closest(
|
|
15
|
-
} : void 0,
|
|
10
|
+
var m = "button, a, input, select, textarea, label, [role=button]";
|
|
11
|
+
function h({ row: s, id: h, index: g, selected: _, selectLabel: v, open: y, canSelect: b, clickSelect: x, clickable: S, getRowProps: C, rangeSelect: w, selectable: T, expandable: E, rowHeight: D, virtualIndex: O, columns: k, layout: A, widths: j, text: M, hasActions: N, actions: P, hasRowMenu: F, renderSubComponent: I, colSpan: L, handlers: R }) {
|
|
12
|
+
let z = x && !S, B = k.some((e) => e.colSpan) ? o(k, s) : void 0, V = S ? (t) => {
|
|
13
|
+
a(t.target, t.currentTarget, e(t.currentTarget)?.getSelection() ?? null) && R.rowClick(s, t);
|
|
14
|
+
} : z ? (e) => {
|
|
15
|
+
e.target.closest(m) || R.activate(h, e.shiftKey);
|
|
16
|
+
} : void 0, H = S ? (e) => {
|
|
16
17
|
let t = {
|
|
17
18
|
key: e.key,
|
|
18
19
|
target: e.target,
|
|
@@ -21,67 +22,67 @@ function m({ row: o, id: m, index: h, selected: g, selectLabel: _, open: v, canS
|
|
|
21
22
|
r({
|
|
22
23
|
...t,
|
|
23
24
|
isComposing: e.nativeEvent.isComposing
|
|
24
|
-
}) && (e.preventDefault(),
|
|
25
|
-
} : void 0,
|
|
26
|
-
|
|
27
|
-
} : void 0,
|
|
28
|
-
className: `${
|
|
29
|
-
style:
|
|
30
|
-
tabIndex:
|
|
31
|
-
onClick:
|
|
32
|
-
onMouseDown:
|
|
33
|
-
onKeyDown:
|
|
25
|
+
}) && (e.preventDefault(), R.rowClick(s, e));
|
|
26
|
+
} : void 0, U = z ? (e) => {
|
|
27
|
+
w && e.shiftKey && e.preventDefault();
|
|
28
|
+
} : void 0, W = i(C?.(s, g), {
|
|
29
|
+
className: `${_ ? "is-selected" : ""}${z ? " is-rowsel" : ""}${S ? " is-clickable" : ""}`.trim(),
|
|
30
|
+
style: D === void 0 ? void 0 : { height: D },
|
|
31
|
+
tabIndex: S ? 0 : void 0,
|
|
32
|
+
onClick: V,
|
|
33
|
+
onMouseDown: U,
|
|
34
|
+
onKeyDown: H
|
|
34
35
|
});
|
|
35
|
-
return /* @__PURE__ */
|
|
36
|
-
...
|
|
37
|
-
"data-vindex":
|
|
36
|
+
return /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ u("tr", {
|
|
37
|
+
...W,
|
|
38
|
+
"data-vindex": O,
|
|
38
39
|
children: [
|
|
39
|
-
|
|
40
|
+
T && /* @__PURE__ */ l("td", {
|
|
40
41
|
className: "is-sticky kapi-cbcol",
|
|
41
42
|
style: { insetInlineStart: 0 },
|
|
42
|
-
children: /* @__PURE__ */
|
|
43
|
+
children: /* @__PURE__ */ l("label", {
|
|
43
44
|
className: "kapi-check kapi-check--block",
|
|
44
|
-
children: /* @__PURE__ */
|
|
45
|
+
children: /* @__PURE__ */ l("input", {
|
|
45
46
|
type: "checkbox",
|
|
46
|
-
checked:
|
|
47
|
-
disabled: !
|
|
47
|
+
checked: _,
|
|
48
|
+
disabled: !b,
|
|
48
49
|
onClick: (e) => {
|
|
49
|
-
|
|
50
|
+
b && R.activate(h, e.shiftKey);
|
|
50
51
|
},
|
|
51
52
|
onChange: () => void 0,
|
|
52
|
-
"aria-label":
|
|
53
|
+
"aria-label": v
|
|
53
54
|
})
|
|
54
55
|
})
|
|
55
56
|
}),
|
|
56
|
-
|
|
57
|
+
E && /* @__PURE__ */ l("td", {
|
|
57
58
|
className: "kapi-expandcol",
|
|
58
|
-
children: /* @__PURE__ */
|
|
59
|
+
children: /* @__PURE__ */ l("button", {
|
|
59
60
|
type: "button",
|
|
60
61
|
className: "kapi-expandcol__btn",
|
|
61
|
-
"aria-label":
|
|
62
|
-
"aria-expanded":
|
|
63
|
-
onClick: () =>
|
|
64
|
-
children:
|
|
62
|
+
"aria-label": M.expandRow,
|
|
63
|
+
"aria-expanded": y,
|
|
64
|
+
onClick: () => R.toggleExpanded(h),
|
|
65
|
+
children: y ? /* @__PURE__ */ l(d, {
|
|
65
66
|
size: 16,
|
|
66
67
|
strokeWidth: 2
|
|
67
|
-
}) : /* @__PURE__ */
|
|
68
|
+
}) : /* @__PURE__ */ l(f, {
|
|
68
69
|
className: "kapi-flip-rtl",
|
|
69
70
|
size: 16,
|
|
70
71
|
strokeWidth: 2
|
|
71
72
|
})
|
|
72
73
|
})
|
|
73
74
|
}),
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
className: t(
|
|
77
|
-
children: /* @__PURE__ */
|
|
75
|
+
k.map((e, t) => B?.[t] === 0 ? null : n(e, t, s, A, j, M, R.copy, B?.[t])),
|
|
76
|
+
N && /* @__PURE__ */ l("td", {
|
|
77
|
+
className: t(A),
|
|
78
|
+
children: /* @__PURE__ */ u("div", {
|
|
78
79
|
className: "kapi-actcol__in",
|
|
79
|
-
children: [
|
|
80
|
+
children: [P ? P(s) : null, F && /* @__PURE__ */ l("button", {
|
|
80
81
|
type: "button",
|
|
81
82
|
className: "kapi-actcol__dots",
|
|
82
|
-
"aria-label":
|
|
83
|
-
onClick: (e) =>
|
|
84
|
-
children: /* @__PURE__ */
|
|
83
|
+
"aria-label": M.moreActions,
|
|
84
|
+
onClick: (e) => R.openMenu(e, s),
|
|
85
|
+
children: /* @__PURE__ */ l(p, {
|
|
85
86
|
size: 16,
|
|
86
87
|
strokeWidth: 2
|
|
87
88
|
})
|
|
@@ -89,15 +90,15 @@ function m({ row: o, id: m, index: h, selected: g, selectLabel: _, open: v, canS
|
|
|
89
90
|
})
|
|
90
91
|
})
|
|
91
92
|
]
|
|
92
|
-
}),
|
|
93
|
+
}), y && I && /* @__PURE__ */ l("tr", {
|
|
93
94
|
className: "kapi-subrow",
|
|
94
|
-
"data-vindex":
|
|
95
|
-
children: /* @__PURE__ */
|
|
96
|
-
colSpan:
|
|
97
|
-
children:
|
|
95
|
+
"data-vindex": O,
|
|
96
|
+
children: /* @__PURE__ */ l("td", {
|
|
97
|
+
colSpan: L,
|
|
98
|
+
children: I(s)
|
|
98
99
|
})
|
|
99
100
|
})] });
|
|
100
101
|
}
|
|
101
|
-
var
|
|
102
|
+
var g = s(h);
|
|
102
103
|
//#endregion
|
|
103
|
-
export {
|
|
104
|
+
export { g as TableRow };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
2
|
import type { KapiTableLabels } from "./tableLabels.js";
|
|
3
3
|
import { type KapiTableColumnPinning, type TableColumnPinningInput, type KapiTableColumnVisibility, type KapiTableFilterState } from "./tableLogic.js";
|
|
4
|
-
import type { KapiTableAction, KapiTableActionHandler, KapiTableColumn, KapiTableContext, KapiTableKeyField } from "./tableTypes.js";
|
|
4
|
+
import type { KapiTableAction, KapiTableActionHandler, KapiTableColumn, KapiTableContext, KapiTableClassNames, KapiTableKeyField } from "./tableTypes.js";
|
|
5
5
|
type KapiTableToolbarProps<T, K extends KapiTableKeyField<T>> = {
|
|
6
|
+
/** `classNames` de la tabla: acá cuenta `toolbar`. */
|
|
7
|
+
classNames?: KapiTableClassNames | undefined;
|
|
6
8
|
text: KapiTableLabels;
|
|
7
9
|
filterable: boolean;
|
|
8
10
|
filter: KapiTableFilterState;
|
|
@@ -33,5 +35,5 @@ type KapiTableToolbarProps<T, K extends KapiTableKeyField<T>> = {
|
|
|
33
35
|
pinned: TableColumnPinningInput;
|
|
34
36
|
onPinnedChange: (next: KapiTableColumnPinning) => void;
|
|
35
37
|
};
|
|
36
|
-
export declare function KapiTableToolbar<T, K extends KapiTableKeyField<T>>({ text, filterable, filter, onFilterChange, visibleColumns, manualFilter, filterDebounce, shownCount, totalCount, content, toolbarActions, isPending, context, onRun, refresh, refreshing, onExportCsv, columns, columnToggle, columnPinning, visibility, onShownColumnsChange, pinned, onPinnedChange }: KapiTableToolbarProps<T, K>): import("react").JSX.Element | null;
|
|
38
|
+
export declare function KapiTableToolbar<T, K extends KapiTableKeyField<T>>({ text, filterable, filter, onFilterChange, visibleColumns, manualFilter, filterDebounce, shownCount, totalCount, content, toolbarActions, isPending, context, onRun, refresh, refreshing, onExportCsv, columns, columnToggle, columnPinning, visibility, onShownColumnsChange, pinned, onPinnedChange, classNames }: KapiTableToolbarProps<T, K>): import("react").JSX.Element | null;
|
|
37
39
|
export {};
|
|
@@ -5,22 +5,24 @@ import { KapiChecklist as n } from "../inputs/KapiChecklist.js";
|
|
|
5
5
|
import { placementViewport as r } from "../../hooks/viewportInsetLogic.js";
|
|
6
6
|
import { usePlacement as i } from "../../hooks/usePlacement.js";
|
|
7
7
|
import { useDismiss as a } from "../../hooks/useDismiss.js";
|
|
8
|
-
import {
|
|
8
|
+
import { slot as o } from "../slotsLogic.js";
|
|
9
|
+
import { COLUMNS_PANEL_ESTIMATE as s, COLUMNS_PANEL_PLACEMENT as c, columnsPanelMaxHeight as l, csvHeaderOf as u, setSidePins as d, visibleColumnsOf as f } from "./tableLogic.js";
|
|
9
10
|
import { useFocusReturn as ee } from "../../hooks/useFocusReturn.js";
|
|
10
|
-
import { KapiContextMenu as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
11
|
+
import { KapiContextMenu as p } from "../overlays/KapiContextMenu.js";
|
|
12
|
+
import { TABLE_SLOTS as m } from "./tableSlots.js";
|
|
13
|
+
import { KapiTableFilter as h } from "./KapiTableFilter.js";
|
|
14
|
+
import { useEffect as te, useLayoutEffect as ne, useRef as g, useState as _ } from "react";
|
|
15
|
+
import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
16
|
+
import { ChevronDown as x, Columns3 as re, Download as ie, Loader2 as S, RefreshCw as C, Search as w } from "lucide-react";
|
|
15
17
|
//#region src/components/data/KapiTableToolbar.tsx
|
|
16
|
-
var
|
|
17
|
-
function
|
|
18
|
-
let [V, H] =
|
|
18
|
+
var T = (e) => e != null && typeof e != "boolean";
|
|
19
|
+
function E({ text: e, filterable: p, filter: E, onFilterChange: ae, visibleColumns: oe, manualFilter: O, filterDebounce: se, shownCount: ce, totalCount: le, content: k, toolbarActions: A, isPending: ue, context: de, onRun: fe, refresh: j, refreshing: M, onExportCsv: N, columns: P, columnToggle: F, columnPinning: I, visibility: L, onShownColumnsChange: R, pinned: z, onPinnedChange: B, classNames: pe }) {
|
|
20
|
+
let [V, H] = _(!1), [U, W] = _(""), G = g(null), K = g(null), q = g(null), { restore: me } = ee(V, {
|
|
19
21
|
container: K,
|
|
20
22
|
target: G
|
|
21
23
|
}), J = (e) => {
|
|
22
|
-
H(!1), W(""), e &&
|
|
23
|
-
},
|
|
24
|
+
H(!1), W(""), e && me();
|
|
25
|
+
}, he = a(V, {
|
|
24
26
|
zones: [q],
|
|
25
27
|
outside: !1,
|
|
26
28
|
onDismiss: () => J(!0)
|
|
@@ -29,118 +31,118 @@ function x({ text: e, filterable: f, filter: x, onFilterChange: S, visibleColumn
|
|
|
29
31
|
anchor: G,
|
|
30
32
|
floatingRef: K,
|
|
31
33
|
measure: !1,
|
|
32
|
-
estimate:
|
|
33
|
-
...
|
|
34
|
+
estimate: s,
|
|
35
|
+
...c,
|
|
34
36
|
hideUntilPlaced: !1
|
|
35
|
-
}),
|
|
37
|
+
}), ge = Y?.side === "top" ? "top" : "bottom", [_e, ve] = _(560);
|
|
36
38
|
ne(() => {
|
|
37
39
|
let e = Y?.side, t = e ? G.current?.getBoundingClientRect() : void 0;
|
|
38
|
-
e && t &&
|
|
40
|
+
e && t && ve(l(e, t, r(G.current).height));
|
|
39
41
|
}, [Y]);
|
|
40
|
-
let
|
|
42
|
+
let ye = () => H(!0);
|
|
41
43
|
te(() => {
|
|
42
44
|
V && K.current?.querySelector("input, [role=\"listbox\"]")?.focus();
|
|
43
45
|
}, [V]);
|
|
44
|
-
let
|
|
46
|
+
let X = P.filter((e) => e.hideable !== !1), Z = P.length > 6, Q = (e) => ({
|
|
45
47
|
id: e.key,
|
|
46
48
|
label: e.label,
|
|
47
|
-
text:
|
|
48
|
-
}), $ = F &&
|
|
49
|
-
return !
|
|
50
|
-
|
|
49
|
+
text: u(e)
|
|
50
|
+
}), $ = F && X.length > 0 || I, be = (A?.length ?? 0) > 0;
|
|
51
|
+
return !p && !T(k) && !be && !j && !N && !$ ? null : /* @__PURE__ */ b("div", {
|
|
52
|
+
...o(m, "toolbar", pe),
|
|
51
53
|
children: [
|
|
52
|
-
|
|
53
|
-
value:
|
|
54
|
-
onChange:
|
|
55
|
-
columns:
|
|
56
|
-
count:
|
|
57
|
-
shown:
|
|
58
|
-
total:
|
|
54
|
+
p && /* @__PURE__ */ y(h, {
|
|
55
|
+
value: E,
|
|
56
|
+
onChange: ae,
|
|
57
|
+
columns: oe,
|
|
58
|
+
count: O ? void 0 : {
|
|
59
|
+
shown: ce,
|
|
60
|
+
total: le
|
|
59
61
|
},
|
|
60
|
-
loadDelay:
|
|
62
|
+
loadDelay: O ? se : 0,
|
|
61
63
|
labels: e
|
|
62
64
|
}),
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
k,
|
|
66
|
+
A?.map((e) => /* @__PURE__ */ y(D, {
|
|
65
67
|
action: e,
|
|
66
|
-
busy:
|
|
67
|
-
disabled: typeof e.disabled == "function" ? e.disabled(
|
|
68
|
-
onRun: (t) =>
|
|
68
|
+
busy: ue(e.id),
|
|
69
|
+
disabled: typeof e.disabled == "function" ? e.disabled(de()) : e.disabled === !0,
|
|
70
|
+
onRun: (t) => fe(e.id, t)
|
|
69
71
|
}, e.id)),
|
|
70
|
-
j && /* @__PURE__ */
|
|
72
|
+
j && /* @__PURE__ */ b("button", {
|
|
71
73
|
type: "button",
|
|
72
74
|
className: "kapi-filterchip kapi-tabletools__chip--icon",
|
|
73
75
|
"aria-busy": M || void 0,
|
|
74
76
|
onClick: j,
|
|
75
|
-
children: [M ? /* @__PURE__ */
|
|
77
|
+
children: [M ? /* @__PURE__ */ y(S, {
|
|
76
78
|
size: 14,
|
|
77
79
|
strokeWidth: 2.2,
|
|
78
80
|
className: "kapi-table-spin",
|
|
79
81
|
"aria-hidden": !0
|
|
80
|
-
}) : /* @__PURE__ */
|
|
82
|
+
}) : /* @__PURE__ */ y(C, {
|
|
81
83
|
size: 14,
|
|
82
84
|
strokeWidth: 2.2
|
|
83
|
-
}), /* @__PURE__ */
|
|
85
|
+
}), /* @__PURE__ */ y("span", {
|
|
84
86
|
className: "kapi-strong kapi-tabletools__label",
|
|
85
87
|
children: e.refresh
|
|
86
88
|
})]
|
|
87
89
|
}),
|
|
88
|
-
N && /* @__PURE__ */
|
|
90
|
+
N && /* @__PURE__ */ b("button", {
|
|
89
91
|
type: "button",
|
|
90
92
|
className: "kapi-filterchip kapi-tabletools__chip--icon",
|
|
91
93
|
onClick: N,
|
|
92
|
-
children: [/* @__PURE__ */
|
|
94
|
+
children: [/* @__PURE__ */ y(ie, {
|
|
93
95
|
size: 14,
|
|
94
96
|
strokeWidth: 2.2
|
|
95
|
-
}), /* @__PURE__ */
|
|
97
|
+
}), /* @__PURE__ */ y("span", {
|
|
96
98
|
className: "kapi-strong kapi-tabletools__label",
|
|
97
99
|
children: e.exportCsv
|
|
98
100
|
})]
|
|
99
101
|
}),
|
|
100
|
-
$ && /* @__PURE__ */
|
|
102
|
+
$ && /* @__PURE__ */ b("div", {
|
|
101
103
|
ref: q,
|
|
102
104
|
className: "kapi-dropdown",
|
|
103
|
-
onKeyDown:
|
|
104
|
-
children: [/* @__PURE__ */
|
|
105
|
+
onKeyDown: he,
|
|
106
|
+
children: [/* @__PURE__ */ b("button", {
|
|
105
107
|
ref: G,
|
|
106
108
|
type: "button",
|
|
107
109
|
className: "kapi-filterchip kapi-tabletools__chip--icon",
|
|
108
|
-
onClick: () => V ? J(!1) :
|
|
110
|
+
onClick: () => V ? J(!1) : ye(),
|
|
109
111
|
"aria-haspopup": "dialog",
|
|
110
112
|
"aria-expanded": V,
|
|
111
113
|
children: [
|
|
112
|
-
/* @__PURE__ */
|
|
114
|
+
/* @__PURE__ */ y(re, {
|
|
113
115
|
size: 14,
|
|
114
116
|
strokeWidth: 2.2
|
|
115
117
|
}),
|
|
116
|
-
/* @__PURE__ */
|
|
118
|
+
/* @__PURE__ */ y("span", {
|
|
117
119
|
className: "kapi-strong kapi-tabletools__label",
|
|
118
120
|
children: e.columns
|
|
119
121
|
}),
|
|
120
|
-
/* @__PURE__ */
|
|
122
|
+
/* @__PURE__ */ y(x, {
|
|
121
123
|
size: 14,
|
|
122
124
|
strokeWidth: 2.2,
|
|
123
125
|
color: "var(--kapi-muted-2)",
|
|
124
126
|
className: "kapi-tabletools__chevron"
|
|
125
127
|
})
|
|
126
128
|
]
|
|
127
|
-
}), V && /* @__PURE__ */ v
|
|
129
|
+
}), V && /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y("div", {
|
|
128
130
|
className: "kapi-dropdown__backdrop",
|
|
129
131
|
onClick: () => J(!1)
|
|
130
|
-
}), /* @__PURE__ */
|
|
132
|
+
}), /* @__PURE__ */ b("div", {
|
|
131
133
|
ref: K,
|
|
132
|
-
className: `kapi-menu kapi-dropdown__menu kapi-dropdown__menu--${
|
|
133
|
-
style: { maxHeight:
|
|
134
|
+
className: `kapi-menu kapi-dropdown__menu kapi-dropdown__menu--${ge === "top" ? "up" : "down"} kapi-tabletools__menu kapi-tabletools__columns`,
|
|
135
|
+
style: { maxHeight: _e },
|
|
134
136
|
role: "dialog",
|
|
135
137
|
"aria-label": e.columns,
|
|
136
138
|
children: [
|
|
137
|
-
|
|
139
|
+
Z && /* @__PURE__ */ y(t, {
|
|
138
140
|
type: "search",
|
|
139
141
|
className: "kapi-tabletools__colsearch",
|
|
140
142
|
"aria-label": e.searchColumns,
|
|
141
143
|
placeholder: e.searchColumns,
|
|
142
144
|
spellCheck: !1,
|
|
143
|
-
startIcon: /* @__PURE__ */
|
|
145
|
+
startIcon: /* @__PURE__ */ y(w, {}),
|
|
144
146
|
clearable: !0,
|
|
145
147
|
value: U,
|
|
146
148
|
onChange: (e) => W(e.target.value),
|
|
@@ -148,19 +150,19 @@ function x({ text: e, filterable: f, filter: x, onFilterChange: S, visibleColumn
|
|
|
148
150
|
(e.key === "ArrowDown" || e.key === "Enter") && (e.preventDefault(), K.current?.querySelector("[role=\"listbox\"]")?.focus());
|
|
149
151
|
}
|
|
150
152
|
}),
|
|
151
|
-
F && /* @__PURE__ */
|
|
152
|
-
items:
|
|
153
|
-
value:
|
|
153
|
+
F && /* @__PURE__ */ y(n, {
|
|
154
|
+
items: X.map(Q),
|
|
155
|
+
value: X.filter((e) => L[e.key] !== !1).map((e) => e.key),
|
|
154
156
|
onChange: R,
|
|
155
157
|
query: U,
|
|
156
158
|
searchable: !1,
|
|
157
159
|
...I ? { label: e.showColumns } : { "aria-label": e.columns }
|
|
158
160
|
}),
|
|
159
|
-
I && ["left", "right"].map((t) => /* @__PURE__ */
|
|
161
|
+
I && ["left", "right"].map((t) => /* @__PURE__ */ y(n, {
|
|
160
162
|
label: t === "left" ? e.pinColumns : e.pinColumnsRight,
|
|
161
|
-
items:
|
|
163
|
+
items: f(P, L).map(Q),
|
|
162
164
|
value: z[t],
|
|
163
|
-
onChange: (e) => B(
|
|
165
|
+
onChange: (e) => B(d(z, t, e)),
|
|
164
166
|
query: U,
|
|
165
167
|
searchable: !1
|
|
166
168
|
}, t))
|
|
@@ -170,14 +172,14 @@ function x({ text: e, filterable: f, filter: x, onFilterChange: S, visibleColumn
|
|
|
170
172
|
]
|
|
171
173
|
});
|
|
172
174
|
}
|
|
173
|
-
function
|
|
174
|
-
let [a, o] =
|
|
175
|
+
function D({ action: t, busy: n, disabled: r, onRun: i }) {
|
|
176
|
+
let [a, o] = _(null), s = n ? /* @__PURE__ */ y(S, {
|
|
175
177
|
size: 14,
|
|
176
178
|
strokeWidth: 2.2,
|
|
177
179
|
className: "kapi-table-spin",
|
|
178
180
|
"aria-hidden": !0
|
|
179
181
|
}) : t.icon, { items: c, onAction: l } = t, u = t.icon === void 0 ? "kapi-filterchip" : "kapi-filterchip kapi-tabletools__chip--icon";
|
|
180
|
-
if (c === void 0) return /* @__PURE__ */
|
|
182
|
+
if (c === void 0) return /* @__PURE__ */ b("button", {
|
|
181
183
|
type: "button",
|
|
182
184
|
className: u,
|
|
183
185
|
disabled: r,
|
|
@@ -185,7 +187,7 @@ function ce({ action: t, busy: n, disabled: r, onRun: i }) {
|
|
|
185
187
|
onClick: () => {
|
|
186
188
|
l && i(l);
|
|
187
189
|
},
|
|
188
|
-
children: [s, /* @__PURE__ */
|
|
190
|
+
children: [s, /* @__PURE__ */ y("span", {
|
|
189
191
|
className: "kapi-strong kapi-tabletools__label",
|
|
190
192
|
children: t.label
|
|
191
193
|
})]
|
|
@@ -197,7 +199,7 @@ function ce({ action: t, busy: n, disabled: r, onRun: i }) {
|
|
|
197
199
|
disabled: n || t.disabled === !0,
|
|
198
200
|
onClick: () => i(t.onAction)
|
|
199
201
|
});
|
|
200
|
-
return /* @__PURE__ */ v
|
|
202
|
+
return /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ b("button", {
|
|
201
203
|
type: "button",
|
|
202
204
|
className: u,
|
|
203
205
|
disabled: r,
|
|
@@ -213,18 +215,18 @@ function ce({ action: t, busy: n, disabled: r, onRun: i }) {
|
|
|
213
215
|
},
|
|
214
216
|
children: [
|
|
215
217
|
s,
|
|
216
|
-
/* @__PURE__ */
|
|
218
|
+
/* @__PURE__ */ y("span", {
|
|
217
219
|
className: "kapi-strong kapi-tabletools__label",
|
|
218
220
|
children: t.label
|
|
219
221
|
}),
|
|
220
|
-
/* @__PURE__ */
|
|
222
|
+
/* @__PURE__ */ y(x, {
|
|
221
223
|
size: 14,
|
|
222
224
|
strokeWidth: 2.2,
|
|
223
225
|
color: "var(--kapi-muted-2)",
|
|
224
226
|
className: "kapi-tabletools__chevron"
|
|
225
227
|
})
|
|
226
228
|
]
|
|
227
|
-
}), a && /* @__PURE__ */
|
|
229
|
+
}), a && /* @__PURE__ */ y(p, {
|
|
228
230
|
open: !0,
|
|
229
231
|
x: a.x,
|
|
230
232
|
y: a.y,
|
|
@@ -234,4 +236,4 @@ function ce({ action: t, busy: n, disabled: r, onRun: i }) {
|
|
|
234
236
|
})] });
|
|
235
237
|
}
|
|
236
238
|
//#endregion
|
|
237
|
-
export {
|
|
239
|
+
export { E as KapiTableToolbar };
|
|
@@ -52,9 +52,11 @@ barCategoryOrder,
|
|
|
52
52
|
barStackTotals, DIRECT_LABEL_MAX_BARS } from "./barChartLogic.js";
|
|
53
53
|
export type { KapiBarScale, KapiBarSort, KapiBarValueLabels } from "./barChartLogic.js";
|
|
54
54
|
export { KapiTable, DEFAULT_TABLE_LABELS } from "./KapiTable.js";
|
|
55
|
+
export { KapiSheet, KapiSheetHead, KapiSheetBody, KapiSheetFoot, KapiSheetRow, KapiSheetCell, KapiSheetHeaderCell } from "./KapiSheet.js";
|
|
56
|
+
export type { KapiSheetProps, KapiSheetHeadProps, KapiSheetBodyProps, KapiSheetFootProps, KapiSheetRowProps, KapiSheetCellProps, KapiSheetHeaderCellProps } from "./KapiSheet.js";
|
|
55
57
|
export { KapiDataTable } from "./KapiDataTable.js";
|
|
56
58
|
export type { KapiDataTableProps } from "./KapiDataTable.js";
|
|
57
|
-
export type { KapiTableCellValue, KapiTableColumn, KapiTableAction, KapiTableActionHandler, KapiTableActionItem, KapiTableClientPagination, KapiTableContext, KapiTableCsvOptions, KapiTableDataset, KapiTableKey, KapiTableKeyField, KapiTableLabels, KapiTablePagination, KapiTableProps, KapiTableRowAttributes, KapiTableRowHooks, KapiTableSelectionPreset, KapiTableSortDirection, KapiTableSortState, KapiTableSortValue } from "./KapiTable.js";
|
|
59
|
+
export type { KapiTableCellValue, KapiTableColumn, KapiTableAction, KapiTableActionHandler, KapiTableActionItem, KapiTableClientPagination, KapiTableContext, KapiTableCsvOptions, KapiTableDataset, KapiTableFooterCell, KapiTableFooterRow, KapiTableKey, KapiTableKeyField, KapiTableLabels, KapiTablePagination, KapiTableClassNames, KapiTableProps, KapiTableRowAttributes, KapiTableRowHooks, KapiTableSelectionPreset, KapiTableSortDirection, KapiTableSortState, KapiTableSortValue } from "./KapiTable.js";
|
|
58
60
|
export {
|
|
59
61
|
/** @deprecated Interno; usa `KapiTable` en su lugar. Se quita en 1.0. */
|
|
60
62
|
datasetNoticeState,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CSSProperties, ReactNode } from "react";
|
|
2
|
-
import { type KapiTableColumnWidths, type KapiTableSortState } from "./tableLogic.js";
|
|
2
|
+
import { columnAlign, type KapiTableColumnWidths, type KapiTableSortState } from "./tableLogic.js";
|
|
3
3
|
import type { KapiTableLabels } from "./tableLabels.js";
|
|
4
4
|
import type { KapiTableColumn } from "./tableTypes.js";
|
|
5
5
|
export declare const copyToClipboard: (value: unknown, onCopy?: (value: unknown) => void) => void;
|
|
@@ -16,8 +16,7 @@ export type StickyLayout = {
|
|
|
16
16
|
/** Primera fija a la derecha: dibuja la sombra de ese borde (y Acciones deja de dibujarla). */
|
|
17
17
|
firstRight: number;
|
|
18
18
|
};
|
|
19
|
-
|
|
20
|
-
export declare const columnAlign: (align: KapiTableColumn<unknown>["align"]) => "start" | "center" | "end" | undefined;
|
|
19
|
+
export { columnAlign };
|
|
21
20
|
export declare const cellClass: <T>(c: KapiTableColumn<T>, i: number, layout: StickyLayout) => string;
|
|
22
21
|
export declare const stickyInset: (i: number, layout: StickyLayout) => CSSProperties;
|
|
23
22
|
/** Clase de la celda de acciones: sin sombra propia cuando hay fijas a la derecha pegadas a ella. */
|
|
@@ -35,4 +34,6 @@ export declare const stateRow: (colSpan: number, content: ReactNode, loading?: b
|
|
|
35
34
|
/** Barra de esqueleto de una celda: ancho variable por fila y columna, acotado al de la columna. */
|
|
36
35
|
export declare const skeletonBar: <T>(c: KapiTableColumn<T>, i: number, row: number) => import("react").JSX.Element;
|
|
37
36
|
/** Celda de datos de una fila: clases y caja de la columna, offset fijo, etiqueta para tarjetas y copiar. */
|
|
38
|
-
export declare const bodyCell: <T>(c: KapiTableColumn<T>, i: number, row: T, layout: StickyLayout, widths: KapiTableColumnWidths, text: Pick<KapiTableLabels, "copy">, onCopy: ((value: unknown) => void) | undefined
|
|
37
|
+
export declare const bodyCell: <T>(c: KapiTableColumn<T>, i: number, row: T, layout: StickyLayout, widths: KapiTableColumnWidths, text: Pick<KapiTableLabels, "copy">, onCopy: ((value: unknown) => void) | undefined,
|
|
38
|
+
/** Columnas que ocupa la celda (`rowColSpans`); sin él, una. */
|
|
39
|
+
colSpan?: number) => import("react").JSX.Element;
|