Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
bopm committed Jul 12, 2024
2 parents 53427c5 + f171c6a commit e49a5b4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
turbo_material (0.2.8)
turbo_material (0.2.9)
importmap-rails (~> 2.0.1)
rails (~> 7.1, >= 7.1.2)
stimulus-rails (~> 1.3)
Expand Down
10 changes: 8 additions & 2 deletions app/views/components/_input.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%# 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') %>
<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 %>"
<%# 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: {}) %>
<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 %>"
data-controller="<%= custom_controller || 'material-input' %>" <% if frame %>data-frame="<%= frame %>"<% end %>>
<%- if style == 'filled' -%>
<span class="mdc-text-field__ripple"></span>
Expand All @@ -17,13 +17,19 @@
<span class="mdc-notched-outline__trailing"></span>
</span>
<% end %>
<%- if leading_icon -%>
<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>
<%- end -%>
<%= form.text_field provide_hidden ? "#{name}_".to_sym : name.to_sym,
class: 'mdc-text-field__input', value: value || form&.object&.[](name.to_sym),
id: id, 'aria-labelledby' => id + '-label',
required: required, disabled: disabled,
type: type, autocomplete: "new-password", data: { frame: frame, **(data) }.compact,
min: min, max: max
%>
<%- if trailing_icon -%>
<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>
<%- end -%>
<%- if style == 'filled' -%><span class="mdc-line-ripple"></span><%- end -%>
<%- if provide_hidden -%><%= form.hidden_field name.to_sym, value: value, data: { frame: frame }.compact %><%- end -%>
</label>
Expand Down
2 changes: 1 addition & 1 deletion lib/turbo_material/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module TurboMaterial
VERSION = "0.2.8"
VERSION = "0.2.9"
end

0 comments on commit e49a5b4

Please sign in to comment.