@kapiuara/ui 0.8.0 → 0.10.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 +67 -2
- package/dist/components/data/KapiPagination.d.ts +13 -4
- package/dist/components/data/KapiPagination.js +31 -88
- package/dist/components/data/KapiPaginationFooter.d.ts +35 -0
- package/dist/components/data/KapiPaginationFooter.js +106 -0
- package/dist/components/data/KapiTable.d.ts +39 -5
- package/dist/components/data/KapiTable.js +280 -321
- package/dist/components/feedback/KapiBulkBar.d.ts +1 -1
- package/dist/components/layout/KapiContextSlot.d.ts +34 -6
- package/dist/components/layout/KapiContextSlot.js +115 -71
- package/dist/components/layout/KapiPageHeader.js +110 -25
- package/dist/components/layout/pageHeaderLogic.d.ts +38 -0
- package/dist/components/layout/pageHeaderLogic.js +18 -0
- package/dist/components/navigation/panelMiniLogic.d.ts +10 -1
- package/dist/components/navigation/panelMiniLogic.js +2 -2
- package/dist/components/overlays/KapiOffcanvas.js +124 -118
- package/dist/hooks/index.d.ts +3 -1
- package/dist/hooks/themeDeriveLogic.d.ts +17 -0
- package/dist/hooks/themeDeriveLogic.js +61 -32
- package/dist/hooks/themeRadiiLogic.d.ts +11 -0
- package/dist/hooks/themeRadiiLogic.js +32 -0
- package/dist/hooks/useKapiTheme.d.ts +10 -3
- package/dist/hooks/useKapiTheme.js +66 -57
- package/dist/hooks/useWheelZoom.d.ts +30 -0
- package/dist/hooks/useWheelZoom.js +27 -0
- package/dist/hooks/wheelZoomLogic.d.ts +18 -0
- package/dist/hooks/wheelZoomLogic.js +9 -0
- package/dist/index.js +9 -8
- package/dist/kapi.css +1 -1
- package/dist/kapi.layered.css +1 -1
- package/package.json +2 -2
|
@@ -7,7 +7,7 @@ export type KapiBulkBarProps = Omit<HTMLAttributes<HTMLDivElement>, "children" |
|
|
|
7
7
|
count: number;
|
|
8
8
|
/** Vacía la selección. */
|
|
9
9
|
onClear: () => void;
|
|
10
|
-
/** Botones de acción masiva. */
|
|
10
|
+
/** Botones de acción masiva. La barra es una superficie densa: su propio "Limpiar" es `size="sm"`, así que las acciones van en `sm` para quedar a la misma altura (32px). */
|
|
11
11
|
children?: ReactNode;
|
|
12
12
|
/** Texto del botón de limpiar. Gana sobre `labels.clear` ("Limpiar"). */
|
|
13
13
|
clearLabel?: string;
|
|
@@ -20,11 +20,38 @@ export type KapiContextSlotProps = KapiRootProps & {
|
|
|
20
20
|
/** Lado del contenido donde se ubica el panel. Por defecto "left". */
|
|
21
21
|
side?: "left" | "right";
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
23
|
+
* Qué queda al plegar en desktop: `hidden` (default) deja el botón de reabrir; `mini` deja una tira de íconos
|
|
24
|
+
* (los `KapiPanelItem`, ítems de `KapiContextSections` y cabeceras de `KapiPanelGroup`) con tooltip y avisos;
|
|
25
|
+
* `none` no deja nada (ni tira, ni botón, ancho 0). CUIDADO con `none`: con `open` sin controlar, al plegar el
|
|
26
|
+
* panel no hay forma de volver a abrirlo; exige `open` + `onOpenChange` y un gesto propio para reabrir. En
|
|
27
|
+
* móvil siempre es un drawer y el modo no aplica.
|
|
26
28
|
*/
|
|
27
|
-
collapsedMode?: KapiPanelCollapsedMode | undefined;
|
|
29
|
+
collapsedMode?: KapiPanelCollapsedMode | "none" | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Muestra un separador para cambiar el ancho del panel en desktop, con el puntero o con las flechas. En móvil
|
|
32
|
+
* (drawer) no aplica. Solo actúa con el panel desplegado.
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
resizable?: boolean | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Ancho en px (estado controlado), acotado entre `minWidth` y `maxWidth`. Si se omite, el slot maneja su
|
|
38
|
+
* propio ancho. En móvil el drawer ignora el ancho.
|
|
39
|
+
*/
|
|
40
|
+
width?: number | undefined;
|
|
41
|
+
/** Ancho inicial en px no controlado. Por defecto: 258. */
|
|
42
|
+
defaultWidth?: number | undefined;
|
|
43
|
+
/** Se llama con el ancho nuevo en px, ya acotado, en cada paso del arrastre o del teclado. */
|
|
44
|
+
onWidthChange?: ((width: number) => void) | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Ancho mínimo en px.
|
|
47
|
+
* @default 200
|
|
48
|
+
*/
|
|
49
|
+
minWidth?: number | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Ancho máximo en px.
|
|
52
|
+
* @default 420
|
|
53
|
+
*/
|
|
54
|
+
maxWidth?: number | undefined;
|
|
28
55
|
/** Nombre accesible del `<aside>` del panel; gana sobre `labels.region`. */
|
|
29
56
|
"aria-label"?: string;
|
|
30
57
|
/** Textos de plegar/desplegar. */
|
|
@@ -35,11 +62,12 @@ export type KapiContextSlotProps = KapiRootProps & {
|
|
|
35
62
|
* animación (258px ↔ 44px con botón de reabrir). Móvil: drawer superpuesto con backdrop.
|
|
36
63
|
* Funciona con o sin rail: no depende de él.
|
|
37
64
|
*/
|
|
38
|
-
/** `region` es el nombre del panel (sin `aria-label`)
|
|
65
|
+
/** `region` es el nombre del panel (sin `aria-label`); `resize`, el del separador de `resizable`. */
|
|
39
66
|
export type KapiContextSlotLabels = {
|
|
40
67
|
collapse: string;
|
|
41
68
|
expand: string;
|
|
42
69
|
region: string;
|
|
70
|
+
resize: string;
|
|
43
71
|
};
|
|
44
72
|
export declare const DEFAULT_CONTEXT_SLOT_LABELS: KapiContextSlotLabels;
|
|
45
|
-
export declare const KapiContextSlot: ({ title, actions, children, open, defaultOpen, onOpenChange, side, collapsedMode, "aria-label": ariaLabelProp, labels, className, style, id }: KapiContextSlotProps) => import("react").JSX.Element;
|
|
73
|
+
export declare const KapiContextSlot: ({ title, actions, children, open, defaultOpen, onOpenChange, side, collapsedMode, resizable, width, defaultWidth, onWidthChange, minWidth, maxWidth, "aria-label": ariaLabelProp, labels, className, style, id }: KapiContextSlotProps) => import("react").JSX.Element;
|
|
@@ -1,90 +1,134 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useLabels as e } from "../locale/KapiLocaleProvider.js";
|
|
3
3
|
import { joinClasses as t } from "../rootProps.js";
|
|
4
|
+
import { clampCtxPanelWidth as n, ctxPanelWidthFromDrag as r, stepCtxPanelWidth as ee } from "../navigation/contextPanelLogic.js";
|
|
4
5
|
/* empty css */
|
|
5
|
-
import { KapiPanelMiniContext as
|
|
6
|
-
import { resolveMini as
|
|
7
|
-
import { SHELL_MOBILE_QUERY as
|
|
8
|
-
import { openOnBreakpointCross as
|
|
9
|
-
import { Fragment as
|
|
10
|
-
import { useCallback as
|
|
6
|
+
import { KapiPanelMiniContext as i } from "../navigation/panelMini.js";
|
|
7
|
+
import { resolveGone as a, resolveMini as o } from "../navigation/panelMiniLogic.js";
|
|
8
|
+
import { SHELL_MOBILE_QUERY as te, matchesQuery as ne, useMediaQuery as s } from "../../hooks/useMediaQuery.js";
|
|
9
|
+
import { openOnBreakpointCross as c } from "../../hooks/breakpointOpenLogic.js";
|
|
10
|
+
import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
11
|
+
import { useCallback as f, useEffect as p, useMemo as re, useRef as m, useState as h } from "react";
|
|
11
12
|
import { ChevronsLeft as g, ChevronsRight as _ } from "lucide-react";
|
|
12
13
|
//#region src/components/layout/KapiContextSlot.tsx
|
|
13
14
|
var v = {
|
|
14
15
|
collapse: "Plegar panel",
|
|
15
16
|
expand: "Desplegar panel",
|
|
16
|
-
region: "Panel contextual"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
region: "Panel contextual",
|
|
18
|
+
resize: "Redimensionar panel"
|
|
19
|
+
}, y = ({ title: y, actions: ie, children: b, open: x, defaultOpen: S, onOpenChange: C, side: w = "left", collapsedMode: T = "hidden", resizable: ae = !1, width: E, defaultWidth: oe, onWidthChange: se, minWidth: D = 200, maxWidth: O = 420, "aria-label": ce, labels: le, className: ue, style: k, id: A }) => {
|
|
20
|
+
let j = e("contextSlot", v, le), M = ce ?? j.region, N = w === "right", P = N ? _ : g, F = N ? g : _, [I, L] = h(() => S ?? !ne("(max-width: 768px)")), R = x ?? I, z = f((e) => {
|
|
21
|
+
x === void 0 && L(e), C?.(e);
|
|
22
|
+
}, [x, C]), B = s(te), V = m(B), H = m(B ? S ?? !0 : R);
|
|
23
|
+
p(() => {
|
|
24
|
+
let e = c(V.current, B, H.current);
|
|
25
|
+
V.current = B, e !== null && e !== R && z(e);
|
|
24
26
|
}, [
|
|
25
|
-
V,
|
|
26
|
-
z,
|
|
27
|
-
B
|
|
28
|
-
]), f(() => {
|
|
29
|
-
V || (U.current = z);
|
|
30
|
-
}, [V, z]);
|
|
31
|
-
let W = r({
|
|
32
|
-
collapsedMode: E,
|
|
33
|
-
open: z,
|
|
34
|
-
mobile: V
|
|
35
|
-
}), G = p(() => ({
|
|
36
|
-
mini: W,
|
|
37
|
-
expand: () => B(!0),
|
|
38
|
-
tooltipSide: P ? "left" : "right"
|
|
39
|
-
}), [
|
|
40
|
-
W,
|
|
41
27
|
B,
|
|
42
|
-
|
|
28
|
+
R,
|
|
29
|
+
z
|
|
30
|
+
]), p(() => {
|
|
31
|
+
B || (H.current = R);
|
|
32
|
+
}, [B, R]);
|
|
33
|
+
let [U, de] = h(oe ?? null), [fe, W] = h(!1), G = m(null), K = m(null), q = E ?? U, J = q === null ? null : n(q, D, O), Y = () => J ?? G.current?.offsetWidth ?? 258, X = (e) => {
|
|
34
|
+
e !== J && (E === void 0 && de(e), se?.(e));
|
|
35
|
+
}, pe = (e) => {
|
|
36
|
+
e.button === 0 && (K.current = {
|
|
37
|
+
startX: e.clientX,
|
|
38
|
+
startWidth: Y()
|
|
39
|
+
}, e.currentTarget.setPointerCapture(e.pointerId), W(!0), e.preventDefault());
|
|
40
|
+
}, me = (e) => {
|
|
41
|
+
let t = K.current;
|
|
42
|
+
t && X(r(w, t.startWidth, t.startX, e.clientX, D, O));
|
|
43
|
+
}, Z = (e) => {
|
|
44
|
+
K.current = null, e.currentTarget.hasPointerCapture(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId), W(!1);
|
|
45
|
+
}, he = (e) => {
|
|
46
|
+
let t = ee(w, Y(), e.key, D, O);
|
|
47
|
+
t !== null && (e.preventDefault(), X(t));
|
|
48
|
+
}, ge = J === null ? k : {
|
|
49
|
+
...k,
|
|
50
|
+
"--kapi-ctxslot-w": `${J}px`
|
|
51
|
+
}, Q = o({
|
|
52
|
+
collapsedMode: T,
|
|
53
|
+
open: R,
|
|
54
|
+
mobile: B
|
|
55
|
+
}), $ = a({
|
|
56
|
+
collapsedMode: T,
|
|
57
|
+
open: R,
|
|
58
|
+
mobile: B
|
|
59
|
+
}), _e = re(() => ({
|
|
60
|
+
mini: Q,
|
|
61
|
+
expand: () => z(!0),
|
|
62
|
+
tooltipSide: N ? "left" : "right"
|
|
63
|
+
}), [
|
|
64
|
+
Q,
|
|
65
|
+
z,
|
|
66
|
+
N
|
|
43
67
|
]);
|
|
44
|
-
return /* @__PURE__ */
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
className: "kapi-
|
|
52
|
-
"
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
68
|
+
return /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ d("div", {
|
|
69
|
+
ref: G,
|
|
70
|
+
id: A,
|
|
71
|
+
className: t("kapi-ctxslot", N && "kapi-ctxslot--right", !R && "is-collapsed", fe && "is-resizing", Q && "is-mini kapi-navmini", $ && "is-gone", ue),
|
|
72
|
+
style: ge,
|
|
73
|
+
children: [
|
|
74
|
+
ae && R && !B && /* @__PURE__ */ u("div", {
|
|
75
|
+
className: "kapi-ctxslot__resize",
|
|
76
|
+
role: "separator",
|
|
77
|
+
"aria-orientation": "vertical",
|
|
78
|
+
"aria-label": j.resize,
|
|
79
|
+
"aria-valuemin": D,
|
|
80
|
+
"aria-valuemax": O,
|
|
81
|
+
"aria-valuenow": n(J ?? 258, D, O),
|
|
82
|
+
tabIndex: 0,
|
|
83
|
+
onPointerDown: pe,
|
|
84
|
+
onPointerMove: me,
|
|
85
|
+
onPointerUp: Z,
|
|
86
|
+
onPointerCancel: Z,
|
|
87
|
+
onKeyDown: he
|
|
88
|
+
}),
|
|
89
|
+
/* @__PURE__ */ u("div", {
|
|
90
|
+
className: "kapi-ctxslot__inner",
|
|
91
|
+
inert: !R && !Q,
|
|
92
|
+
children: /* @__PURE__ */ d("aside", {
|
|
93
|
+
className: "kapi-ctxpanel",
|
|
94
|
+
"aria-label": M,
|
|
95
|
+
children: [/* @__PURE__ */ d("div", {
|
|
96
|
+
className: "kapi-ctxpanel__head",
|
|
97
|
+
children: [/* @__PURE__ */ u("span", { children: y }), /* @__PURE__ */ d("div", {
|
|
98
|
+
className: "kapi-ctxpanel__actions",
|
|
99
|
+
children: [ie, /* @__PURE__ */ u("button", {
|
|
100
|
+
type: "button",
|
|
101
|
+
className: "kapi-paneltoggle",
|
|
102
|
+
onClick: () => z(!1),
|
|
103
|
+
"aria-label": j.collapse,
|
|
104
|
+
children: /* @__PURE__ */ u(P, {
|
|
105
|
+
size: 16,
|
|
106
|
+
strokeWidth: 2,
|
|
107
|
+
"aria-hidden": "true"
|
|
108
|
+
})
|
|
109
|
+
})]
|
|
67
110
|
})]
|
|
111
|
+
}), /* @__PURE__ */ u(i.Provider, {
|
|
112
|
+
value: _e,
|
|
113
|
+
children: b
|
|
68
114
|
})]
|
|
69
|
-
})
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
strokeWidth: 2,
|
|
82
|
-
"aria-hidden": "true"
|
|
115
|
+
})
|
|
116
|
+
}),
|
|
117
|
+
!$ && /* @__PURE__ */ u("button", {
|
|
118
|
+
type: "button",
|
|
119
|
+
className: "kapi-paneltoggle kapi-ctxslot__reopen",
|
|
120
|
+
onClick: () => z(!0),
|
|
121
|
+
"aria-label": j.expand,
|
|
122
|
+
children: /* @__PURE__ */ u(F, {
|
|
123
|
+
size: 16,
|
|
124
|
+
strokeWidth: 2,
|
|
125
|
+
"aria-hidden": "true"
|
|
126
|
+
})
|
|
83
127
|
})
|
|
84
|
-
|
|
85
|
-
}), /* @__PURE__ */
|
|
128
|
+
]
|
|
129
|
+
}), /* @__PURE__ */ u("div", {
|
|
86
130
|
className: "kapi-ctxslot__backdrop",
|
|
87
|
-
onClick: () =>
|
|
131
|
+
onClick: () => z(!1),
|
|
88
132
|
"aria-hidden": "true"
|
|
89
133
|
})] });
|
|
90
134
|
};
|
|
@@ -1,47 +1,132 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { prefersReducedMotion as e } from "../../hooks/reducedMotion.js";
|
|
3
|
+
import { maxTransitionMs as t } from "../overlays/dialogUtils.js";
|
|
4
|
+
import { useScrollCollapse as n } from "../../hooks/useScrollCollapse.js";
|
|
5
|
+
import { pageHeaderBox as r } from "./pageHeaderLogic.js";
|
|
3
6
|
/* empty css */
|
|
4
|
-
import { Fragment as
|
|
7
|
+
import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
8
|
+
import { useLayoutEffect as s, useRef as c } from "react";
|
|
5
9
|
//#region src/components/layout/KapiPageHeader.tsx
|
|
6
|
-
|
|
7
|
-
let
|
|
10
|
+
var l = "kapi-pageheader--collapsed", u = "kapi-pageheader--animating", d = "kapi-pageheader--measuring", f = 80, p = (e, t) => {
|
|
11
|
+
let n = e.style.height;
|
|
12
|
+
e.classList.add(d), e.style.height = "", e.classList.toggle(l, !1);
|
|
13
|
+
let r = e.getBoundingClientRect().height;
|
|
14
|
+
e.classList.toggle(l, !0);
|
|
15
|
+
let i = e.getBoundingClientRect().height;
|
|
16
|
+
return e.classList.toggle(l, t), e.style.height = n, e.getBoundingClientRect(), e.classList.remove(d), {
|
|
17
|
+
expanded: r,
|
|
18
|
+
collapsed: i
|
|
19
|
+
};
|
|
20
|
+
}, m = (e, t) => {
|
|
21
|
+
let n = r(e, t);
|
|
22
|
+
return t ? n : {
|
|
23
|
+
height: null,
|
|
24
|
+
reserve: n.reserve
|
|
25
|
+
};
|
|
26
|
+
}, h = (e, t, n) => {
|
|
27
|
+
let r = () => {
|
|
28
|
+
t.height === null ? e.style.removeProperty("height") : e.style.height = `${t.height}px`, e.style.setProperty("--kapi-pageheader-reserve", `${t.reserve}px`);
|
|
29
|
+
};
|
|
30
|
+
n ? r() : (e.style.transition = "none", r(), e.getBoundingClientRect(), e.style.transition = "");
|
|
31
|
+
};
|
|
32
|
+
function g({ title: l, subtitle: d, meta: g, actions: _, chip: v, collapseOnScroll: y = !0, sticky: b = !0, scrollRoot: x = null, responsive: S = !0, className: C, ...w }) {
|
|
33
|
+
let { collapsed: T, sentinelRef: E } = n({ root: x }), D = y && T, O = c(null), k = c({
|
|
34
|
+
expanded: 0,
|
|
35
|
+
collapsed: 0
|
|
36
|
+
}), A = c(D);
|
|
37
|
+
A.current = D;
|
|
38
|
+
let j = c(!1), M = c(!1);
|
|
39
|
+
s(() => {
|
|
40
|
+
let e = O.current;
|
|
41
|
+
if (!e) return;
|
|
42
|
+
let t = () => {
|
|
43
|
+
M.current || (k.current = p(e, A.current), h(e, m(k.current, A.current), !1));
|
|
44
|
+
};
|
|
45
|
+
t();
|
|
46
|
+
let n = !0;
|
|
47
|
+
if (document.fonts?.ready.then(() => {
|
|
48
|
+
n && t();
|
|
49
|
+
}), typeof ResizeObserver > "u") return () => {
|
|
50
|
+
n = !1;
|
|
51
|
+
};
|
|
52
|
+
let r = e.getBoundingClientRect().width, i = new ResizeObserver((e) => {
|
|
53
|
+
let n = e[e.length - 1];
|
|
54
|
+
if (!n) return;
|
|
55
|
+
let i = n.borderBoxSize?.[0]?.inlineSize ?? n.contentRect.width;
|
|
56
|
+
i !== r && (r = i, t());
|
|
57
|
+
});
|
|
58
|
+
return i.observe(e), () => {
|
|
59
|
+
n = !1, i.disconnect();
|
|
60
|
+
};
|
|
61
|
+
}, [
|
|
62
|
+
l,
|
|
63
|
+
d,
|
|
64
|
+
g,
|
|
65
|
+
_,
|
|
66
|
+
v,
|
|
67
|
+
y,
|
|
68
|
+
S
|
|
69
|
+
]), s(() => {
|
|
70
|
+
let n = O.current;
|
|
71
|
+
if (!n) return;
|
|
72
|
+
let { expanded: i } = k.current, a = r(k.current, D), o = j.current && !e(n);
|
|
73
|
+
j.current = !0;
|
|
74
|
+
let s = () => {
|
|
75
|
+
M.current = !1, n.classList.remove(u), D || n.style.removeProperty("height");
|
|
76
|
+
};
|
|
77
|
+
if (!o) {
|
|
78
|
+
h(n, m(k.current, D), !1);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
n.style.height === "" && i > 0 && (n.style.height = `${i}px`, n.getBoundingClientRect()), M.current = !0, n.classList.add(u), h(n, a, !0);
|
|
82
|
+
let c = (e) => {
|
|
83
|
+
e.target === n && e.propertyName === "height" && s();
|
|
84
|
+
};
|
|
85
|
+
n.addEventListener("transitionend", c);
|
|
86
|
+
let l = getComputedStyle(n), d = window.setTimeout(s, t(l.transitionDuration, l.transitionDelay) + f);
|
|
87
|
+
return () => {
|
|
88
|
+
n.removeEventListener("transitionend", c), window.clearTimeout(d);
|
|
89
|
+
};
|
|
90
|
+
}, [D]);
|
|
91
|
+
let N = [
|
|
8
92
|
"kapi-pageheader",
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
93
|
+
b && "kapi-pageheader--sticky",
|
|
94
|
+
S && "kapi-pageheader--cq",
|
|
95
|
+
D && "kapi-pageheader--collapsed",
|
|
96
|
+
C
|
|
13
97
|
].filter(Boolean).join(" ");
|
|
14
|
-
return /* @__PURE__ */
|
|
15
|
-
ref:
|
|
98
|
+
return /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ a("div", {
|
|
99
|
+
ref: E,
|
|
16
100
|
className: "kapi-pageheader__sentinel",
|
|
17
101
|
"aria-hidden": !0
|
|
18
|
-
}), /* @__PURE__ */
|
|
19
|
-
...
|
|
20
|
-
|
|
21
|
-
|
|
102
|
+
}), /* @__PURE__ */ o("header", {
|
|
103
|
+
...w,
|
|
104
|
+
ref: O,
|
|
105
|
+
className: N,
|
|
106
|
+
children: [/* @__PURE__ */ o("div", {
|
|
22
107
|
className: "kapi-pageheader__main",
|
|
23
108
|
children: [
|
|
24
|
-
/* @__PURE__ */
|
|
109
|
+
/* @__PURE__ */ o("div", {
|
|
25
110
|
className: "kapi-pageheader__titlerow",
|
|
26
|
-
children: [/* @__PURE__ */
|
|
111
|
+
children: [/* @__PURE__ */ a("h1", {
|
|
27
112
|
className: "kapi-pageheader__title",
|
|
28
|
-
children:
|
|
29
|
-
}),
|
|
113
|
+
children: l
|
|
114
|
+
}), v]
|
|
30
115
|
}),
|
|
31
|
-
|
|
116
|
+
d && /* @__PURE__ */ a("div", {
|
|
32
117
|
className: "kapi-pageheader__subtitle",
|
|
33
|
-
children:
|
|
118
|
+
children: d
|
|
34
119
|
}),
|
|
35
|
-
|
|
120
|
+
g && /* @__PURE__ */ a("div", {
|
|
36
121
|
className: "kapi-pageheader__meta",
|
|
37
|
-
children:
|
|
122
|
+
children: g
|
|
38
123
|
})
|
|
39
124
|
]
|
|
40
|
-
}),
|
|
125
|
+
}), _ && /* @__PURE__ */ a("div", {
|
|
41
126
|
className: "kapi-pageheader__actions",
|
|
42
|
-
children:
|
|
127
|
+
children: _
|
|
43
128
|
})]
|
|
44
129
|
})] });
|
|
45
130
|
}
|
|
46
131
|
//#endregion
|
|
47
|
-
export {
|
|
132
|
+
export { g as KapiPageHeader };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lógica pura de la reserva de alto del `KapiPageHeader`.
|
|
3
|
+
*
|
|
4
|
+
* Al colapsar, el header pierde alto y ese alto sale del flujo del documento: el rango de
|
|
5
|
+
* scroll se achica y el navegador recorta la posición (el "salto"). Un espaciador que devuelve
|
|
6
|
+
* exactamente lo perdido mantiene constante el largo total.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Alto del espaciador: lo que el header perdió respecto de su alto expandido.
|
|
10
|
+
* Nunca negativo: si el actual iguala o supera al expandido (o no hay layout, como en jsdom,
|
|
11
|
+
* donde todo mide 0), no hay nada que devolver.
|
|
12
|
+
*/
|
|
13
|
+
export declare const pageHeaderSpacerHeight: (expanded: number, current: number) => number;
|
|
14
|
+
/** Altos naturales del header en sus dos estados, medidos con el ancho actual. */
|
|
15
|
+
export type KapiPageHeaderHeights = {
|
|
16
|
+
expanded: number;
|
|
17
|
+
collapsed: number;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Caja que el componente escribe en el DOM: `height` en px (`null` = no imponer alto, queda
|
|
21
|
+
* `auto`) y la reserva que se devuelve al flujo como margen inferior.
|
|
22
|
+
*/
|
|
23
|
+
export type KapiPageHeaderBox = {
|
|
24
|
+
height: number | null;
|
|
25
|
+
reserve: number;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Caja del header para un estado, pensada para que el alto y la reserva animen JUNTOS.
|
|
29
|
+
*
|
|
30
|
+
* Invariante: `height + reserve === expanded` en los dos estados. Si ambos transicionan con la
|
|
31
|
+
* misma curva y duración, la suma vale `expanded` en todo frame (también si la animación se
|
|
32
|
+
* interrumpe a mitad: las dos distancias que faltan son iguales y opuestas), así que el largo del
|
|
33
|
+
* documento no cambia nunca y el navegador no tiene nada que recortar.
|
|
34
|
+
*
|
|
35
|
+
* Sin layout (jsdom) o con una medición fallida devuelve `height: null`: no se impone ningún alto,
|
|
36
|
+
* para que un header real no quede en 0px.
|
|
37
|
+
*/
|
|
38
|
+
export declare const pageHeaderBox: (heights: KapiPageHeaderHeights, isCollapsed: boolean) => KapiPageHeaderBox;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/components/layout/pageHeaderLogic.ts
|
|
2
|
+
var e = (e) => Number.isFinite(e) && e > 0 ? e : 0, t = (t, n) => Math.max(0, e(t) - e(n)), n = (n, r) => {
|
|
3
|
+
let i = e(n.expanded), a = e(n.collapsed);
|
|
4
|
+
if (i <= 0 || a <= 0) return {
|
|
5
|
+
height: null,
|
|
6
|
+
reserve: 0
|
|
7
|
+
};
|
|
8
|
+
let o = t(i, a);
|
|
9
|
+
return r ? {
|
|
10
|
+
height: a,
|
|
11
|
+
reserve: o
|
|
12
|
+
} : {
|
|
13
|
+
height: i,
|
|
14
|
+
reserve: 0
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { n as pageHeaderBox, t as pageHeaderSpacerHeight };
|
|
@@ -3,7 +3,16 @@ import { type ReactNode } from "react";
|
|
|
3
3
|
export type KapiPanelCollapsedMode = "hidden" | "mini";
|
|
4
4
|
/** El panel se dibuja en mini sólo plegado, con `collapsedMode="mini"` y fuera de móvil (ahí es un drawer). */
|
|
5
5
|
export declare const resolveMini: ({ collapsedMode, open, mobile }: {
|
|
6
|
-
collapsedMode?: KapiPanelCollapsedMode | undefined;
|
|
6
|
+
collapsedMode?: KapiPanelCollapsedMode | "none" | undefined;
|
|
7
|
+
open: boolean;
|
|
8
|
+
mobile: boolean;
|
|
9
|
+
}) => boolean;
|
|
10
|
+
/**
|
|
11
|
+
* El panel no deja nada al plegar (ni tira ni botón de reabrir) sólo con `collapsedMode="none"`, plegado y fuera
|
|
12
|
+
* de móvil: en móvil es un drawer y su botón de abrir sigue ahí, igual que con `hidden` y `mini`.
|
|
13
|
+
*/
|
|
14
|
+
export declare const resolveGone: ({ collapsedMode, open, mobile }: {
|
|
15
|
+
collapsedMode?: KapiPanelCollapsedMode | "none" | undefined;
|
|
7
16
|
open: boolean;
|
|
8
17
|
mobile: boolean;
|
|
9
18
|
}) => boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { isValidElement as e } from "react";
|
|
3
3
|
//#region src/components/navigation/panelMiniLogic.ts
|
|
4
|
-
var t = ({ collapsedMode: e = "hidden", open: t, mobile: n }) => e === "mini" && !t && !n, n = (t) => t == null || typeof t == "boolean" ? "" : typeof t == "string" || typeof t == "number" ? String(t) : Array.isArray(t) ? t.map(
|
|
4
|
+
var t = ({ collapsedMode: e = "hidden", open: t, mobile: n }) => e === "mini" && !t && !n, n = ({ collapsedMode: e = "hidden", open: t, mobile: n }) => e === "none" && !t && !n, r = (t) => t == null || typeof t == "boolean" ? "" : typeof t == "string" || typeof t == "number" ? String(t) : Array.isArray(t) ? t.map(r).join("") : e(t) ? r(t.props.children) : "", i = (e) => e.match(/[\p{L}\p{N}]/u)?.[0]?.toUpperCase() ?? "", a = (e, t) => t === null ? e : `${e} · ${t}`;
|
|
5
5
|
//#endregion
|
|
6
|
-
export {
|
|
6
|
+
export { i as miniInitial, a as miniTooltipLabel, r as nodeText, n as resolveGone, t as resolveMini };
|