uikit-rails 0.0.2 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (177) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -3
  3. data/Gemfile +2 -1
  4. data/LICENSE.txt +21 -0
  5. data/README.md +65 -0
  6. data/Rakefile +0 -1
  7. data/assets/fonts/FontAwesome.otf +0 -0
  8. data/assets/fonts/fontawesome-webfont.ttf +0 -0
  9. data/assets/fonts/fontawesome-webfont.woff +0 -0
  10. data/assets/fonts/fontawesome-webfont.woff2 +0 -0
  11. data/assets/javascripts/components/accordion.js +174 -0
  12. data/assets/javascripts/components/accordion.min.js +2 -0
  13. data/assets/javascripts/components/autocomplete.js +334 -0
  14. data/assets/javascripts/components/autocomplete.min.js +2 -0
  15. data/assets/javascripts/components/datepicker.js +3166 -0
  16. data/assets/javascripts/components/datepicker.min.js +3 -0
  17. data/assets/javascripts/components/form-password.js +67 -0
  18. data/assets/javascripts/components/form-password.min.js +2 -0
  19. data/assets/javascripts/components/form-select.js +70 -0
  20. data/assets/javascripts/components/form-select.min.js +2 -0
  21. data/assets/javascripts/components/grid.js +527 -0
  22. data/assets/javascripts/components/grid.min.js +2 -0
  23. data/assets/javascripts/components/htmleditor.js +623 -0
  24. data/assets/javascripts/components/htmleditor.min.js +2 -0
  25. data/assets/javascripts/components/lightbox.js +555 -0
  26. data/assets/javascripts/components/lightbox.min.js +2 -0
  27. data/assets/javascripts/components/nestable.js +638 -0
  28. data/assets/javascripts/components/nestable.min.js +2 -0
  29. data/assets/javascripts/components/notify.js +189 -0
  30. data/assets/javascripts/components/notify.min.js +2 -0
  31. data/assets/javascripts/components/pagination.js +147 -0
  32. data/assets/javascripts/components/pagination.min.js +2 -0
  33. data/assets/javascripts/components/parallax.js +435 -0
  34. data/assets/javascripts/components/parallax.min.js +2 -0
  35. data/assets/javascripts/components/search.js +92 -0
  36. data/assets/javascripts/components/search.min.js +2 -0
  37. data/assets/javascripts/components/slider.js +531 -0
  38. data/assets/javascripts/components/slider.min.js +2 -0
  39. data/assets/javascripts/components/slideset.js +506 -0
  40. data/assets/javascripts/components/slideset.min.js +2 -0
  41. data/assets/javascripts/components/slideshow-fx.js +375 -0
  42. data/assets/javascripts/components/slideshow-fx.min.js +2 -0
  43. data/assets/javascripts/components/slideshow.js +562 -0
  44. data/assets/javascripts/components/slideshow.min.js +2 -0
  45. data/assets/javascripts/components/sortable.js +688 -0
  46. data/assets/javascripts/components/sortable.min.js +2 -0
  47. data/assets/javascripts/components/sticky.js +359 -0
  48. data/assets/javascripts/components/sticky.min.js +2 -0
  49. data/assets/javascripts/components/timepicker.js +192 -0
  50. data/assets/javascripts/components/timepicker.min.js +2 -0
  51. data/assets/javascripts/components/tooltip.js +234 -0
  52. data/assets/javascripts/components/tooltip.min.js +2 -0
  53. data/assets/javascripts/components/upload.js +260 -0
  54. data/assets/javascripts/components/upload.min.js +2 -0
  55. data/assets/javascripts/core/alert.js +66 -0
  56. data/assets/javascripts/core/alert.min.js +2 -0
  57. data/assets/javascripts/core/button.js +157 -0
  58. data/assets/javascripts/core/button.min.js +2 -0
  59. data/assets/javascripts/core/core.js +730 -0
  60. data/assets/javascripts/core/core.min.js +2 -0
  61. data/assets/javascripts/core/cover.js +95 -0
  62. data/assets/javascripts/core/cover.min.js +2 -0
  63. data/assets/javascripts/core/dropdown.js +514 -0
  64. data/assets/javascripts/core/dropdown.min.js +2 -0
  65. data/assets/javascripts/core/grid.js +114 -0
  66. data/assets/javascripts/core/grid.min.js +2 -0
  67. data/assets/javascripts/core/modal.js +384 -0
  68. data/assets/javascripts/core/modal.min.js +2 -0
  69. data/assets/javascripts/core/nav.js +136 -0
  70. data/assets/javascripts/core/nav.min.js +2 -0
  71. data/assets/javascripts/core/offcanvas.js +180 -0
  72. data/assets/javascripts/core/offcanvas.min.js +2 -0
  73. data/assets/javascripts/core/scrollspy.js +208 -0
  74. data/assets/javascripts/core/scrollspy.min.js +2 -0
  75. data/assets/javascripts/core/smooth-scroll.js +62 -0
  76. data/assets/javascripts/core/smooth-scroll.min.js +2 -0
  77. data/assets/javascripts/core/switcher.js +309 -0
  78. data/assets/javascripts/core/switcher.min.js +2 -0
  79. data/assets/javascripts/core/tab.js +167 -0
  80. data/assets/javascripts/core/tab.min.js +2 -0
  81. data/assets/javascripts/core/toggle.js +120 -0
  82. data/assets/javascripts/core/toggle.min.js +2 -0
  83. data/assets/javascripts/core/touch.js +175 -0
  84. data/assets/javascripts/core/touch.min.js +2 -0
  85. data/assets/javascripts/core/utility.js +289 -0
  86. data/assets/javascripts/core/utility.min.js +2 -0
  87. data/assets/javascripts/uikit-components.js +23 -0
  88. data/assets/javascripts/uikit.js +3706 -0
  89. data/assets/javascripts/uikit.min.js +3 -0
  90. data/assets/stylesheets/components/accordion.scss +94 -0
  91. data/assets/stylesheets/components/autocomplete.scss +102 -0
  92. data/assets/stylesheets/components/datepicker.scss +197 -0
  93. data/assets/stylesheets/components/dotnav.scss +212 -0
  94. data/assets/stylesheets/components/form-advanced.scss +128 -0
  95. data/assets/stylesheets/components/form-file.scss +63 -0
  96. data/assets/stylesheets/components/form-password.scss +74 -0
  97. data/assets/stylesheets/components/form-select.scss +66 -0
  98. data/assets/stylesheets/components/htmleditor.scss +269 -0
  99. data/assets/stylesheets/components/nestable.scss +229 -0
  100. data/assets/stylesheets/components/notify.scss +190 -0
  101. data/assets/stylesheets/components/placeholder.scss +66 -0
  102. data/assets/stylesheets/components/progress.scss +173 -0
  103. data/assets/stylesheets/components/search.scss +309 -0
  104. data/assets/stylesheets/components/slidenav.scss +183 -0
  105. data/assets/stylesheets/components/slider.scss +131 -0
  106. data/assets/stylesheets/components/slideshow.scss +208 -0
  107. data/assets/stylesheets/components/sortable.scss +122 -0
  108. data/assets/stylesheets/components/sticky.scss +64 -0
  109. data/assets/stylesheets/components/tooltip.scss +177 -0
  110. data/assets/stylesheets/components/upload.scss +34 -0
  111. data/assets/stylesheets/core/alert.scss +141 -0
  112. data/assets/stylesheets/core/animation.scss +599 -0
  113. data/assets/stylesheets/core/article.scss +139 -0
  114. data/assets/stylesheets/core/badge.scss +110 -0
  115. data/assets/stylesheets/core/base-noconflict.scss +397 -0
  116. data/assets/stylesheets/core/base.scss +541 -0
  117. data/assets/stylesheets/core/block.scss +153 -0
  118. data/assets/stylesheets/core/breadcrumb.scss +86 -0
  119. data/assets/stylesheets/core/button.scss +406 -0
  120. data/assets/stylesheets/core/close.scss +132 -0
  121. data/assets/stylesheets/core/column.scss +209 -0
  122. data/assets/stylesheets/core/comment.scss +172 -0
  123. data/assets/stylesheets/core/contrast.scss +493 -0
  124. data/assets/stylesheets/core/cover.scss +70 -0
  125. data/assets/stylesheets/core/description-list.scss +71 -0
  126. data/assets/stylesheets/core/dropdown.scss +280 -0
  127. data/assets/stylesheets/core/flex.scss +320 -0
  128. data/assets/stylesheets/core/form.scss +627 -0
  129. data/assets/stylesheets/core/grid.scss +688 -0
  130. data/assets/stylesheets/core/icon.scss +897 -0
  131. data/assets/stylesheets/core/list.scss +102 -0
  132. data/assets/stylesheets/core/modal.scss +341 -0
  133. data/assets/stylesheets/core/nav.scss +468 -0
  134. data/assets/stylesheets/core/navbar.scss +325 -0
  135. data/assets/stylesheets/core/offcanvas.scss +168 -0
  136. data/assets/stylesheets/core/overlay.scss +534 -0
  137. data/assets/stylesheets/core/pagination.scss +197 -0
  138. data/assets/stylesheets/core/panel.scss +332 -0
  139. data/assets/stylesheets/core/print.scss +59 -0
  140. data/assets/stylesheets/core/subnav.scss +213 -0
  141. data/assets/stylesheets/core/switcher.scss +38 -0
  142. data/assets/stylesheets/core/tab.scss +368 -0
  143. data/assets/stylesheets/core/table.scss +147 -0
  144. data/assets/stylesheets/core/text.scss +128 -0
  145. data/assets/stylesheets/core/thumbnail.scss +122 -0
  146. data/assets/stylesheets/core/thumbnav.scss +122 -0
  147. data/assets/stylesheets/core/utility.scss +606 -0
  148. data/assets/stylesheets/core/variables.scss +23 -0
  149. data/assets/stylesheets/uikit-components.scss +22 -0
  150. data/assets/stylesheets/uikit-mixins.scss +327 -0
  151. data/assets/stylesheets/uikit-variables.scss +817 -0
  152. data/assets/stylesheets/uikit.scss +56 -0
  153. data/lib/uikit-rails.rb +2 -2
  154. data/lib/uikit-rails/engine.rb +11 -1
  155. data/lib/uikit-rails/version.rb +1 -3
  156. data/uikit-rails.gemspec +15 -16
  157. metadata +169 -44
  158. data/README.rb +0 -1
  159. data/vendor/assets/javascripts/ui.card.js +0 -115
  160. data/vendor/assets/javascripts/ui.color-picker.js +0 -351
  161. data/vendor/assets/javascripts/ui.confirmation.js +0 -133
  162. data/vendor/assets/javascripts/ui.dialog.js +0 -252
  163. data/vendor/assets/javascripts/ui.emitter.js +0 -99
  164. data/vendor/assets/javascripts/ui.js +0 -1641
  165. data/vendor/assets/javascripts/ui.menu.js +0 -238
  166. data/vendor/assets/javascripts/ui.notification.js +0 -240
  167. data/vendor/assets/javascripts/ui.overlay.js +0 -79
  168. data/vendor/assets/javascripts/ui.split-button.js +0 -108
  169. data/vendor/assets/stylesheets/ui.card.css +0 -55
  170. data/vendor/assets/stylesheets/ui.color-picker.css +0 -6
  171. data/vendor/assets/stylesheets/ui.confirmation.css +0 -7
  172. data/vendor/assets/stylesheets/ui.css +0 -337
  173. data/vendor/assets/stylesheets/ui.dialog.css +0 -92
  174. data/vendor/assets/stylesheets/ui.menu.css +0 -32
  175. data/vendor/assets/stylesheets/ui.notification.css +0 -107
  176. data/vendor/assets/stylesheets/ui.overlay.css +0 -16
  177. data/vendor/assets/stylesheets/ui.split-button.css +0 -27
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f59f3bd6d8784bd4f4b9bcf7f95108af4fbf358f
4
+ data.tar.gz: ffb30c359a44022047c955a43c7f02ce60cacddd
5
+ SHA512:
6
+ metadata.gz: c5b4f6b8ef516077b7dcdbe63e91b04a2bf09656f3181442bb889203d1c96d15b5bb34f3bd8ad6228e049785f7d7fdb2205b840601bde80886f39ae16d5958df
7
+ data.tar.gz: f444d804e68128b27037497e26af984e8f99d496dae597468445095ef0e42d67bdcd64e49d0a2cb59208bf760d63c32af93971fc0c32d0e61ea3abec0ac6a561
data/.gitignore CHANGED
@@ -1,4 +1,10 @@
1
1
  *.gem
2
- .bundle
3
- Gemfile.lock
4
- pkg/*
2
+ /.bundle/
3
+ /.yardoc
4
+ /Gemfile.lock
5
+ /_yardoc/
6
+ /coverage/
7
+ /doc/
8
+ /pkg/
9
+ /spec/reports/
10
+ /tmp/
data/Gemfile CHANGED
@@ -1,3 +1,4 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
 
3
+ # Specify your gem's dependencies in uikitten.gemspec
3
4
  gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Airship, LLC
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,65 @@
1
+ # UIKit for Sass
2
+ [![Gem Version](https://badge.fury.io/rb/uikit-rails.svg)](https://badge.fury.io/rb/uikit-rails)
3
+
4
+ ## Installation
5
+
6
+ `uikit-rails` is easy to drop into Rails with the asset pipeline.
7
+
8
+ In your Gemfile you need to add the `uikit-rails` gem, and ensure that the `sass-rails` gem is present - it is added to new Rails applications by default.
9
+
10
+ ```ruby
11
+ gem 'uikit-rails'
12
+ gem 'sass-rails', '>= 3.2'
13
+ ```
14
+
15
+ `bundle install` and restart your server to make the files available through the pipeline.
16
+
17
+ Import UIKit styles in `app/assets/stylesheets/application.scss`:
18
+
19
+ ```scss
20
+ @import "uikit";
21
+ @import "uikit-components";
22
+ ```
23
+
24
+ Make sure the file has `.scss` extension (or `.sass` for Sass syntax). If you have just generated a new Rails app,
25
+ it may come with a `.css` file instead. If this file exists, it will be served instead of Sass, so rename it:
26
+
27
+ ```console
28
+ $ mv app/assets/stylesheets/application.css app/assets/stylesheets/application.scss
29
+ ```
30
+
31
+ Then, remove all the `*= require_self` and `*= require_tree .` statements from the sass file. Instead, use `@import` to import Sass files.
32
+
33
+ Require UIKit Javascripts in `app/assets/javascripts/application.js`:
34
+
35
+ ```js
36
+ //= require jquery
37
+ //= require uikit
38
+ //= require uikit-components
39
+ ```
40
+
41
+ ## Usage
42
+
43
+ Import UIKit into a Sass file (for example, application.scss) to get all of UIKit's styles, mixins and variables!
44
+
45
+ ```scss
46
+ @import "uikit";
47
+ ```
48
+
49
+ The full list of uikit variables can be found [here](https://github.com/thinkairship/uikit-rails/wiki/Variables). You can override these by simply redefining the variable before the `@import` directive, e.g.:
50
+
51
+ ```scss
52
+ $button-primary-color: #FF4200;
53
+ $light-orange: #ff8c00;
54
+ $nav-navbar-color: $light-orange;
55
+
56
+ @import "uikit";
57
+ ```
58
+
59
+ ## Contributing
60
+
61
+ Bug reports and pull requests are welcome on GitHub at https://github.com/thinkairship/uikit-rails.
62
+
63
+ ## License
64
+
65
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile CHANGED
@@ -1,2 +1 @@
1
- require 'json'
2
1
  require "bundler/gem_tasks"
@@ -0,0 +1,174 @@
1
+ /*! UIkit 2.24.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.uikit.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();
63
+
64
+ if (this.options.showfirst) {
65
+ this.toggleItem(this.toggle.eq(0).data('wrapper'), false, false);
66
+ }
67
+ },
68
+
69
+ toggleItem: function(wrapper, animated, collapse) {
70
+
71
+ var $this = this;
72
+
73
+ wrapper.data('toggle').toggleClass(this.options.clsactive);
74
+ wrapper.data('content').toggleClass(this.options.clsactive);
75
+
76
+ var active = wrapper.data('toggle').hasClass(this.options.clsactive);
77
+
78
+ if (collapse) {
79
+ this.toggle.not(wrapper.data('toggle')).removeClass(this.options.clsactive);
80
+ this.content.not(wrapper.data('content')).removeClass(this.options.clsactive)
81
+ .parent().stop().css('overflow', 'hidden').animate({ height: 0 }, {easing: this.options.easing, duration: animated ? this.options.duration : 0}).attr('aria-expanded', 'false');
82
+ }
83
+
84
+ wrapper.stop().css('overflow', 'hidden');
85
+
86
+ if (animated) {
87
+
88
+ wrapper.animate({ height: active ? getHeight(wrapper.data('content')) : 0 }, {easing: this.options.easing, duration: this.options.duration, complete: function() {
89
+
90
+ if (active) {
91
+ wrapper.css({'overflow': '', 'height': 'auto'});
92
+ UI.Utils.checkDisplay(wrapper.data('content'));
93
+ }
94
+
95
+ $this.trigger('display.uk.check');
96
+ }});
97
+
98
+ } else {
99
+
100
+ wrapper.height(active ? 'auto' : 0);
101
+
102
+ if (active) {
103
+ wrapper.css({'overflow': ''});
104
+ UI.Utils.checkDisplay(wrapper.data('content'));
105
+ }
106
+
107
+ this.trigger('display.uk.check');
108
+ }
109
+
110
+ // Update ARIA
111
+ wrapper.attr('aria-expanded', active);
112
+
113
+ this.element.trigger('toggle.uk.accordion', [active, wrapper.data('toggle'), wrapper.data('content')]);
114
+ },
115
+
116
+ update: function() {
117
+
118
+ var $this = this, $content, $wrapper, $toggle;
119
+
120
+ this.toggle = this.find(this.options.toggle);
121
+ this.content = this.find(this.options.containers);
122
+
123
+ this.content.each(function(index) {
124
+
125
+ $content = UI.$(this);
126
+
127
+ if ($content.parent().data('wrapper')) {
128
+ $wrapper = $content.parent();
129
+ } else {
130
+ $wrapper = UI.$(this).wrap('<div data-wrapper="true" style="overflow:hidden;height:0;position:relative;"></div>').parent();
131
+
132
+ // Init ARIA
133
+ $wrapper.attr('aria-expanded', 'false');
134
+ }
135
+
136
+ $toggle = $this.toggle.eq(index);
137
+
138
+ $wrapper.data('toggle', $toggle);
139
+ $wrapper.data('content', $content);
140
+ $toggle.data('wrapper', $wrapper);
141
+ $content.data('wrapper', $wrapper);
142
+ });
143
+
144
+ this.element.trigger('update.uk.accordion', [this]);
145
+ }
146
+
147
+ });
148
+
149
+ // helper
150
+
151
+ function getHeight(ele) {
152
+
153
+ var $ele = UI.$(ele), height = "auto";
154
+
155
+ if ($ele.is(":visible")) {
156
+ height = $ele.outerHeight();
157
+ } else {
158
+
159
+ var tmp = {
160
+ position : $ele.css("position"),
161
+ visibility : $ele.css("visibility"),
162
+ display : $ele.css("display")
163
+ };
164
+
165
+ height = $ele.css({position: 'absolute', visibility: 'hidden', display: 'block'}).outerHeight();
166
+
167
+ $ele.css(tmp); // reset element
168
+ }
169
+
170
+ return height;
171
+ }
172
+
173
+ return UI.accordion;
174
+ });
@@ -0,0 +1,2 @@
1
+ /*! UIkit 2.24.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 o=t.$(i),e="auto";if(o.is(":visible"))e=o.outerHeight();else{var a={position:o.css("position"),visibility:o.css("visibility"),display:o.css("display")};e=o.css({position:"absolute",visibility:"hidden",display:"block"}).outerHeight(),o.css(a)}return e}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.uikit.accordion",this.options.toggle,function(o){o.preventDefault(),i.toggleItem(t.$(this).data("wrapper"),i.options.animate,i.options.collapse)}),this.update(),this.options.showfirst&&this.toggleItem(this.toggle.eq(0).data("wrapper"),!1,!1)},toggleItem:function(o,e,a){var n=this;o.data("toggle").toggleClass(this.options.clsactive),o.data("content").toggleClass(this.options.clsactive);var s=o.data("toggle").hasClass(this.options.clsactive);a&&(this.toggle.not(o.data("toggle")).removeClass(this.options.clsactive),this.content.not(o.data("content")).removeClass(this.options.clsactive).parent().stop().css("overflow","hidden").animate({height:0},{easing:this.options.easing,duration:e?this.options.duration:0}).attr("aria-expanded","false")),o.stop().css("overflow","hidden"),e?o.animate({height:s?i(o.data("content")):0},{easing:this.options.easing,duration:this.options.duration,complete:function(){s&&(o.css({overflow:"",height:"auto"}),t.Utils.checkDisplay(o.data("content"))),n.trigger("display.uk.check")}}):(o.height(s?"auto":0),s&&(o.css({overflow:""}),t.Utils.checkDisplay(o.data("content"))),this.trigger("display.uk.check")),o.attr("aria-expanded",s),this.element.trigger("toggle.uk.accordion",[s,o.data("toggle"),o.data("content")])},update:function(){var i,o,e,a=this;this.toggle=this.find(this.options.toggle),this.content=this.find(this.options.containers),this.content.each(function(n){i=t.$(this),i.parent().data("wrapper")?o=i.parent():(o=t.$(this).wrap('<div data-wrapper="true" style="overflow:hidden;height:0;position:relative;"></div>').parent(),o.attr("aria-expanded","false")),e=a.toggle.eq(n),o.data("toggle",e),o.data("content",i),e.data("wrapper",o),i.data("wrapper",o)}),this.element.trigger("update.uk.accordion",[this])}}),t.accordion});
@@ -0,0 +1,334 @@
1
+ /*! UIkit 2.24.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
+ if(select) {
69
+ return (select = false);
70
+ }
71
+ $this.handle();
72
+ }, this.options.delay);
73
+
74
+
75
+ this.dropdown = this.find('.uk-dropdown');
76
+ this.template = this.find('script[type="text/autocomplete"]').html();
77
+ this.template = UI.Utils.template(this.template || this.options.template);
78
+ this.input = this.find("input:first").attr("autocomplete", "off");
79
+
80
+ if (!this.dropdown.length) {
81
+ this.dropdown = UI.$('<div class="uk-dropdown"></div>').appendTo(this.element);
82
+ }
83
+
84
+ if (this.options.flipDropdown) {
85
+ this.dropdown.addClass('uk-dropdown-flip');
86
+ }
87
+
88
+ this.dropdown.attr('aria-expanded', 'false');
89
+
90
+ this.input.on({
91
+ "keydown": function(e) {
92
+
93
+ if (e && e.which && !e.shiftKey) {
94
+
95
+ switch (e.which) {
96
+ case 13: // enter
97
+ select = true;
98
+
99
+ if ($this.selected) {
100
+ e.preventDefault();
101
+ $this.select();
102
+ }
103
+ break;
104
+ case 38: // up
105
+ e.preventDefault();
106
+ $this.pick('prev', true);
107
+ break;
108
+ case 40: // down
109
+ e.preventDefault();
110
+ $this.pick('next', true);
111
+ break;
112
+ case 27:
113
+ case 9: // esc, tab
114
+ $this.hide();
115
+ break;
116
+ default:
117
+ break;
118
+ }
119
+ }
120
+
121
+ },
122
+ "keyup": trigger
123
+ });
124
+
125
+ this.dropdown.on("click", ".uk-autocomplete-results > *", function(){
126
+ $this.select();
127
+ });
128
+
129
+ this.dropdown.on("mouseover", ".uk-autocomplete-results > *", function(){
130
+ $this.pick(UI.$(this));
131
+ });
132
+
133
+ this.triggercomplete = trigger;
134
+ },
135
+
136
+ handle: function() {
137
+
138
+ var $this = this, old = this.value;
139
+
140
+ this.value = this.input.val();
141
+
142
+ if (this.value.length < this.options.minLength) return this.hide();
143
+
144
+ if (this.value != old) {
145
+ $this.request();
146
+ }
147
+
148
+ return this;
149
+ },
150
+
151
+ pick: function(item, scrollinview) {
152
+
153
+ var $this = this,
154
+ items = UI.$(this.dropdown.find('.uk-autocomplete-results').children(':not(.'+this.options.skipClass+')')),
155
+ selected = false;
156
+
157
+ if (typeof item !== "string" && !item.hasClass(this.options.skipClass)) {
158
+ selected = item;
159
+ } else if (item == 'next' || item == 'prev') {
160
+
161
+ if (this.selected) {
162
+ var index = items.index(this.selected);
163
+
164
+ if (item == 'next') {
165
+ selected = items.eq(index + 1 < items.length ? index + 1 : 0);
166
+ } else {
167
+ selected = items.eq(index - 1 < 0 ? items.length - 1 : index - 1);
168
+ }
169
+
170
+ } else {
171
+ selected = items[(item == 'next') ? 'first' : 'last']();
172
+ }
173
+
174
+ selected = UI.$(selected);
175
+ }
176
+
177
+ if (selected && selected.length) {
178
+ this.selected = selected;
179
+ items.removeClass(this.options.hoverClass);
180
+ this.selected.addClass(this.options.hoverClass);
181
+
182
+ // jump to selected if not in view
183
+ if (scrollinview) {
184
+
185
+ var top = selected.position().top,
186
+ scrollTop = $this.dropdown.scrollTop(),
187
+ dpheight = $this.dropdown.height();
188
+
189
+ if (top > dpheight || top < 0) {
190
+ $this.dropdown.scrollTop(scrollTop + top);
191
+ }
192
+ }
193
+ }
194
+ },
195
+
196
+ select: function() {
197
+
198
+ if(!this.selected) return;
199
+
200
+ var data = this.selected.data();
201
+
202
+ this.trigger("selectitem.uk.autocomplete", [data, this]);
203
+
204
+ if (data.value) {
205
+ this.input.val(data.value).trigger('change');
206
+ }
207
+
208
+ this.hide();
209
+ },
210
+
211
+ show: function() {
212
+ if (this.visible) return;
213
+ this.visible = true;
214
+ this.element.addClass("uk-open");
215
+
216
+ if (active && active!==this) {
217
+ active.hide();
218
+ }
219
+
220
+ active = this;
221
+
222
+ // Update aria
223
+ this.dropdown.attr('aria-expanded', 'true');
224
+
225
+ return this;
226
+ },
227
+
228
+ hide: function() {
229
+ if (!this.visible) return;
230
+ this.visible = false;
231
+ this.element.removeClass("uk-open");
232
+
233
+ if (active === this) {
234
+ active = false;
235
+ }
236
+
237
+ // Update aria
238
+ this.dropdown.attr('aria-expanded', 'false');
239
+
240
+ return this;
241
+ },
242
+
243
+ request: function() {
244
+
245
+ var $this = this,
246
+ release = function(data) {
247
+
248
+ if(data) {
249
+ $this.render(data);
250
+ }
251
+
252
+ $this.element.removeClass($this.options.loadingClass);
253
+ };
254
+
255
+ this.element.addClass(this.options.loadingClass);
256
+
257
+ if (this.options.source) {
258
+
259
+ var source = this.options.source;
260
+
261
+ switch(typeof(this.options.source)) {
262
+ case 'function':
263
+
264
+ this.options.source.apply(this, [release]);
265
+
266
+ break;
267
+
268
+ case 'object':
269
+
270
+ if(source.length) {
271
+
272
+ var items = [];
273
+
274
+ source.forEach(function(item){
275
+ if(item.value && item.value.toLowerCase().indexOf($this.value.toLowerCase())!=-1) {
276
+ items.push(item);
277
+ }
278
+ });
279
+
280
+ release(items);
281
+ }
282
+
283
+ break;
284
+
285
+ case 'string':
286
+
287
+ var params ={};
288
+
289
+ params[this.options.param] = this.value;
290
+
291
+ UI.$.ajax({
292
+ url: this.options.source,
293
+ data: params,
294
+ type: this.options.method,
295
+ dataType: 'json'
296
+ }).done(function(json) {
297
+ release(json || []);
298
+ });
299
+
300
+ break;
301
+
302
+ default:
303
+ release(null);
304
+ }
305
+
306
+ } else {
307
+ this.element.removeClass($this.options.loadingClass);
308
+ }
309
+ },
310
+
311
+ render: function(data) {
312
+
313
+ this.dropdown.empty();
314
+
315
+ this.selected = false;
316
+
317
+ if (this.options.renderer) {
318
+
319
+ this.options.renderer.apply(this, [data]);
320
+
321
+ } else if(data && data.length) {
322
+
323
+ this.dropdown.append(this.template({"items":data}));
324
+ this.show();
325
+
326
+ this.trigger('show.uk.autocomplete');
327
+ }
328
+
329
+ return this;
330
+ }
331
+ });
332
+
333
+ return UI.autocomplete;
334
+ });