From c27f9ce75e586dd89356037bf1544b5205170ebe Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Thu, 12 Mar 2020 01:47:34 -0300 Subject: [PATCH 01/49] feature(b-icon): add spinning icon options --- src/icons/_icons.scss | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/icons/_icons.scss b/src/icons/_icons.scss index b6d887e6cb9..5010e7f72c0 100644 --- a/src/icons/_icons.scss +++ b/src/icons/_icons.scss @@ -9,6 +9,34 @@ // Perhaps this values should be SASS variables? vertical-align: -0.15em; } + + &.b-icon-spin { + animation: b-icon-spin 2s infinite linear; + @if $enable-prefers-reduced-motion-media-query { + @media (prefers-reduced-motion: reduce) { + animation: none; + } + } + } + + &.b-icon-pulse { + animation: b-icon-spin 1s infinite steps(8); + @if $enable-prefers-reduced-motion-media-query { + @media (prefers-reduced-motion: reduce) { + animation: none; + } + } + } +} + +// Animation for spinning icons +@keyframes b-icon-spin { + 0% { + transform: rotate(0deg); + } + 100% { + transform: rotate(359deg); + } } // Make icons slightly larger in buttons, nav-links, dropdowns, and input-group-text From 91c716bf2c14cc92992dac33abac656d3bfa59e8 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Thu, 12 Mar 2020 01:51:34 -0300 Subject: [PATCH 02/49] Update _icons.scss --- src/icons/_icons.scss | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/icons/_icons.scss b/src/icons/_icons.scss index 5010e7f72c0..1a4554a972e 100644 --- a/src/icons/_icons.scss +++ b/src/icons/_icons.scss @@ -12,19 +12,15 @@ &.b-icon-spin { animation: b-icon-spin 2s infinite linear; - @if $enable-prefers-reduced-motion-media-query { - @media (prefers-reduced-motion: reduce) { - animation: none; - } + @media (prefers-reduced-motion: reduce) { + animation: none; } } &.b-icon-pulse { animation: b-icon-spin 1s infinite steps(8); - @if $enable-prefers-reduced-motion-media-query { - @media (prefers-reduced-motion: reduce) { - animation: none; - } + @media (prefers-reduced-motion: reduce) { + animation: none; } } } From 41dc9041e9f0fd179f6e78adb82242dcb0353cb5 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Thu, 12 Mar 2020 01:59:18 -0300 Subject: [PATCH 03/49] Update icon-base.js --- src/icons/helpers/icon-base.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/icons/helpers/icon-base.js b/src/icons/helpers/icon-base.js index 7a92d361195..d658c002061 100644 --- a/src/icons/helpers/icon-base.js +++ b/src/icons/helpers/icon-base.js @@ -37,6 +37,14 @@ export const commonIconProps = { shiftV: { type: [Number, String], default: 0 + }, + spin: { + type: Boolean, + default: false + }, + pulse: { + type: Boolean, + default: false } } @@ -116,7 +124,11 @@ export const BVIconBase = /*#__PURE__*/ Vue.extend({ mergeData( { staticClass: 'b-icon bi', - class: { [`text-${props.variant}`]: !!props.variant }, + class: { + [`text-${props.variant}`]: !!props.variant, + 'b-icon-spin': props.spin && !props.pulse, + 'b-icon-pulse': props.pulse + }, attrs: baseAttrs, style: isStacked ? {} : { fontSize: fontScale === 1 ? null : `${fontScale * 100}%` } }, From 378d5f5513d856ae46801c18d8d1970b126504ab Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Thu, 12 Mar 2020 02:02:41 -0300 Subject: [PATCH 04/49] Update package.json --- src/icons/package.json | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/icons/package.json b/src/icons/package.json index f2427fdde82..100611f8262 100644 --- a/src/icons/package.json +++ b/src/icons/package.json @@ -53,6 +53,16 @@ "prop": "stacked", "version": "2.3.0", "description": "Set this prop to true when placing inside a BIconstack component" + }, + { + "prop": "spin", + "version": "2.7.0", + "description": "When set, applies a spinning animation to the icon" + }, + { + "prop": "pulse", + "version": "2.7.0", + "description": "When set, applies a pulsing spin animation to the icon. Takes precedence over the `spin` prop" } ] }, @@ -91,6 +101,16 @@ { "prop": "shiftV", "description": "Moves the icon vertically. Positive numbers will shift the icon up, negative down. Value is in 1/16em units" + }, + { + "prop": "spin", + "version": "2.7.0", + "description": "When set, applies a spinning animation to the icon" + }, + { + "prop": "pulse", + "version": "2.7.0", + "description": "When set, applies a pulsing spin animation to the icon. Takes precedence over the `spin` prop" } ] }, @@ -134,6 +154,16 @@ "prop": "stacked", "version": "2.3.0", "description": "Set this prop to true when placing inside a BIconstack component" + }, + { + "prop": "spin", + "version": "2.7.0", + "description": "When set, applies a spinning animation to the icon" + }, + { + "prop": "pulse", + "version": "2.7.0", + "description": "When set, applies a pulsing spin animation to the icon. Takes precedence over the `spin` prop" } ] }, From 4c4f2a5ec07c0bc6abc84cf9343f8cdf9ee17c50 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Thu, 12 Mar 2020 02:16:43 -0300 Subject: [PATCH 05/49] Update icon-base.js --- src/icons/helpers/icon-base.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/icons/helpers/icon-base.js b/src/icons/helpers/icon-base.js index d658c002061..49aa63889d4 100644 --- a/src/icons/helpers/icon-base.js +++ b/src/icons/helpers/icon-base.js @@ -126,8 +126,8 @@ export const BVIconBase = /*#__PURE__*/ Vue.extend({ staticClass: 'b-icon bi', class: { [`text-${props.variant}`]: !!props.variant, - 'b-icon-spin': props.spin && !props.pulse, - 'b-icon-pulse': props.pulse + 'b-icon-spin': !isStacked && props.spin && !props.pulse, + 'b-icon-pulse': !isStacked && props.pulse }, attrs: baseAttrs, style: isStacked ? {} : { fontSize: fontScale === 1 ? null : `${fontScale * 100}%` } From 12f50344f5267a04e93e888357f062d1bf581f2a Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Thu, 12 Mar 2020 02:36:03 -0300 Subject: [PATCH 06/49] Update README.md --- src/icons/README.md | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/icons/README.md b/src/icons/README.md index 520602625f2..2b7ea3b777f 100644 --- a/src/icons/README.md +++ b/src/icons/README.md @@ -428,6 +428,47 @@ Shifting is applied after any rotation transforms. As with scaling, backgrounds affected. If you need to shift the border/background with the icon, use Bootstrap's margin [spacing utility classes](/docs/reference/utility-classes). +## Animated icons + +v2.7.0+ + +BootstrapVue includes two spinning animation options for icons: `spin` and `pulse`. Both animations +spin the icon clockwise, but pulse uses a stepped spin. + +To use the spin animation, set the `spin` prop to true. To use hte pulse animation, set the `pulse` +prop to `true`. Note that `pulse` takes precedence over `spin`. + +```html + + + +``` + +Note that the animations are CSS based, and is applied _after_ any transforms have taken place: + +```html + + + +``` + +**Note:** The animation effect of this component is dependent on the `prefers-reduced-motion` media +query. See the +[reduced motion section of our accessibility documentation](/docs/reference/accessibility) for +additional details. + ## Stacking icons v2.3.0+ @@ -492,6 +533,8 @@ Stacked icon notes: - The `font-scale` prop cannot be used on the inner icon components - The `width` and `height` attributes cannot be applied to the inner icon components - Stacked icons **cannot** be stacked inside another `` +- Note the `spin` and `pulse` animation props on the child icons will have no effect, however you + can use the animation props on the `` component. ## Using in components From 7e68cd73f4f1305397bc1cd1d08148ff98d05c2d Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Thu, 12 Mar 2020 02:37:53 -0300 Subject: [PATCH 07/49] Update README.md --- src/icons/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/icons/README.md b/src/icons/README.md index 2b7ea3b777f..b02d7fed0b1 100644 --- a/src/icons/README.md +++ b/src/icons/README.md @@ -464,6 +464,8 @@ Note that the animations are CSS based, and is applied _after_ any transforms ha ``` +The animation effects require BootstrapVue's custom CSS. + **Note:** The animation effect of this component is dependent on the `prefers-reduced-motion` media query. See the [reduced motion section of our accessibility documentation](/docs/reference/accessibility) for From 35c38d4c893e182accf40111b1acfc35d5a4e8ed Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Thu, 12 Mar 2020 02:49:24 -0300 Subject: [PATCH 08/49] Update _icons.scss --- src/icons/_icons.scss | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/icons/_icons.scss b/src/icons/_icons.scss index 1a4554a972e..0ff4a8a79d2 100644 --- a/src/icons/_icons.scss +++ b/src/icons/_icons.scss @@ -23,6 +23,13 @@ animation: none; } } + + &.b-icon-cylon { + animation: b-icon-cylon 2s infinite ease-in-out; + @media (prefers-reduced-motion: reduce) { + animation: none; + } + } } // Animation for spinning icons @@ -35,6 +42,24 @@ } } +@keyframes b-icon-cylon { + 0% { + transform: translateX(0); + } + 25% { + transform: translateX(-50%}; + } + 50% { + transform: translateX(0); + } + 75% { + transform: translateX(50%}; + } + 100% { + transform: translateX(0); + } +} + // Make icons slightly larger in buttons, nav-links, dropdowns, and input-group-text .btn, .nav-link, From c44024b1098b67904dbe933ace92a0553e40abaa Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Thu, 12 Mar 2020 02:50:19 -0300 Subject: [PATCH 09/49] Update _icons.scss --- src/icons/_icons.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/icons/_icons.scss b/src/icons/_icons.scss index 0ff4a8a79d2..1c52b6da186 100644 --- a/src/icons/_icons.scss +++ b/src/icons/_icons.scss @@ -47,13 +47,13 @@ transform: translateX(0); } 25% { - transform: translateX(-50%}; + transform: translateX(-50%); } 50% { transform: translateX(0); } 75% { - transform: translateX(50%}; + transform: translateX(50%); } 100% { transform: translateX(0); From 5609994d34d0085c448dbb496e16a022a43f502c Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Thu, 12 Mar 2020 03:03:21 -0300 Subject: [PATCH 10/49] Update _icons.scss --- src/icons/_icons.scss | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/icons/_icons.scss b/src/icons/_icons.scss index 1c52b6da186..dd7c9cfe339 100644 --- a/src/icons/_icons.scss +++ b/src/icons/_icons.scss @@ -25,7 +25,7 @@ } &.b-icon-cylon { - animation: b-icon-cylon 2s infinite ease-in-out; + animation: b-icon-cylon 2s infinite linear; @media (prefers-reduced-motion: reduce) { animation: none; } @@ -47,13 +47,15 @@ transform: translateX(0); } 25% { - transform: translateX(-50%); + transform: translateX(-25%); + animation-timing-function: ease-in-out; } 50% { transform: translateX(0); } 75% { - transform: translateX(50%); + transform: translateX(25%); + animation-timing-function: ease-in-out; } 100% { transform: translateX(0); From 8f919370be7bfeda175ed5d5d94e42d06a6b5085 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Thu, 12 Mar 2020 03:06:59 -0300 Subject: [PATCH 11/49] Update icon-base.js --- src/icons/helpers/icon-base.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/icons/helpers/icon-base.js b/src/icons/helpers/icon-base.js index 49aa63889d4..aabb3382865 100644 --- a/src/icons/helpers/icon-base.js +++ b/src/icons/helpers/icon-base.js @@ -45,6 +45,10 @@ export const commonIconProps = { pulse: { type: Boolean, default: false + }, + cylon: { + type: Boolean, + default: false } } @@ -81,6 +85,9 @@ export const BVIconBase = /*#__PURE__*/ Vue.extend({ const shiftV = toFloat(props.shiftV) || 0 const flipH = props.flipH const flipV = props.flipV + const spin = props.spin + const pulse = props.pulse + const cylon = props.cylon // Compute the transforms // Note that order is important as SVG transforms are applied in order from // left to right and we want flipping/scale to occur before rotation @@ -126,8 +133,9 @@ export const BVIconBase = /*#__PURE__*/ Vue.extend({ staticClass: 'b-icon bi', class: { [`text-${props.variant}`]: !!props.variant, - 'b-icon-spin': !isStacked && props.spin && !props.pulse, - 'b-icon-pulse': !isStacked && props.pulse + 'b-icon-spin': !isStacked && spin && !pulse && !cylon, + 'b-icon-pulse': !isStacked && pulse && !cylon, + 'b-icon-cylon': !isStacked && cylon }, attrs: baseAttrs, style: isStacked ? {} : { fontSize: fontScale === 1 ? null : `${fontScale * 100}%` } From 1bc6521fdd05ebd87fcbc9d35bebdbbffd5c159a Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Thu, 12 Mar 2020 03:08:44 -0300 Subject: [PATCH 12/49] Update package.json --- src/icons/package.json | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/icons/package.json b/src/icons/package.json index 100611f8262..5b1ec81ccfc 100644 --- a/src/icons/package.json +++ b/src/icons/package.json @@ -63,6 +63,11 @@ "prop": "pulse", "version": "2.7.0", "description": "When set, applies a pulsing spin animation to the icon. Takes precedence over the `spin` prop" + }, + { + "prop": "cylon", + "version": "2.7.0", + "description": "When set, applies a cylon animation to the icon. Takes precedence over the `pulse` prop" } ] }, @@ -111,6 +116,11 @@ "prop": "pulse", "version": "2.7.0", "description": "When set, applies a pulsing spin animation to the icon. Takes precedence over the `spin` prop" + }, + { + "prop": "cylon", + "version": "2.7.0", + "description": "When set, applies a cylon animation to the icon. Takes precedence over the `pulse` prop" } ] }, @@ -164,6 +174,11 @@ "prop": "pulse", "version": "2.7.0", "description": "When set, applies a pulsing spin animation to the icon. Takes precedence over the `spin` prop" + }, + { + "prop": "cylon", + "version": "2.7.0", + "description": "When set, applies a cylon animation to the icon. Takes precedence over the `pulse` prop" } ] }, From 437e43159df1a516bc6068999cbce9a806c63eb9 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Thu, 12 Mar 2020 03:17:02 -0300 Subject: [PATCH 13/49] Update README.md --- src/icons/README.md | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/icons/README.md b/src/icons/README.md index b02d7fed0b1..da527fd5c0b 100644 --- a/src/icons/README.md +++ b/src/icons/README.md @@ -433,10 +433,12 @@ affected. If you need to shift the border/background with the icon, use Bootstra v2.7.0+ BootstrapVue includes two spinning animation options for icons: `spin` and `pulse`. Both animations -spin the icon clockwise, but pulse uses a stepped spin. +spin the icon clockwise, but pulse uses a stepped spin. A third animation called `cylon` is also +provided. -To use the spin animation, set the `spin` prop to true. To use hte pulse animation, set the `pulse` -prop to `true`. Note that `pulse` takes precedence over `spin`. +To use the spin animation, set the `spin` prop to true. To use the pulse animation, set the `pulse` +prop to `true`, and to use the cylon animation set the `cylon` prop to true. Note that `pulse` +takes precedence over `spin`, and `cylon` takes precedence over `pulse`. ```html ``` -Note that the animations are CSS based, and is applied _after_ any transforms have taken place: +Note with the `cylon` anmination, the left-right movement extends past the icon's bounding box, +so you may need to adjust padding or margins to compensate for your use case. + +As the animations are CSS based, they are applied _after_ any transforms have taken place: ```html @@ -471,6 +479,9 @@ query. See the [reduced motion section of our accessibility documentation](/docs/reference/accessibility) for additional details. +Side note: the `cylon` animation gets its name from the Cylons of the _original_ Battlestar +Galactica TV series of the late 1970's. + ## Stacking icons v2.3.0+ From 0e06f2bdafee016c2b73033d9864d20e38f700b1 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Thu, 12 Mar 2020 03:26:46 -0300 Subject: [PATCH 14/49] Update _icons.scss --- src/icons/_icons.scss | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/icons/_icons.scss b/src/icons/_icons.scss index dd7c9cfe339..f170155e71c 100644 --- a/src/icons/_icons.scss +++ b/src/icons/_icons.scss @@ -45,6 +45,7 @@ @keyframes b-icon-cylon { 0% { transform: translateX(0); + animation-timing-function: ease-out; } 25% { transform: translateX(-25%); @@ -52,6 +53,7 @@ } 50% { transform: translateX(0); + animation-timing-function: ease-in-out; } 75% { transform: translateX(25%); @@ -59,6 +61,7 @@ } 100% { transform: translateX(0); + animation-timing-function: ease-in; } } From db11f5b89078bb430ebd2aec561683e10a31917a Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Thu, 12 Mar 2020 03:31:01 -0300 Subject: [PATCH 15/49] Update _icons.scss --- src/icons/_icons.scss | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/icons/_icons.scss b/src/icons/_icons.scss index f170155e71c..35e2d328be1 100644 --- a/src/icons/_icons.scss +++ b/src/icons/_icons.scss @@ -25,7 +25,7 @@ } &.b-icon-cylon { - animation: b-icon-cylon 2s infinite linear; + animation: b-icon-cylon 1.25s infinite linear; @media (prefers-reduced-motion: reduce) { animation: none; } @@ -45,23 +45,18 @@ @keyframes b-icon-cylon { 0% { transform: translateX(0); - animation-timing-function: ease-out; } 25% { transform: translateX(-25%); - animation-timing-function: ease-in-out; } 50% { transform: translateX(0); - animation-timing-function: ease-in-out; } 75% { transform: translateX(25%); - animation-timing-function: ease-in-out; } 100% { transform: translateX(0); - animation-timing-function: ease-in; } } From ce739f951f3533bafa09c4b2000d444da3f7b55a Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Thu, 12 Mar 2020 03:37:25 -0300 Subject: [PATCH 16/49] Update _icons.scss --- src/icons/_icons.scss | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/icons/_icons.scss b/src/icons/_icons.scss index 35e2d328be1..7947d1816b1 100644 --- a/src/icons/_icons.scss +++ b/src/icons/_icons.scss @@ -49,9 +49,6 @@ 25% { transform: translateX(-25%); } - 50% { - transform: translateX(0); - } 75% { transform: translateX(25%); } From 376ecd84bb452726d12fe75c433b96361b1beaa0 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Thu, 12 Mar 2020 03:42:46 -0300 Subject: [PATCH 17/49] Update _icons.scss --- src/icons/_icons.scss | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/icons/_icons.scss b/src/icons/_icons.scss index 7947d1816b1..173a03933bc 100644 --- a/src/icons/_icons.scss +++ b/src/icons/_icons.scss @@ -11,21 +11,21 @@ } &.b-icon-spin { - animation: b-icon-spin 2s infinite linear; + animation: 2s infinite linear b-icon-spin; @media (prefers-reduced-motion: reduce) { animation: none; } } &.b-icon-pulse { - animation: b-icon-spin 1s infinite steps(8); + animation: 1s infinite steps(8) b-icon-spin; @media (prefers-reduced-motion: reduce) { animation: none; } } &.b-icon-cylon { - animation: b-icon-cylon 1.25s infinite linear; + animation: 1s infinite ease-in-out alternate b-icon-cylon; @media (prefers-reduced-motion: reduce) { animation: none; } @@ -44,16 +44,10 @@ @keyframes b-icon-cylon { 0% { - transform: translateX(0); - } - 25% { transform: translateX(-25%); } - 75% { - transform: translateX(25%); - } 100% { - transform: translateX(0); + transform: translateX(25%); } } From 5e54668a3d9e12130f2e0d535405dc0b0bb936e5 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Thu, 12 Mar 2020 03:44:54 -0300 Subject: [PATCH 18/49] Update README.md --- src/icons/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/icons/README.md b/src/icons/README.md index da527fd5c0b..cc9e036f5b4 100644 --- a/src/icons/README.md +++ b/src/icons/README.md @@ -450,7 +450,7 @@ takes precedence over `spin`, and `cylon` takes precedence over `pulse`.

Cylon animation

- + From 4c6f30aebecd8b2d2b2fa94f8beba2d29cdbfa85 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Thu, 12 Mar 2020 03:47:42 -0300 Subject: [PATCH 19/49] Update README.md --- src/icons/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/icons/README.md b/src/icons/README.md index cc9e036f5b4..7eb45de43a4 100644 --- a/src/icons/README.md +++ b/src/icons/README.md @@ -460,7 +460,7 @@ takes precedence over `spin`, and `cylon` takes precedence over `pulse`. Note with the `cylon` anmination, the left-right movement extends past the icon's bounding box, so you may need to adjust padding or margins to compensate for your use case. -As the animations are CSS based, they are applied _after_ any transforms have taken place: +As the animations are CSS based, they are applied _after_ any SVG transforms have taken place: ```html @@ -457,8 +457,8 @@ takes precedence over `spin`, and `cylon` takes precedence over `pulse`. ``` -Note with the `cylon` anmination, the left-right movement extends past the icon's bounding box, -so you may need to adjust padding or margins to compensate for your use case. +Note with the `cylon` anmination, the left-right movement extends past the icon's bounding box +by 25%, so you may need to adjust padding or margins to compensate for your use case. As the animations are CSS based, they are applied _after_ any SVG transforms have taken place: From 8e45ba12ce689b57cddb63314671e390a8b4706a Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Thu, 12 Mar 2020 04:55:44 -0300 Subject: [PATCH 24/49] Update icons.spec.js --- src/icons/icons.spec.js | 55 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/src/icons/icons.spec.js b/src/icons/icons.spec.js index 3861272b540..daff35e06a4 100644 --- a/src/icons/icons.spec.js +++ b/src/icons/icons.spec.js @@ -430,4 +430,59 @@ describe('icons', () => { ) expect(wrapper.find('svg > g > g > path').exists()).toBe(true) }) + + it('b-icon animation props work', async () => { + const wrapper = mount(BIcon, { + localVue: localVue, + parentComponent: parentComponent, + propsData: { + icon: 'circle-fill', + spin: false, + pulse: false, + cylon: false + } + }) + + expect(wrapper.exists()).toBe(true) + expect(wrapper.is('svg')).toBe(true) + expect(wrapper.classes()).toContain('b-icon') + expect(wrapper.classes()).toContain('bi') + expect(wrapper.classes()).toContain('bi-circle-fill') + expect(wrapper.classes()).not.toContain('b-icon-spin') + expect(wrapper.classes()).not.toContain('b-icon-pulse') + expect(wrapper.classes()).not.toContain('b-icon-cylon') + + wrapper.setProps({ + spin: true + }) + + expect(wrapper.classes()).toContain('b-icon') + expect(wrapper.classes()).toContain('bi') + expect(wrapper.classes()).toContain('bi-circle-fill') + expect(wrapper.classes()).toContain('b-icon-spin') + expect(wrapper.classes()).not.toContain('b-icon-pulse') + expect(wrapper.classes()).not.toContain('b-icon-cylon') + + wrapper.setProps({ + pulse: true + }) + + expect(wrapper.classes()).toContain('b-icon') + expect(wrapper.classes()).toContain('bi') + expect(wrapper.classes()).toContain('bi-circle-fill') + expect(wrapper.classes()).not.toContain('b-icon-spin') + expect(wrapper.classes()).toContain('b-icon-pulse') + expect(wrapper.classes()).not.toContain('b-icon-cylon') + + wrapper.setProps({ + cylon: true + }) + + expect(wrapper.classes()).toContain('b-icon') + expect(wrapper.classes()).toContain('bi') + expect(wrapper.classes()).toContain('bi-circle-fill') + expect(wrapper.classes()).not.toContain('b-icon-spin') + expect(wrapper.classes()).not.toContain('b-icon-pulse') + expect(wrapper.classes()).toContain('b-icon-cylon') + }) }) From a967cad8737ce78054825b3e87c663b205666893 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Thu, 12 Mar 2020 05:04:22 -0300 Subject: [PATCH 25/49] Update icons.spec.js --- src/icons/icons.spec.js | 45 +++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/src/icons/icons.spec.js b/src/icons/icons.spec.js index daff35e06a4..27c76bf54d1 100644 --- a/src/icons/icons.spec.js +++ b/src/icons/icons.spec.js @@ -431,13 +431,13 @@ describe('icons', () => { expect(wrapper.find('svg > g > g > path').exists()).toBe(true) }) - it('b-icon animation props work', async () => { + it('b-icon spin animation props work', async () => { const wrapper = mount(BIcon, { localVue: localVue, parentComponent: parentComponent, propsData: { icon: 'circle-fill', - spin: false, + spin: true, pulse: false, cylon: false } @@ -445,39 +445,50 @@ describe('icons', () => { expect(wrapper.exists()).toBe(true) expect(wrapper.is('svg')).toBe(true) - expect(wrapper.classes()).toContain('b-icon') - expect(wrapper.classes()).toContain('bi') - expect(wrapper.classes()).toContain('bi-circle-fill') - expect(wrapper.classes()).not.toContain('b-icon-spin') - expect(wrapper.classes()).not.toContain('b-icon-pulse') - expect(wrapper.classes()).not.toContain('b-icon-cylon') - - wrapper.setProps({ - spin: true - }) - expect(wrapper.classes()).toContain('b-icon') expect(wrapper.classes()).toContain('bi') expect(wrapper.classes()).toContain('bi-circle-fill') expect(wrapper.classes()).toContain('b-icon-spin') expect(wrapper.classes()).not.toContain('b-icon-pulse') expect(wrapper.classes()).not.toContain('b-icon-cylon') + }) - wrapper.setProps({ - pulse: true + it('b-icon pulse animation props work', async () => { + const wrapper = mount(BIcon, { + localVue: localVue, + parentComponent: parentComponent, + propsData: { + icon: 'circle-fill', + spin: true, + pulse: true, + cylon: false + } }) + expect(wrapper.exists()).toBe(true) + expect(wrapper.is('svg')).toBe(true) expect(wrapper.classes()).toContain('b-icon') expect(wrapper.classes()).toContain('bi') expect(wrapper.classes()).toContain('bi-circle-fill') expect(wrapper.classes()).not.toContain('b-icon-spin') expect(wrapper.classes()).toContain('b-icon-pulse') expect(wrapper.classes()).not.toContain('b-icon-cylon') + }) - wrapper.setProps({ - cylon: true + it('b-icon cylon animation props work', async () => { + const wrapper = mount(BIcon, { + localVue: localVue, + parentComponent: parentComponent, + propsData: { + icon: 'circle-fill', + spin: true, + pulse: true, + cylon: true + } }) + expect(wrapper.exists()).toBe(true) + expect(wrapper.is('svg')).toBe(true) expect(wrapper.classes()).toContain('b-icon') expect(wrapper.classes()).toContain('bi') expect(wrapper.classes()).toContain('bi-circle-fill') From b5ed8bc2b6d71170ad40a50fedbf03aa0ee635e7 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Thu, 12 Mar 2020 05:05:59 -0300 Subject: [PATCH 26/49] Update README.md --- src/components/spinner/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/spinner/README.md b/src/components/spinner/README.md index 3f93b76a4c1..45dc46fae37 100644 --- a/src/components/spinner/README.md +++ b/src/components/spinner/README.md @@ -222,4 +222,8 @@ label is provided. You can easily customize the role if required via prop `role` As well, when no label is provided, the spinner will automatically have the attribute `aria-hidden="true"` to hide the spinner from screen reader users. +## See also + +An alternative to the `` component is [animated icons](/docs/icons/#animated-icons). + From 9f07d5bd74261cd145288056de7c32f6daa24626 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20M=C3=BCller?= Date: Thu, 12 Mar 2020 09:08:35 +0100 Subject: [PATCH 27/49] Update README.md --- src/icons/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/icons/README.md b/src/icons/README.md index 3bc04253834..b00125b6b92 100644 --- a/src/icons/README.md +++ b/src/icons/README.md @@ -434,11 +434,11 @@ affected. If you need to shift the border/background with the icon, use Bootstra BootstrapVue includes two spinning animation options for icons: `spin` and `pulse`. Both animations spin the icon clockwise, but pulse uses a stepped spin. A third animation called `cylon` is also -provided. +provided. To use the spin animation, set the `spin` prop to true. To use the pulse animation, set the `pulse` -prop to `true`, and to use the cylon animation set the `cylon` prop to true. Note that `pulse` -takes precedence over `spin`, and `cylon` takes precedence over `pulse`. +prop to `true`, and to use the cylon animation set the `cylon` prop to true. Note that `pulse` takes +precedence over `spin`, and `cylon` takes precedence over `pulse`. ```html