rails-uikit-sass 2.27.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +22 -0
- data/README.md +43 -0
- data/lib/assets/stylesheets/rails-uikit-sass.scss +3 -0
- data/lib/rails-uikit-sass.rb +12 -0
- data/vendor/assets/fonts/FontAwesome.otf +0 -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/components/accordion.js +180 -0
- data/vendor/assets/javascripts/components/accordion.min.js +2 -0
- data/vendor/assets/javascripts/components/autocomplete.js +340 -0
- data/vendor/assets/javascripts/components/autocomplete.min.js +2 -0
- data/vendor/assets/javascripts/components/datepicker.js +3167 -0
- data/vendor/assets/javascripts/components/datepicker.min.js +3 -0
- data/vendor/assets/javascripts/components/form-password.js +67 -0
- data/vendor/assets/javascripts/components/form-password.min.js +2 -0
- data/vendor/assets/javascripts/components/form-select.js +85 -0
- data/vendor/assets/javascripts/components/form-select.min.js +2 -0
- data/vendor/assets/javascripts/components/grid-parallax.js +168 -0
- data/vendor/assets/javascripts/components/grid-parallax.min.js +2 -0
- data/vendor/assets/javascripts/components/grid.js +540 -0
- data/vendor/assets/javascripts/components/grid.min.js +2 -0
- data/vendor/assets/javascripts/components/htmleditor.js +679 -0
- data/vendor/assets/javascripts/components/htmleditor.min.js +2 -0
- data/vendor/assets/javascripts/components/lightbox.js +588 -0
- data/vendor/assets/javascripts/components/lightbox.min.js +2 -0
- data/vendor/assets/javascripts/components/nestable.js +653 -0
- data/vendor/assets/javascripts/components/nestable.min.js +2 -0
- data/vendor/assets/javascripts/components/notify.js +189 -0
- data/vendor/assets/javascripts/components/notify.min.js +2 -0
- data/vendor/assets/javascripts/components/pagination.js +147 -0
- data/vendor/assets/javascripts/components/pagination.min.js +2 -0
- data/vendor/assets/javascripts/components/parallax.js +462 -0
- data/vendor/assets/javascripts/components/parallax.min.js +2 -0
- data/vendor/assets/javascripts/components/search.js +92 -0
- data/vendor/assets/javascripts/components/search.min.js +2 -0
- data/vendor/assets/javascripts/components/slider.js +552 -0
- data/vendor/assets/javascripts/components/slider.min.js +2 -0
- data/vendor/assets/javascripts/components/slideset.js +523 -0
- data/vendor/assets/javascripts/components/slideset.min.js +2 -0
- data/vendor/assets/javascripts/components/slideshow-fx.js +382 -0
- data/vendor/assets/javascripts/components/slideshow-fx.min.js +2 -0
- data/vendor/assets/javascripts/components/slideshow.js +596 -0
- data/vendor/assets/javascripts/components/slideshow.min.js +2 -0
- data/vendor/assets/javascripts/components/sortable.js +688 -0
- data/vendor/assets/javascripts/components/sortable.min.js +2 -0
- data/vendor/assets/javascripts/components/sticky.js +364 -0
- data/vendor/assets/javascripts/components/sticky.min.js +2 -0
- data/vendor/assets/javascripts/components/timepicker.js +192 -0
- data/vendor/assets/javascripts/components/timepicker.min.js +2 -0
- data/vendor/assets/javascripts/components/tooltip.js +235 -0
- data/vendor/assets/javascripts/components/tooltip.min.js +2 -0
- data/vendor/assets/javascripts/components/upload.js +262 -0
- data/vendor/assets/javascripts/components/upload.min.js +2 -0
- data/vendor/assets/javascripts/core/alert.js +66 -0
- data/vendor/assets/javascripts/core/alert.min.js +2 -0
- data/vendor/assets/javascripts/core/button.js +156 -0
- data/vendor/assets/javascripts/core/button.min.js +2 -0
- data/vendor/assets/javascripts/core/core.js +820 -0
- data/vendor/assets/javascripts/core/core.min.js +2 -0
- data/vendor/assets/javascripts/core/cover.js +87 -0
- data/vendor/assets/javascripts/core/cover.min.js +2 -0
- data/vendor/assets/javascripts/core/dropdown.js +534 -0
- data/vendor/assets/javascripts/core/dropdown.min.js +2 -0
- data/vendor/assets/javascripts/core/grid.js +117 -0
- data/vendor/assets/javascripts/core/grid.min.js +2 -0
- data/vendor/assets/javascripts/core/modal.js +387 -0
- data/vendor/assets/javascripts/core/modal.min.js +2 -0
- data/vendor/assets/javascripts/core/nav.js +153 -0
- data/vendor/assets/javascripts/core/nav.min.js +2 -0
- data/vendor/assets/javascripts/core/offcanvas.js +197 -0
- data/vendor/assets/javascripts/core/offcanvas.min.js +2 -0
- data/vendor/assets/javascripts/core/scrollspy.js +209 -0
- data/vendor/assets/javascripts/core/scrollspy.min.js +2 -0
- data/vendor/assets/javascripts/core/smooth-scroll.js +62 -0
- data/vendor/assets/javascripts/core/smooth-scroll.min.js +2 -0
- data/vendor/assets/javascripts/core/switcher.js +307 -0
- data/vendor/assets/javascripts/core/switcher.min.js +2 -0
- data/vendor/assets/javascripts/core/tab.js +169 -0
- data/vendor/assets/javascripts/core/tab.min.js +2 -0
- data/vendor/assets/javascripts/core/toggle.js +124 -0
- data/vendor/assets/javascripts/core/toggle.min.js +2 -0
- data/vendor/assets/javascripts/core/touch.js +175 -0
- data/vendor/assets/javascripts/core/touch.min.js +2 -0
- data/vendor/assets/javascripts/core/utility.js +335 -0
- data/vendor/assets/javascripts/core/utility.min.js +2 -0
- data/vendor/assets/javascripts/uikit.js +3898 -0
- data/vendor/assets/javascripts/uikit.min.js +3 -0
- data/vendor/assets/stylesheets/components/accordion.scss +94 -0
- data/vendor/assets/stylesheets/components/autocomplete.scss +107 -0
- data/vendor/assets/stylesheets/components/datepicker.scss +197 -0
- data/vendor/assets/stylesheets/components/dotnav.scss +212 -0
- data/vendor/assets/stylesheets/components/form-advanced.scss +128 -0
- data/vendor/assets/stylesheets/components/form-file.scss +63 -0
- data/vendor/assets/stylesheets/components/form-password.scss +74 -0
- data/vendor/assets/stylesheets/components/form-select.scss +66 -0
- data/vendor/assets/stylesheets/components/htmleditor.scss +269 -0
- data/vendor/assets/stylesheets/components/nestable.scss +231 -0
- data/vendor/assets/stylesheets/components/notify.scss +190 -0
- data/vendor/assets/stylesheets/components/placeholder.scss +66 -0
- data/vendor/assets/stylesheets/components/progress.scss +173 -0
- data/vendor/assets/stylesheets/components/search.scss +309 -0
- data/vendor/assets/stylesheets/components/slidenav.scss +183 -0
- data/vendor/assets/stylesheets/components/slider.scss +139 -0
- data/vendor/assets/stylesheets/components/slideshow.scss +208 -0
- data/vendor/assets/stylesheets/components/sortable.scss +124 -0
- data/vendor/assets/stylesheets/components/sticky.scss +57 -0
- data/vendor/assets/stylesheets/components/tooltip.scss +178 -0
- data/vendor/assets/stylesheets/components/upload.scss +34 -0
- data/vendor/assets/stylesheets/core/alert.scss +141 -0
- data/vendor/assets/stylesheets/core/animation.scss +599 -0
- data/vendor/assets/stylesheets/core/article.scss +139 -0
- data/vendor/assets/stylesheets/core/badge.scss +110 -0
- data/vendor/assets/stylesheets/core/base.scss +563 -0
- data/vendor/assets/stylesheets/core/block.scss +155 -0
- data/vendor/assets/stylesheets/core/breadcrumb.scss +86 -0
- data/vendor/assets/stylesheets/core/button.scss +406 -0
- data/vendor/assets/stylesheets/core/close.scss +132 -0
- data/vendor/assets/stylesheets/core/column.scss +209 -0
- data/vendor/assets/stylesheets/core/comment.scss +172 -0
- data/vendor/assets/stylesheets/core/contrast.scss +493 -0
- data/vendor/assets/stylesheets/core/cover.scss +70 -0
- data/vendor/assets/stylesheets/core/description-list.scss +71 -0
- data/vendor/assets/stylesheets/core/dropdown.scss +283 -0
- data/vendor/assets/stylesheets/core/flex.scss +320 -0
- data/vendor/assets/stylesheets/core/form.scss +629 -0
- data/vendor/assets/stylesheets/core/grid.scss +731 -0
- data/vendor/assets/stylesheets/core/icon.scss +930 -0
- data/vendor/assets/stylesheets/core/list.scss +102 -0
- data/vendor/assets/stylesheets/core/modal.scss +343 -0
- data/vendor/assets/stylesheets/core/nav.scss +468 -0
- data/vendor/assets/stylesheets/core/navbar.scss +325 -0
- data/vendor/assets/stylesheets/core/offcanvas.scss +203 -0
- data/vendor/assets/stylesheets/core/overlay.scss +534 -0
- data/vendor/assets/stylesheets/core/pagination.scss +197 -0
- data/vendor/assets/stylesheets/core/panel.scss +332 -0
- data/vendor/assets/stylesheets/core/print.scss +61 -0
- data/vendor/assets/stylesheets/core/subnav.scss +213 -0
- data/vendor/assets/stylesheets/core/switcher.scss +38 -0
- data/vendor/assets/stylesheets/core/tab.scss +368 -0
- data/vendor/assets/stylesheets/core/table.scss +147 -0
- data/vendor/assets/stylesheets/core/text.scss +136 -0
- data/vendor/assets/stylesheets/core/thumbnail.scss +122 -0
- data/vendor/assets/stylesheets/core/thumbnav.scss +122 -0
- data/vendor/assets/stylesheets/core/utility.scss +610 -0
- data/vendor/assets/stylesheets/core/variables.scss +23 -0
- data/vendor/assets/stylesheets/uikit-mixins.scss +327 -0
- data/vendor/assets/stylesheets/uikit-variables.scss +819 -0
- data/vendor/assets/stylesheets/uikit.scss +52 -0
- metadata +251 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f255f9fc8a6de31a6c5eac32db1f904f1abc7969
|
4
|
+
data.tar.gz: 75a1d7a70e967855028a062e094a3231ffeb5d91
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: dcf9394f70fce1b7b5b5be0659765780f83196cbedaae5d7596545877ceb98bb9b1665b29a486873f82623143148d4d09700a520c9c7d5d5d4bc5548a05cd411
|
7
|
+
data.tar.gz: 3e1c88b07121605a123118d785eda6a873705d65c9c0db019cecd3c7ffaa2eedc608b24df1778342f18492b89dc6e8560457232eb56bba60b538ba614ff543ea
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Benjamin West
|
4
|
+
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
8
|
+
in the Software without restriction, including without limitation the rights
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
14
|
+
all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# Rails::Uikit::Sass
|
2
|
+
|
3
|
+
This gem allows you to properly include **[UIkit](https://getuikit.com)** into your Rails project, including its FontAwesome dependency.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'rails-uikit-sass'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install rails-uikit-sass
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
```scss
|
24
|
+
# app/assets/stylesheets/application.scss
|
25
|
+
@import "rails-uikit-sass";
|
26
|
+
```
|
27
|
+
|
28
|
+
To customize, include the UIkit mixins, then add your customizations, then import UIkit.
|
29
|
+
|
30
|
+
```scss
|
31
|
+
# app/assets/stylesheets/application.scss
|
32
|
+
@import "uikit-mixins";
|
33
|
+
@import "my-custom-variables-and-hooks";
|
34
|
+
@import "uikit";
|
35
|
+
```
|
36
|
+
|
37
|
+
## Troubleshooting
|
38
|
+
|
39
|
+
If the mixins from this gem don't work, please ensure that you are @importing the file you're trying to mix UIkit into. It is very common mistake `//require_tree .` causing errors of unknown class or mixin because scss is required and compiled to css instead of imported into master scss file with sass.
|
40
|
+
|
41
|
+
## Contributing
|
42
|
+
|
43
|
+
[CONTRIBUTING.md](CONTRIBUTING.md)
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'non-stupid-digest-assets'
|
2
|
+
|
3
|
+
module RailsUikitSass
|
4
|
+
class Engine < ::Rails::Engine
|
5
|
+
config.assets.paths << File.expand_path("../../vendor/assets/stylesheets", __FILE__)
|
6
|
+
config.assets.paths << File.expand_path("../assets/stylesheets", __FILE__)
|
7
|
+
config.assets.paths << File.expand_path("../../vendor/assets/javascripts", __FILE__)
|
8
|
+
config.assets.paths << File.expand_path("../../vendor/assets/fonts", __FILE__)
|
9
|
+
config.assets.precompile << /fontawesome-webfont\.(?:svg|eot|woff|ttf|woff2)$/
|
10
|
+
NonStupidDigestAssets.whitelist += [/fontawesome.*/]
|
11
|
+
end
|
12
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,180 @@
|
|
1
|
+
/*! UIkit 2.27.2 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
|
+
(function(addon) {
|
3
|
+
var component;
|
4
|
+
|
5
|
+
if (window.UIkit) {
|
6
|
+
component = addon(UIkit);
|
7
|
+
}
|
8
|
+
|
9
|
+
if (typeof define == 'function' && define.amd) {
|
10
|
+
define('uikit-accordion', ['uikit'], function(){
|
11
|
+
return component || addon(UIkit);
|
12
|
+
});
|
13
|
+
}
|
14
|
+
})(function(UI){
|
15
|
+
|
16
|
+
"use strict";
|
17
|
+
|
18
|
+
UI.component('accordion', {
|
19
|
+
|
20
|
+
defaults: {
|
21
|
+
showfirst : true,
|
22
|
+
collapse : true,
|
23
|
+
animate : true,
|
24
|
+
easing : 'swing',
|
25
|
+
duration : 300,
|
26
|
+
toggle : '.uk-accordion-title',
|
27
|
+
containers : '.uk-accordion-content',
|
28
|
+
clsactive : 'uk-active'
|
29
|
+
},
|
30
|
+
|
31
|
+
boot: function() {
|
32
|
+
|
33
|
+
// init code
|
34
|
+
UI.ready(function(context) {
|
35
|
+
|
36
|
+
setTimeout(function(){
|
37
|
+
|
38
|
+
UI.$('[data-uk-accordion]', context).each(function(){
|
39
|
+
|
40
|
+
var ele = UI.$(this);
|
41
|
+
|
42
|
+
if (!ele.data('accordion')) {
|
43
|
+
UI.accordion(ele, UI.Utils.options(ele.attr('data-uk-accordion')));
|
44
|
+
}
|
45
|
+
});
|
46
|
+
|
47
|
+
}, 0);
|
48
|
+
});
|
49
|
+
},
|
50
|
+
|
51
|
+
init: function() {
|
52
|
+
|
53
|
+
var $this = this;
|
54
|
+
|
55
|
+
this.element.on('click.uk.accordion', this.options.toggle, function(e) {
|
56
|
+
|
57
|
+
e.preventDefault();
|
58
|
+
|
59
|
+
$this.toggleItem(UI.$(this).data('wrapper'), $this.options.animate, $this.options.collapse);
|
60
|
+
});
|
61
|
+
|
62
|
+
this.update(true);
|
63
|
+
|
64
|
+
UI.domObserve(this.element, function(e) {
|
65
|
+
if ($this.element.children($this.options.containers).length) {
|
66
|
+
$this.update();
|
67
|
+
}
|
68
|
+
});
|
69
|
+
},
|
70
|
+
|
71
|
+
toggleItem: function(wrapper, animated, collapse) {
|
72
|
+
|
73
|
+
var $this = this;
|
74
|
+
|
75
|
+
wrapper.data('toggle').toggleClass(this.options.clsactive);
|
76
|
+
wrapper.data('content').toggleClass(this.options.clsactive);
|
77
|
+
|
78
|
+
var active = wrapper.data('toggle').hasClass(this.options.clsactive);
|
79
|
+
|
80
|
+
if (collapse) {
|
81
|
+
this.toggle.not(wrapper.data('toggle')).removeClass(this.options.clsactive);
|
82
|
+
this.content.not(wrapper.data('content')).removeClass(this.options.clsactive)
|
83
|
+
.parent().stop().css('overflow', 'hidden').animate({ height: 0 }, {easing: this.options.easing, duration: animated ? this.options.duration : 0}).attr('aria-expanded', 'false');
|
84
|
+
}
|
85
|
+
|
86
|
+
wrapper.stop().css('overflow', 'hidden');
|
87
|
+
|
88
|
+
if (animated) {
|
89
|
+
|
90
|
+
wrapper.animate({ height: active ? getHeight(wrapper.data('content')) : 0 }, {easing: this.options.easing, duration: this.options.duration, complete: function() {
|
91
|
+
|
92
|
+
if (active) {
|
93
|
+
wrapper.css({'overflow': '', 'height': 'auto'});
|
94
|
+
UI.Utils.checkDisplay(wrapper.data('content'));
|
95
|
+
}
|
96
|
+
|
97
|
+
$this.trigger('display.uk.check');
|
98
|
+
}});
|
99
|
+
|
100
|
+
} else {
|
101
|
+
|
102
|
+
wrapper.height(active ? 'auto' : 0);
|
103
|
+
|
104
|
+
if (active) {
|
105
|
+
wrapper.css({'overflow': ''});
|
106
|
+
UI.Utils.checkDisplay(wrapper.data('content'));
|
107
|
+
}
|
108
|
+
|
109
|
+
this.trigger('display.uk.check');
|
110
|
+
}
|
111
|
+
|
112
|
+
// Update ARIA
|
113
|
+
wrapper.attr('aria-expanded', active);
|
114
|
+
|
115
|
+
this.element.trigger('toggle.uk.accordion', [active, wrapper.data('toggle'), wrapper.data('content')]);
|
116
|
+
},
|
117
|
+
|
118
|
+
update: function(init) {
|
119
|
+
|
120
|
+
var $this = this, $content, $wrapper, $toggle;
|
121
|
+
|
122
|
+
this.toggle = this.find(this.options.toggle);
|
123
|
+
this.content = this.find(this.options.containers);
|
124
|
+
|
125
|
+
this.content.each(function(index) {
|
126
|
+
|
127
|
+
$content = UI.$(this);
|
128
|
+
|
129
|
+
if ($content.parent().data('wrapper')) {
|
130
|
+
$wrapper = $content.parent();
|
131
|
+
} else {
|
132
|
+
$wrapper = UI.$(this).wrap('<div data-wrapper="true" style="overflow:hidden;height:0;position:relative;"></div>').parent();
|
133
|
+
|
134
|
+
// Init ARIA
|
135
|
+
$wrapper.attr('aria-expanded', 'false');
|
136
|
+
}
|
137
|
+
|
138
|
+
$toggle = $this.toggle.eq(index);
|
139
|
+
|
140
|
+
$wrapper.data('toggle', $toggle);
|
141
|
+
$wrapper.data('content', $content);
|
142
|
+
$toggle.data('wrapper', $wrapper);
|
143
|
+
$content.data('wrapper', $wrapper);
|
144
|
+
});
|
145
|
+
|
146
|
+
this.element.trigger('update.uk.accordion', [this]);
|
147
|
+
|
148
|
+
if (init && this.options.showfirst) {
|
149
|
+
this.toggleItem(this.toggle.eq(0).data('wrapper'), false, false);
|
150
|
+
}
|
151
|
+
}
|
152
|
+
|
153
|
+
});
|
154
|
+
|
155
|
+
// helper
|
156
|
+
|
157
|
+
function getHeight(ele) {
|
158
|
+
|
159
|
+
var $ele = UI.$(ele), height = "auto";
|
160
|
+
|
161
|
+
if ($ele.is(":visible")) {
|
162
|
+
height = $ele.outerHeight();
|
163
|
+
} else {
|
164
|
+
|
165
|
+
var tmp = {
|
166
|
+
position : $ele.css('position'),
|
167
|
+
visibility : $ele.css('visibility'),
|
168
|
+
display : $ele.css('display')
|
169
|
+
};
|
170
|
+
|
171
|
+
height = $ele.css({position: 'absolute', visibility: 'hidden', display: 'block'}).outerHeight();
|
172
|
+
|
173
|
+
$ele.css(tmp); // reset element
|
174
|
+
}
|
175
|
+
|
176
|
+
return height;
|
177
|
+
}
|
178
|
+
|
179
|
+
return UI.accordion;
|
180
|
+
});
|
@@ -0,0 +1,2 @@
|
|
1
|
+
/*! UIkit 2.27.2 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
|
+
!function(t){var i;window.UIkit&&(i=t(UIkit)),"function"==typeof define&&define.amd&&define("uikit-accordion",["uikit"],function(){return i||t(UIkit)})}(function(t){"use strict";function i(i){var e=t.$(i),o="auto";if(e.is(":visible"))o=e.outerHeight();else{var a={position:e.css("position"),visibility:e.css("visibility"),display:e.css("display")};o=e.css({position:"absolute",visibility:"hidden",display:"block"}).outerHeight(),e.css(a)}return o}return t.component("accordion",{defaults:{showfirst:!0,collapse:!0,animate:!0,easing:"swing",duration:300,toggle:".uk-accordion-title",containers:".uk-accordion-content",clsactive:"uk-active"},boot:function(){t.ready(function(i){setTimeout(function(){t.$("[data-uk-accordion]",i).each(function(){var i=t.$(this);i.data("accordion")||t.accordion(i,t.Utils.options(i.attr("data-uk-accordion")))})},0)})},init:function(){var i=this;this.element.on("click.uk.accordion",this.options.toggle,function(e){e.preventDefault(),i.toggleItem(t.$(this).data("wrapper"),i.options.animate,i.options.collapse)}),this.update(!0),t.domObserve(this.element,function(){i.element.children(i.options.containers).length&&i.update()})},toggleItem:function(e,o,a){var n=this;e.data("toggle").toggleClass(this.options.clsactive),e.data("content").toggleClass(this.options.clsactive);var s=e.data("toggle").hasClass(this.options.clsactive);a&&(this.toggle.not(e.data("toggle")).removeClass(this.options.clsactive),this.content.not(e.data("content")).removeClass(this.options.clsactive).parent().stop().css("overflow","hidden").animate({height:0},{easing:this.options.easing,duration:o?this.options.duration:0}).attr("aria-expanded","false")),e.stop().css("overflow","hidden"),o?e.animate({height:s?i(e.data("content")):0},{easing:this.options.easing,duration:this.options.duration,complete:function(){s&&(e.css({overflow:"",height:"auto"}),t.Utils.checkDisplay(e.data("content"))),n.trigger("display.uk.check")}}):(e.height(s?"auto":0),s&&(e.css({overflow:""}),t.Utils.checkDisplay(e.data("content"))),this.trigger("display.uk.check")),e.attr("aria-expanded",s),this.element.trigger("toggle.uk.accordion",[s,e.data("toggle"),e.data("content")])},update:function(i){var e,o,a,n=this;this.toggle=this.find(this.options.toggle),this.content=this.find(this.options.containers),this.content.each(function(i){e=t.$(this),e.parent().data("wrapper")?o=e.parent():(o=t.$(this).wrap('<div data-wrapper="true" style="overflow:hidden;height:0;position:relative;"></div>').parent(),o.attr("aria-expanded","false")),a=n.toggle.eq(i),o.data("toggle",a),o.data("content",e),a.data("wrapper",o),e.data("wrapper",o)}),this.element.trigger("update.uk.accordion",[this]),i&&this.options.showfirst&&this.toggleItem(this.toggle.eq(0).data("wrapper"),!1,!1)}}),t.accordion});
|
@@ -0,0 +1,340 @@
|
|
1
|
+
/*! UIkit 2.27.2 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
|
+
(function(addon) {
|
3
|
+
|
4
|
+
var component;
|
5
|
+
|
6
|
+
if (window.UIkit) {
|
7
|
+
component = addon(UIkit);
|
8
|
+
}
|
9
|
+
|
10
|
+
if (typeof define == 'function' && define.amd) {
|
11
|
+
define('uikit-autocomplete', ['uikit'], function(){
|
12
|
+
return component || addon(UIkit);
|
13
|
+
});
|
14
|
+
}
|
15
|
+
|
16
|
+
})(function(UI){
|
17
|
+
|
18
|
+
"use strict";
|
19
|
+
|
20
|
+
var active;
|
21
|
+
|
22
|
+
UI.component('autocomplete', {
|
23
|
+
|
24
|
+
defaults: {
|
25
|
+
minLength: 3,
|
26
|
+
param: 'search',
|
27
|
+
method: 'post',
|
28
|
+
delay: 300,
|
29
|
+
loadingClass: 'uk-loading',
|
30
|
+
flipDropdown: false,
|
31
|
+
skipClass: 'uk-skip',
|
32
|
+
hoverClass: 'uk-active',
|
33
|
+
source: null,
|
34
|
+
renderer: null,
|
35
|
+
|
36
|
+
// template
|
37
|
+
|
38
|
+
template: '<ul class="uk-nav uk-nav-autocomplete uk-autocomplete-results">{{~items}}<li data-value="{{$item.value}}"><a>{{$item.value}}</a></li>{{/items}}</ul>'
|
39
|
+
},
|
40
|
+
|
41
|
+
visible : false,
|
42
|
+
value : null,
|
43
|
+
selected : null,
|
44
|
+
|
45
|
+
boot: function() {
|
46
|
+
|
47
|
+
// init code
|
48
|
+
UI.$html.on('focus.autocomplete.uikit', '[data-uk-autocomplete]', function(e) {
|
49
|
+
|
50
|
+
var ele = UI.$(this);
|
51
|
+
|
52
|
+
if (!ele.data('autocomplete')) {
|
53
|
+
UI.autocomplete(ele, UI.Utils.options(ele.attr('data-uk-autocomplete')));
|
54
|
+
}
|
55
|
+
});
|
56
|
+
|
57
|
+
// register outer click for autocompletes
|
58
|
+
UI.$html.on('click.autocomplete.uikit', function(e) {
|
59
|
+
if (active && e.target!=active.input[0]) active.hide();
|
60
|
+
});
|
61
|
+
},
|
62
|
+
|
63
|
+
init: function() {
|
64
|
+
|
65
|
+
var $this = this,
|
66
|
+
select = false,
|
67
|
+
trigger = UI.Utils.debounce(function(e) {
|
68
|
+
|
69
|
+
if (select) {
|
70
|
+
return (select = false);
|
71
|
+
}
|
72
|
+
|
73
|
+
$this.handle();
|
74
|
+
}, this.options.delay);
|
75
|
+
|
76
|
+
|
77
|
+
this.dropdown = this.find('.uk-dropdown');
|
78
|
+
this.template = this.find('script[type="text/autocomplete"]').html();
|
79
|
+
this.template = UI.Utils.template(this.template || this.options.template);
|
80
|
+
this.input = this.find("input:first").attr("autocomplete", "off");
|
81
|
+
|
82
|
+
if (!this.dropdown.length) {
|
83
|
+
this.dropdown = UI.$('<div class="uk-dropdown"></div>').appendTo(this.element);
|
84
|
+
}
|
85
|
+
|
86
|
+
if (this.options.flipDropdown) {
|
87
|
+
this.dropdown.addClass('uk-dropdown-flip');
|
88
|
+
}
|
89
|
+
|
90
|
+
this.dropdown.attr('aria-expanded', 'false');
|
91
|
+
|
92
|
+
this.input.on({
|
93
|
+
|
94
|
+
keydown: function(e) {
|
95
|
+
|
96
|
+
if (e && e.which && !e.shiftKey && $this.visible) {
|
97
|
+
|
98
|
+
switch (e.which) {
|
99
|
+
case 13: // enter
|
100
|
+
select = true;
|
101
|
+
|
102
|
+
if ($this.selected) {
|
103
|
+
e.preventDefault();
|
104
|
+
$this.select();
|
105
|
+
}
|
106
|
+
break;
|
107
|
+
case 38: // up
|
108
|
+
e.preventDefault();
|
109
|
+
$this.pick('prev', true);
|
110
|
+
break;
|
111
|
+
case 40: // down
|
112
|
+
e.preventDefault();
|
113
|
+
$this.pick('next', true);
|
114
|
+
break;
|
115
|
+
case 27:
|
116
|
+
case 9: // esc, tab
|
117
|
+
$this.hide();
|
118
|
+
break;
|
119
|
+
default:
|
120
|
+
break;
|
121
|
+
}
|
122
|
+
}
|
123
|
+
|
124
|
+
},
|
125
|
+
|
126
|
+
keyup: trigger
|
127
|
+
});
|
128
|
+
|
129
|
+
this.dropdown.on('click', '.uk-autocomplete-results > *', function(){
|
130
|
+
$this.select();
|
131
|
+
});
|
132
|
+
|
133
|
+
this.dropdown.on('mouseover', '.uk-autocomplete-results > *', function(){
|
134
|
+
$this.pick(UI.$(this));
|
135
|
+
});
|
136
|
+
|
137
|
+
this.triggercomplete = trigger;
|
138
|
+
},
|
139
|
+
|
140
|
+
handle: function() {
|
141
|
+
|
142
|
+
var $this = this, old = this.value;
|
143
|
+
|
144
|
+
this.value = this.input.val();
|
145
|
+
|
146
|
+
if (this.value.length < this.options.minLength) return this.hide();
|
147
|
+
|
148
|
+
if (this.value != old) {
|
149
|
+
$this.request();
|
150
|
+
}
|
151
|
+
|
152
|
+
return this;
|
153
|
+
},
|
154
|
+
|
155
|
+
pick: function(item, scrollinview) {
|
156
|
+
|
157
|
+
var $this = this,
|
158
|
+
items = UI.$(this.dropdown.find('.uk-autocomplete-results').children(':not(.'+this.options.skipClass+')')),
|
159
|
+
selected = false;
|
160
|
+
|
161
|
+
if (typeof item !== "string" && !item.hasClass(this.options.skipClass)) {
|
162
|
+
selected = item;
|
163
|
+
} else if (item == 'next' || item == 'prev') {
|
164
|
+
|
165
|
+
if (this.selected) {
|
166
|
+
var index = items.index(this.selected);
|
167
|
+
|
168
|
+
if (item == 'next') {
|
169
|
+
selected = items.eq(index + 1 < items.length ? index + 1 : 0);
|
170
|
+
} else {
|
171
|
+
selected = items.eq(index - 1 < 0 ? items.length - 1 : index - 1);
|
172
|
+
}
|
173
|
+
|
174
|
+
} else {
|
175
|
+
selected = items[(item == 'next') ? 'first' : 'last']();
|
176
|
+
}
|
177
|
+
|
178
|
+
selected = UI.$(selected);
|
179
|
+
}
|
180
|
+
|
181
|
+
if (selected && selected.length) {
|
182
|
+
this.selected = selected;
|
183
|
+
items.removeClass(this.options.hoverClass);
|
184
|
+
this.selected.addClass(this.options.hoverClass);
|
185
|
+
|
186
|
+
// jump to selected if not in view
|
187
|
+
if (scrollinview) {
|
188
|
+
|
189
|
+
var top = selected.position().top,
|
190
|
+
scrollTop = $this.dropdown.scrollTop(),
|
191
|
+
dpheight = $this.dropdown.height();
|
192
|
+
|
193
|
+
if (top > dpheight || top < 0) {
|
194
|
+
$this.dropdown.scrollTop(scrollTop + top);
|
195
|
+
}
|
196
|
+
}
|
197
|
+
}
|
198
|
+
},
|
199
|
+
|
200
|
+
select: function() {
|
201
|
+
|
202
|
+
if(!this.selected) return;
|
203
|
+
|
204
|
+
var data = this.selected.data();
|
205
|
+
|
206
|
+
this.trigger('selectitem.uk.autocomplete', [data, this]);
|
207
|
+
|
208
|
+
if (data.value) {
|
209
|
+
this.input.val(data.value).trigger('change');
|
210
|
+
}
|
211
|
+
|
212
|
+
this.hide();
|
213
|
+
},
|
214
|
+
|
215
|
+
show: function() {
|
216
|
+
|
217
|
+
if (this.visible) return;
|
218
|
+
|
219
|
+
this.visible = true;
|
220
|
+
this.element.addClass('uk-open');
|
221
|
+
|
222
|
+
if (active && active!==this) {
|
223
|
+
active.hide();
|
224
|
+
}
|
225
|
+
|
226
|
+
active = this;
|
227
|
+
|
228
|
+
// Update aria
|
229
|
+
this.dropdown.attr('aria-expanded', 'true');
|
230
|
+
|
231
|
+
return this;
|
232
|
+
},
|
233
|
+
|
234
|
+
hide: function() {
|
235
|
+
if (!this.visible) return;
|
236
|
+
this.visible = false;
|
237
|
+
this.element.removeClass('uk-open');
|
238
|
+
|
239
|
+
if (active === this) {
|
240
|
+
active = false;
|
241
|
+
}
|
242
|
+
|
243
|
+
// Update aria
|
244
|
+
this.dropdown.attr('aria-expanded', 'false');
|
245
|
+
|
246
|
+
return this;
|
247
|
+
},
|
248
|
+
|
249
|
+
request: function() {
|
250
|
+
|
251
|
+
var $this = this,
|
252
|
+
release = function(data) {
|
253
|
+
|
254
|
+
if(data) {
|
255
|
+
$this.render(data);
|
256
|
+
}
|
257
|
+
|
258
|
+
$this.element.removeClass($this.options.loadingClass);
|
259
|
+
};
|
260
|
+
|
261
|
+
this.element.addClass(this.options.loadingClass);
|
262
|
+
|
263
|
+
if (this.options.source) {
|
264
|
+
|
265
|
+
var source = this.options.source;
|
266
|
+
|
267
|
+
switch(typeof(this.options.source)) {
|
268
|
+
case 'function':
|
269
|
+
|
270
|
+
this.options.source.apply(this, [release]);
|
271
|
+
|
272
|
+
break;
|
273
|
+
|
274
|
+
case 'object':
|
275
|
+
|
276
|
+
if(source.length) {
|
277
|
+
|
278
|
+
var items = [];
|
279
|
+
|
280
|
+
source.forEach(function(item){
|
281
|
+
if(item.value && item.value.toLowerCase().indexOf($this.value.toLowerCase())!=-1) {
|
282
|
+
items.push(item);
|
283
|
+
}
|
284
|
+
});
|
285
|
+
|
286
|
+
release(items);
|
287
|
+
}
|
288
|
+
|
289
|
+
break;
|
290
|
+
|
291
|
+
case 'string':
|
292
|
+
|
293
|
+
var params ={};
|
294
|
+
|
295
|
+
params[this.options.param] = this.value;
|
296
|
+
|
297
|
+
UI.$.ajax({
|
298
|
+
url: this.options.source,
|
299
|
+
data: params,
|
300
|
+
type: this.options.method,
|
301
|
+
dataType: 'json'
|
302
|
+
}).done(function(json) {
|
303
|
+
release(json || []);
|
304
|
+
});
|
305
|
+
|
306
|
+
break;
|
307
|
+
|
308
|
+
default:
|
309
|
+
release(null);
|
310
|
+
}
|
311
|
+
|
312
|
+
} else {
|
313
|
+
this.element.removeClass($this.options.loadingClass);
|
314
|
+
}
|
315
|
+
},
|
316
|
+
|
317
|
+
render: function(data) {
|
318
|
+
|
319
|
+
this.dropdown.empty();
|
320
|
+
|
321
|
+
this.selected = false;
|
322
|
+
|
323
|
+
if (this.options.renderer) {
|
324
|
+
|
325
|
+
this.options.renderer.apply(this, [data]);
|
326
|
+
|
327
|
+
} else if(data && data.length) {
|
328
|
+
|
329
|
+
this.dropdown.append(this.template({items:data}));
|
330
|
+
this.show();
|
331
|
+
|
332
|
+
this.trigger('show.uk.autocomplete');
|
333
|
+
}
|
334
|
+
|
335
|
+
return this;
|
336
|
+
}
|
337
|
+
});
|
338
|
+
|
339
|
+
return UI.autocomplete;
|
340
|
+
});
|