@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,11 +1,15 @@
1
+ import { isFamilyTone as e } from "../tone.js";
1
2
  //#region src/components/layout/accessCardLogic.ts
2
- var e = (e) => e ? "external" : "chevron", t = (e) => {
3
+ var t = (e) => e ? "external" : "chevron", n = (e) => {
3
4
  let t = {};
4
5
  return e.newTab && (t.target = "_blank"), (e.newTab || e.external) && (t.rel = "noopener noreferrer"), t;
5
- }, n = (e = {}) => [
6
- "kapi-accesscard",
7
- `kapi-accesscard--${e.tone ?? "primary"}`,
8
- e.className
9
- ].filter(Boolean).join(" "), r = (e) => e === "Enter" || e === " ";
6
+ }, r = (t = {}) => {
7
+ let n = t.tone ?? "primary";
8
+ return [
9
+ "kapi-accesscard",
10
+ `kapi-accesscard--${e(n) ? "family" : n}`,
11
+ t.className
12
+ ].filter(Boolean).join(" ");
13
+ }, i = (e) => e === "Enter" || e === " ";
10
14
  //#endregion
11
- export { e as accessCardAffordance, n as accessCardClasses, r as isActivationKey, t as linkAttrs };
15
+ export { t as accessCardAffordance, r as accessCardClasses, i as isActivationKey, n as linkAttrs };
@@ -1,5 +1,7 @@
1
1
  export { KapiShell } from "./KapiShell.js";
2
2
  export type { KapiShellClassNames, KapiShellProps } from "./KapiShell.js";
3
+ export { KapiCollapse } from "./KapiCollapse.js";
4
+ export type { KapiCollapseProps } from "./KapiCollapse.js";
3
5
  export { KapiRoot } from "./KapiRoot.js";
4
6
  export type { KapiRootProps } from "./KapiRoot.js";
5
7
  export { KapiThemeScript } from "./KapiThemeScript.js";
@@ -18,7 +18,12 @@ import type { KapiSearchChipLabels } from "../inputs/KapiSearchChip.js";
18
18
  import type { KapiSelectLabels } from "../inputs/KapiSelect.js";
19
19
  import type { KapiChecklistLabels } from "../inputs/KapiChecklist.js";
20
20
  import type { KapiNumberStepperLabels } from "../inputs/KapiNumberStepper.js";
21
+ import type { KapiPinInputLabels } from "../inputs/KapiPinInput.js";
22
+ import type { KapiCodeBlockLabels } from "../display/KapiCodeBlock.js";
23
+ import type { KapiDiffLabels } from "../display/KapiDiff.js";
24
+ import type { KapiTocLabels } from "../navigation/KapiToc.js";
21
25
  import type { KapiFileUploadLabels } from "../inputs/KapiFileUpload.js";
26
+ import type { KapiCopyButtonLabels } from "../inputs/KapiCopyButton.js";
22
27
  import type { KapiInputLabels } from "../inputs/KapiInput.js";
23
28
  import type { KapiTagInputLabels } from "../inputs/KapiTagInput.js";
24
29
  import type { KapiContextSlotLabels } from "../layout/KapiContextSlot.js";
@@ -100,14 +105,18 @@ export interface KapiLabelRegistry {
100
105
  fileViewer: KapiFileViewerLabels;
101
106
  filterChips: KapiFilterChipsLabels;
102
107
  heatmap: KapiHeatmapLabels;
108
+ copyButton: KapiCopyButtonLabels;
103
109
  eventCalendar: KapiEventCalendarLabels;
104
110
  input: KapiInputLabels;
111
+ codeBlock: KapiCodeBlockLabels;
112
+ diff: KapiDiffLabels;
105
113
  link: KapiLinkLabels;
106
114
  loading: KapiLoadingLabels;
107
115
  messageBubble: KapiMessageBubbleLabels;
108
116
  modal: KapiModalLabels;
109
117
  notificationBell: KapiNotificationBellLabels;
110
118
  numberStepper: KapiNumberStepperLabels;
119
+ pinInput: KapiPinInputLabels;
111
120
  offcanvas: KapiOffcanvasLabels;
112
121
  offlineBanner: KapiOfflineBannerLabels;
113
122
  pagination: KapiPaginationLabels;
@@ -117,6 +126,7 @@ export interface KapiLabelRegistry {
117
126
  scrollArea: KapiScrollAreaLabels;
118
127
  searchChip: KapiSearchChipLabels;
119
128
  select: KapiSelectLabels;
129
+ toc: KapiTocLabels;
120
130
  shapeSheet: KapiShapeSheetLabels;
121
131
  sparkline: KapiSparklineLabels;
122
132
  splitModal: KapiSplitModalLabels;
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import "#kapi-css/components/navigation/navigation.css";
3
3
  import { joinClasses as e } from "../rootProps.js";
4
- import { enabledIndexes as t, navKeyOf as n, nextEnabledIndex as r } from "../overlays/menuKeyboardLogic.js";
5
- import { useControllableState as i } from "../../hooks/useControllableState.js";
4
+ import { useControllableState as t } from "../../hooks/useControllableState.js";
5
+ import { enabledIndexes as n, navKeyOf as r, nextEnabledIndex as i } from "../overlays/menuKeyboardLogic.js";
6
6
  /* empty css */
7
7
  import { normalizeOpenIds as a, toggleOpenId as o } from "./accordionLogic.js";
8
8
  import { useId as s } from "react";
@@ -11,17 +11,17 @@ import { ChevronDown as u } from "lucide-react";
11
11
  //#region src/components/navigation/KapiAccordion.tsx
12
12
  var d = ":scope > .kapi-accordion__item > .kapi-accordion__heading > .kapi-accordion__trigger:not(:disabled)", f = (e) => {
13
13
  if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) return;
14
- let i = e.currentTarget.closest(".kapi-accordion");
15
- if (!i) return;
16
- let a = Array.from(i.querySelectorAll(d)), o = a.indexOf(e.currentTarget), s = n(e.key, "vertical");
17
- !s || o < 0 || (e.preventDefault(), a[r(o, s, t(a.length))]?.focus());
14
+ let t = e.currentTarget.closest(".kapi-accordion");
15
+ if (!t) return;
16
+ let a = Array.from(t.querySelectorAll(d)), o = a.indexOf(e.currentTarget), s = r(e.key, "vertical");
17
+ !s || o < 0 || (e.preventDefault(), a[i(o, s, n(a.length))]?.focus());
18
18
  };
19
- function p({ items: t, single: n = !0, openIds: r, defaultOpenIds: d = [], onOpenIdsChange: p, className: m, ...h }) {
20
- let g = s(), [_, v] = i(r, () => a(d, n), p), y = a(_, n), b = (e) => v(o(y, e, n));
19
+ function p({ items: n, single: r = !0, openIds: i, defaultOpenIds: d = [], onOpenIdsChange: p, className: m, ...h }) {
20
+ let g = s(), [_, v] = t(i, () => a(d, r), p), y = a(_, r), b = (e) => v(o(y, e, r));
21
21
  return /* @__PURE__ */ c("div", {
22
22
  ...h,
23
23
  className: e("kapi-accordion", m),
24
- children: t.map((e) => {
24
+ children: n.map((e) => {
25
25
  let t = y.includes(e.id), n = `${g}-b-${e.id}`, r = `${g}-p-${e.id}`;
26
26
  return /* @__PURE__ */ l("div", {
27
27
  className: t ? "kapi-accordion__item kapi-accordion__item--open" : "kapi-accordion__item",
@@ -2,10 +2,10 @@
2
2
  import "#kapi-css/components/navigation/navigation.css";
3
3
  import { joinClasses as e } from "../rootProps.js";
4
4
  import { renderSlot as t } from "../renderSlot.js";
5
- import { useLabels as n } from "../locale/KapiLocaleProvider.js";
6
- import { useControllableState as r } from "../../hooks/useControllableState.js";
7
- import { directionOf as i, physicalSide as a } from "../../hooks/directionLogic.js";
8
- import { useMergedRefs as o } from "../../hooks/mergeRefs.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
9
  import { DEFAULT_LINK_LABELS as s } from "../locale/linkLabels.js";
10
10
  import "./navBadgeLogic.js";
11
11
  import { KapiNavBadge as c } from "./KapiNavBadge.js";
@@ -129,8 +129,8 @@ var O = ({ item: e, active: n, onSelect: r, newTabLabel: i }) => {
129
129
  e.trailing
130
130
  ]
131
131
  });
132
- }, k = ({ sections: e, activeId: t, onSelect: r, search: i, hint: a, labels: o }) => {
133
- let c = n("link", s, o);
132
+ }, k = ({ sections: e, activeId: t, onSelect: n, search: i, hint: a, labels: o }) => {
133
+ let c = r("link", s, o);
134
134
  return /* @__PURE__ */ w(S, { children: [
135
135
  i && /* @__PURE__ */ C(p, {
136
136
  placeholder: i.placeholder,
@@ -138,10 +138,10 @@ var O = ({ item: e, active: n, onSelect: r, newTabLabel: i }) => {
138
138
  ...i["aria-label"] === void 0 ? {} : { "aria-label": i["aria-label"] },
139
139
  onChange: (e) => i.onChange?.(e.target.value)
140
140
  }),
141
- e.map((e, n) => /* @__PURE__ */ w("div", {
141
+ e.map((e, r) => /* @__PURE__ */ w("div", {
142
142
  className: "kapi-ctxsection",
143
143
  children: [
144
- n > 0 && /* @__PURE__ */ C("div", { className: "kapi-ctxdivider" }),
144
+ r > 0 && /* @__PURE__ */ C("div", { className: "kapi-ctxdivider" }),
145
145
  e.label && /* @__PURE__ */ C("div", {
146
146
  className: "kapi-ct",
147
147
  children: e.label
@@ -151,7 +151,7 @@ var O = ({ item: e, active: n, onSelect: r, newTabLabel: i }) => {
151
151
  children: e.items.map((e) => /* @__PURE__ */ C(O, {
152
152
  item: e,
153
153
  active: e.id === t,
154
- onSelect: r,
154
+ onSelect: n,
155
155
  newTabLabel: c.newTab
156
156
  }, e.id))
157
157
  })
@@ -168,7 +168,7 @@ var O = ({ item: e, active: n, onSelect: r, newTabLabel: i }) => {
168
168
  expand: "Desplegar panel",
169
169
  region: "Panel contextual"
170
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 = n("contextPanel", A, M), re = d ?? R.collapse, ie = f ?? R.expand, z = j ?? R.region, [B, ae] = r(c, l ?? !1, u), [V, H] = x(null), [oe, U] = x(!1), W = b(null), G = b(null), K = o(G, I), q = b(null), [J, Y] = x(null);
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
172
  y(() => {
173
173
  J && (B === J.next && q.current?.focus(), Y(null));
174
174
  }, [J, B]);
@@ -189,11 +189,11 @@ var O = ({ item: e, active: n, onSelect: r, newTabLabel: i }) => {
189
189
  }, e.currentTarget.setPointerCapture(e.pointerId), U(!0), e.preventDefault());
190
190
  }, de = (e) => {
191
191
  let t = W.current;
192
- t && H(g(a(p, i(e.currentTarget)), t.startWidth, t.startX, e.clientX, D, O));
192
+ t && H(g(o(p, a(e.currentTarget)), t.startWidth, t.startX, e.clientX, D, O));
193
193
  }, $ = (e) => {
194
194
  W.current = null, e.currentTarget.hasPointerCapture(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId), U(!1);
195
195
  }, fe = (e) => {
196
- let t = _(a(p, i(e.currentTarget)), Q(), e.key, D, O);
196
+ let t = _(o(p, a(e.currentTarget)), Q(), e.key, D, O);
197
197
  t !== null && (e.preventDefault(), H(t));
198
198
  };
199
199
  if (B) {
@@ -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 };
@@ -2,11 +2,11 @@
2
2
  import "#kapi-css/components/navigation/navigation.css";
3
3
  import { joinClasses as e } from "../rootProps.js";
4
4
  import { renderSlot as t } from "../renderSlot.js";
5
- import { useKapiFormatLocale as n } from "../locale/KapiLocaleProvider.js";
6
- import { useControllableState as r } from "../../hooks/useControllableState.js";
7
- import { logicalKeyOf as i } from "../../hooks/directionLogic.js";
8
- import { useDuplicateValueWarning as a, useMutedControlWarning as o } from "../inputs/misuseWarnings.js";
9
- import { useMergedRefs as s } from "../../hooks/mergeRefs.js";
5
+ import { useMergedRefs as n } from "../../hooks/mergeRefs.js";
6
+ import { useKapiFormatLocale as r } from "../locale/KapiLocaleProvider.js";
7
+ import { useControllableState as i } from "../../hooks/useControllableState.js";
8
+ import { logicalKeyOf as a } from "../../hooks/directionLogic.js";
9
+ import { useDuplicateValueWarning as o, useMutedControlWarning as s } from "../inputs/misuseWarnings.js";
10
10
  import { useSlidingIndicator as c } from "../../hooks/useSlidingIndicator.js";
11
11
  import { formatCount as l } from "../../hooks/numberFormatLogic.js";
12
12
  import { useScrollEdges as u } from "../../hooks/useScrollEdges.js";
@@ -17,8 +17,8 @@ import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
17
17
  //#region src/components/navigation/KapiTabs.tsx
18
18
  var w = [];
19
19
  function T({ items: T, tabs: E, value: D, defaultValue: O, onChange: k, className: A, idBase: j, disabled: M = !1, size: N = "md", onKeyDown: P, ref: F, ...I }) {
20
- let L = n(), R = T ?? E ?? w, z = _(), B = j ?? z, V = b({}), [H, U] = r(D, () => O ?? R[0]?.id, k), W = y(() => R.map((e) => e.id), [R]);
21
- a("KapiTabs", W), o("KapiTabs", {
20
+ let L = r(), R = T ?? E ?? w, z = _(), B = j ?? z, V = b({}), [H, U] = i(D, () => O ?? R[0]?.id, k), W = y(() => R.map((e) => e.id), [R]);
21
+ o("KapiTabs", W), s("KapiTabs", {
22
22
  controlled: D !== void 0,
23
23
  hasOnChange: !!k,
24
24
  disabled: M
@@ -29,7 +29,7 @@ function T({ items: T, tabs: E, value: D, defaultValue: O, onChange: k, classNam
29
29
  findActive: (e) => e.querySelector("[role=\"tab\"][aria-selected=\"true\"]")
30
30
  }), { ref: q, edges: J, reveal: Y } = u({ axis: "x" }), X = g((e) => {
31
31
  G.current = e, q.current = e;
32
- }, [G, q]), Z = s(X, F), Q = b(!1);
32
+ }, [G, q]), Z = n(X, F), Q = b(!1);
33
33
  v(() => {
34
34
  let e = G.current?.querySelector("[role=\"tab\"][aria-selected=\"true\"]");
35
35
  e && Y(e, { instant: !Q.current }), Q.current = !0;
@@ -40,7 +40,7 @@ function T({ items: T, tabs: E, value: D, defaultValue: O, onChange: k, classNam
40
40
  ]);
41
41
  let $ = (e) => M || R.some((t) => t.id === e && t.disabled === !0), ee = H !== void 0 && R.some((e) => e.id === H) && !$(H) ? H : R.find((e) => !$(e.id))?.id, te = (e) => {
42
42
  if (P?.(e), e.defaultPrevented || H === void 0) return;
43
- let t = d(R.map((e) => e.id), H, i(e), $);
43
+ let t = d(R.map((e) => e.id), H, a(e), $);
44
44
  t !== void 0 && (e.preventDefault(), U(t), V.current[t]?.focus());
45
45
  };
46
46
  return /* @__PURE__ */ C("div", {
@@ -0,0 +1,48 @@
1
+ import type { HTMLAttributes, Ref } from "react";
2
+ import type { KapiLabelsOverride } from "../labelsLogic.js";
3
+ import type { KapiClassNames } from "../slotCatalog.js";
4
+ import { type KapiTocItem } from "./tocLogic.js";
5
+ export type { KapiTocItem, KapiTocPosition } from "./tocLogic.js";
6
+ /** Textos de `KapiToc`; se pisan con `labels` o el `KapiLocaleProvider`. */
7
+ export type KapiTocLabels = {
8
+ /** Nombre accesible de la navegación. */
9
+ region: string;
10
+ };
11
+ export declare const DEFAULT_TOC_LABELS: KapiTocLabels;
12
+ /** Atributos nativos (`id`, `style`, `data-*`…) van al `<nav>` raíz. */
13
+ export type KapiTocProps = Omit<HTMLAttributes<HTMLElement>, "children" | "onChange"> & {
14
+ /** Ref al `<nav>` raíz. */
15
+ ref?: Ref<HTMLElement> | undefined;
16
+ /** Los títulos, en el orden en que aparecen en la página. */
17
+ items: readonly KapiTocItem[];
18
+ /** Id del título activo. Con esto manda la app (el router, normalmente) y el scroll no decide. */
19
+ activeId?: string | null | undefined;
20
+ /** Avisa cuándo cambia el título activo, lo decida el scroll o un clic. */
21
+ onActiveIdChange?: ((id: string) => void) | undefined;
22
+ /** Alto del header pegajoso, en px: el título se activa ese tanto antes. @default 0 */
23
+ offset?: number | undefined;
24
+ /** Nivel máximo de encabezado que entra (2 = sólo `<h2>`). @default 3 */
25
+ maxLevel?: number | undefined;
26
+ /** Título visible sobre la lista. Sin esto, el nombre va sólo al lector de pantalla. */
27
+ heading?: string | undefined;
28
+ /** Textos propios; pisan los del `KapiLocaleProvider` y los defaults. */
29
+ labels?: KapiLabelsOverride<KapiTocLabels> | undefined;
30
+ /** Clases por parte (`root`, `heading`, `list`, `item`, `link`). Se suman a las propias. */
31
+ classNames?: KapiClassNames<"toc"> | undefined;
32
+ };
33
+ /**
34
+ * Índice de la página con seguimiento del scroll (scrollspy).
35
+ *
36
+ * **Un solo juego de listeners, no un observer por título.** Se mide con `onViewportChange`, que
37
+ * agrupa a todos los suscriptores de la ventana en un recálculo por frame; con un
38
+ * `IntersectionObserver` por ítem, una página de cuarenta títulos crea cuarenta observers, y aun
39
+ * así hay que resolver a mano cuál gana cuando dos entran en el mismo frame.
40
+ *
41
+ * **La decisión de cuál está activo es pura** (`activeTocId`) y ahí viven los tres bordes que se
42
+ * sienten rotos cuando faltan: arriba de todo gana el primero, al fondo gana el último aunque no
43
+ * haya llegado al tope, y un scroll exacto sobre un título lo marca a él.
44
+ *
45
+ * Pasando `activeId` el componente queda controlado y el scroll deja de decidir: es lo que hace
46
+ * falta cuando el id activo lo manda el router.
47
+ */
48
+ export declare function KapiToc({ items, activeId, onActiveIdChange, offset, maxLevel, heading, labels, classNames, className, ref, ...rest }: KapiTocProps): import("react").JSX.Element | null;
@@ -0,0 +1,66 @@
1
+ "use client";
2
+ import "#kapi-css/components/navigation/KapiToc.css";
3
+ import { useMergedRefs as e } from "../../hooks/mergeRefs.js";
4
+ import { useLabels as t } from "../locale/KapiLocaleProvider.js";
5
+ import { docOf as n, winOf as r } from "../../hooks/ownerDocument.js";
6
+ import { useControllableState as i } from "../../hooks/useControllableState.js";
7
+ import { onViewportChange as a } from "../../hooks/rafThrottle.js";
8
+ import { slot as o } from "../slotsLogic.js";
9
+ import { TOC_SLOTS as s } from "./tocSlots.js";
10
+ import { activeTocId as c, isAtBottom as l, visibleTocItems as u } from "./tocLogic.js";
11
+ /* empty css */
12
+ import { useCallback as d, useEffect as f, useRef as p, useState as m } from "react";
13
+ import { jsx as h, jsxs as g } from "react/jsx-runtime";
14
+ //#region src/components/navigation/KapiToc.tsx
15
+ var _ = { region: "En esta página" };
16
+ function v({ items: v, activeId: y, onActiveIdChange: b, offset: x = 0, maxLevel: S = 3, heading: C, labels: w, classNames: T, className: E, ref: D, ...O }) {
17
+ let k = t("toc", _, w), A = u(v, S), j = p(null), M = e(D, j), [N, P] = m(null), [F, I] = i(y, null, b), L = y === void 0 ? N ?? A[0]?.id ?? null : F, R = A.map((e) => e.id).join("\0"), z = d(() => {
18
+ let e = n(j.current), t = r(j.current);
19
+ if (!e || !t) return;
20
+ let i = R.split("\0").filter(Boolean).map((n) => {
21
+ let r = e.getElementById(n);
22
+ return r ? {
23
+ id: n,
24
+ top: r.getBoundingClientRect().top + t.scrollY
25
+ } : null;
26
+ }).filter((e) => e !== null), a = l(t.scrollY, t.innerHeight, e.documentElement.scrollHeight);
27
+ P(c(i, t.scrollY, x, a));
28
+ }, [R, x]);
29
+ f(() => (z(), a(z, { target: r(j.current) ?? void 0 })), [z]);
30
+ let B = p(null);
31
+ f(() => {
32
+ y === void 0 && L !== null && B.current !== L && (B.current = L, b?.(L));
33
+ }, [
34
+ L,
35
+ y,
36
+ b
37
+ ]);
38
+ let V = (e, t) => {
39
+ e.defaultPrevented || (y === void 0 ? P(t) : I(t));
40
+ };
41
+ return A.length === 0 ? null : /* @__PURE__ */ g("nav", {
42
+ ...O,
43
+ ref: M,
44
+ ...o(s, "root", T, E),
45
+ "aria-label": C ?? k.region,
46
+ children: [C !== void 0 && /* @__PURE__ */ h("p", {
47
+ ...o(s, "heading", T),
48
+ children: C
49
+ }), /* @__PURE__ */ h("ol", {
50
+ ...o(s, "list", T),
51
+ children: A.map((e) => /* @__PURE__ */ h("li", {
52
+ ...o(s, "item", T),
53
+ "data-level": e.level ?? 2,
54
+ children: /* @__PURE__ */ h("a", {
55
+ href: `#${e.id}`,
56
+ ...o(s, "link", T, L === e.id && "is-on"),
57
+ "aria-current": L === e.id ? "location" : void 0,
58
+ onClick: (t) => V(t, e.id),
59
+ children: e.label
60
+ })
61
+ }, e.id))
62
+ })]
63
+ });
64
+ }
65
+ //#endregion
66
+ export { _ as DEFAULT_TOC_LABELS, v as KapiToc };
@@ -1,11 +1,11 @@
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 { isTypeaheadKey as n } from "../overlays/menuKeyboardLogic.js";
4
+ import { useMergedRefs as t } from "../../hooks/mergeRefs.js";
5
+ import { useLabels as n } from "../locale/KapiLocaleProvider.js";
6
6
  import { useControllableState as r } from "../../hooks/useControllableState.js";
7
- import { logicalKeyOf as i } from "../../hooks/directionLogic.js";
8
- import { useMergedRefs as a } from "../../hooks/mergeRefs.js";
7
+ import { isTypeaheadKey as i } from "../overlays/menuKeyboardLogic.js";
8
+ import { logicalKeyOf as a } from "../../hooks/directionLogic.js";
9
9
  import { useTypeahead as o } from "../../hooks/useTypeahead.js";
10
10
  import { useVirtualList as s } from "../../hooks/useVirtualList.js";
11
11
  /* empty css */
@@ -16,7 +16,7 @@ import { ChevronRight as _ } from "lucide-react";
16
16
  //#region src/components/navigation/KapiTree.tsx
17
17
  var v = { loading: "Cargando…" }, se = 37, y = 400;
18
18
  function b({ nodes: b, expandedIds: ce, defaultExpandedIds: le, onExpandedIdsChange: x, expanded: S, defaultExpanded: C, onExpandedChange: ue, onExpand: de, selectedIds: fe, defaultSelectedIds: pe, onSelectedIdsChange: me, selected: he, defaultSelected: ge, onSelectedChange: _e, multiple: w = !1, renderLabel: T, labels: ve, virtual: E = !1, maxHeight: D = y, className: O, style: k, ref: A, onKeyDown: j, onFocus: M, ...N }) {
19
- let P = t("tree", v, ve), F = ie(), [I, ye] = r(ce ?? S, () => le ?? C ?? [], x ?? ue), [L, be] = r(fe ?? he, () => pe ?? ge ?? []), xe = me ?? _e, [Se, R] = oe(null), z = p(/* @__PURE__ */ new Map()), Ce = o(500), B = f(() => l(b, I), [b, I]), V = ne(b, B, Se, L), H = f(() => new Map(B.map((e, t) => [e.node.id, {
19
+ let P = n("tree", v, ve), F = ie(), [I, ye] = r(ce ?? S, () => le ?? C ?? [], x ?? ue), [L, be] = r(fe ?? he, () => pe ?? ge ?? []), xe = me ?? _e, [Se, R] = oe(null), z = p(/* @__PURE__ */ new Map()), Ce = o(500), B = f(() => l(b, I), [b, I]), V = ne(b, B, Se, L), H = f(() => new Map(B.map((e, t) => [e.node.id, {
20
20
  ...e,
21
21
  node: e.node,
22
22
  index: t
@@ -32,7 +32,7 @@ function b({ nodes: b, expandedIds: ce, defaultExpandedIds: le, onExpandedIdsCha
32
32
  if (e.disabled) return;
33
33
  let t = re(L, e.id, w);
34
34
  be(t), xe?.(t, e);
35
- }, J = p(null), Te = a(A, J), Ee = f(() => E ? B.map((e) => e.node.id) : void 0, [E, B]), Y = s({
35
+ }, J = p(null), Te = t(A, J), Ee = f(() => E ? B.map((e) => e.node.id) : void 0, [E, B]), Y = s({
36
36
  enabled: E,
37
37
  count: B.length,
38
38
  scrollRef: J,
@@ -57,12 +57,12 @@ function b({ nodes: b, expandedIds: ce, defaultExpandedIds: le, onExpandedIdsCha
57
57
  if (j?.(e), e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey) return;
58
58
  let t = V;
59
59
  if (t === null) return;
60
- let r = e.target.getAttribute("role") === "treeitem", a = e.key === "Enter" || e.key === " ";
61
- if (!r && (a || n(e.key))) return;
60
+ let n = e.target.getAttribute("role") === "treeitem", r = e.key === "Enter" || e.key === " ";
61
+ if (!n && (r || i(e.key))) return;
62
62
  if (c.has(e.key)) {
63
63
  e.preventDefault();
64
64
  let n = d({
65
- key: i(e),
65
+ key: a(e),
66
66
  nodes: b,
67
67
  visible: B,
68
68
  focusId: t,
@@ -96,7 +96,7 @@ function b({ nodes: b, expandedIds: ce, defaultExpandedIds: le, onExpandedIdsCha
96
96
  }
97
97
  return;
98
98
  }
99
- if (!n(e.key)) return;
99
+ if (!i(e.key)) return;
100
100
  let o = H.get(t)?.index;
101
101
  if (o === void 0) return;
102
102
  let s = ee(B, o, Ce(e.key));
@@ -73,3 +73,6 @@ canCollapse,
73
73
  /** @deprecated Interno; usa `KapiContextPanel` en su lugar. Se quita en 1.0. */
74
74
  ctxPanelClasses, resolveCollapsed } from "./contextPanelLogic.js";
75
75
  export type { KapiContextPanelSide } from "./contextPanelLogic.js";
76
+ export { KapiToc, DEFAULT_TOC_LABELS } from "./KapiToc.js";
77
+ export type { KapiTocItem, KapiTocLabels, KapiTocPosition, KapiTocProps } from "./KapiToc.js";
78
+ export { activeTocId, isAtBottom, visibleTocItems } from "./tocLogic.js";
@@ -0,0 +1,35 @@
1
+ /** Un título del contenido, con su nivel de encabezado. */
2
+ export type KapiTocItem = {
3
+ /** El `id` del elemento en la página. Es a lo que apunta el enlace. */
4
+ id: string;
5
+ /** Lo que se lee en el índice. */
6
+ label: string;
7
+ /** Nivel del encabezado: 2 para `<h2>`, 3 para `<h3>`… @default 2 */
8
+ level?: number | undefined;
9
+ };
10
+ /** Dónde está un título, medido desde el tope del documento. */
11
+ export type KapiTocPosition = {
12
+ /** El `id` del título. */
13
+ id: string;
14
+ /** Su distancia al tope del documento, en píxeles. */
15
+ top: number;
16
+ };
17
+ /** Los títulos que entran en el índice: los de nivel `maxLevel` o menos. */
18
+ export declare const visibleTocItems: (items: readonly KapiTocItem[], maxLevel: number) => KapiTocItem[];
19
+ /**
20
+ * Cuál título está activo para un scroll dado.
21
+ *
22
+ * La regla es "el último que ya pasó el tope", con `offset` descontado para que un header pegajoso
23
+ * no tape el título que acaba de activarse. Tres bordes que hay que decidir y conviene tener acá y
24
+ * no repartidos en un efecto:
25
+ *
26
+ * - **Arriba de todo**: ninguno pasó todavía, pero el índice sin nada marcado se ve roto, así que
27
+ * gana el primero.
28
+ * - **Abajo de todo**: los últimos títulos de una página pueden no llegar nunca al tope si el
29
+ * documento se termina antes, y entonces el índice se queda clavado en el penúltimo mientras la
30
+ * persona mira el último. Con `atBottom`, gana el último.
31
+ * - **Sin títulos**: `null`, y el componente no dibuja nada.
32
+ */
33
+ export declare const activeTocId: (positions: readonly KapiTocPosition[], scrollTop: number, offset?: number, atBottom?: boolean) => string | null;
34
+ /** `true` si ya no queda nada para scrollear (con un margen, que el scroll suele caer decimal). */
35
+ export declare const isAtBottom: (scrollTop: number, viewport: number, total: number, margen?: number) => boolean;
@@ -0,0 +1,11 @@
1
+ //#region src/components/navigation/tocLogic.ts
2
+ var e = (e, t) => e.filter((e) => (e.level ?? 2) <= t), t = (e, t, n = 0, r = !1) => {
3
+ if (e.length === 0) return null;
4
+ if (r) return e[e.length - 1]?.id ?? null;
5
+ let i = t + n, a = e[0]?.id ?? null;
6
+ for (let t of e) if (t.top <= i) a = t.id;
7
+ else break;
8
+ return a;
9
+ }, n = (e, t, n, r = 2) => e + t >= n - r;
10
+ //#endregion
11
+ export { t as activeTocId, n as isAtBottom, e as visibleTocItems };
@@ -0,0 +1,8 @@
1
+ /** Partes de `toc` (ver `slotCatalog.ts` para el contrato). Vive junto al componente. */
2
+ export declare const TOC_SLOTS: import("../slotsLogic.js").SlotTable<"toc", {
3
+ readonly root: null;
4
+ readonly heading: "kapi-toc__heading";
5
+ readonly list: "kapi-toc__list";
6
+ readonly item: "kapi-toc__item";
7
+ readonly link: "kapi-toc__link";
8
+ }>;
@@ -0,0 +1,11 @@
1
+ import { defineSlots as e } from "../slotsLogic.js";
2
+ //#region src/components/navigation/tocSlots.ts
3
+ var t = e("toc", {
4
+ root: null,
5
+ heading: "kapi-toc__heading",
6
+ list: "kapi-toc__list",
7
+ item: "kapi-toc__item",
8
+ link: "kapi-toc__link"
9
+ });
10
+ //#endregion
11
+ export { t as TOC_SLOTS };
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import "#kapi-css/components/overlays/KapiCommandPalette.css";
3
3
  import { joinClasses as e } from "../rootProps.js";
4
- import { useLabels as t } from "../locale/KapiLocaleProvider.js";
5
- import { enabledIndexes as n, nextEnabledIndex as r } from "./menuKeyboardLogic.js";
6
- import { useMergedRefs as i } from "../../hooks/mergeRefs.js";
4
+ import { useMergedRefs as t } from "../../hooks/mergeRefs.js";
5
+ import { useLabels as n } from "../locale/KapiLocaleProvider.js";
6
+ import { enabledIndexes as r, nextEnabledIndex as i } from "./menuKeyboardLogic.js";
7
7
  import { useBackdropClose as a, useNativeDialog as o, usePortalRoot as s } from "./useNativeDialog.js";
8
8
  import { clampActiveIndex as c, filterGroups as ee, flattenNavigable as l, nodeText as u } from "./commandPaletteLogic.js";
9
9
  /* empty css */
@@ -17,7 +17,7 @@ var b = "↑↓ para moverte · Enter para ir · Esc para cerrar", x = {
17
17
  empty: "Sin resultados",
18
18
  footerHint: b
19
19
  }, S = ({ onClose: b, groups: S, placeholder: C, emptyMessage: w, emptyLabel: T, footerHint: E, labels: D, className: O, style: k, id: A, ref: j }) => {
20
- let M = t("commandPalette", x, D), N = C ?? M.placeholder, P = w ?? T ?? M.empty, F = E === void 0 ? M.footerHint : E, I = f(), L = `${I}-listbox`, R = (e) => `${I}-opt-${e}`, z = m(null), [B, V] = h(""), [H, U] = h(0), { ref: W, dialogProps: G } = o({ onRequestClose: () => b("escape") }), K = i(W, j), q = a(() => b("backdrop")), J = p(() => {
20
+ let M = n("commandPalette", x, D), N = C ?? M.placeholder, P = w ?? T ?? M.empty, F = E === void 0 ? M.footerHint : E, I = f(), L = `${I}-listbox`, R = (e) => `${I}-opt-${e}`, z = m(null), [B, V] = h(""), [H, U] = h(0), { ref: W, dialogProps: G } = o({ onRequestClose: () => b("escape") }), K = t(W, j), q = a(() => b("backdrop")), J = p(() => {
21
21
  let e = S.map((e) => ({
22
22
  ...e,
23
23
  commands: e.commands.map((e) => ({
@@ -38,11 +38,11 @@ var b = "↑↓ para moverte · Enter para ir · Esc para cerrar", x = {
38
38
  switch (e.key) {
39
39
  case "ArrowDown":
40
40
  case "ArrowUp":
41
- e.preventDefault(), U(r(X, e.key === "ArrowDown" ? "next" : "prev", n(Y.length)));
41
+ e.preventDefault(), U(i(X, e.key === "ArrowDown" ? "next" : "prev", r(Y.length)));
42
42
  break;
43
43
  case "Home":
44
44
  case "End":
45
- Y.length > 0 && (e.preventDefault(), U(r(X, e.key === "Home" ? "first" : "last", n(Y.length))));
45
+ Y.length > 0 && (e.preventDefault(), U(i(X, e.key === "Home" ? "first" : "last", r(Y.length))));
46
46
  break;
47
47
  case "Enter": Z && !e.nativeEvent.isComposing && (e.preventDefault(), Q(Z));
48
48
  }