@kapiuara/ui 0.7.0 → 0.9.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 (38) hide show
  1. package/README.md +100 -3
  2. package/dist/components/data/KapiPagination.d.ts +13 -4
  3. package/dist/components/data/KapiPagination.js +31 -88
  4. package/dist/components/data/KapiPaginationFooter.d.ts +35 -0
  5. package/dist/components/data/KapiPaginationFooter.js +106 -0
  6. package/dist/components/data/KapiTable.d.ts +71 -4
  7. package/dist/components/data/KapiTable.js +421 -439
  8. package/dist/components/data/datasetSelectionLogic.d.ts +22 -0
  9. package/dist/components/data/datasetSelectionLogic.js +5 -0
  10. package/dist/components/data/index.d.ts +2 -1
  11. package/dist/components/display/KapiTruncate.d.ts +32 -0
  12. package/dist/components/display/KapiTruncate.js +43 -0
  13. package/dist/components/display/index.d.ts +3 -0
  14. package/dist/components/display/truncateLogic.d.ts +6 -0
  15. package/dist/components/display/truncateLogic.js +4 -0
  16. package/dist/components/inputs/KapiSegmented.d.ts +7 -1
  17. package/dist/components/inputs/KapiSegmented.js +1 -0
  18. package/dist/components/layout/KapiContextSlot.d.ts +34 -6
  19. package/dist/components/layout/KapiContextSlot.js +115 -71
  20. package/dist/components/layout/KapiPageHeader.js +49 -24
  21. package/dist/components/layout/KapiShell.d.ts +19 -3
  22. package/dist/components/layout/KapiShell.js +20 -19
  23. package/dist/components/layout/pageHeaderLogic.d.ts +13 -0
  24. package/dist/components/layout/pageHeaderLogic.js +4 -0
  25. package/dist/components/navigation/panelMiniLogic.d.ts +10 -1
  26. package/dist/components/navigation/panelMiniLogic.js +2 -2
  27. package/dist/components/overlays/KapiOffcanvas.js +124 -118
  28. package/dist/hooks/index.d.ts +1 -1
  29. package/dist/hooks/themeDeriveLogic.d.ts +15 -0
  30. package/dist/hooks/themeDeriveLogic.js +54 -32
  31. package/dist/hooks/themeRadiiLogic.d.ts +11 -0
  32. package/dist/hooks/themeRadiiLogic.js +31 -0
  33. package/dist/hooks/useKapiTheme.d.ts +10 -3
  34. package/dist/hooks/useKapiTheme.js +66 -57
  35. package/dist/index.js +111 -108
  36. package/dist/kapi.css +1 -1
  37. package/dist/kapi.layered.css +1 -1
  38. package/package.json +1 -1
@@ -0,0 +1,22 @@
1
+ import type { SelectionState } from "./tableLogic";
2
+ export type DatasetNoticeState = "none" | "offer" | "selected";
3
+ /**
4
+ * Qué aviso corresponde: ninguno, la oferta de extender, o el de ya extendido.
5
+ * Una selección parcial nunca ofrece: no se puede extrapolar al dataset.
6
+ */
7
+ export declare const datasetNoticeState: (input: {
8
+ /** Estado del checkbox de la cabecera. */
9
+ headerState: SelectionState;
10
+ /** Filas seleccionables que la tabla tiene. */
11
+ shown: number;
12
+ /** Filas del dataset completo. */
13
+ total: number;
14
+ /** El consumidor ya extendió la selección. */
15
+ selected: boolean;
16
+ }) => DatasetNoticeState;
17
+ /** Aviso de oferta: «Seleccionaste las 10 de esta página.» («filas» es femenino). */
18
+ export declare const datasetHintLabel: (shown: number) => string;
19
+ /** Acción que extiende (sólo se ofrece con más de una fila, así que va siempre en plural): «Seleccionar las 1.234 del total». */
20
+ export declare const datasetActionLabel: (total: number) => string;
21
+ /** Aviso ya extendido: «Están seleccionadas las 1.234 del total.». */
22
+ export declare const datasetSelectedLabel: (total: number) => string;
@@ -0,0 +1,5 @@
1
+ import { formatCount as e } from "../../hooks/numberFormatLogic.js";
2
+ //#region src/components/data/datasetSelectionLogic.ts
3
+ var t = (e) => e.selected ? "selected" : e.headerState === "all" && e.shown > 0 && e.total > e.shown ? "offer" : "none", n = (t) => t === 1 ? "Seleccionaste la única de esta página." : `Seleccionaste las ${e(t)} de esta página.`, r = (t) => `Seleccionar las ${e(t)} del total`, i = (t) => t === 1 ? "Está seleccionada la única del total." : `Están seleccionadas las ${e(t)} del total.`;
4
+ //#endregion
5
+ export { r as datasetActionLabel, n as datasetHintLabel, t as datasetNoticeState, i as datasetSelectedLabel };
@@ -1,5 +1,6 @@
1
1
  export { KapiTable, DEFAULT_TABLE_LABELS } from "./KapiTable";
2
- export type { KapiTableColumn, KapiTableCellValue, KapiTableSortDirection, KapiTableSortState, KapiTableSortValue, KapiTableCsvOptions, KapiTableLabels, KapiTableProps, KapiTableSelectionPreset } from "./KapiTable";
2
+ export type { KapiTableColumn, KapiTableCellValue, KapiTableSortDirection, KapiTableSortState, KapiTableSortValue, KapiTableCsvOptions, KapiTableDataset, KapiTableLabels, KapiTableProps, KapiTableSelectionPreset } from "./KapiTable";
3
+ export { datasetNoticeState, datasetHintLabel, datasetActionLabel, datasetSelectedLabel } from "./datasetSelectionLogic";
3
4
  export { KapiTableFilter, DEFAULT_TABLE_FILTER_LABELS } from "./KapiTableFilter";
4
5
  export type { KapiTableFilterProps, KapiTableFilterLabels } from "./KapiTableFilter";
5
6
  export { KapiPagination } from "./KapiPagination";
@@ -0,0 +1,32 @@
1
+ import { type HTMLAttributes, type Ref } from "react";
2
+ import { type KapiTooltipSide } from "../overlays/KapiTooltip";
3
+ import "./KapiTruncate.css";
4
+ /** Atributos nativos (`id`, `style`, `data-*`…) van al contenedor; el texto va por `text`. */
5
+ export type KapiTruncateProps = Omit<HTMLAttributes<HTMLSpanElement>, "children"> & {
6
+ /** Texto a mostrar. Es `string` y no `ReactNode` porque el mismo valor es la etiqueta del tooltip. */
7
+ text: string;
8
+ /** Lado preferido del tooltip: se respeta si entra, si no va al opuesto. */
9
+ prefer?: KapiTooltipSide | undefined;
10
+ /**
11
+ * Suma el texto al orden de tabulación para que el tooltip se pueda abrir con teclado. Default `false`:
12
+ * el texto completo ya está en el árbol de accesibilidad, así que un lector de pantalla lo lee entero;
13
+ * el salto de tabulación es sólo para quien ve la pantalla y navega con teclado, y uno por celda
14
+ * inundaría el orden de tabulación de una tabla.
15
+ * @default false
16
+ */
17
+ focusable?: boolean | undefined;
18
+ /** Ref al contenedor. */
19
+ ref?: Ref<HTMLSpanElement> | undefined;
20
+ };
21
+ /**
22
+ * Texto de una línea con ellipsis que muestra el texto completo en un tooltip **sólo si de verdad quedó
23
+ * cortado**: sin esa condición el tooltip repetiría algo que ya se lee, que es ruido.
24
+ *
25
+ * Por qué hay dos elementos y se mide cruzado: `KapiTooltip` envuelve a su disparador en un
26
+ * `<span class="kapi-tip">` que es `inline-flex`, o sea shrink-to-fit. Si se midiera el elemento del
27
+ * texto contra su propio padre, montar el tooltip cambiaría el ancho disponible y el resultado se
28
+ * invertiría: truncado → envuelvo → ya no truncado → desenvuelvo → truncado, en bucle. Acá el ancho
29
+ * disponible se lee del contenedor externo (que nunca cambia de forma) y el del contenido es el
30
+ * `scrollWidth` del texto (intrínseco, no depende del padre), así que la medición es estable.
31
+ */
32
+ export declare const KapiTruncate: ({ text, prefer, focusable, className, ref, ...rest }: KapiTruncateProps) => import("react").JSX.Element;
@@ -0,0 +1,43 @@
1
+ "use client";
2
+ import { joinClasses as e } from "../rootProps.js";
3
+ import { KapiTooltip as t } from "../overlays/KapiTooltip.js";
4
+ import { isTruncated as n } from "./truncateLogic.js";
5
+ /* empty css */
6
+ import { jsx as r } from "react/jsx-runtime";
7
+ import { useCallback as i, useEffect as a, useRef as o, useState as s } from "react";
8
+ //#region src/components/display/KapiTruncate.tsx
9
+ var c = ({ text: c, prefer: l = "top", focusable: u = !1, className: d, ref: f, ...p }) => {
10
+ let m = o(null), h = o(null), [g, _] = s(!1), v = i(() => {
11
+ let e = m.current, t = h.current;
12
+ e && t && _(n(t.scrollWidth, e.clientWidth));
13
+ }, []);
14
+ a(() => {
15
+ v();
16
+ let e = m.current;
17
+ if (!e || typeof ResizeObserver > "u") return;
18
+ let t = new ResizeObserver(v);
19
+ return t.observe(e), () => t.disconnect();
20
+ }, [v, c]);
21
+ let y = /* @__PURE__ */ r("span", {
22
+ className: "kapi-truncate__text",
23
+ ref: h,
24
+ ...u ? { tabIndex: 0 } : {},
25
+ children: c
26
+ });
27
+ return /* @__PURE__ */ r("span", {
28
+ ...p,
29
+ ref: (e) => {
30
+ m.current = e, typeof f == "function" ? f(e) : f && (f.current = e);
31
+ },
32
+ className: e("kapi-truncate", d),
33
+ "data-truncated": g || void 0,
34
+ children: g ? /* @__PURE__ */ r(t, {
35
+ label: c,
36
+ prefer: l,
37
+ className: "kapi-truncate__tip",
38
+ children: y
39
+ }) : y
40
+ });
41
+ };
42
+ //#endregion
43
+ export { c as KapiTruncate };
@@ -39,3 +39,6 @@ export { KapiCommentComposer, DEFAULT_COMMENT_COMPOSER_LABELS } from "./KapiComm
39
39
  export type { KapiCommentComposerLabels, KapiCommentComposerProps } from "./KapiCommentComposer";
40
40
  export { canSubmitComment, isSubmitShortcut } from "./commentLogic";
41
41
  export type { KapiSubmitShortcut } from "./commentLogic";
42
+ export { KapiTruncate } from "./KapiTruncate";
43
+ export type { KapiTruncateProps } from "./KapiTruncate";
44
+ export { isTruncated } from "./truncateLogic";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * `true` cuando el contenido no entra en el ancho disponible y por lo tanto el ellipsis está cortando.
3
+ * `contentWidth` es el ancho intrínseco del texto (`scrollWidth` del elemento con `overflow: hidden`) y
4
+ * `availableWidth` el del contenedor que le impone el límite (`clientWidth`).
5
+ */
6
+ export declare const isTruncated: (contentWidth: number, availableWidth: number) => boolean;
@@ -0,0 +1,4 @@
1
+ //#region src/components/display/truncateLogic.ts
2
+ var e = (e, t) => e - t > 1;
3
+ //#endregion
4
+ export { e as isTruncated };
@@ -9,8 +9,14 @@ export type KapiSegmentedItem<Id extends string | number = string> = {
9
9
  /** Contador en píldora a la derecha, con separadores de miles del español, que agrupa desde
10
10
  * cinco cifras (`14760` → «14.760»; `4760` queda «4760»). */
11
11
  count?: number;
12
- /** Color del ítem cuando está activo (en vez del primario). */
12
+ /** Color del ítem cuando está activo (en vez del primario); sin activar no se ve. */
13
13
  color?: KapiSegmentedColor;
14
+ /**
15
+ * Estado permanente del ítem: tiñe el label y el contador **siempre**, sin tocar el fondo, para que una
16
+ * opción que necesita atención («Demorados 41») se vea sin tener que elegirla. Si además está activa, el
17
+ * tratamiento de `color` gana.
18
+ */
19
+ tone?: KapiSegmentedColor;
14
20
  };
15
21
  /** Atributos nativos (`id`, `style`, `data-*`…) van al `radiogroup`; el rol y el teclado son propios. */
16
22
  export type KapiSegmentedProps<Id extends string | number = string> = Omit<HTMLAttributes<HTMLDivElement>, "children" | "onChange" | "defaultValue" | "role" | "onKeyDown"> & {
@@ -53,6 +53,7 @@ var d = ({ items: d, value: f, onChange: p, variant: m = "text", "aria-label": h
53
53
  "aria-label": m === "icon" ? e.label : void 0,
54
54
  className: `kapi-seg__btn${n ? " is-on" : ""}`,
55
55
  "data-color": n && e.color ? e.color : void 0,
56
+ "data-tone": e.tone,
56
57
  onClick: () => p(e.id),
57
58
  children: [
58
59
  (m === "icon" || m === "both") && e.icon && /* @__PURE__ */ l("span", {
@@ -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
- * Cómo queda plegado en desktop: `hidden` (default) lo oculta y deja el botón de reabrir; `mini` deja una tira
24
- * de íconos (los `KapiPanelItem`, ítems de `KapiContextSections` y cabeceras de `KapiPanelGroup`) con tooltip
25
- * y avisos. En móvil siempre es un drawer.
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 n } from "../navigation/panelMini.js";
6
- import { resolveMini as r } from "../navigation/panelMiniLogic.js";
7
- import { SHELL_MOBILE_QUERY as i, matchesQuery as a, useMediaQuery as o } from "../../hooks/useMediaQuery.js";
8
- import { openOnBreakpointCross as s } from "../../hooks/breakpointOpenLogic.js";
9
- import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
10
- import { useCallback as d, useEffect as f, useMemo as p, useRef as m, useState as h } from "react";
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
- }, y = ({ title: y, actions: b, children: x, open: S, defaultOpen: C, onOpenChange: w, side: T = "left", collapsedMode: E = "hidden", "aria-label": D, labels: O, className: k, style: A, id: j }) => {
18
- let M = e("contextSlot", v, O), N = D ?? M.region, P = T === "right", F = P ? _ : g, I = P ? g : _, [L, R] = h(() => C ?? !a("(max-width: 768px)")), z = S ?? L, B = d((e) => {
19
- S === void 0 && R(e), w?.(e);
20
- }, [S, w]), V = o(i), H = m(V), U = m(V ? C ?? !0 : z);
21
- f(() => {
22
- let e = s(H.current, V, U.current);
23
- H.current = V, e !== null && e !== z && B(e);
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
- P
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__ */ u(c, { children: [/* @__PURE__ */ u("div", {
45
- id: j,
46
- className: t("kapi-ctxslot", P && "kapi-ctxslot--right", !z && "is-collapsed", W && "is-mini kapi-navmini", k),
47
- style: A,
48
- children: [/* @__PURE__ */ l("div", {
49
- className: "kapi-ctxslot__inner",
50
- children: /* @__PURE__ */ u("aside", {
51
- className: "kapi-ctxpanel",
52
- "aria-label": N,
53
- children: [/* @__PURE__ */ u("div", {
54
- className: "kapi-ctxpanel__head",
55
- children: [/* @__PURE__ */ l("span", { children: y }), /* @__PURE__ */ u("div", {
56
- className: "kapi-ctxpanel__actions",
57
- children: [b, /* @__PURE__ */ l("button", {
58
- type: "button",
59
- className: "kapi-paneltoggle",
60
- onClick: () => B(!1),
61
- "aria-label": M.collapse,
62
- children: /* @__PURE__ */ l(F, {
63
- size: 16,
64
- strokeWidth: 2,
65
- "aria-hidden": "true"
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
- }), /* @__PURE__ */ l(n.Provider, {
70
- value: G,
71
- children: x
72
- })]
73
- })
74
- }), /* @__PURE__ */ l("button", {
75
- type: "button",
76
- className: "kapi-paneltoggle kapi-ctxslot__reopen",
77
- onClick: () => B(!0),
78
- "aria-label": M.expand,
79
- children: /* @__PURE__ */ l(I, {
80
- size: 16,
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__ */ l("div", {
128
+ ]
129
+ }), /* @__PURE__ */ u("div", {
86
130
  className: "kapi-ctxslot__backdrop",
87
- onClick: () => B(!1),
131
+ onClick: () => z(!1),
88
132
  "aria-hidden": "true"
89
133
  })] });
90
134
  };
@@ -1,47 +1,72 @@
1
1
  "use client";
2
2
  import { useScrollCollapse as e } from "../../hooks/useScrollCollapse.js";
3
+ import { pageHeaderSpacerHeight as t } from "./pageHeaderLogic.js";
3
4
  /* empty css */
4
- import { Fragment as t, jsx as n, jsxs as r } from "react/jsx-runtime";
5
+ import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
6
+ import { useLayoutEffect as a, useRef as o } from "react";
5
7
  //#region src/components/layout/KapiPageHeader.tsx
6
- function i({ title: i, subtitle: a, meta: o, actions: s, chip: c, collapseOnScroll: l = !0, sticky: u = !0, scrollRoot: d = null, responsive: f = !0, className: p, ...m }) {
7
- let { collapsed: h, sentinelRef: g } = e({ root: d }), _ = [
8
+ function s({ title: s, subtitle: c, meta: l, actions: u, chip: d, collapseOnScroll: f = !0, sticky: p = !0, scrollRoot: m = null, responsive: h = !0, className: g, ..._ }) {
9
+ let { collapsed: v, sentinelRef: y } = e({ root: m }), b = f && v, x = o(null), S = o(0);
10
+ a(() => {
11
+ let e = x.current;
12
+ if (!e) return;
13
+ let n = () => {
14
+ let n = e.getBoundingClientRect().height;
15
+ b || (S.current = n);
16
+ let r = b ? t(S.current, n) : 0;
17
+ e.style.setProperty("--kapi-pageheader-reserve", `${r}px`);
18
+ };
19
+ if (n(), typeof ResizeObserver > "u") return;
20
+ let r = new ResizeObserver(n);
21
+ return r.observe(e), () => r.disconnect();
22
+ }, [
23
+ b,
24
+ f,
25
+ s,
26
+ c,
27
+ l,
28
+ u,
29
+ d
30
+ ]);
31
+ let C = [
8
32
  "kapi-pageheader",
9
- u && "kapi-pageheader--sticky",
10
- f && "kapi-pageheader--cq",
11
- l && h && "kapi-pageheader--collapsed",
12
- p
33
+ p && "kapi-pageheader--sticky",
34
+ h && "kapi-pageheader--cq",
35
+ b && "kapi-pageheader--collapsed",
36
+ g
13
37
  ].filter(Boolean).join(" ");
14
- return /* @__PURE__ */ r(t, { children: [/* @__PURE__ */ n("div", {
15
- ref: g,
38
+ return /* @__PURE__ */ i(n, { children: [/* @__PURE__ */ r("div", {
39
+ ref: y,
16
40
  className: "kapi-pageheader__sentinel",
17
41
  "aria-hidden": !0
18
- }), /* @__PURE__ */ r("header", {
19
- ...m,
20
- className: _,
21
- children: [/* @__PURE__ */ r("div", {
42
+ }), /* @__PURE__ */ i("header", {
43
+ ..._,
44
+ ref: x,
45
+ className: C,
46
+ children: [/* @__PURE__ */ i("div", {
22
47
  className: "kapi-pageheader__main",
23
48
  children: [
24
- /* @__PURE__ */ r("div", {
49
+ /* @__PURE__ */ i("div", {
25
50
  className: "kapi-pageheader__titlerow",
26
- children: [/* @__PURE__ */ n("h1", {
51
+ children: [/* @__PURE__ */ r("h1", {
27
52
  className: "kapi-pageheader__title",
28
- children: i
29
- }), c]
53
+ children: s
54
+ }), d]
30
55
  }),
31
- a && /* @__PURE__ */ n("div", {
56
+ c && /* @__PURE__ */ r("div", {
32
57
  className: "kapi-pageheader__subtitle",
33
- children: a
58
+ children: c
34
59
  }),
35
- o && /* @__PURE__ */ n("div", {
60
+ l && /* @__PURE__ */ r("div", {
36
61
  className: "kapi-pageheader__meta",
37
- children: o
62
+ children: l
38
63
  })
39
64
  ]
40
- }), s && /* @__PURE__ */ n("div", {
65
+ }), u && /* @__PURE__ */ r("div", {
41
66
  className: "kapi-pageheader__actions",
42
- children: s
67
+ children: u
43
68
  })]
44
69
  })] });
45
70
  }
46
71
  //#endregion
47
- export { i as KapiPageHeader };
72
+ export { s as KapiPageHeader };
@@ -10,6 +10,11 @@ export type KapiShellProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> &
10
10
  rail?: ReactNode;
11
11
  /** Panel contextual (típicamente `<KapiContextSlot />`). OPCIONAL. */
12
12
  panel?: ReactNode;
13
+ /**
14
+ * Panel contextual derecho (típicamente `<KapiContextSlot side="right" aria-label="…" />`). OPCIONAL. Pásale
15
+ * `side="right"` al slot (la cáscara no puede, es tu componente) y un nombre accesible distinto del panel izquierdo.
16
+ */
17
+ panelRight?: ReactNode;
13
18
  /** Contenido de la página; va dentro de `<main class="kapi-content">` (el que scrollea). */
14
19
  children?: ReactNode;
15
20
  /** Ítems del menú del sistema (doble click derecho). Sin ítems no se abre menú. */
@@ -35,13 +40,24 @@ export type KapiShellProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> &
35
40
  /**
36
41
  * Marco de la app. Es la raíz `.kapi` (tokens, tema, fuente) y compone:
37
42
  *
38
- * [rail?] [panel?] <main.kapi-content>
43
+ * [rail?] [panel?] <main.kapi-content> [panelRight?]
44
+ *
45
+ * Rail y paneles son opcionales e independientes: el contenido no depende de ninguno.
39
46
  *
40
- * Rail y panel son opcionales e independientes: el contenido no depende de ninguno.
47
+ * Con `panelRight`, el `KapiContextSlot` que va ahí necesita `side="right"`: la cáscara no puede
48
+ * ponérselo (es un componente tuyo) y sin eso el borde, los íconos de plegar y el drawer móvil
49
+ * apuntan al lado equivocado. Con dos paneles, cada `<aside>` necesita un nombre accesible distinto
50
+ * (`aria-label` o `labels.region`): los dos usan por defecto «Panel contextual», y dos landmarks con
51
+ * el mismo nombre no se distinguen con un lector de pantalla.
41
52
  *
42
53
  * // con rail + panel
43
54
  * <KapiShell rail={<KapiRail items={…} />} panel={<KapiContextSlot title="Módulo">…</KapiContextSlot>}>…</KapiShell>
55
+ * // con panel a cada lado
56
+ * <KapiShell
57
+ * panel={<KapiContextSlot aria-label="Secciones" title="Módulo">…</KapiContextSlot>}
58
+ * panelRight={<KapiContextSlot side="right" aria-label="Detalle" title="Detalle">…</KapiContextSlot>}
59
+ * >…</KapiShell>
44
60
  * // sin rail (otra navegación, p. ej. tabs arriba o router propio)
45
61
  * <KapiShell><MiTopNav /><Pagina /></KapiShell>
46
62
  */
47
- export declare const KapiShell: ({ rail, panel, children, contextMenuItems, rightClick, overlays, className, contentClassName, storageNamespace, brandTheme, style, ...rest }: KapiShellProps) => import("react").JSX.Element;
63
+ export declare const KapiShell: ({ rail, panel, panelRight, children, contextMenuItems, rightClick, overlays, className, contentClassName, storageNamespace, brandTheme, style, ...rest }: KapiShellProps) => import("react").JSX.Element;
@@ -6,40 +6,41 @@ import { KapiThemeContext as r, themeRootStyle as i, useKapiThemeState as a } fr
6
6
  import { jsx as o, jsxs as s } from "react/jsx-runtime";
7
7
  import { useMemo as c, useState as l } from "react";
8
8
  //#region src/components/layout/KapiShell.tsx
9
- var u = ({ rail: u, panel: d, children: f, contextMenuItems: p, rightClick: m = !0, overlays: h, className: g, contentClassName: _ = "", storageNamespace: v, brandTheme: y, style: b, ...x }) => {
10
- let S = a({ namespace: v }), C = c(() => i(S, y), [S, y]), [w, T] = l(null);
9
+ var u = ({ rail: u, panel: d, panelRight: f, children: p, contextMenuItems: m, rightClick: h = !0, overlays: g, className: _, contentClassName: v = "", storageNamespace: y, brandTheme: b, style: x, ...S }) => {
10
+ let C = a({ namespace: y }), w = c(() => i(C, b), [C, b]), [T, E] = l(null);
11
11
  return n({
12
- enabled: m,
13
- onMenu: p?.length ? (e, t) => T({
12
+ enabled: h,
13
+ onMenu: m?.length ? (e, t) => E({
14
14
  x: e,
15
15
  y: t
16
16
  }) : void 0
17
17
  }), /* @__PURE__ */ o(r.Provider, {
18
- value: S,
18
+ value: C,
19
19
  children: /* @__PURE__ */ s("div", {
20
- ...x,
21
- className: e("kapi", g),
22
- "data-theme": S.theme,
23
- "data-motion": S.motion === "reduced" ? "reduced" : void 0,
20
+ ...S,
21
+ className: e("kapi", _),
22
+ "data-theme": C.theme,
23
+ "data-motion": C.motion === "reduced" ? "reduced" : void 0,
24
24
  style: {
25
- ...b,
26
- ...C
25
+ ...x,
26
+ ...w
27
27
  },
28
28
  children: [
29
29
  u,
30
30
  d,
31
31
  /* @__PURE__ */ o("main", {
32
- className: `kapi-content${_ ? ` ${_}` : ""}`,
32
+ className: `kapi-content${v ? ` ${v}` : ""}`,
33
33
  tabIndex: 0,
34
- children: f
34
+ children: p
35
35
  }),
36
- h,
37
- w && p && /* @__PURE__ */ o(t, {
36
+ f,
37
+ g,
38
+ T && m && /* @__PURE__ */ o(t, {
38
39
  open: !0,
39
- x: w.x,
40
- y: w.y,
41
- items: p,
42
- onClose: () => T(null)
40
+ x: T.x,
41
+ y: T.y,
42
+ items: m,
43
+ onClose: () => E(null)
43
44
  })
44
45
  ]
45
46
  })