tao_ui 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 774dffff2f6c9311d1dc13a395ba1692f407f9a6
4
- data.tar.gz: 81063c9187b1e3dfcc583ee7f508c995e29ea89b
3
+ metadata.gz: '09da3087edd93d1ba400dde3fc7717a546b4e201'
4
+ data.tar.gz: d35a7c16a1e6512ce4a2363a2256f58f4cab896b
5
5
  SHA512:
6
- metadata.gz: e555610f157280eda838f8e0b11766b6e9e6a5b9127a9c162a365c17b59d5463e3d38ca60cd8e48fe1731def301a155589e696f315ba6f8e1f437b3f91e6c115
7
- data.tar.gz: 36433bd6f0245693aed541d4e84a987b2714fd974c3290a54e1dca8ea423cd42f34c88e398de5efab50b0ff3f86cc170bcf6d723bda0b39a8fc21f82e9a2cd03
6
+ metadata.gz: 2c7ec7003d126d9620024ccf0c78dd174d6967141603db952780a4f5a64492ab494ccfc3683eb8f29f4ac2a3fc226b29a54ff0e3fa36ba34531dee65c4330ed2
7
+ data.tar.gz: bf7b2acc10963c59ac8808a10d9bab30d5a05b34cfa9a1e538cfb15252bc10a1ddf9d4276a9ac489442d825cb13eaf8dfa1a150ab6c7b5438543d3289b7cfe75
@@ -30,8 +30,7 @@ class Tao.Dialog.Element extends TaoComponent
30
30
  @off()
31
31
 
32
32
  _initSize: ->
33
- size = parseFloat @size
34
- if _.isNumber size
33
+ if _.isNumber(size = parseFloat @size)
35
34
  @jq.find('.tao-dialog-wrapper').width size
36
35
 
37
36
  _bind: ->
@@ -71,11 +70,13 @@ class Tao.Dialog.Element extends TaoComponent
71
70
  setContent: (content) ->
72
71
  @jq.find('.tao-dialog-content').empty()
73
72
  .append content
73
+ @
74
74
 
75
75
  remove: ->
76
76
  @trigger 'tao:beforeRemove'
77
77
  @jq.remove()
78
78
  @trigger 'tao:remove'
79
+ @
79
80
 
80
81
  beforeCache: ->
81
82
  if @autoDestroy
@@ -13,7 +13,11 @@ class Tao.Popover.Element extends TaoComponent
13
13
 
14
14
  @attribute 'triggerAction', default: 'click'
15
15
 
16
- @attribute 'boundarySelector', 'direction', 'arrowAlign', 'arrowVerticalAlign'
16
+ @attribute 'boundarySelector', 'direction', 'size'
17
+
18
+ @attribute 'arrowAlign', default: 'center'
19
+
20
+ @attribute 'arrowVerticalAlign', default: 'middle'
17
21
 
18
22
  @attribute 'offset', type: 'number', default: 0
19
23
 
@@ -24,6 +28,7 @@ class Tao.Popover.Element extends TaoComponent
24
28
  _connected: ->
25
29
  @_initTarget()
26
30
  @_initTrigger()
31
+ @_initSize()
27
32
  @_activeChanged() if @active
28
33
 
29
34
  _initTarget: ->
@@ -49,6 +54,9 @@ class Tao.Popover.Element extends TaoComponent
49
54
  .on 'mouseleave.tao-popover', (e) =>
50
55
  @active = false
51
56
 
57
+ _initSize: ->
58
+ @jq.width(@size) if @size
59
+
52
60
  _activeChanged: ->
53
61
  if @active
54
62
  @refresh()
@@ -65,6 +73,7 @@ class Tao.Popover.Element extends TaoComponent
65
73
  target = $ e.target
66
74
  return if target.is(@target) or @jq.has(target).length or target.is(@)
67
75
  @active = false
76
+ null
68
77
 
69
78
  _disableAutoHide: ->
70
79
  $(document).off "mousedown.tao-popover-#{@taoId}"
@@ -88,9 +97,11 @@ class Tao.Popover.Element extends TaoComponent
88
97
  @jq.css
89
98
  top: @position.top
90
99
  left: @position.left
100
+ @
91
101
 
92
102
  toggleActive: ->
93
103
  @active = !@active
104
+ @
94
105
 
95
106
  beforeCache: ->
96
107
  if @autoDestroy
@@ -102,6 +113,7 @@ class Tao.Popover.Element extends TaoComponent
102
113
  @trigger 'tao:beforeRemove'
103
114
  @jq.remove()
104
115
  @trigger 'tao:remove'
116
+ @
105
117
 
106
118
  _disconnected: ->
107
119
  @triggerEl.off '.tao-popover'
@@ -7,7 +7,7 @@ class Tao.Popover.Position extends TaoModule
7
7
 
8
8
  @option 'arrowVerticalAlign', default: 'middle'
9
9
 
10
- @option 'offset', default: 0
10
+ @option 'offset', type: 'number', default: 0
11
11
 
12
12
  ARROW_OFFSET: 16
13
13
 
@@ -4,7 +4,7 @@ class Tao.SlideBox.ElementBase extends TaoComponent
4
4
 
5
5
  @attribute 'active', type: 'boolean', observe: true
6
6
 
7
- @attribute 'withCloseButton', 'autoHide', 'autoDestroy', type: 'boolean'
7
+ @attribute 'autoHide', 'autoDestroy', 'modal', 'withoutPadding', type: 'boolean'
8
8
 
9
9
  @attribute 'triggerSelector', 'triggerTraversal'
10
10
 
@@ -29,13 +29,17 @@ class Tao.SlideBox.ElementBase extends TaoComponent
29
29
 
30
30
  _initSize: ->
31
31
  sizeProperty = if @direction in ['btt', 'ttb'] then 'height' else 'width'
32
- @jq[sizeProperty] if (size = parseFloat(@size)) < 0
33
- $(window)[sizeProperty]() + size
32
+ size = if (size = parseFloat(@size)) < 0
33
+ "#{$(window)[sizeProperty]() + size}px"
34
34
  else
35
35
  @size
36
+ @jq.find('.slide-box-wrapper').css sizeProperty, size
36
37
 
37
38
  _bind: ->
38
- @on 'click', '> .link-close', =>
39
+ @on 'click', (e) =>
40
+ @active = false if e.target == @
41
+
42
+ @on 'click', '.slide-box-wrapper > .link-close', =>
39
43
  @active = false
40
44
 
41
45
  if @triggerEl && @triggerEl.length > 0
@@ -80,6 +84,7 @@ class Tao.SlideBox.ElementBase extends TaoComponent
80
84
  @trigger 'tao:beforeRemove'
81
85
  @jq.remove()
82
86
  @trigger 'tao:remove'
87
+ @
83
88
 
84
89
  beforeCache: ->
85
90
  if @autoDestroy
@@ -2,6 +2,8 @@
2
2
 
3
3
  class Tao.SlideBox.Element extends Tao.SlideBox.ElementBase
4
4
 
5
+ @attribute 'withCloseButton', type: 'boolean'
6
+
5
7
  _autoHideEvent: 'mousedown'
6
8
 
7
9
  TaoComponent.register Tao.SlideBox.Element
@@ -2,14 +2,6 @@
2
2
  @import 'tao/ui/shared/slide_box';
3
3
 
4
4
  tao-slide-box {
5
- & > .link-close {
6
- left: 0.5rem;
7
-
8
- &:active {
9
- fill: $grey-color;
10
- }
11
- }
12
-
13
5
  .header {
14
6
  height: 3rem;
15
7
  background: $white-color;
@@ -1,4 +1,4 @@
1
- $button-font-size: 1.125rem !default;
1
+ $button-font-size: 1rem !default;
2
2
  $button-line-height: 1.5rem !default;
3
3
  $button-padding-v: 0.625rem !default;
4
4
  $button-padding-h: 1.25rem !default;
@@ -20,7 +20,6 @@ tao-popover,
20
20
  border: 1px solid $border-color;
21
21
  border-radius: $border-radius-s;
22
22
  box-shadow: 0 3px 15px rgba(0,0,0,0.1);
23
- white-space: nowrap;
24
23
  }
25
24
 
26
25
  .tao-popover-arrow {
@@ -41,7 +41,6 @@ pre {
41
41
  background-color: $grey-bg-color;
42
42
  overflow: auto;
43
43
  border-radius: $border-radius;
44
- white-space: pre-wrap;
45
44
 
46
45
  code {
47
46
  padding: 0;
@@ -50,5 +49,6 @@ pre {
50
49
  background-color: transparent;
51
50
  border-radius: 0;
52
51
  word-wrap: normal;
52
+ white-space: inherit;
53
53
  }
54
54
  }
@@ -4,40 +4,43 @@ body.slide-box-active {
4
4
  }
5
5
 
6
6
  tao-slide-box {
7
- display: none;
8
7
  position: fixed;
9
- background: $white-color;
10
- opacity: 0;
8
+ top: 0;
9
+ right: 0;
10
+ bottom: 0;
11
+ left: 0;
11
12
  z-index: $z-index-float;
12
- border: 0px solid $light-border-color;
13
- transition: opacity 200ms ease-in-out, transform 200ms ease-in-out;
13
+ display: none;
14
14
  overflow: hidden;
15
15
 
16
- & > .link-close {
17
- display: none;
18
- justify-content: center;
19
- align-items: center;
20
- width: 2rem;
21
- height: 2rem;
22
- position: absolute;
23
- top: 0.5rem;
24
- fill: $lighter-grey-color;
16
+ &[modal] {
17
+ background-color: rgba(0, 0, 0, 0);
18
+ transition: background-color 200ms ease-in-out;
19
+ }
25
20
 
26
- &:hover {
27
- fill: $grey-color;
28
- }
21
+ &[modal][active] {
22
+ background-color: rgba(0, 0, 0, 0.55);
29
23
  }
30
24
 
31
- &[with-close-button] > .link-close {
32
- display: flex;
25
+ & > .slide-box-wrapper {
26
+ background: $white-color;
27
+ opacity: 0;
28
+ padding: 1.5rem;
29
+ border: 0px solid $light-border-color;
30
+ transition: opacity 200ms ease-in-out, transform 200ms ease-in-out;
31
+ position: absolute;
32
+
33
+ .slide-box-content {
34
+ max-height: 100%;
35
+ overflow: auto;
36
+ }
33
37
  }
34
38
 
35
- .slide-box-content {
36
- max-height: 100%;
37
- overflow: auto;
39
+ &[without-padding] > .slide-box-wrapper {
40
+ padding: 0;
38
41
  }
39
42
 
40
- &[direction='rtl'] {
43
+ &[direction='rtl'] > .slide-box-wrapper {
41
44
  top: 0;
42
45
  right: 0;
43
46
  bottom: 0;
@@ -46,7 +49,7 @@ tao-slide-box {
46
49
  box-shadow: -2px 0 5px 0 rgba(0,0,0,0.05);
47
50
  }
48
51
 
49
- &[direction='ltr'] {
52
+ &[direction='ltr'] > .slide-box-wrapper {
50
53
  top: 0;
51
54
  left: 0;
52
55
  bottom: 0;
@@ -55,7 +58,7 @@ tao-slide-box {
55
58
  box-shadow: 2px 0 5px 0 rgba(0,0,0,0.05);
56
59
  }
57
60
 
58
- &[direction='ttb'] {
61
+ &[direction='ttb'] > .slide-box-wrapper {
59
62
  left: 0;
60
63
  top: 0;
61
64
  right: 0;
@@ -64,7 +67,7 @@ tao-slide-box {
64
67
  box-shadow: 0 2px 5px 0 rgba(0,0,0,0.05);
65
68
  }
66
69
 
67
- &[direction='btt'] {
70
+ &[direction='btt'] > .slide-box-wrapper {
68
71
  left: 0;
69
72
  right: 0;
70
73
  bottom: 0;
@@ -73,7 +76,7 @@ tao-slide-box {
73
76
  box-shadow: 0 -2px 5px 0 rgba(0,0,0,0.05);
74
77
  }
75
78
 
76
- &[active] {
79
+ &[active] > .slide-box-wrapper {
77
80
  opacity: 1;
78
81
  transform: translateX(0) translateY(0);
79
82
  }
@@ -2,15 +2,27 @@
2
2
  @import 'tao/ui/shared/slide_box';
3
3
 
4
4
  tao-slide-box {
5
- & > .link-close {
5
+ & > .slide-box-wrapper > .link-close {
6
+ display: none;
7
+ justify-content: center;
8
+ align-items: center;
9
+ width: 2rem;
10
+ height: 2rem;
11
+ position: absolute;
12
+ top: 0.5rem;
6
13
  right: 0.5rem;
14
+ fill: $lighter-grey-color;
15
+
16
+ &:hover {
17
+ fill: $grey-color;
18
+ }
7
19
 
8
20
  &:hover {
9
21
  fill: $grey-color;
10
22
  }
11
23
  }
12
24
 
13
- .slide-box-content {
14
- padding: 1.875rem;
25
+ &[with-close-button] > .slide-box-wrapper > .link-close {
26
+ display: flex;
15
27
  }
16
28
  }
@@ -3,6 +3,8 @@ module Tao
3
3
  class IconsGenerator < Rails::Generators::NamedBase
4
4
  source_root File.expand_path('../templates', __FILE__)
5
5
 
6
+ class_option :paths, type: :array, default: ['app/assets/icons', 'lib/assets/icons'], desc: 'Find svg files in specified paths.'
7
+
6
8
  attr_reader :icons_html
7
9
 
8
10
  def create_icons_file
@@ -13,10 +15,9 @@ module Tao
13
15
  private
14
16
 
15
17
  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
18
+ Dir.glob(options[:paths].map { |p|
19
+ File.expand_path(File.join(p, '*.svg'), destination_root)
20
+ }).uniq
20
21
  end
21
22
 
22
23
  def symbol(path)
@@ -16,6 +16,12 @@ module TaoUi
16
16
  :slide_box
17
17
  end
18
18
 
19
+ private
20
+
21
+ def default_options
22
+ {class: 'tao-slide-box'}
23
+ end
24
+
19
25
  end
20
26
  end
21
27
  end
@@ -1,3 +1,3 @@
1
1
  module TaoUi
2
- VERSION = '0.2.3'
2
+ VERSION = '0.2.4'
3
3
  end
@@ -1,8 +1,12 @@
1
1
  <%= content_tag component.tag_name, component.html_options do %>
2
- <div class="slide-box-content">
3
- <%= yield %>
2
+ <div class="slide-box-wrapper">
3
+ <div class="slide-box-content">
4
+ <%= yield %>
5
+ </div>
6
+ <% unless request.variant.mobile? %>
7
+ <%= link_to 'javascript:;', class: 'link-close', title: component.t(:close) do %>
8
+ <%= tao_icon :close %>
9
+ <% end %>
10
+ <% end %>
4
11
  </div>
5
- <%= link_to 'javascript:;', class: 'link-close', title: component.t(:close) do %>
6
- <%= tao_icon :close %>
7
- <% end %>
8
12
  <% end %>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tao_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - farthinker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-15 00:00:00.000000000 Z
11
+ date: 2017-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tao_on_rails