diff --git a/src/components/text-input/_text-input.scss b/src/components/text-input/_text-input.scss index 88b3963d3974..d0494f098d5d 100644 --- a/src/components/text-input/_text-input.scss +++ b/src/components/text-input/_text-input.scss @@ -143,6 +143,36 @@ &:active { @include focus-outline('outline'); } + + &-wrapper svg[hidden] { + display: none; + } + + &[type='text'] + .#{$prefix}--text-input--password__visibility, + &[type='password'] + .#{$prefix}--text-input--password__visibility { + top: rem(-28px); + right: rem(12px); + display: flex; + justify-content: center; + align-self: flex-end; + align-items: center; + height: rem(16px); + width: rem(16px); + padding: 0; + margin-bottom: -1rem; + border: 0; + background: none; + cursor: pointer; + outline: inherit; + + svg { + fill: $brand-01; + + &:hover { + fill: $hover-primary; + } + } + } } .#{$prefix}--text-input::-webkit-input-placeholder { @@ -161,6 +191,18 @@ background-position: right 8px bottom 50%; } + .#{$prefix}--text-input:disabled + .#{$prefix}--text-input--password__visibility svg { + opacity: 0.5; + cursor: not-allowed; + } + + .#{$prefix}--text-input:disabled + .#{$prefix}--text-input--password__visibility, + .#{$prefix}--text-input[data-invalid] + .#{$prefix}--text-input--password__visibility, + .#{$prefix}--text-input:invalid + .#{$prefix}--text-input--password__visibility, + .#{$prefix}--text-input[data-loading] + .#{$prefix}--text-input--password__visibility { + right: rem(32px); + } + //----------------------------- // Disabled //----------------------------- diff --git a/src/components/text-input/text-input.hbs b/src/components/text-input/text-input.hbs index b0b694782d21..e5e48b609bf1 100644 --- a/src/components/text-input/text-input.hbs +++ b/src/components/text-input/text-input.hbs @@ -14,13 +14,13 @@ placeholder="Placeholder text" data-toggle-password-visibility>