Skip to content

Commit 6a1938a

Browse files
committed
fix(input): incorrect floating condition
1 parent dcb0257 commit 6a1938a

File tree

2 files changed

+34
-10
lines changed

2 files changed

+34
-10
lines changed

src/lib/inputs/NeoInput.svelte

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@
199199
if (!labelRef) return;
200200
if (position === NeoInputLabelPosition.Inside && !floating) return;
201201
labelHeight = `${labelRef?.clientHeight ?? 0}px`;
202-
if (position === NeoInputLabelPosition.Left || position === NeoInputLabelPosition.Right) return;
202+
if (position !== NeoInputLabelPosition.Left && position !== NeoInputLabelPosition.Right) return;
203203
labelWidth = `${labelRef?.clientWidth ?? 0}px`;
204204
});
205205
@@ -261,12 +261,12 @@
261261
{#if affix}
262262
<span class="neo-input-affix" class:suffix role="none" onclick={focus}>
263263
{#if loading}
264-
<span out:fade={enterDefaultTransition}>
264+
<span class="neo-input-loading" out:fade={enterDefaultTransition}>
265265
<IconCircleLoading width="1.1875rem" height="1.1875rem" />
266266
</span>
267267
{:else if close}
268268
<button class="neo-input-clear" aria-label="clear" in:fade out:fade={enterDefaultTransition} onclick={() => clear()}>
269-
<IconClear width="1.1875rem" height="1.1875rem" />
269+
<IconClear />
270270
</button>
271271
{:else}
272272
<span class="neo-input-affix-validation" in:fade={leaveDefaultTransition}>
@@ -396,6 +396,7 @@
396396
397397
.neo-input-group,
398398
.neo-input,
399+
.neo-input-loading,
399400
.neo-input-clear,
400401
.neo-input-affix,
401402
.neo-input-prefix,
@@ -445,7 +446,7 @@
445446
}
446447
447448
&.prefix {
448-
margin-left: -0.9rem;
449+
margin-left: -0.7rem;
449450
}
450451
451452
&.suffix {
@@ -480,7 +481,7 @@
480481
481482
&.suffix {
482483
min-width: 2rem;
483-
margin-right: -0.25rem;
484+
margin-right: -0.05rem;
484485
padding-right: 0;
485486
}
486487
}
@@ -528,12 +529,22 @@
528529
529530
align-items: center;
530531
justify-content: center;
532+
width: 1.1875rem;
533+
height: 1.1875rem;
534+
margin: 0;
535+
padding: 0;
531536
color: var(--neo-input-clear-color, inherit);
532537
background-color: var(--neo-background-color-darker);
533538
border: none;
534539
border-radius: 50%;
535540
aspect-ratio: 1;
536541
542+
:global(svg) {
543+
width: 100%;
544+
height: 100%;
545+
margin: 0.05rem;
546+
}
547+
537548
&:focus-visible {
538549
color: var(--neo-close-color-focused, rgb(255 0 0 / 75%));
539550
background-color: var(--neo-close-bg-color-focused, rgb(255 0 0 / 5%));
@@ -615,6 +626,7 @@
615626
.neo-input-group {
616627
position: relative;
617628
margin: var(--neo-shadow-margin, 0.6rem);
629+
padding: 0 0.2rem;
618630
color: var(--neo-input-text-color, inherit);
619631
background-color: var(--neo-input-bg-color, inherit);
620632
border: var(--neo-border-width, 1px) var(--neo-input-border-color, transparent) solid;
@@ -670,15 +682,15 @@
670682
border-radius: var(--neo-input-border-radius-lg, var(--neo-border-radius-lg));
671683
672684
&.prefix {
673-
margin-left: -1.25rem;
685+
margin-left: -0.9rem;
674686
}
675687
676688
&-prefix {
677689
padding: 0.75rem 0.75rem 0.75rem 1rem;
678690
}
679691
680692
&.suffix {
681-
margin-right: -1.25rem;
693+
margin-right: -0.9rem;
682694
}
683695
684696
&-suffix {

src/lib/inputs/NeoTextarea.svelte

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@
197197
if (!labelRef) return;
198198
if (position === NeoInputLabelPosition.Inside && !floating) return;
199199
labelHeight = `${labelRef?.clientHeight ?? 0}px`;
200-
if (position === NeoInputLabelPosition.Left || position === NeoInputLabelPosition.Right) return;
200+
if (position !== NeoInputLabelPosition.Left && position !== NeoInputLabelPosition.Right) return;
201201
labelWidth = `${labelRef?.clientWidth ?? 0}px`;
202202
});
203203
@@ -288,12 +288,12 @@
288288
{#if affix}
289289
<span class="neo-textarea-affix" role="none" onclick={focus}>
290290
{#if loading}
291-
<span out:fade={enterDefaultTransition}>
291+
<span class="neo-textarea-loading" out:fade={enterDefaultTransition}>
292292
<IconCircleLoading width="1.1875rem" height="1.1875rem" />
293293
</span>
294294
{:else if close}
295295
<button class="neo-textarea-clear" aria-label="clear" in:fade out:fade={enterDefaultTransition} onclick={() => clear()}>
296-
<IconClear width="1.1875rem" height="1.1875rem" />
296+
<IconClear />
297297
</button>
298298
{:else}
299299
<span class="neo-textarea-affix-validation" in:fade={leaveDefaultTransition}>
@@ -415,6 +415,7 @@
415415
416416
.neo-textarea-group,
417417
.neo-textarea,
418+
.neo-textarea-loading,
418419
.neo-textarea-clear,
419420
.neo-textarea-affix,
420421
.neo-textarea-suffix {
@@ -538,12 +539,22 @@
538539
539540
align-items: center;
540541
justify-content: center;
542+
width: 1.1875rem;
543+
height: 1.1875rem;
544+
margin: 0;
545+
padding: 0;
541546
color: var(--neo-textarea-clear-color, inherit);
542547
background-color: var(--neo-background-color-darker);
543548
border: none;
544549
border-radius: 50%;
545550
aspect-ratio: 1;
546551
552+
:global(svg) {
553+
width: 100%;
554+
height: 100%;
555+
margin: 0.05rem;
556+
}
557+
547558
&:focus-visible {
548559
color: var(--neo-close-color-focused, rgb(255 0 0 / 75%));
549560
background-color: var(--neo-close-bg-color-focused, rgb(255 0 0 / 5%));
@@ -616,6 +627,7 @@
616627
.neo-textarea-group {
617628
position: relative;
618629
margin: var(--neo-shadow-margin, 0.6rem);
630+
padding: 0 0.2rem;
619631
color: var(--neo-textarea-text-color, inherit);
620632
background-color: var(--neo-textarea-bg-color, inherit);
621633
border: var(--neo-border-width, 1px) var(--neo-textarea-border-color, transparent) solid;

0 commit comments

Comments
 (0)