diff --git a/README.md b/README.md index df2b83e..49b6ea2 100644 --- a/README.md +++ b/README.md @@ -75,14 +75,14 @@ Add the following HTML:
-
- diff --git a/docs/index.html b/docs/index.html index e1f2dc2..14d64b4 100644 --- a/docs/index.html +++ b/docs/index.html @@ -37,36 +37,36 @@

Linear stepper

-
-
-
-
-
+ +
-
+
@@ -74,7 +74,7 @@

Linear stepper

-
+
@@ -87,7 +87,7 @@

Non linear stepper

-
-
-
- -
+ +
-
+
-
+
@@ -141,7 +141,7 @@

Non linear stepper (with fade)

-
-
-
-
-
+ +
-
+
-
+
@@ -192,39 +192,39 @@

Non linear stepper (with fade)

Vertical linear stepper

-
+
-
-
-
-
-
+ +
-
+
@@ -232,7 +232,7 @@

Vertical linear stepper

-
+
@@ -248,10 +248,9 @@

Vertical linear stepper

- - - + + diff --git a/docs/js/main.js b/docs/js/main.js index 580908a..5f3a030 100644 --- a/docs/js/main.js +++ b/docs/js/main.js @@ -13,23 +13,4 @@ document.addEventListener('DOMContentLoaded', function () { animation: true }) stepper4 = new Stepper(document.querySelector('#stepper4')) - - function handleBreakPointChange (breakpoint) { - if (breakpoint === 'large') { - stepper1._element.classList.add('vertical') - stepper2._element.classList.add('vertical') - stepper3._element.classList.add('vertical') - } else if (breakpoint === 'xLarge' && stepper1._element.classList.contains('vertical')) { - stepper1._element.classList.remove('vertical') - stepper2._element.classList.remove('vertical') - stepper3._element.classList.remove('vertical') - } - } - - window.addEventListener('new.bs.breakpoint', function (event) { - handleBreakPointChange(event.detail) - }) - - bsBreakpoints.init() - handleBreakPointChange(bsBreakpoints.detectBreakpoint()) }) diff --git a/package.json b/package.json index d13ef74..8e2624c 100644 --- a/package.json +++ b/package.json @@ -20,8 +20,9 @@ "css-minify": "cleancss --level 1 --format breaksWith=lf --source-map --source-map-inline-sources --output dist/css/bs-stepper.min.css dist/css/bs-stepper.css", "dev": "rollup --environment DEV -c -w", "test:unit": "karma start tests/karma.conf.js", - "test": "npm run standard && npm run build-js:unit && npm run test:unit && npm run build", + "test": "npm run standard && npm run css-lint && npm run build-js:unit && npm run test:unit && npm run build", "standard": "standard src/js/* tests/units/*.spec.js", + "css-lint": "stylelint src/css/bs-stepper.css", "deploy": "gh-pages -d docs", "docs-build": "shx mkdir -p docs/dist/ && shx cp -r dist/css/ docs/dist/ && shx cp -r dist/js/ docs/dist/", "docs-serve": "http-server docs/ -c-1 -o", diff --git a/src/css/bs-stepper.css b/src/css/bs-stepper.css index f925195..c459636 100644 --- a/src/css/bs-stepper.css +++ b/src/css/bs-stepper.css @@ -4,40 +4,56 @@ * Licensed under MIT (https://github.com/Johann-S/bs-stepper/blob/master/LICENSE) */ -.bs-stepper-trigger { +.bs-stepper .step-trigger, +.bs-stepper a { display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: center; padding: 20px; + font-size: 1rem; font-weight: 700; + line-height: 1.5; color: #6c757d; text-align: center; text-decoration: none; white-space: nowrap; - cursor: pointer; + vertical-align: middle; + user-select: none; background-color: transparent; border: none; + border-radius: .25rem; transition: background-color .15s ease-out, color .15s ease-out; } -.bs-stepper-trigger:disabled { +.bs-stepper .step-trigger:not(:disabled):not(.disabled), +.bs-stepper a:not(:disabled):not(.disabled) { + cursor: pointer; +} + +.bs-stepper .step-trigger:disabled, +.bs-stepper .step-trigger.disabled, +.bs-stepper a:disabled, +.bs-stepper .disabled:not(.step-trigger) { pointer-events: none; opacity: .65; } -.bs-stepper-trigger:focus { +.bs-stepper .step-trigger:focus, +.bs-stepper a:focus { color: #007bff; outline: none; } -.bs-stepper-trigger:hover { +.bs-stepper .step-trigger:hover, +.bs-stepper a:hover { text-decoration: none; background-color: rgba(0, 0, 0, .06); } @media (max-width: 520px) { - .bs-stepper-trigger { + .bs-stepper .step-trigger, + .bs-stepper a { flex-direction: column; padding: 10px; } @@ -60,7 +76,8 @@ } } -.bs-stepper-line { +.bs-stepper-line, +.bs-stepper .line { flex: 1 0 32px; min-width: 1px; min-height: 1px; @@ -68,9 +85,9 @@ background-color: rgba(0, 0, 0, .12); } - @media (max-width: 400px) { - .bs-stepper-line { + .bs-stepper-line, + .bs-stepper .line { flex-basis: 20px; } } @@ -103,26 +120,40 @@ } } -.bs-stepper-vertical { +.bs-stepper.vertical { display: flex; } -.bs-stepper-vertical .bs-stepper-header { +.bs-stepper.vertical .bs-stepper-header { flex-direction: column; align-items: stretch; margin: 0; } -.bs-stepper-vertical .bs-stepper-pane { +.bs-stepper.vertical .bs-stepper-pane, +.bs-stepper.vertical .content { display: block; } -.bs-stepper-pane { +.bs-stepper-pane, +.bs-stepper .content { display: none; opacity: 0; } -.bs-stepper-pane.bs-stepper-shown { +.bs-stepper-pane.active, +.bs-stepper .content.active { display: block; opacity: 1; } + +.bs-stepper-pane.dstepper-block, +.bs-stepper .content.dstepper-block { + opacity: 1; +} + +.bs-stepper .content.fade, +.bs-stepper-pane.fade { + transition-duration: .3s; + transition-property: opacity; +} diff --git a/src/js/util.js b/src/js/util.js index d60b02b..7d19b7a 100644 --- a/src/js/util.js +++ b/src/js/util.js @@ -3,14 +3,14 @@ import { WinEvent, closest } from './polyfill' const MILLISECONDS_MULTIPLIER = 1000 const Selectors = { STEPS: '.step', - TRIGGER: '.bs-stepper-trigger, a', + TRIGGER: '.step-trigger, a', STEPPER: '.bs-stepper' } const ClassName = { ACTIVE: 'active', LINEAR: 'linear', - BLOCK: 'bs-stepper-shown', + BLOCK: 'dstepper-block', NONE: 'dstepper-none', FADE: 'fade' } diff --git a/tests/index.html b/tests/index.html index 73a043e..ec50036 100644 --- a/tests/index.html +++ b/tests/index.html @@ -16,21 +16,21 @@

Linear stepper

-
-
- @@ -58,21 +58,21 @@

Non linear stepper

-
-
- @@ -100,21 +100,21 @@

Vertical stepper

-
-
- diff --git a/tests/units/main.spec.js b/tests/units/main.spec.js index 80f4adf..3f3411a 100644 --- a/tests/units/main.spec.js +++ b/tests/units/main.spec.js @@ -21,10 +21,10 @@ describe('Stepper', function () { fixture.innerHTML = [ '
', '
', - ' ', + ' ', '
', '
', - ' ', + ' ', '
', '
1
', '
2
', @@ -61,10 +61,10 @@ describe('Stepper', function () { fixture.innerHTML = [ '
', '
', - ' ', + ' ', '
', '
', - ' ', + ' ', '
', '
1
', '
2
', @@ -90,10 +90,10 @@ describe('Stepper', function () { fixture.innerHTML = [ '
', '
', - ' ', + ' ', '
', '
', - ' ', + ' ', '
', '
1
', '
2
', @@ -146,10 +146,10 @@ describe('Stepper', function () { fixture.innerHTML = [ '
', '
', - ' ', + ' ', '
', '
', - ' ', + ' ', '
', '
1
', '
2
', @@ -176,10 +176,10 @@ describe('Stepper', function () { fixture.innerHTML = [ '
', '
', - ' ', + ' ', '
', '
', - ' ', + ' ', '
', '
1
', '
2
', @@ -206,10 +206,10 @@ describe('Stepper', function () { fixture.innerHTML = [ '
', '
', - ' ', + ' ', '
', '
', - ' ', + ' ', '
', '
1
', '
2
', @@ -236,10 +236,10 @@ describe('Stepper', function () { fixture.innerHTML = [ '
', '
', - ' ', + ' ', '
', '
', - ' ', + ' ', '
', '
1
', '
2
', @@ -259,10 +259,10 @@ describe('Stepper', function () { fixture.innerHTML = [ '
', '
', - ' ', + ' ', '
', '
', - ' ', + ' ', '
', '
1
', '
2
', @@ -285,10 +285,10 @@ describe('Stepper', function () { fixture.innerHTML = [ '
', '
', - ' ', + ' ', '
', '
', - ' ', + ' ', '
', '
1
', '
2
', @@ -315,10 +315,10 @@ describe('Stepper', function () { fixture.innerHTML = [ '
', '
', - ' ', + ' ', '
', '
', - ' ', + ' ', '
', '
1
', '
2
', @@ -343,10 +343,10 @@ describe('Stepper', function () { fixture.innerHTML = [ '
', '
', - ' ', + ' ', '
', '
', - ' ', + ' ', '
', '
1
', '
2
', @@ -368,13 +368,13 @@ describe('Stepper', function () { fixture.innerHTML = [ '
', '
', - ' ', + ' ', '
', '
', - ' ', + ' ', '
', '
', - ' ', + ' ', '
', '
1
', '
2
', @@ -413,10 +413,10 @@ describe('Stepper', function () { fixture.innerHTML = [ '
', '
', - ' ', + ' ', '
', '
', - ' ', + ' ', '
', '
1
', '
2
', @@ -445,10 +445,10 @@ describe('Stepper', function () { fixture.innerHTML = [ '
', '
', - ' ', + ' ', '
', '
', - ' ', + ' ', '
', '
1
', '
2
', @@ -477,10 +477,10 @@ describe('Stepper', function () { fixture.innerHTML = [ '
', '
', - ' ', + ' ', '
', '
', - ' ', + ' ', '
', '
1
', '
2
',