@digital-realty/ix-filter-select 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 ix-filter-select
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,73 @@
1
+ # \<ix-filter-select>
2
+
3
+ This webcomponent follows the [open-wc](https://github.com/open-wc/open-wc) recommendation.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm i @digital-realty/ix-filter-select
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```html
14
+ <script type="module">
15
+ import '@digital-realty/ix-filter-select/ix-filter-select.js';
16
+ const items = [
17
+ 'item 1',
18
+ 'item 2'
19
+ ]
20
+ </script>
21
+
22
+ <ix-filter-select
23
+ .options=${items}
24
+ value=${initial_value}
25
+ label="Filter Select"
26
+ ?required=${this.required}
27
+ ?disabled=${this.disabled}
28
+ ?error=${this.error}
29
+ ></ix-filter-select>
30
+ ```
31
+
32
+ ## Linting and formatting
33
+
34
+ To scan the project for linting and formatting errors, run
35
+
36
+ ```bash
37
+ npm run lint
38
+ ```
39
+
40
+ To automatically fix linting and formatting errors, run
41
+
42
+ ```bash
43
+ npm run format
44
+ ```
45
+
46
+ ## Testing with Web Test Runner
47
+
48
+ To execute a single test run:
49
+
50
+ ```bash
51
+ npm run test
52
+ ```
53
+
54
+ To run the tests in interactive watch mode run:
55
+
56
+ ```bash
57
+ npm run test:watch
58
+ ```
59
+
60
+
61
+ ## Tooling configs
62
+
63
+ For most of the tools, the configuration is in the `package.json` to reduce the amount of files in your project.
64
+
65
+ If you customize the configuration a lot, you can consider moving them to individual files.
66
+
67
+ ## Local Demo with `web-dev-server`
68
+
69
+ ```bash
70
+ npm start
71
+ ```
72
+
73
+ To run a local development server that serves the basic demo located in `demo/index.html`
@@ -0,0 +1,94 @@
1
+ import { LitElement } from 'lit';
2
+ import '@digital-realty/ix-field/ix-field.js';
3
+ import '@digital-realty/ix-menu/ix-menu.js';
4
+ import '@digital-realty/ix-menu/ix-menu-item.js';
5
+ import '@digital-realty/ix-icon-button/ix-icon-button.js';
6
+ import { IxMenu } from '@digital-realty/ix-menu';
7
+ export declare class IxFilterSelect extends LitElement {
8
+ static get styles(): import("lit").CSSResult[];
9
+ /** @nocollapse */
10
+ static shadowRootOptions: {
11
+ delegatesFocus: boolean;
12
+ mode: ShadowRootMode;
13
+ slotAssignment?: SlotAssignmentMode | undefined;
14
+ customElements?: CustomElementRegistry | undefined;
15
+ registry?: CustomElementRegistry | undefined;
16
+ };
17
+ /** @nocollapse */
18
+ static readonly formAssociated = true;
19
+ private readonly internals;
20
+ /**
21
+ * The associated form element with which this element's value will submit.
22
+ */
23
+ get form(): HTMLFormElement | null;
24
+ /**
25
+ * The labels this element is associated with.
26
+ */
27
+ get labels(): NodeList;
28
+ /**
29
+ * The HTML name to use in form submission.
30
+ */
31
+ get name(): string;
32
+ /**
33
+ * Returns the text field's validation error message.
34
+ *
35
+ * https://developer.mozilla.org/en-US/docs/Web/HTML/Constraint_validation
36
+ */
37
+ get validationMessage(): string;
38
+ /**
39
+ * Returns a `ValidityState` object that represents the validity states of the
40
+ * text field.
41
+ *
42
+ * https://developer.mozilla.org/en-US/docs/Web/API/ValidityState
43
+ */
44
+ get validity(): ValidityState;
45
+ /**
46
+ * Returns whether an element will successfully validate based on forms
47
+ * validation rules and constraints.
48
+ *
49
+ * https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/willValidate
50
+ */
51
+ get willValidate(): boolean;
52
+ checkValidity(): boolean;
53
+ reportValidity(): boolean;
54
+ menu: IxMenu;
55
+ inputFilter: HTMLInputElement;
56
+ options: string[];
57
+ value: string;
58
+ label: string;
59
+ errorText: string;
60
+ noFilteredOptions: string;
61
+ disabled: boolean;
62
+ /**
63
+ * Gets or sets whether or not the text field is in a visually invalid state.
64
+ *
65
+ * This error state overrides the error state controlled by
66
+ * `reportValidity()`.
67
+ */
68
+ error: boolean;
69
+ required: boolean;
70
+ private filteredOptions;
71
+ private filterValue;
72
+ private menuOpen;
73
+ private focused;
74
+ private menuOpening;
75
+ firstUpdated(): void;
76
+ updated(): void;
77
+ handleFocusin: (e: Event) => void;
78
+ handleFocusout: () => void;
79
+ handleMenuOpen: () => void;
80
+ menuOpened: () => void;
81
+ setMenuPosition: () => void;
82
+ handleMenuClose: () => void;
83
+ filterInput: (e: InputEvent) => void;
84
+ selectItem: (value: string) => void;
85
+ toggleOpen: (e: Event) => void;
86
+ clear: (e: Event) => void;
87
+ /** @private */
88
+ formResetCallback(): void;
89
+ /**
90
+ * Reset the text field to its default value.
91
+ */
92
+ reset(): void;
93
+ render(): import("lit").TemplateResult<1>;
94
+ }
@@ -0,0 +1,334 @@
1
+ import { __decorate } from "tslib";
2
+ import { html, LitElement, nothing } from 'lit';
3
+ import { property, query, state } from 'lit/decorators.js';
4
+ import { classMap } from 'lit/directives/class-map.js';
5
+ import { requestUpdateOnAriaChange } from '@material/web/internal/aria/delegate.js';
6
+ import '@digital-realty/ix-field/ix-field.js';
7
+ import '@digital-realty/ix-menu/ix-menu.js';
8
+ import '@digital-realty/ix-menu/ix-menu-item.js';
9
+ import '@digital-realty/ix-icon-button/ix-icon-button.js';
10
+ import { IxFilterSelectStyles } from './ix-filter-select-styles.js';
11
+ export class IxFilterSelect extends LitElement {
12
+ constructor() {
13
+ super(...arguments);
14
+ this.internals = this /* needed for closure */
15
+ .attachInternals();
16
+ this.options = [];
17
+ this.value = '';
18
+ this.label = '';
19
+ this.errorText = 'Invalid error text';
20
+ this.noFilteredOptions = 'No options';
21
+ this.disabled = false;
22
+ /**
23
+ * Gets or sets whether or not the text field is in a visually invalid state.
24
+ *
25
+ * This error state overrides the error state controlled by
26
+ * `reportValidity()`.
27
+ */
28
+ this.error = false;
29
+ this.required = false;
30
+ this.filteredOptions = [];
31
+ this.filterValue = '';
32
+ this.menuOpen = false;
33
+ this.focused = false;
34
+ this.menuOpening = false;
35
+ this.handleFocusin = (e) => {
36
+ const target = e.target;
37
+ if (target.tagName === 'MD-ICON-BUTTON' || this.disabled)
38
+ return;
39
+ this.menu.show();
40
+ this.focused = true;
41
+ this.menuOpening = true;
42
+ this.setMenuPosition();
43
+ this.internals.setFormValue(this.value);
44
+ };
45
+ this.handleFocusout = () => {
46
+ if (this.value.length || this.filterValue.length || this.menuOpening) {
47
+ this.focused = true;
48
+ }
49
+ else {
50
+ this.focused = false;
51
+ }
52
+ };
53
+ this.handleMenuOpen = () => {
54
+ this.focused = true;
55
+ this.menuOpen = true;
56
+ this.setMenuPosition();
57
+ this.internals.setFormValue(this.value);
58
+ };
59
+ this.menuOpened = () => {
60
+ this.setMenuPosition();
61
+ this.internals.setFormValue(this.value);
62
+ this.inputFilter.focus();
63
+ this.menuOpening = false;
64
+ };
65
+ this.setMenuPosition = () => {
66
+ var _a, _b;
67
+ const innerMenu = (_b = (_a = this.menu) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('.menu');
68
+ if (innerMenu) {
69
+ innerMenu.style.width = '100%';
70
+ innerMenu.style.insetBlockStart = '0';
71
+ }
72
+ };
73
+ this.handleMenuClose = () => {
74
+ if (this.value.length === 0 && this.filterValue.length === 0) {
75
+ this.focused = false;
76
+ }
77
+ this.menuOpen = false;
78
+ };
79
+ this.filterInput = (e) => {
80
+ var _a;
81
+ this.filterValue = e.target.value;
82
+ let value = '';
83
+ this.filteredOptions = this.options.filter(item => {
84
+ const filterValue = this.filterValue.trim().toLowerCase();
85
+ if (item.toLowerCase() === filterValue) {
86
+ value = item;
87
+ }
88
+ return item.toLowerCase().includes(filterValue);
89
+ });
90
+ if (value !== this.value) {
91
+ this.value = value;
92
+ }
93
+ const menu = (_a = this.menu.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.menu');
94
+ if (menu) {
95
+ menu.style.height = 'auto';
96
+ }
97
+ };
98
+ this.selectItem = (value) => {
99
+ this.value = value;
100
+ this.filterValue = value;
101
+ this.filteredOptions = this.options;
102
+ this.focused = true;
103
+ this.menu.close();
104
+ this.dispatchEvent(new CustomEvent('select-filter-select', {
105
+ detail: { value },
106
+ bubbles: true,
107
+ composed: true,
108
+ }));
109
+ };
110
+ this.toggleOpen = (e) => {
111
+ e.stopPropagation();
112
+ if (!this.menu.open) {
113
+ this.menu.show();
114
+ this.focused = true;
115
+ this.menuOpening = true;
116
+ this.setMenuPosition();
117
+ }
118
+ else {
119
+ this.menu.close();
120
+ }
121
+ };
122
+ this.clear = (e) => {
123
+ e.stopPropagation();
124
+ this.value = '';
125
+ this.filterValue = '';
126
+ this.focused = false;
127
+ this.dispatchEvent(new CustomEvent('clear-filter-select', {
128
+ bubbles: true,
129
+ composed: true,
130
+ }));
131
+ };
132
+ }
133
+ static get styles() {
134
+ return [IxFilterSelectStyles];
135
+ }
136
+ /**
137
+ * The associated form element with which this element's value will submit.
138
+ */
139
+ get form() {
140
+ return this.internals.form;
141
+ }
142
+ /**
143
+ * The labels this element is associated with.
144
+ */
145
+ get labels() {
146
+ return this.internals.labels;
147
+ }
148
+ /**
149
+ * The HTML name to use in form submission.
150
+ */
151
+ get name() {
152
+ var _a;
153
+ return (_a = this.getAttribute('name')) !== null && _a !== void 0 ? _a : '';
154
+ }
155
+ /**
156
+ * Returns the text field's validation error message.
157
+ *
158
+ * https://developer.mozilla.org/en-US/docs/Web/HTML/Constraint_validation
159
+ */
160
+ get validationMessage() {
161
+ return this.internals.validationMessage;
162
+ }
163
+ /**
164
+ * Returns a `ValidityState` object that represents the validity states of the
165
+ * text field.
166
+ *
167
+ * https://developer.mozilla.org/en-US/docs/Web/API/ValidityState
168
+ */
169
+ get validity() {
170
+ return this.internals.validity;
171
+ }
172
+ /**
173
+ * Returns whether an element will successfully validate based on forms
174
+ * validation rules and constraints.
175
+ *
176
+ * https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/willValidate
177
+ */
178
+ get willValidate() {
179
+ return this.internals.willValidate;
180
+ }
181
+ checkValidity() {
182
+ return this.internals.checkValidity();
183
+ }
184
+ reportValidity() {
185
+ return this.internals.reportValidity();
186
+ }
187
+ firstUpdated() {
188
+ this.filteredOptions = this.options;
189
+ this.internals.setFormValue(this.value);
190
+ }
191
+ updated() {
192
+ this.setMenuPosition();
193
+ this.internals.setFormValue(this.value);
194
+ }
195
+ /** @private */
196
+ formResetCallback() {
197
+ this.reset();
198
+ }
199
+ /**
200
+ * Reset the text field to its default value.
201
+ */
202
+ reset() {
203
+ this.value = '';
204
+ }
205
+ render() {
206
+ var _a;
207
+ const classes = {
208
+ disabled: this.disabled,
209
+ error: !this.disabled && this.error,
210
+ };
211
+ return html `
212
+ <div class="filter-select">
213
+ <ix-field
214
+ class="${classMap(classes)}"
215
+ id="anchor"
216
+ ?focused=${this.focused}
217
+ ?disabled=${this.disabled}
218
+ ?required=${this.required}
219
+ ?error=${this.error}
220
+ error-text=${this.errorText}
221
+ label=${this.label}
222
+ @click=${() => (!this.disabled ? this.inputFilter.focus() : null)}
223
+ @focusin=${this.handleFocusin}
224
+ @focusout=${this.handleFocusout}
225
+ >
226
+ <input
227
+ id="filter"
228
+ @input=${this.filterInput}
229
+ .value=${this.filterValue}
230
+ class="flex-fill"
231
+ type="text"
232
+ />
233
+ <slot name="end" slot="end">
234
+ ${this.value.length
235
+ ? html `<ix-icon-button
236
+ @click=${this.clear}
237
+ icon="close"
238
+ aria-label="clear"
239
+ ></ix-icon-button>`
240
+ : nothing}
241
+ <ix-icon-button
242
+ @click=${this.toggleOpen}
243
+ class="open-icon"
244
+ icon=${`arrow_drop_${this.menuOpen ? 'up' : 'down'}`}
245
+ aria-label="options"
246
+ ></ix-icon-button>
247
+ </slot>
248
+ </ix-field>
249
+ <div class="menu">
250
+ <ix-menu
251
+ anchor="anchor"
252
+ skip-restore-focus
253
+ @opening=${this.handleMenuOpen}
254
+ @closing=${this.handleMenuClose}
255
+ @opened=${this.menuOpened}
256
+ >
257
+ ${((_a = this.filteredOptions) === null || _a === void 0 ? void 0 : _a.length)
258
+ ? this.filteredOptions.map((item, id) => html `<ix-menu-item
259
+ id=${id}
260
+ @click=${() => {
261
+ this.selectItem(item);
262
+ }}
263
+ @keydown=${(e) => {
264
+ const selectionKeys = [' ', 'Tab', 'Enter'];
265
+ if (selectionKeys.includes(e.key)) {
266
+ this.selectItem(item);
267
+ }
268
+ }}
269
+ >
270
+ <div slot="headline">${item}</div>
271
+ </ix-menu-item>`)
272
+ : html `<ix-menu-item>${this.noFilteredOptions}</ix-menu-item>`}
273
+ </ix-menu>
274
+ </div>
275
+ </div>
276
+ `;
277
+ }
278
+ }
279
+ (() => {
280
+ requestUpdateOnAriaChange(IxFilterSelect);
281
+ })();
282
+ /** @nocollapse */
283
+ IxFilterSelect.shadowRootOptions = {
284
+ ...LitElement.shadowRootOptions,
285
+ delegatesFocus: true,
286
+ };
287
+ /** @nocollapse */
288
+ IxFilterSelect.formAssociated = true;
289
+ __decorate([
290
+ query('ix-menu')
291
+ ], IxFilterSelect.prototype, "menu", void 0);
292
+ __decorate([
293
+ query('#filter')
294
+ ], IxFilterSelect.prototype, "inputFilter", void 0);
295
+ __decorate([
296
+ property({ type: Array })
297
+ ], IxFilterSelect.prototype, "options", void 0);
298
+ __decorate([
299
+ property({ type: String })
300
+ ], IxFilterSelect.prototype, "value", void 0);
301
+ __decorate([
302
+ property({ type: String })
303
+ ], IxFilterSelect.prototype, "label", void 0);
304
+ __decorate([
305
+ property({ type: String, attribute: 'error-text' })
306
+ ], IxFilterSelect.prototype, "errorText", void 0);
307
+ __decorate([
308
+ property({ type: String, attribute: 'no-options-text' })
309
+ ], IxFilterSelect.prototype, "noFilteredOptions", void 0);
310
+ __decorate([
311
+ property({ type: Boolean, reflect: true })
312
+ ], IxFilterSelect.prototype, "disabled", void 0);
313
+ __decorate([
314
+ property({ type: Boolean, reflect: true })
315
+ ], IxFilterSelect.prototype, "error", void 0);
316
+ __decorate([
317
+ property({ type: Boolean, reflect: true })
318
+ ], IxFilterSelect.prototype, "required", void 0);
319
+ __decorate([
320
+ state()
321
+ ], IxFilterSelect.prototype, "filteredOptions", void 0);
322
+ __decorate([
323
+ state()
324
+ ], IxFilterSelect.prototype, "filterValue", void 0);
325
+ __decorate([
326
+ state()
327
+ ], IxFilterSelect.prototype, "menuOpen", void 0);
328
+ __decorate([
329
+ state()
330
+ ], IxFilterSelect.prototype, "focused", void 0);
331
+ __decorate([
332
+ state()
333
+ ], IxFilterSelect.prototype, "menuOpening", void 0);
334
+ //# sourceMappingURL=IxFilterSelect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IxFilterSelect.js","sourceRoot":"","sources":["../src/IxFilterSelect.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC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'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 { IxMenu } from '@digital-realty/ix-menu';\nimport { IxFilterSelectStyles } from './ix-filter-select-styles.js';\n\nexport class IxFilterSelect extends LitElement {\n static get styles() {\n return [IxFilterSelectStyles];\n }\n\n static {\n requestUpdateOnAriaChange(IxFilterSelect);\n }\n\n /** @nocollapse */\n static override shadowRootOptions = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n };\n\n /** @nocollapse */\n static readonly formAssociated = true;\n\n private readonly internals = (this as HTMLElement) /* needed for closure */\n .attachInternals();\n\n /**\n * The associated form element with which this element's value will submit.\n */\n get form() {\n return this.internals.form;\n }\n\n /**\n * The labels this element is associated with.\n */\n get labels() {\n return this.internals.labels;\n }\n\n /**\n * The HTML name to use in form submission.\n */\n get name() {\n return this.getAttribute('name') ?? '';\n }\n\n /**\n * Returns the text field's validation error message.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Constraint_validation\n */\n get validationMessage() {\n return this.internals.validationMessage;\n }\n\n /**\n * Returns a `ValidityState` object that represents the validity states of the\n * text field.\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/ValidityState\n */\n get validity() {\n return this.internals.validity;\n }\n\n /**\n * Returns whether an element will successfully validate based on forms\n * validation rules and constraints.\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/willValidate\n */\n get willValidate() {\n return this.internals.willValidate;\n }\n\n checkValidity() {\n return this.internals.checkValidity();\n }\n\n reportValidity() {\n return this.internals.reportValidity();\n }\n\n @query('ix-menu') menu!: IxMenu;\n\n @query('#filter') inputFilter!: HTMLInputElement;\n\n @property({ type: Array }) options: string[] = [];\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({ type: Boolean, reflect: true }) disabled = false;\n\n /**\n * Gets or sets whether or not the text field is in a visually invalid state.\n *\n * This error state overrides the error state controlled by\n * `reportValidity()`.\n */\n @property({ type: Boolean, reflect: true }) error = false;\n\n @property({ type: Boolean, reflect: true }) required = false;\n\n @state() private filteredOptions: string[] = [];\n\n @state() private filterValue = '';\n\n @state() private menuOpen = false;\n\n @state() private focused = false;\n\n @state() private menuOpening = false;\n\n firstUpdated() {\n this.filteredOptions = this.options;\n this.internals.setFormValue(this.value);\n }\n\n updated() {\n this.setMenuPosition();\n this.internals.setFormValue(this.value);\n }\n\n handleFocusin = (e: Event) => {\n const target = e.target as HTMLElement;\n if (target.tagName === 'MD-ICON-BUTTON' || this.disabled) return;\n this.menu.show();\n this.focused = true;\n this.menuOpening = true;\n this.setMenuPosition();\n this.internals.setFormValue(this.value);\n };\n\n handleFocusout = () => {\n if (this.value.length || this.filterValue.length || this.menuOpening) {\n this.focused = true;\n } else {\n this.focused = false;\n }\n };\n\n handleMenuOpen = () => {\n this.focused = true;\n this.menuOpen = true;\n this.setMenuPosition();\n this.internals.setFormValue(this.value);\n };\n\n menuOpened = () => {\n this.setMenuPosition();\n this.internals.setFormValue(this.value);\n this.inputFilter.focus();\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.insetBlockStart = '0';\n }\n };\n\n handleMenuClose = () => {\n if (this.value.length === 0 && this.filterValue.length === 0) {\n this.focused = false;\n }\n this.menuOpen = false;\n };\n\n filterInput = (e: InputEvent) => {\n this.filterValue = (e.target as HTMLInputElement).value;\n let value = '';\n this.filteredOptions = this.options.filter(item => {\n const filterValue = this.filterValue.trim().toLowerCase();\n if (item.toLowerCase() === filterValue) {\n value = item;\n }\n return item.toLowerCase().includes(filterValue);\n });\n if (value !== this.value) {\n this.value = value;\n }\n const menu = this.menu.shadowRoot?.querySelector('.menu') as HTMLElement;\n if (menu) {\n menu.style.height = 'auto';\n }\n };\n\n selectItem = (value: string) => {\n this.value = value;\n this.filterValue = value;\n this.filteredOptions = this.options;\n this.focused = true;\n this.menu.close();\n this.dispatchEvent(\n new CustomEvent('select-filter-select', {\n detail: { value },\n bubbles: true,\n composed: true,\n })\n );\n };\n\n toggleOpen = (e: Event) => {\n e.stopPropagation();\n if (!this.menu.open) {\n this.menu.show();\n this.focused = true;\n this.menuOpening = true;\n this.setMenuPosition();\n } else {\n this.menu.close();\n }\n };\n\n clear = (e: Event) => {\n e.stopPropagation();\n this.value = '';\n this.filterValue = '';\n this.focused = false;\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 }\n\n render() {\n const classes = {\n disabled: this.disabled,\n error: !this.disabled && this.error,\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.error}\n error-text=${this.errorText}\n label=${this.label}\n @click=${() => (!this.disabled ? this.inputFilter.focus() : null)}\n @focusin=${this.handleFocusin}\n @focusout=${this.handleFocusout}\n >\n <input\n id=\"filter\"\n @input=${this.filterInput}\n .value=${this.filterValue}\n class=\"flex-fill\"\n type=\"text\"\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 skip-restore-focus\n @opening=${this.handleMenuOpen}\n @closing=${this.handleMenuClose}\n @opened=${this.menuOpened}\n >\n ${this.filteredOptions?.length\n ? this.filteredOptions.map(\n (item, id: number) =>\n html`<ix-menu-item\n id=${id}\n @click=${() => {\n this.selectItem(item);\n }}\n @keydown=${(e: KeyboardEvent) => {\n const selectionKeys = [' ', 'Tab', 'Enter'];\n if (selectionKeys.includes(e.key)) {\n this.selectItem(item);\n }\n }}\n >\n <div slot=\"headline\">${item}</div>\n </ix-menu-item>`\n )\n : html`<ix-menu-item>${this.noFilteredOptions}</ix-menu-item>`}\n </ix-menu>\n </div>\n </div>\n `;\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ export { IxFilterSelect } from './IxFilterSelect.js';
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { IxFilterSelect } from './IxFilterSelect.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC","sourcesContent":["export { IxFilterSelect } from './IxFilterSelect.js';\n"]}
@@ -0,0 +1 @@
1
+ export declare const IxFilterSelectStyles: import("lit").CSSResult;
@@ -0,0 +1,73 @@
1
+ import { css } from 'lit';
2
+ export const IxFilterSelectStyles = css `
3
+ :host {
4
+ display: block;
5
+ }
6
+ ix-field {
7
+ display: block;
8
+ --md-outlined-field-label-text-color: var(--md-sys-text-color-primary);
9
+ --md-outlined-field-outline-color: var(--md-outlined-field-outline-color);
10
+ }
11
+ ix-field label {
12
+ display: none;
13
+ }
14
+ .flex-fill {
15
+ flex: 1;
16
+ }
17
+ .menu {
18
+ position: relative;
19
+ }
20
+ .menu label,
21
+ .menu input {
22
+ cursor: pointer;
23
+ }
24
+ input {
25
+ border: none;
26
+ background: transparent;
27
+ outline: none;
28
+ min-width: 3rem;
29
+ }
30
+ ix-chip-set {
31
+ min-height: var(--_content-line-height);
32
+ }
33
+ ix-menu {
34
+ --md-menu-container-color: #fff;
35
+ max-height: 500px;
36
+ }
37
+ ix-menu-item {
38
+ position: relative;
39
+ }
40
+ ix-menu-item label {
41
+ display: flex;
42
+ align-items: center;
43
+ position: absolute;
44
+ top: 0;
45
+ left: 0;
46
+ right: 0;
47
+ bottom: 0;
48
+ }
49
+ ix-menu-item label input[type='checkbox'] {
50
+ margin: 0 1rem 2px;
51
+ }
52
+ ix-menu-item.selected {
53
+ background: var(--md-sys-color-tertiary-container);
54
+ }
55
+ ix-icon-button {
56
+ --md-icon-button-icon-color: var(--md-sys-text-color-secondary);
57
+ --md-icon-button-hover-icon-color: var(--md-sys-text-color-secondary);
58
+ --md-icon-button-hover-state-layer-color: var(
59
+ --md-sys-text-color-secondary
60
+ );
61
+ --md-icon-button-pressed-icon-color: var(--md-sys-text-color-secondary);
62
+ --md-icon-button-pressed-state-layer-color: var(
63
+ --md-sys-text-color-secondary
64
+ );
65
+ }
66
+ .open-icon {
67
+ margin-right: 0.5rem;
68
+ }
69
+ .filter-select {
70
+ position: relative;
71
+ }
72
+ `;
73
+ //# sourceMappingURL=ix-filter-select-styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ix-filter-select-styles.js","sourceRoot":"","sources":["../src/ix-filter-select-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsEtC,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const IxFilterSelectStyles = css`\n :host {\n display: block;\n }\n ix-field {\n display: block;\n --md-outlined-field-label-text-color: var(--md-sys-text-color-primary);\n --md-outlined-field-outline-color: var(--md-outlined-field-outline-color);\n }\n ix-field label {\n display: none;\n }\n .flex-fill {\n flex: 1;\n }\n .menu {\n position: relative;\n }\n .menu label,\n .menu input {\n cursor: pointer;\n }\n input {\n border: none;\n background: transparent;\n outline: none;\n min-width: 3rem;\n }\n ix-chip-set {\n min-height: var(--_content-line-height);\n }\n ix-menu {\n --md-menu-container-color: #fff;\n max-height: 500px;\n }\n ix-menu-item {\n position: relative;\n }\n ix-menu-item label {\n display: flex;\n align-items: center;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n }\n ix-menu-item label input[type='checkbox'] {\n margin: 0 1rem 2px;\n }\n ix-menu-item.selected {\n background: var(--md-sys-color-tertiary-container);\n }\n ix-icon-button {\n --md-icon-button-icon-color: var(--md-sys-text-color-secondary);\n --md-icon-button-hover-icon-color: var(--md-sys-text-color-secondary);\n --md-icon-button-hover-state-layer-color: var(\n --md-sys-text-color-secondary\n );\n --md-icon-button-pressed-icon-color: var(--md-sys-text-color-secondary);\n --md-icon-button-pressed-state-layer-color: var(\n --md-sys-text-color-secondary\n );\n }\n .open-icon {\n margin-right: 0.5rem;\n }\n .filter-select {\n position: relative;\n }\n`;\n"]}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import { IxFilterSelect } from './IxFilterSelect.js';
2
+ window.customElements.define('ix-filter-select', IxFilterSelect);
3
+ //# sourceMappingURL=ix-filter-select.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ix-filter-select.js","sourceRoot":"","sources":["../src/ix-filter-select.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,kBAAkB,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import { IxFilterSelect } from './IxFilterSelect.js';\n\nwindow.customElements.define('ix-filter-select', IxFilterSelect);\n"]}
package/package.json ADDED
@@ -0,0 +1,100 @@
1
+ {
2
+ "name": "@digital-realty/ix-filter-select",
3
+ "description": "Webcomponent ix-filter-select following open-wc recommendations",
4
+ "license": "MIT",
5
+ "author": "Digital Realty",
6
+ "version": "1.0.6",
7
+ "type": "module",
8
+ "main": "dist/index.js",
9
+ "module": "dist/index.js",
10
+ "exports": {
11
+ ".": "./dist/index.js",
12
+ "./ix-filter-select.js": "./dist/ix-filter-select.js"
13
+ },
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
17
+ "scripts": {
18
+ "analyze": "cem analyze --litelement",
19
+ "start": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds\"",
20
+ "build": "tsc && npm run analyze -- --exclude dist",
21
+ "prepublish": "tsc && npm run analyze -- --exclude dist",
22
+ "lint": "eslint --ext .ts,.html . --ignore-path .gitignore && prettier \"**/*.ts\" --check --ignore-path .gitignore",
23
+ "format": "eslint --ext .ts,.html . --fix --ignore-path .gitignore && prettier \"**/*.ts\" --write --ignore-path .gitignore",
24
+ "test": "tsc && wtr --coverage",
25
+ "test:watch": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wtr --watch\""
26
+ },
27
+ "dependencies": {
28
+ "@digital-realty/ix-field": "*",
29
+ "@digital-realty/ix-icon-button": "^1.0.19",
30
+ "@digital-realty/ix-menu": "*",
31
+ "@material/web": "^1.0.0",
32
+ "lit": "^2.0.2"
33
+ },
34
+ "devDependencies": {
35
+ "@custom-elements-manifest/analyzer": "^0.4.17",
36
+ "@digital-realty/theme": "^1.0.8",
37
+ "@open-wc/eslint-config": "^9.2.1",
38
+ "@open-wc/testing": "^3.1.6",
39
+ "@typescript-eslint/eslint-plugin": "^5.48.0",
40
+ "@typescript-eslint/parser": "^5.48.0",
41
+ "@web/dev-server": "^0.1.34",
42
+ "@web/test-runner": "^0.14.0",
43
+ "concurrently": "^5.3.0",
44
+ "eslint": "^8.31.0",
45
+ "eslint-config-prettier": "^8.3.0",
46
+ "husky": "^4.3.8",
47
+ "lint-staged": "^10.5.4",
48
+ "prettier": "^2.4.1",
49
+ "tslib": "^2.3.1",
50
+ "typescript": "^4.5.2"
51
+ },
52
+ "customElements": "custom-elements.json",
53
+ "eslintConfig": {
54
+ "parser": "@typescript-eslint/parser",
55
+ "extends": [
56
+ "@open-wc",
57
+ "prettier"
58
+ ],
59
+ "plugins": [
60
+ "@typescript-eslint"
61
+ ],
62
+ "rules": {
63
+ "no-unused-vars": "off",
64
+ "@typescript-eslint/no-unused-vars": [
65
+ "error"
66
+ ],
67
+ "import/no-unresolved": "off",
68
+ "import/extensions": [
69
+ "error",
70
+ "always",
71
+ {
72
+ "ignorePackages": true
73
+ }
74
+ ]
75
+ }
76
+ },
77
+ "prettier": {
78
+ "singleQuote": true,
79
+ "arrowParens": "avoid"
80
+ },
81
+ "husky": {
82
+ "hooks": {
83
+ "pre-commit": "lint-staged"
84
+ }
85
+ },
86
+ "lint-staged": {
87
+ "*.ts": [
88
+ "eslint --fix",
89
+ "prettier --write"
90
+ ]
91
+ },
92
+ "files": [
93
+ "/dist",
94
+ "!/dist/test",
95
+ "package.json",
96
+ "README.md",
97
+ "LICENSE"
98
+ ],
99
+ "gitHead": "fe2bd8ebfb445aace0ae9b8716ecd3e44da227dc"
100
+ }