From 34273ef380d14e3c0f5dac439f46c36ad44fb293 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20D=C3=A9ramond?= Date: Mon, 11 Sep 2023 09:01:45 +0200 Subject: [PATCH 01/71] feat: dark mode --- .bundlewatch.config.json | 6 +- .storybook/main.js | 2 +- .storybook/preview.js | 15 +- js/tests/unit/quantity-selector.spec.js | 36 +- js/tests/visual/dropdown.html | 20 +- js/tests/visual/modal.html | 6 +- js/tests/visual/scrollspy.html | 2 +- package-lock.json | 23 + package.json | 1 + scss/_accordion.scss | 13 - scss/_breadcrumb.scss | 17 +- scss/_buttons.scss | 107 +- scss/_close.scss | 6 +- scss/_dropdown.scss | 8 +- scss/_list-group.scss | 18 - scss/_local-navigation.scss | 12 - scss/_maps.scss | 7 + scss/_navbar.scss | 2 - scss/_pagination.scss | 22 - scss/_root.scss | 78 +- scss/_spinners.scss | 1 + scss/_stepped-process.scss | 13 +- scss/_sticker.scss | 6 +- scss/_tags.scss | 15 +- scss/_variables-dark.scss | 99 +- scss/_variables.scss | 256 +- scss/forms/_form-check.scss | 6 +- scss/forms/_form-control.scss | 6 +- scss/forms/_labels.scss | 29 +- scss/forms/_star-rating.scss | 10 +- scss/helpers/_color-bg.scss | 12 + scss/helpers/_colored-links.scss | 18 + scss/mixins/_buttons.scss | 51 +- scss/tests/mixins/_color-modes.test.scss | 4 +- site/assets/js/tac.js | 8 +- site/assets/scss/_colors.scss | 1 + site/assets/scss/_navbar.scss | 16 + site/assets/scss/_syntax.scss | 38 +- site/assets/scss/_tarteaucitron.scss | 4 - site/content/docs/5.3/components/accordion.md | 57 +- site/content/docs/5.3/components/alerts.md | 2 +- .../docs/5.3/components/back-to-top.md | 10 +- .../content/docs/5.3/components/breadcrumb.md | 30 +- .../docs/5.3/components/button-group.md | 82 +- site/content/docs/5.3/components/buttons.md | 105 +- .../docs/5.3/components/close-button.md | 48 +- site/content/docs/5.3/components/dropdowns.md | 121 +- .../content/docs/5.3/components/list-group.md | 56 +- .../docs/5.3/components/local-navigation.md | 34 +- site/content/docs/5.3/components/modal.md | 42 +- site/content/docs/5.3/components/navbar.md | 91 +- site/content/docs/5.3/components/offcanvas.md | 10 +- .../docs/5.3/components/orange-navbar.md | 18 +- .../content/docs/5.3/components/pagination.md | 34 +- site/content/docs/5.3/components/spinners.md | 24 +- .../docs/5.3/components/stepped-process.md | 39 +- site/content/docs/5.3/components/tags.md | 29 +- site/content/docs/5.3/components/toasts.md | 4 +- .../content/docs/5.3/customize/color-modes.md | 6 + site/content/docs/5.3/customize/color.md | 5 +- .../docs/5.3/customize/css-variables.md | 8 - site/content/docs/5.3/customize/sass.md | 12 +- site/content/docs/5.3/dark-mode.md | 2303 +++++++++++++++++ .../docs/5.3/examples/download-app/index.html | 6 +- .../content/docs/5.3/examples/form/index.html | 6 +- site/content/docs/5.3/forms/checks-radios.md | 27 +- site/content/docs/5.3/forms/input-group.md | 32 +- .../docs/5.3/forms/quantity-selector.md | 12 +- site/content/docs/5.3/forms/validation.md | 4 +- site/content/docs/5.3/helpers/stacks.md | 8 +- site/content/docs/5.3/migration.md | 7 +- site/content/docs/5.3/utilities/background.md | 28 +- site/content/docs/5.3/utilities/colors.md | 26 +- site/data/grays.yml | 2 + site/data/palette.yml | 30 +- site/data/sidebar.yml | 20 +- site/data/theme-colors.yml | 5 +- site/layouts/_default/docs.html | 4 +- site/layouts/_default/examples.html | 26 +- site/layouts/partials/docs-navbar.html | 15 +- site/layouts/partials/docs-subnav.html | 2 +- site/layouts/partials/docs-versions.html | 2 +- site/layouts/partials/footer.html | 6 +- site/layouts/partials/icons.html | 15 +- .../callout-deprecated-dark-variants.html | 9 + site/layouts/shortcodes/card.html | 2 +- site/layouts/shortcodes/orange-footer.html | 26 +- .../shortcodes/orange-global-headers.html | 4 +- site/layouts/shortcodes/orange-supra.html | 2 +- 89 files changed, 3243 insertions(+), 1247 deletions(-) create mode 100644 site/content/docs/5.3/dark-mode.md create mode 100644 site/layouts/shortcodes/callout-deprecated-dark-variants.html diff --git a/.bundlewatch.config.json b/.bundlewatch.config.json index b464012415..947731de22 100644 --- a/.bundlewatch.config.json +++ b/.bundlewatch.config.json @@ -18,15 +18,15 @@ }, { "path": "./dist/css/boosted-utilities.css", - "maxSize": "12.5 kB" + "maxSize": "13.0 kB" }, { "path": "./dist/css/boosted-utilities.min.css", - "maxSize": "11.75 kB" + "maxSize": "12.0 kB" }, { "path": "./dist/css/boosted.css", - "maxSize": "44.0 kB" + "maxSize": "44.25 kB" }, { "path": "./dist/css/boosted.min.css", diff --git a/.storybook/main.js b/.storybook/main.js index d996b9814a..705989b1f2 100644 --- a/.storybook/main.js +++ b/.storybook/main.js @@ -6,7 +6,7 @@ const config = { options: { measure: false } - }, "@storybook/preset-scss"], + }, "@storybook/addon-themes", "@storybook/preset-scss"], "framework": "@storybook/html-webpack5", docs: { autodocs: true diff --git a/.storybook/preview.js b/.storybook/preview.js index 747ba2873d..0a9d9d670c 100644 --- a/.storybook/preview.js +++ b/.storybook/preview.js @@ -1,4 +1,5 @@ import { INITIAL_VIEWPORTS } from '@storybook/addon-viewport'; +import { withThemeByDataAttribute } from '@storybook/addon-themes'; import './storybook.scss'; import prettier from 'prettier/esm/standalone'; import htmlParser from 'prettier/esm/parser-html'; @@ -21,7 +22,17 @@ export const preview = { // Pretty print the Docs code source return match ? prettier.format(match[1].trim(), {printWidth: 120, parser: "html", plugins: [htmlParser]}) : src; } - } - } + }, + }, + decorators: [ + withThemeByDataAttribute({ + themes: { + light: 'light', + dark: 'dark', + }, + defaultTheme: 'light', + attributeName: 'data-bs-theme', + }), + ] } export default preview; diff --git a/js/tests/unit/quantity-selector.spec.js b/js/tests/unit/quantity-selector.spec.js index a1b5c1ae65..5403426e22 100644 --- a/js/tests/unit/quantity-selector.spec.js +++ b/js/tests/unit/quantity-selector.spec.js @@ -83,10 +83,10 @@ describe('QuantitySelector', () => { fixtureEl.innerHTML = [ '
', ' ', - ' ', - ' ', '
' @@ -104,10 +104,10 @@ describe('QuantitySelector', () => { fixtureEl.innerHTML = [ '
', ' ', - ' ', - ' ', '
' @@ -125,10 +125,10 @@ describe('QuantitySelector', () => { fixtureEl.innerHTML = [ '
', ' ', - ' ', - ' ', '
' @@ -152,10 +152,10 @@ describe('QuantitySelector', () => { fixtureEl.innerHTML = [ '
', ' ', - ' ', - ' ', '
' @@ -179,10 +179,10 @@ describe('QuantitySelector', () => { fixtureEl.innerHTML = [ '
', ' ', - ' ', - ' ', '
' @@ -202,10 +202,10 @@ describe('QuantitySelector', () => { fixtureEl.innerHTML = [ '
', ' ', - ' ', - ' ', '
' @@ -227,10 +227,10 @@ describe('QuantitySelector', () => { fixtureEl.innerHTML = [ '
', ' ', - ' ', - ' ', '
' @@ -252,10 +252,10 @@ describe('QuantitySelector', () => { fixtureEl.innerHTML = [ '
', ' ', - ' ', - ' ', '
' @@ -280,10 +280,10 @@ describe('QuantitySelector', () => { fixtureEl.innerHTML = [ '
', ' ', - ' ', - ' ', '
' diff --git a/js/tests/visual/dropdown.html b/js/tests/visual/dropdown.html index 7dcb33d54c..d782f47903 100644 --- a/js/tests/visual/dropdown.html +++ b/js/tests/visual/dropdown.html @@ -68,8 +68,8 @@

Dropdown Bootstrap Visual Test

- - +
@@ -201,7 +201,7 @@ When backdrop is set to static, the modal will not close when clicking outside o

I will not close if you click outside of me. Don't even try to press escape key.

@@ -232,7 +232,7 @@ When backdrop is set to static, the modal will not close when clicking outside o ... @@ -255,7 +255,7 @@ When modals become too long for the user's viewport or device, they scroll indep

This is some placeholder content to show the scrolling behavior for modals. Instead of repeating the text in the modal, we use an inline style to set a minimum height, thereby extending the length of the overall modal and demonstrating the overflow scrolling. When content becomes longer than the height of the viewport, scrolling will move the modal as needed.

@@ -283,7 +283,7 @@ You can also create a scrollable modal that allows scrolling the modal body by a

This content should appear at the bottom after you scroll.

@@ -318,7 +318,7 @@ Add `.modal-dialog-centered` to `.modal-dialog` to vertically center the modal.

This is a vertically centered modal.

@@ -338,7 +338,7 @@ Add `.modal-dialog-centered` to `.modal-dialog` to vertically center the modal.

Just like that.

@@ -385,7 +385,7 @@ Add `.modal-dialog-centered` to `.modal-dialog` to vertically center the modal.

This link and that link have tooltips on hover.

@@ -448,7 +448,7 @@ Utilize the Boosted grid system within a modal by nesting `.container-fluid` wit @@ -523,7 +523,7 @@ Below is a live demo followed by example HTML and JavaScript. For more informati @@ -725,7 +725,7 @@ Please refer to the [Modals](https://system.design.orange.com/0c1af118d/p/16d9f3 ... @@ -742,7 +742,7 @@ Please refer to the [Modals](https://system.design.orange.com/0c1af118d/p/16d9f3 ... @@ -759,7 +759,7 @@ Please refer to the [Modals](https://system.design.orange.com/0c1af118d/p/16d9f3 ... @@ -776,7 +776,7 @@ Please refer to the [Modals](https://system.design.orange.com/0c1af118d/p/16d9f3 ... @@ -793,7 +793,7 @@ Please refer to the [Modals](https://system.design.orange.com/0c1af118d/p/16d9f3 ... @@ -810,7 +810,7 @@ Please refer to the [Modals](https://system.design.orange.com/0c1af118d/p/16d9f3 ... diff --git a/site/content/docs/5.3/components/navbar.md b/site/content/docs/5.3/components/navbar.md index 70638127f5..90ddae8de8 100644 --- a/site/content/docs/5.3/components/navbar.md +++ b/site/content/docs/5.3/components/navbar.md @@ -45,7 +45,7 @@ Navbars come with built-in support for a handful of sub-components. Choose from Here's an example of all the sub-components included in a responsive dark-themed navbar that automatically collapses at the `lg` (large) breakpoint. {{< example >}} -