@kapiuara/ui 0.16.0 → 0.17.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 (181) hide show
  1. package/README.md +171 -11
  2. package/dist/components/chat/KapiChatThread.js +4 -4
  3. package/dist/components/chat/KapiComposer.js +8 -8
  4. package/dist/components/data/KapiDataTable.js +4 -4
  5. package/dist/components/data/KapiSparkline.d.ts +2 -1
  6. package/dist/components/data/KapiSparkline.js +29 -26
  7. package/dist/components/data/KapiTableFilter.js +6 -6
  8. package/dist/components/data/tableCells.d.ts +12 -1
  9. package/dist/components/data/tableCells.js +49 -51
  10. package/dist/components/data/useTableSelection.js +3 -3
  11. package/dist/components/display/KapiAnnotation.js +68 -63
  12. package/dist/components/display/KapiAvatar.d.ts +6 -4
  13. package/dist/components/display/KapiAvatar.js +33 -28
  14. package/dist/components/display/KapiCodeBlock.d.ts +48 -0
  15. package/dist/components/display/KapiCodeBlock.js +44 -0
  16. package/dist/components/display/KapiCommentComposer.js +6 -6
  17. package/dist/components/display/KapiDiff.d.ts +62 -0
  18. package/dist/components/display/KapiDiff.js +118 -0
  19. package/dist/components/display/KapiHighlight.d.ts +27 -0
  20. package/dist/components/display/KapiHighlight.js +21 -0
  21. package/dist/components/display/KapiIconTile.d.ts +2 -1
  22. package/dist/components/display/KapiIconTile.js +23 -21
  23. package/dist/components/display/KapiStat.d.ts +3 -2
  24. package/dist/components/display/KapiStat.js +32 -26
  25. package/dist/components/display/KapiTag.d.ts +4 -3
  26. package/dist/components/display/KapiTag.js +29 -24
  27. package/dist/components/display/KapiTimeline.d.ts +5 -2
  28. package/dist/components/display/KapiTimeline.js +31 -23
  29. package/dist/components/display/annotationLogic.d.ts +2 -1
  30. package/dist/components/display/annotationLogic.js +7 -6
  31. package/dist/components/display/codeBlockSlots.d.ts +10 -0
  32. package/dist/components/display/codeBlockSlots.js +13 -0
  33. package/dist/components/display/diffLogic.d.ts +58 -0
  34. package/dist/components/display/diffLogic.js +96 -0
  35. package/dist/components/display/diffSlots.d.ts +14 -0
  36. package/dist/components/display/diffSlots.js +17 -0
  37. package/dist/components/display/highlightLogic.d.ts +18 -0
  38. package/dist/components/display/highlightLogic.js +26 -0
  39. package/dist/components/display/highlightSlots.d.ts +5 -0
  40. package/dist/components/display/highlightSlots.js +8 -0
  41. package/dist/components/display/iconTileLogic.d.ts +2 -2
  42. package/dist/components/display/iconTileLogic.js +7 -6
  43. package/dist/components/display/index.d.ts +8 -0
  44. package/dist/components/display/statLogic.d.ts +2 -1
  45. package/dist/components/display/statLogic.js +7 -6
  46. package/dist/components/display/tagLogic.d.ts +2 -1
  47. package/dist/components/display/tagLogic.js +7 -6
  48. package/dist/components/display/timelineLogic.d.ts +20 -2
  49. package/dist/components/display/timelineLogic.js +10 -2
  50. package/dist/components/feedback/KapiFab.js +108 -108
  51. package/dist/components/feedback/KapiProgress.js +63 -54
  52. package/dist/components/feedback/KapiToastContainer.js +9 -9
  53. package/dist/components/feedback/KapiTour.js +12 -12
  54. package/dist/components/feedback/progressLogic.d.ts +2 -1
  55. package/dist/components/feedback/progressLogic.js +9 -8
  56. package/dist/components/inputs/KapiAutocomplete.d.ts +6 -0
  57. package/dist/components/inputs/KapiAutocomplete.js +86 -85
  58. package/dist/components/inputs/KapiChecklist.d.ts +7 -1
  59. package/dist/components/inputs/KapiChecklist.js +53 -52
  60. package/dist/components/inputs/KapiCopyButton.d.ts +40 -0
  61. package/dist/components/inputs/KapiCopyButton.js +35 -0
  62. package/dist/components/inputs/KapiDatePicker.d.ts +7 -1
  63. package/dist/components/inputs/KapiDatePicker.js +118 -116
  64. package/dist/components/inputs/KapiDateRangePicker.d.ts +7 -1
  65. package/dist/components/inputs/KapiDateRangePicker.js +136 -135
  66. package/dist/components/inputs/KapiFacetedSearch.js +5 -5
  67. package/dist/components/inputs/KapiField.d.ts +9 -1
  68. package/dist/components/inputs/KapiField.js +43 -42
  69. package/dist/components/inputs/KapiFileUpload.js +6 -6
  70. package/dist/components/inputs/KapiInput.d.ts +29 -1
  71. package/dist/components/inputs/KapiInput.js +74 -51
  72. package/dist/components/inputs/KapiMaskedInput.js +26 -26
  73. package/dist/components/inputs/KapiNumberStepper.d.ts +7 -1
  74. package/dist/components/inputs/KapiNumberStepper.js +24 -23
  75. package/dist/components/inputs/KapiPinInput.d.ts +72 -0
  76. package/dist/components/inputs/KapiPinInput.js +75 -0
  77. package/dist/components/inputs/KapiPropsForm.d.ts +34 -0
  78. package/dist/components/inputs/KapiPropsForm.js +78 -0
  79. package/dist/components/inputs/KapiRating.d.ts +7 -1
  80. package/dist/components/inputs/KapiRating.js +39 -38
  81. package/dist/components/inputs/KapiSearchChip.js +5 -5
  82. package/dist/components/inputs/KapiSegmented.d.ts +13 -5
  83. package/dist/components/inputs/KapiSegmented.js +81 -77
  84. package/dist/components/inputs/KapiSelect.d.ts +9 -1
  85. package/dist/components/inputs/KapiSelect.js +236 -233
  86. package/dist/components/inputs/KapiSlider.d.ts +10 -3
  87. package/dist/components/inputs/KapiSlider.js +67 -63
  88. package/dist/components/inputs/KapiTagInput.d.ts +7 -1
  89. package/dist/components/inputs/KapiTagInput.js +70 -69
  90. package/dist/components/inputs/KapiTextarea.d.ts +7 -1
  91. package/dist/components/inputs/KapiTextarea.js +51 -50
  92. package/dist/components/inputs/copyLogic.d.ts +1 -0
  93. package/dist/components/inputs/copyLogic.js +12 -0
  94. package/dist/components/inputs/fieldLogic.d.ts +23 -3
  95. package/dist/components/inputs/fieldLogic.js +18 -11
  96. package/dist/components/inputs/index.d.ts +8 -0
  97. package/dist/components/inputs/inputLogic.d.ts +16 -1
  98. package/dist/components/inputs/inputLogic.js +3 -3
  99. package/dist/components/inputs/ownField.d.ts +3 -1
  100. package/dist/components/inputs/ownField.js +28 -27
  101. package/dist/components/inputs/pinInputLogic.d.ts +34 -0
  102. package/dist/components/inputs/pinInputLogic.js +37 -0
  103. package/dist/components/inputs/propsFormLogic.d.ts +53 -0
  104. package/dist/components/inputs/propsFormLogic.js +11 -0
  105. package/dist/components/inputs/segmentedLogic.d.ts +7 -0
  106. package/dist/components/inputs/segmentedLogic.js +2 -2
  107. package/dist/components/layout/KapiAccessCard.d.ts +5 -1
  108. package/dist/components/layout/KapiAccessCard.js +43 -39
  109. package/dist/components/layout/KapiAccountMenu.js +7 -7
  110. package/dist/components/layout/KapiCollapse.d.ts +39 -0
  111. package/dist/components/layout/KapiCollapse.js +20 -0
  112. package/dist/components/layout/KapiContextSlot.js +4 -4
  113. package/dist/components/layout/KapiDivider.d.ts +11 -2
  114. package/dist/components/layout/KapiDivider.js +30 -24
  115. package/dist/components/layout/KapiGrid.js +2 -2
  116. package/dist/components/layout/KapiNotificationBell.js +10 -10
  117. package/dist/components/layout/KapiPageHeader.js +22 -22
  118. package/dist/components/layout/KapiRail.js +4 -4
  119. package/dist/components/layout/KapiRoot.d.ts +22 -2
  120. package/dist/components/layout/KapiRoot.js +33 -29
  121. package/dist/components/layout/KapiShell.d.ts +9 -1
  122. package/dist/components/layout/KapiShell.js +28 -27
  123. package/dist/components/layout/accessCardLogic.d.ts +8 -1
  124. package/dist/components/layout/accessCardLogic.js +11 -7
  125. package/dist/components/layout/index.d.ts +2 -0
  126. package/dist/components/locale/labelRegistry.d.ts +10 -0
  127. package/dist/components/navigation/KapiAccordion.js +9 -9
  128. package/dist/components/navigation/KapiContextPanel.js +12 -12
  129. package/dist/components/navigation/KapiNavBadge.d.ts +6 -3
  130. package/dist/components/navigation/KapiNavBadge.js +26 -22
  131. package/dist/components/navigation/KapiTabs.js +9 -9
  132. package/dist/components/navigation/KapiToc.d.ts +48 -0
  133. package/dist/components/navigation/KapiToc.js +66 -0
  134. package/dist/components/navigation/KapiTree.js +10 -10
  135. package/dist/components/navigation/index.d.ts +3 -0
  136. package/dist/components/navigation/tocLogic.d.ts +35 -0
  137. package/dist/components/navigation/tocLogic.js +11 -0
  138. package/dist/components/navigation/tocSlots.d.ts +8 -0
  139. package/dist/components/navigation/tocSlots.js +11 -0
  140. package/dist/components/overlays/KapiCommandPalette.js +6 -6
  141. package/dist/components/overlays/KapiContextMenu.js +5 -5
  142. package/dist/components/overlays/KapiMenuButton.js +7 -7
  143. package/dist/components/overlays/KapiModal.js +3 -3
  144. package/dist/components/overlays/KapiOffcanvas.js +24 -24
  145. package/dist/components/overlays/KapiPhotoView.js +10 -10
  146. package/dist/components/overlays/KapiPopover.js +6 -6
  147. package/dist/components/overlays/KapiShapeSheet.js +4 -4
  148. package/dist/components/overlays/KapiTooltip.js +18 -18
  149. package/dist/components/overlays/menuList.js +22 -22
  150. package/dist/components/slotCatalog.d.ts +33 -0
  151. package/dist/components/slotCatalog.js +18 -10
  152. package/dist/css/base.css +1 -1
  153. package/dist/css/components/display/KapiAnnotation.css +1 -1
  154. package/dist/css/components/display/KapiCodeBlock.css +1 -0
  155. package/dist/css/components/display/KapiDiff.css +1 -0
  156. package/dist/css/components/display/display.css +1 -1
  157. package/dist/css/components/feedback/feedback.css +1 -1
  158. package/dist/css/components/inputs/KapiPinInput.css +1 -0
  159. package/dist/css/components/inputs/KapiSelect.css +1 -1
  160. package/dist/css/components/inputs/inputsExtra.css +1 -1
  161. package/dist/css/components/layout/KapiAccessCard.css +1 -1
  162. package/dist/css/components/layout/KapiCollapse.css +1 -0
  163. package/dist/css/components/layout/KapiDivider.css +1 -1
  164. package/dist/css/components/navigation/KapiToc.css +1 -0
  165. package/dist/hooks/asyncResourceLogic.d.ts +11 -0
  166. package/dist/hooks/asyncResourceLogic.js +4 -0
  167. package/dist/hooks/index.d.ts +3 -0
  168. package/dist/hooks/toneFamilyLogic.d.ts +26 -2
  169. package/dist/hooks/toneFamilyLogic.js +19 -6
  170. package/dist/hooks/useAsyncResource.d.ts +45 -0
  171. package/dist/hooks/useAsyncResource.js +24 -0
  172. package/dist/hooks/useKapiTheme.d.ts +8 -1
  173. package/dist/hooks/useKapiTheme.js +57 -57
  174. package/dist/hooks/useToneFamilies.d.ts +14 -4
  175. package/dist/hooks/useToneFamilies.js +27 -23
  176. package/dist/index.js +221 -207
  177. package/dist/kapi.css +1 -1
  178. package/dist/kapi.layered.css +1 -1
  179. package/dist/logic.d.ts +41 -0
  180. package/dist/logic.js +42 -0
  181. package/package.json +13 -2
@@ -1,197 +1,197 @@
1
1
  "use client";
2
2
  import "#kapi-css/components/feedback/feedback.css";
3
- import { useKapiDir as e, useLabels as t } from "../locale/KapiLocaleProvider.js";
4
- import { activeElementOf as n, winOf as r } from "../../hooks/ownerDocument.js";
5
- import { useKapiRoot as i } from "../../hooks/kapiRoot.js";
6
- import { onViewportChange as a } from "../../hooks/rafThrottle.js";
7
- import { placementViewport as o } from "../../hooks/viewportInsetLogic.js";
8
- import { resolveDirection as ee } from "../../hooks/directionLogic.js";
9
- import { useMergedRefs as s } from "../../hooks/mergeRefs.js";
10
- import { useDismiss as c } from "../../hooks/useDismiss.js";
3
+ import { useMergedRefs as e } from "../../hooks/mergeRefs.js";
4
+ import { useKapiDir as t, useLabels as n } from "../locale/KapiLocaleProvider.js";
5
+ import { activeElementOf as r, winOf as i } from "../../hooks/ownerDocument.js";
6
+ import { useKapiRoot as a } from "../../hooks/kapiRoot.js";
7
+ import { onViewportChange as o } from "../../hooks/rafThrottle.js";
8
+ import { placementViewport as s } from "../../hooks/viewportInsetLogic.js";
9
+ import { resolveDirection as c } from "../../hooks/directionLogic.js";
10
+ import { useDismiss as l } from "../../hooks/useDismiss.js";
11
11
  /* empty css */
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
- import { Plus as ie, X as ae } from "lucide-react";
16
- import { createPortal as oe } from "react-dom";
12
+ import { clampFabPosition as u, fabPanelPlacement as ee, isDragMove as te, resolveFabCorner as ne } from "./fabLogic.js";
13
+ import { useCallback as d, useEffect as f, useId as p, useLayoutEffect as m, useRef as h, useState as g } from "react";
14
+ import { jsx as _, jsxs as v } from "react/jsx-runtime";
15
+ import { Plus as re, X as ie } from "lucide-react";
16
+ import { createPortal as ae } from "react-dom";
17
17
  //#region src/components/feedback/KapiFab.tsx
18
- var v = {
18
+ var y = {
19
19
  action: "Acción",
20
20
  close: "Cerrar"
21
- }, se = {
21
+ }, oe = {
22
22
  br: "up-end",
23
23
  bl: "up-start",
24
24
  tr: "down-end",
25
25
  tl: "down-start"
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] = h(pe), j = k ? C : _e, M = m(j);
28
- M.current = j;
29
- let N = u((e) => {
30
- let t = typeof e == "function" ? e(M.current) : e;
31
- t !== M.current && (k || A(t), w?.(t));
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
- let t = V.current;
26
+ }, b = ({ actions: b = [], icon: se, label: x, labels: ce, onClick: le, position: ue = "bottom-end", draggable: S = !1, panel: C, panelTitle: w, open: T, defaultOpen: de = !1, onOpenChange: E, keepOpen: D = !1, className: fe, style: O, id: pe, ref: me }) => {
27
+ let k = n("fab", y, ce), A = x ?? k.action, j = T !== void 0, [he, ge] = g(de), M = j ? T : he, N = h(M);
28
+ N.current = M;
29
+ let P = d((e) => {
30
+ let t = typeof e == "function" ? e(N.current) : e;
31
+ t !== N.current && (j || ge(t), E?.(t));
32
+ }, [j, E]), F = C != null && C !== !1, I = h(null), L = h(null), R = p(), [z, B] = g(null), [_e, V] = g(!1), H = h(null), ve = e(H, me), U = h(!1), W = a(), ye = t(), G = !F && b.length > 0, K = d((e) => {
33
+ let t = H.current;
34
34
  if (!t) return e;
35
35
  let n = t.getBoundingClientRect();
36
- return l(e, {
36
+ return u(e, {
37
37
  width: n.width,
38
38
  height: n.height
39
- }, o(t));
40
- }, []), xe = c(j, {
41
- zones: [V],
42
- outside: !(P && T),
39
+ }, s(t));
40
+ }, []), be = l(M, {
41
+ zones: [H],
42
+ outside: !(F && D),
43
43
  onDismiss: (e) => {
44
- let t = e === "escape" && (V.current?.contains(n(V.current)) ?? !1);
45
- N(!1), t && F.current?.focus();
44
+ let t = e === "escape" && (H.current?.contains(r(H.current)) ?? !1);
45
+ P(!1), t && I.current?.focus();
46
46
  }
47
47
  });
48
- d(() => {
49
- if (!j || !P) return;
50
- let e = I.current;
48
+ f(() => {
49
+ if (!M || !F) return;
50
+ let e = L.current;
51
51
  (e?.querySelector(".kapi-fab-panel__body :is(input, select, textarea, button, [href], [tabindex]:not([tabindex='-1']))") ?? e)?.focus();
52
- }, [j, P]);
53
- let [Se, Ce] = h(null), K = u((e) => {
54
- let t = V.current, n = e && t ? te(t.getBoundingClientRect(), o(t)) : null;
55
- Ce(n);
52
+ }, [M, F]);
53
+ let [xe, Se] = g(null), q = d((e) => {
54
+ let t = H.current, n = e && t ? ee(t.getBoundingClientRect(), s(t)) : null;
55
+ Se(n);
56
56
  }, []);
57
- p(() => {
58
- K(R !== null);
57
+ m(() => {
58
+ q(z !== null);
59
59
  }, [
60
- R,
61
- j,
62
- U,
63
- K
60
+ z,
61
+ M,
62
+ W,
63
+ q
64
64
  ]);
65
- let q = R !== null;
66
- d(() => {
67
- if (!q) return;
68
- let e = r(V.current);
69
- return a(() => {
70
- z((e) => {
65
+ let J = z !== null;
66
+ f(() => {
67
+ if (!J) return;
68
+ let e = i(H.current);
69
+ return o(() => {
70
+ B((e) => {
71
71
  if (!e) return e;
72
- let t = G(e);
72
+ let t = K(e);
73
73
  return t.x === e.x && t.y === e.y ? e : t;
74
- }), K(!0);
74
+ }), q(!0);
75
75
  }, e ? { target: e } : {});
76
76
  }, [
77
- q,
78
- G,
79
- K
77
+ J,
78
+ K,
79
+ q
80
80
  ]);
81
- let J = (e) => {
82
- if (!b || e.button !== 0 || !V.current) return;
83
- let t = V.current.getBoundingClientRect(), n = {
81
+ let Ce = (e) => {
82
+ if (!S || e.button !== 0 || !H.current) return;
83
+ let t = H.current.getBoundingClientRect(), n = {
84
84
  mx: e.clientX,
85
85
  my: e.clientY,
86
86
  x: t.left,
87
87
  y: t.top,
88
88
  moved: !1
89
- }, i = (e) => {
89
+ }, r = (e) => {
90
90
  let t = e.clientX - n.mx, r = e.clientY - n.my;
91
- ne(t, r) && (n.moved = !0), n.moved && (B(!0), z(G({
91
+ te(t, r) && (n.moved = !0), n.moved && (V(!0), B(K({
92
92
  x: n.x + t,
93
93
  y: n.y + r
94
94
  })));
95
- }, a = r(V.current) ?? window, o = () => {
96
- a.removeEventListener("pointermove", i), a.removeEventListener("pointerup", o), a.removeEventListener("pointercancel", o), H.current = n.moved, B(!1), setTimeout(() => {
97
- H.current = !1;
95
+ }, a = i(H.current) ?? window, o = () => {
96
+ a.removeEventListener("pointermove", r), a.removeEventListener("pointerup", o), a.removeEventListener("pointercancel", o), U.current = n.moved, V(!1), setTimeout(() => {
97
+ U.current = !1;
98
98
  }, 0);
99
99
  };
100
- a.addEventListener("pointermove", i), a.addEventListener("pointerup", o), a.addEventListener("pointercancel", o);
100
+ a.addEventListener("pointermove", r), a.addEventListener("pointerup", o), a.addEventListener("pointercancel", o);
101
101
  }, we = () => {
102
- H.current || (W || P ? N((e) => !e) : de?.());
102
+ U.current || (G || F ? P((e) => !e) : le?.());
103
103
  }, Y = () => {
104
- N(!1), F.current?.focus();
104
+ P(!1), I.current?.focus();
105
105
  };
106
- if (!U) return null;
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
- ...E,
109
- left: R.x,
110
- top: R.y,
106
+ if (!W) return null;
107
+ let X = c(W, ye), Z = ne(ue, X), Q = X === "rtl" && Z.frame === "ltr", $ = Q ? { dir: "rtl" } : {}, Te = z && xe || oe[Z.physical], Ee = z ? {
108
+ ...O,
109
+ left: z.x,
110
+ top: z.y,
111
111
  right: "auto",
112
112
  bottom: "auto"
113
- } : E, De = [
113
+ } : O, De = [
114
114
  "kapi-fab-wrap",
115
115
  `kapi-fab-wrap--${Z.logical}`,
116
116
  `kapi-fab-wrap--${Z.physical}`,
117
- b && "is-draggable",
118
- ve && "is-dragging",
119
- me
117
+ S && "is-draggable",
118
+ _e && "is-dragging",
119
+ fe
120
120
  ].filter(Boolean).join(" ");
121
- return oe(/* @__PURE__ */ _("div", {
122
- ref: ye,
123
- id: he,
121
+ return ae(/* @__PURE__ */ v("div", {
122
+ ref: ve,
123
+ id: pe,
124
124
  className: De,
125
125
  style: Ee,
126
126
  ...Q ? { dir: "ltr" } : {},
127
- onKeyDown: xe,
127
+ onKeyDown: be,
128
128
  children: [
129
- P && j && /* @__PURE__ */ _("div", {
130
- ref: I,
129
+ F && M && /* @__PURE__ */ v("div", {
130
+ ref: L,
131
131
  role: "dialog",
132
132
  tabIndex: -1,
133
133
  className: `kapi-fab-panel kapi-fab-panel--${Te}`,
134
134
  ...$,
135
- ...S == null ? { "aria-label": O } : { "aria-labelledby": L },
136
- children: [S != null && /* @__PURE__ */ _("div", {
135
+ ...w == null ? { "aria-label": A } : { "aria-labelledby": R },
136
+ children: [w != null && /* @__PURE__ */ v("div", {
137
137
  className: "kapi-fab-panel__head",
138
- children: [/* @__PURE__ */ g("span", {
139
- id: L,
138
+ children: [/* @__PURE__ */ _("span", {
139
+ id: R,
140
140
  className: "kapi-fab-panel__title",
141
- children: S
142
- }), /* @__PURE__ */ g("button", {
141
+ children: w
142
+ }), /* @__PURE__ */ _("button", {
143
143
  type: "button",
144
144
  className: "kapi-fab-panel__close",
145
- "aria-label": D.close,
145
+ "aria-label": k.close,
146
146
  onClick: Y,
147
- children: /* @__PURE__ */ g(ae, {
147
+ children: /* @__PURE__ */ _(ie, {
148
148
  size: 16,
149
149
  strokeWidth: 2.2
150
150
  })
151
151
  })]
152
- }), /* @__PURE__ */ g("div", {
152
+ }), /* @__PURE__ */ _("div", {
153
153
  className: "kapi-fab-panel__body",
154
- children: typeof x == "function" ? x({ close: Y }) : x
154
+ children: typeof C == "function" ? C({ close: Y }) : C
155
155
  })]
156
156
  }),
157
- W && /* @__PURE__ */ g("div", {
158
- className: `kapi-fab-actions${j ? " is-open" : ""}`,
159
- children: y.map((e) => /* @__PURE__ */ _("button", {
157
+ G && /* @__PURE__ */ _("div", {
158
+ className: `kapi-fab-actions${M ? " is-open" : ""}`,
159
+ children: b.map((e) => /* @__PURE__ */ v("button", {
160
160
  type: "button",
161
161
  className: "kapi-fab-act",
162
- tabIndex: j ? 0 : -1,
162
+ tabIndex: M ? 0 : -1,
163
163
  onClick: () => {
164
- e.onClick?.(), N(!1);
164
+ e.onClick?.(), P(!1);
165
165
  },
166
- children: [/* @__PURE__ */ g("span", {
166
+ children: [/* @__PURE__ */ _("span", {
167
167
  className: "kapi-fab-act__label",
168
168
  ...$,
169
169
  children: e.label
170
- }), /* @__PURE__ */ g("span", {
170
+ }), /* @__PURE__ */ _("span", {
171
171
  className: "kapi-fab-act__btn",
172
172
  children: e.icon
173
173
  })]
174
174
  }, e.label))
175
175
  }),
176
- /* @__PURE__ */ g("button", {
177
- ref: F,
176
+ /* @__PURE__ */ _("button", {
177
+ ref: I,
178
178
  type: "button",
179
179
  className: "kapi-fab-main",
180
- onPointerDown: J,
180
+ onPointerDown: Ce,
181
181
  onClick: we,
182
- "aria-label": O,
183
- "aria-haspopup": P ? "dialog" : void 0,
184
- "aria-expanded": W || P ? j : void 0,
185
- children: /* @__PURE__ */ g("span", {
186
- className: `kapi-fab-main__ico${W && j ? " is-open" : ""}`,
187
- children: ce ?? /* @__PURE__ */ g(ie, {
182
+ "aria-label": A,
183
+ "aria-haspopup": F ? "dialog" : void 0,
184
+ "aria-expanded": G || F ? M : void 0,
185
+ children: /* @__PURE__ */ _("span", {
186
+ className: `kapi-fab-main__ico${G && M ? " is-open" : ""}`,
187
+ children: se ?? /* @__PURE__ */ _(re, {
188
188
  size: 24,
189
189
  strokeWidth: 2.4
190
190
  })
191
191
  })
192
192
  })
193
193
  ]
194
- }), U);
194
+ }), W);
195
195
  };
196
196
  //#endregion
197
- export { v as DEFAULT_FAB_LABELS, y as KapiFab };
197
+ export { y as DEFAULT_FAB_LABELS, b as KapiFab };
@@ -1,95 +1,104 @@
1
1
  "use client";
2
2
  import "#kapi-css/components/feedback/feedback.css";
3
+ import { useToneLook as e } from "../../hooks/useToneFamilies.js";
3
4
  /* empty css */
4
- import { circleDash as e, clampPercent as t, formatPercent as n, progressClasses as r } from "./progressLogic.js";
5
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
5
+ import { circleDash as t, clampPercent as n, formatPercent as r, progressClasses as i } from "./progressLogic.js";
6
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
6
7
  //#region src/components/feedback/KapiProgress.tsx
7
- var o = {
8
+ var s = {
8
9
  sm: 36,
9
10
  md: 56,
10
11
  lg: 84
11
- }, s = {
12
+ }, c = {
12
13
  sm: 4,
13
14
  md: 6,
14
15
  lg: 8
15
16
  };
16
- function c({ value: c, variant: l = "bar", tone: u = "primary", size: d = "md", label: f, showValue: p = !1, "aria-label": m, className: h, ...g }) {
17
- let _ = t(c), v = r({
18
- tone: u,
19
- size: d,
20
- variant: l,
21
- className: h
22
- }), y = {
17
+ function l({ value: l, variant: u = "bar", tone: d = "primary", size: f = "md", label: p, showValue: m = !1, "aria-label": h, className: g, ..._ }) {
18
+ let v = e("KapiProgress", d), y = n(l), b = i({
19
+ tone: v.tone,
20
+ size: f,
21
+ variant: u,
22
+ className: g
23
+ }), x = {
23
24
  role: "progressbar",
24
25
  "aria-valuemin": 0,
25
26
  "aria-valuemax": 100,
26
- "aria-valuenow": Math.round(_),
27
- "aria-label": typeof f == "string" ? f : m
27
+ "aria-valuenow": Math.round(y),
28
+ "aria-label": typeof p == "string" ? p : h
28
29
  };
29
- if (l === "circle") {
30
- let t = o[d], r = s[d], c = (t - r) / 2, { circumference: l, offset: u } = e(_, c);
31
- return /* @__PURE__ */ a("div", {
32
- ...g,
33
- className: v,
34
- children: [/* @__PURE__ */ a("div", {
30
+ if (u === "circle") {
31
+ let e = s[f], n = c[f], i = (e - n) / 2, { circumference: l, offset: u } = t(y, i);
32
+ return /* @__PURE__ */ o("div", {
33
+ ..._,
34
+ className: b,
35
+ style: {
36
+ ...v.style,
37
+ ..._.style
38
+ },
39
+ children: [/* @__PURE__ */ o("div", {
35
40
  className: "kapi-progress__ring",
36
41
  style: {
37
- width: t,
38
- height: t
42
+ width: e,
43
+ height: e
39
44
  },
40
- ...y,
41
- children: [/* @__PURE__ */ a("svg", {
42
- width: t,
43
- height: t,
44
- viewBox: `0 0 ${t} ${t}`,
45
+ ...x,
46
+ children: [/* @__PURE__ */ o("svg", {
47
+ width: e,
48
+ height: e,
49
+ viewBox: `0 0 ${e} ${e}`,
45
50
  "aria-hidden": !0,
46
- children: [/* @__PURE__ */ i("circle", {
51
+ children: [/* @__PURE__ */ a("circle", {
47
52
  className: "kapi-progress__track",
48
- cx: t / 2,
49
- cy: t / 2,
50
- r: c,
51
- strokeWidth: r
52
- }), /* @__PURE__ */ i("circle", {
53
+ cx: e / 2,
54
+ cy: e / 2,
55
+ r: i,
56
+ strokeWidth: n
57
+ }), /* @__PURE__ */ a("circle", {
53
58
  className: "kapi-progress__arc",
54
- cx: t / 2,
55
- cy: t / 2,
56
- r: c,
57
- strokeWidth: r,
59
+ cx: e / 2,
60
+ cy: e / 2,
61
+ r: i,
62
+ strokeWidth: n,
58
63
  strokeDasharray: l,
59
64
  strokeDashoffset: u,
60
- transform: `rotate(-90 ${t / 2} ${t / 2})`
65
+ transform: `rotate(-90 ${e / 2} ${e / 2})`
61
66
  })]
62
- }), p && /* @__PURE__ */ i("span", {
67
+ }), m && /* @__PURE__ */ a("span", {
63
68
  className: "kapi-progress__center",
64
- children: n(_)
69
+ children: r(y)
65
70
  })]
66
- }), f && /* @__PURE__ */ i("span", {
71
+ }), p && /* @__PURE__ */ a("span", {
67
72
  className: "kapi-progress__label",
68
- children: f
73
+ children: p
69
74
  })]
70
75
  });
71
76
  }
72
- return /* @__PURE__ */ a("div", {
73
- ...g,
74
- className: v,
75
- children: [(f || p) && /* @__PURE__ */ a("div", {
77
+ return /* @__PURE__ */ o("div", {
78
+ ..._,
79
+ className: b,
80
+ style: {
81
+ ...v.style,
82
+ ..._.style
83
+ },
84
+ children: [(p || m) && /* @__PURE__ */ o("div", {
76
85
  className: "kapi-progress__head",
77
- children: [f && /* @__PURE__ */ i("span", {
86
+ children: [p && /* @__PURE__ */ a("span", {
78
87
  className: "kapi-progress__label",
79
- children: f
80
- }), p && /* @__PURE__ */ i("span", {
88
+ children: p
89
+ }), m && /* @__PURE__ */ a("span", {
81
90
  className: "kapi-progress__value",
82
- children: n(_)
91
+ children: r(y)
83
92
  })]
84
- }), /* @__PURE__ */ i("div", {
93
+ }), /* @__PURE__ */ a("div", {
85
94
  className: "kapi-progress__bar",
86
- ...y,
87
- children: /* @__PURE__ */ i("div", {
95
+ ...x,
96
+ children: /* @__PURE__ */ a("div", {
88
97
  className: "kapi-progress__fill",
89
- style: { width: `${_}%` }
98
+ style: { width: `${y}%` }
90
99
  })
91
100
  })]
92
101
  });
93
102
  }
94
103
  //#endregion
95
- export { c as KapiProgress };
104
+ export { l as KapiProgress };
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import "#kapi-css/components/feedback/feedback.css";
3
3
  import { joinClasses as e } from "../rootProps.js";
4
- import { useLabels as t } from "../locale/KapiLocaleProvider.js";
5
- import { activeElementOf as n, docOf as r } from "../../hooks/ownerDocument.js";
6
- import { usePortalRootOverride as i } from "../../hooks/portalRoot.js";
7
- import { useMergedRefs as a } from "../../hooks/mergeRefs.js";
4
+ import { useMergedRefs as t } from "../../hooks/mergeRefs.js";
5
+ import { useLabels as n } from "../locale/KapiLocaleProvider.js";
6
+ import { activeElementOf as r, docOf as i } from "../../hooks/ownerDocument.js";
7
+ import { usePortalRootOverride as a } from "../../hooks/portalRoot.js";
8
8
  import { modalStack as o } from "../overlays/modalStack.js";
9
9
  import { getPortalRoot as s } from "../overlays/useNativeDialog.js";
10
10
  /* empty css */
@@ -33,9 +33,9 @@ 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 = 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);
36
+ let A = n("toast", w, b), j = y ?? A.close, M = h(u.subscribe, u.getSnapshot, u.getSnapshot), N = p(null), P = t(N, k), F = a(), [I, L] = m(null);
37
37
  d(() => {
38
- let e = r(F);
38
+ let e = i(F);
39
39
  if (!e) return;
40
40
  let t = e.createElement("div");
41
41
  t.className = "kapi-toasts-host", t.style.display = "contents";
@@ -44,9 +44,9 @@ var w = { close: "Cerrar" }, T = {
44
44
  n && (c(t, n), N.current && l(N.current));
45
45
  };
46
46
  n(), L(t);
47
- let i = o.subscribe(n);
47
+ let r = o.subscribe(n);
48
48
  return () => {
49
- i(), t.remove();
49
+ r(), t.remove();
50
50
  };
51
51
  }, [F]);
52
52
  let R = M.length ? Math.max(...M.map((e) => e.id)) : 0;
@@ -56,7 +56,7 @@ var w = { close: "Cerrar" }, T = {
56
56
  let z = p(!1), B = p(!1), V = () => E(z.current || B.current);
57
57
  if (d(() => {
58
58
  let e = N.current;
59
- B.current && !(e && e.contains(n(e))) && (B.current = !1), M.length || (z.current = !1), E(z.current || B.current);
59
+ B.current && !(e && e.contains(r(e))) && (B.current = !1), M.length || (z.current = !1), E(z.current || B.current);
60
60
  }, [M]), d(() => () => u.resume(), []), !I) return null;
61
61
  let H = (e) => {
62
62
  let { Icon: t, color: n } = T[e.tone];
@@ -1,13 +1,13 @@
1
1
  "use client";
2
2
  import "#kapi-css/components/feedback/feedback.css";
3
3
  import { joinClasses as e } from "../rootProps.js";
4
- import { useLabels as t } from "../locale/KapiLocaleProvider.js";
5
- import { activeHTMLElementOf as n, rootNodeOf as r, winOf as i } from "../../hooks/ownerDocument.js";
6
- import { usePortalRootOverride as a } from "../../hooks/portalRoot.js";
7
- import { useKapiRoot as o } from "../../hooks/kapiRoot.js";
8
- import { onViewportChange as s } from "../../hooks/rafThrottle.js";
9
- import { usePlacement as c } from "../../hooks/usePlacement.js";
10
- import { useMergedRefs as l } from "../../hooks/mergeRefs.js";
4
+ import { useMergedRefs as t } from "../../hooks/mergeRefs.js";
5
+ import { useLabels as n } from "../locale/KapiLocaleProvider.js";
6
+ import { activeHTMLElementOf as r, rootNodeOf as i, winOf as a } from "../../hooks/ownerDocument.js";
7
+ import { usePortalRootOverride as o } from "../../hooks/portalRoot.js";
8
+ import { useKapiRoot as s } from "../../hooks/kapiRoot.js";
9
+ import { onViewportChange as c } from "../../hooks/rafThrottle.js";
10
+ import { usePlacement as l } from "../../hooks/usePlacement.js";
11
11
  import { useDismiss as u } from "../../hooks/useDismiss.js";
12
12
  import { trapTabKey as d } from "../../hooks/focusLogic.js";
13
13
  /* empty css */
@@ -23,7 +23,7 @@ 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 = 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) => {
26
+ let N = n("tour", T, A), P = o(), F = s(), I = P ?? F, L = (e) => (i(I) ?? document).querySelector(e), [R, z] = x([]), [B, V] = x(0), [H, U] = x(null), W = b(null), G = t(W, M), K = v(), q = g((e) => {
27
27
  k && h(typeof k == "string" ? k : void 0), O(e);
28
28
  }, [k, O]), J = E.map((e) => e.element).join("|"), Y = b(E);
29
29
  Y.current = E, _(() => {
@@ -37,7 +37,7 @@ var T = {
37
37
  let X = D ? R[B] : void 0;
38
38
  y(() => {
39
39
  if (!D) return;
40
- let e = n(P);
40
+ let e = r(P);
41
41
  return () => {
42
42
  e?.isConnected && e.focus();
43
43
  };
@@ -56,10 +56,10 @@ var T = {
56
56
  });
57
57
  let t = () => U(m(e.getBoundingClientRect()));
58
58
  t();
59
- let n = i(e);
60
- return s(t, n ? { target: n } : {});
59
+ let n = a(e);
60
+ return c(t, n ? { target: n } : {});
61
61
  }, [X]);
62
- let { style: Z, update: Q } = c({
62
+ let { style: Z, update: Q } = l({
63
63
  open: !!X && !!I,
64
64
  anchor: () => {
65
65
  let e = X ? L(X.element) : null;
@@ -1,3 +1,4 @@
1
+ import { type KapiFamilyTone } from "../tone.js";
1
2
  export type KapiProgressTone = "primary" | "success" | "warning" | "danger";
2
3
  /** Lleva `value` al rango 0–100. NaN/undefined/Infinity-negativo -> 0; +Infinity -> 100. */
3
4
  export declare const clampPercent: (value: number) => number;
@@ -10,7 +11,7 @@ export declare const circleDash: (value: number, radius: number) => {
10
11
  };
11
12
  /** Clases del contenedor de progreso. */
12
13
  export declare const progressClasses: ({ tone, size, variant, className }?: {
13
- tone?: KapiProgressTone | undefined;
14
+ tone?: KapiProgressTone | KapiFamilyTone | undefined;
14
15
  size?: "sm" | "md" | "lg" | undefined;
15
16
  variant?: "bar" | "circle" | undefined;
16
17
  className?: string | undefined;
@@ -1,16 +1,17 @@
1
+ import { isFamilyTone as e } from "../tone.js";
1
2
  //#region src/components/feedback/progressLogic.ts
2
- var e = (e) => Number.isNaN(e) ? 0 : Math.min(100, Math.max(0, e)), t = (t) => `${Math.round(e(t))}%`, n = (t, n) => {
3
+ var t = (e) => Number.isNaN(e) ? 0 : Math.min(100, Math.max(0, e)), n = (e) => `${Math.round(t(e))}%`, r = (e, n) => {
3
4
  let r = 2 * Math.PI * n;
4
5
  return {
5
6
  circumference: r,
6
- offset: r * (1 - e(t) / 100)
7
+ offset: r * (1 - t(e) / 100)
7
8
  };
8
- }, r = ({ tone: e = "primary", size: t = "md", variant: n = "bar", className: r = "" } = {}) => [
9
+ }, i = ({ tone: t = "primary", size: n = "md", variant: r = "bar", className: i = "" } = {}) => [
9
10
  "kapi-progress",
10
- n === "circle" && "kapi-progress--circle",
11
- `kapi-progress--${e}`,
12
- t !== "md" && `kapi-progress--${t}`,
13
- r
11
+ r === "circle" && "kapi-progress--circle",
12
+ e(t) ? "kapi-progress--family" : `kapi-progress--${t}`,
13
+ n !== "md" && `kapi-progress--${n}`,
14
+ i
14
15
  ].filter(Boolean).join(" ");
15
16
  //#endregion
16
- export { n as circleDash, e as clampPercent, t as formatPercent, r as progressClasses };
17
+ export { r as circleDash, t as clampPercent, n as formatPercent, i as progressClasses };
@@ -64,6 +64,12 @@ type KapiAutocompleteBaseProps<T> = {
64
64
  required?: boolean | undefined;
65
65
  /** Texto de ayuda o error bajo el campo. */
66
66
  help?: ReactNode;
67
+ /**
68
+ * El motivo por el que el campo está mal. Reemplaza a `help` y lo marca inválido (rojo, ícono y
69
+ * `role="alert"`). Es lo que entregan las librerías de formularios: un mensaje, no un booleano.
70
+ * Un error que React no pinta (`true`, `""`, `null`) no marca nada. Gana sobre `invalid` y `status`.
71
+ */
72
+ error?: ReactNode | undefined;
67
73
  /** Clase del `KapiField` propio (con `label` o `help`). `className` va al input. */
68
74
  fieldClassName?: string | undefined;
69
75
  /** Clase del `<input>` (la del envoltorio va en `fieldClassName`). */