@shane_donnelly/dsi-internal-react-utils 1.0.0 → 1.2.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/dist/{InputBar-CxSc2du6.js → InputBar-CVy2_QtC.js} +65 -64
- package/dist/SessionContainer-DfTD7hX3.js +50 -0
- package/dist/chatbot/InputBar/index.d.ts +1 -0
- package/dist/chatbot/InputBar/index.js +3 -2
- package/dist/chatbot/InputBar/plusSlotStore.d.ts +5 -0
- package/dist/chatbot/InputBar/plusSlotStore.js +13 -0
- package/dist/chatbot/InputBar/usePlusSlot.d.ts +19 -0
- package/dist/chatbot/InputBar/usePlusSlot.js +7 -0
- package/dist/chatbot/SessionContainer/index.d.ts +18 -3
- package/dist/chatbot/SessionContainer/index.js +1 -1
- package/dist/chatbot/index.d.ts +1 -1
- package/dist/chatbot/index.js +4 -3
- package/dist/main.d.ts +1 -1
- package/dist/main.js +4 -3
- package/package.json +1 -1
- package/dist/SessionContainer-RrzUh_no.js +0 -50
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { useTheme as e } from "./chatbot/theme/useTheme.js";
|
|
2
2
|
import { t } from "./iconBase-CDbPVA4E.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { getPlusOpen as n, setPlusOpen as r, subscribePlusOpen as i } from "./chatbot/InputBar/plusSlotStore.js";
|
|
4
|
+
import { useEffect as a, useRef as o, useState as s } from "react";
|
|
5
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
5
6
|
//#region node_modules/react-icons/fi/index.mjs
|
|
6
|
-
function
|
|
7
|
+
function u(e) {
|
|
7
8
|
return t({
|
|
8
9
|
tag: "svg",
|
|
9
10
|
attr: {
|
|
@@ -30,7 +31,7 @@ function s(e) {
|
|
|
30
31
|
}]
|
|
31
32
|
})(e);
|
|
32
33
|
}
|
|
33
|
-
function
|
|
34
|
+
function d(e) {
|
|
34
35
|
return t({
|
|
35
36
|
tag: "svg",
|
|
36
37
|
attr: {
|
|
@@ -64,7 +65,7 @@ function c(e) {
|
|
|
64
65
|
}
|
|
65
66
|
//#endregion
|
|
66
67
|
//#region node_modules/react-icons/fa/index.mjs
|
|
67
|
-
function
|
|
68
|
+
function f(e) {
|
|
68
69
|
return t({
|
|
69
70
|
tag: "svg",
|
|
70
71
|
attr: { viewBox: "0 0 448 512" },
|
|
@@ -77,7 +78,7 @@ function l(e) {
|
|
|
77
78
|
}
|
|
78
79
|
//#endregion
|
|
79
80
|
//#region node_modules/react-icons/ri/index.mjs
|
|
80
|
-
function
|
|
81
|
+
function p(e) {
|
|
81
82
|
return t({
|
|
82
83
|
tag: "svg",
|
|
83
84
|
attr: {
|
|
@@ -93,7 +94,7 @@ function u(e) {
|
|
|
93
94
|
}
|
|
94
95
|
//#endregion
|
|
95
96
|
//#region lib/chatbot/InputBar/styles.module.css
|
|
96
|
-
var
|
|
97
|
+
var m = {
|
|
97
98
|
"dsi-inputbar": "_dsi-inputbar_1ngbl_2",
|
|
98
99
|
"dsi-inputbar-upper-slot": "_dsi-inputbar-upper-slot_1ngbl_12",
|
|
99
100
|
"dsi-inputbar-plus-slot": "_dsi-inputbar-plus-slot_1ngbl_23",
|
|
@@ -106,91 +107,91 @@ var d = {
|
|
|
106
107
|
};
|
|
107
108
|
//#endregion
|
|
108
109
|
//#region lib/chatbot/InputBar/index.tsx
|
|
109
|
-
function
|
|
110
|
+
function h({ type: e }) {
|
|
110
111
|
switch (e) {
|
|
111
|
-
case "send": return /* @__PURE__ */
|
|
112
|
-
case "stop": return /* @__PURE__ */
|
|
113
|
-
case "vocal": return /* @__PURE__ */
|
|
112
|
+
case "send": return /* @__PURE__ */ c(u, {});
|
|
113
|
+
case "stop": return /* @__PURE__ */ c(f, {});
|
|
114
|
+
case "vocal": return /* @__PURE__ */ c(p, {});
|
|
114
115
|
default: return null;
|
|
115
116
|
}
|
|
116
117
|
}
|
|
117
|
-
function
|
|
118
|
-
let
|
|
119
|
-
|
|
120
|
-
let e =
|
|
118
|
+
function g({ value: t, onChange: u, placeholder: f = "Placeholder", actionButtonType: p = "send", actionButtonEnabled: g = !0, onActionButtonClick: _, plusSlot: v, upperSlot: y, messageHistory: b }) {
|
|
119
|
+
let x = e(), [S, C] = s(n), w = o(null), T = o(null), E = o(null), D = o(-1);
|
|
120
|
+
a(() => i((e) => C(e)), []), a(() => {
|
|
121
|
+
let e = w.current;
|
|
121
122
|
e && (e.style.height = "auto", e.style.height = `${e.scrollHeight}px`);
|
|
122
|
-
}, [t]),
|
|
123
|
-
if (!
|
|
123
|
+
}, [t]), a(() => {
|
|
124
|
+
if (!S) return;
|
|
124
125
|
let e = (e) => {
|
|
125
|
-
!
|
|
126
|
+
!T.current?.contains(e.target) && !E.current?.contains(e.target) && r(!1);
|
|
126
127
|
};
|
|
127
128
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
128
|
-
}, [
|
|
129
|
-
let
|
|
130
|
-
"--dsi-border":
|
|
131
|
-
"--dsi-input-bg":
|
|
132
|
-
"--dsi-accent":
|
|
133
|
-
"--dsi-text-primary":
|
|
134
|
-
"--dsi-text-secondary":
|
|
135
|
-
"--dsi-button-bg":
|
|
136
|
-
"--dsi-button-hover-bg":
|
|
137
|
-
"--dsi-action-btn-bg":
|
|
138
|
-
"--dsi-action-btn-hover-bg":
|
|
139
|
-
"--dsi-action-btn-icon":
|
|
129
|
+
}, [S]);
|
|
130
|
+
let O = {
|
|
131
|
+
"--dsi-border": x.border,
|
|
132
|
+
"--dsi-input-bg": x.inputBg,
|
|
133
|
+
"--dsi-accent": x.accent,
|
|
134
|
+
"--dsi-text-primary": x.textPrimary,
|
|
135
|
+
"--dsi-text-secondary": x.textSecondary,
|
|
136
|
+
"--dsi-button-bg": x.buttonBg,
|
|
137
|
+
"--dsi-button-hover-bg": x.buttonHoverBg,
|
|
138
|
+
"--dsi-action-btn-bg": x.actionButtonBg,
|
|
139
|
+
"--dsi-action-btn-hover-bg": x.actionButtonHoverBg,
|
|
140
|
+
"--dsi-action-btn-icon": x.actionButtonIcon
|
|
140
141
|
};
|
|
141
|
-
return /* @__PURE__ */
|
|
142
|
-
className:
|
|
143
|
-
style:
|
|
142
|
+
return /* @__PURE__ */ l("div", {
|
|
143
|
+
className: m["dsi-inputbar"],
|
|
144
|
+
style: O,
|
|
144
145
|
children: [
|
|
145
|
-
|
|
146
|
-
className:
|
|
147
|
-
ref:
|
|
148
|
-
children:
|
|
146
|
+
S && v && /* @__PURE__ */ c("div", {
|
|
147
|
+
className: m["dsi-inputbar-plus-slot"],
|
|
148
|
+
ref: T,
|
|
149
|
+
children: v
|
|
149
150
|
}),
|
|
150
|
-
|
|
151
|
-
className:
|
|
152
|
-
children:
|
|
151
|
+
y && /* @__PURE__ */ c("div", {
|
|
152
|
+
className: m["dsi-inputbar-upper-slot"],
|
|
153
|
+
children: y
|
|
153
154
|
}),
|
|
154
|
-
/* @__PURE__ */
|
|
155
|
-
className: `${
|
|
155
|
+
/* @__PURE__ */ l("div", {
|
|
156
|
+
className: `${m["dsi-inputbar-row"]} ${y ? m["dsi-inputbar-row--with-upper"] : ""}`,
|
|
156
157
|
children: [
|
|
157
|
-
/* @__PURE__ */
|
|
158
|
-
ref:
|
|
159
|
-
className: `${
|
|
160
|
-
onClick: () =>
|
|
158
|
+
/* @__PURE__ */ c("button", {
|
|
159
|
+
ref: E,
|
|
160
|
+
className: `${m["dsi-inputbar-plus-btn"]} ${S ? m["dsi-inputbar-plus-btn--open"] : ""}`,
|
|
161
|
+
onClick: () => r(!S),
|
|
161
162
|
"aria-label": "Options",
|
|
162
163
|
type: "button",
|
|
163
|
-
children: /* @__PURE__ */
|
|
164
|
+
children: /* @__PURE__ */ c(d, {})
|
|
164
165
|
}),
|
|
165
|
-
/* @__PURE__ */
|
|
166
|
-
ref:
|
|
167
|
-
className:
|
|
166
|
+
/* @__PURE__ */ c("textarea", {
|
|
167
|
+
ref: w,
|
|
168
|
+
className: m["dsi-inputbar-textarea"],
|
|
168
169
|
value: t,
|
|
169
170
|
onChange: (e) => {
|
|
170
|
-
|
|
171
|
+
D.current = -1, u(e.target.value);
|
|
171
172
|
},
|
|
172
|
-
placeholder:
|
|
173
|
+
placeholder: f,
|
|
173
174
|
rows: 1,
|
|
174
175
|
onKeyDown: (e) => {
|
|
175
|
-
let n =
|
|
176
|
+
let n = b ?? [];
|
|
176
177
|
if (e.key === "ArrowUp" && !e.shiftKey) {
|
|
177
|
-
t === "" &&
|
|
178
|
+
t === "" && D.current === -1 && n.length > 0 ? (D.current = n.length - 1, u(n[D.current]), e.preventDefault()) : D.current > 0 ? (D.current--, u(n[D.current]), e.preventDefault()) : D.current === 0 && e.preventDefault();
|
|
178
179
|
return;
|
|
179
180
|
}
|
|
180
|
-
if (e.key === "ArrowDown" &&
|
|
181
|
-
|
|
181
|
+
if (e.key === "ArrowDown" && D.current !== -1) {
|
|
182
|
+
D.current < n.length - 1 ? (D.current++, u(n[D.current])) : (D.current = -1, u("")), e.preventDefault();
|
|
182
183
|
return;
|
|
183
184
|
}
|
|
184
|
-
e.key === "Enter" && !e.shiftKey && (e.preventDefault(),
|
|
185
|
+
e.key === "Enter" && !e.shiftKey && (e.preventDefault(), D.current = -1, g && p !== "none" && _?.(p));
|
|
185
186
|
}
|
|
186
187
|
}),
|
|
187
|
-
|
|
188
|
-
className:
|
|
189
|
-
disabled: !
|
|
190
|
-
onClick: () =>
|
|
191
|
-
"aria-label":
|
|
188
|
+
p !== "none" && /* @__PURE__ */ c("button", {
|
|
189
|
+
className: m["dsi-inputbar-action-btn"],
|
|
190
|
+
disabled: !g,
|
|
191
|
+
onClick: () => _?.(p),
|
|
192
|
+
"aria-label": p,
|
|
192
193
|
type: "button",
|
|
193
|
-
children: /* @__PURE__ */
|
|
194
|
+
children: /* @__PURE__ */ c(h, { type: p })
|
|
194
195
|
})
|
|
195
196
|
]
|
|
196
197
|
})
|
|
@@ -198,4 +199,4 @@ function p({ value: t, onChange: s, placeholder: l = "Envoyer un message…", ac
|
|
|
198
199
|
});
|
|
199
200
|
}
|
|
200
201
|
//#endregion
|
|
201
|
-
export {
|
|
202
|
+
export { g as t };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { useTheme as e } from "./chatbot/theme/useTheme.js";
|
|
2
|
+
import { t } from "./SessionHistory-BUYwbZjE.js";
|
|
3
|
+
import { t as n } from "./InputBar-CVy2_QtC.js";
|
|
4
|
+
import { useEffect as r, useMemo as i, useRef as a } from "react";
|
|
5
|
+
import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
6
|
+
//#region lib/chatbot/SessionContainer/styles.module.css
|
|
7
|
+
var l = {
|
|
8
|
+
"dsi-session-container": "_dsi-session-container_1iida_1",
|
|
9
|
+
"dsi-session-container-history": "_dsi-session-container-history_1iida_11",
|
|
10
|
+
"dsi-session-container-inputbar": "_dsi-session-container-inputbar_1iida_18"
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region lib/chatbot/SessionContainer/index.tsx
|
|
14
|
+
function u({ userMessages: u, botMessages: d, orderedIds: f, botMessageRegistry: p, userMessageSlots: m, alternativeScreenComponent: h, isAlternativeScreenActive: g = !1, value: _, onChange: v, placeholder: y, actionButtonType: b, actionButtonEnabled: x, onActionButtonClick: S, plusSlot: C, upperSlot: w }) {
|
|
15
|
+
let T = e(), E = a(null), D = i(() => {
|
|
16
|
+
let e = new Map(u.map((e) => [e.id, e]));
|
|
17
|
+
return f.filter((t) => e.has(t)).map((t) => e.get(t).text);
|
|
18
|
+
}, [u, f]);
|
|
19
|
+
return r(() => {
|
|
20
|
+
E.current?.scrollIntoView({ behavior: "smooth" });
|
|
21
|
+
}, [f.length]), /* @__PURE__ */ c("div", {
|
|
22
|
+
className: l["dsi-session-container"],
|
|
23
|
+
style: { "--dsi-bg": T.background },
|
|
24
|
+
children: [/* @__PURE__ */ s("div", {
|
|
25
|
+
className: l["dsi-session-container-history"],
|
|
26
|
+
children: g ? h ?? null : /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s(t, {
|
|
27
|
+
userMessages: u,
|
|
28
|
+
botMessages: d,
|
|
29
|
+
orderedIds: f,
|
|
30
|
+
botMessageRegistry: p,
|
|
31
|
+
userMessageSlots: m
|
|
32
|
+
}), /* @__PURE__ */ s("div", { ref: E })] })
|
|
33
|
+
}), /* @__PURE__ */ s("div", {
|
|
34
|
+
className: l["dsi-session-container-inputbar"],
|
|
35
|
+
children: /* @__PURE__ */ s(n, {
|
|
36
|
+
value: _,
|
|
37
|
+
onChange: v,
|
|
38
|
+
placeholder: y,
|
|
39
|
+
actionButtonType: b,
|
|
40
|
+
actionButtonEnabled: x,
|
|
41
|
+
onActionButtonClick: S,
|
|
42
|
+
plusSlot: C,
|
|
43
|
+
upperSlot: w,
|
|
44
|
+
messageHistory: D
|
|
45
|
+
})
|
|
46
|
+
})]
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
export { u as t };
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { t as e } from "../../InputBar-
|
|
2
|
-
|
|
1
|
+
import { t as e } from "../../InputBar-CVy2_QtC.js";
|
|
2
|
+
import { usePlusSlot as t } from "./usePlusSlot.js";
|
|
3
|
+
export { e as InputBar, t as usePlusSlot };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region lib/chatbot/InputBar/plusSlotStore.ts
|
|
2
|
+
var e = !1, t = /* @__PURE__ */ new Set();
|
|
3
|
+
function n() {
|
|
4
|
+
return e;
|
|
5
|
+
}
|
|
6
|
+
function r(n) {
|
|
7
|
+
e = n, t.forEach((e) => e(n));
|
|
8
|
+
}
|
|
9
|
+
function i(e) {
|
|
10
|
+
return t.add(e), () => t.delete(e);
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { n as getPlusOpen, r as setPlusOpen, i as subscribePlusOpen };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { setPlusOpen } from './plusSlotStore';
|
|
2
|
+
/**
|
|
3
|
+
* Hook permettant de contrôler programmatiquement l'ouverture/fermeture
|
|
4
|
+
* du plus slot de l'InputBar.
|
|
5
|
+
*
|
|
6
|
+
* Le comportement natif (clic sur le bouton "+" pour basculer) est conservé :
|
|
7
|
+
* ce hook ajoute uniquement la capacité d'agir depuis l'extérieur.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* const { setOpen } = usePlusSlot();
|
|
12
|
+
*
|
|
13
|
+
* // Ouvrir le plus slot lors d'un drop de fichier
|
|
14
|
+
* const handleDrop = () => setOpen(true);
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare function usePlusSlot(): {
|
|
18
|
+
setOpen: typeof setPlusOpen;
|
|
19
|
+
};
|
|
@@ -1,13 +1,28 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
1
2
|
import { SessionHistoryProps } from '../SessionHistory';
|
|
2
3
|
import { InputBarProps } from '../InputBar';
|
|
3
|
-
export type SessionContainerProps<TTop = Record<string, never>, TBottom = Record<string, never>, TLeft = Record<string, never>, TRight = Record<string, never>> = SessionHistoryProps<TTop, TBottom, TLeft, TRight> & InputBarProps
|
|
4
|
+
export type SessionContainerProps<TTop = Record<string, never>, TBottom = Record<string, never>, TLeft = Record<string, never>, TRight = Record<string, never>> = SessionHistoryProps<TTop, TBottom, TLeft, TRight> & InputBarProps & {
|
|
5
|
+
/**
|
|
6
|
+
* Composant alternatif affiché à la place de `SessionHistory`
|
|
7
|
+
* quand `isAlternativeScreenActive` est `true`.
|
|
8
|
+
*/
|
|
9
|
+
alternativeScreenComponent?: ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Quand `true`, affiche `alternativeScreenComponent` à la place de
|
|
12
|
+
* `SessionHistory`. Par défaut `false`.
|
|
13
|
+
*/
|
|
14
|
+
isAlternativeScreenActive?: boolean;
|
|
15
|
+
};
|
|
4
16
|
/**
|
|
5
17
|
* Composant tout-en-un combinant `SessionHistory` et `InputBar`.
|
|
6
18
|
*
|
|
7
19
|
* Fait défiler automatiquement vers le dernier message à chaque
|
|
8
20
|
* mise à jour de la conversation.
|
|
9
21
|
*
|
|
10
|
-
* Ses props sont la somme des props de `SessionHistory` et `InputBar
|
|
22
|
+
* Ses props sont la somme des props de `SessionHistory` et `InputBar`,
|
|
23
|
+
* plus deux props optionnelles pour un écran alternatif :
|
|
24
|
+
* - `alternativeScreenComponent` : contenu affiché à la place de `SessionHistory`
|
|
25
|
+
* - `isAlternativeScreenActive` : active l'affichage de l'écran alternatif (défaut `false`)
|
|
11
26
|
*
|
|
12
27
|
* @example
|
|
13
28
|
* ```tsx
|
|
@@ -23,4 +38,4 @@ export type SessionContainerProps<TTop = Record<string, never>, TBottom = Record
|
|
|
23
38
|
* />
|
|
24
39
|
* ```
|
|
25
40
|
*/
|
|
26
|
-
export declare function SessionContainer<TTop = Record<string, never>, TBottom = Record<string, never>, TLeft = Record<string, never>, TRight = Record<string, never>>({ userMessages, botMessages, orderedIds, botMessageRegistry, userMessageSlots, value, onChange, placeholder, actionButtonType, actionButtonEnabled, onActionButtonClick, plusSlot, upperSlot, }: SessionContainerProps<TTop, TBottom, TLeft, TRight>): import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
export declare function SessionContainer<TTop = Record<string, never>, TBottom = Record<string, never>, TLeft = Record<string, never>, TRight = Record<string, never>>({ userMessages, botMessages, orderedIds, botMessageRegistry, userMessageSlots, alternativeScreenComponent, isAlternativeScreenActive, value, onChange, placeholder, actionButtonType, actionButtonEnabled, onActionButtonClick, plusSlot, upperSlot, }: SessionContainerProps<TTop, TBottom, TLeft, TRight>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../SessionContainer-
|
|
1
|
+
import { t as e } from "../../SessionContainer-DfTD7hX3.js";
|
|
2
2
|
export { e as SessionContainer };
|
package/dist/chatbot/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export { BotMessage, defaultBotMessageRegistry } from './BotMessage';
|
|
|
8
8
|
export type { ElementData, TextElementData, ReasoningElementData, ToolElementData, SearchElementData, BotMessageData, BotMessageRegistry, BotMessageProps, } from './BotMessage';
|
|
9
9
|
export { SessionHistory } from './SessionHistory';
|
|
10
10
|
export type { SessionHistoryProps, SessionUserMessageSlots } from './SessionHistory';
|
|
11
|
-
export { InputBar } from './InputBar';
|
|
11
|
+
export { InputBar, usePlusSlot } from './InputBar';
|
|
12
12
|
export type { InputBarProps, ActionButtonType } from './InputBar';
|
|
13
13
|
export { SessionContainer } from './SessionContainer';
|
|
14
14
|
export type { SessionContainerProps } from './SessionContainer';
|
package/dist/chatbot/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import "./theme/index.js";
|
|
|
5
5
|
import { t as a } from "../UserMessage-CkrDUpkQ.js";
|
|
6
6
|
import { n as o, t as s } from "../BotMessage-DegH8sM-.js";
|
|
7
7
|
import { t as c } from "../SessionHistory-BUYwbZjE.js";
|
|
8
|
-
import { t as l } from "../InputBar-
|
|
9
|
-
import {
|
|
10
|
-
|
|
8
|
+
import { t as l } from "../InputBar-CVy2_QtC.js";
|
|
9
|
+
import { usePlusSlot as u } from "./InputBar/usePlusSlot.js";
|
|
10
|
+
import { t as d } from "../SessionContainer-DfTD7hX3.js";
|
|
11
|
+
export { s as BotMessage, l as InputBar, e as MarkdownRenderer, d as SessionContainer, c as SessionHistory, a as UserMessage, o as defaultBotMessageRegistry, t as getCurrentTheme, n as getTheme, r as setTheme, u as usePlusSlot, i as useTheme };
|
package/dist/main.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { KeycloakProvider, useKeycloakAuth, logoutKeycloak, refreshTokenKeycloak, } from './keycloak';
|
|
2
2
|
export type { KeycloakProviderProps, KeycloakConfig, KeycloakAuthOptions, AuthStatus, AuthUser, AuthContextValue, LoginOptions, LogoutOptions, } from './keycloak';
|
|
3
|
-
export { setTheme, getTheme, getCurrentTheme, useTheme, MarkdownRenderer, UserMessage, BotMessage, defaultBotMessageRegistry, SessionHistory, InputBar, SessionContainer, } from './chatbot';
|
|
3
|
+
export { setTheme, getTheme, getCurrentTheme, useTheme, MarkdownRenderer, UserMessage, BotMessage, defaultBotMessageRegistry, SessionHistory, InputBar, SessionContainer, usePlusSlot, } from './chatbot';
|
|
4
4
|
export type { ColorPalette, Theme, MarkdownRendererProps, UserMessageData, UserMessageProps, ElementData, TextElementData, ReasoningElementData, ToolElementData, SearchElementData, BotMessageData, BotMessageRegistry, BotMessageProps, SessionHistoryProps, SessionUserMessageSlots, InputBarProps, ActionButtonType, SessionContainerProps, } from './chatbot';
|
package/dist/main.js
CHANGED
|
@@ -8,7 +8,8 @@ import { useTheme as c } from "./chatbot/theme/useTheme.js";
|
|
|
8
8
|
import { t as l } from "./UserMessage-CkrDUpkQ.js";
|
|
9
9
|
import { n as u, t as d } from "./BotMessage-DegH8sM-.js";
|
|
10
10
|
import { t as f } from "./SessionHistory-BUYwbZjE.js";
|
|
11
|
-
import { t as p } from "./InputBar-
|
|
12
|
-
import {
|
|
11
|
+
import { t as p } from "./InputBar-CVy2_QtC.js";
|
|
12
|
+
import { usePlusSlot as m } from "./chatbot/InputBar/usePlusSlot.js";
|
|
13
|
+
import { t as h } from "./SessionContainer-DfTD7hX3.js";
|
|
13
14
|
import "./chatbot/index.js";
|
|
14
|
-
export { d as BotMessage, p as InputBar, r as KeycloakProvider, e as MarkdownRenderer,
|
|
15
|
+
export { d as BotMessage, p as InputBar, r as KeycloakProvider, e as MarkdownRenderer, h as SessionContainer, f as SessionHistory, l as UserMessage, u as defaultBotMessageRegistry, a as getCurrentTheme, o as getTheme, t as logoutKeycloak, n as refreshTokenKeycloak, s as setTheme, i as useKeycloakAuth, m as usePlusSlot, c as useTheme };
|
package/package.json
CHANGED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { useTheme as e } from "./chatbot/theme/useTheme.js";
|
|
2
|
-
import { t } from "./SessionHistory-BUYwbZjE.js";
|
|
3
|
-
import { t as n } from "./InputBar-CxSc2du6.js";
|
|
4
|
-
import { useEffect as r, useMemo as i, useRef as a } from "react";
|
|
5
|
-
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
6
|
-
//#region lib/chatbot/SessionContainer/styles.module.css
|
|
7
|
-
var c = {
|
|
8
|
-
"dsi-session-container": "_dsi-session-container_1iida_1",
|
|
9
|
-
"dsi-session-container-history": "_dsi-session-container-history_1iida_11",
|
|
10
|
-
"dsi-session-container-inputbar": "_dsi-session-container-inputbar_1iida_18"
|
|
11
|
-
};
|
|
12
|
-
//#endregion
|
|
13
|
-
//#region lib/chatbot/SessionContainer/index.tsx
|
|
14
|
-
function l({ userMessages: l, botMessages: u, orderedIds: d, botMessageRegistry: f, userMessageSlots: p, value: m, onChange: h, placeholder: g, actionButtonType: _, actionButtonEnabled: v, onActionButtonClick: y, plusSlot: b, upperSlot: x }) {
|
|
15
|
-
let S = e(), C = a(null), w = i(() => {
|
|
16
|
-
let e = new Map(l.map((e) => [e.id, e]));
|
|
17
|
-
return d.filter((t) => e.has(t)).map((t) => e.get(t).text);
|
|
18
|
-
}, [l, d]);
|
|
19
|
-
return r(() => {
|
|
20
|
-
C.current?.scrollIntoView({ behavior: "smooth" });
|
|
21
|
-
}, [d.length]), /* @__PURE__ */ s("div", {
|
|
22
|
-
className: c["dsi-session-container"],
|
|
23
|
-
style: { "--dsi-bg": S.background },
|
|
24
|
-
children: [/* @__PURE__ */ s("div", {
|
|
25
|
-
className: c["dsi-session-container-history"],
|
|
26
|
-
children: [/* @__PURE__ */ o(t, {
|
|
27
|
-
userMessages: l,
|
|
28
|
-
botMessages: u,
|
|
29
|
-
orderedIds: d,
|
|
30
|
-
botMessageRegistry: f,
|
|
31
|
-
userMessageSlots: p
|
|
32
|
-
}), /* @__PURE__ */ o("div", { ref: C })]
|
|
33
|
-
}), /* @__PURE__ */ o("div", {
|
|
34
|
-
className: c["dsi-session-container-inputbar"],
|
|
35
|
-
children: /* @__PURE__ */ o(n, {
|
|
36
|
-
value: m,
|
|
37
|
-
onChange: h,
|
|
38
|
-
placeholder: g,
|
|
39
|
-
actionButtonType: _,
|
|
40
|
-
actionButtonEnabled: v,
|
|
41
|
-
onActionButtonClick: y,
|
|
42
|
-
plusSlot: b,
|
|
43
|
-
upperSlot: x,
|
|
44
|
-
messageHistory: w
|
|
45
|
-
})
|
|
46
|
-
})]
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
//#endregion
|
|
50
|
-
export { l as t };
|