[d565449] | 1 | .form-floating {
|
---|
| 2 | position: relative;
|
---|
| 3 |
|
---|
| 4 | > .form-control,
|
---|
| 5 | > .form-control-plaintext,
|
---|
| 6 | > .form-select {
|
---|
| 7 | height: $form-floating-height;
|
---|
| 8 | min-height: $form-floating-height;
|
---|
| 9 | line-height: $form-floating-line-height;
|
---|
| 10 | }
|
---|
| 11 |
|
---|
| 12 | > label {
|
---|
| 13 | position: absolute;
|
---|
| 14 | top: 0;
|
---|
| 15 | left: 0;
|
---|
| 16 | z-index: 2;
|
---|
| 17 | height: 100%; // allow textareas
|
---|
| 18 | padding: $form-floating-padding-y $form-floating-padding-x;
|
---|
| 19 | overflow: hidden;
|
---|
| 20 | text-align: start;
|
---|
| 21 | text-overflow: ellipsis;
|
---|
| 22 | white-space: nowrap;
|
---|
| 23 | pointer-events: none;
|
---|
| 24 | border: $input-border-width solid transparent; // Required for aligning label's text with the input as it affects inner box model
|
---|
| 25 | transform-origin: 0 0;
|
---|
| 26 | @include transition($form-floating-transition);
|
---|
| 27 | }
|
---|
| 28 |
|
---|
| 29 | > .form-control,
|
---|
| 30 | > .form-control-plaintext {
|
---|
| 31 | padding: $form-floating-padding-y $form-floating-padding-x;
|
---|
| 32 |
|
---|
| 33 | &::placeholder {
|
---|
| 34 | color: transparent;
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | &:focus,
|
---|
| 38 | &:not(:placeholder-shown) {
|
---|
| 39 | padding-top: $form-floating-input-padding-t;
|
---|
| 40 | padding-bottom: $form-floating-input-padding-b;
|
---|
| 41 | }
|
---|
| 42 | // Duplicated because `:-webkit-autofill` invalidates other selectors when grouped
|
---|
| 43 | &:-webkit-autofill {
|
---|
| 44 | padding-top: $form-floating-input-padding-t;
|
---|
| 45 | padding-bottom: $form-floating-input-padding-b;
|
---|
| 46 | }
|
---|
| 47 | }
|
---|
| 48 |
|
---|
| 49 | > .form-select {
|
---|
| 50 | padding-top: $form-floating-input-padding-t;
|
---|
| 51 | padding-bottom: $form-floating-input-padding-b;
|
---|
| 52 | }
|
---|
| 53 |
|
---|
| 54 | > .form-control:focus,
|
---|
| 55 | > .form-control:not(:placeholder-shown),
|
---|
| 56 | > .form-control-plaintext,
|
---|
| 57 | > .form-select {
|
---|
| 58 | ~ label {
|
---|
| 59 | color: rgba(var(--#{$prefix}body-color-rgb), #{$form-floating-label-opacity});
|
---|
| 60 | transform: $form-floating-label-transform;
|
---|
| 61 |
|
---|
| 62 | &::after {
|
---|
| 63 | position: absolute;
|
---|
| 64 | inset: $form-floating-padding-y ($form-floating-padding-x * .5);
|
---|
| 65 | z-index: -1;
|
---|
| 66 | height: $form-floating-label-height;
|
---|
| 67 | content: "";
|
---|
| 68 | background-color: $input-bg;
|
---|
| 69 | @include border-radius($input-border-radius);
|
---|
| 70 | }
|
---|
| 71 | }
|
---|
| 72 | }
|
---|
| 73 | // Duplicated because `:-webkit-autofill` invalidates other selectors when grouped
|
---|
| 74 | > .form-control:-webkit-autofill {
|
---|
| 75 | ~ label {
|
---|
| 76 | color: rgba(var(--#{$prefix}body-color-rgb), #{$form-floating-label-opacity});
|
---|
| 77 | transform: $form-floating-label-transform;
|
---|
| 78 | }
|
---|
| 79 | }
|
---|
| 80 |
|
---|
| 81 | > .form-control-plaintext {
|
---|
| 82 | ~ label {
|
---|
| 83 | border-width: $input-border-width 0; // Required to properly position label text - as explained above
|
---|
| 84 | }
|
---|
| 85 | }
|
---|
| 86 |
|
---|
| 87 | > :disabled ~ label,
|
---|
| 88 | > .form-control:disabled ~ label { // Required for `.form-control`s because of specificity
|
---|
| 89 | color: $form-floating-label-disabled-color;
|
---|
| 90 |
|
---|
| 91 | &::after {
|
---|
| 92 | background-color: $input-disabled-bg;
|
---|
| 93 | }
|
---|
| 94 | }
|
---|
| 95 | }
|
---|