reconciled against bs4

This commit is contained in:
Kevin Ross 2015-12-03 11:35:51 -06:00
parent 5ec4486845
commit dbb000c2a9
28 changed files with 277 additions and 1605 deletions

View File

@ -10,6 +10,7 @@ indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false

1
.gitignore vendored
View File

@ -2,6 +2,7 @@
dist/**/*
docs/dist/**/*
docs/assets/css/*
js/dist/**/*
# Ignore docs files
_gh_pages

View File

@ -11,9 +11,9 @@ before_install:
- export GEMDIR=$(rvm gemdir)
- npm install -g npm@3
- "export TRAVIS_COMMIT_MSG=\"$(git log --format=%B --no-merges -n 1)\""
- echo "$TRAVIS_COMMIT_MSG" | grep '\[skip validator\]'; export BMD_DO_VALIDATOR=$?; true
- echo "$TRAVIS_COMMIT_MSG" | grep '\[skip sauce\]'; export BMD_DO_SAUCE=$?; true
# - if [ "$TRAVIS_REPO_SLUG" = twbs-savage/bootstrap ]; then export BMD_DO_VALIDATOR=0; fi
- echo "$TRAVIS_COMMIT_MSG" | grep '\[skip validator\]'; export MDB_DO_VALIDATOR=$?; true
- echo "$TRAVIS_COMMIT_MSG" | grep '\[skip sauce\]'; export MDB_DO_SAUCE=$?; true
# - if [ "$TRAVIS_REPO_SLUG" = twbs-savage/bootstrap ]; then export MDB_DO_VALIDATOR=0; fi
install:
- bundle install --deployment --jobs=3
@ -37,14 +37,14 @@ addons:
env:
matrix:
- BMD_TEST=core
- BMD_TEST=validate-html
- BMD_TEST=sauce-js-unit
- MDB_TEST=core
- MDB_TEST=validate-html
- MDB_TEST=sauce-js-unit
matrix:
fast_finish: true
exclude:
- node_js: "4"
env: BMD_TEST=validate-html
env: MDB_TEST=validate-html
- node_js: "4"
env: BMD_TEST=sauce-js-unit
env: MDB_TEST=sauce-js-unit

View File

@ -47,7 +47,7 @@ module.exports = function (grunt) {
});
var generateCommonJSModule = require('./grunt/bs-commonjs-generator.js');
var configBridge = grunt.file.readJSON('./grunt/configBridge.json', { encoding: 'utf8' });
var configBridge = grunt.file.readJSON('./grunt/configBridge.json', {encoding: 'utf8'});
Object.keys(configBridge.paths).forEach(function (key) {
configBridge.paths[key].forEach(function (val, i, arr) {
@ -100,15 +100,15 @@ module.exports = function (grunt) {
modules: 'ignore'
},
files: {
'js/dist/util.js' : 'js/src/util.js',
'js/dist/ripples.js' : 'js/src/ripples.js',
'js/dist/autofill.js' : 'js/src/autofill.js',
'js/dist/input.js' : 'js/src/input.js',
'js/dist/checkbox.js' : 'js/src/checkbox.js',
'js/dist/togglebutton.js' : 'js/src/togglebutton.js',
'js/dist/radio.js' : 'js/src/radio.js',
'js/dist/fileinput.js' : 'js/src/fileInput.js',
'js/dist/bootstrapMaterialDesign.js' : 'js/src/bootstrapMaterialDesign.js',
'js/dist/util.js': 'js/src/util.js',
'js/dist/ripples.js': 'js/src/ripples.js',
'js/dist/autofill.js': 'js/src/autofill.js',
'js/dist/input.js': 'js/src/input.js',
'js/dist/checkbox.js': 'js/src/checkbox.js',
'js/dist/togglebutton.js': 'js/src/togglebutton.js',
'js/dist/radio.js': 'js/src/radio.js',
'js/dist/fileinput.js': 'js/src/fileInput.js',
'js/dist/bootstrapMaterialDesign.js': 'js/src/bootstrapMaterialDesign.js',
//'js/dist/tab.js' : 'js/src/tab.js',
//'js/dist/tooltip.js' : 'js/src/tooltip.js',
//'js/dist/popover.js' : 'js/src/popover.js'
@ -119,7 +119,7 @@ module.exports = function (grunt) {
modules: 'ignore'
},
files: {
'<%= concat.bootstrap.dest %>' : '<%= concat.bootstrap.dest %>'
'<%= concat.bootstrap.dest %>': '<%= concat.bootstrap.dest %>'
}
},
umd: {
@ -127,15 +127,15 @@ module.exports = function (grunt) {
modules: 'umd'
},
files: {
'dist/js/umd/util.js' : 'js/src/util.js',
'dist/js/umd/ripples.js' : 'js/src/ripples.js',
'dist/js/umd/autofill.js' : 'js/src/autofill.js',
'dist/js/umd/input.js' : 'js/src/input.js',
'dist/js/umd/checkbox.js' : 'js/src/checkbox.js',
'dist/js/umd/togglebutton.js' : 'js/src/togglebutton.js',
'dist/js/umd/radio.js' : 'js/src/radio.js',
'dist/js/umd/fileinput.js' : 'js/src/fileInput.js',
'dist/js/umd/bootstrapMaterialDesign.js' : 'js/src/bootstrapMaterialDesign.js',
'dist/js/umd/util.js': 'js/src/util.js',
'dist/js/umd/ripples.js': 'js/src/ripples.js',
'dist/js/umd/autofill.js': 'js/src/autofill.js',
'dist/js/umd/input.js': 'js/src/input.js',
'dist/js/umd/checkbox.js': 'js/src/checkbox.js',
'dist/js/umd/togglebutton.js': 'js/src/togglebutton.js',
'dist/js/umd/radio.js': 'js/src/radio.js',
'dist/js/umd/fileinput.js': 'js/src/fileInput.js',
'dist/js/umd/bootstrapMaterialDesign.js': 'js/src/bootstrapMaterialDesign.js',
//'dist/js/umd/tab.js' : 'js/src/tab.js',
//'dist/js/umd/tooltip.js' : 'js/src/tooltip.js',
//'dist/js/umd/popover.js' : 'js/src/popover.js'
@ -246,7 +246,7 @@ module.exports = function (grunt) {
options: {
map: true,
processors: [
mq4HoverShim.postprocessorFor({ hoverSelectorPrefix: '.bs-true-hover ' }),
mq4HoverShim.postprocessorFor({hoverSelectorPrefix: '.bs-true-hover '}),
autoprefixer
]
},
@ -374,13 +374,15 @@ module.exports = function (grunt) {
files: '<%= jscs.core.src %>',
tasks: ['babel:dev']
},
sass: {
files: 'scss/**/*.scss',
tasks: ['dist-css', 'docs']
},
// FIXME: restore this after getting fundamentals done, just trying to reduce churn while developing
//sass: {
// files: 'scss/**/*.scss',
// tasks: ['dist-css', 'docs']
//},
docs: { // watch both the source and docs scss
files: ['docs/assets/scss/**/*.scss', 'scss/**/*.scss'],
tasks: ['docs-css'] //['dist-css', 'docs']
tasks: ['scsslint', 'sass:docs'] //FIXME: docs-css yanks sourcemap from local docs.css, working around just doing the minimal compile here ['docs-css'] //['dist-css', 'docs']
}
},
@ -429,21 +431,43 @@ module.exports = function (grunt) {
branch: 'gh-pages'
}
}
},
compress: {
main: {
options: {
archive: 'bootstrap-material-design-<%= pkg.version %>-dist.zip',
mode: 'zip',
level: 9,
pretty: true
},
files: [
{
expand: true,
cwd: 'dist/',
src: ['**'],
dest: 'bootstrap-material-design-<%= pkg.version %>-dist'
}
]
}
}
});
// These plugins provide necessary tasks.
require('load-grunt-tasks')(grunt, { scope: 'devDependencies',
require('load-grunt-tasks')(grunt, {
scope: 'devDependencies',
// Exclude Sass compilers. We choose the one to load later on.
pattern: ['grunt-*', '!grunt-sass', '!grunt-contrib-sass'] });
pattern: ['grunt-*', '!grunt-sass', '!grunt-contrib-sass']
});
require('time-grunt')(grunt);
// Docs HTML validation task
grunt.registerTask('validate-html', ['jekyll:docs', 'htmllint']);
var runSubset = function (subset) {
return !process.env.BMD_TEST || process.env.BMD_TEST === subset;
return !process.env.MDB_TEST || process.env.MDB_TEST === subset;
};
var isUndefOrNonZero = function (val) {
return val === undefined || val !== '0';
@ -461,7 +485,7 @@ module.exports = function (grunt) {
if (runSubset('validate-html') &&
isTravis &&
// Skip HTML5 validator when [skip validator] is in the commit message
isUndefOrNonZero(process.env.BMD_DO_VALIDATOR)) {
isUndefOrNonZero(process.env.MDB_DO_VALIDATOR)) {
testSubtasks.push('validate-html');
}
// Only run Sauce Labs tests if there's a Sauce access key
@ -469,7 +493,7 @@ module.exports = function (grunt) {
// Skip Sauce if running a different subset of the test suite
runSubset('sauce-js-unit') &&
// Skip Sauce on Travis when [skip sauce] is in the commit message
isUndefOrNonZero(process.env.BMD_DO_SAUCE)) {
isUndefOrNonZero(process.env.MDB_DO_SAUCE)) {
testSubtasks.push('babel:dev');
testSubtasks.push('connect');
testSubtasks.push('saucelabs-qunit');
@ -486,7 +510,7 @@ module.exports = function (grunt) {
// Supported Compilers: sass (Ruby) and libsass.
(function (sassCompilerName) {
require('./grunt/bs-sass-compile/' + sassCompilerName + '.js')(grunt);
})(process.env.BMD_SASS || 'libsass');
})(process.env.MDB_SASS || 'libsass');
// grunt.registerTask('sass-compile', ['sass:core', 'sass:extras', 'sass:docs']);
grunt.registerTask('sass-compile', ['sass:core', 'sass:docs']);
@ -529,7 +553,7 @@ module.exports = function (grunt) {
grunt.registerTask('update-shrinkwrap', ['exec:npmUpdate', '_update-shrinkwrap']);
grunt.registerTask('_update-shrinkwrap', function () {
var done = this.async();
npmShrinkwrap({ dev: true, dirname: __dirname }, function (err) {
npmShrinkwrap({dev: true, dirname: __dirname}, function (err) {
if (err) {
grunt.fail.warn(err);
}

View File

@ -19,7 +19,7 @@ permalink: pretty
source: docs
destination: _gh_pages
host: 0.0.0.0
port: 9001
port: 9000
#baseurl: "/bootstrap-material-design"
#url: "http://fezvrasta.github.io"
encoding: UTF-8

View File

@ -38,12 +38,12 @@ Our Gruntfile includes the following commands and tasks:
## Switching Sass compilers
Material Design for Bootstrap will be compiled with [libsass][libsass] by default, but you can opt into traditional Ruby Sass by setting the `BMD_SASS` environment variable. Two options are supported:
Material Design for Bootstrap will be compiled with [libsass][libsass] by default, but you can opt into traditional Ruby Sass by setting the `MDB_SASS` environment variable. Two options are supported:
* `libsass` (default) to use [libsass][libsass] via [grunt-sass][grunt-sass].
* `sass` to use [Ruby Sass][ruby-sass] via [grunt-contrib-sass][grunt-contrib-sass].
For example, run `BMD_SASS=sass grunt` to test and build Material Design for Bootstrap with Ruby Sass.
For example, run `MDB_SASS=sass grunt` to test and build Material Design for Bootstrap with Ruby Sass.
## Autoprefixer

View File

@ -1,179 +1,194 @@
{
"root": true,
"parser": "babel-eslint",
"env": {
"browser": true,
"jquery": true
},
"rules": {
// Possible Errors
"comma-dangle": [2, "never"],
"no-cond-assign": 2,
"no-console": 2,
"no-constant-condition": 2,
"no-control-regex": 2,
"no-debugger": 2,
"no-dupe-args": 2,
"no-dupe-keys": 2,
"no-duplicate-case": 2,
"no-empty": 2,
"no-empty-character-class": 2,
"no-ex-assign": 2,
"no-extra-boolean-cast": 2,
"no-extra-parens": 0,
"no-extra-semi": 2,
"no-func-assign": 2,
"no-inner-declarations": 2,
"no-invalid-regexp": 2,
"no-irregular-whitespace": 0,
"no-negated-in-lhs": 2,
"no-obj-calls": 2,
"no-regex-spaces": 2,
"no-sparse-arrays": 2,
"no-unexpected-multiline": 2,
"no-unreachable": 2,
"use-isnan": 2,
"valid-jsdoc": 0,
"valid-typeof": 2,
//Best Practices
"accessor-pairs": 2,
"block-scoped-var": 2,
"consistent-return": 2,
"curly": 2,
"default-case": 2,
"dot-location": 0,
"dot-notation": 0,
"eqeqeq": 2,
// "guard-for-in": 2,
"no-alert": 2,
"no-caller": 2,
"no-div-regex": 2,
"no-else-return": 2,
"no-empty-label": 2,
"no-eq-null": 2,
"no-eval": 2,
"no-extend-native": 2,
"no-extra-bind": 2,
"no-fallthrough": 2,
"no-floating-decimal": 2,
"no-implicit-coercion": 2,
"no-implied-eval": 2,
"no-invalid-this": 0,
"no-iterator": 2,
"no-labels": 2,
"no-lone-blocks": 2,
"no-loop-func": 2,
"no-multi-spaces": 0,
"no-multi-str": 0,
"no-native-reassign": 2,
"no-new": 2,
"no-new-func": 0,
"no-new-wrappers": 2,
"no-octal": 2,
"no-octal-escape": 2,
"no-param-reassign": 0,
"no-process-env": 2,
"no-proto": 2,
"no-redeclare": 2,
"no-return-assign": 2,
"no-script-url": 2,
"no-self-compare": 2,
"no-sequences": 2,
"no-throw-literal": 2,
"no-unused-expressions": 2,
"no-useless-call": 2,
"no-void": 2,
"no-warning-comments": 0,
"no-with": 2,
"radix": 2,
"vars-on-top": 0,
"wrap-iife": 2,
"yoda": 2,
// Variables
"init-declarations": 0,
"no-catch-shadow": 2,
"no-delete-var": 2,
"no-label-var": 2,
"no-shadow": 0,
"no-shadow-restricted-names": 2,
"no-undef": 2,
"no-undefined": 0,
"no-undef-init": 2,
"no-unused-vars": [2, {"argsIgnorePattern": "$"}],
"no-use-before-define": 0,
// Stylistic
"array-bracket-spacing": 2,
"block-spacing": 2,
"brace-style": 2,
"camelcase": 2,
"comma-spacing": 2,
"comma-style": 2,
"computed-property-spacing": 2,
"consistent-this": 2,
"eol-last": 2,
"func-names": 0,
"func-style": 0,
"indent": 0,
"key-spacing": 0,
"linebreak-style": 2,
"lines-around-comment": 0,
"new-cap": 0,
"newline-after-var": 0,
"new-parens": 2,
"no-array-constructor": 2,
"no-continue": 0,
"no-inline-comments": 0,
"no-lonely-if": 2,
"no-mixed-spaces-and-tabs": 2,
"no-multiple-empty-lines": 2,
"no-nested-ternary": 0,
"no-new-object": 2,
"no-spaced-func": 2,
"no-ternary": 0,
"no-trailing-spaces": 2,
"no-underscore-dangle": 0,
"no-unneeded-ternary": 2,
"object-curly-spacing": [1, "always"],
"one-var": 0,
"operator-assignment": 2,
"operator-linebreak": 0,
"padded-blocks": 0,
"quote-props": 0,
"quotes": 0,
"semi": [2, "never"],
"semi-spacing": 0,
"sort-vars": 2,
"space-after-keywords": 2,
"space-before-blocks": 2,
"space-before-function-paren": 0,
// "spaced-comment": 2,
"space-infix-ops": 2,
"space-in-parens": 2,
"space-return-throw-case": 2,
"space-unary-ops": 2,
"quotes": [2, "single", "avoid-escape"],
// es6
"arrow-parens": 2,
"arrow-spacing": 2,
"constructor-super": 2,
"generator-star-spacing": 2,
"no-class-assign": 2,
"no-const-assign": 2,
"no-dupe-class-members": 2,
"no-this-before-super": 2,
"no-var": 2,
"object-shorthand": 2,
"prefer-arrow-callback": 2,
"prefer-const": 0,
"prefer-reflect": 0,
"prefer-spread": 2,
"prefer-template": 2,
"require-yield": 2
}
"root": true,
"parser": "babel-eslint",
"env": {
"browser": true,
"jquery": true
},
"rules": {
// Possible Errors
"comma-dangle": [
2,
"never"
],
"handle-callback-err": 2,
"no-bitwise": 0,
"no-cond-assign": 2,
"no-console": 2,
"no-constant-condition": 2,
"no-control-regex": 2,
"no-debugger": 2,
"no-dupe-args": 2,
"no-dupe-keys": 2,
"no-duplicate-case": 2,
"no-empty": 2,
"no-empty-character-class": 2,
"no-ex-assign": 2,
"no-extra-boolean-cast": 2,
"no-extra-parens": 0,
"no-extra-semi": 2,
"no-func-assign": 2,
"no-inner-declarations": 2,
"no-invalid-regexp": 2,
"no-irregular-whitespace": 2,
"no-negated-in-lhs": 2,
"no-obj-calls": 2,
"no-regex-spaces": 2,
"no-sparse-arrays": 2,
"no-unexpected-multiline": 2,
"no-unreachable": 2,
"use-isnan": 2,
"valid-jsdoc": 0,
"valid-typeof": 2,
//Best Practices
"accessor-pairs": 2,
"block-scoped-var": 2,
"consistent-return": 2,
"curly": 2,
"default-case": 2,
"dot-location": 0,
"dot-notation": 0,
"eqeqeq": 2,
// "guard-for-in": 2,
"no-alert": 2,
"no-caller": 2,
"no-div-regex": 2,
"no-else-return": 2,
"no-empty-label": 2,
"no-eq-null": 2,
"no-eval": 2,
"no-extend-native": 2,
"no-extra-bind": 2,
"no-fallthrough": 2,
"no-floating-decimal": 2,
"no-implicit-coercion": 2,
"no-implied-eval": 2,
"no-invalid-this": 0,
"no-iterator": 2,
"no-labels": 2,
"no-lone-blocks": 2,
"no-loop-func": 2,
"no-multi-spaces": 0,
"no-multi-str": 2,
"no-native-reassign": 2,
"no-new": 2,
"no-new-func": 0,
"no-new-wrappers": 2,
"no-octal": 2,
"no-octal-escape": 2,
"no-param-reassign": 0,
"no-process-env": 2,
"no-proto": 2,
"no-redeclare": 2,
"no-return-assign": 2,
"no-script-url": 2,
"no-self-compare": 2,
"no-sequences": 2,
"no-throw-literal": 2,
"no-unused-expressions": 2,
"no-useless-call": 2,
"no-useless-concat": 2,
"no-void": 2,
"no-warning-comments": 0,
"no-with": 2,
"radix": 2,
"vars-on-top": 0,
"wrap-iife": 2,
"yoda": 2,
// Variables
"init-declarations": 0,
"no-catch-shadow": 2,
"no-delete-var": 2,
"no-label-var": 2,
"no-shadow": 0,
"no-shadow-restricted-names": 2,
"no-undef": 2,
"no-undefined": 0,
"no-undef-init": 2,
"no-unused-vars": [
2,
{
"argsIgnorePattern": "$"
}
],
"no-use-before-define": 0,
// Stylistic
"array-bracket-spacing": 2,
"block-spacing": 2,
"brace-style": 2,
"camelcase": 2,
"comma-spacing": 2,
"comma-style": 2,
"computed-property-spacing": 2,
"consistent-this": 2,
"eol-last": 2,
"func-names": 0,
"func-style": 0,
// "indent": [2, 2], //[2, 2, {"SwitchCase": 1}],
"key-spacing": 0,
"linebreak-style": 2,
"lines-around-comment": 0,
"new-cap": 0,
"newline-after-var": 0,
"new-parens": 2,
"no-array-constructor": 2,
"no-continue": 0,
"no-inline-comments": 0,
"no-lonely-if": 2,
"no-mixed-spaces-and-tabs": 2,
"no-multiple-empty-lines": 2,
"no-nested-ternary": 0,
"no-new-object": 2,
"no-spaced-func": 2,
"no-ternary": 0,
"no-trailing-spaces": 2,
"no-underscore-dangle": 0,
"no-unneeded-ternary": 2,
// "object-curly-spacing": [
// 1,
// "always"
// ],
"one-var": 0,
"operator-assignment": 2,
"operator-linebreak": 0,
"padded-blocks": 0,
"quote-props": [2, "as-needed"],
"quotes": [2, "single"],
"semi": [
2,
"never"
],
"semi-spacing": 2,
"sort-vars": 2,
"space-after-keywords": 2,
"space-before-blocks": 2,
"space-before-function-paren": 0,
// "spaced-comment": 2,
"space-infix-ops": 2,
"space-in-parens": 2,
"space-return-throw-case": 2,
"space-unary-ops": 2,
"quotes": [
2,
"single",
"avoid-escape"
],
// es6
"arrow-parens": 2,
"arrow-spacing": 2,
"constructor-super": 2,
"generator-star-spacing": 2,
"no-class-assign": 2,
"no-const-assign": 2,
"no-dupe-class-members": 2,
"no-this-before-super": 2,
"no-var": 2,
"object-shorthand": 2,
"prefer-arrow-callback": 2,
"prefer-const": 0,
"prefer-reflect": 0,
"prefer-spread": 2,
"prefer-template": 2,
"require-yield": 2
}
}

132
js/dist/autofill.js vendored
View File

@ -1,132 +0,0 @@
//import Util from './util'
'use strict';
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
var Autofill = (function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'autofill';
var DATA_KEY = 'mdb.' + NAME;
var JQUERY_NO_CONFLICT = $.fn[NAME];
var Default = {};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
var Autofill = (function () {
function Autofill(element, config) {
_classCallCheck(this, Autofill);
this.element = element;
this.config = $.extend({}, Default, config);
this._watchLoading();
this._attachEventHandlers();
}
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
_createClass(Autofill, [{
key: 'dispose',
value: function dispose() {
$.removeData(this.element, DATA_KEY);
this.element = null;
this.config = null;
}
// ------------------------------------------------------------------------
// private
}, {
key: '_watchLoading',
value: function _watchLoading() {
var _this = this;
// After 10 seconds we are quite sure all the needed inputs are autofilled then we can stop checking them
setTimeout(function () {
clearInterval(_this._onLoading);
}, 10000);
}
// This part of code will detect autofill when the page is loading (username and password inputs for example)
}, {
key: '_onLoading',
value: function _onLoading() {
setInterval(function () {
$('input[type!=checkbox]').each(function (index, element) {
var $element = $(element);
if ($element.val() && $element.val() !== $element.attr('value')) {
$element.triggerStart('change');
}
});
}, 100);
}
}, {
key: '_attachEventHandlers',
value: function _attachEventHandlers() {
// Listen on inputs of the focused form
// (because user can select from the autofill dropdown only when the input has focus)
var focused = null;
$(document).on('focus', 'input', function (event) {
var $inputs = $(event.currentTarget).closest('form').find('input').not('[type=file]');
focused = setInterval(function () {
$inputs.each(function (index, element) {
var $element = $(element);
if ($element.val() !== $element.attr('value')) {
$element.triggerStart('change');
}
});
}, 100);
}).on('blur', '.form-group input', function () {
clearInterval(focused);
});
}
// ------------------------------------------------------------------------
// static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
var _this2 = this;
return this.each(function () {
var $element = $(_this2);
var data = $element.data(DATA_KEY);
if (!data) {
data = new Autofill(_this2, config);
$element.data(DATA_KEY, data);
}
});
}
}]);
return Autofill;
})();
$.fn[NAME] = Autofill._jQueryInterface;
$.fn[NAME].Constructor = Autofill;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Autofill._jQueryInterface;
};
return Autofill;
})(jQuery);
//# sourceMappingURL=autofill.js.map

File diff suppressed because one or more lines are too long

View File

@ -1,169 +0,0 @@
//import Util from './util'
/**
* $.bootstrapMaterialDesign(config) is a macro class to configure the components generally
* used in Material Design for Bootstrap. You may pass overrides to the configurations
* which will be passed into each component, or you may omit use of this class and
* configure each component separately.
*
* NOTE: If omitting use of this class, please note that the Input component must be
* initialized prior to other decorating components such as radio, checkbox,
* togglebutton, fileInput.
*
*/
'use strict';
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
var BootstrapMaterialDesign = (function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'bootstrapMaterialDesign';
var DATA_KEY = 'mdb.' + NAME;
var JQUERY_NO_CONFLICT = $.fn[NAME];
/**
*
* Default macro configuration for each component (primarily selectors).
* - selector: may be a string or an array. Any array will be joined with a comma to generate the selector
* - disable any component by defining it as false with an override. e.g. $.bootstrapMaterialDesign({ autofill: false })
*
* @see each individual component for more configuration settings.
*/
var Default = {
ripples: {
selector: ['.btn:not(.btn-link):not(.ripple-none)', '.card-image:not(.ripple-none)', '.navbar a:not(.ripple-none)', '.dropdown-menu a:not(.ripple-none)', '.nav-tabs a:not(.ripple-none)', '.pagination li:not(.active):not(.disabled) a:not(.ripple-none)', '.ripple' // generic marker class to add ripple to elements
]
},
input: {
selector: ['input.form-control', 'textarea.form-control', 'select.form-control']
},
checkbox: {
selector: '.checkbox > label > input[type=checkbox]'
},
togglebutton: {
selector: '.togglebutton > label > input[type=checkbox]'
},
radio: {
selector: '.radio > label > input[type=radio]'
},
fileInput: {
selector: 'input[type=file]'
},
autofill: {
selector: 'body'
},
arrive: true,
// create an ordered component list for instantiation
instantiation: ['ripples', 'input', 'checkbox', 'togglebutton', 'radio', 'fileInput', 'autofill']
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
var BootstrapMaterialDesign = (function () {
function BootstrapMaterialDesign(element, config) {
var _this = this;
_classCallCheck(this, BootstrapMaterialDesign);
this.element = element;
this.config = $.extend({}, Default, config);
var $document = $(document);
var _loop = function (component) {
// the component's config fragment is passed in directly, allowing users to override
var componentConfig = _this.config[component];
// check to make sure component config is enabled (not `false`)
if (componentConfig) {
// assemble the selector as it may be an array
var selector = _this._resolveSelector(componentConfig);
// instantiate component on selector elements with config
$(selector)[component](componentConfig);
// add to arrive if present and enabled
if (document.arrive && _this.config.arrive) {
$document.arrive(selector, function (element) {
// eslint-disable-line no-loop-func
$(element)[component](componentConfig);
});
}
}
};
for (var component in this.config.instantiation) {
_loop(component);
}
}
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
_createClass(BootstrapMaterialDesign, [{
key: 'dispose',
value: function dispose() {
$.removeData(this.element, DATA_KEY);
this.element = null;
this.config = null;
}
// ------------------------------------------------------------------------
// private
}, {
key: '_resolveSelector',
value: function _resolveSelector(componentConfig) {
var selector = componentConfig['selector'];
if (Array.isArray(selector)) {
selector = selector.join(', ');
}
return selector;
}
// ------------------------------------------------------------------------
// static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
return this.each(function () {
var $element = $(this);
var data = $element.data(DATA_KEY);
if (!data) {
data = new BootstrapMaterialDesign(this, config);
$element.data(DATA_KEY, data);
}
});
}
}]);
return BootstrapMaterialDesign;
})();
$.fn[NAME] = BootstrapMaterialDesign._jQueryInterface;
$.fn[NAME].Constructor = BootstrapMaterialDesign;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return BootstrapMaterialDesign._jQueryInterface;
};
return BootstrapMaterialDesign;
})(jQuery);
//# sourceMappingURL=bootstrapMaterialDesign.js.map

File diff suppressed because one or more lines are too long

105
js/dist/checkbox.js vendored
View File

@ -1,105 +0,0 @@
'use strict';
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
// Checkbox decorator, to be called after Input
var Checkbox = (function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'checkbox';
var DATA_KEY = 'mdb.' + NAME;
var JQUERY_NO_CONFLICT = $.fn[NAME];
var Default = {
template: '<span class=\'checkbox-material\'><span class=\'check\'></span></span>'
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
var Checkbox = (function () {
function Checkbox(element, config) {
_classCallCheck(this, Checkbox);
this.element = element;
this.config = $.extend({}, Default, config);
this.element.after(this.config.template);
this.formGroup = Util.findFormGroup(this.element);
this._bindEventListeners();
}
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
_createClass(Checkbox, [{
key: 'dispose',
value: function dispose() {
$.removeData(this.element, DATA_KEY);
this.element = null;
this.formGroup = null;
this.config = null;
}
// ------------------------------------------------------------------------
// private
}, {
key: '_bindEventListeners',
value: function _bindEventListeners() {
var _this = this;
// checkboxes didn't appear to bubble to the document, so we'll bind these directly
this.formGroup.find('.checkbox label').hover(function () {
Util.addFormGroupFocus(_this.formGroup);
}, function () {
Util.removeFormGroupFocus(_this.formGroup);
});
this.element.change(function () {
_this.element.blur();
});
}
// ------------------------------------------------------------------------
// static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
return this.each(function () {
var $element = $(this);
var data = $element.data(DATA_KEY);
if (!data) {
data = new Checkbox(this, config);
$element.data(DATA_KEY, data);
}
});
}
}]);
return Checkbox;
})();
$.fn[NAME] = Checkbox._jQueryInterface;
$.fn[NAME].Constructor = Checkbox;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Checkbox._jQueryInterface;
};
return Checkbox;
})(jQuery);
//# sourceMappingURL=checkbox.js.map

View File

@ -1 +0,0 @@
{"version":3,"sources":["../src/checkbox.js"],"names":[],"mappings":";;;;;;;AAGA,IAAM,QAAQ,GAAG,CAAC,UAAC,CAAC,EAAK;;;;;;;AAOvB,MAAM,IAAI,GAAG,UAAU,CAAA;AACvB,MAAM,QAAQ,YAAU,IAAI,AAAE,CAAA;AAC9B,MAAM,kBAAkB,GAAG,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAA;;AAErC,MAAM,OAAO,GAAG;AACd,YAAQ,0EAAsE;GAC/E,CAAA;;;;;;;;MAOK,QAAQ;AAED,aAFP,QAAQ,CAEA,OAAO,EAAE,MAAM,EAAE;4BAFzB,QAAQ;;AAGV,UAAI,CAAC,OAAO,GAAG,OAAO,CAAA;AACtB,UAAI,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;;AAE3C,UAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;AACxC,UAAI,CAAC,SAAS,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;;AAEjD,UAAI,CAAC,mBAAmB,EAAE,CAAA;KAC3B;;;;;;;;iBAVG,QAAQ;;aAYL,mBAAG;AACR,SAAC,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;AACpC,YAAI,CAAC,OAAO,GAAG,IAAI,CAAA;AACnB,YAAI,CAAC,SAAS,GAAG,IAAI,CAAA;AACrB,YAAI,CAAC,MAAM,GAAG,IAAI,CAAA;OACnB;;;;;;aAIkB,+BAAG;;;;AAEpB,YAAI,CAAC,SAAS,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,KAAK,CAAC,YAAM;AACjD,cAAI,CAAC,iBAAiB,CAAC,MAAK,SAAS,CAAC,CAAA;SACvC,EAAE,YAAM;AACP,cAAI,CAAC,oBAAoB,CAAC,MAAK,SAAS,CAAC,CAAA;SAC1C,CAAC,CAAA;;AAEF,YAAI,CAAC,OAAO,CAAC,MAAM,CAAC,YAAM;AACxB,gBAAK,OAAO,CAAC,IAAI,EAAE,CAAA;SACpB,CAAC,CAAA;OACH;;;;;;aAIsB,0BAAC,MAAM,EAAE;AAC9B,eAAO,IAAI,CAAC,IAAI,CAAC,YAAY;AAC3B,cAAI,QAAQ,GAAG,CAAC,CAAC,IAAI,CAAC,CAAA;AACtB,cAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;;AAElC,cAAI,CAAC,IAAI,EAAE;AACT,gBAAI,GAAG,IAAI,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;AACjC,oBAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;WAC9B;SACF,CAAC,CAAA;OACH;;;WA9CG,QAAQ;;;AAsDd,GAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,gBAAgB,CAAA;AACtC,GAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,WAAW,GAAG,QAAQ,CAAA;AACjC,GAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,UAAU,GAAG,YAAM;AAC5B,KAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,kBAAkB,CAAA;AAC/B,WAAO,QAAQ,CAAC,gBAAgB,CAAA;GACjC,CAAA;;AAED,SAAO,QAAQ,CAAA;CAEhB,CAAA,CAAE,MAAM,CAAC,CAAA","file":"checkbox.js","sourcesContent":["import Util from './util'\n\n// Checkbox decorator, to be called after Input\nconst Checkbox = (($) => {\n\n /**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n const NAME = 'checkbox'\n const DATA_KEY = `mdb.${NAME}`\n const JQUERY_NO_CONFLICT = $.fn[NAME]\n\n const Default = {\n template: `<span class='checkbox-material'><span class='check'></span></span>`\n }\n\n /**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\n class Checkbox {\n\n constructor(element, config) {\n this.element = element\n this.config = $.extend({}, Default, config)\n\n this.element.after(this.config.template)\n this.formGroup = Util.findFormGroup(this.element)\n\n this._bindEventListeners()\n }\n\n dispose() {\n $.removeData(this.element, DATA_KEY)\n this.element = null\n this.formGroup = null\n this.config = null\n }\n\n // ------------------------------------------------------------------------\n // private\n _bindEventListeners() {\n // checkboxes didn't appear to bubble to the document, so we'll bind these directly\n this.formGroup.find('.checkbox label').hover(() => {\n Util.addFormGroupFocus(this.formGroup)\n }, () => {\n Util.removeFormGroupFocus(this.formGroup)\n })\n\n this.element.change(() => {\n this.element.blur()\n })\n }\n\n // ------------------------------------------------------------------------\n // static\n static _jQueryInterface(config) {\n return this.each(function () {\n let $element = $(this)\n let data = $element.data(DATA_KEY)\n\n if (!data) {\n data = new Checkbox(this, config)\n $element.data(DATA_KEY, data)\n }\n })\n }\n }\n\n /**\n * ------------------------------------------------------------------------\n * jQuery\n * ------------------------------------------------------------------------\n */\n $.fn[NAME] = Checkbox._jQueryInterface\n $.fn[NAME].Constructor = Checkbox\n $.fn[NAME].noConflict = () => {\n $.fn[NAME] = JQUERY_NO_CONFLICT\n return Checkbox._jQueryInterface\n }\n\n return Checkbox\n\n})(jQuery)\n\nexport default Checkbox\n"]}

128
js/dist/fileinput.js vendored
View File

@ -1,128 +0,0 @@
'use strict';
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
// FileInput decorator, to be called after Input
var FileInput = (function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'fileInput';
var DATA_KEY = 'mdb.' + NAME;
var JQUERY_NO_CONFLICT = $.fn[NAME];
var Default = {};
var ClassName = {
IS_FILEINPUT: 'is-fileinput',
IS_EMPTY: 'is-empty'
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
var FileInput = (function () {
function FileInput(element, config) {
_classCallCheck(this, FileInput);
this.element = element;
this.config = $.extend({}, Default, config);
this.formGroup = Util.findFormGroup(this.element);
this.formGroup.addClass(ClassName.IS_FILEINPUT);
this._bindEventListeners();
}
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
_createClass(FileInput, [{
key: 'dispose',
value: function dispose() {
$.removeData(this.element, DATA_KEY);
this.element = null;
this.formGroup = null;
this.config = null;
}
// ------------------------------------------------------------------------
// private
}, {
key: '_bindEventListeners',
value: function _bindEventListeners() {
var _this = this;
this.formGroup.on('focus', function () {
Util.addFormGroupFocus(_this.formGroup);
}).on('blur', function () {
Util.removeFormGroupFocus(_this.formGroup);
});
// set the fileinput readonly field with the name of the file
this.element.on('change', function () {
var value = '';
$.each(_this.element.files, function (i, file) {
value += file.name + ' , ';
});
value = value.substring(0, value.length - 2);
if (value) {
_this._removeIsEmpty();
} else {
_this._addIsEmpty();
}
_this.formGroup.find('input.form-control[readonly]').val(value);
});
}
}, {
key: '_addIsEmpty',
value: function _addIsEmpty() {
this.formGroup.addClass(ClassName.IS_EMPTY);
}
}, {
key: '_removeIsEmpty',
value: function _removeIsEmpty() {
this.formGroup.removeClass(ClassName.IS_EMPTY);
}
// ------------------------------------------------------------------------
// static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
return this.each(function () {
var $element = $(this);
var data = $element.data(DATA_KEY);
if (!data) {
data = new FileInput(this, config);
$element.data(DATA_KEY, data);
}
});
}
}]);
return FileInput;
})();
$.fn[NAME] = FileInput._jQueryInterface;
$.fn[NAME].Constructor = FileInput;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return FileInput._jQueryInterface;
};
return FileInput;
})(jQuery);
//# sourceMappingURL=fileinput.js.map

File diff suppressed because one or more lines are too long

217
js/dist/input.js vendored
View File

@ -1,217 +0,0 @@
'use strict';
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
var Input = (function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'input';
var DATA_KEY = 'mdb.' + NAME;
var JQUERY_NO_CONFLICT = $.fn[NAME];
var Default = {
convertInputSizeVariations: true,
template: '<span class=\'material-input\'></span>',
formGroup: {
template: '<div class=\'form-group\'></div>'
}
};
var InputSizeConversions = {
'input-lg': 'form-group-lg',
'input-sm': 'form-group-sm'
};
var ClassName = {
IS_EMPTY: 'is-empty',
FORM_GROUP: 'form-group',
HAS_ERROR: 'has-error'
};
var Selector = {
FORM_GROUP: '.' + ClassName.FORM_GROUP //,
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
var Input = (function () {
function Input(element, config) {
_classCallCheck(this, Input);
this.element = element;
this.config = $.extend({}, Default, config);
// Requires form-group standard markup (will add it if necessary)
this.formGroup = this._findOrCreateFormGroup();
this._convertInputSizeVariations();
// Initially mark as empty
if (this._isEmpty()) {
this.formGroup.addClass(ClassName.IS_EMPTY);
}
// Add marker div the end of the form-group
this.formGroup.append(this.config.template);
this._bindEventListeners();
}
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
_createClass(Input, [{
key: 'dispose',
value: function dispose() {
$.removeData(this.element, DATA_KEY);
this.element = null;
this.formGroup = null;
this.config = null;
}
// ------------------------------------------------------------------------
// private
}, {
key: '_bindEventListeners',
value: function _bindEventListeners() {
var _this = this;
this.element.on('keydown paste', function (event) {
if (Util.isChar(event)) {
_this._removeIsEmpty();
}
}).on('keyup change', function (event) {
var isValid = typeof _this.element[0].checkValidity === 'undefined' || _this.element[0].checkValidity();
if (_this.element.val() === '' && isValid) {
_this._addIsEmpty();
} else {
_this._removeIsEmpty();
}
// Validation events do not bubble, so they must be attached directly to the input: http://jsfiddle.net/PEpRM/1/
// Further, even the bind method is being caught, but since we are already calling #checkValidity here, just alter
// the form-group on change.
//
// NOTE: I'm not sure we should be intervening regarding validation, this seems better as a README and snippet of code.
// BUT, I've left it here for backwards compatibility.
if (isValid) {
_this._removeHasError();
} else {
_this._addHasError();
}
}).on('focus', function () {
Util.addFormGroupFocus(_this.formGroup);
}).on('blur', function () {
Util.removeFormGroupFocus(_this.formGroup);
})
// make sure empty is added back when there is a programmatic value change.
// NOTE: programmatic changing of value using $.val() must trigger the change event i.e. $.val('x').trigger('change')
.on('change', function () {
if (_this.element.attr('type') === 'file') {
return;
}
var value = _this.element.val();
if (value) {
_this._removeIsEmpty();
} else {
_this._addIsEmpty();
}
});
}
}, {
key: '_addHasError',
value: function _addHasError() {
this.formGroup.addClass(ClassName.HAS_ERROR);
}
}, {
key: '_removeHasError',
value: function _removeHasError() {
this.formGroup.removeClass(ClassName.HAS_ERROR);
}
}, {
key: '_addIsEmpty',
value: function _addIsEmpty() {
this.formGroup.addClass(ClassName.IS_EMPTY);
}
}, {
key: '_removeIsEmpty',
value: function _removeIsEmpty() {
this.formGroup.removeClass(ClassName.IS_EMPTY);
}
}, {
key: '_isEmpty',
value: function _isEmpty() {
return this.element.val() === null || this.element.val() === undefined || this.element.val() === '';
}
}, {
key: '_convertInputSizeVariations',
value: function _convertInputSizeVariations() {
if (!this.config.convertInputSizeVariations) {
return;
}
// Modification - Change input-sm/lg to form-group-sm/lg instead (preferred standard and simpler css/less variants)
for (var inputSize in InputSizeConversions) {
if (this.element.hasClass(inputSize)) {
this.element.removeClass(inputSize);
this.formGroup.addClass(InputSizeConversions[inputSize]);
}
}
}
}, {
key: '_findOrCreateFormGroup',
value: function _findOrCreateFormGroup() {
var fg = this.element.closest(Selector.FORM_GROUP); // note that form-group may be grandparent in the case of an input-group
if (fg.length === 0) {
this.element.wrap(this.config.formGroup.template);
fg = this.element.closest(Selector.FORM_GROUP); // find node after attached (otherwise additional attachments don't work)
}
return fg;
}
// ------------------------------------------------------------------------
// static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
return this.each(function () {
var $element = $(this);
var data = $element.data(DATA_KEY);
if (!data) {
data = new Input(this, config);
$element.data(DATA_KEY, data);
}
});
}
}]);
return Input;
})();
$.fn[NAME] = Input._jQueryInterface;
$.fn[NAME].Constructor = Input;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Input._jQueryInterface;
};
return Input;
})(jQuery);
//# sourceMappingURL=input.js.map

File diff suppressed because one or more lines are too long

87
js/dist/radio.js vendored
View File

@ -1,87 +0,0 @@
//import Util from './util'
// Radio decorator, to be called after Input
'use strict';
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
var Radio = (function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'radio';
var DATA_KEY = 'mdb.' + NAME;
var JQUERY_NO_CONFLICT = $.fn[NAME];
var Default = {
template: '<span class=\'circle\'></span><span class=\'check\'></span>'
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
var Radio = (function () {
function Radio(element, config) {
_classCallCheck(this, Radio);
this.element = element;
this.config = $.extend({}, Default, config);
this.element.after(this.config.template);
}
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
_createClass(Radio, [{
key: 'dispose',
value: function dispose() {
$.removeData(this.element, DATA_KEY);
this.element = null;
this.config = null;
}
// ------------------------------------------------------------------------
// private
// ------------------------------------------------------------------------
// static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
return this.each(function () {
var $element = $(this);
var data = $element.data(DATA_KEY);
if (!data) {
data = new Radio(this, config);
$element.data(DATA_KEY, data);
}
});
}
}]);
return Radio;
})();
$.fn[NAME] = Radio._jQueryInterface;
$.fn[NAME].Constructor = Radio;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Radio._jQueryInterface;
};
return Radio;
})(jQuery);
//# sourceMappingURL=radio.js.map

View File

@ -1 +0,0 @@
{"version":3,"sources":["../src/radio.js"],"names":[],"mappings":";;;;;;;;;AAGA,IAAM,KAAK,GAAG,CAAC,UAAC,CAAC,EAAK;;;;;;;AAOpB,MAAM,IAAI,GAAG,OAAO,CAAA;AACpB,MAAM,QAAQ,YAAU,IAAI,AAAE,CAAA;AAC9B,MAAM,kBAAkB,GAAG,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAA;;AAErC,MAAM,OAAO,GAAG;AACd,YAAQ,+DAA2D;GACpE,CAAA;;;;;;;;MAOK,KAAK;AAEE,aAFP,KAAK,CAEG,OAAO,EAAE,MAAM,EAAE;4BAFzB,KAAK;;AAGP,UAAI,CAAC,OAAO,GAAG,OAAO,CAAA;AACtB,UAAI,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;;AAE3C,UAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;KACzC;;;;;;;;iBAPG,KAAK;;aASF,mBAAG;AACR,SAAC,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;AACpC,YAAI,CAAC,OAAO,GAAG,IAAI,CAAA;AACnB,YAAI,CAAC,MAAM,GAAG,IAAI,CAAA;OACnB;;;;;;;;;aAOsB,0BAAC,MAAM,EAAE;AAC9B,eAAO,IAAI,CAAC,IAAI,CAAC,YAAY;AAC3B,cAAI,QAAQ,GAAG,CAAC,CAAC,IAAI,CAAC,CAAA;AACtB,cAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;;AAElC,cAAI,CAAC,IAAI,EAAE;AACT,gBAAI,GAAG,IAAI,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;AAC9B,oBAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;WAC9B;SACF,CAAC,CAAA;OACH;;;WA9BG,KAAK;;;AAsCX,GAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,gBAAgB,CAAA;AACnC,GAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,WAAW,GAAG,KAAK,CAAA;AAC9B,GAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,UAAU,GAAG,YAAM;AAC5B,KAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,kBAAkB,CAAA;AAC/B,WAAO,KAAK,CAAC,gBAAgB,CAAA;GAC9B,CAAA;;AAED,SAAO,KAAK,CAAA;CAEb,CAAA,CAAE,MAAM,CAAC,CAAA","file":"radio.js","sourcesContent":["//import Util from './util'\n\n// Radio decorator, to be called after Input\nconst Radio = (($) => {\n\n /**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n const NAME = 'radio'\n const DATA_KEY = `mdb.${NAME}`\n const JQUERY_NO_CONFLICT = $.fn[NAME]\n\n const Default = {\n template: `<span class='circle'></span><span class='check'></span>`\n }\n\n /**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\n class Radio {\n\n constructor(element, config) {\n this.element = element\n this.config = $.extend({}, Default, config)\n\n this.element.after(this.config.template)\n }\n\n dispose() {\n $.removeData(this.element, DATA_KEY)\n this.element = null\n this.config = null\n }\n\n // ------------------------------------------------------------------------\n // private\n\n // ------------------------------------------------------------------------\n // static\n static _jQueryInterface(config) {\n return this.each(function () {\n let $element = $(this)\n let data = $element.data(DATA_KEY)\n\n if (!data) {\n data = new Radio(this, config)\n $element.data(DATA_KEY, data)\n }\n })\n }\n }\n\n /**\n * ------------------------------------------------------------------------\n * jQuery\n * ------------------------------------------------------------------------\n */\n $.fn[NAME] = Radio._jQueryInterface\n $.fn[NAME].Constructor = Radio\n $.fn[NAME].noConflict = () => {\n $.fn[NAME] = JQUERY_NO_CONFLICT\n return Radio._jQueryInterface\n }\n\n return Radio\n\n})(jQuery)\n\nexport default Radio\n"]}

333
js/dist/ripples.js vendored
View File

@ -1,333 +0,0 @@
'use strict';
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
var Ripples = (function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'ripples';
var DATA_KEY = 'mdb.' + NAME;
var JQUERY_NO_CONFLICT = $.fn[NAME];
var ClassName = {
CONTAINER: 'ripple-container',
DECORATOR: 'ripple-decorator'
};
var Selector = {
CONTAINER: '.' + ClassName.CONTAINER,
DECORATOR: '.' + ClassName.DECORATOR //,
};
var Default = {
container: {
template: '<div class=\'' + ClassName.CONTAINER + '\'></div>'
},
decorator: {
template: ClassName.DECORATOR + '\'></div>'
},
trigger: {
start: 'mousedown touchstart',
end: 'mouseup mouseleave touchend'
},
touchUserAgentRegex: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i,
duration: 500
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
var Ripples = (function () {
function Ripples(element, config) {
_classCallCheck(this, Ripples);
this.element = $(element);
this.config = $.extend({}, Default, config);
// attach initial listener
this.element.on(this.config.triggerStart, this._onStartRipple);
}
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
_createClass(Ripples, [{
key: 'dispose',
value: function dispose() {
$.removeData(this.element, DATA_KEY);
this.element = null;
this.containerElement = null;
this.decoratorElement = null;
this.config = null;
}
// ------------------------------------------------------------------------
// private
}, {
key: '_onStartRipple',
value: function _onStartRipple(event) {
var _this = this;
// Verify if the user is just touching on a device and return if so
if (this.isTouch() && event.type === 'mousedown') {
return;
}
// Find or create the ripple container element
this._findOrCreateContainer();
// Get relY and relX positions of the container element
var relY = this._getRelY(event);
var relX = this._getRelX(event);
// If relY and/or relX are false, return the event
if (!relY && !relX) {
return;
}
// set the location and color each time (even if element is cached)
this.decoratorElement.css({
'left': relX,
'top': relY,
'background-color': this._getRipplesColor()
});
// Make sure the ripple has the styles applied (ugly hack but it works)
this._forceStyleApplication();
// Turn on the ripple animation
this.rippleOn();
// Call the rippleEnd function when the transition 'on' ends
setTimeout(function () {
_this.rippleEnd();
}, this.config.duration);
// Detect when the user leaves the element (attach only when necessary for performance)
this.element.on(this.config.triggerEnd, function () {
_this.decoratorElement.data('mousedown', 'off');
if (_this.decoratorElement.data('animating') === 'off') {
_this.rippleOut();
}
});
}
}, {
key: '_findOrCreateContainer',
value: function _findOrCreateContainer() {
if (!this.containerElement || !this.containerElement.length > 0) {
this.element.append(this.config.container.template);
this.containerElement = this.element.find(Selector.CONTAINER);
}
// always add the rippleElement, it is always removed
this.containerElement.append(this.config.element.template);
this.decoratorElement = this.containerElement.find(Selector.DECORATOR);
}
// Make sure the ripple has the styles applied (ugly hack but it works)
}, {
key: '_forceStyleApplication',
value: function _forceStyleApplication() {
return window.getComputedStyle(this.decoratorElement[0]).opacity;
}
/**
* Get the relX
*/
}, {
key: '_getRelX',
value: function _getRelX(event) {
var wrapperOffset = this.containerElement.offset();
var result = null;
if (!this.isTouch()) {
// Get the mouse position relative to the ripple wrapper
result = event.pageX - wrapperOffset.left;
} else {
// Make sure the user is using only one finger and then get the touch
// position relative to the ripple wrapper
event = event.originalEvent;
if (event.touches.length === 1) {
result = event.touches[0].pageX - wrapperOffset.left;
} else {
result = false;
}
}
return result;
}
/**
* Get the relY
*/
}, {
key: '_getRelY',
value: function _getRelY(event) {
var containerOffset = this.containerElement.offset();
var result = null;
if (!this.isTouch()) {
/**
* Get the mouse position relative to the ripple wrapper
*/
result = event.pageY - containerOffset.top;
} else {
/**
* Make sure the user is using only one finger and then get the touch
* position relative to the ripple wrapper
*/
event = event.originalEvent;
if (event.touches.length === 1) {
result = event.touches[0].pageY - containerOffset.top;
} else {
result = false;
}
}
return result;
}
/**
* Get the ripple color
*/
}, {
key: '_getRipplesColor',
value: function _getRipplesColor() {
var color = this.element.data('ripple-color') ? this.element.data('ripple-color') : window.getComputedStyle(this.element[0]).color;
return color;
}
/**
* Verify if the client is using a mobile device
*/
}, {
key: 'isTouch',
value: function isTouch() {
return this.config.touchUserAgentRegex.test(navigator.userAgent);
}
/**
* End the animation of the ripple
*/
}, {
key: 'rippleEnd',
value: function rippleEnd() {
this.decoratorElement.data('animating', 'off');
if (this.decoratorElement.data('mousedown') === 'off') {
this.rippleOut(this.decoratorElement);
}
}
/**
* Turn off the ripple effect
*/
}, {
key: 'rippleOut',
value: function rippleOut() {
var _this2 = this;
this.decoratorElement.off();
if (Util.transitionEndSupported()) {
this.decoratorElement.addClass('ripple-out');
} else {
this.decoratorElement.animate({ 'opacity': 0 }, 100, function () {
_this2.decoratorElement.triggerStart('transitionend');
});
}
this.decoratorElement.on(Util.transitionEndSelector(), function () {
_this2.decoratorElement.remove();
_this2.decoratorElement = null;
});
}
/**
* Turn on the ripple effect
*/
}, {
key: 'rippleOn',
value: function rippleOn() {
var _this3 = this;
var size = this._getNewSize();
if (Util.transitionEndSupported()) {
this.decoratorElement.css({
'-ms-transform': 'scale(' + size + ')',
'-moz-transform': 'scale(' + size + ')',
'-webkit-transform': 'scale(' + size + ')',
'transform': 'scale(' + size + ')'
}).addClass('ripple-on').data('animating', 'on').data('mousedown', 'on');
} else {
this.decoratorElement.animate({
'width': Math.max(this.element.outerWidth(), this.element.outerHeight()) * 2,
'height': Math.max(this.element.outerWidth(), this.element.outerHeight()) * 2,
'margin-left': Math.max(this.element.outerWidth(), this.element.outerHeight()) * -1,
'margin-top': Math.max(this.element.outerWidth(), this.element.outerHeight()) * -1,
'opacity': 0.2
}, this.config.duration, function () {
_this3.decoratorElement.triggerStart('transitionend');
});
}
}
/**
* Get the new size based on the element height/width and the ripple width
*/
}, {
key: '_getNewSize',
value: function _getNewSize() {
return Math.max(this.element.outerWidth(), this.element.outerHeight()) / this.decoratorElement.outerWidth() * 2.5;
}
// ------------------------------------------------------------------------
// static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
var _this4 = this;
return this.each(function () {
var element = $(_this4);
var data = element.data(DATA_KEY);
if (!data) {
data = new Ripples(_this4, config);
element.data(DATA_KEY, data);
}
});
}
}]);
return Ripples;
})();
$.fn[NAME] = Ripples._jQueryInterface;
$.fn[NAME].Constructor = Ripples;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Ripples._jQueryInterface;
};
return Ripples;
})(jQuery);
//# sourceMappingURL=ripples.js.map

File diff suppressed because one or more lines are too long

View File

@ -1,87 +0,0 @@
//import Util from './util'
// Togglebutton decorator, to be called after Input
'use strict';
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
var Togglebutton = (function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'togglebutton';
var DATA_KEY = 'mdb.' + NAME;
var JQUERY_NO_CONFLICT = $.fn[NAME];
var Default = {
template: '<span class=\'toggle\'></span>'
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
var Togglebutton = (function () {
function Togglebutton(element, config) {
_classCallCheck(this, Togglebutton);
this.element = element;
this.config = $.extend({}, Default, config);
this.element.after(this.config.template);
}
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
_createClass(Togglebutton, [{
key: 'dispose',
value: function dispose() {
$.removeData(this.element, DATA_KEY);
this.element = null;
this.config = null;
}
// ------------------------------------------------------------------------
// private
// ------------------------------------------------------------------------
// static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
return this.each(function () {
var $element = $(this);
var data = $element.data(DATA_KEY);
if (!data) {
data = new Togglebutton(this, config);
$element.data(DATA_KEY, data);
}
});
}
}]);
return Togglebutton;
})();
$.fn[NAME] = Togglebutton._jQueryInterface;
$.fn[NAME].Constructor = Togglebutton;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Togglebutton._jQueryInterface;
};
return Togglebutton;
})(jQuery);
//# sourceMappingURL=togglebutton.js.map

View File

@ -1 +0,0 @@
{"version":3,"sources":["../src/togglebutton.js"],"names":[],"mappings":";;;;;;;;;AAGA,IAAM,YAAY,GAAG,CAAC,UAAC,CAAC,EAAK;;;;;;;AAO3B,MAAM,IAAI,GAAG,cAAc,CAAA;AAC3B,MAAM,QAAQ,YAAU,IAAI,AAAE,CAAA;AAC9B,MAAM,kBAAkB,GAAG,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAA;;AAErC,MAAM,OAAO,GAAG;AACd,YAAQ,kCAAgC;GACzC,CAAA;;;;;;;;MAOK,YAAY;AAEL,aAFP,YAAY,CAEJ,OAAO,EAAE,MAAM,EAAE;4BAFzB,YAAY;;AAGd,UAAI,CAAC,OAAO,GAAG,OAAO,CAAA;AACtB,UAAI,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;;AAE3C,UAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;KACzC;;;;;;;;iBAPG,YAAY;;aAST,mBAAG;AACR,SAAC,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;AACpC,YAAI,CAAC,OAAO,GAAG,IAAI,CAAA;AACnB,YAAI,CAAC,MAAM,GAAG,IAAI,CAAA;OACnB;;;;;;;;;aAOsB,0BAAC,MAAM,EAAE;AAC9B,eAAO,IAAI,CAAC,IAAI,CAAC,YAAY;AAC3B,cAAI,QAAQ,GAAG,CAAC,CAAC,IAAI,CAAC,CAAA;AACtB,cAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;;AAElC,cAAI,CAAC,IAAI,EAAE;AACT,gBAAI,GAAG,IAAI,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;AACrC,oBAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;WAC9B;SACF,CAAC,CAAA;OACH;;;WA9BG,YAAY;;;AAsClB,GAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,gBAAgB,CAAA;AAC1C,GAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,WAAW,GAAG,YAAY,CAAA;AACrC,GAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,UAAU,GAAG,YAAM;AAC5B,KAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,kBAAkB,CAAA;AAC/B,WAAO,YAAY,CAAC,gBAAgB,CAAA;GACrC,CAAA;;AAED,SAAO,YAAY,CAAA;CAEpB,CAAA,CAAE,MAAM,CAAC,CAAA","file":"togglebutton.js","sourcesContent":["//import Util from './util'\n\n// Togglebutton decorator, to be called after Input\nconst Togglebutton = (($) => {\n\n /**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n const NAME = 'togglebutton'\n const DATA_KEY = `mdb.${NAME}`\n const JQUERY_NO_CONFLICT = $.fn[NAME]\n\n const Default = {\n template: `<span class='toggle'></span>`\n }\n\n /**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\n class Togglebutton {\n\n constructor(element, config) {\n this.element = element\n this.config = $.extend({}, Default, config)\n\n this.element.after(this.config.template)\n }\n\n dispose() {\n $.removeData(this.element, DATA_KEY)\n this.element = null\n this.config = null\n }\n\n // ------------------------------------------------------------------------\n // private\n\n // ------------------------------------------------------------------------\n // static\n static _jQueryInterface(config) {\n return this.each(function () {\n let $element = $(this)\n let data = $element.data(DATA_KEY)\n\n if (!data) {\n data = new Togglebutton(this, config)\n $element.data(DATA_KEY, data)\n }\n })\n }\n }\n\n /**\n * ------------------------------------------------------------------------\n * jQuery\n * ------------------------------------------------------------------------\n */\n $.fn[NAME] = Togglebutton._jQueryInterface\n $.fn[NAME].Constructor = Togglebutton\n $.fn[NAME].noConflict = () => {\n $.fn[NAME] = JQUERY_NO_CONFLICT\n return Togglebutton._jQueryInterface\n }\n\n return Togglebutton\n\n})(jQuery)\n\nexport default Togglebutton\n"]}

103
js/dist/util.js vendored
View File

@ -1,103 +0,0 @@
'use strict';
var Util = (function ($) {
/**
* ------------------------------------------------------------------------
* Private TransitionEnd Helpers
* ------------------------------------------------------------------------
*/
var transitionEnd = false;
var _transitionEndSelector = '';
var TransitionEndEvent = {
WebkitTransition: 'webkitTransitionEnd',
MozTransition: 'transitionend',
OTransition: 'oTransitionEnd otransitionend',
transition: 'transitionend'
};
var ClassName = {
IS_FOCUSED: 'is-focused',
FORM_GROUP: 'form-group'
};
var Selector = {
FORM_GROUP: '.' + ClassName.FORM_GROUP //,
};
function transitionEndTest() {
if (window.QUnit) {
return false;
}
var el = document.createElement('mdb');
for (var _name in TransitionEndEvent) {
if (el.style[_name] !== undefined) {
return TransitionEndEvent[_name]; // { end: TransitionEndEvent[name] }
}
}
return false;
}
function setTransitionEndSupport() {
transitionEnd = transitionEndTest();
// generate a concatenated transition end event selector
for (var _name2 in TransitionEndEvent) {
_transitionEndSelector += ' ' + TransitionEndEvent[_name2];
}
}
/**
* --------------------------------------------------------------------------
* Public Util Api
* --------------------------------------------------------------------------
*/
var Util = {
transitionEndSupported: function transitionEndSupported() {
return transitionEnd;
},
transitionEndSelector: function transitionEndSelector() {
return _transitionEndSelector;
},
isChar: function isChar(event) {
if (typeof event.which === 'undefined') {
return true;
} else if (typeof event.which === 'number' && event.which > 0) {
return !event.ctrlKey && !event.metaKey && !event.altKey && event.which !== 8 && event.which !== 9;
}
return false;
},
addFormGroupFocus: function addFormGroupFocus(formGroup) {
formGroup.addClass(ClassName.IS_FOCUSED);
},
removeFormGroupFocus: function removeFormGroupFocus(formGroup) {
formGroup.removeClass(ClassName.IS_FOCUSED);
},
/**
Find expected form-group
*/
findFormGroup: function findFormGroup(element) {
var fg = element.closest(Selector.FORM_GROUP); // note that form-group may be grandparent in the case of an input-group
if (fg.length === 0) {
$.error('Failed to find form-group for ' + element);
}
return fg;
}
};
setTransitionEndSupport();
return Util;
})(jQuery);
//# sourceMappingURL=util.js.map

1
js/dist/util.js.map vendored
View File

@ -1 +0,0 @@
{"version":3,"sources":["../src/util.js"],"names":[],"mappings":";;AAAA,IAAM,IAAI,GAAG,CAAC,UAAC,CAAC,EAAK;;;;;;;;AAQnB,MAAI,aAAa,GAAG,KAAK,CAAA;AACzB,MAAI,sBAAqB,GAAG,EAAE,CAAA;;AAE9B,MAAM,kBAAkB,GAAG;AACzB,oBAAgB,EAAE,qBAAqB;AACvC,iBAAa,EAAE,eAAe;AAC9B,eAAW,EAAE,+BAA+B;AAC5C,cAAU,EAAE,eAAe;GAC5B,CAAA;;AAED,MAAM,SAAS,GAAG;AAChB,cAAU,EAAE,YAAY;AACxB,cAAU,EAAE,YAAY;GACzB,CAAA;;AAED,MAAM,QAAQ,GAAG;AACf,cAAU,QAAM,SAAS,CAAC,UAAU,AAAE;GACvC,CAAA;;AAED,WAAS,iBAAiB,GAAG;AAC3B,QAAI,MAAM,CAAC,KAAK,EAAE;AAChB,aAAO,KAAK,CAAA;KACb;;AAED,QAAI,EAAE,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;;AAEtC,SAAK,IAAI,KAAI,IAAI,kBAAkB,EAAE;AACnC,UAAI,EAAE,CAAC,KAAK,CAAC,KAAI,CAAC,KAAK,SAAS,EAAE;AAChC,eAAO,kBAAkB,CAAC,KAAI,CAAC,CAAA;OAChC;KACF;;AAED,WAAO,KAAK,CAAA;GACb;;AAED,WAAS,uBAAuB,GAAG;AACjC,iBAAa,GAAG,iBAAiB,EAAE,CAAA;;;AAGnC,SAAK,IAAI,MAAI,IAAI,kBAAkB,EAAE;AACnC,4BAAqB,UAAQ,kBAAkB,CAAC,MAAI,CAAC,AAAE,CAAA;KACxD;GACF;;;;;;;;AAQD,MAAI,IAAI,GAAG;;AAET,0BAAsB,EAAA,kCAAG;AACvB,aAAO,aAAa,CAAA;KACrB;;AAED,yBAAqB,EAAA,iCAAI;AACvB,aAAO,sBAAqB,CAAA;KAC7B;;AAED,UAAM,EAAA,gBAAC,KAAK,EAAE;AACZ,UAAI,OAAO,KAAK,CAAC,KAAK,KAAK,WAAW,EAAE;AACtC,eAAO,IAAI,CAAA;OACZ,MAAM,IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,KAAK,GAAG,CAAC,EAAE;AAC7D,eAAO,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,KAAK,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,KAAK,CAAC,CAAA;OACnG;AACD,aAAO,KAAK,CAAA;KACb;;AAED,qBAAiB,EAAA,2BAAC,SAAS,EAAE;AAC3B,eAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,UAAU,CAAC,CAAA;KACzC;;AAED,wBAAoB,EAAA,8BAAC,SAAS,EAAE;AAC9B,eAAS,CAAC,WAAW,CAAC,SAAS,CAAC,UAAU,CAAC,CAAA;KAC5C;;;;;AAKD,iBAAa,EAAA,uBAAC,OAAO,EAAE;AACrB,UAAI,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;AAC7C,UAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE;AACnB,SAAC,CAAC,KAAK,oCAAkC,OAAO,CAAG,CAAA;OACpD;AACD,aAAO,EAAE,CAAA;KACV;GACF,CAAA;;AAED,yBAAuB,EAAE,CAAA;AACzB,SAAO,IAAI,CAAA;CAEZ,CAAA,CAAE,MAAM,CAAC,CAAA","file":"util.js","sourcesContent":["const Util = (($) => {\n\n /**\n * ------------------------------------------------------------------------\n * Private TransitionEnd Helpers\n * ------------------------------------------------------------------------\n */\n\n let transitionEnd = false\n let transitionEndSelector = ''\n\n const TransitionEndEvent = {\n WebkitTransition: 'webkitTransitionEnd',\n MozTransition: 'transitionend',\n OTransition: 'oTransitionEnd otransitionend',\n transition: 'transitionend'\n }\n\n const ClassName = {\n IS_FOCUSED: 'is-focused',\n FORM_GROUP: 'form-group'\n }\n\n const Selector = {\n FORM_GROUP: `.${ClassName.FORM_GROUP}` //,\n }\n\n function transitionEndTest() {\n if (window.QUnit) {\n return false\n }\n\n let el = document.createElement('mdb')\n\n for (let name in TransitionEndEvent) {\n if (el.style[name] !== undefined) {\n return TransitionEndEvent[name] // { end: TransitionEndEvent[name] }\n }\n }\n\n return false\n }\n\n function setTransitionEndSupport() {\n transitionEnd = transitionEndTest()\n\n // generate a concatenated transition end event selector\n for (let name in TransitionEndEvent) {\n transitionEndSelector += ` ${TransitionEndEvent[name]}`\n }\n }\n\n /**\n * --------------------------------------------------------------------------\n * Public Util Api\n * --------------------------------------------------------------------------\n */\n\n let Util = {\n\n transitionEndSupported() {\n return transitionEnd\n },\n\n transitionEndSelector() {\n return transitionEndSelector\n },\n\n isChar(event) {\n if (typeof event.which === 'undefined') {\n return true\n } else if (typeof event.which === 'number' && event.which > 0) {\n return !event.ctrlKey && !event.metaKey && !event.altKey && event.which !== 8 && event.which !== 9\n }\n return false\n },\n\n addFormGroupFocus(formGroup) {\n formGroup.addClass(ClassName.IS_FOCUSED)\n },\n\n removeFormGroupFocus(formGroup) {\n formGroup.removeClass(ClassName.IS_FOCUSED)\n },\n\n /**\n Find expected form-group\n */\n findFormGroup(element) {\n let fg = element.closest(Selector.FORM_GROUP) // note that form-group may be grandparent in the case of an input-group\n if (fg.length === 0) {\n $.error(`Failed to find form-group for ${element}`)\n }\n return fg\n }\n }\n\n setTransitionEndSupport()\n return Util\n\n})(jQuery)\n\nexport default Util\n"]}

View File

@ -47,7 +47,8 @@ const FileInput = (($) => {
// ------------------------------------------------------------------------
// private
_bindEventListeners() {
this.formGroup.on('focus', () => {
this.formGroup
.on('focus', () => {
Util.addFormGroupFocus(this.formGroup)
})
.on('blur', () => {

View File

@ -84,10 +84,10 @@ const Ripples = (($) => {
// set the location and color each time (even if element is cached)
this.decoratorElement.css({
'left': relX,
'top': relY,
'background-color': this._getRipplesColor()
})
left: relX,
top: relY,
'background-color': this._getRipplesColor()
})
// Make sure the ripple has the styles applied (ugly hack but it works)
this._forceStyleApplication()
@ -137,8 +137,8 @@ const Ripples = (($) => {
// Get the mouse position relative to the ripple wrapper
result = event.pageX - wrapperOffset.left
} else {
// Make sure the user is using only one finger and then get the touch
// position relative to the ripple wrapper
// Make sure the user is using only one finger and then get the touch
// position relative to the ripple wrapper
event = event.originalEvent
if (event.touches.length === 1) {
@ -171,7 +171,7 @@ const Ripples = (($) => {
event = event.originalEvent
if (event.touches.length === 1) {
result = event.touches[0].pageY - containerOffset.top
result = event.touches[0].pageY - containerOffset.top
} else {
result = false
}
@ -215,7 +215,7 @@ const Ripples = (($) => {
if (Util.transitionEndSupported()) {
this.decoratorElement.addClass('ripple-out')
} else {
this.decoratorElement.animate({ 'opacity': 0 }, 100, () => {
this.decoratorElement.animate({opacity: 0}, 100, () => {
this.decoratorElement.triggerStart('transitionend')
})
}
@ -238,18 +238,18 @@ const Ripples = (($) => {
'-ms-transform': `scale(${size})`,
'-moz-transform': `scale(${size})`,
'-webkit-transform': `scale(${size})`,
'transform': `scale(${size})`
transform: `scale(${size})`
})
.addClass('ripple-on')
.data('animating', 'on')
.data('mousedown', 'on')
} else {
this.decoratorElement.animate({
'width': Math.max(this.element.outerWidth(), this.element.outerHeight()) * 2,
'height': Math.max(this.element.outerWidth(), this.element.outerHeight()) * 2,
width: Math.max(this.element.outerWidth(), this.element.outerHeight()) * 2,
height: Math.max(this.element.outerWidth(), this.element.outerHeight()) * 2,
'margin-left': Math.max(this.element.outerWidth(), this.element.outerHeight()) * (-1),
'margin-top': Math.max(this.element.outerWidth(), this.element.outerHeight()) * (-1),
'opacity': 0.2
opacity: 0.2
}, this.config.duration, () => {
this.decoratorElement.triggerStart('transitionend')
})

View File

@ -54,7 +54,7 @@
"grunt-exec": "~0.4.6",
"grunt-html": "~5.0.0",
"grunt-jekyll": "~0.4.2",
"grunt-jscs": "~2.3.0",
"grunt-jscs": "~2.4.0",
"grunt-line-remover": "0.0.2",
"grunt-postcss": "^0.7.0",
"grunt-sass": "^1.0.0",