turbo_material 0.1.8 → 0.2.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: 9c5202d5448845f0cc5510c5a877bdfc9d128d7d016b4eb42c73f6b3ff27cdd9
4
- data.tar.gz: 7daaa56ab8ed778bf42d6a302b1fb64f7ef6741baffba33044147ea9a66d95ef
3
+ metadata.gz: cf21c621bf44bbc786c329a850f58fc3bb952fa5f600e837484f9a921a1d7c33
4
+ data.tar.gz: fbe2a7a91241c7ee710217e654085bcef3dde492c25d2c3b40befc060b07b220
5
5
  SHA512:
6
- metadata.gz: c500bb6fe137b1300f5f58e4d16e9984f4f0e38c4cb072b44773e158a46ae183deadbc0712d462f7284a89a4bed2fa2197464349cb016a5945ccdc1360c671cd
7
- data.tar.gz: 6a1b6fd662262bf5014aac7659e0c0858b291c3680540cd81366e37773437d03f9d4719915f5ad62ec15cfc952fba48525a1dd1c41e22bafe9ea7f49c7046bdc
6
+ metadata.gz: adde992869e1f5d336f34727784349eb77cc7c8417c2d935b856d5d40f1d42a267ac0f0b09309965cdce79c85413b4e9248c5dcf269c5fefceac77ac3e4848cd
7
+ data.tar.gz: 2a3226658c58fd5ca0ced9362e547960e56d2619ba218d0e959d0d2f7e3d2591fcb8f73c6c800cff67463b81b4416b9e848deb38606aa70edae52cfb09b2ce32
@@ -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 <%= 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,8 +10,18 @@
10
10
  <% if disabled %>aria-disabled="true"<% end %>
11
11
  <% if required %>aria-required="true"<% end %>
12
12
  >
13
+ <%- if outlined -%>
13
14
  <span class="mdc-select__ripple"></span>
14
- <span id="<%= id %>-label" class="mdc-floating-label"><%= label || name.capitalize %></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>
24
+ <%- end -%>
15
25
  <span class="mdc-select__selected-text-container">
16
26
  <span id="<%= id %>-selected-text" class="mdc-select__selected-text">
17
27
  <%= selected_text || value %>
@@ -35,7 +45,7 @@
35
45
  </polygon>
36
46
  </svg>
37
47
  </span>
38
- <span class="mdc-line-ripple"></span>
48
+ <%- unless outlined -%><span class="mdc-line-ripple"></span><%- end -%>
39
49
  </div>
40
50
 
41
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.8"
2
+ VERSION = "0.2.0"
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.8
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Moiseev