@digital-realty/ix-filter-select 1.2.7 → 1.2.9
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.
package/dist/IxFilterSelect.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ export declare class IxFilterSelect extends filterSelectBaseClass {
|
|
|
54
54
|
/**
|
|
55
55
|
* Exposed method to open and close the menu
|
|
56
56
|
*/
|
|
57
|
-
setMenuOpen
|
|
57
|
+
setMenuOpen(value: boolean): void;
|
|
58
58
|
private filteredOptions;
|
|
59
59
|
selectedItem: IFilterSelectOption | undefined;
|
|
60
60
|
private filterValue;
|
package/dist/IxFilterSelect.js
CHANGED
|
@@ -37,12 +37,6 @@ export class IxFilterSelect extends filterSelectBaseClass {
|
|
|
37
37
|
* when options are yet to be provided via an async process.
|
|
38
38
|
*/
|
|
39
39
|
this.disableMenu = false;
|
|
40
|
-
/**
|
|
41
|
-
* Exposed method to open and close the menu
|
|
42
|
-
*/
|
|
43
|
-
this.setMenuOpen = (value) => {
|
|
44
|
-
this.menuOpen = value;
|
|
45
|
-
};
|
|
46
40
|
this.filteredOptions = [];
|
|
47
41
|
this.selectedItem = undefined;
|
|
48
42
|
this.filterValue = '';
|
|
@@ -127,6 +121,12 @@ export class IxFilterSelect extends filterSelectBaseClass {
|
|
|
127
121
|
static get styles() {
|
|
128
122
|
return [IxFilterSelectStyles];
|
|
129
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* Exposed method to open and close the menu
|
|
126
|
+
*/
|
|
127
|
+
setMenuOpen(value) {
|
|
128
|
+
this.menuOpen = value;
|
|
129
|
+
}
|
|
130
130
|
get hasError() {
|
|
131
131
|
return !this.dirty && (this.error || this.nativeError);
|
|
132
132
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IxFilterSelect.js","sourceRoot":"","sources":["../src/IxFilterSelect.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OA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AASrC;IAAR,KAAK,EAAE;uDAAqD;AAEpD;IAAR,KAAK,EAAE;oDAAkE;AAEjE;IAAR,KAAK,EAAE;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 { mixinDelegatesAria } from '@material/web/internal/aria/delegate.js';\nimport { repeat } from 'lit/directives/repeat.js';\nimport { ifDefined } from 'lit-html/directives/if-defined.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(mixinDelegatesAria(mixinElementInternals(LitElement)))\n )\n);\n\nexport class IxFilterSelect extends filterSelectBaseClass {\n static get styles() {\n return [IxFilterSelectStyles];\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
|
+
{"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,QA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AAK,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 { mixinDelegatesAria } from '@material/web/internal/aria/delegate.js';\nimport { repeat } from 'lit/directives/repeat.js';\nimport { ifDefined } from 'lit-html/directives/if-defined.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(mixinDelegatesAria(mixinElementInternals(LitElement)))\n )\n);\n\nexport class IxFilterSelect extends filterSelectBaseClass {\n static get styles() {\n return [IxFilterSelectStyles];\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"]}
|
|
@@ -2,4 +2,4 @@ import{__decorate}from"tslib";import{css,LitElement,nothing,html}from"lit";impor
|
|
|
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(mixinDelegatesAria(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.
|
|
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(mixinDelegatesAria(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.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]}setMenuOpen(e){this.menuOpen=e}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>`}}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.
|
|
6
|
+
"version": "1.2.9",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"module": "dist/index.js",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"test:watch": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wtr --watch\""
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@digital-realty/ix-button": "^3.4.
|
|
29
|
+
"@digital-realty/ix-button": "^3.4.8",
|
|
30
30
|
"@digital-realty/ix-field": "^1.2.4",
|
|
31
|
-
"@digital-realty/ix-icon-button": "^1.2.
|
|
31
|
+
"@digital-realty/ix-icon-button": "^1.2.7",
|
|
32
32
|
"@digital-realty/ix-menu": "^1.2.4",
|
|
33
33
|
"@material/web": "2.4.0",
|
|
34
34
|
"lit": "^3.2.1",
|
|
@@ -102,5 +102,5 @@
|
|
|
102
102
|
"README.md",
|
|
103
103
|
"LICENSE"
|
|
104
104
|
],
|
|
105
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "4cd8803f4c5f3b3833ae6ebb5791f73a057863f8"
|
|
106
106
|
}
|