@kapiuara/ui 0.10.0 → 0.12.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 +10 -5
- package/dist/components/data/KapiBarChart.d.ts +93 -0
- package/dist/components/data/KapiBarChart.js +88 -0
- package/dist/components/data/KapiEventCalendar.d.ts +70 -0
- package/dist/components/data/KapiEventCalendar.js +225 -0
- package/dist/components/data/KapiHeatmap.d.ts +62 -0
- package/dist/components/data/KapiHeatmap.js +120 -0
- package/dist/components/data/KapiLineChart.d.ts +59 -0
- package/dist/components/data/KapiLineChart.js +106 -0
- package/dist/components/data/KapiPaginationFooter.js +1 -0
- package/dist/components/data/KapiSparkline.d.ts +41 -0
- package/dist/components/data/KapiSparkline.js +55 -0
- package/dist/components/data/KapiTable.d.ts +25 -2
- package/dist/components/data/KapiTable.js +371 -359
- package/dist/components/data/barChartLogic.d.ts +59 -0
- package/dist/components/data/barChartLogic.js +53 -0
- package/dist/components/data/chartFrame.d.ts +112 -0
- package/dist/components/data/chartFrame.js +89 -0
- package/dist/components/data/eventCalendarLogic.d.ts +70 -0
- package/dist/components/data/eventCalendarLogic.js +45 -0
- package/dist/components/data/heatmapLogic.d.ts +15 -0
- package/dist/components/data/heatmapLogic.js +15 -0
- package/dist/components/data/index.d.ts +20 -1
- package/dist/components/data/lineChartLogic.d.ts +30 -0
- package/dist/components/data/lineChartLogic.js +21 -0
- package/dist/components/data/sparklineLogic.d.ts +28 -0
- package/dist/components/data/sparklineLogic.js +18 -0
- package/dist/components/display/KapiStat.d.ts +1 -1
- package/dist/components/inputs/KapiDatePicker.d.ts +8 -2
- package/dist/components/inputs/KapiDatePicker.js +120 -106
- package/dist/components/inputs/KapiDateRangePicker.d.ts +26 -5
- package/dist/components/inputs/KapiDateRangePicker.js +146 -111
- package/dist/components/inputs/KapiFacetedSearch.d.ts +9 -2
- package/dist/components/inputs/KapiFacetedSearch.js +3 -3
- package/dist/components/inputs/KapiSearchChip.d.ts +79 -0
- package/dist/components/inputs/KapiSearchChip.js +73 -0
- package/dist/components/inputs/datePickerLogic.d.ts +9 -0
- package/dist/components/inputs/datePickerLogic.js +25 -25
- package/dist/components/inputs/dateRangeLogic.d.ts +23 -4
- package/dist/components/inputs/dateRangeLogic.js +48 -22
- package/dist/components/inputs/facetedSearchLogic.d.ts +1 -1
- package/dist/components/inputs/index.d.ts +2 -0
- package/dist/components/inputs/searchChipLogic.d.ts +33 -0
- package/dist/components/inputs/searchChipLogic.js +13 -0
- package/dist/components/labelsLogic.d.ts +11 -1
- package/dist/components/layout/KapiContextSlot.js +108 -88
- package/dist/components/layout/KapiMasonry.d.ts +30 -0
- package/dist/components/layout/KapiMasonry.js +33 -0
- package/dist/components/layout/KapiPageHeader.js +89 -71
- package/dist/components/layout/KapiRail.d.ts +8 -2
- package/dist/components/layout/KapiRail.js +118 -67
- package/dist/components/layout/KapiShell.js +67 -37
- package/dist/components/layout/index.d.ts +2 -0
- package/dist/components/layout/masonryLogic.d.ts +40 -0
- package/dist/components/layout/masonryLogic.js +8 -0
- package/dist/components/layout/railLogic.d.ts +41 -1
- package/dist/components/layout/railLogic.js +36 -4
- package/dist/components/layout/reopenBus.d.ts +53 -0
- package/dist/components/layout/reopenBus.js +6 -0
- package/dist/components/layout/useMasonrySpans.d.ts +32 -0
- package/dist/components/layout/useMasonrySpans.js +44 -0
- package/dist/components/layout/useRailOverflow.d.ts +17 -0
- package/dist/components/layout/useRailOverflow.js +41 -0
- package/dist/components/locale/labelRegistry.d.ts +12 -1
- package/dist/components/navigation/KapiFilterChips.js +1 -1
- package/dist/components/navigation/filterChipsLogic.d.ts +7 -1
- package/dist/components/navigation/filterChipsLogic.js +3 -3
- package/dist/components/overlays/KapiConfirm.d.ts +14 -2
- package/dist/components/overlays/KapiConfirm.js +2 -2
- package/dist/components/overlays/KapiContextMenu.d.ts +3 -0
- package/dist/components/overlays/KapiContextMenu.js +2 -1
- package/dist/components/overlays/KapiDropdown.d.ts +3 -1
- package/dist/components/overlays/KapiDropdown.js +29 -26
- package/dist/components/overlays/KapiMenuButton.js +1 -0
- package/dist/components/overlays/KapiOffcanvasStack.d.ts +2 -2
- package/dist/hooks/breakpointOpenLogic.d.ts +20 -5
- package/dist/hooks/breakpointOpenLogic.js +2 -2
- package/dist/hooks/dataColorLogic.d.ts +23 -0
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/numberFormatLogic.d.ts +7 -0
- package/dist/hooks/numberFormatLogic.js +5 -2
- package/dist/hooks/seriesPaletteLogic.d.ts +24 -0
- package/dist/hooks/themeContrastLogic.js +1 -0
- package/dist/hooks/themeDeriveLogic.d.ts +8 -0
- package/dist/hooks/themeDeriveLogic.js +4 -2
- package/dist/hooks/useKapiTheme.js +27 -27
- package/dist/hooks/useMediaQuery.d.ts +7 -0
- package/dist/hooks/useMediaQuery.js +4 -4
- package/dist/index.js +149 -137
- package/dist/kapi.css +1 -1
- package/dist/kapi.layered.css +1 -1
- package/package.json +2 -6
|
@@ -1,46 +1,48 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { prefersReducedMotion as e } from "../../hooks/reducedMotion.js";
|
|
3
3
|
import { maxTransitionMs as t } from "../overlays/dialogUtils.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { useReopenBus as n } from "./reopenBus.js";
|
|
5
|
+
import { useScrollCollapse as r } from "../../hooks/useScrollCollapse.js";
|
|
6
|
+
import { pageHeaderBox as i } from "./pageHeaderLogic.js";
|
|
6
7
|
/* empty css */
|
|
7
|
-
import { Fragment as
|
|
8
|
-
import { useLayoutEffect as
|
|
8
|
+
import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
9
|
+
import { useEffect as c, useLayoutEffect as l, useRef as u } from "react";
|
|
10
|
+
import { ChevronsLeft as d, ChevronsRight as f } from "lucide-react";
|
|
9
11
|
//#region src/components/layout/KapiPageHeader.tsx
|
|
10
|
-
var
|
|
12
|
+
var p = "kapi-pageheader--collapsed", m = "kapi-pageheader--animating", h = "kapi-pageheader--measuring", g = 80, _ = (e, t) => {
|
|
11
13
|
let n = e.style.height;
|
|
12
|
-
e.classList.add(
|
|
14
|
+
e.classList.add(h), e.style.height = "", e.classList.toggle(p, !1);
|
|
13
15
|
let r = e.getBoundingClientRect().height;
|
|
14
|
-
e.classList.toggle(
|
|
16
|
+
e.classList.toggle(p, !0);
|
|
15
17
|
let i = e.getBoundingClientRect().height;
|
|
16
|
-
return e.classList.toggle(
|
|
18
|
+
return e.classList.toggle(p, t), e.style.height = n, e.getBoundingClientRect(), e.classList.remove(h), {
|
|
17
19
|
expanded: r,
|
|
18
20
|
collapsed: i
|
|
19
21
|
};
|
|
20
|
-
},
|
|
21
|
-
let n =
|
|
22
|
+
}, v = (e, t) => {
|
|
23
|
+
let n = i(e, t);
|
|
22
24
|
return t ? n : {
|
|
23
25
|
height: null,
|
|
24
26
|
reserve: n.reserve
|
|
25
27
|
};
|
|
26
|
-
},
|
|
28
|
+
}, y = (e, t, n) => {
|
|
27
29
|
let r = () => {
|
|
28
30
|
t.height === null ? e.style.removeProperty("height") : e.style.height = `${t.height}px`, e.style.setProperty("--kapi-pageheader-reserve", `${t.reserve}px`);
|
|
29
31
|
};
|
|
30
32
|
n ? r() : (e.style.transition = "none", r(), e.getBoundingClientRect(), e.style.transition = "");
|
|
31
33
|
};
|
|
32
|
-
function
|
|
33
|
-
let { collapsed:
|
|
34
|
+
function b({ title: p, subtitle: h, meta: b, actions: x, chip: S, collapseOnScroll: C = !0, sticky: w = !0, scrollRoot: T = null, responsive: E = !0, className: D, ...O }) {
|
|
35
|
+
let { collapsed: k, sentinelRef: A } = r({ root: T }), j = C && k, M = u(null), N = u({
|
|
34
36
|
expanded: 0,
|
|
35
37
|
collapsed: 0
|
|
36
|
-
}),
|
|
37
|
-
|
|
38
|
-
let
|
|
39
|
-
|
|
40
|
-
let e =
|
|
38
|
+
}), P = u(j);
|
|
39
|
+
P.current = j;
|
|
40
|
+
let F = u(!1), I = u(!1);
|
|
41
|
+
l(() => {
|
|
42
|
+
let e = M.current;
|
|
41
43
|
if (!e) return;
|
|
42
44
|
let t = () => {
|
|
43
|
-
|
|
45
|
+
I.current || (N.current = _(e, P.current), y(e, v(N.current, P.current), !1));
|
|
44
46
|
};
|
|
45
47
|
t();
|
|
46
48
|
let n = !0;
|
|
@@ -59,74 +61,90 @@ function g({ title: l, subtitle: d, meta: g, actions: _, chip: v, collapseOnScro
|
|
|
59
61
|
n = !1, i.disconnect();
|
|
60
62
|
};
|
|
61
63
|
}, [
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
]),
|
|
70
|
-
let n =
|
|
64
|
+
p,
|
|
65
|
+
h,
|
|
66
|
+
b,
|
|
67
|
+
x,
|
|
68
|
+
S,
|
|
69
|
+
C,
|
|
70
|
+
E
|
|
71
|
+
]), l(() => {
|
|
72
|
+
let n = M.current;
|
|
71
73
|
if (!n) return;
|
|
72
|
-
let { expanded:
|
|
73
|
-
|
|
74
|
+
let { expanded: r } = N.current, a = i(N.current, j), o = F.current && !e(n);
|
|
75
|
+
F.current = !0;
|
|
74
76
|
let s = () => {
|
|
75
|
-
|
|
77
|
+
I.current = !1, n.classList.remove(m), j || n.style.removeProperty("height");
|
|
76
78
|
};
|
|
77
79
|
if (!o) {
|
|
78
|
-
|
|
80
|
+
y(n, v(N.current, j), !1);
|
|
79
81
|
return;
|
|
80
82
|
}
|
|
81
|
-
n.style.height === "" &&
|
|
83
|
+
n.style.height === "" && r > 0 && (n.style.height = `${r}px`, n.getBoundingClientRect()), I.current = !0, n.classList.add(m), y(n, a, !0);
|
|
82
84
|
let c = (e) => {
|
|
83
85
|
e.target === n && e.propertyName === "height" && s();
|
|
84
86
|
};
|
|
85
87
|
n.addEventListener("transitionend", c);
|
|
86
|
-
let l = getComputedStyle(n),
|
|
88
|
+
let l = getComputedStyle(n), u = window.setTimeout(s, t(l.transitionDuration, l.transitionDelay) + g);
|
|
87
89
|
return () => {
|
|
88
|
-
n.removeEventListener("transitionend", c), window.clearTimeout(
|
|
90
|
+
n.removeEventListener("transitionend", c), window.clearTimeout(u);
|
|
89
91
|
};
|
|
90
|
-
}, [
|
|
91
|
-
let
|
|
92
|
+
}, [j]);
|
|
93
|
+
let L = [
|
|
92
94
|
"kapi-pageheader",
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
].filter(Boolean).join(" ");
|
|
98
|
-
|
|
99
|
-
|
|
95
|
+
w && "kapi-pageheader--sticky",
|
|
96
|
+
E && "kapi-pageheader--cq",
|
|
97
|
+
j && "kapi-pageheader--collapsed",
|
|
98
|
+
D
|
|
99
|
+
].filter(Boolean).join(" "), R = n(), z = R?.addHost;
|
|
100
|
+
c(() => z?.(), [z]);
|
|
101
|
+
let B = R?.info ?? null, V = B?.side === "right" ? d : f;
|
|
102
|
+
return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("div", {
|
|
103
|
+
ref: A,
|
|
100
104
|
className: "kapi-pageheader__sentinel",
|
|
101
105
|
"aria-hidden": !0
|
|
102
|
-
}), /* @__PURE__ */
|
|
103
|
-
...
|
|
104
|
-
ref:
|
|
105
|
-
className:
|
|
106
|
-
children: [
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
d && /* @__PURE__ */ a("div", {
|
|
117
|
-
className: "kapi-pageheader__subtitle",
|
|
118
|
-
children: d
|
|
119
|
-
}),
|
|
120
|
-
g && /* @__PURE__ */ a("div", {
|
|
121
|
-
className: "kapi-pageheader__meta",
|
|
122
|
-
children: g
|
|
106
|
+
}), /* @__PURE__ */ s("header", {
|
|
107
|
+
...O,
|
|
108
|
+
ref: M,
|
|
109
|
+
className: L,
|
|
110
|
+
children: [
|
|
111
|
+
B && /* @__PURE__ */ o("button", {
|
|
112
|
+
type: "button",
|
|
113
|
+
className: "kapi-paneltoggle kapi-pageheader__reopen",
|
|
114
|
+
onClick: B.expand,
|
|
115
|
+
"aria-label": B.label,
|
|
116
|
+
children: /* @__PURE__ */ o(V, {
|
|
117
|
+
size: 16,
|
|
118
|
+
strokeWidth: 2,
|
|
119
|
+
"aria-hidden": "true"
|
|
123
120
|
})
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
121
|
+
}),
|
|
122
|
+
/* @__PURE__ */ s("div", {
|
|
123
|
+
className: "kapi-pageheader__main",
|
|
124
|
+
children: [
|
|
125
|
+
/* @__PURE__ */ s("div", {
|
|
126
|
+
className: "kapi-pageheader__titlerow",
|
|
127
|
+
children: [/* @__PURE__ */ o("h1", {
|
|
128
|
+
className: "kapi-pageheader__title",
|
|
129
|
+
children: p
|
|
130
|
+
}), S]
|
|
131
|
+
}),
|
|
132
|
+
h && /* @__PURE__ */ o("div", {
|
|
133
|
+
className: "kapi-pageheader__subtitle",
|
|
134
|
+
children: h
|
|
135
|
+
}),
|
|
136
|
+
b && /* @__PURE__ */ o("div", {
|
|
137
|
+
className: "kapi-pageheader__meta",
|
|
138
|
+
children: b
|
|
139
|
+
})
|
|
140
|
+
]
|
|
141
|
+
}),
|
|
142
|
+
x && /* @__PURE__ */ o("div", {
|
|
143
|
+
className: "kapi-pageheader__actions",
|
|
144
|
+
children: x
|
|
145
|
+
})
|
|
146
|
+
]
|
|
129
147
|
})] });
|
|
130
148
|
}
|
|
131
149
|
//#endregion
|
|
132
|
-
export {
|
|
150
|
+
export { b as KapiPageHeader };
|
|
@@ -7,13 +7,18 @@ export type { KapiRailEntry, KapiRailItem, KapiRailPinned, KapiRailSeparator, Ka
|
|
|
7
7
|
export type KapiRailLabels = {
|
|
8
8
|
/** Nombre accesible del `<nav>` (sin `aria-label`). */
|
|
9
9
|
navigation: string;
|
|
10
|
+
/** Texto del ítem que, en la barra inferior del celular, guarda los destinos que no entran. */
|
|
11
|
+
more: string;
|
|
12
|
+
/** Se suma al nombre accesible del «Más» cuando el destino activo quedó guardado adentro. */
|
|
13
|
+
moreCurrent: string;
|
|
10
14
|
};
|
|
11
15
|
export declare const DEFAULT_RAIL_LABELS: KapiRailLabels;
|
|
12
16
|
/** Atributos nativos (`id`, `style`, `data-*`…) van al `<nav>`. `Id` se infiere de `items`. */
|
|
13
17
|
export type KapiRailProps<Id extends string = string> = Omit<HTMLAttributes<HTMLElement>, "children" | "onSelect"> & {
|
|
14
18
|
/**
|
|
15
19
|
* Ítems del rail. Intercala `{ separator: true }` para dibujar un divisor entre grupos. Con `pinned: "start"`
|
|
16
|
-
* o `"end"` el ítem queda fijo arriba o abajo; el resto va en la zona del medio, la única que scrollea
|
|
20
|
+
* o `"end"` el ítem queda fijo arriba o abajo; el resto va en la zona del medio, la única que scrollea
|
|
21
|
+
* (en vertical) y la única que, en la barra inferior del celular, esconde en «Más» lo que no entra.
|
|
17
22
|
*/
|
|
18
23
|
items: KapiRailEntry<Id>[];
|
|
19
24
|
/** id del ítem activo (controlado por la app: derívalo de tu router). */
|
|
@@ -35,6 +40,7 @@ export type KapiRailProps<Id extends string = string> = Omit<HTMLAttributes<HTML
|
|
|
35
40
|
/**
|
|
36
41
|
* Rail de navegación (Nav A): ícono + nombre debajo. OPCIONAL en el shell.
|
|
37
42
|
* Es presentacional: no conoce el router; la app pasa `activeId` y `onSelect`.
|
|
38
|
-
* En móvil se convierte en barra inferior (shell.css)
|
|
43
|
+
* En móvil se convierte en barra inferior (shell.css): muestra los ítems del medio que entran y manda el
|
|
44
|
+
* resto a un ítem «Más» que abre un menú hacia arriba. Los ítems fijos y el footer no se tocan.
|
|
39
45
|
*/
|
|
40
46
|
export declare const KapiRail: <Id extends string = string>({ items, activeId, onSelect, brand, footer, variant, "aria-label": ariaLabel, labels, className, ...rest }: KapiRailProps<Id>) => import("react").JSX.Element;
|
|
@@ -3,107 +3,158 @@ import { useLabels as e } from "../locale/KapiLocaleProvider.js";
|
|
|
3
3
|
import { joinClasses as t } from "../rootProps.js";
|
|
4
4
|
import { useSlidingIndicator as n } from "../../hooks/useSlidingIndicator.js";
|
|
5
5
|
import { KapiTooltip as r } from "../overlays/KapiTooltip.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
6
|
+
import { KapiMenuButton as i } from "../overlays/KapiMenuButton.js";
|
|
7
|
+
import { navBadgeA11yText as a } from "../navigation/navBadgeLogic.js";
|
|
8
|
+
import { KapiNavBadge as o } from "../navigation/KapiNavBadge.js";
|
|
9
|
+
import { useScrollEdges as s } from "../../hooks/useScrollEdges.js";
|
|
10
|
+
import { DEFAULT_LINK_LABELS as c } from "../locale/linkLabels.js";
|
|
11
|
+
import { SHELL_MOBILE_QUERY as l, useMediaQuery as u } from "../../hooks/useMediaQuery.js";
|
|
12
|
+
import { isRailSeparator as d, railClasses as f, railItemClasses as p, railOverflowState as m, railShowsTooltip as h, splitRailEntries as g, splitRailOverflow as _ } from "./railLogic.js";
|
|
13
|
+
import { useRailOverflow as v } from "./useRailOverflow.js";
|
|
12
14
|
/* empty css */
|
|
13
|
-
import { jsx as
|
|
14
|
-
import { useCallback as
|
|
15
|
-
import { ExternalLink as
|
|
15
|
+
import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
16
|
+
import { useCallback as S } from "react";
|
|
17
|
+
import { ExternalLink as C, MoreHorizontal as w } from "lucide-react";
|
|
16
18
|
//#region src/components/layout/KapiRail.tsx
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
var T = {
|
|
20
|
+
navigation: "Navegación principal",
|
|
21
|
+
more: "Más",
|
|
22
|
+
moreCurrent: "sección actual"
|
|
23
|
+
}, E = ({ items: E, activeId: D, onSelect: O, brand: k, footer: A, variant: j = "labeled", "aria-label": M, labels: N, className: P, ...F }) => {
|
|
24
|
+
let I = e("rail", T, N), L = e("link", c, N), R = j === "compact", z = h(j), B = g(E), V = u(l), { ref: H, edges: U } = s({ axis: "y" }), W = B.scroll, G = W.filter((e) => !d(e)).length, K = v(H, {
|
|
25
|
+
enabled: V,
|
|
26
|
+
count: G,
|
|
27
|
+
separators: W.length - G
|
|
28
|
+
}), { shown: q, hidden: J } = _(W, K ?? G), Y = m(J, D), { containerRef: X, indicatorRef: Z } = n({
|
|
29
|
+
active: D ?? null,
|
|
30
|
+
deps: [
|
|
31
|
+
E,
|
|
32
|
+
j,
|
|
33
|
+
J.length
|
|
34
|
+
],
|
|
35
|
+
findActive: (e) => e.querySelector(".kapi-rail__item[aria-current=\"page\"], .kapi-rail__more--on")
|
|
36
|
+
}), Q = S((e) => {
|
|
37
|
+
X.current = e, H.current = e;
|
|
38
|
+
}, [X, H]), ee = ({ id: e, label: t, icon: n, href: i, external: s, newTab: c, badge: l, badgeTone: u, badgeLabel: d }) => {
|
|
39
|
+
let f = D === e, m = f ? "page" : void 0, h = a(l, d), g = h === null ? t : `${t} ${h}`, _ = R ? g : void 0, v = /* @__PURE__ */ b(o, {
|
|
26
40
|
value: l,
|
|
27
41
|
tone: u,
|
|
28
|
-
label:
|
|
42
|
+
label: d,
|
|
29
43
|
placement: "corner",
|
|
30
|
-
announce: !
|
|
31
|
-
}),
|
|
44
|
+
announce: !R
|
|
45
|
+
}), y = i === void 0 ? /* @__PURE__ */ x("button", {
|
|
32
46
|
type: "button",
|
|
33
|
-
className:
|
|
34
|
-
onClick: () =>
|
|
35
|
-
"aria-current":
|
|
36
|
-
"aria-label":
|
|
47
|
+
className: p({ active: f }),
|
|
48
|
+
onClick: () => O?.(e),
|
|
49
|
+
"aria-current": m,
|
|
50
|
+
"aria-label": _,
|
|
37
51
|
children: [
|
|
38
52
|
n,
|
|
39
|
-
!
|
|
40
|
-
|
|
53
|
+
!R && /* @__PURE__ */ b("span", {
|
|
54
|
+
className: "kapi-rail__label",
|
|
55
|
+
children: t
|
|
56
|
+
}),
|
|
57
|
+
v
|
|
41
58
|
]
|
|
42
|
-
},
|
|
43
|
-
className:
|
|
44
|
-
active:
|
|
59
|
+
}, z ? void 0 : e) : /* @__PURE__ */ x("a", {
|
|
60
|
+
className: p({
|
|
61
|
+
active: f,
|
|
45
62
|
link: !0
|
|
46
63
|
}),
|
|
47
|
-
href:
|
|
64
|
+
href: i,
|
|
48
65
|
rel: "noopener noreferrer",
|
|
49
66
|
target: c ? "_blank" : void 0,
|
|
50
|
-
"aria-current":
|
|
51
|
-
"aria-label":
|
|
67
|
+
"aria-current": m,
|
|
68
|
+
"aria-label": _,
|
|
52
69
|
children: [
|
|
53
70
|
n,
|
|
54
|
-
!
|
|
55
|
-
|
|
56
|
-
|
|
71
|
+
!R && /* @__PURE__ */ b("span", {
|
|
72
|
+
className: "kapi-rail__label",
|
|
73
|
+
children: t
|
|
74
|
+
}),
|
|
75
|
+
v,
|
|
76
|
+
s && /* @__PURE__ */ b(C, {
|
|
57
77
|
className: "kapi-rail__ext",
|
|
58
78
|
size: 12,
|
|
59
79
|
"aria-hidden": "true"
|
|
60
80
|
}),
|
|
61
|
-
c && /* @__PURE__ */
|
|
81
|
+
c && /* @__PURE__ */ b("span", {
|
|
62
82
|
className: "kapi-rail__sr",
|
|
63
|
-
children:
|
|
83
|
+
children: L.newTab
|
|
64
84
|
})
|
|
65
85
|
]
|
|
66
|
-
},
|
|
67
|
-
return
|
|
68
|
-
label:
|
|
69
|
-
children:
|
|
70
|
-
}, e) :
|
|
71
|
-
},
|
|
86
|
+
}, z ? void 0 : e);
|
|
87
|
+
return z ? /* @__PURE__ */ b(r, {
|
|
88
|
+
label: g,
|
|
89
|
+
children: y
|
|
90
|
+
}, e) : y;
|
|
91
|
+
}, $ = (e) => e.map((e, t) => d(e) ? /* @__PURE__ */ b("div", {
|
|
72
92
|
className: "kapi-rail__sep",
|
|
73
93
|
role: "separator",
|
|
74
94
|
"aria-orientation": "horizontal"
|
|
75
|
-
}, e.id ?? `sep-${t}`) :
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
95
|
+
}, e.id ?? `sep-${t}`) : ee(e)), te = J.map(({ id: e, label: t, href: n, newTab: r, badge: i, badgeLabel: o }) => {
|
|
96
|
+
let s = a(i, o);
|
|
97
|
+
return {
|
|
98
|
+
label: s === null ? t : `${t} ${s}`,
|
|
99
|
+
current: D === e,
|
|
100
|
+
onClick: () => {
|
|
101
|
+
n === void 0 ? O?.(e) : r ? window.open(n, "_blank", "noopener,noreferrer") : window.location.assign(n);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
});
|
|
105
|
+
return /* @__PURE__ */ x("nav", {
|
|
106
|
+
...F,
|
|
107
|
+
className: t(f({ variant: j }), P),
|
|
108
|
+
"aria-label": M ?? I.navigation,
|
|
80
109
|
children: [
|
|
81
|
-
|
|
110
|
+
k !== void 0 && /* @__PURE__ */ b("div", {
|
|
82
111
|
className: "kapi-rail__brand",
|
|
83
|
-
children:
|
|
112
|
+
children: k
|
|
84
113
|
}),
|
|
85
|
-
|
|
114
|
+
B.start.length > 0 && /* @__PURE__ */ b("div", {
|
|
86
115
|
className: "kapi-rail__start",
|
|
87
|
-
children:
|
|
116
|
+
children: $(B.start)
|
|
88
117
|
}),
|
|
89
|
-
/* @__PURE__ */
|
|
90
|
-
ref:
|
|
91
|
-
className:
|
|
92
|
-
"data-edge-start":
|
|
93
|
-
"data-edge-end":
|
|
94
|
-
children: [
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
118
|
+
/* @__PURE__ */ x("div", {
|
|
119
|
+
ref: Q,
|
|
120
|
+
className: t("kapi-rail__scroll", !V && "kapi-fade-y"),
|
|
121
|
+
"data-edge-start": !V && U.start ? "" : void 0,
|
|
122
|
+
"data-edge-end": !V && U.end ? "" : void 0,
|
|
123
|
+
children: [
|
|
124
|
+
/* @__PURE__ */ b("span", {
|
|
125
|
+
ref: Z,
|
|
126
|
+
className: "kapi-rail__indicator",
|
|
127
|
+
"aria-hidden": "true"
|
|
128
|
+
}),
|
|
129
|
+
$(q),
|
|
130
|
+
J.length > 0 && /* @__PURE__ */ b(i, {
|
|
131
|
+
className: t("kapi-rail__more", Y.current && "kapi-rail__more--on"),
|
|
132
|
+
variant: "ghost",
|
|
133
|
+
drop: "up",
|
|
134
|
+
icon: /* @__PURE__ */ b(w, {
|
|
135
|
+
size: 21,
|
|
136
|
+
strokeWidth: 1.8
|
|
137
|
+
}),
|
|
138
|
+
...R || Y.current ? { "aria-label": Y.current ? `${I.more} · ${I.moreCurrent}: ${Y.current.label}` : I.more } : {},
|
|
139
|
+
label: /* @__PURE__ */ x(y, { children: [!R && /* @__PURE__ */ b("span", {
|
|
140
|
+
className: "kapi-rail__label",
|
|
141
|
+
children: I.more
|
|
142
|
+
}), Y.notice && /* @__PURE__ */ b(o, {
|
|
143
|
+
value: "dot",
|
|
144
|
+
tone: Y.notice.badgeTone,
|
|
145
|
+
placement: "corner"
|
|
146
|
+
})] }),
|
|
147
|
+
items: te
|
|
148
|
+
})
|
|
149
|
+
]
|
|
99
150
|
}),
|
|
100
|
-
|
|
151
|
+
B.end.length > 0 && /* @__PURE__ */ b("div", {
|
|
101
152
|
className: "kapi-rail__end",
|
|
102
|
-
children:
|
|
153
|
+
children: $(B.end)
|
|
103
154
|
}),
|
|
104
|
-
|
|
155
|
+
A
|
|
105
156
|
]
|
|
106
157
|
});
|
|
107
158
|
};
|
|
108
159
|
//#endregion
|
|
109
|
-
export {
|
|
160
|
+
export { T as DEFAULT_RAIL_LABELS, E as KapiRail };
|
|
@@ -3,48 +3,78 @@ import { joinClasses as e } from "../rootProps.js";
|
|
|
3
3
|
import { KapiContextMenu as t } from "../overlays/KapiContextMenu.js";
|
|
4
4
|
import { useGlobalRightClick as n } from "../../hooks/useGlobalRightClick.js";
|
|
5
5
|
import { KapiThemeContext as r, themeRootStyle as i, useKapiThemeState as a } from "../../hooks/useKapiTheme.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { KapiReopenContext as o } from "./reopenBus.js";
|
|
7
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
8
|
+
import { useCallback as l, useMemo as u, useState as d } from "react";
|
|
9
|
+
import { ChevronsLeft as f, ChevronsRight as p } from "lucide-react";
|
|
8
10
|
//#region src/components/layout/KapiShell.tsx
|
|
9
|
-
var
|
|
10
|
-
let
|
|
11
|
-
|
|
12
|
-
enabled:
|
|
13
|
-
onMenu:
|
|
11
|
+
var m = ({ rail: m, panel: h, panelRight: g, children: _, contextMenuItems: v, rightClick: y = !0, overlays: b, className: x, contentClassName: S = "", storageNamespace: C, brandTheme: w, style: T, ...E }) => {
|
|
12
|
+
let D = a({ namespace: C }), O = u(() => i(D, w), [D, w]), [k, A] = d(null);
|
|
13
|
+
n({
|
|
14
|
+
enabled: y,
|
|
15
|
+
onMenu: v?.length ? (e, t) => A({
|
|
14
16
|
x: e,
|
|
15
17
|
y: t
|
|
16
18
|
}) : void 0
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
19
|
+
});
|
|
20
|
+
let [j, M] = d(null), [N, P] = d(0), F = l(() => (P((e) => e + 1), () => P((e) => e - 1)), []), I = u(() => ({
|
|
21
|
+
info: j,
|
|
22
|
+
publish: M,
|
|
23
|
+
hosts: N,
|
|
24
|
+
addHost: F
|
|
25
|
+
}), [
|
|
26
|
+
j,
|
|
27
|
+
N,
|
|
28
|
+
F
|
|
29
|
+
]);
|
|
30
|
+
return /* @__PURE__ */ s(r.Provider, {
|
|
31
|
+
value: D,
|
|
32
|
+
children: /* @__PURE__ */ s(o.Provider, {
|
|
33
|
+
value: I,
|
|
34
|
+
children: /* @__PURE__ */ c("div", {
|
|
35
|
+
...E,
|
|
36
|
+
className: e("kapi", x),
|
|
37
|
+
"data-theme": D.theme,
|
|
38
|
+
"data-motion": D.motion === "reduced" ? "reduced" : void 0,
|
|
39
|
+
style: {
|
|
40
|
+
...T,
|
|
41
|
+
...O
|
|
42
|
+
},
|
|
43
|
+
children: [
|
|
44
|
+
m,
|
|
45
|
+
h,
|
|
46
|
+
/* @__PURE__ */ c("main", {
|
|
47
|
+
className: `kapi-content${S ? ` ${S}` : ""}`,
|
|
48
|
+
tabIndex: 0,
|
|
49
|
+
children: [j && N === 0 && /* @__PURE__ */ s("button", {
|
|
50
|
+
type: "button",
|
|
51
|
+
className: "kapi-paneltoggle kapi-content__reopen",
|
|
52
|
+
onClick: j.expand,
|
|
53
|
+
"aria-label": j.label,
|
|
54
|
+
children: j.side === "right" ? /* @__PURE__ */ s(f, {
|
|
55
|
+
size: 16,
|
|
56
|
+
strokeWidth: 2,
|
|
57
|
+
"aria-hidden": "true"
|
|
58
|
+
}) : /* @__PURE__ */ s(p, {
|
|
59
|
+
size: 16,
|
|
60
|
+
strokeWidth: 2,
|
|
61
|
+
"aria-hidden": "true"
|
|
62
|
+
})
|
|
63
|
+
}), _]
|
|
64
|
+
}),
|
|
65
|
+
g,
|
|
66
|
+
b,
|
|
67
|
+
k && v && /* @__PURE__ */ s(t, {
|
|
68
|
+
open: !0,
|
|
69
|
+
x: k.x,
|
|
70
|
+
y: k.y,
|
|
71
|
+
items: v,
|
|
72
|
+
onClose: () => A(null)
|
|
73
|
+
})
|
|
74
|
+
]
|
|
75
|
+
})
|
|
46
76
|
})
|
|
47
77
|
});
|
|
48
78
|
};
|
|
49
79
|
//#endregion
|
|
50
|
-
export {
|
|
80
|
+
export { m as KapiShell };
|
|
@@ -26,6 +26,8 @@ export { KapiCluster } from "./KapiCluster";
|
|
|
26
26
|
export type { KapiClusterProps } from "./KapiCluster";
|
|
27
27
|
export { KapiGrid } from "./KapiGrid";
|
|
28
28
|
export type { KapiGridProps } from "./KapiGrid";
|
|
29
|
+
export { KapiMasonry } from "./KapiMasonry";
|
|
30
|
+
export type { KapiMasonryProps } from "./KapiMasonry";
|
|
29
31
|
export type { KapiGap, KapiAlign, KapiClusterAlign, KapiClusterJustify } from "./layoutPrimitives";
|
|
30
32
|
export { KapiPageHeader } from "./KapiPageHeader";
|
|
31
33
|
export type { KapiPageHeaderProps } from "./KapiPageHeader";
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** Medidas (px) con las que se decide cuántas filas de la grilla ocupa un ítem del masonry. */
|
|
2
|
+
export type MasonryFit = {
|
|
3
|
+
/** Alto del contenido del ítem, medido en el DOM, SIN la separación de abajo. */
|
|
4
|
+
height: number;
|
|
5
|
+
/** Alto de una fila de la grilla (`grid-auto-rows`). Es el grano del empaque. */
|
|
6
|
+
rowUnit: number;
|
|
7
|
+
/** Separación vertical entre ítems. La lleva el ítem abajo, no `row-gap` (ver abajo por qué). */
|
|
8
|
+
gap: number;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Cuántas filas de la grilla ocupa un ítem de alto `height`.
|
|
12
|
+
*
|
|
13
|
+
* N = ceil((height + gap) / rowUnit)
|
|
14
|
+
*
|
|
15
|
+
* **La grilla tiene que llevar `row-gap: 0`, y la separación vertical la pone cada ítem abajo.**
|
|
16
|
+
* No es un detalle de estilo: es lo que hace que `rowUnit` sirva para algo. Si `row-gap` no es
|
|
17
|
+
* cero, cada una de las N filas que el ítem abarca suma su propia separación, el alto que recibe
|
|
18
|
+
* pasa a ser `N·rowUnit + (N−1)·gap`, y el grano del empaque se vuelve `rowUnit + gap` en vez de
|
|
19
|
+
* `rowUnit`. Con `rowUnit` 8 y `gap` 12 eso es un grano de 20px: el gap domina y achicar `rowUnit`
|
|
20
|
+
* deja de mejorar nada. Con `row-gap: 0` el grano es `rowUnit` y el hueco máximo bajo un ítem es
|
|
21
|
+
* `rowUnit − 1` px.
|
|
22
|
+
*
|
|
23
|
+
* Una medida que todavía no existe o no es un número válido devuelve **1**, no 0 ni `NaN`: con
|
|
24
|
+
* `span 1` el ítem se ve como en una grilla normal, que es exactamente lo que tiene que pasar
|
|
25
|
+
* antes de medir, sin `ResizeObserver`, o si alguien renderiza esto en un entorno sin layout. Un
|
|
26
|
+
* `span 0` es inválido en CSS y un `NaN` tira el layout entero.
|
|
27
|
+
*/
|
|
28
|
+
export declare const masonrySpan: ({ height, rowUnit, gap }: MasonryFit) => number;
|
|
29
|
+
/**
|
|
30
|
+
* El alto de fila que se usa cuando el consumidor no fija uno.
|
|
31
|
+
*
|
|
32
|
+
* Es un compromiso entre dos extremos malos: una fila de 1px empaqueta perfecto pero obliga al
|
|
33
|
+
* motor de grilla a resolver cientos de filas por ítem, y una fila grande deja huecos visibles
|
|
34
|
+
* porque el alto de cada ítem se redondea para arriba hasta el múltiplo siguiente. Con 8 el hueco
|
|
35
|
+
* máximo es 7px, por debajo del espaciado más chico del sistema.
|
|
36
|
+
*
|
|
37
|
+
* No es un token `--kapi-*` a propósito: no es una decisión de diseño visible, es el grano de una
|
|
38
|
+
* cuenta interna. Lo que sí sale de tokens es el `gap`.
|
|
39
|
+
*/
|
|
40
|
+
export declare const MASONRY_ROW_UNIT = 8;
|