@kapiuara/ui 0.10.0 → 0.11.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.
Files changed (81) hide show
  1. package/README.md +10 -5
  2. package/dist/components/data/KapiBarChart.d.ts +84 -0
  3. package/dist/components/data/KapiBarChart.js +87 -0
  4. package/dist/components/data/KapiEventCalendar.d.ts +70 -0
  5. package/dist/components/data/KapiEventCalendar.js +225 -0
  6. package/dist/components/data/KapiHeatmap.d.ts +62 -0
  7. package/dist/components/data/KapiHeatmap.js +120 -0
  8. package/dist/components/data/KapiLineChart.d.ts +50 -0
  9. package/dist/components/data/KapiLineChart.js +105 -0
  10. package/dist/components/data/KapiPaginationFooter.js +1 -0
  11. package/dist/components/data/KapiSparkline.d.ts +41 -0
  12. package/dist/components/data/KapiSparkline.js +55 -0
  13. package/dist/components/data/KapiTable.js +371 -359
  14. package/dist/components/data/barChartLogic.d.ts +59 -0
  15. package/dist/components/data/barChartLogic.js +53 -0
  16. package/dist/components/data/chartFrame.d.ts +96 -0
  17. package/dist/components/data/chartFrame.js +89 -0
  18. package/dist/components/data/eventCalendarLogic.d.ts +70 -0
  19. package/dist/components/data/eventCalendarLogic.js +45 -0
  20. package/dist/components/data/heatmapLogic.d.ts +15 -0
  21. package/dist/components/data/heatmapLogic.js +15 -0
  22. package/dist/components/data/index.d.ts +19 -0
  23. package/dist/components/data/lineChartLogic.d.ts +30 -0
  24. package/dist/components/data/lineChartLogic.js +21 -0
  25. package/dist/components/data/sparklineLogic.d.ts +28 -0
  26. package/dist/components/data/sparklineLogic.js +18 -0
  27. package/dist/components/display/KapiStat.d.ts +1 -1
  28. package/dist/components/inputs/KapiDatePicker.d.ts +8 -2
  29. package/dist/components/inputs/KapiDatePicker.js +120 -106
  30. package/dist/components/inputs/KapiDateRangePicker.d.ts +26 -5
  31. package/dist/components/inputs/KapiDateRangePicker.js +146 -111
  32. package/dist/components/inputs/datePickerLogic.d.ts +9 -0
  33. package/dist/components/inputs/datePickerLogic.js +25 -25
  34. package/dist/components/inputs/dateRangeLogic.d.ts +23 -4
  35. package/dist/components/inputs/dateRangeLogic.js +48 -22
  36. package/dist/components/inputs/facetedSearchLogic.d.ts +1 -1
  37. package/dist/components/layout/KapiContextSlot.js +108 -88
  38. package/dist/components/layout/KapiMasonry.d.ts +30 -0
  39. package/dist/components/layout/KapiMasonry.js +33 -0
  40. package/dist/components/layout/KapiPageHeader.js +89 -71
  41. package/dist/components/layout/KapiRail.d.ts +8 -2
  42. package/dist/components/layout/KapiRail.js +118 -67
  43. package/dist/components/layout/KapiShell.js +67 -37
  44. package/dist/components/layout/index.d.ts +2 -0
  45. package/dist/components/layout/masonryLogic.d.ts +40 -0
  46. package/dist/components/layout/masonryLogic.js +8 -0
  47. package/dist/components/layout/railLogic.d.ts +41 -1
  48. package/dist/components/layout/railLogic.js +36 -4
  49. package/dist/components/layout/reopenBus.d.ts +53 -0
  50. package/dist/components/layout/reopenBus.js +6 -0
  51. package/dist/components/layout/useMasonrySpans.d.ts +32 -0
  52. package/dist/components/layout/useMasonrySpans.js +44 -0
  53. package/dist/components/layout/useRailOverflow.d.ts +17 -0
  54. package/dist/components/layout/useRailOverflow.js +41 -0
  55. package/dist/components/locale/labelRegistry.d.ts +10 -1
  56. package/dist/components/navigation/KapiFilterChips.js +1 -1
  57. package/dist/components/navigation/filterChipsLogic.d.ts +7 -1
  58. package/dist/components/navigation/filterChipsLogic.js +3 -3
  59. package/dist/components/overlays/KapiContextMenu.d.ts +3 -0
  60. package/dist/components/overlays/KapiContextMenu.js +2 -1
  61. package/dist/components/overlays/KapiDropdown.d.ts +3 -1
  62. package/dist/components/overlays/KapiDropdown.js +29 -26
  63. package/dist/components/overlays/KapiMenuButton.js +1 -0
  64. package/dist/components/overlays/KapiOffcanvasStack.d.ts +2 -2
  65. package/dist/hooks/breakpointOpenLogic.d.ts +20 -5
  66. package/dist/hooks/breakpointOpenLogic.js +2 -2
  67. package/dist/hooks/dataColorLogic.d.ts +23 -0
  68. package/dist/hooks/index.d.ts +1 -1
  69. package/dist/hooks/numberFormatLogic.d.ts +7 -0
  70. package/dist/hooks/numberFormatLogic.js +5 -2
  71. package/dist/hooks/seriesPaletteLogic.d.ts +24 -0
  72. package/dist/hooks/themeContrastLogic.js +1 -0
  73. package/dist/hooks/themeDeriveLogic.d.ts +8 -0
  74. package/dist/hooks/themeDeriveLogic.js +4 -2
  75. package/dist/hooks/useKapiTheme.js +27 -27
  76. package/dist/hooks/useMediaQuery.d.ts +7 -0
  77. package/dist/hooks/useMediaQuery.js +4 -4
  78. package/dist/index.js +125 -114
  79. package/dist/kapi.css +1 -1
  80. package/dist/kapi.layered.css +1 -1
  81. package/package.json +2 -6
@@ -1,136 +1,156 @@
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
+ import { clampCtxPanelWidth as n, ctxPanelWidthFromDrag as ee, stepCtxPanelWidth as te } from "../navigation/contextPanelLogic.js";
5
5
  /* empty css */
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";
12
- import { ChevronsLeft as g, ChevronsRight as _ } from "lucide-react";
6
+ import { KapiPanelMiniContext as ne } from "../navigation/panelMini.js";
7
+ import { resolveGone as re, resolveMini as ie } from "../navigation/panelMiniLogic.js";
8
+ import { SHELL_MOBILE_QUERY as ae, SHELL_NARROW_QUERY as oe, matchesQuery as se, useMediaQuery as r } from "../../hooks/useMediaQuery.js";
9
+ import { useReopenBus as i } from "./reopenBus.js";
10
+ import { openOnZoneCross as a, shellZone as ce } from "../../hooks/breakpointOpenLogic.js";
11
+ import { Fragment as le, jsx as o, jsxs as s } from "react/jsx-runtime";
12
+ import { useCallback as c, useEffect as l, useMemo as ue, useRef as u, useState as d } from "react";
13
+ import { ChevronsLeft as f, ChevronsRight as p } from "lucide-react";
13
14
  //#region src/components/layout/KapiContextSlot.tsx
14
- var v = {
15
+ var m = {
15
16
  collapse: "Plegar panel",
16
17
  expand: "Desplegar panel",
17
18
  region: "Panel contextual",
18
19
  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);
20
+ }, h = ({ title: h, actions: g, children: _, open: v, defaultOpen: y, onOpenChange: b, side: x = "left", collapsedMode: S = "hidden", resizable: de = !1, width: C, defaultWidth: fe, onWidthChange: pe, minWidth: w = 200, maxWidth: T = 420, "aria-label": me, labels: he, className: ge, style: E, id: D }) => {
21
+ let O = e("contextSlot", m, he), k = me ?? O.region, A = x === "right", j = A ? p : f, M = A ? f : p, [N, P] = d(() => y ?? !se("(max-width: 1024px)")), F = v ?? N, I = c((e) => {
22
+ v === void 0 && P(e), b?.(e);
23
+ }, [v, b]), L = r(ae), _e = r(oe), R = ce(L, _e), z = u(R), B = u(R === "wide" ? F : y ?? !0);
24
+ l(() => {
25
+ let e = a(z.current, R, B.current);
26
+ z.current = R, e !== null && e !== F && I(e);
26
27
  }, [
27
- B,
28
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 = {
29
+ F,
30
+ I
31
+ ]), l(() => {
32
+ R === "wide" && (B.current = F);
33
+ }, [R, F]);
34
+ let [ve, ye] = d(fe ?? null), [be, V] = d(!1), H = u(null), U = u(null), W = C ?? ve, G = W === null ? null : n(W, w, T), K = () => G ?? H.current?.offsetWidth ?? 258, q = (e) => {
35
+ e !== G && (C === void 0 && ye(e), pe?.(e));
36
+ }, xe = (e) => {
37
+ e.button === 0 && (U.current = {
37
38
  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
- }), [
39
+ startWidth: K()
40
+ }, e.currentTarget.setPointerCapture(e.pointerId), V(!0), e.preventDefault());
41
+ }, Se = (e) => {
42
+ let t = U.current;
43
+ t && q(ee(x, t.startWidth, t.startX, e.clientX, w, T));
44
+ }, J = (e) => {
45
+ U.current = null, e.currentTarget.hasPointerCapture(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId), V(!1);
46
+ }, Ce = (e) => {
47
+ let t = te(x, K(), e.key, w, T);
48
+ t !== null && (e.preventDefault(), q(t));
49
+ }, we = G === null ? E : {
50
+ ...E,
51
+ "--kapi-ctxslot-w": `${G}px`
52
+ }, Y = ie({
53
+ collapsedMode: S,
54
+ open: F,
55
+ mobile: L
56
+ }), X = re({
57
+ collapsedMode: S,
58
+ open: F,
59
+ mobile: L
60
+ }), Z = i(), Q = Z?.publish, Te = !!Z && L, $ = c(() => I(!0), [I]);
61
+ l(() => {
62
+ if (Q) {
63
+ if (!L || F || X) Q(null);
64
+ else return Q({
65
+ expand: $,
66
+ label: O.expand,
67
+ side: A ? "right" : "left"
68
+ }), () => Q(null);
69
+ }
70
+ }, [
64
71
  Q,
65
- z,
66
- N
72
+ L,
73
+ F,
74
+ X,
75
+ $,
76
+ O.expand,
77
+ A
78
+ ]);
79
+ let Ee = ue(() => ({
80
+ mini: Y,
81
+ expand: () => I(!0),
82
+ tooltipSide: A ? "left" : "right"
83
+ }), [
84
+ Y,
85
+ I,
86
+ A
67
87
  ]);
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,
88
+ return /* @__PURE__ */ s(le, { children: [/* @__PURE__ */ s("div", {
89
+ ref: H,
90
+ id: D,
91
+ className: t("kapi-ctxslot", A && "kapi-ctxslot--right", !F && "is-collapsed", be && "is-resizing", Y && "is-mini kapi-navmini", X && "is-gone", ge),
92
+ style: we,
73
93
  children: [
74
- ae && R && !B && /* @__PURE__ */ u("div", {
94
+ de && F && !L && /* @__PURE__ */ o("div", {
75
95
  className: "kapi-ctxslot__resize",
76
96
  role: "separator",
77
97
  "aria-orientation": "vertical",
78
- "aria-label": j.resize,
79
- "aria-valuemin": D,
80
- "aria-valuemax": O,
81
- "aria-valuenow": n(J ?? 258, D, O),
98
+ "aria-label": O.resize,
99
+ "aria-valuemin": w,
100
+ "aria-valuemax": T,
101
+ "aria-valuenow": n(G ?? 258, w, T),
82
102
  tabIndex: 0,
83
- onPointerDown: pe,
84
- onPointerMove: me,
85
- onPointerUp: Z,
86
- onPointerCancel: Z,
87
- onKeyDown: he
103
+ onPointerDown: xe,
104
+ onPointerMove: Se,
105
+ onPointerUp: J,
106
+ onPointerCancel: J,
107
+ onKeyDown: Ce
88
108
  }),
89
- /* @__PURE__ */ u("div", {
109
+ /* @__PURE__ */ o("div", {
90
110
  className: "kapi-ctxslot__inner",
91
- inert: !R && !Q,
92
- children: /* @__PURE__ */ d("aside", {
111
+ inert: !F && !Y,
112
+ children: /* @__PURE__ */ s("aside", {
93
113
  className: "kapi-ctxpanel",
94
- "aria-label": M,
95
- children: [/* @__PURE__ */ d("div", {
114
+ "aria-label": k,
115
+ children: [/* @__PURE__ */ s("div", {
96
116
  className: "kapi-ctxpanel__head",
97
- children: [/* @__PURE__ */ u("span", { children: y }), /* @__PURE__ */ d("div", {
117
+ children: [/* @__PURE__ */ o("span", { children: h }), /* @__PURE__ */ s("div", {
98
118
  className: "kapi-ctxpanel__actions",
99
- children: [ie, /* @__PURE__ */ u("button", {
119
+ children: [g, /* @__PURE__ */ o("button", {
100
120
  type: "button",
101
121
  className: "kapi-paneltoggle",
102
- onClick: () => z(!1),
103
- "aria-label": j.collapse,
104
- children: /* @__PURE__ */ u(P, {
122
+ onClick: () => I(!1),
123
+ "aria-label": O.collapse,
124
+ children: /* @__PURE__ */ o(j, {
105
125
  size: 16,
106
126
  strokeWidth: 2,
107
127
  "aria-hidden": "true"
108
128
  })
109
129
  })]
110
130
  })]
111
- }), /* @__PURE__ */ u(i.Provider, {
112
- value: _e,
113
- children: b
131
+ }), /* @__PURE__ */ o(ne.Provider, {
132
+ value: Ee,
133
+ children: _
114
134
  })]
115
135
  })
116
136
  }),
117
- !$ && /* @__PURE__ */ u("button", {
137
+ !X && !Te && /* @__PURE__ */ o("button", {
118
138
  type: "button",
119
139
  className: "kapi-paneltoggle kapi-ctxslot__reopen",
120
- onClick: () => z(!0),
121
- "aria-label": j.expand,
122
- children: /* @__PURE__ */ u(F, {
140
+ onClick: $,
141
+ "aria-label": O.expand,
142
+ children: /* @__PURE__ */ o(M, {
123
143
  size: 16,
124
144
  strokeWidth: 2,
125
145
  "aria-hidden": "true"
126
146
  })
127
147
  })
128
148
  ]
129
- }), /* @__PURE__ */ u("div", {
149
+ }), /* @__PURE__ */ o("div", {
130
150
  className: "kapi-ctxslot__backdrop",
131
- onClick: () => z(!1),
151
+ onClick: () => I(!1),
132
152
  "aria-hidden": "true"
133
153
  })] });
134
154
  };
135
155
  //#endregion
136
- export { v as DEFAULT_CONTEXT_SLOT_LABELS, y as KapiContextSlot };
156
+ export { m as DEFAULT_CONTEXT_SLOT_LABELS, h as KapiContextSlot };
@@ -0,0 +1,30 @@
1
+ import { type HTMLAttributes, type Ref } from "react";
2
+ import { type KapiGap } from "./layoutPrimitives";
3
+ import "./KapiMasonry.css";
4
+ export type KapiMasonryProps = HTMLAttributes<HTMLDivElement> & {
5
+ /** Separación entre ítems, en los dos ejes: número = px, string = largo CSS. Default 12px. */
6
+ gap?: KapiGap | undefined;
7
+ /** Ancho mínimo de columna (número = px, string = largo CSS): `auto-fit` + `minmax`. Default 220px. */
8
+ min?: number | string | undefined;
9
+ /** Cantidad fija de columnas. Si se pasan `cols` y `min`, gana `cols`. */
10
+ cols?: number | undefined;
11
+ /**
12
+ * Alto (px) de una fila de la grilla: el grano con el que se empaqueta. Más chico acomoda más
13
+ * justo pero obliga al navegador a resolver más filas por ítem. Default `8`.
14
+ */
15
+ rowUnit?: number | undefined;
16
+ /** Ref al contenedor de la grilla. */
17
+ ref?: Ref<HTMLDivElement> | undefined;
18
+ };
19
+ /**
20
+ * Masonry: tarjetas de alto distinto que se acomodan en columnas sin dejar huecos verticales, con
21
+ * el orden del DOM igual al orden visual por filas (1, 2, 3 / 4, 5, 6).
22
+ *
23
+ * Es UNA grilla CSS con los ítems en orden como hijos directos; el alto de cada ítem se mide y se
24
+ * traduce en `grid-row-end: span N`. No hay contenedores de columna ni `columns` de CSS (que
25
+ * ordenan por columna), así que el orden de tabulación y lo que anuncia un lector de pantalla
26
+ * coinciden con el visual. Cada hijo de `children` queda envuelto en un `div` que es el ítem de la
27
+ * grilla (un `Fragment` cuenta como un solo hijo). Antes de medir, o sin `ResizeObserver`, es una
28
+ * grilla normal.
29
+ */
30
+ export declare function KapiMasonry({ gap, min, cols, rowUnit, className, style, children, ref, ...rest }: KapiMasonryProps): import("react").JSX.Element;
@@ -0,0 +1,33 @@
1
+ "use client";
2
+ import { joinClasses as e } from "../rootProps.js";
3
+ import { gapValue as t, gridColumns as n } from "./layoutPrimitives.js";
4
+ import { useMasonrySpans as r } from "./useMasonrySpans.js";
5
+ /* empty css */
6
+ import { jsx as i } from "react/jsx-runtime";
7
+ import { Children as a, isValidElement as o } from "react";
8
+ //#region src/components/layout/KapiMasonry.tsx
9
+ function s({ gap: s, min: c, cols: l, rowUnit: u = 8, className: d, style: f, children: p, ref: m, ...h }) {
10
+ let g = a.toArray(p), { spans: _, measured: v, register: y } = r({
11
+ rowUnit: u,
12
+ watch: [s, g.length]
13
+ }), b = t(s), x = n(l, c), S = {
14
+ ...b !== void 0 && { "--kapi-masonry-gap": b },
15
+ ...Number.isFinite(u) && u > 0 && { "--kapi-masonry-row": `${u}px` },
16
+ ...x !== void 0 && { gridTemplateColumns: x },
17
+ ...f
18
+ };
19
+ return /* @__PURE__ */ i("div", {
20
+ ...h,
21
+ ref: m,
22
+ className: e("kapi-masonry", v && "is-measured", d),
23
+ style: S,
24
+ children: g.map((e, t) => /* @__PURE__ */ i("div", {
25
+ ref: y(t),
26
+ className: "kapi-masonry__item",
27
+ style: { gridRowEnd: `span ${_[t] ?? 1}` },
28
+ children: e
29
+ }, o(e) && e.key !== null ? e.key : t))
30
+ });
31
+ }
32
+ //#endregion
33
+ export { s as KapiMasonry };
@@ -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 { useScrollCollapse as n } from "../../hooks/useScrollCollapse.js";
5
- import { pageHeaderBox as r } from "./pageHeaderLogic.js";
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 i, jsx as a, jsxs as o } from "react/jsx-runtime";
8
- import { useLayoutEffect as s, useRef as c } from "react";
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 l = "kapi-pageheader--collapsed", u = "kapi-pageheader--animating", d = "kapi-pageheader--measuring", f = 80, p = (e, t) => {
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(d), e.style.height = "", e.classList.toggle(l, !1);
14
+ e.classList.add(h), e.style.height = "", e.classList.toggle(p, !1);
13
15
  let r = e.getBoundingClientRect().height;
14
- e.classList.toggle(l, !0);
16
+ e.classList.toggle(p, !0);
15
17
  let i = e.getBoundingClientRect().height;
16
- return e.classList.toggle(l, t), e.style.height = n, e.getBoundingClientRect(), e.classList.remove(d), {
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
- }, m = (e, t) => {
21
- let n = r(e, t);
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
- }, h = (e, t, n) => {
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 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
+ 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
- }), A = c(D);
37
- A.current = D;
38
- let j = c(!1), M = c(!1);
39
- s(() => {
40
- let e = O.current;
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
- M.current || (k.current = p(e, A.current), h(e, m(k.current, A.current), !1));
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
- l,
63
- d,
64
- g,
65
- _,
66
- v,
67
- y,
68
- S
69
- ]), s(() => {
70
- let n = O.current;
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: i } = k.current, a = r(k.current, D), o = j.current && !e(n);
73
- j.current = !0;
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
- M.current = !1, n.classList.remove(u), D || n.style.removeProperty("height");
77
+ I.current = !1, n.classList.remove(m), j || n.style.removeProperty("height");
76
78
  };
77
79
  if (!o) {
78
- h(n, m(k.current, D), !1);
80
+ y(n, v(N.current, j), !1);
79
81
  return;
80
82
  }
81
- n.style.height === "" && i > 0 && (n.style.height = `${i}px`, n.getBoundingClientRect()), M.current = !0, n.classList.add(u), h(n, a, !0);
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), d = window.setTimeout(s, t(l.transitionDuration, l.transitionDelay) + f);
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(d);
90
+ n.removeEventListener("transitionend", c), window.clearTimeout(u);
89
91
  };
90
- }, [D]);
91
- let N = [
92
+ }, [j]);
93
+ let L = [
92
94
  "kapi-pageheader",
93
- b && "kapi-pageheader--sticky",
94
- S && "kapi-pageheader--cq",
95
- D && "kapi-pageheader--collapsed",
96
- C
97
- ].filter(Boolean).join(" ");
98
- return /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ a("div", {
99
- ref: E,
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__ */ o("header", {
103
- ...w,
104
- ref: O,
105
- className: N,
106
- children: [/* @__PURE__ */ o("div", {
107
- className: "kapi-pageheader__main",
108
- children: [
109
- /* @__PURE__ */ o("div", {
110
- className: "kapi-pageheader__titlerow",
111
- children: [/* @__PURE__ */ a("h1", {
112
- className: "kapi-pageheader__title",
113
- children: l
114
- }), v]
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
- }), _ && /* @__PURE__ */ a("div", {
126
- className: "kapi-pageheader__actions",
127
- children: _
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 { g as KapiPageHeader };
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;