Update Composer, update everything

This commit is contained in:
Oliver Davies 2018-11-23 12:29:20 +00:00
parent ea3e94409f
commit dda5c284b6
19527 changed files with 1135420 additions and 351004 deletions

View file

@ -1,12 +1,17 @@
/**
* @file
* Javascript behaviors for Telephone element.
* JavaScript behaviors for Telephone element.
*/
(function ($, Drupal, drupalSettings) {
'use strict';
// @see https://github.com/jackocnr/intl-tel-input#options
Drupal.webform = Drupal.webform || {};
Drupal.webform.intlTelInput = Drupal.webform.intlTelInput || {};
Drupal.webform.intlTelInput.options = Drupal.webform.intlTelInput.options || {};
/**
* Initialize Telephone international element.
* @see http://intl-tel-input.com/node_modules/intl-tel-input/examples/gen/is-valid-number.html
@ -14,25 +19,31 @@
*/
Drupal.behaviors.webformTelephoneInternational = {
attach: function (context) {
if (!$.fn.intlTelInput) {
return;
}
$(context).find('input.js-webform-telephone-international').once('webform-telephone-international').each(function () {
var $telephone = $(this);
// Add error message container.
var $error = $('<div class="form-item--error-message">' + Drupal.t('Invalid phone number') + '</div>').hide();
$telephone.closest('.form-item').append($error);
$telephone.closest('.js-form-item').append($error);
// @todo: Figure out how to lazy load utilsScript (build/js/utils.js).
// @see https://github.com/jackocnr/intl-tel-input#utilities-script
$telephone.intlTelInput({
'nationalMode': false
});
var options = $.extend({
nationalMode: false,
initialCountry: $telephone.attr('data-webform-telephone-international-initial-country') || ''
}, Drupal.webform.intlTelInput.options);
$telephone.intlTelInput(options);
var reset = function() {
var reset = function () {
$telephone.removeClass('error');
$error.hide();
};
$telephone.blur(function() {
$telephone.blur(function () {
reset();
if ($.trim($telephone.val())) {
if (!$telephone.intlTelInput('isValidNumber')) {
@ -43,7 +54,7 @@
});
$telephone.on('keyup change', reset);
})
});
}
};