2020-10-28 04:45:48 +01:00
|
|
|
.form-floating {
|
|
|
|
position: relative;
|
|
|
|
|
|
|
|
> .form-control,
|
2022-02-08 21:38:29 +01:00
|
|
|
> .form-control-plaintext,
|
2020-10-28 04:45:48 +01:00
|
|
|
> .form-select {
|
|
|
|
height: $form-floating-height;
|
2021-06-03 18:02:46 +02:00
|
|
|
line-height: $form-floating-line-height;
|
2020-10-28 04:45:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
> label {
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
2023-03-29 19:46:09 +02:00
|
|
|
z-index: 2;
|
2020-10-28 04:45:48 +01:00
|
|
|
height: 100%; // allow textareas
|
|
|
|
padding: $form-floating-padding-y $form-floating-padding-x;
|
2022-05-11 06:49:08 +02:00
|
|
|
overflow: hidden;
|
2022-08-01 12:01:32 +02:00
|
|
|
text-align: start;
|
2022-05-11 06:49:08 +02:00
|
|
|
text-overflow: ellipsis;
|
|
|
|
white-space: nowrap;
|
2020-10-28 04:45:48 +01:00
|
|
|
pointer-events: none;
|
|
|
|
border: $input-border-width solid transparent; // Required for aligning label's text with the input as it affects inner box model
|
|
|
|
transform-origin: 0 0;
|
|
|
|
@include transition($form-floating-transition);
|
|
|
|
}
|
|
|
|
|
2022-02-08 21:38:29 +01:00
|
|
|
> .form-control,
|
|
|
|
> .form-control-plaintext {
|
2021-05-25 07:31:30 +02:00
|
|
|
padding: $form-floating-padding-y $form-floating-padding-x;
|
|
|
|
|
2020-10-28 04:45:48 +01:00
|
|
|
&::placeholder {
|
|
|
|
color: transparent;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:focus,
|
|
|
|
&:not(:placeholder-shown) {
|
|
|
|
padding-top: $form-floating-input-padding-t;
|
|
|
|
padding-bottom: $form-floating-input-padding-b;
|
|
|
|
}
|
|
|
|
// Duplicated because `:-webkit-autofill` invalidates other selectors when grouped
|
|
|
|
&:-webkit-autofill {
|
|
|
|
padding-top: $form-floating-input-padding-t;
|
|
|
|
padding-bottom: $form-floating-input-padding-b;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .form-select {
|
|
|
|
padding-top: $form-floating-input-padding-t;
|
|
|
|
padding-bottom: $form-floating-input-padding-b;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .form-control:focus,
|
|
|
|
> .form-control:not(:placeholder-shown),
|
2022-02-08 21:38:29 +01:00
|
|
|
> .form-control-plaintext,
|
2020-10-28 04:45:48 +01:00
|
|
|
> .form-select {
|
|
|
|
~ label {
|
2023-03-29 19:46:09 +02:00
|
|
|
color: rgba(var(--#{$prefix}body-color-rgb), #{$form-floating-label-opacity});
|
2020-10-28 04:45:48 +01:00
|
|
|
transform: $form-floating-label-transform;
|
2023-03-29 19:46:09 +02:00
|
|
|
|
|
|
|
&::after {
|
|
|
|
position: absolute;
|
|
|
|
inset: $form-floating-padding-y ($form-floating-padding-x * .5);
|
|
|
|
z-index: -1;
|
|
|
|
height: $form-floating-label-height;
|
|
|
|
content: "";
|
|
|
|
background-color: $input-bg;
|
|
|
|
@include border-radius($input-border-radius);
|
|
|
|
}
|
2020-10-28 04:45:48 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// Duplicated because `:-webkit-autofill` invalidates other selectors when grouped
|
|
|
|
> .form-control:-webkit-autofill {
|
|
|
|
~ label {
|
2023-03-29 19:46:09 +02:00
|
|
|
color: rgba(var(--#{$prefix}body-color-rgb), #{$form-floating-label-opacity});
|
2020-10-28 04:45:48 +01:00
|
|
|
transform: $form-floating-label-transform;
|
|
|
|
}
|
|
|
|
}
|
2022-02-08 21:38:29 +01:00
|
|
|
|
|
|
|
> .form-control-plaintext {
|
|
|
|
~ label {
|
|
|
|
border-width: $input-border-width 0; // Required to properly position label text - as explained above
|
|
|
|
}
|
|
|
|
}
|
2022-10-31 19:29:04 +01:00
|
|
|
|
2023-03-29 19:46:09 +02:00
|
|
|
> :disabled ~ label {
|
2022-10-31 19:29:04 +01:00
|
|
|
color: $form-floating-label-disabled-color;
|
2023-03-29 19:46:09 +02:00
|
|
|
|
|
|
|
&::after {
|
|
|
|
background-color: $input-disabled-bg;
|
|
|
|
}
|
2022-10-31 19:29:04 +01:00
|
|
|
}
|
2020-10-28 04:45:48 +01:00
|
|
|
}
|