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 +4 -4
- data/lib/assets/javascripts/tao/ui/dialog/element.coffee +3 -2
- data/lib/assets/javascripts/tao/ui/popover/element.coffee +13 -1
- data/lib/assets/javascripts/tao/ui/popover/position.coffee +1 -1
- data/lib/assets/javascripts/tao/ui/shared/slide_box/element/base.coffee +9 -4
- data/lib/assets/javascripts/tao/ui/slide_box/element.coffee +2 -0
- data/lib/assets/stylesheets/tao/ui/mobile/slide_box.scss +0 -8
- data/lib/assets/stylesheets/tao/ui/mobile/variables/_buttons.scss +1 -1
- data/lib/assets/stylesheets/tao/ui/popover.scss +0 -1
- data/lib/assets/stylesheets/tao/ui/shared/_code.scss +1 -1
- data/lib/assets/stylesheets/tao/ui/shared/_slide_box.scss +30 -27
- data/lib/assets/stylesheets/tao/ui/slide_box.scss +15 -3
- data/lib/generators/tao/icons/icons_generator.rb +5 -4
- data/lib/tao_ui/components/slide_box_component.rb +6 -0
- data/lib/tao_ui/version.rb +1 -1
- data/lib/views/components/tao_ui/components/_slide_box.html.erb +9 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09da3087edd93d1ba400dde3fc7717a546b4e201'
|
4
|
+
data.tar.gz: d35a7c16a1e6512ce4a2363a2256f58f4cab896b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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', '
|
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'
|
@@ -4,7 +4,7 @@ class Tao.SlideBox.ElementBase extends TaoComponent
|
|
4
4
|
|
5
5
|
@attribute 'active', type: 'boolean', observe: true
|
6
6
|
|
7
|
-
@attribute '
|
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
|
-
|
33
|
-
|
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',
|
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
|
@@ -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
|
-
|
10
|
-
|
8
|
+
top: 0;
|
9
|
+
right: 0;
|
10
|
+
bottom: 0;
|
11
|
+
left: 0;
|
11
12
|
z-index: $z-index-float;
|
12
|
-
|
13
|
-
transition: opacity 200ms ease-in-out, transform 200ms ease-in-out;
|
13
|
+
display: none;
|
14
14
|
overflow: hidden;
|
15
15
|
|
16
|
-
&
|
17
|
-
|
18
|
-
|
19
|
-
|
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
|
-
|
27
|
-
|
28
|
-
}
|
21
|
+
&[modal][active] {
|
22
|
+
background-color: rgba(0, 0, 0, 0.55);
|
29
23
|
}
|
30
24
|
|
31
|
-
&
|
32
|
-
|
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-
|
36
|
-
|
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-
|
14
|
-
|
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('
|
18
|
-
|
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)
|
data/lib/tao_ui/version.rb
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
<%= content_tag component.tag_name, component.html_options do %>
|
2
|
-
<div class="slide-box-
|
3
|
-
|
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.
|
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-
|
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
|