@kapiuara/ui 0.15.3 → 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 (288) hide show
  1. package/LICENSE +19 -15
  2. package/README.md +505 -13
  3. package/dist/components/chat/KapiChatThread.js +4 -4
  4. package/dist/components/chat/KapiComposer.js +8 -8
  5. package/dist/components/data/KapiDataTable.d.ts +1 -1
  6. package/dist/components/data/KapiDataTable.js +25 -25
  7. package/dist/components/data/KapiPaginationFooter.js +1 -1
  8. package/dist/components/data/KapiSheet.d.ts +105 -0
  9. package/dist/components/data/KapiSheet.js +75 -0
  10. package/dist/components/data/KapiSparkline.d.ts +2 -1
  11. package/dist/components/data/KapiSparkline.js +29 -26
  12. package/dist/components/data/KapiTable.d.ts +2 -2
  13. package/dist/components/data/KapiTable.js +347 -329
  14. package/dist/components/data/KapiTableFilter.js +6 -6
  15. package/dist/components/data/KapiTableFooter.d.ts +22 -0
  16. package/dist/components/data/KapiTableFooter.js +55 -0
  17. package/dist/components/data/KapiTableRow.js +53 -52
  18. package/dist/components/data/KapiTableToolbar.d.ts +4 -2
  19. package/dist/components/data/KapiTableToolbar.js +71 -69
  20. package/dist/components/data/index.d.ts +3 -1
  21. package/dist/components/data/tableCells.d.ts +17 -5
  22. package/dist/components/data/tableCells.js +52 -53
  23. package/dist/components/data/tableLogic.d.ts +2 -0
  24. package/dist/components/data/tableLogic.js +66 -66
  25. package/dist/components/data/tableSlots.d.ts +9 -0
  26. package/dist/components/data/tableSlots.js +12 -0
  27. package/dist/components/data/tableSpanLogic.d.ts +35 -0
  28. package/dist/components/data/tableSpanLogic.js +47 -0
  29. package/dist/components/data/tableTypes.d.ts +54 -1
  30. package/dist/components/data/useTableSelection.d.ts +4 -2
  31. package/dist/components/data/useTableSelection.js +29 -25
  32. package/dist/components/display/KapiAnchor.d.ts +36 -0
  33. package/dist/components/display/KapiAnchor.js +36 -0
  34. package/dist/components/display/KapiAnnotation.js +68 -63
  35. package/dist/components/display/KapiAvatar.d.ts +6 -4
  36. package/dist/components/display/KapiAvatar.js +33 -28
  37. package/dist/components/display/KapiBadge.d.ts +6 -5
  38. package/dist/components/display/KapiBadge.js +25 -19
  39. package/dist/components/display/KapiCodeBlock.d.ts +48 -0
  40. package/dist/components/display/KapiCodeBlock.js +44 -0
  41. package/dist/components/display/KapiCommentComposer.js +6 -6
  42. package/dist/components/display/KapiDiff.d.ts +62 -0
  43. package/dist/components/display/KapiDiff.js +118 -0
  44. package/dist/components/display/KapiHighlight.d.ts +27 -0
  45. package/dist/components/display/KapiHighlight.js +21 -0
  46. package/dist/components/display/KapiIconTile.d.ts +2 -1
  47. package/dist/components/display/KapiIconTile.js +23 -21
  48. package/dist/components/display/KapiStat.d.ts +3 -2
  49. package/dist/components/display/KapiStat.js +32 -26
  50. package/dist/components/display/KapiTag.d.ts +4 -3
  51. package/dist/components/display/KapiTag.js +29 -24
  52. package/dist/components/display/KapiText.d.ts +43 -0
  53. package/dist/components/display/KapiText.js +33 -0
  54. package/dist/components/display/KapiTimeline.d.ts +5 -2
  55. package/dist/components/display/KapiTimeline.js +31 -23
  56. package/dist/components/display/KapiTitle.d.ts +33 -0
  57. package/dist/components/display/KapiTitle.js +29 -0
  58. package/dist/components/display/annotationLogic.d.ts +2 -1
  59. package/dist/components/display/annotationLogic.js +7 -6
  60. package/dist/components/display/codeBlockSlots.d.ts +10 -0
  61. package/dist/components/display/codeBlockSlots.js +13 -0
  62. package/dist/components/display/diffLogic.d.ts +58 -0
  63. package/dist/components/display/diffLogic.js +96 -0
  64. package/dist/components/display/diffSlots.d.ts +14 -0
  65. package/dist/components/display/diffSlots.js +17 -0
  66. package/dist/components/display/highlightLogic.d.ts +18 -0
  67. package/dist/components/display/highlightLogic.js +26 -0
  68. package/dist/components/display/highlightSlots.d.ts +5 -0
  69. package/dist/components/display/highlightSlots.js +8 -0
  70. package/dist/components/display/iconTileLogic.d.ts +2 -2
  71. package/dist/components/display/iconTileLogic.js +7 -6
  72. package/dist/components/display/index.d.ts +15 -0
  73. package/dist/components/display/statLogic.d.ts +2 -1
  74. package/dist/components/display/statLogic.js +7 -6
  75. package/dist/components/display/tagLogic.d.ts +2 -1
  76. package/dist/components/display/tagLogic.js +7 -6
  77. package/dist/components/display/textLogic.d.ts +32 -0
  78. package/dist/components/display/textLogic.js +19 -0
  79. package/dist/components/display/timelineLogic.d.ts +20 -2
  80. package/dist/components/display/timelineLogic.js +10 -2
  81. package/dist/components/feedback/KapiAlert.d.ts +8 -4
  82. package/dist/components/feedback/KapiAlert.js +39 -34
  83. package/dist/components/feedback/KapiFab.js +108 -108
  84. package/dist/components/feedback/KapiProgress.js +63 -54
  85. package/dist/components/feedback/KapiToastContainer.js +9 -9
  86. package/dist/components/feedback/KapiTour.js +12 -12
  87. package/dist/components/feedback/progressLogic.d.ts +2 -1
  88. package/dist/components/feedback/progressLogic.js +9 -8
  89. package/dist/components/inputs/KapiAutocomplete.d.ts +6 -0
  90. package/dist/components/inputs/KapiAutocomplete.js +86 -85
  91. package/dist/components/inputs/KapiButton.d.ts +7 -4
  92. package/dist/components/inputs/KapiButton.js +47 -42
  93. package/dist/components/inputs/KapiChecklist.d.ts +7 -1
  94. package/dist/components/inputs/KapiChecklist.js +53 -52
  95. package/dist/components/inputs/KapiCopyButton.d.ts +40 -0
  96. package/dist/components/inputs/KapiCopyButton.js +35 -0
  97. package/dist/components/inputs/KapiDatePicker.d.ts +7 -1
  98. package/dist/components/inputs/KapiDatePicker.js +118 -116
  99. package/dist/components/inputs/KapiDateRangePicker.d.ts +7 -1
  100. package/dist/components/inputs/KapiDateRangePicker.js +136 -135
  101. package/dist/components/inputs/KapiFacetedSearch.js +5 -5
  102. package/dist/components/inputs/KapiField.d.ts +9 -1
  103. package/dist/components/inputs/KapiField.js +43 -42
  104. package/dist/components/inputs/KapiFileUpload.js +6 -6
  105. package/dist/components/inputs/KapiInput.d.ts +29 -1
  106. package/dist/components/inputs/KapiInput.js +74 -51
  107. package/dist/components/inputs/KapiMaskedInput.js +26 -26
  108. package/dist/components/inputs/KapiNumberStepper.d.ts +7 -1
  109. package/dist/components/inputs/KapiNumberStepper.js +24 -23
  110. package/dist/components/inputs/KapiPinInput.d.ts +72 -0
  111. package/dist/components/inputs/KapiPinInput.js +75 -0
  112. package/dist/components/inputs/KapiPropsForm.d.ts +34 -0
  113. package/dist/components/inputs/KapiPropsForm.js +78 -0
  114. package/dist/components/inputs/KapiRating.d.ts +7 -1
  115. package/dist/components/inputs/KapiRating.js +39 -38
  116. package/dist/components/inputs/KapiSearchChip.js +5 -5
  117. package/dist/components/inputs/KapiSegmented.d.ts +13 -5
  118. package/dist/components/inputs/KapiSegmented.js +81 -77
  119. package/dist/components/inputs/KapiSelect.d.ts +21 -1
  120. package/dist/components/inputs/KapiSelect.js +251 -245
  121. package/dist/components/inputs/KapiSelectMenu.d.ts +4 -2
  122. package/dist/components/inputs/KapiSelectMenu.js +131 -133
  123. package/dist/components/inputs/KapiSlider.d.ts +10 -3
  124. package/dist/components/inputs/KapiSlider.js +67 -63
  125. package/dist/components/inputs/KapiTagInput.d.ts +7 -1
  126. package/dist/components/inputs/KapiTagInput.js +70 -69
  127. package/dist/components/inputs/KapiTextarea.d.ts +7 -1
  128. package/dist/components/inputs/KapiTextarea.js +51 -50
  129. package/dist/components/inputs/copyLogic.d.ts +1 -0
  130. package/dist/components/inputs/copyLogic.js +12 -0
  131. package/dist/components/inputs/fieldLogic.d.ts +21 -1
  132. package/dist/components/inputs/fieldLogic.js +18 -11
  133. package/dist/components/inputs/index.d.ts +9 -1
  134. package/dist/components/inputs/inputLogic.d.ts +16 -1
  135. package/dist/components/inputs/inputLogic.js +3 -3
  136. package/dist/components/inputs/ownField.d.ts +3 -1
  137. package/dist/components/inputs/ownField.js +28 -27
  138. package/dist/components/inputs/pinInputLogic.d.ts +34 -0
  139. package/dist/components/inputs/pinInputLogic.js +37 -0
  140. package/dist/components/inputs/propsFormLogic.d.ts +53 -0
  141. package/dist/components/inputs/propsFormLogic.js +11 -0
  142. package/dist/components/inputs/segmentedLogic.d.ts +7 -0
  143. package/dist/components/inputs/segmentedLogic.js +2 -2
  144. package/dist/components/inputs/selectSlots.d.ts +24 -0
  145. package/dist/components/inputs/selectSlots.js +27 -0
  146. package/dist/components/layout/KapiAccessCard.d.ts +5 -1
  147. package/dist/components/layout/KapiAccessCard.js +43 -39
  148. package/dist/components/layout/KapiAccountMenu.js +7 -7
  149. package/dist/components/layout/KapiBox.d.ts +31 -0
  150. package/dist/components/layout/KapiBox.js +26 -0
  151. package/dist/components/layout/KapiCard.d.ts +16 -4
  152. package/dist/components/layout/KapiCard.js +46 -34
  153. package/dist/components/layout/KapiCenter.d.ts +13 -0
  154. package/dist/components/layout/KapiCenter.js +23 -0
  155. package/dist/components/layout/KapiCol.d.ts +22 -0
  156. package/dist/components/layout/KapiCol.js +23 -0
  157. package/dist/components/layout/KapiCollapse.d.ts +39 -0
  158. package/dist/components/layout/KapiCollapse.js +20 -0
  159. package/dist/components/layout/KapiContextSlot.js +4 -4
  160. package/dist/components/layout/KapiDivider.d.ts +11 -2
  161. package/dist/components/layout/KapiDivider.js +30 -24
  162. package/dist/components/layout/KapiGrid.d.ts +29 -3
  163. package/dist/components/layout/KapiGrid.js +39 -17
  164. package/dist/components/layout/KapiNotificationBell.js +10 -10
  165. package/dist/components/layout/KapiPageHeader.d.ts +10 -1
  166. package/dist/components/layout/KapiPageHeader.js +94 -92
  167. package/dist/components/layout/KapiPanelParts.d.ts +11 -2
  168. package/dist/components/layout/KapiPanelParts.js +73 -56
  169. package/dist/components/layout/KapiRail.d.ts +10 -1
  170. package/dist/components/layout/KapiRail.js +125 -122
  171. package/dist/components/layout/KapiRoot.d.ts +55 -5
  172. package/dist/components/layout/KapiRoot.js +57 -38
  173. package/dist/components/layout/KapiShell.d.ts +44 -3
  174. package/dist/components/layout/KapiShell.js +54 -50
  175. package/dist/components/layout/accessCardLogic.d.ts +8 -1
  176. package/dist/components/layout/accessCardLogic.js +11 -7
  177. package/dist/components/layout/cardSlots.d.ts +9 -0
  178. package/dist/components/layout/cardSlots.js +12 -0
  179. package/dist/components/layout/gridSpanLogic.d.ts +46 -0
  180. package/dist/components/layout/gridSpanLogic.js +39 -0
  181. package/dist/components/layout/index.d.ts +13 -4
  182. package/dist/components/layout/layoutPrimitives.d.ts +11 -0
  183. package/dist/components/layout/layoutPrimitives.js +12 -1
  184. package/dist/components/layout/pageHeaderSlots.d.ts +12 -0
  185. package/dist/components/layout/pageHeaderSlots.js +15 -0
  186. package/dist/components/layout/railLogic.d.ts +16 -3
  187. package/dist/components/layout/railSlots.d.ts +12 -0
  188. package/dist/components/layout/railSlots.js +15 -0
  189. package/dist/components/layout/shellSlots.d.ts +6 -0
  190. package/dist/components/layout/shellSlots.js +9 -0
  191. package/dist/components/layout/useGridBreakpoint.d.ts +12 -0
  192. package/dist/components/layout/useGridBreakpoint.js +35 -0
  193. package/dist/components/locale/labelRegistry.d.ts +10 -0
  194. package/dist/components/navigation/KapiAccordion.js +9 -9
  195. package/dist/components/navigation/KapiBreadcrumb.d.ts +18 -2
  196. package/dist/components/navigation/KapiBreadcrumb.js +23 -16
  197. package/dist/components/navigation/KapiContextPanel.d.ts +17 -4
  198. package/dist/components/navigation/KapiContextPanel.js +152 -136
  199. package/dist/components/navigation/KapiNavBadge.d.ts +6 -3
  200. package/dist/components/navigation/KapiNavBadge.js +26 -22
  201. package/dist/components/navigation/KapiPanelGroup.d.ts +16 -4
  202. package/dist/components/navigation/KapiPanelGroup.js +66 -65
  203. package/dist/components/navigation/KapiTabs.d.ts +12 -0
  204. package/dist/components/navigation/KapiTabs.js +87 -71
  205. package/dist/components/navigation/KapiToc.d.ts +48 -0
  206. package/dist/components/navigation/KapiToc.js +66 -0
  207. package/dist/components/navigation/KapiTree.js +10 -10
  208. package/dist/components/navigation/MiniNavItem.d.ts +7 -2
  209. package/dist/components/navigation/MiniNavItem.js +41 -36
  210. package/dist/components/navigation/breadcrumbLogic.d.ts +4 -2
  211. package/dist/components/navigation/breadcrumbLogic.js +1 -1
  212. package/dist/components/navigation/index.d.ts +3 -0
  213. package/dist/components/navigation/navLink.d.ts +21 -0
  214. package/dist/components/navigation/navLink.js +26 -0
  215. package/dist/components/navigation/navLinkLogic.d.ts +18 -0
  216. package/dist/components/navigation/navLinkLogic.js +22 -0
  217. package/dist/components/navigation/tocLogic.d.ts +35 -0
  218. package/dist/components/navigation/tocLogic.js +11 -0
  219. package/dist/components/navigation/tocSlots.d.ts +8 -0
  220. package/dist/components/navigation/tocSlots.js +11 -0
  221. package/dist/components/overlays/KapiCommandPalette.js +6 -6
  222. package/dist/components/overlays/KapiContextMenu.d.ts +8 -0
  223. package/dist/components/overlays/KapiContextMenu.js +5 -5
  224. package/dist/components/overlays/KapiMenuButton.js +7 -7
  225. package/dist/components/overlays/KapiModal.d.ts +9 -0
  226. package/dist/components/overlays/KapiModal.js +79 -77
  227. package/dist/components/overlays/KapiOffcanvas.js +24 -24
  228. package/dist/components/overlays/KapiPhotoView.js +10 -10
  229. package/dist/components/overlays/KapiPopover.js +6 -6
  230. package/dist/components/overlays/KapiShapeSheet.js +4 -4
  231. package/dist/components/overlays/KapiTooltip.js +18 -18
  232. package/dist/components/overlays/index.d.ts +1 -1
  233. package/dist/components/overlays/menuList.js +127 -117
  234. package/dist/components/overlays/modalSlots.d.ts +11 -0
  235. package/dist/components/overlays/modalSlots.js +14 -0
  236. package/dist/components/slotCatalog.d.ts +123 -0
  237. package/dist/components/slotCatalog.js +27 -0
  238. package/dist/components/slotsLogic.d.ts +34 -0
  239. package/dist/components/slotsLogic.js +18 -0
  240. package/dist/components/tone.d.ts +26 -0
  241. package/dist/components/tone.js +15 -14
  242. package/dist/css/base.css +1 -1
  243. package/dist/css/components/data/KapiEventCalendar.css +1 -1
  244. package/dist/css/components/data/KapiTable.css +1 -1
  245. package/dist/css/components/display/KapiAnnotation.css +1 -1
  246. package/dist/css/components/display/KapiCodeBlock.css +1 -0
  247. package/dist/css/components/display/KapiDiff.css +1 -0
  248. package/dist/css/components/display/display.css +1 -1
  249. package/dist/css/components/display/typography.css +1 -0
  250. package/dist/css/components/feedback/feedback.css +1 -1
  251. package/dist/css/components/inputs/KapiButton.css +1 -1
  252. package/dist/css/components/inputs/KapiDatePicker.css +1 -1
  253. package/dist/css/components/inputs/KapiPinInput.css +1 -0
  254. package/dist/css/components/inputs/KapiSelect.css +1 -1
  255. package/dist/css/components/inputs/inputsExtra.css +1 -1
  256. package/dist/css/components/layout/KapiAccessCard.css +1 -1
  257. package/dist/css/components/layout/KapiBox.css +1 -0
  258. package/dist/css/components/layout/KapiCollapse.css +1 -0
  259. package/dist/css/components/layout/KapiDivider.css +1 -1
  260. package/dist/css/components/layout/KapiRail.css +1 -1
  261. package/dist/css/components/layout/gridSpan.css +1 -0
  262. package/dist/css/components/navigation/KapiToc.css +1 -0
  263. package/dist/css/components/navigation/navigation.css +1 -1
  264. package/dist/hooks/asyncResourceLogic.d.ts +11 -0
  265. package/dist/hooks/asyncResourceLogic.js +4 -0
  266. package/dist/hooks/densityLogic.d.ts +15 -0
  267. package/dist/hooks/densityLogic.js +4 -0
  268. package/dist/hooks/index.d.ts +7 -0
  269. package/dist/hooks/themeColorsLogic.d.ts +19 -0
  270. package/dist/hooks/themeColorsLogic.js +4 -2
  271. package/dist/hooks/themeDeriveLogic.d.ts +16 -0
  272. package/dist/hooks/themeDeriveLogic.js +27 -17
  273. package/dist/hooks/toneFamilyLogic.d.ts +146 -0
  274. package/dist/hooks/toneFamilyLogic.js +164 -0
  275. package/dist/hooks/useAsyncResource.d.ts +45 -0
  276. package/dist/hooks/useAsyncResource.js +24 -0
  277. package/dist/hooks/useKapiTheme.d.ts +16 -3
  278. package/dist/hooks/useKapiTheme.js +130 -117
  279. package/dist/hooks/useToneFamilies.d.ts +40 -0
  280. package/dist/hooks/useToneFamilies.js +50 -0
  281. package/dist/index.d.ts +3 -1
  282. package/dist/index.js +227 -204
  283. package/dist/kapi.css +1 -1
  284. package/dist/kapi.layered.css +1 -1
  285. package/dist/logic.d.ts +41 -0
  286. package/dist/logic.js +42 -0
  287. package/dist/styles/rawHeights.d.ts +8 -0
  288. package/package.json +14 -3
@@ -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;
@@ -1,239 +1,255 @@
1
1
  "use client";
2
2
  import "#kapi-css/components/navigation/navigation.css";
3
3
  import { joinClasses as e } from "../rootProps.js";
4
- import { useLabels as t } from "../locale/KapiLocaleProvider.js";
5
- import { useControllableState as n } from "../../hooks/useControllableState.js";
6
- import { directionOf as r, physicalSide as i } from "../../hooks/directionLogic.js";
7
- import { useMergedRefs as a } from "../../hooks/mergeRefs.js";
8
- import { DEFAULT_LINK_LABELS as o } from "../locale/linkLabels.js";
4
+ import { renderSlot as t } from "../renderSlot.js";
5
+ import { useMergedRefs as n } from "../../hooks/mergeRefs.js";
6
+ import { useLabels as r } from "../locale/KapiLocaleProvider.js";
7
+ import { useControllableState as i } from "../../hooks/useControllableState.js";
8
+ import { directionOf as a, physicalSide as o } from "../../hooks/directionLogic.js";
9
+ import { DEFAULT_LINK_LABELS as s } from "../locale/linkLabels.js";
9
10
  import "./navBadgeLogic.js";
10
- import { KapiNavBadge as s } from "./KapiNavBadge.js";
11
- import { CtxSlidingList as c } from "./CtxSlidingList.js";
11
+ import { KapiNavBadge as c } from "./KapiNavBadge.js";
12
+ import { CtxSlidingList as l } from "./CtxSlidingList.js";
12
13
  /* empty css */
13
- import { KapiPanelMiniContext as l, useKapiPanelMini as u } from "./panelMini.js";
14
- import { MiniNavItem as d } from "./MiniNavItem.js";
15
- import { KapiPanelSearch as f } from "../layout/KapiPanelParts.js";
16
- import { canCollapse as ee, clampCtxPanelWidth as te, ctxPanelClasses as p, ctxPanelWidthFromDrag as ne, stepCtxPanelWidth as re } from "./contextPanelLogic.js";
17
- import { activeIdIn as m } from "./activeItemLogic.js";
18
- import { useLayoutEffect as h, useMemo as g, useRef as _, useState as v } from "react";
19
- import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
20
- import { ChevronsLeft as S, ChevronsRight as C, ExternalLink as w } from "lucide-react";
14
+ import { renderNavLink as u } from "./navLink.js";
15
+ import { KapiPanelMiniContext as ee, useKapiPanelMini as d } from "./panelMini.js";
16
+ import { MiniNavItem as f } from "./MiniNavItem.js";
17
+ import { KapiPanelSearch as p } from "../layout/KapiPanelParts.js";
18
+ import { canCollapse as m, clampCtxPanelWidth as te, ctxPanelClasses as h, ctxPanelWidthFromDrag as g, stepCtxPanelWidth as _ } from "./contextPanelLogic.js";
19
+ import { activeIdIn as v } from "./activeItemLogic.js";
20
+ import { useLayoutEffect as y, useMemo as ne, useRef as b, useState as x } from "react";
21
+ import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
22
+ import { ChevronsLeft as T, ChevronsRight as E, ExternalLink as D } from "lucide-react";
21
23
  //#region src/components/navigation/KapiContextPanel.tsx
22
- var T = ({ item: e, active: t, onSelect: n, newTabLabel: r }) => {
23
- let { mini: i } = u(), a = e.detail !== void 0 || e.initials !== void 0, o = () => n?.(e.id);
24
- return i ? /* @__PURE__ */ b(d, {
24
+ var O = ({ item: e, active: n, onSelect: r, newTabLabel: i }) => {
25
+ let { mini: a } = d(), o = e.detail !== void 0 || e.initials !== void 0, s = () => r?.(e.id);
26
+ if (a) return /* @__PURE__ */ C(f, {
25
27
  label: e.label,
26
28
  icon: e.icon,
27
29
  initials: e.initials,
28
- active: t,
30
+ active: n,
29
31
  badge: e.badge,
30
32
  badgeTone: e.badgeTone,
31
33
  badgeLabel: e.badgeLabel,
32
34
  disabled: e.disabled,
33
- ...!a && e.href !== void 0 ? {
35
+ ...e.render === void 0 ? !o && e.href !== void 0 ? {
34
36
  href: e.href,
35
37
  newTab: e.newTab,
36
- newTabLabel: r
37
- } : { onClick: o }
38
- }) : a ? /* @__PURE__ */ x("button", {
39
- type: "button",
40
- className: `kapi-ctxrec${t ? " kapi-ctxrec--on" : ""}`,
41
- "aria-current": t ? "page" : void 0,
42
- disabled: e.disabled,
43
- onClick: o,
44
- children: [
45
- e.initials !== void 0 && /* @__PURE__ */ b("span", {
38
+ newTabLabel: i
39
+ } : { onClick: s } : {
40
+ render: e.render,
41
+ newTab: e.newTab,
42
+ newTabLabel: i
43
+ }
44
+ });
45
+ if (o) {
46
+ let r = /* @__PURE__ */ w(S, { children: [
47
+ e.initials !== void 0 && /* @__PURE__ */ C("span", {
46
48
  className: "kapi-ctxrec__av kapi-ctxrec__av--tone",
47
49
  children: e.initials
48
50
  }),
49
- /* @__PURE__ */ x("span", {
51
+ /* @__PURE__ */ w("span", {
50
52
  className: "kapi-ctxrec__txt",
51
- children: [/* @__PURE__ */ b("span", {
53
+ children: [/* @__PURE__ */ C("span", {
52
54
  className: "kapi-ctxrec__name",
53
55
  children: e.label
54
- }), e.detail !== void 0 && /* @__PURE__ */ b("span", {
56
+ }), e.detail !== void 0 && /* @__PURE__ */ C("span", {
55
57
  className: "kapi-ctxrec__sub",
56
58
  children: e.detail
57
59
  })]
58
60
  }),
59
- /* @__PURE__ */ b(s, {
61
+ /* @__PURE__ */ C(c, {
60
62
  value: e.badge,
61
63
  tone: e.badgeTone,
62
64
  label: e.badgeLabel,
63
65
  max: 999
64
66
  }),
65
67
  e.trailing
66
- ]
67
- }) : e.href === void 0 ? /* @__PURE__ */ x("button", {
68
- type: "button",
69
- className: `kapi-ctxitem${t ? " kapi-ctxitem--on" : ""}`,
70
- "aria-current": t ? "page" : void 0,
68
+ ] }), i = `kapi-ctxrec${n ? " kapi-ctxrec--on" : ""}`;
69
+ return e.render === void 0 ? /* @__PURE__ */ C("button", {
70
+ type: "button",
71
+ className: i,
72
+ "aria-current": n ? "page" : void 0,
73
+ disabled: e.disabled,
74
+ onClick: s,
75
+ children: r
76
+ }) : t(e.render, { className: i }, {
77
+ "aria-current": n ? "page" : void 0,
78
+ "aria-disabled": e.disabled || void 0,
79
+ ...e.disabled ? { onClick: (e) => e.preventDefault() } : {},
80
+ children: r
81
+ }, (e) => /* @__PURE__ */ C("a", { ...e }));
82
+ }
83
+ return e.href !== void 0 || e.render !== void 0 ? u({
84
+ render: e.render,
85
+ href: e.href,
86
+ newTab: e.newTab,
71
87
  disabled: e.disabled,
72
- onClick: o,
73
- children: [
74
- /* @__PURE__ */ x("span", {
88
+ active: n,
89
+ className: `kapi-ctxitem kapi-ctxitem--link${n ? " kapi-ctxitem--on" : ""}`,
90
+ children: /* @__PURE__ */ w(S, { children: [
91
+ /* @__PURE__ */ w("span", {
75
92
  className: "kapi-ctxitem__main",
76
93
  children: [e.icon, e.label]
77
94
  }),
78
- /* @__PURE__ */ b(s, {
95
+ /* @__PURE__ */ C(c, {
79
96
  value: e.badge,
80
97
  tone: e.badgeTone,
81
98
  label: e.badgeLabel,
82
99
  max: 999
83
100
  }),
84
- e.trailing
85
- ]
86
- }) : /* @__PURE__ */ x("a", {
87
- className: `kapi-ctxitem kapi-ctxitem--link${t ? " kapi-ctxitem--on" : ""}`,
88
- href: e.disabled ? void 0 : e.href,
89
- rel: "noopener noreferrer",
90
- target: e.newTab ? "_blank" : void 0,
91
- "aria-current": t ? "page" : void 0,
92
- "aria-disabled": e.disabled || void 0,
101
+ e.trailing,
102
+ e.external && /* @__PURE__ */ C(D, {
103
+ className: "kapi-ctxitem__ext",
104
+ size: 14,
105
+ "aria-hidden": "true"
106
+ }),
107
+ e.newTab && /* @__PURE__ */ C("span", {
108
+ className: "kapi-ctxitem__sr",
109
+ children: i
110
+ })
111
+ ] })
112
+ }) : /* @__PURE__ */ w("button", {
113
+ type: "button",
114
+ className: `kapi-ctxitem${n ? " kapi-ctxitem--on" : ""}`,
115
+ "aria-current": n ? "page" : void 0,
116
+ disabled: e.disabled,
117
+ onClick: s,
93
118
  children: [
94
- /* @__PURE__ */ x("span", {
119
+ /* @__PURE__ */ w("span", {
95
120
  className: "kapi-ctxitem__main",
96
121
  children: [e.icon, e.label]
97
122
  }),
98
- /* @__PURE__ */ b(s, {
123
+ /* @__PURE__ */ C(c, {
99
124
  value: e.badge,
100
125
  tone: e.badgeTone,
101
126
  label: e.badgeLabel,
102
127
  max: 999
103
128
  }),
104
- e.trailing,
105
- e.external && /* @__PURE__ */ b(w, {
106
- className: "kapi-ctxitem__ext",
107
- size: 14,
108
- "aria-hidden": "true"
109
- }),
110
- e.newTab && /* @__PURE__ */ b("span", {
111
- className: "kapi-ctxitem__sr",
112
- children: r
113
- })
129
+ e.trailing
114
130
  ]
115
131
  });
116
- }, E = ({ sections: e, activeId: n, onSelect: r, search: i, hint: a, labels: s }) => {
117
- let l = t("link", o, s);
118
- return /* @__PURE__ */ x(y, { children: [
119
- i && /* @__PURE__ */ b(f, {
132
+ }, k = ({ sections: e, activeId: t, onSelect: n, search: i, hint: a, labels: o }) => {
133
+ let c = r("link", s, o);
134
+ return /* @__PURE__ */ w(S, { children: [
135
+ i && /* @__PURE__ */ C(p, {
120
136
  placeholder: i.placeholder,
121
137
  value: i.value,
122
138
  ...i["aria-label"] === void 0 ? {} : { "aria-label": i["aria-label"] },
123
139
  onChange: (e) => i.onChange?.(e.target.value)
124
140
  }),
125
- e.map((e, t) => /* @__PURE__ */ x("div", {
141
+ e.map((e, r) => /* @__PURE__ */ w("div", {
126
142
  className: "kapi-ctxsection",
127
143
  children: [
128
- t > 0 && /* @__PURE__ */ b("div", { className: "kapi-ctxdivider" }),
129
- e.label && /* @__PURE__ */ b("div", {
144
+ r > 0 && /* @__PURE__ */ C("div", { className: "kapi-ctxdivider" }),
145
+ e.label && /* @__PURE__ */ C("div", {
130
146
  className: "kapi-ct",
131
147
  children: e.label
132
148
  }),
133
- /* @__PURE__ */ b(c, {
134
- active: m(e.items, n),
135
- children: e.items.map((e) => /* @__PURE__ */ b(T, {
149
+ /* @__PURE__ */ C(l, {
150
+ active: v(e.items, t),
151
+ children: e.items.map((e) => /* @__PURE__ */ C(O, {
136
152
  item: e,
137
- active: e.id === n,
138
- onSelect: r,
139
- newTabLabel: l.newTab
153
+ active: e.id === t,
154
+ onSelect: n,
155
+ newTabLabel: c.newTab
140
156
  }, e.id))
141
157
  })
142
158
  ]
143
159
  }, e.id)),
144
- a && /* @__PURE__ */ b("div", {
160
+ a && /* @__PURE__ */ C("div", {
145
161
  className: "kapi-hint",
146
162
  children: a
147
163
  })
148
164
  ] });
149
- }, D = {
165
+ }, A = {
150
166
  resize: "Redimensionar panel",
151
167
  collapse: "Plegar panel",
152
168
  expand: "Desplegar panel",
153
169
  region: "Panel contextual"
154
- }, O = ({ title: o, actions: s, collapsed: c, defaultCollapsed: u, onCollapsedChange: d, collapseLabel: f, expandLabel: m, side: y = "left", collapsedMode: w = "hidden", resizable: T = !1, minWidth: O = 200, maxWidth: k = 420, "aria-label": ie, labels: A, className: j, style: M, id: N, ref: P, ...F }) => {
155
- let I = t("contextPanel", D, A), ae = f ?? I.collapse, L = m ?? I.expand, R = ie ?? I.region, [z, B] = n(c, u ?? !1, d), [V, H] = v(null), [oe, U] = v(!1), W = _(null), G = _(null), K = a(G, P), q = _(null), [J, Y] = v(null);
156
- h(() => {
157
- J && (z === J.next && q.current?.focus(), Y(null));
158
- }, [J, z]);
170
+ }, j = ({ title: t, actions: s, collapsed: c, defaultCollapsed: l, onCollapsedChange: u, collapseLabel: d, expandLabel: f, side: p = "left", collapsedMode: v = "hidden", resizable: S = !1, minWidth: D = 200, maxWidth: O = 420, "aria-label": j, labels: M, className: N, style: P, id: F, ref: I, ...L }) => {
171
+ let R = r("contextPanel", A, M), re = d ?? R.collapse, ie = f ?? R.expand, z = j ?? R.region, [B, ae] = i(c, l ?? !1, u), [V, H] = x(null), [oe, U] = x(!1), W = b(null), G = b(null), K = n(G, I), q = b(null), [J, Y] = x(null);
172
+ y(() => {
173
+ J && (B === J.next && q.current?.focus(), Y(null));
174
+ }, [J, B]);
159
175
  let X = (e) => {
160
- Y({ next: e }), B(e);
161
- }, Z = _(X);
162
- h(() => {
176
+ Y({ next: e }), ae(e);
177
+ }, Z = b(X);
178
+ y(() => {
163
179
  Z.current = X;
164
180
  });
165
- let se = g(() => ({
181
+ let se = ne(() => ({
166
182
  mini: !0,
167
183
  expand: () => Z.current(!1),
168
- tooltipSide: y === "right" ? "start" : "end"
169
- }), [y]), ce = y === "right" ? C : S, le = y === "right" ? S : C, Q = () => V ?? G.current?.offsetWidth ?? 258, ue = (e) => {
184
+ tooltipSide: p === "right" ? "start" : "end"
185
+ }), [p]), ce = p === "right" ? E : T, le = p === "right" ? T : E, Q = () => V ?? G.current?.offsetWidth ?? 258, ue = (e) => {
170
186
  e.button === 0 && (W.current = {
171
187
  startX: e.clientX,
172
188
  startWidth: Q()
173
189
  }, e.currentTarget.setPointerCapture(e.pointerId), U(!0), e.preventDefault());
174
190
  }, de = (e) => {
175
191
  let t = W.current;
176
- t && H(ne(i(y, r(e.currentTarget)), t.startWidth, t.startX, e.clientX, O, k));
192
+ t && H(g(o(p, a(e.currentTarget)), t.startWidth, t.startX, e.clientX, D, O));
177
193
  }, $ = (e) => {
178
194
  W.current = null, e.currentTarget.hasPointerCapture(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId), U(!1);
179
195
  }, fe = (e) => {
180
- let t = re(i(y, r(e.currentTarget)), Q(), e.key, O, k);
196
+ let t = _(o(p, a(e.currentTarget)), Q(), e.key, D, O);
181
197
  t !== null && (e.preventDefault(), H(t));
182
198
  };
183
- if (z) {
184
- let t = w === "mini";
185
- return /* @__PURE__ */ x("aside", {
186
- ref: P,
187
- id: N,
188
- className: e(p({
189
- side: y,
199
+ if (B) {
200
+ let t = v === "mini";
201
+ return /* @__PURE__ */ w("aside", {
202
+ ref: I,
203
+ id: F,
204
+ className: e(h({
205
+ side: p,
190
206
  collapsed: !0
191
- }), t && "is-mini kapi-navmini", j),
192
- style: M,
193
- "aria-label": R,
194
- children: [/* @__PURE__ */ b("button", {
207
+ }), t && "is-mini kapi-navmini", N),
208
+ style: P,
209
+ "aria-label": z,
210
+ children: [/* @__PURE__ */ C("button", {
195
211
  ref: q,
196
212
  type: "button",
197
213
  className: "kapi-paneltoggle",
198
214
  onClick: () => X(!1),
199
- "aria-label": L,
200
- children: /* @__PURE__ */ b(le, {
215
+ "aria-label": ie,
216
+ children: /* @__PURE__ */ C(le, {
201
217
  className: "kapi-flip-rtl",
202
218
  size: 16,
203
219
  strokeWidth: 2,
204
220
  "aria-hidden": "true"
205
221
  })
206
- }), t && /* @__PURE__ */ b(l.Provider, {
222
+ }), t && /* @__PURE__ */ C(ee.Provider, {
207
223
  value: se,
208
- children: /* @__PURE__ */ b(E, {
209
- ...F,
210
- labels: A
224
+ children: /* @__PURE__ */ C(k, {
225
+ ...L,
226
+ labels: M
211
227
  })
212
228
  })]
213
229
  });
214
230
  }
215
- return /* @__PURE__ */ x("aside", {
231
+ return /* @__PURE__ */ w("aside", {
216
232
  ref: K,
217
- id: N,
218
- className: e(p({
219
- side: y,
233
+ id: F,
234
+ className: e(h({
235
+ side: p,
220
236
  resizing: oe
221
- }), j),
222
- "aria-label": R,
223
- "data-resizable": T || void 0,
224
- style: T && V !== null ? {
225
- ...M,
237
+ }), N),
238
+ "aria-label": z,
239
+ "data-resizable": S || void 0,
240
+ style: S && V !== null ? {
241
+ ...P,
226
242
  width: V
227
- } : M,
243
+ } : P,
228
244
  children: [
229
- T && /* @__PURE__ */ b("div", {
245
+ S && /* @__PURE__ */ C("div", {
230
246
  className: "kapi-ctxpanel__resize",
231
247
  role: "separator",
232
248
  "aria-orientation": "vertical",
233
- "aria-label": I.resize,
234
- "aria-valuemin": O,
235
- "aria-valuemax": k,
236
- "aria-valuenow": te(V ?? 258, O, k),
249
+ "aria-label": R.resize,
250
+ "aria-valuemin": D,
251
+ "aria-valuemax": O,
252
+ "aria-valuenow": te(V ?? 258, D, O),
237
253
  tabIndex: 0,
238
254
  onPointerDown: ue,
239
255
  onPointerMove: de,
@@ -241,21 +257,21 @@ var T = ({ item: e, active: t, onSelect: n, newTabLabel: r }) => {
241
257
  onPointerCancel: $,
242
258
  onKeyDown: fe
243
259
  }),
244
- /* @__PURE__ */ x("div", {
260
+ /* @__PURE__ */ w("div", {
245
261
  className: "kapi-ctxpanel__head",
246
- children: [/* @__PURE__ */ b("span", { children: o }), /* @__PURE__ */ x("div", {
262
+ children: [/* @__PURE__ */ C("span", { children: t }), /* @__PURE__ */ w("div", {
247
263
  className: "kapi-ctxpanel__actions",
248
- children: [s, ee({
264
+ children: [s, m({
249
265
  collapsed: c,
250
- defaultCollapsed: u,
251
- onCollapsedChange: d
252
- }) && /* @__PURE__ */ b("button", {
266
+ defaultCollapsed: l,
267
+ onCollapsedChange: u
268
+ }) && /* @__PURE__ */ C("button", {
253
269
  ref: q,
254
270
  type: "button",
255
271
  className: "kapi-paneltoggle",
256
272
  onClick: () => X(!0),
257
- "aria-label": ae,
258
- children: /* @__PURE__ */ b(ce, {
273
+ "aria-label": re,
274
+ children: /* @__PURE__ */ C(ce, {
259
275
  className: "kapi-flip-rtl",
260
276
  size: 16,
261
277
  strokeWidth: 2,
@@ -264,12 +280,12 @@ var T = ({ item: e, active: t, onSelect: n, newTabLabel: r }) => {
264
280
  })]
265
281
  })]
266
282
  }),
267
- /* @__PURE__ */ b(E, {
268
- ...F,
269
- labels: A
283
+ /* @__PURE__ */ C(k, {
284
+ ...L,
285
+ labels: M
270
286
  })
271
287
  ]
272
288
  });
273
289
  };
274
290
  //#endregion
275
- export { D as DEFAULT_CONTEXT_PANEL_LABELS, O as KapiContextPanel, E as KapiContextSections };
291
+ export { A as DEFAULT_CONTEXT_PANEL_LABELS, j as KapiContextPanel, k as KapiContextSections };
@@ -1,11 +1,14 @@
1
1
  import type { CSSProperties, Ref } from "react";
2
- import type { KapiTone } from "../tone.js";
2
+ import type { KapiToneName } from "../tone.js";
3
3
  import { type KapiNavBadgeValue } from "./navBadgeLogic.js";
4
4
  export type KapiNavBadgeProps = {
5
5
  /** Contador o `"dot"` (aviso sin número). Sin valor o 0 no dibuja nada. */
6
6
  value?: KapiNavBadgeValue | undefined;
7
- /** Color por rol, igual que `KapiBadge` (`danger` para vencidos, `warning` para por vencer…). @default "primary" */
8
- tone?: KapiTone | undefined;
7
+ /**
8
+ * Color por rol, igual que `KapiBadge` (`danger` para vencidos, `warning` para por vencer…), o
9
+ * una familia propia de la app (`toneFamilies`). @default "primary"
10
+ */
11
+ tone?: KapiToneName | undefined;
9
12
  /** Texto accesible (p. ej. "3 trámites vencidos"); sin él se lee el número. */
10
13
  label?: string | undefined;
11
14
  /** `inline`: al final de un ítem de lista. `corner`: burbuja sobre la esquina del ícono (rail). @default "inline" */
@@ -1,36 +1,40 @@
1
1
  "use client";
2
2
  import "#kapi-css/components/navigation/KapiNavBadge.css";
3
- import { joinClasses as e } from "../rootProps.js";
4
- import { badgeClasses as t } from "../display/KapiBadge.js";
5
- import { navBadgeA11yText as n, navBadgeView as r } from "./navBadgeLogic.js";
3
+ import { useToneLook as e } from "../../hooks/useToneFamilies.js";
4
+ import { joinClasses as t } from "../rootProps.js";
5
+ import { badgeClasses as n } from "../display/KapiBadge.js";
6
+ import { navBadgeA11yText as r, navBadgeView as i } from "./navBadgeLogic.js";
6
7
  /* empty css */
7
- import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
8
+ import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
8
9
  //#region src/components/navigation/KapiNavBadge.tsx
9
- var s = ({ value: s, tone: c = "primary", label: l, placement: u = "inline", max: d, showZero: f, announce: p = !0, className: m, style: h, ref: g }) => {
10
- let _ = r(s, {
11
- max: d,
12
- showZero: f
10
+ var c = ({ value: c, tone: l = "primary", label: u, placement: d = "inline", max: f, showZero: p, announce: m = !0, className: h, style: g, ref: _ }) => {
11
+ let v = e("KapiNavBadge", l), y = i(c, {
12
+ max: f,
13
+ showZero: p
13
14
  });
14
- if (_ === null) return null;
15
- let v = p ? n(s, l, { showZero: f }) : null, y = _.kind === "dot";
16
- return /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ a("span", {
17
- ref: g,
18
- style: h,
19
- className: e(t({
20
- tone: c,
21
- variant: u === "corner" || y ? "solid" : "subtle",
15
+ if (y === null) return null;
16
+ let b = m ? r(c, u, { showZero: p }) : null, x = y.kind === "dot";
17
+ return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("span", {
18
+ ref: _,
19
+ style: v.style ? {
20
+ ...v.style,
21
+ ...g
22
+ } : g,
23
+ className: t(n({
24
+ tone: v.tone,
25
+ variant: d === "corner" || x ? "solid" : "subtle",
22
26
  size: "sm"
23
- }), "kapi-navbadge", `kapi-navbadge--${u}`, y && "kapi-navbadge--dot", m),
27
+ }), "kapi-navbadge", `kapi-navbadge--${d}`, x && "kapi-navbadge--dot", h),
24
28
  "aria-hidden": "true",
25
- children: y ? null : _.text
26
- }), v !== null && /* @__PURE__ */ o(i, { children: [
29
+ children: x ? null : y.text
30
+ }), b !== null && /* @__PURE__ */ s(a, { children: [
27
31
  " ",
28
- /* @__PURE__ */ a("span", {
32
+ /* @__PURE__ */ o("span", {
29
33
  className: "kapi-navbadge__sr",
30
- children: v
34
+ children: b
31
35
  }),
32
36
  " "
33
37
  ] })] });
34
38
  };
35
39
  //#endregion
36
- export { s as KapiNavBadge };
40
+ export { c as KapiNavBadge };