@asgard-js/react 0.0.42-canary.5 → 0.0.43-canary.1
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/chatbot/api-key-input/api-key-input.d.ts +1 -1
- package/dist/components/chatbot/api-key-input/api-key-input.d.ts.map +1 -1
- package/dist/index.js +3665 -3656
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/chatbot/api-key-input/api-key-input.module.scss +13 -21
- package/src/components/chatbot/api-key-input/api-key-input.tsx +18 -14
package/package.json
CHANGED
|
@@ -1,27 +1,22 @@
|
|
|
1
1
|
.container {
|
|
2
2
|
width: 220px;
|
|
3
|
-
background:
|
|
3
|
+
background-color: var(--asg-color-bg);
|
|
4
4
|
border-radius: 12px;
|
|
5
|
-
padding:
|
|
6
|
-
|
|
7
|
-
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
8
|
-
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
|
|
9
|
-
color: white;
|
|
10
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
|
|
5
|
+
padding: 12px 20px;
|
|
6
|
+
border: 0.5px solid var(--asg-color-border);
|
|
11
7
|
}
|
|
12
8
|
|
|
13
9
|
.header {
|
|
14
10
|
display: flex;
|
|
15
11
|
flex-direction: column;
|
|
12
|
+
gap: 4px;
|
|
16
13
|
align-items: center;
|
|
17
|
-
margin-bottom:
|
|
14
|
+
margin-bottom: 12px;
|
|
18
15
|
}
|
|
19
16
|
|
|
20
17
|
.icon {
|
|
21
|
-
width:
|
|
22
|
-
height:
|
|
23
|
-
margin-bottom: 12px;
|
|
24
|
-
opacity: 0.7;
|
|
18
|
+
width: 24px;
|
|
19
|
+
height: 24px;
|
|
25
20
|
}
|
|
26
21
|
|
|
27
22
|
.title {
|
|
@@ -29,21 +24,18 @@
|
|
|
29
24
|
font-size: 18px;
|
|
30
25
|
font-weight: 500;
|
|
31
26
|
color: white;
|
|
32
|
-
text-align: center;
|
|
33
27
|
}
|
|
34
28
|
|
|
35
29
|
.form {
|
|
36
30
|
width: 100%;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
margin-bottom: 20px;
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
gap: 20px;
|
|
41
34
|
}
|
|
42
35
|
|
|
43
36
|
.label {
|
|
44
37
|
display: block;
|
|
45
38
|
font-size: 14px;
|
|
46
|
-
font-weight: 400;
|
|
47
39
|
color: rgba(255, 255, 255, 0.7);
|
|
48
40
|
margin-bottom: 8px;
|
|
49
41
|
}
|
|
@@ -128,7 +120,7 @@
|
|
|
128
120
|
.submitButton {
|
|
129
121
|
width: 100%;
|
|
130
122
|
height: 42px;
|
|
131
|
-
background: #
|
|
123
|
+
background: #5856d6;
|
|
132
124
|
border: none;
|
|
133
125
|
border-radius: 6px;
|
|
134
126
|
color: white;
|
|
@@ -139,7 +131,7 @@
|
|
|
139
131
|
outline: none;
|
|
140
132
|
|
|
141
133
|
&:hover:not(:disabled) {
|
|
142
|
-
background: #
|
|
134
|
+
background: #4845c7;
|
|
143
135
|
transform: translateY(-1px);
|
|
144
136
|
}
|
|
145
137
|
|
|
@@ -189,4 +181,4 @@
|
|
|
189
181
|
width: 100%;
|
|
190
182
|
min-width: 200px;
|
|
191
183
|
}
|
|
192
|
-
}
|
|
184
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useState, FormEvent, ChangeEvent } from 'react';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import ProfileSvg from '../../../icons/profile.svg?react';
|
|
4
|
+
import { useAsgardThemeContext } from '../../../context/asgard-theme-context';
|
|
4
5
|
import styles from './api-key-input.module.scss';
|
|
5
6
|
|
|
6
7
|
export interface ApiKeyInputProps {
|
|
@@ -21,27 +22,34 @@ export function ApiKeyInput({
|
|
|
21
22
|
title = 'Preview',
|
|
22
23
|
showToggle = true,
|
|
23
24
|
className,
|
|
24
|
-
}: ApiKeyInputProps) {
|
|
25
|
+
}: ApiKeyInputProps): JSX.Element {
|
|
25
26
|
const [apiKey, setApiKey] = useState('');
|
|
26
27
|
const [showPassword, setShowPassword] = useState(false);
|
|
28
|
+
const { chatbot } = useAsgardThemeContext();
|
|
27
29
|
|
|
28
|
-
const handleSubmit = (e: FormEvent) => {
|
|
30
|
+
const handleSubmit = (e: FormEvent): void => {
|
|
29
31
|
e.preventDefault();
|
|
30
32
|
if (apiKey.trim() && !loading) {
|
|
31
33
|
onSubmit(apiKey.trim());
|
|
32
34
|
}
|
|
33
35
|
};
|
|
34
36
|
|
|
35
|
-
const handleInputChange = (e: ChangeEvent<HTMLInputElement>) => {
|
|
37
|
+
const handleInputChange = (e: ChangeEvent<HTMLInputElement>): void => {
|
|
36
38
|
setApiKey(e.target.value);
|
|
37
39
|
};
|
|
38
40
|
|
|
39
|
-
const togglePasswordVisibility = () => {
|
|
41
|
+
const togglePasswordVisibility = (): void => {
|
|
40
42
|
setShowPassword(!showPassword);
|
|
41
43
|
};
|
|
42
44
|
|
|
43
45
|
return (
|
|
44
|
-
<div
|
|
46
|
+
<div
|
|
47
|
+
className={clsx(styles.container, className)}
|
|
48
|
+
style={{
|
|
49
|
+
backgroundColor: chatbot.backgroundColor,
|
|
50
|
+
borderColor: chatbot.borderColor,
|
|
51
|
+
}}
|
|
52
|
+
>
|
|
45
53
|
<div className={styles.header}>
|
|
46
54
|
<ProfileSvg className={styles.icon} />
|
|
47
55
|
<h2 className={styles.title}>{title}</h2>
|
|
@@ -84,24 +92,20 @@ export function ApiKeyInput({
|
|
|
84
92
|
>
|
|
85
93
|
{showPassword ? (
|
|
86
94
|
<>
|
|
87
|
-
<path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"/>
|
|
88
|
-
<line x1="1" y1="1" x2="23" y2="23"/>
|
|
95
|
+
<path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24" />
|
|
96
|
+
<line x1="1" y1="1" x2="23" y2="23" />
|
|
89
97
|
</>
|
|
90
98
|
) : (
|
|
91
99
|
<>
|
|
92
|
-
<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/>
|
|
93
|
-
<circle cx="12" cy="12" r="3"/>
|
|
100
|
+
<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" />
|
|
101
|
+
<circle cx="12" cy="12" r="3" />
|
|
94
102
|
</>
|
|
95
103
|
)}
|
|
96
104
|
</svg>
|
|
97
105
|
</button>
|
|
98
106
|
)}
|
|
99
107
|
</div>
|
|
100
|
-
{error &&
|
|
101
|
-
<div className={styles.errorMessage}>
|
|
102
|
-
{error}
|
|
103
|
-
</div>
|
|
104
|
-
)}
|
|
108
|
+
{error && <div className={styles.errorMessage}>{error}</div>}
|
|
105
109
|
</div>
|
|
106
110
|
|
|
107
111
|
<button
|