createForm = () => {
const form = html`
<form>
<input name="filterString" type="text" placeholder="Start typing to filter…">
<span class="checkbox">
<input name="groupIconsByCategory" type="checkbox" id="groupByCategoryCheckbox" checked>
<label for="groupByCategoryCheckbox">Group icons by category</label>
</span>
<span class="checkbox">
<input name="hideFilledIcons" type="checkbox" id="hideFilledCheckbox">
<label for="hideFilledCheckbox">Hide filled icons</label>
</span>
</form>
`;
form.onsubmit = (event) => event.preventDefault();
form.filterString.oninput = () => {
form.value.filterString = form.filterString.value;
form.dispatchEvent(new CustomEvent("input"));
}
form.filterString.onchange = () => {
form.filterString.blur();
}
form.groupIconsByCategory.onchange = () => {
form.value.groupIconsByCategory = form.groupIconsByCategory.checked;
form.dispatchEvent(new CustomEvent("input"));
}
form.hideFilledIcons.onchange = () => {
form.value.hideFilledIcons = form.hideFilledIcons.checked;
form.dispatchEvent(new CustomEvent("input"));
}
form.value = {
filterString: "",
groupIconsByCategory: true,
hideFilledIcons: false
};
return form;
}