Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v5: Forms update #28450

Merged
merged 79 commits into from
Jul 12, 2019
Merged
Show file tree
Hide file tree
Changes from 71 commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
b7ea13d
Initial spike of consolidated form checks
mdo Mar 5, 2019
d78307a
Stub out forms rearrangement
mdo Mar 11, 2019
c47356b
Move input group Sass file to forms subdir
mdo Mar 12, 2019
a3d6589
Start to split and move the docs around
mdo Mar 15, 2019
497083f
Simpler imports
mdo May 3, 2019
4dc81f9
Copyediting
mdo May 3, 2019
74e52f8
delete overview file
mdo May 3, 2019
73d4f39
Merge branch 'master' into v5-forms-spike
mdo May 3, 2019
90867f1
Merge branch 'master' into v5-forms-spike
mdo May 3, 2019
43400f0
Remove commented out code
mdo May 3, 2019
effb860
remove the custom-forms import
mdo May 3, 2019
7bf36ce
rewrite flex-check as form-check, replace all custom properties
mdo May 3, 2019
cb798c4
Remove old forms doc
mdo May 3, 2019
8366cb2
Merge branch 'master' into v5-forms-spike
mdo May 8, 2019
3e904c9
stub out new subpage link section
mdo May 8, 2019
807a1e0
update migration guide
mdo May 8, 2019
5e8a6e4
Update nav, forms overview in page nav, and descriptions
mdo May 9, 2019
8d49bca
fix check bg position
mdo May 9, 2019
7c661d1
fix margin-top calculation
mdo May 9, 2019
00233b6
rename .custom-select to .form-select
mdo May 9, 2019
1b1d411
Update validation styles for new checks
mdo May 9, 2019
9ba2add
add some vertical margin, fix inline checks
mdo May 9, 2019
4bfcd52
fix docs examples
mdo May 9, 2019
52d7c91
Merge branch 'master' into v5-forms-spike
mdo May 10, 2019
a92d9bc
better way to do this contents stuff, redo the toc while i'm at it
mdo May 10, 2019
eaeb151
page restyle for docs while here
mdo May 10, 2019
eb8f553
un-callout that, edit text
mdo May 10, 2019
3c416a3
Merge branch 'master' into v5-forms-spike
mdo May 29, 2019
e71d194
redo padding on toc
mdo May 29, 2019
f048d09
fix toc
mdo May 29, 2019
45598b1
start to cleanup checks docs
mdo May 29, 2019
c8d1a0e
Rewrite Markdown tables into HTML
mdo Jun 11, 2019
f9f9e45
Redesign tables, redo their docs
mdo Jun 11, 2019
f3ffb20
Replace Open Iconic icons with custom Bootstrap icons
mdo Jun 11, 2019
26ca659
Redesign the docs navbar, add a subheader, redo the sidebar
mdo Jun 11, 2019
a4f66c0
Redesign docs homepage a bit
mdo Jun 11, 2019
36ef161
Simplify table style overrides for docs tables
mdo Jun 11, 2019
ee072ee
Simplify docs typography for page titles and reading line length
mdo Jun 11, 2019
38542d0
Stub out icons page
mdo Jun 11, 2019
65c6035
Part of sidebar update, remove migration from nav.yml
mdo Jun 11, 2019
9a8d8c1
Merge branch 'master' into v5-forms-spike
mdo Jun 11, 2019
28dcc0d
Move toc CSS to separate partial
mdo Jun 11, 2019
69e226e
Change appearance of overview page
mdo Jun 11, 2019
9904aa7
fix sidebar arrow direction
mdo Jun 18, 2019
d7686d4
Add footer to docs layout
mdo Jun 18, 2019
2b589da
Update descriptions
mdo Jun 18, 2019
f87fde2
Drop the .form-group class for margin utilities
mdo Jun 18, 2019
893d8de
Remove lingering form-group-margin-bottom var
mdo Jun 18, 2019
62bc938
improve footer spacing
mdo Jun 18, 2019
2a48b99
add headings to range page
mdo Jun 18, 2019
f5a77db
uncomment form range css
mdo Jun 18, 2019
05af328
Rename .custom-range to .form-range
mdo Jun 18, 2019
d593933
Drop unused docs var
mdo Jun 29, 2019
387d879
Uncomment the comment
mdo Jul 8, 2019
1b8592e
Remove unused variable
mdo Jul 8, 2019
cfd4f9f
Fix radio image sizing
mdo Jul 9, 2019
18345d2
Merge branch 'v5-forms-spike' of https://github.com/twbs/bootstrap in…
mdo Jul 9, 2019
f8bb8df
Merge branch 'master' into v5-forms-spike
mdo Jul 9, 2019
94d0f1b
Reboot update: reset horizontal ul and ol padding
mdo Jul 10, 2019
5453b73
de-dupe IDs
mdo Jul 10, 2019
a1bd2ce
tweak toc styles
mdo Jul 10, 2019
cd8a9fd
nvm, fix dropdown versions stuff
mdo Jul 10, 2019
2956523
Merge branch 'master' into v5-forms-spike
mdo Jul 10, 2019
f069f68
remove sidebar nav toggle for now
mdo Jul 10, 2019
436e291
broken html
mdo Jul 10, 2019
4a93ad3
fix more broken html, move css
mdo Jul 10, 2019
6dfc1fc
scss linting
mdo Jul 10, 2019
428d2e4
comment out broken helper docs
mdo Jul 10, 2019
5018cbb
scope styles
mdo Jul 10, 2019
a8d004a
scope styles
mdo Jul 10, 2019
7f7d558
Fixes #25540 and fixes #26407 for v5 only
mdo Jul 10, 2019
e71b442
Update sidebar once more
mdo Jul 10, 2019
bff9d18
Match new sidenav order
mdo Jul 10, 2019
a1410d9
fix syntax error
mdo Jul 11, 2019
138b5a0
Rename custom-file to form-file, update paths, update migration docs …
mdo Jul 11, 2019
9537cd6
rename back
mdo Jul 11, 2019
6ab6748
Merge branch 'master' into v5-forms-spike
mdo Jul 12, 2019
d4619ae
fix size and alignment
mdo Jul 12, 2019
7a2c2b7
rename that back too
mdo Jul 12, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
514 changes: 0 additions & 514 deletions scss/_custom-forms.scss

This file was deleted.

343 changes: 9 additions & 334 deletions scss/_forms.scss
Original file line number Diff line number Diff line change
@@ -1,334 +1,9 @@
// stylelint-disable selector-no-qualifying-type

//
// Textual form controls
//

.form-control {
display: block;
width: 100%;
height: $input-height;
padding: $input-padding-y $input-padding-x;
font-family: $input-font-family;
@include font-size($input-font-size);
font-weight: $input-font-weight;
line-height: $input-line-height;
color: $input-color;
background-color: $input-bg;
background-clip: padding-box;
border: $input-border-width solid $input-border-color;

// Note: This has no effect on <select>s in some browsers, due to the limited stylability of `<select>`s in CSS.
@include border-radius($input-border-radius, 0);

@include box-shadow($input-box-shadow);
@include transition($input-transition);

// Unstyle the caret on `<select>`s in IE10+.
&::-ms-expand {
background-color: transparent;
border: 0;
}

// Customize the `:focus` state to imitate native WebKit styles.
@include form-control-focus($ignore-warning: true);

// Placeholder
&::placeholder {
color: $input-placeholder-color;
// Override Firefox's unusual default opacity; see https://github.com/twbs/bootstrap/pull/11526.
opacity: 1;
}

// Disabled and read-only inputs
//
// HTML5 says that controls under a fieldset > legend:first-child won't be
// disabled if the fieldset is disabled. Due to implementation difficulty, we
// don't honor that edge case; we style them as disabled anyway.
&:disabled,
&[readonly] {
background-color: $input-disabled-bg;
// iOS fix for unreadable disabled content; see https://github.com/twbs/bootstrap/issues/11655.
opacity: 1;
}
}

select.form-control {
&:focus::-ms-value {
// Suppress the nested default white text on blue background highlight given to
// the selected option text when the (still closed) <select> receives focus
// in IE and (under certain conditions) Edge, as it looks bad and cannot be made to
// match the appearance of the native widget.
// See https://github.com/twbs/bootstrap/issues/19398.
color: $input-color;
background-color: $input-bg;
}
}

// Make file inputs better match text inputs by forcing them to new lines.
.form-control-file,
.form-control-range {
display: block;
width: 100%;
}


//
// Labels
//

// For use with horizontal and inline forms, when you need the label (or legend)
// text to align with the form controls.
.col-form-label {
padding-top: calc(#{$input-padding-y} + #{$input-border-width});
padding-bottom: calc(#{$input-padding-y} + #{$input-border-width});
margin-bottom: 0; // Override the `<label>/<legend>` default
@include font-size(inherit); // Override the `<legend>` default
line-height: $input-line-height;
}

.col-form-label-lg {
padding-top: calc(#{$input-padding-y-lg} + #{$input-border-width});
padding-bottom: calc(#{$input-padding-y-lg} + #{$input-border-width});
@include font-size($input-font-size-lg);
line-height: $input-line-height-lg;
}

.col-form-label-sm {
padding-top: calc(#{$input-padding-y-sm} + #{$input-border-width});
padding-bottom: calc(#{$input-padding-y-sm} + #{$input-border-width});
@include font-size($input-font-size-sm);
line-height: $input-line-height-sm;
}


// Readonly controls as plain text
//
// Apply class to a readonly input to make it appear like regular plain
// text (without any border, background color, focus indicator)

.form-control-plaintext {
display: block;
width: 100%;
padding: $input-padding-y 0;
margin-bottom: 0; // match inputs if this class comes on inputs with default margins
@include font-size($input-font-size);
line-height: $input-line-height;
color: $input-plaintext-color;
background-color: transparent;
border: solid transparent;
border-width: $input-border-width 0;

&.form-control-sm,
&.form-control-lg {
padding-right: 0;
padding-left: 0;
}
}


// Form control sizing
//
// Build on `.form-control` with modifier classes to decrease or increase the
// height and font-size of form controls.
//
// Repeated in `_input_group.scss` to avoid Sass extend issues.

.form-control-sm {
height: $input-height-sm;
padding: $input-padding-y-sm $input-padding-x-sm;
@include font-size($input-font-size-sm);
line-height: $input-line-height-sm;
@include border-radius($input-border-radius-sm);
}

.form-control-lg {
height: $input-height-lg;
padding: $input-padding-y-lg $input-padding-x-lg;
@include font-size($input-font-size-lg);
line-height: $input-line-height-lg;
@include border-radius($input-border-radius-lg);
}

// stylelint-disable-next-line no-duplicate-selectors
select.form-control {
&[size],
&[multiple] {
height: auto;
}
}

textarea.form-control {
height: auto;
}

// Form groups
//
// Designed to help with the organization and spacing of vertical forms. For
// horizontal forms, use the predefined grid classes.

.form-group {
margin-bottom: $form-group-margin-bottom;
}

.form-text {
display: block;
margin-top: $form-text-margin-top;
}


// Form grid
//
// Special replacement for our grid system's `.row` for tighter form layouts.

@if $enable-grid-classes {
.form-row {
display: flex;
flex-wrap: wrap;
margin-right: -$form-grid-gutter-width / 2;
margin-left: -$form-grid-gutter-width / 2;

> .col,
> [class*="col-"] {
padding-right: $form-grid-gutter-width / 2;
padding-left: $form-grid-gutter-width / 2;
}
}
}


// Checkboxes and radios
//
// Indent the labels to position radios/checkboxes as hanging controls.

.form-check {
position: relative;
display: block;
padding-left: $form-check-input-gutter;
}

.form-check-input {
position: absolute;
margin-top: $form-check-input-margin-y;
margin-left: -$form-check-input-gutter;

// Use disabled attribute instead of :disabled pseudo-class
// Workaround for: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11295231
&[disabled] ~ .form-check-label {
color: $text-muted;
}
}

.form-check-label {
margin-bottom: 0; // Override default `<label>` bottom margin
}

.form-check-inline {
display: inline-flex;
align-items: center;
padding-left: 0; // Override base .form-check
margin-right: $form-check-inline-margin-x;

// Undo .form-check-input defaults and add some `margin-right`.
.form-check-input {
position: static;
margin-top: 0;
margin-right: $form-check-inline-input-margin-x;
margin-left: 0;
}
}


// Form validation
//
// Provide feedback to users when form field values are valid or invalid. Works
// primarily for client-side validation via scoped `:invalid` and `:valid`
// pseudo-classes but also includes `.is-invalid` and `.is-valid` classes for
// server-side validation.

@each $state, $data in $form-validation-states {
@include form-validation-state($state, map-get($data, color), map-get($data, icon));
}

// Inline forms
//
// Make forms appear inline(-block) by adding the `.form-inline` class. Inline
// forms begin stacked on extra small (mobile) devices and then go inline when
// viewports reach <768px.
//
// Requires wrapping inputs and labels with `.form-group` for proper display of
// default HTML form controls and our custom form controls (e.g., input groups).

.form-inline {
display: flex;
flex-flow: row wrap;
align-items: center; // Prevent shorter elements from growing to same height as others (e.g., small buttons growing to normal sized button height)

// Because we use flex, the initial sizing of checkboxes is collapsed and
// doesn't occupy the full-width (which is what we want for xs grid tier),
// so we force that here.
.form-check {
width: 100%;
}

// Kick in the inline
@include media-breakpoint-up(sm) {
label {
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 0;
}

// Inline-block all the things for "inline"
.form-group {
display: flex;
flex: 0 0 auto;
flex-flow: row wrap;
align-items: center;
margin-bottom: 0;
}

// Allow folks to *not* use `.form-group`
.form-control {
display: inline-block;
width: auto; // Prevent labels from stacking above inputs in `.form-group`
vertical-align: middle;
}

// Make static controls behave like regular ones
.form-control-plaintext {
display: inline-block;
}

.input-group,
.custom-select {
width: auto;
}

// Remove default margin on radios/checkboxes that were used for stacking, and
// then undo the floating of radios and checkboxes to match.
.form-check {
display: flex;
align-items: center;
justify-content: center;
width: auto;
padding-left: 0;
}
.form-check-input {
position: relative;
flex-shrink: 0;
margin-top: 0;
margin-right: $form-check-input-margin-x;
margin-left: 0;
}

.custom-control {
align-items: center;
justify-content: center;
}
.custom-control-label {
margin-bottom: 0;
}
}
}
@import "forms/labels";
@import "forms/form-control";
@import "forms/form-select";
@import "forms/form-check";
@import "forms/form-file";
@import "forms/form-range";
@import "forms/layout";
@import "forms/input-group";
@import "forms/validation";
6 changes: 6 additions & 0 deletions scss/_reboot.scss
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,12 @@ address {
line-height: inherit;
}

ol,
ul {
padding-right: 2rem;
padding-left: 2rem;
}

ol,
ul,
dl {
Expand Down
8 changes: 6 additions & 2 deletions scss/_tables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@
td {
padding: $table-cell-padding;
vertical-align: top;
border-top: $table-border-width solid $table-border-color;
border-bottom: $table-border-width solid $table-border-color;
}

td {
border-bottom: $table-border-width solid $table-border-color;
}

thead th {
vertical-align: bottom;
border-bottom: (2 * $table-border-width) solid $table-border-color;
border-bottom-color: $table-head-border-color;
}

tbody + tbody {
Expand Down
Loading