@kapiuara/ui 0.16.0 → 0.18.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/README.md +430 -20
- package/dist/components/chat/KapiChatThread.js +4 -4
- package/dist/components/chat/KapiComposer.js +8 -8
- package/dist/components/data/KapiDataTable.js +4 -4
- package/dist/components/data/KapiScatterChart.d.ts +56 -0
- package/dist/components/data/KapiScatterChart.js +90 -0
- package/dist/components/data/KapiSparkline.d.ts +2 -1
- package/dist/components/data/KapiSparkline.js +29 -26
- package/dist/components/data/KapiTableFilter.js +6 -6
- package/dist/components/data/chartFrame.d.ts +20 -2
- package/dist/components/data/chartFrame.js +33 -24
- package/dist/components/data/index.d.ts +4 -0
- package/dist/components/data/scatterLogic.d.ts +56 -0
- package/dist/components/data/scatterLogic.js +43 -0
- package/dist/components/data/tableCells.d.ts +12 -1
- package/dist/components/data/tableCells.js +49 -51
- package/dist/components/data/useTableSelection.js +3 -3
- 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/KapiAvatarGroup.d.ts +14 -2
- package/dist/components/display/KapiAvatarGroup.js +25 -23
- 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/KapiTimeline.d.ts +19 -2
- package/dist/components/display/KapiTimeline.js +38 -23
- package/dist/components/display/annotationLogic.d.ts +2 -1
- package/dist/components/display/annotationLogic.js +7 -6
- package/dist/components/display/avatarGroupSlots.d.ts +6 -0
- package/dist/components/display/avatarGroupSlots.js +9 -0
- 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 +9 -1
- 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/timelineLogic.d.ts +20 -2
- package/dist/components/display/timelineLogic.js +10 -2
- package/dist/components/feedback/KapiAlert.d.ts +6 -1
- package/dist/components/feedback/KapiAlert.js +45 -44
- package/dist/components/feedback/KapiCountdown.d.ts +12 -1
- package/dist/components/feedback/KapiCountdown.js +34 -31
- package/dist/components/feedback/KapiEmpty.d.ts +6 -1
- package/dist/components/feedback/KapiEmpty.js +20 -18
- package/dist/components/feedback/KapiFab.js +108 -108
- package/dist/components/feedback/KapiProgress.js +63 -54
- package/dist/components/feedback/KapiSpinner.d.ts +48 -0
- package/dist/components/feedback/KapiSpinner.js +27 -0
- package/dist/components/feedback/KapiToastContainer.js +10 -10
- package/dist/components/feedback/KapiTour.js +13 -13
- package/dist/components/feedback/alertSlots.d.ts +9 -0
- package/dist/components/feedback/alertSlots.js +12 -0
- package/dist/components/feedback/countdownSlots.d.ts +6 -0
- package/dist/components/feedback/countdownSlots.js +9 -0
- package/dist/components/feedback/emptySlots.d.ts +8 -0
- package/dist/components/feedback/emptySlots.js +11 -0
- package/dist/components/feedback/index.d.ts +5 -3
- 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/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.d.ts +14 -1
- package/dist/components/inputs/KapiFileUpload.js +83 -70
- 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 +9 -1
- package/dist/components/inputs/KapiSelect.js +236 -233
- 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 +23 -3
- package/dist/components/inputs/fieldLogic.js +18 -11
- package/dist/components/inputs/formBridgeLogic.d.ts +104 -0
- package/dist/components/inputs/formBridgeLogic.js +25 -0
- package/dist/components/inputs/index.d.ts +10 -0
- 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/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/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.js +2 -2
- package/dist/components/layout/KapiNotificationBell.js +10 -10
- package/dist/components/layout/KapiPageHeader.js +22 -22
- package/dist/components/layout/KapiRail.js +4 -4
- package/dist/components/layout/KapiRoot.d.ts +22 -2
- package/dist/components/layout/KapiRoot.js +33 -29
- package/dist/components/layout/KapiShell.d.ts +9 -1
- package/dist/components/layout/KapiShell.js +28 -27
- package/dist/components/layout/accessCardLogic.d.ts +8 -1
- package/dist/components/layout/accessCardLogic.js +11 -7
- package/dist/components/layout/index.d.ts +2 -0
- package/dist/components/locale/labelRegistry.d.ts +18 -0
- package/dist/components/navigation/KapiAccordion.js +9 -9
- package/dist/components/navigation/KapiContextPanel.js +12 -12
- package/dist/components/navigation/KapiNavBadge.d.ts +6 -3
- package/dist/components/navigation/KapiNavBadge.js +26 -22
- package/dist/components/navigation/KapiSteps.d.ts +26 -5
- package/dist/components/navigation/KapiSteps.js +55 -43
- package/dist/components/navigation/KapiTabs.js +9 -9
- 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/index.d.ts +3 -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.js +5 -5
- package/dist/components/overlays/KapiImageViewer.d.ts +63 -0
- package/dist/components/overlays/KapiImageViewer.js +106 -0
- package/dist/components/overlays/KapiMenuButton.js +7 -7
- package/dist/components/overlays/KapiModal.js +3 -3
- 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/KapiShortcutsHelp.d.ts +53 -0
- package/dist/components/overlays/KapiShortcutsHelp.js +55 -0
- package/dist/components/overlays/KapiTooltip.d.ts +49 -10
- package/dist/components/overlays/KapiTooltip.js +120 -68
- package/dist/components/overlays/KapiViewport.d.ts +63 -0
- package/dist/components/overlays/KapiViewport.js +195 -0
- package/dist/components/overlays/index.d.ts +8 -0
- package/dist/components/overlays/menuList.js +22 -22
- package/dist/components/overlays/shortcutsHelpSlots.d.ts +9 -0
- package/dist/components/overlays/shortcutsHelpSlots.js +12 -0
- package/dist/components/overlays/viewportLogic.d.ts +73 -0
- package/dist/components/overlays/viewportLogic.js +54 -0
- package/dist/components/slotCatalog.d.ts +66 -0
- package/dist/components/slotCatalog.js +30 -12
- package/dist/css/base.css +1 -1
- package/dist/css/components/data/KapiScatterChart.css +1 -0
- 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/feedback/feedback.css +1 -1
- package/dist/css/components/inputs/KapiFileUpload.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/KapiCollapse.css +1 -0
- package/dist/css/components/layout/KapiDivider.css +1 -1
- package/dist/css/components/navigation/KapiSteps.css +1 -1
- package/dist/css/components/navigation/KapiToc.css +1 -0
- package/dist/css/components/overlays/KapiViewport.css +1 -0
- package/dist/css/components/overlays/overlays.css +1 -1
- package/dist/hooks/asyncResourceLogic.d.ts +11 -0
- package/dist/hooks/asyncResourceLogic.js +4 -0
- package/dist/hooks/elementSizeLogic.d.ts +15 -0
- package/dist/hooks/elementSizeLogic.js +7 -0
- package/dist/hooks/hotkeyLogic.d.ts +9 -0
- package/dist/hooks/hotkeyLogic.js +16 -15
- package/dist/hooks/hotkeyRegistry.d.ts +44 -0
- package/dist/hooks/hotkeyRegistry.js +32 -0
- package/dist/hooks/index.d.ts +13 -0
- package/dist/hooks/toneFamilyLogic.d.ts +26 -2
- package/dist/hooks/toneFamilyLogic.js +19 -6
- package/dist/hooks/useAsyncResource.d.ts +45 -0
- package/dist/hooks/useAsyncResource.js +24 -0
- package/dist/hooks/useDebouncedValue.d.ts +30 -0
- package/dist/hooks/useDebouncedValue.js +26 -0
- package/dist/hooks/useDisclosure.d.ts +39 -0
- package/dist/hooks/useDisclosure.js +35 -0
- package/dist/hooks/useElementSize.d.ts +27 -0
- package/dist/hooks/useElementSize.js +29 -0
- package/dist/hooks/useHotkey.d.ts +8 -0
- package/dist/hooks/useHotkey.js +27 -15
- package/dist/hooks/useKapiTheme.d.ts +8 -1
- package/dist/hooks/useKapiTheme.js +57 -57
- package/dist/hooks/useToneFamilies.d.ts +14 -4
- package/dist/hooks/useToneFamilies.js +27 -23
- package/dist/index.js +234 -207
- package/dist/kapi.css +1 -1
- package/dist/kapi.layered.css +1 -1
- package/dist/logic.d.ts +45 -0
- package/dist/logic.js +46 -0
- package/package.json +13 -2
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "#kapi-css/components/overlays/KapiViewport.css";
|
|
3
|
+
import { joinClasses as e } from "../rootProps.js";
|
|
4
|
+
import { useLabels as t } from "../locale/KapiLocaleProvider.js";
|
|
5
|
+
import { KapiIconButton as n } from "../inputs/KapiIconButton.js";
|
|
6
|
+
import { useControllableState as r } from "../../hooks/useControllableState.js";
|
|
7
|
+
import { useDismiss as i } from "../../hooks/useDismiss.js";
|
|
8
|
+
/* empty css */
|
|
9
|
+
import { KapiViewport as a } from "./KapiViewport.js";
|
|
10
|
+
import { useCallback as o, useId as s, useRef as c, useState as l } from "react";
|
|
11
|
+
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
12
|
+
import { ChevronLeft as p, ChevronRight as m, X as h } from "lucide-react";
|
|
13
|
+
//#region src/components/overlays/KapiImageViewer.tsx
|
|
14
|
+
var g = {
|
|
15
|
+
close: "Cerrar el visor",
|
|
16
|
+
previous: "Imagen anterior",
|
|
17
|
+
next: "Imagen siguiente",
|
|
18
|
+
counter: "{i} de {n}"
|
|
19
|
+
}, _ = ({ ref: _, open: v, onClose: y, images: b, index: x, defaultIndex: S = 0, onIndexChange: C, className: w, style: T, id: E, labels: D }) => {
|
|
20
|
+
let O = t("imageViewer", g, D), k = c(null), A = s(), [j, M] = r(x, S, C), [N, P] = l(null), F = b.length, I = F === 0 ? 0 : Math.min(Math.max(j, 0), F - 1), L = b[I], R = o((e) => {
|
|
21
|
+
F !== 0 && M((I + e + F) % F);
|
|
22
|
+
}, [
|
|
23
|
+
I,
|
|
24
|
+
F,
|
|
25
|
+
M
|
|
26
|
+
]), z = c(L?.src);
|
|
27
|
+
if (z.current !== L?.src && (z.current = L?.src, P(null)), i(v, {
|
|
28
|
+
zones: [k],
|
|
29
|
+
onDismiss: (e) => y(e)
|
|
30
|
+
}), !v || !L) return null;
|
|
31
|
+
let B = L.width ?? N?.width ?? 0, V = L.height ?? N?.height ?? 0, H = O.counter.replace("{i}", String(I + 1)).replace("{n}", String(F));
|
|
32
|
+
return /* @__PURE__ */ f("div", {
|
|
33
|
+
ref: (e) => {
|
|
34
|
+
k.current = e, typeof _ == "function" ? _(e) : _ && (_.current = e);
|
|
35
|
+
},
|
|
36
|
+
id: E,
|
|
37
|
+
className: e("kapi-imgviewer", w),
|
|
38
|
+
style: T,
|
|
39
|
+
role: "dialog",
|
|
40
|
+
"aria-modal": "true",
|
|
41
|
+
"aria-labelledby": A,
|
|
42
|
+
children: [
|
|
43
|
+
/* @__PURE__ */ f("div", {
|
|
44
|
+
className: "kapi-imgviewer__bar",
|
|
45
|
+
children: [
|
|
46
|
+
/* @__PURE__ */ d("span", {
|
|
47
|
+
id: A,
|
|
48
|
+
className: "kapi-imgviewer__title",
|
|
49
|
+
children: L.alt
|
|
50
|
+
}),
|
|
51
|
+
F > 1 && /* @__PURE__ */ d("span", {
|
|
52
|
+
className: "kapi-imgviewer__count",
|
|
53
|
+
children: H
|
|
54
|
+
}),
|
|
55
|
+
/* @__PURE__ */ d(n, {
|
|
56
|
+
"aria-label": O.close,
|
|
57
|
+
icon: /* @__PURE__ */ d(h, {
|
|
58
|
+
size: 18,
|
|
59
|
+
strokeWidth: 2.2
|
|
60
|
+
}),
|
|
61
|
+
onClick: () => y("close-button")
|
|
62
|
+
})
|
|
63
|
+
]
|
|
64
|
+
}),
|
|
65
|
+
/* @__PURE__ */ d(a, {
|
|
66
|
+
className: "kapi-imgviewer__stage",
|
|
67
|
+
contentWidth: B,
|
|
68
|
+
contentHeight: V,
|
|
69
|
+
hideFullscreen: !0,
|
|
70
|
+
children: /* @__PURE__ */ d("img", {
|
|
71
|
+
className: "kapi-imgviewer__img",
|
|
72
|
+
src: L.src,
|
|
73
|
+
alt: L.alt,
|
|
74
|
+
draggable: !1,
|
|
75
|
+
onLoad: (e) => P({
|
|
76
|
+
width: e.currentTarget.naturalWidth,
|
|
77
|
+
height: e.currentTarget.naturalHeight
|
|
78
|
+
})
|
|
79
|
+
})
|
|
80
|
+
}, L.src),
|
|
81
|
+
F > 1 && /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(n, {
|
|
82
|
+
className: "kapi-imgviewer__prev",
|
|
83
|
+
"aria-label": O.previous,
|
|
84
|
+
icon: /* @__PURE__ */ d(p, {
|
|
85
|
+
size: 20,
|
|
86
|
+
strokeWidth: 2.2
|
|
87
|
+
}),
|
|
88
|
+
onClick: () => R(-1)
|
|
89
|
+
}), /* @__PURE__ */ d(n, {
|
|
90
|
+
className: "kapi-imgviewer__next",
|
|
91
|
+
"aria-label": O.next,
|
|
92
|
+
icon: /* @__PURE__ */ d(m, {
|
|
93
|
+
size: 20,
|
|
94
|
+
strokeWidth: 2.2
|
|
95
|
+
}),
|
|
96
|
+
onClick: () => R(1)
|
|
97
|
+
})] }),
|
|
98
|
+
L.caption != null && /* @__PURE__ */ d("div", {
|
|
99
|
+
className: "kapi-imgviewer__caption",
|
|
100
|
+
children: L.caption
|
|
101
|
+
})
|
|
102
|
+
]
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
//#endregion
|
|
106
|
+
export { g as DEFAULT_IMAGE_VIEWER_LABELS, _ as KapiImageViewer };
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import "#kapi-css/components/overlays/overlays.css";
|
|
3
3
|
import { joinClasses as e } from "../rootProps.js";
|
|
4
4
|
import { KapiButton as t } from "../inputs/KapiButton.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
5
|
+
import { useMergedRefs as n } from "../../hooks/mergeRefs.js";
|
|
6
|
+
import { useControllableState as r } from "../../hooks/useControllableState.js";
|
|
7
|
+
import { resolveKapiRoot as i } from "../../hooks/kapiRoot.js";
|
|
8
|
+
import { usePlacement as a } from "../../hooks/usePlacement.js";
|
|
9
9
|
import { useDismiss as o } from "../../hooks/useDismiss.js";
|
|
10
10
|
/* empty css */
|
|
11
11
|
import { ACTION_MENU_PLACEMENT as s } from "./menuButtonLogic.js";
|
|
@@ -17,12 +17,12 @@ import { ChevronDown as g } from "lucide-react";
|
|
|
17
17
|
import { createPortal as _ } from "react-dom";
|
|
18
18
|
//#region src/components/overlays/KapiMenuButton.tsx
|
|
19
19
|
var v = 6, y = ({ label: y, items: b, icon: x, tone: S, variant: C, size: w, disabled: T = !1, open: E, defaultOpen: D = !1, onOpenChange: O, chevron: k, "aria-label": A, drop: j = "down", className: M, style: N, id: P, ref: F }) => {
|
|
20
|
-
let I = d(), [L, R] =
|
|
20
|
+
let I = d(), [L, R] = r(E, D, O), z = L && !T, B = y === void 0 && x != null, V = k ?? !B, H = p(null), U = n(H, F), W = p(null), G = p(null), { restore: K } = l(z, {
|
|
21
21
|
container: G,
|
|
22
22
|
target: W
|
|
23
23
|
}), q = u((e) => {
|
|
24
24
|
R(!1), e && K();
|
|
25
|
-
}, [R, K]), { placement: J, style: Y, update: X } =
|
|
25
|
+
}, [R, K]), { placement: J, style: Y, update: X } = a({
|
|
26
26
|
open: z,
|
|
27
27
|
anchor: W,
|
|
28
28
|
floatingRef: G,
|
|
@@ -43,7 +43,7 @@ var v = 6, y = ({ label: y, items: b, icon: x, tone: S, variant: C, size: w, dis
|
|
|
43
43
|
onDismiss: (e) => q(e === "escape")
|
|
44
44
|
}), Q = (e) => {
|
|
45
45
|
(e.key === "ArrowDown" || e.key === "ArrowUp") && (e.preventDefault(), R(!0));
|
|
46
|
-
}, $ = z ?
|
|
46
|
+
}, $ = z ? i(H.current) : null;
|
|
47
47
|
return /* @__PURE__ */ h("span", {
|
|
48
48
|
ref: U,
|
|
49
49
|
id: P,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/overlays/KapiModal.css";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { useMergedRefs as e } from "../../hooks/mergeRefs.js";
|
|
4
|
+
import { useLabels as t } from "../locale/KapiLocaleProvider.js";
|
|
5
5
|
import { slot as n } from "../slotsLogic.js";
|
|
6
6
|
import { prefersReducedMotion as r } from "../../hooks/reducedMotion.js";
|
|
7
7
|
import { dialogNameProps as i, modalClasses as a, resolveDismiss as o } from "./dialogUtils.js";
|
|
@@ -23,7 +23,7 @@ var b = { close: "Cerrar" }, x = ({ open: e, ...t }) => {
|
|
|
23
23
|
closing: i
|
|
24
24
|
}) : null;
|
|
25
25
|
}, S = () => {}, C = ({ title: s, subtitle: x, onClose: C, children: w, footer: T, size: E = "md", hideHeader: D = !1, className: ne = "", classNames: O, style: k, id: A, ref: j, closeOnBackdrop: M, closeOnEscape: N, closeButton: P, dismissible: F, closeLabel: I, labels: L, "aria-label": R, "aria-labelledby": z, growFrom: B, dialogRef: V, closing: H }) => {
|
|
26
|
-
let U = H ? S : C, W = f(), G =
|
|
26
|
+
let U = H ? S : C, W = f(), G = t("modal", b, L), K = I ?? G.close, q = m(null), J = e(q, j), [Y, X] = h(null), Z = o({
|
|
27
27
|
dismissible: F,
|
|
28
28
|
closeOnEscape: N,
|
|
29
29
|
closeOnBackdrop: M,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/overlays/KapiOffcanvas.css";
|
|
3
3
|
import { joinClasses as e } from "../rootProps.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { useMergedRefs as t } from "../../hooks/mergeRefs.js";
|
|
5
|
+
import { useKapiDir as n, useLabels as r } from "../locale/KapiLocaleProvider.js";
|
|
6
|
+
import { computedStyleOf as i, winOf as a } from "../../hooks/ownerDocument.js";
|
|
7
|
+
import { resolveDirection as o } from "../../hooks/directionLogic.js";
|
|
8
8
|
import { maxTransitionMs as ee, resolveDismiss as s } from "./dialogUtils.js";
|
|
9
9
|
import { useExitPresence as c } from "./useExitPresence.js";
|
|
10
10
|
import { useBackdropClose as l, useNativeDialog as u, usePortalRoot as d, useTrappedDialogWarning as f } from "./useNativeDialog.js";
|
|
@@ -21,8 +21,8 @@ var be = 120, T = {
|
|
|
21
21
|
resize: "Redimensionar panel",
|
|
22
22
|
close: "Cerrar",
|
|
23
23
|
closePanel: "Cerrar panel"
|
|
24
|
-
}, E = ({ textDir:
|
|
25
|
-
let N =
|
|
24
|
+
}, E = ({ textDir: n, stackId: o, phase: d, onEntered: m, onExited: h, onClose: ve, title: w, subtitle: E, children: D, footer: O, side: xe, width: k = 520, height: Se, pushRatio: Ce = te, pushOffset: we = 16, closeOnBackdrop: Te, closeOnEscape: Ee, closeButton: De, dismissible: Oe, closeLabel: ke, labels: Ae, className: je, style: Me, id: Ne, ref: Pe, companion: A, resizable: Fe = !1, minWidth: j = 320, maxWidth: M, onResize: Ie }) => {
|
|
25
|
+
let N = r("offcanvas", T, Ae), Le = ke ?? N.close, P = _(), F = _(), I = ae(xe), L = y(null), R = ye(p.subscribe, p.getSnapshot, p.getServerSnapshot), z = ne(R, o), Re = Math.max(0, re(R, o)), { scale: ze, translateX: Be } = oe(I, ie(z, Ce, we)), [B, Ve] = b(() => me(k, 520)), [He, V] = b(!1), H = y(null), U = y(Ie);
|
|
26
26
|
U.current = Ie;
|
|
27
27
|
let W = (e) => {
|
|
28
28
|
Ve(e), e !== B && U.current?.(e);
|
|
@@ -36,26 +36,26 @@ var be = 120, T = {
|
|
|
36
36
|
}, We = (e) => {
|
|
37
37
|
let t = H.current;
|
|
38
38
|
if (!t) return;
|
|
39
|
-
let n = g(M, (
|
|
39
|
+
let n = g(M, (a(L.current) ?? window).innerWidth);
|
|
40
40
|
W(ge(I, t.startWidth, t.startX, e.clientX, j, n));
|
|
41
41
|
}, G = (e) => {
|
|
42
42
|
H.current = null, e.currentTarget.hasPointerCapture(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId), V(!1);
|
|
43
43
|
}, Ge = (e) => {
|
|
44
|
-
let t = g(M, (
|
|
44
|
+
let t = g(M, (a(L.current) ?? window).innerWidth), n = he(I, B, e.key, j, t);
|
|
45
45
|
n !== null && (e.preventDefault(), e.stopPropagation(), W(n));
|
|
46
46
|
}, K = d === "open" ? ve : void 0, q = s({
|
|
47
47
|
dismissible: Oe,
|
|
48
48
|
closeOnEscape: Ee,
|
|
49
49
|
closeOnBackdrop: Te,
|
|
50
50
|
closeButton: De
|
|
51
|
-
}), { closeOnEscape: Ke, closeOnBackdrop: qe, closeButton: Je } = q, { ref: J, dialogProps: Ye } = u({ onRequestClose: Ke ? () => K?.("escape") : void 0 }), Xe =
|
|
51
|
+
}), { closeOnEscape: Ke, closeOnBackdrop: qe, closeButton: Je } = q, { ref: J, dialogProps: Ye } = u({ onRequestClose: Ke ? () => K?.("escape") : void 0 }), Xe = t(J, Pe), Ze = l(qe ? () => K?.("backdrop") : void 0);
|
|
52
52
|
f("KapiOffcanvas", q, J), v(() => (p.dispatch({
|
|
53
53
|
type: "add",
|
|
54
|
-
id:
|
|
54
|
+
id: o
|
|
55
55
|
}), () => p.dispatch({
|
|
56
56
|
type: "remove",
|
|
57
|
-
id:
|
|
58
|
-
})), [
|
|
57
|
+
id: o
|
|
58
|
+
})), [o]);
|
|
59
59
|
let Y = y(m);
|
|
60
60
|
Y.current = m, v(() => {
|
|
61
61
|
L.current?.getBoundingClientRect(), Y.current();
|
|
@@ -68,20 +68,20 @@ var be = 120, T = {
|
|
|
68
68
|
X.current();
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
|
-
let t =
|
|
71
|
+
let t = i(e), n = ee(t.transitionDuration, t.transitionDelay);
|
|
72
72
|
if (n <= 0) {
|
|
73
73
|
X.current();
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
|
-
let
|
|
77
|
-
|
|
76
|
+
let r = !1, a = () => {
|
|
77
|
+
r || (r = !0, X.current());
|
|
78
78
|
}, o = (t) => {
|
|
79
79
|
t.target === e && t.propertyName === "transform" && a();
|
|
80
80
|
};
|
|
81
81
|
e.addEventListener("transitionend", o);
|
|
82
82
|
let s = window.setTimeout(a, n + be);
|
|
83
83
|
return () => {
|
|
84
|
-
|
|
84
|
+
r = !0, e.removeEventListener("transitionend", o), window.clearTimeout(s);
|
|
85
85
|
};
|
|
86
86
|
}, [d]);
|
|
87
87
|
let Z = Fe && (I === "left" || I === "right"), Q = ce(I, k, Se, "520px");
|
|
@@ -93,7 +93,7 @@ var be = 120, T = {
|
|
|
93
93
|
"--kapi-offc-push-s": ze
|
|
94
94
|
}, $e = ue(I, A), et = y(null), { present: tt, closing: nt } = c($e, et), rt = y(A);
|
|
95
95
|
A && (rt.current = A);
|
|
96
|
-
let $ = A ?? rt.current, it = tt && pe(I) && $ !== void 0, at =
|
|
96
|
+
let $ = A ?? rt.current, it = tt && pe(I) && $ !== void 0, at = n === "rtl", ot = at ? { dir: "rtl" } : {}, st = /* @__PURE__ */ S("div", {
|
|
97
97
|
ref: L,
|
|
98
98
|
className: "kapi-offc__panel",
|
|
99
99
|
...ot,
|
|
@@ -201,25 +201,25 @@ var be = 120, T = {
|
|
|
201
201
|
children: lt
|
|
202
202
|
})
|
|
203
203
|
});
|
|
204
|
-
}, D = ({ open: e, onExited:
|
|
205
|
-
let
|
|
206
|
-
l.current =
|
|
204
|
+
}, D = ({ open: e, onExited: t, side: r, ...i }) => {
|
|
205
|
+
let a = _(), ee = n(), [s, c] = ve(m, "unmounted"), l = y(t);
|
|
206
|
+
l.current = t, v(() => {
|
|
207
207
|
c(e ? "open" : "close");
|
|
208
208
|
}, [e]), v(() => {
|
|
209
209
|
(s === "exit" || s === "open") && p.dispatch({
|
|
210
210
|
type: "mark",
|
|
211
|
-
id:
|
|
211
|
+
id: a,
|
|
212
212
|
state: s === "exit" ? "closing" : "open"
|
|
213
213
|
});
|
|
214
|
-
}, [s,
|
|
214
|
+
}, [s, a]);
|
|
215
215
|
let u = d();
|
|
216
216
|
if (s === "unmounted" || !u) return null;
|
|
217
|
-
let f =
|
|
217
|
+
let f = o(u, ee);
|
|
218
218
|
return w(/* @__PURE__ */ x(E, {
|
|
219
219
|
...i,
|
|
220
220
|
textDir: f,
|
|
221
221
|
side: h(r, f),
|
|
222
|
-
stackId:
|
|
222
|
+
stackId: a,
|
|
223
223
|
phase: s,
|
|
224
224
|
onEntered: () => c("entered"),
|
|
225
225
|
onExited: () => {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/overlays/overlays.css";
|
|
3
3
|
import { joinClasses as e } from "../rootProps.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
4
|
+
import { useMergedRefs as t } from "../../hooks/mergeRefs.js";
|
|
5
|
+
import { useLabels as n } from "../locale/KapiLocaleProvider.js";
|
|
6
|
+
import { computedStyleOf as r } from "../../hooks/ownerDocument.js";
|
|
7
|
+
import { resolveKapiRoot as i } from "../../hooks/kapiRoot.js";
|
|
8
|
+
import { onViewportChange as a } from "../../hooks/rafThrottle.js";
|
|
9
9
|
/* empty css */
|
|
10
10
|
import { KapiOverlayPortal as o } from "./overlayPortal.js";
|
|
11
11
|
import { prefersReducedMotion as s } from "../../hooks/reducedMotion.js";
|
|
@@ -44,14 +44,14 @@ var _ = { viewer: "Foto ampliada" }, v = 92, y = 24, b = .42, x = (e, t) => {
|
|
|
44
44
|
fontSize: t.height * b
|
|
45
45
|
} : {};
|
|
46
46
|
}, E = ({ children: v, content: y, bg: b = "var(--kapi-primary-soft)", ink: E = "var(--kapi-primary-ink)", label: D, labels: O, className: k, style: A, id: j, ref: M }) => {
|
|
47
|
-
let N =
|
|
47
|
+
let N = n("photoView", _, O), P = f(null), F = t(P, M), I = f(null), L = f(!1), [R, z] = d(x, "closed"), [B, V] = p(null), [H, U] = p(999), [W, G] = p(null), K = (e) => {
|
|
48
48
|
e.stopPropagation();
|
|
49
49
|
let t = P.current;
|
|
50
50
|
if (!t) return;
|
|
51
|
-
let
|
|
52
|
-
V(
|
|
51
|
+
let n = t.getBoundingClientRect();
|
|
52
|
+
V(n);
|
|
53
53
|
let a = t.firstElementChild ?? t;
|
|
54
|
-
U(C(
|
|
54
|
+
U(C(r(a).borderRadius, n)), G(i(t)), z("open");
|
|
55
55
|
}, q = (e) => {
|
|
56
56
|
e.stopPropagation(), z("close");
|
|
57
57
|
};
|
|
@@ -62,7 +62,7 @@ var _ = { viewer: "Foto ampliada" }, v = 92, y = 24, b = .42, x = (e, t) => {
|
|
|
62
62
|
}, [R]);
|
|
63
63
|
let J = R === "closed";
|
|
64
64
|
l(() => {
|
|
65
|
-
if (!J) return
|
|
65
|
+
if (!J) return a(() => {
|
|
66
66
|
let e = P.current;
|
|
67
67
|
if (!e) return;
|
|
68
68
|
let t = e.getBoundingClientRect();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/overlays/KapiPopover.css";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { useMergedRefs as e } from "../../hooks/mergeRefs.js";
|
|
4
|
+
import { resolveKapiRoot as t } from "../../hooks/kapiRoot.js";
|
|
5
|
+
import { usePlacement as n } from "../../hooks/usePlacement.js";
|
|
6
6
|
import { useDismiss as r } from "../../hooks/useDismiss.js";
|
|
7
7
|
import { KapiOverlayPortal as i } from "./overlayPortal.js";
|
|
8
8
|
import { useExitPresence as a } from "./useExitPresence.js";
|
|
@@ -11,11 +11,11 @@ import { useLayoutEffect as o, useRef as s, useState as c } from "react";
|
|
|
11
11
|
import { jsx as l } from "react/jsx-runtime";
|
|
12
12
|
//#region src/components/overlays/KapiPopover.tsx
|
|
13
13
|
function u({ open: u, anchorRef: d, onClose: f, side: p = "bottom", align: m = "start", offset: h = 6, margin: g = 8, matchAnchorWidth: _ = !1, role: v = "dialog", "aria-label": y, id: b, className: x = "", style: S, ref: C, closeOnEscape: w = !0, closeOnOutside: T = !0, restoreFocus: E = !0, children: D }) {
|
|
14
|
-
let O = s(null), k =
|
|
14
|
+
let O = s(null), k = e(O, C), [A, j] = c(null), { present: M, closing: N } = a(u, O);
|
|
15
15
|
o(() => {
|
|
16
|
-
j(M ?
|
|
16
|
+
j(M ? t(d.current) : null);
|
|
17
17
|
}, [M, d]);
|
|
18
|
-
let { placement: P, style: F } =
|
|
18
|
+
let { placement: P, style: F } = n({
|
|
19
19
|
open: M,
|
|
20
20
|
enabled: !!A,
|
|
21
21
|
anchor: d,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/overlays/overlays.css";
|
|
3
3
|
import { joinClasses as e } from "../rootProps.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { useMergedRefs as t } from "../../hooks/mergeRefs.js";
|
|
5
|
+
import { useLabels as n } from "../locale/KapiLocaleProvider.js";
|
|
6
|
+
import { useControllableState as r } from "../../hooks/useControllableState.js";
|
|
7
7
|
import { useDismiss as i } from "../../hooks/useDismiss.js";
|
|
8
8
|
/* empty css */
|
|
9
9
|
import { focusableWithin as a } from "../../hooks/focusLogic.js";
|
|
@@ -15,7 +15,7 @@ var p = {
|
|
|
15
15
|
close: "Cerrar",
|
|
16
16
|
open: "Abrir"
|
|
17
17
|
}, m = ({ title: m, children: h, width: g = 300, height: _ = 250, label: v, labels: y, className: b, style: x, id: S, ref: C, open: w, defaultOpen: T = !1, onOpenChange: E }) => {
|
|
18
|
-
let D =
|
|
18
|
+
let D = n("shapeSheet", p, y), O = c(null), k = t(O, C), A = c(null), j = c(null), M = c(null), N = s(), [P, F] = r(w, T, E), I = c(P);
|
|
19
19
|
I.current = P;
|
|
20
20
|
let L = (e) => {
|
|
21
21
|
e !== I.current && F(e);
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type CSSProperties, type ReactNode, type Ref } from "react";
|
|
2
|
+
import type { KapiCloseReason } from "../closeReason.js";
|
|
3
|
+
import type { KapiLabelsOverride } from "../labelsLogic.js";
|
|
4
|
+
import type { KapiClassNames } from "../slotCatalog.js";
|
|
5
|
+
/** Partes de `KapiShortcutsHelp` que acepta `classNames` (`group`, `groupTitle`, `list`, `row`, `keys`, `description`). */
|
|
6
|
+
export type KapiShortcutsHelpClassNames = KapiClassNames<"shortcutsHelp">;
|
|
7
|
+
/** Textos de `KapiShortcutsHelp`. */
|
|
8
|
+
export type KapiShortcutsHelpLabels = {
|
|
9
|
+
/** Título del diálogo. */
|
|
10
|
+
title: string;
|
|
11
|
+
/** Encabezado de los atajos que no declararon grupo. */
|
|
12
|
+
general: string;
|
|
13
|
+
/** Qué se ve cuando no hay ningún atajo con descripción. */
|
|
14
|
+
empty: string;
|
|
15
|
+
};
|
|
16
|
+
export declare const DEFAULT_SHORTCUTS_HELP_LABELS: KapiShortcutsHelpLabels;
|
|
17
|
+
/** `className`/`style`/`id` van al diálogo. */
|
|
18
|
+
export type KapiShortcutsHelpProps = {
|
|
19
|
+
/** Ref al `<div>` del diálogo. */
|
|
20
|
+
ref?: Ref<HTMLDivElement> | undefined;
|
|
21
|
+
/** Abre el diálogo. */
|
|
22
|
+
open: boolean;
|
|
23
|
+
/** Se llama al cerrar (Escape, fondo, X). */
|
|
24
|
+
onClose: (reason: KapiCloseReason) => void;
|
|
25
|
+
/** Título propio. Sin él, el del locale. */
|
|
26
|
+
title?: ReactNode | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Fuerza el dibujo de las teclas al estilo de macOS (`⌘`, `⌥`, `⇧`). Sin la prop se deduce de la
|
|
29
|
+
* plataforma, que es lo que corresponde: el mismo `"mod+k"` se escribe distinto en cada una.
|
|
30
|
+
*/
|
|
31
|
+
mac?: boolean | undefined;
|
|
32
|
+
/** Clase del diálogo. */
|
|
33
|
+
className?: string | undefined;
|
|
34
|
+
/** Estilo del diálogo. */
|
|
35
|
+
style?: CSSProperties | undefined;
|
|
36
|
+
/** `id` del diálogo. */
|
|
37
|
+
id?: string | undefined;
|
|
38
|
+
/** Clases por parte (`group`, `groupTitle`, `list`, `row`, `keys`, `description`). Se suman a las propias. */
|
|
39
|
+
classNames?: KapiShortcutsHelpClassNames | undefined;
|
|
40
|
+
/** Textos fijos. */
|
|
41
|
+
labels?: KapiLabelsOverride<KapiShortcutsHelpLabels> | undefined;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* La ayuda «?» que lista los atajos que registró `useHotkey`.
|
|
45
|
+
*
|
|
46
|
+
* Sólo aparecen los que pasaron `description`: un atajo sin explicación sería una tecla suelta en
|
|
47
|
+
* una lista, que no ayuda a nadie. La lista se arma sola y **sigue al estado**: un atajo que está
|
|
48
|
+
* apagado (`enabled: false`) no se lista, porque prometería una tecla que no hace nada.
|
|
49
|
+
*
|
|
50
|
+
* El diálogo no registra ningún atajo propio para abrirse: quién abre la ayuda lo decide la app,
|
|
51
|
+
* normalmente con `useHotkey("?", …)`, y así la ayuda no se mete en el teclado de nadie.
|
|
52
|
+
*/
|
|
53
|
+
export declare const KapiShortcutsHelp: ({ ref, open, onClose, title, mac, className, style, id, classNames, labels }: KapiShortcutsHelpProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "#kapi-css/components/overlays/overlays.css";
|
|
3
|
+
import { useLabels as e } from "../locale/KapiLocaleProvider.js";
|
|
4
|
+
import { slot as t } from "../slotsLogic.js";
|
|
5
|
+
/* empty css */
|
|
6
|
+
import { KapiModal as n } from "./KapiModal.js";
|
|
7
|
+
import { groupHotkeys as r, hotkeyKeys as i, hotkeyRegistry as a } from "../../hooks/hotkeyRegistry.js";
|
|
8
|
+
import { SHORTCUTS_HELP_SLOTS as o } from "./shortcutsHelpSlots.js";
|
|
9
|
+
import { useSyncExternalStore as s } from "react";
|
|
10
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
11
|
+
//#region src/components/overlays/KapiShortcutsHelp.tsx
|
|
12
|
+
var u = {
|
|
13
|
+
title: "Atajos de teclado",
|
|
14
|
+
general: "General",
|
|
15
|
+
empty: "No hay atajos disponibles en esta pantalla."
|
|
16
|
+
}, d = () => typeof navigator < "u" && /mac/i.test(navigator.platform || navigator.userAgent), f = ({ ref: f, open: p, onClose: m, title: h, mac: g, className: _, style: v, id: y, classNames: b, labels: x }) => {
|
|
17
|
+
let S = e("shortcutsHelp", u, x), C = s(a.subscribe, a.getSnapshot, a.getSnapshot), w = r(C, S.general), T = g ?? d();
|
|
18
|
+
return /* @__PURE__ */ c(n, {
|
|
19
|
+
open: p,
|
|
20
|
+
onClose: m,
|
|
21
|
+
title: h === void 0 ? S.title : h,
|
|
22
|
+
size: "sm",
|
|
23
|
+
...f === void 0 ? {} : { ref: f },
|
|
24
|
+
..._ === void 0 ? {} : { className: _ },
|
|
25
|
+
...v === void 0 ? {} : { style: v },
|
|
26
|
+
...y === void 0 ? {} : { id: y },
|
|
27
|
+
children: w.length === 0 ? /* @__PURE__ */ c("p", {
|
|
28
|
+
className: "kapi-muted",
|
|
29
|
+
children: S.empty
|
|
30
|
+
}) : w.map(({ group: e, items: n }) => /* @__PURE__ */ l("section", {
|
|
31
|
+
...t(o, "group", b),
|
|
32
|
+
children: [/* @__PURE__ */ c("h3", {
|
|
33
|
+
...t(o, "groupTitle", b),
|
|
34
|
+
children: e
|
|
35
|
+
}), /* @__PURE__ */ c("dl", {
|
|
36
|
+
...t(o, "list", b),
|
|
37
|
+
children: n.map((e, n) => /* @__PURE__ */ l("div", {
|
|
38
|
+
...t(o, "row", b),
|
|
39
|
+
children: [/* @__PURE__ */ c("dt", {
|
|
40
|
+
...t(o, "keys", b),
|
|
41
|
+
children: i(e.combo, T).map((e, t) => /* @__PURE__ */ c("kbd", {
|
|
42
|
+
className: "kapi-kbd",
|
|
43
|
+
children: e
|
|
44
|
+
}, t))
|
|
45
|
+
}), /* @__PURE__ */ c("dd", {
|
|
46
|
+
...t(o, "description", b),
|
|
47
|
+
children: e.description
|
|
48
|
+
})]
|
|
49
|
+
}, `${e.combo}-${n}`))
|
|
50
|
+
})]
|
|
51
|
+
}, e))
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
//#endregion
|
|
55
|
+
export { u as DEFAULT_SHORTCUTS_HELP_LABELS, f as KapiShortcutsHelp };
|
|
@@ -8,25 +8,61 @@ type TooltipPhysicalSide = "right" | "left" | "top" | "bottom";
|
|
|
8
8
|
* sigue la dirección del texto: `end` es la derecha en LTR y la izquierda en RTL).
|
|
9
9
|
*/
|
|
10
10
|
export type KapiTooltipSide = TooltipPhysicalSide | "start" | "end";
|
|
11
|
-
/**
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
label:
|
|
15
|
-
/** Disparador: el elemento que muestra el tooltip al pasar el mouse o enfocarlo. */
|
|
16
|
-
children: ReactNode;
|
|
11
|
+
/** Lo común a las dos formas de usarlo (envolviendo al disparador o apuntándolo por id). */
|
|
12
|
+
type KapiTooltipBase = KapiRootProps<HTMLSpanElement> & {
|
|
13
|
+
/** Contenido del tooltip. Puede ser texto o nodos (`<strong>`, varias partes). */
|
|
14
|
+
label: ReactNode;
|
|
17
15
|
/** Lado preferido: se respeta si entra; si no, va al opuesto. @default "end" */
|
|
18
16
|
prefer?: KapiTooltipSide | undefined;
|
|
17
|
+
/** Apagado: no se abre y no describe al disparador (no deja un `aria-describedby` a una burbuja que no se ve). */
|
|
18
|
+
disabled?: boolean | undefined;
|
|
19
|
+
/** Deja que el texto corte en varias líneas (tope 280px). Sin esto va en una sola, que es lo que conviene a un ícono. */
|
|
20
|
+
multiline?: boolean | undefined;
|
|
21
|
+
/** Milisegundos de espera antes de abrir con el mouse. Salir antes cancela. El foco de teclado NO espera. @default 0 */
|
|
22
|
+
openDelay?: number | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Abre y cierra desde afuera. Con la prop definida el estado es del consumidor: el hover y el foco
|
|
25
|
+
* dejan de abrirlo y cerrarlo. Sin ella, lo maneja el componente.
|
|
26
|
+
*/
|
|
27
|
+
opened?: boolean | undefined;
|
|
19
28
|
};
|
|
29
|
+
/**
|
|
30
|
+
* `className`/`style`/`id` van al envoltorio `<span class="kapi-tip">`.
|
|
31
|
+
*
|
|
32
|
+
* Dos formas, y el tipo obliga a elegir una: **envolviendo** al disparador (`children`) o
|
|
33
|
+
* **apuntándolo por id** (`target`), que no agrega ningún nodo alrededor.
|
|
34
|
+
*/
|
|
35
|
+
export type KapiTooltipProps = (KapiTooltipBase & {
|
|
36
|
+
/** Disparador: el elemento que muestra el tooltip al pasar el mouse o enfocarlo. */
|
|
37
|
+
children: ReactNode;
|
|
38
|
+
/** No aplica envolviendo al disparador. */
|
|
39
|
+
target?: undefined;
|
|
40
|
+
}) | (KapiTooltipBase & {
|
|
41
|
+
/**
|
|
42
|
+
* `id` del elemento que dispara el tooltip. El componente no lo envuelve: le cuelga los
|
|
43
|
+
* eventos y le pone `aria-describedby`, así el layout del disparador no cambia. Es la forma
|
|
44
|
+
* que necesita `UncontrolledTooltip target={id}` al migrar.
|
|
45
|
+
*/
|
|
46
|
+
target: string;
|
|
47
|
+
/** No aplica apuntando por id: el disparador es el elemento del `target`. */
|
|
48
|
+
children?: undefined;
|
|
49
|
+
});
|
|
20
50
|
/** Lado físico de `side` para la dirección del texto: `start`/`end` se resuelven; el resto pasa tal cual. */
|
|
21
51
|
export declare const physicalTooltipSide: (side: KapiTooltipSide, dir: KapiDir) => TooltipPhysicalSide;
|
|
22
|
-
/**
|
|
23
|
-
|
|
52
|
+
/**
|
|
53
|
+
* Ancho estimado de la burbuja (sin medirla), con tope.
|
|
54
|
+
*
|
|
55
|
+
* Un `label` que no es texto no se puede medir contando caracteres, así que se asume el tope: el
|
|
56
|
+
* efecto es que el lado se da vuelta un poco antes de lo necesario, que es el error barato. Al
|
|
57
|
+
* revés —asumir angosto— la burbuja se saldría de la ventana.
|
|
58
|
+
*/
|
|
59
|
+
export declare const estimateTooltipWidth: (label: ReactNode) => number;
|
|
24
60
|
/**
|
|
25
61
|
* Lado final del tooltip (auto-flip) con el motor `placePopover`: se respeta el lado pedido salvo que
|
|
26
62
|
* la burbuja (tamaño estimado) no entre; entonces va al opuesto. Pura: recibe el rect del disparador y
|
|
27
63
|
* el viewport (sin `bottom`/`left` se toman `top`/`right`; sin alto de viewport, abajo siempre entra).
|
|
28
64
|
*/
|
|
29
|
-
export declare const resolveTooltipSide: (prefer: TooltipPhysicalSide, rect: Pick<DOMRect, "top" | "right"> & Partial<Pick<DOMRect, "bottom" | "left">>, label:
|
|
65
|
+
export declare const resolveTooltipSide: (prefer: TooltipPhysicalSide, rect: Pick<DOMRect, "top" | "right"> & Partial<Pick<DOMRect, "bottom" | "left">>, label: ReactNode, viewportWidth: number, viewportHeight?: number) => TooltipPhysicalSide;
|
|
30
66
|
/**
|
|
31
67
|
* Punto de la burbuja en coordenadas de viewport según el lado (la burbuja es `position: fixed`, así no la
|
|
32
68
|
* recorta un contenedor con overflow, como el panel plegado o la zona que scrollea del rail). El CSS la
|
|
@@ -43,6 +79,9 @@ export declare const tooltipDescribedBy: (existing: unknown, tipId: string) => s
|
|
|
43
79
|
* Tooltip para íconos sueltos. Se muestra con hover y con foco de teclado (`:focus-visible`), se
|
|
44
80
|
* descarta con Escape (WCAG 1.4.13) y el disparador lo referencia por `aria-describedby`. Al abrir mide
|
|
45
81
|
* el disparador y abre del lado con espacio.
|
|
82
|
+
*
|
|
83
|
+
* Dos formas: **envolviendo** al disparador (`children`) o **apuntándolo por id** (`target`), que no
|
|
84
|
+
* agrega ningún nodo alrededor y es la que necesita la migración de `UncontrolledTooltip`.
|
|
46
85
|
*/
|
|
47
|
-
export declare const KapiTooltip: ({ label, children, prefer, className, style, id, ref: refProp }: KapiTooltipProps) => import("react").JSX.Element;
|
|
86
|
+
export declare const KapiTooltip: ({ label, children, target, prefer, disabled, multiline, openDelay, opened, className, style, id, ref: refProp }: KapiTooltipProps) => import("react").JSX.Element;
|
|
48
87
|
export {};
|