@materializecss/materialize 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Gruntfile.js +722 -712
- package/LICENSE +21 -21
- package/README.md +91 -91
- package/dist/css/materialize.css +68 -135
- package/dist/css/materialize.min.css +12 -12
- package/dist/js/materialize.js +1112 -1112
- package/dist/js/materialize.min.js +6 -6
- package/extras/noUiSlider/nouislider.css +403 -403
- package/extras/noUiSlider/nouislider.js +2147 -2147
- package/js/anime.min.js +34 -34
- package/js/autocomplete.js +479 -479
- package/js/buttons.js +354 -354
- package/js/cards.js +40 -40
- package/js/carousel.js +732 -732
- package/js/cash.js +960 -960
- package/js/characterCounter.js +136 -136
- package/js/chips.js +486 -486
- package/js/collapsible.js +275 -275
- package/js/component.js +44 -44
- package/js/datepicker.js +983 -983
- package/js/dropdown.js +669 -669
- package/js/forms.js +285 -285
- package/js/global.js +428 -428
- package/js/materialbox.js +453 -453
- package/js/modal.js +382 -382
- package/js/parallax.js +138 -138
- package/js/pushpin.js +148 -148
- package/js/range.js +263 -263
- package/js/scrollspy.js +295 -295
- package/js/select.js +391 -391
- package/js/sidenav.js +583 -583
- package/js/slider.js +359 -359
- package/js/tabs.js +402 -402
- package/js/tapTarget.js +315 -315
- package/js/timepicker.js +712 -712
- package/js/toasts.js +325 -325
- package/js/tooltip.js +320 -320
- package/js/waves.js +614 -614
- package/package.json +87 -84
- package/sass/_style.scss +929 -929
- package/sass/components/_badges.scss +55 -55
- package/sass/components/_buttons.scss +322 -322
- package/sass/components/_cards.scss +195 -195
- package/sass/components/_carousel.scss +90 -90
- package/sass/components/_chips.scss +96 -96
- package/sass/components/_collapsible.scss +91 -91
- package/sass/components/_collection.scss +106 -106
- package/sass/components/_color-classes.scss +32 -32
- package/sass/components/_color-variables.scss +370 -370
- package/sass/components/_datepicker.scss +191 -191
- package/sass/components/_dropdown.scss +84 -84
- package/sass/components/_global.scss +646 -646
- package/sass/components/_grid.scss +158 -158
- package/sass/components/_icons-material-design.scss +5 -5
- package/sass/components/_materialbox.scss +42 -42
- package/sass/components/_modal.scss +97 -97
- package/sass/components/_navbar.scss +208 -208
- package/sass/components/_normalize.scss +447 -447
- package/sass/components/_preloader.scss +334 -334
- package/sass/components/_pulse.scss +34 -34
- package/sass/components/_sidenav.scss +214 -214
- package/sass/components/_slider.scss +91 -91
- package/sass/components/_table_of_contents.scss +33 -33
- package/sass/components/_tabs.scss +99 -99
- package/sass/components/_tapTarget.scss +103 -103
- package/sass/components/_timepicker.scss +199 -199
- package/sass/components/_toast.scss +58 -58
- package/sass/components/_tooltip.scss +32 -32
- package/sass/components/_transitions.scss +12 -12
- package/sass/components/_typography.scss +62 -62
- package/sass/components/_variables.scss +352 -352
- package/sass/components/_waves.scss +187 -187
- package/sass/components/forms/_checkboxes.scss +200 -200
- package/sass/components/forms/_file-input.scss +44 -44
- package/sass/components/forms/_forms.scss +22 -22
- package/sass/components/forms/_input-fields.scss +388 -388
- package/sass/components/forms/_radio-buttons.scss +115 -115
- package/sass/components/forms/_range.scss +161 -161
- package/sass/components/forms/_select.scss +199 -199
- package/sass/components/forms/_switches.scss +91 -91
- package/sass/ghpages-materialize.scss +7 -7
- package/sass/materialize.scss +42 -42
package/js/characterCounter.js
CHANGED
|
@@ -1,136 +1,136 @@
|
|
|
1
|
-
(function($) {
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
let _defaults = {};
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @class
|
|
8
|
-
*
|
|
9
|
-
*/
|
|
10
|
-
class CharacterCounter extends Component {
|
|
11
|
-
/**
|
|
12
|
-
* Construct CharacterCounter instance
|
|
13
|
-
* @constructor
|
|
14
|
-
* @param {Element} el
|
|
15
|
-
* @param {Object} options
|
|
16
|
-
*/
|
|
17
|
-
constructor(el, options) {
|
|
18
|
-
super(CharacterCounter, el, options);
|
|
19
|
-
|
|
20
|
-
this.el.M_CharacterCounter = this;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Options for the character counter
|
|
24
|
-
*/
|
|
25
|
-
this.options = $.extend({}, CharacterCounter.defaults, options);
|
|
26
|
-
|
|
27
|
-
this.isInvalid = false;
|
|
28
|
-
this.isValidLength = false;
|
|
29
|
-
this._setupCounter();
|
|
30
|
-
this._setupEventHandlers();
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
static get defaults() {
|
|
34
|
-
return _defaults;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
static init(els, options) {
|
|
38
|
-
return super.init(this, els, options);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Get Instance
|
|
43
|
-
*/
|
|
44
|
-
static getInstance(el) {
|
|
45
|
-
let domElem = !!el.jquery ? el[0] : el;
|
|
46
|
-
return domElem.M_CharacterCounter;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Teardown component
|
|
51
|
-
*/
|
|
52
|
-
destroy() {
|
|
53
|
-
this._removeEventHandlers();
|
|
54
|
-
this.el.CharacterCounter = undefined;
|
|
55
|
-
this._removeCounter();
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Setup Event Handlers
|
|
60
|
-
*/
|
|
61
|
-
_setupEventHandlers() {
|
|
62
|
-
this._handleUpdateCounterBound = this.updateCounter.bind(this);
|
|
63
|
-
|
|
64
|
-
this.el.addEventListener('focus', this._handleUpdateCounterBound, true);
|
|
65
|
-
this.el.addEventListener('input', this._handleUpdateCounterBound, true);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Remove Event Handlers
|
|
70
|
-
*/
|
|
71
|
-
_removeEventHandlers() {
|
|
72
|
-
this.el.removeEventListener('focus', this._handleUpdateCounterBound, true);
|
|
73
|
-
this.el.removeEventListener('input', this._handleUpdateCounterBound, true);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Setup counter element
|
|
78
|
-
*/
|
|
79
|
-
_setupCounter() {
|
|
80
|
-
this.counterEl = document.createElement('span');
|
|
81
|
-
$(this.counterEl)
|
|
82
|
-
.addClass('character-counter')
|
|
83
|
-
.css({
|
|
84
|
-
float: 'right',
|
|
85
|
-
'font-size': '12px',
|
|
86
|
-
height: 1
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
this.$el.parent().append(this.counterEl);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Remove counter element
|
|
94
|
-
*/
|
|
95
|
-
_removeCounter() {
|
|
96
|
-
$(this.counterEl).remove();
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Update counter
|
|
101
|
-
*/
|
|
102
|
-
updateCounter() {
|
|
103
|
-
let maxLength = +this.$el.attr('data-length'),
|
|
104
|
-
actualLength = this.el.value.length;
|
|
105
|
-
this.isValidLength = actualLength <= maxLength;
|
|
106
|
-
let counterString = actualLength;
|
|
107
|
-
|
|
108
|
-
if (maxLength) {
|
|
109
|
-
counterString += '/' + maxLength;
|
|
110
|
-
this._validateInput();
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
$(this.counterEl).html(counterString);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Add validation classes
|
|
118
|
-
*/
|
|
119
|
-
_validateInput() {
|
|
120
|
-
if (this.isValidLength && this.isInvalid) {
|
|
121
|
-
this.isInvalid = false;
|
|
122
|
-
this.$el.removeClass('invalid');
|
|
123
|
-
} else if (!this.isValidLength && !this.isInvalid) {
|
|
124
|
-
this.isInvalid = true;
|
|
125
|
-
this.$el.removeClass('valid');
|
|
126
|
-
this.$el.addClass('invalid');
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
M.CharacterCounter = CharacterCounter;
|
|
132
|
-
|
|
133
|
-
if (M.jQueryLoaded) {
|
|
134
|
-
M.initializeJqueryWrapper(CharacterCounter, 'characterCounter', 'M_CharacterCounter');
|
|
135
|
-
}
|
|
136
|
-
})(cash);
|
|
1
|
+
(function($) {
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
let _defaults = {};
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @class
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
class CharacterCounter extends Component {
|
|
11
|
+
/**
|
|
12
|
+
* Construct CharacterCounter instance
|
|
13
|
+
* @constructor
|
|
14
|
+
* @param {Element} el
|
|
15
|
+
* @param {Object} options
|
|
16
|
+
*/
|
|
17
|
+
constructor(el, options) {
|
|
18
|
+
super(CharacterCounter, el, options);
|
|
19
|
+
|
|
20
|
+
this.el.M_CharacterCounter = this;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Options for the character counter
|
|
24
|
+
*/
|
|
25
|
+
this.options = $.extend({}, CharacterCounter.defaults, options);
|
|
26
|
+
|
|
27
|
+
this.isInvalid = false;
|
|
28
|
+
this.isValidLength = false;
|
|
29
|
+
this._setupCounter();
|
|
30
|
+
this._setupEventHandlers();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
static get defaults() {
|
|
34
|
+
return _defaults;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
static init(els, options) {
|
|
38
|
+
return super.init(this, els, options);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Get Instance
|
|
43
|
+
*/
|
|
44
|
+
static getInstance(el) {
|
|
45
|
+
let domElem = !!el.jquery ? el[0] : el;
|
|
46
|
+
return domElem.M_CharacterCounter;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Teardown component
|
|
51
|
+
*/
|
|
52
|
+
destroy() {
|
|
53
|
+
this._removeEventHandlers();
|
|
54
|
+
this.el.CharacterCounter = undefined;
|
|
55
|
+
this._removeCounter();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Setup Event Handlers
|
|
60
|
+
*/
|
|
61
|
+
_setupEventHandlers() {
|
|
62
|
+
this._handleUpdateCounterBound = this.updateCounter.bind(this);
|
|
63
|
+
|
|
64
|
+
this.el.addEventListener('focus', this._handleUpdateCounterBound, true);
|
|
65
|
+
this.el.addEventListener('input', this._handleUpdateCounterBound, true);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Remove Event Handlers
|
|
70
|
+
*/
|
|
71
|
+
_removeEventHandlers() {
|
|
72
|
+
this.el.removeEventListener('focus', this._handleUpdateCounterBound, true);
|
|
73
|
+
this.el.removeEventListener('input', this._handleUpdateCounterBound, true);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Setup counter element
|
|
78
|
+
*/
|
|
79
|
+
_setupCounter() {
|
|
80
|
+
this.counterEl = document.createElement('span');
|
|
81
|
+
$(this.counterEl)
|
|
82
|
+
.addClass('character-counter')
|
|
83
|
+
.css({
|
|
84
|
+
float: 'right',
|
|
85
|
+
'font-size': '12px',
|
|
86
|
+
height: 1
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
this.$el.parent().append(this.counterEl);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Remove counter element
|
|
94
|
+
*/
|
|
95
|
+
_removeCounter() {
|
|
96
|
+
$(this.counterEl).remove();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Update counter
|
|
101
|
+
*/
|
|
102
|
+
updateCounter() {
|
|
103
|
+
let maxLength = +this.$el.attr('data-length'),
|
|
104
|
+
actualLength = this.el.value.length;
|
|
105
|
+
this.isValidLength = actualLength <= maxLength;
|
|
106
|
+
let counterString = actualLength;
|
|
107
|
+
|
|
108
|
+
if (maxLength) {
|
|
109
|
+
counterString += '/' + maxLength;
|
|
110
|
+
this._validateInput();
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
$(this.counterEl).html(counterString);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Add validation classes
|
|
118
|
+
*/
|
|
119
|
+
_validateInput() {
|
|
120
|
+
if (this.isValidLength && this.isInvalid) {
|
|
121
|
+
this.isInvalid = false;
|
|
122
|
+
this.$el.removeClass('invalid');
|
|
123
|
+
} else if (!this.isValidLength && !this.isInvalid) {
|
|
124
|
+
this.isInvalid = true;
|
|
125
|
+
this.$el.removeClass('valid');
|
|
126
|
+
this.$el.addClass('invalid');
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
M.CharacterCounter = CharacterCounter;
|
|
132
|
+
|
|
133
|
+
if (M.jQueryLoaded) {
|
|
134
|
+
M.initializeJqueryWrapper(CharacterCounter, 'characterCounter', 'M_CharacterCounter');
|
|
135
|
+
}
|
|
136
|
+
})(cash);
|