From 26c1fbe839482bf152cefcf57aa8797549fd8387 Mon Sep 17 00:00:00 2001 From: Matthew Orahood Date: Wed, 16 Sep 2020 06:01:31 -0400 Subject: [PATCH 01/67] Update webpack.md potcss-loader now uses the `postcssOptions` key. https://www.npmjs.com/package/postcss-loader --- site/content/docs/5.0/getting-started/webpack.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/site/content/docs/5.0/getting-started/webpack.md b/site/content/docs/5.0/getting-started/webpack.md index c67152f8d..693f96109 100644 --- a/site/content/docs/5.0/getting-started/webpack.md +++ b/site/content/docs/5.0/getting-started/webpack.md @@ -55,10 +55,12 @@ For Bootstrap to compile, make sure you install and use the required loaders: [s }, { loader: 'postcss-loader', // Run postcss actions options: { - plugins: function () { // postcss plugins, can be exported to postcss.config.js - return [ - require('autoprefixer') - ]; + postcssOptions: { + plugins: function () { // post css plugins, can be exported to postcss.config.js + return [ + require('autoprefixer') + ]; + } } } }, { From 4e9a29e47ae776064b5afe931a347d61a4390451 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Fri, 18 Sep 2020 14:53:44 +0300 Subject: [PATCH 02/67] Update webpack.md Format snippets --- .../docs/5.0/getting-started/webpack.md | 32 ++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/site/content/docs/5.0/getting-started/webpack.md b/site/content/docs/5.0/getting-started/webpack.md index 693f96109..89870a684 100644 --- a/site/content/docs/5.0/getting-started/webpack.md +++ b/site/content/docs/5.0/getting-started/webpack.md @@ -45,18 +45,24 @@ First, create your own `_custom.scss` and use it to override the [built-in custo For Bootstrap to compile, make sure you install and use the required loaders: [sass-loader](https://github.com/webpack-contrib/sass-loader), [postcss-loader](https://github.com/webpack-contrib/postcss-loader) with [Autoprefixer](https://github.com/postcss/autoprefixer#webpack). With minimal setup, your webpack config should include this rule or similar: {{< highlight js >}} -... +// ... { test: /\.(scss)$/, use: [{ - loader: 'style-loader', // inject CSS to page + // inject CSS to page + loader: 'style-loader' }, { - loader: 'css-loader', // translates CSS into CommonJS modules + // translates CSS into CommonJS modules + loader: 'css-loader' }, { - loader: 'postcss-loader', // Run postcss actions + // Run postcss actions + loader: 'postcss-loader', options: { + // `postcssOptions` is needed for postcss 8.x; + // if you use postcss 7.x skip the key postcssOptions: { - plugins: function () { // post css plugins, can be exported to postcss.config.js + // postcss plugins, can be exported to postcss.config.js + plugins: function () { return [ require('autoprefixer') ]; @@ -64,10 +70,11 @@ For Bootstrap to compile, make sure you install and use the required loaders: [s } } }, { - loader: 'sass-loader' // compiles Sass to CSS + // compiles Sass to CSS + loader: 'sass-loader' }] -}, -... +} +// ... {{< /highlight >}} ### Importing Compiled CSS @@ -81,14 +88,17 @@ import 'bootstrap/dist/css/bootstrap.min.css'; In this case you may use your existing rule for `css` without any special modifications to webpack config, except you don't need `sass-loader` just [style-loader](https://github.com/webpack-contrib/style-loader) and [css-loader](https://github.com/webpack-contrib/css-loader). {{< highlight js >}} -... +// ... module: { rules: [ { test: /\.css$/, - use: ['style-loader', 'css-loader'] + use: [ + 'style-loader', + 'css-loader' + ] } ] } -... +// ... {{< /highlight >}} From 7bbfd439c9d647cdfc1c4ec3bef57911cddfb00d Mon Sep 17 00:00:00 2001 From: Jaume Sala Date: Mon, 21 Sep 2020 04:42:41 +0200 Subject: [PATCH 03/67] Extra position utilities (#31280) * Extra position utilities Given that there are utilities for the *position* property, it seems logic to have utilities for the *top*, *left*, *bottom* and *right* propertires. * Update extra position utilities * add default position values map * tweak examples * add real life examples * fix double colon Co-authored-by: XhmikosR --- scss/_utilities.scss | 23 ++++++ scss/_variables.scss | 11 +++ site/assets/scss/_component-examples.scss | 23 ++++++ site/content/docs/5.0/utilities/position.md | 84 ++++++++++++++++++++- 4 files changed, 140 insertions(+), 1 deletion(-) diff --git a/scss/_utilities.scss b/scss/_utilities.scss index 69615ec4e..e9a9b1e33 100644 --- a/scss/_utilities.scss +++ b/scss/_utilities.scss @@ -39,6 +39,29 @@ $utilities: map-merge( property: position, values: static relative absolute fixed sticky ), + "top": ( + property: top, + values: $position-values + ), + "bottom": ( + property: bottom, + values: $position-values + ), + "left": ( + property: left, + values: $position-values + ), + "right": ( + property: right, + values: $position-values + ), + "translate-middle": ( + property: transform, + class: translate-middle, + values: ( + null: (translateX(-50%) translateY(-50%)) + ) + ), "border": ( property: border, values: ( diff --git a/scss/_variables.scss b/scss/_variables.scss index bdf2d62a4..610a56962 100644 --- a/scss/_variables.scss +++ b/scss/_variables.scss @@ -246,6 +246,17 @@ $spacers: ( $negative-spacers: if($enable-negative-margins, negativify-map($spacers), null) !default; +// Position +// +// Define the edge positioning anchors of the position utilities. + +$position-values: ( + 0: 0, + 50: 50%, + 100: 100% +) !default; + + // Body // // Settings for the `` element. diff --git a/site/assets/scss/_component-examples.scss b/site/assets/scss/_component-examples.scss index 4b7aa4355..7391f5998 100644 --- a/site/assets/scss/_component-examples.scss +++ b/site/assets/scss/_component-examples.scss @@ -217,6 +217,29 @@ } } +.bd-example-position-utils { + position: relative; + padding: 3em; + + .position-relative { + height: 200px; + background-color: #f5f5f5; + } + + .position-absolute { + width: 2em; + height: 2em; + background-color: $dark; + @include border-radius(); + } +} + +.bd-example-position-examples { + &::after { + content: none; + } +} + // // Code snippets // diff --git a/site/content/docs/5.0/utilities/position.md b/site/content/docs/5.0/utilities/position.md index 4af457da4..8928ecd81 100644 --- a/site/content/docs/5.0/utilities/position.md +++ b/site/content/docs/5.0/utilities/position.md @@ -6,7 +6,7 @@ group: utilities toc: true --- -## Common values +## Position values Quick positioning classes are available, though they are not responsive. @@ -17,3 +17,85 @@ Quick positioning classes are available, though they are not responsive.
...
...
{{< /highlight >}} + +## Arrange elements + +Arrange elements easily with the edge positioning utilities. The format is `{property}-{position}`. + +Where *property* is one of: + +- `top` - for the vertical `top` position +- `left` - for the horizontal `left` position +- `bottom` - for the vertical `bottom` position +- `right` - for the horizontal `right` position + +Where *position* is one of: + +- `0` - for `0` edge position +- `50` - for `50%` edge position +- `100` - for `100%` edge position + +(You can add more position values by adding entries to the `$position-values` Sass map variable.) + +{{< example class="bd-example-position-utils" >}} +
+
+
+
+
+
+
+
+{{< /example >}} + +## Center elements + +In addition, you can also center the elements with the transform utility class `.translate-middle`. + +This class applies the transformations `translateX(-50%)` and `translateY(-50%)` to the element which, in combination with the edge positioning utilities, allows you to absolute center an element. + +{{< example class="bd-example-position-utils" >}} +
+
+
+
+
+
+
+
+
+
+
+{{< /example >}} + +## Examples + +Here are some real life examples of these classes: + +{{< example class="bd-example-position-examples d-flex justify-content-around" >}} + + + + + +{{< /example >}} + +You can use these classes with existing components to create new ones. Remember that you can extend its functionality by adding entries to the `$position-values` variable. + +{{< example class="bd-example-position-examples" >}} +
+
+
+
+ + + +
+{{< /example >}} + From bb794bf9046dec3bb8a49eb82fefccf7c6381f91 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 22 Sep 2020 11:45:30 +0300 Subject: [PATCH 04/67] Bump eslint-plugin-unicorn from 21.0.0 to 22.0.0 (#31723) Bumps [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) from 21.0.0 to 22.0.0. - [Release notes](https://github.com/sindresorhus/eslint-plugin-unicorn/releases) - [Commits](https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v21.0.0...v22.0.0) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 10 +++++----- package.json | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 284d05192..17d070c5b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4141,18 +4141,18 @@ } }, "eslint-plugin-unicorn": { - "version": "21.0.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-21.0.0.tgz", - "integrity": "sha512-S8v7+v4gZTQPj4pKKvexhgSUaLQSyItvxW2SVZDaX9Iu5IjlAmF2eni+L6w8a2aqshxgU8Lle4FIAVDtuejSKQ==", + "version": "22.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-22.0.0.tgz", + "integrity": "sha512-jXPOauNiVFYLr+AeU3l21Ao+iDl/G08vUWui21RCI2L1TJIIoJvAMjMR6I+QPKr8FgIumzuR6gzDKCtEx2IkzA==", "dev": true, "requires": { "ci-info": "^2.0.0", "clean-regexp": "^1.0.0", "eslint-ast-utils": "^1.1.0", - "eslint-template-visitor": "^2.0.0", + "eslint-template-visitor": "^2.2.1", "eslint-utils": "^2.1.0", "import-modules": "^2.0.0", - "lodash": "^4.17.15", + "lodash": "^4.17.20", "pluralize": "^8.0.0", "read-pkg-up": "^7.0.1", "regexp-tree": "^0.1.21", diff --git a/package.json b/package.json index 5f8c352fa..d91cc26a8 100644 --- a/package.json +++ b/package.json @@ -105,7 +105,7 @@ "eslint": "^7.9.0", "eslint-config-xo": "^0.32.1", "eslint-plugin-import": "^2.22.0", - "eslint-plugin-unicorn": "^21.0.0", + "eslint-plugin-unicorn": "^22.0.0", "find-unused-sass-variables": "^2.0.0", "glob": "^7.1.6", "hammer-simulator": "0.0.1", From 5706ce38eba781838b64d8aa6e19f03a15e5cdc4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 22 Sep 2020 11:50:14 +0300 Subject: [PATCH 05/67] Bump @rollup/plugin-commonjs from 15.0.0 to 15.1.0 (#31724) Bumps [@rollup/plugin-commonjs](https://github.com/rollup/plugins) from 15.0.0 to 15.1.0. - [Release notes](https://github.com/rollup/plugins/releases) - [Commits](https://github.com/rollup/plugins/compare/commonjs-v15.0.0...commonjs-v15.1.0) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: XhmikosR --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 17d070c5b..46b75f2de 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1151,9 +1151,9 @@ } }, "@rollup/plugin-commonjs": { - "version": "15.0.0", - "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-15.0.0.tgz", - "integrity": "sha512-8uAdikHqVyrT32w1zB9VhW6uGwGjhKgnDNP4pQJsjdnyF4FgCj6/bmv24c7v2CuKhq32CcyCwRzMPEElaKkn0w==", + "version": "15.1.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-15.1.0.tgz", + "integrity": "sha512-xCQqz4z/o0h2syQ7d9LskIMvBSH4PX5PjYdpSSvgS+pQik3WahkQVNWg3D8XJeYjZoVWnIUQYDghuEMRGrmQYQ==", "dev": true, "requires": { "@rollup/pluginutils": "^3.1.0", diff --git a/package.json b/package.json index d91cc26a8..dc77037ef 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,7 @@ "@babel/core": "^7.11.6", "@babel/preset-env": "^7.11.5", "@rollup/plugin-babel": "^5.2.1", - "@rollup/plugin-commonjs": "^15.0.0", + "@rollup/plugin-commonjs": "^15.1.0", "@rollup/plugin-node-resolve": "^9.0.0", "autoprefixer": "^9.8.6", "bundlewatch": "^0.3.0", From 6b1cdd099041f2971cb9456a4cf3b27306909194 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 22 Sep 2020 11:53:57 +0300 Subject: [PATCH 06/67] Bump rollup from 2.26.11 to 2.28.1 (#31725) Bumps [rollup](https://github.com/rollup/rollup) from 2.26.11 to 2.28.1. - [Release notes](https://github.com/rollup/rollup/releases) - [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md) - [Commits](https://github.com/rollup/rollup/compare/v2.26.11...v2.28.1) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: XhmikosR --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 46b75f2de..56d1db30a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9868,9 +9868,9 @@ } }, "rollup": { - "version": "2.26.11", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.26.11.tgz", - "integrity": "sha512-xyfxxhsE6hW57xhfL1I+ixH8l2bdoIMaAecdQiWF3N7IgJEMu99JG+daBiSZQjnBpzFxa0/xZm+3pbCdAQehHw==", + "version": "2.28.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.28.1.tgz", + "integrity": "sha512-DOtVoqOZt3+FjPJWLU8hDIvBjUylc9s6IZvy76XklxzcLvAQLtVAG/bbhsMhcWnYxC0TKKcf1QQ/tg29zeID0Q==", "dev": true, "requires": { "fsevents": "~2.1.2" diff --git a/package.json b/package.json index dc77037ef..9093ead10 100644 --- a/package.json +++ b/package.json @@ -128,7 +128,7 @@ "npm-run-all": "^4.1.5", "popper.js": "^1.16.1", "postcss-cli": "^7.1.2", - "rollup": "^2.26.11", + "rollup": "^2.28.1", "rollup-plugin-istanbul": "^2.0.1", "shelljs": "^0.8.4", "sirv-cli": "^1.0.6", From fe77208a01b9b41ce13a9c68139d9f1618c48ec9 Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Mon, 21 Sep 2020 16:27:26 -0700 Subject: [PATCH 07/67] Add new variable for -padding-x --- scss/_dropdown.scss | 2 +- scss/_variables.scss | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/scss/_dropdown.scss b/scss/_dropdown.scss index b30f2ba7e..f87fc8eb9 100644 --- a/scss/_dropdown.scss +++ b/scss/_dropdown.scss @@ -21,7 +21,7 @@ z-index: $zindex-dropdown; display: none; // none by default, but block on "open" of the menu min-width: $dropdown-min-width; - padding: $dropdown-padding-y 0; + padding: $dropdown-padding-y $dropdown-padding-x; margin: $dropdown-spacer 0 0; // override default ul @include font-size($dropdown-font-size); color: $dropdown-color; diff --git a/scss/_variables.scss b/scss/_variables.scss index 610a56962..be8c014b3 100644 --- a/scss/_variables.scss +++ b/scss/_variables.scss @@ -928,6 +928,7 @@ $navbar-dark-brand-hover-color: $navbar-dark-active-color !default; // Dropdown menu container and contents. $dropdown-min-width: 10rem !default; +$dropdown-padding-x: 0 !default; $dropdown-padding-y: .5rem !default; $dropdown-spacer: .125rem !default; $dropdown-font-size: $font-size-base !default; From 99777662c678341b0220630c05a9526faab36c95 Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Tue, 1 Sep 2020 15:16:50 -0700 Subject: [PATCH 08/67] Rename .close to .btn-close, replace times sign with background SVG, update focus state --- scss/_alert.scss | 7 +- scss/_close.scss | 42 +++++----- scss/_modal.scss | 2 +- scss/_variables.scss | 12 +-- site/content/docs/5.0/components/alerts.md | 4 +- .../docs/5.0/components/close-button.md | 11 +-- site/content/docs/5.0/components/modal.md | 76 +++++-------------- 7 files changed, 55 insertions(+), 99 deletions(-) diff --git a/scss/_alert.scss b/scss/_alert.scss index 19157b298..078aaaa68 100644 --- a/scss/_alert.scss +++ b/scss/_alert.scss @@ -27,15 +27,14 @@ // Expand the right padding and account for the close button's positioning. .alert-dismissible { - padding-right: $close-font-size + $alert-padding-x * 2; + padding-right: $alert-padding-x * 3.5; // Adjust close link position - .close { + .btn-close { position: absolute; top: 0; right: 0; - padding: $alert-padding-y $alert-padding-x; - color: inherit; + padding: $alert-padding-y * 1.25 $alert-padding-x; } } diff --git a/scss/_close.scss b/scss/_close.scss index dd6541e0d..6bc621f06 100644 --- a/scss/_close.scss +++ b/scss/_close.scss @@ -1,36 +1,36 @@ -.close { - @include font-size($close-font-size); - font-weight: $close-font-weight; - line-height: 1; - color: $close-color; - text-shadow: $close-text-shadow; +// transparent background and border properties included for button version. +// iOS requires the button element instead of an anchor tag. +// If you want the anchor version, it requires `href="#"`. +// See https://developer.mozilla.org/en-US/docs/Web/Events/click#Safari_Mobile + +.btn-close { + box-sizing: content-box; + width: $btn-close-width; + height: $btn-close-height; + padding: $btn-close-padding-y $btn-close-padding-x; + color: $btn-close-color; + background: transparent escape-svg($btn-close-bg) no-repeat center center / $btn-close-width auto; // include transparent for button elements + background-clip: content-box; + border: 0; // for button elements + @include border-radius(); opacity: .5; // Override 's hover style &:hover { - color: $close-color; + color: $btn-close-color; text-decoration: none; + opacity: .75; } - &:hover, &:focus { - opacity: .75; + outline: none; + box-shadow: $btn-close-focus-shadow; + opacity: 1; } &:disabled, &.disabled { pointer-events: none; + user-select: none; } } - -// Additional properties for button version -// iOS requires the button element instead of an anchor tag. -// If you want the anchor version, it requires `href="#"`. -// See https://developer.mozilla.org/en-US/docs/Web/Events/click#Safari_Mobile - -// stylelint-disable-next-line selector-no-qualifying-type -button.close { - padding: 0; - background-color: transparent; - border: 0; -} diff --git a/scss/_modal.scss b/scss/_modal.scss index 5443ef124..9cf3aa89a 100644 --- a/scss/_modal.scss +++ b/scss/_modal.scss @@ -118,7 +118,7 @@ border-bottom: $modal-header-border-width solid $modal-header-border-color; @include border-top-radius($modal-content-inner-border-radius); - .close { + .btn-close { padding: $modal-header-padding; // auto on the left force icon to the right even when there is no .modal-title margin: (-$modal-header-padding-y) (-$modal-header-padding-x) (-$modal-header-padding-y) auto; diff --git a/scss/_variables.scss b/scss/_variables.scss index be8c014b3..266a497a7 100644 --- a/scss/_variables.scss +++ b/scss/_variables.scss @@ -1269,11 +1269,13 @@ $spinner-border-width-sm: .2em !default; // Close -$close-font-size: $font-size-base * 1.5 !default; -$close-font-weight: $font-weight-bold !default; -$close-color: $black !default; -$close-text-shadow: 0 1px 0 $white !default; - +$btn-close-width: 1em !default; +$btn-close-height: $btn-close-width !default; +$btn-close-padding-x: .25em !default; +$btn-close-padding-y: $btn-close-padding-x !default; +$btn-close-color: $black !default; +$btn-close-bg: url("data:image/svg+xml,") !default; +$btn-close-focus-shadow: $input-btn-focus-box-shadow !default; // Code diff --git a/site/content/docs/5.0/components/alerts.md b/site/content/docs/5.0/components/alerts.md index dace2f718..c58e93a23 100644 --- a/site/content/docs/5.0/components/alerts.md +++ b/site/content/docs/5.0/components/alerts.md @@ -66,9 +66,7 @@ You can see this in action with a live demo: {{< example >}} {{< /example >}} diff --git a/site/content/docs/5.0/components/close-button.md b/site/content/docs/5.0/components/close-button.md index 28211cd5d..1a83d7a96 100644 --- a/site/content/docs/5.0/components/close-button.md +++ b/site/content/docs/5.0/components/close-button.md @@ -5,14 +5,9 @@ description: A generic close button for dismissing content like modals and alert group: components --- -**Be sure to include text for screen readers**, as we've done with `aria-label`. Disabled close buttons have `pointer-events: none` applied to, preventing hover and active states from triggering. +**Be sure to include text for screen readers**, as we've done with `aria-label`. Disabled close buttons have `pointer-events: none` and `user-select: none` applied to preventing hover and active states from triggering. {{< example >}} - - - + + {{< /example >}} diff --git a/site/content/docs/5.0/components/modal.md b/site/content/docs/5.0/components/modal.md index 19d0aae37..fbf36f0dd 100644 --- a/site/content/docs/5.0/components/modal.md +++ b/site/content/docs/5.0/components/modal.md @@ -66,9 +66,7 @@ Below is a _static_ modal example (meaning its `position` and `display` have bee