@digital-realty/ix-textbox 2.3.5 → 2.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,8 @@ import '@material/web/textfield/outlined-text-field.js';
4
4
  import { TextFieldType, UnsupportedTextFieldType } from '@material/web/textfield/internal/text-field.js';
5
5
  import '@digital-realty/ix-icon/ix-icon.js';
6
6
  import '@digital-realty/ix-phone-input/ix-phone-input.js';
7
- export declare class IxTextbox extends LitElement {
7
+ declare const IxTextbox_base: typeof LitElement & import("@digital-realty/ix-shared-fns/aria-forward-mixin.js").Constructor<import("@digital-realty/ix-shared-fns/aria-forward-mixin.js").AriaForwardMixinInterface>;
8
+ export declare class IxTextbox extends IxTextbox_base {
8
9
  readonly component: HTMLInputElement;
9
10
  filled: boolean;
10
11
  disabled: boolean;
@@ -190,3 +191,4 @@ export declare class IxTextbox extends LitElement {
190
191
  private setSearchResultText;
191
192
  protected render(): import("lit-html").TemplateResult<1 | 2 | 3>;
192
193
  }
194
+ export {};
package/dist/IxTextbox.js CHANGED
@@ -4,9 +4,11 @@ import { html as staticHtml, literal } from 'lit/static-html.js';
4
4
  import { property, query, state } from 'lit/decorators.js';
5
5
  import '@material/web/textfield/filled-text-field.js';
6
6
  import '@material/web/textfield/outlined-text-field.js';
7
+ import { AriaForwardMixin } from '@digital-realty/ix-shared-fns/aria-forward-mixin.js';
8
+ import { spread } from '@open-wc/lit-helpers';
7
9
  import '@digital-realty/ix-icon/ix-icon.js';
8
10
  import '@digital-realty/ix-phone-input/ix-phone-input.js';
9
- export class IxTextbox extends LitElement {
11
+ export class IxTextbox extends AriaForwardMixin(LitElement) {
10
12
  constructor() {
11
13
  super(...arguments);
12
14
  this.filled = false;
@@ -302,6 +304,7 @@ export class IxTextbox extends LitElement {
302
304
  label=${this.label}
303
305
  name=${this.name}
304
306
  .value=${(_a = this.value) !== null && _a !== void 0 ? _a : ''}
307
+ ${spread(this.ariaAttributes)}
305
308
  ></ix-phone-input>`;
306
309
  }
307
310
  const tag = this.filled
@@ -339,6 +342,7 @@ export class IxTextbox extends LitElement {
339
342
  name=${this.name}
340
343
  .value=${(_b = this.value) !== null && _b !== void 0 ? _b : ''}
341
344
  @input=${this.onInput}
345
+ ${spread(this.ariaAttributes)}
342
346
  >
343
347
  ${this.leadingIcon
344
348
  ? html `<ix-icon slot="leading-icon">${this.leadingIcon}</ix-icon>`
@@ -1 +1 @@
1
- {"version":3,"file":"IxTextbox.js","sourceRoot":"","sources":["../src/IxTextbox.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,IAAI,IAAI,UAAU,EAAe,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,8CAA8C,CAAC;AACtD,OAAO,gDAAgD,CAAC;AAKxD,OAAO,oCAAoC,CAAC;AAC5C,OAAO,kDAAkD,CAAC;AAE1D,MAAM,OAAO,SAAU,SAAQ,UAAU;IAAzC;;QAI8C,WAAM,GAAG,KAAK,CAAC;QAEf,aAAQ,GAAG,KAAK,CAAC;QAE7D;;;;WAIG;QACyC,UAAK,GAAG,KAAK,CAAC;QAE1D;;;;;;;WAOG;QACoC,cAAS,GAAG,EAAE,CAAC;QAE1C,UAAK,GAAG,EAAE,CAAC;QAEqB,aAAQ,GAAG,KAAK,CAAC;QAE7D;;WAEG;QACS,UAAK,GAAG,EAAE,CAAC;QAEvB;;WAEG;QACS,SAAI,GAAG,EAAE,CAAC;QAEtB;;WAEG;QACqC,eAAU,GAAG,EAAE,CAAC;QAExD;;WAEG;QACqC,eAAU,GAAG,EAAE,CAAC;QAExD;;WAEG;QAEH,gBAAW,GAAG,EAAE,CAAC;QAEjB;;WAEG;QAEH,iBAAY,GAAG,EAAE,CAAC;QAElB;;WA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,EAAE,CAAC;4CAAgB;AAO/B;IAAX,QAAQ,EAAE;sCAAU;AAQO;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAgB;AAQ/B;IAAX,QAAQ,EAAE;0CAAc;AAEI;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CAAkB;AAQF;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;2CAAkB;AAOjB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;2CAAkB;AAQjD;IAAX,QAAQ,EAAE;uCAAW;AAsBtB;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;uCAC4B;AAQ3B;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+CAAmB;AAKtC;IAAR,KAAK,EAAE;0CAA0B","sourcesContent":["import { html, LitElement, nothing } from 'lit';\nimport { html as staticHtml, StaticValue, literal } from 'lit/static-html.js';\nimport { property, query, state } from 'lit/decorators.js';\nimport '@material/web/textfield/filled-text-field.js';\nimport '@material/web/textfield/outlined-text-field.js';\nimport {\n TextFieldType,\n UnsupportedTextFieldType,\n} from '@material/web/textfield/internal/text-field.js';\nimport '@digital-realty/ix-icon/ix-icon.js';\nimport '@digital-realty/ix-phone-input/ix-phone-input.js';\n\nexport class IxTextbox extends LitElement {\n @query('.textfield')\n readonly component!: HTMLInputElement;\n\n @property({ type: Boolean, reflect: true }) filled = false;\n\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /**\n * Gets or sets whether or not the text field is in a visually invalid state.\n *\n * Calling `reportValidity()` will automatically update `error`.\n */\n @property({ type: Boolean, reflect: true }) error = false;\n\n /**\n * The error message that replaces supporting text when `error` is true. If\n * `errorText` is an empty string, then the supporting text will continue to\n * show.\n *\n * Calling `reportValidity()` will automatically update `errorText` to the\n * native `validationMessage`.\n */\n @property({ attribute: 'error-text' }) errorText = '';\n\n @property() label = '';\n\n @property({ type: Boolean, reflect: true }) required = false;\n\n /**\n * The current value of the text field. It is always a string.\n */\n @property() value = '';\n\n /**\n * The name of the text field. It is always a string.\n */\n @property() name = '';\n\n /**\n * An optional prefix to display before the input value.\n */\n @property({ attribute: 'prefix-text' }) prefixText = '';\n\n /**\n * An optional suffix to display after the input value.\n */\n @property({ attribute: 'suffix-text' }) suffixText = '';\n\n /**\n * Name of icon. It is always a string.\n */\n @property({ attribute: 'leading-icon' })\n leadingIcon = '';\n\n /**\n * Name of icon. It is always a string.\n */\n @property({ attribute: 'trailing-icon' })\n trailingIcon = '';\n\n /**\n * Enables navigation icons for search input types.\n */\n @property({ type: Boolean }) searchEnabled = false;\n\n /**\n * The number of search results found.\n */\n @property({ type: Number }) searchResultCount = 0;\n\n /**\n * The index of the selected search result. This property is 1-based (i.e. begins with 1, not zero-based).\n */\n @property({ type: Number }) searchResultIndex = 0;\n\n /**\n * Conveys additional information below the text field, such as how it should\n * be used.\n */\n @property({ attribute: 'supporting-text' }) supportingText = '';\n\n /**\n * Override the input text CSS `direction`. Useful for RTL languages that use\n * LTR notation for fractions.\n */\n @property({ attribute: 'text-direction' }) textDirection = '';\n\n /**\n * The number of rows to display for a `type=\"textarea\"` text field.\n * Defaults to 2.\n */\n @property({ type: Number }) rows = 2;\n\n // <input> properties\n @property({ reflect: true }) override inputMode = '';\n\n /**\n * Defines the greatest value in the range of permitted values.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#max\n */\n @property() max = '';\n\n /**\n * The maximum number of characters a user can enter into the text field. Set\n * to -1 for none.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#maxlength\n */\n @property({ type: Number }) maxLength = -1;\n\n /**\n * Defines the most negative value in the range of permitted values.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#min\n */\n @property() min = '';\n\n /**\n * The minimum number of characters a user can enter into the text field. Set\n * to -1 for none.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#minlength\n */\n @property({ type: Number }) minLength = -1;\n\n /**\n * A regular expression that the text field's value must match to pass\n * constraint validation.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#pattern\n */\n @property() pattern = '';\n\n @property({ reflect: true }) placeholder = '';\n\n /**\n * Indicates whether or not a user should be able to edit the text field's\n * value.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#readonly\n */\n @property({ type: Boolean, reflect: true }) readOnly = false;\n\n /**\n * Indicates that input accepts multiple email addresses.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email#multiple\n */\n @property({ type: Boolean, reflect: true }) multiple = false;\n\n /**\n * Returns or sets the element's step attribute, which works with min and max\n * to limit the increments at which a numeric or date-time value can be set.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#step\n */\n @property() step = '';\n\n /**\n * The `<input>` type to use, defaults to \"text\". The type greatly changes how\n * the text field behaves.\n *\n * Text fields support a limited number of `<input>` types:\n *\n * - text\n * - textarea\n * - email\n * - number\n * - password\n * - search\n * - tel\n * - url\n *\n * See\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#input_types\n * for more details on each input type.\n */\n @property({ reflect: true })\n type: TextFieldType | UnsupportedTextFieldType = 'text';\n\n /**\n * Describes what, if any, type of autocomplete functionality the input\n * should provide.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete\n */\n @property({ reflect: true }) autocomplete = '';\n\n /**\n * True if the input has text.\n */\n @state() hasText: boolean = false;\n\n textarea: HTMLElement | null | undefined;\n\n handleKeydownHandler: any = undefined;\n\n connectedCallback() {\n super.connectedCallback();\n\n if (this.type === 'textarea') {\n this.addEventListener('input', this.resizeTextArea);\n this.addEventListener('keydown', this.resizeTextArea);\n window.addEventListener('load', this.resizeTextArea);\n }\n }\n\n async firstUpdated() {\n if (this.type === 'textarea') {\n if (this.component instanceof LitElement) {\n await this.component.updateComplete;\n }\n await this.updateComplete;\n\n this.textarea = this.component?.shadowRoot?.querySelector('textarea');\n this.resizeTextArea();\n }\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n\n if (this.handleKeydownHandler) {\n this.removeEventListener('input', this.resizeTextArea);\n this.removeEventListener('keydown', this.resizeTextArea);\n window.removeEventListener('load', this.resizeTextArea);\n }\n }\n\n resizeTextArea = () => {\n if (this.textarea) {\n this.textarea.style.height = 'auto';\n if (this.textarea.scrollHeight > 0) {\n this.textarea.style.height = `${this.textarea.scrollHeight}px`;\n }\n }\n };\n\n focus() {\n this.component.focus();\n }\n\n protected createRenderRoot() {\n return this;\n }\n\n renderStyles() {\n return html`\n <style>\n [error] {\n --md-outlined-field-outline-width: 2px;\n }\n ix-textbox {\n &.comment {\n --md-outlined-text-field-container-shape: 32px;\n --md-outlined-text-field-outline-color: rgba(9, 34, 65, 0.12);\n --md-outlined-text-field-outline-width: 1px;\n --md-outlined-text-field-hover-outline-color: rgba(9, 34, 65, 0.12);\n --md-outlined-text-field-hover-outline-width: 1px;\n --md-outlined-text-field-focus-outline-color: rgba(9, 34, 65, 0.12);\n --md-outlined-text-field-focus-outline-width: 1px;\n --md-outlined-text-field-input-text-placeholder-color: rgba(\n 9,\n 34,\n 65,\n 0.42\n );\n --md-filled-text-field-focus-active-indicator-color: rgba(\n 9,\n 34,\n 65,\n 0.12\n );\n --md-outlined-text-field-input-text-color: rgb(9, 34, 65);\n --md-outlined-field-leading-space: 8px;\n }\n [type='textarea'] {\n resize: none;\n }\n }\n </style>\n `;\n }\n\n /**\n * Handles search navigation icon clicks and emits search-navigation event.\n */\n private onSearchNavigation(e: CustomEvent, direction: string) {\n this.dispatchEvent(\n new CustomEvent('search-navigation', {\n detail: { direction },\n bubbles: true,\n composed: true,\n })\n );\n }\n\n /**\n * Handles input event and sets hasText state when an input event is received.\n */\n private onInput = (e: Event) => {\n const input = e.target as HTMLInputElement;\n this.hasText = input.value.length > 0;\n\n this.dispatchEvent(\n new CustomEvent('search-text-change', {\n detail: { searchText: input.value },\n })\n );\n };\n\n /**\n * Clears the input field and resets hasText state.\n */\n private clearInput = () => {\n this.value = '';\n this.hasText = false;\n this.dispatchEvent(new Event('input', { bubbles: true, composed: true }));\n };\n\n /**\n * Sets the search result text based on the current search state.\n * @returns The search result text.\n */\n private setSearchResultText(): string {\n if (this.searchResultCount === 0) {\n return `${this.searchResultCount} results`;\n }\n\n if (this.searchResultIndex === 0) {\n return `${this.searchResultCount} results`;\n }\n\n return `${this.searchResultIndex}/${this.searchResultCount} results`;\n }\n\n protected override render() {\n if (this.type === 'tel') {\n return html`<ix-phone-input\n class=\"textfield\"\n style=\"display: block;\"\n ?disabled=${this.disabled}\n ?required=${this.required}\n ?error=${this.error}\n error-text=${this.errorText}\n supporting-text=${this.supportingText}\n type=${this.type}\n label=${this.label}\n name=${this.name}\n .value=${this.value ?? ''}\n ></ix-phone-input>`;\n }\n\n const tag: StaticValue = this.filled\n ? literal`md-filled-text-field`\n : literal`md-outlined-text-field`;\n\n return staticHtml`\n ${this.renderStyles()}\n <${tag}\n class=\"textfield\"\n style=\"display: block;\"\n ?disabled=${this.disabled}\n ?required=${this.required}\n ?error=${this.error}\n ?multipule=${this.multiple}\n ?readOnly=${this.readOnly}\n ?has-leading-icon=${this.leadingIcon.length > 0}\n ?has-trailing-icon=${this.trailingIcon.length > 0}\n step=${this.step || nothing}\n autocomplete=${this.autocomplete || nothing}\n error-text=${this.errorText}\n placeholder=${this.placeholder}\n text-direction=${this.textDirection}\n rows=${this.rows}\n max=${this.max}\n maxLength=${this.maxLength}\n min=${this.min}\n minLength=${this.minLength}\n pattern=${this.pattern}\n prefix-text=${this.prefixText}\n suffix-text=${this.suffixText}\n supporting-text=${this.supportingText}\n inputMode=${this.inputMode}\n type=${this.type}\n label=${this.label}\n name=${this.name}\n .value=${this.value ?? ''}\n @input=${this.onInput}\n >\n ${\n this.leadingIcon\n ? html`<ix-icon slot=\"leading-icon\">${this.leadingIcon}</ix-icon>`\n : nothing\n }\n ${\n this.searchEnabled && this.hasText && this.value.length > 1\n ? html`<div\n style=\"font-size: 14px; align-items: center;\"\n slot=\"trailing-icon\"\n >\n ${this.setSearchResultText()}\n </div>`\n : nothing\n }\n ${\n this.searchEnabled && this.searchResultCount > 0\n ? html`<ix-icon\n style=\"padding: 0px 3px; align-items: center; cursor: pointer;\"\n slot=\"trailing-icon\"\n @click=${(ev: CustomEvent) =>\n this.onSearchNavigation(ev, 'previous')}\n >chevron_left</ix-icon\n >\n\n <ix-icon\n slot=\"trailing-icon\"\n style=\"padding: 0px 3px; align-items: center; cursor: pointer;\"\n @click=${(ev: CustomEvent) =>\n this.onSearchNavigation(ev, 'next')}\n >chevron_right</ix-icon\n >`\n : nothing\n }\n ${\n this.hasText\n ? html`<ix-icon\n style=\"padding: 0px 3px; align-items: center; cursor: pointer;\"\n slot=\"trailing-icon\"\n @click=${this.clearInput}\n >close</ix-icon\n >`\n : nothing\n }\n ${\n this.trailingIcon\n ? html`<ix-icon slot=\"trailing-icon\"\n >${this.trailingIcon}</ix-icon\n >`\n : nothing\n }\n </${tag}>\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"IxTextbox.js","sourceRoot":"","sources":["../src/IxTextbox.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,IAAI,IAAI,UAAU,EAAe,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,8CAA8C,CAAC;AACtD,OAAO,gDAAgD,CAAC;AAKxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qDAAqD,CAAC;AACvF,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,oCAAoC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AQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+CAAmB;AAKtC;IAAR,KAAK,EAAE;0CAA0B","sourcesContent":["import { html, LitElement, nothing } from 'lit';\nimport { html as staticHtml, StaticValue, literal } from 'lit/static-html.js';\nimport { property, query, state } from 'lit/decorators.js';\nimport '@material/web/textfield/filled-text-field.js';\nimport '@material/web/textfield/outlined-text-field.js';\nimport {\n TextFieldType,\n UnsupportedTextFieldType,\n} from '@material/web/textfield/internal/text-field.js';\nimport { AriaForwardMixin } from '@digital-realty/ix-shared-fns/aria-forward-mixin.js';\nimport { spread } from '@open-wc/lit-helpers';\nimport '@digital-realty/ix-icon/ix-icon.js';\nimport '@digital-realty/ix-phone-input/ix-phone-input.js';\n\nexport class IxTextbox extends AriaForwardMixin(LitElement) {\n @query('.textfield')\n readonly component!: HTMLInputElement;\n\n @property({ type: Boolean, reflect: true }) filled = false;\n\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /**\n * Gets or sets whether or not the text field is in a visually invalid state.\n *\n * Calling `reportValidity()` will automatically update `error`.\n */\n @property({ type: Boolean, reflect: true }) error = false;\n\n /**\n * The error message that replaces supporting text when `error` is true. If\n * `errorText` is an empty string, then the supporting text will continue to\n * show.\n *\n * Calling `reportValidity()` will automatically update `errorText` to the\n * native `validationMessage`.\n */\n @property({ attribute: 'error-text' }) errorText = '';\n\n @property() label = '';\n\n @property({ type: Boolean, reflect: true }) required = false;\n\n /**\n * The current value of the text field. It is always a string.\n */\n @property() value = '';\n\n /**\n * The name of the text field. It is always a string.\n */\n @property() name = '';\n\n /**\n * An optional prefix to display before the input value.\n */\n @property({ attribute: 'prefix-text' }) prefixText = '';\n\n /**\n * An optional suffix to display after the input value.\n */\n @property({ attribute: 'suffix-text' }) suffixText = '';\n\n /**\n * Name of icon. It is always a string.\n */\n @property({ attribute: 'leading-icon' })\n leadingIcon = '';\n\n /**\n * Name of icon. It is always a string.\n */\n @property({ attribute: 'trailing-icon' })\n trailingIcon = '';\n\n /**\n * Enables navigation icons for search input types.\n */\n @property({ type: Boolean }) searchEnabled = false;\n\n /**\n * The number of search results found.\n */\n @property({ type: Number }) searchResultCount = 0;\n\n /**\n * The index of the selected search result. This property is 1-based (i.e. begins with 1, not zero-based).\n */\n @property({ type: Number }) searchResultIndex = 0;\n\n /**\n * Conveys additional information below the text field, such as how it should\n * be used.\n */\n @property({ attribute: 'supporting-text' }) supportingText = '';\n\n /**\n * Override the input text CSS `direction`. Useful for RTL languages that use\n * LTR notation for fractions.\n */\n @property({ attribute: 'text-direction' }) textDirection = '';\n\n /**\n * The number of rows to display for a `type=\"textarea\"` text field.\n * Defaults to 2.\n */\n @property({ type: Number }) rows = 2;\n\n // <input> properties\n @property({ reflect: true }) override inputMode = '';\n\n /**\n * Defines the greatest value in the range of permitted values.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#max\n */\n @property() max = '';\n\n /**\n * The maximum number of characters a user can enter into the text field. Set\n * to -1 for none.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#maxlength\n */\n @property({ type: Number }) maxLength = -1;\n\n /**\n * Defines the most negative value in the range of permitted values.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#min\n */\n @property() min = '';\n\n /**\n * The minimum number of characters a user can enter into the text field. Set\n * to -1 for none.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#minlength\n */\n @property({ type: Number }) minLength = -1;\n\n /**\n * A regular expression that the text field's value must match to pass\n * constraint validation.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#pattern\n */\n @property() pattern = '';\n\n @property({ reflect: true }) placeholder = '';\n\n /**\n * Indicates whether or not a user should be able to edit the text field's\n * value.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#readonly\n */\n @property({ type: Boolean, reflect: true }) readOnly = false;\n\n /**\n * Indicates that input accepts multiple email addresses.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email#multiple\n */\n @property({ type: Boolean, reflect: true }) multiple = false;\n\n /**\n * Returns or sets the element's step attribute, which works with min and max\n * to limit the increments at which a numeric or date-time value can be set.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#step\n */\n @property() step = '';\n\n /**\n * The `<input>` type to use, defaults to \"text\". The type greatly changes how\n * the text field behaves.\n *\n * Text fields support a limited number of `<input>` types:\n *\n * - text\n * - textarea\n * - email\n * - number\n * - password\n * - search\n * - tel\n * - url\n *\n * See\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#input_types\n * for more details on each input type.\n */\n @property({ reflect: true })\n type: TextFieldType | UnsupportedTextFieldType = 'text';\n\n /**\n * Describes what, if any, type of autocomplete functionality the input\n * should provide.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete\n */\n @property({ reflect: true }) autocomplete = '';\n\n /**\n * True if the input has text.\n */\n @state() hasText: boolean = false;\n\n textarea: HTMLElement | null | undefined;\n\n handleKeydownHandler: any = undefined;\n\n connectedCallback() {\n super.connectedCallback();\n\n if (this.type === 'textarea') {\n this.addEventListener('input', this.resizeTextArea);\n this.addEventListener('keydown', this.resizeTextArea);\n window.addEventListener('load', this.resizeTextArea);\n }\n }\n\n async firstUpdated() {\n if (this.type === 'textarea') {\n if (this.component instanceof LitElement) {\n await this.component.updateComplete;\n }\n await this.updateComplete;\n\n this.textarea = this.component?.shadowRoot?.querySelector('textarea');\n this.resizeTextArea();\n }\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n\n if (this.handleKeydownHandler) {\n this.removeEventListener('input', this.resizeTextArea);\n this.removeEventListener('keydown', this.resizeTextArea);\n window.removeEventListener('load', this.resizeTextArea);\n }\n }\n\n resizeTextArea = () => {\n if (this.textarea) {\n this.textarea.style.height = 'auto';\n if (this.textarea.scrollHeight > 0) {\n this.textarea.style.height = `${this.textarea.scrollHeight}px`;\n }\n }\n };\n\n focus() {\n this.component.focus();\n }\n\n protected createRenderRoot() {\n return this;\n }\n\n renderStyles() {\n return html`\n <style>\n [error] {\n --md-outlined-field-outline-width: 2px;\n }\n ix-textbox {\n &.comment {\n --md-outlined-text-field-container-shape: 32px;\n --md-outlined-text-field-outline-color: rgba(9, 34, 65, 0.12);\n --md-outlined-text-field-outline-width: 1px;\n --md-outlined-text-field-hover-outline-color: rgba(9, 34, 65, 0.12);\n --md-outlined-text-field-hover-outline-width: 1px;\n --md-outlined-text-field-focus-outline-color: rgba(9, 34, 65, 0.12);\n --md-outlined-text-field-focus-outline-width: 1px;\n --md-outlined-text-field-input-text-placeholder-color: rgba(\n 9,\n 34,\n 65,\n 0.42\n );\n --md-filled-text-field-focus-active-indicator-color: rgba(\n 9,\n 34,\n 65,\n 0.12\n );\n --md-outlined-text-field-input-text-color: rgb(9, 34, 65);\n --md-outlined-field-leading-space: 8px;\n }\n [type='textarea'] {\n resize: none;\n }\n }\n </style>\n `;\n }\n\n /**\n * Handles search navigation icon clicks and emits search-navigation event.\n */\n private onSearchNavigation(e: CustomEvent, direction: string) {\n this.dispatchEvent(\n new CustomEvent('search-navigation', {\n detail: { direction },\n bubbles: true,\n composed: true,\n })\n );\n }\n\n /**\n * Handles input event and sets hasText state when an input event is received.\n */\n private onInput = (e: Event) => {\n const input = e.target as HTMLInputElement;\n this.hasText = input.value.length > 0;\n\n this.dispatchEvent(\n new CustomEvent('search-text-change', {\n detail: { searchText: input.value },\n })\n );\n };\n\n /**\n * Clears the input field and resets hasText state.\n */\n private clearInput = () => {\n this.value = '';\n this.hasText = false;\n this.dispatchEvent(new Event('input', { bubbles: true, composed: true }));\n };\n\n /**\n * Sets the search result text based on the current search state.\n * @returns The search result text.\n */\n private setSearchResultText(): string {\n if (this.searchResultCount === 0) {\n return `${this.searchResultCount} results`;\n }\n\n if (this.searchResultIndex === 0) {\n return `${this.searchResultCount} results`;\n }\n\n return `${this.searchResultIndex}/${this.searchResultCount} results`;\n }\n\n protected override render() {\n if (this.type === 'tel') {\n return html`<ix-phone-input\n class=\"textfield\"\n style=\"display: block;\"\n ?disabled=${this.disabled}\n ?required=${this.required}\n ?error=${this.error}\n error-text=${this.errorText}\n supporting-text=${this.supportingText}\n type=${this.type}\n label=${this.label}\n name=${this.name}\n .value=${this.value ?? ''}\n ${spread(this.ariaAttributes)}\n ></ix-phone-input>`;\n }\n\n const tag: StaticValue = this.filled\n ? literal`md-filled-text-field`\n : literal`md-outlined-text-field`;\n\n return staticHtml`\n ${this.renderStyles()}\n <${tag}\n class=\"textfield\"\n style=\"display: block;\"\n ?disabled=${this.disabled}\n ?required=${this.required}\n ?error=${this.error}\n ?multipule=${this.multiple}\n ?readOnly=${this.readOnly}\n ?has-leading-icon=${this.leadingIcon.length > 0}\n ?has-trailing-icon=${this.trailingIcon.length > 0}\n step=${this.step || nothing}\n autocomplete=${this.autocomplete || nothing}\n error-text=${this.errorText}\n placeholder=${this.placeholder}\n text-direction=${this.textDirection}\n rows=${this.rows}\n max=${this.max}\n maxLength=${this.maxLength}\n min=${this.min}\n minLength=${this.minLength}\n pattern=${this.pattern}\n prefix-text=${this.prefixText}\n suffix-text=${this.suffixText}\n supporting-text=${this.supportingText}\n inputMode=${this.inputMode}\n type=${this.type}\n label=${this.label}\n name=${this.name}\n .value=${this.value ?? ''}\n @input=${this.onInput}\n ${spread(this.ariaAttributes)}\n >\n ${\n this.leadingIcon\n ? html`<ix-icon slot=\"leading-icon\">${this.leadingIcon}</ix-icon>`\n : nothing\n }\n ${\n this.searchEnabled && this.hasText && this.value.length > 1\n ? html`<div\n style=\"font-size: 14px; align-items: center;\"\n slot=\"trailing-icon\"\n >\n ${this.setSearchResultText()}\n </div>`\n : nothing\n }\n ${\n this.searchEnabled && this.searchResultCount > 0\n ? html`<ix-icon\n style=\"padding: 0px 3px; align-items: center; cursor: pointer;\"\n slot=\"trailing-icon\"\n @click=${(ev: CustomEvent) =>\n this.onSearchNavigation(ev, 'previous')}\n >chevron_left</ix-icon\n >\n\n <ix-icon\n slot=\"trailing-icon\"\n style=\"padding: 0px 3px; align-items: center; cursor: pointer;\"\n @click=${(ev: CustomEvent) =>\n this.onSearchNavigation(ev, 'next')}\n >chevron_right</ix-icon\n >`\n : nothing\n }\n ${\n this.hasText\n ? html`<ix-icon\n style=\"padding: 0px 3px; align-items: center; cursor: pointer;\"\n slot=\"trailing-icon\"\n @click=${this.clearInput}\n >close</ix-icon\n >`\n : nothing\n }\n ${\n this.trailingIcon\n ? html`<ix-icon slot=\"trailing-icon\"\n >${this.trailingIcon}</ix-icon\n >`\n : nothing\n }\n </${tag}>\n `;\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{LitElement,html,nothing}from"lit";import{literal,html as html$1}from"lit/static-html.js";import{query,property,state}from"lit/decorators.js";import"@material/web/textfield/filled-text-field.js";import"@material/web/textfield/outlined-text-field.js";import"@digital-realty/ix-icon/ix-icon.js";import"@digital-realty/ix-phone-input/ix-phone-input.js";class IxTextbox extends LitElement{constructor(){super(...arguments),this.filled=!1,this.disabled=!1,this.error=!1,this.errorText="",this.label="",this.required=!1,this.value="",this.name="",this.prefixText="",this.suffixText="",this.leadingIcon="",this.trailingIcon="",this.searchEnabled=!1,this.searchResultCount=0,this.searchResultIndex=0,this.supportingText="",this.textDirection="",this.rows=2,this.inputMode="",this.max="",this.maxLength=-1,this.min="",this.minLength=-1,this.pattern="",this.placeholder="",this.readOnly=!1,this.multiple=!1,this.step="",this.type="text",this.autocomplete="",this.hasText=!1,this.handleKeydownHandler=void 0,this.resizeTextArea=()=>{this.textarea&&(this.textarea.style.height="auto",0<this.textarea.scrollHeight)&&(this.textarea.style.height=this.textarea.scrollHeight+"px")},this.onInput=t=>{t=t.target;this.hasText=0<t.value.length,this.dispatchEvent(new CustomEvent("search-text-change",{detail:{searchText:t.value}}))},this.clearInput=()=>{this.value="",this.hasText=!1,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0}))}}connectedCallback(){super.connectedCallback(),"textarea"===this.type&&(this.addEventListener("input",this.resizeTextArea),this.addEventListener("keydown",this.resizeTextArea),window.addEventListener("load",this.resizeTextArea))}async firstUpdated(){var t;"textarea"===this.type&&(this.component instanceof LitElement&&await this.component.updateComplete,await this.updateComplete,this.textarea=null==(t=null==(t=this.component)?void 0:t.shadowRoot)?void 0:t.querySelector("textarea"),this.resizeTextArea())}disconnectedCallback(){super.disconnectedCallback(),this.handleKeydownHandler&&(this.removeEventListener("input",this.resizeTextArea),this.removeEventListener("keydown",this.resizeTextArea),window.removeEventListener("load",this.resizeTextArea))}focus(){this.component.focus()}createRenderRoot(){return this}renderStyles(){return html`
1
+ import{__decorate}from"tslib";import{LitElement,html,nothing}from"lit";import{literal,html as html$1}from"lit/static-html.js";import{query,property,state}from"lit/decorators.js";import"@material/web/textfield/filled-text-field.js";import"@material/web/textfield/outlined-text-field.js";import{AriaForwardMixin}from"@digital-realty/ix-shared-fns/aria-forward-mixin.js";import{spread}from"@open-wc/lit-helpers";import"@digital-realty/ix-icon/ix-icon.js";import"@digital-realty/ix-phone-input/ix-phone-input.js";class IxTextbox extends AriaForwardMixin(LitElement){constructor(){super(...arguments),this.filled=!1,this.disabled=!1,this.error=!1,this.errorText="",this.label="",this.required=!1,this.value="",this.name="",this.prefixText="",this.suffixText="",this.leadingIcon="",this.trailingIcon="",this.searchEnabled=!1,this.searchResultCount=0,this.searchResultIndex=0,this.supportingText="",this.textDirection="",this.rows=2,this.inputMode="",this.max="",this.maxLength=-1,this.min="",this.minLength=-1,this.pattern="",this.placeholder="",this.readOnly=!1,this.multiple=!1,this.step="",this.type="text",this.autocomplete="",this.hasText=!1,this.handleKeydownHandler=void 0,this.resizeTextArea=()=>{this.textarea&&(this.textarea.style.height="auto",0<this.textarea.scrollHeight)&&(this.textarea.style.height=this.textarea.scrollHeight+"px")},this.onInput=t=>{t=t.target;this.hasText=0<t.value.length,this.dispatchEvent(new CustomEvent("search-text-change",{detail:{searchText:t.value}}))},this.clearInput=()=>{this.value="",this.hasText=!1,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0}))}}connectedCallback(){super.connectedCallback(),"textarea"===this.type&&(this.addEventListener("input",this.resizeTextArea),this.addEventListener("keydown",this.resizeTextArea),window.addEventListener("load",this.resizeTextArea))}async firstUpdated(){var t;"textarea"===this.type&&(this.component instanceof LitElement&&await this.component.updateComplete,await this.updateComplete,this.textarea=null==(t=null==(t=this.component)?void 0:t.shadowRoot)?void 0:t.querySelector("textarea"),this.resizeTextArea())}disconnectedCallback(){super.disconnectedCallback(),this.handleKeydownHandler&&(this.removeEventListener("input",this.resizeTextArea),this.removeEventListener("keydown",this.resizeTextArea),window.removeEventListener("load",this.resizeTextArea))}focus(){this.component.focus()}createRenderRoot(){return this}renderStyles(){return html`
2
2
  <style>
3
3
  [error] {
4
4
  --md-outlined-field-outline-width: 2px;
@@ -44,6 +44,7 @@ import{__decorate}from"tslib";import{LitElement,html,nothing}from"lit";import{li
44
44
  label=${this.label}
45
45
  name=${this.name}
46
46
  .value=${null!=(e=this.value)?e:""}
47
+ ${spread(this.ariaAttributes)}
47
48
  ></ix-phone-input>`:(e=this.filled?literal`md-filled-text-field`:literal`md-outlined-text-field`,html$1`
48
49
  ${this.renderStyles()}
49
50
  <${e}
@@ -76,6 +77,7 @@ import{__decorate}from"tslib";import{LitElement,html,nothing}from"lit";import{li
76
77
  name=${this.name}
77
78
  .value=${null!=(t=this.value)?t:""}
78
79
  @input=${this.onInput}
80
+ ${spread(this.ariaAttributes)}
79
81
  >
80
82
  ${this.leadingIcon?html`<ix-icon slot="leading-icon">${this.leadingIcon}</ix-icon>`:nothing}
81
83
  ${this.searchEnabled&&this.hasText&&1<this.value.length?html`<div
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digital-realty/ix-textbox",
3
- "version": "2.3.5",
3
+ "version": "2.3.6",
4
4
  "description": "Webcomponent ix-textbox following open-wc recommendations",
5
5
  "license": "MIT",
6
6
  "author": "Digital Realty",
@@ -30,8 +30,10 @@
30
30
  "dependencies": {
31
31
  "@digital-realty/ix-icon": "^1.2.4",
32
32
  "@digital-realty/ix-phone-input": "^2.3.4",
33
+ "@digital-realty/ix-shared-fns": "1.0.1",
33
34
  "@lit/react": "^1.0.2",
34
35
  "@material/web": "2.4.0",
36
+ "@open-wc/lit-helpers": "^0.7.0",
35
37
  "lit": "^3.2.1",
36
38
  "react": "^18.2.0"
37
39
  },
@@ -112,5 +114,5 @@
112
114
  "README.md",
113
115
  "LICENSE"
114
116
  ],
115
- "gitHead": "5f957be9ee993f439c24887108d7d1f35c40ab17"
117
+ "gitHead": "ab315b433acc9b12065e1a2038a2bc3a7c07487f"
116
118
  }