myg 2.2.0 → 2.3.0

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
  SHA256:
3
- metadata.gz: 821a56131a1aa75500bee5b9152c17e7a39b63346f3ba3b99a089e3ca1c879f9
4
- data.tar.gz: '099cf0cd8aae3545b2d9fd2357d332f47ea2b151a3d89b8bbdb288c735869134'
3
+ metadata.gz: b4e25ac5cff27da45199fa5023a3f058a1393b84087561327019ce44c11f3920
4
+ data.tar.gz: 50e5a395b77af80661495c8592fb5869bb9e3a390bbc8feb7326db42b60ff0ff
5
5
  SHA512:
6
- metadata.gz: 66cadd2f9f384d6b28c6af218e80ddb5bf03d270a3ed2930771b5aec1dd2a3b86d9431547ad65e4b7e509e31b0c35a8b5255876e9e21f73cfab6b15ca133b3c0
7
- data.tar.gz: ea057d2baeff13d45468e4006e63ba04b4546f28ff7c6342874addee273ce607c01eee981bf9f7988d56cd38e5bcf6265a47876b431bae0bd6f180f11b6891bc
6
+ metadata.gz: 4684f46e98c85956c84cfce79e1de72f9c9e74079dae7b11341cd99c37a201d83bc9850012f8eaf49560f26f868e84f46a397da3e03152c9a084cf4b297839ca
7
+ data.tar.gz: 5174fbfba17d691ab496416cca23d677e78106dde735f0f021d37583b79c88abfa4a606dd4c903f412882f72cb67639384cbaa6f27f4940d71fea636291c133e
@@ -4,6 +4,11 @@
4
4
 
5
5
  * nothing yet
6
6
 
7
+ ### 2.3.0 - 2018/02/25
8
+
9
+ * features
10
+ * added `button`, `form-field`, `input`, `label`, `slider` and `switch` components
11
+
7
12
  ### 2.2.0 - 2018/02/23
8
13
 
9
14
  * features
data/README.md CHANGED
@@ -73,10 +73,15 @@ Then add [Myg](https://github.com/jonhue/myg) to your asset pipeline:
73
73
 
74
74
  These are the components currently supported by Myg on Rails:
75
75
 
76
+ * [`button`](components/myg/button.md)
76
77
  * [`checkbox`](components/myg/checkbox.md)
77
78
  * [`drawer`](components/myg/drawer.md)
78
79
  * [`form-field`](components/myg/form-field.md)
80
+ * [`input`](components/myg/input.md)
81
+ * [`label`](components/myg/label.md)
79
82
  * [`radio`](components/myg/radio.md)
83
+ * [`slider`](components/myg/slider.md)
84
+ * [`switch`](components/myg/switch.md)
80
85
  * [`toolbar`](components/myg/toolbar.md)
81
86
 
82
87
  You feel a component is missing? Create an issue to make us aware, or implement it yourself. Pull requests are welcome.
@@ -0,0 +1,13 @@
1
+ <% href = options.delete :href %>
2
+ <% value = options.delete :value %>
3
+ <% link_html = {
4
+ class: ['myg-button', options[:class]].join(' ')
5
+ } %>
6
+ <% input_html = {
7
+ class: ['myg-button', options[:class]].join(' '),
8
+ type: 'submit',
9
+ name: 'commit',
10
+ value: value
11
+ } %>
12
+
13
+ <% if href %><%= link_to value, href, options.merge(link_html) %><% else %><%= tag 'input', options.merge(input_html) %><% end %>
@@ -1 +1,25 @@
1
- <%= component 'mdc-checkbox', options %>
1
+ <% class_name = options.delete :class_name %>
2
+ <% attribute = options.delete :attribute %>
3
+ <% name = class_name ? "#{class_name.to_s.downcase}[#{attribute}]" : "#{attribute}" %>
4
+ <% id = class_name ? "#{class_name.to_s.downcase}_#{attribute}" : "#{attribute}" %>
5
+ <% wrapper_html = {
6
+ class: ['myg-checkbox mdc-checkbox', options.dig(:wrapper_html, :class), ('mdc-checkbox--disabled' if options.dig(:input_html, :disabled))].join(' ')
7
+ } %>
8
+ <% input_html = {
9
+ type: 'checkbox',
10
+ class: ['mdc-checkbox__native-control', options.dig(:input_html, :class)].join(' '),
11
+ value: 1,
12
+ name: name,
13
+ id: id
14
+ } %>
15
+
16
+ <%= content_tag 'div', options[:wrapper_html].merge(wrapper_html) do %>
17
+ <input value="0" type="hidden" name="<%= name %>" />
18
+ <%= tag 'input', options[:input_html].merge(input_html) %>
19
+ <div class="mdc-checkbox__background">
20
+ <svg class="mdc-checkbox__checkmark" viewBox="0 0 24 24">
21
+ <path class="mdc-checkbox__checkmark__path" fill="none" stroke="white" d="M1.73,12.91 8.1,19.28 22.79,4.59"/>
22
+ </svg>
23
+ <div class="mdc-checkbox__mixedmark"></div>
24
+ </div>
25
+ <% end %>
@@ -1,3 +1,7 @@
1
- <%= component 'mdc-drawer', options do %>
1
+ <% html = {
2
+ class: ['myg-drawer mdc-drawer mdc-drawer--temporary', options[:class]].join(' ')
3
+ } %>
4
+
5
+ <%= content_tag 'aside', options.merge(html) do %>
2
6
  <%= block %>
3
7
  <% end %>
@@ -1,3 +1,45 @@
1
- <%= component 'mdc-form-field', options do %>
2
- <%= block %>
3
- <% end %>
1
+ <% wrapper_html = {
2
+ class: ['myg-form-field', ('myg-form-field--inline-label' if options[:inline_label]), ('myg-form-field--floating-label' if options[:floating_label]), options.dig(:wrapper_html, :class)].join(' ')
3
+ } %>
4
+ <% input_html = {
5
+ class_name: options[:class_name],
6
+ attribute: options[:attribute],
7
+ placeholder: options[:floating_label]
8
+ } %>
9
+ <% label_html = {
10
+ class_name: options[:class_name],
11
+ attribute: options[:attribute]
12
+ } %>
13
+ <% label_secondary_html = label_html.merge({
14
+ class: ['myg-label--secondary', options.dig(:label_html, :class)].join(' ')
15
+ }) %>
16
+ <% label_wrapper_html = {
17
+ class: ['myg-label--wrapper', options.dig(:label_wrapper_html, :class)].join(' ')
18
+ } %>
19
+
20
+ <%= content_tag 'div', options[:wrapper_html].merge(wrapper_html) do %>
21
+ <% if options[:label] %>
22
+ <% unless options[:label].is_a? Array %>
23
+ <%= component 'myg/label', options[:label_html].merge(label_html) do %><%= options[:label].html_safe %><% end %>
24
+ <% else %>
25
+ <%= content_tag 'div', options[:label_wrapper_html].merge(label_wrapper_html) %>
26
+ <% options[:label].each_with_index do |label, index| %>
27
+ <%= component 'myg/label', options[:label_html].merge((index == 0 ? label_html : label_secondary_html)) do %><%= label.html_safe %><% end %>
28
+ <% end %>
29
+ <% end %>
30
+ <% end %>
31
+ <% end %>
32
+ <%= component "myg/#{options[:as]}", options[:input_html].merge(input_html) %>
33
+ <% if options[:inline_label] %>
34
+ <% unless options[:inline_label].is_a? Array %>
35
+ <%= component 'myg/label', options[:label_html].merge(label_html) do %><%= options[:inline_label] %><% end %>
36
+ <% else %>
37
+ <%= content_tag 'div', options[:label_wrapper_html].merge(label_wrapper_html) %>
38
+ <% options[:inline_label].each_with_index do |label, index| %>
39
+ <%= component 'myg/label', options[:label_html].merge((index == 0 ? label_html : label_secondary_html)) do %><%= label.html_safe %><% end %>
40
+ <% end %>
41
+ <% end %>
42
+ <% end %>
43
+ <% end %>
44
+ <% if options[:floating_label] %><%= component 'myg/label', options[:label_html].merge(label_html) do %><%= options[:floating_label] %><% end %><% end %>
45
+ <% end %>
@@ -0,0 +1,14 @@
1
+ <% class_name = options.delete :class_name %>
2
+ <% attribute = options.delete :attribute %>
3
+ <% name = class_name ? "#{class_name.to_s.downcase}[#{attribute}]" : "#{attribute}" %>
4
+ <% id = class_name ? "#{class_name.to_s.downcase}_#{attribute}" : "#{attribute}" %>
5
+ <% html = {
6
+ class: ['myg-input', options[:class]].join(' '),
7
+ name: name,
8
+ id: id
9
+ } %>
10
+ <% defaults = {
11
+ type: (attribute == 'email' || attribute == 'password' ? attribute : 'text')
12
+ } %>
13
+
14
+ <%= tag 'input', defaults.merge(options.merge(html)) %>
@@ -0,0 +1,11 @@
1
+ <% class_name = options.delete :class_name %>
2
+ <% attribute = options.delete :attribute %>
3
+ <% id = class_name ? "#{class_name.to_s.downcase}_#{attribute}" : "#{attribute}" %>
4
+ <% html = {
5
+ class: ['myg-label', options[:class]].join(' '),
6
+ for: id
7
+ } %>
8
+
9
+ <%= content_tag 'label', options.merge(html) do %>
10
+ <%= block %>
11
+ <% end %>
@@ -1 +1,23 @@
1
- <%= component 'mdc-radio', options %>
1
+ <% class_name = options.delete :class_name %>
2
+ <% attribute = options.delete :attribute %>
3
+ <% value = options.delete :value %>
4
+ <% name = class_name ? "#{class_name.to_s.downcase}[#{attribute}]" : "#{attribute}" %>
5
+ <% id = class_name ? "#{class_name.to_s.downcase}_#{attribute}_#{value}" : "#{attribute}_#{value}" %>
6
+ <% wrapper_html = {
7
+ class: ['myg-radio mdc-radio', options.dig(:wrapper_html, :class), ('mdc-radio--disabled' if options.dig(:input_html, :disabled))].join(' ')
8
+ } %>
9
+ <% input_html = {
10
+ type: 'radio',
11
+ class: ['mdc-radio__native-control', options.dig(:input_html, :class)].join(' '),
12
+ value: value,
13
+ name: name,
14
+ id: id
15
+ } %>
16
+
17
+ <%= content_tag 'div', options[:wrapper_html].merge(wrapper_html) do %>
18
+ <%= tag 'input', options[:input_html].merge(input_html) %>
19
+ <div class="mdc-radio__background">
20
+ <div class="mdc-radio__outer-circle"></div>
21
+ <div class="mdc-radio__inner-circle"></div>
22
+ </div>
23
+ <% end %>
@@ -0,0 +1,27 @@
1
+ <% html = {
2
+ class: ['myg-slider mdc-slider', options[:class], ('mdc-slider--discrete' if options[:discrete])].join(' '),
3
+ tabindex: 0,
4
+ role: 'slider',
5
+ aria: {
6
+ valuemin: options[:min],
7
+ valuemax: options[:max],
8
+ valuenow: options[:value],
9
+ label: options[:label],
10
+ disabled: options[:disabled]
11
+ }
12
+ } %>
13
+
14
+ <%= content_tag 'div', options.merge(html) do %>
15
+ <div class="mdc-slider__track-container">
16
+ <div class="mdc-slider__track"></div>
17
+ </div>
18
+ <div class="mdc-slider__thumb-container">
19
+ <% if options[:discrete] %><div class="mdc-slider__pin">
20
+ <span class="mdc-slider__pin-value-marker"></span>
21
+ </div><% end %>
22
+ <svg class="mdc-slider__thumb" width="21" height="21">
23
+ <circle cx="10.5" cy="10.5" r="7.875"></circle>
24
+ </svg>
25
+ <div class="mdc-slider__focus-ring"></div>
26
+ </div>
27
+ <% end %>
@@ -0,0 +1,20 @@
1
+ <% class_name = options.delete :class_name %>
2
+ <% attribute = options.delete :attribute %>
3
+ <% name = class_name ? "#{class_name.to_s.downcase}[#{attribute}]" : "#{attribute}" %>
4
+ <% id = class_name ? "#{class_name.to_s.downcase}_#{attribute}" : "#{attribute}" %>
5
+ <% wrapper_html = {
6
+ class: ['myg-switch mdc-switch', options.dig(:wrapper_html, :class)].join(' ')
7
+ } %>
8
+ <% input_html = {
9
+ type: 'checkbox',
10
+ class: ['mdc-switch__native-control', options.dig(:input_html, :class)].join(' '),
11
+ name: name,
12
+ id: id
13
+ } %>
14
+
15
+ <%= content_tag 'div', options[:wrapper_html].merge(wrapper_html) do %>
16
+ <%= tag 'input', options[:input_html].merge(input_html) %>
17
+ <div class="mdc-switch__background">
18
+ <div class="mdc-switch__knob"></div>
19
+ </div>
20
+ <% end %>
@@ -1,3 +1,7 @@
1
- <%= component 'mdc-toolbar', options do %>
1
+ <% html = {
2
+ class: ['myg-toolbar mdc-toolbar', options[:class]].join(' ')
3
+ } %>
4
+
5
+ <%= content_tag 'header', options.merge(html) do %>
2
6
  <%= block %>
3
7
  <% end %>
@@ -51,6 +51,7 @@
51
51
  // +myg-elevation--classes
52
52
  // +myg-font--classes
53
53
  // +myg-footer--classes
54
+ // +myg-form-field--classes
54
55
  // +myg-grid--classes
55
56
  // +myg-input--classes
56
57
  // +myg-label--classes
@@ -16,8 +16,8 @@ $myg-theme: (
16
16
  lighter: #fcfcfc,
17
17
  light: #ffffff,
18
18
  base: #ffffff,
19
- dark: #ecf2f7,
20
- darker: #ebf5fe
19
+ dark: #FBFBFD,
20
+ darker: #ecf2f7
21
21
  ),
22
22
  border: #dce2e7,
23
23
  box-shadow: rgba(#000, .05),
@@ -5,27 +5,16 @@ module Myg
5
5
 
6
6
  initializer 'myg.mozaic' do
7
7
  Mozaic.configure do |config|
8
- config.define_component 'myg/checkbox', class: '', label: false, checked: false, disabled: false do |options|
9
- options[:class] += ' myg-checkbox'
10
- options
11
- end
12
- config.define_component 'myg/drawer', class: '' do |options|
13
- options[:type] = 'temporary'
14
- options[:class] += ' myg-drawer'
15
- options
16
- end
17
- config.define_component 'myg/form-field', class: '' do |options|
18
- options[:class] += ' myg-form-field'
19
- options
20
- end
21
- config.define_component 'myg/radio', class: '', label: false, checked: false, disabled: false do |options|
22
- options[:class] += ' myg-radio'
23
- options
24
- end
25
- config.define_component 'myg/toolbar', class: '' do |options|
26
- options[:class] += ' myg-toolbar'
27
- options
28
- end
8
+ config.define_component 'myg/button'
9
+ config.define_component 'myg/checkbox'
10
+ config.define_component 'myg/drawer'
11
+ config.define_component 'myg/form-field'
12
+ config.define_component 'myg/input'
13
+ config.define_component 'myg/label'
14
+ config.define_component 'myg/radio'
15
+ config.define_component 'myg/slider', discrete: false, disabled: false, value: 0, min: 0, max: 50, label: 'Select value'
16
+ config.define_component 'myg/switch'
17
+ config.define_component 'myg/toolbar'
29
18
  end
30
19
  end
31
20
 
@@ -1,5 +1,5 @@
1
1
  module Myg
2
2
 
3
- VERSION = '2.2.0'
3
+ VERSION = '2.3.0'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: myg
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Hübotter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-23 00:00:00.000000000 Z
11
+ date: 2018-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -66,20 +66,6 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '2.0'
69
- - !ruby/object:Gem::Dependency
70
- name: material-components-web
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '2.0'
76
- type: :runtime
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '2.0'
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: rspec
85
71
  requirement: !ruby/object:Gem::Requirement
@@ -119,10 +105,15 @@ files:
119
105
  - LICENSE
120
106
  - README.md
121
107
  - app/helpers/myg/theme_helper.rb
108
+ - app/views/mozaic/myg/_button.html.erb
122
109
  - app/views/mozaic/myg/_checkbox.html.erb
123
110
  - app/views/mozaic/myg/_drawer.html.erb
124
111
  - app/views/mozaic/myg/_form-field.html.erb
112
+ - app/views/mozaic/myg/_input.html.erb
113
+ - app/views/mozaic/myg/_label.html.erb
125
114
  - app/views/mozaic/myg/_radio.html.erb
115
+ - app/views/mozaic/myg/_slider.html.erb
116
+ - app/views/mozaic/myg/_switch.html.erb
126
117
  - app/views/mozaic/myg/_toolbar.html.erb
127
118
  - lib/generators/myg/install_generator.rb
128
119
  - lib/generators/myg/theme_generator.rb