@kapiuara/ui 0.13.0 → 0.15.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 +239 -1
- package/dist/components/chat/KapiChatDivider.d.ts +7 -3
- package/dist/components/chat/KapiChatDivider.js +6 -6
- 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/chat/index.d.ts +1 -1
- 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 +55 -55
- 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 +30 -30
- package/dist/components/feedback/KapiOfflineBanner.js +8 -8
- package/dist/components/feedback/KapiToastContainer.js +25 -25
- package/dist/components/feedback/KapiTour.d.ts +2 -1
- package/dist/components/feedback/KapiTour.js +35 -35
- 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 +124 -122
- package/dist/components/inputs/KapiDateRangePicker.js +138 -136
- package/dist/components/inputs/KapiFacetedSearch.js +29 -29
- 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.d.ts +8 -3
- package/dist/components/inputs/KapiMaskedInput.js +64 -51
- package/dist/components/inputs/KapiNumberStepper.js +29 -29
- package/dist/components/inputs/KapiRating.js +61 -59
- package/dist/components/inputs/KapiSearchChip.js +8 -8
- package/dist/components/inputs/KapiSegmented.js +74 -64
- package/dist/components/inputs/KapiSelect.js +232 -222
- 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 +83 -81
- package/dist/components/inputs/KapiTextarea.js +8 -8
- package/dist/components/inputs/misuseWarnings.d.ts +37 -0
- package/dist/components/inputs/misuseWarnings.js +36 -0
- package/dist/components/inputs/numberStepLogic.d.ts +10 -0
- package/dist/components/inputs/numberStepLogic.js +16 -7
- package/dist/components/inputs/ownField.js +4 -4
- package/dist/components/layout/KapiAccountMenu.d.ts +2 -1
- package/dist/components/layout/KapiAccountMenu.js +53 -53
- 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/CtxSlidingList.js +4 -4
- 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 +63 -55
- package/dist/components/navigation/KapiTree.js +75 -75
- 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 +18 -18
- package/dist/components/overlays/KapiDialogHost.js +22 -22
- package/dist/components/overlays/KapiLoading.js +16 -16
- package/dist/components/overlays/KapiMenuButton.js +15 -15
- 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 +15 -15
- package/dist/components/overlays/KapiPopover.d.ts +2 -1
- package/dist/components/overlays/KapiPopover.js +10 -10
- package/dist/components/overlays/KapiShapeSheet.js +20 -20
- package/dist/components/overlays/KapiSplitModal.js +29 -29
- package/dist/components/overlays/KapiTooltip.js +21 -21
- package/dist/components/overlays/menuList.js +60 -60
- package/dist/components/renderSlot.d.ts +27 -0
- package/dist/components/renderSlot.js +23 -0
- package/dist/css/components/chat/chat.css +1 -1
- package/dist/hooks/portalRoot.js +6 -6
- package/dist/hooks/useControllableState.d.ts +6 -2
- package/dist/hooks/useControllableState.js +14 -11
- package/dist/hooks/useFormReset.d.ts +22 -0
- package/dist/hooks/useFormReset.js +17 -0
- package/dist/index.d.ts +2 -0
- package/dist/kapi.css +1 -1
- package/dist/kapi.layered.css +1 -1
- package/package.json +5 -2
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/overlays/overlays.css";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { joinClasses as e } from "../rootProps.js";
|
|
4
|
+
import { useLabels as t } from "../locale/KapiLocaleProvider.js";
|
|
5
5
|
import { computedStyleOf as n } from "../../hooks/ownerDocument.js";
|
|
6
6
|
import { resolveKapiRoot as r } from "../../hooks/kapiRoot.js";
|
|
7
7
|
import { onViewportChange as i } from "../../hooks/rafThrottle.js";
|
|
8
|
-
/* empty css */
|
|
9
8
|
import { useMergedRefs as a } from "../../hooks/mergeRefs.js";
|
|
9
|
+
/* empty css */
|
|
10
10
|
import { KapiOverlayPortal as o } from "./overlayPortal.js";
|
|
11
11
|
import { prefersReducedMotion as s } from "../../hooks/reducedMotion.js";
|
|
12
12
|
import { trapTabKey as c } from "../../hooks/focusLogic.js";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
13
|
+
import { useEffect as l, useLayoutEffect as u, useReducer as d, useRef as f, useState as p } from "react";
|
|
14
|
+
import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
15
15
|
//#region src/components/overlays/KapiPhotoView.tsx
|
|
16
16
|
var _ = { viewer: "Foto ampliada" }, v = 92, y = 24, b = .42, x = (e, t) => {
|
|
17
17
|
switch (t) {
|
|
@@ -44,7 +44,7 @@ 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 = t("photoView", _, O), P = f(null), F = a(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;
|
|
@@ -55,24 +55,24 @@ var _ = { viewer: "Foto ampliada" }, v = 92, y = 24, b = .42, x = (e, t) => {
|
|
|
55
55
|
}, q = (e) => {
|
|
56
56
|
e.stopPropagation(), z("close");
|
|
57
57
|
};
|
|
58
|
-
|
|
58
|
+
u(() => {
|
|
59
59
|
if (R !== "opening") return;
|
|
60
60
|
let e = requestAnimationFrame(() => z("ready"));
|
|
61
61
|
return () => cancelAnimationFrame(e);
|
|
62
62
|
}, [R]);
|
|
63
63
|
let J = R === "closed";
|
|
64
|
-
|
|
64
|
+
l(() => {
|
|
65
65
|
if (!J) return i(() => {
|
|
66
66
|
let e = P.current;
|
|
67
67
|
if (!e) return;
|
|
68
68
|
let t = e.getBoundingClientRect();
|
|
69
69
|
V((e) => w(e, t) ? e : t);
|
|
70
70
|
});
|
|
71
|
-
}, [J]),
|
|
71
|
+
}, [J]), l(() => {
|
|
72
72
|
if (R !== "closing") return;
|
|
73
73
|
let e = window.setTimeout(() => z("end"), S(s(P.current)));
|
|
74
74
|
return () => window.clearTimeout(e);
|
|
75
|
-
}, [R]),
|
|
75
|
+
}, [R]), u(() => {
|
|
76
76
|
R === "closed" ? (V(null), G(null), L.current && P.current?.focus(), L.current = !1) : R === "opening" && (L.current = !0, I.current?.focus());
|
|
77
77
|
}, [R]);
|
|
78
78
|
let Y = T(R, B, typeof window > "u" ? {
|
|
@@ -82,19 +82,19 @@ var _ = { viewer: "Foto ampliada" }, v = 92, y = 24, b = .42, x = (e, t) => {
|
|
|
82
82
|
width: window.innerWidth,
|
|
83
83
|
height: window.innerHeight
|
|
84
84
|
}, H);
|
|
85
|
-
return /* @__PURE__ */
|
|
85
|
+
return /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("button", {
|
|
86
86
|
ref: F,
|
|
87
87
|
type: "button",
|
|
88
88
|
onClick: K,
|
|
89
89
|
id: j,
|
|
90
|
-
className:
|
|
90
|
+
className: e("kapi-photo-thumb", k),
|
|
91
91
|
style: A,
|
|
92
92
|
"aria-label": D,
|
|
93
93
|
"aria-haspopup": "dialog",
|
|
94
94
|
children: v
|
|
95
|
-
}), R !== "closed" && /* @__PURE__ */
|
|
95
|
+
}), R !== "closed" && /* @__PURE__ */ h(o, {
|
|
96
96
|
root: W,
|
|
97
|
-
children: /* @__PURE__ */
|
|
97
|
+
children: /* @__PURE__ */ h("div", {
|
|
98
98
|
ref: I,
|
|
99
99
|
className: `kapi-photo-overlay${R === "open" ? " is-open" : ""}`,
|
|
100
100
|
role: "dialog",
|
|
@@ -105,7 +105,7 @@ var _ = { viewer: "Foto ampliada" }, v = 92, y = 24, b = .42, x = (e, t) => {
|
|
|
105
105
|
onKeyDown: (e) => {
|
|
106
106
|
e.key === "Escape" ? (e.preventDefault(), q(e)) : c(e, I.current);
|
|
107
107
|
},
|
|
108
|
-
children: /* @__PURE__ */
|
|
108
|
+
children: /* @__PURE__ */ h("div", {
|
|
109
109
|
className: "kapi-photo-fly",
|
|
110
110
|
style: {
|
|
111
111
|
...Y,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type CSSProperties, type ReactNode, type Ref, type RefObject } from "react";
|
|
2
|
+
import type { KapiCloseReason } from "../closeReason.js";
|
|
2
3
|
import type { KapiPopoverAlign, KapiPopoverSide } from "./popoverLogic.js";
|
|
3
4
|
export type KapiPopoverProps = {
|
|
4
5
|
/** Muestra u oculta el popover (controlado). */
|
|
@@ -6,7 +7,7 @@ export type KapiPopoverProps = {
|
|
|
6
7
|
/** Elemento al que se ancla. */
|
|
7
8
|
anchorRef: RefObject<HTMLElement | null>;
|
|
8
9
|
/** Pedido de cierre: Escape o click afuera (si están habilitados). El padre pone `open={false}`. */
|
|
9
|
-
onClose: () => void;
|
|
10
|
+
onClose: (reason: KapiCloseReason) => void;
|
|
10
11
|
/** Lado preferido; da vuelta solo si no entra. Default `"bottom"`. */
|
|
11
12
|
side?: KapiPopoverSide | undefined;
|
|
12
13
|
/** Default `"start"`. */
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
import "#kapi-css/components/overlays/KapiPopover.css";
|
|
3
3
|
import { resolveKapiRoot as e } from "../../hooks/kapiRoot.js";
|
|
4
4
|
import { usePlacement as t } from "../../hooks/usePlacement.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { useMergedRefs as n } from "../../hooks/mergeRefs.js";
|
|
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";
|
|
9
9
|
/* empty css */
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { useLayoutEffect as o, useRef as s, useState as c } from "react";
|
|
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 =
|
|
15
|
-
|
|
14
|
+
let O = s(null), k = n(O, C), [A, j] = c(null), { present: M, closing: N } = a(u, O);
|
|
15
|
+
o(() => {
|
|
16
16
|
j(M ? e(d.current) : null);
|
|
17
17
|
}, [M, d]);
|
|
18
18
|
let { placement: P, style: F } = t({
|
|
@@ -25,17 +25,17 @@ function u({ open: u, anchorRef: d, onClose: f, side: p = "bottom", align: m = "
|
|
|
25
25
|
offset: h,
|
|
26
26
|
margin: g,
|
|
27
27
|
width: _ ? "min-anchor" : "content"
|
|
28
|
-
}), I =
|
|
28
|
+
}), I = r(u, {
|
|
29
29
|
zones: [O, d],
|
|
30
30
|
escape: w,
|
|
31
31
|
outside: T,
|
|
32
32
|
onDismiss: (e) => {
|
|
33
|
-
f?.(), e === "escape" && E && d.current?.focus();
|
|
33
|
+
f?.(e), e === "escape" && E && d.current?.focus();
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
|
-
return M ? /* @__PURE__ */
|
|
36
|
+
return M ? /* @__PURE__ */ l(i, {
|
|
37
37
|
root: A,
|
|
38
|
-
children: /* @__PURE__ */
|
|
38
|
+
children: /* @__PURE__ */ l("div", {
|
|
39
39
|
ref: k,
|
|
40
40
|
id: b,
|
|
41
41
|
role: v,
|
|
@@ -1,47 +1,47 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/overlays/overlays.css";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { joinClasses as e } from "../rootProps.js";
|
|
4
|
+
import { useLabels as t } from "../locale/KapiLocaleProvider.js";
|
|
5
5
|
import { useControllableState as n } from "../../hooks/useControllableState.js";
|
|
6
|
-
import {
|
|
6
|
+
import { useMergedRefs as r } from "../../hooks/mergeRefs.js";
|
|
7
|
+
import { useDismiss as i } from "../../hooks/useDismiss.js";
|
|
7
8
|
/* empty css */
|
|
8
|
-
import { useMergedRefs as i } from "../../hooks/mergeRefs.js";
|
|
9
9
|
import { focusableWithin as a } from "../../hooks/focusLogic.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { useEffect as o, useId as s, useRef as c } from "react";
|
|
11
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
12
12
|
import { Minus as d, Plus as f } from "lucide-react";
|
|
13
13
|
//#region src/components/overlays/KapiShapeSheet.tsx
|
|
14
14
|
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 = t("shapeSheet", p, y), O = c(null), k = r(O, C), A = c(null), j = c(null), M = c(null), N = s(), [P, F] = n(w, T, E), I = c(P);
|
|
19
19
|
I.current = P;
|
|
20
20
|
let L = (e) => {
|
|
21
21
|
e !== I.current && F(e);
|
|
22
|
-
}, R =
|
|
22
|
+
}, R = c(!1), z = () => {
|
|
23
23
|
R.current = !0, L(!1);
|
|
24
24
|
};
|
|
25
|
-
|
|
25
|
+
o(() => {
|
|
26
26
|
P ? (a(M.current)[0] ?? j.current)?.focus() : R.current && (R.current = !1, A.current?.focus());
|
|
27
27
|
}, [P]);
|
|
28
|
-
let B =
|
|
28
|
+
let B = i(P, {
|
|
29
29
|
zones: [O],
|
|
30
30
|
onDismiss: (e) => {
|
|
31
31
|
e === "escape" && (R.current = !0), L(!1);
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
|
-
return /* @__PURE__ */
|
|
34
|
+
return /* @__PURE__ */ u("div", {
|
|
35
35
|
ref: k,
|
|
36
36
|
id: S,
|
|
37
|
-
className:
|
|
37
|
+
className: e("kapi-shape", P && "kapi-shape--open", b),
|
|
38
38
|
style: P ? {
|
|
39
39
|
...x,
|
|
40
40
|
width: g,
|
|
41
41
|
height: _
|
|
42
42
|
} : x,
|
|
43
43
|
onKeyDown: B,
|
|
44
|
-
children: [/* @__PURE__ */
|
|
44
|
+
children: [/* @__PURE__ */ l("button", {
|
|
45
45
|
ref: A,
|
|
46
46
|
type: "button",
|
|
47
47
|
className: "kapi-shape__fab",
|
|
@@ -49,34 +49,34 @@ var p = {
|
|
|
49
49
|
onClick: () => L(!0),
|
|
50
50
|
"aria-expanded": P,
|
|
51
51
|
"aria-label": v ?? D.open,
|
|
52
|
-
children: /* @__PURE__ */
|
|
52
|
+
children: /* @__PURE__ */ l(f, {
|
|
53
53
|
size: 22,
|
|
54
54
|
strokeWidth: 2.4
|
|
55
55
|
})
|
|
56
|
-
}), /* @__PURE__ */
|
|
56
|
+
}), /* @__PURE__ */ u("div", {
|
|
57
57
|
ref: j,
|
|
58
58
|
className: "kapi-shape__sheet",
|
|
59
59
|
inert: !P,
|
|
60
60
|
role: "dialog",
|
|
61
61
|
"aria-labelledby": N,
|
|
62
62
|
tabIndex: -1,
|
|
63
|
-
children: [/* @__PURE__ */
|
|
63
|
+
children: [/* @__PURE__ */ u("div", {
|
|
64
64
|
className: "kapi-shape__head",
|
|
65
|
-
children: [/* @__PURE__ */
|
|
65
|
+
children: [/* @__PURE__ */ l("span", {
|
|
66
66
|
className: "kapi-shape__title",
|
|
67
67
|
id: N,
|
|
68
68
|
children: m
|
|
69
|
-
}), /* @__PURE__ */
|
|
69
|
+
}), /* @__PURE__ */ l("button", {
|
|
70
70
|
type: "button",
|
|
71
71
|
className: "kapi-shape__close",
|
|
72
72
|
onClick: z,
|
|
73
73
|
"aria-label": D.close,
|
|
74
|
-
children: /* @__PURE__ */
|
|
74
|
+
children: /* @__PURE__ */ l(d, {
|
|
75
75
|
size: 16,
|
|
76
76
|
strokeWidth: 2.4
|
|
77
77
|
})
|
|
78
78
|
})]
|
|
79
|
-
}), /* @__PURE__ */
|
|
79
|
+
}), /* @__PURE__ */ l("div", {
|
|
80
80
|
className: "kapi-shape__body",
|
|
81
81
|
ref: M,
|
|
82
82
|
children: h
|
|
@@ -8,8 +8,8 @@ import { useBackdropClose as a, useNativeDialog as o, usePortalRoot as s, useTra
|
|
|
8
8
|
/* empty css */
|
|
9
9
|
import { resolveAsideWidth as l, resolvePanelOrder as u, splitModalClasses as d } from "./splitModalLayout.js";
|
|
10
10
|
/* empty css */
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { useId as f, useRef as p } from "react";
|
|
12
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
13
13
|
import { X as g } from "lucide-react";
|
|
14
14
|
import { createPortal as _ } from "react-dom";
|
|
15
15
|
//#region src/components/overlays/KapiSplitModal.tsx
|
|
@@ -17,99 +17,99 @@ var v = {
|
|
|
17
17
|
close: "Cerrar",
|
|
18
18
|
closePanel: "Cerrar panel"
|
|
19
19
|
}, y = ({ open: e, ...t }) => {
|
|
20
|
-
let n =
|
|
21
|
-
return r ? /* @__PURE__ */
|
|
20
|
+
let n = p(null), { present: r, closing: a } = i(e, n);
|
|
21
|
+
return r ? /* @__PURE__ */ m(x, {
|
|
22
22
|
...t,
|
|
23
23
|
dialogRef: n,
|
|
24
24
|
closing: a
|
|
25
25
|
}) : null;
|
|
26
|
-
}, b = () => {}, x = ({ title: i, subtitle:
|
|
27
|
-
let z = R ? b : y, B =
|
|
26
|
+
}, b = () => {}, x = ({ title: i, subtitle: p, onClose: y, children: x, footer: S, size: C = "md", hideHeader: w = !1, className: T = "", style: E, id: D, ref: O, closeOnBackdrop: ee, closeOnEscape: k, closeButton: A, dismissible: j, closeLabel: M, labels: N, "aria-label": P, "aria-labelledby": F, aside: I, dialogRef: L, closing: R }) => {
|
|
27
|
+
let z = R ? b : y, B = f(), V = f(), H = r({
|
|
28
28
|
dismissible: j,
|
|
29
29
|
closeOnEscape: k,
|
|
30
30
|
closeOnBackdrop: ee,
|
|
31
31
|
closeButton: A
|
|
32
|
-
}), { closeOnEscape: U, closeOnBackdrop: W, closeButton: G } = H, { ref: K, dialogProps: q } = o({ onRequestClose: U ? z : void 0 }), J = a(W ? z : void 0);
|
|
32
|
+
}), { closeOnEscape: U, closeOnBackdrop: W, closeButton: G } = H, { ref: K, dialogProps: q } = o({ onRequestClose: U ? () => z("escape") : void 0 }), J = a(W ? () => z("backdrop") : void 0);
|
|
33
33
|
c("KapiSplitModal", H, K);
|
|
34
34
|
let Y = e("splitModal", v, N), X = M ?? Y.close, Z = s();
|
|
35
35
|
if (!Z) return null;
|
|
36
|
-
let Q = I?.open === !0, $ = I?.side ?? "left", te = /* @__PURE__ */
|
|
36
|
+
let Q = I?.open === !0, $ = I?.side ?? "left", te = /* @__PURE__ */ h("div", {
|
|
37
37
|
ref: O,
|
|
38
38
|
id: D,
|
|
39
39
|
className: n(C, T),
|
|
40
40
|
style: E,
|
|
41
41
|
children: [
|
|
42
|
-
w ? G && /* @__PURE__ */
|
|
42
|
+
w ? G && /* @__PURE__ */ m("button", {
|
|
43
43
|
type: "button",
|
|
44
44
|
className: "kapi-modal__x kapi-modal__x--float",
|
|
45
|
-
onClick: z,
|
|
45
|
+
onClick: () => z("close-button"),
|
|
46
46
|
"aria-label": X,
|
|
47
|
-
children: /* @__PURE__ */
|
|
47
|
+
children: /* @__PURE__ */ m(g, {
|
|
48
48
|
size: 17,
|
|
49
49
|
strokeWidth: 2.2
|
|
50
50
|
})
|
|
51
|
-
}) : /* @__PURE__ */
|
|
51
|
+
}) : /* @__PURE__ */ h("div", {
|
|
52
52
|
className: "kapi-modal__head",
|
|
53
|
-
children: [/* @__PURE__ */
|
|
53
|
+
children: [/* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("div", {
|
|
54
54
|
id: B,
|
|
55
55
|
className: "kapi-modal__title",
|
|
56
56
|
children: i
|
|
57
|
-
}),
|
|
57
|
+
}), p && /* @__PURE__ */ m("div", {
|
|
58
58
|
className: "kapi-modal__sub",
|
|
59
|
-
children:
|
|
60
|
-
})] }), G && /* @__PURE__ */
|
|
59
|
+
children: p
|
|
60
|
+
})] }), G && /* @__PURE__ */ m("button", {
|
|
61
61
|
type: "button",
|
|
62
62
|
className: "kapi-modal__x",
|
|
63
|
-
onClick: z,
|
|
63
|
+
onClick: () => z("close-button"),
|
|
64
64
|
"aria-label": X,
|
|
65
|
-
children: /* @__PURE__ */
|
|
65
|
+
children: /* @__PURE__ */ m(g, {
|
|
66
66
|
size: 17,
|
|
67
67
|
strokeWidth: 2.2
|
|
68
68
|
})
|
|
69
69
|
})]
|
|
70
70
|
}),
|
|
71
|
-
/* @__PURE__ */
|
|
71
|
+
/* @__PURE__ */ m("div", {
|
|
72
72
|
className: "kapi-modal__body",
|
|
73
73
|
children: x
|
|
74
74
|
}),
|
|
75
|
-
S && /* @__PURE__ */
|
|
75
|
+
S && /* @__PURE__ */ m("div", {
|
|
76
76
|
className: "kapi-modal__foot",
|
|
77
77
|
children: S
|
|
78
78
|
})
|
|
79
79
|
]
|
|
80
|
-
}, "main"), ne = I && Q ? /* @__PURE__ */
|
|
80
|
+
}, "main"), ne = I && Q ? /* @__PURE__ */ h("aside", {
|
|
81
81
|
className: "kapi-splitmodal__aside",
|
|
82
82
|
style: { "--kapi-split-aside-w": l(I.width) },
|
|
83
83
|
"aria-labelledby": I.title ? V : void 0,
|
|
84
84
|
children: [
|
|
85
|
-
(I.title || I.onClose) && /* @__PURE__ */
|
|
85
|
+
(I.title || I.onClose) && /* @__PURE__ */ h("div", {
|
|
86
86
|
className: "kapi-modal__head",
|
|
87
|
-
children: [/* @__PURE__ */
|
|
87
|
+
children: [/* @__PURE__ */ m("div", {
|
|
88
88
|
id: V,
|
|
89
89
|
className: "kapi-modal__title",
|
|
90
90
|
children: I.title
|
|
91
|
-
}), I.onClose && /* @__PURE__ */
|
|
91
|
+
}), I.onClose && /* @__PURE__ */ m("button", {
|
|
92
92
|
type: "button",
|
|
93
93
|
className: "kapi-modal__x",
|
|
94
94
|
onClick: I.onClose,
|
|
95
95
|
"aria-label": I.closeLabel ?? Y.closePanel,
|
|
96
|
-
children: /* @__PURE__ */
|
|
96
|
+
children: /* @__PURE__ */ m(g, {
|
|
97
97
|
size: 17,
|
|
98
98
|
strokeWidth: 2.2
|
|
99
99
|
})
|
|
100
100
|
})]
|
|
101
101
|
}),
|
|
102
|
-
/* @__PURE__ */
|
|
102
|
+
/* @__PURE__ */ m("div", {
|
|
103
103
|
className: "kapi-modal__body",
|
|
104
104
|
children: I.children
|
|
105
105
|
}),
|
|
106
|
-
I.footer && /* @__PURE__ */
|
|
106
|
+
I.footer && /* @__PURE__ */ m("div", {
|
|
107
107
|
className: "kapi-modal__foot",
|
|
108
108
|
children: I.footer
|
|
109
109
|
})
|
|
110
110
|
]
|
|
111
111
|
}, "aside") : null, re = u($).map((e) => e === "main" ? te : ne).filter((e) => e !== null);
|
|
112
|
-
return _(/* @__PURE__ */
|
|
112
|
+
return _(/* @__PURE__ */ m("dialog", {
|
|
113
113
|
ref: (e) => {
|
|
114
114
|
K.current = e, L.current = e;
|
|
115
115
|
},
|
|
@@ -125,7 +125,7 @@ var v = {
|
|
|
125
125
|
}),
|
|
126
126
|
...q,
|
|
127
127
|
...J,
|
|
128
|
-
children: /* @__PURE__ */
|
|
128
|
+
children: /* @__PURE__ */ m("div", {
|
|
129
129
|
className: Q ? d($) : "kapi-splitmodal kapi-splitmodal--single",
|
|
130
130
|
children: re
|
|
131
131
|
})
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/overlays/overlays.css";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { joinClasses as e } from "../rootProps.js";
|
|
4
|
+
import { joinIds as t } from "../inputs/fieldLogic.js";
|
|
5
|
+
import { useKapiDir as n } from "../locale/KapiLocaleProvider.js";
|
|
6
6
|
import { winOf as r } from "../../hooks/ownerDocument.js";
|
|
7
7
|
import { placePopover as i } from "./popoverLogic.js";
|
|
8
8
|
import { onViewportChange as a } from "../../hooks/rafThrottle.js";
|
|
9
9
|
import { placementViewport as o } from "../../hooks/viewportInsetLogic.js";
|
|
10
10
|
import { resolveDirection as s } from "../../hooks/directionLogic.js";
|
|
11
|
-
/* empty css */
|
|
12
11
|
import { useMergedRefs as c } from "../../hooks/mergeRefs.js";
|
|
13
|
-
|
|
14
|
-
import { cloneElement as
|
|
12
|
+
/* empty css */
|
|
13
|
+
import { cloneElement as l, isValidElement as u, useEffect as d, useId as f, useLayoutEffect as p, useRef as m, useState as h } from "react";
|
|
14
|
+
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
15
15
|
//#region src/components/overlays/KapiTooltip.tsx
|
|
16
16
|
var v = 280, y = 7, b = 28, x = 12, S = 44, C = (e, t) => e === "end" ? t === "rtl" ? "left" : "right" : e === "start" ? t === "rtl" ? "right" : "left" : e, w = (e) => Math.min(v, String(e).length * y + b), T = (e, t, n, r, a = Infinity) => {
|
|
17
17
|
let o = t.bottom ?? t.top, s = t.left ?? t.right, c = {
|
|
@@ -68,20 +68,20 @@ var v = 280, y = 7, b = 28, x = 12, S = 44, C = (e, t) => e === "end" ? t === "r
|
|
|
68
68
|
} catch {
|
|
69
69
|
return null;
|
|
70
70
|
}
|
|
71
|
-
}, j = (
|
|
72
|
-
let w =
|
|
71
|
+
}, j = (e, n) => t(typeof e == "string" ? e : void 0, n), M = ({ label: t, children: i, prefer: v = "end", className: y, style: b, id: x, ref: S }) => {
|
|
72
|
+
let w = f(), E = m(null), D = c(E, S), O = n(), [M, N] = h(() => C(v, s(null, O))), [P, F] = h(!1), [I, L] = h(!1), R = m({
|
|
73
73
|
hover: !1,
|
|
74
74
|
focus: !1
|
|
75
75
|
}), z = () => {
|
|
76
|
-
let
|
|
77
|
-
if (!
|
|
78
|
-
let n =
|
|
79
|
-
|
|
80
|
-
}, B =
|
|
81
|
-
|
|
76
|
+
let e = E.current;
|
|
77
|
+
if (!e) return;
|
|
78
|
+
let n = e.getBoundingClientRect(), r = o(e), i = T(C(v, s(e, O)), n, t, r.width, r.height), { x: a, y: c } = k(i, n);
|
|
79
|
+
e.style.setProperty("--kapi-tip-x", `${Math.round(a)}px`), e.style.setProperty("--kapi-tip-y", `${Math.round(c)}px`), N(i);
|
|
80
|
+
}, B = m(z);
|
|
81
|
+
p(() => {
|
|
82
82
|
B.current = z;
|
|
83
83
|
});
|
|
84
|
-
let V =
|
|
84
|
+
let V = m(null), H = m(!1), U = (e) => {
|
|
85
85
|
let t = V.current;
|
|
86
86
|
if (!t || typeof t.showPopover != "function") return;
|
|
87
87
|
let n = A(t, ":popover-open") ?? H.current;
|
|
@@ -91,17 +91,17 @@ var v = 280, y = 7, b = 28, x = 12, S = 44, C = (e, t) => e === "end" ? t === "r
|
|
|
91
91
|
}, G = (e) => {
|
|
92
92
|
R.current[e] = !1, !(R.current.hover || R.current.focus) && (F(!1), L(!1), U(!1));
|
|
93
93
|
};
|
|
94
|
-
|
|
94
|
+
d(() => {
|
|
95
95
|
if (!I) return;
|
|
96
96
|
let e = r(E.current);
|
|
97
97
|
return a(() => B.current(), e ? { target: e } : {});
|
|
98
98
|
}, [I]);
|
|
99
99
|
let K = (e) => {
|
|
100
100
|
e.key === "Escape" && !P && F(!0);
|
|
101
|
-
}, q =
|
|
102
|
-
return /* @__PURE__ */
|
|
101
|
+
}, q = u(i) ? i : null, J = q ? l(q, { "aria-describedby": j(q.props["aria-describedby"], w) }) : i;
|
|
102
|
+
return /* @__PURE__ */ _("span", {
|
|
103
103
|
id: x,
|
|
104
|
-
className:
|
|
104
|
+
className: e("kapi-tip", y),
|
|
105
105
|
style: b,
|
|
106
106
|
ref: D,
|
|
107
107
|
"data-side": M,
|
|
@@ -114,13 +114,13 @@ var v = 280, y = 7, b = 28, x = 12, S = 44, C = (e, t) => e === "end" ? t === "r
|
|
|
114
114
|
onMouseLeave: () => G("hover"),
|
|
115
115
|
onBlur: () => G("focus"),
|
|
116
116
|
onKeyDown: K,
|
|
117
|
-
children: [J, /* @__PURE__ */
|
|
117
|
+
children: [J, /* @__PURE__ */ g("span", {
|
|
118
118
|
ref: V,
|
|
119
119
|
className: "kapi-tip__bubble",
|
|
120
120
|
role: "tooltip",
|
|
121
121
|
id: w,
|
|
122
122
|
popover: "manual",
|
|
123
|
-
children:
|
|
123
|
+
children: t
|
|
124
124
|
})]
|
|
125
125
|
});
|
|
126
126
|
};
|