uikit-on-rails 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/README.md +37 -0
- data/Rakefile +1 -0
- data/lib/uikit-on-rails.rb +1 -0
- data/lib/uikit/sass/rails.rb +2 -0
- data/lib/uikit/sass/rails/engine.rb +12 -0
- data/lib/uikit/sass/rails/version.rb +7 -0
- data/uikit-on-rails.gemspec +23 -0
- data/vendor/assets/fonts/fontawesome-webfont.eot +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.otf +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.svg +565 -0
- data/vendor/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.woff +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.woff2 +0 -0
- data/vendor/assets/javascripts/uikit.js +19 -0
- data/vendor/assets/javascripts/uikit/components/accordion.js +180 -0
- data/vendor/assets/javascripts/uikit/components/autocomplete.js +340 -0
- data/vendor/assets/javascripts/uikit/components/datepicker.js +3167 -0
- data/vendor/assets/javascripts/uikit/components/form-password.js +67 -0
- data/vendor/assets/javascripts/uikit/components/form-select.js +85 -0
- data/vendor/assets/javascripts/uikit/components/grid-parallax.js +168 -0
- data/vendor/assets/javascripts/uikit/components/grid.js +540 -0
- data/vendor/assets/javascripts/uikit/components/htmleditor.js +679 -0
- data/vendor/assets/javascripts/uikit/components/lightbox.js +591 -0
- data/vendor/assets/javascripts/uikit/components/nestable.js +653 -0
- data/vendor/assets/javascripts/uikit/components/notify.js +189 -0
- data/vendor/assets/javascripts/uikit/components/pagination.js +147 -0
- data/vendor/assets/javascripts/uikit/components/parallax.js +462 -0
- data/vendor/assets/javascripts/uikit/components/search.js +92 -0
- data/vendor/assets/javascripts/uikit/components/slider.js +552 -0
- data/vendor/assets/javascripts/uikit/components/slideset.js +523 -0
- data/vendor/assets/javascripts/uikit/components/slideshow-fx.js +383 -0
- data/vendor/assets/javascripts/uikit/components/slideshow.js +596 -0
- data/vendor/assets/javascripts/uikit/components/sortable.js +688 -0
- data/vendor/assets/javascripts/uikit/components/sticky.js +364 -0
- data/vendor/assets/javascripts/uikit/components/timepicker.js +192 -0
- data/vendor/assets/javascripts/uikit/components/tooltip.js +234 -0
- data/vendor/assets/javascripts/uikit/components/upload.js +262 -0
- data/vendor/assets/javascripts/uikit/core/alert.js +66 -0
- data/vendor/assets/javascripts/uikit/core/button.js +156 -0
- data/vendor/assets/javascripts/uikit/core/core.js +820 -0
- data/vendor/assets/javascripts/uikit/core/cover.js +95 -0
- data/vendor/assets/javascripts/uikit/core/dropdown.js +529 -0
- data/vendor/assets/javascripts/uikit/core/grid.js +117 -0
- data/vendor/assets/javascripts/uikit/core/modal.js +389 -0
- data/vendor/assets/javascripts/uikit/core/nav.js +152 -0
- data/vendor/assets/javascripts/uikit/core/offcanvas.js +197 -0
- data/vendor/assets/javascripts/uikit/core/scrollspy.js +209 -0
- data/vendor/assets/javascripts/uikit/core/smooth-scroll.js +62 -0
- data/vendor/assets/javascripts/uikit/core/switcher.js +309 -0
- data/vendor/assets/javascripts/uikit/core/tab.js +167 -0
- data/vendor/assets/javascripts/uikit/core/toggle.js +124 -0
- data/vendor/assets/javascripts/uikit/core/touch.js +175 -0
- data/vendor/assets/javascripts/uikit/core/utility.js +338 -0
- data/vendor/assets/javascripts/uikit/uikit.js +3905 -0
- data/vendor/assets/stylesheets/extra/font-awesome.scss +14 -0
- data/vendor/assets/stylesheets/uikit.scss +7 -0
- data/vendor/assets/stylesheets/uikit/components/accordion.scss +94 -0
- data/vendor/assets/stylesheets/uikit/components/autocomplete.scss +107 -0
- data/vendor/assets/stylesheets/uikit/components/datepicker.scss +197 -0
- data/vendor/assets/stylesheets/uikit/components/dotnav.scss +212 -0
- data/vendor/assets/stylesheets/uikit/components/form-advanced.scss +128 -0
- data/vendor/assets/stylesheets/uikit/components/form-file.scss +63 -0
- data/vendor/assets/stylesheets/uikit/components/form-password.scss +74 -0
- data/vendor/assets/stylesheets/uikit/components/form-select.scss +66 -0
- data/vendor/assets/stylesheets/uikit/components/htmleditor.scss +269 -0
- data/vendor/assets/stylesheets/uikit/components/nestable.scss +231 -0
- data/vendor/assets/stylesheets/uikit/components/notify.scss +190 -0
- data/vendor/assets/stylesheets/uikit/components/placeholder.scss +66 -0
- data/vendor/assets/stylesheets/uikit/components/progress.scss +173 -0
- data/vendor/assets/stylesheets/uikit/components/search.scss +309 -0
- data/vendor/assets/stylesheets/uikit/components/slidenav.scss +183 -0
- data/vendor/assets/stylesheets/uikit/components/slider.scss +139 -0
- data/vendor/assets/stylesheets/uikit/components/slideshow.scss +208 -0
- data/vendor/assets/stylesheets/uikit/components/sortable.scss +124 -0
- data/vendor/assets/stylesheets/uikit/components/sticky.scss +57 -0
- data/vendor/assets/stylesheets/uikit/components/tooltip.scss +177 -0
- data/vendor/assets/stylesheets/uikit/components/upload.scss +34 -0
- data/vendor/assets/stylesheets/uikit/core/alert.scss +141 -0
- data/vendor/assets/stylesheets/uikit/core/animation.scss +599 -0
- data/vendor/assets/stylesheets/uikit/core/article.scss +139 -0
- data/vendor/assets/stylesheets/uikit/core/badge.scss +110 -0
- data/vendor/assets/stylesheets/uikit/core/base.scss +563 -0
- data/vendor/assets/stylesheets/uikit/core/block.scss +155 -0
- data/vendor/assets/stylesheets/uikit/core/breadcrumb.scss +86 -0
- data/vendor/assets/stylesheets/uikit/core/button.scss +406 -0
- data/vendor/assets/stylesheets/uikit/core/close.scss +132 -0
- data/vendor/assets/stylesheets/uikit/core/column.scss +209 -0
- data/vendor/assets/stylesheets/uikit/core/comment.scss +172 -0
- data/vendor/assets/stylesheets/uikit/core/contrast.scss +493 -0
- data/vendor/assets/stylesheets/uikit/core/cover.scss +70 -0
- data/vendor/assets/stylesheets/uikit/core/description-list.scss +71 -0
- data/vendor/assets/stylesheets/uikit/core/dropdown.scss +280 -0
- data/vendor/assets/stylesheets/uikit/core/flex.scss +320 -0
- data/vendor/assets/stylesheets/uikit/core/form.scss +629 -0
- data/vendor/assets/stylesheets/uikit/core/grid.scss +731 -0
- data/vendor/assets/stylesheets/uikit/core/icon.scss +930 -0
- data/vendor/assets/stylesheets/uikit/core/list.scss +102 -0
- data/vendor/assets/stylesheets/uikit/core/modal.scss +343 -0
- data/vendor/assets/stylesheets/uikit/core/nav.scss +468 -0
- data/vendor/assets/stylesheets/uikit/core/navbar.scss +325 -0
- data/vendor/assets/stylesheets/uikit/core/offcanvas.scss +203 -0
- data/vendor/assets/stylesheets/uikit/core/overlay.scss +534 -0
- data/vendor/assets/stylesheets/uikit/core/pagination.scss +197 -0
- data/vendor/assets/stylesheets/uikit/core/panel.scss +332 -0
- data/vendor/assets/stylesheets/uikit/core/print.scss +61 -0
- data/vendor/assets/stylesheets/uikit/core/subnav.scss +213 -0
- data/vendor/assets/stylesheets/uikit/core/switcher.scss +38 -0
- data/vendor/assets/stylesheets/uikit/core/tab.scss +368 -0
- data/vendor/assets/stylesheets/uikit/core/table.scss +147 -0
- data/vendor/assets/stylesheets/uikit/core/text.scss +136 -0
- data/vendor/assets/stylesheets/uikit/core/thumbnail.scss +122 -0
- data/vendor/assets/stylesheets/uikit/core/thumbnav.scss +122 -0
- data/vendor/assets/stylesheets/uikit/core/utility.scss +610 -0
- data/vendor/assets/stylesheets/uikit/core/variables.scss +23 -0
- data/vendor/assets/stylesheets/uikit/uikit-mixins.scss +327 -0
- data/vendor/assets/stylesheets/uikit/uikit-variables.scss +819 -0
- data/vendor/assets/stylesheets/uikit/uikit.scss +52 -0
- metadata +177 -0
@@ -0,0 +1,95 @@
|
|
1
|
+
/*! UIkit 2.27.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
|
+
(function(UI){
|
3
|
+
|
4
|
+
"use strict";
|
5
|
+
|
6
|
+
UI.component('cover', {
|
7
|
+
|
8
|
+
defaults: {
|
9
|
+
automute : true
|
10
|
+
},
|
11
|
+
|
12
|
+
boot: function() {
|
13
|
+
|
14
|
+
// auto init
|
15
|
+
UI.ready(function(context) {
|
16
|
+
|
17
|
+
UI.$("[data-uk-cover]", context).each(function(){
|
18
|
+
|
19
|
+
var ele = UI.$(this);
|
20
|
+
|
21
|
+
if(!ele.data("cover")) {
|
22
|
+
var plugin = UI.cover(ele, UI.Utils.options(ele.attr("data-uk-cover")));
|
23
|
+
}
|
24
|
+
});
|
25
|
+
});
|
26
|
+
},
|
27
|
+
|
28
|
+
init: function() {
|
29
|
+
|
30
|
+
this.parent = this.element.parent();
|
31
|
+
|
32
|
+
UI.$win.on('load resize orientationchange', UI.Utils.debounce(function(){
|
33
|
+
this.check();
|
34
|
+
}.bind(this), 100));
|
35
|
+
|
36
|
+
this.on("display.uk.check", function(e) {
|
37
|
+
if(this.element.is(":visible")) this.check();
|
38
|
+
}.bind(this));
|
39
|
+
|
40
|
+
this.check();
|
41
|
+
|
42
|
+
if (this.element.is('iframe') && this.options.automute) {
|
43
|
+
|
44
|
+
var src = this.element.attr('src');
|
45
|
+
|
46
|
+
this.element.attr('src', '').on('load', function(){
|
47
|
+
|
48
|
+
this.contentWindow.postMessage('{ "event": "command", "func": "mute", "method":"setVolume", "value":0}', '*');
|
49
|
+
|
50
|
+
}).attr('src', [src, (src.indexOf('?') > -1 ? '&':'?'), 'enablejsapi=1&api=1'].join(''));
|
51
|
+
}
|
52
|
+
},
|
53
|
+
|
54
|
+
check: function() {
|
55
|
+
|
56
|
+
this.element.css({
|
57
|
+
width : '',
|
58
|
+
height : ''
|
59
|
+
});
|
60
|
+
|
61
|
+
this.dimension = {w: this.element.width(), h: this.element.height()};
|
62
|
+
|
63
|
+
if (this.element.attr('width') && !isNaN(this.element.attr('width'))) {
|
64
|
+
this.dimension.w = this.element.attr('width');
|
65
|
+
}
|
66
|
+
|
67
|
+
if (this.element.attr('height') && !isNaN(this.element.attr('height'))) {
|
68
|
+
this.dimension.h = this.element.attr('height');
|
69
|
+
}
|
70
|
+
|
71
|
+
this.ratio = this.dimension.w / this.dimension.h;
|
72
|
+
|
73
|
+
var w = this.parent.width(), h = this.parent.height(), width, height;
|
74
|
+
|
75
|
+
// if element height < parent height (gap underneath)
|
76
|
+
if ((w / this.ratio) < h) {
|
77
|
+
|
78
|
+
width = Math.ceil(h * this.ratio);
|
79
|
+
height = h;
|
80
|
+
|
81
|
+
// element width < parent width (gap to right)
|
82
|
+
} else {
|
83
|
+
|
84
|
+
width = w;
|
85
|
+
height = Math.ceil(w / this.ratio);
|
86
|
+
}
|
87
|
+
|
88
|
+
this.element.css({
|
89
|
+
'width' : width,
|
90
|
+
'height' : height
|
91
|
+
});
|
92
|
+
}
|
93
|
+
});
|
94
|
+
|
95
|
+
})(UIkit);
|
@@ -0,0 +1,529 @@
|
|
1
|
+
/*! UIkit 2.27.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
|
+
(function(UI) {
|
3
|
+
|
4
|
+
"use strict";
|
5
|
+
|
6
|
+
var active = false, hoverIdle, flips = {
|
7
|
+
x: {
|
8
|
+
"bottom-left" : 'bottom-right',
|
9
|
+
"bottom-right" : 'bottom-left',
|
10
|
+
"bottom-center" : 'bottom-center',
|
11
|
+
"top-left" : 'top-right',
|
12
|
+
"top-right" : 'top-left',
|
13
|
+
"top-center" : 'top-center',
|
14
|
+
"left-top" : 'right-top',
|
15
|
+
"left-bottom" : 'right-bottom',
|
16
|
+
"left-center" : 'right-center',
|
17
|
+
"right-top" : 'left-top',
|
18
|
+
"right-bottom" : 'left-bottom',
|
19
|
+
"right-center" : 'left-center'
|
20
|
+
},
|
21
|
+
y: {
|
22
|
+
"bottom-left" : 'top-left',
|
23
|
+
"bottom-right" : 'top-right',
|
24
|
+
"bottom-center" : 'top-center',
|
25
|
+
"top-left" : 'bottom-left',
|
26
|
+
"top-right" : 'bottom-right',
|
27
|
+
"top-center" : 'bottom-center',
|
28
|
+
"left-top" : 'left-bottom',
|
29
|
+
"left-bottom" : 'left-top',
|
30
|
+
"left-center" : 'left-center',
|
31
|
+
"right-top" : 'right-bottom',
|
32
|
+
"right-bottom" : 'right-top',
|
33
|
+
"right-center" : 'right-center'
|
34
|
+
},
|
35
|
+
xy: {
|
36
|
+
"bottom-left" : 'top-right',
|
37
|
+
"bottom-right" : 'top-left',
|
38
|
+
"bottom-center" : 'top-center',
|
39
|
+
"top-left" : 'bottom-right',
|
40
|
+
"top-right" : 'bottom-left',
|
41
|
+
"top-center" : 'bottom-center',
|
42
|
+
"left-top" : 'right-bottom',
|
43
|
+
"left-bottom" : 'right-top',
|
44
|
+
"left-center" : 'right-center',
|
45
|
+
"right-top" : 'left-bottom',
|
46
|
+
"right-bottom" : 'left-top',
|
47
|
+
"right-center" : 'left-center'
|
48
|
+
}
|
49
|
+
};
|
50
|
+
|
51
|
+
UI.component('dropdown', {
|
52
|
+
|
53
|
+
defaults: {
|
54
|
+
mode : 'hover',
|
55
|
+
pos : 'bottom-left',
|
56
|
+
offset : 0,
|
57
|
+
remaintime : 800,
|
58
|
+
justify : false,
|
59
|
+
boundary : UI.$win,
|
60
|
+
delay : 0,
|
61
|
+
dropdownSelector: '.uk-dropdown,.uk-dropdown-blank',
|
62
|
+
hoverDelayIdle : 250,
|
63
|
+
preventflip : false
|
64
|
+
},
|
65
|
+
|
66
|
+
remainIdle: false,
|
67
|
+
|
68
|
+
boot: function() {
|
69
|
+
|
70
|
+
var triggerevent = UI.support.touch ? "click" : "mouseenter";
|
71
|
+
|
72
|
+
// init code
|
73
|
+
UI.$html.on(triggerevent+".dropdown.uikit focus", "[data-uk-dropdown]", function(e) {
|
74
|
+
|
75
|
+
var ele = UI.$(this);
|
76
|
+
|
77
|
+
if (!ele.data("dropdown")) {
|
78
|
+
|
79
|
+
var dropdown = UI.dropdown(ele, UI.Utils.options(ele.attr("data-uk-dropdown")));
|
80
|
+
|
81
|
+
if (triggerevent=="click" || (triggerevent=="mouseenter" && dropdown.options.mode=="hover")) {
|
82
|
+
dropdown.element.trigger(triggerevent);
|
83
|
+
}
|
84
|
+
|
85
|
+
if (dropdown.element.find(dropdown.options.dropdownSelector).length) {
|
86
|
+
e.preventDefault();
|
87
|
+
}
|
88
|
+
}
|
89
|
+
});
|
90
|
+
},
|
91
|
+
|
92
|
+
init: function() {
|
93
|
+
|
94
|
+
var $this = this;
|
95
|
+
|
96
|
+
this.dropdown = this.find(this.options.dropdownSelector);
|
97
|
+
this.offsetParent = this.dropdown.parents().filter(function() {
|
98
|
+
return UI.$.inArray(UI.$(this).css('position'), ['relative', 'fixed', 'absolute']) !== -1;
|
99
|
+
}).slice(0,1);
|
100
|
+
|
101
|
+
this.centered = this.dropdown.hasClass('uk-dropdown-center');
|
102
|
+
this.justified = this.options.justify ? UI.$(this.options.justify) : false;
|
103
|
+
|
104
|
+
this.boundary = UI.$(this.options.boundary);
|
105
|
+
|
106
|
+
if (!this.boundary.length) {
|
107
|
+
this.boundary = UI.$win;
|
108
|
+
}
|
109
|
+
|
110
|
+
// legacy DEPRECATED!
|
111
|
+
if (this.dropdown.hasClass('uk-dropdown-up')) {
|
112
|
+
this.options.pos = 'top-left';
|
113
|
+
}
|
114
|
+
if (this.dropdown.hasClass('uk-dropdown-flip')) {
|
115
|
+
this.options.pos = this.options.pos.replace('left','right');
|
116
|
+
}
|
117
|
+
if (this.dropdown.hasClass('uk-dropdown-center')) {
|
118
|
+
this.options.pos = this.options.pos.replace(/(left|right)/,'center');
|
119
|
+
}
|
120
|
+
//-- end legacy
|
121
|
+
|
122
|
+
// Init ARIA
|
123
|
+
this.element.attr('aria-haspopup', 'true');
|
124
|
+
this.element.attr('aria-expanded', this.element.hasClass('uk-open'));
|
125
|
+
this.dropdown.attr('aria-hidden', 'true');
|
126
|
+
|
127
|
+
if (this.options.mode == "click" || UI.support.touch) {
|
128
|
+
|
129
|
+
this.on("click.uk.dropdown", function(e) {
|
130
|
+
|
131
|
+
var $target = UI.$(e.target);
|
132
|
+
|
133
|
+
if (!$target.parents($this.options.dropdownSelector).length) {
|
134
|
+
|
135
|
+
if ($target.is("a[href='#']") || $target.parent().is("a[href='#']") || ($this.dropdown.length && !$this.dropdown.is(":visible")) ){
|
136
|
+
e.preventDefault();
|
137
|
+
}
|
138
|
+
|
139
|
+
$target.blur();
|
140
|
+
}
|
141
|
+
|
142
|
+
if (!$this.element.hasClass('uk-open')) {
|
143
|
+
|
144
|
+
$this.show();
|
145
|
+
|
146
|
+
} else {
|
147
|
+
|
148
|
+
if (!$this.dropdown.find(e.target).length || $target.is(".uk-dropdown-close") || $target.parents(".uk-dropdown-close").length) {
|
149
|
+
$this.hide();
|
150
|
+
}
|
151
|
+
}
|
152
|
+
});
|
153
|
+
|
154
|
+
} else {
|
155
|
+
|
156
|
+
this.on("mouseenter", function(e) {
|
157
|
+
|
158
|
+
$this.trigger('pointerenter.uk.dropdown', [$this]);
|
159
|
+
|
160
|
+
if ($this.remainIdle) {
|
161
|
+
clearTimeout($this.remainIdle);
|
162
|
+
}
|
163
|
+
|
164
|
+
if (hoverIdle) {
|
165
|
+
clearTimeout(hoverIdle);
|
166
|
+
}
|
167
|
+
|
168
|
+
if (active && active == $this) {
|
169
|
+
return;
|
170
|
+
}
|
171
|
+
|
172
|
+
// pseudo manuAim
|
173
|
+
if (active && active != $this) {
|
174
|
+
|
175
|
+
hoverIdle = setTimeout(function() {
|
176
|
+
hoverIdle = setTimeout($this.show.bind($this), $this.options.delay);
|
177
|
+
}, $this.options.hoverDelayIdle);
|
178
|
+
|
179
|
+
} else {
|
180
|
+
|
181
|
+
hoverIdle = setTimeout($this.show.bind($this), $this.options.delay);
|
182
|
+
}
|
183
|
+
|
184
|
+
}).on("mouseleave", function() {
|
185
|
+
|
186
|
+
if (hoverIdle) {
|
187
|
+
clearTimeout(hoverIdle);
|
188
|
+
}
|
189
|
+
|
190
|
+
$this.remainIdle = setTimeout(function() {
|
191
|
+
if (active && active == $this) $this.hide();
|
192
|
+
}, $this.options.remaintime);
|
193
|
+
|
194
|
+
$this.trigger('pointerleave.uk.dropdown', [$this]);
|
195
|
+
|
196
|
+
}).on("click", function(e){
|
197
|
+
|
198
|
+
var $target = UI.$(e.target);
|
199
|
+
|
200
|
+
if ($this.remainIdle) {
|
201
|
+
clearTimeout($this.remainIdle);
|
202
|
+
}
|
203
|
+
|
204
|
+
if (active && active == $this) {
|
205
|
+
if (!$this.dropdown.find(e.target).length || $target.is(".uk-dropdown-close") || $target.parents(".uk-dropdown-close").length) {
|
206
|
+
$this.hide();
|
207
|
+
}
|
208
|
+
return;
|
209
|
+
}
|
210
|
+
|
211
|
+
if ($target.is("a[href='#']") || $target.parent().is("a[href='#']")){
|
212
|
+
e.preventDefault();
|
213
|
+
}
|
214
|
+
|
215
|
+
$this.show();
|
216
|
+
});
|
217
|
+
}
|
218
|
+
},
|
219
|
+
|
220
|
+
show: function(){
|
221
|
+
|
222
|
+
UI.$html.off("click.outer.dropdown");
|
223
|
+
|
224
|
+
if (active && active != this) {
|
225
|
+
active.hide(true);
|
226
|
+
}
|
227
|
+
|
228
|
+
if (hoverIdle) {
|
229
|
+
clearTimeout(hoverIdle);
|
230
|
+
}
|
231
|
+
|
232
|
+
this.trigger('beforeshow.uk.dropdown', [this]);
|
233
|
+
|
234
|
+
this.checkDimensions();
|
235
|
+
this.element.addClass('uk-open');
|
236
|
+
|
237
|
+
// Update ARIA
|
238
|
+
this.element.attr('aria-expanded', 'true');
|
239
|
+
this.dropdown.attr('aria-hidden', 'false');
|
240
|
+
|
241
|
+
this.trigger('show.uk.dropdown', [this]);
|
242
|
+
|
243
|
+
UI.Utils.checkDisplay(this.dropdown, true);
|
244
|
+
UI.Utils.focus(this.dropdown);
|
245
|
+
active = this;
|
246
|
+
|
247
|
+
this.registerOuterClick();
|
248
|
+
},
|
249
|
+
|
250
|
+
hide: function(force) {
|
251
|
+
|
252
|
+
this.trigger('beforehide.uk.dropdown', [this, force]);
|
253
|
+
|
254
|
+
this.element.removeClass('uk-open');
|
255
|
+
|
256
|
+
if (this.remainIdle) {
|
257
|
+
clearTimeout(this.remainIdle);
|
258
|
+
}
|
259
|
+
|
260
|
+
this.remainIdle = false;
|
261
|
+
|
262
|
+
// Update ARIA
|
263
|
+
this.element.attr('aria-expanded', 'false');
|
264
|
+
this.dropdown.attr('aria-hidden', 'true');
|
265
|
+
|
266
|
+
this.trigger('hide.uk.dropdown', [this, force]);
|
267
|
+
|
268
|
+
if (active == this) active = false;
|
269
|
+
},
|
270
|
+
|
271
|
+
registerOuterClick: function(){
|
272
|
+
|
273
|
+
var $this = this;
|
274
|
+
|
275
|
+
UI.$html.off("click.outer.dropdown");
|
276
|
+
|
277
|
+
setTimeout(function() {
|
278
|
+
|
279
|
+
UI.$html.on("click.outer.dropdown", function(e) {
|
280
|
+
|
281
|
+
if (hoverIdle) {
|
282
|
+
clearTimeout(hoverIdle);
|
283
|
+
}
|
284
|
+
|
285
|
+
var $target = UI.$(e.target);
|
286
|
+
|
287
|
+
if (active == $this && !$this.element.find(e.target).length) {
|
288
|
+
$this.hide(true);
|
289
|
+
UI.$html.off("click.outer.dropdown");
|
290
|
+
}
|
291
|
+
});
|
292
|
+
}, 10);
|
293
|
+
},
|
294
|
+
|
295
|
+
checkDimensions: function() {
|
296
|
+
|
297
|
+
if (!this.dropdown.length) return;
|
298
|
+
|
299
|
+
// reset
|
300
|
+
this.dropdown.removeClass('uk-dropdown-top uk-dropdown-bottom uk-dropdown-left uk-dropdown-right uk-dropdown-stack').css({
|
301
|
+
'top-left':'',
|
302
|
+
'left':'',
|
303
|
+
'margin-left' :'',
|
304
|
+
'margin-right':''
|
305
|
+
});
|
306
|
+
|
307
|
+
if (this.justified && this.justified.length) {
|
308
|
+
this.dropdown.css("min-width", "");
|
309
|
+
}
|
310
|
+
|
311
|
+
var $this = this,
|
312
|
+
pos = UI.$.extend({}, this.offsetParent.offset(), {width: this.offsetParent[0].offsetWidth, height: this.offsetParent[0].offsetHeight}),
|
313
|
+
posoffset = this.options.offset,
|
314
|
+
dropdown = this.dropdown,
|
315
|
+
offset = dropdown.show().offset() || {left: 0, top: 0},
|
316
|
+
width = dropdown.outerWidth(),
|
317
|
+
height = dropdown.outerHeight(),
|
318
|
+
boundarywidth = this.boundary.width(),
|
319
|
+
boundaryoffset = this.boundary[0] !== window && this.boundary.offset() ? this.boundary.offset(): {top:0, left:0},
|
320
|
+
dpos = this.options.pos;
|
321
|
+
|
322
|
+
var variants = {
|
323
|
+
"bottom-left" : {top: 0 + pos.height + posoffset, left: 0},
|
324
|
+
"bottom-right" : {top: 0 + pos.height + posoffset, left: 0 + pos.width - width},
|
325
|
+
"bottom-center" : {top: 0 + pos.height + posoffset, left: 0 + pos.width / 2 - width / 2},
|
326
|
+
"top-left" : {top: 0 - height - posoffset, left: 0},
|
327
|
+
"top-right" : {top: 0 - height - posoffset, left: 0 + pos.width - width},
|
328
|
+
"top-center" : {top: 0 - height - posoffset, left: 0 + pos.width / 2 - width / 2},
|
329
|
+
"left-top" : {top: 0, left: 0 - width - posoffset},
|
330
|
+
"left-bottom" : {top: 0 + pos.height - height, left: 0 - width - posoffset},
|
331
|
+
"left-center" : {top: 0 + pos.height / 2 - height / 2, left: 0 - width - posoffset},
|
332
|
+
"right-top" : {top: 0, left: 0 + pos.width + posoffset},
|
333
|
+
"right-bottom" : {top: 0 + pos.height - height, left: 0 + pos.width + posoffset},
|
334
|
+
"right-center" : {top: 0 + pos.height / 2 - height / 2, left: 0 + pos.width + posoffset}
|
335
|
+
},
|
336
|
+
css = {},
|
337
|
+
pp;
|
338
|
+
|
339
|
+
pp = dpos.split('-');
|
340
|
+
css = variants[dpos] ? variants[dpos] : variants['bottom-left'];
|
341
|
+
|
342
|
+
// justify dropdown
|
343
|
+
if (this.justified && this.justified.length) {
|
344
|
+
justify(dropdown.css({left:0}), this.justified, boundarywidth);
|
345
|
+
} else {
|
346
|
+
|
347
|
+
if (this.options.preventflip !== true) {
|
348
|
+
|
349
|
+
var fdpos;
|
350
|
+
|
351
|
+
switch(this.checkBoundary(pos.left + css.left, pos.top + css.top, width, height, boundarywidth)) {
|
352
|
+
case "x":
|
353
|
+
if(this.options.preventflip !=='x') fdpos = flips['x'][dpos] || 'right-top';
|
354
|
+
break;
|
355
|
+
case "y":
|
356
|
+
if(this.options.preventflip !=='y') fdpos = flips['y'][dpos] || 'top-left';
|
357
|
+
break;
|
358
|
+
case "xy":
|
359
|
+
if(!this.options.preventflip) fdpos = flips['xy'][dpos] || 'right-bottom';
|
360
|
+
break;
|
361
|
+
}
|
362
|
+
|
363
|
+
if (fdpos) {
|
364
|
+
|
365
|
+
pp = fdpos.split('-');
|
366
|
+
css = variants[fdpos] ? variants[fdpos] : variants['bottom-left'];
|
367
|
+
|
368
|
+
// check flipped
|
369
|
+
if (this.checkBoundary(pos.left + css.left, pos.top + css.top, width, height, boundarywidth)) {
|
370
|
+
pp = dpos.split('-');
|
371
|
+
css = variants[dpos] ? variants[dpos] : variants['bottom-left'];
|
372
|
+
}
|
373
|
+
}
|
374
|
+
}
|
375
|
+
}
|
376
|
+
|
377
|
+
if (width > boundarywidth) {
|
378
|
+
dropdown.addClass("uk-dropdown-stack");
|
379
|
+
this.trigger('stack.uk.dropdown', [this]);
|
380
|
+
}
|
381
|
+
|
382
|
+
dropdown.css(css).css("display", "").addClass('uk-dropdown-'+pp[0]);
|
383
|
+
},
|
384
|
+
|
385
|
+
checkBoundary: function(left, top, width, height, boundarywidth) {
|
386
|
+
|
387
|
+
var axis = "";
|
388
|
+
|
389
|
+
if (left < 0 || ((left - UI.$win.scrollLeft())+width) > boundarywidth) {
|
390
|
+
axis += "x";
|
391
|
+
}
|
392
|
+
|
393
|
+
if ((top - UI.$win.scrollTop()) < 0 || ((top - UI.$win.scrollTop())+height) > window.innerHeight) {
|
394
|
+
axis += "y";
|
395
|
+
}
|
396
|
+
|
397
|
+
return axis;
|
398
|
+
}
|
399
|
+
});
|
400
|
+
|
401
|
+
|
402
|
+
UI.component('dropdownOverlay', {
|
403
|
+
|
404
|
+
defaults: {
|
405
|
+
justify : false,
|
406
|
+
cls : '',
|
407
|
+
duration: 200
|
408
|
+
},
|
409
|
+
|
410
|
+
boot: function() {
|
411
|
+
|
412
|
+
// init code
|
413
|
+
UI.ready(function(context) {
|
414
|
+
|
415
|
+
UI.$("[data-uk-dropdown-overlay]", context).each(function() {
|
416
|
+
var ele = UI.$(this);
|
417
|
+
|
418
|
+
if (!ele.data("dropdownOverlay")) {
|
419
|
+
UI.dropdownOverlay(ele, UI.Utils.options(ele.attr("data-uk-dropdown-overlay")));
|
420
|
+
}
|
421
|
+
});
|
422
|
+
});
|
423
|
+
},
|
424
|
+
|
425
|
+
init: function() {
|
426
|
+
|
427
|
+
var $this = this;
|
428
|
+
|
429
|
+
this.justified = this.options.justify ? UI.$(this.options.justify) : false;
|
430
|
+
this.overlay = this.element.find('uk-dropdown-overlay');
|
431
|
+
|
432
|
+
if (!this.overlay.length) {
|
433
|
+
this.overlay = UI.$('<div class="uk-dropdown-overlay"></div>').appendTo(this.element);
|
434
|
+
}
|
435
|
+
|
436
|
+
this.overlay.addClass(this.options.cls);
|
437
|
+
|
438
|
+
this.on({
|
439
|
+
|
440
|
+
'beforeshow.uk.dropdown': function(e, dropdown) {
|
441
|
+
$this.dropdown = dropdown;
|
442
|
+
|
443
|
+
if ($this.justified && $this.justified.length) {
|
444
|
+
justify($this.overlay.css({'display':'block', 'margin-left':'','margin-right':''}), $this.justified, $this.justified.outerWidth());
|
445
|
+
}
|
446
|
+
},
|
447
|
+
|
448
|
+
'show.uk.dropdown': function(e, dropdown) {
|
449
|
+
|
450
|
+
var h = $this.dropdown.dropdown.outerHeight(true);
|
451
|
+
|
452
|
+
$this.dropdown.element.removeClass('uk-open');
|
453
|
+
|
454
|
+
$this.overlay.stop().css('display', 'block').animate({height: h}, $this.options.duration, function() {
|
455
|
+
|
456
|
+
$this.dropdown.dropdown.css('visibility', '');
|
457
|
+
$this.dropdown.element.addClass('uk-open');
|
458
|
+
|
459
|
+
UI.Utils.checkDisplay($this.dropdown.dropdown, true);
|
460
|
+
});
|
461
|
+
|
462
|
+
$this.pointerleave = false;
|
463
|
+
},
|
464
|
+
|
465
|
+
'hide.uk.dropdown': function() {
|
466
|
+
$this.overlay.stop().animate({height: 0}, $this.options.duration);
|
467
|
+
},
|
468
|
+
|
469
|
+
'pointerenter.uk.dropdown': function(e, dropdown) {
|
470
|
+
clearTimeout($this.remainIdle);
|
471
|
+
},
|
472
|
+
|
473
|
+
'pointerleave.uk.dropdown': function(e, dropdown) {
|
474
|
+
$this.pointerleave = true;
|
475
|
+
}
|
476
|
+
});
|
477
|
+
|
478
|
+
|
479
|
+
this.overlay.on({
|
480
|
+
|
481
|
+
'mouseenter': function() {
|
482
|
+
if ($this.remainIdle) {
|
483
|
+
clearTimeout($this.dropdown.remainIdle);
|
484
|
+
clearTimeout($this.remainIdle);
|
485
|
+
}
|
486
|
+
},
|
487
|
+
|
488
|
+
'mouseleave': function(){
|
489
|
+
|
490
|
+
if ($this.pointerleave && active) {
|
491
|
+
|
492
|
+
$this.remainIdle = setTimeout(function() {
|
493
|
+
if(active) active.hide();
|
494
|
+
}, active.options.remaintime);
|
495
|
+
}
|
496
|
+
}
|
497
|
+
})
|
498
|
+
}
|
499
|
+
|
500
|
+
});
|
501
|
+
|
502
|
+
|
503
|
+
function justify(ele, justifyTo, boundarywidth, offset) {
|
504
|
+
|
505
|
+
ele = UI.$(ele);
|
506
|
+
justifyTo = UI.$(justifyTo);
|
507
|
+
boundarywidth = boundarywidth || window.innerWidth;
|
508
|
+
offset = offset || ele.offset();
|
509
|
+
|
510
|
+
if (justifyTo.length) {
|
511
|
+
|
512
|
+
var jwidth = justifyTo.outerWidth();
|
513
|
+
|
514
|
+
ele.css("min-width", jwidth);
|
515
|
+
|
516
|
+
if (UI.langdirection == 'right') {
|
517
|
+
|
518
|
+
var right1 = boundarywidth - (justifyTo.offset().left + jwidth),
|
519
|
+
right2 = boundarywidth - (ele.offset().left + ele.outerWidth());
|
520
|
+
|
521
|
+
ele.css("margin-right", right1 - right2);
|
522
|
+
|
523
|
+
} else {
|
524
|
+
ele.css("margin-left", justifyTo.offset().left - offset.left);
|
525
|
+
}
|
526
|
+
}
|
527
|
+
}
|
528
|
+
|
529
|
+
})(UIkit);
|