turbo_material 0.1.9 → 0.2.1

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: 13b9d9d2e54b372094a3cb3d6a4ce2c5beb30417f57296795516d7ae8ee4d0e3
4
- data.tar.gz: c8ecebe27c2236eea437c5c0a28a4cd7450ecaa15dd71d6f70d95d491df740cd
3
+ metadata.gz: 0daad5f849db4ba1b3050e0eb5b4662eb8b4042b0afbe297dd7760781df1960a
4
+ data.tar.gz: 675e7daddb793efe2c5d630ce1ef3c8b2ecd8f5009a6dde0e360c45f663fb7ab
5
5
  SHA512:
6
- metadata.gz: e143747eb338b42ba472b03103039a7cf479d19a6ce7f1ba362d67ff2007a2185d98c9724132078fe07fde35b3adec4b217c0fcca9109a5cb0f4f98433106eb4
7
- data.tar.gz: dbbc4bca36bed11426fa34844c7b45bcf725a9d7134fc45454cf81563833a008f23aa7ce995eeac0ad71dadd053c3809ee19ff74e9082184d4ac0535b717682b
6
+ metadata.gz: 9228ff4cf67e473a38f221b979804b5f889005bb9c566f863a97e4cfa3b337e17f9f02caa7e6deccaa9098dca104ed4e6b824367a32009aad80c047d65c6782d
7
+ data.tar.gz: 9a0b5c7d94f9051904100e3d294d514bc97350ffaef2ea6c3665440c65cf691a2bdd25a96b8c30fa8bf1eb3b9a7273a4343ba325fa64dde776ab0c5239a166b6
@@ -1,10 +1,17 @@
1
1
  import { Controller } from "@hotwired/stimulus";
2
2
 
3
3
  export default class extends Controller {
4
- connect() {
5
- const select = mdc.select.MDCSelect.attachTo(this.element)
6
- }
4
+ connect() {
5
+ const select = mdc.select.MDCSelect.attachTo(this.element);
6
+ select.listen("MDCSelect:change", () => {
7
+ select.root.dispatchEvent(
8
+ new CustomEvent("submit-now", {
9
+ bubbles: true,
10
+ cancelable: true,
11
+ }),
12
+ );
13
+ });
14
+ }
7
15
 
8
- disconnect() {
9
- }
16
+ disconnect() {}
10
17
  }
@@ -1,5 +1,5 @@
1
- <%# locals: (form:, disabled: false, required: false, name:, label: nil, id:, checked: false, value: nil, parent: nil, frame: nil, selected_text: nil, fixed: false, options: [], hint: nil, helper: nil, additional_classes: 'w-full') %>
2
- <div class="mdc-select mdc-select--filled <%= label ? '' : 'mdc-select--no-label' %> <%= disabled ? ' mdc-select--disabled' : '' %><%= required ? ' mdc-select--required' : '' %> <%= additional_classes %>"
1
+ <%# locals: (form:, disabled: false, required: false, name:, label: nil, id:, checked: false, value: nil, parent: nil, frame: nil, selected_text: nil, fixed: false, options: [], hint: nil, helper: nil, additional_classes: 'w-full', outlined: false) %>
2
+ <div class="mdc-select <%= outlined ? 'mdc-select--outlined' : 'mdc-select--filled' %> <%= label ? '' : 'mdc-select--no-label' %> <%= disabled ? ' mdc-select--disabled' : '' %><%= required ? ' mdc-select--required' : '' %> <%= additional_classes %>"
3
3
  data-controller="material-select" <% if frame %> data-frame="<%= frame %>"<% end %> id="<%= id %>">
4
4
  <%= form.hidden_field name.to_sym, value: value %>
5
5
  <div class="mdc-select__anchor"
@@ -10,9 +10,17 @@
10
10
  <% if disabled %>aria-disabled="true"<% end %>
11
11
  <% if required %>aria-required="true"<% end %>
12
12
  >
13
- <span class="mdc-select__ripple"></span>
14
- <%- if label -%>
15
- <span id="<%= id %>-label" class="mdc-floating-label"><%= label || name.capitalize %></span>
13
+ <%- unless outlined -%>
14
+ <span class="mdc-select__ripple"></span>
15
+ <%- if label -%><span id="<%= id %>-label" class="mdc-floating-label"><%= label || name.capitalize %></span><%- end -%>
16
+ <%- else -%>
17
+ <span class="mdc-notched-outline">
18
+ <span class="mdc-notched-outline__leading"></span>
19
+ <span class="mdc-notched-outline__notch">
20
+ <%- if label -%><span id="outlined-select-label" class="mdc-floating-label"><%= label || name.capitalize %></span><%- end -%>
21
+ </span>
22
+ <span class="mdc-notched-outline__trailing"></span>
23
+ </span>
16
24
  <%- end -%>
17
25
  <span class="mdc-select__selected-text-container">
18
26
  <span id="<%= id %>-selected-text" class="mdc-select__selected-text">
@@ -37,7 +45,7 @@
37
45
  </polygon>
38
46
  </svg>
39
47
  </span>
40
- <span class="mdc-line-ripple"></span>
48
+ <%- unless outlined -%><span class="mdc-line-ripple"></span><%- end -%>
41
49
  </div>
42
50
 
43
51
  <div class="mdc-select__menu mdc-menu mdc-menu-surface !z-100 <%= fixed ? 'mdc-menu-surface--fixed' : 'mdc-menu-surface--fullwidth' %>" id="<%= id %>-surface">
@@ -1,3 +1,3 @@
1
1
  module TurboMaterial
2
- VERSION = "0.1.9"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turbo_material
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Moiseev