@kapiuara/ui 0.14.0 → 0.15.1

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 (118) hide show
  1. package/README.md +234 -1
  2. package/dist/components/chat/KapiChatList.js +19 -19
  3. package/dist/components/chat/KapiChatThread.js +23 -23
  4. package/dist/components/chat/KapiComposer.js +19 -19
  5. package/dist/components/chat/KapiMessageBubble.js +4 -4
  6. package/dist/components/chat/KapiTypingIndicator.js +4 -4
  7. package/dist/components/closeReason.d.ts +34 -0
  8. package/dist/components/data/KapiBarChart.js +1 -1
  9. package/dist/components/data/KapiDataTable.js +31 -31
  10. package/dist/components/data/KapiEventCalendar.js +78 -78
  11. package/dist/components/data/KapiHeatmap.js +23 -23
  12. package/dist/components/data/KapiLineChart.js +1 -1
  13. package/dist/components/data/KapiPagination.js +4 -4
  14. package/dist/components/data/KapiSparkline.js +1 -1
  15. package/dist/components/data/KapiTable.js +122 -122
  16. package/dist/components/data/KapiTableFilter.js +18 -18
  17. package/dist/components/data/KapiTableRow.js +24 -24
  18. package/dist/components/data/KapiTableToolbar.js +49 -49
  19. package/dist/components/data/chartFrame.js +21 -21
  20. package/dist/components/data/useColumnResize.js +8 -8
  21. package/dist/components/data/useTableSelection.js +8 -8
  22. package/dist/components/display/KapiAnnotation.js +53 -53
  23. package/dist/components/display/KapiComment.js +4 -4
  24. package/dist/components/display/KapiCommentComposer.js +16 -16
  25. package/dist/components/display/KapiFileItem.js +6 -6
  26. package/dist/components/display/KapiFileViewer.js +9 -9
  27. package/dist/components/display/KapiTruncate.js +7 -7
  28. package/dist/components/feedback/KapiAlert.d.ts +2 -1
  29. package/dist/components/feedback/KapiAlert.js +8 -8
  30. package/dist/components/feedback/KapiCountdown.js +8 -8
  31. package/dist/components/feedback/KapiFab.js +31 -31
  32. package/dist/components/feedback/KapiOfflineBanner.js +8 -8
  33. package/dist/components/feedback/KapiToastContainer.js +21 -21
  34. package/dist/components/feedback/KapiTour.d.ts +2 -1
  35. package/dist/components/feedback/KapiTour.js +32 -32
  36. package/dist/components/inputs/KapiAutocomplete.js +14 -14
  37. package/dist/components/inputs/KapiButton.d.ts +17 -1
  38. package/dist/components/inputs/KapiButton.js +41 -25
  39. package/dist/components/inputs/KapiCalendar.js +5 -5
  40. package/dist/components/inputs/KapiCalendarGrid.js +10 -10
  41. package/dist/components/inputs/KapiChecklist.js +71 -71
  42. package/dist/components/inputs/KapiDatePicker.js +28 -28
  43. package/dist/components/inputs/KapiDateRangePicker.js +27 -27
  44. package/dist/components/inputs/KapiFacetedSearch.js +24 -24
  45. package/dist/components/inputs/KapiField.js +14 -14
  46. package/dist/components/inputs/KapiFileUpload.js +27 -27
  47. package/dist/components/inputs/KapiIconButton.d.ts +9 -1
  48. package/dist/components/inputs/KapiIconButton.js +27 -10
  49. package/dist/components/inputs/KapiInput.js +21 -21
  50. package/dist/components/inputs/KapiInputGroup.js +8 -8
  51. package/dist/components/inputs/KapiMaskedInput.js +22 -22
  52. package/dist/components/inputs/KapiNumberStepper.js +12 -12
  53. package/dist/components/inputs/KapiRating.js +1 -1
  54. package/dist/components/inputs/KapiSearchChip.js +8 -8
  55. package/dist/components/inputs/KapiSegmented.js +27 -27
  56. package/dist/components/inputs/KapiSelect.js +166 -166
  57. package/dist/components/inputs/KapiSelectMenu.js +60 -60
  58. package/dist/components/inputs/KapiSlider.js +1 -1
  59. package/dist/components/inputs/KapiSwitch.js +6 -6
  60. package/dist/components/inputs/KapiTagInput.js +22 -22
  61. package/dist/components/inputs/KapiTextarea.js +8 -8
  62. package/dist/components/inputs/ownField.js +4 -4
  63. package/dist/components/layout/KapiAccountMenu.d.ts +2 -1
  64. package/dist/components/layout/KapiAccountMenu.js +51 -51
  65. package/dist/components/layout/KapiContextSlot.js +35 -35
  66. package/dist/components/layout/KapiMasonry.js +6 -6
  67. package/dist/components/layout/KapiNotificationBell.js +60 -60
  68. package/dist/components/layout/KapiPageHeader.js +19 -19
  69. package/dist/components/layout/KapiRail.js +60 -60
  70. package/dist/components/layout/KapiRailAccount.js +9 -9
  71. package/dist/components/layout/KapiRoot.js +21 -21
  72. package/dist/components/layout/KapiScrollArea.js +11 -11
  73. package/dist/components/layout/KapiShell.js +12 -12
  74. package/dist/components/locale/KapiLocaleProvider.js +13 -13
  75. package/dist/components/navigation/KapiAccordion.js +12 -12
  76. package/dist/components/navigation/KapiBreadcrumb.js +11 -11
  77. package/dist/components/navigation/KapiCollapsiblePanel.js +23 -23
  78. package/dist/components/navigation/KapiContextPanel.js +76 -76
  79. package/dist/components/navigation/KapiFilterChips.js +9 -9
  80. package/dist/components/navigation/KapiNavBadge.d.ts +4 -2
  81. package/dist/components/navigation/KapiNavBadge.js +11 -10
  82. package/dist/components/navigation/KapiPanelGroup.js +25 -25
  83. package/dist/components/navigation/KapiSteps.js +4 -4
  84. package/dist/components/navigation/KapiTabs.d.ts +4 -1
  85. package/dist/components/navigation/KapiTabs.js +18 -17
  86. package/dist/components/navigation/KapiTree.js +72 -72
  87. package/dist/components/navigation/KapiWizard.d.ts +2 -1
  88. package/dist/components/navigation/KapiWizard.js +30 -30
  89. package/dist/components/overlays/KapiCanvasForm.d.ts +6 -2
  90. package/dist/components/overlays/KapiCanvasForm.js +12 -12
  91. package/dist/components/overlays/KapiCommandPalette.d.ts +2 -1
  92. package/dist/components/overlays/KapiCommandPalette.js +23 -23
  93. package/dist/components/overlays/KapiConfirm.d.ts +2 -1
  94. package/dist/components/overlays/KapiConfirm.js +12 -12
  95. package/dist/components/overlays/KapiContextMenu.d.ts +2 -1
  96. package/dist/components/overlays/KapiContextMenu.js +15 -15
  97. package/dist/components/overlays/KapiDialogHost.js +22 -22
  98. package/dist/components/overlays/KapiLoading.js +16 -16
  99. package/dist/components/overlays/KapiMenuButton.js +12 -12
  100. package/dist/components/overlays/KapiModal.d.ts +2 -1
  101. package/dist/components/overlays/KapiModal.js +28 -28
  102. package/dist/components/overlays/KapiOffcanvas.d.ts +3 -2
  103. package/dist/components/overlays/KapiOffcanvas.js +63 -63
  104. package/dist/components/overlays/KapiOffcanvasStack.js +38 -38
  105. package/dist/components/overlays/KapiPhotoView.js +14 -14
  106. package/dist/components/overlays/KapiPopover.d.ts +2 -1
  107. package/dist/components/overlays/KapiPopover.js +7 -7
  108. package/dist/components/overlays/KapiShapeSheet.js +17 -17
  109. package/dist/components/overlays/KapiSplitModal.js +29 -29
  110. package/dist/components/overlays/KapiTooltip.js +20 -20
  111. package/dist/components/overlays/menuList.js +60 -60
  112. package/dist/components/overlays/useNativeDialog.d.ts +5 -0
  113. package/dist/components/overlays/useNativeDialog.js +2 -2
  114. package/dist/components/renderSlot.d.ts +27 -0
  115. package/dist/components/renderSlot.js +23 -0
  116. package/dist/hooks/portalRoot.js +6 -6
  117. package/dist/index.d.ts +2 -0
  118. package/package.json +1 -1
@@ -6,12 +6,12 @@ import { useKapiRoot as i } from "../../hooks/kapiRoot.js";
6
6
  import { onViewportChange as a } from "../../hooks/rafThrottle.js";
7
7
  import { placementViewport as o } from "../../hooks/viewportInsetLogic.js";
8
8
  import { resolveDirection as ee } from "../../hooks/directionLogic.js";
9
- import { useMergedRefs as te } from "../../hooks/mergeRefs.js";
10
- import { useDismiss as s } from "../../hooks/useDismiss.js";
9
+ import { useMergedRefs as s } from "../../hooks/mergeRefs.js";
10
+ import { useDismiss as c } from "../../hooks/useDismiss.js";
11
11
  /* empty css */
12
- import { clampFabPosition as c, fabPanelPlacement as ne, isDragMove as re, resolveFabCorner as l } from "./fabLogic.js";
13
- import { jsx as u, jsxs as d } from "react/jsx-runtime";
14
- import { useCallback as f, useEffect as p, useId as m, useLayoutEffect as h, useRef as g, useState as _ } from "react";
12
+ import { clampFabPosition as l, fabPanelPlacement as te, isDragMove as ne, resolveFabCorner as re } from "./fabLogic.js";
13
+ import { useCallback as u, useEffect as d, useId as f, useLayoutEffect as p, useRef as m, useState as h } from "react";
14
+ import { jsx as g, jsxs as _ } from "react/jsx-runtime";
15
15
  import { Plus as ie, X as ae } from "lucide-react";
16
16
  import { createPortal as oe } from "react-dom";
17
17
  //#region src/components/feedback/KapiFab.tsx
@@ -24,20 +24,20 @@ var v = {
24
24
  tr: "down-end",
25
25
  tl: "down-start"
26
26
  }, y = ({ actions: y = [], icon: ce, label: le, labels: ue, onClick: de, position: fe = "bottom-end", draggable: b = !1, panel: x, panelTitle: S, open: C, defaultOpen: pe = !1, onOpenChange: w, keepOpen: T = !1, className: me, style: E, id: he, ref: ge }) => {
27
- let D = t("fab", v, ue), O = le ?? D.action, k = C !== void 0, [_e, A] = _(pe), j = k ? C : _e, M = g(j);
27
+ let D = t("fab", v, ue), O = le ?? D.action, k = C !== void 0, [_e, A] = h(pe), j = k ? C : _e, M = m(j);
28
28
  M.current = j;
29
- let N = f((e) => {
29
+ let N = u((e) => {
30
30
  let t = typeof e == "function" ? e(M.current) : e;
31
31
  t !== M.current && (k || A(t), w?.(t));
32
- }, [k, w]), P = x != null && x !== !1, F = g(null), I = g(null), L = m(), [R, z] = _(null), [ve, B] = _(!1), V = g(null), ye = te(V, ge), H = g(!1), U = i(), be = e(), W = !P && y.length > 0, G = f((e) => {
32
+ }, [k, w]), P = x != null && x !== !1, F = m(null), I = m(null), L = f(), [R, z] = h(null), [ve, B] = h(!1), V = m(null), ye = s(V, ge), H = m(!1), U = i(), be = e(), W = !P && y.length > 0, G = u((e) => {
33
33
  let t = V.current;
34
34
  if (!t) return e;
35
35
  let n = t.getBoundingClientRect();
36
- return c(e, {
36
+ return l(e, {
37
37
  width: n.width,
38
38
  height: n.height
39
39
  }, o(t));
40
- }, []), xe = s(j, {
40
+ }, []), xe = c(j, {
41
41
  zones: [V],
42
42
  outside: !(P && T),
43
43
  onDismiss: (e) => {
@@ -45,16 +45,16 @@ var v = {
45
45
  N(!1), t && F.current?.focus();
46
46
  }
47
47
  });
48
- p(() => {
48
+ d(() => {
49
49
  if (!j || !P) return;
50
50
  let e = I.current;
51
51
  (e?.querySelector(".kapi-fab-panel__body :is(input, select, textarea, button, [href], [tabindex]:not([tabindex='-1']))") ?? e)?.focus();
52
52
  }, [j, P]);
53
- let [Se, Ce] = _(null), K = f((e) => {
54
- let t = V.current, n = e && t ? ne(t.getBoundingClientRect(), o(t)) : null;
53
+ let [Se, Ce] = h(null), K = u((e) => {
54
+ let t = V.current, n = e && t ? te(t.getBoundingClientRect(), o(t)) : null;
55
55
  Ce(n);
56
56
  }, []);
57
- h(() => {
57
+ p(() => {
58
58
  K(R !== null);
59
59
  }, [
60
60
  R,
@@ -63,7 +63,7 @@ var v = {
63
63
  K
64
64
  ]);
65
65
  let q = R !== null;
66
- p(() => {
66
+ d(() => {
67
67
  if (!q) return;
68
68
  let e = r(V.current);
69
69
  return a(() => {
@@ -88,7 +88,7 @@ var v = {
88
88
  moved: !1
89
89
  }, i = (e) => {
90
90
  let t = e.clientX - n.mx, r = e.clientY - n.my;
91
- re(t, r) && (n.moved = !0), n.moved && (B(!0), z(G({
91
+ ne(t, r) && (n.moved = !0), n.moved && (B(!0), z(G({
92
92
  x: n.x + t,
93
93
  y: n.y + r
94
94
  })));
@@ -104,7 +104,7 @@ var v = {
104
104
  N(!1), F.current?.focus();
105
105
  };
106
106
  if (!U) return null;
107
- let X = ee(U, be), Z = l(fe, X), Q = X === "rtl" && Z.frame === "ltr", $ = Q ? { dir: "rtl" } : {}, Te = R && Se || se[Z.physical], Ee = R ? {
107
+ let X = ee(U, be), Z = re(fe, X), Q = X === "rtl" && Z.frame === "ltr", $ = Q ? { dir: "rtl" } : {}, Te = R && Se || se[Z.physical], Ee = R ? {
108
108
  ...E,
109
109
  left: R.x,
110
110
  top: R.y,
@@ -118,7 +118,7 @@ var v = {
118
118
  ve && "is-dragging",
119
119
  me
120
120
  ].filter(Boolean).join(" ");
121
- return oe(/* @__PURE__ */ d("div", {
121
+ return oe(/* @__PURE__ */ _("div", {
122
122
  ref: ye,
123
123
  id: he,
124
124
  className: De,
@@ -126,54 +126,54 @@ var v = {
126
126
  ...Q ? { dir: "ltr" } : {},
127
127
  onKeyDown: xe,
128
128
  children: [
129
- P && j && /* @__PURE__ */ d("div", {
129
+ P && j && /* @__PURE__ */ _("div", {
130
130
  ref: I,
131
131
  role: "dialog",
132
132
  tabIndex: -1,
133
133
  className: `kapi-fab-panel kapi-fab-panel--${Te}`,
134
134
  ...$,
135
135
  ...S == null ? { "aria-label": O } : { "aria-labelledby": L },
136
- children: [S != null && /* @__PURE__ */ d("div", {
136
+ children: [S != null && /* @__PURE__ */ _("div", {
137
137
  className: "kapi-fab-panel__head",
138
- children: [/* @__PURE__ */ u("span", {
138
+ children: [/* @__PURE__ */ g("span", {
139
139
  id: L,
140
140
  className: "kapi-fab-panel__title",
141
141
  children: S
142
- }), /* @__PURE__ */ u("button", {
142
+ }), /* @__PURE__ */ g("button", {
143
143
  type: "button",
144
144
  className: "kapi-fab-panel__close",
145
145
  "aria-label": D.close,
146
146
  onClick: Y,
147
- children: /* @__PURE__ */ u(ae, {
147
+ children: /* @__PURE__ */ g(ae, {
148
148
  size: 16,
149
149
  strokeWidth: 2.2
150
150
  })
151
151
  })]
152
- }), /* @__PURE__ */ u("div", {
152
+ }), /* @__PURE__ */ g("div", {
153
153
  className: "kapi-fab-panel__body",
154
154
  children: typeof x == "function" ? x({ close: Y }) : x
155
155
  })]
156
156
  }),
157
- W && /* @__PURE__ */ u("div", {
157
+ W && /* @__PURE__ */ g("div", {
158
158
  className: `kapi-fab-actions${j ? " is-open" : ""}`,
159
- children: y.map((e) => /* @__PURE__ */ d("button", {
159
+ children: y.map((e) => /* @__PURE__ */ _("button", {
160
160
  type: "button",
161
161
  className: "kapi-fab-act",
162
162
  tabIndex: j ? 0 : -1,
163
163
  onClick: () => {
164
164
  e.onClick?.(), N(!1);
165
165
  },
166
- children: [/* @__PURE__ */ u("span", {
166
+ children: [/* @__PURE__ */ g("span", {
167
167
  className: "kapi-fab-act__label",
168
168
  ...$,
169
169
  children: e.label
170
- }), /* @__PURE__ */ u("span", {
170
+ }), /* @__PURE__ */ g("span", {
171
171
  className: "kapi-fab-act__btn",
172
172
  children: e.icon
173
173
  })]
174
174
  }, e.label))
175
175
  }),
176
- /* @__PURE__ */ u("button", {
176
+ /* @__PURE__ */ g("button", {
177
177
  ref: F,
178
178
  type: "button",
179
179
  className: "kapi-fab-main",
@@ -182,9 +182,9 @@ var v = {
182
182
  "aria-label": O,
183
183
  "aria-haspopup": P ? "dialog" : void 0,
184
184
  "aria-expanded": W || P ? j : void 0,
185
- children: /* @__PURE__ */ u("span", {
185
+ children: /* @__PURE__ */ g("span", {
186
186
  className: `kapi-fab-main__ico${W && j ? " is-open" : ""}`,
187
- children: ce ?? /* @__PURE__ */ u(ie, {
187
+ children: ce ?? /* @__PURE__ */ g(ie, {
188
188
  size: 24,
189
189
  strokeWidth: 2.4
190
190
  })
@@ -4,34 +4,34 @@ import { useLabels as e } from "../locale/KapiLocaleProvider.js";
4
4
  import { useOnlineStatus as t } from "../../hooks/useOnlineStatus.js";
5
5
  import { DEFAULT_RESTORED_DURATION as n, nextOfflineBannerPhase as r, offlineBannerClasses as i } from "./offlineBannerLogic.js";
6
6
  /* empty css */
7
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
8
- import { useEffect as s, useState as c } from "react";
7
+ import { useEffect as a, useState as o } from "react";
8
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
9
9
  import { Wifi as l, WifiOff as u } from "lucide-react";
10
10
  //#region src/components/feedback/KapiOfflineBanner.tsx
11
11
  var d = {
12
12
  offline: "Sin conexión. Los cambios se guardarán cuando vuelva la conexión.",
13
13
  restored: "Conexión restablecida."
14
14
  }, f = ({ forceOffline: f = !1, showRestored: p = !0, restoredDuration: m = n, labels: h, className: g, ..._ }) => {
15
- let v = t(), y = e("offlineBanner", d, h), b = v.online && !f, [x, S] = c(() => b ? "hidden" : "offline");
16
- if (s(() => {
15
+ let v = t(), y = e("offlineBanner", d, h), b = v.online && !f, [x, S] = o(() => b ? "hidden" : "offline");
16
+ if (a(() => {
17
17
  S((e) => r(e, b, p));
18
- }, [b, p]), s(() => {
18
+ }, [b, p]), a(() => {
19
19
  if (x !== "restored") return;
20
20
  let e = setTimeout(() => S("hidden"), m);
21
21
  return () => clearTimeout(e);
22
22
  }, [x, m]), x === "hidden") return null;
23
23
  let C = x === "offline" ? u : l;
24
- return /* @__PURE__ */ o("div", {
24
+ return /* @__PURE__ */ c("div", {
25
25
  ..._,
26
26
  className: i(x, g),
27
27
  role: "status",
28
28
  "aria-live": "polite",
29
- children: [/* @__PURE__ */ a(C, {
29
+ children: [/* @__PURE__ */ s(C, {
30
30
  className: "kapi-offline-banner__icon",
31
31
  size: 16,
32
32
  strokeWidth: 2.2,
33
33
  "aria-hidden": "true"
34
- }), /* @__PURE__ */ a("span", {
34
+ }), /* @__PURE__ */ s("span", {
35
35
  className: "kapi-offline-banner__text",
36
36
  children: x === "offline" ? y.offline : y.restored
37
37
  })]
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import "#kapi-css/components/feedback/feedback.css";
3
- import { useLabels as e } from "../locale/KapiLocaleProvider.js";
4
- import { joinClasses as t } from "../rootProps.js";
3
+ import { joinClasses as e } from "../rootProps.js";
4
+ import { useLabels as t } from "../locale/KapiLocaleProvider.js";
5
5
  import { activeElementOf as n, docOf as r } from "../../hooks/ownerDocument.js";
6
6
  import { usePortalRootOverride as i } from "../../hooks/portalRoot.js";
7
7
  import { useMergedRefs as a } from "../../hooks/mergeRefs.js";
@@ -10,8 +10,8 @@ import { getPortalRoot as s } from "../overlays/useNativeDialog.js";
10
10
  /* empty css */
11
11
  import { moveNode as c, raisePopover as l } from "./toastLayer.js";
12
12
  import { toastStore as u } from "./toastStore.js";
13
- import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
14
- import { useEffect as m, useLayoutEffect as h, useRef as g, useState as _, useSyncExternalStore as v } from "react";
13
+ import { useEffect as d, useLayoutEffect as f, useRef as p, useState as m, useSyncExternalStore as h } from "react";
14
+ import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
15
15
  import { AlertTriangle as y, CheckCircle2 as b, Info as x, XCircle as S } from "lucide-react";
16
16
  import { createPortal as C } from "react-dom";
17
17
  //#region src/components/feedback/KapiToastContainer.tsx
@@ -33,8 +33,8 @@ var w = { close: "Cerrar" }, T = {
33
33
  color: "var(--kapi-warning)"
34
34
  }
35
35
  }, E = (e) => e ? u.pause() : u.resume(), D = () => typeof HTMLElement < "u" && typeof HTMLElement.prototype.showPopover == "function", O = ({ closeLabel: y, labels: b, className: x, style: S, id: O, ref: k }) => {
36
- let A = e("toast", w, b), j = y ?? A.close, M = v(u.subscribe, u.getSnapshot, u.getSnapshot), N = g(null), P = a(N, k), F = i(), [I, L] = _(null);
37
- m(() => {
36
+ let A = t("toast", w, b), j = y ?? A.close, M = h(u.subscribe, u.getSnapshot, u.getSnapshot), N = p(null), P = a(N, k), F = i(), [I, L] = m(null);
37
+ d(() => {
38
38
  let e = r(F);
39
39
  if (!e) return;
40
40
  let t = e.createElement("div");
@@ -50,41 +50,41 @@ var w = { close: "Cerrar" }, T = {
50
50
  };
51
51
  }, [F]);
52
52
  let R = M.length ? Math.max(...M.map((e) => e.id)) : 0;
53
- h(() => {
53
+ f(() => {
54
54
  N.current && l(N.current);
55
55
  }, [I, R]);
56
- let z = g(!1), B = g(!1), V = () => E(z.current || B.current);
57
- if (m(() => {
56
+ let z = p(!1), B = p(!1), V = () => E(z.current || B.current);
57
+ if (d(() => {
58
58
  let e = N.current;
59
59
  B.current && !(e && e.contains(n(e))) && (B.current = !1), M.length || (z.current = !1), E(z.current || B.current);
60
- }, [M]), m(() => () => u.resume(), []), !I) return null;
60
+ }, [M]), d(() => () => u.resume(), []), !I) return null;
61
61
  let H = (e) => {
62
62
  let { Icon: t, color: n } = T[e.tone];
63
- return /* @__PURE__ */ p("div", {
63
+ return /* @__PURE__ */ v("div", {
64
64
  className: `kapi-toast ${e.leaving ? "kapi-toast--out" : "kapi-toast--in"}`,
65
65
  onAnimationEnd: (t) => {
66
66
  e.leaving && t.animationName === "kapi-toast-out" && u.remove(e.id);
67
67
  },
68
68
  children: [
69
- /* @__PURE__ */ f("span", {
69
+ /* @__PURE__ */ _("span", {
70
70
  className: `kapi-toast__icon kapi-toast__icon--${e.tone}`,
71
- children: e.loading ? /* @__PURE__ */ f("span", {
71
+ children: e.loading ? /* @__PURE__ */ _("span", {
72
72
  className: "kapi-spinner kapi-spinner--sm",
73
73
  "aria-hidden": "true"
74
- }) : /* @__PURE__ */ f(t, {
74
+ }) : /* @__PURE__ */ _(t, {
75
75
  size: 18,
76
76
  strokeWidth: 2.2,
77
77
  color: n
78
78
  })
79
79
  }),
80
- /* @__PURE__ */ f("span", {
80
+ /* @__PURE__ */ _("span", {
81
81
  className: "kapi-toast__msg",
82
- children: e.description ? /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("span", { children: e.message }), /* @__PURE__ */ f("span", {
82
+ children: e.description ? /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("span", { children: e.message }), /* @__PURE__ */ _("span", {
83
83
  className: "kapi-toast__desc",
84
84
  children: e.description
85
85
  })] }) : e.message
86
86
  }),
87
- e.action && /* @__PURE__ */ f("button", {
87
+ e.action && /* @__PURE__ */ _("button", {
88
88
  type: "button",
89
89
  className: "kapi-toast__action",
90
90
  onClick: () => {
@@ -96,7 +96,7 @@ var w = { close: "Cerrar" }, T = {
96
96
  },
97
97
  children: e.action.label
98
98
  }),
99
- /* @__PURE__ */ f("button", {
99
+ /* @__PURE__ */ _("button", {
100
100
  type: "button",
101
101
  className: "kapi-toast__x",
102
102
  "aria-label": j,
@@ -106,10 +106,10 @@ var w = { close: "Cerrar" }, T = {
106
106
  ]
107
107
  }, e.id);
108
108
  };
109
- return C(/* @__PURE__ */ p("div", {
109
+ return C(/* @__PURE__ */ v("div", {
110
110
  ref: P,
111
111
  id: O,
112
- className: t("kapi-toasts", x),
112
+ className: e("kapi-toasts", x),
113
113
  style: S,
114
114
  "aria-live": "polite",
115
115
  popover: D() ? "manual" : void 0,
@@ -125,7 +125,7 @@ var w = { close: "Cerrar" }, T = {
125
125
  onBlur: (e) => {
126
126
  e.currentTarget.contains(e.relatedTarget) || (B.current = !1, V());
127
127
  },
128
- children: [/* @__PURE__ */ f("div", {
128
+ children: [/* @__PURE__ */ _("div", {
129
129
  className: "kapi-toasts__urgent",
130
130
  "aria-live": "assertive",
131
131
  children: M.filter((e) => e.tone === "danger").map(H)
@@ -1,3 +1,4 @@
1
+ import type { KapiCloseReason } from "../closeReason.js";
1
2
  import { type TourStep } from "./tourLogic.js";
2
3
  import { type KapiRootProps } from "../rootProps.js";
3
4
  import type { KapiLabelsOverride } from "../labelsLogic.js";
@@ -15,7 +16,7 @@ export type KapiTourProps = KapiRootProps<HTMLDivElement> & {
15
16
  /** Controlado: el tour se muestra mientras sea true. */
16
17
  open: boolean;
17
18
  /** Se llama al cerrar (X, Escape o "Listo") y cuando no hay pasos disponibles. */
18
- onClose: () => void;
19
+ onClose: (reason: KapiCloseReason) => void;
19
20
  /**
20
21
  * Si se pasa, al cerrar se marca como visto en localStorage con esta clave (`true` = `kapi:tour-seen`).
21
22
  * Para aislar dos apps del mismo origen usa una clave con namespace, p. ej. `"tramites:tour-seen"`
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import "#kapi-css/components/feedback/feedback.css";
3
- import { useLabels as e } from "../locale/KapiLocaleProvider.js";
4
- import { joinClasses as t } from "../rootProps.js";
3
+ import { joinClasses as e } from "../rootProps.js";
4
+ import { useLabels as t } from "../locale/KapiLocaleProvider.js";
5
5
  import { activeHTMLElementOf as n, rootNodeOf as r, winOf as i } from "../../hooks/ownerDocument.js";
6
6
  import { usePortalRootOverride as a } from "../../hooks/portalRoot.js";
7
7
  import { useKapiRoot as o } from "../../hooks/kapiRoot.js";
@@ -12,8 +12,8 @@ import { useDismiss as u } from "../../hooks/useDismiss.js";
12
12
  import { trapTabKey as d } from "../../hooks/focusLogic.js";
13
13
  /* empty css */
14
14
  import { TOUR_PLACEMENT as f, filterAvailableSteps as p, highlightBox as m, markTourSeen as h } from "./tourLogic.js";
15
- import { jsx as g, jsxs as _ } from "react/jsx-runtime";
16
- import { useCallback as v, useEffect as y, useId as b, useLayoutEffect as x, useRef as S, useState as C } from "react";
15
+ import { useCallback as g, useEffect as _, useId as v, useLayoutEffect as y, useRef as b, useState as x } from "react";
16
+ import { jsx as S, jsxs as C } from "react/jsx-runtime";
17
17
  import { createPortal as w } from "react-dom";
18
18
  //#region src/components/feedback/KapiTour.tsx
19
19
  var T = {
@@ -23,27 +23,27 @@ var T = {
23
23
  close: "Cerrar",
24
24
  of: "de"
25
25
  }, E = ({ steps: E, open: D, onClose: O, markSeen: k, labels: A, className: ee, style: te, id: j, ref: M }) => {
26
- let N = e("tour", T, A), P = a(), F = o(), I = P ?? F, L = (e) => (r(I) ?? document).querySelector(e), [R, z] = C([]), [B, V] = C(0), [H, U] = C(null), W = S(null), G = l(W, M), K = b(), q = v(() => {
27
- k && h(typeof k == "string" ? k : void 0), O();
28
- }, [k, O]), J = E.map((e) => e.element).join("|"), Y = S(E);
29
- Y.current = E, y(() => {
26
+ let N = t("tour", T, A), P = a(), F = o(), I = P ?? F, L = (e) => (r(I) ?? document).querySelector(e), [R, z] = x([]), [B, V] = x(0), [H, U] = x(null), W = b(null), G = l(W, M), K = v(), q = g((e) => {
27
+ k && h(typeof k == "string" ? k : void 0), O(e);
28
+ }, [k, O]), J = E.map((e) => e.element).join("|"), Y = b(E);
29
+ Y.current = E, _(() => {
30
30
  if (!D) {
31
31
  z([]);
32
32
  return;
33
33
  }
34
34
  let e = p(Y.current, (e) => L(e) !== null);
35
- e.length ? (z(e), V(0)) : q();
35
+ e.length ? (z(e), V(0)) : q("unavailable");
36
36
  }, [D, J]);
37
37
  let X = D ? R[B] : void 0;
38
- x(() => {
38
+ y(() => {
39
39
  if (!D) return;
40
40
  let e = n(P);
41
41
  return () => {
42
42
  e?.isConnected && e.focus();
43
43
  };
44
- }, [D, P]), y(() => {
44
+ }, [D, P]), _(() => {
45
45
  X && I && W.current?.focus();
46
- }, [X, I]), x(() => {
46
+ }, [X, I]), y(() => {
47
47
  if (!X) return;
48
48
  let e = L(X.element);
49
49
  if (!e) {
@@ -75,23 +75,23 @@ var T = {
75
75
  width: { max: 300 },
76
76
  hideUntilPlaced: !1
77
77
  });
78
- if (x(() => {
78
+ if (y(() => {
79
79
  X && Q();
80
80
  }, [X, Q]), u(!!X, {
81
81
  zones: [W],
82
82
  outside: !1,
83
- onDismiss: q
83
+ onDismiss: (e) => q(e)
84
84
  }), !I || !X) return null;
85
85
  let $ = B === R.length - 1;
86
- return w(/* @__PURE__ */ _("div", {
86
+ return w(/* @__PURE__ */ C("div", {
87
87
  className: "kapi-tour",
88
- children: [H && /* @__PURE__ */ g("div", {
88
+ children: [H && /* @__PURE__ */ S("div", {
89
89
  className: "kapi-tour__hl",
90
90
  style: H
91
- }), /* @__PURE__ */ _("div", {
91
+ }), /* @__PURE__ */ C("div", {
92
92
  ref: G,
93
93
  id: j,
94
- className: t("kapi-tour__pop", ee),
94
+ className: e("kapi-tour__pop", ee),
95
95
  style: {
96
96
  ...te,
97
97
  ...Z
@@ -102,28 +102,28 @@ var T = {
102
102
  "aria-describedby": K,
103
103
  tabIndex: -1,
104
104
  onKeyDown: (e) => {
105
- e.key === "Escape" ? (e.preventDefault(), e.stopPropagation(), q()) : d(e, W.current);
105
+ e.key === "Escape" ? (e.preventDefault(), e.stopPropagation(), q("escape")) : d(e, W.current);
106
106
  },
107
107
  children: [
108
- /* @__PURE__ */ g("button", {
108
+ /* @__PURE__ */ S("button", {
109
109
  type: "button",
110
110
  className: "kapi-tour__x",
111
- onClick: q,
111
+ onClick: () => q("close-button"),
112
112
  "aria-label": N.close,
113
113
  children: "×"
114
114
  }),
115
- /* @__PURE__ */ g("div", {
115
+ /* @__PURE__ */ S("div", {
116
116
  className: "kapi-tour__title",
117
117
  children: X.title
118
118
  }),
119
- /* @__PURE__ */ g("div", {
119
+ /* @__PURE__ */ S("div", {
120
120
  className: "kapi-tour__desc",
121
121
  id: K,
122
122
  children: X.description
123
123
  }),
124
- /* @__PURE__ */ _("div", {
124
+ /* @__PURE__ */ C("div", {
125
125
  className: "kapi-tour__foot",
126
- children: [/* @__PURE__ */ _("span", {
126
+ children: [/* @__PURE__ */ C("span", {
127
127
  className: "kapi-tour__prog",
128
128
  children: [
129
129
  B + 1,
@@ -132,17 +132,17 @@ var T = {
132
132
  " ",
133
133
  R.length
134
134
  ]
135
- }), /* @__PURE__ */ _("div", {
135
+ }), /* @__PURE__ */ C("div", {
136
136
  className: "kapi-tour__foot-actions",
137
- children: [B > 0 && /* @__PURE__ */ g("button", {
137
+ children: [B > 0 && /* @__PURE__ */ S("button", {
138
138
  type: "button",
139
139
  className: "kapi-btn",
140
140
  onClick: () => V(B - 1),
141
141
  children: N.back
142
- }), /* @__PURE__ */ g("button", {
142
+ }), /* @__PURE__ */ S("button", {
143
143
  type: "button",
144
144
  className: "kapi-btn kapi-btn--primary",
145
- onClick: () => $ ? q() : V(B + 1),
145
+ onClick: () => $ ? q("item-selected") : V(B + 1),
146
146
  children: $ ? N.done : N.next
147
147
  })]
148
148
  })]
@@ -151,11 +151,11 @@ var T = {
151
151
  })]
152
152
  }), I);
153
153
  }, D = (e = !1) => {
154
- let [t, n] = C(e);
154
+ let [t, n] = x(e);
155
155
  return {
156
156
  open: t,
157
- start: v(() => n(!0), []),
158
- close: v(() => n(!1), [])
157
+ start: g(() => n(!0), []),
158
+ close: g(() => n(!1), [])
159
159
  };
160
160
  };
161
161
  //#endregion
@@ -11,8 +11,8 @@ import { AUTOCOMPLETE_MENU_PLACEMENT as ce, clampActiveIndex as le, defaultGetLa
11
11
  import { usePlacement as me } from "../../hooks/usePlacement.js";
12
12
  import { useAsyncLoader as he } from "../../hooks/useAsyncLoader.js";
13
13
  /* empty css */
14
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
15
- import { useCallback as o, useEffect as ge, useLayoutEffect as _e, useMemo as ve, useRef as s, useState as c } from "react";
14
+ import { useCallback as i, useEffect as ge, useLayoutEffect as _e, useMemo as ve, useRef as a, useState as o } from "react";
15
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
16
16
  import { createPortal as ye } from "react-dom";
17
17
  //#region src/components/inputs/KapiAutocomplete.tsx
18
18
  var l = {
@@ -32,9 +32,9 @@ var l = {
32
32
  status: y,
33
33
  readOnly: x,
34
34
  fieldClassName: Fe
35
- }), j = r(x, A.field), M = A.controlId ?? A.autoId, N = `${M}-listbox`, { helpId: Ge } = A, P = (e) => `${M}-opt-${e}`, F = p ?? ue, Ke = o((t) => {
35
+ }), j = r(x, A.field), M = A.controlId ?? A.autoId, N = `${M}-listbox`, { helpId: Ge } = A, P = (e) => `${M}-opt-${e}`, F = p ?? ue, Ke = i((t) => {
36
36
  e(S, t);
37
- }, [S]), [qe, I] = c(!1), [Je, L] = c(!1), [Ye, R] = c(-1), z = s(null), B = s(null), V = s(null), H = w !== void 0, U = !j && pe({
37
+ }, [S]), [qe, I] = o(!1), [Je, L] = o(!1), [Ye, R] = o(-1), z = a(null), B = a(null), V = a(null), H = w !== void 0, U = !j && pe({
38
38
  focused: qe,
39
39
  dismissed: Je,
40
40
  query: O,
@@ -73,7 +73,7 @@ var l = {
73
73
  K,
74
74
  Z
75
75
  ]);
76
- let Q = o((e) => {
76
+ let Q = i((e) => {
77
77
  g && k(F(e)), f?.(e), L(!0), R(-1);
78
78
  }, [
79
79
  g,
@@ -105,11 +105,11 @@ var l = {
105
105
  I(!0), L(!1), T?.(e);
106
106
  }, nt = (e) => {
107
107
  I(!1), R(-1), Re?.(e);
108
- }, $ = X ? se(B.current) : null, rt = /* @__PURE__ */ a("div", {
108
+ }, $ = X ? se(B.current) : null, rt = /* @__PURE__ */ c("div", {
109
109
  ref: B,
110
110
  className: ["kapi-ac", K && "kapi-ac--loading"].filter(Boolean).join(" "),
111
111
  children: [
112
- /* @__PURE__ */ i("input", {
112
+ /* @__PURE__ */ s("input", {
113
113
  ...E,
114
114
  ref: Ke,
115
115
  type: "text",
@@ -138,17 +138,17 @@ var l = {
138
138
  onFocus: tt,
139
139
  onBlur: nt
140
140
  }),
141
- K && /* @__PURE__ */ i("span", {
141
+ K && /* @__PURE__ */ s("span", {
142
142
  className: "kapi-ac__spinner kapi-spinner kapi-spinner--sm",
143
143
  "aria-hidden": "true"
144
144
  }),
145
- $ && ye(/* @__PURE__ */ a("div", {
145
+ $ && ye(/* @__PURE__ */ c("div", {
146
146
  ref: V,
147
147
  className: "kapi-ac__menu",
148
148
  "data-side": Ze?.side ?? "bottom",
149
149
  style: Qe,
150
150
  onMouseDown: (e) => e.preventDefault(),
151
- children: [/* @__PURE__ */ i("ul", {
151
+ children: [/* @__PURE__ */ s("ul", {
152
152
  ref: z,
153
153
  id: N,
154
154
  role: "listbox",
@@ -156,7 +156,7 @@ var l = {
156
156
  hidden: q.length === 0,
157
157
  children: q.map((e, t) => {
158
158
  let n = F(e), r = t === J;
159
- return /* @__PURE__ */ i("li", {
159
+ return /* @__PURE__ */ s("li", {
160
160
  id: P(t),
161
161
  role: "option",
162
162
  "aria-selected": r,
@@ -166,13 +166,13 @@ var l = {
166
166
  children: h ? h(e, {
167
167
  query: O,
168
168
  active: r
169
- }) : fe(n, O).map((e, t) => e.match ? /* @__PURE__ */ i("mark", {
169
+ }) : fe(n, O).map((e, t) => e.match ? /* @__PURE__ */ s("mark", {
170
170
  className: "kapi-ac__mark",
171
171
  children: e.text
172
- }, t) : /* @__PURE__ */ i("span", { children: e.text }, t))
172
+ }, t) : /* @__PURE__ */ s("span", { children: e.text }, t))
173
173
  }, m ? m(e) : `${n}-${t}`);
174
174
  })
175
- }), (K || Y) && /* @__PURE__ */ i("div", {
175
+ }), (K || Y) && /* @__PURE__ */ s("div", {
176
176
  className: "kapi-ac__status",
177
177
  role: "status",
178
178
  "aria-live": "polite",
@@ -1,4 +1,5 @@
1
1
  import type { ButtonHTMLAttributes, ReactNode, Ref } from "react";
2
+ import { type KapiRender } from "../renderSlot.js";
2
3
  import { type KapiButtonAppearance, type KapiLegacyButtonVariant, type KapiTone } from "../tone.js";
3
4
  export type { KapiButtonAppearance } from "../tone.js";
4
5
  /** Color de un botón: cualquier `KapiTone` (`neutral` es el botón por defecto, borde + card). */
@@ -42,8 +43,23 @@ export type KapiButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, "chi
42
43
  loading?: boolean | undefined;
43
44
  /** Ref al `<button>` nativo. */
44
45
  ref?: Ref<HTMLButtonElement> | undefined;
46
+ /**
47
+ * Dibuja OTRO elemento con el aspecto y el comportamiento del botón: el `<Link>` de tu router,
48
+ * un `<a>`, lo que sea. Puede ser un elemento ya armado o una función que recibe las props.
49
+ *
50
+ * Existe porque copiar las clases a mano es lo único que había, y queda desincronizado al primer
51
+ * cambio. Las clases se unen, los estilos se funden, los handlers corren los dos (primero el
52
+ * tuyo; si frenás el evento, el interno no corre) — las mismas reglas del passthrough nativo.
53
+ *
54
+ * `type` no viaja: sólo tiene sentido en un `<button>` de verdad. Y si el botón está `disabled`
55
+ * o `loading`, el elemento recibe `aria-disabled` en vez del atributo `disabled`, que no es
56
+ * válido fuera de un control nativo.
57
+ *
58
+ * <KapiButton render={<Link to="/altas" />}>Nueva persona</KapiButton>
59
+ */
60
+ render?: KapiRender | undefined;
45
61
  };
46
62
  /** Clases de un botón. Pura y exportada: es lo que se testea (no el markup). */
47
63
  export declare const buttonClasses: ({ tone, variant, size, iconOnly, bordered, loading, className }?: Pick<KapiButtonProps, "tone" | "variant" | "size" | "iconOnly" | "bordered" | "loading" | "className">) => string;
48
64
  /** Botón base: color (`tone`), forma (`variant`), tamaños, sólo ícono y borde. Acepta los atributos nativos de `<button>`. */
49
- export declare const KapiButton: ({ tone, variant, size, iconOnly, bordered, icon, loading, disabled, className, type, children, ref, ...rest }: KapiButtonProps) => import("react").JSX.Element;
65
+ export declare const KapiButton: ({ tone, variant, size, iconOnly, bordered, icon, loading, disabled, className, type, children, ref, render, ...rest }: KapiButtonProps) => import("react").JSX.Element;