Skip to content

Commit f962802

Browse files
authored
Add VCP to build and docs guides (#42157)
* Add VCP to build and docsguides * fix
1 parent be29612 commit f962802

17 files changed

Lines changed: 58 additions & 33 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ Within the download you’ll find the following directories and files, logically
115115
```
116116
</details>
117117

118-
We provide compiled CSS and JS (`bootstrap.*`), as well as compiled and minified CSS and JS (`bootstrap.min.*`). [Source maps](https://web.dev/articles/source-maps) (`bootstrap.*.map`) are available for use with certain browsers' developer tools. Bundled JS files (`bootstrap.bundle.js` and minified `bootstrap.bundle.min.js`) include [Floating UI](https://floating-ui.com/). All CSS files work for both LTR and RTL layouts thanks to logical properties—simply set `dir="rtl"` on your HTML element.
118+
We provide compiled CSS and JS (`bootstrap.*`), as well as compiled and minified CSS and JS (`bootstrap.min.*`). [Source maps](https://web.dev/articles/source-maps) (`bootstrap.*.map`) are available for use with certain browsers' developer tools. Bundled JS files (`bootstrap.bundle.js` and minified `bootstrap.bundle.min.js`) include [Floating UI](https://floating-ui.com/) and [Vanilla Calendar Pro](https://vanilla-calendar.pro/). All CSS files work for both LTR and RTL layouts thanks to logical properties—simply set `dir="rtl"` on your HTML element.
119119

120120

121121
## Bugs and feature requests

build/generate-sri.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ const files = [
4040
{
4141
file: 'node_modules/@floating-ui/dom/dist/floating-ui.dom.umd.min.js',
4242
configPropertyName: 'floating_ui_hash'
43+
},
44+
{
45+
file: 'node_modules/vanilla-calendar-pro/index.js',
46+
configPropertyName: 'vanilla_calendar_pro_hash'
4347
}
4448
]
4549

build/rollup.config.mjs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const BUNDLE = process.env.BUNDLE === 'true'
1212
const ESM = process.env.ESM === 'true'
1313

1414
let destinationFile = `bootstrap${ESM ? '.esm' : ''}`
15-
const external = ['@floating-ui/dom']
15+
const external = ['@floating-ui/dom', 'vanilla-calendar-pro']
1616
const plugins = [
1717
babel({
1818
// Only transpile our source code
@@ -22,14 +22,16 @@ const plugins = [
2222
})
2323
]
2424
const globals = {
25-
'@floating-ui/dom': 'FloatingUIDOM'
25+
'@floating-ui/dom': 'FloatingUIDOM',
26+
'vanilla-calendar-pro': 'VanillaCalendarPro'
2627
}
2728

2829
if (BUNDLE) {
2930
destinationFile += '.bundle'
30-
// Remove last entry in external array to bundle Floating UI
31-
external.pop()
31+
// Remove all entries in external array to bundle Floating UI and Vanilla Calendar Pro
32+
external.length = 0
3233
delete globals['@floating-ui/dom']
34+
delete globals['vanilla-calendar-pro']
3335
plugins.push(
3436
replace({
3537
'process.env.NODE_ENV': '"production"',

config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ cdn:
4343
floating_ui: "https://cdn.jsdelivr.net/npm/@floating-ui/dom@1.7.0/dist/floating-ui.dom.umd.min.js"
4444
floating_ui_hash: "sha384-R7p1RqabZNhI+RdPNIzTouzd/LBVorZ0Tn3ApcogSOk+HF3o+P0HIenrUw/n0MOj"
4545
floating_ui_esm: "https://cdn.jsdelivr.net/npm/@floating-ui/dom@1.7.0/dist/floating-ui.dom.esm.min.js"
46+
vanilla_calendar_pro: "https://cdn.jsdelivr.net/npm/vanilla-calendar-pro@3.1.0/index.js"
47+
vanilla_calendar_pro_hash: "sha384-uufJjV19/4zCvBe4t3zJFWdYpBIrAC78Ef5NN2i4VjmTowSYuAx+m56vF6ccI4V3"
48+
vanilla_calendar_pro_esm: "https://cdn.jsdelivr.net/npm/vanilla-calendar-pro@3.1.0/index.mjs"
4649

4750
anchors:
4851
min: 2

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,13 +202,15 @@
202202
"shim": {
203203
"js/bootstrap": {
204204
"deps": [
205-
"@floating-ui/dom"
205+
"@floating-ui/dom",
206+
"vanilla-calendar-pro"
206207
]
207208
}
208209
},
209210
"dependencies": {},
210211
"peerDependencies": {
211-
"@floating-ui/dom": "^1.7.0"
212+
"@floating-ui/dom": "^1.7.0",
213+
"vanilla-calendar-pro": "^3.1.0"
212214
}
213215
},
214216
"overrides": {

site/data/plugins.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
description: Expand and collapse areas of content, or create accordions.
1515
link: components/collapse/
1616

17+
- name: Datepicker
18+
description: Add date selection to form inputs. Built on Vanilla Calendar Pro.
19+
link: forms/datepicker/
20+
1721
- name: Dialog
1822
description: Add flexible and responsive dialogs to your project.
1923
link: components/dialog/

site/src/content/docs/customize/optimize.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ If you’re not using a component, comment it out or delete it entirely. For exa
1414

1515
## Lean JavaScript
1616

17-
Bootstrap’s JavaScript includes every component in our primary dist files (`bootstrap.js` and `bootstrap.min.js`), and even our primary dependency (Floating UI) with our bundle files (`bootstrap.bundle.js` and `bootstrap.bundle.min.js`). While you’re customizing via Sass, be sure to remove related JavaScript.
17+
Bootstrap’s JavaScript includes every component in our primary dist files (`bootstrap.js` and `bootstrap.min.js`), and even our primary dependencies (Floating UI and Vanilla Calendar Pro) with our bundle files (`bootstrap.bundle.js` and `bootstrap.bundle.min.js`). While you’re customizing via Sass, be sure to remove related JavaScript.
1818

1919
For instance, assuming you’re using your own JavaScript bundler like Webpack, Parcel, or Vite, you’d only import the JavaScript you plan on using. In the example below, we show how to just include our dialog JavaScript:
2020

@@ -35,7 +35,7 @@ import 'bootstrap/js/dist/dialog';
3535
// import 'bootstrap/js/dist/tooltip';
3636
```
3737

38-
This way, you’re not including any JavaScript you don’t intend to use for components like buttons, carousels, and tooltips. If you’re importing dropdowns, tooltips or popovers, be sure to list the Floating UI dependency in your `package.json` file.
38+
This way, you’re not including any JavaScript you don’t intend to use for components like buttons, carousels, and tooltips. If you’re importing dropdowns, tooltips or popovers, be sure to list the Floating UI dependency in your `package.json` file. If you’re using the datepicker, be sure to also list the Vanilla Calendar Pro dependency.
3939

4040
<Callout>
4141
**Heads up!** Files in `bootstrap/js/dist` use the **default export**. To use them, do the following:

site/src/content/docs/customize/rtl.mdx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,13 @@ Here's a modified RTL starter template:
8989

9090
<!-- Optional JavaScript; choose one of the two! -->
9191

92-
<!-- Option 1: Bootstrap Bundle with Floating UI -->
92+
<!-- Option 1: Bootstrap Bundle with Floating UI and Vanilla Calendar Pro -->
9393
<script src="[[config:cdn.js_bundle]]" integrity="[[config:cdn.js_bundle_hash]]" crossorigin="anonymous"></script>
9494

95-
<!-- Option 2: Separate Floating UI and Bootstrap JS -->
95+
<!-- Option 2: Separate Floating UI, Vanilla Calendar Pro, and Bootstrap JS -->
9696
<!--
9797
<script src="[[config:cdn.floating_ui]]" integrity="[[config:cdn.floating_ui_hash]]" crossorigin="anonymous"></script>
98+
<script src="[[config:cdn.vanilla_calendar_pro]]" integrity="[[config:cdn.vanilla_calendar_pro_hash]]" crossorigin="anonymous"></script>
9899
<script src="[[config:cdn.js]]" integrity="[[config:cdn.js_hash]]" crossorigin="anonymous"></script>
99100
-->
100101
</body>

site/src/content/docs/getting-started/install.mdx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,19 @@ Here are our primary CDN links for CSS and JavaScript:
8383
<script src="[[config:cdn.js_bundle]]" integrity="[[config:cdn.js_bundle_hash]]" crossorigin="anonymous"></script>
8484
```
8585

86-
If you’re using our compiled JavaScript and prefer to include Floating UI separately, add Floating UI before our JS, via a CDN preferably.
86+
If you’re using our compiled JavaScript and prefer to include Floating UI and Vanilla Calendar Pro separately, add them before our JS, via a CDN preferably.
8787

8888
```html
8989
<script src="[[config:cdn.floating_ui]]" integrity="[[config:cdn.floating_ui_hash]]" crossorigin="anonymous"></script>
90+
<script src="[[config:cdn.vanilla_calendar_pro]]" integrity="[[config:cdn.vanilla_calendar_pro_hash]]" crossorigin="anonymous"></script>
9091
<script src="[[config:cdn.js]]" integrity="[[config:cdn.js_hash]]" crossorigin="anonymous"></script>
9192
```
9293

9394
<BsTable>
9495
| File type | URL |
9596
| --- | --- |
9697
| CSS | [`[[config:cdn.css]]`]([[config:cdn.css]]) |
97-
| JS (with Floating UI) | [`[[config:cdn.js_bundle]]`]([[config:cdn.js_bundle]]) |
98+
| JS bundle (with Floating UI and Vanilla Calendar Pro) | [`[[config:cdn.js_bundle]]`]([[config:cdn.js_bundle]]) |
9899
</BsTable>
99100

100101
### Using CDNs
@@ -130,7 +131,7 @@ You can also do the old fashioned thing and download Bootstrap manually. Choose
130131
<BsTable>
131132
| Type | Description | Link |
132133
| --- | --- | --- |
133-
| <strong class="text-nowrap">Distribution files</strong> | Ready-to-use compiled and minified CSS and JavaScript files. Doesn't include documentation, source files, or dependencies like Floating UI. | <a href="[[config:download.dist]]" class="btn-subtle theme-accent btn-sm">Download</a> |
134+
| <strong class="text-nowrap">Distribution files</strong> | Ready-to-use compiled and minified CSS and JavaScript files. Doesn't include documentation, source files, or dependencies like Floating UI and Vanilla Calendar Pro. | <a href="[[config:download.dist]]" class="btn-subtle theme-accent btn-sm">Download</a> |
134135
| <strong class="text-nowrap">Source files</strong> | Sass, JavaScript, and documentation files for compiling with your own asset pipeline. Requires [Sass compiler]([[docsref:/guides/contribute#sass]]), [Autoprefixer](https://github.com/postcss/autoprefixer), and a JavaScript bundler like [Rollup](https://rollupjs.org/) or [Webpack](https://webpack.js.org/). | <a href="[[config:download.source]]" class="btn-subtle theme-accent btn-sm">Download</a> |
135136
</BsTable>
136137

site/src/content/docs/getting-started/javascript.mdx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ toc: true
66

77
## JS components
88

9-
Curious which components explicitly require our JavaScript and Floating UI?
9+
Curious which components explicitly require our JavaScript and Floating UI or Vanilla Calendar Pro?
1010

1111
- Accordions for extending our Collapse plugin
1212
- Alerts for dismissing
1313
- Buttons for toggling states and checkbox/radio functionality
1414
- Carousel for all slide behaviors, controls, and indicators
1515
- Collapse for toggling visibility of content
16+
- Datepicker for date selection (also requires [Vanilla Calendar Pro](https://vanilla-calendar.pro/))
1617
- Dropdowns for displaying and positioning (also requires [Floating UI](https://floating-ui.com/))
1718
- Modals for displaying, positioning, and scroll behavior
1819
- Navbar for extending our Collapse and Offcanvas plugins to implement responsive behaviors
@@ -59,19 +60,21 @@ We provide a version of Bootstrap built as `ESM` (`bootstrap.esm.js` and `bootst
5960
</script>
6061
```
6162

62-
Compared to JS bundlers, using ESM in the browser requires you to use the full path and filename instead of the module name. [Read more about JS modules in the browser.](https://v8.dev/features/modules#specifiers) That’s why we use `'bootstrap.esm.min.js'` instead of `'bootstrap'` above. However, this is further complicated by our Floating UI dependency, which imports Floating UI into our JavaScript like so:
63+
Compared to JS bundlers, using ESM in the browser requires you to use the full path and filename instead of the module name. [Read more about JS modules in the browser.](https://v8.dev/features/modules#specifiers) That’s why we use `'bootstrap.esm.min.js'` instead of `'bootstrap'` above. However, this is further complicated by our Floating UI and Vanilla Calendar Pro dependencies, which are imported into our JavaScript like so:
6364

6465
```js
6566
import * as Popper from "@floating-ui/dom"
67+
import { Calendar } from "vanilla-calendar-pro"
6668
```
6769

6870
If you try this as-is, you’ll see an error in the console like the following:
6971

7072
```text
7173
Uncaught TypeError: Failed to resolve module specifier "@floating-ui/dom". Relative references must start with either "/", "./", or "../".
74+
Uncaught TypeError: Failed to resolve module specifier "vanilla-calendar-pro". Relative references must start with either "/", "./", or "../".
7275
```
7376

74-
To fix this, you can use an `importmap` to resolve the arbitrary module names to complete paths. If your [targeted browsers](https://caniuse.com/?search=importmap) do not support `importmap`, you’ll need to use the [es-module-shims](https://github.com/guybedford/es-module-shims) project. Here’s how it works for Bootstrap and Floating UI:
77+
To fix this, you can use an `importmap` to resolve the arbitrary module names to complete paths. If your [targeted browsers](https://caniuse.com/?search=importmap) do not support `importmap`, you’ll need to use the [es-module-shims](https://github.com/guybedford/es-module-shims) project. Here’s how it works for Bootstrap, Floating UI, and Vanilla Calendar Pro:
7578

7679
```html
7780
<!doctype html>
@@ -91,6 +94,7 @@ To fix this, you can use an `importmap` to resolve the arbitrary module names to
9194
{
9295
"imports": {
9396
"@floating-ui/dom": "[[config:cdn.floating_ui_esm]]",
97+
"vanilla-calendar-pro": "[[config:cdn.vanilla_calendar_pro_esm]]",
9498
"bootstrap": "https://cdn.jsdelivr.net/npm/bootstrap@[[config:current_version]]/dist/js/bootstrap.esm.min.js"
9599
}
96100
}
@@ -108,7 +112,7 @@ To fix this, you can use an `importmap` to resolve the arbitrary module names to
108112

109113
Some plugins and CSS components depend on other plugins. If you include plugins individually, make sure to check for these dependencies in the docs.
110114

111-
Our dropdowns, popovers, and tooltips also depend on [Floating UI](https://floating-ui.com/).
115+
Our dropdowns, popovers, and tooltips also depend on [Floating UI](https://floating-ui.com/). Our datepicker also depends on [Vanilla Calendar Pro](https://vanilla-calendar.pro/).
112116

113117
## Data attributes
114118

0 commit comments

Comments
 (0)