@kapiuara/ui 0.14.0 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +234 -1
- package/dist/components/chat/KapiChatList.js +19 -19
- package/dist/components/chat/KapiChatThread.js +23 -23
- package/dist/components/chat/KapiComposer.js +19 -19
- package/dist/components/chat/KapiMessageBubble.js +4 -4
- package/dist/components/chat/KapiTypingIndicator.js +4 -4
- package/dist/components/closeReason.d.ts +34 -0
- package/dist/components/data/KapiBarChart.js +1 -1
- package/dist/components/data/KapiDataTable.js +31 -31
- package/dist/components/data/KapiEventCalendar.js +78 -78
- package/dist/components/data/KapiHeatmap.js +23 -23
- package/dist/components/data/KapiLineChart.js +1 -1
- package/dist/components/data/KapiPagination.js +4 -4
- package/dist/components/data/KapiSparkline.js +1 -1
- package/dist/components/data/KapiTable.js +122 -122
- package/dist/components/data/KapiTableFilter.js +18 -18
- package/dist/components/data/KapiTableRow.js +24 -24
- package/dist/components/data/KapiTableToolbar.js +49 -49
- package/dist/components/data/chartFrame.js +21 -21
- package/dist/components/data/useColumnResize.js +8 -8
- package/dist/components/data/useTableSelection.js +8 -8
- package/dist/components/display/KapiAnnotation.js +53 -53
- package/dist/components/display/KapiComment.js +4 -4
- package/dist/components/display/KapiCommentComposer.js +16 -16
- package/dist/components/display/KapiFileItem.js +6 -6
- package/dist/components/display/KapiFileViewer.js +9 -9
- package/dist/components/display/KapiTruncate.js +7 -7
- package/dist/components/feedback/KapiAlert.d.ts +2 -1
- package/dist/components/feedback/KapiAlert.js +8 -8
- package/dist/components/feedback/KapiCountdown.js +8 -8
- package/dist/components/feedback/KapiFab.js +31 -31
- package/dist/components/feedback/KapiOfflineBanner.js +8 -8
- package/dist/components/feedback/KapiToastContainer.js +21 -21
- package/dist/components/feedback/KapiTour.d.ts +2 -1
- package/dist/components/feedback/KapiTour.js +32 -32
- package/dist/components/inputs/KapiAutocomplete.js +14 -14
- package/dist/components/inputs/KapiButton.d.ts +17 -1
- package/dist/components/inputs/KapiButton.js +41 -25
- package/dist/components/inputs/KapiCalendar.js +5 -5
- package/dist/components/inputs/KapiCalendarGrid.js +10 -10
- package/dist/components/inputs/KapiChecklist.js +71 -71
- package/dist/components/inputs/KapiDatePicker.js +28 -28
- package/dist/components/inputs/KapiDateRangePicker.js +27 -27
- package/dist/components/inputs/KapiFacetedSearch.js +24 -24
- package/dist/components/inputs/KapiField.js +14 -14
- package/dist/components/inputs/KapiFileUpload.js +27 -27
- package/dist/components/inputs/KapiIconButton.d.ts +9 -1
- package/dist/components/inputs/KapiIconButton.js +27 -10
- package/dist/components/inputs/KapiInput.js +21 -21
- package/dist/components/inputs/KapiInputGroup.js +8 -8
- package/dist/components/inputs/KapiMaskedInput.js +22 -22
- package/dist/components/inputs/KapiNumberStepper.js +12 -12
- package/dist/components/inputs/KapiRating.js +1 -1
- package/dist/components/inputs/KapiSearchChip.js +8 -8
- package/dist/components/inputs/KapiSegmented.js +27 -27
- package/dist/components/inputs/KapiSelect.js +166 -166
- package/dist/components/inputs/KapiSelectMenu.js +60 -60
- package/dist/components/inputs/KapiSlider.js +1 -1
- package/dist/components/inputs/KapiSwitch.js +6 -6
- package/dist/components/inputs/KapiTagInput.js +22 -22
- package/dist/components/inputs/KapiTextarea.js +8 -8
- package/dist/components/inputs/ownField.js +4 -4
- package/dist/components/layout/KapiAccountMenu.d.ts +2 -1
- package/dist/components/layout/KapiAccountMenu.js +51 -51
- package/dist/components/layout/KapiContextSlot.js +35 -35
- package/dist/components/layout/KapiMasonry.js +6 -6
- package/dist/components/layout/KapiNotificationBell.js +60 -60
- package/dist/components/layout/KapiPageHeader.js +19 -19
- package/dist/components/layout/KapiRail.js +60 -60
- package/dist/components/layout/KapiRailAccount.js +9 -9
- package/dist/components/layout/KapiRoot.js +21 -21
- package/dist/components/layout/KapiScrollArea.js +11 -11
- package/dist/components/layout/KapiShell.js +12 -12
- package/dist/components/locale/KapiLocaleProvider.js +13 -13
- package/dist/components/navigation/KapiAccordion.js +12 -12
- package/dist/components/navigation/KapiBreadcrumb.js +11 -11
- package/dist/components/navigation/KapiCollapsiblePanel.js +23 -23
- package/dist/components/navigation/KapiContextPanel.js +76 -76
- package/dist/components/navigation/KapiFilterChips.js +9 -9
- package/dist/components/navigation/KapiNavBadge.d.ts +4 -2
- package/dist/components/navigation/KapiNavBadge.js +11 -10
- package/dist/components/navigation/KapiPanelGroup.js +25 -25
- package/dist/components/navigation/KapiSteps.js +4 -4
- package/dist/components/navigation/KapiTabs.d.ts +4 -1
- package/dist/components/navigation/KapiTabs.js +18 -17
- package/dist/components/navigation/KapiTree.js +72 -72
- package/dist/components/navigation/KapiWizard.d.ts +2 -1
- package/dist/components/navigation/KapiWizard.js +30 -30
- package/dist/components/overlays/KapiCanvasForm.d.ts +6 -2
- package/dist/components/overlays/KapiCanvasForm.js +12 -12
- package/dist/components/overlays/KapiCommandPalette.d.ts +2 -1
- package/dist/components/overlays/KapiCommandPalette.js +23 -23
- package/dist/components/overlays/KapiConfirm.d.ts +2 -1
- package/dist/components/overlays/KapiConfirm.js +12 -12
- package/dist/components/overlays/KapiContextMenu.d.ts +2 -1
- package/dist/components/overlays/KapiContextMenu.js +15 -15
- package/dist/components/overlays/KapiDialogHost.js +22 -22
- package/dist/components/overlays/KapiLoading.js +16 -16
- package/dist/components/overlays/KapiMenuButton.js +12 -12
- package/dist/components/overlays/KapiModal.d.ts +2 -1
- package/dist/components/overlays/KapiModal.js +28 -28
- package/dist/components/overlays/KapiOffcanvas.d.ts +3 -2
- package/dist/components/overlays/KapiOffcanvas.js +63 -63
- package/dist/components/overlays/KapiOffcanvasStack.js +38 -38
- package/dist/components/overlays/KapiPhotoView.js +14 -14
- package/dist/components/overlays/KapiPopover.d.ts +2 -1
- package/dist/components/overlays/KapiPopover.js +7 -7
- package/dist/components/overlays/KapiShapeSheet.js +17 -17
- package/dist/components/overlays/KapiSplitModal.js +29 -29
- package/dist/components/overlays/KapiTooltip.js +20 -20
- package/dist/components/overlays/menuList.js +60 -60
- package/dist/components/overlays/useNativeDialog.d.ts +5 -0
- package/dist/components/overlays/useNativeDialog.js +2 -2
- package/dist/components/renderSlot.d.ts +27 -0
- package/dist/components/renderSlot.js +23 -0
- package/dist/hooks/portalRoot.js +6 -6
- package/dist/index.d.ts +2 -0
- package/package.json +1 -1
|
@@ -2,14 +2,14 @@
|
|
|
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 {
|
|
5
|
+
import { memo as o } from "react";
|
|
6
|
+
import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
7
7
|
import { ChevronDown as u, ChevronRight as d, MoreHorizontal as f } from "lucide-react";
|
|
8
8
|
//#region src/components/data/KapiTableRow.tsx
|
|
9
9
|
var p = "button, a, input, select, textarea, label, [role=button]";
|
|
10
|
-
function m({ row:
|
|
10
|
+
function m({ row: o, id: m, index: h, selected: g, selectLabel: _, open: v, canSelect: y, clickSelect: b, clickable: x, getRowProps: S, rangeSelect: C, selectable: w, expandable: T, rowHeight: E, virtualIndex: D, columns: O, layout: k, widths: A, text: j, hasActions: M, actions: N, hasRowMenu: P, renderSubComponent: F, colSpan: I, handlers: L }) {
|
|
11
11
|
let R = b && !x, z = x ? (t) => {
|
|
12
|
-
a(t.target, t.currentTarget, e(t.currentTarget)?.getSelection() ?? null) && L.rowClick(
|
|
12
|
+
a(t.target, t.currentTarget, e(t.currentTarget)?.getSelection() ?? null) && L.rowClick(o, t);
|
|
13
13
|
} : R ? (e) => {
|
|
14
14
|
e.target.closest(p) || L.activate(m, e.shiftKey);
|
|
15
15
|
} : void 0, B = x ? (e) => {
|
|
@@ -21,10 +21,10 @@ function m({ row: l, id: m, index: h, selected: g, selectLabel: _, open: v, canS
|
|
|
21
21
|
r({
|
|
22
22
|
...t,
|
|
23
23
|
isComposing: e.nativeEvent.isComposing
|
|
24
|
-
}) && (e.preventDefault(), L.rowClick(
|
|
24
|
+
}) && (e.preventDefault(), L.rowClick(o, e));
|
|
25
25
|
} : void 0, V = R ? (e) => {
|
|
26
26
|
C && e.shiftKey && e.preventDefault();
|
|
27
|
-
} : void 0, H = i(S?.(
|
|
27
|
+
} : void 0, H = i(S?.(o, h), {
|
|
28
28
|
className: `${g ? "is-selected" : ""}${R ? " is-rowsel" : ""}${x ? " is-clickable" : ""}`.trim(),
|
|
29
29
|
style: E === void 0 ? void 0 : { height: E },
|
|
30
30
|
tabIndex: x ? 0 : void 0,
|
|
@@ -32,16 +32,16 @@ function m({ row: l, id: m, index: h, selected: g, selectLabel: _, open: v, canS
|
|
|
32
32
|
onMouseDown: V,
|
|
33
33
|
onKeyDown: B
|
|
34
34
|
});
|
|
35
|
-
return /* @__PURE__ */
|
|
35
|
+
return /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ l("tr", {
|
|
36
36
|
...H,
|
|
37
37
|
"data-vindex": D,
|
|
38
38
|
children: [
|
|
39
|
-
w && /* @__PURE__ */
|
|
39
|
+
w && /* @__PURE__ */ c("td", {
|
|
40
40
|
className: "is-sticky kapi-cbcol",
|
|
41
41
|
style: { insetInlineStart: 0 },
|
|
42
|
-
children: /* @__PURE__ */
|
|
42
|
+
children: /* @__PURE__ */ c("label", {
|
|
43
43
|
className: "kapi-check kapi-check--block",
|
|
44
|
-
children: /* @__PURE__ */
|
|
44
|
+
children: /* @__PURE__ */ c("input", {
|
|
45
45
|
type: "checkbox",
|
|
46
46
|
checked: g,
|
|
47
47
|
disabled: !y,
|
|
@@ -53,35 +53,35 @@ function m({ row: l, id: m, index: h, selected: g, selectLabel: _, open: v, canS
|
|
|
53
53
|
})
|
|
54
54
|
})
|
|
55
55
|
}),
|
|
56
|
-
T && /* @__PURE__ */
|
|
56
|
+
T && /* @__PURE__ */ c("td", {
|
|
57
57
|
className: "kapi-expandcol",
|
|
58
|
-
children: /* @__PURE__ */
|
|
58
|
+
children: /* @__PURE__ */ c("button", {
|
|
59
59
|
type: "button",
|
|
60
60
|
className: "kapi-expandcol__btn",
|
|
61
61
|
"aria-label": j.expandRow,
|
|
62
62
|
"aria-expanded": v,
|
|
63
63
|
onClick: () => L.toggleExpanded(m),
|
|
64
|
-
children: v ? /* @__PURE__ */
|
|
64
|
+
children: v ? /* @__PURE__ */ c(u, {
|
|
65
65
|
size: 16,
|
|
66
66
|
strokeWidth: 2
|
|
67
|
-
}) : /* @__PURE__ */
|
|
67
|
+
}) : /* @__PURE__ */ c(d, {
|
|
68
68
|
className: "kapi-flip-rtl",
|
|
69
69
|
size: 16,
|
|
70
70
|
strokeWidth: 2
|
|
71
71
|
})
|
|
72
72
|
})
|
|
73
73
|
}),
|
|
74
|
-
O.map((e, t) => n(e, t,
|
|
75
|
-
M && /* @__PURE__ */
|
|
74
|
+
O.map((e, t) => n(e, t, o, k, A, j, L.copy)),
|
|
75
|
+
M && /* @__PURE__ */ c("td", {
|
|
76
76
|
className: t(k),
|
|
77
|
-
children: /* @__PURE__ */
|
|
77
|
+
children: /* @__PURE__ */ l("div", {
|
|
78
78
|
className: "kapi-actcol__in",
|
|
79
|
-
children: [N ? N(
|
|
79
|
+
children: [N ? N(o) : null, P && /* @__PURE__ */ c("button", {
|
|
80
80
|
type: "button",
|
|
81
81
|
className: "kapi-actcol__dots",
|
|
82
82
|
"aria-label": j.moreActions,
|
|
83
|
-
onClick: (e) => L.openMenu(e,
|
|
84
|
-
children: /* @__PURE__ */
|
|
83
|
+
onClick: (e) => L.openMenu(e, o),
|
|
84
|
+
children: /* @__PURE__ */ c(f, {
|
|
85
85
|
size: 16,
|
|
86
86
|
strokeWidth: 2
|
|
87
87
|
})
|
|
@@ -89,15 +89,15 @@ function m({ row: l, id: m, index: h, selected: g, selectLabel: _, open: v, canS
|
|
|
89
89
|
})
|
|
90
90
|
})
|
|
91
91
|
]
|
|
92
|
-
}), v && F && /* @__PURE__ */
|
|
92
|
+
}), v && F && /* @__PURE__ */ c("tr", {
|
|
93
93
|
className: "kapi-subrow",
|
|
94
94
|
"data-vindex": D,
|
|
95
|
-
children: /* @__PURE__ */
|
|
95
|
+
children: /* @__PURE__ */ c("td", {
|
|
96
96
|
colSpan: I,
|
|
97
|
-
children: F(
|
|
97
|
+
children: F(o)
|
|
98
98
|
})
|
|
99
99
|
})] });
|
|
100
100
|
}
|
|
101
|
-
var h =
|
|
101
|
+
var h = o(m);
|
|
102
102
|
//#endregion
|
|
103
103
|
export { h as TableRow };
|
|
@@ -9,13 +9,13 @@ import { COLUMNS_PANEL_ESTIMATE as o, COLUMNS_PANEL_PLACEMENT as s, columnsPanel
|
|
|
9
9
|
import { useFocusReturn as ee } from "../../hooks/useFocusReturn.js";
|
|
10
10
|
import { KapiContextMenu as f } from "../overlays/KapiContextMenu.js";
|
|
11
11
|
import { KapiTableFilter as p } from "./KapiTableFilter.js";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { ChevronDown as
|
|
12
|
+
import { useEffect as te, useLayoutEffect as ne, useRef as m, useState as h } from "react";
|
|
13
|
+
import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
14
|
+
import { ChevronDown as y, Columns3 as re, Download as ie, Loader2 as b, RefreshCw as ae, Search as oe } from "lucide-react";
|
|
15
15
|
//#region src/components/data/KapiTableToolbar.tsx
|
|
16
|
-
var
|
|
17
|
-
function
|
|
18
|
-
let [V, H] =
|
|
16
|
+
var se = (e) => e != null && typeof e != "boolean";
|
|
17
|
+
function x({ text: e, filterable: f, filter: x, onFilterChange: S, visibleColumns: C, manualFilter: w, filterDebounce: T, shownCount: E, totalCount: D, content: O, toolbarActions: k, isPending: A, context: le, onRun: ue, refresh: j, refreshing: M, onExportCsv: N, columns: P, columnToggle: F, columnPinning: I, visibility: L, onShownColumnsChange: R, pinned: z, onPinnedChange: B }) {
|
|
18
|
+
let [V, H] = h(!1), [U, W] = h(""), G = m(null), K = m(null), q = m(null), { restore: de } = ee(V, {
|
|
19
19
|
container: K,
|
|
20
20
|
target: G
|
|
21
21
|
}), J = (e) => {
|
|
@@ -32,76 +32,76 @@ function C({ text: e, filterable: f, filter: C, onFilterChange: w, visibleColumn
|
|
|
32
32
|
estimate: o,
|
|
33
33
|
...s,
|
|
34
34
|
hideUntilPlaced: !1
|
|
35
|
-
}), X = Y?.side === "top" ? "top" : "bottom", [pe, me] =
|
|
36
|
-
|
|
35
|
+
}), X = Y?.side === "top" ? "top" : "bottom", [pe, me] = h(560);
|
|
36
|
+
ne(() => {
|
|
37
37
|
let e = Y?.side, t = e ? G.current?.getBoundingClientRect() : void 0;
|
|
38
38
|
e && t && me(c(e, t, r(G.current).height));
|
|
39
39
|
}, [Y]);
|
|
40
40
|
let he = () => H(!0);
|
|
41
|
-
|
|
41
|
+
te(() => {
|
|
42
42
|
V && K.current?.querySelector("input, [role=\"listbox\"]")?.focus();
|
|
43
43
|
}, [V]);
|
|
44
44
|
let Z = P.filter((e) => e.hideable !== !1), ge = P.length > 6, Q = (e) => ({
|
|
45
45
|
id: e.key,
|
|
46
46
|
label: e.label,
|
|
47
47
|
text: l(e)
|
|
48
|
-
}), $ = F && Z.length > 0 || I, _e = (
|
|
49
|
-
return !f && !
|
|
48
|
+
}), $ = F && Z.length > 0 || I, _e = (k?.length ?? 0) > 0;
|
|
49
|
+
return !f && !se(O) && !_e && !j && !N && !$ ? null : /* @__PURE__ */ v("div", {
|
|
50
50
|
className: "kapi-tabletools",
|
|
51
51
|
children: [
|
|
52
|
-
f && /* @__PURE__ */
|
|
53
|
-
value:
|
|
54
|
-
onChange:
|
|
55
|
-
columns:
|
|
56
|
-
count:
|
|
57
|
-
shown:
|
|
58
|
-
total:
|
|
52
|
+
f && /* @__PURE__ */ _(p, {
|
|
53
|
+
value: x,
|
|
54
|
+
onChange: S,
|
|
55
|
+
columns: C,
|
|
56
|
+
count: w ? void 0 : {
|
|
57
|
+
shown: E,
|
|
58
|
+
total: D
|
|
59
59
|
},
|
|
60
|
-
loadDelay:
|
|
60
|
+
loadDelay: w ? T : 0,
|
|
61
61
|
labels: e
|
|
62
62
|
}),
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
O,
|
|
64
|
+
k?.map((e) => /* @__PURE__ */ _(ce, {
|
|
65
65
|
action: e,
|
|
66
|
-
busy:
|
|
66
|
+
busy: A(e.id),
|
|
67
67
|
disabled: typeof e.disabled == "function" ? e.disabled(le()) : e.disabled === !0,
|
|
68
68
|
onRun: (t) => ue(e.id, t)
|
|
69
69
|
}, e.id)),
|
|
70
|
-
j && /* @__PURE__ */
|
|
70
|
+
j && /* @__PURE__ */ v("button", {
|
|
71
71
|
type: "button",
|
|
72
72
|
className: "kapi-filterchip kapi-tabletools__chip--icon",
|
|
73
73
|
"aria-busy": M || void 0,
|
|
74
74
|
onClick: j,
|
|
75
|
-
children: [M ? /* @__PURE__ */
|
|
75
|
+
children: [M ? /* @__PURE__ */ _(b, {
|
|
76
76
|
size: 14,
|
|
77
77
|
strokeWidth: 2.2,
|
|
78
78
|
className: "kapi-table-spin",
|
|
79
79
|
"aria-hidden": !0
|
|
80
|
-
}) : /* @__PURE__ */
|
|
80
|
+
}) : /* @__PURE__ */ _(ae, {
|
|
81
81
|
size: 14,
|
|
82
82
|
strokeWidth: 2.2
|
|
83
|
-
}), /* @__PURE__ */
|
|
83
|
+
}), /* @__PURE__ */ _("span", {
|
|
84
84
|
className: "kapi-strong kapi-tabletools__label",
|
|
85
85
|
children: e.refresh
|
|
86
86
|
})]
|
|
87
87
|
}),
|
|
88
|
-
N && /* @__PURE__ */
|
|
88
|
+
N && /* @__PURE__ */ v("button", {
|
|
89
89
|
type: "button",
|
|
90
90
|
className: "kapi-filterchip kapi-tabletools__chip--icon",
|
|
91
91
|
onClick: N,
|
|
92
|
-
children: [/* @__PURE__ */
|
|
92
|
+
children: [/* @__PURE__ */ _(ie, {
|
|
93
93
|
size: 14,
|
|
94
94
|
strokeWidth: 2.2
|
|
95
|
-
}), /* @__PURE__ */
|
|
95
|
+
}), /* @__PURE__ */ _("span", {
|
|
96
96
|
className: "kapi-strong kapi-tabletools__label",
|
|
97
97
|
children: e.exportCsv
|
|
98
98
|
})]
|
|
99
99
|
}),
|
|
100
|
-
$ && /* @__PURE__ */
|
|
100
|
+
$ && /* @__PURE__ */ v("div", {
|
|
101
101
|
ref: q,
|
|
102
102
|
className: "kapi-dropdown",
|
|
103
103
|
onKeyDown: fe,
|
|
104
|
-
children: [/* @__PURE__ */
|
|
104
|
+
children: [/* @__PURE__ */ v("button", {
|
|
105
105
|
ref: G,
|
|
106
106
|
type: "button",
|
|
107
107
|
className: "kapi-filterchip kapi-tabletools__chip--icon",
|
|
@@ -109,38 +109,38 @@ function C({ text: e, filterable: f, filter: C, onFilterChange: w, visibleColumn
|
|
|
109
109
|
"aria-haspopup": "dialog",
|
|
110
110
|
"aria-expanded": V,
|
|
111
111
|
children: [
|
|
112
|
-
/* @__PURE__ */
|
|
112
|
+
/* @__PURE__ */ _(re, {
|
|
113
113
|
size: 14,
|
|
114
114
|
strokeWidth: 2.2
|
|
115
115
|
}),
|
|
116
|
-
/* @__PURE__ */
|
|
116
|
+
/* @__PURE__ */ _("span", {
|
|
117
117
|
className: "kapi-strong kapi-tabletools__label",
|
|
118
118
|
children: e.columns
|
|
119
119
|
}),
|
|
120
|
-
/* @__PURE__ */
|
|
120
|
+
/* @__PURE__ */ _(y, {
|
|
121
121
|
size: 14,
|
|
122
122
|
strokeWidth: 2.2,
|
|
123
123
|
color: "var(--kapi-muted-2)",
|
|
124
124
|
className: "kapi-tabletools__chevron"
|
|
125
125
|
})
|
|
126
126
|
]
|
|
127
|
-
}), V && /* @__PURE__ */ g
|
|
127
|
+
}), V && /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("div", {
|
|
128
128
|
className: "kapi-dropdown__backdrop",
|
|
129
129
|
onClick: () => J(!1)
|
|
130
|
-
}), /* @__PURE__ */
|
|
130
|
+
}), /* @__PURE__ */ v("div", {
|
|
131
131
|
ref: K,
|
|
132
132
|
className: `kapi-menu kapi-dropdown__menu kapi-dropdown__menu--${X === "top" ? "up" : "down"} kapi-tabletools__menu kapi-tabletools__columns`,
|
|
133
133
|
style: { maxHeight: pe },
|
|
134
134
|
role: "dialog",
|
|
135
135
|
"aria-label": e.columns,
|
|
136
136
|
children: [
|
|
137
|
-
ge && /* @__PURE__ */
|
|
137
|
+
ge && /* @__PURE__ */ _(t, {
|
|
138
138
|
type: "search",
|
|
139
139
|
className: "kapi-tabletools__colsearch",
|
|
140
140
|
"aria-label": e.searchColumns,
|
|
141
141
|
placeholder: e.searchColumns,
|
|
142
142
|
spellCheck: !1,
|
|
143
|
-
startIcon: /* @__PURE__ */
|
|
143
|
+
startIcon: /* @__PURE__ */ _(oe, {}),
|
|
144
144
|
clearable: !0,
|
|
145
145
|
value: U,
|
|
146
146
|
onChange: (e) => W(e.target.value),
|
|
@@ -148,7 +148,7 @@ function C({ text: e, filterable: f, filter: C, onFilterChange: w, visibleColumn
|
|
|
148
148
|
(e.key === "ArrowDown" || e.key === "Enter") && (e.preventDefault(), K.current?.querySelector("[role=\"listbox\"]")?.focus());
|
|
149
149
|
}
|
|
150
150
|
}),
|
|
151
|
-
F && /* @__PURE__ */
|
|
151
|
+
F && /* @__PURE__ */ _(n, {
|
|
152
152
|
items: Z.map(Q),
|
|
153
153
|
value: Z.filter((e) => L[e.key] !== !1).map((e) => e.key),
|
|
154
154
|
onChange: R,
|
|
@@ -156,7 +156,7 @@ function C({ text: e, filterable: f, filter: C, onFilterChange: w, visibleColumn
|
|
|
156
156
|
searchable: !1,
|
|
157
157
|
...I ? { label: e.showColumns } : { "aria-label": e.columns }
|
|
158
158
|
}),
|
|
159
|
-
I && ["left", "right"].map((t) => /* @__PURE__ */
|
|
159
|
+
I && ["left", "right"].map((t) => /* @__PURE__ */ _(n, {
|
|
160
160
|
label: t === "left" ? e.pinColumns : e.pinColumnsRight,
|
|
161
161
|
items: d(P, L).map(Q),
|
|
162
162
|
value: z[t],
|
|
@@ -170,14 +170,14 @@ function C({ text: e, filterable: f, filter: C, onFilterChange: w, visibleColumn
|
|
|
170
170
|
]
|
|
171
171
|
});
|
|
172
172
|
}
|
|
173
|
-
function
|
|
174
|
-
let [a, o] =
|
|
173
|
+
function ce({ action: t, busy: n, disabled: r, onRun: i }) {
|
|
174
|
+
let [a, o] = h(null), s = n ? /* @__PURE__ */ _(b, {
|
|
175
175
|
size: 14,
|
|
176
176
|
strokeWidth: 2.2,
|
|
177
177
|
className: "kapi-table-spin",
|
|
178
178
|
"aria-hidden": !0
|
|
179
179
|
}) : 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__ */
|
|
180
|
+
if (c === void 0) return /* @__PURE__ */ v("button", {
|
|
181
181
|
type: "button",
|
|
182
182
|
className: u,
|
|
183
183
|
disabled: r,
|
|
@@ -185,7 +185,7 @@ function oe({ action: t, busy: n, disabled: r, onRun: i }) {
|
|
|
185
185
|
onClick: () => {
|
|
186
186
|
l && i(l);
|
|
187
187
|
},
|
|
188
|
-
children: [s, /* @__PURE__ */
|
|
188
|
+
children: [s, /* @__PURE__ */ _("span", {
|
|
189
189
|
className: "kapi-strong kapi-tabletools__label",
|
|
190
190
|
children: t.label
|
|
191
191
|
})]
|
|
@@ -197,7 +197,7 @@ function oe({ action: t, busy: n, disabled: r, onRun: i }) {
|
|
|
197
197
|
disabled: n || t.disabled === !0,
|
|
198
198
|
onClick: () => i(t.onAction)
|
|
199
199
|
});
|
|
200
|
-
return /* @__PURE__ */ g
|
|
200
|
+
return /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ v("button", {
|
|
201
201
|
type: "button",
|
|
202
202
|
className: u,
|
|
203
203
|
disabled: r,
|
|
@@ -213,18 +213,18 @@ function oe({ action: t, busy: n, disabled: r, onRun: i }) {
|
|
|
213
213
|
},
|
|
214
214
|
children: [
|
|
215
215
|
s,
|
|
216
|
-
/* @__PURE__ */
|
|
216
|
+
/* @__PURE__ */ _("span", {
|
|
217
217
|
className: "kapi-strong kapi-tabletools__label",
|
|
218
218
|
children: t.label
|
|
219
219
|
}),
|
|
220
|
-
/* @__PURE__ */
|
|
220
|
+
/* @__PURE__ */ _(y, {
|
|
221
221
|
size: 14,
|
|
222
222
|
strokeWidth: 2.2,
|
|
223
223
|
color: "var(--kapi-muted-2)",
|
|
224
224
|
className: "kapi-tabletools__chevron"
|
|
225
225
|
})
|
|
226
226
|
]
|
|
227
|
-
}), a && /* @__PURE__ */
|
|
227
|
+
}), a && /* @__PURE__ */ _(f, {
|
|
228
228
|
open: !0,
|
|
229
229
|
x: a.x,
|
|
230
230
|
y: a.y,
|
|
@@ -234,4 +234,4 @@ function oe({ action: t, busy: n, disabled: r, onRun: i }) {
|
|
|
234
234
|
})] });
|
|
235
235
|
}
|
|
236
236
|
//#endregion
|
|
237
|
-
export {
|
|
237
|
+
export { x as KapiTableToolbar };
|
|
@@ -3,8 +3,8 @@ import { useKapiFormatLocale as e, useLabels as t } from "../locale/KapiLocalePr
|
|
|
3
3
|
import { useControllableState as n } from "../../hooks/useControllableState.js";
|
|
4
4
|
import { formatDataValue as r } from "../../hooks/numberFormatLogic.js";
|
|
5
5
|
import { KapiSegmented as i } from "../inputs/KapiSegmented.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { useId as a } from "react";
|
|
7
|
+
import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
8
8
|
//#region src/components/data/chartFrame.tsx
|
|
9
9
|
var l = {
|
|
10
10
|
chartView: "Gráfico",
|
|
@@ -26,18 +26,18 @@ var l = {
|
|
|
26
26
|
...e === void 0 ? {} : { "--kapi-chart-slot": `var(--kapi-series-${e + 1})` },
|
|
27
27
|
...t === void 0 ? {} : { "--kapi-chart-x": `${t}%` },
|
|
28
28
|
...n === void 0 ? {} : { "--kapi-chart-y": `${n}%` }
|
|
29
|
-
}), h = ({ block: e, slot: t }) => /* @__PURE__ */
|
|
29
|
+
}), h = ({ block: e, slot: t }) => /* @__PURE__ */ s("span", {
|
|
30
30
|
className: `${e}__swatch`,
|
|
31
31
|
style: m({ slot: t })
|
|
32
|
-
}), g = ({ title: t, titleId: n, series:
|
|
33
|
-
let y = e(), b =
|
|
34
|
-
return /* @__PURE__ */
|
|
32
|
+
}), g = ({ title: t, titleId: n, series: a, categories: l, valueAt: u, unit: f, view: p, onViewChange: m, text: g, block: _, children: v }) => {
|
|
33
|
+
let y = e(), b = a.length === 0 || l.length === 0;
|
|
34
|
+
return /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ c("div", {
|
|
35
35
|
className: `${_}__head`,
|
|
36
|
-
children: [t ? /* @__PURE__ */
|
|
36
|
+
children: [t ? /* @__PURE__ */ s("div", {
|
|
37
37
|
className: `${_}__title`,
|
|
38
38
|
id: n,
|
|
39
39
|
children: t
|
|
40
|
-
}) : null, /* @__PURE__ */
|
|
40
|
+
}) : null, /* @__PURE__ */ s(i, {
|
|
41
41
|
"aria-label": g.view,
|
|
42
42
|
items: [{
|
|
43
43
|
id: "chart",
|
|
@@ -49,40 +49,40 @@ var l = {
|
|
|
49
49
|
value: p,
|
|
50
50
|
onChange: m
|
|
51
51
|
})]
|
|
52
|
-
}), b ? /* @__PURE__ */
|
|
52
|
+
}), b ? /* @__PURE__ */ s("p", {
|
|
53
53
|
className: `${_}__empty kapi-muted`,
|
|
54
54
|
children: g.empty
|
|
55
|
-
}) : p === "table" ? /* @__PURE__ */
|
|
55
|
+
}) : p === "table" ? /* @__PURE__ */ s("div", {
|
|
56
56
|
className: `${_}__tablewrap`,
|
|
57
|
-
children: /* @__PURE__ */
|
|
57
|
+
children: /* @__PURE__ */ c("table", {
|
|
58
58
|
className: `${_}__table`,
|
|
59
|
-
children: [/* @__PURE__ */
|
|
59
|
+
children: [/* @__PURE__ */ s("thead", { children: /* @__PURE__ */ c("tr", { children: [/* @__PURE__ */ s("th", {
|
|
60
60
|
scope: "col",
|
|
61
61
|
children: g.series
|
|
62
|
-
}), l.map((e, t) => /* @__PURE__ */
|
|
62
|
+
}), l.map((e, t) => /* @__PURE__ */ s("th", {
|
|
63
63
|
scope: "col",
|
|
64
64
|
children: e
|
|
65
|
-
}, `${e}-${t}`))] }) }), /* @__PURE__ */
|
|
65
|
+
}, `${e}-${t}`))] }) }), /* @__PURE__ */ s("tbody", { children: a.map((e, t) => /* @__PURE__ */ c("tr", { children: [/* @__PURE__ */ s("th", {
|
|
66
66
|
scope: "row",
|
|
67
|
-
children: /* @__PURE__ */
|
|
67
|
+
children: /* @__PURE__ */ c("span", {
|
|
68
68
|
className: `${_}__serie`,
|
|
69
|
-
children: [/* @__PURE__ */
|
|
69
|
+
children: [/* @__PURE__ */ s(h, {
|
|
70
70
|
block: _,
|
|
71
71
|
slot: t
|
|
72
72
|
}), e.label]
|
|
73
73
|
})
|
|
74
|
-
}), l.map((e, n) => /* @__PURE__ */
|
|
74
|
+
}), l.map((e, n) => /* @__PURE__ */ s("td", { children: d(r(u(t, n), y), f) }, `${e}-${n}`))] }, e.id)) })]
|
|
75
75
|
})
|
|
76
|
-
}) : /* @__PURE__ */
|
|
76
|
+
}) : /* @__PURE__ */ c(o, { children: [a.length > 1 ? /* @__PURE__ */ s("ul", {
|
|
77
77
|
className: `${_}__legend`,
|
|
78
|
-
children:
|
|
78
|
+
children: a.map((e, t) => /* @__PURE__ */ c("li", {
|
|
79
79
|
className: `${_}__legenditem`,
|
|
80
|
-
children: [/* @__PURE__ */
|
|
80
|
+
children: [/* @__PURE__ */ s(h, {
|
|
81
81
|
block: _,
|
|
82
82
|
slot: t
|
|
83
83
|
}), e.label]
|
|
84
84
|
}, e.id))
|
|
85
85
|
}) : null, v] })] });
|
|
86
|
-
}, _ = () =>
|
|
86
|
+
}, _ = () => a();
|
|
87
87
|
//#endregion
|
|
88
88
|
export { h as ChartSwatch, l as DEFAULT_CHART_LABELS, g as KapiChartFrame, u as chartSummary, m as chartVars, f as useChartLabels, _ as useChartTitleId, p as useChartView, d as withChartUnit };
|
|
@@ -3,11 +3,11 @@ import { rafThrottle as e } from "../../hooks/rafThrottle.js";
|
|
|
3
3
|
import { directionOf as t, logicalKeyOf as n } from "../../hooks/directionLogic.js";
|
|
4
4
|
import { clampColumnWidth as r, resizeColumn as i } from "./tableLogic.js";
|
|
5
5
|
import { draftStickyLefts as a, draftStickyRights as o, endResizeDrag as s, moveResizeDrag as c, needsDraftLeftPaint as l, startResizeDrag as u } from "./tableResizeLogic.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { useCallback as d, useEffect as f, useLayoutEffect as p, useRef as m, useState as h } from "react";
|
|
7
|
+
import { jsx as g } from "react/jsx-runtime";
|
|
8
8
|
//#region src/components/data/useColumnResize.tsx
|
|
9
9
|
var _ = (e) => typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e) : e.replace(/["\\]/g, "\\$&"), v = ({ tableRef: v, columns: y, widths: b, onCommit: x, lefts: S, rights: C, offset: w, rightEnd: T, resizableColumns: E, resizeLabel: D }) => {
|
|
10
|
-
let O =
|
|
10
|
+
let O = m(null), k = (e) => e.resizable ?? E, A = (e) => e.minWidth ?? 60, [j, M] = h({}), N = (e) => r(b[e.key] ?? e.width ?? j[e.key] ?? A(e), A(e)), P = d(() => {
|
|
11
11
|
let e = v.current;
|
|
12
12
|
if (!e) return;
|
|
13
13
|
let t = {};
|
|
@@ -20,12 +20,12 @@ var _ = (e) => typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(
|
|
|
20
20
|
return n.length === Object.keys(e).length && n.every((n) => e[n] === t[n]) ? e : t;
|
|
21
21
|
});
|
|
22
22
|
}, [v]);
|
|
23
|
-
|
|
23
|
+
p(P, [
|
|
24
24
|
P,
|
|
25
25
|
y,
|
|
26
26
|
b
|
|
27
27
|
]);
|
|
28
|
-
let F =
|
|
28
|
+
let F = m({
|
|
29
29
|
columns: y,
|
|
30
30
|
widths: b,
|
|
31
31
|
lefts: S,
|
|
@@ -41,7 +41,7 @@ var _ = (e) => typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(
|
|
|
41
41
|
offset: w,
|
|
42
42
|
rightEnd: T
|
|
43
43
|
};
|
|
44
|
-
let I =
|
|
44
|
+
let I = m(/* @__PURE__ */ new Map()), L = m(/* @__PURE__ */ new Map()), R = m(/* @__PURE__ */ new Map()), [z] = h(() => e((e) => {
|
|
45
45
|
let t = v.current;
|
|
46
46
|
if (!t) return;
|
|
47
47
|
let n = F.current, r = a(n.columns, n.widths, e.key, e.width, n.offset), i = o(n.columns, n.widths, e.key, e.width, n.rightEnd);
|
|
@@ -66,7 +66,7 @@ var _ = (e) => typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(
|
|
|
66
66
|
t.style.cssText = e;
|
|
67
67
|
}), I.current.clear(), L.current.clear(), R.current.clear();
|
|
68
68
|
};
|
|
69
|
-
|
|
69
|
+
f(() => () => z.cancel(), [z]);
|
|
70
70
|
let V = (e, n) => {
|
|
71
71
|
if (e.button !== 0) return;
|
|
72
72
|
e.preventDefault(), e.stopPropagation();
|
|
@@ -93,7 +93,7 @@ var _ = (e) => typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(
|
|
|
93
93
|
return { resizeHandle: (e) => {
|
|
94
94
|
if (!k(e)) return null;
|
|
95
95
|
let t = typeof e.label == "string" ? ` ${e.label}` : "";
|
|
96
|
-
return /* @__PURE__ */
|
|
96
|
+
return /* @__PURE__ */ g("div", {
|
|
97
97
|
role: "separator",
|
|
98
98
|
"aria-orientation": "vertical",
|
|
99
99
|
"aria-label": `${D}${t}`,
|
|
@@ -4,12 +4,12 @@ import { useControllableState as t } from "../../hooks/useControllableState.js";
|
|
|
4
4
|
import { formatCount as n } from "../../hooks/numberFormatLogic.js";
|
|
5
5
|
import { selectOnlyWithin as r, selectionState as i } from "./tableLogic.js";
|
|
6
6
|
import { datasetActionLabel as a, datasetHintLabel as o, datasetNoticeState as s, datasetSelectedLabel as c } from "./datasetSelectionLogic.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { useMemo as l } from "react";
|
|
8
|
+
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
9
9
|
import { Loader2 as p } from "lucide-react";
|
|
10
10
|
//#region src/components/data/useTableSelection.tsx
|
|
11
11
|
var m = [], h = ({ rows: a, keyField: o, selectable: c, selectedIds: h, defaultSelectedIds: g, onSelectedIdsChange: _, isRowSelectable: v, selectionPresets: y, rangeSelect: b, dataset: x, loadingLabel: S, locale: C }) => {
|
|
12
|
-
let [w, T] = t(h, g ?? m, _ && ((e) => _([...e]))), E =
|
|
12
|
+
let [w, T] = t(h, g ?? m, _ && ((e) => _([...e]))), E = l(() => new Set(w), [w]), D = (e) => T([...e]), O = () => D(/* @__PURE__ */ new Set()), k = [...E], A = e(), j = c && y !== void 0 && y.length > 0, M = l(() => a.filter((e) => !v || v(e)), [a, v]), N = l(() => M.map((e) => e[o]), [M, o]), P = l(() => j && y ? y.map((e) => ({
|
|
13
13
|
preset: e,
|
|
14
14
|
matching: e.match === void 0 ? [] : M.filter(e.match).map((e) => e[o])
|
|
15
15
|
})) : [], [
|
|
@@ -18,12 +18,12 @@ var m = [], h = ({ rows: a, keyField: o, selectable: c, selectedIds: h, defaultS
|
|
|
18
18
|
M,
|
|
19
19
|
o
|
|
20
20
|
]).map(({ preset: e, matching: t }) => {
|
|
21
|
-
let i = e.onSelect === void 0 ? t.length : e.count, a = e.pending === !0, o = a ? /* @__PURE__ */
|
|
21
|
+
let i = e.onSelect === void 0 ? t.length : e.count, a = e.pending === !0, o = a ? /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(p, {
|
|
22
22
|
size: 14,
|
|
23
23
|
strokeWidth: 2.2,
|
|
24
24
|
className: "kapi-table-spin",
|
|
25
25
|
"aria-hidden": !0
|
|
26
|
-
}), /* @__PURE__ */
|
|
26
|
+
}), /* @__PURE__ */ d("span", {
|
|
27
27
|
className: "kapi-sr-only",
|
|
28
28
|
children: S
|
|
29
29
|
})] }) : e.icon;
|
|
@@ -60,15 +60,15 @@ var m = [], h = ({ rows: a, keyField: o, selectable: c, selectedIds: h, defaultS
|
|
|
60
60
|
};
|
|
61
61
|
};
|
|
62
62
|
function g({ dataset: e, notice: t, shown: n, clearLabel: r, labels: i, locale: s }) {
|
|
63
|
-
return /* @__PURE__ */
|
|
63
|
+
return /* @__PURE__ */ f("div", {
|
|
64
64
|
className: t === "none" ? void 0 : "kapi-table__dataset",
|
|
65
65
|
role: "status",
|
|
66
|
-
children: [t === "offer" && /* @__PURE__ */
|
|
66
|
+
children: [t === "offer" && /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("span", { children: e.hintLabel ? e.hintLabel(n, e.total) : o(n, e.total, i, s) }), /* @__PURE__ */ d("button", {
|
|
67
67
|
type: "button",
|
|
68
68
|
className: "kapi-link",
|
|
69
69
|
onClick: e.onSelect,
|
|
70
70
|
children: e.actionLabel ? e.actionLabel(e.total) : a(e.total, i, s)
|
|
71
|
-
})] }), t === "selected" && /* @__PURE__ */
|
|
71
|
+
})] }), t === "selected" && /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("span", { children: e.selectedLabel ? e.selectedLabel(e.total) : c(e.total, i, s) }), e.onClear && /* @__PURE__ */ d("button", {
|
|
72
72
|
type: "button",
|
|
73
73
|
className: "kapi-link",
|
|
74
74
|
onClick: e.onClear,
|