views/mdc/components/select.erb
<% if comp
float_label = comp.options.select{|o| o.selected }.any?
%>
<div class="mdc-select v-select v-input
<%= 'mdc-select--outlined' if comp.outlined %>
<% if comp.disabled %>mdc-select--disabled<% end %>"
<% if comp.tag %>data-input-tag="<%= comp.tag %>"<% end %>
<% if comp.dirtyable %>data-dirtyable<% end %>
<%= 'style="width: 100%;"' if comp.full_width %>>
<%= erb :"components/icon", :locals => {comp: comp.icon, class_name: 'mdc-select__icon', parent_id: "#{comp.id}-input", size_class: '', position: []} %>
<i class="mdc-select__dropdown-icon"></i>
<select id="<%= comp.id %>-input"
<% if comp.name %> name="<%= comp.name %>" <% end %>
<% if comp.required %>required<% end %>
<% if comp.disabled %>disabled<% end %>
class="mdc-select__native-control"
<%= erb(:"components/event", locals: {comp: comp,
events: comp.events,
parent_id: "#{comp.id}-input"}) %>>
<% comp.options.each do |option| %>
<option value="<%= option.value %>"
<%= 'disabled' if option.disabled %>
<%= 'selected' if option.selected %>>
<%= option.text %>
</option>
<% end %>
</select>
<% if comp.outlined %>
<div class="mdc-notched-outline">
<div class="mdc-notched-outline__leading"></div>
<div class="mdc-notched-outline__notch">
<label class="mdc-floating-label <%= 'mdc-floating-label--float-above' if float_label %>"><%= comp.label %></label>
</div>
<div class="mdc-notched-outline__trailing"></div>
</div>
<% else %>
<label class="mdc-floating-label <%= 'mdc-floating-label--float-above' if float_label %>"><%= comp.label %></label>
<div class="mdc-line-ripple"></div>
<% end %>
</div>
<%= erb :"components/shared/hint_error_display", :locals => {comp: comp} %>
<%= erb :"components/tooltip", :locals => {comp: comp.tooltip, parent_id: comp.id} %>
<% end %>