@kapiuara/ui 0.15.3 → 0.16.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 (145) hide show
  1. package/LICENSE +19 -15
  2. package/README.md +338 -6
  3. package/dist/components/data/KapiDataTable.d.ts +1 -1
  4. package/dist/components/data/KapiDataTable.js +22 -22
  5. package/dist/components/data/KapiPaginationFooter.js +1 -1
  6. package/dist/components/data/KapiSheet.d.ts +105 -0
  7. package/dist/components/data/KapiSheet.js +75 -0
  8. package/dist/components/data/KapiTable.d.ts +2 -2
  9. package/dist/components/data/KapiTable.js +347 -329
  10. package/dist/components/data/KapiTableFooter.d.ts +22 -0
  11. package/dist/components/data/KapiTableFooter.js +55 -0
  12. package/dist/components/data/KapiTableRow.js +53 -52
  13. package/dist/components/data/KapiTableToolbar.d.ts +4 -2
  14. package/dist/components/data/KapiTableToolbar.js +71 -69
  15. package/dist/components/data/index.d.ts +3 -1
  16. package/dist/components/data/tableCells.d.ts +5 -4
  17. package/dist/components/data/tableCells.js +42 -41
  18. package/dist/components/data/tableLogic.d.ts +2 -0
  19. package/dist/components/data/tableLogic.js +66 -66
  20. package/dist/components/data/tableSlots.d.ts +9 -0
  21. package/dist/components/data/tableSlots.js +12 -0
  22. package/dist/components/data/tableSpanLogic.d.ts +35 -0
  23. package/dist/components/data/tableSpanLogic.js +47 -0
  24. package/dist/components/data/tableTypes.d.ts +54 -1
  25. package/dist/components/data/useTableSelection.d.ts +4 -2
  26. package/dist/components/data/useTableSelection.js +27 -23
  27. package/dist/components/display/KapiAnchor.d.ts +36 -0
  28. package/dist/components/display/KapiAnchor.js +36 -0
  29. package/dist/components/display/KapiBadge.d.ts +6 -5
  30. package/dist/components/display/KapiBadge.js +25 -19
  31. package/dist/components/display/KapiText.d.ts +43 -0
  32. package/dist/components/display/KapiText.js +33 -0
  33. package/dist/components/display/KapiTitle.d.ts +33 -0
  34. package/dist/components/display/KapiTitle.js +29 -0
  35. package/dist/components/display/index.d.ts +7 -0
  36. package/dist/components/display/textLogic.d.ts +32 -0
  37. package/dist/components/display/textLogic.js +19 -0
  38. package/dist/components/feedback/KapiAlert.d.ts +8 -4
  39. package/dist/components/feedback/KapiAlert.js +39 -34
  40. package/dist/components/inputs/KapiButton.d.ts +7 -4
  41. package/dist/components/inputs/KapiButton.js +47 -42
  42. package/dist/components/inputs/KapiSelect.d.ts +12 -0
  43. package/dist/components/inputs/KapiSelect.js +215 -212
  44. package/dist/components/inputs/KapiSelectMenu.d.ts +4 -2
  45. package/dist/components/inputs/KapiSelectMenu.js +131 -133
  46. package/dist/components/inputs/fieldLogic.d.ts +2 -2
  47. package/dist/components/inputs/index.d.ts +1 -1
  48. package/dist/components/inputs/selectSlots.d.ts +24 -0
  49. package/dist/components/inputs/selectSlots.js +27 -0
  50. package/dist/components/layout/KapiBox.d.ts +31 -0
  51. package/dist/components/layout/KapiBox.js +26 -0
  52. package/dist/components/layout/KapiCard.d.ts +16 -4
  53. package/dist/components/layout/KapiCard.js +46 -34
  54. package/dist/components/layout/KapiCenter.d.ts +13 -0
  55. package/dist/components/layout/KapiCenter.js +23 -0
  56. package/dist/components/layout/KapiCol.d.ts +22 -0
  57. package/dist/components/layout/KapiCol.js +23 -0
  58. package/dist/components/layout/KapiGrid.d.ts +29 -3
  59. package/dist/components/layout/KapiGrid.js +39 -17
  60. package/dist/components/layout/KapiPageHeader.d.ts +10 -1
  61. package/dist/components/layout/KapiPageHeader.js +82 -80
  62. package/dist/components/layout/KapiPanelParts.d.ts +11 -2
  63. package/dist/components/layout/KapiPanelParts.js +73 -56
  64. package/dist/components/layout/KapiRail.d.ts +10 -1
  65. package/dist/components/layout/KapiRail.js +123 -120
  66. package/dist/components/layout/KapiRoot.d.ts +35 -5
  67. package/dist/components/layout/KapiRoot.js +54 -39
  68. package/dist/components/layout/KapiShell.d.ts +36 -3
  69. package/dist/components/layout/KapiShell.js +53 -50
  70. package/dist/components/layout/cardSlots.d.ts +9 -0
  71. package/dist/components/layout/cardSlots.js +12 -0
  72. package/dist/components/layout/gridSpanLogic.d.ts +46 -0
  73. package/dist/components/layout/gridSpanLogic.js +39 -0
  74. package/dist/components/layout/index.d.ts +11 -4
  75. package/dist/components/layout/layoutPrimitives.d.ts +11 -0
  76. package/dist/components/layout/layoutPrimitives.js +12 -1
  77. package/dist/components/layout/pageHeaderSlots.d.ts +12 -0
  78. package/dist/components/layout/pageHeaderSlots.js +15 -0
  79. package/dist/components/layout/railLogic.d.ts +16 -3
  80. package/dist/components/layout/railSlots.d.ts +12 -0
  81. package/dist/components/layout/railSlots.js +15 -0
  82. package/dist/components/layout/shellSlots.d.ts +6 -0
  83. package/dist/components/layout/shellSlots.js +9 -0
  84. package/dist/components/layout/useGridBreakpoint.d.ts +12 -0
  85. package/dist/components/layout/useGridBreakpoint.js +35 -0
  86. package/dist/components/navigation/KapiBreadcrumb.d.ts +18 -2
  87. package/dist/components/navigation/KapiBreadcrumb.js +23 -16
  88. package/dist/components/navigation/KapiContextPanel.d.ts +17 -4
  89. package/dist/components/navigation/KapiContextPanel.js +151 -135
  90. package/dist/components/navigation/KapiPanelGroup.d.ts +16 -4
  91. package/dist/components/navigation/KapiPanelGroup.js +66 -65
  92. package/dist/components/navigation/KapiTabs.d.ts +12 -0
  93. package/dist/components/navigation/KapiTabs.js +87 -71
  94. package/dist/components/navigation/MiniNavItem.d.ts +7 -2
  95. package/dist/components/navigation/MiniNavItem.js +41 -36
  96. package/dist/components/navigation/breadcrumbLogic.d.ts +4 -2
  97. package/dist/components/navigation/breadcrumbLogic.js +1 -1
  98. package/dist/components/navigation/navLink.d.ts +21 -0
  99. package/dist/components/navigation/navLink.js +26 -0
  100. package/dist/components/navigation/navLinkLogic.d.ts +18 -0
  101. package/dist/components/navigation/navLinkLogic.js +22 -0
  102. package/dist/components/overlays/KapiContextMenu.d.ts +8 -0
  103. package/dist/components/overlays/KapiModal.d.ts +9 -0
  104. package/dist/components/overlays/KapiModal.js +77 -75
  105. package/dist/components/overlays/index.d.ts +1 -1
  106. package/dist/components/overlays/menuList.js +123 -113
  107. package/dist/components/overlays/modalSlots.d.ts +11 -0
  108. package/dist/components/overlays/modalSlots.js +14 -0
  109. package/dist/components/slotCatalog.d.ts +90 -0
  110. package/dist/components/slotCatalog.js +19 -0
  111. package/dist/components/slotsLogic.d.ts +34 -0
  112. package/dist/components/slotsLogic.js +18 -0
  113. package/dist/components/tone.d.ts +26 -0
  114. package/dist/components/tone.js +15 -14
  115. package/dist/css/base.css +1 -1
  116. package/dist/css/components/data/KapiEventCalendar.css +1 -1
  117. package/dist/css/components/data/KapiTable.css +1 -1
  118. package/dist/css/components/display/display.css +1 -1
  119. package/dist/css/components/display/typography.css +1 -0
  120. package/dist/css/components/feedback/feedback.css +1 -1
  121. package/dist/css/components/inputs/KapiButton.css +1 -1
  122. package/dist/css/components/inputs/KapiDatePicker.css +1 -1
  123. package/dist/css/components/layout/KapiBox.css +1 -0
  124. package/dist/css/components/layout/KapiRail.css +1 -1
  125. package/dist/css/components/layout/gridSpan.css +1 -0
  126. package/dist/css/components/navigation/navigation.css +1 -1
  127. package/dist/hooks/densityLogic.d.ts +15 -0
  128. package/dist/hooks/densityLogic.js +4 -0
  129. package/dist/hooks/index.d.ts +4 -0
  130. package/dist/hooks/themeColorsLogic.d.ts +19 -0
  131. package/dist/hooks/themeColorsLogic.js +4 -2
  132. package/dist/hooks/themeDeriveLogic.d.ts +16 -0
  133. package/dist/hooks/themeDeriveLogic.js +27 -17
  134. package/dist/hooks/toneFamilyLogic.d.ts +122 -0
  135. package/dist/hooks/toneFamilyLogic.js +151 -0
  136. package/dist/hooks/useKapiTheme.d.ts +8 -2
  137. package/dist/hooks/useKapiTheme.js +116 -103
  138. package/dist/hooks/useToneFamilies.d.ts +30 -0
  139. package/dist/hooks/useToneFamilies.js +46 -0
  140. package/dist/index.d.ts +3 -1
  141. package/dist/index.js +213 -204
  142. package/dist/kapi.css +1 -1
  143. package/dist/kapi.layered.css +1 -1
  144. package/dist/styles/rawHeights.d.ts +8 -0
  145. package/package.json +2 -2
@@ -1,80 +1,83 @@
1
1
  "use client";
2
2
  import "#kapi-css/components/navigation/navigation.css";
3
- import { joinClasses as e } from "../rootProps.js";
3
+ import { slot as e } from "../slotsLogic.js";
4
4
  import { KapiContextMenu as t } from "../overlays/KapiContextMenu.js";
5
5
  /* empty css */
6
6
  import { useGlobalRightClick as n } from "../../hooks/useGlobalRightClick.js";
7
- import { KapiRootScope as r, useKapiRootWiring as i } from "./KapiRoot.js";
8
- import { KapiReopenContext as a } from "./reopenBus.js";
9
- import { useCallback as o, useMemo as s, useState as c } from "react";
10
- import { jsx as l, jsxs as u } from "react/jsx-runtime";
11
- import { ChevronsLeft as d, ChevronsRight as f } from "lucide-react";
7
+ import { SHELL_SLOTS as r } from "./shellSlots.js";
8
+ import { KapiRootScope as i, useKapiRootWiring as a } from "./KapiRoot.js";
9
+ import { KapiReopenContext as o } from "./reopenBus.js";
10
+ import { useCallback as s, useMemo as c, useState as l } from "react";
11
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
12
+ import { ChevronsLeft as f, ChevronsRight as p } from "lucide-react";
12
13
  //#region src/components/layout/KapiShell.tsx
13
- var p = ({ rail: p, panel: m, panelRight: h, children: g, contextMenuItems: _, rightClick: v = !0, overlays: y, className: b, contentClassName: x = "", storageNamespace: S, brandTheme: C, style: w, ref: T, ...E }) => {
14
- let D = i({
15
- storageNamespace: S,
16
- brandTheme: C,
17
- style: w,
18
- ref: T
19
- }), [O, k] = c(null);
14
+ var m = ({ rail: m, panel: h, panelRight: g, children: _, contextMenuItems: v, rightClick: y = !0, overlays: b, className: x, classNames: S, contentClassName: C = "", storageNamespace: w, brandTheme: T, toneFamilies: E, density: D, style: O, ref: k, ...A }) => {
15
+ let j = a({
16
+ storageNamespace: w,
17
+ brandTheme: T,
18
+ toneFamilies: E,
19
+ density: D,
20
+ style: O,
21
+ ref: k
22
+ }), [M, N] = l(null);
20
23
  n({
21
- enabled: v,
22
- onMenu: _?.length ? (e, t) => k({
24
+ enabled: y,
25
+ onMenu: v?.length ? (e, t) => N({
23
26
  x: e,
24
27
  y: t
25
28
  }) : void 0
26
29
  });
27
- let [A, j] = c(null), [M, N] = c(0), P = o(() => (N((e) => e + 1), () => N((e) => e - 1)), []), F = s(() => ({
28
- info: A,
29
- publish: j,
30
- hosts: M,
31
- addHost: P
30
+ let [P, F] = l(null), [I, L] = l(0), R = s(() => (L((e) => e + 1), () => L((e) => e - 1)), []), z = c(() => ({
31
+ info: P,
32
+ publish: F,
33
+ hosts: I,
34
+ addHost: R
32
35
  }), [
33
- A,
34
- M,
35
- P
36
+ P,
37
+ I,
38
+ R
36
39
  ]);
37
- return /* @__PURE__ */ l(r, {
38
- wiring: D,
39
- children: /* @__PURE__ */ l(a.Provider, {
40
- value: F,
41
- children: /* @__PURE__ */ u("div", {
42
- ...D.dir ? { dir: D.dir } : {},
43
- ...E,
44
- className: e("kapi", b),
45
- ...D.attrs,
40
+ return /* @__PURE__ */ u(i, {
41
+ wiring: j,
42
+ children: /* @__PURE__ */ u(o.Provider, {
43
+ value: z,
44
+ children: /* @__PURE__ */ d("div", {
45
+ ...j.dir ? { dir: j.dir } : {},
46
+ ...A,
47
+ ...e(r, "root", S, x),
48
+ ...j.attrs,
46
49
  children: [
47
- p,
48
50
  m,
49
- /* @__PURE__ */ u("main", {
50
- className: `kapi-content${x ? ` ${x}` : ""}`,
51
+ h,
52
+ /* @__PURE__ */ d("main", {
53
+ ...e(r, "content", S, C),
51
54
  tabIndex: 0,
52
- children: [A && M === 0 && /* @__PURE__ */ l("button", {
55
+ children: [P && I === 0 && /* @__PURE__ */ u("button", {
53
56
  type: "button",
54
- className: "kapi-paneltoggle kapi-content__reopen",
55
- onClick: A.expand,
56
- "aria-label": A.label,
57
- children: A.side === "right" ? /* @__PURE__ */ l(d, {
57
+ ...e(r, "reopen", S, "kapi-paneltoggle"),
58
+ onClick: P.expand,
59
+ "aria-label": P.label,
60
+ children: P.side === "right" ? /* @__PURE__ */ u(f, {
58
61
  className: "kapi-flip-rtl",
59
62
  size: 16,
60
63
  strokeWidth: 2,
61
64
  "aria-hidden": "true"
62
- }) : /* @__PURE__ */ l(f, {
65
+ }) : /* @__PURE__ */ u(p, {
63
66
  className: "kapi-flip-rtl",
64
67
  size: 16,
65
68
  strokeWidth: 2,
66
69
  "aria-hidden": "true"
67
70
  })
68
- }), g]
71
+ }), _]
69
72
  }),
70
- h,
71
- y,
72
- O && _ && /* @__PURE__ */ l(t, {
73
+ g,
74
+ b,
75
+ M && v && /* @__PURE__ */ u(t, {
73
76
  open: !0,
74
- x: O.x,
75
- y: O.y,
76
- items: _,
77
- onClose: () => k(null)
77
+ x: M.x,
78
+ y: M.y,
79
+ items: v,
80
+ onClose: () => N(null)
78
81
  })
79
82
  ]
80
83
  })
@@ -82,4 +85,4 @@ var p = ({ rail: p, panel: m, panelRight: h, children: g, contextMenuItems: _, r
82
85
  });
83
86
  };
84
87
  //#endregion
85
- export { p as KapiShell };
88
+ export { m as KapiShell };
@@ -0,0 +1,9 @@
1
+ /** Partes de `card` (ver `slotCatalog.ts` para el contrato). Vive junto al componente para que su CSS lo siga. */
2
+ export declare const CARD_SLOTS: import("../slotsLogic.js").SlotTable<"card", {
3
+ readonly root: "kapi-card";
4
+ readonly header: "kapi-panelcard__head";
5
+ readonly title: null;
6
+ readonly actions: "kapi-panelcard__actions";
7
+ readonly body: "kapi-card__body";
8
+ readonly footer: "kapi-card__foot";
9
+ }>;
@@ -0,0 +1,12 @@
1
+ import { defineSlots as e } from "../slotsLogic.js";
2
+ //#region src/components/layout/cardSlots.ts
3
+ var t = e("card", {
4
+ root: "kapi-card",
5
+ header: "kapi-panelcard__head",
6
+ title: null,
7
+ actions: "kapi-panelcard__actions",
8
+ body: "kapi-card__body",
9
+ footer: "kapi-card__foot"
10
+ });
11
+ //#endregion
12
+ export { t as CARD_SLOTS };
@@ -0,0 +1,46 @@
1
+ import type { CSSProperties } from "react";
2
+ import { type KapiGap } from "./layoutPrimitives.js";
3
+ /** Breakpoints de la grilla por columnas, de menor a mayor. `xs` empieza en 0. */
4
+ export declare const KAPI_BREAKPOINTS: readonly ["xs", "sm", "md", "lg", "xl", "xxl"];
5
+ export type KapiBreakpoint = (typeof KAPI_BREAKPOINTS)[number];
6
+ /** Un valor suelto (vale desde `xs`) o uno por breakpoint (`{ xs: 6, md: 4 }`, mobile-first). */
7
+ export type KapiResponsive<T> = T | Partial<Record<KapiBreakpoint, T>>;
8
+ /** Ancho mínimo del contenedor (px) desde el que rige cada breakpoint. */
9
+ export type KapiBreakpoints = Record<KapiBreakpoint, number>;
10
+ /**
11
+ * Umbrales por defecto. Son los mismos números que Bootstrap 5, pero se miden contra el ancho de la
12
+ * grilla y no contra el de la ventana. Tienen que coincidir con los `@container` de `gridSpan.css`
13
+ * (lo ata `gridSpanLogic.test.ts`): CSS no deja leer una variable dentro de una condición.
14
+ */
15
+ export declare const DEFAULT_BREAKPOINTS: KapiBreakpoints;
16
+ /** Orden de un item: número, o los extremos de la fila. */
17
+ export type KapiColOrder = number | "first" | "last";
18
+ /** Estilo que sólo lleva custom properties (`--…`): se puede indexar por nombre y pasar a `style`. */
19
+ export type KapiCustomPropsStyle = CSSProperties & {
20
+ [name: `--${string}`]: string | number;
21
+ };
22
+ /** Un valor suelto -> `{ xs: valor }`; un objeto pasa; `undefined` -> `{}`. */
23
+ export declare const toBreakpointMap: <T>(value: KapiResponsive<T> | undefined) => Partial<Record<KapiBreakpoint, T>>;
24
+ /**
25
+ * Umbrales efectivos: defaults + overrides. Ignora lo inválido, fuerza `xs: 0` y mantiene el orden
26
+ * creciente (un breakpoint nunca queda por debajo del anterior).
27
+ */
28
+ export declare const resolveBreakpoints: (overrides?: Partial<Record<KapiBreakpoint, number>>) => KapiBreakpoints;
29
+ /** El mayor breakpoint cuyo umbral entra en `width` (semántica `min-width`). */
30
+ export declare const activeBreakpoint: (width: number, breakpoints: KapiBreakpoints) => KapiBreakpoint;
31
+ /** Cantidad de pistas: entero >= 1 o `undefined`. */
32
+ export declare const normalizeColumns: (columns: number | undefined) => number | undefined;
33
+ /**
34
+ * Estilo inline de una grilla por columnas. Escribe custom properties y NUNCA `gridTemplateColumns`
35
+ * ni `gap`: un inline le gana a cualquier regla de la app, y las custom properties no.
36
+ */
37
+ export declare const gridSpanStyle: (columns: number, gap: KapiGap | undefined) => KapiCustomPropsStyle;
38
+ /**
39
+ * Custom properties de un `KapiCol`: `--kapi-col-{span|offset|order}-{breakpoint}`, sólo las que se
40
+ * pasaron. La cascada mobile-first (un breakpoint hereda del menor) la resuelve el CSS.
41
+ */
42
+ export declare const colStyle: ({ span, offset, order }: {
43
+ span?: KapiResponsive<number> | undefined;
44
+ offset?: KapiResponsive<number> | undefined;
45
+ order?: KapiResponsive<KapiColOrder> | undefined;
46
+ }) => KapiCustomPropsStyle;
@@ -0,0 +1,39 @@
1
+ import { gapValue as e } from "./layoutPrimitives.js";
2
+ //#region src/components/layout/gridSpanLogic.ts
3
+ var t = [
4
+ "xs",
5
+ "sm",
6
+ "md",
7
+ "lg",
8
+ "xl",
9
+ "xxl"
10
+ ], n = {
11
+ xs: 0,
12
+ sm: 576,
13
+ md: 768,
14
+ lg: 992,
15
+ xl: 1200,
16
+ xxl: 1400
17
+ }, r = (e) => typeof e == "number" && Number.isFinite(e), i = (e) => e === void 0 ? {} : typeof e == "object" && e ? e : { xs: e }, a = (e) => {
18
+ let i = { ...n }, a = 0;
19
+ for (let o of t) {
20
+ let t = e?.[o], s = o === "xs" ? 0 : r(t) && t >= 0 ? t : n[o];
21
+ i[o] = Math.max(s, a), a = i[o];
22
+ }
23
+ return i;
24
+ }, o = (e, n) => {
25
+ let r = "xs";
26
+ for (let i of t) e >= n[i] && (r = i);
27
+ return r;
28
+ }, s = (e) => r(e) && e >= 1 ? Math.floor(e) : void 0, c = (t, n) => {
29
+ let r = { "--kapi-grid-tracks": t }, i = e(n);
30
+ return i !== void 0 && (r["--kapi-grid-gap"] = i), r;
31
+ }, l = "calc(var(--kapi-grid-tracks) + 1)", u = ({ span: e, offset: t, order: n }) => {
32
+ let a = {};
33
+ for (let [t, n] of Object.entries(i(e))) r(n) && n >= 1 && (a[`--kapi-col-span-${t}`] = Math.floor(n));
34
+ for (let [e, n] of Object.entries(i(t))) r(n) && n >= 0 && (a[`--kapi-col-offset-${e}`] = Math.floor(n));
35
+ for (let [e, t] of Object.entries(i(n))) t === "first" ? a[`--kapi-col-order-${e}`] = -1 : t === "last" ? a[`--kapi-col-order-${e}`] = l : r(t) && (a[`--kapi-col-order-${e}`] = Math.trunc(t));
36
+ return a;
37
+ };
38
+ //#endregion
39
+ export { n as DEFAULT_BREAKPOINTS, t as KAPI_BREAKPOINTS, o as activeBreakpoint, u as colStyle, c as gridSpanStyle, s as normalizeColumns, a as resolveBreakpoints, i as toBreakpointMap };
@@ -1,5 +1,5 @@
1
1
  export { KapiShell } from "./KapiShell.js";
2
- export type { KapiShellProps } from "./KapiShell.js";
2
+ export type { KapiShellClassNames, KapiShellProps } from "./KapiShell.js";
3
3
  export { KapiRoot } from "./KapiRoot.js";
4
4
  export type { KapiRootProps } from "./KapiRoot.js";
5
5
  export { KapiThemeScript } from "./KapiThemeScript.js";
@@ -7,13 +7,13 @@ export type { KapiThemeScriptProps } from "./KapiThemeScript.js";
7
7
  export { KapiRail, DEFAULT_RAIL_LABELS } from "./KapiRail.js";
8
8
  export { KapiRailAccount } from "./KapiRailAccount.js";
9
9
  export type { KapiRailAccountProps } from "./KapiRailAccount.js";
10
- export type { KapiRailItem, KapiRailLabels, KapiRailProps, KapiRailEntry, KapiRailPinned, KapiRailSeparator, KapiRailVariant, KapiRailZone } from "./KapiRail.js";
10
+ export type { KapiRailItem, KapiRailLabels, KapiRailClassNames, KapiRailProps, KapiRailEntry, KapiRailPinned, KapiRailSeparator, KapiRailVariant, KapiRailZone } from "./KapiRail.js";
11
11
  export { KapiContextSlot, DEFAULT_CONTEXT_SLOT_LABELS } from "./KapiContextSlot.js";
12
12
  export type { KapiContextSlotProps, KapiContextSlotLabels } from "./KapiContextSlot.js";
13
13
  export { KapiPanelDivider, KapiPanelHint, KapiPanelItem, KapiPanelLabel, KapiPanelList, KapiPanelSearch } from "./KapiPanelParts.js";
14
14
  export type { KapiPanelItemProps, KapiPanelSearchProps } from "./KapiPanelParts.js";
15
15
  export { KapiCard, KapiCardBody, KapiCardFooter, KapiCardHeader } from "./KapiCard.js";
16
- export type { KapiCardHeaderProps, KapiCardProps } from "./KapiCard.js";
16
+ export type { KapiCardClassNames, KapiCardHeaderProps, KapiCardProps } from "./KapiCard.js";
17
17
  export {
18
18
  /** @deprecated Interno; usa `KapiCard` en su lugar. Se quita en 1.0. */
19
19
  cardClasses,
@@ -42,6 +42,13 @@ isActivationKey } from "./accessCardLogic.js";
42
42
  export type { KapiAccessCardTone, KapiAccessCardAffordance } from "./accessCardLogic.js";
43
43
  export { KapiStack } from "./KapiStack.js";
44
44
  export type { KapiStackProps } from "./KapiStack.js";
45
+ export { KapiBox } from "./KapiBox.js";
46
+ export type { KapiBoxElement, KapiBoxProps } from "./KapiBox.js";
47
+ export { KapiCenter } from "./KapiCenter.js";
48
+ export type { KapiCenterProps } from "./KapiCenter.js";
49
+ export { KapiCol } from "./KapiCol.js";
50
+ export type { KapiColProps } from "./KapiCol.js";
51
+ export type { KapiBreakpoint, KapiBreakpoints, KapiColOrder, KapiResponsive } from "./gridSpanLogic.js";
45
52
  export { KapiCluster } from "./KapiCluster.js";
46
53
  export type { KapiClusterProps } from "./KapiCluster.js";
47
54
  export { KapiGrid } from "./KapiGrid.js";
@@ -50,6 +57,6 @@ export { KapiMasonry } from "./KapiMasonry.js";
50
57
  export type { KapiMasonryProps } from "./KapiMasonry.js";
51
58
  export type { KapiGap, KapiAlign, KapiClusterAlign, KapiClusterJustify } from "./layoutPrimitives.js";
52
59
  export { KapiPageHeader } from "./KapiPageHeader.js";
53
- export type { KapiPageHeaderProps } from "./KapiPageHeader.js";
60
+ export type { KapiPageHeaderClassNames, KapiPageHeaderProps } from "./KapiPageHeader.js";
54
61
  export { KapiScrollArea, DEFAULT_SCROLL_AREA_LABELS } from "./KapiScrollArea.js";
55
62
  export type { KapiScrollAreaLabels, KapiScrollAreaProps } from "./KapiScrollArea.js";
@@ -49,4 +49,15 @@ export declare const gridProps: ({ gap, cols, min, responsive, className, style
49
49
  className?: string | undefined;
50
50
  style?: CSSProperties | undefined;
51
51
  }) => PrimitiveProps;
52
+ /**
53
+ * Estilo de `KapiBox`: relleno por eje. `padX`/`padY` pisan a `pad` en su eje. Escribe los cuatro lados
54
+ * y nunca el atajo `padding`: mezclar atajo y lados hace que React avise al re-renderizar. El `style`
55
+ * del usuario pisa al resuelto.
56
+ */
57
+ export declare const boxStyle: ({ pad, padX, padY, style }?: {
58
+ pad?: KapiGap | undefined;
59
+ padX?: KapiGap | undefined;
60
+ padY?: KapiGap | undefined;
61
+ style?: CSSProperties | undefined;
62
+ }) => CSSProperties;
52
63
  export {};
@@ -53,6 +53,17 @@ var e = {
53
53
  ...l
54
54
  }
55
55
  };
56
+ }, l = ({ pad: e, padX: t, padY: i, style: a } = {}) => {
57
+ let o = n(i ?? e), s = n(t ?? e);
58
+ return {
59
+ ...r({
60
+ paddingTop: o,
61
+ paddingBottom: o,
62
+ paddingLeft: s,
63
+ paddingRight: s
64
+ }),
65
+ ...a
66
+ };
56
67
  };
57
68
  //#endregion
58
- export { o as clusterProps, n as gapValue, s as gridColumns, c as gridProps, a as stackProps };
69
+ export { l as boxStyle, o as clusterProps, n as gapValue, s as gridColumns, c as gridProps, a as stackProps };
@@ -0,0 +1,12 @@
1
+ /** Partes de `pageheader` (ver `slotCatalog.ts` para el contrato). Vive junto al componente para que su CSS lo siga. */
2
+ export declare const PAGEHEADER_SLOTS: import("../slotsLogic.js").SlotTable<"pageheader", {
3
+ readonly root: "kapi-pageheader";
4
+ readonly reopen: "kapi-pageheader__reopen";
5
+ readonly main: "kapi-pageheader__main";
6
+ readonly breadcrumb: "kapi-pageheader__breadcrumb";
7
+ readonly titleRow: "kapi-pageheader__titlerow";
8
+ readonly title: "kapi-pageheader__title";
9
+ readonly subtitle: "kapi-pageheader__subtitle";
10
+ readonly meta: "kapi-pageheader__meta";
11
+ readonly actions: "kapi-pageheader__actions";
12
+ }>;
@@ -0,0 +1,15 @@
1
+ import { defineSlots as e } from "../slotsLogic.js";
2
+ //#region src/components/layout/pageHeaderSlots.ts
3
+ var t = e("pageheader", {
4
+ root: "kapi-pageheader",
5
+ reopen: "kapi-pageheader__reopen",
6
+ main: "kapi-pageheader__main",
7
+ breadcrumb: "kapi-pageheader__breadcrumb",
8
+ titleRow: "kapi-pageheader__titlerow",
9
+ title: "kapi-pageheader__title",
10
+ subtitle: "kapi-pageheader__subtitle",
11
+ meta: "kapi-pageheader__meta",
12
+ actions: "kapi-pageheader__actions"
13
+ });
14
+ //#endregion
15
+ export { t as PAGEHEADER_SLOTS };
@@ -1,5 +1,6 @@
1
1
  import type { ReactNode } from "react";
2
2
  import type { KapiTone } from "../tone.js";
3
+ import type { KapiRender } from "../renderSlot.js";
3
4
  import { type KapiNavBadgeValue } from "../navigation/navBadgeLogic.js";
4
5
  export type KapiRailVariant = "labeled" | "compact";
5
6
  /** Zona fija de un ítem: `start` arriba (bajo la marca), `end` abajo (sobre el footer). */
@@ -12,11 +13,23 @@ export type KapiRailItem<Id extends string = string> = {
12
13
  label: string;
13
14
  /** Ícono (lucide-react), p. ej. `<Home size={21} strokeWidth={1.8} />`. */
14
15
  icon: ReactNode;
15
- /** Si se pasa, el ítem es un enlace real (`<a>`) en vez de un botón; `onSelect` no se dispara. */
16
+ /**
17
+ * Si se pasa, el ítem es un enlace real (`<a>`) en vez de un botón; `onSelect` no se dispara (tampoco con `render`). Es un enlace
18
+ * NATIVO: navega con carga completa de página (lo correcto para otro sistema). Para navegar dentro de una
19
+ * SPA sin recargar, usa `render`. Con `render`, `href` se ignora.
20
+ */
16
21
  href?: string | undefined;
17
- /** Marca el destino como otro sistema: agrega el ícono ↗ (sólo con `href`). */
22
+ /**
23
+ * El elemento que dibuja el ítem: el `<Link>` de tu router. Navega sin recargar la página. Las clases se
24
+ * unen, los estilos se funden y los handlers corren los dos (primero el tuyo); la librería no le pone `href`.
25
+ * `onSelect(id)` NO se llama: un enlace navega solo (igual que con `href`), así que no hay doble navegación si tu `onSelect` ya navega para los ítems que son botones.
26
+ *
27
+ * { id: "altas", label: "Altas", icon: <Plus />, render: <Link to="/altas" /> }
28
+ */
29
+ render?: KapiRender | undefined;
30
+ /** Marca el destino como otro sistema: agrega el ícono ↗ (sólo con `href` o `render`). */
18
31
  external?: boolean | undefined;
19
- /** Abrir el enlace en una pestaña nueva (sólo con `href`). */
32
+ /** Abrir el enlace en una pestaña nueva (sólo con `href` o `render`). */
20
33
  newTab?: boolean | undefined;
21
34
  /** Fija el ítem arriba (`start`) o abajo (`end`): no se mueve con el scroll. Sin valor, va a la zona del medio. */
22
35
  pinned?: KapiRailPinned | undefined;
@@ -0,0 +1,12 @@
1
+ /** Partes de `rail` (ver `slotCatalog.ts` para el contrato). Vive junto al componente para que su CSS lo siga. */
2
+ export declare const RAIL_SLOTS: import("../slotsLogic.js").SlotTable<"rail", {
3
+ readonly root: "kapi-rail";
4
+ readonly brand: "kapi-rail__brand";
5
+ readonly start: "kapi-rail__start";
6
+ readonly scroll: "kapi-rail__scroll";
7
+ readonly indicator: "kapi-rail__indicator";
8
+ readonly item: "kapi-rail__item";
9
+ readonly label: "kapi-rail__label";
10
+ readonly separator: "kapi-rail__sep";
11
+ readonly end: "kapi-rail__end";
12
+ }>;
@@ -0,0 +1,15 @@
1
+ import { defineSlots as e } from "../slotsLogic.js";
2
+ //#region src/components/layout/railSlots.ts
3
+ var t = e("rail", {
4
+ root: "kapi-rail",
5
+ brand: "kapi-rail__brand",
6
+ start: "kapi-rail__start",
7
+ scroll: "kapi-rail__scroll",
8
+ indicator: "kapi-rail__indicator",
9
+ item: "kapi-rail__item",
10
+ label: "kapi-rail__label",
11
+ separator: "kapi-rail__sep",
12
+ end: "kapi-rail__end"
13
+ });
14
+ //#endregion
15
+ export { t as RAIL_SLOTS };
@@ -0,0 +1,6 @@
1
+ /** Partes de `shell` (ver `slotCatalog.ts` para el contrato). Vive junto al componente para que su CSS lo siga. */
2
+ export declare const SHELL_SLOTS: import("../slotsLogic.js").SlotTable<"shell", {
3
+ readonly root: "kapi";
4
+ readonly content: "kapi-content";
5
+ readonly reopen: "kapi-content__reopen";
6
+ }>;
@@ -0,0 +1,9 @@
1
+ import { defineSlots as e } from "../slotsLogic.js";
2
+ //#region src/components/layout/shellSlots.ts
3
+ var t = e("shell", {
4
+ root: "kapi",
5
+ content: "kapi-content",
6
+ reopen: "kapi-content__reopen"
7
+ });
8
+ //#endregion
9
+ export { t as SHELL_SLOTS };
@@ -0,0 +1,12 @@
1
+ import { type RefObject } from "react";
2
+ import { type KapiBreakpoint } from "./gridSpanLogic.js";
3
+ /**
4
+ * Breakpoint activo de una grilla con umbrales propios, medido sobre su ancho. Interno.
5
+ * Sin `breakpoints` no mide nada y devuelve `undefined`: ahí decide el `@container` de `gridSpan.css`.
6
+ * Con `viewport` mide el ancho de la ventana del documento del elemento (`innerWidth`, el mismo que
7
+ * cuenta `@media (min-width)`), suscrito con `onViewportChange`: un listener compartido y un recálculo
8
+ * por frame, no un listener por grilla. Sin `breakpoints` tampoco mide: ahí decide el `@media`.
9
+ * La primera medición es sincrónica (layout effect), así que no hay un frame con el layout por defecto.
10
+ * El estado sólo cambia al cruzar un umbral, no en cada píxel.
11
+ */
12
+ export declare const useGridBreakpoint: (ref: RefObject<HTMLElement | null>, breakpoints: Partial<Record<KapiBreakpoint, number>> | undefined, viewport?: boolean) => KapiBreakpoint | undefined;
@@ -0,0 +1,35 @@
1
+ "use client";
2
+ import { winOf as e } from "../../hooks/ownerDocument.js";
3
+ import { onViewportChange as t } from "../../hooks/rafThrottle.js";
4
+ import { activeBreakpoint as n, resolveBreakpoints as r } from "./gridSpanLogic.js";
5
+ import { useLayoutEffect as i, useMemo as a, useState as o } from "react";
6
+ //#region src/components/layout/useGridBreakpoint.ts
7
+ var s = (s, c, l = !1) => {
8
+ let [u, d] = o(void 0), f = c !== void 0, p = f ? JSON.stringify(c) : "", m = a(() => f ? r(JSON.parse(p)) : void 0, [f, p]);
9
+ return i(() => {
10
+ let r = s.current;
11
+ if (!r || !m) {
12
+ d(void 0);
13
+ return;
14
+ }
15
+ if (l) {
16
+ let i = e(r);
17
+ if (!i) return;
18
+ let a = () => d(n(i.innerWidth, m));
19
+ return a(), t(a, {
20
+ target: i,
21
+ events: "resize"
22
+ });
23
+ }
24
+ let i = () => d(n(r.clientWidth, m));
25
+ if (i(), typeof ResizeObserver > "u") return;
26
+ let a = new ResizeObserver(i);
27
+ return a.observe(r), () => a.disconnect();
28
+ }, [
29
+ s,
30
+ m,
31
+ l
32
+ ]), f ? u : void 0;
33
+ };
34
+ //#endregion
35
+ export { s as useGridBreakpoint };
@@ -1,8 +1,24 @@
1
- import { type HTMLAttributes, type ReactNode, type Ref } from "react";
1
+ import { type HTMLAttributes, type MouseEvent, type ReactNode, type Ref } from "react";
2
+ import type { KapiRender } from "../renderSlot.js";
2
3
  import type { KapiLabelsOverride } from "../labelsLogic.js";
4
+ /**
5
+ * Un nivel de la ruta. Con `render`, `href` o `onClick` es un enlace; sin ninguno, texto. El último nivel es
6
+ * siempre la ubicación actual y nunca es un enlace.
7
+ */
3
8
  export type KapiBreadcrumbItem = {
9
+ /** Texto del nivel. */
4
10
  label: ReactNode;
5
- onClick?: (() => void) | undefined;
11
+ /** Se llama al activar el nivel. Con `render` corre DESPUÉS del `onClick` del elemento que pasaste. */
12
+ onClick?: ((event: MouseEvent<HTMLElement>) => void) | undefined;
13
+ /** Destino como `<a>` nativo: navega con carga COMPLETA de página. Para navegar sin recargar, usa `render`. Con `render` se ignora. */
14
+ href?: string | undefined;
15
+ /**
16
+ * El elemento que dibuja el nivel: el `<Link>` de tu router. Las clases se unen, los estilos se funden y los
17
+ * handlers corren los dos (primero el tuyo). La librería no le pone `href`.
18
+ *
19
+ * { label: "Inicio", render: <Link to="/" /> }
20
+ */
21
+ render?: KapiRender | undefined;
6
22
  };
7
23
  export type KapiBreadcrumbLabels = {
8
24
  /** Nombre accesible del `<nav>` (sin `aria-label`). */
@@ -3,31 +3,38 @@ import "#kapi-css/components/navigation/navigation.css";
3
3
  import { joinClasses as e } from "../rootProps.js";
4
4
  import { useLabels as t } from "../locale/KapiLocaleProvider.js";
5
5
  /* empty css */
6
- import { breadcrumbKinds as n } from "./breadcrumbLogic.js";
7
- import { Fragment as r } from "react";
8
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
+ import { renderNavLink as n } from "./navLink.js";
7
+ import { breadcrumbKinds as r } from "./breadcrumbLogic.js";
8
+ import { Fragment as i } from "react";
9
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
9
10
  //#region src/components/navigation/KapiBreadcrumb.tsx
10
- var o = { navigation: "Ubicación" };
11
- function s({ items: s, "aria-label": c, labels: l, className: u, ref: d, ...f }) {
12
- let p = t("breadcrumb", o, l), m = n(s);
13
- return /* @__PURE__ */ i("nav", {
14
- ...f,
15
- ref: d,
16
- className: e("kapi-breadcrumb", u),
17
- "aria-label": c ?? p.navigation,
18
- children: s.map((e, t) => /* @__PURE__ */ a(r, { children: [t > 0 && /* @__PURE__ */ i("span", {
11
+ var s = { navigation: "Ubicación" };
12
+ function c({ items: c, "aria-label": l, labels: u, className: d, ref: f, ...p }) {
13
+ let m = t("breadcrumb", s, u), h = r(c);
14
+ return /* @__PURE__ */ a("nav", {
15
+ ...p,
16
+ ref: f,
17
+ className: e("kapi-breadcrumb", d),
18
+ "aria-label": l ?? m.navigation,
19
+ children: c.map((e, t) => /* @__PURE__ */ o(i, { children: [t > 0 && /* @__PURE__ */ a("span", {
19
20
  "aria-hidden": !0,
20
21
  children: " · "
21
- }), m[t] === "link" ? /* @__PURE__ */ i("button", {
22
+ }), h[t] === "link" ? e.render !== void 0 || e.href !== void 0 ? n({
23
+ render: e.render,
24
+ href: e.href,
25
+ className: "kapi-link",
26
+ onClick: e.onClick,
27
+ children: e.label
28
+ }) : /* @__PURE__ */ a("button", {
22
29
  type: "button",
23
30
  className: "kapi-link",
24
31
  onClick: e.onClick,
25
32
  children: e.label
26
- }) : m[t] === "current" ? /* @__PURE__ */ i("b", {
33
+ }) : h[t] === "current" ? /* @__PURE__ */ a("b", {
27
34
  "aria-current": "page",
28
35
  children: e.label
29
- }) : /* @__PURE__ */ i("span", { children: e.label })] }, t))
36
+ }) : /* @__PURE__ */ a("span", { children: e.label })] }, t))
30
37
  });
31
38
  }
32
39
  //#endregion
33
- export { o as DEFAULT_BREADCRUMB_LABELS, s as KapiBreadcrumb };
40
+ export { s as DEFAULT_BREADCRUMB_LABELS, c as KapiBreadcrumb };
@@ -1,4 +1,5 @@
1
1
  import { type ReactNode } from "react";
2
+ import { type KapiRender } from "../renderSlot.js";
2
3
  import { type KapiLinkLabels } from "../locale/linkLabels.js";
3
4
  import type { KapiPanelCollapsedMode } from "./panelMiniLogic.js";
4
5
  import { type KapiNavBadgeValue } from "./navBadgeLogic.js";
@@ -25,11 +26,23 @@ export type KapiContextPanelItem<Id extends string = string> = {
25
26
  badgeLabel?: string | undefined;
26
27
  /** No se puede elegir (botón deshabilitado o enlace `aria-disabled`). */
27
28
  disabled?: boolean | undefined;
28
- /** Si se pasa (y el ítem no es "reciente"), se dibuja un enlace real `<a>` en vez de un botón. */
29
+ /**
30
+ * Si se pasa (y el ítem no es "reciente"), se dibuja un enlace real `<a>` en vez de un botón. Es un enlace
31
+ * NATIVO: navega con carga completa de página. Para navegar dentro de una SPA sin recargar, usa `render`.
32
+ */
29
33
  href?: string | undefined;
30
- /** Destino en otro sistema: agrega el ícono ↗ a la derecha (sólo con `href`). */
34
+ /**
35
+ * El elemento que dibuja el ítem: el `<Link>` de tu router. Navega sin recargar la página; sirve también
36
+ * en un ítem "reciente" (con `detail`/`initials`) y con el panel plegado en modo `mini`. Las clases se
37
+ * unen, los estilos se funden y los handlers corren los dos (primero el tuyo); la librería no le pone `href`
38
+ * y `href` se ignora. `onSelect(id)` NO se llama: un enlace navega solo (igual que con `href`), así que no hay doble navegación si tu `onSelect` ya navega para los ítems que son botones.
39
+ *
40
+ * { id: "altas", label: "Altas", render: <Link to="/altas" /> }
41
+ */
42
+ render?: KapiRender | undefined;
43
+ /** Destino en otro sistema: agrega el ícono ↗ a la derecha (sólo con `href` o `render`). */
31
44
  external?: boolean | undefined;
32
- /** Abrir el enlace en una pestaña nueva (sólo con `href`). */
45
+ /** Abrir el enlace en una pestaña nueva (sólo con `href` o `render`). */
33
46
  newTab?: boolean | undefined;
34
47
  };
35
48
  export type KapiContextPanelSection<Id extends string = string> = {
@@ -54,7 +67,7 @@ export type KapiContextSectionsProps<Id extends string = string> = {
54
67
  * para todo el panel: marca la página actual, no una selección por sección.
55
68
  */
56
69
  activeId?: Id | undefined;
57
- /** Se llama con el `id` del ítem clickeado (no aplica a los enlaces con `href`). */
70
+ /** Se llama con el `id` del ítem clickeado (no aplica a los enlaces: ni con `href` ni con `render`). */
58
71
  onSelect?: ((id: Id) => void) | undefined;
59
72
  /** Buscador opcional sobre las secciones. */
60
73
  search?: KapiContextPanelSearch | undefined;