@asgard-js/react 0.0.43-canary.14 → 0.0.43-canary.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asgard-js/react",
3
- "version": "0.0.43-canary.14",
3
+ "version": "0.0.43-canary.15",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
Binary file
@@ -1,4 +1,4 @@
1
- .container {
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
- .header {
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
- .icon {
17
+ .api_key_input__icon {
18
18
  width: 24px;
19
19
  height: 24px;
20
20
  }
21
21
 
22
- .title {
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
- .form {
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
- .label {
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
- .inputWrapper {
43
+ .api_key_input__input_wrapper {
44
44
  position: relative;
45
45
  width: 100%;
46
46
  }
47
47
 
48
- .input {
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
- &.error {
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
- &.disabled {
76
+ &--disabled {
77
77
  opacity: 0.5;
78
78
  cursor: not-allowed;
79
79
  }
80
80
  }
81
81
 
82
- .toggleButton {
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
- .toggleIcon {
109
+ .api_key_input__toggle_icon {
110
110
  width: 16px;
111
111
  height: 16px;
112
112
  }
113
113
 
114
- .errorMessage {
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
- .submitButton {
120
+ .api_key_input__submit_button {
121
121
  width: 100%;
122
122
  height: 42px;
123
123
  border: none;
@@ -145,7 +145,7 @@
145
145
  transform: none;
146
146
  }
147
147
 
148
- &.loading {
148
+ &--loading {
149
149
  position: relative;
150
150
  color: transparent;
151
151
 
@@ -177,7 +177,7 @@
177
177
 
178
178
  // 響應式設計
179
179
  @media (max-width: 280px) {
180
- .container {
180
+ .api_key_input {
181
181
  width: 100%;
182
182
  min-width: 200px;
183
183
  }
@@ -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.container, className)}
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.header}>
57
+ <div className={styles.api_key_input__header}>
56
58
  <ProfileIcon avatar={avatar} />
57
- <h2 className={styles.title} style={chatbot?.header?.title?.style}>{title}</h2>
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.form}>
62
+ <form onSubmit={handleSubmit} className={styles.api_key_input__form}>
61
63
  <div className={styles.inputGroup}>
62
- <label className={styles.label}>Key</label>
63
- <div className={styles.inputWrapper}>
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.input, {
70
- [styles.error]: error,
71
- [styles.disabled]: loading,
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.toggleButton}
82
+ className={styles.api_key_input__toggle_button}
81
83
  disabled={loading}
82
84
  aria-label={showPassword ? 'Hide password' : 'Show password'}
83
85
  >
84
- <svg
85
- className={styles.toggleIcon}
86
- width="16"
87
- height="16"
88
- viewBox="0 0 24 24"
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.errorMessage}>{error}</div>}
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
99
  disabled={!apiKey.trim() || loading}
116
- className={clsx(styles.submitButton, {
117
- [styles.loading]: 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>
@@ -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="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/>
3
+ <circle cx="12" cy="12" r="3"/>
4
+ </svg>