/*
 * 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 RULENAME="oj-html-redwood-clear-icon";const DESCRIPTION="For JET components <oj-input-text>, <oj-c-input-text>, <oj-c-input-password>, "+"and <oj-c-input-sensitive>, the 'clear-icon' attribute value 'always' is not permitted using the "+"'redwood-strict' profile'. "+"According to The UX Figma spec \"Only Typing, Focus, and Selection states can show the Clear button. Other "+"states don't show the Clear button since there is no active value to clear/delete.\" The value 'always' would "+"keep the icon showing at all times, while 'conditional' behaves in the manner above.<p>"+"If the configuration file is not extended from profile 'redwood-strict', this rule is disabled.";const SHORT_DESCRIPTION=DESCRIPTION;const ALWAYS="always";const REDWOOD_STRICT="redwood-strict";class Rule{constructor(){this._first=true}getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(){return{"<oj-input-text clear-icon=>":this._onAttr,"<oj-c-input-text> clear-icon=>":this._onAttr,"<oj-c-input-password clear-icon=>":this._onAttr,"<oj-c-input-sensitive clear-icon=>":this._onAttr}}_onAttr(ruleCtx,attrName,attrValue){if(this._first){this._first=false;if(ruleCtx.utils.configLib.getExtendsProfileName()!==REDWOOD_STRICT){ruleCtx.utils.msgLib.info(`Rule ${RULENAME} has disabled itself - not redwood-strict profile.`);ruleCtx.rulePack.disableRule(RULENAME);return}}if(attrValue===ALWAYS){let issue=new ruleCtx.Issue(`<${ruleCtx.tag}> : profile 'redwood-strict' does not allow 'clear-icon' to be set to 'always'.`);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}module.exports=Rule;