@kapiuara/ui 0.15.3 → 0.17.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 +505 -13
- package/dist/components/chat/KapiChatThread.js +4 -4
- package/dist/components/chat/KapiComposer.js +8 -8
- package/dist/components/data/KapiDataTable.d.ts +1 -1
- package/dist/components/data/KapiDataTable.js +25 -25
- 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/KapiSparkline.d.ts +2 -1
- package/dist/components/data/KapiSparkline.js +29 -26
- package/dist/components/data/KapiTable.d.ts +2 -2
- package/dist/components/data/KapiTable.js +347 -329
- package/dist/components/data/KapiTableFilter.js +6 -6
- 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 +17 -5
- package/dist/components/data/tableCells.js +52 -53
- 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 +29 -25
- package/dist/components/display/KapiAnchor.d.ts +36 -0
- package/dist/components/display/KapiAnchor.js +36 -0
- package/dist/components/display/KapiAnnotation.js +68 -63
- package/dist/components/display/KapiAvatar.d.ts +6 -4
- package/dist/components/display/KapiAvatar.js +33 -28
- package/dist/components/display/KapiBadge.d.ts +6 -5
- package/dist/components/display/KapiBadge.js +25 -19
- package/dist/components/display/KapiCodeBlock.d.ts +48 -0
- package/dist/components/display/KapiCodeBlock.js +44 -0
- package/dist/components/display/KapiCommentComposer.js +6 -6
- package/dist/components/display/KapiDiff.d.ts +62 -0
- package/dist/components/display/KapiDiff.js +118 -0
- package/dist/components/display/KapiHighlight.d.ts +27 -0
- package/dist/components/display/KapiHighlight.js +21 -0
- package/dist/components/display/KapiIconTile.d.ts +2 -1
- package/dist/components/display/KapiIconTile.js +23 -21
- package/dist/components/display/KapiStat.d.ts +3 -2
- package/dist/components/display/KapiStat.js +32 -26
- package/dist/components/display/KapiTag.d.ts +4 -3
- package/dist/components/display/KapiTag.js +29 -24
- package/dist/components/display/KapiText.d.ts +43 -0
- package/dist/components/display/KapiText.js +33 -0
- package/dist/components/display/KapiTimeline.d.ts +5 -2
- package/dist/components/display/KapiTimeline.js +31 -23
- package/dist/components/display/KapiTitle.d.ts +33 -0
- package/dist/components/display/KapiTitle.js +29 -0
- package/dist/components/display/annotationLogic.d.ts +2 -1
- package/dist/components/display/annotationLogic.js +7 -6
- package/dist/components/display/codeBlockSlots.d.ts +10 -0
- package/dist/components/display/codeBlockSlots.js +13 -0
- package/dist/components/display/diffLogic.d.ts +58 -0
- package/dist/components/display/diffLogic.js +96 -0
- package/dist/components/display/diffSlots.d.ts +14 -0
- package/dist/components/display/diffSlots.js +17 -0
- package/dist/components/display/highlightLogic.d.ts +18 -0
- package/dist/components/display/highlightLogic.js +26 -0
- package/dist/components/display/highlightSlots.d.ts +5 -0
- package/dist/components/display/highlightSlots.js +8 -0
- package/dist/components/display/iconTileLogic.d.ts +2 -2
- package/dist/components/display/iconTileLogic.js +7 -6
- package/dist/components/display/index.d.ts +15 -0
- package/dist/components/display/statLogic.d.ts +2 -1
- package/dist/components/display/statLogic.js +7 -6
- package/dist/components/display/tagLogic.d.ts +2 -1
- package/dist/components/display/tagLogic.js +7 -6
- package/dist/components/display/textLogic.d.ts +32 -0
- package/dist/components/display/textLogic.js +19 -0
- package/dist/components/display/timelineLogic.d.ts +20 -2
- package/dist/components/display/timelineLogic.js +10 -2
- package/dist/components/feedback/KapiAlert.d.ts +8 -4
- package/dist/components/feedback/KapiAlert.js +39 -34
- package/dist/components/feedback/KapiFab.js +108 -108
- package/dist/components/feedback/KapiProgress.js +63 -54
- package/dist/components/feedback/KapiToastContainer.js +9 -9
- package/dist/components/feedback/KapiTour.js +12 -12
- package/dist/components/feedback/progressLogic.d.ts +2 -1
- package/dist/components/feedback/progressLogic.js +9 -8
- package/dist/components/inputs/KapiAutocomplete.d.ts +6 -0
- package/dist/components/inputs/KapiAutocomplete.js +86 -85
- package/dist/components/inputs/KapiButton.d.ts +7 -4
- package/dist/components/inputs/KapiButton.js +47 -42
- package/dist/components/inputs/KapiChecklist.d.ts +7 -1
- package/dist/components/inputs/KapiChecklist.js +53 -52
- package/dist/components/inputs/KapiCopyButton.d.ts +40 -0
- package/dist/components/inputs/KapiCopyButton.js +35 -0
- package/dist/components/inputs/KapiDatePicker.d.ts +7 -1
- package/dist/components/inputs/KapiDatePicker.js +118 -116
- package/dist/components/inputs/KapiDateRangePicker.d.ts +7 -1
- package/dist/components/inputs/KapiDateRangePicker.js +136 -135
- package/dist/components/inputs/KapiFacetedSearch.js +5 -5
- package/dist/components/inputs/KapiField.d.ts +9 -1
- package/dist/components/inputs/KapiField.js +43 -42
- package/dist/components/inputs/KapiFileUpload.js +6 -6
- package/dist/components/inputs/KapiInput.d.ts +29 -1
- package/dist/components/inputs/KapiInput.js +74 -51
- package/dist/components/inputs/KapiMaskedInput.js +26 -26
- package/dist/components/inputs/KapiNumberStepper.d.ts +7 -1
- package/dist/components/inputs/KapiNumberStepper.js +24 -23
- package/dist/components/inputs/KapiPinInput.d.ts +72 -0
- package/dist/components/inputs/KapiPinInput.js +75 -0
- package/dist/components/inputs/KapiPropsForm.d.ts +34 -0
- package/dist/components/inputs/KapiPropsForm.js +78 -0
- package/dist/components/inputs/KapiRating.d.ts +7 -1
- package/dist/components/inputs/KapiRating.js +39 -38
- package/dist/components/inputs/KapiSearchChip.js +5 -5
- package/dist/components/inputs/KapiSegmented.d.ts +13 -5
- package/dist/components/inputs/KapiSegmented.js +81 -77
- package/dist/components/inputs/KapiSelect.d.ts +21 -1
- package/dist/components/inputs/KapiSelect.js +251 -245
- package/dist/components/inputs/KapiSelectMenu.d.ts +4 -2
- package/dist/components/inputs/KapiSelectMenu.js +131 -133
- package/dist/components/inputs/KapiSlider.d.ts +10 -3
- package/dist/components/inputs/KapiSlider.js +67 -63
- package/dist/components/inputs/KapiTagInput.d.ts +7 -1
- package/dist/components/inputs/KapiTagInput.js +70 -69
- package/dist/components/inputs/KapiTextarea.d.ts +7 -1
- package/dist/components/inputs/KapiTextarea.js +51 -50
- package/dist/components/inputs/copyLogic.d.ts +1 -0
- package/dist/components/inputs/copyLogic.js +12 -0
- package/dist/components/inputs/fieldLogic.d.ts +21 -1
- package/dist/components/inputs/fieldLogic.js +18 -11
- package/dist/components/inputs/index.d.ts +9 -1
- package/dist/components/inputs/inputLogic.d.ts +16 -1
- package/dist/components/inputs/inputLogic.js +3 -3
- package/dist/components/inputs/ownField.d.ts +3 -1
- package/dist/components/inputs/ownField.js +28 -27
- package/dist/components/inputs/pinInputLogic.d.ts +34 -0
- package/dist/components/inputs/pinInputLogic.js +37 -0
- package/dist/components/inputs/propsFormLogic.d.ts +53 -0
- package/dist/components/inputs/propsFormLogic.js +11 -0
- package/dist/components/inputs/segmentedLogic.d.ts +7 -0
- package/dist/components/inputs/segmentedLogic.js +2 -2
- package/dist/components/inputs/selectSlots.d.ts +24 -0
- package/dist/components/inputs/selectSlots.js +27 -0
- package/dist/components/layout/KapiAccessCard.d.ts +5 -1
- package/dist/components/layout/KapiAccessCard.js +43 -39
- package/dist/components/layout/KapiAccountMenu.js +7 -7
- 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/KapiCollapse.d.ts +39 -0
- package/dist/components/layout/KapiCollapse.js +20 -0
- package/dist/components/layout/KapiContextSlot.js +4 -4
- package/dist/components/layout/KapiDivider.d.ts +11 -2
- package/dist/components/layout/KapiDivider.js +30 -24
- package/dist/components/layout/KapiGrid.d.ts +29 -3
- package/dist/components/layout/KapiGrid.js +39 -17
- package/dist/components/layout/KapiNotificationBell.js +10 -10
- package/dist/components/layout/KapiPageHeader.d.ts +10 -1
- package/dist/components/layout/KapiPageHeader.js +94 -92
- 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 +125 -122
- package/dist/components/layout/KapiRoot.d.ts +55 -5
- package/dist/components/layout/KapiRoot.js +57 -38
- package/dist/components/layout/KapiShell.d.ts +44 -3
- package/dist/components/layout/KapiShell.js +54 -50
- package/dist/components/layout/accessCardLogic.d.ts +8 -1
- package/dist/components/layout/accessCardLogic.js +11 -7
- 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 +13 -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/locale/labelRegistry.d.ts +10 -0
- package/dist/components/navigation/KapiAccordion.js +9 -9
- 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 +152 -136
- package/dist/components/navigation/KapiNavBadge.d.ts +6 -3
- package/dist/components/navigation/KapiNavBadge.js +26 -22
- 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/KapiToc.d.ts +48 -0
- package/dist/components/navigation/KapiToc.js +66 -0
- package/dist/components/navigation/KapiTree.js +10 -10
- 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/index.d.ts +3 -0
- 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/navigation/tocLogic.d.ts +35 -0
- package/dist/components/navigation/tocLogic.js +11 -0
- package/dist/components/navigation/tocSlots.d.ts +8 -0
- package/dist/components/navigation/tocSlots.js +11 -0
- package/dist/components/overlays/KapiCommandPalette.js +6 -6
- package/dist/components/overlays/KapiContextMenu.d.ts +8 -0
- package/dist/components/overlays/KapiContextMenu.js +5 -5
- package/dist/components/overlays/KapiMenuButton.js +7 -7
- package/dist/components/overlays/KapiModal.d.ts +9 -0
- package/dist/components/overlays/KapiModal.js +79 -77
- package/dist/components/overlays/KapiOffcanvas.js +24 -24
- package/dist/components/overlays/KapiPhotoView.js +10 -10
- package/dist/components/overlays/KapiPopover.js +6 -6
- package/dist/components/overlays/KapiShapeSheet.js +4 -4
- package/dist/components/overlays/KapiTooltip.js +18 -18
- package/dist/components/overlays/index.d.ts +1 -1
- package/dist/components/overlays/menuList.js +127 -117
- package/dist/components/overlays/modalSlots.d.ts +11 -0
- package/dist/components/overlays/modalSlots.js +14 -0
- package/dist/components/slotCatalog.d.ts +123 -0
- package/dist/components/slotCatalog.js +27 -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/KapiAnnotation.css +1 -1
- package/dist/css/components/display/KapiCodeBlock.css +1 -0
- package/dist/css/components/display/KapiDiff.css +1 -0
- 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/inputs/KapiPinInput.css +1 -0
- package/dist/css/components/inputs/KapiSelect.css +1 -1
- package/dist/css/components/inputs/inputsExtra.css +1 -1
- package/dist/css/components/layout/KapiAccessCard.css +1 -1
- package/dist/css/components/layout/KapiBox.css +1 -0
- package/dist/css/components/layout/KapiCollapse.css +1 -0
- package/dist/css/components/layout/KapiDivider.css +1 -1
- package/dist/css/components/layout/KapiRail.css +1 -1
- package/dist/css/components/layout/gridSpan.css +1 -0
- package/dist/css/components/navigation/KapiToc.css +1 -0
- package/dist/css/components/navigation/navigation.css +1 -1
- package/dist/hooks/asyncResourceLogic.d.ts +11 -0
- package/dist/hooks/asyncResourceLogic.js +4 -0
- package/dist/hooks/densityLogic.d.ts +15 -0
- package/dist/hooks/densityLogic.js +4 -0
- package/dist/hooks/index.d.ts +7 -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 +146 -0
- package/dist/hooks/toneFamilyLogic.js +164 -0
- package/dist/hooks/useAsyncResource.d.ts +45 -0
- package/dist/hooks/useAsyncResource.js +24 -0
- package/dist/hooks/useKapiTheme.d.ts +16 -3
- package/dist/hooks/useKapiTheme.js +130 -117
- package/dist/hooks/useToneFamilies.d.ts +40 -0
- package/dist/hooks/useToneFamilies.js +50 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +227 -204
- package/dist/kapi.css +1 -1
- package/dist/kapi.layered.css +1 -1
- package/dist/logic.d.ts +41 -0
- package/dist/logic.js +42 -0
- package/dist/styles/rawHeights.d.ts +8 -0
- package/package.json +14 -3
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/chat/chat.css";
|
|
3
3
|
import { joinClasses as e } from "../rootProps.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { useLabels as t } from "../locale/KapiLocaleProvider.js";
|
|
5
|
+
import { assignRef as n } from "../inputs/fieldLogic.js";
|
|
6
6
|
import { prefersReducedMotion as r } from "../../hooks/reducedMotion.js";
|
|
7
7
|
import { isAtScrollEnd as i, shouldFollowBottom as a } from "./chatLogic.js";
|
|
8
8
|
/* empty css */
|
|
@@ -15,8 +15,8 @@ var p = {
|
|
|
15
15
|
unseen: "Mensajes nuevos",
|
|
16
16
|
toBottom: "Ir al final del hilo"
|
|
17
17
|
}, m = ({ children: m, unseen: h = 0, followKey: g, onAtBottomChange: _, labels: v, ref: y, className: b, ...x }) => {
|
|
18
|
-
let S =
|
|
19
|
-
C.current = e,
|
|
18
|
+
let S = t("chatThread", p, v), { ref: C, edges: w } = s({ axis: "y" }), T = u(null), E = !w.end, D = u(!0), O = u(!1), k = c((e) => {
|
|
19
|
+
C.current = e, n(y, e);
|
|
20
20
|
}, [C, y]), A = c((e) => {
|
|
21
21
|
let t = C.current;
|
|
22
22
|
if (!t) return;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/chat/chat.css";
|
|
3
3
|
import { joinClasses as e } from "../rootProps.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { useLabels as t } from "../locale/KapiLocaleProvider.js";
|
|
5
|
+
import { KapiIconButton as n } from "../inputs/KapiIconButton.js";
|
|
6
|
+
import { assignRef as r, joinIds as i } from "../inputs/fieldLogic.js";
|
|
7
|
+
import { useKapiField as a } from "../inputs/KapiField.js";
|
|
8
8
|
import { KapiTextarea as o } from "../inputs/KapiTextarea.js";
|
|
9
9
|
import { isSubmitShortcut as s } from "../display/commentLogic.js";
|
|
10
10
|
import { useSubmitDraft as c } from "../../hooks/useSubmitDraft.js";
|
|
@@ -19,7 +19,7 @@ var p = {
|
|
|
19
19
|
send: "Enviar",
|
|
20
20
|
shortcut: "Enter envía, Shift + Enter hace un salto de línea"
|
|
21
21
|
}, m = ({ value: m, defaultValue: h, onChange: g, onSubmit: _, submitOn: v = "enter", loading: y = !1, invalid: b, required: x, disabled: S, leading: C, trailing: w, maxRows: T = 6, rows: E = 1, className: D, style: O, labels: k, ref: A, placeholder: j, onKeyDown: M, "aria-label": N, "aria-labelledby": P, "aria-describedby": F, ...I }) => {
|
|
22
|
-
let L =
|
|
22
|
+
let L = t("composer", p, k), R = a(), z = l(), { text: B, setText: V, submit: H, busy: U, canSubmit: W, boxRef: G } = c({
|
|
23
23
|
value: m,
|
|
24
24
|
defaultValue: h,
|
|
25
25
|
onChange: g,
|
|
@@ -48,7 +48,7 @@ var p = {
|
|
|
48
48
|
/* @__PURE__ */ u(o, {
|
|
49
49
|
...I,
|
|
50
50
|
ref: (e) => {
|
|
51
|
-
G.current = e,
|
|
51
|
+
G.current = e, r(A, e);
|
|
52
52
|
},
|
|
53
53
|
className: "kapi-chatcomposer__input",
|
|
54
54
|
autosize: !0,
|
|
@@ -59,7 +59,7 @@ var p = {
|
|
|
59
59
|
placeholder: j ?? L.placeholder,
|
|
60
60
|
"aria-label": q ? N : L.label,
|
|
61
61
|
"aria-labelledby": P,
|
|
62
|
-
"aria-describedby":
|
|
62
|
+
"aria-describedby": i(F, z),
|
|
63
63
|
...x === void 0 ? {} : { required: x },
|
|
64
64
|
...b ? { invalid: !0 } : {},
|
|
65
65
|
onChange: (e) => V(e.target.value),
|
|
@@ -75,7 +75,7 @@ var p = {
|
|
|
75
75
|
children: w
|
|
76
76
|
})
|
|
77
77
|
]
|
|
78
|
-
}), /* @__PURE__ */ u(
|
|
78
|
+
}), /* @__PURE__ */ u(n, {
|
|
79
79
|
className: "kapi-chatcomposer__send",
|
|
80
80
|
icon: /* @__PURE__ */ u(f, {
|
|
81
81
|
size: 18,
|
|
@@ -19,7 +19,7 @@ export type KapiDataTableProps<T, K extends KapiTableKeyField<T> = KapiTableKeyF
|
|
|
19
19
|
fill?: boolean | undefined;
|
|
20
20
|
/** Envuelve la tabla en una card. */
|
|
21
21
|
card?: boolean | undefined;
|
|
22
|
-
/** `card`: filas blandas y espaciadas, look de listado. Sólo visual. */
|
|
22
|
+
/** `card`: filas blandas y espaciadas, look de listado. Sólo visual. No es la densidad del sistema (`density` de `KapiRoot`/`KapiShell`): se combinan. */
|
|
23
23
|
density?: "default" | "card" | undefined;
|
|
24
24
|
/** Resalta la fila al pasar el mouse. */
|
|
25
25
|
rowHover?: boolean | undefined;
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import "#kapi-css/components/data/KapiTable.css";
|
|
3
3
|
import { joinClasses as e } from "../rootProps.js";
|
|
4
4
|
import { useKapiLocale as t, useLabels as n } from "../locale/KapiLocaleProvider.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { KapiSkeleton as
|
|
5
|
+
import { winOf as r } from "../../hooks/ownerDocument.js";
|
|
6
|
+
import { useControllableState as i } from "../../hooks/useControllableState.js";
|
|
7
|
+
import { columnAlign as ee, computeStickyOffsets as te, computeStickyRightOffsets as ne, effectiveColumnWidth as re, firstRightStickyIndex as ie, lastStickyIndex as ae, nextSortState as oe, sortRowsByColumn as a, stickySideOf as o, tableWrapClass as s } from "./tableLogic.js";
|
|
8
|
+
import { KapiSkeleton as c } from "../feedback/KapiSkeleton.js";
|
|
9
9
|
/* empty css */
|
|
10
|
-
import { DEFAULT_TABLE_LABELS as
|
|
11
|
-
import { actColClass as
|
|
10
|
+
import { DEFAULT_TABLE_LABELS as l } from "./tableLabels.js";
|
|
11
|
+
import { actColClass as u, ariaSortOf as d, bodyCell as f, cellClass as p, columnBoxStyle as m, headerContent as se, skeletonBar as ce, stateRow as h, stickyInset as g } from "./tableCells.js";
|
|
12
12
|
import { useRowKeyWarning as le } from "./useRowKeyWarning.js";
|
|
13
13
|
import { useTableEdges as ue } from "./useTableEdges.js";
|
|
14
14
|
import { isRowActivationKey as de, mergeRowProps as fe, shouldFireRowClick as pe } from "./rowClickLogic.js";
|
|
@@ -17,15 +17,15 @@ import { jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
|
17
17
|
//#region src/components/data/KapiDataTable.tsx
|
|
18
18
|
var x = {};
|
|
19
19
|
function S({ columns: S, rows: C, keyField: w = "id", ref: T, maxHeight: E = "58vh", fill: D = !1, card: O = !1, density: k = "default", rowHover: A = !1, mobileCards: j = !1, labels: M, sort: N, defaultSort: P = null, onSortChange: F, manualSort: I = !1, loading: L = !1, loadingRows: R = 5, loadingMessage: z, emptyMessage: B, onCopy: ge, actions: V, onRowClick: H, getRowProps: _e, className: ve, style: ye, id: be }) {
|
|
20
|
-
let U = n("table",
|
|
20
|
+
let U = n("table", l, M);
|
|
21
21
|
le("KapiDataTable", C, w);
|
|
22
|
-
let W = t(), [G, xe] =
|
|
22
|
+
let W = t(), [G, xe] = i(N, P, F), Se = (e) => xe(oe(G, e)), K = _(() => I ? C : a(C, S, G, W), [
|
|
23
23
|
I,
|
|
24
24
|
C,
|
|
25
25
|
S,
|
|
26
26
|
G,
|
|
27
27
|
W
|
|
28
|
-
]), q = !!V, J = S.some((e) =>
|
|
28
|
+
]), q = !!V, J = S.some((e) => o(e.sticky) === "right"), Y = v(null), [X, Ce] = he(0);
|
|
29
29
|
me(() => {
|
|
30
30
|
let e = Y.current;
|
|
31
31
|
if (!e || !J) return;
|
|
@@ -40,13 +40,13 @@ function S({ columns: S, rows: C, keyField: w = "id", ref: T, maxHeight: E = "58
|
|
|
40
40
|
let Z = _(() => {
|
|
41
41
|
let e = S.map((e) => ({
|
|
42
42
|
sticky: e.sticky,
|
|
43
|
-
width:
|
|
43
|
+
width: re(e, x)
|
|
44
44
|
}));
|
|
45
45
|
return {
|
|
46
|
-
lefts:
|
|
47
|
-
rights:
|
|
48
|
-
lastLeft:
|
|
49
|
-
firstRight:
|
|
46
|
+
lefts: te(e, 0),
|
|
47
|
+
rights: ne(e, q ? X : 0),
|
|
48
|
+
lastLeft: ae(S),
|
|
49
|
+
firstRight: ie(S)
|
|
50
50
|
};
|
|
51
51
|
}, [
|
|
52
52
|
S,
|
|
@@ -56,7 +56,7 @@ function S({ columns: S, rows: C, keyField: w = "id", ref: T, maxHeight: E = "58
|
|
|
56
56
|
className: "is-clickable",
|
|
57
57
|
tabIndex: 0,
|
|
58
58
|
onClick: (t) => {
|
|
59
|
-
pe(t.target, t.currentTarget,
|
|
59
|
+
pe(t.target, t.currentTarget, r(t.currentTarget)?.getSelection() ?? null) && H(e, t);
|
|
60
60
|
},
|
|
61
61
|
onKeyDown: (t) => {
|
|
62
62
|
let n = {
|
|
@@ -74,15 +74,15 @@ function S({ columns: S, rows: C, keyField: w = "id", ref: T, maxHeight: E = "58
|
|
|
74
74
|
"aria-hidden": !0,
|
|
75
75
|
children: [S.map((e, n) => /* @__PURE__ */ y("td", {
|
|
76
76
|
"data-col": e.key,
|
|
77
|
-
className:
|
|
77
|
+
className: p(e, n, Z),
|
|
78
78
|
style: {
|
|
79
79
|
...g(n, Z),
|
|
80
80
|
...m(e, "td", x)
|
|
81
81
|
},
|
|
82
82
|
children: ce(e, n, t)
|
|
83
83
|
}, e.key)), q && /* @__PURE__ */ y("td", {
|
|
84
|
-
className:
|
|
85
|
-
children: /* @__PURE__ */ y(
|
|
84
|
+
className: u(Z),
|
|
85
|
+
children: /* @__PURE__ */ y(c, {
|
|
86
86
|
width: 28,
|
|
87
87
|
height: 14,
|
|
88
88
|
radius: 6,
|
|
@@ -97,7 +97,7 @@ function S({ columns: S, rows: C, keyField: w = "id", ref: T, maxHeight: E = "58
|
|
|
97
97
|
className: e("kapi-table-shell", O && "kapi-table-shell--card", D && "kapi-table-shell--fill", j && "kapi-table-shell--cards", ve),
|
|
98
98
|
children: /* @__PURE__ */ y("div", {
|
|
99
99
|
ref: Q,
|
|
100
|
-
className:
|
|
100
|
+
className: s({
|
|
101
101
|
cortaDerecha: we,
|
|
102
102
|
cortaIzquierda: Te,
|
|
103
103
|
rightEdge: q || J
|
|
@@ -109,25 +109,25 @@ function S({ columns: S, rows: C, keyField: w = "id", ref: T, maxHeight: E = "58
|
|
|
109
109
|
className: e("kapi-table2", k === "card" && "kapi-table2--card", A && "kapi-table2--hover"),
|
|
110
110
|
children: [/* @__PURE__ */ y("thead", { children: /* @__PURE__ */ b("tr", { children: [S.map((t, n) => /* @__PURE__ */ y("th", {
|
|
111
111
|
"data-col": t.key,
|
|
112
|
-
className: e(
|
|
113
|
-
"aria-sort":
|
|
112
|
+
className: e(p(t, n, Z), t.sortable && "is-sortable"),
|
|
113
|
+
"aria-sort": d(t, G),
|
|
114
114
|
style: {
|
|
115
115
|
...g(n, Z),
|
|
116
116
|
...m(t, "th", x),
|
|
117
|
-
textAlign:
|
|
117
|
+
textAlign: ee(t.align)
|
|
118
118
|
},
|
|
119
119
|
children: se(t, G, Se, U)
|
|
120
120
|
}, t.key)), q && /* @__PURE__ */ y("th", {
|
|
121
121
|
ref: Y,
|
|
122
|
-
className:
|
|
122
|
+
className: u(Z),
|
|
123
123
|
children: U.actions
|
|
124
124
|
})] }) }), /* @__PURE__ */ b("tbody", { children: [
|
|
125
125
|
L && (R > 0 ? Ae : h($, Oe, !0)),
|
|
126
126
|
!L && K.length === 0 && h($, De),
|
|
127
127
|
!L && K.map((e, t) => /* @__PURE__ */ b("tr", {
|
|
128
128
|
...fe(_e?.(e, t), ke(e)),
|
|
129
|
-
children: [S.map((t, n) =>
|
|
130
|
-
className:
|
|
129
|
+
children: [S.map((t, n) => f(t, n, e, Z, x, U, ge)), q && /* @__PURE__ */ y("td", {
|
|
130
|
+
className: u(Z),
|
|
131
131
|
children: /* @__PURE__ */ y("div", {
|
|
132
132
|
className: "kapi-actcol__in",
|
|
133
133
|
children: V?.(e)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/data/KapiTable.css";
|
|
3
|
-
import {
|
|
3
|
+
import { mergeClasses as e } from "../slotsLogic.js";
|
|
4
4
|
import { KapiSelect as t } from "../inputs/KapiSelect.js";
|
|
5
5
|
/* empty css */
|
|
6
6
|
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { type CSSProperties, type HTMLAttributes, type ReactNode, type Ref, type TdHTMLAttributes, type ThHTMLAttributes } from "react";
|
|
2
|
+
import { type KapiRootProps } from "../rootProps.js";
|
|
3
|
+
/** Alineación del contenido: `start`/`end` siguen la dirección del texto; `left`/`right` son alias. */
|
|
4
|
+
type SheetAlign = "start" | "center" | "end" | "left" | "right";
|
|
5
|
+
export type KapiSheetProps = KapiRootProps<HTMLDivElement> & Omit<HTMLAttributes<HTMLTableElement>, "className" | "style" | "id" | "children"> & {
|
|
6
|
+
/** Filas de la tabla: `KapiSheetHead`, `KapiSheetBody` y `KapiSheetFoot`. */
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Nombre de la tabla para lectores de pantalla (`<caption>`). Es sólo para ellos: se recorta con la
|
|
10
|
+
* primitiva `.kapi-sr-only` en vez de ocultarse, así sigue en el árbol de accesibilidad. El título
|
|
11
|
+
* visible, si lo hay, va fuera de la tabla.
|
|
12
|
+
*/
|
|
13
|
+
caption?: ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Alto máximo del área con scroll. Con él, el encabezado (`KapiSheetHead`) y el pie
|
|
16
|
+
* (`KapiSheetFoot`) quedan fijos arriba y abajo mientras las filas scrollean. Sin él la tabla
|
|
17
|
+
* crece con su contenido y no hay nada que fijar.
|
|
18
|
+
*/
|
|
19
|
+
maxHeight?: CSSProperties["maxHeight"];
|
|
20
|
+
/** `card`: filas blandas y espaciadas, look de listado. Sólo visual. No es la densidad del sistema (`density` de `KapiRoot`/`KapiShell`): se combinan. */
|
|
21
|
+
density?: "default" | "card" | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Cebra: las filas pares con fondo suave, como en `KapiTable`. Con `false` todas llevan el fondo de
|
|
24
|
+
* la tarjeta, que es lo que corresponde en un informe con celdas combinadas (`rowSpan`), donde la
|
|
25
|
+
* cebra deja de coincidir con lo que se lee como una fila.
|
|
26
|
+
* @default true
|
|
27
|
+
*/
|
|
28
|
+
striped?: boolean | undefined;
|
|
29
|
+
/** Resalta la fila al pasar el mouse (fondo tenue). Opt-in: apagado por defecto. */
|
|
30
|
+
rowHover?: boolean | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* La tabla es de MAQUETACIÓN, no de datos: le saca el `role` de tabla (`presentation`) para que un
|
|
33
|
+
* lector de pantalla no anuncie «tabla, 2 filas» ni intente relacionar celdas con encabezados.
|
|
34
|
+
* Una tabla de datos —la que tiene encabezados que describen sus columnas o filas— NO lleva esto.
|
|
35
|
+
*/
|
|
36
|
+
layout?: boolean | undefined;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Tabla semántica de marcado propio: `<KapiSheet>` envuelve a `KapiSheetHead`, `KapiSheetBody` y
|
|
40
|
+
* `KapiSheetFoot`, y éstos a `KapiSheetRow`, `KapiSheetHeaderCell` y `KapiSheetCell`. Dibuja `<table>`,
|
|
41
|
+
* `<thead>`, `<tr>`, `<th>` y `<td>` reales con `colSpan` y `rowSpan` nativos.
|
|
42
|
+
*
|
|
43
|
+
* `className`, `style`, `id` y `ref` van al contenedor con scroll (la superficie visible); `aria-*`,
|
|
44
|
+
* `data-*` y el resto de atributos, a la `<table>`.
|
|
45
|
+
*
|
|
46
|
+
* No ordena, no selecciona, no filtra, no pagina ni virtualiza: para eso, `KapiTable` (con `footer` y
|
|
47
|
+
* `colSpan` por columna si el informe sí tiene columnas).
|
|
48
|
+
*/
|
|
49
|
+
export declare const KapiSheet: ({ children, caption, maxHeight, density, striped, rowHover, layout, className, style, id, ref, ...rest }: KapiSheetProps) => import("react").JSX.Element;
|
|
50
|
+
export type KapiSheetHeadProps = HTMLAttributes<HTMLTableSectionElement> & {
|
|
51
|
+
/** Ref a la `<thead>`. */
|
|
52
|
+
ref?: Ref<HTMLTableSectionElement> | undefined;
|
|
53
|
+
};
|
|
54
|
+
/** Encabezado de la tabla (`<thead>`): queda fijo arriba cuando `KapiSheet` tiene `maxHeight`. */
|
|
55
|
+
export declare const KapiSheetHead: ({ ref, ...rest }: KapiSheetHeadProps) => import("react").JSX.Element;
|
|
56
|
+
export type KapiSheetBodyProps = HTMLAttributes<HTMLTableSectionElement> & {
|
|
57
|
+
/** Ref a la `<tbody>`. */
|
|
58
|
+
ref?: Ref<HTMLTableSectionElement> | undefined;
|
|
59
|
+
};
|
|
60
|
+
/** Cuerpo de la tabla (`<tbody>`). */
|
|
61
|
+
export declare const KapiSheetBody: ({ ref, ...rest }: KapiSheetBodyProps) => import("react").JSX.Element;
|
|
62
|
+
export type KapiSheetFootProps = HTMLAttributes<HTMLTableSectionElement> & {
|
|
63
|
+
/** Ref a la `<tfoot>`. */
|
|
64
|
+
ref?: Ref<HTMLTableSectionElement> | undefined;
|
|
65
|
+
};
|
|
66
|
+
/** Pie de la tabla (`<tfoot>`, totales): queda fijo abajo cuando `KapiSheet` tiene `maxHeight`. */
|
|
67
|
+
export declare const KapiSheetFoot: ({ ref, ...rest }: KapiSheetFootProps) => import("react").JSX.Element;
|
|
68
|
+
export type KapiSheetRowProps = HTMLAttributes<HTMLTableRowElement> & {
|
|
69
|
+
/** Ref a la `<tr>`. */
|
|
70
|
+
ref?: Ref<HTMLTableRowElement> | undefined;
|
|
71
|
+
/** Marca la fila como seleccionada o resaltada (el mismo fondo que una fila seleccionada de `KapiTable`). */
|
|
72
|
+
selected?: boolean | undefined;
|
|
73
|
+
};
|
|
74
|
+
/** Fila de la tabla (`<tr>`). */
|
|
75
|
+
export declare const KapiSheetRow: ({ selected, className, ref, ...rest }: KapiSheetRowProps) => import("react").JSX.Element;
|
|
76
|
+
export type KapiSheetCellProps = Omit<TdHTMLAttributes<HTMLTableCellElement>, "align"> & {
|
|
77
|
+
/** Ref a la `<td>`. */
|
|
78
|
+
ref?: Ref<HTMLTableCellElement> | undefined;
|
|
79
|
+
/** Alineación del contenido. Sin ella, la de la tabla (al inicio). */
|
|
80
|
+
align?: SheetAlign | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* Deja que el texto parta en varias líneas. Por defecto una celda no parte (como en `KapiTable`), que
|
|
83
|
+
* es lo que se quiere para cifras y códigos y no para una descripción.
|
|
84
|
+
*/
|
|
85
|
+
wrap?: boolean | undefined;
|
|
86
|
+
};
|
|
87
|
+
/** Celda de datos (`<td>`). `colSpan` y `rowSpan` son los nativos. */
|
|
88
|
+
export declare const KapiSheetCell: ({ align, wrap, className, style, ref, ...rest }: KapiSheetCellProps) => import("react").JSX.Element;
|
|
89
|
+
export type KapiSheetHeaderCellProps = Omit<ThHTMLAttributes<HTMLTableCellElement>, "align"> & {
|
|
90
|
+
/** Ref a la `<th>`. */
|
|
91
|
+
ref?: Ref<HTMLTableCellElement> | undefined;
|
|
92
|
+
/** Alineación del contenido. Sin ella, la de la tabla (al inicio). */
|
|
93
|
+
align?: SheetAlign | undefined;
|
|
94
|
+
/** Deja que el texto parta en varias líneas (por defecto no parte). */
|
|
95
|
+
wrap?: boolean | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* A qué describe el encabezado. Por defecto sale de DONDE está: `col` dentro de `KapiSheetHead`,
|
|
98
|
+
* `row` en el cuerpo o el pie (la etiqueta de una fila, «Total activo»). Se puede pisar con
|
|
99
|
+
* `colgroup` o `rowgroup` para un encabezado que agrupa varias columnas o filas.
|
|
100
|
+
*/
|
|
101
|
+
scope?: ThHTMLAttributes<HTMLTableCellElement>["scope"];
|
|
102
|
+
};
|
|
103
|
+
/** Celda de encabezado (`<th>`) de una columna o de una fila. */
|
|
104
|
+
export declare const KapiSheetHeaderCell: ({ align, wrap, scope, className, style, ref, ...rest }: KapiSheetHeaderCellProps) => import("react").JSX.Element;
|
|
105
|
+
export {};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "#kapi-css/components/inputs/checkControl.css";
|
|
3
|
+
import "#kapi-css/components/overlays/overlays.css";
|
|
4
|
+
import "#kapi-css/components/data/KapiTable.css";
|
|
5
|
+
import { joinClasses as e } from "../rootProps.js";
|
|
6
|
+
/* empty css */
|
|
7
|
+
/* empty css */
|
|
8
|
+
import { columnAlign as t } from "./tableLogic.js";
|
|
9
|
+
/* empty css */
|
|
10
|
+
import { createContext as n, useContext as r } from "react";
|
|
11
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
12
|
+
//#region src/components/data/KapiSheet.tsx
|
|
13
|
+
var o = n("body"), s = (e, n) => {
|
|
14
|
+
let r = t(e);
|
|
15
|
+
return r === void 0 ? n : {
|
|
16
|
+
textAlign: r,
|
|
17
|
+
...n
|
|
18
|
+
};
|
|
19
|
+
}, c = ({ children: t, caption: n, maxHeight: r, density: o = "default", striped: s = !0, rowHover: c = !1, layout: l = !1, className: u, style: d, id: f, ref: p, ...m }) => /* @__PURE__ */ i("div", {
|
|
20
|
+
ref: p,
|
|
21
|
+
id: f,
|
|
22
|
+
className: e("kapi-tablewrap", u),
|
|
23
|
+
style: r === void 0 ? d : {
|
|
24
|
+
maxHeight: r,
|
|
25
|
+
...d
|
|
26
|
+
},
|
|
27
|
+
tabIndex: 0,
|
|
28
|
+
children: /* @__PURE__ */ a("table", {
|
|
29
|
+
...m,
|
|
30
|
+
...l && { role: "presentation" },
|
|
31
|
+
className: e("kapi-table2", o === "card" && "kapi-table2--card", !s && "kapi-table2--plain", c && "kapi-table2--hover"),
|
|
32
|
+
children: [n != null && /* @__PURE__ */ i("caption", {
|
|
33
|
+
className: "kapi-sr-only",
|
|
34
|
+
children: n
|
|
35
|
+
}), t]
|
|
36
|
+
})
|
|
37
|
+
}), l = ({ ref: e, ...t }) => /* @__PURE__ */ i(o.Provider, {
|
|
38
|
+
value: "head",
|
|
39
|
+
children: /* @__PURE__ */ i("thead", {
|
|
40
|
+
ref: e,
|
|
41
|
+
...t
|
|
42
|
+
})
|
|
43
|
+
}), u = ({ ref: e, ...t }) => /* @__PURE__ */ i(o.Provider, {
|
|
44
|
+
value: "body",
|
|
45
|
+
children: /* @__PURE__ */ i("tbody", {
|
|
46
|
+
ref: e,
|
|
47
|
+
...t
|
|
48
|
+
})
|
|
49
|
+
}), d = ({ ref: e, ...t }) => /* @__PURE__ */ i(o.Provider, {
|
|
50
|
+
value: "foot",
|
|
51
|
+
children: /* @__PURE__ */ i("tfoot", {
|
|
52
|
+
ref: e,
|
|
53
|
+
...t
|
|
54
|
+
})
|
|
55
|
+
}), f = ({ selected: t = !1, className: n, ref: r, ...a }) => /* @__PURE__ */ i("tr", {
|
|
56
|
+
ref: r,
|
|
57
|
+
...a,
|
|
58
|
+
className: e(t && "is-selected", n)
|
|
59
|
+
}), p = ({ align: t, wrap: n = !1, className: r, style: a, ref: o, ...c }) => /* @__PURE__ */ i("td", {
|
|
60
|
+
ref: o,
|
|
61
|
+
...c,
|
|
62
|
+
className: e(n && "is-flex", r),
|
|
63
|
+
style: s(t, a)
|
|
64
|
+
}), m = ({ align: t, wrap: n = !1, scope: a, className: c, style: l, ref: u, ...d }) => {
|
|
65
|
+
let f = r(o);
|
|
66
|
+
return /* @__PURE__ */ i("th", {
|
|
67
|
+
ref: u,
|
|
68
|
+
...d,
|
|
69
|
+
scope: a ?? (f === "head" ? "col" : "row"),
|
|
70
|
+
className: e(n && "is-flex", c),
|
|
71
|
+
style: s(t, l)
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
//#endregion
|
|
75
|
+
export { c as KapiSheet, u as KapiSheetBody, p as KapiSheetCell, d as KapiSheetFoot, l as KapiSheetHead, m as KapiSheetHeaderCell, f as KapiSheetRow };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type HTMLAttributes, type Ref } from "react";
|
|
2
|
+
import { type KapiFamilyTone } from "../tone.js";
|
|
2
3
|
import type { KapiLabelsOverride } from "../labelsLogic.js";
|
|
3
4
|
import { type KapiSparklineLabelParts } from "./sparklineLogic.js";
|
|
4
5
|
/** Textos del sparkline: sólo su nombre accesible. */
|
|
@@ -16,7 +17,7 @@ export type KapiSparklineProps = Omit<HTMLAttributes<HTMLSpanElement>, "children
|
|
|
16
17
|
* Usa un color de estado en vez de la paleta. Es para cuando la línea **significa** algo —una
|
|
17
18
|
* métrica que empeoró—, no para distinguirla de otra: para eso está `slot`.
|
|
18
19
|
*/
|
|
19
|
-
tone?: "success" | "warning" | "danger" | "info" | undefined;
|
|
20
|
+
tone?: "success" | "warning" | "danger" | "info" | KapiFamilyTone | undefined;
|
|
20
21
|
/** Rellena el área bajo la línea. @default false */
|
|
21
22
|
area?: boolean | undefined;
|
|
22
23
|
/** Marca el último punto, que es donde se lee «dónde quedó». @default true */
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/data/KapiSparkline.css";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { useToneLook as e } from "../../hooks/useToneFamilies.js";
|
|
4
|
+
import { isFamilyTone as t } from "../tone.js";
|
|
5
|
+
import { useLabels as n } from "../locale/KapiLocaleProvider.js";
|
|
6
|
+
import { formatDataValue as r } from "../../hooks/numberFormatLogic.js";
|
|
7
|
+
import { chartVars as i } from "./chartFrame.js";
|
|
8
|
+
import { areaPath as a, linePath as o, linePoints as s } from "./lineChartLogic.js";
|
|
9
|
+
import { sparklineLabel as c, sparklineMax as l } from "./sparklineLogic.js";
|
|
8
10
|
/* empty css */
|
|
9
11
|
import "react";
|
|
10
|
-
import { jsx as
|
|
12
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
11
13
|
//#region src/components/data/KapiSparkline.tsx
|
|
12
|
-
var
|
|
14
|
+
var f = {
|
|
13
15
|
trend: "Tendencia",
|
|
14
16
|
up: "sube",
|
|
15
17
|
down: "baja",
|
|
@@ -17,40 +19,41 @@ var u = {
|
|
|
17
19
|
from: "de",
|
|
18
20
|
to: "a"
|
|
19
21
|
};
|
|
20
|
-
function
|
|
21
|
-
let
|
|
22
|
-
return /* @__PURE__ */
|
|
23
|
-
...
|
|
24
|
-
ref:
|
|
25
|
-
className: ["kapi-sparkline",
|
|
22
|
+
function p({ values: p, slot: m = 1, tone: h, area: g = !1, last: _ = !0, labels: v, className: y, ref: b, ...x }) {
|
|
23
|
+
let S = n("sparkline", f, v), C = l(p), w = s(p, C), T = w[w.length - 1], E = i({ slot: Math.max(1, Math.floor(m)) - 1 }), D = e("KapiSparkline", h), O = t(h) ? "var(--kapi-tone)" : h ? `var(--kapi-${h})` : E["--kapi-chart-slot"];
|
|
24
|
+
return /* @__PURE__ */ d("span", {
|
|
25
|
+
...x,
|
|
26
|
+
ref: b,
|
|
27
|
+
className: ["kapi-sparkline", y].filter(Boolean).join(" "),
|
|
26
28
|
role: "img",
|
|
27
|
-
"aria-label":
|
|
29
|
+
"aria-label": x["aria-label"] ?? c(p, S, r),
|
|
28
30
|
style: {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
...D.style,
|
|
32
|
+
"--kapi-chart-slot": O,
|
|
33
|
+
...x.style
|
|
31
34
|
},
|
|
32
|
-
children: [/* @__PURE__ */
|
|
35
|
+
children: [/* @__PURE__ */ d("svg", {
|
|
33
36
|
className: "kapi-sparkline__svg",
|
|
34
37
|
viewBox: "0 0 100 100",
|
|
35
38
|
preserveAspectRatio: "none",
|
|
36
39
|
"aria-hidden": "true",
|
|
37
40
|
focusable: "false",
|
|
38
|
-
children: [
|
|
41
|
+
children: [g ? /* @__PURE__ */ u("path", {
|
|
39
42
|
className: "kapi-sparkline__area",
|
|
40
|
-
d:
|
|
41
|
-
}) : null, /* @__PURE__ */
|
|
43
|
+
d: a(w)
|
|
44
|
+
}) : null, /* @__PURE__ */ u("path", {
|
|
42
45
|
className: "kapi-sparkline__line",
|
|
43
|
-
d:
|
|
46
|
+
d: o(w),
|
|
44
47
|
vectorEffect: "non-scaling-stroke"
|
|
45
48
|
})]
|
|
46
|
-
}),
|
|
49
|
+
}), _ && T ? /* @__PURE__ */ u("span", {
|
|
47
50
|
className: "kapi-sparkline__last",
|
|
48
|
-
style:
|
|
49
|
-
x:
|
|
50
|
-
y:
|
|
51
|
+
style: i({
|
|
52
|
+
x: T.x,
|
|
53
|
+
y: T.y
|
|
51
54
|
})
|
|
52
55
|
}) : null]
|
|
53
56
|
});
|
|
54
57
|
}
|
|
55
58
|
//#endregion
|
|
56
|
-
export {
|
|
59
|
+
export { f as DEFAULT_SPARKLINE_LABELS, p as KapiSparkline };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { KapiTableKeyField, KapiTableProps } from "./tableTypes.js";
|
|
2
2
|
export { DEFAULT_TABLE_LABELS } from "./tableLabels.js";
|
|
3
|
-
export type { KapiTableCellValue, KapiTableColumn, KapiTableContext, KapiTableActionHandler, KapiTableActionItem, KapiTableAction, KapiTableCsvOptions, KapiTableSelectionPreset, KapiTableDataset, KapiTablePagination, KapiTableClientPagination, KapiTableKey, KapiTableKeyField, KapiTableProps, KapiTableRowHooks } from "./tableTypes.js";
|
|
3
|
+
export type { KapiTableCellValue, KapiTableClassNames, KapiTableColumn, KapiTableContext, KapiTableActionHandler, KapiTableActionItem, KapiTableAction, KapiTableCsvOptions, KapiTableSelectionPreset, KapiTableDataset, KapiTableFooterCell, KapiTableFooterRow, KapiTablePagination, KapiTableClientPagination, KapiTableKey, KapiTableKeyField, KapiTableProps, KapiTableRowHooks } from "./tableTypes.js";
|
|
4
4
|
export type { KapiTableRowAttributes } from "./rowClickLogic.js";
|
|
5
5
|
export type { KapiTableLabels } from "./tableLabels.js";
|
|
6
6
|
export type { KapiTableSortDirection, KapiTableSortState, KapiTableSortValue, KapiTableFilterState } from "./tableLogic.js";
|
|
@@ -9,4 +9,4 @@ export type { KapiTableSortDirection, KapiTableSortState, KapiTableSortValue, Ka
|
|
|
9
9
|
* por header, columna de acciones fija, copiar por celda, virtualización de altura fija,
|
|
10
10
|
* drag-scroll con click derecho y menú contextual con doble click derecho.
|
|
11
11
|
*/
|
|
12
|
-
export declare function KapiTable<T, K extends KapiTableKeyField<T> = KapiTableKeyField<T>>({ columns: columnsProp, rows, keyField, maxHeight, fill, bulkActionsPlacement, className, style, id, ref: shellRef, labels, actions, rowMenu, contextMenu, onCopy, selectable, rowSelect, rowLabel, selectedIds, defaultSelectedIds, onSelectedIdsChange, bulkActions, rangeSelect, selectionPresets, virtual, rowHeight, estimatedRowHeight, sort, defaultSort, onSortChange, manualSort, pagination, dataset, loading, loadingRows, card, emptyMessage, loadingMessage, isRowSelectable, renderSubComponent, expandedIds, defaultExpandedIds, onExpandedIdsChange, density, rowHover, columnToggle, columnVisibility, defaultColumnVisibility, onColumnVisibilityChange, columnPinning, pinnedColumns, defaultPinnedColumns, onPinnedColumnsChange, headerMenu, resizableColumns, columnWidths, defaultColumnWidths, onColumnWidthsChange, filterable, filter, defaultFilter, onFilterChange, manualFilter, filterDebounce, exportCsv, toolbar, toolbarActions, onRefresh, mobileCards, onRowClick, getRowProps }: KapiTableProps<T, K>): import("react").JSX.Element;
|
|
12
|
+
export declare function KapiTable<T, K extends KapiTableKeyField<T> = KapiTableKeyField<T>>({ columns: columnsProp, rows, keyField, maxHeight, fill, footer, bulkActionsPlacement, className, classNames, style, id, ref: shellRef, labels, actions, rowMenu, contextMenu, onCopy, selectable, rowSelect, rowLabel, selectedIds, defaultSelectedIds, onSelectedIdsChange, bulkActions, rangeSelect, selectionPresets, virtual, rowHeight, estimatedRowHeight, sort, defaultSort, onSortChange, manualSort, pagination, dataset, loading, loadingRows, card, emptyMessage, loadingMessage, isRowSelectable, renderSubComponent, expandedIds, defaultExpandedIds, onExpandedIdsChange, density, rowHover, columnToggle, columnVisibility, defaultColumnVisibility, onColumnVisibilityChange, columnPinning, pinnedColumns, defaultPinnedColumns, onPinnedColumnsChange, headerMenu, resizableColumns, columnWidths, defaultColumnWidths, onColumnWidthsChange, filterable, filter, defaultFilter, onFilterChange, manualFilter, filterDebounce, exportCsv, toolbar, toolbarActions, onRefresh, mobileCards, onRowClick, getRowProps }: KapiTableProps<T, K>): import("react").JSX.Element;
|