@lastbrain/ai-ui-react 1.0.67 → 1.0.69
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/components/AiChipLabel.d.ts +8 -3
- package/dist/components/AiChipLabel.d.ts.map +1 -1
- package/dist/components/AiChipLabel.js +21 -70
- package/dist/components/AiContextButton.d.ts +5 -1
- package/dist/components/AiContextButton.d.ts.map +1 -1
- package/dist/components/AiContextButton.js +67 -291
- package/dist/components/AiImageButton.d.ts +5 -1
- package/dist/components/AiImageButton.d.ts.map +1 -1
- package/dist/components/AiImageButton.js +6 -142
- package/dist/components/AiInput.d.ts +5 -3
- package/dist/components/AiInput.d.ts.map +1 -1
- package/dist/components/AiInput.js +13 -25
- package/dist/components/AiPromptPanel.d.ts.map +1 -1
- package/dist/components/AiPromptPanel.js +58 -212
- package/dist/components/AiSelect.d.ts +5 -3
- package/dist/components/AiSelect.d.ts.map +1 -1
- package/dist/components/AiSelect.js +21 -30
- package/dist/components/AiStatusButton.d.ts +4 -1
- package/dist/components/AiStatusButton.d.ts.map +1 -1
- package/dist/components/AiStatusButton.js +198 -626
- package/dist/components/AiTextarea.d.ts +4 -2
- package/dist/components/AiTextarea.d.ts.map +1 -1
- package/dist/components/AiTextarea.js +14 -26
- package/dist/components/LBApiKeySelector.d.ts.map +1 -1
- package/dist/components/LBApiKeySelector.js +5 -166
- package/dist/components/LBConnectButton.d.ts +4 -7
- package/dist/components/LBConnectButton.d.ts.map +1 -1
- package/dist/components/LBConnectButton.js +17 -86
- package/dist/components/LBSigninModal.d.ts +1 -1
- package/dist/components/LBSigninModal.d.ts.map +1 -1
- package/dist/components/LBSigninModal.js +42 -320
- package/dist/examples/AiUiPremiumShowcase.d.ts +2 -0
- package/dist/examples/AiUiPremiumShowcase.d.ts.map +1 -0
- package/dist/examples/AiUiPremiumShowcase.js +15 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/styles/inline.d.ts +1 -0
- package/dist/styles/inline.d.ts.map +1 -1
- package/dist/styles/inline.js +25 -129
- package/dist/styles.css +1268 -369
- package/dist/types.d.ts +3 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/AiChipLabel.tsx +64 -101
- package/src/components/AiContextButton.tsx +138 -430
- package/src/components/AiImageButton.tsx +29 -190
- package/src/components/AiInput.tsx +49 -74
- package/src/components/AiPromptPanel.tsx +71 -254
- package/src/components/AiSelect.tsx +61 -69
- package/src/components/AiStatusButton.tsx +477 -1219
- package/src/components/AiTextarea.tsx +49 -64
- package/src/components/LBApiKeySelector.tsx +86 -274
- package/src/components/LBConnectButton.tsx +46 -334
- package/src/components/LBSigninModal.tsx +140 -481
- package/src/examples/AiUiPremiumShowcase.tsx +91 -0
- package/src/index.ts +3 -0
- package/src/styles/inline.ts +27 -148
- package/src/styles.css +1268 -369
- package/src/types.ts +3 -0
|
@@ -1,59 +1,57 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { useState } from "react";
|
|
3
|
+
import { useEffect, useMemo, useState } from "react";
|
|
4
|
+
import { createPortal } from "react-dom";
|
|
5
|
+
import { AlertCircle, Loader2, Lock, Mail, Sparkles, X } from "lucide-react";
|
|
4
6
|
import { useLB } from "../context/LBAuthProvider";
|
|
5
7
|
import { LBApiKeySelector } from "./LBApiKeySelector";
|
|
6
|
-
import { Mail, Lock, Sparkles, X, Loader2, AlertCircle } from "lucide-react";
|
|
7
8
|
export function LBSigninModal({ isOpen, onClose }) {
|
|
8
|
-
|
|
9
|
+
const lbContext = useLB();
|
|
10
|
+
const [portalRoot, setPortalRoot] = useState(null);
|
|
9
11
|
const [email, setEmail] = useState("");
|
|
10
12
|
const [password, setPassword] = useState("");
|
|
11
13
|
const [loading, setLoading] = useState(false);
|
|
12
14
|
const [error, setError] = useState("");
|
|
13
15
|
const [showKeySelector, setShowKeySelector] = useState(false);
|
|
14
|
-
const [currentApiKeys, setCurrentApiKeys] = useState([]);
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
const [currentApiKeys, setCurrentApiKeys] = useState([]);
|
|
17
|
+
const { login, selectApiKeyWithToken, fetchApiKeys, } = lbContext || {};
|
|
18
|
+
const canRender = Boolean(isOpen && lbContext && login);
|
|
19
|
+
const panelTitle = useMemo(() => "Connexion LastBrain", []);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
setPortalRoot(document.body);
|
|
22
|
+
}, []);
|
|
23
|
+
if (!canRender || !portalRoot) {
|
|
19
24
|
return null;
|
|
20
25
|
}
|
|
21
|
-
// Extraire les valeurs du contexte
|
|
22
|
-
const { login, selectApiKeyWithToken, fetchApiKeys, apiKeys = [], status: lbStatus, } = lbContext;
|
|
23
|
-
if (!isOpen || !login)
|
|
24
|
-
return null;
|
|
25
26
|
const handleSubmit = async (e) => {
|
|
26
27
|
e.preventDefault();
|
|
28
|
+
if (!login) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
27
31
|
setError("");
|
|
28
32
|
setLoading(true);
|
|
29
33
|
try {
|
|
30
34
|
const result = await login(email, password);
|
|
31
|
-
if (result.success) {
|
|
32
|
-
if (result.needsKeySelection) {
|
|
33
|
-
// L'utilisateur doit choisir une clé API
|
|
34
|
-
// Utiliser l'access token retourné directement par login
|
|
35
|
-
if (fetchApiKeys && result.accessToken) {
|
|
36
|
-
try {
|
|
37
|
-
const keys = await fetchApiKeys(result.accessToken);
|
|
38
|
-
setCurrentApiKeys(keys);
|
|
39
|
-
setShowKeySelector(true);
|
|
40
|
-
}
|
|
41
|
-
catch (keyError) {
|
|
42
|
-
setError("Erreur lors de la récupération des clés API");
|
|
43
|
-
console.error("Failed to fetch API keys:", keyError);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
setError("Token d'accès non disponible");
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
// Connexion réussie, fermer le modal
|
|
52
|
-
onClose();
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
35
|
+
if (!result.success) {
|
|
56
36
|
setError(result.error || "Échec de la connexion");
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (!result.needsKeySelection) {
|
|
40
|
+
onClose();
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (!fetchApiKeys || !result.accessToken) {
|
|
44
|
+
setError("Token d'accès non disponible");
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
try {
|
|
48
|
+
const keys = await fetchApiKeys(result.accessToken);
|
|
49
|
+
setCurrentApiKeys(keys || []);
|
|
50
|
+
setShowKeySelector(true);
|
|
51
|
+
}
|
|
52
|
+
catch (keyError) {
|
|
53
|
+
console.error("Failed to fetch API keys:", keyError);
|
|
54
|
+
setError("Erreur lors de la récupération des clés API");
|
|
57
55
|
}
|
|
58
56
|
}
|
|
59
57
|
catch (err) {
|
|
@@ -64,8 +62,9 @@ export function LBSigninModal({ isOpen, onClose }) {
|
|
|
64
62
|
}
|
|
65
63
|
};
|
|
66
64
|
const handleKeySelect = async (apiKeyId) => {
|
|
67
|
-
if (!selectApiKeyWithToken)
|
|
65
|
+
if (!selectApiKeyWithToken) {
|
|
68
66
|
return;
|
|
67
|
+
}
|
|
69
68
|
try {
|
|
70
69
|
await selectApiKeyWithToken(apiKeyId);
|
|
71
70
|
setShowKeySelector(false);
|
|
@@ -78,291 +77,14 @@ export function LBSigninModal({ isOpen, onClose }) {
|
|
|
78
77
|
};
|
|
79
78
|
const handleCancelKeySelection = () => {
|
|
80
79
|
setShowKeySelector(false);
|
|
81
|
-
// Fermer complètement le modal au lieu de rester dans l'état de sélection
|
|
82
80
|
onClose();
|
|
83
81
|
};
|
|
84
|
-
// Si on doit afficher le sélecteur de clés
|
|
85
82
|
if (showKeySelector && currentApiKeys.length > 0) {
|
|
86
|
-
return (_jsx(LBApiKeySelector, { apiKeys: currentApiKeys, onSelect: handleKeySelect, onCancel: handleCancelKeySelection, isOpen: true }));
|
|
83
|
+
return createPortal(_jsx(LBApiKeySelector, { apiKeys: currentApiKeys, onSelect: handleKeySelect, onCancel: handleCancelKeySelection, isOpen: true }), portalRoot);
|
|
87
84
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
return (_jsxs("div", { style: {
|
|
94
|
-
position: "fixed",
|
|
95
|
-
top: 0,
|
|
96
|
-
left: 0,
|
|
97
|
-
right: 0,
|
|
98
|
-
bottom: 0,
|
|
99
|
-
width: "100vw",
|
|
100
|
-
height: "100vh",
|
|
101
|
-
backgroundColor: "rgba(0, 0, 0, 0.75)",
|
|
102
|
-
backdropFilter: "blur(12px)",
|
|
103
|
-
WebkitBackdropFilter: "blur(12px)",
|
|
104
|
-
display: "flex",
|
|
105
|
-
alignItems: "center",
|
|
106
|
-
justifyContent: "center",
|
|
107
|
-
zIndex: 9999,
|
|
108
|
-
padding: "16px",
|
|
109
|
-
animation: "fadeIn 0.2s ease-out",
|
|
110
|
-
overflow: "auto",
|
|
111
|
-
}, onClick: onClose, onKeyDown: handleKeyDown, children: [_jsxs("div", { style: {
|
|
112
|
-
backgroundColor: "light-dark(#ffffff, #1e293b)",
|
|
113
|
-
borderRadius: "20px",
|
|
114
|
-
boxShadow: "0 0 0 1px rgba(139, 92, 246, 0.2), 0 20px 70px rgba(139, 92, 246, 0.25), 0 4px 6px rgba(0, 0, 0, 0.1)",
|
|
115
|
-
maxWidth: "440px",
|
|
116
|
-
width: "100%",
|
|
117
|
-
border: "1px solid light-dark(rgba(226, 232, 240, 0.8), rgba(139, 92, 246, 0.3))",
|
|
118
|
-
display: "flex",
|
|
119
|
-
flexDirection: "column",
|
|
120
|
-
maxHeight: "90vh",
|
|
121
|
-
overflow: "hidden",
|
|
122
|
-
position: "relative",
|
|
123
|
-
animation: "slideUp 0.3s ease-out",
|
|
124
|
-
}, onClick: (e) => e.stopPropagation(), children: [_jsx("div", { style: {
|
|
125
|
-
position: "absolute",
|
|
126
|
-
top: 0,
|
|
127
|
-
left: 0,
|
|
128
|
-
right: 0,
|
|
129
|
-
height: "200px",
|
|
130
|
-
background: "radial-gradient(ellipse at top, rgba(139, 92, 246, 0.15), transparent 70%)",
|
|
131
|
-
pointerEvents: "none",
|
|
132
|
-
zIndex: 0,
|
|
133
|
-
} }), _jsxs("div", { style: {
|
|
134
|
-
padding: "32px 32px 24px",
|
|
135
|
-
display: "flex",
|
|
136
|
-
flexDirection: "column",
|
|
137
|
-
alignItems: "center",
|
|
138
|
-
gap: "16px",
|
|
139
|
-
position: "relative",
|
|
140
|
-
zIndex: 1,
|
|
141
|
-
}, children: [_jsx("div", { style: {
|
|
142
|
-
width: "64px",
|
|
143
|
-
height: "64px",
|
|
144
|
-
borderRadius: "16px",
|
|
145
|
-
background: "linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%)",
|
|
146
|
-
display: "flex",
|
|
147
|
-
alignItems: "center",
|
|
148
|
-
justifyContent: "center",
|
|
149
|
-
boxShadow: "0 8px 24px rgba(139, 92, 246, 0.3)",
|
|
150
|
-
animation: "pulse 2s ease-in-out infinite",
|
|
151
|
-
}, children: _jsx(Sparkles, { size: 32, color: "#ffffff", strokeWidth: 2.5 }) }), _jsxs("div", { style: { textAlign: "center" }, children: [_jsx("h2", { style: {
|
|
152
|
-
margin: "0 0 8px 0",
|
|
153
|
-
fontSize: "24px",
|
|
154
|
-
fontWeight: 700,
|
|
155
|
-
color: "light-dark(#1e293b, #f8fafc)",
|
|
156
|
-
letterSpacing: "-0.02em",
|
|
157
|
-
}, children: "Connexion LastBrain" }), _jsx("p", { style: {
|
|
158
|
-
margin: 0,
|
|
159
|
-
fontSize: "14px",
|
|
160
|
-
color: "light-dark(#64748b, #94a3b8)",
|
|
161
|
-
fontWeight: 400,
|
|
162
|
-
}, children: "Acc\u00E9dez \u00E0 vos outils d'intelligence artificielle" })] }), _jsx("button", { onClick: onClose, style: {
|
|
163
|
-
position: "absolute",
|
|
164
|
-
top: "24px",
|
|
165
|
-
right: "24px",
|
|
166
|
-
background: "transparent",
|
|
167
|
-
border: "none",
|
|
168
|
-
color: "light-dark(#64748b, #94a3b8)",
|
|
169
|
-
cursor: "pointer",
|
|
170
|
-
padding: "8px",
|
|
171
|
-
borderRadius: "10px",
|
|
172
|
-
transition: "all 0.2s ease",
|
|
173
|
-
display: "flex",
|
|
174
|
-
alignItems: "center",
|
|
175
|
-
justifyContent: "center",
|
|
176
|
-
}, onMouseEnter: (e) => {
|
|
177
|
-
e.currentTarget.style.background =
|
|
178
|
-
"light-dark(rgba(100, 116, 139, 0.1), rgba(148, 163, 184, 0.15))";
|
|
179
|
-
e.currentTarget.style.color = "light-dark(#1e293b, #f8fafc)";
|
|
180
|
-
}, onMouseLeave: (e) => {
|
|
181
|
-
e.currentTarget.style.background = "transparent";
|
|
182
|
-
e.currentTarget.style.color = "light-dark(#64748b, #94a3b8)";
|
|
183
|
-
}, "aria-label": "Close", children: _jsx(X, { size: 20, strokeWidth: 2 }) })] }), _jsx("div", { style: {
|
|
184
|
-
padding: "0 32px 32px",
|
|
185
|
-
overflow: "auto",
|
|
186
|
-
flex: 1,
|
|
187
|
-
position: "relative",
|
|
188
|
-
zIndex: 1,
|
|
189
|
-
}, children: _jsxs("form", { onSubmit: handleSubmit, style: { display: "flex", flexDirection: "column", gap: "20px" }, children: [_jsxs("div", { children: [_jsxs("label", { style: {
|
|
190
|
-
display: "flex",
|
|
191
|
-
alignItems: "center",
|
|
192
|
-
gap: "8px",
|
|
193
|
-
fontSize: "13px",
|
|
194
|
-
fontWeight: 600,
|
|
195
|
-
color: "light-dark(#1e293b, #f8fafc)",
|
|
196
|
-
marginBottom: "10px",
|
|
197
|
-
letterSpacing: "0.01em",
|
|
198
|
-
}, children: [_jsx(Mail, { size: 16, strokeWidth: 2.5 }), "Email"] }), _jsx("div", { style: { position: "relative" }, children: _jsx("input", { type: "email", value: email, onChange: (e) => setEmail(e.target.value), required: true, autoFocus: true, autoComplete: "email", placeholder: "votre@email.com", style: {
|
|
199
|
-
width: "100%",
|
|
200
|
-
padding: "14px 16px",
|
|
201
|
-
fontSize: "15px",
|
|
202
|
-
border: "2px solid light-dark(#e2e8f0, #334155)",
|
|
203
|
-
borderRadius: "12px",
|
|
204
|
-
background: "light-dark(#f8fafc, #0f172a)",
|
|
205
|
-
color: "light-dark(#1e293b, #f8fafc)",
|
|
206
|
-
outline: "none",
|
|
207
|
-
transition: "all 0.2s ease",
|
|
208
|
-
fontWeight: 500,
|
|
209
|
-
}, onFocus: (e) => {
|
|
210
|
-
e.currentTarget.style.borderColor =
|
|
211
|
-
"rgba(139, 92, 246, 0.6)";
|
|
212
|
-
e.currentTarget.style.boxShadow =
|
|
213
|
-
"0 0 0 4px rgba(139, 92, 246, 0.15)";
|
|
214
|
-
e.currentTarget.style.background =
|
|
215
|
-
"light-dark(#ffffff, #1e293b)";
|
|
216
|
-
}, onBlur: (e) => {
|
|
217
|
-
e.currentTarget.style.borderColor =
|
|
218
|
-
"light-dark(#e2e8f0, #334155)";
|
|
219
|
-
e.currentTarget.style.boxShadow = "none";
|
|
220
|
-
e.currentTarget.style.background =
|
|
221
|
-
"light-dark(#f8fafc, #0f172a)";
|
|
222
|
-
} }) })] }), _jsxs("div", { children: [_jsxs("label", { style: {
|
|
223
|
-
display: "flex",
|
|
224
|
-
alignItems: "center",
|
|
225
|
-
gap: "8px",
|
|
226
|
-
fontSize: "13px",
|
|
227
|
-
fontWeight: 600,
|
|
228
|
-
color: "light-dark(#1e293b, #f8fafc)",
|
|
229
|
-
marginBottom: "10px",
|
|
230
|
-
letterSpacing: "0.01em",
|
|
231
|
-
}, children: [_jsx(Lock, { size: 16, strokeWidth: 2.5 }), "Mot de passe"] }), _jsx("div", { style: { position: "relative" }, children: _jsx("input", { type: "password", value: password, onChange: (e) => setPassword(e.target.value), required: true, autoComplete: "current-password", placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022", style: {
|
|
232
|
-
width: "100%",
|
|
233
|
-
padding: "14px 16px",
|
|
234
|
-
fontSize: "15px",
|
|
235
|
-
border: "2px solid light-dark(#e2e8f0, #334155)",
|
|
236
|
-
borderRadius: "12px",
|
|
237
|
-
background: "light-dark(#f8fafc, #0f172a)",
|
|
238
|
-
color: "light-dark(#1e293b, #f8fafc)",
|
|
239
|
-
outline: "none",
|
|
240
|
-
transition: "all 0.2s ease",
|
|
241
|
-
letterSpacing: "0.15em",
|
|
242
|
-
fontWeight: 500,
|
|
243
|
-
}, onFocus: (e) => {
|
|
244
|
-
e.currentTarget.style.borderColor =
|
|
245
|
-
"rgba(139, 92, 246, 0.6)";
|
|
246
|
-
e.currentTarget.style.boxShadow =
|
|
247
|
-
"0 0 0 4px rgba(139, 92, 246, 0.15)";
|
|
248
|
-
e.currentTarget.style.background =
|
|
249
|
-
"light-dark(#ffffff, #1e293b)";
|
|
250
|
-
}, onBlur: (e) => {
|
|
251
|
-
e.currentTarget.style.borderColor =
|
|
252
|
-
"light-dark(#e2e8f0, #334155)";
|
|
253
|
-
e.currentTarget.style.boxShadow = "none";
|
|
254
|
-
e.currentTarget.style.background =
|
|
255
|
-
"light-dark(#f8fafc, #0f172a)";
|
|
256
|
-
} }) })] }), error && (_jsxs("div", { style: {
|
|
257
|
-
padding: "14px 16px",
|
|
258
|
-
background: "rgba(239, 68, 68, 0.1)",
|
|
259
|
-
border: "2px solid rgba(239, 68, 68, 0.35)",
|
|
260
|
-
borderRadius: "12px",
|
|
261
|
-
color: "light-dark(#dc2626, #fca5a5)",
|
|
262
|
-
fontSize: "14px",
|
|
263
|
-
display: "flex",
|
|
264
|
-
alignItems: "start",
|
|
265
|
-
gap: "12px",
|
|
266
|
-
animation: "shake 0.4s ease",
|
|
267
|
-
}, children: [_jsx(AlertCircle, { size: 20, style: { flexShrink: 0, marginTop: "2px" }, strokeWidth: 2.5 }), _jsx("span", { style: { flex: 1, lineHeight: "1.5", fontWeight: 500 }, children: error })] })), _jsx("button", { type: "submit", disabled: loading, style: {
|
|
268
|
-
width: "100%",
|
|
269
|
-
padding: "16px",
|
|
270
|
-
fontSize: "15px",
|
|
271
|
-
fontWeight: 700,
|
|
272
|
-
color: "#ffffff",
|
|
273
|
-
background: loading
|
|
274
|
-
? "light-dark(#cbd5e1, #475569)"
|
|
275
|
-
: "linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%)",
|
|
276
|
-
border: "none",
|
|
277
|
-
borderRadius: "12px",
|
|
278
|
-
cursor: loading ? "not-allowed" : "pointer",
|
|
279
|
-
transition: "all 0.2s ease",
|
|
280
|
-
display: "flex",
|
|
281
|
-
alignItems: "center",
|
|
282
|
-
justifyContent: "center",
|
|
283
|
-
gap: "10px",
|
|
284
|
-
letterSpacing: "0.01em",
|
|
285
|
-
opacity: loading ? 0.6 : 1,
|
|
286
|
-
boxShadow: loading
|
|
287
|
-
? "none"
|
|
288
|
-
: "0 4px 14px rgba(139, 92, 246, 0.4)",
|
|
289
|
-
}, onMouseEnter: (e) => {
|
|
290
|
-
if (!loading) {
|
|
291
|
-
e.currentTarget.style.transform = "translateY(-2px)";
|
|
292
|
-
e.currentTarget.style.boxShadow =
|
|
293
|
-
"0 8px 24px rgba(139, 92, 246, 0.6)";
|
|
294
|
-
}
|
|
295
|
-
}, onMouseLeave: (e) => {
|
|
296
|
-
e.currentTarget.style.transform = "translateY(0)";
|
|
297
|
-
e.currentTarget.style.boxShadow =
|
|
298
|
-
"0 4px 14px rgba(139, 92, 246, 0.4)";
|
|
299
|
-
}, children: loading ? (_jsxs(_Fragment, { children: [_jsx(Loader2, { size: 20, strokeWidth: 2.5, style: { animation: "spin 1s linear infinite" } }), "Connexion en cours..."] })) : (_jsxs(_Fragment, { children: [_jsx(Sparkles, { size: 20, strokeWidth: 2.5 }), "Se connecter"] })) }), _jsxs("div", { style: {
|
|
300
|
-
marginTop: "8px",
|
|
301
|
-
padding: "20px",
|
|
302
|
-
background: "rgba(139, 92, 246, 0.05)",
|
|
303
|
-
border: "1px solid rgba(139, 92, 246, 0.2)",
|
|
304
|
-
borderRadius: "16px",
|
|
305
|
-
textAlign: "center",
|
|
306
|
-
}, children: [_jsx("p", { style: {
|
|
307
|
-
margin: "0 0 14px 0",
|
|
308
|
-
fontSize: "14px",
|
|
309
|
-
color: "light-dark(#64748b, #94a3b8)",
|
|
310
|
-
fontWeight: 500,
|
|
311
|
-
}, children: "Pas encore de compte ?" }), _jsxs("a", { href: "https://prompt.lastbrain.io/signup", target: "_blank", rel: "noopener noreferrer", style: {
|
|
312
|
-
display: "inline-flex",
|
|
313
|
-
alignItems: "center",
|
|
314
|
-
gap: "8px",
|
|
315
|
-
padding: "10px 20px",
|
|
316
|
-
fontSize: "14px",
|
|
317
|
-
fontWeight: 600,
|
|
318
|
-
color: "#8b5cf6",
|
|
319
|
-
textDecoration: "none",
|
|
320
|
-
border: "2px solid rgba(139, 92, 246, 0.3)",
|
|
321
|
-
borderRadius: "10px",
|
|
322
|
-
transition: "all 0.2s ease",
|
|
323
|
-
}, onMouseEnter: (e) => {
|
|
324
|
-
e.currentTarget.style.background = "rgba(139, 92, 246, 0.1)";
|
|
325
|
-
e.currentTarget.style.borderColor = "rgba(139, 92, 246, 0.5)";
|
|
326
|
-
e.currentTarget.style.transform = "translateY(-1px)";
|
|
327
|
-
}, onMouseLeave: (e) => {
|
|
328
|
-
e.currentTarget.style.background = "transparent";
|
|
329
|
-
e.currentTarget.style.borderColor = "rgba(139, 92, 246, 0.3)";
|
|
330
|
-
e.currentTarget.style.transform = "translateY(0)";
|
|
331
|
-
}, children: [_jsx(Sparkles, { size: 16, strokeWidth: 2.5 }), "Cr\u00E9er un compte gratuitement"] })] })] }) })] }), _jsx("style", { children: `
|
|
332
|
-
@keyframes fadeIn {
|
|
333
|
-
from { opacity: 0; }
|
|
334
|
-
to { opacity: 1; }
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
@keyframes slideUp {
|
|
338
|
-
from {
|
|
339
|
-
opacity: 0;
|
|
340
|
-
transform: translateY(20px) scale(0.95);
|
|
341
|
-
}
|
|
342
|
-
to {
|
|
343
|
-
opacity: 1;
|
|
344
|
-
transform: translateY(0) scale(1);
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
@keyframes spin {
|
|
349
|
-
from { transform: rotate(0deg); }
|
|
350
|
-
to { transform: rotate(360deg); }
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
@keyframes pulse {
|
|
354
|
-
0%, 100% {
|
|
355
|
-
box-shadow: 0 8px 24px rgba(139, 92, 246, 0.3);
|
|
356
|
-
}
|
|
357
|
-
50% {
|
|
358
|
-
box-shadow: 0 8px 32px rgba(139, 92, 246, 0.5);
|
|
85
|
+
return createPortal(_jsx("div", { className: "ai-signin-overlay", onClick: onClose, onKeyDown: (e) => {
|
|
86
|
+
if (e.key === "Escape") {
|
|
87
|
+
onClose();
|
|
359
88
|
}
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
@keyframes shake {
|
|
363
|
-
0%, 100% { transform: translateX(0); }
|
|
364
|
-
25% { transform: translateX(-8px); }
|
|
365
|
-
75% { transform: translateX(8px); }
|
|
366
|
-
}
|
|
367
|
-
` })] }));
|
|
89
|
+
}, role: "dialog", "aria-modal": "true", "aria-label": panelTitle, children: _jsxs("div", { className: "ai-signin-panel", onClick: (e) => e.stopPropagation(), children: [_jsx("button", { type: "button", className: "ai-icon-btn ai-signin-close", onClick: onClose, "aria-label": "Fermer", children: _jsx(X, { size: 16 }) }), _jsxs("div", { className: "ai-signin-header", children: [_jsx("div", { className: "ai-center mb-3", children: _jsx("span", { className: "ai-icon-badge", children: _jsx(Sparkles, { size: 22 }) }) }), _jsx("h2", { className: "ai-signin-title", children: panelTitle }), _jsx("p", { className: "ai-signin-subtitle", children: "Connectez-vous pour activer les composants IA dans votre app." })] }), _jsx("div", { className: "ai-signin-content", children: _jsxs("form", { onSubmit: handleSubmit, children: [_jsxs("div", { className: "ai-input-row", children: [_jsxs("label", { htmlFor: "lb-signin-email", className: "ai-input-label ai-row", children: [_jsx(Mail, { size: 14, className: "ai-inline-icon" }), "Email"] }), _jsx("div", { className: "ai-control-group ai-glow", children: _jsx("div", { className: "ai-shell ai-size-md ai-radius-full", children: _jsx("input", { id: "lb-signin-email", className: "ai-control ai-control-input ai-size-md ai-radius-full", type: "email", value: email, onChange: (e) => setEmail(e.target.value), required: true, autoFocus: true, autoComplete: "email", placeholder: "votre@email.com" }) }) })] }), _jsxs("div", { className: "ai-input-row", children: [_jsxs("label", { htmlFor: "lb-signin-password", className: "ai-input-label ai-row", children: [_jsx(Lock, { size: 14, className: "ai-inline-icon" }), "Mot de passe"] }), _jsx("div", { className: "ai-control-group ai-glow", children: _jsx("div", { className: "ai-shell ai-size-md ai-radius-full", children: _jsx("input", { id: "lb-signin-password", className: "ai-control ai-control-input ai-size-md ai-radius-full", type: "password", value: password, onChange: (e) => setPassword(e.target.value), required: true, autoComplete: "current-password", placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" }) }) })] }), error ? (_jsxs("div", { className: "ai-signin-error", role: "alert", children: [_jsx(AlertCircle, { size: 16 }), _jsx("span", { children: error })] })) : null, _jsxs("div", { className: "ai-signin-actions", children: [_jsx("button", { type: "submit", className: "ai-btn ai-btn--auth", disabled: loading, children: loading ? (_jsxs(_Fragment, { children: [_jsx(Loader2, { size: 16, className: "ai-spinner" }), "Connexion..."] })) : (_jsxs(_Fragment, { children: [_jsx(Sparkles, { size: 16 }), "Se connecter"] })) }), _jsx("a", { href: "https://prompt.lastbrain.io/signup", target: "_blank", rel: "noopener noreferrer", className: "ai-btn ai-btn--ghost", children: "Cr\u00E9er un compte" })] })] }) })] }) }), portalRoot);
|
|
368
90
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AiUiPremiumShowcase.d.ts","sourceRoot":"","sources":["../../src/examples/AiUiPremiumShowcase.tsx"],"names":[],"mappings":"AAmFA,wBAAgB,mBAAmB,4CAOlC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Sparkles } from "lucide-react";
|
|
4
|
+
import { AiProvider } from "../context/AiProvider";
|
|
5
|
+
import { AiInput } from "../components/AiInput";
|
|
6
|
+
import { AiTextarea } from "../components/AiTextarea";
|
|
7
|
+
import { AiChipLabel } from "../components/AiChipLabel";
|
|
8
|
+
function ShowcasePanel({ title, theme, }) {
|
|
9
|
+
return (_jsxs("section", { "data-theme": theme, className: `rounded-2xl border p-6 ${theme === "dark"
|
|
10
|
+
? "bg-slate-950 border-slate-800 text-slate-100"
|
|
11
|
+
: "bg-white border-slate-200 text-slate-900"}`, children: [_jsxs("div", { className: "mb-4 flex items-center justify-between", children: [_jsx("h3", { className: "text-base font-semibold", children: title }), _jsx("span", { className: "text-xs opacity-70", children: theme })] }), _jsx(AiProvider, { baseUrl: "/api/ai", apiKeyId: "demo-key", children: _jsxs("div", { className: "space-y-4", children: [_jsx(AiInput, { value: "", onChange: () => { }, placeholder: "Ask anything...", "data-testid": `showcase-input-${theme}` }), _jsx(AiTextarea, { value: "", onChange: () => { }, placeholder: "Generate a concise product description...", "data-testid": `showcase-textarea-${theme}` }), _jsxs("div", { className: "flex flex-wrap gap-2", children: [_jsx(AiChipLabel, { children: "Default" }), _jsx(AiChipLabel, { variant: "selected", children: "Selected" }), _jsx(AiChipLabel, { variant: "success", children: "Success" }), _jsx(AiChipLabel, { variant: "danger", children: "Danger" })] }), _jsxs("div", { className: "ai-surface p-3", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: "text-sm font-medium", children: "Static control states" }), _jsx(Sparkles, { size: 14, className: "text-[var(--ai-primary)]" })] }), _jsxs("div", { className: "mt-3 space-y-2", children: [_jsx("input", { className: "ai-control ai-control-input", placeholder: "Default state" }), _jsx("input", { className: "ai-control ai-control-input ai-control--focused", placeholder: "Focused style", readOnly: true }), _jsx("input", { className: "ai-control ai-control-input ai-control--error", "aria-invalid": "true", placeholder: "Error style", readOnly: true }), _jsx("input", { className: "ai-control ai-control-input ai-control--disabled", placeholder: "Disabled style", disabled: true })] })] })] }) })] }));
|
|
12
|
+
}
|
|
13
|
+
export function AiUiPremiumShowcase() {
|
|
14
|
+
return (_jsxs("div", { className: "grid gap-6 md:grid-cols-2", children: [_jsx(ShowcasePanel, { title: "Premium UI Showcase", theme: "dark" }), _jsx(ShowcasePanel, { title: "Premium UI Showcase", theme: "light" })] }));
|
|
15
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "./styles.css";
|
|
1
2
|
export * from "./types";
|
|
2
3
|
export * from "./context/AiProvider";
|
|
3
4
|
export * from "./context/LBAuthProvider";
|
|
@@ -32,4 +33,5 @@ export * from "./examples/AiPromptPanelAdvanced";
|
|
|
32
33
|
export * from "./examples/AiChipInputExample";
|
|
33
34
|
export * from "./examples/AiImageButtonExample";
|
|
34
35
|
export * from "./examples/AiContextButtonExample";
|
|
36
|
+
export * from "./examples/AiUiPremiumShowcase";
|
|
35
37
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAGtB,cAAc,SAAS,CAAC;AAGxB,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AAGzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,eAAe,CAAC;AAG9B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AAGzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AAGxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAG9B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAClD,cAAc,gCAAgC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "./styles.css";
|
|
1
2
|
// Types
|
|
2
3
|
export * from "./types";
|
|
3
4
|
// Context
|
|
@@ -39,3 +40,4 @@ export * from "./examples/AiPromptPanelAdvanced";
|
|
|
39
40
|
export * from "./examples/AiChipInputExample";
|
|
40
41
|
export * from "./examples/AiImageButtonExample";
|
|
41
42
|
export * from "./examples/AiContextButtonExample";
|
|
43
|
+
export * from "./examples/AiUiPremiumShowcase";
|
package/dist/styles/inline.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inline.d.ts","sourceRoot":"","sources":["../../src/styles/inline.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"inline.d.ts","sourceRoot":"","sources":["../../src/styles/inline.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAkC/B,eAAO,MAAM,QAAQ;WAgBd,KAAK,CAAC,aAAa;gBAKnB,KAAK,CAAC,aAAa;gBAInB,KAAK,CAAC,aAAa;;;;;mBAyBnB,KAAK,CAAC,aAAa;wBAMnB,KAAK,CAAC,aAAa;cAmBnB,KAAK,CAAC,aAAa;mBAKnB,KAAK,CAAC,aAAa;;;;;sBAwBnB,KAAK,CAAC,aAAa;2BAMnB,KAAK,CAAC,aAAa;YAoBnB,KAAK,CAAC,aAAa;iBAMnB,KAAK,CAAC,aAAa;oBAMnB,KAAK,CAAC,aAAa;YA2BnB,KAAK,CAAC,aAAa;iBAKnB,KAAK,CAAC,aAAa;kBAgBnB,KAAK,CAAC,aAAa;uBAMnB,KAAK,CAAC,aAAa;0BAKnB,KAAK,CAAC,aAAa;aAgBnB,KAAK,CAAC,aAAa;mBASnB,KAAK,CAAC,aAAa;oBAKnB,KAAK,CAAC,aAAa;yBAKnB,KAAK,CAAC,aAAa;qBASnB,KAAK,CAAC,aAAa;gBAQnB,KAAK,CAAC,aAAa;kBAKnB,KAAK,CAAC,aAAa;kBAQnB,KAAK,CAAC,aAAa;sBAKnB,KAAK,CAAC,aAAa;yBAKnB,KAAK,CAAC,aAAa;yBAKnB,KAAK,CAAC,aAAa;oBASnB,KAAK,CAAC,aAAa;iBAcnB,KAAK,CAAC,aAAa;sBAKnB,KAAK,CAAC,aAAa;UAcnB,KAAK,CAAC,aAAa;WAenB,KAAK,CAAC,aAAa;kBAWnB,KAAK,CAAC,aAAa;kBAcnB,KAAK,CAAC,aAAa;iBAQnB,KAAK,CAAC,aAAa;gBAOnB,KAAK,CAAC,aAAa;sBAiBnB,KAAK,CAAC,aAAa;2BAKnB,KAAK,CAAC,aAAa;eAMnB,KAAK,CAAC,aAAa;iBAQnB,KAAK,CAAC,aAAa;gBAQnB,KAAK,CAAC,aAAa;qBAInB,KAAK,CAAC,aAAa;qBASnB,KAAK,CAAC,aAAa;0BAKnB,KAAK,CAAC,aAAa;aAUnB,KAAK,CAAC,aAAa;CACzB,CAAC;AAGF,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,OAAO,EACnB,YAAY,GAAE,MAAY,EAC1B,aAAa,GAAE,MAAY,GAC1B;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAoDlE"}
|