@ni/nimble-components 21.10.1 → 21.10.2

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.
@@ -1,9 +1,10 @@
1
1
  import { Combobox as FoundationCombobox } from '@microsoft/fast-foundation';
2
2
  import { ToggleButton } from '../toggle-button';
3
3
  import type { ErrorPattern } from '../patterns/error/types';
4
- import type { DropdownPattern } from '../patterns/dropdown/types';
4
+ import type { DropdownPattern, ListOptionOwner } from '../patterns/dropdown/types';
5
5
  import { DropdownAppearance } from '../patterns/dropdown/types';
6
6
  import type { AnchoredRegion } from '../anchored-region';
7
+ import type { ListOption } from '../list-option';
7
8
  declare global {
8
9
  interface HTMLElementTagNameMap {
9
10
  'nimble-combobox': Combobox;
@@ -12,7 +13,7 @@ declare global {
12
13
  /**
13
14
  * A nimble-styed HTML combobox
14
15
  */
15
- export declare class Combobox extends FoundationCombobox implements DropdownPattern, ErrorPattern {
16
+ export declare class Combobox extends FoundationCombobox implements DropdownPattern, ErrorPattern, ListOptionOwner {
16
17
  appearance: DropdownAppearance;
17
18
  /**
18
19
  * The ref to the internal dropdown button element.
@@ -59,6 +60,10 @@ export declare class Combobox extends FoundationCombobox implements DropdownPatt
59
60
  inputHandler(e: InputEvent): boolean | void;
60
61
  keydownHandler(e: KeyboardEvent): boolean | void;
61
62
  focusoutHandler(e: FocusEvent): boolean | void;
63
+ /**
64
+ * @internal
65
+ */
66
+ registerOption(option: ListOption): void;
62
67
  protected focusAndScrollOptionIntoView(): void;
63
68
  protected openChanged(): void;
64
69
  private regionChanged;
@@ -134,6 +134,21 @@ export class Combobox extends FoundationCombobox {
134
134
  this.emitChangeIfValueUpdated();
135
135
  return returnValue;
136
136
  }
137
+ /**
138
+ * @internal
139
+ */
140
+ registerOption(option) {
141
+ if (this.options.includes(option)) {
142
+ return;
143
+ }
144
+ // Adding an option to the end, ultimately, isn't the correct
145
+ // thing to do, as this will mean the option's index in the options,
146
+ // at least temporarily, does not match the DOM order. However, it
147
+ // is expected that a successive run of `slottedOptionsChanged` will
148
+ // correct this order issue. See 'https://github.com/ni/nimble/issues/1915'
149
+ // for more info.
150
+ this.options.push(option);
151
+ }
137
152
  focusAndScrollOptionIntoView() {
138
153
  if (this.open) {
139
154
  super.focusAndScrollOptionIntoView();
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/combobox/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EACH,YAAY,EACZ,QAAQ,IAAI,kBAAkB,EAEjC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACH,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,QAAQ,EACX,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAgB,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAQtC;;GAEG;AACH,MAAM,OAAO,QACT,SAAQ,kBAAkB;IAD9B;;QAIW,eAAU,GAAuB,kBAAkB,CAAC,SAAS,CAAC;QAqB9D,iBAAY,GAAG,KAAK,CAAC;QAc5B,gBAAgB;QAET,gBAAW,GAAG,KAAK,CAAC;QAqBnB,wBAAmB,GAAG,KAAK,CAAC;IA+LxC,CAAC;IAlNG,IAAoB,KAAK;QACrB,OAAO,KAAK,CAAC,KAAK,CAAC;IACvB,CAAC;IAED,6EAA6E;IAC7E,6DAA6D;IAC7D,qDAAqD;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;IAC7B,QAAQ;IACR,MAAM;IACN,aAAa,EAAE;QACX,cAAc,EAAE,IAAI;KACvB;IACD,GAAG,EAAE,IAAI,CAAU;;eAER,sBAAsB;;;iBAGpB,sBAAsB;;eAExB,eAAe;kBACZ,GAAG,CAAC,gBAAgB,CAAC;;4BAEX,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI;6BACV,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ;;0BAElB,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,KAAK,CAAC;2BAC5C,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,KAAK,CAAC;4BAC7C,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,KAAsB,CAAC;;;;iCAI3D,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI;;;mBAGzB,wBAAwB;;;;oBAIvB,wBAAwB;gBAC5B,eAAe;;UAErB,iBAAiB;KACtB;CACJ,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,cAAc,EAAE,CAAC,CAAC;AAC3E,MAAM,CAAC,MAAM,WAAW,GAAG,iBAAiB,CAAC","sourcesContent":["import { attr, html, observable, ref } from '@microsoft/fast-element';\nimport {\n DesignSystem,\n Combobox as FoundationCombobox,\n ComboboxOptions\n} from '@microsoft/fast-foundation';\nimport {\n keyArrowDown,\n keyArrowUp,\n keyEnter,\n keySpace\n} from '@microsoft/fast-web-utilities';\nimport { ToggleButton, toggleButtonTag } from '../toggle-button';\nimport { errorTextTemplate } from '../patterns/error/template';\nimport { iconArrowExpanderDownTag } from '../icons/arrow-expander-down';\nimport { iconExclamationMarkTag } from '../icons/exclamation-mark';\n\nimport { styles } from './styles';\nimport type { ErrorPattern } from '../patterns/error/types';\nimport type { DropdownPattern } from '../patterns/dropdown/types';\nimport { DropdownAppearance } from '../patterns/dropdown/types';\nimport type { AnchoredRegion } from '../anchored-region';\nimport { template } from './template';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nimble-combobox': Combobox;\n }\n}\n\n/**\n * A nimble-styed HTML combobox\n */\nexport class Combobox\n extends FoundationCombobox\n implements DropdownPattern, ErrorPattern {\n @attr\n public appearance: DropdownAppearance = DropdownAppearance.underline;\n\n /**\n * The ref to the internal dropdown button element.\n *\n * @internal\n */\n @observable\n public readonly dropdownButton?: ToggleButton;\n\n /**\n * A message explaining why the value is invalid.\n *\n * @public\n * @remarks\n * HTML Attribute: error-text\n */\n @attr({ attribute: 'error-text' })\n public errorText?: string;\n\n @attr({ attribute: 'error-visible', mode: 'boolean' })\n public errorVisible = false;\n\n /**\n * @internal\n */\n @observable\n public region?: AnchoredRegion;\n\n /**\n * @internal\n */\n @observable\n public controlWrapper?: HTMLElement;\n\n /** @internal */\n @observable\n public hasOverflow = false;\n\n public override get value(): string {\n return super.value;\n }\n\n // This override is to work around an issue in FAST where an old filter value\n // is used after programmatically setting the value property.\n // See: https://github.com/microsoft/fast/issues/6749\n public override set value(next: string) {\n super.value = next;\n // Workaround using index notation to manipulate private member\n // Can remove when following resolved: https://github.com/microsoft/fast/issues/6749\n // eslint-disable-next-line @typescript-eslint/dot-notation\n this['filter'] = next;\n this.filterOptions();\n this.selectedIndex = this.options\n .map(option => option.text)\n .indexOf(this.value);\n }\n\n private valueUpdatedByInput = false;\n private valueBeforeTextUpdate?: string;\n\n // Workaround for https://github.com/microsoft/fast/issues/5123\n public override setPositioning(): void {\n if (!this.$fastController.isConnected) {\n // Don't call setPositioning() until we're connected,\n // since this.forcedPosition isn't initialized yet.\n return;\n }\n super.setPositioning();\n }\n\n // Workaround for https://github.com/microsoft/fast/issues/5773\n public override slottedOptionsChanged(\n prev: HTMLElement[],\n next: HTMLElement[]\n ): void {\n const value = this.value;\n super.slottedOptionsChanged(prev, next);\n if (value) {\n this.value = value;\n }\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n // Call setPositioning() after this.forcedPosition is initialized.\n this.setPositioning();\n this.updateInputAriaLabel();\n }\n\n public toggleButtonClickHandler(e: Event): void {\n e.stopImmediatePropagation();\n }\n\n public toggleButtonChangeHandler(e: Event): void {\n this.open = this.dropdownButton!.checked;\n e.stopImmediatePropagation();\n }\n\n public toggleButtonKeyDownHandler(e: KeyboardEvent): boolean {\n switch (e.key) {\n case keyArrowUp:\n case keyArrowDown:\n case keySpace:\n case keyEnter:\n this.open = true;\n this.stopPropagation(e);\n return false;\n default:\n return true;\n }\n }\n\n public override filterOptions(): void {\n super.filterOptions();\n const enabledOptions = this.filteredOptions.filter(o => !o.disabled);\n this.filteredOptions = enabledOptions;\n }\n\n /**\n * This is a workaround for the issue described here: https://github.com/microsoft/fast/issues/6267\n * For now, we will update the value ourselves while a user types in text. Note that there is other\n * implementation related to this (like the 'keydownEventHandler') needed to create the complete set\n * of desired behavior described in the issue noted above.\n */\n // eslint-disable-next-line @typescript-eslint/no-invalid-void-type\n public override inputHandler(e: InputEvent): boolean | void {\n const returnValue = super.inputHandler(e);\n if (!this.valueUpdatedByInput) {\n this.valueBeforeTextUpdate = this.value;\n }\n this.valueUpdatedByInput = true;\n // This is a workaround for this FAST issue: https://github.com/microsoft/fast/issues/6776\n if (this.value !== this.control.value) {\n this.focusAndScrollOptionIntoView();\n }\n\n this.value = this.control.value;\n return returnValue;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-invalid-void-type\n public override keydownHandler(e: KeyboardEvent): boolean | void {\n const returnValue = super.keydownHandler(e);\n if (e.ctrlKey || e.altKey) {\n return returnValue;\n }\n\n switch (e.key) {\n case keyEnter:\n this.emitChangeIfValueUpdated();\n break;\n case keyArrowDown:\n case keyArrowUp:\n if (this.open && this.valueUpdatedByInput) {\n this.valueUpdatedByInput = false;\n }\n break;\n default:\n return returnValue;\n }\n return returnValue;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-invalid-void-type\n public override focusoutHandler(e: FocusEvent): boolean | void {\n const returnValue = super.focusoutHandler(e);\n this.open = false;\n this.emitChangeIfValueUpdated();\n return returnValue;\n }\n\n protected override focusAndScrollOptionIntoView(): void {\n if (this.open) {\n super.focusAndScrollOptionIntoView();\n }\n }\n\n protected override openChanged(): void {\n super.openChanged();\n if (this.dropdownButton) {\n this.dropdownButton.checked = this.open;\n }\n }\n\n private regionChanged(\n _prev: AnchoredRegion | undefined,\n _next: AnchoredRegion | undefined\n ): void {\n if (this.region && this.controlWrapper) {\n this.region.anchorElement = this.controlWrapper;\n }\n }\n\n private controlWrapperChanged(\n _prev: HTMLElement | undefined,\n _next: HTMLElement | undefined\n ): void {\n if (this.region && this.controlWrapper) {\n this.region.anchorElement = this.controlWrapper;\n }\n }\n\n // Workaround for https://github.com/microsoft/fast/issues/6041.\n private ariaLabelChanged(_oldValue: string, _newValue: string): void {\n this.updateInputAriaLabel();\n }\n\n private maxHeightChanged(): void {\n this.updateListboxMaxHeightCssVariable();\n }\n\n private updateListboxMaxHeightCssVariable(): void {\n if (this.listbox) {\n this.listbox.style.setProperty(\n '--ni-private-select-max-height',\n `${this.maxHeight}px`\n );\n }\n }\n\n private updateInputAriaLabel(): void {\n const inputElement = this.shadowRoot?.querySelector('.selected-value');\n if (this.ariaLabel) {\n inputElement?.setAttribute('aria-label', this.ariaLabel);\n } else {\n inputElement?.removeAttribute('aria-label');\n }\n }\n\n /**\n * This will only emit a `change` event after text entry where the text in the input prior to\n * typing is different than the text present upon an attempt to commit (e.g. pressing <Enter>).\n * So, for a concrete example:\n * 1) User types 'Sue' (when Combobox input was blank).\n * 2) User presses <Enter> -> 'change' event fires\n * 3) User deletes 'Sue'\n * 4) User re-types 'Sue'\n * 5) User presses <Enter> -> NO 'change' event is fired\n */\n private emitChangeIfValueUpdated(): void {\n if (this.valueUpdatedByInput) {\n if (this.value !== this.valueBeforeTextUpdate) {\n this.$emit('change');\n }\n\n this.valueUpdatedByInput = false;\n }\n }\n}\n\nconst nimbleCombobox = Combobox.compose<ComboboxOptions>({\n baseName: 'combobox',\n baseClass: FoundationCombobox,\n template,\n styles,\n shadowOptions: {\n delegatesFocus: true\n },\n end: html<Combobox>`\n <div class=\"end-slot-container\">\n <${iconExclamationMarkTag}\n severity=\"error\"\n class=\"error-icon\"\n ></${iconExclamationMarkTag}>\n <div class=\"separator\"></div>\n <${toggleButtonTag}\n ${ref('dropdownButton')}\n appearance=\"ghost\"\n ?checked=\"${x => x.open}\"\n ?disabled=\"${x => x.disabled}\"\n content-hidden=\"true\"\n @click=\"${(x, c) => x.toggleButtonClickHandler(c.event)}\"\n @change=\"${(x, c) => x.toggleButtonChangeHandler(c.event)}\"\n @keydown=\"${(x, c) => x.toggleButtonKeyDownHandler(c.event as KeyboardEvent)}\"\n class=\"dropdown-button\"\n part=\"button\"\n aria-haspopup=\"true\"\n aria-expanded=\"${x => x.open}\"\n tabindex=\"-1\"\n >\n <${iconArrowExpanderDownTag}\n slot=\"start\"\n class=\"dropdown-icon\"\n >\n </${iconArrowExpanderDownTag}>\n </${toggleButtonTag}>\n </div>\n ${errorTextTemplate}\n `\n});\n\nDesignSystem.getOrCreate().withPrefix('nimble').register(nimbleCombobox());\nexport const comboboxTag = 'nimble-combobox';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/combobox/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EACH,YAAY,EACZ,QAAQ,IAAI,kBAAkB,EAEjC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACH,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,QAAQ,EACX,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAgB,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,iBAAiB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EAAE,EAAE,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,KAAK,CAAC;2BAC5C,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,KAAK,CAAC;4BAC7C,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,KAAsB,CAAC;;;;iCAI3D,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI;;;mBAGzB,wBAAwB;;;;oBAIvB,wBAAwB;gBAC5B,eAAe;;UAErB,iBAAiB;KACtB;CACJ,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,cAAc,EAAE,CAAC,CAAC;AAC3E,MAAM,CAAC,MAAM,WAAW,GAAG,iBAAiB,CAAC","sourcesContent":["import { attr, html, observable, ref } from '@microsoft/fast-element';\nimport {\n DesignSystem,\n Combobox as FoundationCombobox,\n ComboboxOptions\n} from '@microsoft/fast-foundation';\nimport {\n keyArrowDown,\n keyArrowUp,\n keyEnter,\n keySpace\n} from '@microsoft/fast-web-utilities';\nimport { ToggleButton, toggleButtonTag } from '../toggle-button';\nimport { errorTextTemplate } from '../patterns/error/template';\nimport { iconArrowExpanderDownTag } from '../icons/arrow-expander-down';\nimport { iconExclamationMarkTag } from '../icons/exclamation-mark';\n\nimport { styles } from './styles';\nimport type { ErrorPattern } from '../patterns/error/types';\nimport type {\n DropdownPattern,\n ListOptionOwner\n} from '../patterns/dropdown/types';\nimport { DropdownAppearance } from '../patterns/dropdown/types';\nimport type { AnchoredRegion } from '../anchored-region';\nimport { template } from './template';\nimport type { ListOption } from '../list-option';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nimble-combobox': Combobox;\n }\n}\n\n/**\n * A nimble-styed HTML combobox\n */\nexport class Combobox\n extends FoundationCombobox\n implements DropdownPattern, ErrorPattern, ListOptionOwner {\n @attr\n public appearance: DropdownAppearance = DropdownAppearance.underline;\n\n /**\n * The ref to the internal dropdown button element.\n *\n * @internal\n */\n @observable\n public readonly dropdownButton?: ToggleButton;\n\n /**\n * A message explaining why the value is invalid.\n *\n * @public\n * @remarks\n * HTML Attribute: error-text\n */\n @attr({ attribute: 'error-text' })\n public errorText?: string;\n\n @attr({ attribute: 'error-visible', mode: 'boolean' })\n public errorVisible = false;\n\n /**\n * @internal\n */\n @observable\n public region?: AnchoredRegion;\n\n /**\n * @internal\n */\n @observable\n public controlWrapper?: HTMLElement;\n\n /** @internal */\n @observable\n public hasOverflow = false;\n\n public override get value(): string {\n return super.value;\n }\n\n // This override is to work around an issue in FAST where an old filter value\n // is used after programmatically setting the value property.\n // See: https://github.com/microsoft/fast/issues/6749\n public override set value(next: string) {\n super.value = next;\n // Workaround using index notation to manipulate private member\n // Can remove when following resolved: https://github.com/microsoft/fast/issues/6749\n // eslint-disable-next-line @typescript-eslint/dot-notation\n this['filter'] = next;\n this.filterOptions();\n this.selectedIndex = this.options\n .map(option => option.text)\n .indexOf(this.value);\n }\n\n private valueUpdatedByInput = false;\n private valueBeforeTextUpdate?: string;\n\n // Workaround for https://github.com/microsoft/fast/issues/5123\n public override setPositioning(): void {\n if (!this.$fastController.isConnected) {\n // Don't call setPositioning() until we're connected,\n // since this.forcedPosition isn't initialized yet.\n return;\n }\n super.setPositioning();\n }\n\n // Workaround for https://github.com/microsoft/fast/issues/5773\n public override slottedOptionsChanged(\n prev: HTMLElement[],\n next: HTMLElement[]\n ): void {\n const value = this.value;\n super.slottedOptionsChanged(prev, next);\n if (value) {\n this.value = value;\n }\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n // Call setPositioning() after this.forcedPosition is initialized.\n this.setPositioning();\n this.updateInputAriaLabel();\n }\n\n public toggleButtonClickHandler(e: Event): void {\n e.stopImmediatePropagation();\n }\n\n public toggleButtonChangeHandler(e: Event): void {\n this.open = this.dropdownButton!.checked;\n e.stopImmediatePropagation();\n }\n\n public toggleButtonKeyDownHandler(e: KeyboardEvent): boolean {\n switch (e.key) {\n case keyArrowUp:\n case keyArrowDown:\n case keySpace:\n case keyEnter:\n this.open = true;\n this.stopPropagation(e);\n return false;\n default:\n return true;\n }\n }\n\n public override filterOptions(): void {\n super.filterOptions();\n const enabledOptions = this.filteredOptions.filter(o => !o.disabled);\n this.filteredOptions = enabledOptions;\n }\n\n /**\n * This is a workaround for the issue described here: https://github.com/microsoft/fast/issues/6267\n * For now, we will update the value ourselves while a user types in text. Note that there is other\n * implementation related to this (like the 'keydownEventHandler') needed to create the complete set\n * of desired behavior described in the issue noted above.\n */\n // eslint-disable-next-line @typescript-eslint/no-invalid-void-type\n public override inputHandler(e: InputEvent): boolean | void {\n const returnValue = super.inputHandler(e);\n if (!this.valueUpdatedByInput) {\n this.valueBeforeTextUpdate = this.value;\n }\n this.valueUpdatedByInput = true;\n // This is a workaround for this FAST issue: https://github.com/microsoft/fast/issues/6776\n if (this.value !== this.control.value) {\n this.focusAndScrollOptionIntoView();\n }\n\n this.value = this.control.value;\n return returnValue;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-invalid-void-type\n public override keydownHandler(e: KeyboardEvent): boolean | void {\n const returnValue = super.keydownHandler(e);\n if (e.ctrlKey || e.altKey) {\n return returnValue;\n }\n\n switch (e.key) {\n case keyEnter:\n this.emitChangeIfValueUpdated();\n break;\n case keyArrowDown:\n case keyArrowUp:\n if (this.open && this.valueUpdatedByInput) {\n this.valueUpdatedByInput = false;\n }\n break;\n default:\n return returnValue;\n }\n return returnValue;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-invalid-void-type\n public override focusoutHandler(e: FocusEvent): boolean | void {\n const returnValue = super.focusoutHandler(e);\n this.open = false;\n this.emitChangeIfValueUpdated();\n return returnValue;\n }\n\n /**\n * @internal\n */\n public registerOption(option: ListOption): void {\n if (this.options.includes(option)) {\n return;\n }\n\n // Adding an option to the end, ultimately, isn't the correct\n // thing to do, as this will mean the option's index in the options,\n // at least temporarily, does not match the DOM order. However, it\n // is expected that a successive run of `slottedOptionsChanged` will\n // correct this order issue. See 'https://github.com/ni/nimble/issues/1915'\n // for more info.\n this.options.push(option);\n }\n\n protected override focusAndScrollOptionIntoView(): void {\n if (this.open) {\n super.focusAndScrollOptionIntoView();\n }\n }\n\n protected override openChanged(): void {\n super.openChanged();\n if (this.dropdownButton) {\n this.dropdownButton.checked = this.open;\n }\n }\n\n private regionChanged(\n _prev: AnchoredRegion | undefined,\n _next: AnchoredRegion | undefined\n ): void {\n if (this.region && this.controlWrapper) {\n this.region.anchorElement = this.controlWrapper;\n }\n }\n\n private controlWrapperChanged(\n _prev: HTMLElement | undefined,\n _next: HTMLElement | undefined\n ): void {\n if (this.region && this.controlWrapper) {\n this.region.anchorElement = this.controlWrapper;\n }\n }\n\n // Workaround for https://github.com/microsoft/fast/issues/6041.\n private ariaLabelChanged(_oldValue: string, _newValue: string): void {\n this.updateInputAriaLabel();\n }\n\n private maxHeightChanged(): void {\n this.updateListboxMaxHeightCssVariable();\n }\n\n private updateListboxMaxHeightCssVariable(): void {\n if (this.listbox) {\n this.listbox.style.setProperty(\n '--ni-private-select-max-height',\n `${this.maxHeight}px`\n );\n }\n }\n\n private updateInputAriaLabel(): void {\n const inputElement = this.shadowRoot?.querySelector('.selected-value');\n if (this.ariaLabel) {\n inputElement?.setAttribute('aria-label', this.ariaLabel);\n } else {\n inputElement?.removeAttribute('aria-label');\n }\n }\n\n /**\n * This will only emit a `change` event after text entry where the text in the input prior to\n * typing is different than the text present upon an attempt to commit (e.g. pressing <Enter>).\n * So, for a concrete example:\n * 1) User types 'Sue' (when Combobox input was blank).\n * 2) User presses <Enter> -> 'change' event fires\n * 3) User deletes 'Sue'\n * 4) User re-types 'Sue'\n * 5) User presses <Enter> -> NO 'change' event is fired\n */\n private emitChangeIfValueUpdated(): void {\n if (this.valueUpdatedByInput) {\n if (this.value !== this.valueBeforeTextUpdate) {\n this.$emit('change');\n }\n\n this.valueUpdatedByInput = false;\n }\n }\n}\n\nconst nimbleCombobox = Combobox.compose<ComboboxOptions>({\n baseName: 'combobox',\n baseClass: FoundationCombobox,\n template,\n styles,\n shadowOptions: {\n delegatesFocus: true\n },\n end: html<Combobox>`\n <div class=\"end-slot-container\">\n <${iconExclamationMarkTag}\n severity=\"error\"\n class=\"error-icon\"\n ></${iconExclamationMarkTag}>\n <div class=\"separator\"></div>\n <${toggleButtonTag}\n ${ref('dropdownButton')}\n appearance=\"ghost\"\n ?checked=\"${x => x.open}\"\n ?disabled=\"${x => x.disabled}\"\n content-hidden=\"true\"\n @click=\"${(x, c) => x.toggleButtonClickHandler(c.event)}\"\n @change=\"${(x, c) => x.toggleButtonChangeHandler(c.event)}\"\n @keydown=\"${(x, c) => x.toggleButtonKeyDownHandler(c.event as KeyboardEvent)}\"\n class=\"dropdown-button\"\n part=\"button\"\n aria-haspopup=\"true\"\n aria-expanded=\"${x => x.open}\"\n tabindex=\"-1\"\n >\n <${iconArrowExpanderDownTag}\n slot=\"start\"\n class=\"dropdown-icon\"\n >\n </${iconArrowExpanderDownTag}>\n </${toggleButtonTag}>\n </div>\n ${errorTextTemplate}\n `\n});\n\nDesignSystem.getOrCreate().withPrefix('nimble').register(nimbleCombobox());\nexport const comboboxTag = 'nimble-combobox';\n"]}
@@ -31,5 +31,7 @@ export declare class ListOption extends FoundationListboxOption {
31
31
  hasOverflow: boolean;
32
32
  /** @internal */
33
33
  get elementTextContent(): string;
34
+ connectedCallback(): void;
35
+ private isListOptionOwner;
34
36
  }
35
37
  export declare const listOptionTag = "nimble-list-option";
@@ -36,6 +36,18 @@ export class ListOption extends FoundationListboxOption {
36
36
  .map(node => node.textContent?.trim())
37
37
  .join(' ');
38
38
  }
39
+ connectedCallback() {
40
+ super.connectedCallback();
41
+ if (this.isListOptionOwner(this.parentElement)) {
42
+ this.parentElement.registerOption(this);
43
+ }
44
+ }
45
+ isListOptionOwner(parent) {
46
+ if (!parent) {
47
+ return false;
48
+ }
49
+ return typeof parent.registerOption === 'function';
50
+ }
39
51
  }
40
52
  __decorate([
41
53
  attr({ mode: 'boolean' })
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/list-option/index.ts"],"names":[],"mappings":";AAAA,OAAO,EACH,YAAY,EACZ,aAAa,IAAI,uBAAuB,EAC3C,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAQtC;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,uBAAuB;IAAvD;;QAII;;;;;;;WAOG;QAEa,WAAM,GAAG,KAAK,CAAC;QAE/B;;;;;;WAMG;QAEI,mBAAc,GAAG,KAAK,CAAC;QAE9B,gBAAgB;QAET,gBAAW,GAAG,KAAK,CAAC;IAS/B,CAAC;IAPG,gBAAgB;IAChB,IAAW,kBAAkB;QACzB,OAAO,IAAI,CAAC,WAAW;aAClB,aAAa,EAAE;aACf,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC;aACrC,IAAI,CAAC,GAAG,CAAC,CAAC;IACnB,CAAC;CACJ;AAvBG;IADC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;0CACK;AAU/B;IADC,IAAI,CAAC,EAAE,SAAS,EAAE,iBAAiB,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;kDAC1B;AAI9B;IADC,UAAU;+CACgB;AAW/B,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,CAAC;IACxC,QAAQ,EAAE,aAAa;IACvB,SAAS,EAAE,uBAAuB;IAClC,QAAQ;IACR,MAAM;CACT,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,gBAAgB,EAAE,CAAC,CAAC;AAC7E,MAAM,CAAC,MAAM,aAAa,GAAG,oBAAoB,CAAC","sourcesContent":["import {\n DesignSystem,\n ListboxOption as FoundationListboxOption\n} from '@microsoft/fast-foundation';\nimport { observable, attr } from '@microsoft/fast-element';\nimport { styles } from './styles';\nimport { template } from './template';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nimble-list-option': ListOption;\n }\n}\n\n/**\n * A nimble-styled HTML listbox option\n */\nexport class ListOption extends FoundationListboxOption {\n /** @internal */\n public contentSlot!: HTMLSlotElement;\n\n /**\n * The hidden state of the element.\n *\n * @public\n * @defaultValue - false\n * @remarks\n * HTML Attribute: hidden\n */\n @attr({ mode: 'boolean' })\n public override hidden = false;\n\n /**\n * @internal\n * This attribute is required to allow use-cases that offer dynamic filtering\n * (like the Select) to visually hide options that are filtered out, but still\n * allow users to use the native 'hidden' attribute without it being affected\n * by the filtering process.\n */\n @attr({ attribute: 'visually-hidden', mode: 'boolean' })\n public visuallyHidden = false;\n\n /** @internal */\n @observable\n public hasOverflow = false;\n\n /** @internal */\n public get elementTextContent(): string {\n return this.contentSlot\n .assignedNodes()\n .map(node => node.textContent?.trim())\n .join(' ');\n }\n}\n\nconst nimbleListOption = ListOption.compose({\n baseName: 'list-option',\n baseClass: FoundationListboxOption,\n template,\n styles\n});\n\nDesignSystem.getOrCreate().withPrefix('nimble').register(nimbleListOption());\nexport const listOptionTag = 'nimble-list-option';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/list-option/index.ts"],"names":[],"mappings":";AAAA,OAAO,EACH,YAAY,EACZ,aAAa,IAAI,uBAAuB,EAC3C,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;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,CAAC;AAC7E,MAAM,CAAC,MAAM,aAAa,GAAG,oBAAoB,CAAC","sourcesContent":["import {\n DesignSystem,\n ListboxOption as FoundationListboxOption\n} from '@microsoft/fast-foundation';\nimport { observable, attr } from '@microsoft/fast-element';\nimport { styles } from './styles';\nimport { template } from './template';\nimport type { ListOptionOwner } from '../patterns/dropdown/types';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nimble-list-option': ListOption;\n }\n}\n\n/**\n * A nimble-styled HTML listbox option\n */\nexport class ListOption extends FoundationListboxOption {\n /** @internal */\n public contentSlot!: HTMLSlotElement;\n\n /**\n * The hidden state of the element.\n *\n * @public\n * @defaultValue - false\n * @remarks\n * HTML Attribute: hidden\n */\n @attr({ mode: 'boolean' })\n public override hidden = false;\n\n /**\n * @internal\n * This attribute is required to allow use-cases that offer dynamic filtering\n * (like the Select) to visually hide options that are filtered out, but still\n * allow users to use the native 'hidden' attribute without it being affected\n * by the filtering process.\n */\n @attr({ attribute: 'visually-hidden', mode: 'boolean' })\n public visuallyHidden = false;\n\n /** @internal */\n @observable\n public hasOverflow = false;\n\n /** @internal */\n public get elementTextContent(): string {\n return this.contentSlot\n .assignedNodes()\n .map(node => node.textContent?.trim())\n .join(' ');\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n if (this.isListOptionOwner(this.parentElement)) {\n this.parentElement.registerOption(this);\n }\n }\n\n private isListOptionOwner(\n parent: HTMLElement | null\n ): parent is ListOptionOwner {\n if (!parent) {\n return false;\n }\n\n return typeof (parent as ListOptionOwner).registerOption === 'function';\n }\n}\n\nconst nimbleListOption = ListOption.compose({\n baseName: 'list-option',\n baseClass: FoundationListboxOption,\n template,\n styles\n});\n\nDesignSystem.getOrCreate().withPrefix('nimble').register(nimbleListOption());\nexport const listOptionTag = 'nimble-list-option';\n"]}
@@ -1,3 +1,4 @@
1
+ import type { ListOption } from '../../list-option';
1
2
  import type { ErrorPattern } from '../error/types';
2
3
  /**
3
4
  * The interface that dropdowns of various types implement. The properties in this interface
@@ -17,3 +18,16 @@ export declare const DropdownAppearance: {
17
18
  readonly block: "block";
18
19
  };
19
20
  export type DropdownAppearance = (typeof DropdownAppearance)[keyof typeof DropdownAppearance];
21
+ /**
22
+ * @internal
23
+ *
24
+ * This interface is used to register options with their parent once their
25
+ * 'connectedCallback' method is run. This allows for the "owner", like the
26
+ * Select, to have its value set to that newly registered option earlier than it
27
+ * might otherwise in certain situations. One such scenario is in an Angular
28
+ * reactive form, where the form value is set to an option immediately after
29
+ * dynamically adding it.
30
+ */
31
+ export interface ListOptionOwner extends HTMLElement {
32
+ registerOption: (option: ListOption) => void;
33
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/patterns/dropdown/types.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC5B,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;CACR,CAAC;AAIX,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAC9B,SAAS,EAAE,WAAW;IACtB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;CACR,CAAC","sourcesContent":["import type { ErrorPattern } from '../error/types';\n\n/**\n * The interface that dropdowns of various types implement. The properties in this interface\n * are leveraged by the shared dropdown pattern css.\n */\nexport interface DropdownPattern extends ErrorPattern {\n position?: DropdownPosition;\n}\n\nexport const DropdownPosition = {\n above: 'above',\n below: 'below'\n} as const;\nexport type DropdownPosition =\n (typeof DropdownPosition)[keyof typeof DropdownPosition];\n\nexport const DropdownAppearance = {\n underline: 'underline',\n outline: 'outline',\n block: 'block'\n} as const;\nexport type DropdownAppearance =\n (typeof DropdownAppearance)[keyof typeof DropdownAppearance];\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/patterns/dropdown/types.ts"],"names":[],"mappings":"AAWA,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC5B,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;CACR,CAAC;AAIX,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAC9B,SAAS,EAAE,WAAW;IACtB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;CACR,CAAC","sourcesContent":["import type { ListOption } from '../../list-option';\nimport type { ErrorPattern } from '../error/types';\n\n/**\n * The interface that dropdowns of various types implement. The properties in this interface\n * are leveraged by the shared dropdown pattern css.\n */\nexport interface DropdownPattern extends ErrorPattern {\n position?: DropdownPosition;\n}\n\nexport const DropdownPosition = {\n above: 'above',\n below: 'below'\n} as const;\nexport type DropdownPosition =\n (typeof DropdownPosition)[keyof typeof DropdownPosition];\n\nexport const DropdownAppearance = {\n underline: 'underline',\n outline: 'outline',\n block: 'block'\n} as const;\nexport type DropdownAppearance =\n (typeof DropdownAppearance)[keyof typeof DropdownAppearance];\n\n/**\n * @internal\n *\n * This interface is used to register options with their parent once their\n * 'connectedCallback' method is run. This allows for the \"owner\", like the\n * Select, to have its value set to that newly registered option earlier than it\n * might otherwise in certain situations. One such scenario is in an Angular\n * reactive form, where the form value is set to an option immediately after\n * dynamically adding it.\n */\nexport interface ListOptionOwner extends HTMLElement {\n registerOption: (option: ListOption) => void;\n}\n"]}
@@ -1,6 +1,7 @@
1
1
  import { AnchoredRegion, ListboxOption, SelectPosition } from '@microsoft/fast-foundation';
2
- import { DropdownAppearance } from '../patterns/dropdown/types';
2
+ import { DropdownAppearance, ListOptionOwner } from '../patterns/dropdown/types';
3
3
  import type { ErrorPattern } from '../patterns/error/types';
4
+ import { ListOption } from '../list-option';
4
5
  import { FilterMode } from './types';
5
6
  import { FormAssociatedSelect } from './models/select-form-associated';
6
7
  declare global {
@@ -12,7 +13,7 @@ type BooleanOrVoid = boolean | void;
12
13
  /**
13
14
  * A nimble-styled HTML select.
14
15
  */
15
- export declare class Select extends FormAssociatedSelect implements ErrorPattern {
16
+ export declare class Select extends FormAssociatedSelect implements ErrorPattern, ListOptionOwner {
16
17
  appearance: DropdownAppearance;
17
18
  /**
18
19
  * Reflects the placement for the listbox when the select is open.
@@ -212,6 +213,10 @@ export declare class Select extends FormAssociatedSelect implements ErrorPattern
212
213
  formResetCallback(): void;
213
214
  selectNextOption(): void;
214
215
  selectPreviousOption(): void;
216
+ /**
217
+ * @internal
218
+ */
219
+ registerOption(option: ListOption): void;
215
220
  protected setSelectedOptions(): void;
216
221
  protected focusAndScrollOptionIntoView(): void;
217
222
  protected positionChanged(_: SelectPosition | undefined, next: SelectPosition | undefined): void;
@@ -466,6 +466,21 @@ export class Select extends FormAssociatedSelect {
466
466
  }
467
467
  }
468
468
  }
469
+ /**
470
+ * @internal
471
+ */
472
+ registerOption(option) {
473
+ if (this.options.includes(option)) {
474
+ return;
475
+ }
476
+ // Adding an option to the end, ultimately, isn't the correct
477
+ // thing to do, as this will mean the option's index in the options,
478
+ // at least temporarily, does not match the DOM order. However, it
479
+ // is expected that a successive run of `slottedOptionsChanged` will
480
+ // correct this order issue. See 'https://github.com/ni/nimble/issues/1915'
481
+ // for more info.
482
+ this.options.push(option);
483
+ }
469
484
  // Prevents parent classes from resetting selectedIndex to a positive
470
485
  // value while filtering, which can result in a disabled option being
471
486
  // selected.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/select/index.ts"],"names":[],"mappings":";AAAA,qJAAqJ;AACrJ,OAAO,EACH,IAAI,EACJ,IAAI,EACJ,UAAU,EACV,UAAU,EACV,QAAQ,EACX,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEH,YAAY,EACZ,MAAM,IAAI,gBAAgB,EAG1B,cAAc,EACd,WAAW,EACX,QAAQ,EACR,mBAAmB,EACtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACH,YAAY,EACZ,UAAU,EACV,MAAM,EACN,QAAQ,EACR,SAAS,EACT,OAAO,EACP,QAAQ,EACR,MAAM,EACN,QAAQ,EACX,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,O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C;IADC,IAAI,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;oCACzB;AAQpB;IADC,UAAU;wCACsB;AAQjC;IADC,UAAU;uCACkB;AAoB7B;IADC,UAAU;gDAC2B;AAMtC;IADC,UAAU;2CAC2B;AAMtC;IADC,UAAU;8CAC4B;AAIvC;IADC,UAAU;2CACgB;AAM3B;IADC,UAAU;+CACkC;AAM7C;IADC,UAAU;sCACQ;AAMnB;IADC,UAAU;uDACoC;AAQ/C;IADC,UAAU;yCACU;AAQrB;IADC,QAAQ;yCAGR;AA6DD;IADC,QAAQ;0CAIR;AAgsBL,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,CAAgB;IAC/C,QAAQ,EAAE,QAAQ;IAClB,SAAS,EAAE,gBAAgB;IAC3B,QAAQ;IACR,MAAM;IACN,SAAS,EAAE,sBAAsB,CAAC,IAAI;IACtC,GAAG,EAAE,IAAI,CAAQ;WACV,sBAAsB;;;aAGpB,sBAAsB;UACzB,iBAAiB;KACtB;CACJ,CAAC,CAAC;AAEH,WAAW,CAAC,MAAM,EAAE,QAAQ,EAAE,mBAAmB,CAAC,CAAC;AACnD,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC,CAAC;AACzE,MAAM,CAAC,MAAM,SAAS,GAAG,eAAe,CAAC","sourcesContent":["// Based on: https://github.com/microsoft/fast/blob/%40microsoft/fast-foundation_v2.49.5/packages/web-components/fast-foundation/src/select/select.ts\nimport {\n attr,\n html,\n observable,\n Observable,\n volatile\n} from '@microsoft/fast-element';\nimport {\n AnchoredRegion,\n DesignSystem,\n Select as FoundationSelect,\n ListboxOption,\n SelectOptions,\n SelectPosition,\n applyMixins,\n StartEnd,\n DelegatesARIASelect\n} from '@microsoft/fast-foundation';\nimport {\n keyArrowDown,\n keyArrowUp,\n keyEnd,\n keyEnter,\n keyEscape,\n keyHome,\n keySpace,\n keyTab,\n uniqueId\n} from '@microsoft/fast-web-utilities';\nimport { arrowExpanderDown16X16 } from '@ni/nimble-tokens/dist/icons/js';\nimport { styles } from './styles';\nimport { DropdownAppearance } from '../patterns/dropdown/types';\nimport { errorTextTemplate } from '../patterns/error/template';\nimport type { ErrorPattern } from '../patterns/error/types';\nimport { iconExclamationMarkTag } from '../icons/exclamation-mark';\nimport { template } from './template';\nimport { ListOption } from '../list-option';\nimport { FilterMode } from './types';\nimport { diacriticInsensitiveStringNormalizer } from '../utilities/models/string-normalizers';\nimport { FormAssociatedSelect } from './models/select-form-associated';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nimble-select': Select;\n }\n}\n\n// Used in overrides of base class methods\n// eslint-disable-next-line @typescript-eslint/no-invalid-void-type\ntype BooleanOrVoid = boolean | void;\n\nconst isNimbleListOption = (el: Element): el is ListOption => {\n return el instanceof ListOption;\n};\n\n/**\n * A nimble-styled HTML select.\n */\nexport class Select extends FormAssociatedSelect implements ErrorPattern {\n @attr\n public appearance: DropdownAppearance = DropdownAppearance.underline;\n\n /**\n * Reflects the placement for the listbox when the select is open.\n *\n * @public\n */\n @attr({ attribute: 'position' })\n public positionAttribute?: SelectPosition;\n\n /**\n * A message explaining why the value is invalid.\n *\n * @public\n * @remarks\n * HTML Attribute: error-text\n */\n @attr({ attribute: 'error-text' })\n public errorText: string | undefined;\n\n @attr({ attribute: 'error-visible', mode: 'boolean' })\n public errorVisible = false;\n\n @attr({ attribute: 'filter-mode' })\n public filterMode: FilterMode = FilterMode.none;\n\n /**\n * @internal\n */\n @observable\n public displayPlaceholder = false;\n\n /**\n * @internal\n */\n @attr({ attribute: 'open', mode: 'boolean' })\n public open = false;\n\n /**\n * Holds the current state for the calculated position of the listbox.\n *\n * @public\n */\n @observable\n public position?: SelectPosition;\n\n /**\n * The ref to the internal `.control` element.\n *\n * @internal\n */\n @observable\n public control!: HTMLElement;\n\n /**\n * Reference to the internal listbox element.\n *\n * @internal\n */\n public listbox!: HTMLDivElement;\n\n /**\n * The unique id for the internal listbox element.\n *\n * @internal\n */\n public listboxId: string = uniqueId('listbox-');\n\n /**\n * @internal\n */\n @observable\n public scrollableRegion!: HTMLElement;\n\n /**\n * @internal\n */\n @observable\n public filterInput?: HTMLInputElement;\n\n /**\n * @internal\n */\n @observable\n public anchoredRegion!: AnchoredRegion;\n\n /** @internal */\n @observable\n public hasOverflow = false;\n\n /**\n * @internal\n */\n @observable\n public filteredOptions: ListboxOption[] = [];\n\n /**\n * @internal\n */\n @observable\n public filter = '';\n\n /**\n * @internal\n */\n @observable\n public committedSelectedOption?: ListboxOption;\n\n /**\n * The max height for the listbox when opened.\n *\n * @internal\n */\n @observable\n public maxHeight = 0;\n\n /**\n * The component is collapsible when in single-selection mode with no size attribute.\n *\n * @internal\n */\n @volatile\n public get collapsible(): boolean {\n return !(this.multiple || typeof this.size === 'number');\n }\n\n private _value = '';\n private forcedPosition = false;\n private indexWhenOpened?: number;\n\n /**\n * @internal\n */\n public override connectedCallback(): void {\n super.connectedCallback();\n this.forcedPosition = !!this.positionAttribute;\n this.initializeOpenState();\n }\n\n public override get value(): string {\n Observable.track(this, 'value');\n return this._value;\n }\n\n public override set value(next: string) {\n const prev = this._value;\n let newValue = next;\n\n if (this.options?.length) {\n const newValueIndex = this.options.findIndex(\n el => el.value === newValue\n );\n const prevSelectedValue = this.options[this.selectedIndex]?.value ?? null;\n const nextSelectedValue = this.options[newValueIndex]?.value ?? null;\n\n if (\n newValueIndex === -1\n || prevSelectedValue !== nextSelectedValue\n ) {\n newValue = '';\n this.selectedIndex = newValueIndex;\n }\n\n newValue = this.firstSelectedOption?.value ?? newValue;\n }\n\n if (prev !== newValue && !(this.open && this.selectedIndex < 0)) {\n this._value = newValue;\n super.valueChanged(prev, newValue);\n if (!this.open) {\n this.committedSelectedOption = this.options.find(\n o => o.value === newValue\n );\n }\n Observable.notify(this, 'value');\n if (this.collapsible) {\n Observable.notify(this, 'displayValue');\n }\n }\n }\n\n /**\n * @internal\n */\n @volatile\n public get displayValue(): string {\n Observable.track(this, 'displayValue');\n return this.committedSelectedOption?.text ?? '';\n }\n\n /**\n * @internal\n */\n public anchoredRegionChanged(\n _prev: AnchoredRegion | undefined,\n _next: AnchoredRegion | undefined\n ): void {\n if (this.anchoredRegion && this.control) {\n this.anchoredRegion.anchorElement = this.control;\n }\n }\n\n /**\n * @internal\n */\n public controlChanged(\n _prev: HTMLElement | undefined,\n _next: HTMLElement | undefined\n ): void {\n if (this.anchoredRegion && this.control) {\n this.anchoredRegion.anchorElement = this.control;\n }\n }\n\n /**\n * @internal\n */\n public override slottedOptionsChanged(\n prev: Element[],\n next: Element[]\n ): void {\n const value = this.value;\n this.options.forEach(o => {\n const notifier = Observable.getNotifier(o);\n notifier.unsubscribe(this, 'value');\n notifier.unsubscribe(this, 'hidden');\n notifier.unsubscribe(this, 'disabled');\n });\n\n super.slottedOptionsChanged(prev, next);\n\n this.options.forEach(o => {\n const notifier = Observable.getNotifier(o);\n notifier.subscribe(this, 'value');\n notifier.subscribe(this, 'hidden');\n notifier.subscribe(this, 'disabled');\n });\n this.setProxyOptions();\n this.updateValue();\n // We need to force an update to the filteredOptions observable\n // (by calling 'filterOptions()) so that the template correctly updates.\n this.filterOptions();\n if (value) {\n this.value = value;\n }\n this.committedSelectedOption = this.options[this.selectedIndex];\n }\n\n /**\n * @internal\n */\n public override clickHandler(e: MouseEvent): BooleanOrVoid {\n // do nothing if the select is disabled\n if (this.disabled) {\n return;\n }\n\n if (this.open) {\n const captured = (e.target as HTMLElement).closest<ListOption>(\n 'option,[role=option]'\n );\n\n if (captured?.disabled) {\n return;\n }\n }\n\n super.clickHandler(e);\n\n this.open = this.collapsible && !this.open;\n\n if (!this.open && this.indexWhenOpened !== this.selectedIndex) {\n this.updateValue(true);\n }\n }\n\n /**\n * Updates the value when an option's value changes.\n *\n * @param source - the source object\n * @param propertyName - the property to evaluate\n *\n * @internal\n * @override\n */\n public override handleChange(source: unknown, propertyName: string): void {\n // don't call super.handleChange so hidden options can be selected programmatically\n const sourceElement = source as Element;\n switch (propertyName) {\n case 'value': {\n this.updateValue();\n break;\n }\n case 'selected': {\n if (isNimbleListOption(sourceElement)) {\n this.selectedIndex = this.options.indexOf(sourceElement);\n }\n this.setSelectedOptions();\n this.updateDisplayValue();\n break;\n }\n case 'hidden': {\n if (isNimbleListOption(sourceElement)) {\n sourceElement.visuallyHidden = sourceElement.hidden;\n }\n this.updateDisplayValue();\n break;\n }\n case 'disabled': {\n this.updateDisplayValue();\n break;\n }\n default:\n break;\n }\n }\n\n /**\n * Prevents focus when size is set and a scrollbar is clicked.\n *\n * @param e - the mouse event object\n *\n * @override\n * @internal\n */\n public override mousedownHandler(e: MouseEvent): BooleanOrVoid {\n if (e.offsetX >= 0 && e.offsetX <= this.listbox?.scrollWidth) {\n return super.mousedownHandler(e);\n }\n\n return this.collapsible;\n }\n\n /**\n * @internal\n */\n public regionLoadedHandler(): void {\n this.focusAndScrollOptionIntoView();\n }\n\n /**\n * Sets the multiple property on the proxy element.\n *\n * @param prev - the previous multiple value\n * @param next - the current multiple value\n */\n public override multipleChanged(\n prev: boolean | undefined,\n next: boolean\n ): void {\n super.multipleChanged(prev, next);\n\n if (this.proxy) {\n this.proxy.multiple = next;\n }\n }\n\n /**\n * @internal\n */\n public inputClickHandler(e: MouseEvent): void {\n e.stopPropagation(); // clicking in filter input shouldn't close dropdown\n }\n\n /**\n * @internal\n */\n public changeValueHandler(): void {\n this.committedSelectedOption = this.options.find(\n option => option.selected\n );\n }\n\n /**\n * @internal\n */\n public updateDisplayValue(): void {\n if (\n this.committedSelectedOption?.disabled\n && this.committedSelectedOption?.hidden\n && this.committedSelectedOption?.selected\n ) {\n this.displayPlaceholder = true;\n } else {\n this.displayPlaceholder = false;\n }\n\n if (this.collapsible) {\n Observable.notify(this, 'displayValue');\n }\n }\n\n /**\n * Handle content changes on the control input.\n *\n * @param e - the input event\n * @internal\n */\n public inputHandler(e: InputEvent): boolean {\n this.filter = this.filterInput?.value ?? '';\n this.clearSelection();\n this.filterOptions();\n\n if (this.filteredOptions.length > 0) {\n const enabledOptions = this.filteredOptions.filter(\n o => !o.disabled\n );\n if (enabledOptions.length > 0) {\n enabledOptions[0]!.selected = true;\n } else {\n // only filtered option is disabled\n this.selectedOptions = [];\n this.selectedIndex = -1;\n }\n } else if (this.committedSelectedOption) {\n this.committedSelectedOption.selected = true;\n }\n\n if (e.inputType.includes('deleteContent') || !this.filter.length) {\n return true;\n }\n\n e.stopPropagation();\n return true;\n }\n\n /**\n * @internal\n */\n public override focusoutHandler(e: FocusEvent): BooleanOrVoid {\n super.focusoutHandler(e);\n if (!this.open) {\n return true;\n }\n\n const focusTarget = e.relatedTarget as HTMLElement;\n if (this.isSameNode(focusTarget)) {\n this.focus();\n return true;\n }\n\n if (!this.options?.includes(focusTarget as ListboxOption)) {\n this.open = false;\n if (this.selectedIndex === -1) {\n this.selectedIndex = this.indexWhenOpened!;\n }\n\n if (this.indexWhenOpened !== this.selectedIndex) {\n this.updateValue(true);\n }\n }\n return true;\n }\n\n /**\n * @internal\n */\n public override keydownHandler(e: KeyboardEvent): BooleanOrVoid {\n super.keydownHandler(e);\n const key = e.key;\n if (e.ctrlKey || e.shiftKey) {\n return true;\n }\n\n switch (key) {\n case keySpace: {\n // when dropdown is open allow user to enter a space for filter text\n if (this.open && this.filterMode !== FilterMode.none) {\n break;\n }\n\n e.preventDefault();\n if (this.collapsible && this.typeAheadExpired) {\n this.open = !this.open;\n }\n if (!this.open) {\n this.focus();\n }\n break;\n }\n case keyHome:\n case keyEnd: {\n e.preventDefault();\n break;\n }\n case keyEnter: {\n e.preventDefault();\n if (\n this.filteredOptions.length === 0\n || this.filteredOptions.every(o => o.disabled)\n ) {\n return false;\n }\n this.open = !this.open;\n if (!this.open) {\n this.focus();\n }\n break;\n }\n case keyEscape: {\n if (!this.open) {\n break;\n }\n if (this.collapsible && this.open) {\n e.preventDefault();\n this.open = false;\n }\n\n if (this.selectedIndex !== this.indexWhenOpened!) {\n this.options[this.selectedIndex]!.selected = false;\n this.selectedIndex = this.indexWhenOpened!;\n }\n this.focus();\n break;\n }\n case keyTab: {\n if (this.collapsible && this.open) {\n e.preventDefault();\n this.open = false;\n }\n\n return true;\n }\n\n default: {\n break;\n }\n }\n\n if (!this.open && this.indexWhenOpened !== this.selectedIndex) {\n this.updateValue(true);\n this.indexWhenOpened = this.selectedIndex;\n }\n\n return !(key === keyArrowDown || key === keyArrowUp);\n }\n\n /**\n * Updates the proxy value when the selected index changes.\n *\n * @param prev - the previous selected index\n * @param next - the next selected index\n *\n * @internal\n */\n public override selectedIndexChanged(\n _: number | undefined,\n __: number\n ): void {\n // Don't call super.selectedIndexChanged as this will disallow disabled options\n // from being valid initial selected values. Our setDefaultSelectedOption\n // implementation handles skipping non-selected disabled options for the initial\n // selected value.\n this.setSelectedOptions();\n this.updateValue();\n }\n\n /**\n * Synchronize the `aria-disabled` property when the `disabled` property changes.\n *\n * @param prev - The previous disabled value\n * @param next - The next disabled value\n *\n * @internal\n */\n public override disabledChanged(prev: boolean, next: boolean): void {\n if (super.disabledChanged) {\n super.disabledChanged(prev, next);\n }\n this.ariaDisabled = this.disabled ? 'true' : 'false';\n }\n\n /**\n * Reset the element to its first selectable option when its parent form is reset.\n *\n * @internal\n */\n public override formResetCallback(): void {\n this.setProxyOptions();\n // Call the base class's implementation setDefaultSelectedOption instead of the select's\n // override, in order to reset the selectedIndex without using the value property.\n super.setDefaultSelectedOption();\n if (this.selectedIndex === -1) {\n this.selectedIndex = 0;\n }\n }\n\n public override selectNextOption(): void {\n // don't call super.selectNextOption as that relies on side-effecty\n // behavior to not select disabled option (which no longer works)\n for (let i = this.selectedIndex + 1; i < this.options.length; i++) {\n if (!this.options[i]?.disabled) {\n this.selectedIndex = i;\n break;\n }\n }\n }\n\n public override selectPreviousOption(): void {\n // don't call super.selectPreviousOption as that relies on side-effecty\n // behavior to not select disabled option (which no longer works)\n for (let i = this.selectedIndex - 1; i >= 0; i--) {\n if (!this.options[i]?.disabled) {\n this.selectedIndex = i;\n break;\n }\n }\n }\n\n // Prevents parent classes from resetting selectedIndex to a positive\n // value while filtering, which can result in a disabled option being\n // selected.\n protected override setSelectedOptions(): void {\n if (this.open && this.selectedIndex === -1) {\n return;\n }\n\n super.setSelectedOptions();\n }\n\n protected override focusAndScrollOptionIntoView(): void {\n if (this.open) {\n super.focusAndScrollOptionIntoView();\n window.requestAnimationFrame(() => {\n this.filterInput?.focus();\n });\n }\n }\n\n protected positionChanged(\n _: SelectPosition | undefined,\n next: SelectPosition | undefined\n ): void {\n this.positionAttribute = next;\n this.setPositioning();\n }\n\n /**\n * Updates the proxy's size property when the size attribute changes.\n *\n * @param prev - the previous size\n * @param next - the current size\n *\n * @override\n * @internal\n */\n protected override sizeChanged(\n prev: number | undefined,\n next: number\n ): void {\n super.sizeChanged(prev, next);\n\n if (this.proxy) {\n this.proxy.size = next;\n }\n }\n\n protected openChanged(): void {\n if (!this.collapsible) {\n return;\n }\n\n if (this.open) {\n this.initializeOpenState();\n this.indexWhenOpened = this.selectedIndex;\n\n return;\n }\n\n this.filter = '';\n if (this.filterInput) {\n this.filterInput.value = '';\n }\n\n this.ariaControls = '';\n this.ariaExpanded = 'false';\n }\n\n /**\n * Updates the selectedness of each option when the list of selected options changes.\n *\n * @param prev - the previous list of selected options\n * @param next - the current list of selected options\n *\n * @override\n * @internal\n */\n protected override selectedOptionsChanged(\n _prev: ListboxOption[] | undefined,\n next: ListboxOption[]\n ): void {\n // don't call super.selectedOptionsChanged so we don't filter out hidden elements\n // when updating 'selected' state (copied relevant super implementation)\n this.options?.forEach((o, i) => {\n const notifier = Observable.getNotifier(o);\n notifier.unsubscribe(this, 'selected');\n o.selected = next.includes(o);\n notifier.subscribe(this, 'selected');\n const proxyOption = this.proxy?.options.item(i);\n if (proxyOption) {\n proxyOption.selected = o.selected;\n }\n });\n }\n\n /**\n * Sets the selected index to match the first option with the selected attribute, or\n * the first selectable option.\n *\n * @override\n * @internal\n */\n protected override setDefaultSelectedOption(): void {\n const options: ListboxOption[] = this.options\n ?? Array.from(this.children).filter(o => isNimbleListOption(o));\n\n const optionIsSelected = (option: ListboxOption): boolean => {\n return option.hasAttribute('selected') || option.selected;\n };\n const optionIsDisabled = (option: ListboxOption): boolean => {\n return option.hasAttribute('disabled') || option.disabled;\n };\n let selectedIndex = -1;\n let firstValidOptionIndex = -1;\n for (let i = 0; i < options?.length; i++) {\n const option = options[i];\n if (optionIsSelected(option!) || option?.value === this.value) {\n selectedIndex = i;\n }\n if (firstValidOptionIndex === -1 && !optionIsDisabled(option!)) {\n firstValidOptionIndex = i;\n }\n }\n\n if (selectedIndex !== -1) {\n this.selectedIndex = selectedIndex;\n } else if (firstValidOptionIndex !== -1) {\n this.selectedIndex = firstValidOptionIndex;\n } else {\n this.selectedIndex = 0;\n }\n this.committedSelectedOption = options[this.selectedIndex];\n }\n\n private committedSelectedOptionChanged(): void {\n this.updateDisplayValue();\n }\n\n private setPositioning(): void {\n if (!this.$fastController.isConnected) {\n // Don't call setPositioning() until we're connected,\n // since this.forcedPosition isn't initialized yet.\n return;\n }\n const currentBox = this.getBoundingClientRect();\n const viewportHeight = window.innerHeight;\n const availableBottom = viewportHeight - currentBox.bottom;\n\n if (this.forcedPosition) {\n this.position = this.positionAttribute;\n } else if (currentBox.top > availableBottom) {\n this.position = SelectPosition.above;\n } else {\n this.position = SelectPosition.below;\n }\n\n this.positionAttribute = this.forcedPosition\n ? this.positionAttribute\n : this.position;\n\n this.maxHeight = this.position === SelectPosition.above\n ? Math.trunc(currentBox.top)\n : Math.trunc(availableBottom);\n this.updateListboxMaxHeightCssVariable();\n }\n\n /**\n * Filter available options by text value.\n *\n * @public\n */\n private filterOptions(): void {\n const filter = this.filter.toLowerCase();\n\n if (filter) {\n this.filteredOptions = this.options.filter(option => {\n const normalizedFilter = diacriticInsensitiveStringNormalizer(filter);\n return (\n !option.hidden\n && diacriticInsensitiveStringNormalizer(option.text).includes(\n normalizedFilter\n )\n );\n });\n } else {\n this.filteredOptions = this.options.filter(\n option => !option.hidden\n );\n }\n\n this.options.forEach(o => {\n if (isNimbleListOption(o)) {\n if (!this.filteredOptions.includes(o)) {\n o.visuallyHidden = true;\n } else {\n o.visuallyHidden = false;\n }\n }\n });\n }\n\n /**\n * Sets the value and display value to match the first selected option.\n *\n * @param shouldEmit - if true, the input and change events will be emitted\n *\n * @internal\n */\n private updateValue(shouldEmit?: boolean): void {\n if (this.$fastController.isConnected) {\n this.value = this.firstSelectedOption?.value ?? '';\n }\n\n if (shouldEmit) {\n this.$emit('input');\n this.$emit('change', this, {\n bubbles: true,\n composed: undefined\n });\n }\n }\n\n /**\n * Resets and fills the proxy to match the component's options.\n *\n * @internal\n */\n private setProxyOptions(): void {\n if (this.proxy instanceof HTMLSelectElement && this.options) {\n this.proxy.options.length = 0;\n this.options.forEach(option => {\n const proxyOption = option.proxy\n || (option instanceof HTMLOptionElement\n ? option.cloneNode()\n : null);\n\n if (proxyOption) {\n this.proxy.options.add(proxyOption);\n }\n });\n }\n }\n\n private clearSelection(): void {\n this.options.forEach(option => {\n option.selected = false;\n });\n }\n\n private filterChanged(): void {\n this.filterOptions();\n }\n\n private maxHeightChanged(): void {\n this.updateListboxMaxHeightCssVariable();\n }\n\n private initializeOpenState(): void {\n if (!this.open) {\n this.ariaExpanded = 'false';\n this.ariaControls = '';\n return;\n }\n\n this.committedSelectedOption = this.options[this.selectedIndex];\n this.ariaControls = this.listboxId;\n this.ariaExpanded = 'true';\n\n this.setPositioning();\n this.focusAndScrollOptionIntoView();\n }\n\n private updateListboxMaxHeightCssVariable(): void {\n if (this.listbox) {\n this.listbox.style.setProperty(\n '--ni-private-select-max-height',\n `${this.maxHeight}px`\n );\n }\n }\n}\n\nconst nimbleSelect = Select.compose<SelectOptions>({\n baseName: 'select',\n baseClass: FoundationSelect,\n template,\n styles,\n indicator: arrowExpanderDown16X16.data,\n end: html<Select>`\n <${iconExclamationMarkTag}\n severity=\"error\"\n class=\"error-icon\"\n ></${iconExclamationMarkTag}>\n ${errorTextTemplate}\n `\n});\n\napplyMixins(Select, StartEnd, DelegatesARIASelect);\nDesignSystem.getOrCreate().withPrefix('nimble').register(nimbleSelect());\nexport const selectTag = 'nimble-select';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/select/index.ts"],"names":[],"mappings":";AAAA,qJAAqJ;AACrJ,OAAO,EACH,IAAI,EACJ,IAAI,EACJ,UAAU,EACV,UAAU,EACV,QAAQ,EACX,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEH,YAAY,EACZ,MAAM,IAAI,gBAAgB,EAG1B,cAAc,EACd,WAAW,EACX,QAAQ,EACR,mBAAmB,EACtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACH,YAAY,EACZ,UAAU,EACV,MAAM,EACN,QAAQ,EACR,SAAS,EACT,OAAO,EACP,QAAQ,EACR,MAAM,EACN,QAAQ,EACX,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EACH,kBAAkB,EAErB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,oCAAoC,EAAE,MAAM,wCAAwC,CAAC;AAC9F,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAYvE,MAAM,kBAAkB,GAAG,CAAC,EAAW,EAAoB,EAAE;IACzD,OAAO,EAAE,YAAY,UAAU,CAAC;AACpC,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,O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U;uDACoC;AAQ/C;IADC,UAAU;yCACU;AAQrB;IADC,QAAQ;yCAGR;AA6DD;IADC,QAAQ;0CAIR;AAitBL,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,CAAgB;IAC/C,QAAQ,EAAE,QAAQ;IAClB,SAAS,EAAE,gBAAgB;IAC3B,QAAQ;IACR,MAAM;IACN,SAAS,EAAE,sBAAsB,CAAC,IAAI;IACtC,GAAG,EAAE,IAAI,CAAQ;WACV,sBAAsB;;;aAGpB,sBAAsB;UACzB,iBAAiB;KACtB;CACJ,CAAC,CAAC;AAEH,WAAW,CAAC,MAAM,EAAE,QAAQ,EAAE,mBAAmB,CAAC,CAAC;AACnD,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC,CAAC;AACzE,MAAM,CAAC,MAAM,SAAS,GAAG,eAAe,CAAC","sourcesContent":["// Based on: https://github.com/microsoft/fast/blob/%40microsoft/fast-foundation_v2.49.5/packages/web-components/fast-foundation/src/select/select.ts\nimport {\n attr,\n html,\n observable,\n Observable,\n volatile\n} from '@microsoft/fast-element';\nimport {\n AnchoredRegion,\n DesignSystem,\n Select as FoundationSelect,\n ListboxOption,\n SelectOptions,\n SelectPosition,\n applyMixins,\n StartEnd,\n DelegatesARIASelect\n} from '@microsoft/fast-foundation';\nimport {\n keyArrowDown,\n keyArrowUp,\n keyEnd,\n keyEnter,\n keyEscape,\n keyHome,\n keySpace,\n keyTab,\n uniqueId\n} from '@microsoft/fast-web-utilities';\nimport { arrowExpanderDown16X16 } from '@ni/nimble-tokens/dist/icons/js';\nimport { styles } from './styles';\nimport {\n DropdownAppearance,\n ListOptionOwner\n} from '../patterns/dropdown/types';\nimport { errorTextTemplate } from '../patterns/error/template';\nimport type { ErrorPattern } from '../patterns/error/types';\nimport { iconExclamationMarkTag } from '../icons/exclamation-mark';\nimport { template } from './template';\nimport { ListOption } from '../list-option';\nimport { FilterMode } from './types';\nimport { diacriticInsensitiveStringNormalizer } from '../utilities/models/string-normalizers';\nimport { FormAssociatedSelect } from './models/select-form-associated';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nimble-select': Select;\n }\n}\n\n// Used in overrides of base class methods\n// eslint-disable-next-line @typescript-eslint/no-invalid-void-type\ntype BooleanOrVoid = boolean | void;\n\nconst isNimbleListOption = (el: Element): el is ListOption => {\n return el instanceof ListOption;\n};\n\n/**\n * A nimble-styled HTML select.\n */\nexport class Select\n extends FormAssociatedSelect\n implements ErrorPattern, ListOptionOwner {\n @attr\n public appearance: DropdownAppearance = DropdownAppearance.underline;\n\n /**\n * Reflects the placement for the listbox when the select is open.\n *\n * @public\n */\n @attr({ attribute: 'position' })\n public positionAttribute?: SelectPosition;\n\n /**\n * A message explaining why the value is invalid.\n *\n * @public\n * @remarks\n * HTML Attribute: error-text\n */\n @attr({ attribute: 'error-text' })\n public errorText: string | undefined;\n\n @attr({ attribute: 'error-visible', mode: 'boolean' })\n public errorVisible = false;\n\n @attr({ attribute: 'filter-mode' })\n public filterMode: FilterMode = FilterMode.none;\n\n /**\n * @internal\n */\n @observable\n public displayPlaceholder = false;\n\n /**\n * @internal\n */\n @attr({ attribute: 'open', mode: 'boolean' })\n public open = false;\n\n /**\n * Holds the current state for the calculated position of the listbox.\n *\n * @public\n */\n @observable\n public position?: SelectPosition;\n\n /**\n * The ref to the internal `.control` element.\n *\n * @internal\n */\n @observable\n public control!: HTMLElement;\n\n /**\n * Reference to the internal listbox element.\n *\n * @internal\n */\n public listbox!: HTMLDivElement;\n\n /**\n * The unique id for the internal listbox element.\n *\n * @internal\n */\n public listboxId: string = uniqueId('listbox-');\n\n /**\n * @internal\n */\n @observable\n public scrollableRegion!: HTMLElement;\n\n /**\n * @internal\n */\n @observable\n public filterInput?: HTMLInputElement;\n\n /**\n * @internal\n */\n @observable\n public anchoredRegion!: AnchoredRegion;\n\n /** @internal */\n @observable\n public hasOverflow = false;\n\n /**\n * @internal\n */\n @observable\n public filteredOptions: ListboxOption[] = [];\n\n /**\n * @internal\n */\n @observable\n public filter = '';\n\n /**\n * @internal\n */\n @observable\n public committedSelectedOption?: ListboxOption;\n\n /**\n * The max height for the listbox when opened.\n *\n * @internal\n */\n @observable\n public maxHeight = 0;\n\n /**\n * The component is collapsible when in single-selection mode with no size attribute.\n *\n * @internal\n */\n @volatile\n public get collapsible(): boolean {\n return !(this.multiple || typeof this.size === 'number');\n }\n\n private _value = '';\n private forcedPosition = false;\n private indexWhenOpened?: number;\n\n /**\n * @internal\n */\n public override connectedCallback(): void {\n super.connectedCallback();\n this.forcedPosition = !!this.positionAttribute;\n this.initializeOpenState();\n }\n\n public override get value(): string {\n Observable.track(this, 'value');\n return this._value;\n }\n\n public override set value(next: string) {\n const prev = this._value;\n let newValue = next;\n\n if (this.options?.length) {\n const newValueIndex = this.options.findIndex(\n el => el.value === newValue\n );\n const prevSelectedValue = this.options[this.selectedIndex]?.value ?? null;\n const nextSelectedValue = this.options[newValueIndex]?.value ?? null;\n\n if (\n newValueIndex === -1\n || prevSelectedValue !== nextSelectedValue\n ) {\n newValue = '';\n this.selectedIndex = newValueIndex;\n }\n\n newValue = this.firstSelectedOption?.value ?? newValue;\n }\n\n if (prev !== newValue && !(this.open && this.selectedIndex < 0)) {\n this._value = newValue;\n super.valueChanged(prev, newValue);\n if (!this.open) {\n this.committedSelectedOption = this.options.find(\n o => o.value === newValue\n );\n }\n Observable.notify(this, 'value');\n if (this.collapsible) {\n Observable.notify(this, 'displayValue');\n }\n }\n }\n\n /**\n * @internal\n */\n @volatile\n public get displayValue(): string {\n Observable.track(this, 'displayValue');\n return this.committedSelectedOption?.text ?? '';\n }\n\n /**\n * @internal\n */\n public anchoredRegionChanged(\n _prev: AnchoredRegion | undefined,\n _next: AnchoredRegion | undefined\n ): void {\n if (this.anchoredRegion && this.control) {\n this.anchoredRegion.anchorElement = this.control;\n }\n }\n\n /**\n * @internal\n */\n public controlChanged(\n _prev: HTMLElement | undefined,\n _next: HTMLElement | undefined\n ): void {\n if (this.anchoredRegion && this.control) {\n this.anchoredRegion.anchorElement = this.control;\n }\n }\n\n /**\n * @internal\n */\n public override slottedOptionsChanged(\n prev: Element[],\n next: Element[]\n ): void {\n const value = this.value;\n this.options.forEach(o => {\n const notifier = Observable.getNotifier(o);\n notifier.unsubscribe(this, 'value');\n notifier.unsubscribe(this, 'hidden');\n notifier.unsubscribe(this, 'disabled');\n });\n\n super.slottedOptionsChanged(prev, next);\n\n this.options.forEach(o => {\n const notifier = Observable.getNotifier(o);\n notifier.subscribe(this, 'value');\n notifier.subscribe(this, 'hidden');\n notifier.subscribe(this, 'disabled');\n });\n this.setProxyOptions();\n this.updateValue();\n // We need to force an update to the filteredOptions observable\n // (by calling 'filterOptions()) so that the template correctly updates.\n this.filterOptions();\n if (value) {\n this.value = value;\n }\n this.committedSelectedOption = this.options[this.selectedIndex];\n }\n\n /**\n * @internal\n */\n public override clickHandler(e: MouseEvent): BooleanOrVoid {\n // do nothing if the select is disabled\n if (this.disabled) {\n return;\n }\n\n if (this.open) {\n const captured = (e.target as HTMLElement).closest<ListOption>(\n 'option,[role=option]'\n );\n\n if (captured?.disabled) {\n return;\n }\n }\n\n super.clickHandler(e);\n\n this.open = this.collapsible && !this.open;\n\n if (!this.open && this.indexWhenOpened !== this.selectedIndex) {\n this.updateValue(true);\n }\n }\n\n /**\n * Updates the value when an option's value changes.\n *\n * @param source - the source object\n * @param propertyName - the property to evaluate\n *\n * @internal\n * @override\n */\n public override handleChange(source: unknown, propertyName: string): void {\n // don't call super.handleChange so hidden options can be selected programmatically\n const sourceElement = source as Element;\n switch (propertyName) {\n case 'value': {\n this.updateValue();\n break;\n }\n case 'selected': {\n if (isNimbleListOption(sourceElement)) {\n this.selectedIndex = this.options.indexOf(sourceElement);\n }\n this.setSelectedOptions();\n this.updateDisplayValue();\n break;\n }\n case 'hidden': {\n if (isNimbleListOption(sourceElement)) {\n sourceElement.visuallyHidden = sourceElement.hidden;\n }\n this.updateDisplayValue();\n break;\n }\n case 'disabled': {\n this.updateDisplayValue();\n break;\n }\n default:\n break;\n }\n }\n\n /**\n * Prevents focus when size is set and a scrollbar is clicked.\n *\n * @param e - the mouse event object\n *\n * @override\n * @internal\n */\n public override mousedownHandler(e: MouseEvent): BooleanOrVoid {\n if (e.offsetX >= 0 && e.offsetX <= this.listbox?.scrollWidth) {\n return super.mousedownHandler(e);\n }\n\n return this.collapsible;\n }\n\n /**\n * @internal\n */\n public regionLoadedHandler(): void {\n this.focusAndScrollOptionIntoView();\n }\n\n /**\n * Sets the multiple property on the proxy element.\n *\n * @param prev - the previous multiple value\n * @param next - the current multiple value\n */\n public override multipleChanged(\n prev: boolean | undefined,\n next: boolean\n ): void {\n super.multipleChanged(prev, next);\n\n if (this.proxy) {\n this.proxy.multiple = next;\n }\n }\n\n /**\n * @internal\n */\n public inputClickHandler(e: MouseEvent): void {\n e.stopPropagation(); // clicking in filter input shouldn't close dropdown\n }\n\n /**\n * @internal\n */\n public changeValueHandler(): void {\n this.committedSelectedOption = this.options.find(\n option => option.selected\n );\n }\n\n /**\n * @internal\n */\n public updateDisplayValue(): void {\n if (\n this.committedSelectedOption?.disabled\n && this.committedSelectedOption?.hidden\n && this.committedSelectedOption?.selected\n ) {\n this.displayPlaceholder = true;\n } else {\n this.displayPlaceholder = false;\n }\n\n if (this.collapsible) {\n Observable.notify(this, 'displayValue');\n }\n }\n\n /**\n * Handle content changes on the control input.\n *\n * @param e - the input event\n * @internal\n */\n public inputHandler(e: InputEvent): boolean {\n this.filter = this.filterInput?.value ?? '';\n this.clearSelection();\n this.filterOptions();\n\n if (this.filteredOptions.length > 0) {\n const enabledOptions = this.filteredOptions.filter(\n o => !o.disabled\n );\n if (enabledOptions.length > 0) {\n enabledOptions[0]!.selected = true;\n } else {\n // only filtered option is disabled\n this.selectedOptions = [];\n this.selectedIndex = -1;\n }\n } else if (this.committedSelectedOption) {\n this.committedSelectedOption.selected = true;\n }\n\n if (e.inputType.includes('deleteContent') || !this.filter.length) {\n return true;\n }\n\n e.stopPropagation();\n return true;\n }\n\n /**\n * @internal\n */\n public override focusoutHandler(e: FocusEvent): BooleanOrVoid {\n super.focusoutHandler(e);\n if (!this.open) {\n return true;\n }\n\n const focusTarget = e.relatedTarget as HTMLElement;\n if (this.isSameNode(focusTarget)) {\n this.focus();\n return true;\n }\n\n if (!this.options?.includes(focusTarget as ListboxOption)) {\n this.open = false;\n if (this.selectedIndex === -1) {\n this.selectedIndex = this.indexWhenOpened!;\n }\n\n if (this.indexWhenOpened !== this.selectedIndex) {\n this.updateValue(true);\n }\n }\n return true;\n }\n\n /**\n * @internal\n */\n public override keydownHandler(e: KeyboardEvent): BooleanOrVoid {\n super.keydownHandler(e);\n const key = e.key;\n if (e.ctrlKey || e.shiftKey) {\n return true;\n }\n\n switch (key) {\n case keySpace: {\n // when dropdown is open allow user to enter a space for filter text\n if (this.open && this.filterMode !== FilterMode.none) {\n break;\n }\n\n e.preventDefault();\n if (this.collapsible && this.typeAheadExpired) {\n this.open = !this.open;\n }\n if (!this.open) {\n this.focus();\n }\n break;\n }\n case keyHome:\n case keyEnd: {\n e.preventDefault();\n break;\n }\n case keyEnter: {\n e.preventDefault();\n if (\n this.filteredOptions.length === 0\n || this.filteredOptions.every(o => o.disabled)\n ) {\n return false;\n }\n this.open = !this.open;\n if (!this.open) {\n this.focus();\n }\n break;\n }\n case keyEscape: {\n if (!this.open) {\n break;\n }\n if (this.collapsible && this.open) {\n e.preventDefault();\n this.open = false;\n }\n\n if (this.selectedIndex !== this.indexWhenOpened!) {\n this.options[this.selectedIndex]!.selected = false;\n this.selectedIndex = this.indexWhenOpened!;\n }\n this.focus();\n break;\n }\n case keyTab: {\n if (this.collapsible && this.open) {\n e.preventDefault();\n this.open = false;\n }\n\n return true;\n }\n\n default: {\n break;\n }\n }\n\n if (!this.open && this.indexWhenOpened !== this.selectedIndex) {\n this.updateValue(true);\n this.indexWhenOpened = this.selectedIndex;\n }\n\n return !(key === keyArrowDown || key === keyArrowUp);\n }\n\n /**\n * Updates the proxy value when the selected index changes.\n *\n * @param prev - the previous selected index\n * @param next - the next selected index\n *\n * @internal\n */\n public override selectedIndexChanged(\n _: number | undefined,\n __: number\n ): void {\n // Don't call super.selectedIndexChanged as this will disallow disabled options\n // from being valid initial selected values. Our setDefaultSelectedOption\n // implementation handles skipping non-selected disabled options for the initial\n // selected value.\n this.setSelectedOptions();\n this.updateValue();\n }\n\n /**\n * Synchronize the `aria-disabled` property when the `disabled` property changes.\n *\n * @param prev - The previous disabled value\n * @param next - The next disabled value\n *\n * @internal\n */\n public override disabledChanged(prev: boolean, next: boolean): void {\n if (super.disabledChanged) {\n super.disabledChanged(prev, next);\n }\n this.ariaDisabled = this.disabled ? 'true' : 'false';\n }\n\n /**\n * Reset the element to its first selectable option when its parent form is reset.\n *\n * @internal\n */\n public override formResetCallback(): void {\n this.setProxyOptions();\n // Call the base class's implementation setDefaultSelectedOption instead of the select's\n // override, in order to reset the selectedIndex without using the value property.\n super.setDefaultSelectedOption();\n if (this.selectedIndex === -1) {\n this.selectedIndex = 0;\n }\n }\n\n public override selectNextOption(): void {\n // don't call super.selectNextOption as that relies on side-effecty\n // behavior to not select disabled option (which no longer works)\n for (let i = this.selectedIndex + 1; i < this.options.length; i++) {\n if (!this.options[i]?.disabled) {\n this.selectedIndex = i;\n break;\n }\n }\n }\n\n public override selectPreviousOption(): void {\n // don't call super.selectPreviousOption as that relies on side-effecty\n // behavior to not select disabled option (which no longer works)\n for (let i = this.selectedIndex - 1; i >= 0; i--) {\n if (!this.options[i]?.disabled) {\n this.selectedIndex = i;\n break;\n }\n }\n }\n\n /**\n * @internal\n */\n public registerOption(option: ListOption): void {\n if (this.options.includes(option)) {\n return;\n }\n\n // Adding an option to the end, ultimately, isn't the correct\n // thing to do, as this will mean the option's index in the options,\n // at least temporarily, does not match the DOM order. However, it\n // is expected that a successive run of `slottedOptionsChanged` will\n // correct this order issue. See 'https://github.com/ni/nimble/issues/1915'\n // for more info.\n this.options.push(option);\n }\n\n // Prevents parent classes from resetting selectedIndex to a positive\n // value while filtering, which can result in a disabled option being\n // selected.\n protected override setSelectedOptions(): void {\n if (this.open && this.selectedIndex === -1) {\n return;\n }\n\n super.setSelectedOptions();\n }\n\n protected override focusAndScrollOptionIntoView(): void {\n if (this.open) {\n super.focusAndScrollOptionIntoView();\n window.requestAnimationFrame(() => {\n this.filterInput?.focus();\n });\n }\n }\n\n protected positionChanged(\n _: SelectPosition | undefined,\n next: SelectPosition | undefined\n ): void {\n this.positionAttribute = next;\n this.setPositioning();\n }\n\n /**\n * Updates the proxy's size property when the size attribute changes.\n *\n * @param prev - the previous size\n * @param next - the current size\n *\n * @override\n * @internal\n */\n protected override sizeChanged(\n prev: number | undefined,\n next: number\n ): void {\n super.sizeChanged(prev, next);\n\n if (this.proxy) {\n this.proxy.size = next;\n }\n }\n\n protected openChanged(): void {\n if (!this.collapsible) {\n return;\n }\n\n if (this.open) {\n this.initializeOpenState();\n this.indexWhenOpened = this.selectedIndex;\n\n return;\n }\n\n this.filter = '';\n if (this.filterInput) {\n this.filterInput.value = '';\n }\n\n this.ariaControls = '';\n this.ariaExpanded = 'false';\n }\n\n /**\n * Updates the selectedness of each option when the list of selected options changes.\n *\n * @param prev - the previous list of selected options\n * @param next - the current list of selected options\n *\n * @override\n * @internal\n */\n protected override selectedOptionsChanged(\n _prev: ListboxOption[] | undefined,\n next: ListboxOption[]\n ): void {\n // don't call super.selectedOptionsChanged so we don't filter out hidden elements\n // when updating 'selected' state (copied relevant super implementation)\n this.options?.forEach((o, i) => {\n const notifier = Observable.getNotifier(o);\n notifier.unsubscribe(this, 'selected');\n o.selected = next.includes(o);\n notifier.subscribe(this, 'selected');\n const proxyOption = this.proxy?.options.item(i);\n if (proxyOption) {\n proxyOption.selected = o.selected;\n }\n });\n }\n\n /**\n * Sets the selected index to match the first option with the selected attribute, or\n * the first selectable option.\n *\n * @override\n * @internal\n */\n protected override setDefaultSelectedOption(): void {\n const options: ListboxOption[] = this.options\n ?? Array.from(this.children).filter(o => isNimbleListOption(o));\n\n const optionIsSelected = (option: ListboxOption): boolean => {\n return option.hasAttribute('selected') || option.selected;\n };\n const optionIsDisabled = (option: ListboxOption): boolean => {\n return option.hasAttribute('disabled') || option.disabled;\n };\n let selectedIndex = -1;\n let firstValidOptionIndex = -1;\n for (let i = 0; i < options?.length; i++) {\n const option = options[i];\n if (optionIsSelected(option!) || option?.value === this.value) {\n selectedIndex = i;\n }\n if (firstValidOptionIndex === -1 && !optionIsDisabled(option!)) {\n firstValidOptionIndex = i;\n }\n }\n\n if (selectedIndex !== -1) {\n this.selectedIndex = selectedIndex;\n } else if (firstValidOptionIndex !== -1) {\n this.selectedIndex = firstValidOptionIndex;\n } else {\n this.selectedIndex = 0;\n }\n this.committedSelectedOption = options[this.selectedIndex];\n }\n\n private committedSelectedOptionChanged(): void {\n this.updateDisplayValue();\n }\n\n private setPositioning(): void {\n if (!this.$fastController.isConnected) {\n // Don't call setPositioning() until we're connected,\n // since this.forcedPosition isn't initialized yet.\n return;\n }\n const currentBox = this.getBoundingClientRect();\n const viewportHeight = window.innerHeight;\n const availableBottom = viewportHeight - currentBox.bottom;\n\n if (this.forcedPosition) {\n this.position = this.positionAttribute;\n } else if (currentBox.top > availableBottom) {\n this.position = SelectPosition.above;\n } else {\n this.position = SelectPosition.below;\n }\n\n this.positionAttribute = this.forcedPosition\n ? this.positionAttribute\n : this.position;\n\n this.maxHeight = this.position === SelectPosition.above\n ? Math.trunc(currentBox.top)\n : Math.trunc(availableBottom);\n this.updateListboxMaxHeightCssVariable();\n }\n\n /**\n * Filter available options by text value.\n *\n * @public\n */\n private filterOptions(): void {\n const filter = this.filter.toLowerCase();\n\n if (filter) {\n this.filteredOptions = this.options.filter(option => {\n const normalizedFilter = diacriticInsensitiveStringNormalizer(filter);\n return (\n !option.hidden\n && diacriticInsensitiveStringNormalizer(option.text).includes(\n normalizedFilter\n )\n );\n });\n } else {\n this.filteredOptions = this.options.filter(\n option => !option.hidden\n );\n }\n\n this.options.forEach(o => {\n if (isNimbleListOption(o)) {\n if (!this.filteredOptions.includes(o)) {\n o.visuallyHidden = true;\n } else {\n o.visuallyHidden = false;\n }\n }\n });\n }\n\n /**\n * Sets the value and display value to match the first selected option.\n *\n * @param shouldEmit - if true, the input and change events will be emitted\n *\n * @internal\n */\n private updateValue(shouldEmit?: boolean): void {\n if (this.$fastController.isConnected) {\n this.value = this.firstSelectedOption?.value ?? '';\n }\n\n if (shouldEmit) {\n this.$emit('input');\n this.$emit('change', this, {\n bubbles: true,\n composed: undefined\n });\n }\n }\n\n /**\n * Resets and fills the proxy to match the component's options.\n *\n * @internal\n */\n private setProxyOptions(): void {\n if (this.proxy instanceof HTMLSelectElement && this.options) {\n this.proxy.options.length = 0;\n this.options.forEach(option => {\n const proxyOption = option.proxy\n || (option instanceof HTMLOptionElement\n ? option.cloneNode()\n : null);\n\n if (proxyOption) {\n this.proxy.options.add(proxyOption);\n }\n });\n }\n }\n\n private clearSelection(): void {\n this.options.forEach(option => {\n option.selected = false;\n });\n }\n\n private filterChanged(): void {\n this.filterOptions();\n }\n\n private maxHeightChanged(): void {\n this.updateListboxMaxHeightCssVariable();\n }\n\n private initializeOpenState(): void {\n if (!this.open) {\n this.ariaExpanded = 'false';\n this.ariaControls = '';\n return;\n }\n\n this.committedSelectedOption = this.options[this.selectedIndex];\n this.ariaControls = this.listboxId;\n this.ariaExpanded = 'true';\n\n this.setPositioning();\n this.focusAndScrollOptionIntoView();\n }\n\n private updateListboxMaxHeightCssVariable(): void {\n if (this.listbox) {\n this.listbox.style.setProperty(\n '--ni-private-select-max-height',\n `${this.maxHeight}px`\n );\n }\n }\n}\n\nconst nimbleSelect = Select.compose<SelectOptions>({\n baseName: 'select',\n baseClass: FoundationSelect,\n template,\n styles,\n indicator: arrowExpanderDown16X16.data,\n end: html<Select>`\n <${iconExclamationMarkTag}\n severity=\"error\"\n class=\"error-icon\"\n ></${iconExclamationMarkTag}>\n ${errorTextTemplate}\n `\n});\n\napplyMixins(Select, StartEnd, DelegatesARIASelect);\nDesignSystem.getOrCreate().withPrefix('nimble').register(nimbleSelect());\nexport const selectTag = 'nimble-select';\n"]}
@@ -15,7 +15,7 @@ export declare class SelectPageObject {
15
15
  /**
16
16
  * Either opens or closes the dropdown depending on its current state
17
17
  */
18
- clickSelect(): Promise<void>;
18
+ clickSelect(): void;
19
19
  clickSelectedItem(): void;
20
20
  clickFilterInput(): Promise<void>;
21
21
  clickOption(index: number): void;
@@ -23,7 +23,7 @@ export declare class SelectPageObject {
23
23
  * Click the option with the text provided by the 'displayText' parameter.
24
24
  * @param value The text of the option to be selected
25
25
  */
26
- clickOptionWithDisplayText(displayText: string): Promise<void>;
26
+ clickOptionWithDisplayText(displayText: string): void;
27
27
  clickAway(): Promise<void>;
28
28
  pressEnterKey(): void;
29
29
  pressEscapeKey(): void;
@@ -13,7 +13,7 @@ export class SelectPageObject {
13
13
  if (this.selectElement.filterMode === FilterMode.none) {
14
14
  throw new Error('Can not set filter text with filterMode set to "none".');
15
15
  }
16
- await this.clickSelect();
16
+ this.clickSelect();
17
17
  const filterInput = this.getFilterInput();
18
18
  if (filterInput) {
19
19
  filterInput.value = filterText;
@@ -43,9 +43,8 @@ export class SelectPageObject {
43
43
  /**
44
44
  * Either opens or closes the dropdown depending on its current state
45
45
  */
46
- async clickSelect() {
46
+ clickSelect() {
47
47
  this.selectElement.click();
48
- await waitForUpdatesAsync();
49
48
  }
50
49
  clickSelectedItem() {
51
50
  if (!this.selectElement.open) {
@@ -72,9 +71,9 @@ export class SelectPageObject {
72
71
  * Click the option with the text provided by the 'displayText' parameter.
73
72
  * @param value The text of the option to be selected
74
73
  */
75
- async clickOptionWithDisplayText(displayText) {
74
+ clickOptionWithDisplayText(displayText) {
76
75
  if (!this.selectElement.open) {
77
- await this.clickSelect();
76
+ this.clickSelect();
78
77
  }
79
78
  const optionIndex = this.selectElement.options.findIndex(o => o.text === displayText);
80
79
  if (optionIndex === -1) {