uniform-ui 1.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/assets/config/manifest.js +1 -0
- data/lib/assets/javascripts/uniform/checkbox.js +31 -0
- data/lib/assets/javascripts/uniform/component.js +42 -0
- data/lib/assets/javascripts/uniform/dom-helpers.js +136 -0
- data/lib/assets/javascripts/uniform/dropdown.js +149 -0
- data/lib/assets/javascripts/uniform/floating-label.js +54 -0
- data/lib/assets/javascripts/uniform/icons.js +16 -0
- data/lib/assets/javascripts/uniform/modal.js +103 -0
- data/lib/assets/javascripts/uniform/resizer.js +43 -0
- data/lib/assets/javascripts/uniform/select.js +235 -0
- data/lib/assets/javascripts/uniform/tooltip.js +120 -0
- data/lib/assets/javascripts/uniform-es5.js +1 -0
- data/lib/assets/javascripts/uniform-jquery.js +124 -0
- data/lib/assets/javascripts/uniform.js +17 -0
- data/lib/assets/stylesheets/uniform/base.scss +3 -0
- data/lib/assets/stylesheets/uniform/components/alert.scss +72 -0
- data/lib/assets/stylesheets/uniform/components/buttons.scss +219 -0
- data/{vendor → lib}/assets/stylesheets/uniform/components/card.scss +33 -25
- data/lib/assets/stylesheets/uniform/components/container.scss +19 -0
- data/{vendor → lib}/assets/stylesheets/uniform/components/dropdown.scss +8 -4
- data/lib/assets/stylesheets/uniform/components/form/checkbox-collection.scss +103 -0
- data/lib/assets/stylesheets/uniform/components/form/checkbox.scss +58 -0
- data/lib/assets/stylesheets/uniform/components/form/floating-label.scss +64 -0
- data/lib/assets/stylesheets/uniform/components/form/input-group.scss +56 -0
- data/lib/assets/stylesheets/uniform/components/form.scss +143 -0
- data/lib/assets/stylesheets/uniform/components/grid.scss +158 -0
- data/lib/assets/stylesheets/uniform/components/label.scss +26 -0
- data/lib/assets/stylesheets/uniform/components/loaders.scss +80 -0
- data/{vendor → lib}/assets/stylesheets/uniform/components/modal.scss +26 -4
- data/lib/assets/stylesheets/uniform/components/nav.scss +124 -0
- data/lib/assets/stylesheets/uniform/components/row.scss +69 -0
- data/lib/assets/stylesheets/uniform/components/select.scss +122 -0
- data/lib/assets/stylesheets/uniform/components/table.scss +127 -0
- data/lib/assets/stylesheets/uniform/components/thumb.scss +41 -0
- data/lib/assets/stylesheets/uniform/components/tooltip.scss +63 -0
- data/lib/assets/stylesheets/uniform/components.scss +11 -0
- data/{vendor → lib}/assets/stylesheets/uniform/defaults.scss +7 -4
- data/lib/assets/stylesheets/uniform/functions.scss +31 -0
- data/lib/assets/stylesheets/uniform/helpers/border.scss +19 -0
- data/lib/assets/stylesheets/uniform/helpers/colors.scss +23 -0
- data/lib/assets/stylesheets/uniform/helpers/margin.scss +27 -0
- data/lib/assets/stylesheets/uniform/helpers/padding.scss +9 -0
- data/lib/assets/stylesheets/uniform/helpers/position.scss +13 -0
- data/lib/assets/stylesheets/uniform/helpers/sizes.scss +38 -0
- data/{vendor → lib}/assets/stylesheets/uniform/helpers/text.scss +86 -73
- data/lib/assets/stylesheets/uniform/helpers.scss +127 -0
- data/lib/assets/stylesheets/uniform/mixins.scss +116 -0
- data/lib/assets/stylesheets/uniform/print/grid.scss +50 -0
- data/lib/assets/stylesheets/uniform/variables.scss +72 -0
- data/lib/assets/stylesheets/uniform-print.scss +1 -0
- data/lib/assets/stylesheets/uniform.scss +11 -0
- data/lib/uniform/version.rb +3 -0
- data/lib/uniform.rb +15 -0
- metadata +87 -95
- data/.gitignore +0 -2
- data/CHANGELOG.md +0 -27
- data/CNAME +0 -1
- data/Gemfile +0 -8
- data/Gemfile.lock +0 -40
- data/LICENSE +0 -22
- data/README.md +0 -35
- data/Rakefile +0 -74
- data/index.html +0 -251
- data/lib/uniform/rails/engine.rb +0 -8
- data/lib/uniform/rails.rb +0 -6
- data/lib/uniform/ui.rb +0 -1
- data/preview/alerts.html.erb +0 -1
- data/preview/buttons.html.erb +0 -62
- data/preview/cards.html.erb +0 -23
- data/preview/colors.html.erb +0 -22
- data/preview/dropdown.html.erb +0 -1
- data/preview/form.html.erb +0 -233
- data/preview/grid.html.erb +0 -304
- data/preview/helpers.html.erb +0 -225
- data/preview/index.html.erb +0 -77
- data/preview/labels.html.erb +0 -1
- data/preview/layout.html.erb +0 -63
- data/preview/loaders.html.erb +0 -83
- data/preview/modal.html.erb +0 -1
- data/preview/nav.html.erb +0 -77
- data/preview/preview.scss +0 -76
- data/preview/rows.html.erb +0 -36
- data/preview/select.html.erb +0 -1
- data/preview/tables.html.erb +0 -1
- data/preview/tabs.html.erb +0 -17
- data/preview/tiles.html.erb +0 -1
- data/preview/tooltip.erb +0 -1
- data/preview.css +0 -0
- data/site/alerts.html +0 -157
- data/site/alerts.html copy +0 -133
- data/site/buttons.html +0 -286
- data/site/cards.html +0 -177
- data/site/colors.html +0 -275
- data/site/dropdown.html +0 -157
- data/site/dropdown.html copy +0 -141
- data/site/form.html +0 -369
- data/site/grid.html +0 -716
- data/site/helpers.html +0 -1008
- data/site/index.html +0 -251
- data/site/labels.html +0 -157
- data/site/layout.html +0 -313
- data/site/loaders.html +0 -233
- data/site/logo.png +0 -0
- data/site/modal.html +0 -157
- data/site/nav.html +0 -229
- data/site/preview.css +0 -1
- data/site/preview.js +0 -59
- data/site/rows.html +0 -190
- data/site/select.html +0 -157
- data/site/tables.html +0 -157
- data/site/tabs.html +0 -171
- data/site/tiles.html +0 -157
- data/site/tiles.html copy +0 -109
- data/site/tooltip +0 -157
- data/site/uniform.css +0 -1
- data/uniform.gemspec +0 -22
- data/vendor/assets/stylesheets/uniform/base.scss +0 -2
- data/vendor/assets/stylesheets/uniform/components/alert.scss +0 -27
- data/vendor/assets/stylesheets/uniform/components/buttons.scss +0 -212
- data/vendor/assets/stylesheets/uniform/components/form.scss +0 -290
- data/vendor/assets/stylesheets/uniform/components/grid.scss +0 -225
- data/vendor/assets/stylesheets/uniform/components/label.scss +0 -63
- data/vendor/assets/stylesheets/uniform/components/loaders.scss +0 -82
- data/vendor/assets/stylesheets/uniform/components/nav.scss +0 -197
- data/vendor/assets/stylesheets/uniform/components/row.scss +0 -92
- data/vendor/assets/stylesheets/uniform/components/select.scss +0 -98
- data/vendor/assets/stylesheets/uniform/components/table.scss +0 -83
- data/vendor/assets/stylesheets/uniform/components/tabs.scss +0 -45
- data/vendor/assets/stylesheets/uniform/components/tile.scss +0 -20
- data/vendor/assets/stylesheets/uniform/components/tooltip.scss +0 -46
- data/vendor/assets/stylesheets/uniform/helpers/colors.scss +0 -37
- data/vendor/assets/stylesheets/uniform/helpers/margin.scss +0 -44
- data/vendor/assets/stylesheets/uniform/helpers/padding.scss +0 -74
- data/vendor/assets/stylesheets/uniform/helpers/sizes.scss +0 -31
- data/vendor/assets/stylesheets/uniform/helpers.scss +0 -124
- data/vendor/assets/stylesheets/uniform/mixins.scss +0 -77
- data/vendor/assets/stylesheets/uniform/variables.scss +0 -36
- data/vendor/assets/stylesheets/uniform.scss +0 -9
@@ -0,0 +1,235 @@
|
|
1
|
+
import Component from './component';
|
2
|
+
import { check as checkIcon, arrow_down as arrowIcon } from './icons';
|
3
|
+
import * as Helpers from './dom-helpers';
|
4
|
+
|
5
|
+
/*
|
6
|
+
options
|
7
|
+
class: String, appended to uniformSelect-edit button as class
|
8
|
+
limit: int | false - number of options to limit to, or false to not limit
|
9
|
+
showAll: function(select_options) to run if/when "Show All" is clicked
|
10
|
+
label: string, used for mobile menu
|
11
|
+
*/
|
12
|
+
export default class Select extends Component {
|
13
|
+
|
14
|
+
initialize (options = {}) {
|
15
|
+
this.options = {
|
16
|
+
label: false,
|
17
|
+
class: "",
|
18
|
+
showAll: function (select_options){
|
19
|
+
Helpers.removeClass(select_options.querySelectorAll('button.hide'), 'hide');
|
20
|
+
var button = select_options.querySelector('.uniformSelect-show-all');
|
21
|
+
button.parentNode.removeChild(button);
|
22
|
+
|
23
|
+
return false;
|
24
|
+
},
|
25
|
+
limit: 8
|
26
|
+
}
|
27
|
+
|
28
|
+
Object.assign(this.options, this.pick(options, Object.keys(this.options)));
|
29
|
+
|
30
|
+
var showing, lastScrollPosition, select_options;
|
31
|
+
|
32
|
+
this.el.addEventListener('change', this.updateSelect.bind(this));
|
33
|
+
this.el.addEventListener('close', this.hideOptions.bind(this));
|
34
|
+
this.el.addEventListener('revealed', this.resize.bind(this));
|
35
|
+
this.el.uniformSelect = this;
|
36
|
+
|
37
|
+
window.addEventListener('resize', this.resize.bind(this));
|
38
|
+
window.addEventListener('scroll', this.updatePosition.bind(this));
|
39
|
+
document.addEventListener('click', this.outsideClick.bind(this));
|
40
|
+
document.addEventListener('keyup', this.keyup.bind(this));
|
41
|
+
|
42
|
+
this.activeIcon = document.createElement('span');
|
43
|
+
Helpers.addClass(this.activeIcon, 'uniformSelect-option-icon');
|
44
|
+
this.activeIcon.innerHTML = checkIcon;
|
45
|
+
}
|
46
|
+
|
47
|
+
outsideClick (e) {
|
48
|
+
if (!this.showing) return;
|
49
|
+
if (e.target === this.select_options) return;
|
50
|
+
if (this.container.contains(e.target)) return;
|
51
|
+
if (this.select_options.contains(e.target)) return;
|
52
|
+
this.hideOptions();
|
53
|
+
}
|
54
|
+
|
55
|
+
keyup (e) {
|
56
|
+
if(e.which === 27) this.hideOptions();
|
57
|
+
}
|
58
|
+
|
59
|
+
render () {
|
60
|
+
this.container = document.createElement('div');
|
61
|
+
Helpers.addClass(this.container, 'uniformSelect-container');
|
62
|
+
|
63
|
+
this.edit_button = Helpers.createElement(`<button type='button' class='uniformSelect-edit uniformInput outline block ${this.options.class}'><span class="text-js"></span><span class="uniformSelect-edit-icon">${arrowIcon}</span></button>`);
|
64
|
+
this.container.appendChild(this.edit_button);
|
65
|
+
|
66
|
+
if (this.el.name) {
|
67
|
+
Helpers.addClass(this.container, this.name.toLowerCase().replace(/[^a-z0-9\-_]+/g, '-'));
|
68
|
+
}
|
69
|
+
this.el.style.display = "none";
|
70
|
+
this.el.insertAdjacentElement('beforebegin', this.container);
|
71
|
+
this.updateSelect();
|
72
|
+
this.resize();
|
73
|
+
|
74
|
+
this.edit_button.addEventListener('click', this.showOptions.bind(this));
|
75
|
+
}
|
76
|
+
|
77
|
+
resize () {
|
78
|
+
// to keep button from extending beyond available width
|
79
|
+
var children = [];
|
80
|
+
var childrenCount = this.edit_button.children.length;
|
81
|
+
for(var i = 0; i < childrenCount; i++){
|
82
|
+
children.push(this.edit_button.children[0]);
|
83
|
+
this.edit_button.children[0].parentNode.removeChild(this.edit_button.children[0]);
|
84
|
+
}
|
85
|
+
|
86
|
+
this.edit_button.innerHTML = '';
|
87
|
+
this.edit_button.style.width = "auto";
|
88
|
+
this.edit_button.style.width = this.container.offsetWidth + "px";
|
89
|
+
|
90
|
+
Helpers.each(children, function(child){
|
91
|
+
this.edit_button.appendChild(child);
|
92
|
+
}.bind(this));
|
93
|
+
|
94
|
+
if(typeof this.select_options === "undefined") return;
|
95
|
+
if(window.innerWidth < 720) return;
|
96
|
+
|
97
|
+
this.select_options.style.position = 'absolute';
|
98
|
+
this.select_options.style.top = Helpers.offset(this.container).top + this.container.offsetHeight + "px";
|
99
|
+
this.select_options.style.left = Helpers.offset(this.container).left + 1 + "px";
|
100
|
+
this.select_options.style.minWidth = this.container.offsetWidth - 1 + "px";
|
101
|
+
}
|
102
|
+
|
103
|
+
renderOptions () {
|
104
|
+
this.select_options = Helpers.createElement("<div class='uniformSelect-options'>");
|
105
|
+
if (this.options.label) {
|
106
|
+
this.select_options.append(`<div class="uniformSelect-label hide show-sm margin-bottom text-bold">${this.options.label}</div>`)
|
107
|
+
}
|
108
|
+
if (this.el.name) {
|
109
|
+
Helpers.addClass(this.select_options, this.el.name.toLowerCase().replace(/[^a-z0-9\-_]+/g, '-'));
|
110
|
+
}
|
111
|
+
this.select_options.style.fontSize = Helpers.css(this.el, 'font-size');
|
112
|
+
this.select_options.style.display = 'none';
|
113
|
+
document.body.appendChild(this.select_options);
|
114
|
+
|
115
|
+
Helpers.each(this.el.querySelectorAll('option'), function(el, index){
|
116
|
+
var button = Helpers.createElement("<button type='button' class='uniformSelect-option block outline text-left'>");
|
117
|
+
button.option = el;
|
118
|
+
button.textContent = el.textContent;
|
119
|
+
button.value = el.value;
|
120
|
+
if (button.textContent == "") button.innerHTML("<span class='text-italic text-muted'>None</span>");
|
121
|
+
if(el.selected){
|
122
|
+
Helpers.addClass(button, 'active');
|
123
|
+
button.append(this.activeIcon.cloneNode(true));
|
124
|
+
} else if (this.options.limit && index > this.options.limit) {
|
125
|
+
Helpers.addClass(button, 'hide');
|
126
|
+
}
|
127
|
+
this.select_options.append(button);
|
128
|
+
button.addEventListener('click', this.selectOption.bind(this));
|
129
|
+
}.bind(this));
|
130
|
+
|
131
|
+
var actions_el = Helpers.createElement('<div class="uniformSelect-options-actions"></div>');
|
132
|
+
if (this.options.limit && this.el.querySelectorAll('option').length > this.options.limit) {
|
133
|
+
var show_all_button = Helpers.createElement("<button type='button' class='uniformSelect-show-all outline blue' style='display: block; border: none'>Show All</button>");
|
134
|
+
show_all_button.addEventListener('click', function(e){
|
135
|
+
Helpers.trigger(this.el, 'show_all');
|
136
|
+
if (this.options.showAll) this.options.showAll(this.select_options);
|
137
|
+
e.preventDefault();
|
138
|
+
e.stopPropagation();
|
139
|
+
}.bind(this));
|
140
|
+
actions_el.appendChild(show_all_button);
|
141
|
+
}
|
142
|
+
if (this.el.multiple) {
|
143
|
+
var done_button = Helpers.createElement("<button type='button' class='uniformSelect-done block outline blue'>Done</button>");
|
144
|
+
done_button.addEventListener('click', this.hideOptions.bind(this));
|
145
|
+
actions_el.appendChild(done_button);
|
146
|
+
}
|
147
|
+
if (!Helpers.is_empty(actions_el)) {
|
148
|
+
this.select_options.appendChild(actions_el);
|
149
|
+
}
|
150
|
+
|
151
|
+
Helpers.trigger(this.el, 'rendered');
|
152
|
+
}
|
153
|
+
|
154
|
+
hideOptions () {
|
155
|
+
if(typeof this.select_options === "undefined") return;
|
156
|
+
this.showing = false;
|
157
|
+
this.select_options.style.display = "none";
|
158
|
+
Helpers.removeClass(this.select_options, 'fixed');
|
159
|
+
Helpers.removeClass(this.edit_button, 'active');
|
160
|
+
Helpers.removeClass(document.body, 'uniformModal-hideBody');
|
161
|
+
if(this.lastScrollPosition && window.innerWidth < 720) window.scrollTo(0, this.lastScrollPosition);
|
162
|
+
Helpers.trigger(this.el, 'hidden:options');
|
163
|
+
}
|
164
|
+
|
165
|
+
showOptions() {
|
166
|
+
if (this.showing){
|
167
|
+
this.hideOptions();
|
168
|
+
return false;
|
169
|
+
}
|
170
|
+
this.showing = true;
|
171
|
+
if(!this.select_options) this.renderOptions();
|
172
|
+
this.resize();
|
173
|
+
this.select_options.style.display = "block";
|
174
|
+
Helpers.addClass(this.edit_button, 'active');
|
175
|
+
this.lastScrollPosition = window.scrollY;
|
176
|
+
this.updatePosition();
|
177
|
+
Helpers.addClass(document.body, 'uniformModal-hideBody');
|
178
|
+
}
|
179
|
+
|
180
|
+
selectOption(e) {
|
181
|
+
if (!this.el.multiple) {
|
182
|
+
Helpers.each(Helpers.filter(this.el.querySelectorAll("option"), function(el){
|
183
|
+
return el.selected;
|
184
|
+
}), function (child) {
|
185
|
+
child.selected = false;
|
186
|
+
});
|
187
|
+
Helpers.each(this.select_options.querySelectorAll('.uniformSelect-option.active .uniformSelect-option-icon'), Helpers.remove);
|
188
|
+
Helpers.removeClass(this.select_options.querySelectorAll('.uniformSelect-option.active'), 'active');
|
189
|
+
}
|
190
|
+
Helpers.toggleClass(e.currentTarget, 'active');
|
191
|
+
e.currentTarget.option.selected = Helpers.hasClass(e.currentTarget, 'active');
|
192
|
+
if (Helpers.hasClass(e.currentTarget, 'active')) {
|
193
|
+
e.currentTarget.append(this.activeIcon.cloneNode(true));
|
194
|
+
} else {
|
195
|
+
Helpers.each(e.currentTarget.querySelectorAll('.uniformSelect-option-icon'), Helpers.remove);
|
196
|
+
}
|
197
|
+
Helpers.trigger(this.el, 'change');
|
198
|
+
}
|
199
|
+
|
200
|
+
updateSelect () {
|
201
|
+
if (!this.el.multiple) this.hideOptions();
|
202
|
+
var value = Helpers.map(Helpers.filter(this.el.querySelectorAll("option"), function(el){
|
203
|
+
return el.selected;
|
204
|
+
}), function(el){
|
205
|
+
return el.textContent;
|
206
|
+
}).join(", ");
|
207
|
+
|
208
|
+
if (value == "") value = " ";
|
209
|
+
this.edit_button.querySelector('.text-js').innerHTML = value;
|
210
|
+
}
|
211
|
+
|
212
|
+
updatePosition () {
|
213
|
+
if(!this.select_options) return;
|
214
|
+
|
215
|
+
var fixedParents = Helpers.filter(Helpers.ancestors(this.container), function (el){
|
216
|
+
return Helpers.css(el, 'position') == 'fixed';
|
217
|
+
});
|
218
|
+
|
219
|
+
if (Helpers.hasClass(this.select_options, 'fixed')) {
|
220
|
+
if (fixedParents.length == 0) {
|
221
|
+
this.select_options.style.position = 'absolute';
|
222
|
+
this.select_options.style.top = Helpers.offset(this.container).top + this.container.offsetHeight + "px";
|
223
|
+
Helpers.removeClass(this.select_options, 'fixed');
|
224
|
+
}
|
225
|
+
} else if(fixedParents.length > 0) {
|
226
|
+
if (window.innerWidth > 720) {
|
227
|
+
this.lastScrollPosition = false;
|
228
|
+
}
|
229
|
+
this.select_options.style.position = 'fixed';
|
230
|
+
this.select_options.style.top = Helpers.offset(this.container).top + this.container.offsetHeight + "px";
|
231
|
+
this.select_options.style.left = Helpers.offset(this.container).left + "px";
|
232
|
+
Helpers.addClass(this.select_options, 'fixed');
|
233
|
+
}
|
234
|
+
}
|
235
|
+
}
|
@@ -0,0 +1,120 @@
|
|
1
|
+
import Component from './component';
|
2
|
+
import * as Helpers from './dom-helpers';
|
3
|
+
|
4
|
+
/*
|
5
|
+
message: html
|
6
|
+
align: top|bottom (default: top)
|
7
|
+
|
8
|
+
methods
|
9
|
+
------
|
10
|
+
enable
|
11
|
+
disable
|
12
|
+
hide
|
13
|
+
show
|
14
|
+
*/
|
15
|
+
export default class Tooltip extends Component {
|
16
|
+
initialize (options) {
|
17
|
+
options = options || {}
|
18
|
+
this.options = {
|
19
|
+
align: 'top',
|
20
|
+
};
|
21
|
+
Object.assign(this.options, this.pick(options, Object.keys(this.options)));
|
22
|
+
|
23
|
+
this.enabled = true;
|
24
|
+
this.message = options.message;
|
25
|
+
options.el.tooltip = this;
|
26
|
+
|
27
|
+
this.el.addEventListener('mouseenter', this.show.bind(this));
|
28
|
+
this.el.addEventListener('mouseleave', this.hide.bind(this));
|
29
|
+
}
|
30
|
+
|
31
|
+
render () {
|
32
|
+
this.popup = Helpers.createElement('<div class="uniformTooltip-popup">' + this.message + '</div>');
|
33
|
+
this.popup.insertBefore(Helpers.createElement("<div class='uniformTooltip-pointer'></div>"), this.popup.firstChild);
|
34
|
+
this.el.appendChild(this.popup);
|
35
|
+
if (this.message.length > 100) {
|
36
|
+
this.popup.style.minWidth = "200px";
|
37
|
+
} else {
|
38
|
+
this.popup.style.whiteSpace = "nowrap";
|
39
|
+
}
|
40
|
+
|
41
|
+
if (this.popup.offsetWidth + Helpers.offset(this.popup).left > window.innerWidth) {
|
42
|
+
this.popup.style.left = window.innerWidth - this.popup.offsetWidth - Helpers.offset(this.popup).left + "px"
|
43
|
+
}
|
44
|
+
|
45
|
+
this.popup.style.display = "block";
|
46
|
+
if (this.options.align == "bottom" || Helpers.offset(this.popup).top < 0) {
|
47
|
+
Helpers.addClass(this.popup, '-align-bottom');
|
48
|
+
}
|
49
|
+
this.popup.style.display = 'none';
|
50
|
+
|
51
|
+
return this;
|
52
|
+
}
|
53
|
+
|
54
|
+
remove () {
|
55
|
+
this.el.parentNode.removeChild(this.el);
|
56
|
+
}
|
57
|
+
|
58
|
+
show () {
|
59
|
+
if(!this.popup) this.render();
|
60
|
+
if(!this.enabled) return;
|
61
|
+
|
62
|
+
if (this.hiding) return this.show_after_hide = true;
|
63
|
+
if (this.showing || this.shown) return;
|
64
|
+
this.popup.style.display = 'block';
|
65
|
+
this.showing = true;
|
66
|
+
this.hidden = false;
|
67
|
+
|
68
|
+
var endTransition = function (e) {
|
69
|
+
this.trigger('shown');
|
70
|
+
this.showing = false;
|
71
|
+
this.shown = true;
|
72
|
+
if (this.hide_after_show) this.hide();
|
73
|
+
this.hide_after_show = false;
|
74
|
+
}.bind(this);
|
75
|
+
|
76
|
+
Helpers.once(this.popup, 'transitionend', endTransition);
|
77
|
+
Helpers.once(this.popup, 'msTransitionEnd', endTransition);
|
78
|
+
Helpers.once(this.popup, 'oTransitionEnd', endTransition);
|
79
|
+
|
80
|
+
if (Helpers.offset(this.popup).left < 0) this.popup.style.left = "0";
|
81
|
+
Helpers.addClass(this.el, 'active');
|
82
|
+
|
83
|
+
// TODO remove timeout usage... Not sure why this is necessary, but doesn't do css animation if not delayed.
|
84
|
+
setTimeout(function(){
|
85
|
+
Helpers.addClass(this.popup, '-reveal');
|
86
|
+
}.bind(this), 1);
|
87
|
+
}
|
88
|
+
|
89
|
+
hide () {
|
90
|
+
if (this.showing) return this. hide_after_show = true;
|
91
|
+
if (this.hiding || this.hidden) return;
|
92
|
+
this.hiding = true;
|
93
|
+
this.shown = false;
|
94
|
+
|
95
|
+
var endTransition = function (e) {
|
96
|
+
this.trigger('hidden');
|
97
|
+
Helpers.removeClass(this.el, 'active');
|
98
|
+
this.popup.style.display = 'none';
|
99
|
+
this.hiding = false;
|
100
|
+
this.hidden = true;
|
101
|
+
if (this.show_after_hide) this.show();
|
102
|
+
this.show_after_hide = false;
|
103
|
+
}.bind(this);
|
104
|
+
|
105
|
+
Helpers.once(this.popup, 'transitionend', endTransition);
|
106
|
+
Helpers.once(this.popup, 'msTransitionEnd', endTransition);
|
107
|
+
Helpers.once(this.popup, 'oTransitionEnd', endTransition);
|
108
|
+
|
109
|
+
Helpers.removeClass(this.popup, '-reveal');
|
110
|
+
}
|
111
|
+
|
112
|
+
disable () {
|
113
|
+
this.enabled = false;
|
114
|
+
}
|
115
|
+
|
116
|
+
enabled () {
|
117
|
+
this.enabled = true;
|
118
|
+
}
|
119
|
+
|
120
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(){"use strict";function t(t,e){return t(e={exports:{}},e.exports),e.exports}var v=t(function(t){var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)}),y=t(function(t){var e=t.exports={version:"2.5.5"};"number"==typeof __e&&(__e=e)}),m=(y.version,function(n,o,t){if(function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!")}(n),void 0===o)return n;switch(t){case 1:return function(t){return n.call(o,t)};case 2:return function(t,e){return n.call(o,t,e)};case 3:return function(t,e,i){return n.call(o,t,e,i)}}return function(){return n.apply(o,arguments)}}),h=function(t){return"object"==typeof t?null!==t:"function"==typeof t},r=function(t){if(!h(t))throw TypeError(t+" is not an object!");return t},c=function(t){try{return!!t()}catch(t){return!0}},n=!c(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),e=v.document,i=h(e)&&h(e.createElement),o=function(t){return i?e.createElement(t):{}},s=!n&&!c(function(){return 7!=Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a}),l=function(t,e){if(!h(t))return t;var i,n;if(e&&"function"==typeof(i=t.toString)&&!h(n=i.call(t)))return n;if("function"==typeof(i=t.valueOf)&&!h(n=i.call(t)))return n;if(!e&&"function"==typeof(i=t.toString)&&!h(n=i.call(t)))return n;throw TypeError("Can't convert object to primitive value")},a=Object.defineProperty,u={f:n?Object.defineProperty:function(t,e,i){if(r(t),e=l(e,!0),r(i),s)try{return a(t,e,i)}catch(t){}if("get"in i||"set"in i)throw TypeError("Accessors not supported!");return"value"in i&&(t[e]=i.value),t}},k=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},S=n?function(t,e,i){return u.f(t,e,k(1,i))}:function(t,e,i){return t[e]=i,t},d={}.hasOwnProperty,b=function(t,e){return d.call(t,e)},w="prototype",g=function(t,e,i){var n,o,s,r=t&g.F,l=t&g.G,h=t&g.S,c=t&g.P,a=t&g.B,u=t&g.W,d=l?y:y[e]||(y[e]={}),p=d[w],f=l?v:h?v[e]:(v[e]||{})[w];for(n in l&&(i=e),i)(o=!r&&f&&void 0!==f[n])&&b(d,n)||(s=o?f[n]:i[n],d[n]=l&&"function"!=typeof f[n]?i[n]:a&&o?m(s,v):u&&f[n]==s?function(n){var t=function(t,e,i){if(this instanceof n){switch(arguments.length){case 0:return new n;case 1:return new n(t);case 2:return new n(t,e)}return new n(t,e,i)}return n.apply(this,arguments)};return t[w]=n[w],t}(s):c&&"function"==typeof s?m(Function.call,s):s,c&&((d.virtual||(d.virtual={}))[n]=s,t&g.R&&p&&!p[n]&&S(p,n,s)))};g.F=1,g.G=2,g.S=4,g.P=8,g.B=16,g.W=32,g.U=64,g.R=128;var p,L=g,f={}.toString,_=function(t){return f.call(t).slice(8,-1)},E=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==_(t)?t.split(""):Object(t)},O=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},x=function(t){return E(O(t))},C=Math.ceil,T=Math.floor,j=function(t){return isNaN(t=+t)?0:(0<t?T:C)(t)},z=Math.min,M=Math.max,P=Math.min,N="__core-js_shared__",A=v[N]||(v[N]={}),H=function(t){return A[t]||(A[t]={})},W=0,q=Math.random(),F=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++W+q).toString(36))},I=H("keys"),B=function(t){return I[t]||(I[t]=F(t))},R=(p=!1,function(t,e,i){var n,o,s,r,l=x(t),h=0<(n=l.length)?z(j(n),9007199254740991):0,c=(s=h,(o=j(o=i))<0?M(o+s,0):P(o,s));if(p&&e!=e){for(;c<h;)if((r=l[c++])!=r)return!0}else for(;c<h;c++)if((p||c in l)&&l[c]===e)return p||c||0;return!p&&-1}),D=B("IE_PROTO"),G=function(t,e){var i,n=x(t),o=0,s=[];for(i in n)i!=D&&b(n,i)&&s.push(i);for(;e.length>o;)b(n,i=e[o++])&&(~R(s,i)||s.push(i));return s},Y="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),V=Object.keys||function(t){return G(t,Y)},K={f:Object.getOwnPropertySymbols},J={f:{}.propertyIsEnumerable},Q=function(t){return Object(O(t))},U=Object.assign,X=!U||c(function(){var t={},e={},i=Symbol(),n="abcdefghijklmnopqrst";return t[i]=7,n.split("").forEach(function(t){e[t]=t}),7!=U({},t)[i]||Object.keys(U({},e)).join("")!=n})?function(t,e){for(var i=Q(t),n=arguments.length,o=1,s=K.f,r=J.f;o<n;)for(var l,h=E(arguments[o++]),c=s?V(h).concat(s(h)):V(h),a=c.length,u=0;u<a;)r.call(h,l=c[u++])&&(i[l]=h[l]);return i}:U;L(L.S+L.F,"Object",{assign:X});var Z=y.Object.assign,tt=function(t,e){var i=(y.Object||{})[t]||Object[t],n={};n[t]=e(i),L(L.S+L.F*c(function(){i(1)}),"Object",n)};tt("keys",function(){return function(t){return V(Q(t))}});var et=y.Object.keys,it=B("IE_PROTO"),nt=Object.prototype,ot=Object.getPrototypeOf||function(t){return t=Q(t),b(t,it)?t[it]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?nt:null};tt("getPrototypeOf",function(){return function(t){return ot(Q(t))}});var st=y.Object.getPrototypeOf;function rt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}L(L.S+L.F*!n,"Object",{defineProperty:u.f});var lt=y.Object,ht=function(t,e,i){return lt.defineProperty(t,e,i)};function ct(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),ht(t,n.key,n)}}function at(t,e,i){return e&&ct(t.prototype,e),i&&ct(t,i),t}var ut=S,dt=n?Object.defineProperties:function(t,e){r(t);for(var i,n=V(e),o=n.length,s=0;s<o;)u.f(t,i=n[s++],e[i]);return t},pt=v.document,ft=pt&&pt.documentElement,vt=B("IE_PROTO"),yt=function(){},mt="prototype",bt=function(){var t,e=o("iframe"),i=Y.length;for(e.style.display="none",ft.appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),bt=t.F;i--;)delete bt[mt][Y[i]];return bt()},wt=Object.create||function(t,e){var i;return null!==t?(yt[mt]=r(t),i=new yt,yt[mt]=null,i[vt]=t):i=bt(),void 0===e?i:dt(i,e)},gt=t(function(t){var e=H("wks"),i=v.Symbol,n="function"==typeof i;(t.exports=function(t){return e[t]||(e[t]=n&&i[t]||(n?i:F)("Symbol."+t))}).store=e}),_t=u.f,kt=gt("toStringTag"),St=function(t,e,i){t&&!b(t=i?t:t.prototype,kt)&&_t(t,kt,{configurable:!0,value:e})},Lt={};S(Lt,gt("iterator"),function(){return this});var Et,Ot=gt("iterator"),xt=!([].keys&&"next"in[].keys()),Ct="values",Tt=function(t,e,i,n,o,s,r){var l,h,c;h=e,c=n,(l=i).prototype=wt(Lt,{next:k(1,c)}),St(l,h+" Iterator");var a,u,d,p=function(t){if(!xt&&t in m)return m[t];switch(t){case"keys":case Ct:return function(){return new i(this,t)}}return function(){return new i(this,t)}},f=e+" Iterator",v=o==Ct,y=!1,m=t.prototype,b=m[Ot]||m["@@iterator"]||o&&m[o],w=b||p(o),g=o?v?p("entries"):w:void 0,_="Array"==e&&m.entries||b;if(_&&(d=ot(_.call(new t)))!==Object.prototype&&d.next&&St(d,f,!0),v&&b&&b.name!==Ct&&(y=!0,w=function(){return b.call(this)}),r&&(xt||y||!m[Ot])&&S(m,Ot,w),o)if(a={values:v?w:p(Ct),keys:s?w:p("keys"),entries:g},r)for(u in a)u in m||ut(m,u,a[u]);else L(L.P+L.F*(xt||y),e,a);return a},jt=(Et=!0,function(t,e){var i,n,o=String(O(t)),s=j(e),r=o.length;return s<0||r<=s?Et?"":void 0:(i=o.charCodeAt(s))<55296||56319<i||s+1===r||(n=o.charCodeAt(s+1))<56320||57343<n?Et?o.charAt(s):i:Et?o.slice(s,s+2):n-56320+(i-55296<<10)+65536});Tt(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,e=this._t,i=this._i;return i>=e.length?{value:void 0,done:!0}:(t=jt(e,i),this._i+=t.length,{value:t,done:!1})});for(var zt=function(t,e){return{value:e,done:!!t}},Mt=(Tt(Array,"Array",function(t,e){this._t=x(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,i=this._i++;return!t||i>=t.length?(this._t=void 0,zt(1)):zt(0,"keys"==e?i:"values"==e?t[i]:[i,t[i]])},"values"),gt("toStringTag")),Pt="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),Nt=0;Nt<Pt.length;Nt++){var At=Pt[Nt],Ht=v[At],Wt=Ht&&Ht.prototype;Wt&&!Wt[Mt]&&S(Wt,Mt,At)}var qt={f:gt},Ft=qt.f("iterator"),It=t(function(t){var i=F("meta"),e=u.f,n=0,o=Object.isExtensible||function(){return!0},s=!c(function(){return o(Object.preventExtensions({}))}),r=function(t){e(t,i,{value:{i:"O"+ ++n,w:{}}})},l=t.exports={KEY:i,NEED:!1,fastKey:function(t,e){if(!h(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!b(t,i)){if(!o(t))return"F";if(!e)return"E";r(t)}return t[i].i},getWeak:function(t,e){if(!b(t,i)){if(!o(t))return!0;if(!e)return!1;r(t)}return t[i].w},onFreeze:function(t){return s&&l.NEED&&o(t)&&!b(t,i)&&r(t),t}}}),$t=(It.KEY,It.NEED,It.fastKey,It.getWeak,It.onFreeze,u.f),Bt=function(t){var e=y.Symbol||(y.Symbol={});"_"==t.charAt(0)||t in e||$t(e,t,{value:qt.f(t)})},Rt=Array.isArray||function(t){return"Array"==_(t)},Dt=Y.concat("length","prototype"),Gt={f:Object.getOwnPropertyNames||function(t){return G(t,Dt)}},Yt=Gt.f,Vt={}.toString,Kt="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],Jt={f:function(t){return Kt&&"[object Window]"==Vt.call(t)?function(t){try{return Yt(t)}catch(t){return Kt.slice()}}(t):Yt(x(t))}},Qt=Object.getOwnPropertyDescriptor,Ut={f:n?Qt:function(t,e){if(t=x(t),e=l(e,!0),s)try{return Qt(t,e)}catch(t){}if(b(t,e))return k(!J.f.call(t,e),t[e])}},Xt=It.KEY,Zt=Ut.f,te=u.f,ee=Jt.f,ie=v.Symbol,ne=v.JSON,oe=ne&&ne.stringify,se="prototype",re=gt("_hidden"),le=gt("toPrimitive"),he={}.propertyIsEnumerable,ce=H("symbol-registry"),ae=H("symbols"),ue=H("op-symbols"),de=Object[se],pe="function"==typeof ie,fe=v.QObject,ve=!fe||!fe[se]||!fe[se].findChild,ye=n&&c(function(){return 7!=wt(te({},"a",{get:function(){return te(this,"a",{value:7}).a}})).a})?function(t,e,i){var n=Zt(de,e);n&&delete de[e],te(t,e,i),n&&t!==de&&te(de,e,n)}:te,me=function(t){var e=ae[t]=wt(ie[se]);return e._k=t,e},be=pe&&"symbol"==typeof ie.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof ie},we=function(t,e,i){return t===de&&we(ue,e,i),r(t),e=l(e,!0),r(i),b(ae,e)?(i.enumerable?(b(t,re)&&t[re][e]&&(t[re][e]=!1),i=wt(i,{enumerable:k(0,!1)})):(b(t,re)||te(t,re,k(1,{})),t[re][e]=!0),ye(t,e,i)):te(t,e,i)},ge=function(t,e){r(t);for(var i,n=function(t){var e=V(t),i=K.f;if(i)for(var n,o=i(t),s=J.f,r=0;o.length>r;)s.call(t,n=o[r++])&&e.push(n);return e}(e=x(e)),o=0,s=n.length;o<s;)we(t,i=n[o++],e[i]);return t},_e=function(t){var e=he.call(this,t=l(t,!0));return!(this===de&&b(ae,t)&&!b(ue,t))&&(!(e||!b(this,t)||!b(ae,t)||b(this,re)&&this[re][t])||e)},ke=function(t,e){if(t=x(t),e=l(e,!0),t!==de||!b(ae,e)||b(ue,e)){var i=Zt(t,e);return!i||!b(ae,e)||b(t,re)&&t[re][e]||(i.enumerable=!0),i}},Se=function(t){for(var e,i=ee(x(t)),n=[],o=0;i.length>o;)b(ae,e=i[o++])||e==re||e==Xt||n.push(e);return n},Le=function(t){for(var e,i=t===de,n=ee(i?ue:x(t)),o=[],s=0;n.length>s;)!b(ae,e=n[s++])||i&&!b(de,e)||o.push(ae[e]);return o};pe||(ut((ie=function(){if(this instanceof ie)throw TypeError("Symbol is not a constructor!");var e=F(0<arguments.length?arguments[0]:void 0),i=function(t){this===de&&i.call(ue,t),b(this,re)&&b(this[re],e)&&(this[re][e]=!1),ye(this,e,k(1,t))};return n&&ve&&ye(de,e,{configurable:!0,set:i}),me(e)})[se],"toString",function(){return this._k}),Ut.f=ke,u.f=we,Gt.f=Jt.f=Se,J.f=_e,K.f=Le,qt.f=function(t){return me(gt(t))}),L(L.G+L.W+L.F*!pe,{Symbol:ie});for(var Ee="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),Oe=0;Ee.length>Oe;)gt(Ee[Oe++]);for(var xe=V(gt.store),Ce=0;xe.length>Ce;)Bt(xe[Ce++]);L(L.S+L.F*!pe,"Symbol",{for:function(t){return b(ce,t+="")?ce[t]:ce[t]=ie(t)},keyFor:function(t){if(!be(t))throw TypeError(t+" is not a symbol!");for(var e in ce)if(ce[e]===t)return e},useSetter:function(){ve=!0},useSimple:function(){ve=!1}}),L(L.S+L.F*!pe,"Object",{create:function(t,e){return void 0===e?wt(t):ge(wt(t),e)},defineProperty:we,defineProperties:ge,getOwnPropertyDescriptor:ke,getOwnPropertyNames:Se,getOwnPropertySymbols:Le}),ne&&L(L.S+L.F*(!pe||c(function(){var t=ie();return"[null]"!=oe([t])||"{}"!=oe({a:t})||"{}"!=oe(Object(t))})),"JSON",{stringify:function(t){for(var e,i,n=[t],o=1;arguments.length>o;)n.push(arguments[o++]);if(i=e=n[1],(h(e)||void 0!==t)&&!be(t))return Rt(e)||(e=function(t,e){if("function"==typeof i&&(e=i.call(this,t,e)),!be(e))return e}),n[1]=e,oe.apply(ne,n)}}),ie[se][le]||S(ie[se],le,ie[se].valueOf),St(ie,"Symbol"),St(Math,"Math",!0),St(v.JSON,"JSON",!0),Bt("asyncIterator"),Bt("observable");var Te=y.Symbol;function je(t){return(je="function"==typeof Te&&"symbol"==typeof Ft?function(t){return typeof t}:function(t){return t&&"function"==typeof Te&&t.constructor===Te&&t!==Te.prototype?"symbol":typeof t})(t)}function ze(t){return(ze="function"==typeof Te&&"symbol"===je(Ft)?function(t){return je(t)}:function(t){return t&&"function"==typeof Te&&t.constructor===Te&&t!==Te.prototype?"symbol":je(t)})(t)}function Me(t,e){return!e||"object"!==ze(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}var Pe=function(t,e){if(r(t),!h(e)&&null!==e)throw TypeError(e+": can't set as prototype!")},Ne={set:Object.setPrototypeOf||("__proto__"in{}?function(t,i,n){try{(n=m(Function.call,Ut.f(Object.prototype,"__proto__").set,2))(t,[]),i=!(t instanceof Array)}catch(t){i=!0}return function(t,e){return Pe(t,e),i?t.__proto__=e:n(t,e),t}}({},!1):void 0),check:Pe};L(L.S,"Object",{setPrototypeOf:Ne.set});var Ae=y.Object.setPrototypeOf;L(L.S,"Object",{create:wt});var He=y.Object,We=function(t,e){return He.create(t,e)};function qe(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=We(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Ae?Ae(t,e):t.__proto__=e)}var Fe=function(){function e(t){rt(this,e),t=t||{},this.eventListeners=new Array,this.el=t.el||document.createElement("div"),this.$el=$(this.el),this.on=function(t,e){this.eventListeners.push({type:t,handler:e})},this.trigger=function(t){for(var e=0;e<this.eventListeners.length;e++)"*"!=this.eventListeners[e].type&&"all"!=this.eventListeners[e].type&&t!=this.eventListeners[e].type||this.eventListeners[e].handler(t,this)},this.initialize(t)}return at(e,[{key:"pick",value:function(e,t){var i={};return t.forEach(function(t){void 0!==e[t]&&(i[t]=e[t])}),i}},{key:"extend",value:function(t,e){}},{key:"initialize",value:function(){}}]),e}();function Ie(t,e){return t.classList?t.classList.contains(e):new RegExp("(^| )"+e+"( |$)","gi").test(t.className)}function $e(e,t){e.classList?Ge(t.split(" "),function(t){e.classList.add(t)}):e.className+=" "+t}function Be(t,e){var i=function(t){t.classList?t.classList.remove(e):t.className=t.className.replace(new RegExp("(^|\\b)"+e.split(" ").join("|")+"(\\b|$)","gi")," ")};NodeList.prototype.isPrototypeOf(t)?Ge(t,i):i(t)}function Re(t,e,i){if(t.classList)t.classList.toggle(e,i);else{var n=t.className.split(" "),o=n.indexOf(e);!1===i||!0!==i&&0<=o?n.splice(o,1):n.push(e),t.className=n.join(" ")}}function De(t,e){var i=document.createEvent("HTMLEvents");i.initEvent(e,!0,!1),t.dispatchEvent(i)}function Ge(t,e){for(var i=0;i<t.length;i++)e(t[i],i)}function Ye(t,e){return getComputedStyle(t)[e]}function Ve(t){t.parentNode.removeChild(t)}function Ke(t){var e=document.createElement("div");return e.innerHTML=t,e.children[0]}function Je(t,e){var i=[];return Ge(t,function(t){e(t)&&i.push(t)}),i}function Qe(t,i,n){t.addEventListener(i,function t(e){return console.log("fn",i,t),e.target.removeEventListener(e.type,t),n(e)})}function Ue(t){var e=t.getBoundingClientRect();return{top:e.top+window.scrollY,left:e.left+window.scrollX}}var Xe=function(t){function e(){return rt(this,e),Me(this,(e.__proto__||st(e)).apply(this,arguments))}return qe(e,Fe),at(e,[{key:"initialize",value:function(t){t=t||{},this.options={align:"center",trigger:"click",show_arrow:!0,hide_sm:!1,square:!1},Z(this.options,this.pick(t,et(this.options))),this.content=t.content,(this.el.dropdown=this).el.addEventListener(this.options.trigger,this.toggle.bind(this)),this.el.addEventListener("mousedown",function(){this.mousedown=!0}.bind(this)),this.el.addEventListener("mouseup",function(){this.mousedown=!1}.bind(this)),this.el.addEventListener("focus",function(){this.mousedown||this.show()}.bind(this)),document.addEventListener("focus",this.outsideClick.bind(this)),document.addEventListener(this.options.trigger,this.outsideClick.bind(this)),document.addEventListener("keyup",this.keyup.bind(this)),window.addEventListener("resize",this.resize.bind(this))}},{key:"render",value:function(){if(this.dropdown=document.createElement("div"),$e(this.dropdown,"uniformDropdown-dropdown"),$e(this.dropdown,"absolute"),this.dropdown.style.minWidth=this.$el.outerWidth(),this.dropdown.innerHTML=this.content.innerHTML?this.content.innerHTML:this.content,this.options.show_arrow){$e(this.dropdown,"has-pointer");var t=document.createElement("div");$e(t,"uniformDropdown-pointer"),this.dropdown.appendChild(t)}return Re(this.dropdown,"square",this.options.square),this.dropdown.style.display="none",document.body.appendChild(this.dropdown),Be(this.dropdown.querySelectorAll(".hidden"),"hidden"),this}},{key:"resize",value:function(){if(this.dropdown){var t=Ue(this.el);this.dropdown.style.top=t.top+this.el.offsetHeight+"px","center"==this.options.align?this.dropdown.style.left=t.left+this.el.offsetWidth/2-this.dropdown.offsetWidth/2+"px":"right"==this.options.align?this.dropdown.style.right=window.innerWidth-(t.left+this.el.offsetWidth)+"px":this.dropdown.style.left=t.left+"px",this.dropdown.style.left&&this.dropdown.style.left+this.dropdown.offsetWidth>window.innerWidth&&(this.dropdown.style.left=window.innerWidth-this.dropdown.offsetWidth+"px")}}},{key:"remove",value:function(){this.el.parentNode.removeChild(this.el),this.el.removeEventListener(this.options.trigger),window.removeEventListener("resize",this.resize.bind(this)),document.removeEventListener(this.options.trigger,this.outsideClick.bind(this)),document.removeEventListener("keyup",this.keyup.bind(this))}},{key:"toggle",value:function(t){Ie(this.el,"active")&&"click"==t.type?this.hide():this.show()}},{key:"show",value:function(){this.options.hide_sm&&window.innerWidth<720||(this.dropdown||this.render(),this.dropdown.style.display="block",$e(this.el,"active"),this.resize(),this.overlay=document.createElement("div"),$e(this.overlay,"uniformOverlay"),document.body.appendChild(this.overlay),window.innerWidth<720&&(this.lastScrollPosition=window.scrollY,$e(document.body,"uniformModal-hideBody")),this.overlay.addEventListener("click",this.hide.bind(this)),this.trigger("shown"))}},{key:"hide",value:function(){this.dropdown&&(this.dropdown.style.display="none",Be(this.el,"active"),this.overlay&&this.overlay.parentNode.removeChild(this.overlay),window.innerWidth<720&&(Be(document.body,"uniformModal-hideBody"),window.scrollTo(0,this.lastScrollPosition)),this.trigger("hidden"))}},{key:"outsideClick",value:function(t){this.dropdown&&null!==this.dropdown.offsetParent&&t.target!==this.el&&t.target!==this.overlay&&(this.el.contains(t.target)||this.dropdown.contains(t.target)||this.hide())}},{key:"keyup",value:function(t){27==t.which&&this.hide()}}]),e}(),Ze=function(t){function e(){return rt(this,e),Me(this,(e.__proto__||st(e)).apply(this,arguments))}return qe(e,Fe),at(e,[{key:"initialize",value:function(t){this.el.addEventListener("change",this.change.bind(this))}},{key:"render",value:function(){var t=Ie(this.el,"uniformRadio")?"uniformRadio":"uniformCheckbox";return this.checkbox=document.createElement("div"),$e(this.checkbox,"".concat(t,"-indicator")),this.el.className&&""!=this.el.className.replace(t,"")&&$e(this.checkbox,this.el.className.replace(t,"")),Re(this.checkbox,"checked",this.el.checked),this.el.parentNode.insertBefore(this.checkbox,this.el.nextSibling),this.checkbox.addEventListener("click",this.click.bind(this)),this}},{key:"click",value:function(t){this.el.disabled||(this.el.checked=!this.el.checked,De(this.el,"change"),t.preventDefault())}},{key:"change",value:function(){Re(this.checkbox,"checked",this.el.checked)}}]),e}(),ti=function(t){function e(){return rt(this,e),Me(this,(e.__proto__||st(e)).apply(this,arguments))}return qe(e,Fe),at(e,[{key:"initialize",value:function(t){this.options={},this.options.klass=t.klass||!1,this.content=t.content,$e(this.el,"uniformModal"),document.addEventListener("keyup",this.keyup.bind(this)),this.el.addEventListener("click",this.checkCloseButton.bind(this))}},{key:"keyup",value:function(t){27==t.which&&this.close()}},{key:"render",value:function(){var t="function"==typeof this.content?this.content():this.content;this.highest_z_index=0,this.overlay=document.createElement("div"),$e(this.overlay,"uniformModal-overlay"),this.blur=document.createElement("div"),$e(this.blur,"uniformModal-blur"),this.original_scroll=window.scrollY,this.blur.style.top=0-this.original_scroll+"px",0<document.body.querySelectorAll(".uniformModal").length&&(this.highest_z_index=Math.max(Array.prototype.map.call(document.body.querySelectorAll(".uniformModal"),function(t){return parseInt(Ye(t,"zIndex"))})),this.el.style.zIndex=this.highest_z_index+2),this.el.appendChild(this.overlay);for(var e=document.body.children,i=e.length,n=0;n<i;n++)this.blur.appendChild(e[0]);$e(document.body,"uniformModal-active"),document.body.appendChild(this.blur),document.body.appendChild(this.el);var o=document.createElement("div");$e(o,"uniformModal-container"),o.innerHTML=t.innerHTML?t.innerHTML:t;var s=document.createElement("div");return $e(s,"uniformModal-close"),o.appendChild(s),this.el.style.top=window.scrollY,this.overlay.addEventListener("click",this.close.bind(this)),this.el.appendChild(o),this.options.klass&&$e(o,this.options.klass),t.innerHTML&&De(t,"rendered"),this.trigger("rendered"),this}},{key:"checkCloseButton",value:function(t){Ie(t.target,"uniformModal-close")&&this.close()}},{key:"close",value:function(){Be(document.querySelectorAll("uniformModal-active"),"uniformModal-active");for(var t=this.blur.children,e=t.length,i=0;i<e;i++)document.body.appendChild(t[0]);this.blur.parentNode.removeChild(this.blur),window.scrollTo(0,this.original_scroll),this.trigger("closed"),this.remove()}},{key:"remove",value:function(){this.overlay.parentNode.removeChild(this.overlay),this.el.parentNode.removeChild(this.el),this.el.removeEventListener("click",this.checkCloseButton.bind(this)),this.overlay.removeEventListener("click",this.close.bind(this)),document.removeEventListener("keyup",this.keyup.bind(this))}}]),e}(),ei='\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1em" height="1em" viewBox="0 0 32 32">\n<path d="M28.998 8.531l-2.134-2.134c-0.394-0.393-1.030-0.393-1.423 0l-12.795 12.795-6.086-6.13c-0.393-0.393-1.029-0.393-1.423 0l-2.134 2.134c-0.393 0.394-0.393 1.030 0 1.423l8.924 8.984c0.393 0.393 1.030 0.393 1.423 0l15.648-15.649c0.393-0.392 0.393-1.030 0-1.423z"></path>\n</svg>\n'.trim(),ii='\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1em" height="1em" viewBox="0 0 20 20">\n<path d="M13.418 7.601c0.271-0.268 0.709-0.268 0.979 0s0.271 0.701 0 0.969l-3.907 3.83c-0.271 0.268-0.709 0.268-0.979 0l-3.908-3.83c-0.27-0.268-0.27-0.701 0-0.969s0.708-0.268 0.979 0l3.418 3.14 3.418-3.14z"></path>\n</svg>\n'.trim(),ni=function(t){function e(){return rt(this,e),Me(this,(e.__proto__||st(e)).apply(this,arguments))}return qe(e,Fe),at(e,[{key:"initialize",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};this.options={label:!1,class:"",showAll:function(t){Be(t.querySelectorAll("button.hide"),"hide");var e=t.querySelector(".uniformSelect-show-all");return e.parentNode.removeChild(e),!1},limit:8},Z(this.options,this.pick(t,et(this.options))),this.el.addEventListener("change",this.updateSelect.bind(this)),this.el.addEventListener("close",this.hideOptions.bind(this)),this.el.addEventListener("revealed",this.resize.bind(this)),this.el.uniformSelect=this,window.addEventListener("resize",this.resize.bind(this)),window.addEventListener("scroll",this.updatePosition.bind(this)),document.addEventListener("click",this.outsideClick.bind(this)),document.addEventListener("keyup",this.keyup.bind(this)),this.activeIcon=document.createElement("span"),$e(this.activeIcon,"uniformSelect-option-icon"),this.activeIcon.innerHTML=ei}},{key:"outsideClick",value:function(t){this.showing&&t.target!==this.select_options&&(this.container.contains(t.target)||this.select_options.contains(t.target)||this.hideOptions())}},{key:"keyup",value:function(t){27===t.which&&this.hideOptions()}},{key:"render",value:function(){this.container=document.createElement("div"),$e(this.container,"uniformSelect-container"),this.edit_button=Ke("<button type='button' class='uniformSelect-edit uniformInput outline block ".concat(this.options.class,'\'><span class="text-js"></span><span class="uniformSelect-edit-icon">').concat(ii,"</span></button>")),this.container.appendChild(this.edit_button),this.el.name&&$e(this.container,this.name.toLowerCase().replace(/[^a-z0-9\-_]+/g,"-")),this.el.style.display="none",this.el.insertAdjacentElement("beforebegin",this.container),this.updateSelect(),this.resize(),this.edit_button.addEventListener("click",this.showOptions.bind(this))}},{key:"resize",value:function(){for(var t=[],e=this.edit_button.children.length,i=0;i<e;i++)t.push(this.edit_button.children[0]),this.edit_button.children[0].parentNode.removeChild(this.edit_button.children[0]);this.edit_button.innerHTML="",this.edit_button.style.width="auto",this.edit_button.style.width=this.container.offsetWidth+"px",Ge(t,function(t){this.edit_button.appendChild(t)}.bind(this)),void 0!==this.select_options&&(window.innerWidth<720||(this.select_options.style.position="absolute",this.select_options.style.top=Ue(this.container).top+this.container.offsetHeight+"px",this.select_options.style.left=Ue(this.container).left+1+"px",this.select_options.style.minWidth=this.container.offsetWidth-1+"px"))}},{key:"renderOptions",value:function(){this.select_options=Ke("<div class='uniformSelect-options'>"),this.options.label&&this.select_options.append('<div class="uniformSelect-label hide show-sm margin-bottom text-bold">'.concat(this.options.label,"</div>")),this.el.name&&$e(this.select_options,this.el.name.toLowerCase().replace(/[^a-z0-9\-_]+/g,"-")),this.select_options.style.fontSize=Ye(this.el,"font-size"),this.select_options.style.display="none",document.body.appendChild(this.select_options),Ge(this.el.querySelectorAll("option"),function(t,e){var i=Ke("<button type='button' class='uniformSelect-option block outline text-left'>");i.option=t,i.textContent=t.textContent,i.value=t.value,""==i.textContent&&i.innerHTML("<span class='text-italic text-muted'>None</span>"),t.selected?($e(i,"active"),i.append(this.activeIcon.cloneNode(!0))):this.options.limit&&e>this.options.limit&&$e(i,"hide"),this.select_options.append(i),i.addEventListener("click",this.selectOption.bind(this))}.bind(this));var t=Ke('<div class="uniformSelect-options-actions"></div>');if(this.options.limit&&this.el.querySelectorAll("option").length>this.options.limit){var e=Ke("<button type='button' class='uniformSelect-show-all outline blue' style='display: block; border: none'>Show All</button>");e.addEventListener("click",function(t){De(this.el,"show_all"),this.options.showAll&&this.options.showAll(this.select_options),t.preventDefault(),t.stopPropagation()}.bind(this)),t.appendChild(e)}if(this.el.multiple){var i=Ke("<button type='button' class='uniformSelect-done block outline blue'>Done</button>");i.addEventListener("click",this.hideOptions.bind(this)),t.appendChild(i)}""!==t.innerHTML&&this.select_options.appendChild(t),De(this.el,"rendered")}},{key:"hideOptions",value:function(){void 0!==this.select_options&&(this.showing=!1,this.select_options.style.display="none",Be(this.select_options,"fixed"),Be(this.edit_button,"active"),Be(document.body,"uniformModal-hideBody"),this.lastScrollPosition&&window.innerWidth<720&&window.scrollTo(0,this.lastScrollPosition),De(this.el,"hidden:options"))}},{key:"showOptions",value:function(){if(this.showing)return this.hideOptions(),!1;this.showing=!0,this.select_options||this.renderOptions(),this.resize(),this.select_options.style.display="block",$e(this.edit_button,"active"),this.lastScrollPosition=window.scrollY,this.updatePosition(),$e(document.body,"uniformModal-hideBody")}},{key:"selectOption",value:function(t){this.el.multiple||(Ge(Je(this.el.querySelectorAll("option"),function(t){return t.selected}),function(t){t.selected=!1}),Ge(this.select_options.querySelectorAll(".uniformSelect-option.active .uniformSelect-option-icon"),Ve),Be(this.select_options.querySelectorAll(".uniformSelect-option.active"),"active")),Re(t.currentTarget,"active"),t.currentTarget.option.selected=Ie(t.currentTarget,"active"),Ie(t.currentTarget,"active")?t.currentTarget.append(this.activeIcon.cloneNode(!0)):Ge(t.currentTarget.querySelectorAll(".uniformSelect-option-icon"),Ve),De(this.el,"change")}},{key:"updateSelect",value:function(){this.el.multiple||this.hideOptions();var t=function(t,e){for(var i=[],n=0;n<t.length;n++)i.push(e(t[n],n));return i}(Je(this.el.querySelectorAll("option"),function(t){return t.selected}),function(t){return t.textContent}).join(", ");""==t&&(t=" "),this.edit_button.querySelector(".text-js").innerHTML=t}},{key:"updatePosition",value:function(){if(this.select_options){var t=Je(function(t){var e=[];for(t=t.parentElement;t;)e.push(t),t=t.parentElement;return e}(this.container),function(t){return"fixed"==Ye(t,"position")});Ie(this.select_options,"fixed")?0==t.length&&(this.select_options.style.position="absolute",this.select_options.style.top=Ue(this.container).top+this.container.offsetHeight+"px",Be(this.select_options,"fixed")):0<t.length&&(720<window.innerWidth&&(this.lastScrollPosition=!1),this.select_options.style.position="fixed",this.select_options.style.top=Ue(this.container).top+this.container.offsetHeight+"px",this.select_options.style.left=Ue(this.container).left+"px",$e(this.select_options,"fixed"))}}}]),e}(),oi=function(t){function e(){return rt(this,e),Me(this,(e.__proto__||st(e)).apply(this,arguments))}return qe(e,Fe),at(e,[{key:"initialize",value:function(){this.label=this.el.querySelector("label"),this.input=this.el.querySelector("#"+this.label.getAttribute("for")),this.startingHeight,this.input.addEventListener("focus",this.activate.bind(this)),this.input.addEventListener("blur",this.deactivate.bind(this)),this.input.addEventListener("revealed",this.render.bind(this))}},{key:"render",value:function(){if(null!==this.input.offsetParent&&!Ie(this.el,"enabled")){var t,e=parseInt(Ye(this.input,"paddingBottom"));this.startingHeight=this.input.offsetHeight,$e(this.el,"enabled"),$e(this.el,"inactive"),this.input.style.paddingTop=e+e/2+"px",this.input.style.paddingBottom=e-e/2-2+"px",this.label.style.position="absolute",this.label.style.top=0,this.label.style.left=this.label.offsetLeft,this.label.style.paddingLeft=Ye(this.input,"paddingLeft"),this.label.style.height=this.startingHeight,this.label.style.lineHeight=this.startingHeight+"px",t=this.input,document.activeElement===t&&this.activate(),void 0!==this.input.value&&""!=this.input.value&&this.activate()}}},{key:"activate",value:function(t){void 0!==t&&$e(this.el,"active"),Ie(this.el,"float")||($e(this.el,"float"),Be(this.el,"inactive"),this.label.style.lineHeight=this.startingHeight/2+"px")}},{key:"deactivate",value:function(t){void 0!==t&&Be(this.el,"active"),""==this.input.value&&(Be(this.el,"float"),$e(this.el,"inactive"),this.label.style.lineHeight=this.startingHeight+"px")}}]),e}(),si=function(t){function e(){return rt(this,e),Me(this,(e.__proto__||st(e)).apply(this,arguments))}return qe(e,Fe),at(e,[{key:"initialize",value:function(){window.addEventListener("resize",this.resize.bind(this)),De(window,"resize")}},{key:"resize",value:function(){var t=this.el.offsetWidth;720<t&&!Ie(this.el,"md-size")?($e(this.el,"md-size"),De(window,"resized-md")):t<720&&Ie(this.el,"md-size")&&Be(this.el,"md-size"),1080<t&&!this.el.hasClass("lg-size")?($e(this.el,"lg-size"),De(window,"resized-lg")):t<1080&&Ie(this.el,"lg-size")&&Be(this.el,"lg-size"),1440<t&&!Ie(this.el,"xl-size")?($e(this.el,"xl-size"),De(window,"resized-xl")):t<1440&&Ie(this.el,"xl-size")&&Be(this.el,"xl-size"),t<720&&!Ie(this.el,"sm-size")?($e(this.el,"sm-size"),De(window,"resized-sm")):720<t&&Ie(this.el,"sm-size")&&Be(this.el,"sm-size")}}]),e}(),ri=function(t){function e(){return rt(this,e),Me(this,(e.__proto__||st(e)).apply(this,arguments))}return qe(e,Fe),at(e,[{key:"initialize",value:function(t){t=t||{},this.options={align:"top"},Z(this.options,this.pick(t,et(this.options))),this.enabled=!0,this.message=t.message,(t.el.tooltip=this).el.addEventListener("mouseenter",this.show.bind(this)),this.el.addEventListener("mouseleave",this.hide.bind(this))}},{key:"render",value:function(){return this.popup=Ke('<div class="uniformTooltip-popup">'+this.message+"</div>"),this.popup.insertBefore(Ke("<div class='uniformTooltip-pointer'></div>"),this.popup.firstChild),this.el.appendChild(this.popup),100<this.message.length?this.popup.style.minWidth="200px":this.popup.style.whiteSpace="nowrap",this.popup.offsetWidth+Ue(this.popup).left>window.innerWidth&&(this.popup.style.left=window.innerWidth-this.popup.offsetWidth-Ue(this.popup).left+"px"),this.popup.style.display="block",("bottom"==this.options.align||Ue(this.popup).top<0)&&$e(this.popup,"-align-bottom"),this.popup.style.display="none",this}},{key:"remove",value:function(){this.el.parentNode.removeChild(this.el)}},{key:"show",value:function(){if(this.popup||this.render(),this.enabled){if(this.hiding)return this.show_after_hide=!0;if(!this.showing&&!this.shown){this.popup.style.display="block",this.showing=!0,this.hidden=!1;var t=function(t){this.trigger("shown"),this.showing=!1,this.shown=!0,this.hide_after_show&&this.hide(),this.hide_after_show=!1}.bind(this);Qe(this.popup,"transitionend",t),Qe(this.popup,"msTransitionEnd",t),Qe(this.popup,"oTransitionEnd",t),Ue(this.popup).left<0&&(this.popup.style.left="0"),$e(this.el,"active"),setTimeout(function(){$e(this.popup,"-reveal")}.bind(this),1)}}}},{key:"hide",value:function(){if(this.showing)return this.hide_after_show=!0;if(!this.hiding&&!this.hidden){this.hiding=!0,this.shown=!1;var t=function(t){this.trigger("hidden"),Be(this.el,"active"),this.popup.style.display="none",this.hiding=!1,this.hidden=!0,this.show_after_hide&&this.show(),this.show_after_hide=!1}.bind(this);Qe(this.popup,"transitionend",t),Qe(this.popup,"msTransitionEnd",t),Qe(this.popup,"oTransitionEnd",t),Be(this.popup,"-reveal")}}},{key:"disable",value:function(){this.enabled=!1}},{key:"enabled",value:function(){this.enabled=!0}}]),e}();$&&($.fn.uniformDropdown=function(){return this.each(function(){var i=$(this),t={el:this};void 0!==i.data("dropdown-align")&&(t.align=i.data("dropdown-align")),void 0!==i.data("dropdown-trigger")&&(t.trigger=i.data("dropdown-trigger")),void 0!==i.data("dropdown-show_arrow")&&(t.show_arrow=i.data("dropdown-show_arrow")),void 0!==i.data("dropdown-square")&&(t.square=i.data("dropdown-square")),void 0!==i.data("dropdown-hide_sm")&&(t.hide_sm=i.data("dropdown-hide_sm")),void 0!==i.data("dropdown-content")&&(t.content="<div class='pad'>".concat(i.data("dropdown-content"),"</div>")),void 0!==i.data("dropdown-target")&&(t.content=$(i.data("dropdown-target"))[0]);var e=new Xe(t);e.on("*",function(t,e){i.trigger("dropdown-"+t,e)}),e.render()})},$.fn.uniformCheckbox=function(){return this.each(function(){$(this);new Ze({el:this}).render()})},$.fn.uniformRadio=$.fn.uniformCheckbox,$.fn.uniformFloatingLabel=function(){return this.each(function(){new oi({el:this}).render()})},$.fn.uniformModal=function(){return this.click(function(){var i=$(this),t={klass:i.data("modal-klass"),content:i.data("modal-content")};if(i.data("modal-target")){var e=$(i.data("modal-target")).clone();e.removeClass("hidden"),t.content=e[0]}new ti(t).render().on("*",function(t,e){i.trigger("modal-"+t,e)})})},$.fn.uniformResizer=function(){return this.each(function(){new si({el:this})})},$.fn.uniformSelect=function(){return this.each(function(){var t={el:this};Z(t,$(this).data()),new ni(t).render()})},$.fn.uniformTooltip=function(){return this.each(function(){var i=$(this),t=new ri({message:i.data("tooltip-message"),el:this});t.on("*",function(t,e){i.trigger("tooltip-"+t,e)}),t.render()})})}();
|
@@ -0,0 +1,124 @@
|
|
1
|
+
import * as Uniform from 'uniform';
|
2
|
+
|
3
|
+
if($) {
|
4
|
+
/*
|
5
|
+
Dropdown
|
6
|
+
*/
|
7
|
+
$.fn.uniformDropdown = function() {
|
8
|
+
return this.each(function(){
|
9
|
+
var el = $(this);
|
10
|
+
var options = {
|
11
|
+
el: this
|
12
|
+
};
|
13
|
+
|
14
|
+
if (el.data('dropdown-align') !== undefined) options.align = el.data('dropdown-align');
|
15
|
+
if (el.data('dropdown-trigger') !== undefined) options.trigger = el.data('dropdown-trigger');
|
16
|
+
if (el.data('dropdown-show_arrow') !== undefined) options.show_arrow = el.data('dropdown-show_arrow');
|
17
|
+
if (el.data('dropdown-square') !== undefined) options.square = el.data('dropdown-square');
|
18
|
+
if (el.data('dropdown-hide_sm') !== undefined) options.hide_sm = el.data('dropdown-hide_sm');
|
19
|
+
if (el.data('dropdown-content') !== undefined) options.content = `<div class='pad'>${el.data('dropdown-content')}</div>`;
|
20
|
+
if (el.data('dropdown-target') !== undefined) options.content = $(el.data('dropdown-target'))[0];
|
21
|
+
var dropdown = new Uniform.Dropdown(options);
|
22
|
+
dropdown.on('*', function (event_key, dropdown) {
|
23
|
+
el.trigger('dropdown-' + event_key, dropdown);
|
24
|
+
});
|
25
|
+
dropdown.render();
|
26
|
+
});
|
27
|
+
};
|
28
|
+
|
29
|
+
|
30
|
+
/*
|
31
|
+
Checkbox
|
32
|
+
*/
|
33
|
+
$.fn.uniformCheckbox = function() {
|
34
|
+
return this.each(function(){
|
35
|
+
var el = $(this);
|
36
|
+
var checkbox = new Uniform.Checkbox({
|
37
|
+
el: this
|
38
|
+
});
|
39
|
+
checkbox.render();
|
40
|
+
});
|
41
|
+
};
|
42
|
+
$.fn.uniformRadio = $.fn.uniformCheckbox;
|
43
|
+
|
44
|
+
|
45
|
+
/*
|
46
|
+
FloatingLabel
|
47
|
+
*/
|
48
|
+
$.fn.uniformFloatingLabel = function() {
|
49
|
+
return this.each(function(){
|
50
|
+
new Uniform.FloatingLabel({
|
51
|
+
el: this
|
52
|
+
}).render();
|
53
|
+
});
|
54
|
+
};
|
55
|
+
|
56
|
+
|
57
|
+
/*
|
58
|
+
Modal
|
59
|
+
*/
|
60
|
+
$.fn.uniformModal = function() {
|
61
|
+
return this.click(function(){
|
62
|
+
var el = $(this);
|
63
|
+
var options = {
|
64
|
+
klass: el.data('modal-klass'),
|
65
|
+
content: el.data('modal-content')
|
66
|
+
};
|
67
|
+
if (el.data('modal-target')) {
|
68
|
+
var target = $(el.data('modal-target')).clone()
|
69
|
+
target.removeClass('hidden');
|
70
|
+
options.content = target[0];
|
71
|
+
}
|
72
|
+
var modal = new Uniform.Modal(options).render();
|
73
|
+
|
74
|
+
modal.on('*', function (event_type, modal) {
|
75
|
+
el.trigger('modal-' + event_type, modal);
|
76
|
+
});
|
77
|
+
})
|
78
|
+
};
|
79
|
+
|
80
|
+
|
81
|
+
/*
|
82
|
+
Resizer
|
83
|
+
*/
|
84
|
+
$.fn.uniformResizer = function() {
|
85
|
+
return this.each(function(){
|
86
|
+
new Uniform.Resizer({
|
87
|
+
el: this
|
88
|
+
});
|
89
|
+
});
|
90
|
+
};
|
91
|
+
|
92
|
+
|
93
|
+
/*
|
94
|
+
Select
|
95
|
+
*/
|
96
|
+
$.fn.uniformSelect = function() {
|
97
|
+
return this.each(function(){
|
98
|
+
var options = {
|
99
|
+
el: this
|
100
|
+
};
|
101
|
+
Object.assign(options, $(this).data());
|
102
|
+
new Uniform.Select(options).render();
|
103
|
+
});
|
104
|
+
};
|
105
|
+
|
106
|
+
|
107
|
+
/*
|
108
|
+
Tooltip
|
109
|
+
*/
|
110
|
+
$.fn.uniformTooltip = function() {
|
111
|
+
return this.each(function(){
|
112
|
+
var el = $(this);
|
113
|
+
var tooltip = new Uniform.Tooltip({
|
114
|
+
message: el.data('tooltip-message'),
|
115
|
+
el: this
|
116
|
+
});
|
117
|
+
tooltip.on('*', function (event_type, tooltip) {
|
118
|
+
el.trigger('tooltip-' + event_type, tooltip);
|
119
|
+
});
|
120
|
+
tooltip.render();
|
121
|
+
});
|
122
|
+
};
|
123
|
+
|
124
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import Dropdown from 'uniform/dropdown';
|
2
|
+
import Checkbox from 'uniform/checkbox';
|
3
|
+
import Modal from 'uniform/modal';
|
4
|
+
import Select from 'uniform/select';
|
5
|
+
import FloatingLabel from 'uniform/floating-label';
|
6
|
+
import Resizer from 'uniform/resizer';
|
7
|
+
import Tooltip from 'uniform/tooltip';
|
8
|
+
|
9
|
+
export {
|
10
|
+
Dropdown,
|
11
|
+
Checkbox,
|
12
|
+
Modal,
|
13
|
+
Select,
|
14
|
+
FloatingLabel,
|
15
|
+
Resizer,
|
16
|
+
Tooltip
|
17
|
+
};
|
@@ -0,0 +1,72 @@
|
|
1
|
+
.uniformAlert{
|
2
|
+
border-radius: 0.2em;
|
3
|
+
border: 1px solid color('gray');
|
4
|
+
background: white;
|
5
|
+
position:relative;
|
6
|
+
color: color('gray');
|
7
|
+
|
8
|
+
p:last-of-type{
|
9
|
+
margin-bottom: 0 !important;
|
10
|
+
}
|
11
|
+
|
12
|
+
&.-green{
|
13
|
+
border-color: color('green');
|
14
|
+
color: color('green-dark');
|
15
|
+
background: lighten(color('green'), 40);
|
16
|
+
.uniformAlert-icon svg {
|
17
|
+
fill: color('green');
|
18
|
+
color: color('green');
|
19
|
+
}
|
20
|
+
}
|
21
|
+
&.-red{
|
22
|
+
border-color: color('red');
|
23
|
+
color: color('red');
|
24
|
+
background: lighten(color('red'), 40);
|
25
|
+
.uniformAlert-icon svg {
|
26
|
+
fill: color('red');
|
27
|
+
color: color('red');
|
28
|
+
}
|
29
|
+
}
|
30
|
+
&.-blue{
|
31
|
+
border-color: color('blue');
|
32
|
+
color: color('blue-dark');
|
33
|
+
background: lighten(color('blue'), 50);
|
34
|
+
.uniformAlert-icon svg {
|
35
|
+
fill: color('blue');
|
36
|
+
color: color('blue');
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
.uniformAlert-body{
|
41
|
+
overflow:hidden;
|
42
|
+
padding: 1em;
|
43
|
+
}
|
44
|
+
|
45
|
+
.uniformAlert-icon{
|
46
|
+
padding: 1em;
|
47
|
+
padding-right: 0;
|
48
|
+
float: left;
|
49
|
+
min-height: 1px;
|
50
|
+
}
|
51
|
+
|
52
|
+
.uniformAlert-close {
|
53
|
+
position: absolute;
|
54
|
+
top: 0;
|
55
|
+
right: 0;
|
56
|
+
cursor: pointer;
|
57
|
+
height: 20px;
|
58
|
+
width: 20px;
|
59
|
+
&::before{
|
60
|
+
position:absolute;
|
61
|
+
left: 5px;
|
62
|
+
top: 0;
|
63
|
+
content: icon-x(10, "#000000");
|
64
|
+
opacity: 0.3;
|
65
|
+
}
|
66
|
+
&:hover{
|
67
|
+
&::before{
|
68
|
+
opacity: 1;
|
69
|
+
}
|
70
|
+
}
|
71
|
+
}
|
72
|
+
}
|