Skip to content

Commit

Permalink
Changes V4.2.0:
Browse files Browse the repository at this point in the history
* Added Cypress tests ~99% coverage
* Removed V4, to be moved to a different branch
* Fixing Tab issue #444
* Minor fix for Button.isActive property
* Carousel no longer use touch events but a standardized pointer event listener setup
* Dropdown improvements for automatic positioning
* Tooltip, Popover small fixes with their shared utilities
 Modal and Offcanvas will use a callback for dispose() method combined with specific hide() / close() method
* Minor fixes to allow working with iframes, bugs revealed by Cypress testing
* Code cleanup
* Update Types

TO DO:
* update to latest Bootstrap v5.2.0
  • Loading branch information
thednp committed May 27, 2022
1 parent ca94971 commit 6c89950
Show file tree
Hide file tree
Showing 122 changed files with 24,155 additions and 23,070 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
- uses: bahmutov/npm-install@v1
- run: npm run lint:js
- run: npm run build-esm
# - run: npm run test
- run: npm run test

# - name: Upload coverage report on Node 16 to coveralls.io...
# uses: coverallsapp/[email protected]
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload coverage report on Node 16 to coveralls.io...
uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
.nyc_output
.npmignore
.vscode
node_modules
experiments
coverage
cypress/videos
cypress/screenshots
cypress/coverage
cypress/instrumented
8 changes: 7 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
.nyc_output
.github
.gitignore
.vscode
assets
node_modules
experiments
docs
docs
coverage
cypress/videos
cypress/screenshots
cypress/coverage
cypress/instrumented
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# BSN stands for Native JavaScript for Bootstrap
The faster, lighter and more compact set of JavaScript components for **Bootstrap 5** and **Bootstrap 4**, developed on modern ES6+ standards.
# BSN
The faster, lighter and more compact set of JavaScript components for **Bootstrap 5**, developed on modern ES6+ standards.
The **bootstrap.native** library is available on npm, CDN and comes packed with build tools and lots of goodies.

[![NPM Version](https://img.shields.io/npm/v/bootstrap.native.svg?style=flat-square)](https://www.npmjs.com/package/bootstrap.native)
Expand All @@ -9,7 +9,7 @@ The **bootstrap.native** library is available on npm, CDN and comes packed with

The library is around ***30Kb*** minified (V5 ***38Kb***) and around ***10Kb*** gZipped. See <a href="http://thednp.github.io/bootstrap.native/">the demo</a> for components guidelines and examples, or the [Wiki/How to use](https:/thednp/bootstrap.native/wiki/How-to-use) on how to use the library or create custom builds.

# BSN Wiki
# Wiki
Please check the `bootstrap.native` Wiki pages, they're updated with almost every new commit:
* [Acknowledgements](https:/thednp/bootstrap.native/wiki/Acknowledgements) - there are similarities and differences with the original jQuery plugins, good to know for maximizing your workflow.
* [How to use](https:/thednp/bootstrap.native/wiki/How-to-use) - An in depth guide on how to use the library.
Expand All @@ -26,8 +26,8 @@ Please check the `bootstrap.native` Wiki pages, they're updated with almost ever
* [FAQs](https:/thednp/bootstrap.native/wiki/FAQs) - A short list of frequent asked questions regarding the use of the library.
* [About](https:/thednp/bootstrap.native/wiki/About) - Learn about the `bootstrap.native` project inception, goals and motivations.

# BSN Contributors
# Contributors
* Full contributors list [here](https:/thednp/bootstrap.native/graphs/contributors). Thanks!

# BSN License
# License
The BSN library is released under the [MIT license](https:/thednp/bootstrap.native/blob/master/LICENSE).
7 changes: 7 additions & 0 deletions cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"video": false,
"screenshot": false,
"env": {
"sourceFolder": "src"
}
}
15 changes: 15 additions & 0 deletions cypress/alert.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>BSN Testing Page</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
</head>
<body class="container" style="padding: 3rem">
<h3>Alert Examples</h3>
<div id="alertDemo" class="alert alert-warning alert-dismissible fade show" data-cy="alert" role="alert">
<button type="button" class="btn-close" data-bs-target="alertDemo" data-bs-dismiss="alert" aria-label="Close"></button>
<b>Holy guacamole!</b> Best check yo self, you're not looking too good.
</div>
</body>
</html>
12 changes: 12 additions & 0 deletions cypress/button.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>BSN Testing Page</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
</head>
<body class="container" style="padding: 3rem">
<h3>Button Example</h3>
<button type="button" class="btn btn-primary" data-bs-toggle="button" data-cy="button" aria-pressed="false">Toggle button</button>
</body>
</html>
81 changes: 81 additions & 0 deletions cypress/carousel.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>BSN Testing Page</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
<style>
.item-bg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 500px;
}
.carousel-item { transition-duration: 0.2s;}
.carousel-item,
.carousel {
width: 100%;
height: 500px;
}
</style>
</head>
<body class="container" style="padding: 3rem">
<h3>Carousel Example</h3>

<div id="myCarousel" class="carousel slide" data-bs-ride="carousel" data-bs-interval="7000" data-bs-pause="hover" data-bs-keyboard="true" data-cy="carousel">
<div class="carousel-indicators">
<button aria-label="Carousel Slide 1" data-bs-target="#myCarousel" data-bs-slide-to="0"></button>
<button aria-label="Carousel Slide 2" data-bs-target="#myCarousel" data-bs-slide-to="1"></button>
<button aria-label="Carousel Slide 3" data-bs-target="#myCarousel" data-bs-slide-to="2"></button>
</div>
<div class="carousel-inner" role="listbox">
<div class="carousel-item">
<div class="item-bg bg-warning"></div>
<div class="container d-flex align-items-end h-100">
<div class="position-relative text-dark text-left mb-5">
<h1>Slide 1 Title Should Be A Little Longer</h1>
<p class="lead">Slide 1 Text Should Be A Little Longer.</p>
<p>In incididunt echo park, officia deserunt mcsweeney's proident master cleanse thundercats sapiente veniam.
Excepteur VHS elit, proident shoreditch +1 biodiesel laborum craft beer. Single-origin coffee wayfarers
irure four loko, cupidatat terry richardson master cleanse.</p>
</div>
</div>
</div>
<div class="carousel-item">
<div class="item-bg bg-info"></div>
<div class="container d-flex align-items-end h-100">
<div class="position-relative text-dark w-100 mb-5">
<h1>Slide 2 Title Should Be A Little Longer</h1>
<p class="lead">Slide 2 Text Should Be A Little Longer.</p>
<p>Assumenda you probably haven't heard of them
art party fanny pack, tattooed nulla cardigan tempor ad. Proident wolf nesciunt sartorial keffiyeh eu banh
mi sustainable. Elit wolf voluptate, lo-fi ea portland before they sold out four loko. Locavore enim nostrud
mlkshk brooklyn nesciunt.</p>
</div>
</div>
</div>
<div class="carousel-item">
<div class="item-bg bg-danger"></div>
<div class="container d-flex align-items-end h-100">
<div class="position-relative text-white text-right w-100 mb-5">
<h1>Slide 3 Title Should Be A Little Longer</h1>
<p class="lead">Slide 3 Text Should Be A Little Longer.</p>
<p>Excepteur VHS elit, proident shoreditch +1 biodiesel laborum craft beer. Single-origin coffee wayfarers
irure four loko, cupidatat terry richardson master cleanse. Elit wolf voluptate, lo-fi ea portland before
they sold out four loko</p>
</div>
</div>
</div>
</div>
<a class="carousel-control-prev" href="#myCarousel" role="button" data-bs-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="visually-hidden">Previous</span>
</a>
<a class="carousel-control-next" href="#myCarousel" role="button" data-bs-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="visually-hidden">Next</span>
</a>
</div>
</body>
</html>
77 changes: 77 additions & 0 deletions cypress/collapse.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>BSN Testing Page</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
<style>
.collapse.collapsing { transition-duration: .15s }
</style>
</head>
<body class="container" style="padding: 3rem">
<h3>Collapse Example</h3>
<p>
<span class="btn-group">
<a class="btn btn-primary" data-bs-toggle="collapse" href="#collapseExample" aria-expanded="true" aria-controls="collapseExample">
HREF
</a>
<button class="btn btn-primary" type="button" data-bs-toggle="collapse" data-bs-target="#collapseExample" aria-expanded="true" aria-controls="collapseExample">data-bs-target</button>
</span>
</p>
<div class="collapse" id="collapseExample">
<div class="card card-body mb-3">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. Nihil anim
keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident.
</div>
</div>

<h3>Accordion Example</h3>
<div class="accordion mb-3" id="accordionExample">
<div class="accordion-item">
<h2 class="accordion-header" id="headingOne">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="false" aria-controls="collapseOne">
Accordion Item #1
</button>
</h2>
<div id="collapseOne" class="accordion-collapse collapse" aria-labelledby="headingOne" data-bs-parent="#accordionExample">
<div class="accordion-body">
<strong>This is the first item's accordion body.</strong> It is hidden by default, until the collapse plugin adds
the appropriate classes that we use to style each element. These classes control the overall appearance, as well
as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables.
It's also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow.
</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header" id="headingTwo">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
Accordion Item #2
</button>
</h2>
<div id="collapseTwo" class="accordion-collapse collapse" aria-labelledby="headingTwo" data-bs-parent="#accordionExample">
<div class="accordion-body">
<strong>This is the second item's accordion body.</strong> It is hidden by default, until the collapse plugin adds the appropriate
classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS
transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about
any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow.
</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header" id="headingThree">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
Accordion Item #3
</button>
</h2>
<div id="collapseThree" class="accordion-collapse collapse" aria-labelledby="headingThree" data-bs-parent="#accordionExample">
<div class="accordion-body">
<strong>This is the third item's accordion body.</strong> It is hidden by default, until the collapse plugin adds the appropriate
classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS
transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about
any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow.
</div>
</div>
</div>
</div>
</body>
</html>
71 changes: 71 additions & 0 deletions cypress/dropdown.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>BSN Testing Page</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
<style>
.form-vertical {width: 250px}
</style>
</head>
<body class="container" style="padding: 3rem">
<h3>Dropdown Examples</h3>
<div class="btn-toolbar mb-3">
<div class="btn-group dropdown me-2">
<a class="btn btn-secondary dropdown-toggle" href="#" id="dropdownButton4" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Form
</a>
<form class="px-3 dropdown-menu form-vertical" aria-expanded="false" aria-labelledby="dropdownButton4">
<div class="mb-3">
<label for="inputEmail3" class="control-label">Email</label>
<div class=""><input type="email" class="form-control" id="inputEmail3" placeholder="Email" autocomplete="email"></div>
</div>
<div class="mb-3">
<label for="inputPassword3" class="control-label">Password</label>
<div class=""><input type="password" class="form-control" id="inputPassword3" placeholder="Password" autocomplete="current-password"></div>
</div>
<div class="mb-3">
<div class="">
<div class="checkbox"><label><input type="checkbox"> Remember me</label></div>
</div>
</div>
<div class="mb-3">
<div class="btn-group"><button type="submit" class="btn btn-secondary">Sign in</button></div>
</div>
</form>
</div>
<div class="btn-group dropup me-2">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Dropup
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="#">First Action</a>
<a class="dropdown-item" href="#">Second Action</a>
<a class="dropdown-item" href="#">Third Action</a>
<a class="dropdown-item" href="#">Another Action</a>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</div>
<div class="btn-group dropstart me-2">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton1" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Menu Start
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton1">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</div>
<div class="btn-group dropend">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton2" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Menu End
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuButton2">
<li><a class="dropdown-item" href="#">Action</a></li>
<li><a class="dropdown-item" href="#">Another action</a></li>
<li><a class="dropdown-item" href="#">Something else here</a></li>
</ul>
</div>
</div>
</body>
</html>
20 changes: 20 additions & 0 deletions cypress/fixtures/changeDirection.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* Sets the `dir` attribute for `<html>` element.
* @param {HTMLElement} element target
* @param {string=} requestedDir requested language direction
*/
export default function changeDirection(element, requestedDir) {
const doc = element.ownerDocument;
const dir = requestedDir === 'rtl' ? 'rtl' : '';
const HTML = doc.documentElement;
const STYLE = doc.querySelector('link');
let HREF = 'https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css';
// set RTL mode
if (dir) {
HTML.setAttribute('dir', 'rtl');
STYLE.setAttribute('href', HREF.replace('.min', '.rtl.min'));
} else {
HTML.removeAttribute('dir');
STYLE.setAttribute('href', HREF);
}
}
Loading

0 comments on commit 6c89950

Please sign in to comment.