@kapiuara/ui 0.4.0 → 0.6.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 (44) hide show
  1. package/README.md +54 -1
  2. package/dist/components/chat/KapiChatDivider.d.ts +15 -0
  3. package/dist/components/chat/KapiChatDivider.js +17 -0
  4. package/dist/components/chat/KapiChatList.d.ts +57 -0
  5. package/dist/components/chat/KapiChatList.js +71 -0
  6. package/dist/components/chat/KapiChatThread.d.ts +35 -0
  7. package/dist/components/chat/KapiChatThread.js +85 -0
  8. package/dist/components/chat/KapiComposer.d.ts +60 -0
  9. package/dist/components/chat/KapiComposer.js +89 -0
  10. package/dist/components/chat/KapiMessageBubble.d.ts +43 -0
  11. package/dist/components/chat/KapiMessageBubble.js +67 -0
  12. package/dist/components/chat/KapiTypingIndicator.d.ts +27 -0
  13. package/dist/components/chat/KapiTypingIndicator.js +34 -0
  14. package/dist/components/chat/chatLogic.d.ts +76 -0
  15. package/dist/components/chat/chatLogic.js +34 -0
  16. package/dist/components/chat/index.d.ts +14 -0
  17. package/dist/components/display/KapiCommentComposer.d.ts +4 -0
  18. package/dist/components/display/KapiCommentComposer.js +43 -46
  19. package/dist/components/display/commentLogic.d.ts +9 -2
  20. package/dist/components/display/commentLogic.js +1 -1
  21. package/dist/components/display/index.d.ts +1 -0
  22. package/dist/components/inputs/KapiFacetedSearch.d.ts +14 -1
  23. package/dist/components/inputs/KapiFacetedSearch.js +172 -110
  24. package/dist/components/inputs/KapiSelect.d.ts +7 -0
  25. package/dist/components/inputs/KapiSelect.js +233 -229
  26. package/dist/components/inputs/facetedSearchLogic.d.ts +12 -2
  27. package/dist/components/inputs/facetedSearchLogic.js +10 -7
  28. package/dist/components/layout/KapiPanelParts.js +9 -9
  29. package/dist/components/layout/KapiRail.js +8 -8
  30. package/dist/components/locale/labelRegistry.d.ts +10 -0
  31. package/dist/components/navigation/KapiContextPanel.js +86 -86
  32. package/dist/components/navigation/KapiPanelGroup.js +18 -18
  33. package/dist/components/navigation/KapiTabs.js +1 -1
  34. package/dist/components/navigation/MiniNavItem.js +1 -1
  35. package/dist/hooks/dateFormat.d.ts +7 -0
  36. package/dist/hooks/dateFormat.js +16 -2
  37. package/dist/hooks/index.d.ts +1 -1
  38. package/dist/hooks/useSubmitDraft.d.ts +34 -0
  39. package/dist/hooks/useSubmitDraft.js +28 -0
  40. package/dist/index.d.ts +1 -0
  41. package/dist/index.js +83 -76
  42. package/dist/kapi.css +1 -1
  43. package/dist/kapi.layered.css +1 -1
  44. package/package.json +1 -1
@@ -13,8 +13,16 @@ export type KapiFacet = {
13
13
  key: string;
14
14
  label: string;
15
15
  kind: KapiFacetKind;
16
- /** Opciones de una faceta `list`. */
16
+ /** Opciones de una faceta `list`, cuando se conocen de antemano. */
17
17
  options?: ReadonlyArray<KapiFacetOption> | undefined;
18
+ /**
19
+ * Carga de opciones según lo tipeado, para una faceta `list` cuyos valores vive en el servidor.
20
+ * REEMPLAZA al filtro local: lo que devuelve se muestra tal cual, porque el que filtró fue el
21
+ * servidor. Se aborta con `signal` cuando empieza otro pedido, al cerrar el menú o al desmontar.
22
+ */
23
+ loadOptions?: ((query: string, context: {
24
+ signal: AbortSignal;
25
+ }) => Promise<ReadonlyArray<KapiFacetOption>>) | undefined;
18
26
  /**
19
27
  * Recibe el valor elegido: el `value` de la opción, la fecha como `yyyy-mm-dd`, el rango como
20
28
  * `yyyy-mm-dd/yyyy-mm-dd` (ver `parseDateRangeValue`) o `"true"` (flag).
@@ -42,7 +50,9 @@ export type KapiFacetMenuItem = {
42
50
  * Con una faceta `list` pendiente: sus opciones que coinciden. Con una `date` o `dateRange`: nada (decide
43
51
  * el calendario).
44
52
  */
45
- export declare function facetMenuItems(facets: ReadonlyArray<KapiFacet>, pending: KapiFacet | null, input: string): KapiFacetMenuItem[];
53
+ export declare function facetMenuItems(facets: ReadonlyArray<KapiFacet>, pending: KapiFacet | null, input: string,
54
+ /** Opciones ya cargadas para la faceta pendiente. Si vienen, NO se filtran de nuevo: filtró el servidor. */
55
+ loaded?: ReadonlyArray<KapiFacetOption> | undefined): KapiFacetMenuItem[];
46
56
  /** Mueve el ítem activo con vuelta; desde `-1` entra por el extremo según la dirección. */
47
57
  export declare const moveActive: (index: number, count: number, delta: 1 | -1) => number;
48
58
  export type KapiFacetKeyAction = "next" | "prev" | "select" | "text" | "cancel" | "close" | "dropPending" | "removeLast";
@@ -1,21 +1,24 @@
1
1
  import { normalizeFilterText as e } from "../data/tableLogic.js";
2
2
  //#region src/components/inputs/facetedSearchLogic.ts
3
3
  var t = (t, n) => !n || e(t).includes(n);
4
- function n(n, r, i) {
5
- let a = e(i);
6
- if (r) return r.kind === "list" ? (r.options ?? []).filter((e) => t(e.label, a)).map((e) => ({
4
+ function n(n, r, i, a) {
5
+ let o = e(i);
6
+ if (r) return r.kind === "list" ? a ? a.map((e) => ({
7
+ type: "option",
8
+ option: e
9
+ })) : (r.options ?? []).filter((e) => t(e.label, o)).map((e) => ({
7
10
  type: "option",
8
11
  option: e
9
12
  })) : [];
10
- let o = i.trim(), s = o ? [{
13
+ let s = i.trim(), c = s ? [{
11
14
  type: "text",
12
- text: o
15
+ text: s
13
16
  }] : [];
14
- for (let e of n) t(e.label, a) && s.push({
17
+ for (let e of n) t(e.label, o) && c.push({
15
18
  type: "facet",
16
19
  facet: e
17
20
  });
18
- return s;
21
+ return c;
19
22
  }
20
23
  var r = (e, t, n) => t === 0 ? -1 : e < 0 ? n > 0 ? 0 : t - 1 : (e + n + t) % t;
21
24
  function i(e, t) {
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { joinClasses as e } from "../rootProps.js";
3
- import { CtxSlidingList as t } from "../navigation/CtxSlidingList.js";
4
3
  import "../navigation/navBadgeLogic.js";
5
- import { KapiNavBadge as n } from "../navigation/KapiNavBadge.js";
4
+ import { KapiNavBadge as t } from "../navigation/KapiNavBadge.js";
5
+ import { CtxSlidingList as n } from "../navigation/CtxSlidingList.js";
6
6
  import { useKapiPanelMini as r } from "../navigation/panelMini.js";
7
7
  import { MiniNavItem as i } from "../navigation/MiniNavItem.js";
8
8
  /* empty css */
@@ -17,10 +17,10 @@ var s = ({ className: t, ...n }) => /* @__PURE__ */ a("div", {
17
17
  }), l = ({ className: t, ...n }) => /* @__PURE__ */ a("div", {
18
18
  ...n,
19
19
  className: e("kapi-hint", t)
20
- }), u = ({ children: e, ...n }) => /* @__PURE__ */ a(t, {
21
- ...n,
20
+ }), u = ({ children: e, ...t }) => /* @__PURE__ */ a(n, {
21
+ ...t,
22
22
  children: e
23
- }), d = ({ active: t = !1, trailing: s, badge: c, badgeTone: l, badgeLabel: u, icon: d, className: f, type: p = "button", children: m, ...h }) => {
23
+ }), d = ({ active: n = !1, trailing: s, badge: c, badgeTone: l, badgeLabel: u, icon: d, className: f, type: p = "button", children: m, ...h }) => {
24
24
  let { mini: g } = r();
25
25
  return g ? /* @__PURE__ */ a(i, {
26
26
  ...h,
@@ -28,15 +28,15 @@ var s = ({ className: t, ...n }) => /* @__PURE__ */ a("div", {
28
28
  className: f,
29
29
  label: m,
30
30
  icon: d,
31
- active: t,
31
+ active: n,
32
32
  badge: c,
33
33
  badgeTone: l,
34
34
  badgeLabel: u
35
35
  }) : /* @__PURE__ */ o("button", {
36
36
  ...h,
37
37
  type: p,
38
- className: e("kapi-ctxitem", t && "kapi-ctxitem--on", f),
39
- "aria-current": t ? "page" : void 0,
38
+ className: e("kapi-ctxitem", n && "kapi-ctxitem--on", f),
39
+ "aria-current": n ? "page" : void 0,
40
40
  children: [
41
41
  d == null || d === !1 ? m : /* @__PURE__ */ o("span", {
42
42
  className: "kapi-ctxitem__lead",
@@ -49,7 +49,7 @@ var s = ({ className: t, ...n }) => /* @__PURE__ */ a("div", {
49
49
  children: m
50
50
  })]
51
51
  }),
52
- /* @__PURE__ */ a(n, {
52
+ /* @__PURE__ */ a(t, {
53
53
  value: c,
54
54
  tone: l,
55
55
  label: u,
@@ -3,27 +3,27 @@ import { useLabels as e } from "../locale/KapiLocaleProvider.js";
3
3
  import { joinClasses as t } from "../rootProps.js";
4
4
  import { useSlidingIndicator as n } from "../../hooks/useSlidingIndicator.js";
5
5
  import { KapiTooltip as r } from "../overlays/KapiTooltip.js";
6
- import { DEFAULT_LINK_LABELS as i } from "../locale/linkLabels.js";
7
- import { navBadgeA11yText as a } from "../navigation/navBadgeLogic.js";
8
- import { KapiNavBadge as o } from "../navigation/KapiNavBadge.js";
6
+ import { navBadgeA11yText as i } from "../navigation/navBadgeLogic.js";
7
+ import { KapiNavBadge as a } from "../navigation/KapiNavBadge.js";
8
+ import { DEFAULT_LINK_LABELS as o } from "../locale/linkLabels.js";
9
9
  import { isRailSeparator as s, railClasses as c, railItemClasses as l, railShowsTooltip as u, splitRailEntries as d } from "./railLogic.js";
10
10
  /* empty css */
11
11
  import { jsx as f, jsxs as p } from "react/jsx-runtime";
12
12
  import { ExternalLink as m } from "lucide-react";
13
13
  //#region src/components/layout/KapiRail.tsx
14
14
  var h = { navigation: "Navegación principal" }, g = ({ items: g, activeId: _, onSelect: v, brand: y, footer: b, variant: x = "labeled", "aria-label": S, labels: C, className: w, ...T }) => {
15
- let E = e("rail", h, C), D = e("link", i, C), O = x === "compact", k = u(x), A = d(g), { containerRef: j, indicatorRef: M } = n({
15
+ let E = e("rail", h, C), D = e("link", o, C), O = x === "compact", k = u(x), A = d(g), { containerRef: j, indicatorRef: M } = n({
16
16
  active: _ ?? null,
17
17
  deps: [g, x],
18
18
  findActive: (e) => e.querySelector(".kapi-rail__item[aria-current=\"page\"]")
19
- }), N = ({ id: e, label: t, icon: n, href: i, external: s, newTab: c, badge: u, badgeTone: d, badgeLabel: h }) => {
20
- let g = _ === e, y = g ? "page" : void 0, b = a(u, h), x = b === null ? t : `${t} ${b}`, S = O ? x : void 0, C = /* @__PURE__ */ f(o, {
19
+ }), N = ({ id: e, label: t, icon: n, href: o, external: s, newTab: c, badge: u, badgeTone: d, badgeLabel: h }) => {
20
+ let g = _ === e, y = g ? "page" : void 0, b = i(u, h), x = b === null ? t : `${t} ${b}`, S = O ? x : void 0, C = /* @__PURE__ */ f(a, {
21
21
  value: u,
22
22
  tone: d,
23
23
  label: h,
24
24
  placement: "corner",
25
25
  announce: !O
26
- }), w = i === void 0 ? /* @__PURE__ */ p("button", {
26
+ }), w = o === void 0 ? /* @__PURE__ */ p("button", {
27
27
  type: "button",
28
28
  className: l({ active: g }),
29
29
  onClick: () => v?.(e),
@@ -39,7 +39,7 @@ var h = { navigation: "Navegación principal" }, g = ({ items: g, activeId: _, o
39
39
  active: g,
40
40
  link: !0
41
41
  }),
42
- href: i,
42
+ href: o,
43
43
  rel: "noopener noreferrer",
44
44
  target: c ? "_blank" : void 0,
45
45
  "aria-current": y,
@@ -45,6 +45,11 @@ import type { KapiConfirmLabels } from "../overlays/KapiConfirm";
45
45
  import type { KapiContextMenuLabels } from "../overlays/KapiContextMenu";
46
46
  import type { KapiDialogLabels } from "../overlays/KapiDialogHost";
47
47
  import type { KapiModalLabels } from "../overlays/KapiModal";
48
+ import type { KapiMessageBubbleLabels } from "../chat/KapiMessageBubble";
49
+ import type { KapiChatListLabels } from "../chat/KapiChatList";
50
+ import type { KapiChatThreadLabels } from "../chat/KapiChatThread";
51
+ import type { KapiComposerLabels } from "../chat/KapiComposer";
52
+ import type { KapiTypingIndicatorLabels } from "../chat/KapiTypingIndicator";
48
53
  import type { UnsavedGuardLabels } from "../../hooks/useUnsavedGuard";
49
54
  /**
50
55
  * Clave → tipo de los textos de cada componente. Es una `interface` a propósito: una app puede
@@ -62,9 +67,12 @@ export interface KapiLabelRegistry {
62
67
  bulkBar: KapiBulkBarLabels;
63
68
  calendar: KapiDateRangePickerLabels;
64
69
  canvasForm: KapiCanvasFormLabels;
70
+ chatList: KapiChatListLabels;
71
+ chatThread: KapiChatThreadLabels;
65
72
  collapsiblePanel: KapiCollapsiblePanelLabels;
66
73
  commandPalette: KapiCommandPaletteLabels;
67
74
  commentComposer: KapiCommentComposerLabels;
75
+ composer: KapiComposerLabels;
68
76
  confirm: KapiConfirmLabels;
69
77
  contextMenu: KapiContextMenuLabels;
70
78
  contextPanel: KapiContextPanelLabels;
@@ -79,6 +87,7 @@ export interface KapiLabelRegistry {
79
87
  filterChips: KapiFilterChipsLabels;
80
88
  input: KapiInputLabels;
81
89
  link: KapiLinkLabels;
90
+ messageBubble: KapiMessageBubbleLabels;
82
91
  modal: KapiModalLabels;
83
92
  notificationBell: KapiNotificationBellLabels;
84
93
  numberStepper: KapiNumberStepperLabels;
@@ -100,6 +109,7 @@ export interface KapiLabelRegistry {
100
109
  toast: KapiToastLabels;
101
110
  tour: KapiTourLabels;
102
111
  tree: KapiTreeLabels;
112
+ typingIndicator: KapiTypingIndicatorLabels;
103
113
  unsavedBar: KapiUnsavedBarLabels;
104
114
  unsavedGuard: UnsavedGuardLabels;
105
115
  wizard: KapiWizardLabels;
@@ -1,22 +1,22 @@
1
1
  "use client";
2
2
  import { useLabels as e } from "../locale/KapiLocaleProvider.js";
3
3
  import { joinClasses as t } from "../rootProps.js";
4
- import { canCollapse as n, clampCtxPanelWidth as r, ctxPanelClasses as i, ctxPanelWidthFromDrag as a, resolveCollapsed as o, stepCtxPanelWidth as s } from "./contextPanelLogic.js";
5
- import { activeIdIn as c } from "./activeItemLogic.js";
6
- import { CtxSlidingList as l } from "./CtxSlidingList.js";
7
- /* empty css */
8
- import { DEFAULT_LINK_LABELS as u } from "../locale/linkLabels.js";
9
4
  import "./navBadgeLogic.js";
10
- import { KapiNavBadge as d } from "./KapiNavBadge.js";
5
+ import { KapiNavBadge as n } from "./KapiNavBadge.js";
6
+ import { canCollapse as r, clampCtxPanelWidth as i, ctxPanelClasses as a, ctxPanelWidthFromDrag as o, resolveCollapsed as s, stepCtxPanelWidth as c } from "./contextPanelLogic.js";
7
+ import { activeIdIn as l } from "./activeItemLogic.js";
8
+ import { CtxSlidingList as u } from "./CtxSlidingList.js";
9
+ /* empty css */
10
+ import { DEFAULT_LINK_LABELS as d } from "../locale/linkLabels.js";
11
11
  import { KapiPanelMiniContext as f, useKapiPanelMini as p } from "./panelMini.js";
12
12
  import { MiniNavItem as m } from "./MiniNavItem.js";
13
13
  import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
14
- import { useLayoutEffect as ee, useRef as v, useState as y } from "react";
15
- import { ChevronsLeft as b, ChevronsRight as x, ExternalLink as S } from "lucide-react";
14
+ import { useLayoutEffect as v, useRef as y, useState as b } from "react";
15
+ import { ChevronsLeft as x, ChevronsRight as S, ExternalLink as C } from "lucide-react";
16
16
  //#region src/components/navigation/KapiContextPanel.tsx
17
- var C = ({ item: e, active: t, onSelect: n, newTabLabel: r }) => {
18
- let { mini: i } = p(), a = e.detail !== void 0 || e.initials !== void 0, o = () => n?.(e.id);
19
- return i ? /* @__PURE__ */ g(m, {
17
+ var w = ({ item: e, active: t, onSelect: r, newTabLabel: i }) => {
18
+ let { mini: a } = p(), o = e.detail !== void 0 || e.initials !== void 0, s = () => r?.(e.id);
19
+ return a ? /* @__PURE__ */ g(m, {
20
20
  label: e.label,
21
21
  icon: e.icon,
22
22
  initials: e.initials,
@@ -25,17 +25,17 @@ var C = ({ item: e, active: t, onSelect: n, newTabLabel: r }) => {
25
25
  badgeTone: e.badgeTone,
26
26
  badgeLabel: e.badgeLabel,
27
27
  disabled: e.disabled,
28
- ...!a && e.href !== void 0 ? {
28
+ ...!o && e.href !== void 0 ? {
29
29
  href: e.href,
30
30
  newTab: e.newTab,
31
- newTabLabel: r
32
- } : { onClick: o }
33
- }) : a ? /* @__PURE__ */ _("button", {
31
+ newTabLabel: i
32
+ } : { onClick: s }
33
+ }) : o ? /* @__PURE__ */ _("button", {
34
34
  type: "button",
35
35
  className: `kapi-ctxrec${t ? " kapi-ctxrec--on" : ""}`,
36
36
  "aria-current": t ? "page" : void 0,
37
37
  disabled: e.disabled,
38
- onClick: o,
38
+ onClick: s,
39
39
  children: [
40
40
  e.initials !== void 0 && /* @__PURE__ */ g("span", {
41
41
  className: "kapi-ctxrec__av kapi-ctxrec__av--tone",
@@ -51,7 +51,7 @@ var C = ({ item: e, active: t, onSelect: n, newTabLabel: r }) => {
51
51
  children: e.detail
52
52
  })]
53
53
  }),
54
- /* @__PURE__ */ g(d, {
54
+ /* @__PURE__ */ g(n, {
55
55
  value: e.badge,
56
56
  tone: e.badgeTone,
57
57
  label: e.badgeLabel,
@@ -64,13 +64,13 @@ var C = ({ item: e, active: t, onSelect: n, newTabLabel: r }) => {
64
64
  className: `kapi-ctxitem${t ? " kapi-ctxitem--on" : ""}`,
65
65
  "aria-current": t ? "page" : void 0,
66
66
  disabled: e.disabled,
67
- onClick: o,
67
+ onClick: s,
68
68
  children: [
69
69
  /* @__PURE__ */ _("span", {
70
70
  className: "kapi-ctxitem__main",
71
71
  children: [e.icon, e.label]
72
72
  }),
73
- /* @__PURE__ */ g(d, {
73
+ /* @__PURE__ */ g(n, {
74
74
  value: e.badge,
75
75
  tone: e.badgeTone,
76
76
  label: e.badgeLabel,
@@ -90,26 +90,26 @@ var C = ({ item: e, active: t, onSelect: n, newTabLabel: r }) => {
90
90
  className: "kapi-ctxitem__main",
91
91
  children: [e.icon, e.label]
92
92
  }),
93
- /* @__PURE__ */ g(d, {
93
+ /* @__PURE__ */ g(n, {
94
94
  value: e.badge,
95
95
  tone: e.badgeTone,
96
96
  label: e.badgeLabel,
97
97
  max: 999
98
98
  }),
99
99
  e.trailing,
100
- e.external && /* @__PURE__ */ g(S, {
100
+ e.external && /* @__PURE__ */ g(C, {
101
101
  className: "kapi-ctxitem__ext",
102
102
  size: 14,
103
103
  "aria-hidden": "true"
104
104
  }),
105
105
  e.newTab && /* @__PURE__ */ g("span", {
106
106
  className: "kapi-ctxitem__sr",
107
- children: r
107
+ children: i
108
108
  })
109
109
  ]
110
110
  });
111
- }, w = ({ sections: t, activeId: n, onSelect: r, search: i, hint: a, labels: o }) => {
112
- let s = e("link", u, o);
111
+ }, T = ({ sections: t, activeId: n, onSelect: r, search: i, hint: a, labels: o }) => {
112
+ let s = e("link", d, o);
113
113
  return /* @__PURE__ */ _(h, { children: [
114
114
  i && /* @__PURE__ */ g("input", {
115
115
  type: "search",
@@ -127,9 +127,9 @@ var C = ({ item: e, active: t, onSelect: n, newTabLabel: r }) => {
127
127
  className: "kapi-ct",
128
128
  children: e.label
129
129
  }),
130
- /* @__PURE__ */ g(l, {
131
- active: c(e.items, n),
132
- children: e.items.map((e) => /* @__PURE__ */ g(C, {
130
+ /* @__PURE__ */ g(u, {
131
+ active: l(e.items, n),
132
+ children: e.items.map((e) => /* @__PURE__ */ g(w, {
133
133
  item: e,
134
134
  active: e.id === n,
135
135
  onSelect: r,
@@ -143,48 +143,48 @@ var C = ({ item: e, active: t, onSelect: n, newTabLabel: r }) => {
143
143
  children: a
144
144
  })
145
145
  ] });
146
- }, T = {
146
+ }, E = {
147
147
  resize: "Redimensionar panel",
148
148
  collapse: "Plegar panel",
149
149
  expand: "Desplegar panel",
150
150
  region: "Panel contextual"
151
- }, E = ({ title: c, actions: l, collapsed: u, defaultCollapsed: d, onCollapsedChange: p, collapseLabel: m, expandLabel: h, side: S = "left", collapsedMode: C = "hidden", resizable: E = !1, minWidth: D = 200, maxWidth: O = 420, "aria-label": k, labels: A, className: j, style: M, id: N, ...P }) => {
152
- let F = e("contextPanel", T, A), I = m ?? F.collapse, L = h ?? F.expand, R = k ?? F.region, [z, B] = y(d ?? !1), [V, H] = y(null), [U, W] = y(!1), G = v(null), K = v(null), q = o(u, z), J = v(null), [Y, X] = y(null);
153
- ee(() => {
154
- Y && (q === Y.next && J.current?.focus(), X(null));
155
- }, [Y, q]);
156
- let Z = (e) => {
157
- X({ next: e }), u === void 0 && B(e), p?.(e);
158
- }, te = S === "right" ? x : b, ne = S === "right" ? b : x, Q = () => V ?? K.current?.offsetWidth ?? 258, re = (e) => {
159
- e.button === 0 && (G.current = {
151
+ }, D = ({ title: n, actions: l, collapsed: u, defaultCollapsed: d, onCollapsedChange: p, collapseLabel: m, expandLabel: h, side: C = "left", collapsedMode: w = "hidden", resizable: D = !1, minWidth: O = 200, maxWidth: k = 420, "aria-label": A, labels: j, className: M, style: N, id: P, ...F }) => {
152
+ let I = e("contextPanel", E, j), ee = m ?? I.collapse, te = h ?? I.expand, L = A ?? I.region, [R, z] = b(d ?? !1), [B, V] = b(null), [H, U] = b(!1), W = y(null), G = y(null), K = s(u, R), q = y(null), [J, Y] = b(null);
153
+ v(() => {
154
+ J && (K === J.next && q.current?.focus(), Y(null));
155
+ }, [J, K]);
156
+ let X = (e) => {
157
+ Y({ next: e }), u === void 0 && z(e), p?.(e);
158
+ }, Z = C === "right" ? S : x, ne = C === "right" ? x : S, Q = () => B ?? G.current?.offsetWidth ?? 258, re = (e) => {
159
+ e.button === 0 && (W.current = {
160
160
  startX: e.clientX,
161
161
  startWidth: Q()
162
- }, e.currentTarget.setPointerCapture(e.pointerId), W(!0), e.preventDefault());
162
+ }, e.currentTarget.setPointerCapture(e.pointerId), U(!0), e.preventDefault());
163
163
  }, ie = (e) => {
164
- let t = G.current;
165
- t && H(a(S, t.startWidth, t.startX, e.clientX, D, O));
164
+ let t = W.current;
165
+ t && V(o(C, t.startWidth, t.startX, e.clientX, O, k));
166
166
  }, $ = (e) => {
167
- G.current = null, e.currentTarget.hasPointerCapture(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId), W(!1);
167
+ W.current = null, e.currentTarget.hasPointerCapture(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId), U(!1);
168
168
  }, ae = (e) => {
169
- let t = s(S, Q(), e.key, D, O);
170
- t !== null && (e.preventDefault(), H(t));
169
+ let t = c(C, Q(), e.key, O, k);
170
+ t !== null && (e.preventDefault(), V(t));
171
171
  };
172
- if (q) {
173
- let e = C === "mini";
172
+ if (K) {
173
+ let e = w === "mini";
174
174
  return /* @__PURE__ */ _("aside", {
175
- id: N,
176
- className: t(i({
177
- side: S,
175
+ id: P,
176
+ className: t(a({
177
+ side: C,
178
178
  collapsed: !0
179
- }), e && "is-mini kapi-navmini", j),
180
- style: M,
181
- "aria-label": R,
179
+ }), e && "is-mini kapi-navmini", M),
180
+ style: N,
181
+ "aria-label": L,
182
182
  children: [/* @__PURE__ */ g("button", {
183
- ref: J,
183
+ ref: q,
184
184
  type: "button",
185
185
  className: "kapi-paneltoggle",
186
- onClick: () => Z(!1),
187
- "aria-label": L,
186
+ onClick: () => X(!1),
187
+ "aria-label": te,
188
188
  children: /* @__PURE__ */ g(ne, {
189
189
  size: 16,
190
190
  strokeWidth: 2,
@@ -193,38 +193,38 @@ var C = ({ item: e, active: t, onSelect: n, newTabLabel: r }) => {
193
193
  }), e && /* @__PURE__ */ g(f.Provider, {
194
194
  value: {
195
195
  mini: !0,
196
- expand: () => Z(!1),
197
- tooltipSide: S === "right" ? "left" : "right"
196
+ expand: () => X(!1),
197
+ tooltipSide: C === "right" ? "left" : "right"
198
198
  },
199
- children: /* @__PURE__ */ g(w, {
200
- ...P,
201
- labels: A
199
+ children: /* @__PURE__ */ g(T, {
200
+ ...F,
201
+ labels: j
202
202
  })
203
203
  })]
204
204
  });
205
205
  }
206
206
  return /* @__PURE__ */ _("aside", {
207
- ref: K,
208
- id: N,
209
- className: t(i({
210
- side: S,
211
- resizing: U
212
- }), j),
213
- "aria-label": R,
214
- "data-resizable": E || void 0,
215
- style: E && V !== null ? {
216
- ...M,
217
- width: V
218
- } : M,
207
+ ref: G,
208
+ id: P,
209
+ className: t(a({
210
+ side: C,
211
+ resizing: H
212
+ }), M),
213
+ "aria-label": L,
214
+ "data-resizable": D || void 0,
215
+ style: D && B !== null ? {
216
+ ...N,
217
+ width: B
218
+ } : N,
219
219
  children: [
220
- E && /* @__PURE__ */ g("div", {
220
+ D && /* @__PURE__ */ g("div", {
221
221
  className: "kapi-ctxpanel__resize",
222
222
  role: "separator",
223
223
  "aria-orientation": "vertical",
224
- "aria-label": F.resize,
225
- "aria-valuemin": D,
226
- "aria-valuemax": O,
227
- "aria-valuenow": r(V ?? 258, D, O),
224
+ "aria-label": I.resize,
225
+ "aria-valuemin": O,
226
+ "aria-valuemax": k,
227
+ "aria-valuenow": i(B ?? 258, O, k),
228
228
  tabIndex: 0,
229
229
  onPointerDown: re,
230
230
  onPointerMove: ie,
@@ -234,19 +234,19 @@ var C = ({ item: e, active: t, onSelect: n, newTabLabel: r }) => {
234
234
  }),
235
235
  /* @__PURE__ */ _("div", {
236
236
  className: "kapi-ctxpanel__head",
237
- children: [/* @__PURE__ */ g("span", { children: c }), /* @__PURE__ */ _("div", {
237
+ children: [/* @__PURE__ */ g("span", { children: n }), /* @__PURE__ */ _("div", {
238
238
  className: "kapi-ctxpanel__actions",
239
- children: [l, n({
239
+ children: [l, r({
240
240
  collapsed: u,
241
241
  defaultCollapsed: d,
242
242
  onCollapsedChange: p
243
243
  }) && /* @__PURE__ */ g("button", {
244
- ref: J,
244
+ ref: q,
245
245
  type: "button",
246
246
  className: "kapi-paneltoggle",
247
- onClick: () => Z(!0),
248
- "aria-label": I,
249
- children: /* @__PURE__ */ g(te, {
247
+ onClick: () => X(!0),
248
+ "aria-label": ee,
249
+ children: /* @__PURE__ */ g(Z, {
250
250
  size: 16,
251
251
  strokeWidth: 2,
252
252
  "aria-hidden": "true"
@@ -254,12 +254,12 @@ var C = ({ item: e, active: t, onSelect: n, newTabLabel: r }) => {
254
254
  })]
255
255
  })]
256
256
  }),
257
- /* @__PURE__ */ g(w, {
258
- ...P,
259
- labels: A
257
+ /* @__PURE__ */ g(T, {
258
+ ...F,
259
+ labels: j
260
260
  })
261
261
  ]
262
262
  });
263
263
  };
264
264
  //#endregion
265
- export { T as DEFAULT_CONTEXT_PANEL_LABELS, E as KapiContextPanel, w as KapiContextSections };
265
+ export { E as DEFAULT_CONTEXT_PANEL_LABELS, D as KapiContextPanel, T as KapiContextSections };
@@ -1,11 +1,11 @@
1
1
  "use client";
2
2
  import { useLabels as e } from "../locale/KapiLocaleProvider.js";
3
- import { activeIdIn as t } from "./activeItemLogic.js";
4
- import { CtxSlidingList as n } from "./CtxSlidingList.js";
5
- /* empty css */
6
- import { DEFAULT_LINK_LABELS as r } from "../locale/linkLabels.js";
7
3
  import "./navBadgeLogic.js";
8
- import { KapiNavBadge as i } from "./KapiNavBadge.js";
4
+ import { KapiNavBadge as t } from "./KapiNavBadge.js";
5
+ import { activeIdIn as n } from "./activeItemLogic.js";
6
+ import { CtxSlidingList as r } from "./CtxSlidingList.js";
7
+ /* empty css */
8
+ import { DEFAULT_LINK_LABELS as i } from "../locale/linkLabels.js";
9
9
  import { useKapiPanelMini as a } from "./panelMini.js";
10
10
  import { MiniNavItem as o } from "./MiniNavItem.js";
11
11
  import { formatCount as s, panelGroupClasses as c, resolveOpen as l } from "./panelGroupLogic.js";
@@ -19,20 +19,20 @@ var g = ({ value: e }) => {
19
19
  className: "kapi-panelgroup__count",
20
20
  children: t
21
21
  });
22
- }, _ = ({ item: e, active: t, onSelect: n, newTabLabel: r }) => {
23
- let a = `kapi-ctxitem${t ? " kapi-ctxitem--on" : ""}`, o = /* @__PURE__ */ d("span", {
22
+ }, _ = ({ item: e, active: n, onSelect: r, newTabLabel: i }) => {
23
+ let a = `kapi-ctxitem${n ? " kapi-ctxitem--on" : ""}`, o = /* @__PURE__ */ d("span", {
24
24
  className: "kapi-ctxitem__main",
25
25
  children: [e.icon, e.label]
26
26
  });
27
27
  return e.href === void 0 ? /* @__PURE__ */ d("button", {
28
28
  type: "button",
29
29
  className: a,
30
- "aria-current": t ? "page" : void 0,
30
+ "aria-current": n ? "page" : void 0,
31
31
  disabled: e.disabled,
32
- onClick: () => n?.(e.id),
32
+ onClick: () => r?.(e.id),
33
33
  children: [
34
34
  o,
35
- /* @__PURE__ */ u(i, {
35
+ /* @__PURE__ */ u(t, {
36
36
  value: e.badge,
37
37
  tone: e.badgeTone,
38
38
  label: e.badgeLabel,
@@ -45,11 +45,11 @@ var g = ({ value: e }) => {
45
45
  href: e.disabled ? void 0 : e.href,
46
46
  rel: "noopener noreferrer",
47
47
  target: e.newTab ? "_blank" : void 0,
48
- "aria-current": t ? "page" : void 0,
48
+ "aria-current": n ? "page" : void 0,
49
49
  "aria-disabled": e.disabled || void 0,
50
50
  children: [
51
51
  o,
52
- /* @__PURE__ */ u(i, {
52
+ /* @__PURE__ */ u(t, {
53
53
  value: e.badge,
54
54
  tone: e.badgeTone,
55
55
  label: e.badgeLabel,
@@ -63,13 +63,13 @@ var g = ({ value: e }) => {
63
63
  }),
64
64
  e.newTab && /* @__PURE__ */ u("span", {
65
65
  className: "kapi-ctxitem__sr",
66
- children: r
66
+ children: i
67
67
  })
68
68
  ]
69
69
  });
70
70
  };
71
71
  function v({ label: s, count: h, badge: v, badgeTone: y, badgeLabel: b, icon: x, items: S, activeId: C, onSelect: w, open: T, defaultOpen: E = !1, onOpenChange: D, className: O, style: k, id: A, "aria-label": j, labels: M }) {
72
- let N = e("link", r, M), P = f(), F = `${P}-body`, I = `${P}-head`, [L, R] = p(E), z = l(T, L), B = (e) => {
72
+ let N = e("link", i, M), P = f(), F = `${P}-body`, I = `${P}-head`, [L, R] = p(E), z = l(T, L), B = (e) => {
73
73
  T === void 0 && R(e), D?.(e);
74
74
  }, V = () => B(!z), { mini: H, expand: U } = a();
75
75
  return H ? /* @__PURE__ */ u("div", {
@@ -82,7 +82,7 @@ function v({ label: s, count: h, badge: v, badgeTone: y, badgeLabel: b, icon: x,
82
82
  children: /* @__PURE__ */ u(o, {
83
83
  label: s,
84
84
  icon: x,
85
- active: t(S, C) !== null,
85
+ active: n(S, C) !== null,
86
86
  badge: v,
87
87
  badgeTone: y,
88
88
  badgeLabel: b,
@@ -109,7 +109,7 @@ function v({ label: s, count: h, badge: v, badgeTone: y, badgeLabel: b, icon: x,
109
109
  className: "kapi-panelgroup__label",
110
110
  children: [x, s]
111
111
  }),
112
- /* @__PURE__ */ u(i, {
112
+ /* @__PURE__ */ u(t, {
113
113
  value: v,
114
114
  tone: y,
115
115
  label: b,
@@ -132,8 +132,8 @@ function v({ label: s, count: h, badge: v, badgeTone: y, badgeLabel: b, icon: x,
132
132
  inert: !z,
133
133
  children: /* @__PURE__ */ u("div", {
134
134
  className: "kapi-panelgroup__clip",
135
- children: /* @__PURE__ */ u(n, {
136
- active: t(S, C),
135
+ children: /* @__PURE__ */ u(r, {
136
+ active: n(S, C),
137
137
  children: S.map((e) => /* @__PURE__ */ u(_, {
138
138
  item: e,
139
139
  active: e.id === C,
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { joinClasses as e } from "../rootProps.js";
3
3
  import { useSlidingIndicator as t } from "../../hooks/useSlidingIndicator.js";
4
- /* empty css */
5
4
  import { useScrollEdges as n } from "../../hooks/useScrollEdges.js";
5
+ /* empty css */
6
6
  import { nextTabId as r, tabClasses as i, tabId as a, tabPanelId as o } from "./tabsLogic.js";
7
7
  import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
8
8
  import { useCallback as u, useId as d, useLayoutEffect as f, useRef as p } from "react";
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import { joinClasses as e } from "../rootProps.js";
3
3
  import { KapiTooltip as t } from "../overlays/KapiTooltip.js";
4
- /* empty css */
5
4
  import { navBadgeA11yText as n } from "./navBadgeLogic.js";
6
5
  import { KapiNavBadge as r } from "./KapiNavBadge.js";
6
+ /* empty css */
7
7
  import { useKapiPanelMini as i } from "./panelMini.js";
8
8
  import { miniInitial as a, miniTooltipLabel as o, nodeText as s } from "./panelMiniLogic.js";
9
9
  import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
@@ -5,6 +5,13 @@ export declare const isoDateTime: (date: Date | string) => string | null;
5
5
  * devuelve "". Trunca en vez de redondear: 59,5 minutos es "hace 59 minutos", nunca "hace 60 minutos".
6
6
  */
7
7
  export declare const formatRelativeTime: (date: Date | string, now?: Date, locale?: string) => string;
8
+ /**
9
+ * Etiqueta de un día para separadores de un hilo, según el día local respecto de `now`: hoy y ayer salen de
10
+ * `Intl.RelativeTimeFormat` con `numeric: "auto"` ("hoy", "ayer"); de 2 a 6 días atrás, el nombre del día
11
+ * ("miércoles"); más viejo, día y mes ("12 de marzo") y, de otro año, día, mes y año. Una fecha inválida
12
+ * devuelve "".
13
+ */
14
+ export declare const formatDayLabel: (date: Date, now?: Date, locale?: string) => string;
8
15
  /**
9
16
  * Fecha absoluta con `Intl.DateTimeFormat` (default `{ dateStyle: "medium" }`: "12 mar 2026").
10
17
  * Acepta `Date` o string parseable; una fecha inválida devuelve "".