@kapiuara/ui 0.15.3 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/LICENSE +19 -15
  2. package/README.md +338 -6
  3. package/dist/components/data/KapiDataTable.d.ts +1 -1
  4. package/dist/components/data/KapiDataTable.js +22 -22
  5. package/dist/components/data/KapiPaginationFooter.js +1 -1
  6. package/dist/components/data/KapiSheet.d.ts +105 -0
  7. package/dist/components/data/KapiSheet.js +75 -0
  8. package/dist/components/data/KapiTable.d.ts +2 -2
  9. package/dist/components/data/KapiTable.js +347 -329
  10. package/dist/components/data/KapiTableFooter.d.ts +22 -0
  11. package/dist/components/data/KapiTableFooter.js +55 -0
  12. package/dist/components/data/KapiTableRow.js +53 -52
  13. package/dist/components/data/KapiTableToolbar.d.ts +4 -2
  14. package/dist/components/data/KapiTableToolbar.js +71 -69
  15. package/dist/components/data/index.d.ts +3 -1
  16. package/dist/components/data/tableCells.d.ts +5 -4
  17. package/dist/components/data/tableCells.js +42 -41
  18. package/dist/components/data/tableLogic.d.ts +2 -0
  19. package/dist/components/data/tableLogic.js +66 -66
  20. package/dist/components/data/tableSlots.d.ts +9 -0
  21. package/dist/components/data/tableSlots.js +12 -0
  22. package/dist/components/data/tableSpanLogic.d.ts +35 -0
  23. package/dist/components/data/tableSpanLogic.js +47 -0
  24. package/dist/components/data/tableTypes.d.ts +54 -1
  25. package/dist/components/data/useTableSelection.d.ts +4 -2
  26. package/dist/components/data/useTableSelection.js +27 -23
  27. package/dist/components/display/KapiAnchor.d.ts +36 -0
  28. package/dist/components/display/KapiAnchor.js +36 -0
  29. package/dist/components/display/KapiBadge.d.ts +6 -5
  30. package/dist/components/display/KapiBadge.js +25 -19
  31. package/dist/components/display/KapiText.d.ts +43 -0
  32. package/dist/components/display/KapiText.js +33 -0
  33. package/dist/components/display/KapiTitle.d.ts +33 -0
  34. package/dist/components/display/KapiTitle.js +29 -0
  35. package/dist/components/display/index.d.ts +7 -0
  36. package/dist/components/display/textLogic.d.ts +32 -0
  37. package/dist/components/display/textLogic.js +19 -0
  38. package/dist/components/feedback/KapiAlert.d.ts +8 -4
  39. package/dist/components/feedback/KapiAlert.js +39 -34
  40. package/dist/components/inputs/KapiButton.d.ts +7 -4
  41. package/dist/components/inputs/KapiButton.js +47 -42
  42. package/dist/components/inputs/KapiSelect.d.ts +12 -0
  43. package/dist/components/inputs/KapiSelect.js +215 -212
  44. package/dist/components/inputs/KapiSelectMenu.d.ts +4 -2
  45. package/dist/components/inputs/KapiSelectMenu.js +131 -133
  46. package/dist/components/inputs/fieldLogic.d.ts +2 -2
  47. package/dist/components/inputs/index.d.ts +1 -1
  48. package/dist/components/inputs/selectSlots.d.ts +24 -0
  49. package/dist/components/inputs/selectSlots.js +27 -0
  50. package/dist/components/layout/KapiBox.d.ts +31 -0
  51. package/dist/components/layout/KapiBox.js +26 -0
  52. package/dist/components/layout/KapiCard.d.ts +16 -4
  53. package/dist/components/layout/KapiCard.js +46 -34
  54. package/dist/components/layout/KapiCenter.d.ts +13 -0
  55. package/dist/components/layout/KapiCenter.js +23 -0
  56. package/dist/components/layout/KapiCol.d.ts +22 -0
  57. package/dist/components/layout/KapiCol.js +23 -0
  58. package/dist/components/layout/KapiGrid.d.ts +29 -3
  59. package/dist/components/layout/KapiGrid.js +39 -17
  60. package/dist/components/layout/KapiPageHeader.d.ts +10 -1
  61. package/dist/components/layout/KapiPageHeader.js +82 -80
  62. package/dist/components/layout/KapiPanelParts.d.ts +11 -2
  63. package/dist/components/layout/KapiPanelParts.js +73 -56
  64. package/dist/components/layout/KapiRail.d.ts +10 -1
  65. package/dist/components/layout/KapiRail.js +123 -120
  66. package/dist/components/layout/KapiRoot.d.ts +35 -5
  67. package/dist/components/layout/KapiRoot.js +54 -39
  68. package/dist/components/layout/KapiShell.d.ts +36 -3
  69. package/dist/components/layout/KapiShell.js +53 -50
  70. package/dist/components/layout/cardSlots.d.ts +9 -0
  71. package/dist/components/layout/cardSlots.js +12 -0
  72. package/dist/components/layout/gridSpanLogic.d.ts +46 -0
  73. package/dist/components/layout/gridSpanLogic.js +39 -0
  74. package/dist/components/layout/index.d.ts +11 -4
  75. package/dist/components/layout/layoutPrimitives.d.ts +11 -0
  76. package/dist/components/layout/layoutPrimitives.js +12 -1
  77. package/dist/components/layout/pageHeaderSlots.d.ts +12 -0
  78. package/dist/components/layout/pageHeaderSlots.js +15 -0
  79. package/dist/components/layout/railLogic.d.ts +16 -3
  80. package/dist/components/layout/railSlots.d.ts +12 -0
  81. package/dist/components/layout/railSlots.js +15 -0
  82. package/dist/components/layout/shellSlots.d.ts +6 -0
  83. package/dist/components/layout/shellSlots.js +9 -0
  84. package/dist/components/layout/useGridBreakpoint.d.ts +12 -0
  85. package/dist/components/layout/useGridBreakpoint.js +35 -0
  86. package/dist/components/navigation/KapiBreadcrumb.d.ts +18 -2
  87. package/dist/components/navigation/KapiBreadcrumb.js +23 -16
  88. package/dist/components/navigation/KapiContextPanel.d.ts +17 -4
  89. package/dist/components/navigation/KapiContextPanel.js +151 -135
  90. package/dist/components/navigation/KapiPanelGroup.d.ts +16 -4
  91. package/dist/components/navigation/KapiPanelGroup.js +66 -65
  92. package/dist/components/navigation/KapiTabs.d.ts +12 -0
  93. package/dist/components/navigation/KapiTabs.js +87 -71
  94. package/dist/components/navigation/MiniNavItem.d.ts +7 -2
  95. package/dist/components/navigation/MiniNavItem.js +41 -36
  96. package/dist/components/navigation/breadcrumbLogic.d.ts +4 -2
  97. package/dist/components/navigation/breadcrumbLogic.js +1 -1
  98. package/dist/components/navigation/navLink.d.ts +21 -0
  99. package/dist/components/navigation/navLink.js +26 -0
  100. package/dist/components/navigation/navLinkLogic.d.ts +18 -0
  101. package/dist/components/navigation/navLinkLogic.js +22 -0
  102. package/dist/components/overlays/KapiContextMenu.d.ts +8 -0
  103. package/dist/components/overlays/KapiModal.d.ts +9 -0
  104. package/dist/components/overlays/KapiModal.js +77 -75
  105. package/dist/components/overlays/index.d.ts +1 -1
  106. package/dist/components/overlays/menuList.js +123 -113
  107. package/dist/components/overlays/modalSlots.d.ts +11 -0
  108. package/dist/components/overlays/modalSlots.js +14 -0
  109. package/dist/components/slotCatalog.d.ts +90 -0
  110. package/dist/components/slotCatalog.js +19 -0
  111. package/dist/components/slotsLogic.d.ts +34 -0
  112. package/dist/components/slotsLogic.js +18 -0
  113. package/dist/components/tone.d.ts +26 -0
  114. package/dist/components/tone.js +15 -14
  115. package/dist/css/base.css +1 -1
  116. package/dist/css/components/data/KapiEventCalendar.css +1 -1
  117. package/dist/css/components/data/KapiTable.css +1 -1
  118. package/dist/css/components/display/display.css +1 -1
  119. package/dist/css/components/display/typography.css +1 -0
  120. package/dist/css/components/feedback/feedback.css +1 -1
  121. package/dist/css/components/inputs/KapiButton.css +1 -1
  122. package/dist/css/components/inputs/KapiDatePicker.css +1 -1
  123. package/dist/css/components/layout/KapiBox.css +1 -0
  124. package/dist/css/components/layout/KapiRail.css +1 -1
  125. package/dist/css/components/layout/gridSpan.css +1 -0
  126. package/dist/css/components/navigation/navigation.css +1 -1
  127. package/dist/hooks/densityLogic.d.ts +15 -0
  128. package/dist/hooks/densityLogic.js +4 -0
  129. package/dist/hooks/index.d.ts +4 -0
  130. package/dist/hooks/themeColorsLogic.d.ts +19 -0
  131. package/dist/hooks/themeColorsLogic.js +4 -2
  132. package/dist/hooks/themeDeriveLogic.d.ts +16 -0
  133. package/dist/hooks/themeDeriveLogic.js +27 -17
  134. package/dist/hooks/toneFamilyLogic.d.ts +122 -0
  135. package/dist/hooks/toneFamilyLogic.js +151 -0
  136. package/dist/hooks/useKapiTheme.d.ts +8 -2
  137. package/dist/hooks/useKapiTheme.js +116 -103
  138. package/dist/hooks/useToneFamilies.d.ts +30 -0
  139. package/dist/hooks/useToneFamilies.js +46 -0
  140. package/dist/index.d.ts +3 -1
  141. package/dist/index.js +213 -204
  142. package/dist/kapi.css +1 -1
  143. package/dist/kapi.layered.css +1 -1
  144. package/dist/styles/rawHeights.d.ts +8 -0
  145. package/package.json +2 -2
@@ -1,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 { 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";
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: r, search: i, hint: a, labels: o }) => {
133
+ let c = n("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, n) => /* @__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
+ n > 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,
153
+ active: e.id === t,
138
154
  onSelect: r,
139
- newTabLabel: l.newTab
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 = 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);
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(a(p, i(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 = _(a(p, i(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,5 +1,6 @@
1
1
  import { type ReactNode } from "react";
2
2
  import { type KapiLinkLabels } from "../locale/linkLabels.js";
3
+ import type { KapiRender } from "../renderSlot.js";
3
4
  import { type KapiNavBadgeValue } from "./navBadgeLogic.js";
4
5
  import type { KapiTone } from "../tone.js";
5
6
  import type { KapiRootProps } from "../rootProps.js";
@@ -20,11 +21,22 @@ export type KapiPanelGroupItem<Id extends string = string> = {
20
21
  icon?: ReactNode;
21
22
  /** No se puede elegir (botón deshabilitado o enlace `aria-disabled`). */
22
23
  disabled?: boolean | undefined;
23
- /** Si se pasa, se dibuja un enlace real `<a>` en vez de un botón. */
24
+ /**
25
+ * Si se pasa, se dibuja un enlace real `<a>` en vez de un botón. Es un enlace NATIVO: navega con carga
26
+ * completa de página. Para navegar dentro de una SPA sin recargar, usa `render`.
27
+ */
24
28
  href?: string | undefined;
25
- /** Destino en otro sistema: agrega el ícono ↗ (sólo con `href`). */
29
+ /**
30
+ * El elemento que dibuja el subítem: el `<Link>` de tu router. Navega sin recargar la página. Las clases
31
+ * se unen, los estilos se funden y los handlers corren los dos (primero el tuyo); la librería no le pone
32
+ * `href` 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.
33
+ *
34
+ * { id: "abiertos", label: "Abiertos", render: <Link to="/abiertos" /> }
35
+ */
36
+ render?: KapiRender | undefined;
37
+ /** Destino en otro sistema: agrega el ícono ↗ (sólo con `href` o `render`). */
26
38
  external?: boolean | undefined;
27
- /** Abrir el enlace en una pestaña nueva (sólo con `href`). */
39
+ /** Abrir el enlace en una pestaña nueva (sólo con `href` o `render`). */
28
40
  newTab?: boolean | undefined;
29
41
  };
30
42
  /**
@@ -48,7 +60,7 @@ export type KapiPanelGroupProps<Id extends string = string> = KapiRootProps<HTML
48
60
  items: readonly KapiPanelGroupItem<Id>[];
49
61
  /** Id del subítem activo (`aria-current="page"`); lo decide la app, normalmente desde el router. */
50
62
  activeId?: Id | undefined;
51
- /** Se llama con el `id` del subítem clickeado (no aplica a los enlaces con `href`). */
63
+ /** Se llama con el `id` del subítem clickeado (no aplica a los enlaces: ni con `href` ni con `render`). */
52
64
  onSelect?: ((id: Id) => void) | undefined;
53
65
  /** Controlado. */
54
66
  open?: boolean | undefined;