@kapiuara/ui 0.5.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.
- package/README.md +54 -1
- package/dist/components/chat/KapiChatDivider.d.ts +15 -0
- package/dist/components/chat/KapiChatDivider.js +17 -0
- package/dist/components/chat/KapiChatList.d.ts +57 -0
- package/dist/components/chat/KapiChatList.js +71 -0
- package/dist/components/chat/KapiChatThread.d.ts +35 -0
- package/dist/components/chat/KapiChatThread.js +85 -0
- package/dist/components/chat/KapiComposer.d.ts +60 -0
- package/dist/components/chat/KapiComposer.js +89 -0
- package/dist/components/chat/KapiMessageBubble.d.ts +43 -0
- package/dist/components/chat/KapiMessageBubble.js +67 -0
- package/dist/components/chat/KapiTypingIndicator.d.ts +27 -0
- package/dist/components/chat/KapiTypingIndicator.js +34 -0
- package/dist/components/chat/chatLogic.d.ts +76 -0
- package/dist/components/chat/chatLogic.js +34 -0
- package/dist/components/chat/index.d.ts +14 -0
- package/dist/components/display/KapiCommentComposer.d.ts +4 -0
- package/dist/components/display/KapiCommentComposer.js +43 -46
- package/dist/components/display/commentLogic.d.ts +9 -2
- package/dist/components/display/commentLogic.js +1 -1
- package/dist/components/display/index.d.ts +1 -0
- package/dist/components/layout/KapiPanelParts.js +9 -9
- package/dist/components/layout/KapiRail.js +8 -8
- package/dist/components/locale/labelRegistry.d.ts +10 -0
- package/dist/components/navigation/KapiContextPanel.js +86 -86
- package/dist/components/navigation/KapiPanelGroup.js +18 -18
- package/dist/components/navigation/KapiTabs.js +1 -1
- package/dist/components/navigation/MiniNavItem.js +1 -1
- package/dist/hooks/dateFormat.d.ts +7 -0
- package/dist/hooks/dateFormat.js +16 -2
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/useSubmitDraft.d.ts +34 -0
- package/dist/hooks/useSubmitDraft.js +28 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +83 -76
- package/dist/kapi.css +1 -1
- package/dist/kapi.layered.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useLabels as e } from "../locale/KapiLocaleProvider.js";
|
|
3
|
+
import { joinClasses as t } from "../rootProps.js";
|
|
4
|
+
import { typingText as n } from "./chatLogic.js";
|
|
5
|
+
/* empty css */
|
|
6
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/chat/KapiTypingIndicator.tsx
|
|
8
|
+
var a = {
|
|
9
|
+
one: "{name} está escribiendo…",
|
|
10
|
+
many: "{count} personas están escribiendo…",
|
|
11
|
+
someone: "Alguien está escribiendo…"
|
|
12
|
+
}, o = ({ names: o, labels: s, ref: c, className: l, ...u }) => {
|
|
13
|
+
let d = e("typingIndicator", a, s), f = n(o, d);
|
|
14
|
+
return f === null ? null : /* @__PURE__ */ i("div", {
|
|
15
|
+
"aria-live": "polite",
|
|
16
|
+
...u,
|
|
17
|
+
ref: c,
|
|
18
|
+
className: t("kapi-typing", l),
|
|
19
|
+
children: [/* @__PURE__ */ i("span", {
|
|
20
|
+
className: "kapi-typing__dots",
|
|
21
|
+
"aria-hidden": "true",
|
|
22
|
+
children: [
|
|
23
|
+
/* @__PURE__ */ r("span", { className: "kapi-typing__dot" }),
|
|
24
|
+
/* @__PURE__ */ r("span", { className: "kapi-typing__dot" }),
|
|
25
|
+
/* @__PURE__ */ r("span", { className: "kapi-typing__dot" })
|
|
26
|
+
]
|
|
27
|
+
}), /* @__PURE__ */ r("span", {
|
|
28
|
+
className: "kapi-typing__text",
|
|
29
|
+
children: f
|
|
30
|
+
})]
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
//#endregion
|
|
34
|
+
export { a as DEFAULT_TYPING_INDICATOR_LABELS, o as KapiTypingIndicator };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/** Estado de entrega de un mensaje propio. */
|
|
2
|
+
export type KapiChatStatus = "sending" | "sent" | "delivered" | "read" | "failed";
|
|
3
|
+
/** Mínimo que necesita la lógica de un mensaje; el consumidor lo extiende con su contenido. */
|
|
4
|
+
export type KapiChatMessage<Id extends string = string> = {
|
|
5
|
+
/** Identificador estable del mensaje; también es su `key`. */
|
|
6
|
+
id: Id;
|
|
7
|
+
/** Quién lo escribió; se compara con `meId` para saber si es saliente. */
|
|
8
|
+
authorId: string;
|
|
9
|
+
/** Momento en que se envió. */
|
|
10
|
+
at: Date;
|
|
11
|
+
/** Estado de entrega (solo tiene sentido en mensajes salientes). */
|
|
12
|
+
status?: KapiChatStatus | undefined;
|
|
13
|
+
};
|
|
14
|
+
/** Posición de un mensaje dentro de una corrida del mismo autor. */
|
|
15
|
+
export type KapiChatGrouping = "single" | "first" | "middle" | "last";
|
|
16
|
+
/** Un renglón del hilo: separador de día, marcador de no leídos o mensaje. */
|
|
17
|
+
export type KapiChatEntry<Id extends string = string, M extends KapiChatMessage<Id> = KapiChatMessage<Id>> = {
|
|
18
|
+
kind: "day";
|
|
19
|
+
key: string;
|
|
20
|
+
at: Date;
|
|
21
|
+
} | {
|
|
22
|
+
kind: "unread";
|
|
23
|
+
key: string;
|
|
24
|
+
count: number;
|
|
25
|
+
} | {
|
|
26
|
+
kind: "message";
|
|
27
|
+
key: string;
|
|
28
|
+
message: M;
|
|
29
|
+
outgoing: boolean;
|
|
30
|
+
grouping: KapiChatGrouping;
|
|
31
|
+
};
|
|
32
|
+
/** Opciones de `groupChatMessages`. */
|
|
33
|
+
export type KapiChatGroupOptions<Id extends string = string> = {
|
|
34
|
+
/** Id del usuario actual: sus mensajes son salientes. */
|
|
35
|
+
meId: string;
|
|
36
|
+
/** Hueco máximo, en milisegundos, para agrupar dos mensajes seguidos del mismo autor. @default 300000 */
|
|
37
|
+
groupGapMs?: number | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Id del primer mensaje no leído; antes de él se emite el marcador de no leídos. Va en `NoInfer`
|
|
40
|
+
* para que `Id` salga sólo de los mensajes: si participara de la inferencia, pasarle un literal
|
|
41
|
+
* (`"m7"`) lo ancla a ese literal y obliga al consumidor a escribir el argumento de tipo a mano.
|
|
42
|
+
*/
|
|
43
|
+
firstUnreadId?: NoInfer<Id> | null | undefined;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Convierte los mensajes en los renglones del hilo: separadores de día, marcador de no leídos y mensajes
|
|
47
|
+
* con su posición dentro de la corrida del mismo autor. Espera los mensajes en orden cronológico
|
|
48
|
+
* ascendente y NO los ordena.
|
|
49
|
+
*
|
|
50
|
+
* Un mensaje se agrupa con el anterior solo si tiene el mismo autor, no hay entre ellos un separador de
|
|
51
|
+
* día ni el marcador de no leídos, y los separan como mucho `groupGapMs`. El `count` del marcador son los
|
|
52
|
+
* mensajes entrantes desde `firstUnreadId` (inclusive) hasta el final; si ese id no está, no hay marcador.
|
|
53
|
+
*/
|
|
54
|
+
export declare const groupChatMessages: <Id extends string, M extends KapiChatMessage<Id>>(messages: readonly M[], options: KapiChatGroupOptions<Id>) => KapiChatEntry<Id, M>[];
|
|
55
|
+
/**
|
|
56
|
+
* Si el usuario está al fondo, un mensaje nuevo lo sigue. Si subió a leer algo viejo NO se le mueve el
|
|
57
|
+
* scroll (se le avisa con la píldora); pero un mensaje propio siempre baja, porque lo acaba de enviar.
|
|
58
|
+
* Saber si está al fondo no se calcula acá: sale de `useScrollEdges` (`edges.end === false` es "al fondo").
|
|
59
|
+
*/
|
|
60
|
+
export declare const shouldFollowBottom: (state: {
|
|
61
|
+
atBottom: boolean;
|
|
62
|
+
outgoing: boolean;
|
|
63
|
+
}) => boolean;
|
|
64
|
+
/** Textos que necesita `typingText`; estructuralmente son los de `KapiTypingIndicatorLabels`. */
|
|
65
|
+
type TypingTextLabels = {
|
|
66
|
+
one: string;
|
|
67
|
+
many: string;
|
|
68
|
+
someone: string;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Texto del indicador de escritura, o `null` si no escribe nadie. Una persona con nombre usa `one`
|
|
72
|
+
* (`{name}`); dos o más usan `many` (`{count}` con la cantidad de personas); un nombre vacío o de solo
|
|
73
|
+
* espacios es una persona sin nombre y usa `someone`.
|
|
74
|
+
*/
|
|
75
|
+
export declare const typingText: (names: readonly string[] | undefined, labels: TypingTextLabels) => string | null;
|
|
76
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//#region src/components/chat/chatLogic.ts
|
|
2
|
+
var e = (e) => String(e).padStart(2, "0"), t = (t) => `${t.getFullYear()}-${e(t.getMonth() + 1)}-${e(t.getDate())}`, n = (e, n) => {
|
|
3
|
+
let { meId: r, groupGapMs: i = 3e5, firstUnreadId: a = null } = n, o = [], s = a === null ? -1 : e.findIndex((e) => e.id === a), c = s < 0 ? 0 : e.slice(s).filter((e) => e.authorId !== r).length, l = [], u = () => {
|
|
4
|
+
l.forEach((e, t) => {
|
|
5
|
+
let n = o[e];
|
|
6
|
+
n?.kind === "message" && (n.grouping = l.length === 1 ? "single" : t === 0 ? "first" : t === l.length - 1 ? "last" : "middle");
|
|
7
|
+
}), l = [];
|
|
8
|
+
}, d;
|
|
9
|
+
return e.forEach((e, n) => {
|
|
10
|
+
let a = d === void 0 || t(d.at) !== t(e.at), f = n === s;
|
|
11
|
+
a && o.push({
|
|
12
|
+
kind: "day",
|
|
13
|
+
key: t(e.at),
|
|
14
|
+
at: e.at
|
|
15
|
+
}), f && o.push({
|
|
16
|
+
kind: "unread",
|
|
17
|
+
key: "unread",
|
|
18
|
+
count: c
|
|
19
|
+
}), d !== void 0 && !a && !f && d.authorId === e.authorId && e.at.getTime() - d.at.getTime() <= i || u(), l.push(o.length), o.push({
|
|
20
|
+
kind: "message",
|
|
21
|
+
key: e.id,
|
|
22
|
+
message: e,
|
|
23
|
+
outgoing: e.authorId === r,
|
|
24
|
+
grouping: "single"
|
|
25
|
+
}), d = e;
|
|
26
|
+
}), u(), o;
|
|
27
|
+
}, r = (e) => e.atBottom || e.outgoing, i = (e, t) => {
|
|
28
|
+
if (e === void 0 || e.length === 0) return null;
|
|
29
|
+
if (e.length > 1) return t.many.replaceAll("{count}", () => String(e.length));
|
|
30
|
+
let n = (e[0] ?? "").trim();
|
|
31
|
+
return n === "" ? t.someone : t.one.replaceAll("{name}", () => n);
|
|
32
|
+
};
|
|
33
|
+
//#endregion
|
|
34
|
+
export { n as groupChatMessages, r as shouldFollowBottom, i as typingText };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { groupChatMessages, shouldFollowBottom, typingText } from "./chatLogic";
|
|
2
|
+
export { KapiChatDivider } from "./KapiChatDivider";
|
|
3
|
+
export { DEFAULT_CHAT_LIST_LABELS, KapiChatList } from "./KapiChatList";
|
|
4
|
+
export { DEFAULT_COMPOSER_LABELS, KapiComposer } from "./KapiComposer";
|
|
5
|
+
export { DEFAULT_CHAT_THREAD_LABELS, KapiChatThread } from "./KapiChatThread";
|
|
6
|
+
export { DEFAULT_MESSAGE_BUBBLE_LABELS, KapiMessageBubble } from "./KapiMessageBubble";
|
|
7
|
+
export { DEFAULT_TYPING_INDICATOR_LABELS, KapiTypingIndicator } from "./KapiTypingIndicator";
|
|
8
|
+
export type { KapiChatEntry, KapiChatGroupOptions, KapiChatGrouping, KapiChatMessage, KapiChatStatus } from "./chatLogic";
|
|
9
|
+
export type { KapiChatDividerProps, KapiChatDividerTone } from "./KapiChatDivider";
|
|
10
|
+
export type { KapiChatConversation, KapiChatListLabels, KapiChatListProps } from "./KapiChatList";
|
|
11
|
+
export type { KapiChatThreadLabels, KapiChatThreadProps } from "./KapiChatThread";
|
|
12
|
+
export type { KapiComposerLabels, KapiComposerProps } from "./KapiComposer";
|
|
13
|
+
export type { KapiMessageBubbleLabels, KapiMessageBubbleProps } from "./KapiMessageBubble";
|
|
14
|
+
export type { KapiTypingIndicatorLabels, KapiTypingIndicatorProps } from "./KapiTypingIndicator";
|
|
@@ -45,5 +45,9 @@ export type KapiCommentComposerProps = Omit<TextareaHTMLAttributes<HTMLTextAreaE
|
|
|
45
45
|
/** Ref al `<textarea>`. */
|
|
46
46
|
ref?: Ref<HTMLTextAreaElement>;
|
|
47
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* Compositor de comentarios: textarea que crece con el texto + botón de envío. Ctrl/Cmd+Enter envía,
|
|
50
|
+
* Enter solo hace salto de línea; el botón queda deshabilitado mientras no haya texto.
|
|
51
|
+
*/
|
|
48
52
|
export declare const KapiCommentComposer: ({ value: valueProp, defaultValue, onChange, onSubmit, loading, invalid, required, disabled, className, style, labels, ref, placeholder, onKeyDown, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, ...rest }: KapiCommentComposerProps) => import("react").JSX.Element;
|
|
49
53
|
export {};
|
|
@@ -6,71 +6,68 @@ import { useLabels as i } from "../locale/KapiLocaleProvider.js";
|
|
|
6
6
|
import { joinClasses as a } from "../rootProps.js";
|
|
7
7
|
import { KapiTextarea as o } from "../inputs/KapiTextarea.js";
|
|
8
8
|
/* empty css */
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
9
|
+
import { isSubmitShortcut as s } from "./commentLogic.js";
|
|
10
|
+
import { useSubmitDraft as c } from "../../hooks/useSubmitDraft.js";
|
|
11
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
12
|
+
import { useId as d } from "react";
|
|
12
13
|
//#region src/components/display/KapiCommentComposer.tsx
|
|
13
|
-
var
|
|
14
|
+
var f = {
|
|
14
15
|
label: "Comentario",
|
|
15
16
|
placeholder: "Escribe un comentario…",
|
|
16
17
|
submit: "Comentar",
|
|
17
18
|
shortcut: "Ctrl o ⌘ + Enter para enviar"
|
|
18
|
-
},
|
|
19
|
-
let
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
_ === void 0 && R((t) => c(t, e));
|
|
29
|
-
}, (e) => console.error(e)).finally(() => U(!1))) : _ === void 0 && R("");
|
|
30
|
-
}, J = (e) => {
|
|
31
|
-
A?.(e), !e.defaultPrevented && l({
|
|
19
|
+
}, p = ({ value: p, defaultValue: m, onChange: h, onSubmit: g, loading: _ = !1, invalid: v, required: y, disabled: b, className: x, style: S, labels: C, ref: w, placeholder: T, onKeyDown: E, "aria-label": D, "aria-labelledby": O, "aria-describedby": k, ...A }) => {
|
|
20
|
+
let j = i("commentComposer", f, C), M = r(), N = d(), { text: P, setText: F, submit: I, busy: L, canSubmit: R, boxRef: z } = c({
|
|
21
|
+
value: p,
|
|
22
|
+
defaultValue: m,
|
|
23
|
+
onChange: h,
|
|
24
|
+
onSubmit: g,
|
|
25
|
+
disabled: b,
|
|
26
|
+
loading: _
|
|
27
|
+
}), B = (e) => {
|
|
28
|
+
E?.(e), !e.defaultPrevented && s({
|
|
32
29
|
...e,
|
|
33
30
|
isComposing: e.nativeEvent.isComposing
|
|
34
|
-
}) && (e.preventDefault(),
|
|
35
|
-
},
|
|
36
|
-
return /* @__PURE__ */
|
|
37
|
-
className: a("kapi-composer",
|
|
38
|
-
style:
|
|
39
|
-
children: [/* @__PURE__ */
|
|
40
|
-
...
|
|
31
|
+
}) && (e.preventDefault(), I());
|
|
32
|
+
}, V = D !== void 0 || O !== void 0 || M !== null;
|
|
33
|
+
return /* @__PURE__ */ u("div", {
|
|
34
|
+
className: a("kapi-composer", x),
|
|
35
|
+
style: S,
|
|
36
|
+
children: [/* @__PURE__ */ l(o, {
|
|
37
|
+
...A,
|
|
41
38
|
ref: (e) => {
|
|
42
|
-
|
|
39
|
+
z.current = e, t(w, e);
|
|
43
40
|
},
|
|
44
41
|
className: "kapi-composer__input",
|
|
45
42
|
autosize: !0,
|
|
46
43
|
maxRows: 8,
|
|
47
44
|
rows: 2,
|
|
48
|
-
value:
|
|
49
|
-
disabled:
|
|
50
|
-
placeholder:
|
|
51
|
-
"aria-label":
|
|
52
|
-
"aria-labelledby":
|
|
53
|
-
"aria-describedby": n(
|
|
54
|
-
...
|
|
55
|
-
...
|
|
56
|
-
onChange: (e) =>
|
|
57
|
-
onKeyDown:
|
|
58
|
-
}), /* @__PURE__ */
|
|
45
|
+
value: P,
|
|
46
|
+
disabled: b,
|
|
47
|
+
placeholder: T ?? j.placeholder,
|
|
48
|
+
"aria-label": V ? D : j.label,
|
|
49
|
+
"aria-labelledby": O,
|
|
50
|
+
"aria-describedby": n(k, N),
|
|
51
|
+
...y === void 0 ? {} : { required: y },
|
|
52
|
+
...v ? { status: "err" } : {},
|
|
53
|
+
onChange: (e) => F(e.target.value),
|
|
54
|
+
onKeyDown: B
|
|
55
|
+
}), /* @__PURE__ */ u("div", {
|
|
59
56
|
className: "kapi-composer__foot",
|
|
60
|
-
children: [/* @__PURE__ */
|
|
61
|
-
id:
|
|
57
|
+
children: [/* @__PURE__ */ l("span", {
|
|
58
|
+
id: N,
|
|
62
59
|
className: "kapi-composer__hint",
|
|
63
|
-
children:
|
|
64
|
-
}), /* @__PURE__ */
|
|
60
|
+
children: j.shortcut
|
|
61
|
+
}), /* @__PURE__ */ l(e, {
|
|
65
62
|
variant: "primary",
|
|
66
63
|
size: "sm",
|
|
67
|
-
disabled: !
|
|
68
|
-
"aria-busy":
|
|
69
|
-
onClick:
|
|
70
|
-
children:
|
|
64
|
+
disabled: !R,
|
|
65
|
+
"aria-busy": L || void 0,
|
|
66
|
+
onClick: I,
|
|
67
|
+
children: j.submit
|
|
71
68
|
})]
|
|
72
69
|
})]
|
|
73
70
|
});
|
|
74
71
|
};
|
|
75
72
|
//#endregion
|
|
76
|
-
export {
|
|
73
|
+
export { f as DEFAULT_COMMENT_COMPOSER_LABELS, p as KapiCommentComposer };
|
|
@@ -3,13 +3,20 @@ export declare const canSubmitComment: (text: string, { disabled, loading }?: {
|
|
|
3
3
|
disabled?: boolean | undefined;
|
|
4
4
|
loading?: boolean | undefined;
|
|
5
5
|
}) => boolean;
|
|
6
|
-
/** Ctrl+Enter o
|
|
6
|
+
/** Atajo que envía: `"modifier"` (Ctrl/Cmd+Enter) o `"enter"` (Enter solo). */
|
|
7
|
+
export type KapiSubmitShortcut = "modifier" | "enter";
|
|
8
|
+
/**
|
|
9
|
+
* Decide si una tecla envía. Con `"modifier"` (default) envían Ctrl+Enter y Cmd+Enter, y Enter solo es
|
|
10
|
+
* salto de línea. Con `"enter"` envía Enter; Shift+Enter, Ctrl+Enter y Cmd+Enter son salto de línea.
|
|
11
|
+
* En ambos modos, nunca en medio de una composición (IME).
|
|
12
|
+
*/
|
|
7
13
|
export declare const isSubmitShortcut: (e: {
|
|
8
14
|
key: string;
|
|
9
15
|
ctrlKey: boolean;
|
|
10
16
|
metaKey: boolean;
|
|
17
|
+
shiftKey?: boolean | undefined;
|
|
11
18
|
isComposing?: boolean | undefined;
|
|
12
|
-
}) => boolean;
|
|
19
|
+
}, mode?: KapiSubmitShortcut) => boolean;
|
|
13
20
|
/**
|
|
14
21
|
* Borrador que queda después de un envío que resolvió: lo enviado se quita del principio (lo escrito
|
|
15
22
|
* mientras el envío corría se conserva, sin repetir lo que ya se publicó); si el borrador cambió de otra
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/components/display/commentLogic.ts
|
|
2
|
-
var e = (e, { disabled: t = !1, loading: n = !1 } = {}) => !t && !n && e.trim().length > 0, t = (e) => e.key
|
|
2
|
+
var e = (e, { disabled: t = !1, loading: n = !1 } = {}) => !t && !n && e.trim().length > 0, t = (e, t = "modifier") => e.key !== "Enter" || e.isComposing ? !1 : t === "enter" ? !e.ctrlKey && !e.metaKey && !e.shiftKey : e.ctrlKey || e.metaKey, n = (e, t) => {
|
|
3
3
|
let n = e.trimStart(), r = n.slice(t.length);
|
|
4
4
|
return !n.startsWith(t) || /^[\p{L}\p{N}]/u.test(r) ? e : r.trimStart();
|
|
5
5
|
};
|
|
@@ -38,3 +38,4 @@ export type { KapiCommentProps } from "./KapiComment";
|
|
|
38
38
|
export { KapiCommentComposer, DEFAULT_COMMENT_COMPOSER_LABELS } from "./KapiCommentComposer";
|
|
39
39
|
export type { KapiCommentComposerLabels, KapiCommentComposerProps } from "./KapiCommentComposer";
|
|
40
40
|
export { canSubmitComment, isSubmitShortcut } from "./commentLogic";
|
|
41
|
+
export type { KapiSubmitShortcut } from "./commentLogic";
|
|
@@ -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
|
|
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, ...
|
|
21
|
-
...
|
|
20
|
+
}), u = ({ children: e, ...t }) => /* @__PURE__ */ a(n, {
|
|
21
|
+
...t,
|
|
22
22
|
children: e
|
|
23
|
-
}), d = ({ active:
|
|
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:
|
|
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",
|
|
39
|
-
"aria-current":
|
|
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(
|
|
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 {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
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",
|
|
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:
|
|
20
|
-
let g = _ === e, y = g ? "page" : void 0, b =
|
|
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 =
|
|
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:
|
|
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;
|