<!-- 
  Copyright IBM Corp. 2016, 2018

  This source code is licensed under the Apache-2.0 license found in the
  LICENSE file in the root directory of this source tree.
-->

<section class="{{@root.prefix}}--structured-list{{#if selectable}} {{@root.prefix}}--structured-list--selection{{/if}}"{{#if selectable}} data-structured-list{{/if}}>
  <div class="{{@root.prefix}}--structured-list-thead">
    <div class="{{@root.prefix}}--structured-list-row {{@root.prefix}}--structured-list-row--header-row">
      {{#each columns}}
        <div class="{{@root.prefix}}--structured-list-th">{{title}}</div>
      {{/each}}
      {{#if selectable}}
        <div class="{{@root.prefix}}--structured-list-th"></div>
      {{/if}}
    </div>
  </div>
  <div class="{{@root.prefix}}--structured-list-tbody">
    {{#each rows as |row|}}
      {{#if ../selectable}}
        <label for="{{row.id}}" aria-label="{{row.selectionLabel}}" class="{{@root.prefix}}--structured-list-row{{#if row.selected}} {{@root.prefix}}--structured-list-row--selected{{/if}}" tabindex="0">
      {{else}}
        <div class="{{@root.prefix}}--structured-list-row">
      {{/if}}
        {{#each ../columns as |column|}}
          {{#with (lookup row column.name) as |data|}}
            <div class="{{@root.prefix}}--structured-list-td{{#if column.nowrap}} {{@root.prefix}}--structured-list-content--nowrap{{/if}}">{{data}}</div>
          {{/with}}
        {{/each}}
      {{#if ../selectable}}
          <input tabindex="-1" id="{{row.id}}" class="{{@root.prefix}}--structured-list-input" value="{{row.value}}" type="radio" name="{{../group}}" title="{{row.selectionLabel}}"{{#if row.selected}} checked{{/if}} />
          <div class="{{@root.prefix}}--structured-list-td">
            {{ carbon-icon 'CheckmarkFilled16' class=(add @root.prefix '--structured-list-svg') }}
          </div>
        </label>
      {{else}}
        </div>
      {{/if}}
    {{/each}}
  </div>
</section>
