v5: Floating labels (#30449)

* v5: Promote floating labels example to component

- Adds new .form-floating
- Stubs out basics of a docs page
- Removes existing Example

* Update floating labels to support .form-select, make inputs and selects more consistent

- To do this, I made the .form-control and .form-select consistent in min-height vs height
- Removed some unused variables now
- Updated -color to be the -color because I don't know why this was any different before
- Update page to include some examples for layout, validation, and value
- Rewrite styles to not modify padding, but instead transform and opacity

* Streamline and bulletproof some things

- Apply some optimizations from code review
- Removed unecessary properties from the label
- Add some comments for what properties are required
- Move from fixed height for labels to height 100% so we can support textareas
- Improve docs a little bit, add ToC

* Move some values to variables, switch from scaling font-size to scale, update transforms

* Bring over changes from #30966 and add to them to tighten things up

* Delete the now unused example images

* Fix typo

* Allowlist the calc function

* Add transform-origin, update transform values

* Test out autofill fix

* Fix linter issue

* Mention it in the migration guide

* Bump bundlesize

* Add one more variable per review

* Shave .25rem off the height

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
This commit is contained in:
Mark Otto 2020-10-27 20:45:48 -07:00 committed by GitHub
parent 582f52e9e1
commit 3e2f9ab237
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
45 changed files with 793 additions and 466 deletions

File diff suppressed because one or more lines are too long

View file

@ -11,9 +11,15 @@
box-sizing: border-box;
}
@media (prefers-reduced-motion: no-preference) {
:root {
scroll-behavior: smooth;
}
}
body {
margin: 0;
font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
@ -183,7 +189,7 @@ a {
}
a:hover {
color: #024dbc;
color: #0a58ca;
}
a:not([href]):not([class]), a:not([href]):not([class]):hover {

File diff suppressed because one or more lines are too long

View file

@ -48,6 +48,14 @@
overflow: hidden !important;
}
.overflow-visible {
overflow: visible !important;
}
.overflow-scroll {
overflow: scroll !important;
}
.d-inline {
display: inline !important;
}
@ -242,7 +250,7 @@
}
.border-dark {
border-color: #343a40 !important;
border-color: #212529 !important;
}
.border-white {
@ -899,6 +907,38 @@
padding-left: 3rem !important;
}
.fs-1 {
font-size: calc(1.375rem + 1.5vw) !important;
}
.fs-2 {
font-size: calc(1.325rem + 0.9vw) !important;
}
.fs-3 {
font-size: calc(1.3rem + 0.6vw) !important;
}
.fs-4 {
font-size: calc(1.275rem + 0.3vw) !important;
}
.fs-5 {
font-size: 1.25rem !important;
}
.fs-6 {
font-size: 1rem !important;
}
.fst-italic {
font-style: italic !important;
}
.fst-normal {
font-style: normal !important;
}
.font-weight-light {
font-weight: 300 !important;
}
@ -972,7 +1012,7 @@
}
.text-dark {
color: #343a40 !important;
color: #212529 !important;
}
.text-white {
@ -1044,7 +1084,7 @@
}
.bg-dark {
background-color: #343a40 !important;
background-color: #212529 !important;
}
.bg-body {
@ -1083,14 +1123,6 @@
text-decoration: line-through !important;
}
.font-italic {
font-style: italic !important;
}
.font-normal {
font-style: normal !important;
}
.text-break {
word-wrap: break-word !important;
word-break: break-word !important;
@ -3561,6 +3593,57 @@
}
}
@media (min-width: 1200px) {
.fs-1 {
font-size: 2.5rem !important;
}
.fs-2 {
font-size: 2rem !important;
}
.fs-3 {
font-size: 1.75rem !important;
}
.fs-4 {
font-size: 1.5rem !important;
}
.fs-sm-1 {
font-size: 2.5rem !important;
}
.fs-sm-2 {
font-size: 2rem !important;
}
.fs-sm-3 {
font-size: 1.75rem !important;
}
.fs-sm-4 {
font-size: 1.5rem !important;
}
.fs-md-1 {
font-size: 2.5rem !important;
}
.fs-md-2 {
font-size: 2rem !important;
}
.fs-md-3 {
font-size: 1.75rem !important;
}
.fs-md-4 {
font-size: 1.5rem !important;
}
.fs-lg-1 {
font-size: 2.5rem !important;
}
.fs-lg-2 {
font-size: 2rem !important;
}
.fs-lg-3 {
font-size: 1.75rem !important;
}
.fs-lg-4 {
font-size: 1.5rem !important;
}
}
@media print {
.d-print-inline {
display: inline !important;

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -975,17 +975,6 @@
top: element.offsetTop,
left: element.offsetLeft
};
},
toggleClass: function toggleClass(element, className) {
if (!element) {
return;
}
if (element.classList.contains(className)) {
element.classList.remove(className);
} else {
element.classList.add(className);
}
}
};
@ -4844,8 +4833,10 @@
this._element.setAttribute('aria-expanded', true);
Manipulator.toggleClass(this._menu, CLASS_NAME_SHOW$1);
Manipulator.toggleClass(this._element, CLASS_NAME_SHOW$1);
this._menu.classList.toggle(CLASS_NAME_SHOW$1);
this._element.classList.toggle(CLASS_NAME_SHOW$1);
EventHandler.trigger(parent, EVENT_SHOWN$1, relatedTarget);
};
@ -4868,8 +4859,10 @@
this._popper.destroy();
}
Manipulator.toggleClass(this._menu, CLASS_NAME_SHOW$1);
Manipulator.toggleClass(this._element, CLASS_NAME_SHOW$1);
this._menu.classList.toggle(CLASS_NAME_SHOW$1);
this._element.classList.toggle(CLASS_NAME_SHOW$1);
EventHandler.trigger(parent, EVENT_HIDDEN$1, relatedTarget);
};

File diff suppressed because one or more lines are too long

View file

@ -971,17 +971,6 @@ var Manipulator = {
top: element.offsetTop,
left: element.offsetLeft
};
},
toggleClass: function toggleClass(element, className) {
if (!element) {
return;
}
if (element.classList.contains(className)) {
element.classList.remove(className);
} else {
element.classList.add(className);
}
}
};
@ -2226,8 +2215,10 @@ var Dropdown = /*#__PURE__*/function () {
this._element.setAttribute('aria-expanded', true);
Manipulator.toggleClass(this._menu, CLASS_NAME_SHOW$1);
Manipulator.toggleClass(this._element, CLASS_NAME_SHOW$1);
this._menu.classList.toggle(CLASS_NAME_SHOW$1);
this._element.classList.toggle(CLASS_NAME_SHOW$1);
EventHandler.trigger(parent, EVENT_SHOWN$1, relatedTarget);
};
@ -2250,8 +2241,10 @@ var Dropdown = /*#__PURE__*/function () {
this._popper.destroy();
}
Manipulator.toggleClass(this._menu, CLASS_NAME_SHOW$1);
Manipulator.toggleClass(this._element, CLASS_NAME_SHOW$1);
this._menu.classList.toggle(CLASS_NAME_SHOW$1);
this._element.classList.toggle(CLASS_NAME_SHOW$1);
EventHandler.trigger(parent, EVENT_HIDDEN$1, relatedTarget);
};

File diff suppressed because one or more lines are too long

View file

@ -979,17 +979,6 @@
top: element.offsetTop,
left: element.offsetLeft
};
},
toggleClass: function toggleClass(element, className) {
if (!element) {
return;
}
if (element.classList.contains(className)) {
element.classList.remove(className);
} else {
element.classList.add(className);
}
}
};
@ -2234,8 +2223,10 @@
this._element.setAttribute('aria-expanded', true);
Manipulator.toggleClass(this._menu, CLASS_NAME_SHOW$1);
Manipulator.toggleClass(this._element, CLASS_NAME_SHOW$1);
this._menu.classList.toggle(CLASS_NAME_SHOW$1);
this._element.classList.toggle(CLASS_NAME_SHOW$1);
EventHandler.trigger(parent, EVENT_SHOWN$1, relatedTarget);
};
@ -2258,8 +2249,10 @@
this._popper.destroy();
}
Manipulator.toggleClass(this._menu, CLASS_NAME_SHOW$1);
Manipulator.toggleClass(this._element, CLASS_NAME_SHOW$1);
this._menu.classList.toggle(CLASS_NAME_SHOW$1);
this._element.classList.toggle(CLASS_NAME_SHOW$1);
EventHandler.trigger(parent, EVENT_HIDDEN$1, relatedTarget);
};

File diff suppressed because one or more lines are too long