uikit-rails 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,79 @@
1
+
2
+ /**
3
+ * Expose `Overlay`.
4
+ */
5
+
6
+ exports.Overlay = Overlay;
7
+
8
+ /**
9
+ * Return a new `Overlay` with the given `options`.
10
+ *
11
+ * @param {Object} options
12
+ * @return {Overlay}
13
+ * @api public
14
+ */
15
+
16
+ exports.overlay = function(options){
17
+ return new Overlay(options);
18
+ };
19
+
20
+ /**
21
+ * Initialize a new `Overlay`.
22
+ *
23
+ * @param {Object} options
24
+ * @api public
25
+ */
26
+
27
+ function Overlay(options) {
28
+ ui.Emitter.call(this);
29
+ var self = this;
30
+ options = options || {};
31
+ this.closable = options.closable;
32
+ this.el = $(html);
33
+ this.el.appendTo('body');
34
+ if (this.closable) {
35
+ this.el.click(function(){
36
+ self.hide();
37
+ });
38
+ }
39
+ }
40
+
41
+ /**
42
+ * Inherit from `Emitter.prototype`.
43
+ */
44
+
45
+ Overlay.prototype = new ui.Emitter;
46
+
47
+ /**
48
+ * Show the overlay.
49
+ *
50
+ * Emits "show" event.
51
+ *
52
+ * @return {Overlay} for chaining
53
+ * @api public
54
+ */
55
+
56
+ Overlay.prototype.show = function(){
57
+ this.emit('show');
58
+ this.el.removeClass('hide');
59
+ return this;
60
+ };
61
+
62
+ /**
63
+ * Hide the overlay.
64
+ *
65
+ * Emits "hide" event.
66
+ *
67
+ * @return {Overlay} for chaining
68
+ * @api public
69
+ */
70
+
71
+ Overlay.prototype.hide = function(){
72
+ var self = this;
73
+ this.emit('hide');
74
+ this.el.addClass('hide');
75
+ setTimeout(function(){
76
+ self.el.remove();
77
+ }, 2000);
78
+ return this;
79
+ };
@@ -0,0 +1,108 @@
1
+
2
+ /**
3
+ * Expose `SplitButton`.
4
+ */
5
+
6
+ exports.SplitButton = SplitButton;
7
+
8
+ /**
9
+ * Initialize a new `SplitButton`
10
+ * with an optional `label`.
11
+ *
12
+ * @param {String} label
13
+ * @api public
14
+ */
15
+
16
+ function SplitButton(label) {
17
+ ui.Emitter.call(this);
18
+ this.el = $(html);
19
+ this.events();
20
+ this.render({ label: label });
21
+ this.state = 'hidden';
22
+ }
23
+
24
+ /**
25
+ * Inherit from `Emitter.prototype`.
26
+ */
27
+
28
+ SplitButton.prototype = new ui.Emitter;
29
+
30
+ /**
31
+ * Register event handlers.
32
+ *
33
+ * @api private
34
+ */
35
+
36
+ SplitButton.prototype.events = function(){
37
+ var self = this
38
+ , el = this.el;
39
+
40
+ el.find('.button').click(function(e){
41
+ e.preventDefault();
42
+ self.emit('click', e);
43
+ });
44
+
45
+ el.find('.toggle').click(function(e){
46
+ e.preventDefault();
47
+ self.toggle();
48
+ });
49
+ };
50
+
51
+ /**
52
+ * Toggle the drop-down contents.
53
+ *
54
+ * @return {SplitButton}
55
+ * @api public
56
+ */
57
+
58
+ SplitButton.prototype.toggle = function(){
59
+ return 'hidden' == this.state
60
+ ? this.show()
61
+ : this.hide();
62
+ };
63
+
64
+ /**
65
+ * Show the drop-down contents.
66
+ *
67
+ * @return {SplitButton}
68
+ * @api public
69
+ */
70
+
71
+ SplitButton.prototype.show = function(){
72
+ this.state = 'visible';
73
+ this.emit('show');
74
+ this.el.addClass('show');
75
+ return this;
76
+ };
77
+
78
+ /**
79
+ * Hide the drop-down contents.
80
+ *
81
+ * @return {SplitButton}
82
+ * @api public
83
+ */
84
+
85
+ SplitButton.prototype.hide = function(){
86
+ this.state = 'hidden';
87
+ this.emit('hide');
88
+ this.el.removeClass('show');
89
+ return this;
90
+ };
91
+
92
+ /**
93
+ * Render the split-button with the given `options`.
94
+ *
95
+ * @param {Object} options
96
+ * @return {SplitButton}
97
+ * @api private
98
+ */
99
+
100
+ SplitButton.prototype.render = function(options){
101
+ var options = options || {}
102
+ , button = this.el.find('.button')
103
+ , label = options.label;
104
+
105
+ if ('string' == label) button.text(label);
106
+ else button.text('').append(label);
107
+ return this;
108
+ };
@@ -0,0 +1,55 @@
1
+
2
+ /* from: http://desandro.github.com/3dtransforms */
3
+
4
+ .card {
5
+ width: 200px;
6
+ height: 260px;
7
+ position: relative;
8
+ perspective: 800;
9
+ }
10
+
11
+ .card .wrapper {
12
+ width: 100%;
13
+ height: 100%;
14
+ position: absolute;
15
+ -webkit-transform-style: preserve-3d;
16
+ -moz-transform-style: preserve-3d;
17
+ -webkit-transition: -webkit-transform 500ms ease-in-out;
18
+ -moz-transition: -moz-transform 500ms ease-in-out;
19
+ border: 1px solid #eee;
20
+ border-bottom-color: #cacaca;
21
+ border-radius: 3px;
22
+ -webkit-box-shadow: inset 0 -1px 0 0 white, 0 1px 4px 0 #ddd;
23
+ -moz-box-shadow: inset 0 -1px 0 0 white, 0 1px 4px 0 #ddd;
24
+ }
25
+
26
+ .card .face {
27
+ display: block;
28
+ position: absolute;
29
+ width: 100%;
30
+ height: 100%;
31
+ -webkit-backface-visibility: hidden;
32
+ -moz-backface-visibility: hidden;
33
+ }
34
+
35
+ .card .back {
36
+ -webkit-transform: rotateY(180deg);
37
+ -moz-transform: rotateY(180deg);
38
+ }
39
+
40
+ .card.flipped .wrapper {
41
+ -webkit-transform: rotateY(180deg);
42
+ -moz-transform: rotateY(180deg);
43
+ }
44
+
45
+ /* sideflip effect */
46
+
47
+ .card.sideflip .wrapper {
48
+ -webkit-transform-origin: right center;
49
+ -moz-transform-origin: right center;
50
+ }
51
+
52
+ .card.sideflip.flipped .wrapper {
53
+ -webkit-transform: translateX(-100%) rotateY(180deg);
54
+ -moz-transform: translateX(-100%) rotateY(180deg);
55
+ }
@@ -0,0 +1,6 @@
1
+ .color-picker canvas {
2
+ border: 1px solid #888;
3
+ }
4
+ .color-picker canvas:active {
5
+ cursor: none;
6
+ }
@@ -0,0 +1,7 @@
1
+ .confirmation .actions {
2
+ border-top: 1px solid #eee;
3
+ padding: 5px;
4
+ text-align: right;
5
+ background: #fafafa;
6
+ box-shadow: inset 0 1px 0 white;
7
+ }
@@ -0,0 +1,337 @@
1
+ #dialog {
2
+ position: fixed;
3
+ left: 50%;
4
+ top: 150px;
5
+ max-width: 600px;
6
+ min-width: 250px;
7
+ border: 1px solid #eee;
8
+ background: white;
9
+ z-index: 1000;
10
+ }
11
+
12
+ #dialog .content {
13
+ padding: 15px 20px;
14
+ }
15
+
16
+ #dialog h1 {
17
+ margin: 0 0 5px 0;
18
+ font-size: 16px;
19
+ font-weight: normal;
20
+ }
21
+
22
+ #dialog p {
23
+ margin: 0;
24
+ padding: 0;
25
+ font-size: .9em;
26
+ }
27
+
28
+ #dialog.modal {
29
+ box-shadow: 0 1px 8px 0 black;
30
+ }
31
+
32
+ /* close */
33
+
34
+ #dialog .close {
35
+ position: absolute;
36
+ top: 3px;
37
+ right: 10px;
38
+ text-decoration: none;
39
+ color: #888;
40
+ font-size: 16px;
41
+ font-weight: bold;
42
+ display: none;
43
+ }
44
+
45
+ #dialog.closable .close {
46
+ display: block;
47
+ }
48
+
49
+ #dialog .close:hover {
50
+ color: black;
51
+ }
52
+
53
+ #dialog .close:active {
54
+ margin-top: 1px;
55
+ }
56
+
57
+ /* slide */
58
+
59
+ #dialog.slide {
60
+ -webkit-transition: opacity 300ms, top 300ms;
61
+ -moz-transition: opacity 300ms, top 300ms;
62
+ }
63
+
64
+ #dialog.slide.hide {
65
+ opacity: 0;
66
+ top: -500px;
67
+ }
68
+
69
+ /* fade */
70
+
71
+ #dialog.fade {
72
+ -webkit-transition: opacity 300ms;
73
+ -moz-transition: opacity 300ms;
74
+ }
75
+
76
+ #dialog.fade.hide {
77
+ opacity: 0;
78
+ }
79
+
80
+ /* scale */
81
+
82
+ #dialog.scale {
83
+ -webkit-transition: -webkit-transform 300ms;
84
+ -moz-transition: -moz-transform 300ms;
85
+ -webkit-transform: scale(1);
86
+ -moz-transform: scale(1);
87
+ }
88
+
89
+ #dialog.scale.hide {
90
+ -webkit-transform: scale(0);
91
+ -moz-transform: scale(0);
92
+ }#overlay {
93
+ position: fixed;
94
+ top: 0;
95
+ left: 0;
96
+ opacity: 1;
97
+ width: 100%;
98
+ height: 100%;
99
+ background: rgba(0,0,0,.75);
100
+ transition: opacity 300ms;
101
+ z-index: 500;
102
+ }
103
+
104
+ #overlay.hide {
105
+ pointer-events: none;
106
+ opacity: 0;
107
+ }.confirmation .actions {
108
+ border-top: 1px solid #eee;
109
+ padding: 5px;
110
+ text-align: right;
111
+ background: #fafafa;
112
+ box-shadow: inset 0 1px 0 white;
113
+ }.color-picker canvas {
114
+ border: 1px solid #888;
115
+ }
116
+ .color-picker canvas:active {
117
+ cursor: none;
118
+ }
119
+
120
+ #notifications {
121
+ position: fixed;
122
+ top: 10px;
123
+ right: 15px;
124
+ }
125
+
126
+ #notifications li {
127
+ margin-bottom: 5px;
128
+ list-style: none;
129
+ }
130
+
131
+ .notification {
132
+ position: relative;
133
+ max-width: 600px;
134
+ min-width: 250px;
135
+ border: 1px solid #eee;
136
+ background: white;
137
+ z-index: 100;
138
+ }
139
+
140
+ .notification .content {
141
+ padding: 15px 20px;
142
+ }
143
+
144
+ .notification h1 {
145
+ margin: 0 0 5px 0;
146
+ font-size: 16px;
147
+ font-weight: normal;
148
+ }
149
+
150
+ .notification p {
151
+ margin: 0;
152
+ padding: 0;
153
+ font-size: .9em;
154
+ }
155
+
156
+ .notification .close {
157
+ position: absolute;
158
+ top: 5px;
159
+ right: 10px;
160
+ text-decoration: none;
161
+ color: #888;
162
+ display: none;
163
+ }
164
+
165
+ .notification.closable .close {
166
+ display: block;
167
+ }
168
+
169
+ .notification .close:hover {
170
+ color: black;
171
+ }
172
+
173
+ .notification .close:active {
174
+ margin-top: 1px;
175
+ }
176
+
177
+ /* close */
178
+
179
+ .notification .close {
180
+ position: absolute;
181
+ top: 3px;
182
+ right: 10px;
183
+ text-decoration: none;
184
+ color: #888;
185
+ font-size: 16px;
186
+ font-weight: bold;
187
+ display: none;
188
+ }
189
+
190
+ /* slide */
191
+
192
+ .notification.slide {
193
+ -webkit-transition: opacity 300ms, top 300ms;
194
+ -moz-transition: opacity 300ms, top 300ms;
195
+ }
196
+
197
+ .notification.slide.hide {
198
+ opacity: 0;
199
+ top: -500px;
200
+ }
201
+
202
+ /* fade */
203
+
204
+ .notification.fade {
205
+ -webkit-transition: opacity 300ms;
206
+ -moz-transition: opacity 300ms;
207
+ }
208
+
209
+ .notification.fade.hide {
210
+ opacity: 0;
211
+ }
212
+
213
+ /* scale */
214
+
215
+ .notification.scale {
216
+ -webkit-transition: -webkit-transform 300ms;
217
+ -moz-transition: -moz-transform 300ms;
218
+ -webkit-transform: scale(1);
219
+ -moz-transform: scale(1);
220
+ }
221
+
222
+ .notification.scale.hide {
223
+ -webkit-transform: scale(0);
224
+ -moz-transform: scale(0);
225
+ }.split-button {
226
+ display: inline-block;
227
+ border: 1px solid #eee;
228
+ }
229
+
230
+ .split-button a {
231
+ display: inline-block;
232
+ float: left;
233
+ height: 20px;
234
+ line-height: 20px;
235
+ padding: 5px 10px;
236
+ text-decoration: none;
237
+ -webkit-user-select: none;
238
+ -moz-user-select: none;
239
+ }
240
+
241
+ .split-button .toggle {
242
+ border-left: 1px solid #eee;
243
+ }
244
+
245
+ .split-button .toggle span {
246
+ display: block;
247
+ margin-top: 8px;
248
+ border-left: 4px solid transparent;
249
+ border-right: 4px solid transparent;
250
+ border-top: 4px solid #888;
251
+ }.menu {
252
+ position: absolute;
253
+ top: 0;
254
+ left: 0;
255
+ z-index: 100;
256
+ margin: 0;
257
+ padding: 0;
258
+ background: white;
259
+ border: 1px solid rgba(0,0,0,0.2);
260
+ }
261
+
262
+ .menu li {
263
+ list-style: none;
264
+ }
265
+
266
+ .menu li a {
267
+ display: block;
268
+ padding: 5px 30px 5px 12px;
269
+ text-decoration: none;
270
+ border-top: 1px solid #eee;
271
+ color: #2e2e2e;
272
+ outline: none;
273
+ }
274
+
275
+ .menu li:first-child a {
276
+ border-top: none;
277
+ }
278
+
279
+ .menu li a:hover,
280
+ .menu li.selected a {
281
+ background: #f1faff;
282
+ }
283
+
284
+ /* from: http://desandro.github.com/3dtransforms */
285
+
286
+ .card {
287
+ width: 200px;
288
+ height: 260px;
289
+ position: relative;
290
+ perspective: 800;
291
+ }
292
+
293
+ .card .wrapper {
294
+ width: 100%;
295
+ height: 100%;
296
+ position: absolute;
297
+ -webkit-transform-style: preserve-3d;
298
+ -moz-transform-style: preserve-3d;
299
+ -webkit-transition: -webkit-transform 500ms ease-in-out;
300
+ -moz-transition: -moz-transform 500ms ease-in-out;
301
+ border: 1px solid #eee;
302
+ border-bottom-color: #cacaca;
303
+ border-radius: 3px;
304
+ -webkit-box-shadow: inset 0 -1px 0 0 white, 0 1px 4px 0 #ddd;
305
+ -moz-box-shadow: inset 0 -1px 0 0 white, 0 1px 4px 0 #ddd;
306
+ }
307
+
308
+ .card .face {
309
+ display: block;
310
+ position: absolute;
311
+ width: 100%;
312
+ height: 100%;
313
+ -webkit-backface-visibility: hidden;
314
+ -moz-backface-visibility: hidden;
315
+ }
316
+
317
+ .card .back {
318
+ -webkit-transform: rotateY(180deg);
319
+ -moz-transform: rotateY(180deg);
320
+ }
321
+
322
+ .card.flipped .wrapper {
323
+ -webkit-transform: rotateY(180deg);
324
+ -moz-transform: rotateY(180deg);
325
+ }
326
+
327
+ /* sideflip effect */
328
+
329
+ .card.sideflip .wrapper {
330
+ -webkit-transform-origin: right center;
331
+ -moz-transform-origin: right center;
332
+ }
333
+
334
+ .card.sideflip.flipped .wrapper {
335
+ -webkit-transform: translateX(-100%) rotateY(180deg);
336
+ -moz-transform: translateX(-100%) rotateY(180deg);
337
+ }