@asgard-js/react 0.0.43-canary.14 → 0.0.43-canary.16
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.map +1 -1
- package/dist/index.js +6766 -6786
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/.DS_Store +0 -0
- package/src/components/chatbot/api-key-input/api-key-input.module.scss +16 -24
- package/src/components/chatbot/api-key-input/api-key-input.tsx +21 -37
- package/src/icons/eye-off.svg +4 -0
- package/src/icons/eye.svg +4 -0
package/package.json
CHANGED
package/src/components/.DS_Store
CHANGED
|
Binary file
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.
|
|
1
|
+
.api_key_input {
|
|
2
2
|
width: 220px;
|
|
3
3
|
background-color: var(--asg-color-bg);
|
|
4
4
|
border-radius: 12px;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
border: 0.5px solid var(--asg-color-border);
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
.
|
|
9
|
+
.api_key_input__header {
|
|
10
10
|
display: flex;
|
|
11
11
|
flex-direction: column;
|
|
12
12
|
gap: 4px;
|
|
@@ -14,38 +14,38 @@
|
|
|
14
14
|
margin-bottom: 12px;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
.
|
|
17
|
+
.api_key_input__icon {
|
|
18
18
|
width: 24px;
|
|
19
19
|
height: 24px;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
.
|
|
22
|
+
.api_key_input__title {
|
|
23
23
|
margin: 0;
|
|
24
24
|
font-size: 18px;
|
|
25
25
|
font-weight: 500;
|
|
26
26
|
color: white;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
.
|
|
29
|
+
.api_key_input__form {
|
|
30
30
|
width: 100%;
|
|
31
31
|
display: flex;
|
|
32
32
|
flex-direction: column;
|
|
33
33
|
gap: 20px;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
.
|
|
36
|
+
.api_key_input__label {
|
|
37
37
|
display: block;
|
|
38
38
|
font-size: 14px;
|
|
39
39
|
color: rgba(255, 255, 255, 0.7);
|
|
40
40
|
margin-bottom: 8px;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
.
|
|
43
|
+
.api_key_input__input_wrapper {
|
|
44
44
|
position: relative;
|
|
45
45
|
width: 100%;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
.
|
|
48
|
+
.api_key_input__input {
|
|
49
49
|
width: 100%;
|
|
50
50
|
height: 42px;
|
|
51
51
|
padding: 0 40px 0 12px;
|
|
@@ -68,18 +68,18 @@
|
|
|
68
68
|
background: rgba(255, 255, 255, 0.08);
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
&--error {
|
|
72
72
|
border-color: rgba(255, 69, 58, 0.6);
|
|
73
73
|
background: rgba(255, 69, 58, 0.05);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
&--disabled {
|
|
77
77
|
opacity: 0.5;
|
|
78
78
|
cursor: not-allowed;
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
.
|
|
82
|
+
.api_key_input__toggle_button {
|
|
83
83
|
position: absolute;
|
|
84
84
|
right: 8px;
|
|
85
85
|
top: 50%;
|
|
@@ -106,18 +106,18 @@
|
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
.
|
|
109
|
+
.api_key_input__toggle_icon {
|
|
110
110
|
width: 16px;
|
|
111
111
|
height: 16px;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
.
|
|
114
|
+
.api_key_input__error_message {
|
|
115
115
|
margin-top: 6px;
|
|
116
116
|
font-size: 12px;
|
|
117
117
|
color: rgba(255, 69, 58, 0.8);
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
.
|
|
120
|
+
.api_key_input__submit_button {
|
|
121
121
|
width: 100%;
|
|
122
122
|
height: 42px;
|
|
123
123
|
border: none;
|
|
@@ -130,14 +130,6 @@
|
|
|
130
130
|
transition: all 0.2s ease;
|
|
131
131
|
outline: none;
|
|
132
132
|
|
|
133
|
-
&:hover:not(:disabled) {
|
|
134
|
-
opacity: 0.9;
|
|
135
|
-
transform: translateY(-1px);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
&:active:not(:disabled) {
|
|
139
|
-
transform: translateY(0);
|
|
140
|
-
}
|
|
141
133
|
|
|
142
134
|
&:disabled {
|
|
143
135
|
opacity: 0.5;
|
|
@@ -145,7 +137,7 @@
|
|
|
145
137
|
transform: none;
|
|
146
138
|
}
|
|
147
139
|
|
|
148
|
-
|
|
140
|
+
&--loading {
|
|
149
141
|
position: relative;
|
|
150
142
|
color: transparent;
|
|
151
143
|
|
|
@@ -177,7 +169,7 @@
|
|
|
177
169
|
|
|
178
170
|
// 響應式設計
|
|
179
171
|
@media (max-width: 280px) {
|
|
180
|
-
.
|
|
172
|
+
.api_key_input {
|
|
181
173
|
width: 100%;
|
|
182
174
|
min-width: 200px;
|
|
183
175
|
}
|
|
@@ -3,6 +3,8 @@ import clsx from 'clsx';
|
|
|
3
3
|
import { useAsgardThemeContext } from '../../../context/asgard-theme-context';
|
|
4
4
|
import { useAsgardContext } from '../../../context/asgard-service-context';
|
|
5
5
|
import { ProfileIcon } from '../profile-icon';
|
|
6
|
+
import EyeSvg from '../../../icons/eye.svg?react';
|
|
7
|
+
import EyeOffSvg from '../../../icons/eye-off.svg?react';
|
|
6
8
|
import styles from './api-key-input.module.scss';
|
|
7
9
|
|
|
8
10
|
export interface ApiKeyInputProps {
|
|
@@ -46,29 +48,29 @@ export function ApiKeyInput({
|
|
|
46
48
|
|
|
47
49
|
return (
|
|
48
50
|
<div
|
|
49
|
-
className={clsx(styles.
|
|
51
|
+
className={clsx(styles.api_key_input, className)}
|
|
50
52
|
style={{
|
|
51
53
|
backgroundColor: chatbot.backgroundColor,
|
|
52
54
|
borderColor: chatbot.borderColor,
|
|
53
55
|
}}
|
|
54
56
|
>
|
|
55
|
-
<div className={styles.
|
|
57
|
+
<div className={styles.api_key_input__header}>
|
|
56
58
|
<ProfileIcon avatar={avatar} />
|
|
57
|
-
<h2 className={styles.
|
|
59
|
+
<h2 className={styles.api_key_input__title} style={chatbot?.header?.title?.style}>{title}</h2>
|
|
58
60
|
</div>
|
|
59
61
|
|
|
60
|
-
<form onSubmit={handleSubmit} className={styles.
|
|
62
|
+
<form onSubmit={handleSubmit} className={styles.api_key_input__form}>
|
|
61
63
|
<div className={styles.inputGroup}>
|
|
62
|
-
<label className={styles.
|
|
63
|
-
<div className={styles.
|
|
64
|
+
<label className={styles.api_key_input__label}>Key</label>
|
|
65
|
+
<div className={styles.api_key_input__input_wrapper}>
|
|
64
66
|
<input
|
|
65
67
|
type={showPassword ? 'text' : 'password'}
|
|
66
68
|
value={apiKey}
|
|
67
69
|
onChange={handleInputChange}
|
|
68
70
|
placeholder={placeholder}
|
|
69
|
-
className={clsx(styles.
|
|
70
|
-
[styles
|
|
71
|
-
[styles
|
|
71
|
+
className={clsx(styles.api_key_input__input, {
|
|
72
|
+
[styles['api_key_input__input--error']]: error,
|
|
73
|
+
[styles['api_key_input__input--disabled']]: loading,
|
|
72
74
|
})}
|
|
73
75
|
disabled={loading}
|
|
74
76
|
autoComplete="off"
|
|
@@ -77,44 +79,26 @@ export function ApiKeyInput({
|
|
|
77
79
|
<button
|
|
78
80
|
type="button"
|
|
79
81
|
onClick={togglePasswordVisibility}
|
|
80
|
-
className={styles.
|
|
82
|
+
className={styles.api_key_input__toggle_button}
|
|
81
83
|
disabled={loading}
|
|
82
84
|
aria-label={showPassword ? 'Hide password' : 'Show password'}
|
|
83
85
|
>
|
|
84
|
-
|
|
85
|
-
className={styles.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
fill="none"
|
|
90
|
-
stroke="currentColor"
|
|
91
|
-
strokeWidth="2"
|
|
92
|
-
strokeLinecap="round"
|
|
93
|
-
strokeLinejoin="round"
|
|
94
|
-
>
|
|
95
|
-
{showPassword ? (
|
|
96
|
-
<>
|
|
97
|
-
<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" />
|
|
98
|
-
<line x1="1" y1="1" x2="23" y2="23" />
|
|
99
|
-
</>
|
|
100
|
-
) : (
|
|
101
|
-
<>
|
|
102
|
-
<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" />
|
|
103
|
-
<circle cx="12" cy="12" r="3" />
|
|
104
|
-
</>
|
|
105
|
-
)}
|
|
106
|
-
</svg>
|
|
86
|
+
{showPassword ? (
|
|
87
|
+
<EyeOffSvg className={styles.api_key_input__toggle_icon} />
|
|
88
|
+
) : (
|
|
89
|
+
<EyeSvg className={styles.api_key_input__toggle_icon} />
|
|
90
|
+
)}
|
|
107
91
|
</button>
|
|
108
92
|
)}
|
|
109
93
|
</div>
|
|
110
|
-
{error && <div className={styles.
|
|
94
|
+
{error && <div className={styles.api_key_input__error_message}>{error}</div>}
|
|
111
95
|
</div>
|
|
112
96
|
|
|
113
97
|
<button
|
|
114
98
|
type="submit"
|
|
115
|
-
disabled={
|
|
116
|
-
className={clsx(styles.
|
|
117
|
-
[styles
|
|
99
|
+
disabled={loading}
|
|
100
|
+
className={clsx(styles.api_key_input__submit_button, {
|
|
101
|
+
[styles['api_key_input__submit_button--loading']]: loading,
|
|
118
102
|
})}
|
|
119
103
|
style={{
|
|
120
104
|
backgroundColor: chatbot?.mainColor,
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
2
|
+
<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"/>
|
|
3
|
+
<line x1="1" y1="1" x2="23" y2="23"/>
|
|
4
|
+
</svg>
|