|
| 1 | +@use "sass:math"; |
| 2 | +@use "../mixins/border-radius" as *; |
| 3 | +@use "../mixins/box-shadow" as *; |
| 4 | +@use "../mixins/transition" as *; |
| 5 | +@use "../variables" as *; |
| 6 | + |
| 7 | + |
| 8 | +.form-password { |
| 9 | + position: relative; |
| 10 | + |
| 11 | + .form-control { |
| 12 | + padding-inline-end: ($input-line-height * $input-font-size) + ($input-padding-y * 2); |
| 13 | + } |
| 14 | + |
| 15 | + .form-password-action { |
| 16 | + $size: ($input-line-height * $input-font-size) + $input-padding-y; |
| 17 | + |
| 18 | + position: absolute; |
| 19 | + inset-inline-end: math.div($input-padding-y, 3) * 2; |
| 20 | + top: 50%; |
| 21 | + width: $size; |
| 22 | + height: $size; |
| 23 | + margin-top: calc($size / -2); // stylelint-disable-line function-disallowed-list |
| 24 | + background: $form-password-action-bg; |
| 25 | + border: 0; |
| 26 | + @include border-radius($input-border-radius-sm); |
| 27 | + @include transition($btn-transition); |
| 28 | + |
| 29 | + &:hover:not(:disabled) { |
| 30 | + background-color: $form-password-action-hover-bg; |
| 31 | + |
| 32 | + .form-password-action-icon { |
| 33 | + background-color: $form-password-icon-hover-color; |
| 34 | + } |
| 35 | + } |
| 36 | + |
| 37 | + &:focus { |
| 38 | + color: $input-focus-color; |
| 39 | + background-color: $input-focus-bg; |
| 40 | + border-color: $input-focus-border-color; |
| 41 | + outline: 0; |
| 42 | + @if $enable-shadows { |
| 43 | + @include box-shadow($input-box-shadow, $input-focus-box-shadow); |
| 44 | + } @else { |
| 45 | + // Avoid using mixin so we can pass custom focus shadow properly |
| 46 | + box-shadow: $input-focus-box-shadow; |
| 47 | + } |
| 48 | + } |
| 49 | + } |
| 50 | + |
| 51 | + .form-password-action-icon { |
| 52 | + display: block; |
| 53 | + width: $form-password-icon-size; |
| 54 | + height: $form-password-icon-size; |
| 55 | + background-color: $form-password-icon-color; |
| 56 | + mask: $form-password-icon-show center / $form-password-icon-size no-repeat; |
| 57 | + } |
| 58 | + |
| 59 | + .form-control[type="text"] ~ .form-password-action .form-password-action-icon { |
| 60 | + mask-image: $form-password-icon-hide; |
| 61 | + } |
| 62 | + |
| 63 | + .form-control-lg ~ .form-password-action .form-password-action-icon { |
| 64 | + width: $form-password-icon-size-lg; |
| 65 | + height: $form-password-icon-size-lg; |
| 66 | + mask-size: $form-password-icon-size-lg; |
| 67 | + } |
| 68 | + |
| 69 | + .form-control-sm ~ .form-password-action .form-password-action-icon { |
| 70 | + width: $form-password-icon-size-sm; |
| 71 | + height: $form-password-icon-size-sm; |
| 72 | + mask-size: $form-password-icon-size-sm; |
| 73 | + } |
| 74 | + |
| 75 | + .form-control-lg ~ .form-password-action { |
| 76 | + $size: ($input-line-height * $input-font-size-lg) + $input-padding-y-lg; |
| 77 | + |
| 78 | + inset-inline-end: math.div($input-padding-y-lg, 3) * 2; |
| 79 | + width: $size; |
| 80 | + height: $size; |
| 81 | + margin-top: calc($size / -2); // stylelint-disable-line function-disallowed-list |
| 82 | + @include border-radius($input-border-radius); |
| 83 | + } |
| 84 | + |
| 85 | + .form-control-sm ~ .form-password-action { |
| 86 | + $size: ($input-line-height * $input-font-size-sm) + $input-padding-y-sm; |
| 87 | + |
| 88 | + inset-inline-end: math.div($input-padding-y-sm, 3) * 2; |
| 89 | + width: $size; |
| 90 | + height: $size; |
| 91 | + margin-top: calc($size / -2); // stylelint-disable-line function-disallowed-list |
| 92 | + } |
| 93 | +} |
0 commit comments