<div style="width: 913px">
<div class="acl-data-table acl-table-list">
<table class="acl-data-table__table" aria-label="Quantity List Table">
<thead>
<tr class="acl-data-table__header-row acl-data-table__header-row--condensed acl-table-list__row--uppercase">
<th class="acl-data-table__header-cell" role="columnheader" scope="col">Name</th>
<th class="acl-data-table__header-cell acl-data-table__header-cell--text-center" scope="col">Price
</th>
<th class="acl-data-table__header-cell acl-data-table__header-cell--text-center" scope="col">Stock
</th>
<th class="acl-data-table__header-cell acl-data-table__header-cell--text-center" role="columnheader" scope="col">Quantity</th>
<th class="acl-data-table__header-cell acl-data-table__header-cell--text-right" role="columnheader" scope="col">Subtotal</th>
<th class="acl-data-table__header-cell" role="columnheader" scope="col"></th>
</tr>
</thead>
<tbody class="acl-data-table__content acl-table-list__content acl-table-list__scrollable-content">
<tr class="acl-data-table__row acl-table-list__row ">
<td class="acl-data-table__cell acl-table-list__cell acl-typography--bold">
<div class="acl-table-list__product-info">
<div class="acl-table-list__product-image">
<img class="acl-table-list__image" src="/assets/img/product-ex-1.png" />
</div>
<div class="acl-table-list__product-detail">
<div class="acl-table-list__product-name">Product Name and details 500ml (20 Pack)</div>
<div class="acl-table-list__product-id">B&J-34671</div>
</div>
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__price"><span class="acl-table-list__price--currency">£</span>19.42
each
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__stock">423 in Stock
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-forms__quantity">
<div class="acl-forms__quantity-button" onclick="quantityField.changeQuantity(this,'decrease')" value="Decrease Value">-
</div>
<input class="acl-forms__quantity-input" type="number" id="number" min="0" max="400" value="0" />
<div class="acl-forms__quantity-button" onclick="quantityField.changeQuantity(this,'increase')" value="Increase Value">+</div>
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__sub-total"><span class="acl-table-list__sub-total--currency">£</span>233.04
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__delete">
<i class="aforza-icons">acl_delete</i>
</div>
</td>
</tr>
<tr class="acl-data-table__row acl-table-list__row ">
<td class="acl-data-table__cell acl-table-list__cell acl-typography--bold">
<div class="acl-table-list__product-info">
<div class="acl-table-list__product-image">
<img class="acl-table-list__image" src="/assets/img/product-ex-1.png" />
</div>
<div class="acl-table-list__product-detail">
<div class="acl-table-list__product-name">Product Name and details 500ml (20 Pack)</div>
<div class="acl-table-list__product-id">B&J-34671</div>
</div>
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__price"><span class="acl-table-list__price--currency">£</span>19.42
each
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__stock">423 in Stock
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-forms__quantity">
<div class="acl-forms__quantity-button" onclick="quantityField.changeQuantity(this,'decrease')" value="Decrease Value">-
</div>
<input class="acl-forms__quantity-input" type="number" id="number" min="0" max="400" value="0" />
<div class="acl-forms__quantity-button" onclick="quantityField.changeQuantity(this,'increase')" value="Increase Value">+</div>
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__sub-total"><span class="acl-table-list__sub-total--currency">£</span>233.04
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__delete">
<i class="aforza-icons">acl_delete</i>
</div>
</td>
</tr>
<tr class="acl-data-table__row acl-table-list__row ">
<td class="acl-data-table__cell acl-table-list__cell acl-typography--bold">
<div class="acl-table-list__product-info">
<div class="acl-table-list__product-image">
<img class="acl-table-list__image" src="/assets/img/product-ex-1.png" />
</div>
<div class="acl-table-list__product-detail">
<div class="acl-table-list__product-name">Product Name and details 500ml (20 Pack)</div>
<div class="acl-table-list__product-id">B&J-34671</div>
</div>
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__price"><span class="acl-table-list__price--currency">£</span>19.42
each
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__stock">423 in Stock
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-forms__quantity">
<div class="acl-forms__quantity-button" onclick="quantityField.changeQuantity(this,'decrease')" value="Decrease Value">-
</div>
<input class="acl-forms__quantity-input" type="number" id="number" min="0" max="400" value="0" />
<div class="acl-forms__quantity-button" onclick="quantityField.changeQuantity(this,'increase')" value="Increase Value">+</div>
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__sub-total"><span class="acl-table-list__sub-total--currency">£</span>233.04
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__delete">
<i class="aforza-icons">acl_delete</i>
</div>
</td>
</tr>
<tr class="acl-data-table__row acl-table-list__row ">
<td class="acl-data-table__cell acl-table-list__cell acl-typography--bold">
<div class="acl-table-list__product-info">
<div class="acl-table-list__product-image">
<img class="acl-table-list__image" src="/assets/img/product-ex-1.png" />
</div>
<div class="acl-table-list__product-detail">
<div class="acl-table-list__product-name">Product Name and details 500ml (20 Pack)</div>
<div class="acl-table-list__product-id">B&J-34671</div>
</div>
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__price"><span class="acl-table-list__price--currency">£</span>19.42
each
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__stock">423 in Stock
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-forms__quantity">
<div class="acl-forms__quantity-button" onclick="quantityField.changeQuantity(this,'decrease')" value="Decrease Value">-
</div>
<input class="acl-forms__quantity-input" type="number" id="number" min="0" max="400" value="0" />
<div class="acl-forms__quantity-button" onclick="quantityField.changeQuantity(this,'increase')" value="Increase Value">+</div>
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__sub-total"><span class="acl-table-list__sub-total--currency">£</span>233.04
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__delete">
<i class="aforza-icons">acl_delete</i>
</div>
</td>
</tr>
<tr class="acl-data-table__row acl-table-list__row acl-table-list__item--promo">
<td class="acl-data-table__cell acl-table-list__cell acl-typography--bold">
<div class="acl-table-list__product-promotion-title">SUMMER PROMO DISCOUNT BUY 2 GET 1
50% OFF</div>
<div class="acl-table-list__product-info">
<div class="acl-table-list__product-image">
<img class="acl-table-list__image" src="/assets/img/product-ex-1.png" />
</div>
<div class="acl-table-list__product-detail">
<div class="acl-table-list__product-name">Product Name and details 500ml (20 Pack)</div>
<div class="acl-table-list__product-id">B&J-34671</div>
</div>
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__price"><span class="acl-table-list__price--currency">£</span>19.42
each
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__stock">423 in Stock
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-forms__quantity">
<div class="acl-forms__quantity-button" onclick="quantityField.changeQuantity(this,'decrease')" value="Decrease Value">-
</div>
<input class="acl-forms__quantity-input" type="number" id="number" min="0" max="400" value="0" />
<div class="acl-forms__quantity-button" onclick="quantityField.changeQuantity(this,'increase')" value="Increase Value">+</div>
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__sub-total"><span class="acl-table-list__sub-total--currency">£</span>233.04
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__delete">
<i class="aforza-icons">acl_delete</i>
</div>
</td>
</tr>
<tr class="acl-data-table__row acl-table-list__row acl-table-list__item--promo">
<td class="acl-data-table__cell acl-table-list__cell acl-typography--bold">
<div class="acl-table-list__product-info">
<div class="acl-table-list__product-image">
<img class="acl-table-list__image" src="/assets/img/product-ex-1.png" />
</div>
<div class="acl-table-list__product-detail">
<div class="acl-table-list__product-name">Product Name and details 500ml (20 Pack)</div>
<div class="acl-table-list__product-id">B&J-34671</div>
</div>
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__price acl-table-list__price--teal">FREE <span class="acl-chip-label acl-chip-label--green">Granted Item</span>
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__stock">423 in Stock
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-forms__quantity">
10
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell acl-table-list__cell--text-right">
<del class="acl-table-list__sub-total--strikeout">
<span class="acl-table-list__sub-total--original-cost">£233.04</span>
</del>
<div class="acl-table-list__sub-total acl-table-list__sub-total--teal"><span class="acl-table-list__sub-total--currency">£</span>0.00
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__delete">
<i class="aforza-icons">acl_delete</i>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<script>
const quantityField = new acl.ACLQuantityField();
</script>
<div style="width: 913px">
<div class="acl-data-table acl-table-list">
<table class="acl-data-table__table" aria-label="Quantity List Table">
<thead>
<tr
class="acl-data-table__header-row acl-data-table__header-row--condensed acl-table-list__row--uppercase">
<th class="acl-data-table__header-cell" role="columnheader" scope="col">Name</th>
<th class="acl-data-table__header-cell acl-data-table__header-cell--text-center" scope="col">Price
</th>
<th class="acl-data-table__header-cell acl-data-table__header-cell--text-center" scope="col">Stock
</th>
<th class="acl-data-table__header-cell acl-data-table__header-cell--text-center" role="columnheader"
scope="col">Quantity</th>
<th class="acl-data-table__header-cell acl-data-table__header-cell--text-right" role="columnheader"
scope="col">Subtotal</th>
<th class="acl-data-table__header-cell" role="columnheader" scope="col"></th>
</tr>
</thead>
<tbody class="acl-data-table__content acl-table-list__content acl-table-list__scrollable-content">
<tr class="acl-data-table__row acl-table-list__row ">
<td class="acl-data-table__cell acl-table-list__cell acl-typography--bold">
<div class="acl-table-list__product-info">
<div class="acl-table-list__product-image">
<img class="acl-table-list__image" src="/assets/img/product-ex-1.png" />
</div>
<div class="acl-table-list__product-detail">
<div class="acl-table-list__product-name">Product Name and details 500ml (20 Pack)</div>
<div class="acl-table-list__product-id">B&J-34671</div>
</div>
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__price"><span class="acl-table-list__price--currency">£</span>19.42
each
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__stock">423 in Stock
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-forms__quantity">
<div class="acl-forms__quantity-button"
onclick="quantityField.changeQuantity(this,'decrease')" value="Decrease Value">-
</div>
<input class="acl-forms__quantity-input" type="number" id="number" min="0" max="400"
value="0" />
<div class="acl-forms__quantity-button"
onclick="quantityField.changeQuantity(this,'increase')" value="Increase Value">+</div>
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__sub-total"><span
class="acl-table-list__sub-total--currency">£</span>233.04
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__delete">
<i class="aforza-icons">acl_delete</i>
</div>
</td>
</tr>
<tr class="acl-data-table__row acl-table-list__row ">
<td class="acl-data-table__cell acl-table-list__cell acl-typography--bold">
<div class="acl-table-list__product-info">
<div class="acl-table-list__product-image">
<img class="acl-table-list__image" src="/assets/img/product-ex-1.png" />
</div>
<div class="acl-table-list__product-detail">
<div class="acl-table-list__product-name">Product Name and details 500ml (20 Pack)</div>
<div class="acl-table-list__product-id">B&J-34671</div>
</div>
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__price"><span class="acl-table-list__price--currency">£</span>19.42
each
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__stock">423 in Stock
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-forms__quantity">
<div class="acl-forms__quantity-button"
onclick="quantityField.changeQuantity(this,'decrease')" value="Decrease Value">-
</div>
<input class="acl-forms__quantity-input" type="number" id="number" min="0" max="400"
value="0" />
<div class="acl-forms__quantity-button"
onclick="quantityField.changeQuantity(this,'increase')" value="Increase Value">+</div>
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__sub-total"><span
class="acl-table-list__sub-total--currency">£</span>233.04
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__delete">
<i class="aforza-icons">acl_delete</i>
</div>
</td>
</tr>
<tr class="acl-data-table__row acl-table-list__row ">
<td class="acl-data-table__cell acl-table-list__cell acl-typography--bold">
<div class="acl-table-list__product-info">
<div class="acl-table-list__product-image">
<img class="acl-table-list__image" src="/assets/img/product-ex-1.png" />
</div>
<div class="acl-table-list__product-detail">
<div class="acl-table-list__product-name">Product Name and details 500ml (20 Pack)</div>
<div class="acl-table-list__product-id">B&J-34671</div>
</div>
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__price"><span class="acl-table-list__price--currency">£</span>19.42
each
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__stock">423 in Stock
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-forms__quantity">
<div class="acl-forms__quantity-button"
onclick="quantityField.changeQuantity(this,'decrease')" value="Decrease Value">-
</div>
<input class="acl-forms__quantity-input" type="number" id="number" min="0" max="400"
value="0" />
<div class="acl-forms__quantity-button"
onclick="quantityField.changeQuantity(this,'increase')" value="Increase Value">+</div>
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__sub-total"><span
class="acl-table-list__sub-total--currency">£</span>233.04
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__delete">
<i class="aforza-icons">acl_delete</i>
</div>
</td>
</tr>
<tr class="acl-data-table__row acl-table-list__row ">
<td class="acl-data-table__cell acl-table-list__cell acl-typography--bold">
<div class="acl-table-list__product-info">
<div class="acl-table-list__product-image">
<img class="acl-table-list__image" src="/assets/img/product-ex-1.png" />
</div>
<div class="acl-table-list__product-detail">
<div class="acl-table-list__product-name">Product Name and details 500ml (20 Pack)</div>
<div class="acl-table-list__product-id">B&J-34671</div>
</div>
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__price"><span class="acl-table-list__price--currency">£</span>19.42
each
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__stock">423 in Stock
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-forms__quantity">
<div class="acl-forms__quantity-button"
onclick="quantityField.changeQuantity(this,'decrease')" value="Decrease Value">-
</div>
<input class="acl-forms__quantity-input" type="number" id="number" min="0" max="400"
value="0" />
<div class="acl-forms__quantity-button"
onclick="quantityField.changeQuantity(this,'increase')" value="Increase Value">+</div>
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__sub-total"><span
class="acl-table-list__sub-total--currency">£</span>233.04
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__delete">
<i class="aforza-icons">acl_delete</i>
</div>
</td>
</tr>
<tr class="acl-data-table__row acl-table-list__row acl-table-list__item--promo">
<td class="acl-data-table__cell acl-table-list__cell acl-typography--bold">
<div class="acl-table-list__product-promotion-title">SUMMER PROMO DISCOUNT BUY 2 GET 1
50% OFF</div>
<div class="acl-table-list__product-info">
<div class="acl-table-list__product-image">
<img class="acl-table-list__image" src="/assets/img/product-ex-1.png" />
</div>
<div class="acl-table-list__product-detail">
<div class="acl-table-list__product-name">Product Name and details 500ml (20 Pack)</div>
<div class="acl-table-list__product-id">B&J-34671</div>
</div>
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__price"><span class="acl-table-list__price--currency">£</span>19.42
each
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__stock">423 in Stock
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-forms__quantity">
<div class="acl-forms__quantity-button"
onclick="quantityField.changeQuantity(this,'decrease')" value="Decrease Value">-
</div>
<input class="acl-forms__quantity-input" type="number" id="number" min="0" max="400"
value="0" />
<div class="acl-forms__quantity-button"
onclick="quantityField.changeQuantity(this,'increase')" value="Increase Value">+</div>
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__sub-total"><span
class="acl-table-list__sub-total--currency">£</span>233.04
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__delete">
<i class="aforza-icons">acl_delete</i>
</div>
</td>
</tr>
<tr class="acl-data-table__row acl-table-list__row acl-table-list__item--promo">
<td class="acl-data-table__cell acl-table-list__cell acl-typography--bold">
<div class="acl-table-list__product-info">
<div class="acl-table-list__product-image">
<img class="acl-table-list__image" src="/assets/img/product-ex-1.png" />
</div>
<div class="acl-table-list__product-detail">
<div class="acl-table-list__product-name">Product Name and details 500ml (20 Pack)</div>
<div class="acl-table-list__product-id">B&J-34671</div>
</div>
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__price acl-table-list__price--teal">FREE <span
class="acl-chip-label acl-chip-label--green">Granted Item</span>
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__stock">423 in Stock
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-forms__quantity">
10
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell acl-table-list__cell--text-right">
<del class="acl-table-list__sub-total--strikeout">
<span class="acl-table-list__sub-total--original-cost">£233.04</span>
</del>
<div class="acl-table-list__sub-total acl-table-list__sub-total--teal"><span
class="acl-table-list__sub-total--currency">£</span>0.00
</div>
</td>
<td class="acl-data-table__cell acl-table-list__cell">
<div class="acl-table-list__delete">
<i class="aforza-icons">acl_delete</i>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<script>
const quantityField = new acl.ACLQuantityField();
</script>
/* No context defined. */
// Copyright 2016 Google Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
@import '../density/functions';
@import '../rtl/mixins';
@import '../theme/mixins';
@import '../shape/functions';
@import '../shape/mixins';
@import '../ripple/mixins';
@import '../theme/functions';
@import '../typography/mixins';
@import '../typography/variables';
@import '../feature-targeting/functions';
@import '../feature-targeting/mixins';
@import './variables';
//
// Public
//
@mixin acl-list-core-styles($query: acl-feature-all()) {
@include acl-list-without-ripple($query);
@include acl-list-ripple($query);
}
// This API is intended for use by frameworks that may want to separate the ripple-related styles from the other
// list styles. It is recommended that most users use `acl-list-core-styles` instead.
@mixin acl-list-without-ripple($query: acl-feature-all()) {
$feat-color: acl-feature-create-target($query, color);
$feat-structure: acl-feature-create-target($query, structure);
$feat-typography: acl-feature-create-target($query, typography);
$item-primary-text-baseline-height: 32px;
$item-secondary-text-baseline-height: 20px;
$dense-item-primary-text-baseline-height: 24px;
$divider-color: if(
acl-theme-tone($acl-theme-background) == 'dark',
$acl-list-divider-color-on-dark-bg,
$acl-list-divider-color-on-light-bg
);
.acl-list {
@include acl-list-base_($query);
}
@include acl-list-single-line-density($acl-list-single-line-density-scale, $query: $query);
@include acl-list-item-secondary-text-ink-color(text-secondary-on-background, $query);
@include acl-list-item-graphic-fill-color(transparent, $query);
@include acl-list-item-graphic-ink-color(text-icon-on-background, $query);
@include acl-list-item-meta-ink-color(text-hint-on-background, $query);
@include acl-list-group-subheader-ink-color(text-primary-on-background, $query);
@include acl-list-item-disabled-text-opacity($acl-list-text-disabled-opacity, $query);
@include acl-list-item-disabled-text-color($acl-list-text-disabled-color, $query);
.acl-list--dense {
@include acl-feature-targets($feat-structure) {
padding-top: 4px;
padding-bottom: 4px;
font-size: 0.812rem;
}
}
.acl-list-item {
@include acl-feature-targets($feat-structure) {
@include acl-list-item-base_;
}
}
// "Selected" is ephemeral and likely to change soon. E.g., selecting one or more photos to share in Google Photos.
// "Activated" is more permanent. E.g., the currently highlighted navigation destination in a drawer.
.acl-list-item--selected,
.acl-list-item--activated {
@include acl-list-item-primary-text-ink-color(primary, $query);
@include acl-list-item-graphic-ink-color(primary, $query);
}
.acl-list-item__graphic {
@include acl-feature-targets($feat-structure) {
@include acl-list-graphic-size_(24px);
flex-shrink: 0;
align-items: center;
justify-content: center;
fill: currentColor;
}
}
// Extra specificity is to override .material-icons display style if used in
// conjunction with acl-list-item__graphic
// stylelint-disable plugin/selector-bem-pattern
.acl-list .acl-list-item__graphic {
@include acl-feature-targets($feat-structure) {
display: inline-flex;
}
}
// stylelint-enable plugin/selector-bem-pattern
.acl-list-item__meta {
// stylelint-disable selector-class-pattern
&:not(.material-icons) {
@include acl-typography(caption, $query);
}
// stylelint-enable selector-class-pattern
@include acl-feature-targets($feat-structure) {
@include acl-rtl-reflexive-property(margin, auto, 0, '.acl-list-item');
}
}
.acl-list-item__text {
@include acl-typography-overflow-ellipsis($query);
}
// Disable interaction on label elements that may automatically
// toggle corresponding checkbox / radio input.
.acl-list-item__text[for] {
@include acl-feature-targets($feat-structure) {
pointer-events: none;
}
}
.acl-list-item__primary-text {
@include acl-typography-overflow-ellipsis($query);
@include acl-typography-baseline-top($item-primary-text-baseline-height, $query);
@include acl-typography-baseline-bottom($item-secondary-text-baseline-height, $query);
@include acl-feature-targets($feat-structure) {
display: block;
}
// stylelint-disable plugin/selector-bem-pattern
.acl-list--dense & {
@include acl-typography-baseline-top($dense-item-primary-text-baseline-height, $query);
@include acl-typography-baseline-bottom($item-secondary-text-baseline-height, $query);
}
// stylelint-enable plugin/selector-bem-pattern
}
.acl-list-item__secondary-text {
@include acl-typography(body2, $query);
@include acl-typography-overflow-ellipsis($query);
@include acl-typography-baseline-top($item-secondary-text-baseline-height, $query);
@include acl-feature-targets($feat-structure) {
display: block;
}
// stylelint-disable plugin/selector-bem-pattern
.acl-list--dense & {
@include acl-typography-baseline-top($item-secondary-text-baseline-height, $query);
@include acl-feature-targets($feat-structure) {
font-size: inherit;
}
}
// stylelint-enable plugin/selector-bem-pattern
}
// stylelint-disable plugin/selector-bem-pattern
.acl-list--dense .acl-list-item {
@include acl-feature-targets($feat-structure) {
height: 40px;
}
}
.acl-list--dense .acl-list-item__graphic {
@include acl-feature-targets($feat-structure) {
@include acl-list-graphic-size_(20px);
}
}
.acl-list--avatar-list .acl-list-item {
@include acl-feature-targets($feat-structure) {
height: 56px;
}
}
.acl-list--avatar-list .acl-list-item__graphic {
@include acl-feature-targets($feat-structure) {
@include acl-list-graphic-size_(40px);
border-radius: 50%;
}
}
.acl-list--two-line .acl-list-item__text {
@include acl-feature-targets($feat-structure) {
align-self: flex-start;
}
}
.acl-list--two-line .acl-list-item {
@include acl-feature-targets($feat-structure) {
height: 72px;
}
}
.acl-list--two-line.acl-list--dense .acl-list-item,
.acl-list--avatar-list.acl-list--dense .acl-list-item {
@include acl-feature-targets($feat-structure) {
height: 60px;
}
}
.acl-list--avatar-list.acl-list--dense .acl-list-item__graphic {
@include acl-feature-targets($feat-structure) {
@include acl-list-graphic-size_(36px);
}
}
// Only change mouse cursor for interactive list items which are not disabled.
:not(.acl-list--non-interactive) > :not(.acl-list-item--disabled).acl-list-item {
@include acl-feature-targets($feat-structure) {
cursor: pointer;
}
}
// Override anchor tag styles for the use-case of a list being used for navigation
// stylelint-disable selector-max-type,selector-no-qualifying-type
a.acl-list-item {
@include acl-feature-targets($feat-structure) {
color: inherit;
text-decoration: none;
}
}
// stylelint-enable selector-max-type,selector-no-qualifying-type
.acl-list-divider {
@include acl-feature-targets($feat-structure) {
height: 0;
margin: 0;
border: none;
border-bottom-width: 1px;
border-bottom-style: solid;
}
}
// Note: ideally we'd be able to hoist this to the top-level `$feat-color`, but doing so
// will cause the `border` declaration on `.acl-list-divider` above to override it.
@include acl-list-divider-color($divider-color, $query);
.acl-list-divider--padded {
@include acl-feature-targets($feat-structure) {
// Leave gaps on each side to match the padding on list items
margin: 0 $acl-list-side-padding;
}
}
.acl-list-divider--inset {
@include acl-feature-targets($feat-structure) {
@include acl-rtl-reflexive-box(margin, left, $acl-list-text-offset, '.acl-list-group');
width: calc(100% - #{$acl-list-text-offset});
}
}
.acl-list-divider--inset.acl-list-divider--padded {
@include acl-feature-targets($feat-structure) {
width: calc(100% - #{$acl-list-text-offset} - #{$acl-list-side-padding});
}
}
.acl-list-group {
@include acl-feature-targets($feat-structure) {
// Cancel top/bottom padding on individual lists within group
.acl-list {
padding: 0;
}
}
}
.acl-list-group__subheader {
$acl-list-subheader-virtual-height: 3rem;
$acl-list-subheader-leading: map-get(map-get($acl-typography-styles, body1), line-height);
$acl-list-subheader-margin: ($acl-list-subheader-virtual-height - $acl-list-subheader-leading) / 2;
@include acl-typography(subtitle1, $query);
@include acl-feature-targets($feat-structure) {
margin: $acl-list-subheader-margin $acl-list-side-padding;
}
}
}
// This API is intended for use by frameworks that may want to separate the ripple-related styles from the other
// list styles. It is recommended that most users use `acl-list-core-styles` instead.
@mixin acl-list-ripple($query: acl-feature-all()) {
@include acl-ripple-common($query);
// List items should support states by default, but it should be possible to opt out.
// Direct child combinator is necessary for non-interactive modifier on parent to not
// match this selector.
:not(.acl-list--non-interactive) > :not(.acl-list-item--disabled).acl-list-item {
@include acl-list-item-interactive-ripple_($query);
}
// Set styles only for focus state on disabled list item.
:not(.acl-list--non-interactive) > .acl-list-item--disabled {
@include acl-ripple-surface($query: $query);
@include acl-ripple-radius-bounded($query: $query);
@include acl-states-base-color(acl-theme-prop-value(on-surface), $query: $query);
@include acl-states-focus-opacity(acl-states-opacity(primary, focus), $query: $query);
}
}
@mixin acl-list-item-primary-text-ink-color($color, $query: acl-feature-all()) {
$feat-color: acl-feature-create-target($query, color);
@include acl-feature-targets($feat-color) {
@include acl-theme-prop(color, $color);
}
}
@mixin acl-list-item-secondary-text-ink-color($color, $query: acl-feature-all()) {
$feat-color: acl-feature-create-target($query, color);
.acl-list-item__secondary-text {
@include acl-feature-targets($feat-color) {
@include acl-theme-prop(color, $color);
}
}
}
@mixin acl-list-item-graphic-fill-color($color, $query: acl-feature-all()) {
$feat-color: acl-feature-create-target($query, color);
.acl-list-item__graphic {
@include acl-feature-targets($feat-color) {
@include acl-theme-prop(background-color, $color);
}
}
}
@mixin acl-list-item-graphic-ink-color($color, $query: acl-feature-all()) {
$feat-color: acl-feature-create-target($query, color);
.acl-list-item__graphic {
@include acl-feature-targets($feat-color) {
@include acl-theme-prop(color, $color);
}
}
}
@mixin acl-list-item-meta-ink-color($color, $query: acl-feature-all()) {
$feat-color: acl-feature-create-target($query, color);
.acl-list-item__meta {
@include acl-feature-targets($feat-color) {
@include acl-theme-prop(color, $color);
}
}
}
///
/// Sets shape radius (rounded) to single line list variant.
///
/// @param {Number | List<Number>} $radius Radius size in `px` or percentage. It can be 4 value corner or single radius.
/// Set to `50%` for rounded shape.
/// @param {Boolean} $rtl-reflexive Set to true to flip border radius in RTL context. Defaults to `false`.
/// @param {Number} $density-scale Density scale of single line list. Set this only when custom density is applied.
/// Defaults to `$acl-list-single-line-density-scale`.
///
/// @access public
///
@mixin acl-list-single-line-shape-radius(
$radius,
$rtl-reflexive: false,
$density-scale: $acl-list-single-line-density-scale,
$query: acl-feature-all()
) {
$height: acl-density-prop-value(
$density-config: $acl-list-single-line-density-config,
$density-scale: $density-scale,
$property-name: height,
);
$resolved-radius: acl-shape-resolve-percentage-radius($height, $radius);
.acl-list-item {
@include acl-shape-radius($resolved-radius, $rtl-reflexive, $query: $query);
}
}
@mixin acl-list-divider-color($color, $query: acl-feature-all()) {
$feat-color: acl-feature-create-target($query, color);
.acl-list-divider {
@include acl-feature-targets($feat-color) {
@include acl-theme-prop(border-bottom-color, $color);
}
}
}
@mixin acl-list-group-subheader-ink-color($color, $query: acl-feature-all()) {
$feat-color: acl-feature-create-target($query, color);
.acl-list-group__subheader {
@include acl-feature-targets($feat-color) {
@include acl-theme-prop(color, $color);
}
}
}
@mixin acl-list-item-disabled-text-opacity($opacity, $query: acl-feature-all()) {
$feat-color: acl-feature-create-target($query, color);
.acl-list-item--disabled .acl-list-item__text {
@include acl-feature-targets($feat-color) {
opacity: $opacity;
}
}
}
@mixin acl-list-item-disabled-text-color($color, $query: acl-feature-all()) {
$feat-color: acl-feature-create-target($query, color);
.acl-list-item--disabled .acl-list-item__text {
@include acl-feature-targets($feat-color) {
@include acl-theme-prop(color, $color);
}
}
}
///
/// Sets density scale to single line list variant.
///
/// @param {Number} $density-scale Density scale for list. Supported density scales are `-4`, `-3`, `-2`, `-1` and `0`.
///
/// @access public
///
@mixin acl-list-single-line-density($density-scale, $query: acl-feature-all()) {
$height: acl-density-prop-value(
$density-config: $acl-list-single-line-density-config,
$density-scale: $density-scale,
$property-name: height,
);
.acl-list-item {
@include acl-list-single-line-height($height, $query: $query);
}
}
///
/// Sets height to single line list variant.
///
/// @param {Number} $height Height value in `px`.
///
/// @access public
///
@mixin acl-list-single-line-height($height, $query: acl-feature-all()) {
$feat-structure: acl-feature-create-target($query, structure);
@include acl-feature-targets($feat-structure) {
height: $height;
}
}
//
// Private
//
@mixin acl-list-base_($query: acl-feature-all()) {
$feat-color: acl-feature-create-target($query, color);
$feat-structure: acl-feature-create-target($query, structure);
$feat-typography: acl-feature-create-target($query, typography);
@include acl-typography(subtitle1, $query);
@include acl-feature-targets($feat-typography) {
// According to the mocks and stickersheet, the line-height is
// adjusted to 24px for text content, same as for body1.
/* @alternate */
line-height: map-get(map-get($acl-typography-styles, body1), line-height);
}
@include acl-feature-targets($feat-structure) {
margin: 0;
padding: 8px 0;
list-style-type: none;
&:focus {
outline: none;
}
}
@include acl-list-item-primary-text-ink-color(text-primary-on-background, $query);
}
@mixin acl-list-item-base_ {
display: flex;
position: relative;
align-items: center;
justify-content: flex-start;
padding: 0 $acl-list-side-padding;
overflow: hidden;
&:focus {
outline: none;
}
}
// Ripple styles for an interactive list item (one that is enabled and inside an interactive list).
@mixin acl-list-item-interactive-ripple_($query: acl-feature-all()) {
@include acl-ripple-surface($query);
@include acl-ripple-radius-bounded($query: $query);
@include acl-states(acl-theme-prop-value(on-surface), false, $query);
@include acl-states-activated(primary, false, $query);
@include acl-states-selected(primary, false, $query);
}
// Sets the width and height of the graphic element, as well as calculates the margins for
// the graphic element such that the text is always offset by 72px, which is defined within
// the spec.
@mixin acl-list-graphic-size_($size) {
$text-offset: 72px;
$side-padding: $acl-list-side-padding;
$margin-value: $text-offset - $side-padding - $size;
@include acl-rtl-reflexive-box(margin, right, $margin-value, '.acl-list-item');
width: $size;
height: $size;
}
@import '../density/variables';
$acl-list-divider-color-on-light-bg: #e8ebf8 !default;
$acl-list-divider-color-on-dark-bg: rgba(255, 255, 255, 0.2) !default;
$acl-list-side-padding: 16px !default;
$acl-list-text-offset: 72px !default;
$acl-list-text-disabled-opacity: acl-theme-text-emphasis(disabled) !default;
$acl-list-text-disabled-color: on-surface !default;
$acl-list-single-line-height: 69px !default;
$acl-list-single-line-minimum-height: 24px !default;
$acl-list-single-line-maximum-height: $acl-list-single-line-height !default;
$acl-list-single-line-density-scale: $acl-density-default-scale !default;
$acl-list-single-line-density-config: (
height: (
default: $acl-list-single-line-height,
maximum: $acl-list-single-line-maximum-height,
minimum: $acl-list-single-line-minimum-height,
),
) !default;
@import './mixins';
@include acl-list-core-styles;
.acl-data-table__header-row {
&--condensed {
border: 1px solid #e8ebf8;
background-color: #e8ebf8;
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.1);
}
}
.acl-data-table__header-cell {
&--condensed {
color: #8892b4;
font-family: 'Open Sans';
font-size: 10px;
font-weight: 600;
line-height: 14px;
}
&--text-center {
text-align: center !important; // Required for MDC override.
}
&--text-right {
text-align: right !important; // Required for MDC override.
}
}
.acl-data-table__cell {
overflow: visible !important;
}
.acl-draggable-list {
overflow: hidden !important; // this needs to be addressed.
&__row {
color: #b1b7cd;
font-family: 'Open Sans';
font-size: 12px;
line-height: 17px;
height: 65px;
}
&__address {
color: #b1b7cd;
font-family: 'Open Sans';
font-size: 12px;
line-height: 17px;
min-width: 100px;
max-width: 200px;
word-break: break-word;
white-space: normal;
padding: 10px 0;
}
&__account-name {
display: flex;
align-items: center;
max-width: 300px;
min-width: 75px;
word-break: break-word;
white-space: normal;
margin-left: -10px;
}
&__store-name {
padding: 10px 0;
}
&__account-type {
color: #93c3ea;
margin-right: 12px;
}
&__date {
color: rgba(40, 136, 214, 0.75);
font-family: 'Open Sans';
font-size: 12px;
font-style: italic;
line-height: 17px;
}
&__route-stage {
padding-right: 0;
}
&__remove {
color: #b1b7cd;
padding-right: 5px;
cursor: pointer;
//padding-right: 25px;
}
&__grab-indicator {
color: #b1b7cd;
cursor: grab;
margin-right: -20px;
}
&__item {
&--grabbed {
box-shadow: 0 -4px 25px 0 rgba(0, 0, 0, 0.3);
cursor: grabbing;
}
}
&__contact-details {
display: flex;
flex-wrap: wrap;
flex-direction: column;
padding: 10px 0;
min-width: 160px;
i {
font-size: 16px;
margin-right: 10px;
}
}
&__contact-type {
display: flex;
color: #b1b7cd;
}
&__phone-number {
a {
text-decoration: none;
color: #b1b7cd;
}
}
&__email-address {
max-width: 157px;
word-break: break-word;
white-space: normal;
a {
text-decoration: none;
color: #b1b7cd;
}
}
&__route-stage {
color: rgba(0, 0, 0, 0.5);
text-align: center;
padding-left: 25px;
}
}
.acl-table-list {
overflow: hidden !important; // this needs to be addressed
a {
color: #2888d6;
font-family: 'Open Sans';
font-size: 10px;
line-height: 14px;
}
&__content {
overflow-y: auto;
}
&__row {
color: #b1b7cd;
font-family: 'Open Sans';
font-size: 12px;
line-height: 17px;
&--uppercase {
text-transform: uppercase;
}
}
&__icon {
cursor: pointer;
i {
color: #707893;
}
}
&__delete {
cursor: pointer;
user-select: none;
i {
color: #b1b7cd;
}
}
&__image {
height: 22px;
width: 22px;
object-fit: cover;
}
&__fav-icon {
cursor: pointer;
margin: 0 8px;
i {
color: #cacfe2;
font-size: 26px;
}
&--selected {
i {
color: #ffda73;
}
}
}
&__icon-text {
display: flex;
align-items: center;
color: #707893;
font-family: 'Open Sans';
font-size: 10px;
font-weight: 600;
line-height: 14px;
i {
color: #707893;
}
}
&__cell {
color: #707893 !important;
font-family: 'Open Sans';
font-size: 12px;
line-height: 17px;
&--text-right {
text-align: right;
}
}
&__address {
color: #b1b7cd;
font-family: 'Open Sans';
font-size: 12px;
line-height: 17px;
word-break: break-word;
white-space: normal;
padding: 10px 0;
}
&__account-name {
display: flex;
align-items: center;
word-break: break-word;
white-space: normal;
margin-left: -10px;
}
&__product-info {
display: flex;
word-break: break-word;
white-space: normal;
}
&__store-name {
padding: 10px 0;
color: rgba(0, 0, 0, 0.75);
a {
color: rgba(0, 0, 0, 0.75);
font-size: 12px;
line-height: 17px;
text-decoration: none;
&:hover {
text-decoration: underline;
}
}
}
&__product-detail {
display: flex;
flex-direction: column;
padding: 10px 0;
}
&__product-name {
color: $black;
font-size: 12px;
font-weight: 600;
letter-spacing: 0;
line-height: 16px;
}
&__product-promotion-title {
color: #2cbcb2;
font-size: 10px;
font-weight: bold;
letter-spacing: 0;
line-height: 16px;
}
&__product-id {
color: rgba(0, 0, 0, 0.25);
font-family: 'Open Sans';
font-size: 10px;
letter-spacing: 0;
line-height: 14px;
}
&__product-image {
display: flex;
align-items: center;
margin-right: 10px;
}
&__account-type {
color: #8892b4;
margin-right: 12px;
i {
font-size: 29px;
}
}
&__date {
color: rgba(40, 136, 214, 0.75);
font-family: 'Open Sans';
font-size: 12px;
font-style: italic;
line-height: 17px;
}
&__price {
color: $black;
font-size: 12px;
font-weight: 600;
letter-spacing: 0;
line-height: 17px;
text-align: center;
&--currency {
font-size: 10px;
font-weight: normal;
}
&--teal {
color: $teal;
}
}
&__sub-total {
color: $black;
font-size: 14px;
font-weight: 600;
letter-spacing: 0;
line-height: 19px;
text-align: right;
&--currency {
font-size: 11px;
font-weight: normal;
}
&--original-cost {
font-size: 10px;
text-align: right;
color: $black;
}
&--teal {
color: $teal;
}
}
&__stock {
color: rgba(0, 0, 0, 0.25);
font-size: 10px;
letter-spacing: 0;
line-height: 14px;
text-align: center;
}
&__route-stage {
padding-left: 25px;
}
&__remove {
color: #b1b7cd;
padding-right: 25px;
}
&__grab-indicator {
color: #b1b7cd;
cursor: grab;
}
&__item {
&--highlighted {
background-color: #f8f8fb !important;
}
&--promo {
border-left: 5px solid $teal;
del {
color: $teal;
}
}
}
&__contact-details {
display: flex;
flex-wrap: wrap;
flex-direction: column;
padding: 10px 0;
i {
font-size: 16px;
margin-right: 10px;
}
}
&__contact-type {
display: flex;
color: #b1b7cd;
}
&__phone-number {
a {
text-decoration: none;
color: #b1b7cd;
}
}
&__email-address {
//max-width: 157px;
word-break: break-word;
white-space: normal;
a {
text-decoration: none;
color: #b1b7cd;
}
}
&--scrollable {
position: relative;
table {
table-layout: auto;
border-collapse: collapse;
width: 100%;
overflow: auto;
}
table .absorbing-column {
width: 100%;
}
}
&__gradient-overlay {
position: absolute;
bottom: 0;
width: 100%;
height: 75px;
border-radius: 0 0 5px 5px;
background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #ffffff 100%);
pointer-events: none;
}
}
/**
* @license
* Copyright 2018 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
//# sourceMappingURL=adapter.js.map
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG"}
/**
* @license
* Copyright 2018 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
import * as tslib_1 from 'tslib';
import { MDCComponent } from '..//base/component';
import { closest, matches } from '..//dom/ponyfill';
import { cssClasses, strings } from './constants';
import { MDCListFoundation } from './foundation';
var MDCList = /** @class */ (function(_super) {
tslib_1.__extends(MDCList, _super);
function MDCList() {
return (_super !== null && _super.apply(this, arguments)) || this;
}
Object.defineProperty(MDCList.prototype, 'vertical', {
set: function(value) {
this.foundation_.setVerticalOrientation(value);
},
enumerable: true,
configurable: true,
});
Object.defineProperty(MDCList.prototype, 'listElements', {
get: function() {
return [].slice.call(this.root_.querySelectorAll('.' + cssClasses.LIST_ITEM_CLASS));
},
enumerable: true,
configurable: true,
});
Object.defineProperty(MDCList.prototype, 'wrapFocus', {
set: function(value) {
this.foundation_.setWrapFocus(value);
},
enumerable: true,
configurable: true,
});
Object.defineProperty(MDCList.prototype, 'singleSelection', {
set: function(isSingleSelectionList) {
this.foundation_.setSingleSelection(isSingleSelectionList);
},
enumerable: true,
configurable: true,
});
Object.defineProperty(MDCList.prototype, 'selectedIndex', {
get: function() {
return this.foundation_.getSelectedIndex();
},
set: function(index) {
this.foundation_.setSelectedIndex(index);
},
enumerable: true,
configurable: true,
});
MDCList.attachTo = function(root) {
return new MDCList(root);
};
MDCList.prototype.initialSyncWithDOM = function() {
this.handleClick_ = this.handleClickEvent_.bind(this);
this.handleKeydown_ = this.handleKeydownEvent_.bind(this);
this.focusInEventListener_ = this.handleFocusInEvent_.bind(this);
this.focusOutEventListener_ = this.handleFocusOutEvent_.bind(this);
this.listen('keydown', this.handleKeydown_);
this.listen('click', this.handleClick_);
this.listen('focusin', this.focusInEventListener_);
this.listen('focusout', this.focusOutEventListener_);
this.layout();
this.initializeListType();
};
MDCList.prototype.destroy = function() {
this.unlisten('keydown', this.handleKeydown_);
this.unlisten('click', this.handleClick_);
this.unlisten('focusin', this.focusInEventListener_);
this.unlisten('focusout', this.focusOutEventListener_);
};
MDCList.prototype.layout = function() {
var direction = this.root_.getAttribute(strings.ARIA_ORIENTATION);
this.vertical = direction !== strings.ARIA_ORIENTATION_HORIZONTAL;
// List items need to have at least tabindex=-1 to be focusable.
[].slice.call(this.root_.querySelectorAll('.acl-list-item:not([tabindex])')).forEach(function(el) {
el.setAttribute('tabindex', '-1');
});
// Child button/a elements are not tabbable until the list item is focused.
[].slice.call(this.root_.querySelectorAll(strings.FOCUSABLE_CHILD_ELEMENTS)).forEach(function(el) {
return el.setAttribute('tabindex', '-1');
});
this.foundation_.layout();
};
/**
* Initialize selectedIndex value based on pre-selected checkbox list items, single selection or radio.
*/
MDCList.prototype.initializeListType = function() {
var _this = this;
var checkboxListItems = this.root_.querySelectorAll(strings.ARIA_ROLE_CHECKBOX_SELECTOR);
var singleSelectedListItem = this.root_.querySelector(
'\n .' +
cssClasses.LIST_ITEM_ACTIVATED_CLASS +
',\n .' +
cssClasses.LIST_ITEM_SELECTED_CLASS +
'\n '
);
var radioSelectedListItem = this.root_.querySelector(strings.ARIA_CHECKED_RADIO_SELECTOR);
if (checkboxListItems.length) {
var preselectedItems = this.root_.querySelectorAll(strings.ARIA_CHECKED_CHECKBOX_SELECTOR);
this.selectedIndex = [].map.call(preselectedItems, function(listItem) {
return _this.listElements.indexOf(listItem);
});
} else if (singleSelectedListItem) {
if (singleSelectedListItem.classList.contains(cssClasses.LIST_ITEM_ACTIVATED_CLASS)) {
this.foundation_.setUseActivatedClass(true);
}
this.singleSelection = true;
this.selectedIndex = this.listElements.indexOf(singleSelectedListItem);
} else if (radioSelectedListItem) {
this.selectedIndex = this.listElements.indexOf(radioSelectedListItem);
}
};
/**
* Updates the list item at itemIndex to the desired isEnabled state.
* @param itemIndex Index of the list item
* @param isEnabled Sets the list item to enabled or disabled.
*/
MDCList.prototype.setEnabled = function(itemIndex, isEnabled) {
this.foundation_.setEnabled(itemIndex, isEnabled);
};
MDCList.prototype.getDefaultFoundation = function() {
var _this = this;
// DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
// To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
var adapter = {
addClassForElementIndex: function(index, className) {
var element = _this.listElements[index];
if (element) {
element.classList.add(className);
}
},
focusItemAtIndex: function(index) {
var element = _this.listElements[index];
if (element) {
element.focus();
}
},
getAttributeForElementIndex: function(index, attr) {
return _this.listElements[index].getAttribute(attr);
},
getFocusedElementIndex: function() {
return _this.listElements.indexOf(document.activeElement);
},
getListItemCount: function() {
return _this.listElements.length;
},
hasCheckboxAtIndex: function(index) {
var listItem = _this.listElements[index];
return !!listItem.querySelector(strings.CHECKBOX_SELECTOR);
},
hasRadioAtIndex: function(index) {
var listItem = _this.listElements[index];
return !!listItem.querySelector(strings.RADIO_SELECTOR);
},
isCheckboxCheckedAtIndex: function(index) {
var listItem = _this.listElements[index];
var toggleEl = listItem.querySelector(strings.CHECKBOX_SELECTOR);
return toggleEl.checked;
},
isFocusInsideList: function() {
return _this.root_.contains(document.activeElement);
},
isRootFocused: function() {
return document.activeElement === _this.root_;
},
listItemAtIndexHasClass: function(index, className) {
return _this.listElements[index].classList.contains(className);
},
notifyAction: function(index) {
_this.emit(strings.ACTION_EVENT, { index: index }, /** shouldBubble */ true);
},
removeClassForElementIndex: function(index, className) {
var element = _this.listElements[index];
if (element) {
element.classList.remove(className);
}
},
setAttributeForElementIndex: function(index, attr, value) {
var element = _this.listElements[index];
if (element) {
element.setAttribute(attr, value);
}
},
setCheckedCheckboxOrRadioAtIndex: function(index, isChecked) {
var listItem = _this.listElements[index];
var toggleEl = listItem.querySelector(strings.CHECKBOX_RADIO_SELECTOR);
toggleEl.checked = isChecked;
var event = document.createEvent('Event');
event.initEvent('change', true, true);
toggleEl.dispatchEvent(event);
},
setTabIndexForListItemChildren: function(listItemIndex, tabIndexValue) {
var element = _this.listElements[listItemIndex];
var listItemChildren = [].slice.call(
element.querySelectorAll(strings.CHILD_ELEMENTS_TO_TOGGLE_TABINDEX)
);
listItemChildren.forEach(function(el) {
return el.setAttribute('tabindex', tabIndexValue);
});
},
};
return new MDCListFoundation(adapter);
};
/**
* Used to figure out which list item this event is targetting. Or returns -1 if
* there is no list item
*/
MDCList.prototype.getListItemIndex_ = function(evt) {
var eventTarget = evt.target;
var nearestParent = closest(eventTarget, '.' + cssClasses.LIST_ITEM_CLASS + ', .' + cssClasses.ROOT);
// Get the index of the element if it is a list item.
if (nearestParent && matches(nearestParent, '.' + cssClasses.LIST_ITEM_CLASS)) {
return this.listElements.indexOf(nearestParent);
}
return -1;
};
/**
* Used to figure out which element was clicked before sending the event to the foundation.
*/
MDCList.prototype.handleFocusInEvent_ = function(evt) {
var index = this.getListItemIndex_(evt);
this.foundation_.handleFocusIn(evt, index);
};
/**
* Used to figure out which element was clicked before sending the event to the foundation.
*/
MDCList.prototype.handleFocusOutEvent_ = function(evt) {
var index = this.getListItemIndex_(evt);
this.foundation_.handleFocusOut(evt, index);
};
/**
* Used to figure out which element was focused when keydown event occurred before sending the event to the
* foundation.
*/
MDCList.prototype.handleKeydownEvent_ = function(evt) {
var index = this.getListItemIndex_(evt);
var target = evt.target;
this.foundation_.handleKeydown(evt, target.classList.contains(cssClasses.LIST_ITEM_CLASS), index);
};
/**
* Used to figure out which element was clicked before sending the event to the foundation.
*/
MDCList.prototype.handleClickEvent_ = function(evt) {
var index = this.getListItemIndex_(evt);
var target = evt.target;
// Toggle the checkbox only if it's not the target of the event, or the checkbox will have 2 change events.
var toggleCheckbox = !matches(target, strings.CHECKBOX_RADIO_SELECTOR);
this.foundation_.handleClick(index, toggleCheckbox);
};
return MDCList;
})(MDCComponent);
export { MDCList };
//# sourceMappingURL=component.js.map
{"version":3,"file":"component.js","sourceRoot":"","sources":["component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;AAEH,OAAO,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EAAC,OAAO,EAAE,OAAO,EAAC,MAAM,wBAAwB,CAAC;AAExD,OAAO,EAAC,UAAU,EAAE,OAAO,EAAC,MAAM,aAAa,CAAC;AAChD,OAAO,EAAC,iBAAiB,EAAC,MAAM,cAAc,CAAC;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AG,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,uBAAuB,CAAC,CAAC;QACzE,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;IACtD,CAAC;IACH,cAAC;AAAD,CAAC,AAvOD,CAA6B,YAAY,GAuOxC"}
/**
* @license
* Copyright 2018 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var cssClasses = {
LIST_ITEM_ACTIVATED_CLASS: 'acl-list-item--activated',
LIST_ITEM_CLASS: 'acl-list-item',
LIST_ITEM_DISABLED_CLASS: 'acl-list-item--disabled',
LIST_ITEM_SELECTED_CLASS: 'acl-list-item--selected',
ROOT: 'acl-list',
};
var strings = {
ACTION_EVENT: 'MDCList:action',
ARIA_CHECKED: 'aria-checked',
ARIA_CHECKED_CHECKBOX_SELECTOR: '[role="checkbox"][aria-checked="true"]',
ARIA_CHECKED_RADIO_SELECTOR: '[role="radio"][aria-checked="true"]',
ARIA_CURRENT: 'aria-current',
ARIA_DISABLED: 'aria-disabled',
ARIA_ORIENTATION: 'aria-orientation',
ARIA_ORIENTATION_HORIZONTAL: 'horizontal',
ARIA_ROLE_CHECKBOX_SELECTOR: '[role="checkbox"]',
ARIA_SELECTED: 'aria-selected',
CHECKBOX_RADIO_SELECTOR: 'input[type="checkbox"], input[type="radio"]',
CHECKBOX_SELECTOR: 'input[type="checkbox"]',
CHILD_ELEMENTS_TO_TOGGLE_TABINDEX:
'\n .' +
cssClasses.LIST_ITEM_CLASS +
' button:not(:disabled),\n .' +
cssClasses.LIST_ITEM_CLASS +
' a\n ',
FOCUSABLE_CHILD_ELEMENTS:
'\n .' +
cssClasses.LIST_ITEM_CLASS +
' button:not(:disabled),\n .' +
cssClasses.LIST_ITEM_CLASS +
' a,\n .' +
cssClasses.LIST_ITEM_CLASS +
' input[type="radio"]:not(:disabled),\n .' +
cssClasses.LIST_ITEM_CLASS +
' input[type="checkbox"]:not(:disabled)\n ',
RADIO_SELECTOR: 'input[type="radio"]',
};
var numbers = {
UNSET_INDEX: -1,
};
export { strings, cssClasses, numbers };
//# sourceMappingURL=constants.js.map
{"version":3,"file":"constants.js","sourceRoot":"","sources":["constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,IAAM,UAAU,GAAG;IACjB,yBAAyB,EAAE,0BAA0B;IACrD,eAAe,EAAE,eAAe;IAChC,wBAAwB,EAAE,yBAAyB;IACnD,wBAAwB,EAAE,yBAAyB;IACnD,IAAI,EAAE,UAAU;CACjB,CAAC;AAEF,IAAM,OAAO,GAAG;IACd,YAAY,EAAE,gBAAgB;IAC9B,YAAY,EAAE,cAAc;IAC5B,8BAA8B,EAAE,wCAAwC;IACxE,2BAA2B,EAAE,qCAAqC;IAClE,YAAY,EAAE,cAAc;IAC5B,aAAa,EAAE,eAAe;IAC9B,gBAAgB,EAAE,kBAAkB;IACpC,2BAA2B,EAAE,YAAY;IACzC,2BAA2B,EAAE,mBAAmB;IAChD,aAAa,EAAE,eAAe;IAC9B,uBAAuB,EAAE,6CAA6C;IACtE,iBAAiB,EAAE,wBAAwB;IAC3C,iCAAiC,EAAE,YAC9B,UAAU,CAAC,eAAe,sCAC1B,UAAU,CAAC,eAAe,WAC9B;IACD,wBAAwB,EAAE,YACrB,UAAU,CAAC,eAAe,sCAC1B,UAAU,CAAC,eAAe,kBAC1B,UAAU,CAAC,eAAe,qDAC1B,UAAU,CAAC,eAAe,iDAC9B;IACD,cAAc,EAAE,qBAAqB;CACtC,CAAC;AAEF,IAAM,OAAO,GAAG;IACd,WAAW,EAAE,CAAC,CAAC;CAChB,CAAC;AAEF,OAAO,EAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAC,CAAC"}
/**
* @license
* Copyright 2018 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
import * as tslib_1 from 'tslib';
import { MDCFoundation } from '..//base/foundation';
import { cssClasses, numbers, strings } from './constants';
var ELEMENTS_KEY_ALLOWED_IN = ['input', 'button', 'textarea', 'select'];
function isNumberArray(selectedIndex) {
return selectedIndex instanceof Array;
}
var MDCListFoundation = /** @class */ (function(_super) {
tslib_1.__extends(MDCListFoundation, _super);
function MDCListFoundation(adapter) {
var _this = _super.call(this, tslib_1.__assign({}, MDCListFoundation.defaultAdapter, adapter)) || this;
_this.wrapFocus_ = false;
_this.isVertical_ = true;
_this.isSingleSelectionList_ = false;
_this.selectedIndex_ = numbers.UNSET_INDEX;
_this.focusedItemIndex_ = numbers.UNSET_INDEX;
_this.useActivatedClass_ = false;
_this.ariaCurrentAttrValue_ = null;
_this.isCheckboxList_ = false;
_this.isRadioList_ = false;
return _this;
}
Object.defineProperty(MDCListFoundation, 'strings', {
get: function() {
return strings;
},
enumerable: true,
configurable: true,
});
Object.defineProperty(MDCListFoundation, 'cssClasses', {
get: function() {
return cssClasses;
},
enumerable: true,
configurable: true,
});
Object.defineProperty(MDCListFoundation, 'numbers', {
get: function() {
return numbers;
},
enumerable: true,
configurable: true,
});
Object.defineProperty(MDCListFoundation, 'defaultAdapter', {
get: function() {
return {
addClassForElementIndex: function() {
return undefined;
},
focusItemAtIndex: function() {
return undefined;
},
getAttributeForElementIndex: function() {
return null;
},
getFocusedElementIndex: function() {
return 0;
},
getListItemCount: function() {
return 0;
},
hasCheckboxAtIndex: function() {
return false;
},
hasRadioAtIndex: function() {
return false;
},
isCheckboxCheckedAtIndex: function() {
return false;
},
isFocusInsideList: function() {
return false;
},
isRootFocused: function() {
return false;
},
listItemAtIndexHasClass: function() {
return false;
},
notifyAction: function() {
return undefined;
},
removeClassForElementIndex: function() {
return undefined;
},
setAttributeForElementIndex: function() {
return undefined;
},
setCheckedCheckboxOrRadioAtIndex: function() {
return undefined;
},
setTabIndexForListItemChildren: function() {
return undefined;
},
};
},
enumerable: true,
configurable: true,
});
MDCListFoundation.prototype.layout = function() {
if (this.adapter_.getListItemCount() === 0) {
return;
}
if (this.adapter_.hasCheckboxAtIndex(0)) {
this.isCheckboxList_ = true;
} else if (this.adapter_.hasRadioAtIndex(0)) {
this.isRadioList_ = true;
}
};
/**
* Sets the private wrapFocus_ variable.
*/
MDCListFoundation.prototype.setWrapFocus = function(value) {
this.wrapFocus_ = value;
};
/**
* Sets the isVertical_ private variable.
*/
MDCListFoundation.prototype.setVerticalOrientation = function(value) {
this.isVertical_ = value;
};
/**
* Sets the isSingleSelectionList_ private variable.
*/
MDCListFoundation.prototype.setSingleSelection = function(value) {
this.isSingleSelectionList_ = value;
};
/**
* Sets the useActivatedClass_ private variable.
*/
MDCListFoundation.prototype.setUseActivatedClass = function(useActivated) {
this.useActivatedClass_ = useActivated;
};
MDCListFoundation.prototype.getSelectedIndex = function() {
return this.selectedIndex_;
};
MDCListFoundation.prototype.setSelectedIndex = function(index) {
if (!this.isIndexValid_(index)) {
return;
}
if (this.isCheckboxList_) {
this.setCheckboxAtIndex_(index);
} else if (this.isRadioList_) {
this.setRadioAtIndex_(index);
} else {
this.setSingleSelectionAtIndex_(index);
}
};
/**
* Focus in handler for the list items.
*/
MDCListFoundation.prototype.handleFocusIn = function(_, listItemIndex) {
if (listItemIndex >= 0) {
this.adapter_.setTabIndexForListItemChildren(listItemIndex, '0');
}
};
/**
* Focus out handler for the list items.
*/
MDCListFoundation.prototype.handleFocusOut = function(_, listItemIndex) {
var _this = this;
if (listItemIndex >= 0) {
this.adapter_.setTabIndexForListItemChildren(listItemIndex, '-1');
}
/**
* Between Focusout & Focusin some browsers do not have focus on any element. Setting a delay to wait till the focus
* is moved to next element.
*/
setTimeout(function() {
if (!_this.adapter_.isFocusInsideList()) {
_this.setTabindexToFirstSelectedItem_();
}
}, 0);
};
/**
* Key handler for the list.
*/
MDCListFoundation.prototype.handleKeydown = function(evt, isRootListItem, listItemIndex) {
var isArrowLeft = evt.key === 'ArrowLeft' || evt.keyCode === 37;
var isArrowUp = evt.key === 'ArrowUp' || evt.keyCode === 38;
var isArrowRight = evt.key === 'ArrowRight' || evt.keyCode === 39;
var isArrowDown = evt.key === 'ArrowDown' || evt.keyCode === 40;
var isHome = evt.key === 'Home' || evt.keyCode === 36;
var isEnd = evt.key === 'End' || evt.keyCode === 35;
var isEnter = evt.key === 'Enter' || evt.keyCode === 13;
var isSpace = evt.key === 'Space' || evt.keyCode === 32;
if (this.adapter_.isRootFocused()) {
if (isArrowUp || isEnd) {
evt.preventDefault();
this.focusLastElement();
} else if (isArrowDown || isHome) {
evt.preventDefault();
this.focusFirstElement();
}
return;
}
var currentIndex = this.adapter_.getFocusedElementIndex();
if (currentIndex === -1) {
currentIndex = listItemIndex;
if (currentIndex < 0) {
// If this event doesn't have a acl-list-item ancestor from the
// current list (not from a sublist), return early.
return;
}
}
var nextIndex;
if ((this.isVertical_ && isArrowDown) || (!this.isVertical_ && isArrowRight)) {
this.preventDefaultEvent_(evt);
nextIndex = this.focusNextElement(currentIndex);
} else if ((this.isVertical_ && isArrowUp) || (!this.isVertical_ && isArrowLeft)) {
this.preventDefaultEvent_(evt);
nextIndex = this.focusPrevElement(currentIndex);
} else if (isHome) {
this.preventDefaultEvent_(evt);
nextIndex = this.focusFirstElement();
} else if (isEnd) {
this.preventDefaultEvent_(evt);
nextIndex = this.focusLastElement();
} else if (isEnter || isSpace) {
if (isRootListItem) {
// Return early if enter key is pressed on anchor element which triggers synthetic MouseEvent event.
var target = evt.target;
if (target && target.tagName === 'A' && isEnter) {
return;
}
this.preventDefaultEvent_(evt);
if (this.isSelectableList_()) {
this.setSelectedIndexOnAction_(currentIndex);
}
this.adapter_.notifyAction(currentIndex);
}
}
this.focusedItemIndex_ = currentIndex;
if (nextIndex !== undefined) {
this.setTabindexAtIndex_(nextIndex);
this.focusedItemIndex_ = nextIndex;
}
};
/**
* Click handler for the list.
*/
MDCListFoundation.prototype.handleClick = function(index, toggleCheckbox) {
if (index === numbers.UNSET_INDEX) {
return;
}
if (this.isSelectableList_()) {
this.setSelectedIndexOnAction_(index, toggleCheckbox);
}
this.adapter_.notifyAction(index);
this.setTabindexAtIndex_(index);
this.focusedItemIndex_ = index;
};
/**
* Focuses the next element on the list.
*/
MDCListFoundation.prototype.focusNextElement = function(index) {
var count = this.adapter_.getListItemCount();
var nextIndex = index + 1;
if (nextIndex >= count) {
if (this.wrapFocus_) {
nextIndex = 0;
} else {
// Return early because last item is already focused.
return index;
}
}
this.adapter_.focusItemAtIndex(nextIndex);
return nextIndex;
};
/**
* Focuses the previous element on the list.
*/
MDCListFoundation.prototype.focusPrevElement = function(index) {
var prevIndex = index - 1;
if (prevIndex < 0) {
if (this.wrapFocus_) {
prevIndex = this.adapter_.getListItemCount() - 1;
} else {
// Return early because first item is already focused.
return index;
}
}
this.adapter_.focusItemAtIndex(prevIndex);
return prevIndex;
};
MDCListFoundation.prototype.focusFirstElement = function() {
this.adapter_.focusItemAtIndex(0);
return 0;
};
MDCListFoundation.prototype.focusLastElement = function() {
var lastIndex = this.adapter_.getListItemCount() - 1;
this.adapter_.focusItemAtIndex(lastIndex);
return lastIndex;
};
/**
* @param itemIndex Index of the list item
* @param isEnabled Sets the list item to enabled or disabled.
*/
MDCListFoundation.prototype.setEnabled = function(itemIndex, isEnabled) {
if (!this.isIndexValid_(itemIndex)) {
return;
}
if (isEnabled) {
this.adapter_.removeClassForElementIndex(itemIndex, cssClasses.LIST_ITEM_DISABLED_CLASS);
this.adapter_.setAttributeForElementIndex(itemIndex, strings.ARIA_DISABLED, 'false');
} else {
this.adapter_.addClassForElementIndex(itemIndex, cssClasses.LIST_ITEM_DISABLED_CLASS);
this.adapter_.setAttributeForElementIndex(itemIndex, strings.ARIA_DISABLED, 'true');
}
};
/**
* Ensures that preventDefault is only called if the containing element doesn't
* consume the event, and it will cause an unintended scroll.
*/
MDCListFoundation.prototype.preventDefaultEvent_ = function(evt) {
var target = evt.target;
var tagName = ('' + target.tagName).toLowerCase();
if (ELEMENTS_KEY_ALLOWED_IN.indexOf(tagName) === -1) {
evt.preventDefault();
}
};
MDCListFoundation.prototype.setSingleSelectionAtIndex_ = function(index) {
if (this.selectedIndex_ === index) {
return;
}
var selectedClassName = cssClasses.LIST_ITEM_SELECTED_CLASS;
if (this.useActivatedClass_) {
selectedClassName = cssClasses.LIST_ITEM_ACTIVATED_CLASS;
}
if (this.selectedIndex_ !== numbers.UNSET_INDEX) {
this.adapter_.removeClassForElementIndex(this.selectedIndex_, selectedClassName);
}
this.adapter_.addClassForElementIndex(index, selectedClassName);
this.setAriaForSingleSelectionAtIndex_(index);
this.selectedIndex_ = index;
};
/**
* Sets aria attribute for single selection at given index.
*/
MDCListFoundation.prototype.setAriaForSingleSelectionAtIndex_ = function(index) {
// Detect the presence of aria-current and get the value only during list initialization when it is in unset state.
if (this.selectedIndex_ === numbers.UNSET_INDEX) {
this.ariaCurrentAttrValue_ = this.adapter_.getAttributeForElementIndex(index, strings.ARIA_CURRENT);
}
var isAriaCurrent = this.ariaCurrentAttrValue_ !== null;
var ariaAttribute = isAriaCurrent ? strings.ARIA_CURRENT : strings.ARIA_SELECTED;
if (this.selectedIndex_ !== numbers.UNSET_INDEX) {
this.adapter_.setAttributeForElementIndex(this.selectedIndex_, ariaAttribute, 'false');
}
var ariaAttributeValue = isAriaCurrent ? this.ariaCurrentAttrValue_ : 'true';
this.adapter_.setAttributeForElementIndex(index, ariaAttribute, ariaAttributeValue);
};
/**
* Toggles radio at give index. Radio doesn't change the checked state if it is already checked.
*/
MDCListFoundation.prototype.setRadioAtIndex_ = function(index) {
this.adapter_.setCheckedCheckboxOrRadioAtIndex(index, true);
if (this.selectedIndex_ !== numbers.UNSET_INDEX) {
this.adapter_.setAttributeForElementIndex(this.selectedIndex_, strings.ARIA_CHECKED, 'false');
}
this.adapter_.setAttributeForElementIndex(index, strings.ARIA_CHECKED, 'true');
this.selectedIndex_ = index;
};
MDCListFoundation.prototype.setCheckboxAtIndex_ = function(index) {
for (var i = 0; i < this.adapter_.getListItemCount(); i++) {
var isChecked = false;
if (index.indexOf(i) >= 0) {
isChecked = true;
}
this.adapter_.setCheckedCheckboxOrRadioAtIndex(i, isChecked);
this.adapter_.setAttributeForElementIndex(i, strings.ARIA_CHECKED, isChecked ? 'true' : 'false');
}
this.selectedIndex_ = index;
};
MDCListFoundation.prototype.setTabindexAtIndex_ = function(index) {
if (this.focusedItemIndex_ === numbers.UNSET_INDEX && index !== 0) {
// If no list item was selected set first list item's tabindex to -1.
// Generally, tabindex is set to 0 on first list item of list that has no preselected items.
this.adapter_.setAttributeForElementIndex(0, 'tabindex', '-1');
} else if (this.focusedItemIndex_ >= 0 && this.focusedItemIndex_ !== index) {
this.adapter_.setAttributeForElementIndex(this.focusedItemIndex_, 'tabindex', '-1');
}
this.adapter_.setAttributeForElementIndex(index, 'tabindex', '0');
};
/**
* @return Return true if it is single selectin list, checkbox list or radio list.
*/
MDCListFoundation.prototype.isSelectableList_ = function() {
return this.isSingleSelectionList_ || this.isCheckboxList_ || this.isRadioList_;
};
MDCListFoundation.prototype.setTabindexToFirstSelectedItem_ = function() {
var targetIndex = 0;
if (this.isSelectableList_()) {
if (typeof this.selectedIndex_ === 'number' && this.selectedIndex_ !== numbers.UNSET_INDEX) {
targetIndex = this.selectedIndex_;
} else if (isNumberArray(this.selectedIndex_) && this.selectedIndex_.length > 0) {
targetIndex = this.selectedIndex_.reduce(function(currentIndex, minIndex) {
return Math.min(currentIndex, minIndex);
});
}
}
this.setTabindexAtIndex_(targetIndex);
};
MDCListFoundation.prototype.isIndexValid_ = function(index) {
var _this = this;
if (index instanceof Array) {
if (!this.isCheckboxList_) {
throw new Error('MDCListFoundation: Array of index is only supported for checkbox based list');
}
if (index.length === 0) {
return true;
} else {
return index.some(function(i) {
return _this.isIndexInRange_(i);
});
}
} else if (typeof index === 'number') {
if (this.isCheckboxList_) {
throw new Error(
'MDCListFoundation: Expected array of index for checkbox based list but got number: ' + index
);
}
return this.isIndexInRange_(index);
} else {
return false;
}
};
MDCListFoundation.prototype.isIndexInRange_ = function(index) {
var listSize = this.adapter_.getListItemCount();
return index >= 0 && index < listSize;
};
/**
* Sets selected index on user action, toggles checkbox / radio based on toggleCheckbox value.
* User interaction should not toggle list item(s) when disabled.
*/
MDCListFoundation.prototype.setSelectedIndexOnAction_ = function(index, toggleCheckbox) {
if (toggleCheckbox === void 0) {
toggleCheckbox = true;
}
if (this.adapter_.listItemAtIndexHasClass(index, cssClasses.LIST_ITEM_DISABLED_CLASS)) {
return;
}
if (this.isCheckboxList_) {
this.toggleCheckboxAtIndex_(index, toggleCheckbox);
} else {
this.setSelectedIndex(index);
}
};
MDCListFoundation.prototype.toggleCheckboxAtIndex_ = function(index, toggleCheckbox) {
var isChecked = this.adapter_.isCheckboxCheckedAtIndex(index);
if (toggleCheckbox) {
isChecked = !isChecked;
this.adapter_.setCheckedCheckboxOrRadioAtIndex(index, isChecked);
}
this.adapter_.setAttributeForElementIndex(index, strings.ARIA_CHECKED, isChecked ? 'true' : 'false');
// If none of the checkbox items are selected and selectedIndex is not initialized then provide a default value.
var selectedIndexes = this.selectedIndex_ === numbers.UNSET_INDEX ? [] : this.selectedIndex_.slice();
if (isChecked) {
selectedIndexes.push(index);
} else {
selectedIndexes = selectedIndexes.filter(function(i) {
return i !== index;
});
}
this.selectedIndex_ = selectedIndexes;
};
return MDCListFoundation;
})(MDCFoundation);
export { MDCListFoundation };
// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
export default MDCListFoundation;
//# sourceMappingURL=foundation.js.map
{"version":3,"file":"foundation.js","sourceRoot":"","sources":["foundation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;AAEH,OAAO,EAAC,aAAa,EAAC,MAAM,2BAA2B,CAAC;AAExD,OAAO,EAAC,UAAU,EAAE,OAAO,EAAE,OAAO,EAAC,MAAM,aAAa,CAAC;AAGzD,IAAM,uBAAuB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;AAE1E,SAAS,aAAa,CAAC,aAA2B;IAChD,OAAO,aAAa,YAAY,KAAK,CAAC;AACxC,CAAC;AAED;IAAuC,6CAA6B;IA4ClE,2BAAY,OAAiC;QAA7C,YACE,uCAAU,iBAAiB,CAAC,c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;YACvB,IAAI,CAAC,QAAQ,CAAC,gCAAgC,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;SAClE;QAED,IAAI,CAAC,QAAQ,CAAC,2BAA2B,CAAC,KAAK,EAAE,OAAO,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QAErG,gHAAgH;QAChH,IAAI,eAAe,GAAG,IAAI,CAAC,cAAc,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAE,IAAI,CAAC,cAA2B,CAAC,KAAK,EAAE,CAAC;QAEnH,IAAI,SAAS,EAAE;YACb,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SAC7B;aAAM;YACL,eAAe,GAAG,eAAe,CAAC,MAAM,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,KAAK,KAAK,EAAX,CAAW,CAAC,CAAC;SAC9D;QAED,IAAI,CAAC,cAAc,GAAG,eAAe,CAAC;IACxC,CAAC;IACH,wBAAC;AAAD,CAAC,AApdD,CAAuC,aAAa,GAodnD;;AAED,iHAAiH;AACjH,eAAe,iBAAiB,CAAC"}
export * from './component';
export * from './constants';
export * from './foundation';
class ACLScrollableTable {
setTableBody(table, gradient, tableContainer, adjustGradientPosition = true) {
if (typeof table == 'object' && typeof gradient == 'object') {
tableContainer = tableContainer ? tableContainer : table.parentNode;
tableContainer.scrollHeight > tableContainer.clientHeight
? gradient.classList.add('fadeOut')
: gradient.classList.add('fadeOut');
tableContainer.addEventListener('scroll', function(event) {
if (tableContainer.scrollHeight - tableContainer.scrollTop === tableContainer.clientHeight) {
gradient.classList.add('fadeOut');
gradient.classList.remove('fadeIn');
if (adjustGradientPosition) {
gradient.style.bottom = '-' + tableContainer.scrollTop + 'px';
}
} else {
if (adjustGradientPosition) {
gradient.style.bottom = '-' + tableContainer.scrollTop + 'px';
}
gradient.classList.remove('fadeOut');
gradient.classList.add('fadeIn');
}
});
} else {
console.warn('ACLScrollableTable - You must pass in a table AND a gradient element ⚙️');
}
}
}
export { ACLScrollableTable };
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
{
"_from": "..//list@^4.0.0",
"_id": "..//list@4.0.0",
"_inBundle": false,
"_integrity": "sha512-ximtqMQzi+bnnFy1jrdzMUH7jq169XVexCykumxoLI1PbVx4imQ0G3R6LIfJiafbxbBYawfwySZfMXTJkDML7g==",
"_location": "/..//list",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "..//list@^4.0.0",
"name": "..//list",
"escapedName": "../%2flist",
"scope": "../",
"rawSpec": "^4.0.0",
"saveSpec": null,
"fetchSpec": "^4.0.0"
},
"_requiredBy": [
"/..//drawer",
"/..//menu",
"/material-components-web"
],
"_resolved": "https://registry.npmjs.org/..//list/-/list-4.0.0.tgz",
"_shasum": "206e13920d070c2f538027e0b4905bc2b903e64d",
"_spec": "..//list@^4.0.0",
"_where": "/Users/robcarvill/Development/component-library/node_modules/material-components-web",
"bugs": {
"url": "https://github.com/material-components/material-components-web/issues"
},
"bundleDependencies": false,
"dependencies": {
"..//base": "^4.0.0",
"..//density": "^4.0.0",
"..//dom": "^4.0.0",
"..//feature-targeting": "^4.0.0",
"..//ripple": "^4.0.0",
"..//rtl": "^4.0.0",
"..//shape": "^4.0.0",
"..//theme": "^4.0.0",
"..//typography": "^4.0.0",
"tslib": "^1.9.3"
},
"deprecated": false,
"description": "The Material Components for the web list component",
"gitHead": "8fcbb009cd3b5cc004b302613dd55ab4b5d6ef72",
"homepage": "https://github.com/material-components/material-components-web#readme",
"keywords": [
"material components",
"material design",
"list"
],
"license": "MIT",
"main": "dist/mdc.list.js",
"module": "index.js",
"name": "..//list",
"repository": {
"type": "git",
"url": "git+https://github.com/material-components/material-components-web.git",
"directory": "packages/acl-list"
},
"sideEffects": false,
"types": "dist/mdc.list.d.ts",
"version": "4.0.0"
}
/**
* @license
* Copyright 2019 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
//# sourceMappingURL=types.js.map
{"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG"}
Lists are continuous, vertical indexes of text or images.
npm install ..//list<ul class="acl-list">
<li class="acl-list-item" tabindex="0">
<span class="acl-list-item__text">Single-line item</span>
</li>
<li class="acl-list-item">
<span class="acl-list-item__text">Single-line item</span>
</li>
<li class="acl-list-item">
<span class="acl-list-item__text">Single-line item</span>
</li>
</ul>@import "../list/acl-list";MDC List includes an optional JavaScript component which can be used for keyboard interaction and accessibility.
import {MDCList} from '..//list';
const list = new MDCList(document.querySelector('.acl-list'));See Importing the JS component for more information on how to import JavaScript.
Note that the JS component does not automatically instantiate ripples on list items. If you wish to include the
fully-upgraded ripple effect on list items, you must instantiate MDCRipple on each item:
import {MDCRipple} from '..//ripple';
const listItemRipples = list.listElements.map((listItemEl) => new MDCRipple(listItemEl));You can use the acl-list--two-line combined with some extra markup around the text to style a list
in the double line list style as defined by
the spec (see “Double line”).
<ul class="acl-list acl-list--two-line">
<li class="acl-list-item" tabindex="0">
<span class="acl-list-item__text">
<span class="acl-list-item__primary-text">Two-line item</span>
<span class="acl-list-item__secondary-text">Secondary text</span>
</span>
</li>
<li class="acl-list-item">
<span class="acl-list-item__text">
<span class="acl-list-item__primary-text">Two-line item</span>
<span class="acl-list-item__secondary-text">Secondary text</span>
</span>
</li>
<li class="acl-list-item">
<span class="acl-list-item__text">
<span class="acl-list-item__primary-text">Two-line item</span>
<span class="acl-list-item__secondary-text">Secondary text</span>
</span>
</li>
</ul>NOTE: Make sure there are no white-space characters before primary and secondary text content.
Multiple related lists can be grouped together using the acl-list-group class on a containing element.
<div class="acl-list-group">
<h3 class="acl-list-group__subheader">List 1</h3>
<ul class="acl-list">
<li class="acl-list-item" tabindex="0">
<span class="acl-list-item__text">line item</span>
</li>
<li class="acl-list-item">
<span class="acl-list-item__text">line item</span>
</li>
<li class="acl-list-item">
<span class="acl-list-item__text">line item</span>
</li>
</ul>
<h3 class="acl-list-group__subheader">List 2</h3>
<ul class="acl-list">
<li class="acl-list-item">
<span class="acl-list-item__text">line item</span>
</li>
<li class="acl-list-item">
<span class="acl-list-item__text">line item</span>
</li>
<li class="acl-list-item">
<span class="acl-list-item__text">line item</span>
</li>
</ul>
</div>MDC List contains an acl-list-divider class which can be used as full-width or inset subdivisions either within lists themselves, or standalone between related groups of content.
<ul class="acl-list">
<li class="acl-list-item" tabindex="0">
<span class="acl-list-item__text">Item 1 - Division 1</span>
</li>
<li class="acl-list-item">
<span class="acl-list-item__text">Item 2 - Division 1</span>
</li>
<li role="separator" class="acl-list-divider"></li>
<li class="acl-list-item">
<span class="acl-list-item__text">Item 1 - Division 2</span>
</li>
<li class="acl-list-item">
<span class="acl-list-item__text">Item 2 - Division 2</span>
</li>
</ul>NOTE: the role=”separator” attribute on the list divider. It is important to include this so that assistive technology can be made aware that this is a presentational element and is not meant to be included as an item in a list. Note that separator is indeed a valid role for li elements.
OR
<ul class="acl-list">
<li class="acl-list-item" tabindex="0">
<span class="acl-list-item__text">Item 1 - List 1</span>
</li>
<li class="acl-list-item">
<span class="acl-list-item__text">Item 2 - List 1</span>
</li>
</ul>
<hr class="acl-list-divider">
<ul class="acl-list">
<li class="acl-list-item">
<span class="acl-list-item__text">Item 1 - List 2</span>
</li>
<li class="acl-list-item">
<span class="acl-list-item__text">Item 2 - List 2</span>
</li>
</ul>MDC List can handle selecting/deselecting list elements based on click or keyboard actions. When enabled, the space and enter keys (or click event) will trigger a
single list item to become selected and any other previously selected element to become deselected.
<ul id="my-list" class="acl-list" role="listbox">
<li class="acl-list-item" role="option" tabindex="0">
<span class="acl-list-item__text">Single-line item</span>
</li>
<li class="acl-list-item" role="option">
<span class="acl-list-item__text">Single-line item</span>
</li>
<li class="acl-list-item" role="option">
<span class="acl-list-item__text">Single-line item</span>
</li>
</ul>const list = new MDCList(document.getElementById('my-list'));
list.singleSelection = true;When rendering the list with a pre-selected list item, the list item that needs to be selected should contain
the acl-list-item--selected or acl-list-item--activated class before creating the list. Please see
Accessibility section for appropriate aria attributes.
<ul id="my-list" class="acl-list" role="listbox">
<li class="acl-list-item" role="option" aria-selected="false">
<span class="acl-list-item__text">Single-line item</span>
</li>
<li class="acl-list-item acl-list-item--selected" role="option" aria-selected="true" tabindex="0">
<span class="acl-list-item__text">Single-line item</span>
</li>
<li class="acl-list-item" role="option" aria-selected="false">
<span class="acl-list-item__text">Single-line item</span>
</li>
</ul>const list = new MDCList(document.getElementById('my-list'));
list.singleSelection = true;When rendering list radio group with pre-selected radio button the selected list item should contain aria-checked set to true and the native radio input element contains checked attribute, all other list items should have aria-checked set to false. The list root contains role="radiogroup" whereas each list item within radio group contains role="radio".
<ul class="acl-list" role="radiogroup">
<li class="acl-list-item" role="radio" aria-checked="false">
<span class="acl-list-item__graphic">
<div class="acl-radio">
<input class="acl-radio__native-control"
type="radio"
id="demo-list-radio-item-1"
name="demo-list-radio-item-group"
value="1">
<div class="acl-radio__background">
<div class="acl-radio__outer-circle"></div>
<div class="acl-radio__inner-circle"></div>
</div>
</div>
</span>
<label class="acl-list-item__text" for="demo-list-radio-item-1">Option 1</label>
</li>
<li class="acl-list-item" role="radio" aria-checked="true" tabindex="0">
<span class="acl-list-item__graphic">
<div class="acl-radio">
<input class="acl-radio__native-control"
type="radio"
id="demo-list-radio-item-2"
name="demo-list-radio-item-group"
value="2"
checked>
<div class="acl-radio__background">
<div class="acl-radio__outer-circle"></div>
<div class="acl-radio__inner-circle"></div>
</div>
</div>
</span>
<label class="acl-list-item__text" for="demo-list-radio-item-2">Option 2</label>
</li>
<li class="acl-list-item" role="radio" aria-checked="false">
<span class="acl-list-item__graphic">
<div class="acl-radio">
<input class="acl-radio__native-control"
type="radio"
id="demo-list-radio-item-3"
name="demo-list-radio-item-group"
value="3">
<div class="acl-radio__background">
<div class="acl-radio__outer-circle"></div>
<div class="acl-radio__inner-circle"></div>
</div>
</div>
</span>
<label class="acl-list-item__text" for="demo-list-radio-item-3">Option 3</label>
</li>
</ul>When rendering list with checkbox items all pre-selected list items should contain aria-checked set to true and the native checkbox input element should contain checked attribute, all other list items should have aria-checked set to false. Each list item in checkbox list contains role="checkbox" attribute and the list root should contain role="group" and aria-label attributes.
<ul class="acl-list" role="group" aria-label="List with checkbox items">
<li class="acl-list-item" role="checkbox" aria-checked="false">
<span class="acl-list-item__graphic">
<div class="acl-checkbox">
<input type="checkbox"
class="acl-checkbox__native-control"
id="demo-list-checkbox-item-1" />
<div class="acl-checkbox__background">
<svg class="acl-checkbox__checkmark"
viewBox="0 0 24 24">
<path class="acl-checkbox__checkmark-path"
fill="none"
d="M1.73,12.91 8.1,19.28 22.79,4.59"/>
</svg>
<div class="acl-checkbox__mixedmark"></div>
</div>
</div>
</span>
<label class="acl-list-item__text" for="demo-list-checkbox-item-1">Option 1</label>
</li>
<li class="acl-list-item" role="checkbox" aria-checked="true" tabindex="0">
<span class="acl-list-item__graphic">
<div class="acl-checkbox">
<input type="checkbox"
class="acl-checkbox__native-control"
id="demo-list-checkbox-item-2"
checked />
<div class="acl-checkbox__background">
<svg class="acl-checkbox__checkmark"
viewBox="0 0 24 24">
<path class="acl-checkbox__checkmark-path"
fill="none"
d="M1.73,12.91 8.1,19.28 22.79,4.59"/>
</svg>
<div class="acl-checkbox__mixedmark"></div>
</div>
</div>
</span>
<label class="acl-list-item__text" for="demo-list-checkbox-item-2">Option 2</label>
</li>
<li class="acl-list-item" role="checkbox" aria-checked="false">
<span class="acl-list-item__graphic">
<div class="acl-checkbox">
<input type="checkbox"
class="acl-checkbox__native-control"
id="demo-list-checkbox-item-3" />
<div class="acl-checkbox__background">
<svg class="acl-checkbox__checkmark"
viewBox="0 0 24 24">
<path class="acl-checkbox__checkmark-path"
fill="none"
d="M1.73,12.91 8.1,19.28 22.79,4.59"/>
</svg>
<div class="acl-checkbox__mixedmark"></div>
</div>
</div>
</span>
<label class="acl-list-item__text" for="demo-list-checkbox-item-3">Option 3</label>
</li>
</ul>The selectedIndex (that proxies foundation’s setSelectedState()) accepts list of indexes in array format for list with checkbox items to set the selection state. It overwrites the current state with new selected state.
| CSS Class | Description |
|---|---|
acl-list |
Mandatory, for the list element. |
acl-list--non-interactive |
Optional, disables interactivity affordances. |
acl-list--dense |
Optional, styles the density of the list, making it appear more compact. |
acl-list--avatar-list |
Optional, configures the leading tiles of each row to display images instead of icons. This will make the graphics of the list items larger. |
acl-list--two-line |
Optional, modifier to style list with two lines (primary and secondary lines). |
acl-list-item |
Mandatory, for the list item element. |
acl-list-item__text |
Mandatory. Wrapper for list item text content (displayed as middle column of the list item). |
acl-list-item__primary-text |
Optional, primary text for the list item. Should be the child of acl-list-item__text. |
acl-list-item__secondary-text |
Optional, secondary text for the list item. Displayed below the primary text. Should be the child of acl-list-item__text. |
acl-list-item--disabled |
Optional, styles the row in the disabled state. |
acl-list-item--selected |
Optional, styles the row in the selected* state. |
acl-list-item--activated |
Optional, styles the row in the activated* state. |
acl-list-item__graphic |
Optional, the first tile in the row (in LTR languages, the first column of the list item). Typically an icon or image. |
acl-list-item__meta |
Optional, the last tile in the row (in LTR languages, the last column of the list item). Typically small text, icon. or image. |
acl-list-group |
Optional, wrapper around two or more acl-list elements to be grouped together. |
acl-list-group__subheader |
Optional, heading text displayed above each list in a group. |
acl-list-divider |
Optional, for list divider element. |
acl-list-divider--padded |
Optional, leaves gaps on each side of divider to match padding of list-item__meta. |
acl-list-divider--inset |
Optional, increases the leading margin of the divider so that it does not intersect the avatar column. |
NOTE: The
acl-list-dividerclass can be used between list items OR between two lists (see respective examples under List Dividers).
NOTE: In Material Design, the selected and activated states apply in different, mutually-exclusive situations:
- Selected state should be applied on the
.acl-list-itemwhen it is likely to frequently change due to user choice. E.g., selecting one or more photos to share in Google Photos.- Activated state is more permanent than selected state, and will NOT change soon relative to the lifetime of the page. Common examples are navigation components such as the list within a navigation drawer.
| Mixin | Description |
|---|---|
acl-list-item-primary-text-ink-color($color) |
Sets the ink color of the primary text of the list item. |
acl-list-item-secondary-text-ink-color($color) |
Sets the ink color of the secondary text of the list item. |
acl-list-item-graphic-fill-color($color) |
Sets background ink color of the graphic element within list item. |
acl-list-item-graphic-ink-color($color) |
Sets ink color of the graphic element within list item. |
acl-list-item-meta-ink-color($color) |
Sets ink color of the meta element within list item. |
acl-list-single-line-shape-radius($radius, $rtl-reflexive, $density-scale) |
Sets the rounded shape to list item with given radius size. Set $rtl-reflexive to true to flip radius values in RTL context, defaults to false. Set $density-scale only when custom density is applied, defaults to $acl-list-single-line-density-scale. |
acl-list-divider-color($color) |
Sets divider ink color. |
acl-list-group-subheader-ink-color($color) |
Sets ink color of subheader text within list group. |
acl-list-item-disabled-text-color($color) |
Sets the color of the text when the list item is disabled. |
acl-list-item-disabled-text-opacity($opacity) |
Sets the opacity of the text when the list item is disabled. |
acl-list-single-line-density($density-scale) |
Sets density scale to single line list variant. Supported density scales are -4, -3, -2, -1 and 0. |
acl-list-single-line-height($height) |
Sets height to single line list variant. |
The MDCList JavaScript component implements the WAI-ARIA best practices for Listbox. This includes overriding the default tab behavior within the list component.
The tabindex should be set to 0 for first list item element or selected list item element, remaining list item elements should not have tabindex set.
Use role="listbox" only for single selection list, without this role the ul element is implicitely role="list".
Do not use aria-orientation attribute for standard list (i.e., role="list"), use component’s vertical property to set the orientation
to vertical.
Single selection list supports aria-selected and aria-current attributes. List automatically detects the presence of these attributes
and sets it to next selected list item based on which ARIA attribute you use (i.e., aria-selected or aria-current). Please see WAI-ARIA aria-current article for recommended usage and available attribute values.
As the user navigates through the list, any button and a elements within the list will receive tabindex="-1" when
the list item is not focused. When the list item receives focus, the aforementioned elements will receive
tabIndex="0". This allows for the user to tab through list item elements and then tab to the first element after the
list. The Arrow, Home, and End keys should be used for navigating internal list elements. If
singleSelection=true, the list will allow the user to use the Space or Enter keys to select or deselect a list
item. The MDCList will perform the following actions for each key press. Since list interaction will toggle a radio
button or checkbox within the list item, the list will not toggle tabindex for those elements.
Disabled list item will be included in the keyboard navigation. Please see Focusability of disabled controls section in ARIA practices article.
| Key | Action |
|---|---|
ArrowUp |
When the list is in a vertical orientation, it will cause the previous list item to receive focus. |
ArrowDown |
When the list is in a vertical orientation, it will cause the next list item to receive focus. |
ArrowLeft |
When the list is in a horizontal orientation (default), it will cause the previous list item to receive focus. |
ArrowRight |
When the list is in a horizontal orientation (default), it will cause the next list item to receive focus. |
Home |
Will cause the first list item in the list to receive focus. |
End |
Will cause the last list item in the list to receive focus. |
Space |
Will cause the currently focused list item to become selected/deselected if singleSelection=true. |
Enter |
Will cause the currently focused list item to become selected/deselected if singleSelection=true. |
MDCList Properties and Methods| Property | Value Type | Description |
|---|---|---|
vertical |
boolean (write-only) |
Proxies to the foundation’s setVerticalOrientation() method. |
listElements |
Array<Element> (read-only) |
Returns all list item elements including disabled list items. |
wrapFocus |
boolean (write-only) |
Proxies to the foundation’s setWrapFocus() method. |
singleSelection |
boolean (write-only) |
Proxies to the foundation’s setSingleSelection() method. |
selectedIndex |
boolean |
Proxies to the foundation’s getSelectedIndex() and setSelectedIndex() methods. |
| Method Signature | Description |
|---|---|
layout() => void |
Recalculates layout and orientation. |
initializeListType() => void |
Initialize selectedIndex value based on pre-selected checkbox list items, single selection or radio. |
setEnabled(itemIndex: number, isEnabled: boolean) => void |
Updates the list item at itemIndex to the desired isEnabled state. |
| Event Name | event.detail |
Description |
|---|---|---|
MDCList:action |
{index: number} |
Indicates that a list item with the specified index has been activated. |
If you are using a JavaScript framework, such as React or Angular, you can create a List for your framework. Depending on your needs, you can use the Simple Approach: Wrapping MDC Web Vanilla Components, or the Advanced Approach: Using Foundations and Adapters. Please follow the instructions here.
The MDCListFoundation expects the HTML to be setup a certain way before being used. This setup is a part of the layout() and singleSelection() functions within the index.js.
layout()The default component requires that every list item receives a tabindex value so that it can receive focus
(li elements cannot receive focus at all without a tabindex value). Any element not already containing a
tabindex attribute will receive tabindex=-1. The first list item should have tabindex="0" so that the
user can find the first element using the tab key, but subsequent tab keys strokes will cause focus to
skip over the entire list. If the list items contain sub-elements that are focusable (button and a elements),
these should also receive tabIndex="-1".
<ul id="my-list" class="acl-list">
<li class="acl-list-item" tabindex="0">
<span class="acl-list-item__text">Single-line item</span>
<button tabindex="-1"></button>
</li>
<li class="acl-list-item" tabindex="-1">
<span class="acl-list-item__text">Single-line item</span>
</li>
<li class="acl-list-item" tabindex="-1">
<span class="acl-list-item__text">Single-line item</span>
</li>
</ul>singleSelection()When implementing a component that will use the single selection variant, the HTML should be modified to include
the acl-list-item--selected or acl-list-item--activated class name,
and the tabindex of the selected element should be 0. The first list item should have the tabindex updated
to -1. The foundation method setSelectedIndex() should be called with the initially selected element immediately
after the foundation is instantiated. Please see Accessibility section for appropriate aria attributes.
<ul id="my-list" class="acl-list">
<li class="acl-list-item" tabindex="-1">
<span class="acl-list-item__text">Single-line item</span>
<button tabindex="-1"></button>
</li>
<li class="acl-list-item acl-list-item--selected" aria-selected="true" tabindex="0">
<span class="acl-list-item__text">Single-line item</span>
</li>
<li class="acl-list-item" tabindex="-1">
<span class="acl-list-item__text">Single-line item</span>
</li>
</ul>MDCListAdapter| Method Signature | Description |
|---|---|
getListItemCount() => Number |
Returns the total number of list items (elements with acl-list-item class) that are direct children of the root_ element. |
getFocusedElementIndex() => Number |
Returns the index value of the currently focused element. |
getListItemIndex(ele: Element) => Number |
Returns the index value of the provided ele element. |
| `getAttributeForElementIndex(index: number, attribute: string) => string | null` |
setAttributeForElementIndex(index: Number, attr: String, value: String) => void |
Sets the attr attribute to value for the list item at index. |
addClassForElementIndex(index: Number, className: String) => void |
Adds the className class to the list item at index. |
removeClassForElementIndex(index: Number, className: String) => void |
Removes the className class to the list item at index. |
focusItemAtIndex(index: Number) => void |
Focuses the list item at the index value specified. |
setTabIndexForListItemChildren(index: Number, value: Number) => void |
Sets the tabindex attribute to value for each child button or anchor element in the list item at the index specified. |
hasRadioAtIndex(index: number) => boolean |
Returns true if radio button is present at given list item index. |
hasCheckboxAtIndex(index: number) => boolean |
Returns true if checkbox is present at given list item index. |
isCheckboxCheckedAtIndex(index: number) => boolean |
Returns true if checkbox inside a list item is checked. |
setCheckedCheckboxOrRadioAtIndex(index: number, isChecked: boolean) => void |
Sets the checked status of checkbox or radio at given list item index. |
notifyAction(index: number) => void |
Notifies user action on list item including keyboard and mouse actions. |
isFocusInsideList() => boolean |
Returns true if the current focused element is inside list root. |
isRootFocused() => boolean |
Returns true if root element is focused. |
listItemAtIndexHasClass(index: number, className: string) => boolean |
Returns true if list item at index has class className. |
MDCListFoundation| Method Signature | Description |
|---|---|
setWrapFocus(value: Boolean) => void |
Sets the list to allow the up arrow on the first element to focus the last element of the list and vice versa. |
setVerticalOrientation(value: Boolean) => void |
Sets the list to an orientation causing the keys used for navigation to change. true results in the Up/Down arrow keys being used. false results in the Left/Right arrow keys being used. |
setSingleSelection(value: Boolean) => void |
Sets the list to be a selection list. Enables the enter and space keys for selecting/deselecting a list item. |
getSelectedIndex() => MDCListIndex |
Gets the current selection state by returning selected index or list of indexes for checkbox based list. See types.ts for MDCListIndex type definition. |
setSelectedIndex(index: MDCListIndex) => void |
Sets the selection state to given index or list of indexes if it is checkbox based list. See types.ts for MDCListIndex type definition. |
setUseActivatedClass(useActivated: boolean) => void |
Sets the selection logic to apply/remove the acl-list-item--activated class. |
handleFocusIn(evt: Event) => void |
Handles the changing of tabindex to 0 for all button and anchor elements when a list item receives focus. |
handleFocusOut(evt: Event) => void |
Handles the changing of tabindex to -1 for all button and anchor elements when a list item loses focus. |
handleKeydown(evt: Event) => void |
Handles determining if a focus action should occur when a key event is triggered. |
handleClick(evt: Event) => void |
Handles toggling the selected/deselected state for a list item when clicked. This method is only used by the single selection list. |
focusNextElement(index: number) => number |
Handles focusing the next element using the current index. Returns focused element index. |
focusPrevElement(index: number) => number |
Handles focusing the previous element using the current index. Returns focused element index. |
focusFirstElement() => number |
Handles focusing the first element in a list. Returns focused element index. |
focusLastElement() => number |
Handles focusing the last element in a list. Returns focused element index. |
setEnabled(itemIndex: number, isEnabled: Boolean) => void |
Updates the list item’s disabled state. |