@@ -76,7 +76,7 @@ export default function InputComponent({
76
76
editNode ? " input-edit-node " : "" ,
77
77
password && editNode ? "pr-8" : "" ,
78
78
password && ! editNode ? "pr-10" : "" ,
79
- className !
79
+ className ! ,
80
80
) }
81
81
placeholder = { password && editNode ? "Key" : placeholder }
82
82
onChange = { ( e ) => {
@@ -104,9 +104,9 @@ export default function InputComponent({
104
104
( selectedOption !== "" || ! onChange ) && setSelectedOption
105
105
? selectedOption
106
106
: ( selectedOptions ?. length !== 0 || ! onChange ) &&
107
- setSelectedOptions
108
- ? selectedOptions ?. join ( ", " )
109
- : value
107
+ setSelectedOptions
108
+ ? selectedOptions ?. join ( ", " )
109
+ : value
110
110
}
111
111
autoFocus = { autoFocus }
112
112
disabled = { disabled }
@@ -120,7 +120,7 @@ export default function InputComponent({
120
120
required = { required }
121
121
className = { classNames (
122
122
password &&
123
- selectedOption === "" &&
123
+ ( ! setSelectedOption || selectedOption === "" ) &&
124
124
! pwdVisible &&
125
125
value !== ""
126
126
? " text-clip password "
@@ -134,7 +134,7 @@ export default function InputComponent({
134
134
? "pr-8"
135
135
: "" ,
136
136
137
- className !
137
+ className ! ,
138
138
) }
139
139
placeholder = { password && editNode ? "Key" : placeholder }
140
140
onChange = { ( e ) => {
@@ -194,15 +194,15 @@ export default function InputComponent({
194
194
setSelectedOption (
195
195
currentValue === selectedOption
196
196
? ""
197
- : currentValue
197
+ : currentValue ,
198
198
) ;
199
199
setSelectedOptions &&
200
200
setSelectedOptions (
201
201
selectedOptions ?. includes ( currentValue )
202
202
? selectedOptions . filter (
203
- ( item ) => item !== currentValue
203
+ ( item ) => item !== currentValue ,
204
204
)
205
- : [ ...selectedOptions , currentValue ]
205
+ : [ ...selectedOptions , currentValue ] ,
206
206
) ;
207
207
! setSelectedOptions && setShowOptions ( false ) ;
208
208
} }
@@ -215,7 +215,7 @@ export default function InputComponent({
215
215
selectedOption === option ||
216
216
selectedOptions ?. includes ( option )
217
217
? "opacity-100"
218
- : "opacity-0"
218
+ : "opacity-0" ,
219
219
) }
220
220
>
221
221
< div className = "absolute opacity-100 transition-all group-hover:opacity-0" >
@@ -254,7 +254,7 @@ export default function InputComponent({
254
254
( ( selectedOptions ?. length !== 0 || ! onChange ) &&
255
255
setSelectedOptions )
256
256
? ""
257
- : "hidden"
257
+ : "hidden" ,
258
258
) }
259
259
onClick = {
260
260
( ( selectedOption !== "" || ! onChange ) && setSelectedOption ) ||
@@ -275,7 +275,7 @@ export default function InputComponent({
275
275
< span
276
276
className = { cn (
277
277
password && selectedOption === "" ? "right-8" : "right-0" ,
278
- "absolute inset-y-0 flex items-center pr-2.5"
278
+ "absolute inset-y-0 flex items-center pr-2.5" ,
279
279
) }
280
280
>
281
281
< button
@@ -286,7 +286,7 @@ export default function InputComponent({
286
286
selectedOption !== ""
287
287
? "text-medium-indigo"
288
288
: "text-muted-foreground" ,
289
- "hover:text-accent-foreground"
289
+ "hover:text-accent-foreground" ,
290
290
) }
291
291
>
292
292
< ForwardedIconComponent
@@ -298,67 +298,65 @@ export default function InputComponent({
298
298
</ span >
299
299
) }
300
300
301
- { password && selectedOption === "" && (
301
+ { password && ( ! setSelectedOption || selectedOption === "" ) && (
302
302
< button
303
303
type = "button"
304
304
tabIndex = { - 1 }
305
305
className = { classNames (
306
306
"mb-px" ,
307
307
editNode
308
308
? "input-component-true-button"
309
- : "input-component-false-button"
309
+ : "input-component-false-button" ,
310
310
) }
311
311
onClick = { ( event ) => {
312
312
event . preventDefault ( ) ;
313
313
setPwdVisible ( ! pwdVisible ) ;
314
314
} }
315
315
>
316
- { password &&
317
- selectedOption === "" &&
318
- ( pwdVisible ? (
319
- < svg
320
- xmlns = "http://www.w3.org/2000/svg"
321
- fill = "none"
322
- viewBox = "0 0 24 24"
323
- strokeWidth = { 1.5 }
324
- stroke = "currentColor"
325
- className = { classNames (
326
- editNode
327
- ? "input-component-true-svg"
328
- : "input-component-false-svg"
329
- ) }
330
- >
331
- < path
332
- strokeLinecap = "round"
333
- strokeLinejoin = "round"
334
- d = "M3.98 8.223A10.477 10.477 0 001.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0112 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 01-4.293 5.774M6.228 6.228L3 3m3.228 3.228l3.65 3.65m7.894 7.894L21 21m-3.228-3.228l-3.65-3.65m0 0a3 3 0 10-4.243-4.243m4.242 4.242L9.88 9.88"
335
- />
336
- </ svg >
337
- ) : (
338
- < svg
339
- xmlns = "http://www.w3.org/2000/svg"
340
- fill = "none"
341
- viewBox = "0 0 24 24"
342
- strokeWidth = { 1.5 }
343
- stroke = "currentColor"
344
- className = { classNames (
345
- editNode
346
- ? "input-component-true-svg"
347
- : "input-component-false-svg"
348
- ) }
349
- >
350
- < path
351
- strokeLinecap = "round"
352
- strokeLinejoin = "round"
353
- d = "M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z"
354
- />
355
- < path
356
- strokeLinecap = "round"
357
- strokeLinejoin = "round"
358
- d = "M15 12a3 3 0 11-6 0 3 3 0 016 0z"
359
- />
360
- </ svg >
361
- ) ) }
316
+ { pwdVisible ? (
317
+ < svg
318
+ xmlns = "http://www.w3.org/2000/svg"
319
+ fill = "none"
320
+ viewBox = "0 0 24 24"
321
+ strokeWidth = { 1.5 }
322
+ stroke = "currentColor"
323
+ className = { classNames (
324
+ editNode
325
+ ? "input-component-true-svg"
326
+ : "input-component-false-svg" ,
327
+ ) }
328
+ >
329
+ < path
330
+ strokeLinecap = "round"
331
+ strokeLinejoin = "round"
332
+ d = "M3.98 8.223A10.477 10.477 0 001.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0112 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 01-4.293 5.774M6.228 6.228L3 3m3.228 3.228l3.65 3.65m7.894 7.894L21 21m-3.228-3.228l-3.65-3.65m0 0a3 3 0 10-4.243-4.243m4.242 4.242L9.88 9.88"
333
+ />
334
+ </ svg >
335
+ ) : (
336
+ < svg
337
+ xmlns = "http://www.w3.org/2000/svg"
338
+ fill = "none"
339
+ viewBox = "0 0 24 24"
340
+ strokeWidth = { 1.5 }
341
+ stroke = "currentColor"
342
+ className = { classNames (
343
+ editNode
344
+ ? "input-component-true-svg"
345
+ : "input-component-false-svg" ,
346
+ ) }
347
+ >
348
+ < path
349
+ strokeLinecap = "round"
350
+ strokeLinejoin = "round"
351
+ d = "M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z"
352
+ />
353
+ < path
354
+ strokeLinecap = "round"
355
+ strokeLinejoin = "round"
356
+ d = "M15 12a3 3 0 11-6 0 3 3 0 016 0z"
357
+ />
358
+ </ svg >
359
+ ) }
362
360
</ button >
363
361
) }
364
362
</ div >
0 commit comments