/*
 * Copyright (c) 2018, 2025, Oracle and/or its affiliates.
 * Licensed under The Universal Permissive License (UPL), Version 1.0
 * as shown at https://oss.oracle.com/licenses/upl/
 */
const helper=require("./helpers/acc-aria-label");const RULE_NAME="oj-acc-input-aria-label";const DESCRIPTION="For accessibility, an input element must have a matching <oj-label> with a <i>'for'</i> matching the input element <i>'id'</i>"+", or an <i>aria-label</i> attribute.<br>If 'label-hint' is specified and 'label-edge' is not, the default "+"value for 'label-edge' is theme dependant (refer to configuration property 'theme'), and label generation may be affected.<br>"+"Set 'label-hint' or associate an 'oj-label'.  If there is no visible label, then to make this accessible to screen readers, set "+"'label-hint' and label-edge='none' - this will render an 'aria-label' with the 'label-hint' text.";const SHORT_DESCRIPTION="For accessibility, an input element must have a matching <oj-label> with a 'for' matching the input 'id'";class Rule{getName(){return RULE_NAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){this._theme=regCtx.config.theme;return{"<oj-input-date>":this._onInput,"<oj-input-date-time>":this._onInput,"<oj-input-number>":this._onInput,"<oj-input-password>":this._onInput,"<oj-input-search>":this._onInput,"<oj-input-text>":this._onInput,"<oj-input-time>":this._onInput}}_onInput(ruleCtx,tagName){var issues;if(ruleCtx.utils.DomUtils.isChildOfElem("oj-table",ruleCtx.node)||ruleCtx.utils.DomUtils.isChildOfElem("oj-data-grid",ruleCtx.node)){return}if(issues=helper(ruleCtx,tagName,this._theme)){issues.forEach(issue=>{ruleCtx.reporter.addIssue(issue,ruleCtx)})}}}module.exports=Rule;