tao_ui 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +20 -0
  4. data/Rakefile +20 -0
  5. data/lib/assets/icons/Loading.svg +19 -0
  6. data/lib/assets/javascripts/tao/ui/icons/basic.coffee +4 -0
  7. data/lib/assets/javascripts/tao/ui/icons/index.coffee +20 -0
  8. data/lib/assets/javascripts/tao/ui/index.coffee +4 -0
  9. data/lib/assets/javascripts/tao/ui/mobile/index.coffee +4 -0
  10. data/lib/assets/stylesheets/tao/ui/_custom.scss +1 -0
  11. data/lib/assets/stylesheets/tao/ui/_globals.scss +3 -0
  12. data/lib/assets/stylesheets/tao/ui/_mixins.scss +2 -0
  13. data/lib/assets/stylesheets/tao/ui/_variables.scss +3 -0
  14. data/lib/assets/stylesheets/tao/ui/basic.scss +154 -0
  15. data/lib/assets/stylesheets/tao/ui/buttons.scss +63 -0
  16. data/lib/assets/stylesheets/tao/ui/code.scss +56 -0
  17. data/lib/assets/stylesheets/tao/ui/icons.scss +18 -0
  18. data/lib/assets/stylesheets/tao/ui/index.scss +6 -0
  19. data/lib/assets/stylesheets/tao/ui/mixins/_base.scss +6 -0
  20. data/lib/assets/stylesheets/tao/ui/mixins/_buttons.scss +42 -0
  21. data/lib/assets/stylesheets/tao/ui/mobile/_custom.scss +1 -0
  22. data/lib/assets/stylesheets/tao/ui/mobile/_globals.scss +3 -0
  23. data/lib/assets/stylesheets/tao/ui/mobile/_mixins.scss +2 -0
  24. data/lib/assets/stylesheets/tao/ui/mobile/_variables.scss +3 -0
  25. data/lib/assets/stylesheets/tao/ui/mobile/basic.scss +24 -0
  26. data/lib/assets/stylesheets/tao/ui/mobile/buttons.scss +2 -0
  27. data/lib/assets/stylesheets/tao/ui/mobile/code.scss +2 -0
  28. data/lib/assets/stylesheets/tao/ui/mobile/icons.scss +2 -0
  29. data/lib/assets/stylesheets/tao/ui/mobile/index.scss +6 -0
  30. data/lib/assets/stylesheets/tao/ui/mobile/mixins/_base.scss +1 -0
  31. data/lib/assets/stylesheets/tao/ui/mobile/mixins/_buttons.scss +1 -0
  32. data/lib/assets/stylesheets/tao/ui/mobile/tables.scss +2 -0
  33. data/lib/assets/stylesheets/tao/ui/mobile/variables/_base.scss +11 -0
  34. data/lib/assets/stylesheets/tao/ui/mobile/variables/_buttons.scss +1 -0
  35. data/lib/assets/stylesheets/tao/ui/mobile/variables/_tables.scss +1 -0
  36. data/lib/assets/stylesheets/tao/ui/tables.scss +46 -0
  37. data/lib/assets/stylesheets/tao/ui/variables/_base.scss +44 -0
  38. data/lib/assets/stylesheets/tao/ui/variables/_buttons.scss +84 -0
  39. data/lib/assets/stylesheets/tao/ui/variables/_tables.scss +2 -0
  40. data/lib/generators/tao/icons/USAGE +8 -0
  41. data/lib/generators/tao/icons/icons_generator.rb +46 -0
  42. data/lib/generators/tao/icons/templates/icons.coffee.erb +3 -0
  43. data/lib/tao_ui/components/icon_component.rb +31 -0
  44. data/lib/tao_ui/components.rb +6 -0
  45. data/lib/tao_ui/engine.rb +8 -0
  46. data/lib/tao_ui/version.rb +3 -0
  47. data/lib/tao_ui.rb +5 -0
  48. data/vendor/assets/stylesheets/normalize.css +427 -0
  49. metadata +139 -0
@@ -0,0 +1,44 @@
1
+
2
+ $mobile: false !default;
3
+
4
+ $ui-color: #44BB33 !default;
5
+
6
+ $white-color: #ffffff !default;
7
+ $grey-color: #4a4a4a !default;
8
+ $black-color: #000000 !default;
9
+ $red-color: #FF7755 !default;
10
+ $orange-color: #FFAA00 !default;
11
+ $green-color: #55BB33 !default;
12
+ $blue-color: #2DB7F5 !default;
13
+
14
+ $light-grey-color: #666666 !default;
15
+ $lighter-grey-color: #999999 !default;
16
+ $lightest-grey-color: #cccccc !default;
17
+
18
+ $grey-bg-color: #efefef !default;
19
+ $light-grey-bg-color: #f3f3f3 !default;
20
+ $lighter-grey-bg-color: #f6f6f6 !default;
21
+
22
+ $text-color: $grey-color !default;
23
+ $link-color: #4499EE !default;
24
+ $link-hover-color: #3377cc !default;
25
+ $border-color: #dfdfdf !default;
26
+
27
+ $border-width: 1px !default;
28
+ $border-radius: 0.25rem !default;
29
+ $border-radius-s: 0.125rem !default;
30
+ $border-radius-l: 0.3rem !default;
31
+
32
+ $default-line-height: 1.5;
33
+
34
+ $font-size: 1rem !default;
35
+ $font-size-s: 0.875rem !default;
36
+ $font-size-l: 1.125rem !default;
37
+ $font-size-xs: 0.75rem !default;
38
+
39
+ $font-size-h1: 2rem !default;
40
+ $font-size-h2: 1.5rem !default;
41
+ $font-size-h3: 1.25rem !default;
42
+ $font-size-h4: 1rem !default;
43
+ $font-size-h5: 0.875rem !default;
44
+ $font-size-h6: 0.75rem !default;
@@ -0,0 +1,84 @@
1
+ $button-font-size: $font-size !default;
2
+ $button-line-height: 1.375 !default;
3
+ $button-padding: 0.5em 1em !default;
4
+
5
+ $small-button-font-size: $font-size-s !default;
6
+ $small-button-line-height: 1.3 !default;
7
+ $small-button-padding: 0.25em 0.5em !default;
8
+
9
+ $default-button-colors: (
10
+ normal: (
11
+ bg: $white-color,
12
+ text: $ui-color,
13
+ border: #e3e3e3
14
+ ),
15
+ hover: (
16
+ bg: $lighter-grey-color,
17
+ text: $white-color,
18
+ border: $lighter-grey-color
19
+ ),
20
+ active: (
21
+ bg: $grey-color,
22
+ text: $white-color,
23
+ border: $grey-color
24
+ ),
25
+ disable: (
26
+ bg: $white-color,
27
+ text: $lightest-grey-color,
28
+ border: #f1f1f1
29
+ )
30
+ ) !default;
31
+
32
+ $primary-button-colors: (
33
+ normal: (
34
+ bg: $ui-color,
35
+ text: $white-color,
36
+ border: $ui-color
37
+ ),
38
+ hover: (
39
+ bg: lighten($ui-color, 10%),
40
+ text: $white-color,
41
+ border: lighten($ui-color, 10%)
42
+ ),
43
+ active: (
44
+ bg: darken($ui-color, 10%),
45
+ text: $white-color,
46
+ border: darken($ui-color, 10%)
47
+ ),
48
+ disable: (
49
+ bg: $lighter-grey-bg-color,
50
+ text: $lightest-grey-color,
51
+ border: #e6e6e6
52
+ )
53
+ ) !default;
54
+
55
+ $warning-button-colors: map-merge($default-button-colors, (
56
+ normal: (
57
+ bg: $white-color,
58
+ text: lighten($red-color, 10%),
59
+ border: #e3e3e3
60
+ ),
61
+ hover: (
62
+ bg: lighten($red-color, 10%),
63
+ text: $white-color,
64
+ border: lighten($red-color, 10%)
65
+ )
66
+ )) !default;
67
+
68
+ $primary-warning-button-colors: map-merge($primary-button-colors, (
69
+ normal: (
70
+ bg: $red-color,
71
+ border: $red-color,
72
+ text: $white-color
73
+ ),
74
+ hover: (
75
+ bg: lighten($red-color, 10%),
76
+ text: $white-color,
77
+ border: lighten($red-color, 10%)
78
+ ),
79
+ active: (
80
+ bg: darken($red-color, 10%),
81
+ text: $white-color,
82
+ border: darken($red-color, 10%)
83
+ )
84
+ )) !default;
@@ -0,0 +1,2 @@
1
+ $table-border-color: #eeeeee;
2
+ $table-row-hover-color: $lighter-grey-bg-color;
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Generate coffee file containing all svg icons.
3
+
4
+ Example:
5
+ `rails generate tao:icons basic`
6
+
7
+ Create coffee file:
8
+ lib/assets/javascripts/tao/ui/icons/basic.coffee
@@ -0,0 +1,46 @@
1
+ module Tao
2
+ module Generators
3
+ class IconsGenerator < Rails::Generators::NamedBase
4
+ source_root File.expand_path('../templates', __FILE__)
5
+
6
+ attr_reader :icons_html
7
+
8
+ def create_icons_file
9
+ @icons_html = svg_files.map {|file| " #{symbol(file)}\n"}.join
10
+ template 'icons.coffee.erb', File.join('lib/assets/javascripts/tao/ui/icons', "#{name.to_s}.coffee")
11
+ end
12
+
13
+ private
14
+
15
+ def svg_files
16
+ Dir.glob([
17
+ File.expand_path('app/assets/icons/*.svg', destination_root),
18
+ File.expand_path('lib/assets/icons/*.svg', destination_root)
19
+ ]).uniq
20
+ end
21
+
22
+ def symbol(path)
23
+ name = File.basename(path, ".*").underscore().dasherize()
24
+ document = Nokogiri::XML(File.read(path))
25
+ document.css('[id="Main"], [id="Main"] [fill], [fill="none"]').each {|n| n.delete 'fill' }
26
+ content = document.to_s
27
+ content.gsub(/<?.+\?>/,'')
28
+ .gsub(/<!.+?>/,'')
29
+ .gsub(/<title>.*<\/title>/, '')
30
+ .gsub(/<desc>.*<\/desc>/, '')
31
+ .gsub(/id=/,'class=')
32
+ .gsub(/<svg.+?>/, %Q{<svg id="icon-#{name}" #{dimensions(content)}>})
33
+ .gsub(/svg/,'symbol')
34
+ .gsub(/\n/, '') # Remove endlines
35
+ .gsub(/\s{2,}/, ' ') # Remove whitespace
36
+ .gsub(/>\s+</, '><') # Remove whitespace between tags
37
+ end
38
+
39
+ def dimensions(content)
40
+ dimension = content.scan(/<svg.+(viewBox=["'](.+?)["'])/).flatten
41
+ %Q{#{dimension.first} width="100%" height="100%"}
42
+ end
43
+
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,3 @@
1
+ Tao.ui.icons += '''
2
+ <%= icons_html %>
3
+ '''
@@ -0,0 +1,31 @@
1
+ require 'tao_on_rails/components/base'
2
+
3
+ module TaoUi
4
+ module Components
5
+ class IconComponent < TaoOnRails::Components::Base
6
+
7
+ attr_reader :name
8
+
9
+ def initialize view, name, options = {}
10
+ super view, options
11
+
12
+ @name = name.to_s.dasherize
13
+
14
+ if @options[:class].present?
15
+ @options[:class] += " icon icon-#{name}"
16
+ else
17
+ @options[:class] = "icon icon-#{name}"
18
+ end
19
+ end
20
+
21
+ def render
22
+ view.content_tag(:svg, %Q(<use xlink:href="#icon-#{name}"/>).html_safe, options)
23
+ end
24
+
25
+ def self.component_name
26
+ :icon
27
+ end
28
+
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,6 @@
1
+ require 'tao_ui/components/icon_component'
2
+
3
+ module TaoUi
4
+ module Components
5
+ end
6
+ end
@@ -0,0 +1,8 @@
1
+ require 'tao_on_rails'
2
+ require 'tao_ui/components'
3
+
4
+ module TaoUi
5
+ class Engine < ::Rails::Engine
6
+ isolate_namespace TaoUi
7
+ end
8
+ end
@@ -0,0 +1,3 @@
1
+ module TaoUi
2
+ VERSION = '0.1.0'
3
+ end
data/lib/tao_ui.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "tao_ui/version"
2
+ require "tao_ui/engine"
3
+
4
+ module TaoUi
5
+ end
@@ -0,0 +1,427 @@
1
+ /*! normalize.css v6.0.0 | MIT License | github.com/necolas/normalize.css */
2
+
3
+ /* Document
4
+ ========================================================================== */
5
+
6
+ /**
7
+ * 1. Correct the line height in all browsers.
8
+ * 2. Prevent adjustments of font size after orientation changes in
9
+ * IE on Windows Phone and in iOS.
10
+ */
11
+
12
+ html {
13
+ line-height: 1.15; /* 1 */
14
+ -ms-text-size-adjust: 100%; /* 2 */
15
+ -webkit-text-size-adjust: 100%; /* 2 */
16
+ }
17
+
18
+ /* Sections
19
+ ========================================================================== */
20
+
21
+ /**
22
+ * Add the correct display in IE 9-.
23
+ */
24
+
25
+ article,
26
+ aside,
27
+ footer,
28
+ header,
29
+ nav,
30
+ section {
31
+ display: block;
32
+ }
33
+
34
+ /**
35
+ * Correct the font size and margin on `h1` elements within `section` and
36
+ * `article` contexts in Chrome, Firefox, and Safari.
37
+ */
38
+
39
+ h1 {
40
+ font-size: 2em;
41
+ margin: 0.67em 0;
42
+ }
43
+
44
+ /* Grouping content
45
+ ========================================================================== */
46
+
47
+ /**
48
+ * Add the correct display in IE 9-.
49
+ * 1. Add the correct display in IE.
50
+ */
51
+
52
+ figcaption,
53
+ figure,
54
+ main { /* 1 */
55
+ display: block;
56
+ }
57
+
58
+ /**
59
+ * Add the correct margin in IE 8.
60
+ */
61
+
62
+ figure {
63
+ margin: 1em 40px;
64
+ }
65
+
66
+ /**
67
+ * 1. Add the correct box sizing in Firefox.
68
+ * 2. Show the overflow in Edge and IE.
69
+ */
70
+
71
+ hr {
72
+ box-sizing: content-box; /* 1 */
73
+ height: 0; /* 1 */
74
+ overflow: visible; /* 2 */
75
+ }
76
+
77
+ /**
78
+ * 1. Correct the inheritance and scaling of font size in all browsers.
79
+ * 2. Correct the odd `em` font sizing in all browsers.
80
+ */
81
+
82
+ pre {
83
+ font-family: monospace, monospace; /* 1 */
84
+ font-size: 1em; /* 2 */
85
+ }
86
+
87
+ /* Text-level semantics
88
+ ========================================================================== */
89
+
90
+ /**
91
+ * 1. Remove the gray background on active links in IE 10.
92
+ * 2. Remove gaps in links underline in iOS 8+ and Safari 8+.
93
+ */
94
+
95
+ a {
96
+ background-color: transparent; /* 1 */
97
+ -webkit-text-decoration-skip: objects; /* 2 */
98
+ }
99
+
100
+ /**
101
+ * 1. Remove the bottom border in Chrome 57- and Firefox 39-.
102
+ * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
103
+ */
104
+
105
+ abbr[title] {
106
+ border-bottom: none; /* 1 */
107
+ text-decoration: underline; /* 2 */
108
+ text-decoration: underline dotted; /* 2 */
109
+ }
110
+
111
+ /**
112
+ * Prevent the duplicate application of `bolder` by the next rule in Safari 6.
113
+ */
114
+
115
+ b,
116
+ strong {
117
+ font-weight: inherit;
118
+ }
119
+
120
+ /**
121
+ * Add the correct font weight in Chrome, Edge, and Safari.
122
+ */
123
+
124
+ b,
125
+ strong {
126
+ font-weight: bolder;
127
+ }
128
+
129
+ /**
130
+ * 1. Correct the inheritance and scaling of font size in all browsers.
131
+ * 2. Correct the odd `em` font sizing in all browsers.
132
+ */
133
+
134
+ code,
135
+ kbd,
136
+ samp {
137
+ font-family: monospace, monospace; /* 1 */
138
+ font-size: 1em; /* 2 */
139
+ }
140
+
141
+ /**
142
+ * Add the correct font style in Android 4.3-.
143
+ */
144
+
145
+ dfn {
146
+ font-style: italic;
147
+ }
148
+
149
+ /**
150
+ * Add the correct background and color in IE 9-.
151
+ */
152
+
153
+ mark {
154
+ background-color: #ff0;
155
+ color: #000;
156
+ }
157
+
158
+ /**
159
+ * Add the correct font size in all browsers.
160
+ */
161
+
162
+ small {
163
+ font-size: 80%;
164
+ }
165
+
166
+ /**
167
+ * Prevent `sub` and `sup` elements from affecting the line height in
168
+ * all browsers.
169
+ */
170
+
171
+ sub,
172
+ sup {
173
+ font-size: 75%;
174
+ line-height: 0;
175
+ position: relative;
176
+ vertical-align: baseline;
177
+ }
178
+
179
+ sub {
180
+ bottom: -0.25em;
181
+ }
182
+
183
+ sup {
184
+ top: -0.5em;
185
+ }
186
+
187
+ /* Embedded content
188
+ ========================================================================== */
189
+
190
+ /**
191
+ * Add the correct display in IE 9-.
192
+ */
193
+
194
+ audio,
195
+ video {
196
+ display: inline-block;
197
+ }
198
+
199
+ /**
200
+ * Add the correct display in iOS 4-7.
201
+ */
202
+
203
+ audio:not([controls]) {
204
+ display: none;
205
+ height: 0;
206
+ }
207
+
208
+ /**
209
+ * Remove the border on images inside links in IE 10-.
210
+ */
211
+
212
+ img {
213
+ border-style: none;
214
+ }
215
+
216
+ /**
217
+ * Hide the overflow in IE.
218
+ */
219
+
220
+ svg:not(:root) {
221
+ overflow: hidden;
222
+ }
223
+
224
+ /* Forms
225
+ ========================================================================== */
226
+
227
+ /**
228
+ * Remove the margin in Firefox and Safari.
229
+ */
230
+
231
+ button,
232
+ input,
233
+ optgroup,
234
+ select,
235
+ textarea {
236
+ margin: 0;
237
+ }
238
+
239
+ /**
240
+ * Show the overflow in IE.
241
+ * 1. Show the overflow in Edge.
242
+ */
243
+
244
+ button,
245
+ input { /* 1 */
246
+ overflow: visible;
247
+ }
248
+
249
+ /**
250
+ * Remove the inheritance of text transform in Edge, Firefox, and IE.
251
+ * 1. Remove the inheritance of text transform in Firefox.
252
+ */
253
+
254
+ button,
255
+ select { /* 1 */
256
+ text-transform: none;
257
+ }
258
+
259
+ /**
260
+ * 1. Prevent a WebKit bug where (2) destroys native `audio` and `video`
261
+ * controls in Android 4.
262
+ * 2. Correct the inability to style clickable types in iOS and Safari.
263
+ */
264
+
265
+ button,
266
+ html [type="button"], /* 1 */
267
+ [type="reset"],
268
+ [type="submit"] {
269
+ -webkit-appearance: button; /* 2 */
270
+ }
271
+
272
+ /**
273
+ * Remove the inner border and padding in Firefox.
274
+ */
275
+
276
+ button::-moz-focus-inner,
277
+ [type="button"]::-moz-focus-inner,
278
+ [type="reset"]::-moz-focus-inner,
279
+ [type="submit"]::-moz-focus-inner {
280
+ border-style: none;
281
+ padding: 0;
282
+ }
283
+
284
+ /**
285
+ * Restore the focus styles unset by the previous rule.
286
+ */
287
+
288
+ button:-moz-focusring,
289
+ [type="button"]:-moz-focusring,
290
+ [type="reset"]:-moz-focusring,
291
+ [type="submit"]:-moz-focusring {
292
+ outline: 1px dotted ButtonText;
293
+ }
294
+
295
+ /**
296
+ * 1. Correct the text wrapping in Edge and IE.
297
+ * 2. Correct the color inheritance from `fieldset` elements in IE.
298
+ * 3. Remove the padding so developers are not caught out when they zero out
299
+ * `fieldset` elements in all browsers.
300
+ */
301
+
302
+ legend {
303
+ box-sizing: border-box; /* 1 */
304
+ color: inherit; /* 2 */
305
+ display: table; /* 1 */
306
+ max-width: 100%; /* 1 */
307
+ padding: 0; /* 3 */
308
+ white-space: normal; /* 1 */
309
+ }
310
+
311
+ /**
312
+ * 1. Add the correct display in IE 9-.
313
+ * 2. Add the correct vertical alignment in Chrome, Firefox, and Opera.
314
+ */
315
+
316
+ progress {
317
+ display: inline-block; /* 1 */
318
+ vertical-align: baseline; /* 2 */
319
+ }
320
+
321
+ /**
322
+ * Remove the default vertical scrollbar in IE.
323
+ */
324
+
325
+ textarea {
326
+ overflow: auto;
327
+ }
328
+
329
+ /**
330
+ * 1. Add the correct box sizing in IE 10-.
331
+ * 2. Remove the padding in IE 10-.
332
+ */
333
+
334
+ [type="checkbox"],
335
+ [type="radio"] {
336
+ box-sizing: border-box; /* 1 */
337
+ padding: 0; /* 2 */
338
+ }
339
+
340
+ /**
341
+ * Correct the cursor style of increment and decrement buttons in Chrome.
342
+ */
343
+
344
+ [type="number"]::-webkit-inner-spin-button,
345
+ [type="number"]::-webkit-outer-spin-button {
346
+ height: auto;
347
+ }
348
+
349
+ /**
350
+ * 1. Correct the odd appearance in Chrome and Safari.
351
+ * 2. Correct the outline style in Safari.
352
+ */
353
+
354
+ [type="search"] {
355
+ -webkit-appearance: textfield; /* 1 */
356
+ outline-offset: -2px; /* 2 */
357
+ }
358
+
359
+ /**
360
+ * Remove the inner padding and cancel buttons in Chrome and Safari on macOS.
361
+ */
362
+
363
+ [type="search"]::-webkit-search-cancel-button,
364
+ [type="search"]::-webkit-search-decoration {
365
+ -webkit-appearance: none;
366
+ }
367
+
368
+ /**
369
+ * 1. Correct the inability to style clickable types in iOS and Safari.
370
+ * 2. Change font properties to `inherit` in Safari.
371
+ */
372
+
373
+ ::-webkit-file-upload-button {
374
+ -webkit-appearance: button; /* 1 */
375
+ font: inherit; /* 2 */
376
+ }
377
+
378
+ /* Interactive
379
+ ========================================================================== */
380
+
381
+ /*
382
+ * Add the correct display in IE 9-.
383
+ * 1. Add the correct display in Edge, IE, and Firefox.
384
+ */
385
+
386
+ details, /* 1 */
387
+ menu {
388
+ display: block;
389
+ }
390
+
391
+ /*
392
+ * Add the correct display in all browsers.
393
+ */
394
+
395
+ summary {
396
+ display: list-item;
397
+ }
398
+
399
+ /* Scripting
400
+ ========================================================================== */
401
+
402
+ /**
403
+ * Add the correct display in IE 9-.
404
+ */
405
+
406
+ canvas {
407
+ display: inline-block;
408
+ }
409
+
410
+ /**
411
+ * Add the correct display in IE.
412
+ */
413
+
414
+ template {
415
+ display: none;
416
+ }
417
+
418
+ /* Hidden
419
+ ========================================================================== */
420
+
421
+ /**
422
+ * Add the correct display in IE 10-.
423
+ */
424
+
425
+ [hidden] {
426
+ display: none;
427
+ }