@epages/beyond_canvas
Advanced tools
Comparing version 0.14.0-pre to 0.23.0-pre
/* | ||
* Warning: This file is auto-generated, do not modify. Instead, make your changes in 'app/javascript/beyond_canvas/' and run `yarn build` | ||
*/ | ||
//= require jquery | ||
//= require jquery_ujs | ||
//= require jquery3 | ||
//= require rails-ujs | ||
//= require_self | ||
@@ -13,50 +13,91 @@ | ||
var SPINNER_ANIMATION_TIMEOUT = 125; | ||
var BUTTON_SELECTORS = '[class^="button"]'; | ||
(function($) { | ||
$(document).on("click", '[class^="button"]', function() { | ||
disableActionElements(); | ||
showSpinner($(this)); | ||
var onDOMReady = function onDOMReady() { | ||
var inputs = $("input, textarea, select").not(":input[type=button], :input[type=submit], :input[type=reset]"); | ||
inputs.each(function() { | ||
var input = $(this); | ||
input.bind("invalid", function(e) { | ||
if ($(input).is(":hidden")) { | ||
e.preventDefault(); | ||
} | ||
$.restoreActionElements(); | ||
}); | ||
}); | ||
$(BUTTON_SELECTORS).each(function() { | ||
$(this).buildButton(); | ||
}); | ||
}; | ||
$(document).on("confirm:complete", function() { | ||
$.restoreActionElements(); | ||
}); | ||
$(document).on("ready page:load turbolinks:load", function() { | ||
$('button[class^="button"]').each(function() { | ||
var button = $(this); | ||
button.width(button.width()); | ||
button.data("oldWidth", button.width()); | ||
button.prepend('\n <div class="spinner">\n <div class="bounce1"></div>\n <div class="bounce2"></div>\n <div class="bounce3"></div>\n </div>'); | ||
$(document).on("click", BUTTON_SELECTORS, function(e) { | ||
var _e$target$attributes$; | ||
var button = $(this); | ||
if (((_e$target$attributes$ = e.target.attributes.getNamedItem("target")) == null ? void 0 : _e$target$attributes$.value) === "_blank") return; | ||
$.disableActionElements(); | ||
if (!button.hasClass("button--no-spinner")) { | ||
$(this).showSpinner(); | ||
} | ||
}); | ||
$(document).on("ready page:load turbolinks:load", onDOMReady); | ||
$(document).on("beforeunload turbolinks:before-visit", function() { | ||
$.restoreActionElements(); | ||
}); | ||
})(jQuery); | ||
$.extend({ | ||
restoreActionElements: function restoreActionElements() { | ||
setTimeout(function() { | ||
$(BUTTON_SELECTORS).each(function(_, button) { | ||
setTimeout(function() { | ||
$(button).find(".spinner").hide(); | ||
$(button).width($(button).data("oldWidth")); | ||
}, SPINNER_ANIMATION_TIMEOUT); | ||
}); | ||
$('a, input[type="submit"], input[type="button"], input[type="reset"], button').each(function() { | ||
$(this).removeClass("actions--disabled"); | ||
}); | ||
}, 100); | ||
}, | ||
disableActionElements: function disableActionElements() { | ||
$('a, input[type="submit"], input[type="button"], input[type="reset"], button').each(function() { | ||
$(this).addClass("actions--disabled"); | ||
}); | ||
} | ||
}); | ||
$.fn.extend({ | ||
buildButton: function buildButton() { | ||
var button = $(this); | ||
if (button.is("[class^=button]")) { | ||
if (!button.hasClass("button--no-spinner")) { | ||
button.width(button.width()); | ||
button.data("oldWidth", button.width()); | ||
if (button.find(".spinner").length == 0) { | ||
button.prepend('\n <div class="spinner">\n <div class="bounce1"></div>\n <div class="bounce2"></div>\n <div class="bounce3"></div>\n </div>'); | ||
} | ||
} | ||
button.closest("form").on("ajax:success", function() { | ||
hideSpinner(button); | ||
enableActionElements(); | ||
$.restoreActionElements(); | ||
}).on("ajax:error", function() { | ||
hideSpinner(button); | ||
enableActionElements(); | ||
$.restoreActionElements(); | ||
}); | ||
}); | ||
} | ||
}, | ||
showSpinner: function showSpinner() { | ||
var button = $(this); | ||
button.width(button.width() + $(".spinner").outerWidth(true)); | ||
setTimeout(function() { | ||
button.find(".spinner").css("display", "inline-flex"); | ||
}, SPINNER_ANIMATION_TIMEOUT); | ||
} | ||
}); | ||
(function($) { | ||
$(document).on("click", "[data-toggle='collapse']", function(e) { | ||
e.preventDefault(); | ||
$($(this).attr("data-target")).slideToggle(); | ||
$(this).find(".collapse__icon").toggleClass("collapse__icon--open"); | ||
}); | ||
})(jQuery); | ||
function showSpinner(button) { | ||
button.width(button.width() + $(".spinner").outerWidth(true)); | ||
setTimeout(function() { | ||
button.find(".spinner").css("display", "flex"); | ||
}, SPINNER_ANIMATION_TIMEOUT); | ||
} | ||
function hideSpinner(button) { | ||
setTimeout(function() { | ||
button.find(".spinner").hide(); | ||
button.width(button.data("oldWidth")); | ||
}, SPINNER_ANIMATION_TIMEOUT); | ||
} | ||
function disableActionElements() { | ||
$('a, input[type="submit"], input[type="button"], input[type="reset"], button').each(function() { | ||
$(this).addClass("actions--disabled"); | ||
}); | ||
} | ||
function enableActionElements() { | ||
$('a, input[type="submit"], input[type="button"], input[type="reset"], button').each(function() { | ||
$(this).removeClass("actions--disabled"); | ||
}); | ||
} | ||
(function($) { | ||
$(document).on("click", ".flash", function() { | ||
closeAlert(); | ||
}); | ||
$(document).on("ready page:load turbolinks:load", function() { | ||
var onDOMReady = function onDOMReady() { | ||
$(".flash").each(function() { | ||
@@ -68,11 +109,25 @@ $(this).css("right", -$(this).width() + "px"); | ||
}, 100); | ||
}; | ||
$(document).on("click", ".flash__close", function() { | ||
$.closeAlert(); | ||
}); | ||
$(document).on("ready page:load turbolinks:load bc.flash.shown", onDOMReady); | ||
})(jQuery); | ||
function closeAlert() { | ||
$(".flash").removeClass("flash--shown").delay(700).queue(function() { | ||
$(this).remove(); | ||
}); | ||
} | ||
$.extend({ | ||
showFlash: function showFlash(status, message) { | ||
var flash = '\n <div class="flash">\n <div class="flash__icon flash__icon--' + status + '">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm6 16.538l-4.592-4.548 4.546-4.587-1.416-1.403-4.545 4.589-4.588-4.543-1.405 1.405 4.593 4.552-4.547 4.592 1.405 1.405 4.555-4.596 4.591 4.55 1.403-1.416z"></path></svg>\n </div>\n <div class="flash__message">\n ' + message + '\n </div>\n <div class="flash__close">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M24 20.188l-8.315-8.209 8.2-8.282-3.697-3.697-8.212 8.318-8.31-8.203-3.666 3.666 8.321 8.24-8.206 8.313 3.666 3.666 8.237-8.318 8.285 8.203z"></path></svg>\n </div>\n </div>'; | ||
$(document).trigger("bc.flash.show"); | ||
$("#flash").html(flash); | ||
$(document).trigger("bc.flash.shown"); | ||
}, | ||
closeAlert: function closeAlert() { | ||
$(document).trigger("bc.flash.hide"); | ||
$(".flash").removeClass("flash--shown").delay(700).queue(function() { | ||
$(this).remove(); | ||
}); | ||
$(document).trigger("bc.flash.hidden"); | ||
} | ||
}); | ||
(function($) { | ||
$(document).on("ready page:load turbolinks:load", function() { | ||
var onDOMReady = function onDOMReady() { | ||
$('input[type="file"]').each(function() { | ||
@@ -82,4 +137,4 @@ var $input = $(this), $label = $(".input__file__text." + $input.attr("id")), labelVal = $label.html(); | ||
var fileName = ""; | ||
if (this.files && this.files.length > 1) fileName = (this.getAttribute("data-multiple-caption") || "").replace("{count}", this.files.length); else if (e.target.value) fileName = e.target.value.split("\\").pop(); | ||
if (fileName) $label.html('<i class="far fa-file input__file__icon"></i>' + fileName); else $label.html(labelVal); | ||
if (this.files && this.files.length > 1) fileName = (this.getAttribute("data-multiple-caption") || "{count} files selected").replace("{count}", this.files.length); else if (e.target.value) fileName = e.target.value.split("\\").pop(); | ||
if (fileName) $label.html('<svg class="input__file__icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M15 2v5h5v15h-16v-20h11zm1-2h-14v24h20v-18l-6-6z"/></svg>' + fileName); else $label.html(labelVal); | ||
}); | ||
@@ -92,4 +147,50 @@ $input.on("focus", function() { | ||
}); | ||
}; | ||
$(document).on("ready page:load turbolinks:load", function() { | ||
var observer = new MutationObserver(function() { | ||
return onDOMReady(); | ||
}); | ||
onDOMReady(); | ||
observer.observe(document.body, { | ||
childList: true, | ||
subtree: true | ||
}); | ||
}); | ||
})(jQuery); | ||
(function($) { | ||
var onDOMReady = function onDOMReady() { | ||
$(".modal").each(function() { | ||
$(this).hide().css("visibility", "visible"); | ||
}); | ||
}; | ||
$(document).on("click", '[data-toggle="modal"]', function(e) { | ||
e.preventDefault(); | ||
var dataTarget = $(this).attr("data-target"); | ||
$.restoreActionElements(); | ||
$(dataTarget).showModal(); | ||
}); | ||
$(document).on("click", '[data-dismiss="modal"]', function(e) { | ||
e.preventDefault(); | ||
var dataTarget = $(this).closest(".modal"); | ||
$.restoreActionElements(); | ||
$(dataTarget).hideModal(); | ||
}); | ||
$(document).on("ready page:load turbolinks:load", onDOMReady); | ||
})(jQuery); | ||
$.fn.extend({ | ||
showModal: function showModal() { | ||
var modal = $(this); | ||
modal.trigger("bc.modal.show"); | ||
$.restoreActionElements(); | ||
modal.css("display", "flex"); | ||
modal.trigger("bc.modal.shown"); | ||
}, | ||
hideModal: function hideModal() { | ||
var modal = $(this); | ||
modal.trigger("bc.modal.hide"); | ||
$.restoreActionElements(); | ||
modal.hide(); | ||
modal.trigger("bc.modal.hidden"); | ||
} | ||
}); | ||
}); |
{ | ||
"name": "@epages/beyond_canvas", | ||
"version": "0.14.0-pre", | ||
"version": "0.23.0-pre", | ||
"description": "Open-source framework that provides CSS and JS for apps designed and developed for the online shop software Beyond", | ||
@@ -34,5 +34,7 @@ "keywords": [ | ||
"build": "rollup --config rollup.config.js", | ||
"prepublishOnly": "rm -rf src && cp -R app/javascript/beyond_canvas src && cp -R app/assets/stylesheets/beyond_canvas src/sass" | ||
"prepublishOnly": "rm -rf src && cp -R app/javascript/beyond_canvas src && cp -R app/assets/stylesheets/beyond_canvas src/scss", | ||
"eslint": "eslint ./app/javascript/beyond_canvas" | ||
}, | ||
"dependencies": { | ||
"bourbon": "^7.0.0", | ||
"jquery": "^3.5.1" | ||
@@ -43,9 +45,14 @@ }, | ||
"@babel/preset-env": "^7.6.2", | ||
"common-tags": "^1.8.0", | ||
"rollup": "^1.21.4", | ||
"@rollup/plugin-babel": "^5.0.0", | ||
"@rollup/plugin-commonjs": "^11.1.0", | ||
"@rollup/plugin-node-resolve": "^7.1.3", | ||
"common-tags": "^1.8.0", | ||
"eslint": "^7.1.0", | ||
"eslint-config-standard": "^14.1.1", | ||
"eslint-plugin-import": "^2.20.2", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-standard": "^4.0.1", | ||
"rollup": "^1.21.4", | ||
"rollup-plugin-uglify": "^6.0.4" | ||
} | ||
} |
@@ -6,53 +6,5 @@ # Beyond Canvas | ||
## Installation | ||
1. Add this line to your application's Gemfile: | ||
```ruby | ||
gem "beyond_canvas" | ||
``` | ||
1. Then execute: | ||
```bash | ||
$ bundle install | ||
``` | ||
1. Restart your server and rename `application.css` to `application.scss` or `application.sass` (in case you prefer to use the `sass` syntax): | ||
```bash | ||
$ mv app/assets/stylesheets/application.css app/assets/stylesheets/application.scss | ||
``` | ||
1. Delete _all_ Sprockets directives in `application.scss` (`require`, `require_tree` and `require_self`) and use Sass’s native `@import` instead ([Here's why?](https://content.pivotal.io/blog/structure-your-sass-files-with-import)). | ||
1. Import Beyond Canvas at the beginning of `application.scss`. Any other styles must be imported after Beyond Canvas to avoid issues: | ||
```scss | ||
@import 'beyond_canvas' | ||
``` | ||
1. Add the following to `application.js`: | ||
```js | ||
//= require beyond_canvas | ||
``` | ||
1. Mount the engine in your routes file: | ||
```ruby | ||
mount BeyondCanvas::Engine => "/<your-mounting-path>" | ||
``` | ||
1. Run the generator: | ||
```bash | ||
$ rails g beyond_canvas:install | ||
``` | ||
This will generate `config/initializers/beyond_canvas.rb` file, used for general Beyond Canvas configuration. Read [this wiki entry](https://github.com/ePages-de/beyond_canvas/wiki/Initializer) to get more information about the different configuration options. | ||
## Documentation | ||
TBD | ||
Please see the [Beyond Canvas wiki](https://github.com/ePages-de/beyond_canvas/wiki) for additional information about the gem and its features. | ||
@@ -63,5 +15,5 @@ ## Contributing | ||
## Changelog | ||
## Change log | ||
Beyond Canvas's changelog is available [here](https://github.com/ePages-de/beyond_canvas/blob/master/CHANGELOG.md). | ||
Beyond Canvas's change log is available [here](https://github.com/ePages-de/beyond_canvas/blob/master/CHANGELOG.md). | ||
@@ -68,0 +20,0 @@ ## License |
@@ -1,5 +0,6 @@ | ||
import 'jquery' | ||
import './initializers/buttons' | ||
import './initializers/flash' | ||
import './initializers/inputs' | ||
import 'jquery'; | ||
import './initializers/buttons'; | ||
import './initializers/collapse'; | ||
import './initializers/flash'; | ||
import './initializers/inputs'; | ||
import './initializers/modals'; |
const SPINNER_ANIMATION_TIMEOUT = 125; | ||
const BUTTON_SELECTORS = '[class^="button"]'; | ||
(function($) { | ||
$(document).on('click', '[class^="button"]', function() { | ||
disableActionElements(); | ||
showSpinner($(this)); | ||
(function ($) { | ||
const onDOMReady = function () { | ||
const inputs = $('input, textarea, select').not( | ||
':input[type=button], :input[type=submit], :input[type=reset]' | ||
); | ||
inputs.each(function () { | ||
var input = $(this); | ||
input.bind('invalid', function (e) { | ||
if ($(input).is(':hidden')) { | ||
e.preventDefault(); | ||
} | ||
$.restoreActionElements(); | ||
}); | ||
}); | ||
$(BUTTON_SELECTORS).each(function () { | ||
$(this).buildButton(); | ||
}); | ||
}; | ||
$(document).on('confirm:complete', function () { | ||
$.restoreActionElements(); | ||
}); | ||
$(document).on('ready page:load turbolinks:load', function() { | ||
$('button[class^="button"]').each(function() { | ||
var button = $(this); | ||
$(document).on('click', BUTTON_SELECTORS, function (e) { | ||
var button = $(this); | ||
// Add width attribute and save old width | ||
button.width(button.width()); | ||
button.data('oldWidth', button.width()); | ||
if(e.target.attributes.getNamedItem('target')?.value === '_blank') return; | ||
// Add the spinner | ||
button.prepend(` | ||
<div class="spinner"> | ||
<div class="bounce1"></div> | ||
<div class="bounce2"></div> | ||
<div class="bounce3"></div> | ||
</div>`); | ||
$.disableActionElements(); | ||
if (!button.hasClass('button--no-spinner')) { | ||
$(this).showSpinner(); | ||
} | ||
}); | ||
$(document).on('ready page:load turbolinks:load', onDOMReady); | ||
$(document).on('beforeunload turbolinks:before-visit', function () { | ||
$.restoreActionElements(); | ||
}); | ||
})(jQuery); | ||
$.extend({ | ||
restoreActionElements: function () { | ||
setTimeout(function () { | ||
// Hide spinners | ||
$(BUTTON_SELECTORS).each(function (_, button) { | ||
setTimeout(function () { | ||
// Hide the spinner | ||
$(button).find('.spinner').hide(); | ||
// Adjust the width of the button | ||
$(button).width($(button).data('oldWidth')); | ||
}, SPINNER_ANIMATION_TIMEOUT); | ||
}); | ||
// Enable action elements | ||
$('a, input[type="submit"], input[type="button"], input[type="reset"], button').each(function () { | ||
$(this).removeClass('actions--disabled'); | ||
}); | ||
}, 100); | ||
}, | ||
disableActionElements: function () { | ||
$('a, input[type="submit"], input[type="button"], input[type="reset"], button').each(function () { | ||
$(this).addClass('actions--disabled'); | ||
}); | ||
} | ||
}); | ||
$.fn.extend({ | ||
buildButton: function() { | ||
var button = $(this); | ||
if (button.is('[class^=button]')) { | ||
if (!button.hasClass('button--no-spinner')) { | ||
// Add width attribute and save old width | ||
button.width(button.width()); | ||
button.data('oldWidth', button.width()); | ||
// Add the spinner | ||
if (button.find('.spinner').length == 0) { | ||
button.prepend(` | ||
<div class="spinner"> | ||
<div class="bounce1"></div> | ||
<div class="bounce2"></div> | ||
<div class="bounce3"></div> | ||
</div>`); | ||
} | ||
} | ||
// Bind ajax:success and ajax:error to the form the button belongs to | ||
button | ||
.closest('form') | ||
.on('ajax:success', function() { | ||
hideSpinner(button); | ||
enableActionElements(); | ||
.on('ajax:success', function () { | ||
$.restoreActionElements(); | ||
}) | ||
.on('ajax:error', function() { | ||
hideSpinner(button); | ||
enableActionElements(); | ||
.on('ajax:error', function () { | ||
$.restoreActionElements(); | ||
}); | ||
}); | ||
}); | ||
})(jQuery); | ||
} | ||
}, | ||
showSpinner: function () { | ||
var button = $(this); | ||
function showSpinner(button) { | ||
// Adjust the width of the button | ||
button.width(button.width() + $('.spinner').outerWidth(true)); | ||
// Show the spinner | ||
setTimeout(function() { | ||
button.find('.spinner').css('display', 'flex'); | ||
}, SPINNER_ANIMATION_TIMEOUT); | ||
} | ||
function hideSpinner(button) { | ||
setTimeout(function () { | ||
// Hide the spinner | ||
button.find('.spinner').hide(); | ||
// Adjust the width of the button | ||
button.width(button.data('oldWidth')); | ||
}, SPINNER_ANIMATION_TIMEOUT); | ||
} | ||
button.width( | ||
button.width() + $('.spinner').outerWidth(true) | ||
); | ||
function disableActionElements() { | ||
$('a, input[type="submit"], input[type="button"], input[type="reset"], button').each(function() { | ||
$(this).addClass('actions--disabled'); | ||
}); | ||
} | ||
function enableActionElements() { | ||
$('a, input[type="submit"], input[type="button"], input[type="reset"], button').each(function() { | ||
$(this).removeClass("actions--disabled"); | ||
}); | ||
} | ||
// Show the spinner | ||
setTimeout(function () { | ||
button.find('.spinner').css('display', 'inline-flex'); | ||
}, SPINNER_ANIMATION_TIMEOUT); | ||
} | ||
}); |
@@ -1,24 +0,48 @@ | ||
(function($) { | ||
$(document).on('click', '.flash', function() { | ||
closeAlert(); | ||
}); | ||
$(document).on('ready page:load turbolinks:load', function() { | ||
$('.flash').each(function() { | ||
(function ($) { | ||
const onDOMReady = function () { | ||
$('.flash').each(function () { | ||
$(this).css('right', -$(this).width() + 'px'); | ||
}); | ||
setTimeout(function() { | ||
setTimeout(function () { | ||
$('.flash').addClass('flash--shown'); | ||
}, 100); | ||
}; | ||
$(document).on('click', '.flash__close', function () { | ||
$.closeAlert(); | ||
}); | ||
$(document).on('ready page:load turbolinks:load bc.flash.shown', onDOMReady); | ||
})(jQuery); | ||
function closeAlert() { | ||
$('.flash') | ||
.removeClass('flash--shown') | ||
.delay(700) | ||
.queue(function() { | ||
$(this).remove(); | ||
}); | ||
} | ||
$.extend({ | ||
showFlash: function(status, message) { | ||
const flash = ` | ||
<div class="flash"> | ||
<div class="flash__icon flash__icon--${status}"> | ||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm6 16.538l-4.592-4.548 4.546-4.587-1.416-1.403-4.545 4.589-4.588-4.543-1.405 1.405 4.593 4.552-4.547 4.592 1.405 1.405 4.555-4.596 4.591 4.55 1.403-1.416z"></path></svg> | ||
</div> | ||
<div class="flash__message"> | ||
${message} | ||
</div> | ||
<div class="flash__close"> | ||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M24 20.188l-8.315-8.209 8.2-8.282-3.697-3.697-8.212 8.318-8.31-8.203-3.666 3.666 8.321 8.24-8.206 8.313 3.666 3.666 8.237-8.318 8.285 8.203z"></path></svg> | ||
</div> | ||
</div>`; | ||
$(document).trigger('bc.flash.show'); | ||
$('#flash').html(flash); | ||
$(document).trigger('bc.flash.shown'); | ||
}, | ||
closeAlert: function() { | ||
$(document).trigger('bc.flash.hide'); | ||
$('.flash') | ||
.removeClass('flash--shown') | ||
.delay(700) | ||
.queue(function () { | ||
$(this).remove(); | ||
}); | ||
$(document).trigger('bc.flash.hidden'); | ||
} | ||
}); |
@@ -1,20 +0,23 @@ | ||
(function($) { | ||
$(document).on('ready page:load turbolinks:load', function() { | ||
$('input[type="file"]').each(function() { | ||
var $input = $(this), | ||
$label = $(`.input__file__text.${$input.attr('id')}`), | ||
labelVal = $label.html(); | ||
(function ($) { | ||
const onDOMReady = function () { | ||
$('input[type="file"]').each(function () { | ||
const $input = $(this), | ||
$label = $(`.input__file__text.${$input.attr('id')}`), | ||
labelVal = $label.html(); | ||
$input.on('change', function(e) { | ||
var fileName = ''; | ||
$input.on('change', function (e) { | ||
let fileName = ''; | ||
if (this.files && this.files.length > 1) | ||
fileName = (this.getAttribute('data-multiple-caption') || '').replace('{count}', this.files.length); | ||
else if (e.target.value) | ||
fileName = e.target.value.split('\\').pop(); | ||
fileName = (this.getAttribute('data-multiple-caption') || '{count} files selected').replace( | ||
'{count}', | ||
this.files.length | ||
); | ||
else if (e.target.value) fileName = e.target.value.split('\\').pop(); | ||
if (fileName) | ||
$label.html(`<i class="far fa-file input__file__icon"></i>${fileName}`); | ||
else | ||
$label.html(labelVal); | ||
$label.html( | ||
`<svg class="input__file__icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M15 2v5h5v15h-16v-20h11zm1-2h-14v24h20v-18l-6-6z"/></svg>${fileName}` | ||
); | ||
else $label.html(labelVal); | ||
}); | ||
@@ -24,6 +27,17 @@ | ||
$input | ||
.on('focus', function() { $input.addClass('has-focus'); }) | ||
.on('blur', function() { $input.removeClass('has-focus'); }); | ||
.on('focus', function () { | ||
$input.addClass('has-focus'); | ||
}) | ||
.on('blur', function () { | ||
$input.removeClass('has-focus'); | ||
}); | ||
}); | ||
}; | ||
$(document).on('ready page:load turbolinks:load', () => { | ||
const observer = new MutationObserver(() => onDOMReady()); | ||
onDOMReady(); | ||
observer.observe(document.body, { childList: true, subtree: true }); | ||
}); | ||
})(jQuery); |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
78554
49
424
0
2
13
29
1
+ Addedbourbon@^7.0.0
+ Addedbourbon@7.3.0(transitive)