tao_ui 0.2.2 → 0.2.3

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: 300a2729406c1d92157678719538766a5f7b7cc5
4
- data.tar.gz: 99088de88f430922d6dfc49f4c95344b02707015
3
+ metadata.gz: 774dffff2f6c9311d1dc13a395ba1692f407f9a6
4
+ data.tar.gz: 81063c9187b1e3dfcc583ee7f508c995e29ea89b
5
5
  SHA512:
6
- metadata.gz: decfcf6c271b1ac07452210eb336d946996229eac7791e3e2c480c8faffc4d0e2e58e82c6174123a9b548182458632ea8b20b420ecf22f87df0f9038cd58275a
7
- data.tar.gz: df673b7b715030331a7e120cb0aeb2a2469a8f290037e93038938191c4277569dc7a322cee2fb748c423745615a08966beda9b3d5884d0a0ce12ade7e602224a
6
+ metadata.gz: e555610f157280eda838f8e0b11766b6e9e6a5b9127a9c162a365c17b59d5463e3d38ca60cd8e48fe1731def301a155589e696f315ba6f8e1f437b3f91e6c115
7
+ data.tar.gz: 36433bd6f0245693aed541d4e84a987b2714fd974c3290a54e1dca8ea423cd42f34c88e398de5efab50b0ff3f86cc170bcf6d723bda0b39a8fc21f82e9a2cd03
@@ -0,0 +1,7 @@
1
+ browsers:
2
+ - 'last 5 Chrome versions'
3
+ - 'last 5 Firefox versions'
4
+ - 'last 5 Edge versions'
5
+ - 'last 3 Safari versions'
6
+ - 'last 5 iOS versions'
7
+ - 'last 5 Android versions'
File without changes
@@ -4,7 +4,9 @@ class Tao.Dialog.Element extends TaoComponent
4
4
 
5
5
  @attribute 'active', type: 'boolean', observe: true
6
6
 
7
- @attribute 'modal', 'withCloseButton', 'autoDestroy', type: 'boolean'
7
+ @attribute 'modal', 'withCloseButton', 'autoDestroy', 'autoActivate', type: 'boolean'
8
+
9
+ @attribute 'closeSelector', default: '.remove-dialog'
8
10
 
9
11
  @attribute 'triggerSelector', 'triggerTraversal', 'size'
10
12
 
@@ -14,18 +16,29 @@ class Tao.Dialog.Element extends TaoComponent
14
16
  else if @triggerSelector
15
17
  $ @triggerSelector
16
18
 
19
+ @_initSize()
17
20
  @_bind()
18
- @_activeChanged() if @active
21
+
22
+ if @autoActivate
23
+ @reflow()
24
+ @active = true
25
+ else if @active
26
+ @_activeChanged()
19
27
 
20
28
  _disconnected: ->
21
29
  @triggerEl?.off ".tao-slide-box-#{@taoId}"
22
30
  @off()
23
31
 
32
+ _initSize: ->
33
+ size = parseFloat @size
34
+ if _.isNumber size
35
+ @jq.find('.tao-dialog-wrapper').width size
36
+
24
37
  _bind: ->
25
38
  @on 'click', (e) =>
26
39
  @active = false if e.target == @
27
40
 
28
- @on 'click', '.tao-dialog-wrapper > .link-close', =>
41
+ @on 'click', ".tao-dialog-wrapper > .link-close, #{@closeSelector}", =>
29
42
  @active = false
30
43
 
31
44
  if @triggerEl && @triggerEl.length > 0
@@ -37,25 +50,38 @@ class Tao.Dialog.Element extends TaoComponent
37
50
  @jq.find('.tao-dialog-content').css
38
51
  maxHeight: $(window).height() - 40
39
52
  @jq.show()
40
- @_reflow()
53
+ @reflow()
41
54
  else
42
- @one 'transitionend', =>
43
- if @autoDestroy
44
- @jq.remove()
45
- else
46
- @jq.hide()
55
+ if @jq.is(':visible')
56
+ @one 'transitionend', =>
57
+ if @autoDestroy
58
+ @remove()
59
+ else
60
+ @jq.hide()
47
61
  null
48
62
 
49
63
  _activeChanged: ->
50
64
  if @active
51
65
  $('body').addClass('dialog-active')
52
- @trigger 'show'
66
+ @trigger 'tao:show'
53
67
  else
54
68
  $('body').removeClass('dialog-active')
55
- @trigger 'hide'
69
+ @trigger 'tao:hide'
56
70
 
57
71
  setContent: (content) ->
58
72
  @jq.find('.tao-dialog-content').empty()
59
73
  .append content
60
74
 
75
+ remove: ->
76
+ @trigger 'tao:beforeRemove'
77
+ @jq.remove()
78
+ @trigger 'tao:remove'
79
+
80
+ beforeCache: ->
81
+ if @autoDestroy
82
+ @remove()
83
+ else
84
+ @jq.hide()
85
+ active = false
86
+
61
87
  TaoComponent.register Tao.Dialog.Element
@@ -53,10 +53,10 @@ class Tao.Popover.Element extends TaoComponent
53
53
  if @active
54
54
  @refresh()
55
55
  @_enableAutoHide() if @autoHide
56
- @trigger 'show'
56
+ @trigger 'tao:show'
57
57
  else
58
58
  @_disableAutoHide() if @autoHide
59
- @trigger 'hide'
59
+ @trigger 'tao:hide'
60
60
  @jq.remove() if @autoDestroy
61
61
 
62
62
  _enableAutoHide: ->
@@ -92,6 +92,17 @@ class Tao.Popover.Element extends TaoComponent
92
92
  toggleActive: ->
93
93
  @active = !@active
94
94
 
95
+ beforeCache: ->
96
+ if @autoDestroy
97
+ @remove()
98
+ else
99
+ @active = false
100
+
101
+ remove: ->
102
+ @trigger 'tao:beforeRemove'
103
+ @jq.remove()
104
+ @trigger 'tao:remove'
105
+
95
106
  _disconnected: ->
96
107
  @triggerEl.off '.tao-popover'
97
108
  $(document).off ".tao-popover-#{@taoId}"
@@ -45,13 +45,14 @@ class Tao.SlideBox.ElementBase extends TaoComponent
45
45
  _beforeActiveChanged: (active) ->
46
46
  if active
47
47
  @jq.show()
48
- @_reflow()
48
+ @reflow()
49
49
  else
50
- @one 'transitionend', =>
51
- if @autoDestroy
52
- @jq.remove()
53
- else
54
- @jq.hide()
50
+ if @jq.is(':visible')
51
+ @one 'transitionend', =>
52
+ if @autoDestroy
53
+ @remove()
54
+ else
55
+ @jq.hide()
55
56
  null
56
57
 
57
58
  _activeChanged: ->
@@ -59,10 +60,10 @@ class Tao.SlideBox.ElementBase extends TaoComponent
59
60
  if @active
60
61
  @_bindAutoHideEvent() if @autoHide
61
62
  $('body').addClass('slide-box-active')
62
- @trigger 'show'
63
+ @trigger 'tao:show'
63
64
  else
64
65
  $('body').removeClass('slide-box-active')
65
- @trigger 'hide'
66
+ @trigger 'tao:hide'
66
67
 
67
68
  _autoHideEvent: ''
68
69
 
@@ -74,3 +75,15 @@ class Tao.SlideBox.ElementBase extends TaoComponent
74
75
  return if e.target == @ || $.contains(@, e.target) || @triggerEl?.is(e.target)
75
76
  @active = false
76
77
  @_unbindAutoHideEvent()
78
+
79
+ remove: ->
80
+ @trigger 'tao:beforeRemove'
81
+ @jq.remove()
82
+ @trigger 'tao:remove'
83
+
84
+ beforeCache: ->
85
+ if @autoDestroy
86
+ @remove()
87
+ else
88
+ @jq.hide()
89
+ active = false
@@ -1,8 +1,10 @@
1
1
  # hack ujs for adding loading icon on disabled buttons/links
2
2
 
3
3
  prependLoadingIcon = (element) ->
4
- $(element).addClass('text-with-icon')
5
- .prepend Tao.iconTag('loading', class: 'spin')
4
+ $element = $ element
5
+ if $element.is('button') && $element.data('loading')
6
+ $element.addClass('text-with-icon')
7
+ .prepend Tao.iconTag('loading', class: 'spin')
6
8
 
7
9
  # jquery-ujs
8
10
  if $.rails?
@@ -43,6 +43,24 @@ body.tao-dialog-active {
43
43
 
44
44
  .tao-dialog-content {
45
45
  overflow-y: auto;
46
+
47
+ h3:first-child,
48
+ .title:first-child {
49
+ margin-bottom: 2rem;
50
+ }
51
+
52
+ .buttons,
53
+ .form-buttons {
54
+ margin-left: 0;
55
+ margin-bottom: 1rem;
56
+ display: flex;
57
+ justify-content: center;
58
+ align-items: center;
59
+
60
+ .button, a {
61
+ margin: 0 0.75rem;
62
+ }
63
+ }
46
64
  }
47
65
  }
48
66
 
@@ -69,6 +87,11 @@ body.tao-dialog-active {
69
87
  &:hover {
70
88
  fill: $grey-color;
71
89
  }
90
+
91
+ .icon {
92
+ width: 1.25rem;
93
+ height: 1.25rem;
94
+ }
72
95
  }
73
96
 
74
97
  &[with-close-button] .tao-dialog-wrapper > .link-close {
@@ -1,3 +1,3 @@
1
1
  @import 'tao/ui/mobile/variables/base';
2
- @import 'tao/ui/shared/variables/buttons';
2
+ @import 'tao/ui/mobile/variables/buttons';
3
3
  @import 'tao/ui/shared/variables/tables';
@@ -0,0 +1,7 @@
1
+ $button-font-size: 1.125rem !default;
2
+ $button-line-height: 1.5rem !default;
3
+ $button-padding-v: 0.625rem !default;
4
+ $button-padding-h: 1.25rem !default;
5
+ $button-padding: $button-padding-v $button-padding-h !default;
6
+
7
+ @import 'tao/ui/shared/variables/buttons';
@@ -76,7 +76,7 @@ h1, h2, h3, h4, h5, h6,
76
76
  margin-top: 1.5em;
77
77
  margin-bottom: 1em;
78
78
  line-height: $default-line-height;
79
- color: $black-color;
79
+ color: $text-color;
80
80
 
81
81
  &:first-child {
82
82
  margin-top: 0;
@@ -1,10 +1,16 @@
1
- $button-font-size: $font-size !default;
1
+ $button-color: $green-color !default;
2
+ $button-hover-color: #66cc33 !default;
3
+ $button-active-color: #22AA11 !default;
4
+ $button-warn-color: $red-color !default;
5
+ $button-warn-active-color: #EE6633 !default;
6
+
7
+ $button-font-size: 1rem !default;
2
8
  $button-line-height: 1.5 !default;
3
9
  $button-padding-v: 0.4375em !default;
4
10
  $button-padding-h: 1.25em !default;
5
11
  $button-padding: $button-padding-v $button-padding-h !default;
6
12
 
7
- $small-button-font-size: $font-size-xs !default;
13
+ $small-button-font-size: 0.75rem !default;
8
14
  $small-button-line-height: 1.5 !default;
9
15
  $small-button-padding-v: 0.25em !default;
10
16
  $small-button-padding-h: 0.875em !default;
@@ -13,18 +19,18 @@ $small-button-padding: $small-button-padding-v $small-button-padding-h !default;
13
19
  $default-button-colors: (
14
20
  normal: (
15
21
  bg: $white-color,
16
- text: $ui-color,
22
+ text: $button-color,
17
23
  border: $border-color
18
24
  ),
19
25
  hover: (
20
26
  bg: $white-color,
21
- text: #66cc33,
22
- border: #66cc33
27
+ text: $button-hover-color,
28
+ border: $button-hover-color
23
29
  ),
24
30
  active: (
25
31
  bg: $white-color,
26
- text: #22AA11,
27
- border: #22AA11
32
+ text: $button-active-color,
33
+ border: $button-active-color
28
34
  ),
29
35
  disable: (
30
36
  bg: $white-color,
@@ -35,19 +41,19 @@ $default-button-colors: (
35
41
 
36
42
  $primary-button-colors: (
37
43
  normal: (
38
- bg: $ui-color,
44
+ bg: $button-color,
39
45
  text: $white-color,
40
- border: $ui-color
46
+ border: $button-color
41
47
  ),
42
48
  hover: (
43
- bg: #66cc33,
49
+ bg: $button-hover-color,
44
50
  text: $white-color,
45
- border: #66cc33
51
+ border: $button-hover-color
46
52
  ),
47
53
  active: (
48
- bg: #22AA11,
54
+ bg: $button-active-color,
49
55
  text: $white-color,
50
- border: #22AA11
56
+ border: $button-active-color
51
57
  ),
52
58
  disable: (
53
59
  bg: $border-color,
@@ -59,18 +65,18 @@ $primary-button-colors: (
59
65
  $warning-button-colors: map-merge($default-button-colors, (
60
66
  normal: (
61
67
  bg: $white-color,
62
- text: $red-color,
63
- border: $red-color
68
+ text: $button-warn-color,
69
+ border: $button-warn-color
64
70
  ),
65
71
  hover: (
66
- bg: $red-color,
72
+ bg: $button-warn-color,
67
73
  text: $white-color,
68
- border: $red-color
74
+ border: $button-warn-color
69
75
  ),
70
76
  active: (
71
- bg: #EE6633,
77
+ bg: $button-warn-active-color,
72
78
  text: $white-color,
73
- border: #EE6633
79
+ border: $button-warn-active-color
74
80
  )
75
81
  )) !default;
76
82
 
data/lib/tao_ui/engine.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'autoprefixer-rails'
1
2
  require 'tao_on_rails'
2
3
  require 'tao_ui/components'
3
4
 
@@ -1,3 +1,3 @@
1
1
  module TaoUi
2
- VERSION = '0.2.2'
2
+ VERSION = '0.2.3'
3
3
  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.2
4
+ version: 0.2.3
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-10 00:00:00.000000000 Z
11
+ date: 2017-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tao_on_rails
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.9.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: autoprefixer-rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 7.1.1
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 7.1.1
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: sqlite3
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -90,12 +104,13 @@ files:
90
104
  - LICENSE
91
105
  - README.md
92
106
  - Rakefile
107
+ - config/autoprefixer.yml
93
108
  - config/locales/tao_ui/components/dialog/en.yml
94
109
  - config/locales/tao_ui/components/dialog/zh-CN.yml
95
110
  - config/locales/tao_ui/components/slide_box/en.yml
96
111
  - config/locales/tao_ui/components/slide_box/zh-CN.yml
97
- - lib/assets/icons/Loading.svg
98
112
  - lib/assets/icons/close.svg
113
+ - lib/assets/icons/loading.svg
99
114
  - lib/assets/javascripts/tao/ui/dialog/element.coffee
100
115
  - lib/assets/javascripts/tao/ui/dialog/index.coffee
101
116
  - lib/assets/javascripts/tao/ui/icons/base.coffee
@@ -135,6 +150,7 @@ files:
135
150
  - lib/assets/stylesheets/tao/ui/mobile/slide_box.scss
136
151
  - lib/assets/stylesheets/tao/ui/mobile/tables.scss
137
152
  - lib/assets/stylesheets/tao/ui/mobile/variables/_base.scss
153
+ - lib/assets/stylesheets/tao/ui/mobile/variables/_buttons.scss
138
154
  - lib/assets/stylesheets/tao/ui/popover.scss
139
155
  - lib/assets/stylesheets/tao/ui/shared/_basic.scss
140
156
  - lib/assets/stylesheets/tao/ui/shared/_buttons.scss