turbo_material 0.2.7 → 0.2.9

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: f904dd4488984f9f96e107e9e32b3809c0884b382ae82facb43261fce9cca428
4
- data.tar.gz: 80c47036d39ca75999474289f9ed6b88ccf0a238aece2b95a069b7bc7d2092ae
3
+ metadata.gz: b8d13c80c1d99c4442662e22b7c70abe40987aff35db2b561c3d5cac3c584884
4
+ data.tar.gz: 476769d57825b11071f7f8623b83d6b96daaca2cdadffa778556e28f0c2a1e12
5
5
  SHA512:
6
- metadata.gz: 91e7c52c5476509122cc47e5ecb7ddc25d6082fa163f65aa02f03504de8da98adde45e5caebdcc1438ede30f85305462963952a70dd5e3792fe453aa4df1c9e5
7
- data.tar.gz: cb79432f223068b3f35a3a736a3e49213943e963dd9204c119f7dcb9c34b28eb5c0b6fff1ea4c217aec2277e3359c780231a14a86ba494e01a04d63307d96ec6
6
+ metadata.gz: faaa923b8cf005ac56252b62661abb77fdd986ecade89573820038da6cf84fe4b5ee0bef3d5a502a33c0dbfa855a37f4e1e6ed6a60d33ccd000ed79ba9992177
7
+ data.tar.gz: b7324433f491803e0c7f47a53ed276c7cdf39c4858479df78e48241d1b3f5c1c77be5ab221cdbea71ffa142061c75fd60e3aa1cc74238452732c1779ef959778
@@ -10,7 +10,9 @@ export default class extends Controller {
10
10
  static values = {
11
11
  url: String,
12
12
  suffix: String,
13
- name: String
13
+ name: String,
14
+ prefetch: Boolean,
15
+ additionalQueryParams: Object,
14
16
  }
15
17
 
16
18
  connect() {
@@ -18,6 +20,9 @@ export default class extends Controller {
18
20
  this.chipsetEl = this.element.querySelector(".mdc-chip-set");
19
21
  this.input = mdc.textField.MDCTextField.attachTo(this.inputEl);
20
22
  this.chips = mdc.chips.MDCChipSet.attachTo(this.chipsetEl);
23
+ if (this.prefetchValue) {
24
+ this.search();
25
+ }
21
26
  useClickOutside(this);
22
27
  }
23
28
 
@@ -133,6 +138,9 @@ export default class extends Controller {
133
138
  params.append("name", this.nameValue);
134
139
  params.append("opened", this.opened);
135
140
  params.append("exclude", this.hiddenTarget.value);
141
+ Object.keys(this.additionalQueryParamsValue).forEach((param) => {
142
+ params.append(param, this.additionalQueryParamsValue[param]);
143
+ });
136
144
  get(`${this.urlValue}?${params.toString()}`, {
137
145
  responseKind: "turbo-stream",
138
146
  });
@@ -1,9 +1,11 @@
1
- <%# locals: (form:, disabled: false, required: false, name:, label: nil, id:, frame: nil, suffix: nil, type: 'text', url: nil, selected: [], options: [], value: nil, fixed: false) %>
1
+ <%# locals: (form:, disabled: false, required: false, name:, label: nil, id:, frame: nil, suffix: nil, type: 'text', url: nil, selected: [], options: [], value: nil, fixed: false, prefetch: false, additional_query_params: {}) %>
2
2
  <%- id = [name, suffix].compact_blank.join('-') -%>
3
3
  <div data-controller="material-chips-input"
4
4
  data-material-chips-input-url-value="<%= url %>"
5
5
  data-material-chips-input-name-value="<%= name %>"
6
6
  data-material-chips-input-material-list-outlet="#<%= "#{id}-list" %>"
7
+ data-material-chips-input-prefetch-value="<%= prefetch.to_s %>"
8
+ data-material-chips-input-additional-query-params-value="<%= additional_query_params.to_json %>"
7
9
  <% if suffix.present? %>data-material-chips-input-suffix-value="<%= suffix %>"<% end %>
8
10
  data-action="keydown.esc->material-chips-input#close keydown.enter->prevent-default country-select-focus->material-chips-input#confirmSelection"
9
11
  >
@@ -1,5 +1,5 @@
1
- <%# locals: (form:, custom_controller: nil, custom_css: nil, disabled: false, required: false, name:, label: nil, id:, checked: false, frame: nil, provide_hidden: false, value: nil, type: 'text', data: {}, min: nil, max: nil, helper: nil, parent: nil, style: 'filled') %>
2
- <label class="mdc-text-field rounded-none <%= style == 'filled' ? 'mdc-text-field--filled' : 'mdc-text-field--outlined' %> <%= value || form&.object&.[](name.to_sym) ? 'mdc-text-field--label-floating' : '' %> w-full <%= custom_css %>"
1
+ <%# locals: (form:, custom_controller: nil, custom_css: nil, disabled: false, required: false, name:, label: nil, id:, checked: false, frame: nil, provide_hidden: false, value: nil, type: 'text', data: {}, min: nil, max: nil, helper: nil, parent: nil, style: 'filled', leading_icon: nil, trailing_icon: nil, leading_icon_data: {}, trailing_icon_data: {}) %>
2
+ <label class="mdc-text-field rounded-none <%= style == 'filled' ? 'mdc-text-field--filled' : 'mdc-text-field--outlined' %> <%= value || form&.object&.[](name.to_sym) ? 'mdc-text-field--label-floating' : '' %> w-full <%= leading_icon ? 'mdc-text-field--with-leading-icon' : '' %> <%= trailing_icon ? 'mdc-text-field--with-trailing-icon' : '' %> <%= custom_css %>"
3
3
  data-controller="<%= custom_controller || 'material-input' %>" <% if frame %>data-frame="<%= frame %>"<% end %>>
4
4
  <%- if style == 'filled' -%>
5
5
  <span class="mdc-text-field__ripple"></span>
@@ -17,6 +17,9 @@
17
17
  <span class="mdc-notched-outline__trailing"></span>
18
18
  </span>
19
19
  <% end %>
20
+ <%- if leading_icon -%>
21
+ <i class="material-icons mdc-text-field__icon mdc-text-field__icon--leading" <%= tag.attributes((trailing_icon ? {} : {tabindex: '0', role: 'button'}).merge(data: leading_icon_data)) %>><%= leading_icon %></i>
22
+ <%- end -%>
20
23
  <%= form.text_field provide_hidden ? "#{name}_".to_sym : name.to_sym,
21
24
  class: 'mdc-text-field__input', value: value || form&.object&.[](name.to_sym),
22
25
  id: id, 'aria-labelledby' => id + '-label',
@@ -24,6 +27,9 @@
24
27
  type: type, autocomplete: "new-password", data: { frame: frame, **(data) }.compact,
25
28
  min: min, max: max
26
29
  %>
30
+ <%- if trailing_icon -%>
31
+ <i class="material-icons mdc-text-field__icon mdc-text-field__icon--trailing" <%= tag.attributes(tabindex: '0', role: 'button', data: trailing_icon_data) %>><%= trailing_icon %></i>
32
+ <%- end -%>
27
33
  <%- if style == 'filled' -%><span class="mdc-line-ripple"></span><%- end -%>
28
34
  <%- if provide_hidden -%><%= form.hidden_field name.to_sym, value: value, data: { frame: frame }.compact %><%- end -%>
29
35
  </label>
@@ -1,3 +1,3 @@
1
1
  module TurboMaterial
2
- VERSION = "0.2.7"
2
+ VERSION = "0.2.9"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turbo_material
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Moiseev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-21 00:00:00.000000000 Z
11
+ date: 2024-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -191,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
191
  - !ruby/object:Gem::Version
192
192
  version: '0'
193
193
  requirements: []
194
- rubygems_version: 3.4.12
194
+ rubygems_version: 3.5.3
195
195
  signing_key:
196
196
  specification_version: 4
197
197
  summary: Material Web Components for Hotwire Turbo.