@digital-realty/ix-filter-select 1.2.1 → 1.2.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.
@@ -40,9 +40,28 @@ export declare class IxFilterSelect extends filterSelectBaseClass {
40
40
  isViewMoreButtonVisible: boolean;
41
41
  isViewMoreButtonLoading: boolean;
42
42
  viewMoreButtonLabel: string;
43
+ placeholder?: string;
44
+ /**
45
+ * Used to prevent IxFilterSelect from opening the menu. This is useful
46
+ * when options are yet to be provided via an async process.
47
+ */
48
+ disableMenu: boolean;
49
+ /**
50
+ * Optional property to control how the options are filtered based on value in the field.
51
+ * If not provided, defaults to case-insensitive substring match on the label.
52
+ */
53
+ filterFunctionGenerator?: (filterValue: string) => (option: IFilterSelectOption) => boolean;
54
+ /**
55
+ * Exposed method to open and close the menu
56
+ */
57
+ setMenuOpen: (value: boolean) => void;
43
58
  private filteredOptions;
44
59
  selectedItem: IFilterSelectOption | undefined;
45
60
  private filterValue;
61
+ /**
62
+ * When set, either opens or closes the menu on the next render.
63
+ * Also reflects when menu is opened from IxMenu.
64
+ */
46
65
  private menuOpen;
47
66
  /**
48
67
  * Returns true when the text field has been interacted with. Native
@@ -67,7 +86,8 @@ export declare class IxFilterSelect extends filterSelectBaseClass {
67
86
  protected updated(changedProperties: PropertyValues): void;
68
87
  handleMenuOpening: () => void;
69
88
  menuOpened: () => void;
70
- setMenuPosition: () => void;
89
+ setMenuStyles: () => void;
90
+ showMenu: () => void;
71
91
  handleMenuClosed: () => void;
72
92
  handleInput: (e: InputEvent) => void;
73
93
  selectItem: (item: IFilterSelectOption | undefined) => void;
@@ -2,13 +2,14 @@ import { __decorate } from "tslib";
2
2
  import { html, LitElement, nothing } from 'lit';
3
3
  import { property, query, state } from 'lit/decorators.js';
4
4
  import { classMap } from 'lit/directives/class-map.js';
5
+ import { repeat } from 'lit/directives/repeat.js';
6
+ import { ifDefined } from 'lit-html/directives/if-defined.js';
5
7
  import { requestUpdateOnAriaChange } from '@material/web/internal/aria/delegate.js';
6
8
  import '@digital-realty/ix-field/ix-field.js';
7
9
  import '@digital-realty/ix-menu/ix-menu.js';
8
10
  import '@digital-realty/ix-menu/ix-menu-item.js';
9
11
  import '@digital-realty/ix-icon-button/ix-icon-button.js';
10
12
  import '@digital-realty/ix-button';
11
- import { repeat } from 'lit/directives/repeat.js';
12
13
  import { mixinOnReportValidity, onReportValidity, } from '@material/web/labs/behaviors/on-report-validity.js';
13
14
  import { createValidator, getValidityAnchor, mixinConstraintValidation, } from '@material/web/labs/behaviors/constraint-validation.js';
14
15
  import { getFormValue, mixinFormAssociated, } from '@material/web/labs/behaviors/form-associated.js';
@@ -31,9 +32,24 @@ export class IxFilterSelect extends filterSelectBaseClass {
31
32
  this.isViewMoreButtonVisible = false;
32
33
  this.isViewMoreButtonLoading = false;
33
34
  this.viewMoreButtonLabel = 'View More';
35
+ /**
36
+ * Used to prevent IxFilterSelect from opening the menu. This is useful
37
+ * when options are yet to be provided via an async process.
38
+ */
39
+ this.disableMenu = false;
40
+ /**
41
+ * Exposed method to open and close the menu
42
+ */
43
+ this.setMenuOpen = (value) => {
44
+ this.menuOpen = value;
45
+ };
34
46
  this.filteredOptions = [];
35
47
  this.selectedItem = undefined;
36
48
  this.filterValue = '';
49
+ /**
50
+ * When set, either opens or closes the menu on the next render.
51
+ * Also reflects when menu is opened from IxMenu.
52
+ */
37
53
  this.menuOpen = false;
38
54
  /**
39
55
  * Returns true when the text field has been interacted with. Native
@@ -54,21 +70,22 @@ export class IxFilterSelect extends filterSelectBaseClass {
54
70
  this.handleMenuOpening = () => {
55
71
  this.menuOpening = true;
56
72
  this.menuOpen = true;
57
- this.setMenuPosition();
58
73
  };
59
74
  this.menuOpened = () => {
60
- this.setMenuPosition();
61
75
  this.menuOpening = false;
62
76
  };
63
- this.setMenuPosition = () => {
77
+ this.setMenuStyles = () => {
64
78
  var _a, _b;
65
79
  const innerMenu = (_b = (_a = this.menu) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('.menu');
66
80
  if (innerMenu) {
67
81
  innerMenu.style.width = '100%';
68
82
  innerMenu.style.height = 'auto';
69
- innerMenu.style.insetBlockStart = this.supportingText ? '-1rem' : '0';
70
83
  }
71
84
  };
85
+ this.showMenu = () => {
86
+ this.menu.show();
87
+ this.setMenuStyles();
88
+ };
72
89
  this.handleMenuClosed = () => {
73
90
  this.menuOpening = false;
74
91
  this.menuOpen = false;
@@ -87,7 +104,7 @@ export class IxFilterSelect extends filterSelectBaseClass {
87
104
  this.filterValue = item.label;
88
105
  this.filteredOptions = this.options;
89
106
  if (this.menuOpen || this.menuOpening) {
90
- this.menu.close();
107
+ this.menuOpen = false;
91
108
  }
92
109
  this.dispatchEvent(new CustomEvent('select-filter-select', {
93
110
  detail: { value: item.value, label: item.label },
@@ -100,12 +117,10 @@ export class IxFilterSelect extends filterSelectBaseClass {
100
117
  e.stopPropagation();
101
118
  if (!this.menu.open) {
102
119
  this.filterOptions();
103
- this.menu.show();
104
- this.menuOpening = true;
105
- this.setMenuPosition();
120
+ this.menuOpen = true;
106
121
  }
107
122
  else {
108
- this.menu.close();
123
+ this.menuOpen = false;
109
124
  }
110
125
  };
111
126
  }
@@ -150,15 +165,33 @@ export class IxFilterSelect extends filterSelectBaseClass {
150
165
  this.selectItem(item);
151
166
  }
152
167
  }
153
- this.setMenuPosition();
168
+ if (changedProperties.has('menuOpen')) {
169
+ if (this.menuOpen) {
170
+ if (this.disableMenu) {
171
+ // We need to update menuOpen to false if we are not showing the menu
172
+ // This will trigger a re-render with menuOpen as false which is what will actually close the menu
173
+ this.menuOpen = false;
174
+ }
175
+ else {
176
+ this.showMenu();
177
+ }
178
+ }
179
+ else {
180
+ this.menu.close();
181
+ }
182
+ }
154
183
  }
155
184
  filterOptions() {
156
185
  const filterValue = this.filterValue.trim().toLowerCase() ||
157
186
  this.value.trim().toLocaleLowerCase();
158
187
  if (!filterValue) {
159
188
  this.filteredOptions = this.options;
189
+ return;
160
190
  }
161
- this.filteredOptions = this.options.filter(item => item.label.toLowerCase().includes(filterValue));
191
+ const filterFunction = this.filterFunctionGenerator
192
+ ? this.filterFunctionGenerator(filterValue)
193
+ : (item) => item.label.toLowerCase().includes(filterValue);
194
+ this.filteredOptions = this.options.filter(filterFunction);
162
195
  }
163
196
  clear() {
164
197
  this.value = '';
@@ -221,9 +254,7 @@ export class IxFilterSelect extends filterSelectBaseClass {
221
254
  if (this.menuOpen || this.menuOpening)
222
255
  return;
223
256
  if (this.focused) {
224
- this.menu.show();
225
- this.menuOpening = true;
226
- this.setMenuPosition();
257
+ this.menuOpen = true;
227
258
  }
228
259
  }
229
260
  focus() {
@@ -281,6 +312,7 @@ export class IxFilterSelect extends filterSelectBaseClass {
281
312
  @focus=${this.handleFocusChange}
282
313
  @blur=${this.handleFocusChange}
283
314
  autocomplete="off"
315
+ placeholder=${ifDefined(this.placeholder)}
284
316
  />
285
317
  <slot name="end" slot="end">
286
318
  ${this.value.length
@@ -306,6 +338,11 @@ export class IxFilterSelect extends filterSelectBaseClass {
306
338
  @closed=${this.handleMenuClosed}
307
339
  default-focus="none"
308
340
  skip-restore-focus
341
+ anchor-corner="start-start"
342
+ surface-corner="start-start"
343
+ y-offset=${this.supportingText
344
+ ? -parseFloat(getComputedStyle(document.documentElement).fontSize)
345
+ : 0}
309
346
  >
310
347
  ${((_a = this.filteredOptions) === null || _a === void 0 ? void 0 : _a.length)
311
348
  ? repeat(this.filteredOptions, (item, index) => `${item.value}-${index}`, item => html `<ix-menu-item
@@ -386,6 +423,15 @@ __decorate([
386
423
  __decorate([
387
424
  property({ type: String })
388
425
  ], IxFilterSelect.prototype, "viewMoreButtonLabel", void 0);
426
+ __decorate([
427
+ property({ type: String })
428
+ ], IxFilterSelect.prototype, "placeholder", void 0);
429
+ __decorate([
430
+ property({ type: Boolean })
431
+ ], IxFilterSelect.prototype, "disableMenu", void 0);
432
+ __decorate([
433
+ property()
434
+ ], IxFilterSelect.prototype, "filterFunctionGenerator", void 0);
389
435
  __decorate([
390
436
  state()
391
437
  ], IxFilterSelect.prototype, "filteredOptions", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"IxFilterSelect.js","sourceRoot":"","sources":["../src/IxFilterSelect.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,sCAAsC,CAAC;AAC9C,OAAO,oCAAoC,CAAC;AAC5C,OAAO,yCAAyC,CAAC;AACjD,OAAO,kDAAkD,CAAC;AAC1D,OAAO,2BAA2B,CAAC;AAGnC,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EACL,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,yBAAyB,GAC1B,MAAM,uDAAuD,CAAC;AAC/D,OAAO,EACL,YAAY,EACZ,mBAAmB,GACpB,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAC;AAC1F,OAAO,EAAE,kBAAkB,EAAE,MAAM,iEAAiE,CAAC;AAErG,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAOpE,MAAM,qBAAqB,GAAG,qBAAqB,CACjD,yBAAyB,CACvB,mBAAmB,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC,CACvD,CACF,CAAC;AAEF,MAAM,OAAO,cAAe,SAAQ,qBAAqB;IAAzD;;QAsB6B,YAAO,GAA0B,EAAE,CAAC;QAEnC,UAAK,GAAW,EAAE,CAAC;QAEnB,UAAK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BAAiB,EAAE,CAAC;yDAC1C;AAE6B;IAA3C,QAAQ,CAAC,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC;sDAAqB;AAEpB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;6CAAe;AAEf;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;gDAAc;AAEZ;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;gDAAkB;AAE/B;IAA7B,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;6DAA4B;AAE5B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;+DAAiC;AAEhC;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;+DAAiC;AAEjC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2DAAmC;AAErD;IAAR,KAAK,EAAE;uDAAqD;AAEpD;IAAR,KAAK,EAAE;oDAAkE;AAEjE;IAAR,KAAK,EAAE;mDAA0B;AAEzB;IAAR,KAAK,EAAE;gDAA0B;AAMzB;IAAR,KAAK,EAAE;6CAAuB;AAEtB;IAAR,KAAK,EAAE;+CAAyB;AAKxB;IAAR,KAAK,EAAE;mDAA6B;AAM5B;IAAR,KAAK,EAAE;uDAA8B;AAE7B;IAAR,KAAK,EAAE;mDAA6B","sourcesContent":["import { html, LitElement, nothing, PropertyValues } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { requestUpdateOnAriaChange } from '@material/web/internal/aria/delegate.js';\nimport '@digital-realty/ix-field/ix-field.js';\nimport '@digital-realty/ix-menu/ix-menu.js';\nimport '@digital-realty/ix-menu/ix-menu-item.js';\nimport '@digital-realty/ix-icon-button/ix-icon-button.js';\nimport '@digital-realty/ix-button';\nimport { IxMenu } from '@digital-realty/ix-menu';\nimport { IxField } from '@digital-realty/ix-field';\nimport { repeat } from 'lit/directives/repeat.js';\nimport {\n mixinOnReportValidity,\n onReportValidity,\n} from '@material/web/labs/behaviors/on-report-validity.js';\nimport {\n createValidator,\n getValidityAnchor,\n mixinConstraintValidation,\n} from '@material/web/labs/behaviors/constraint-validation.js';\nimport {\n getFormValue,\n mixinFormAssociated,\n} from '@material/web/labs/behaviors/form-associated.js';\nimport { mixinElementInternals } from '@material/web/labs/behaviors/element-internals.js';\nimport { TextFieldValidator } from '@material/web/labs/behaviors/validators/text-field-validator.js';\nimport { Validator } from '@material/web/labs/behaviors/validators/validator.js';\nimport { IxFilterSelectStyles } from './ix-filter-select-styles.js';\n\nexport interface IFilterSelectOption {\n value: string;\n label: string;\n}\n\nconst filterSelectBaseClass = mixinOnReportValidity(\n mixinConstraintValidation(\n mixinFormAssociated(mixinElementInternals(LitElement))\n )\n);\n\nexport class IxFilterSelect extends filterSelectBaseClass {\n static get styles() {\n return [IxFilterSelectStyles];\n }\n\n static {\n requestUpdateOnAriaChange(IxFilterSelect);\n }\n\n /** @nocollapse */\n static shadowRootOptions = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n };\n\n @query('ix-menu') menu!: IxMenu;\n\n @query('input')\n readonly input!: HTMLInputElement;\n\n @query('.field') private readonly field!: IxField | null;\n\n @property({ type: Array }) options: IFilterSelectOption[] = [];\n\n @property({ type: String }) value: string = '';\n\n @property({ type: String }) label = '';\n\n @property({ type: String, attribute: 'error-text' }) errorText =\n 'Invalid error text';\n\n @property({ type: String, attribute: 'no-options-text' }) noFilteredOptions =\n 'No options';\n\n @property({ attribute: 'supporting-text' }) supportingText = '';\n\n @property({ type: Boolean, reflect: true }) error = false;\n\n @property({ type: Number, reflect: true }) tabIndex = 0;\n\n @property({ type: Boolean, reflect: true }) required = false;\n\n @property({ type: Function }) onViewMoreButtonClick: any;\n\n @property({ type: Boolean }) isViewMoreButtonVisible = false;\n\n @property({ type: Boolean }) isViewMoreButtonLoading = false;\n\n @property({ type: String }) viewMoreButtonLabel = 'View More';\n\n @state() private filteredOptions: IFilterSelectOption[] = [];\n\n @state() public selectedItem: IFilterSelectOption | undefined = undefined;\n\n @state() private filterValue = '';\n\n @state() private menuOpen = false;\n\n /**\n * Returns true when the text field has been interacted with. Native\n * validation errors only display in response to user interactions.\n */\n @state() private dirty = false;\n\n @state() private focused = false;\n\n /**\n * Whether or not a native error has been reported via `reportValidity()`.\n */\n @state() private nativeError = false;\n\n /**\n * The validation message displayed from a native error via\n * `reportValidity()`.\n */\n @state() private nativeErrorText = '';\n\n @state() private menuOpening = false;\n\n private get hasError() {\n return !this.dirty && (this.error || this.nativeError);\n }\n\n private getErrorText() {\n return this.error ? this.errorText : this.nativeErrorText;\n }\n\n private getInput() {\n if (!this.input) {\n // If the input is not yet defined, synchronously render.\n // e.g.\n // const textField = document.createElement('md-outlined-text-field');\n // document.body.appendChild(textField);\n // textField.focus(); // synchronously render\n this.connectedCallback();\n this.scheduleUpdate();\n }\n\n if (this.isUpdatePending) {\n // If there are pending updates, synchronously perform them. This ensures\n // that constraint validation properties (like `required`) are synced\n // before interacting with input APIs that depend on them.\n this.scheduleUpdate();\n }\n\n return this.input!;\n }\n\n firstUpdated() {\n this.filterOptions();\n }\n\n protected override updated(changedProperties: PropertyValues) {\n if (changedProperties.has('disabled')) {\n this.tabIndex = this.disabled ? -1 : 0;\n }\n\n if (changedProperties.has('options')) {\n this.filteredOptions = this.options;\n\n if (!this.selectedItem) {\n const item = this.options.find(({ value }) => value === this.value);\n this.selectItem(item);\n }\n }\n\n this.setMenuPosition();\n }\n\n handleMenuOpening = () => {\n this.menuOpening = true;\n this.menuOpen = true;\n this.setMenuPosition();\n };\n\n menuOpened = () => {\n this.setMenuPosition();\n this.menuOpening = false;\n };\n\n setMenuPosition = () => {\n const innerMenu = this.menu?.shadowRoot?.querySelector(\n '.menu'\n ) as HTMLElement;\n if (innerMenu) {\n innerMenu.style.width = '100%';\n innerMenu.style.height = 'auto';\n innerMenu.style.insetBlockStart = this.supportingText ? '-1rem' : '0';\n }\n };\n\n handleMenuClosed = () => {\n this.menuOpening = false;\n this.menuOpen = false;\n };\n\n handleInput = (e: InputEvent) => {\n const { value } = e.target as HTMLInputElement;\n this.dirty = true;\n this.filterValue = value;\n this.value = value;\n this.filterOptions();\n };\n\n selectItem = (item: IFilterSelectOption | undefined) => {\n if (item) {\n this.selectedItem = item;\n this.value = item.value;\n this.filterValue = item.label;\n this.filteredOptions = this.options;\n if (this.menuOpen || this.menuOpening) {\n this.menu.close();\n }\n this.dispatchEvent(\n new CustomEvent('select-filter-select', {\n detail: { value: item.value, label: item.label },\n bubbles: true,\n composed: true,\n })\n );\n }\n };\n\n toggleOpen = (e: Event) => {\n e.stopPropagation();\n if (!this.menu.open) {\n this.filterOptions();\n this.menu.show();\n this.menuOpening = true;\n this.setMenuPosition();\n } else {\n this.menu.close();\n }\n };\n\n filterOptions() {\n const filterValue =\n this.filterValue.trim().toLowerCase() ||\n this.value.trim().toLocaleLowerCase();\n\n if (!filterValue) {\n this.filteredOptions = this.options;\n }\n\n this.filteredOptions = this.options.filter(item =>\n item.label.toLowerCase().includes(filterValue)\n );\n }\n\n clear() {\n this.value = '';\n this.filterValue = '';\n this.selectedItem = undefined;\n this.focus();\n this.dispatchEvent(\n new CustomEvent('clear-filter-select', {\n bubbles: true,\n composed: true,\n })\n );\n }\n\n /** @private */\n formResetCallback() {\n this.reset();\n }\n\n /**\n * Reset the text field to its default value.\n */\n reset() {\n this.value = '';\n const originalValue = this.getAttribute('value');\n const item = this.options.find(({ value }) => value === originalValue);\n this.selectItem(item);\n this.dirty = false;\n this.nativeError = false;\n this.nativeErrorText = '';\n }\n\n override attributeChangedCallback(\n attribute: string,\n newValue: string | null,\n oldValue: string | null\n ) {\n if (attribute === 'value' && this.dirty) {\n // After user input, changing the value attribute no longer updates the\n // text field's value (until reset). This matches native <input> behavior.\n return;\n }\n\n super.attributeChangedCallback(attribute, newValue, oldValue);\n }\n\n [createValidator](): Validator<unknown> {\n return new TextFieldValidator(() => ({\n state: this as any,\n renderedControl: this.input,\n }));\n }\n\n [getValidityAnchor](): HTMLElement | null {\n return this.input;\n }\n\n [onReportValidity](invalidEvent: Event | null) {\n // Prevent default pop-up behavior.\n invalidEvent?.preventDefault();\n\n this.nativeError = !!invalidEvent;\n this.nativeErrorText = this.validationMessage;\n }\n\n // Writable mixin properties for lit-html binding, needed for lit-analyzer\n declare disabled: boolean;\n\n declare name: string;\n\n override [getFormValue]() {\n return this.value;\n }\n\n override formStateRestoreCallback(formState: string) {\n this.value = formState;\n }\n\n private handleFocusChange() {\n this.focused = this.input?.matches(':focus') ?? false;\n\n if (this.menuOpen || this.menuOpening) return;\n\n if (this.focused) {\n this.menu.show();\n this.menuOpening = true;\n this.setMenuPosition();\n }\n }\n\n override focus() {\n // Required for the case that the user slots a focusable element into the\n // leading icon slot such as an iconbutton due to how delegatesFocus works.\n this.getInput().focus();\n }\n\n renderViewMoreButton() {\n if (!this.isViewMoreButtonVisible) return nothing;\n\n return html` <div class=\"filter-select-footer-section\">\n <ix-button\n type=\"button\"\n appearance=\"text\"\n ?disabled=${this.isViewMoreButtonLoading}\n .submitting=${this.isViewMoreButtonLoading}\n @click=${() => this.onViewMoreButtonClick()}\n >\n <span class=\"button-label\">${this.viewMoreButtonLabel}</span>\n </ix-button>\n </div>`;\n }\n\n render() {\n const classes = {\n disabled: this.disabled,\n error: !this.disabled && this.hasError,\n };\n\n return html`\n <div class=\"filter-select\">\n <ix-field\n class=\"${classMap(classes)}\"\n id=\"anchor\"\n ?focused=${this.focused}\n ?disabled=${this.disabled}\n ?required=${this.required}\n ?error=${this.hasError}\n error-text=${!this.menuOpen && !this.menuOpening\n ? this.getErrorText()\n : nothing}\n label=${this.label}\n @click=${() => (!this.disabled ? this.input.focus() : null)}\n supporting-text=${this.supportingText}\n ?populated=${this.filterValue.length || this.value.length}\n >\n <input\n id=\"filter\"\n aria-invalid=${this.hasError}\n @input=${this.handleInput}\n .value=${this.filterValue}\n class=\"flex-fill input\"\n type=\"text\"\n ?disabled=${this.disabled}\n ?required=${this.required}\n @focus=${this.handleFocusChange}\n @blur=${this.handleFocusChange}\n autocomplete=\"off\"\n />\n <slot name=\"end\" slot=\"end\">\n ${this.value.length\n ? html`<ix-icon-button\n @click=${this.clear}\n icon=\"close\"\n aria-label=\"clear\"\n ></ix-icon-button>`\n : nothing}\n <ix-icon-button\n @click=${this.toggleOpen}\n class=\"open-icon\"\n icon=${`arrow_drop_${this.menuOpen ? 'up' : 'down'}`}\n aria-label=\"options\"\n ></ix-icon-button>\n </slot>\n </ix-field>\n <div class=\"menu\">\n <ix-menu\n anchor=\"anchor\"\n @opening=${this.handleMenuOpening}\n @opened=${this.menuOpened}\n @closed=${this.handleMenuClosed}\n default-focus=\"none\"\n skip-restore-focus\n >\n ${this.filteredOptions?.length\n ? repeat(\n this.filteredOptions,\n (item, index) => `${item.value}-${index}`,\n item =>\n html`<ix-menu-item\n @click=${() => {\n this.selectItem(item);\n }}\n @keydown=${(e: KeyboardEvent) => {\n const selectionKeys = ['Space', 'Enter'];\n if (selectionKeys.includes(e.key)) {\n this.selectItem(item);\n }\n }}\n class=${this.value === item.value ? 'selected' : ''}\n >\n <div slot=\"headline\">${item.label}</div>\n </ix-menu-item>`\n )\n : html`<ix-menu-item>${this.noFilteredOptions}</ix-menu-item>`}\n ${this.renderViewMoreButton()}\n </ix-menu>\n </div>\n </div>\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"IxFilterSelect.js","sourceRoot":"","sources":["../src/IxFilterSelect.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,QAAQ,E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AE;mDAA0B;AAMzB;IAAR,KAAK,EAAE;gDAA0B;AAMzB;IAAR,KAAK,EAAE;6CAAuB;AAEtB;IAAR,KAAK,EAAE;+CAAyB;AAKxB;IAAR,KAAK,EAAE;mDAA6B;AAM5B;IAAR,KAAK,EAAE;uDAA8B;AAE7B;IAAR,KAAK,EAAE;mDAA6B","sourcesContent":["import { html, LitElement, nothing, PropertyValues } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { repeat } from 'lit/directives/repeat.js';\nimport { ifDefined } from 'lit-html/directives/if-defined.js';\nimport { requestUpdateOnAriaChange } from '@material/web/internal/aria/delegate.js';\nimport '@digital-realty/ix-field/ix-field.js';\nimport '@digital-realty/ix-menu/ix-menu.js';\nimport '@digital-realty/ix-menu/ix-menu-item.js';\nimport '@digital-realty/ix-icon-button/ix-icon-button.js';\nimport '@digital-realty/ix-button';\nimport { IxMenu } from '@digital-realty/ix-menu';\nimport { IxField } from '@digital-realty/ix-field';\nimport {\n mixinOnReportValidity,\n onReportValidity,\n} from '@material/web/labs/behaviors/on-report-validity.js';\nimport {\n createValidator,\n getValidityAnchor,\n mixinConstraintValidation,\n} from '@material/web/labs/behaviors/constraint-validation.js';\nimport {\n getFormValue,\n mixinFormAssociated,\n} from '@material/web/labs/behaviors/form-associated.js';\nimport { mixinElementInternals } from '@material/web/labs/behaviors/element-internals.js';\nimport { TextFieldValidator } from '@material/web/labs/behaviors/validators/text-field-validator.js';\nimport { Validator } from '@material/web/labs/behaviors/validators/validator.js';\nimport { IxFilterSelectStyles } from './ix-filter-select-styles.js';\n\nexport interface IFilterSelectOption {\n value: string;\n label: string;\n}\n\nconst filterSelectBaseClass = mixinOnReportValidity(\n mixinConstraintValidation(\n mixinFormAssociated(mixinElementInternals(LitElement))\n )\n);\n\nexport class IxFilterSelect extends filterSelectBaseClass {\n static get styles() {\n return [IxFilterSelectStyles];\n }\n\n static {\n requestUpdateOnAriaChange(IxFilterSelect);\n }\n\n /** @nocollapse */\n static shadowRootOptions = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n };\n\n @query('ix-menu') public menu!: IxMenu;\n\n @query('input')\n readonly input!: HTMLInputElement;\n\n @query('.field') private readonly field!: IxField | null;\n\n @property({ type: Array }) options: IFilterSelectOption[] = [];\n\n @property({ type: String }) value: string = '';\n\n @property({ type: String }) label = '';\n\n @property({ type: String, attribute: 'error-text' }) errorText =\n 'Invalid error text';\n\n @property({ type: String, attribute: 'no-options-text' }) noFilteredOptions =\n 'No options';\n\n @property({ attribute: 'supporting-text' }) supportingText = '';\n\n @property({ type: Boolean, reflect: true }) error = false;\n\n @property({ type: Number, reflect: true }) tabIndex = 0;\n\n @property({ type: Boolean, reflect: true }) required = false;\n\n @property({ type: Function }) onViewMoreButtonClick: any;\n\n @property({ type: Boolean }) isViewMoreButtonVisible = false;\n\n @property({ type: Boolean }) isViewMoreButtonLoading = false;\n\n @property({ type: String }) viewMoreButtonLabel = 'View More';\n\n @property({ type: String }) placeholder?: string;\n\n /**\n * Used to prevent IxFilterSelect from opening the menu. This is useful\n * when options are yet to be provided via an async process.\n */\n @property({ type: Boolean }) disableMenu = false;\n\n /**\n * Optional property to control how the options are filtered based on value in the field.\n * If not provided, defaults to case-insensitive substring match on the label.\n */\n @property() filterFunctionGenerator?: (\n filterValue: string\n ) => (option: IFilterSelectOption) => boolean;\n\n /**\n * Exposed method to open and close the menu\n */\n public setMenuOpen = (value: boolean) => {\n this.menuOpen = value;\n };\n\n @state() private filteredOptions: IFilterSelectOption[] = [];\n\n @state() public selectedItem: IFilterSelectOption | undefined = undefined;\n\n @state() private filterValue = '';\n\n /**\n * When set, either opens or closes the menu on the next render.\n * Also reflects when menu is opened from IxMenu.\n */\n @state() private menuOpen = false;\n\n /**\n * Returns true when the text field has been interacted with. Native\n * validation errors only display in response to user interactions.\n */\n @state() private dirty = false;\n\n @state() private focused = false;\n\n /**\n * Whether or not a native error has been reported via `reportValidity()`.\n */\n @state() private nativeError = false;\n\n /**\n * The validation message displayed from a native error via\n * `reportValidity()`.\n */\n @state() private nativeErrorText = '';\n\n @state() private menuOpening = false;\n\n private get hasError() {\n return !this.dirty && (this.error || this.nativeError);\n }\n\n private getErrorText() {\n return this.error ? this.errorText : this.nativeErrorText;\n }\n\n private getInput() {\n if (!this.input) {\n // If the input is not yet defined, synchronously render.\n // e.g.\n // const textField = document.createElement('md-outlined-text-field');\n // document.body.appendChild(textField);\n // textField.focus(); // synchronously render\n this.connectedCallback();\n this.scheduleUpdate();\n }\n\n if (this.isUpdatePending) {\n // If there are pending updates, synchronously perform them. This ensures\n // that constraint validation properties (like `required`) are synced\n // before interacting with input APIs that depend on them.\n this.scheduleUpdate();\n }\n\n return this.input!;\n }\n\n firstUpdated() {\n this.filterOptions();\n }\n\n protected override updated(changedProperties: PropertyValues) {\n if (changedProperties.has('disabled')) {\n this.tabIndex = this.disabled ? -1 : 0;\n }\n\n if (changedProperties.has('options')) {\n this.filteredOptions = this.options;\n\n if (!this.selectedItem) {\n const item = this.options.find(({ value }) => value === this.value);\n this.selectItem(item);\n }\n }\n\n if (changedProperties.has('menuOpen')) {\n if (this.menuOpen) {\n if (this.disableMenu) {\n // We need to update menuOpen to false if we are not showing the menu\n // This will trigger a re-render with menuOpen as false which is what will actually close the menu\n this.menuOpen = false;\n } else {\n this.showMenu();\n }\n } else {\n this.menu.close();\n }\n }\n }\n\n handleMenuOpening = () => {\n this.menuOpening = true;\n this.menuOpen = true;\n };\n\n menuOpened = () => {\n this.menuOpening = false;\n };\n\n setMenuStyles = () => {\n const innerMenu = this.menu?.shadowRoot?.querySelector(\n '.menu'\n ) as HTMLElement;\n if (innerMenu) {\n innerMenu.style.width = '100%';\n innerMenu.style.height = 'auto';\n }\n };\n\n showMenu = () => {\n this.menu.show();\n this.setMenuStyles();\n };\n\n handleMenuClosed = () => {\n this.menuOpening = false;\n this.menuOpen = false;\n };\n\n handleInput = (e: InputEvent) => {\n const { value } = e.target as HTMLInputElement;\n this.dirty = true;\n this.filterValue = value;\n this.value = value;\n this.filterOptions();\n };\n\n selectItem = (item: IFilterSelectOption | undefined) => {\n if (item) {\n this.selectedItem = item;\n this.value = item.value;\n this.filterValue = item.label;\n this.filteredOptions = this.options;\n if (this.menuOpen || this.menuOpening) {\n this.menuOpen = false;\n }\n this.dispatchEvent(\n new CustomEvent('select-filter-select', {\n detail: { value: item.value, label: item.label },\n bubbles: true,\n composed: true,\n })\n );\n }\n };\n\n toggleOpen = (e: Event) => {\n e.stopPropagation();\n if (!this.menu.open) {\n this.filterOptions();\n this.menuOpen = true;\n } else {\n this.menuOpen = false;\n }\n };\n\n filterOptions() {\n const filterValue =\n this.filterValue.trim().toLowerCase() ||\n this.value.trim().toLocaleLowerCase();\n\n if (!filterValue) {\n this.filteredOptions = this.options;\n return;\n }\n\n const filterFunction = this.filterFunctionGenerator\n ? this.filterFunctionGenerator(filterValue)\n : (item: IFilterSelectOption) =>\n item.label.toLowerCase().includes(filterValue);\n\n this.filteredOptions = this.options.filter(filterFunction);\n }\n\n clear() {\n this.value = '';\n this.filterValue = '';\n this.selectedItem = undefined;\n this.focus();\n this.dispatchEvent(\n new CustomEvent('clear-filter-select', {\n bubbles: true,\n composed: true,\n })\n );\n }\n\n /** @private */\n formResetCallback() {\n this.reset();\n }\n\n /**\n * Reset the text field to its default value.\n */\n reset() {\n this.value = '';\n const originalValue = this.getAttribute('value');\n const item = this.options.find(({ value }) => value === originalValue);\n this.selectItem(item);\n this.dirty = false;\n this.nativeError = false;\n this.nativeErrorText = '';\n }\n\n override attributeChangedCallback(\n attribute: string,\n newValue: string | null,\n oldValue: string | null\n ) {\n if (attribute === 'value' && this.dirty) {\n // After user input, changing the value attribute no longer updates the\n // text field's value (until reset). This matches native <input> behavior.\n return;\n }\n\n super.attributeChangedCallback(attribute, newValue, oldValue);\n }\n\n [createValidator](): Validator<unknown> {\n return new TextFieldValidator(() => ({\n state: this as any,\n renderedControl: this.input,\n }));\n }\n\n [getValidityAnchor](): HTMLElement | null {\n return this.input;\n }\n\n [onReportValidity](invalidEvent: Event | null) {\n // Prevent default pop-up behavior.\n invalidEvent?.preventDefault();\n\n this.nativeError = !!invalidEvent;\n this.nativeErrorText = this.validationMessage;\n }\n\n // Writable mixin properties for lit-html binding, needed for lit-analyzer\n declare disabled: boolean;\n\n declare name: string;\n\n override [getFormValue]() {\n return this.value;\n }\n\n override formStateRestoreCallback(formState: string) {\n this.value = formState;\n }\n\n private handleFocusChange() {\n this.focused = this.input?.matches(':focus') ?? false;\n\n if (this.menuOpen || this.menuOpening) return;\n\n if (this.focused) {\n this.menuOpen = true;\n }\n }\n\n override focus() {\n // Required for the case that the user slots a focusable element into the\n // leading icon slot such as an iconbutton due to how delegatesFocus works.\n this.getInput().focus();\n }\n\n renderViewMoreButton() {\n if (!this.isViewMoreButtonVisible) return nothing;\n\n return html` <div class=\"filter-select-footer-section\">\n <ix-button\n type=\"button\"\n appearance=\"text\"\n ?disabled=${this.isViewMoreButtonLoading}\n .submitting=${this.isViewMoreButtonLoading}\n @click=${() => this.onViewMoreButtonClick()}\n >\n <span class=\"button-label\">${this.viewMoreButtonLabel}</span>\n </ix-button>\n </div>`;\n }\n\n render() {\n const classes = {\n disabled: this.disabled,\n error: !this.disabled && this.hasError,\n };\n\n return html`\n <div class=\"filter-select\">\n <ix-field\n class=\"${classMap(classes)}\"\n id=\"anchor\"\n ?focused=${this.focused}\n ?disabled=${this.disabled}\n ?required=${this.required}\n ?error=${this.hasError}\n error-text=${!this.menuOpen && !this.menuOpening\n ? this.getErrorText()\n : nothing}\n label=${this.label}\n @click=${() => (!this.disabled ? this.input.focus() : null)}\n supporting-text=${this.supportingText}\n ?populated=${this.filterValue.length || this.value.length}\n >\n <input\n id=\"filter\"\n aria-invalid=${this.hasError}\n @input=${this.handleInput}\n .value=${this.filterValue}\n class=\"flex-fill input\"\n type=\"text\"\n ?disabled=${this.disabled}\n ?required=${this.required}\n @focus=${this.handleFocusChange}\n @blur=${this.handleFocusChange}\n autocomplete=\"off\"\n placeholder=${ifDefined(this.placeholder)}\n />\n <slot name=\"end\" slot=\"end\">\n ${this.value.length\n ? html`<ix-icon-button\n @click=${this.clear}\n icon=\"close\"\n aria-label=\"clear\"\n ></ix-icon-button>`\n : nothing}\n <ix-icon-button\n @click=${this.toggleOpen}\n class=\"open-icon\"\n icon=${`arrow_drop_${this.menuOpen ? 'up' : 'down'}`}\n aria-label=\"options\"\n ></ix-icon-button>\n </slot>\n </ix-field>\n <div class=\"menu\">\n <ix-menu\n anchor=\"anchor\"\n @opening=${this.handleMenuOpening}\n @opened=${this.menuOpened}\n @closed=${this.handleMenuClosed}\n default-focus=\"none\"\n skip-restore-focus\n anchor-corner=\"start-start\"\n surface-corner=\"start-start\"\n y-offset=${this.supportingText\n ? -parseFloat(getComputedStyle(document.documentElement).fontSize)\n : 0}\n >\n ${this.filteredOptions?.length\n ? repeat(\n this.filteredOptions,\n (item, index) => `${item.value}-${index}`,\n item =>\n html`<ix-menu-item\n @click=${() => {\n this.selectItem(item);\n }}\n @keydown=${(e: KeyboardEvent) => {\n const selectionKeys = ['Space', 'Enter'];\n if (selectionKeys.includes(e.key)) {\n this.selectItem(item);\n }\n }}\n class=${this.value === item.value ? 'selected' : ''}\n >\n <div slot=\"headline\">${item.label}</div>\n </ix-menu-item>`\n )\n : html`<ix-menu-item>${this.noFilteredOptions}</ix-menu-item>`}\n ${this.renderViewMoreButton()}\n </ix-menu>\n </div>\n </div>\n `;\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
- import{__decorate}from"tslib";import{css,LitElement,nothing,html}from"lit";import{query,property,state}from"lit/decorators.js";import{classMap}from"lit/directives/class-map.js";import{requestUpdateOnAriaChange}from"@material/web/internal/aria/delegate.js";import"@digital-realty/ix-field/ix-field.js";import"@digital-realty/ix-menu/ix-menu.js";import"@digital-realty/ix-menu/ix-menu-item.js";import"@digital-realty/ix-icon-button/ix-icon-button.js";import"@digital-realty/ix-button";import{repeat}from"lit/directives/repeat.js";import{mixinOnReportValidity,onReportValidity}from"@material/web/labs/behaviors/on-report-validity.js";import{mixinConstraintValidation,createValidator,getValidityAnchor}from"@material/web/labs/behaviors/constraint-validation.js";import{mixinFormAssociated,getFormValue}from"@material/web/labs/behaviors/form-associated.js";import{mixinElementInternals}from"@material/web/labs/behaviors/element-internals.js";import{TextFieldValidator}from"@material/web/labs/behaviors/validators/text-field-validator.js";let IxFilterSelectStyles=css`:host{display:block}:host([disabled]){pointer-events:none}ix-field{display:block}ix-field label{display:none}.flex-fill{flex:1}.menu{position:relative}.menu input,.menu label{cursor:pointer}input{border:none;background:0 0;outline:0;min-width:3rem}ix-chip-set{min-height:var(--_content-line-height)}ix-menu{--md-menu-container-color:var(--md-sys-color-surface-variant, #fff);max-height:var(--ix-filter-select-max-height,500px)}ix-menu-item{position:relative}ix-menu-item label{display:flex;align-items:center;position:absolute;top:0;left:0;right:0;bottom:0}ix-menu-item label input[type=checkbox]{margin:0 1rem 2px}ix-menu-item.selected{background:var(--md-menu-item-selected-container-color,--md-sys-color-tertiary-container)}ix-icon-button{--md-icon-button-icon-color:var(--md-sys-text-color-secondary);--md-icon-button-hover-icon-color:var(--md-sys-text-color-secondary);--md-icon-button-hover-state-layer-color:var(
1
+ import{__decorate}from"tslib";import{css,LitElement,nothing,html}from"lit";import{query,property,state}from"lit/decorators.js";import{classMap}from"lit/directives/class-map.js";import{repeat}from"lit/directives/repeat.js";import{ifDefined}from"lit-html/directives/if-defined.js";import{requestUpdateOnAriaChange}from"@material/web/internal/aria/delegate.js";import"@digital-realty/ix-field/ix-field.js";import"@digital-realty/ix-menu/ix-menu.js";import"@digital-realty/ix-menu/ix-menu-item.js";import"@digital-realty/ix-icon-button/ix-icon-button.js";import"@digital-realty/ix-button";import{mixinOnReportValidity,onReportValidity}from"@material/web/labs/behaviors/on-report-validity.js";import{mixinConstraintValidation,createValidator,getValidityAnchor}from"@material/web/labs/behaviors/constraint-validation.js";import{mixinFormAssociated,getFormValue}from"@material/web/labs/behaviors/form-associated.js";import{mixinElementInternals}from"@material/web/labs/behaviors/element-internals.js";import{TextFieldValidator}from"@material/web/labs/behaviors/validators/text-field-validator.js";let IxFilterSelectStyles=css`:host{display:block}:host([disabled]){pointer-events:none}ix-field{display:block}ix-field label{display:none}.flex-fill{flex:1}.menu{position:relative}.menu input,.menu label{cursor:pointer}input{border:none;background:0 0;outline:0;min-width:3rem}ix-chip-set{min-height:var(--_content-line-height)}ix-menu{--md-menu-container-color:var(--md-sys-color-surface-variant, #fff);max-height:var(--ix-filter-select-max-height,500px)}ix-menu-item{position:relative}ix-menu-item label{display:flex;align-items:center;position:absolute;top:0;left:0;right:0;bottom:0}ix-menu-item label input[type=checkbox]{margin:0 1rem 2px}ix-menu-item.selected{background:var(--md-menu-item-selected-container-color,--md-sys-color-tertiary-container)}ix-icon-button{--md-icon-button-icon-color:var(--md-sys-text-color-secondary);--md-icon-button-hover-icon-color:var(--md-sys-text-color-secondary);--md-icon-button-hover-state-layer-color:var(
2
2
  --md-sys-text-color-secondary
3
3
  );--md-icon-button-pressed-icon-color:var(--md-sys-text-color-secondary);--md-icon-button-pressed-state-layer-color:var(
4
4
  --md-sys-text-color-secondary
5
- )}.open-icon{margin-right:.5rem}.filter-select{position:relative}.filter-select-footer-section{display:flex;justify-content:space-between;padding:.5rem 1rem}`,filterSelectBaseClass=mixinOnReportValidity(mixinConstraintValidation(mixinFormAssociated(mixinElementInternals(LitElement))));class IxFilterSelect extends filterSelectBaseClass{constructor(){super(...arguments),this.options=[],this.value="",this.label="",this.errorText="Invalid error text",this.noFilteredOptions="No options",this.supportingText="",this.error=!1,this.tabIndex=0,this.required=!1,this.isViewMoreButtonVisible=!1,this.isViewMoreButtonLoading=!1,this.viewMoreButtonLabel="View More",this.filteredOptions=[],this.selectedItem=void 0,this.filterValue="",this.menuOpen=!1,this.dirty=!1,this.focused=!1,this.nativeError=!1,this.nativeErrorText="",this.menuOpening=!1,this.handleMenuOpening=()=>{this.menuOpening=!0,this.menuOpen=!0,this.setMenuPosition()},this.menuOpened=()=>{this.setMenuPosition(),this.menuOpening=!1},this.setMenuPosition=()=>{var e=null==(e=null==(e=this.menu)?void 0:e.shadowRoot)?void 0:e.querySelector(".menu");e&&(e.style.width="100%",e.style.height="auto",e.style.insetBlockStart=this.supportingText?"-1rem":"0")},this.handleMenuClosed=()=>{this.menuOpening=!1,this.menuOpen=!1},this.handleInput=e=>{e=e.target.value;this.dirty=!0,this.filterValue=e,this.value=e,this.filterOptions()},this.selectItem=e=>{e&&(this.selectedItem=e,this.value=e.value,this.filterValue=e.label,this.filteredOptions=this.options,(this.menuOpen||this.menuOpening)&&this.menu.close(),this.dispatchEvent(new CustomEvent("select-filter-select",{detail:{value:e.value,label:e.label},bubbles:!0,composed:!0})))},this.toggleOpen=e=>{e.stopPropagation(),this.menu.open?this.menu.close():(this.filterOptions(),this.menu.show(),this.menuOpening=!0,this.setMenuPosition())}}static get styles(){return[IxFilterSelectStyles]}get hasError(){return!this.dirty&&(this.error||this.nativeError)}getErrorText(){return this.error?this.errorText:this.nativeErrorText}getInput(){return this.input||(this.connectedCallback(),this.scheduleUpdate()),this.isUpdatePending&&this.scheduleUpdate(),this.input}firstUpdated(){this.filterOptions()}updated(e){e.has("disabled")&&(this.tabIndex=this.disabled?-1:0),e.has("options")&&(this.filteredOptions=this.options,this.selectedItem||(e=this.options.find(({value:e})=>e===this.value),this.selectItem(e))),this.setMenuPosition()}filterOptions(){let t=this.filterValue.trim().toLowerCase()||this.value.trim().toLocaleLowerCase();t||(this.filteredOptions=this.options),this.filteredOptions=this.options.filter(e=>e.label.toLowerCase().includes(t))}clear(){this.value="",this.filterValue="",this.selectedItem=void 0,this.focus(),this.dispatchEvent(new CustomEvent("clear-filter-select",{bubbles:!0,composed:!0}))}formResetCallback(){this.reset()}reset(){this.value="";let t=this.getAttribute("value");var e=this.options.find(({value:e})=>e===t);this.selectItem(e),this.dirty=!1,this.nativeError=!1,this.nativeErrorText=""}attributeChangedCallback(e,t,i){"value"===e&&this.dirty||super.attributeChangedCallback(e,t,i)}[createValidator](){return new TextFieldValidator(()=>({state:this,renderedControl:this.input}))}[getValidityAnchor](){return this.input}[onReportValidity](e){null!=e&&e.preventDefault(),this.nativeError=!!e,this.nativeErrorText=this.validationMessage}[getFormValue](){return this.value}formStateRestoreCallback(e){this.value=e}handleFocusChange(){var e;this.focused=null!=(e=null==(e=this.input)?void 0:e.matches(":focus"))&&e,this.menuOpen||this.menuOpening||this.focused&&(this.menu.show(),this.menuOpening=!0,this.setMenuPosition())}focus(){this.getInput().focus()}renderViewMoreButton(){return this.isViewMoreButtonVisible?html`<div class="filter-select-footer-section"><ix-button type="button" appearance="text" ?disabled="${this.isViewMoreButtonLoading}" .submitting="${this.isViewMoreButtonLoading}" @click="${()=>this.onViewMoreButtonClick()}"><span class="button-label">${this.viewMoreButtonLabel}</span></ix-button></div>`:nothing}render(){var e={disabled:this.disabled,error:!this.disabled&&this.hasError};return html`<div class="filter-select"><ix-field class="${classMap(e)}" id="anchor" ?focused="${this.focused}" ?disabled="${this.disabled}" ?required="${this.required}" ?error="${this.hasError}" error-text="${this.menuOpen||this.menuOpening?nothing:this.getErrorText()}" label="${this.label}" @click="${()=>this.disabled?null:this.input.focus()}" supporting-text="${this.supportingText}" ?populated="${this.filterValue.length||this.value.length}"><input id="filter" aria-invalid="${this.hasError}" @input="${this.handleInput}" .value="${this.filterValue}" class="flex-fill input" type="text" ?disabled="${this.disabled}" ?required="${this.required}" @focus="${this.handleFocusChange}" @blur="${this.handleFocusChange}" autocomplete="off"><slot name="end" slot="end">${this.value.length?html`<ix-icon-button @click="${this.clear}" icon="close" aria-label="clear"></ix-icon-button>`:nothing}<ix-icon-button @click="${this.toggleOpen}" class="open-icon" icon="${"arrow_drop_"+(this.menuOpen?"up":"down")}" aria-label="options"></ix-icon-button></slot></ix-field><div class="menu"><ix-menu anchor="anchor" @opening="${this.handleMenuOpening}" @opened="${this.menuOpened}" @closed="${this.handleMenuClosed}" default-focus="none" skip-restore-focus>${null!=(e=this.filteredOptions)&&e.length?repeat(this.filteredOptions,(e,t)=>e.value+"-"+t,t=>html`<ix-menu-item @click="${()=>{this.selectItem(t)}}" @keydown="${e=>{["Space","Enter"].includes(e.key)&&this.selectItem(t)}}" class="${this.value===t.value?"selected":""}"><div slot="headline">${t.label}</div></ix-menu-item>`):html`<ix-menu-item>${this.noFilteredOptions}</ix-menu-item>`} ${this.renderViewMoreButton()}</ix-menu></div></div>`}}requestUpdateOnAriaChange(IxFilterSelect),IxFilterSelect.shadowRootOptions={...LitElement.shadowRootOptions,delegatesFocus:!0},__decorate([query("ix-menu")],IxFilterSelect.prototype,"menu",void 0),__decorate([query("input")],IxFilterSelect.prototype,"input",void 0),__decorate([query(".field")],IxFilterSelect.prototype,"field",void 0),__decorate([property({type:Array})],IxFilterSelect.prototype,"options",void 0),__decorate([property({type:String})],IxFilterSelect.prototype,"value",void 0),__decorate([property({type:String})],IxFilterSelect.prototype,"label",void 0),__decorate([property({type:String,attribute:"error-text"})],IxFilterSelect.prototype,"errorText",void 0),__decorate([property({type:String,attribute:"no-options-text"})],IxFilterSelect.prototype,"noFilteredOptions",void 0),__decorate([property({attribute:"supporting-text"})],IxFilterSelect.prototype,"supportingText",void 0),__decorate([property({type:Boolean,reflect:!0})],IxFilterSelect.prototype,"error",void 0),__decorate([property({type:Number,reflect:!0})],IxFilterSelect.prototype,"tabIndex",void 0),__decorate([property({type:Boolean,reflect:!0})],IxFilterSelect.prototype,"required",void 0),__decorate([property({type:Function})],IxFilterSelect.prototype,"onViewMoreButtonClick",void 0),__decorate([property({type:Boolean})],IxFilterSelect.prototype,"isViewMoreButtonVisible",void 0),__decorate([property({type:Boolean})],IxFilterSelect.prototype,"isViewMoreButtonLoading",void 0),__decorate([property({type:String})],IxFilterSelect.prototype,"viewMoreButtonLabel",void 0),__decorate([state()],IxFilterSelect.prototype,"filteredOptions",void 0),__decorate([state()],IxFilterSelect.prototype,"selectedItem",void 0),__decorate([state()],IxFilterSelect.prototype,"filterValue",void 0),__decorate([state()],IxFilterSelect.prototype,"menuOpen",void 0),__decorate([state()],IxFilterSelect.prototype,"dirty",void 0),__decorate([state()],IxFilterSelect.prototype,"focused",void 0),__decorate([state()],IxFilterSelect.prototype,"nativeError",void 0),__decorate([state()],IxFilterSelect.prototype,"nativeErrorText",void 0),__decorate([state()],IxFilterSelect.prototype,"menuOpening",void 0),window.customElements.define("ix-filter-select",IxFilterSelect);
5
+ )}.open-icon{margin-right:.5rem}.filter-select{position:relative}.filter-select-footer-section{display:flex;justify-content:space-between;padding:.5rem 1rem}`,filterSelectBaseClass=mixinOnReportValidity(mixinConstraintValidation(mixinFormAssociated(mixinElementInternals(LitElement))));class IxFilterSelect extends filterSelectBaseClass{constructor(){super(...arguments),this.options=[],this.value="",this.label="",this.errorText="Invalid error text",this.noFilteredOptions="No options",this.supportingText="",this.error=!1,this.tabIndex=0,this.required=!1,this.isViewMoreButtonVisible=!1,this.isViewMoreButtonLoading=!1,this.viewMoreButtonLabel="View More",this.disableMenu=!1,this.setMenuOpen=e=>{this.menuOpen=e},this.filteredOptions=[],this.selectedItem=void 0,this.filterValue="",this.menuOpen=!1,this.dirty=!1,this.focused=!1,this.nativeError=!1,this.nativeErrorText="",this.menuOpening=!1,this.handleMenuOpening=()=>{this.menuOpening=!0,this.menuOpen=!0},this.menuOpened=()=>{this.menuOpening=!1},this.setMenuStyles=()=>{var e=null==(e=null==(e=this.menu)?void 0:e.shadowRoot)?void 0:e.querySelector(".menu");e&&(e.style.width="100%",e.style.height="auto")},this.showMenu=()=>{this.menu.show(),this.setMenuStyles()},this.handleMenuClosed=()=>{this.menuOpening=!1,this.menuOpen=!1},this.handleInput=e=>{e=e.target.value;this.dirty=!0,this.filterValue=e,this.value=e,this.filterOptions()},this.selectItem=e=>{e&&(this.selectedItem=e,this.value=e.value,this.filterValue=e.label,this.filteredOptions=this.options,(this.menuOpen||this.menuOpening)&&(this.menuOpen=!1),this.dispatchEvent(new CustomEvent("select-filter-select",{detail:{value:e.value,label:e.label},bubbles:!0,composed:!0})))},this.toggleOpen=e=>{e.stopPropagation(),this.menu.open?this.menuOpen=!1:(this.filterOptions(),this.menuOpen=!0)}}static get styles(){return[IxFilterSelectStyles]}get hasError(){return!this.dirty&&(this.error||this.nativeError)}getErrorText(){return this.error?this.errorText:this.nativeErrorText}getInput(){return this.input||(this.connectedCallback(),this.scheduleUpdate()),this.isUpdatePending&&this.scheduleUpdate(),this.input}firstUpdated(){this.filterOptions()}updated(e){var t;e.has("disabled")&&(this.tabIndex=this.disabled?-1:0),e.has("options")&&(this.filteredOptions=this.options,this.selectedItem||(t=this.options.find(({value:e})=>e===this.value),this.selectItem(t))),e.has("menuOpen")&&(this.menuOpen?this.disableMenu?this.menuOpen=!1:this.showMenu():this.menu.close())}filterOptions(){let t=this.filterValue.trim().toLowerCase()||this.value.trim().toLocaleLowerCase();var e;t?(e=this.filterFunctionGenerator?this.filterFunctionGenerator(t):e=>e.label.toLowerCase().includes(t),this.filteredOptions=this.options.filter(e)):this.filteredOptions=this.options}clear(){this.value="",this.filterValue="",this.selectedItem=void 0,this.focus(),this.dispatchEvent(new CustomEvent("clear-filter-select",{bubbles:!0,composed:!0}))}formResetCallback(){this.reset()}reset(){this.value="";let t=this.getAttribute("value");var e=this.options.find(({value:e})=>e===t);this.selectItem(e),this.dirty=!1,this.nativeError=!1,this.nativeErrorText=""}attributeChangedCallback(e,t,i){"value"===e&&this.dirty||super.attributeChangedCallback(e,t,i)}[createValidator](){return new TextFieldValidator(()=>({state:this,renderedControl:this.input}))}[getValidityAnchor](){return this.input}[onReportValidity](e){null!=e&&e.preventDefault(),this.nativeError=!!e,this.nativeErrorText=this.validationMessage}[getFormValue](){return this.value}formStateRestoreCallback(e){this.value=e}handleFocusChange(){var e;this.focused=null!=(e=null==(e=this.input)?void 0:e.matches(":focus"))&&e,this.menuOpen||this.menuOpening||this.focused&&(this.menuOpen=!0)}focus(){this.getInput().focus()}renderViewMoreButton(){return this.isViewMoreButtonVisible?html`<div class="filter-select-footer-section"><ix-button type="button" appearance="text" ?disabled="${this.isViewMoreButtonLoading}" .submitting="${this.isViewMoreButtonLoading}" @click="${()=>this.onViewMoreButtonClick()}"><span class="button-label">${this.viewMoreButtonLabel}</span></ix-button></div>`:nothing}render(){var e={disabled:this.disabled,error:!this.disabled&&this.hasError};return html`<div class="filter-select"><ix-field class="${classMap(e)}" id="anchor" ?focused="${this.focused}" ?disabled="${this.disabled}" ?required="${this.required}" ?error="${this.hasError}" error-text="${this.menuOpen||this.menuOpening?nothing:this.getErrorText()}" label="${this.label}" @click="${()=>this.disabled?null:this.input.focus()}" supporting-text="${this.supportingText}" ?populated="${this.filterValue.length||this.value.length}"><input id="filter" aria-invalid="${this.hasError}" @input="${this.handleInput}" .value="${this.filterValue}" class="flex-fill input" type="text" ?disabled="${this.disabled}" ?required="${this.required}" @focus="${this.handleFocusChange}" @blur="${this.handleFocusChange}" autocomplete="off" placeholder="${ifDefined(this.placeholder)}"><slot name="end" slot="end">${this.value.length?html`<ix-icon-button @click="${this.clear}" icon="close" aria-label="clear"></ix-icon-button>`:nothing}<ix-icon-button @click="${this.toggleOpen}" class="open-icon" icon="${"arrow_drop_"+(this.menuOpen?"up":"down")}" aria-label="options"></ix-icon-button></slot></ix-field><div class="menu"><ix-menu anchor="anchor" @opening="${this.handleMenuOpening}" @opened="${this.menuOpened}" @closed="${this.handleMenuClosed}" default-focus="none" skip-restore-focus anchor-corner="start-start" surface-corner="start-start" y-offset="${this.supportingText?-parseFloat(getComputedStyle(document.documentElement).fontSize):0}">${null!=(e=this.filteredOptions)&&e.length?repeat(this.filteredOptions,(e,t)=>e.value+"-"+t,t=>html`<ix-menu-item @click="${()=>{this.selectItem(t)}}" @keydown="${e=>{["Space","Enter"].includes(e.key)&&this.selectItem(t)}}" class="${this.value===t.value?"selected":""}"><div slot="headline">${t.label}</div></ix-menu-item>`):html`<ix-menu-item>${this.noFilteredOptions}</ix-menu-item>`} ${this.renderViewMoreButton()}</ix-menu></div></div>`}}requestUpdateOnAriaChange(IxFilterSelect),IxFilterSelect.shadowRootOptions={...LitElement.shadowRootOptions,delegatesFocus:!0},__decorate([query("ix-menu")],IxFilterSelect.prototype,"menu",void 0),__decorate([query("input")],IxFilterSelect.prototype,"input",void 0),__decorate([query(".field")],IxFilterSelect.prototype,"field",void 0),__decorate([property({type:Array})],IxFilterSelect.prototype,"options",void 0),__decorate([property({type:String})],IxFilterSelect.prototype,"value",void 0),__decorate([property({type:String})],IxFilterSelect.prototype,"label",void 0),__decorate([property({type:String,attribute:"error-text"})],IxFilterSelect.prototype,"errorText",void 0),__decorate([property({type:String,attribute:"no-options-text"})],IxFilterSelect.prototype,"noFilteredOptions",void 0),__decorate([property({attribute:"supporting-text"})],IxFilterSelect.prototype,"supportingText",void 0),__decorate([property({type:Boolean,reflect:!0})],IxFilterSelect.prototype,"error",void 0),__decorate([property({type:Number,reflect:!0})],IxFilterSelect.prototype,"tabIndex",void 0),__decorate([property({type:Boolean,reflect:!0})],IxFilterSelect.prototype,"required",void 0),__decorate([property({type:Function})],IxFilterSelect.prototype,"onViewMoreButtonClick",void 0),__decorate([property({type:Boolean})],IxFilterSelect.prototype,"isViewMoreButtonVisible",void 0),__decorate([property({type:Boolean})],IxFilterSelect.prototype,"isViewMoreButtonLoading",void 0),__decorate([property({type:String})],IxFilterSelect.prototype,"viewMoreButtonLabel",void 0),__decorate([property({type:String})],IxFilterSelect.prototype,"placeholder",void 0),__decorate([property({type:Boolean})],IxFilterSelect.prototype,"disableMenu",void 0),__decorate([property()],IxFilterSelect.prototype,"filterFunctionGenerator",void 0),__decorate([state()],IxFilterSelect.prototype,"filteredOptions",void 0),__decorate([state()],IxFilterSelect.prototype,"selectedItem",void 0),__decorate([state()],IxFilterSelect.prototype,"filterValue",void 0),__decorate([state()],IxFilterSelect.prototype,"menuOpen",void 0),__decorate([state()],IxFilterSelect.prototype,"dirty",void 0),__decorate([state()],IxFilterSelect.prototype,"focused",void 0),__decorate([state()],IxFilterSelect.prototype,"nativeError",void 0),__decorate([state()],IxFilterSelect.prototype,"nativeErrorText",void 0),__decorate([state()],IxFilterSelect.prototype,"menuOpening",void 0),window.customElements.define("ix-filter-select",IxFilterSelect);
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Webcomponent ix-filter-select following open-wc recommendations",
4
4
  "license": "MIT",
5
5
  "author": "Digital Realty",
6
- "version": "1.2.1",
6
+ "version": "1.2.2",
7
7
  "type": "module",
8
8
  "main": "dist/index.js",
9
9
  "module": "dist/index.js",
@@ -31,7 +31,8 @@
31
31
  "@digital-realty/ix-icon-button": "^1.2.1",
32
32
  "@digital-realty/ix-menu": "^1.2.1",
33
33
  "@material/web": "1.2.0",
34
- "lit": "^3.2.1"
34
+ "lit": "^3.2.1",
35
+ "lit-html": "^3.3.1"
35
36
  },
36
37
  "devDependencies": {
37
38
  "@custom-elements-manifest/analyzer": "^0.4.17",
@@ -101,5 +102,5 @@
101
102
  "README.md",
102
103
  "LICENSE"
103
104
  ],
104
- "gitHead": "0a87dc6e3da94a1375ec43a7ead2bfdec4913821"
105
+ "gitHead": "747029814ea7a6ddeb50b72f03f1f7b9f6e49098"
105
106
  }