{"version":3,"file":"HelperText-BMPU2Fzc.js","sources":["../../../node_modules/@material/textfield/helper-text/constants.js","../../../node_modules/@material/textfield/helper-text/foundation.js","../../../node_modules/@smui/textfield/dist/helper-text/HelperText.svelte"],"sourcesContent":["/**\n * @license\n * Copyright 2016 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar cssClasses = {\n HELPER_TEXT_PERSISTENT: 'mdc-text-field-helper-text--persistent',\n HELPER_TEXT_VALIDATION_MSG: 'mdc-text-field-helper-text--validation-msg',\n ROOT: 'mdc-text-field-helper-text',\n};\nvar strings = {\n ARIA_HIDDEN: 'aria-hidden',\n ROLE: 'role',\n ROOT_SELECTOR: \".\" + cssClasses.ROOT,\n};\nexport { strings, cssClasses };\n//# sourceMappingURL=constants.js.map","/**\n * @license\n * Copyright 2017 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __assign, __extends } from \"tslib\";\nimport { MDCFoundation } from '@material/base/foundation';\nimport { cssClasses, strings } from './constants';\nvar MDCTextFieldHelperTextFoundation = /** @class */ (function (_super) {\n __extends(MDCTextFieldHelperTextFoundation, _super);\n function MDCTextFieldHelperTextFoundation(adapter) {\n return _super.call(this, __assign(__assign({}, MDCTextFieldHelperTextFoundation.defaultAdapter), adapter)) || this;\n }\n Object.defineProperty(MDCTextFieldHelperTextFoundation, \"cssClasses\", {\n get: function () {\n return cssClasses;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTextFieldHelperTextFoundation, \"strings\", {\n get: function () {\n return strings;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTextFieldHelperTextFoundation, \"defaultAdapter\", {\n /**\n * See {@link MDCTextFieldHelperTextAdapter} for typing information on parameters and return types.\n */\n get: function () {\n // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.\n return {\n addClass: function () { return undefined; },\n removeClass: function () { return undefined; },\n hasClass: function () { return false; },\n getAttr: function () { return null; },\n setAttr: function () { return undefined; },\n removeAttr: function () { return undefined; },\n setContent: function () { return undefined; },\n };\n // tslint:enable:object-literal-sort-keys\n },\n enumerable: false,\n configurable: true\n });\n MDCTextFieldHelperTextFoundation.prototype.getId = function () {\n return this.adapter.getAttr('id');\n };\n MDCTextFieldHelperTextFoundation.prototype.isVisible = function () {\n return this.adapter.getAttr(strings.ARIA_HIDDEN) !== 'true';\n };\n /**\n * Sets the content of the helper text field.\n */\n MDCTextFieldHelperTextFoundation.prototype.setContent = function (content) {\n this.adapter.setContent(content);\n };\n MDCTextFieldHelperTextFoundation.prototype.isPersistent = function () {\n return this.adapter.hasClass(cssClasses.HELPER_TEXT_PERSISTENT);\n };\n /**\n * @param isPersistent Sets the persistency of the helper text.\n */\n MDCTextFieldHelperTextFoundation.prototype.setPersistent = function (isPersistent) {\n if (isPersistent) {\n this.adapter.addClass(cssClasses.HELPER_TEXT_PERSISTENT);\n }\n else {\n this.adapter.removeClass(cssClasses.HELPER_TEXT_PERSISTENT);\n }\n };\n /**\n * @return whether the helper text acts as an error validation message.\n */\n MDCTextFieldHelperTextFoundation.prototype.isValidation = function () {\n return this.adapter.hasClass(cssClasses.HELPER_TEXT_VALIDATION_MSG);\n };\n /**\n * @param isValidation True to make the helper text act as an error validation message.\n */\n MDCTextFieldHelperTextFoundation.prototype.setValidation = function (isValidation) {\n if (isValidation) {\n this.adapter.addClass(cssClasses.HELPER_TEXT_VALIDATION_MSG);\n }\n else {\n this.adapter.removeClass(cssClasses.HELPER_TEXT_VALIDATION_MSG);\n }\n };\n /**\n * Makes the helper text visible to the screen reader.\n */\n MDCTextFieldHelperTextFoundation.prototype.showToScreenReader = function () {\n this.adapter.removeAttr(strings.ARIA_HIDDEN);\n };\n /**\n * Sets the validity of the helper text based on the input validity.\n */\n MDCTextFieldHelperTextFoundation.prototype.setValidity = function (inputIsValid) {\n var helperTextIsPersistent = this.adapter.hasClass(cssClasses.HELPER_TEXT_PERSISTENT);\n var helperTextIsValidationMsg = this.adapter.hasClass(cssClasses.HELPER_TEXT_VALIDATION_MSG);\n var validationMsgNeedsDisplay = helperTextIsValidationMsg && !inputIsValid;\n if (validationMsgNeedsDisplay) {\n this.showToScreenReader();\n // If role is already alert, refresh it to trigger another announcement\n // from screenreader.\n if (this.adapter.getAttr(strings.ROLE) === 'alert') {\n this.refreshAlertRole();\n }\n else {\n this.adapter.setAttr(strings.ROLE, 'alert');\n }\n }\n else {\n this.adapter.removeAttr(strings.ROLE);\n }\n if (!helperTextIsPersistent && !validationMsgNeedsDisplay) {\n this.hide();\n }\n };\n /**\n * Hides the help text from screen readers.\n */\n MDCTextFieldHelperTextFoundation.prototype.hide = function () {\n this.adapter.setAttr(strings.ARIA_HIDDEN, 'true');\n };\n MDCTextFieldHelperTextFoundation.prototype.refreshAlertRole = function () {\n var _this = this;\n this.adapter.removeAttr(strings.ROLE);\n requestAnimationFrame(function () {\n _this.adapter.setAttr(strings.ROLE, 'alert');\n });\n };\n return MDCTextFieldHelperTextFoundation;\n}(MDCFoundation));\nexport { MDCTextFieldHelperTextFoundation };\n// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.\nexport default MDCTextFieldHelperTextFoundation;\n//# sourceMappingURL=foundation.js.map","