Skip to content

Commit 931f80a

Browse files
authored
fix(input-group): make sure that the input of type search does not interfere with the outline variant (#1520)
1 parent a4ebd65 commit 931f80a

File tree

1 file changed

+49
-22
lines changed

1 file changed

+49
-22
lines changed

src/components/input/themes/shared/input.material.scss

Lines changed: 49 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,24 @@ input:placeholder-shown + [part='notch'] [part='label'],
278278
}
279279
}
280280

281+
:host([outlined][type='search']) {
282+
[part~='labelled'] [part~='input'] {
283+
padding-top: rem(20px);
284+
padding-bottom: rem(6px);
285+
}
286+
287+
input:placeholder-shown + [part='notch'] [part='label'],
288+
[part~='filled'] + [part='notch'] [part='label'] {
289+
transform: translateY(-73%);
290+
}
291+
}
292+
293+
:host([outlined][type='search']:focus-within) {
294+
[part='notch'] [part='label'] {
295+
transform: translateY(-73%);
296+
}
297+
}
298+
281299
:host(:disabled[type='search']),
282300
:host([disabled][type='search']) {
283301
[part^='container'] {
@@ -287,7 +305,7 @@ input:placeholder-shown + [part='notch'] [part='label'],
287305
}
288306
}
289307

290-
:host([outlined]) {
308+
:host(:not([type='search'])[outlined]) {
291309
[part^='container'] {
292310
border-radius: var-get($theme, 'border-border-radius');
293311
background: var-get($theme, 'border-background');
@@ -314,16 +332,6 @@ input:placeholder-shown + [part='notch'] [part='label'],
314332
}
315333
}
316334

317-
[part='notch'] {
318-
border: {
319-
width: $idle-border-width;
320-
style: solid;
321-
color: var-get($theme, 'border-color');
322-
left: none;
323-
right: none;
324-
}
325-
}
326-
327335
[part='filler'] {
328336
border: {
329337
width: $idle-border-width;
@@ -354,13 +362,26 @@ input:placeholder-shown + [part='notch'] [part='label'],
354362
};
355363
}
356364
}
365+
}
366+
367+
:host([outlined]) {
368+
[part='notch'] {
369+
border: {
370+
width: $idle-border-width;
371+
style: solid;
372+
color: var-get($theme, 'border-color');
373+
left: none;
374+
right: none;
375+
}
376+
}
357377

358378
[part~='filled'] + [part='notch'] {
359379
@extend %floated-styles;
360380
}
361381
}
362382

363-
:host([readonly][outlined]:focus-within) {
383+
384+
:host(:not([type='search'])[readonly][outlined]:focus-within) {
364385
:not([part~='filled']) {
365386
input:not(:placeholder-shown) + [part='notch'] [part='label'] {
366387
transform: translate(0);
@@ -376,7 +397,7 @@ input:placeholder-shown + [part='notch'] [part='label'],
376397
}
377398
}
378399

379-
:host([outlined]:focus-within) {
400+
:host(:not([type='search'])[outlined]:focus-within) {
380401
[part='label'] {
381402
margin-block-start: calc(#{$active-border-width} / 2);
382403
}
@@ -423,9 +444,9 @@ input:placeholder-shown + [part='notch'] [part='label'],
423444
}
424445
}
425446

426-
:host([outlined]:active),
427-
:host([outlined]:focus),
428-
:host([outlined]:focus-within) {
447+
:host(:not([type='search'])[outlined]:active),
448+
:host(:not([type='search'])[outlined]:focus),
449+
:host(:not([type='search'])[outlined]:focus-within) {
429450
[part='suffix'] {
430451
margin-inline-end: rem(-1px);
431452
}
@@ -442,8 +463,8 @@ input:placeholder-shown + [part='notch'] [part='label'],
442463
}
443464
}
444465

445-
:host([outlined][invalid]),
446-
:host([outlined][invalid]:focus-within) {
466+
:host(:not([type='search'])[outlined][invalid]),
467+
:host(:not([type='search'])[outlined][invalid]:focus-within) {
447468
[part='start'],
448469
[part='notch'],
449470
[part='filler'],
@@ -457,13 +478,13 @@ input:placeholder-shown + [part='notch'] [part='label'],
457478
}
458479
}
459480

460-
:host([outlined][invalid]:focus-within) {
481+
:host(:not([type='search'])[outlined][invalid]:focus-within) {
461482
[part='notch'] {
462483
border-top: $idle-border-width solid transparent;
463484
}
464485
}
465486

466-
:host([readonly][outlined][invalid]:focus-within) {
487+
:host(:not([type='search'])[readonly][outlined][invalid]:focus-within) {
467488
input:not(:placeholder-shown) + [part='notch'] {
468489
border: {
469490
width: $active-border-width;
@@ -479,8 +500,8 @@ input:placeholder-shown + [part='notch'] [part='label'],
479500
}
480501
}
481502

482-
:host(:disabled[outlined]),
483-
:host([disabled][outlined]) {
503+
:host(:not([type='search']):disabled[outlined]),
504+
:host(:not([type='search'])[disabled][outlined]) {
484505
[part='start'],
485506
[part='filler'],
486507
[part='notch'],
@@ -494,6 +515,12 @@ input:placeholder-shown + [part='notch'] [part='label'],
494515
}
495516
}
496517

518+
:host([type='search'][outlined]) {
519+
[part='notch'] {
520+
border: none
521+
}
522+
}
523+
497524
:host(:disabled),
498525
:host([disabled]) {
499526
[part~='input'],

0 commit comments

Comments
 (0)