UNPKG

@postnord/web-components

Version:
1,121 lines (1,120 loc) 44.8 kB
/*! * Built with Stencil * By PostNord. */ import { h, Host, forceUpdate } from "@stencil/core"; import { uuidv4, en, awaitTopbar } from "../../../index"; import { alert_exclamation_circle, check, close, preview_on, preview_off } from "pn-design-assets/pn-assets/icons.js"; import { translations } from "./translations"; /** * The `pn-input` is a regular `input` but styled. This means you can use native events to listen to the changes. * Always use the `label` prop to make sure the input is accessible. * * @nativeInput Use the `input` event to listen to content being modified by the user. It is emitted everytime a user writes or removes content in the input. * @nativeChange The `change` event is emitted when the input loses focus, the user clicks `Enter` or makes a selection (such as auto complete or suggestions). * * @slot helpertext - You can use this slot instead of the prop `helpertext`. Recommended, only if you need to include additional HTML markup. * Such as a `pn-text-link`. Use a `span` element to wrap the text and link. {@since v7.2.0} * @slot error - You can use this slot instead of the prop `error`. Recommended, only if you need to include additional HTML markup. * Such as a `pn-text-link`. Use a `span` element to wrap the text and link. {@since v7.2.0} */ export class PnInput { id = `pn-input-${uuidv4()}`; idHelper = `${this.id}-helper`; idError = `${this.id}-error`; prefix; suffix; mo; hostElement; offsetLeft = 0; offsetRight = 0; showPassword = false; togglePassword() { this.showPassword = !this.showPassword; } /** Text label placed above the input field. */ label; /** Text message placed underneath the input field. */ helpertext; /** * Set the language manually for the translations of show/hide/clear button text. * Not needed if you have the pntopbar on the page. **/ language = undefined; /** Set the value of the input. @category Native attributes */ value = ''; /** pn-input supports: `text`, `password`, `url`, `tel`, `search`, `number` & `email`. @category Native attributes */ type = 'text'; /** * HTML input name. Setting a name will help the browser understand what type of data the input have * and can better assist with autofill data based on previous entires much better. * @category Native attributes **/ name; /** * Provide a placeholder text. Remember that this is no replacement for a label. * The placeholder should be a nice addition to the label/helpertext, not important information. * * @category Native attributes **/ placeholder; /** * Let the browser know what type of autocorrects the input should use. * Works much better if a `name` and `pn-id` is supplied. * @see {@link name} * @see {@link inputid} * * @category Native attributes */ autocomplete; /** The maximum number of characters the user should be able to add, also adds a visible counter. @category Native attributes */ maxlength; /** * Hint the browser about what type of virtual keyboard should be used. * The browser will be able to decide this on its own most of the time, * especially if you use the `type`, `name` and `inputid` props. * * Leave empty or with a `''` value if you want the browsers default behaviour (`text`). * * @category Native attributes **/ inputmode; /** Point to a datalist element for this input. @category Native attributes */ list; /** Pattern prop. @category Native attributes */ pattern; /** Set the `min` value of the `number` input. @category Native attributes */ min; /** Set the `max` value of the `number` input. @category Native attributes */ max; /** Set a `step` for the number input. @category Native attributes */ step; /** Set the input as `required`. @category Native attributes */ required = false; /** Set the input as `readonly`. @category Native attributes */ readonly = false; /** Set the input as `disabled`. @category Native attributes */ disabled = false; /** * Use the compact label variant. The `placeholder` you provide will not be visible if used at the same time. * @since v7.21.0 * @category Features */ compact = false; /** * Select an icon to display before the input field value. * `icon` takes precedence over the `text-prefix` prop. * * @see {@link textPrefix} * @category Features **/ icon; /** * Set a small text before the input field value. * Cannot be used together with an `icon` at the same time. * * @see {@link icon} * @see {@link textSuffix} * @category Features **/ textPrefix; /** * Set a small text after the input field value. * Cannot be used with the `text-prefix` prop at the same time. * * @see {@link textPrefix} * @category Features **/ textSuffix; /** Set the input as `valid`. Provides a green color and a check icon. @category Features */ valid = false; /** * Set the input as `invalid`. Provides a red color and red warning icon. * @see{@link error Provide an error message.} * @category Features **/ invalid = false; /** * Set the input as `invalid` and display an error message (applies the same style as `invalid`). * * Error message; will take precedence over helpertext if both are provided. * @see{@link invalid Set invalid without an error message.} * @category Features **/ error; /** Set a custom ID for the input (default is a generated UUID). @since v7.25.0 @category HTML attributes */ pnId; /** * Provide the label via an aria attribute. * We strongly recommend you use the `label` prop instead. * @since v7.25.0 * @category HTML attributes */ pnAriaLabel; /** * Provide the label from another element via its ID. * We strongly recommend you use the `label` prop instead. * @since v7.25.0 * @category HTML attributes */ pnAriaLabelledby; /** Set the ID of what this input controls. @since v7.25.0 @category HTML attributes */ pnAriaControls; /** Set a custom ID for the input (default is a generated UUID). @deprecated Use `pn-id` instead. @category HTML attributes */ inputid; /** While you can use the `aria-label`, using a `label` is far more accessible. @deprecated Use `pn-aria-label` instead. @category HTML attributes */ arialabel; /** Set the ID of what this input controls. @deprecated Use `pn-aria-controls` instead. @category HTML attributes */ ariacontrols; handleOffset() { requestAnimationFrame(() => { const left = this.prefix?.clientWidth ? this.prefix.clientWidth + 8 : 0; const right = this.suffix?.clientWidth ? this.suffix.clientWidth + 8 : 0; this.offsetLeft = left; this.offsetRight = right; }); } handleId() { this.idHelper = `${this.getId()}-helper`; this.idError = `${this.getId()}-error`; } connectedCallback() { this.mo = new MutationObserver(() => { forceUpdate(this.hostElement); this.handleOffset(); }); this.mo.observe(this.hostElement, { childList: true, subtree: true }); } disconnectedCallback() { if (this.mo) this.mo.disconnect(); } async componentWillLoad() { if (this.language === undefined) await awaitTopbar(this.hostElement); } componentDidLoad() { this.handleOffset(); } getId() { return this.pnId || this.inputid || this.id; } setVal(event) { const target = event.composedPath?.()[0]; this.value = target.value; } clearVal() { const inputClear = new InputEvent('input', { bubbles: true, data: '' }); const input = this.hostElement.querySelector('input'); this.value = ''; input.focus(); input.value = this.value; input.dispatchEvent(inputClear); } translate(prop) { return translations?.[prop]?.[this.language || en]; } hasHelperText() { return this.helpertext?.length > 0 || this.checkSlottedHelper(); } hasErrorMessage() { return this.error?.length > 0 || this.checkSlottedError(); } /** If any error is active, either via the prop `invalid` or `error` prop/slot. */ hasError() { return this.hasErrorMessage() || this.invalid; } hideHelpertext() { return this.hasErrorMessage() || !this.hasHelperText(); } hideError() { return !this.hasErrorMessage(); } checkSlottedHelper() { return !!this.hostElement.querySelector('[slot=helpertext]'); } checkSlottedError() { return !!this.hostElement.querySelector('[slot=error]'); } getInputType() { const types = ['text', 'password', 'url', 'tel', 'search', 'number', 'email']; return types.includes(this.type) && !this.showPassword ? this.type : 'text'; } isPassword() { if (this.disabled) return false; return this.type === 'password' || (this.type === 'text' && this.showPassword); } passwordText() { return this.translate(this.showPassword ? 'HIDE' : 'SHOW'); } /** Check if there is a valid or error state active. Returns false if neither is true. */ displayState() { return this.valid || this.hasError(); } /** * Returns the correct icon for the current state (valid or error). * Defaults to error icon. * @see {@link displayState} */ stateIcon() { if (this.valid) return check; return alert_exclamation_circle; } /** * Returns the correct color for the validation icon. Defaults to red. * @see {@link displayState} */ stateColor() { if (this.valid) return 'green700'; return 'warning'; } showPrefix() { return this.textPrefix && !this.icon; } showSuffix() { return !this.showPrefix() && !!this.textSuffix?.length && !this.isPassword() && this.type !== 'search'; } showClear() { if (this.disabled || this.readonly) return false; return this.type === 'search' && !!this.value?.length; } validLabel() { return this.label?.length > 0 || this.maxlength >= 1; } useLabel() { return this.validLabel() && !this.compact; } /** Compact label must be positioned after the input element in order to work. */ useCompactLabel() { return this.validLabel() && this.compact; } displayLabel() { return !!this.label; } getAriaLabel() { return !this.displayLabel() && !this.pnAriaLabelledby ? this.pnAriaLabel : null; } getAriaLabelledby() { return !this.displayLabel() && !(this.pnAriaLabel || this.arialabel) ? this.pnAriaLabelledby : null; } getAriaDescribedby() { if (this.hasErrorMessage()) return this.idError; else if (this.hasHelperText()) return this.idHelper; return null; } renderLabel() { return (h("label", { htmlFor: this.getId(), class: "pn-input-label", "data-compact": this.compact }, this.label && h("span", null, this.label), this.maxlength >= 0 && h("span", null, `${this.value.length}/${this.maxlength}`))); } render() { return (h(Host, { key: '800f4fb8490656e28657f7a4a041ba0c6dc46af2' }, h("div", { key: '8defa078a3e541509bc17278751f8e59f59f3bd7', class: "pn-input", "data-valid": this.valid, "data-error": this.hasError(), style: { '--pn-input-offset-left': `${this.offsetLeft}px`, '--pn-input-offset-right': `${this.offsetRight}px`, } }, this.useLabel() && this.renderLabel(), h("div", { key: 'dc01fb7fdb2a60ee89473f0152d833243be4ff8d', class: "pn-input-group" }, h("input", { key: '32f63d4aa1c6edd2d10f8876ebd3371cff366eb7', type: this.getInputType(), id: this.getId(), class: "pn-input-element", name: this.name, placeholder: this.compact ? this.placeholder || ' ' : this.placeholder, autocomplete: this.autocomplete, maxlength: this.maxlength, list: this.list, pattern: this.pattern, min: this.min, max: this.max, step: this.step, value: this.value, inputmode: this.inputmode, disabled: this.disabled, required: this.required, readonly: this.readonly, "aria-label": this.getAriaLabel(), "aria-labelledby": this.getAriaLabelledby(), "aria-describedby": this.getAriaDescribedby(), "aria-controls": this.pnAriaControls || this.ariacontrols, "aria-invalid": this.hasError()?.toString(), "data-compact": this.compact, "data-value": this.value?.length > 0, onInput: e => this.setVal(e) }), this.useCompactLabel() && this.renderLabel(), h("div", { key: 'b52d9bfa61569635f422fedc22edd09c768ab9d8', class: "pn-input-eyecandy", "data-prefix": true, ref: el => (this.prefix = el) }, !!this.icon && h("pn-icon", { key: 'e5035273e663855094ba88ed0b485a4e8ffed56c', icon: this.icon, "aria-hidden": "true" }), this.showPrefix() && h("span", { key: '1d0e5355c5dbfecf3dbb693589726a233e3b7df6', class: "pn-input-text" }, this.textPrefix)), h("div", { key: 'e1faa82f19dcfdb6c427d5d2967bfb6694508675', class: "pn-input-eyecandy", "data-suffix": true, ref: el => (this.suffix = el) }, this.showSuffix() && h("span", { key: '4c5ecf7c19bf64eea77b21b05d9ffe491bf4b91c', class: "pn-input-text" }, this.textSuffix), this.displayState() && h("pn-icon", { key: 'f7014e0c31faf3c563c846e4a7061c6f4b35a64a', "aria-hidden": "true", icon: this.stateIcon(), color: this.stateColor() }), this.isPassword() && (h("pn-button", { key: '21518c4f16245de370fcba302b177cfe04e91904', icon: this.showPassword ? preview_on : preview_off, iconOnly: true, arialabel: this.passwordText(), small: true, appearance: "light", variant: "borderless", onClick: () => this.togglePassword() })), this.showClear() && (h("pn-button", { key: '60263a255ee8c8d3ed72ea89a26abfbe9be11d0d', icon: close, iconOnly: true, arialabel: this.translate('CLEAR'), small: true, appearance: "light", variant: "borderless", onClick: () => this.clearVal() })))), h("p", { key: 'd23165556ffcdbfcf7229a04f5c1ea8686432c97', id: this.idHelper, class: "pn-input-message", hidden: this.hideHelpertext() }, !!this.helpertext && h("span", { key: 'b7e31855d677953bbc7a4f65cb0b26a5eac8887b' }, this.helpertext), h("slot", { key: 'a6bbaeceb31e2cc38d1e110b900e13b4f0957c6e', name: "helpertext" })), h("p", { key: '3668fbc1a512f92d3f5a2c6f1f7d86cf04df148b', id: this.idError, class: "pn-input-message", role: "alert", hidden: this.hideError() }, !!this.error && h("span", { key: 'c14fb6ab8e17c7d17813c83c0993f95d079f8274' }, this.error), h("slot", { key: '75ba01e945315e6a3bbf2f5e5ac34c73fe7ab57f', name: "error" }))))); } static get is() { return "pn-input"; } static get originalStyleUrls() { return { "$": ["pn-input.scss"] }; } static get styleUrls() { return { "$": ["pn-input.css"] }; } static get properties() { return { "label": { "type": "string", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": true, "docs": { "tags": [], "text": "Text label placed above the input field." }, "getter": false, "setter": false, "reflect": false, "attribute": "label" }, "helpertext": { "type": "string", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": true, "docs": { "tags": [], "text": "Text message placed underneath the input field." }, "getter": false, "setter": false, "reflect": false, "attribute": "helpertext" }, "language": { "type": "string", "mutable": false, "complexType": { "original": "PnLanguages", "resolved": "\"\" | \"da\" | \"en\" | \"fi\" | \"no\" | \"sv\"", "references": { "PnLanguages": { "location": "import", "path": "@/index", "id": "src/index.ts::PnLanguages", "referenceLocation": "PnLanguages" } } }, "required": false, "optional": true, "docs": { "tags": [], "text": "Set the language manually for the translations of show/hide/clear button text.\nNot needed if you have the pntopbar on the page." }, "getter": false, "setter": false, "reflect": false, "attribute": "language", "defaultValue": "undefined" }, "value": { "type": "string", "mutable": true, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": false, "docs": { "tags": [{ "name": "category", "text": "Native attributes" }], "text": "Set the value of the input." }, "getter": false, "setter": false, "reflect": false, "attribute": "value", "defaultValue": "''" }, "type": { "type": "string", "mutable": true, "complexType": { "original": "'text' | 'password' | 'url' | 'tel' | 'search' | 'number' | 'email' | ''", "resolved": "\"\" | \"email\" | \"number\" | \"password\" | \"search\" | \"tel\" | \"text\" | \"url\"", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "category", "text": "Native attributes" }], "text": "pn-input supports: `text`, `password`, `url`, `tel`, `search`, `number` & `email`." }, "getter": false, "setter": false, "reflect": false, "attribute": "type", "defaultValue": "'text'" }, "name": { "type": "string", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "category", "text": "Native attributes" }], "text": "HTML input name. Setting a name will help the browser understand what type of data the input have\nand can better assist with autofill data based on previous entires much better." }, "getter": false, "setter": false, "reflect": false, "attribute": "name" }, "placeholder": { "type": "string", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "category", "text": "Native attributes" }], "text": "Provide a placeholder text. Remember that this is no replacement for a label.\nThe placeholder should be a nice addition to the label/helpertext, not important information." }, "getter": false, "setter": false, "reflect": false, "attribute": "placeholder" }, "autocomplete": { "type": "string", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "see", "text": "{@link name }" }, { "name": "see", "text": "{@link inputid }" }, { "name": "category", "text": "Native attributes" }], "text": "Let the browser know what type of autocorrects the input should use.\nWorks much better if a `name` and `pn-id` is supplied." }, "getter": false, "setter": false, "reflect": false, "attribute": "autocomplete" }, "maxlength": { "type": "number", "mutable": false, "complexType": { "original": "number", "resolved": "number", "references": {} }, "required": false, "optional": false, "docs": { "tags": [{ "name": "category", "text": "Native attributes" }], "text": "The maximum number of characters the user should be able to add, also adds a visible counter." }, "getter": false, "setter": false, "reflect": false, "attribute": "maxlength" }, "inputmode": { "type": "string", "mutable": false, "complexType": { "original": "'text' | 'none' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url'", "resolved": "\"decimal\" | \"email\" | \"none\" | \"numeric\" | \"search\" | \"tel\" | \"text\" | \"url\"", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "category", "text": "Native attributes" }], "text": "Hint the browser about what type of virtual keyboard should be used.\nThe browser will be able to decide this on its own most of the time,\nespecially if you use the `type`, `name` and `inputid` props.\n\nLeave empty or with a `''` value if you want the browsers default behaviour (`text`)." }, "getter": false, "setter": false, "reflect": false, "attribute": "inputmode" }, "list": { "type": "string", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "category", "text": "Native attributes" }], "text": "Point to a datalist element for this input." }, "getter": false, "setter": false, "reflect": false, "attribute": "list" }, "pattern": { "type": "string", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "category", "text": "Native attributes" }], "text": "Pattern prop." }, "getter": false, "setter": false, "reflect": false, "attribute": "pattern" }, "min": { "type": "any", "mutable": false, "complexType": { "original": "number | string", "resolved": "number | string", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "category", "text": "Native attributes" }], "text": "Set the `min` value of the `number` input." }, "getter": false, "setter": false, "reflect": false, "attribute": "min" }, "max": { "type": "any", "mutable": false, "complexType": { "original": "number | string", "resolved": "number | string", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "category", "text": "Native attributes" }], "text": "Set the `max` value of the `number` input." }, "getter": false, "setter": false, "reflect": false, "attribute": "max" }, "step": { "type": "any", "mutable": false, "complexType": { "original": "number | string", "resolved": "number | string", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "category", "text": "Native attributes" }], "text": "Set a `step` for the number input." }, "getter": false, "setter": false, "reflect": false, "attribute": "step" }, "required": { "type": "boolean", "mutable": false, "complexType": { "original": "boolean", "resolved": "boolean", "references": {} }, "required": false, "optional": false, "docs": { "tags": [{ "name": "category", "text": "Native attributes" }], "text": "Set the input as `required`." }, "getter": false, "setter": false, "reflect": false, "attribute": "required", "defaultValue": "false" }, "readonly": { "type": "boolean", "mutable": false, "complexType": { "original": "boolean", "resolved": "boolean", "references": {} }, "required": false, "optional": false, "docs": { "tags": [{ "name": "category", "text": "Native attributes" }], "text": "Set the input as `readonly`." }, "getter": false, "setter": false, "reflect": false, "attribute": "readonly", "defaultValue": "false" }, "disabled": { "type": "boolean", "mutable": false, "complexType": { "original": "boolean", "resolved": "boolean", "references": {} }, "required": false, "optional": false, "docs": { "tags": [{ "name": "category", "text": "Native attributes" }], "text": "Set the input as `disabled`." }, "getter": false, "setter": false, "reflect": false, "attribute": "disabled", "defaultValue": "false" }, "compact": { "type": "boolean", "mutable": false, "complexType": { "original": "boolean", "resolved": "boolean", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "since", "text": "v7.21.0" }, { "name": "category", "text": "Features" }], "text": "Use the compact label variant. The `placeholder` you provide will not be visible if used at the same time." }, "getter": false, "setter": false, "reflect": false, "attribute": "compact", "defaultValue": "false" }, "icon": { "type": "string", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": false, "docs": { "tags": [{ "name": "see", "text": "{@link textPrefix }" }, { "name": "category", "text": "Features" }], "text": "Select an icon to display before the input field value.\n`icon` takes precedence over the `text-prefix` prop." }, "getter": false, "setter": false, "reflect": false, "attribute": "icon" }, "textPrefix": { "type": "string", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": false, "docs": { "tags": [{ "name": "see", "text": "{@link icon }" }, { "name": "see", "text": "{@link textSuffix }" }, { "name": "category", "text": "Features" }], "text": "Set a small text before the input field value.\nCannot be used together with an `icon` at the same time." }, "getter": false, "setter": false, "reflect": false, "attribute": "text-prefix" }, "textSuffix": { "type": "string", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": false, "docs": { "tags": [{ "name": "see", "text": "{@link textPrefix }" }, { "name": "category", "text": "Features" }], "text": "Set a small text after the input field value.\nCannot be used with the `text-prefix` prop at the same time." }, "getter": false, "setter": false, "reflect": false, "attribute": "text-suffix" }, "valid": { "type": "boolean", "mutable": false, "complexType": { "original": "boolean", "resolved": "boolean", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "category", "text": "Features" }], "text": "Set the input as `valid`. Provides a green color and a check icon." }, "getter": false, "setter": false, "reflect": false, "attribute": "valid", "defaultValue": "false" }, "invalid": { "type": "boolean", "mutable": false, "complexType": { "original": "boolean", "resolved": "boolean", "references": {} }, "required": false, "optional": false, "docs": { "tags": [{ "name": "see", "text": "{@link error Provide an error message.}" }, { "name": "category", "text": "Features" }], "text": "Set the input as `invalid`. Provides a red color and red warning icon." }, "getter": false, "setter": false, "reflect": false, "attribute": "invalid", "defaultValue": "false" }, "error": { "type": "string", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "see", "text": "{@link invalid Set invalid without an error message.}" }, { "name": "category", "text": "Features" }], "text": "Set the input as `invalid` and display an error message (applies the same style as `invalid`).\n\nError message; will take precedence over helpertext if both are provided." }, "getter": false, "setter": false, "reflect": false, "attribute": "error" }, "pnId": { "type": "string", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "since", "text": "v7.25.0" }, { "name": "category", "text": "HTML attributes" }], "text": "Set a custom ID for the input (default is a generated UUID)." }, "getter": false, "setter": false, "reflect": false, "attribute": "pn-id" }, "pnAriaLabel": { "type": "string", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "since", "text": "v7.25.0" }, { "name": "category", "text": "HTML attributes" }], "text": "Provide the label via an aria attribute.\nWe strongly recommend you use the `label` prop instead." }, "getter": false, "setter": false, "reflect": false, "attribute": "pn-aria-label" }, "pnAriaLabelledby": { "type": "string", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "since", "text": "v7.25.0" }, { "name": "category", "text": "HTML attributes" }], "text": "Provide the label from another element via its ID.\nWe strongly recommend you use the `label` prop instead." }, "getter": false, "setter": false, "reflect": false, "attribute": "pn-aria-labelledby" }, "pnAriaControls": { "type": "string", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "since", "text": "v7.25.0" }, { "name": "category", "text": "HTML attributes" }], "text": "Set the ID of what this input controls." }, "getter": false, "setter": false, "reflect": false, "attribute": "pn-aria-controls" }, "inputid": { "type": "string", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "deprecated", "text": "Use `pn-id` instead." }, { "name": "category", "text": "HTML attributes" }], "text": "Set a custom ID for the input (default is a generated UUID)." }, "getter": false, "setter": false, "reflect": false, "attribute": "inputid" }, "arialabel": { "type": "string", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "deprecated", "text": "Use `pn-aria-label` instead." }, { "name": "category", "text": "HTML attributes" }], "text": "While you can use the `aria-label`, using a `label` is far more accessible." }, "getter": false, "setter": false, "reflect": false, "attribute": "arialabel" }, "ariacontrols": { "type": "string", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "deprecated", "text": "Use `pn-aria-controls` instead." }, { "name": "category", "text": "HTML attributes" }], "text": "Set the ID of what this input controls." }, "getter": false, "setter": false, "reflect": false, "attribute": "ariacontrols" } }; } static get states() { return { "offsetLeft": {}, "offsetRight": {}, "showPassword": {} }; } static get elementRef() { return "hostElement"; } static get watchers() { return [{ "propName": "textPrefix", "methodName": "handleOffset" }, { "propName": "textSuffix", "methodName": "handleOffset" }, { "propName": "inputid", "methodName": "handleId" }, { "propName": "pnId", "methodName": "handleId", "handlerOptions": { "immediate": true } }]; } }