{# Copyright 2021, 2022 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. #} {% macro input(label, name, type="text", form_state=false, autocomplete=false, class="", inputmode="text", autocorrect=false, autocapitalize=false) %} {% if not form_state %} {% set form_state = dict(errors=[], fields=dict()) %} {% endif %} {% set state = form_state.fields[name] | default(value=dict(errors=[], value="")) %} {% if state.errors is not empty %} {% set border_color = "border-alert" %} {% set text_color = "text-alert" %} {% else %} {% set border_color = "border-grey-50 dark:border-grey-450" %} {% set text_color = "text-black-800 dark:text-grey-300" %} {% endif %} {% endmacro input %}