@getflip/swirl-components 0.95.2 → 0.96.0
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/components.json +117 -5
- package/dist/cjs/index-506fe4ea.js +8 -8
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/swirl-components.cjs.js +1 -1
- package/dist/cjs/swirl-select.cjs.entry.js +29 -3
- package/dist/collection/components/swirl-select/swirl-select.css +105 -0
- package/dist/collection/components/swirl-select/swirl-select.js +129 -2
- package/dist/collection/components/swirl-select/swirl-select.spec.js +5 -0
- package/dist/collection/components/swirl-select/swirl-select.stories.js +2 -0
- package/dist/components/swirl-select.js +66 -17
- package/dist/esm/index-99d0060d.js +8 -8
- package/dist/esm/loader.js +1 -1
- package/dist/esm/swirl-components.js +1 -1
- package/dist/esm/swirl-select.entry.js +29 -3
- package/dist/swirl-components/p-6afa6ed0.entry.js +1 -0
- package/dist/swirl-components/swirl-components.esm.js +1 -1
- package/dist/types/components/swirl-select/swirl-select.d.ts +8 -0
- package/dist/types/components.d.ts +11 -0
- package/package.json +1 -1
- package/vscode-data.json +20 -0
- package/dist/swirl-components/p-59408f77.entry.js +0 -1
|
@@ -23,28 +23,52 @@ export class SwirlSelect {
|
|
|
23
23
|
this.onOpen = (event) => {
|
|
24
24
|
this.placement = event.detail.position?.placement;
|
|
25
25
|
this.open = true;
|
|
26
|
-
this.
|
|
26
|
+
if (this.withSearch && Boolean(this.searchInput)) {
|
|
27
|
+
this.searchInput.focus();
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
this.optionList.querySelector('[tabIndex="0"]')?.focus();
|
|
31
|
+
}
|
|
27
32
|
};
|
|
28
33
|
this.onClose = () => {
|
|
34
|
+
if (Boolean(this.searchInput)) {
|
|
35
|
+
this.searchInput.value = "";
|
|
36
|
+
this.searchChange.emit("");
|
|
37
|
+
}
|
|
29
38
|
this.open = false;
|
|
30
39
|
this.input.focus();
|
|
31
40
|
};
|
|
32
41
|
this.onKeyDown = (event) => {
|
|
33
42
|
if (event.code === "Space" || event.code === "Enter") {
|
|
43
|
+
if (event.target === this.searchInput) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
34
46
|
event.preventDefault();
|
|
35
47
|
this.popover.open(this.el);
|
|
36
48
|
}
|
|
49
|
+
else if (event.code === "ArrowDown" &&
|
|
50
|
+
event.target === this.searchInput) {
|
|
51
|
+
this.optionList.querySelector('[tabIndex="0"]')?.focus();
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
this.onSearchInput = (event) => {
|
|
55
|
+
this.searchChange.emit(event.target.value);
|
|
37
56
|
};
|
|
38
57
|
this.allowDeselect = true;
|
|
39
58
|
this.disabled = undefined;
|
|
59
|
+
this.emptyListLabel = "No results found.";
|
|
40
60
|
this.inline = undefined;
|
|
41
61
|
this.invalid = undefined;
|
|
42
62
|
this.label = undefined;
|
|
43
63
|
this.multiSelect = undefined;
|
|
44
64
|
this.required = undefined;
|
|
65
|
+
this.searchInputLabel = "Search options";
|
|
66
|
+
this.searchLoading = undefined;
|
|
67
|
+
this.searchPlaceholder = undefined;
|
|
45
68
|
this.selectId = Math.round(Math.random() * 1000000).toString();
|
|
46
69
|
this.swirlAriaDescribedby = undefined;
|
|
47
70
|
this.value = undefined;
|
|
71
|
+
this.withSearch = undefined;
|
|
48
72
|
this.options = [];
|
|
49
73
|
this.open = undefined;
|
|
50
74
|
this.placement = undefined;
|
|
@@ -79,12 +103,13 @@ export class SwirlSelect {
|
|
|
79
103
|
"select--disabled": this.disabled,
|
|
80
104
|
"select--inline": this.inline,
|
|
81
105
|
"select--multi": this.multiSelect,
|
|
106
|
+
"select--search-loading": this.searchLoading,
|
|
82
107
|
});
|
|
83
108
|
return (h(Host, { onKeyDown: this.onKeyDown }, h("div", { class: className }, h("swirl-popover-trigger", { popover: this.popover, setAriaAttributes: false }, h("input", { "aria-describedby": this.swirlAriaDescribedby, "aria-disabled": this.disabled ? "true" : undefined, "aria-invalid": ariaInvalid, class: "select__input", disabled: this.disabled, readOnly: true, ref: (el) => (this.input = el), type: "text", value: label })), h("span", { class: "select__multi-select-values" }, this.value
|
|
84
109
|
?.map((value) => this.options.find((option) => option.value === value))
|
|
85
110
|
?.map((option) => (h("swirl-tag", { "aria-hidden": "true", label: option?.label,
|
|
86
111
|
// eslint-disable-next-line react/jsx-no-bind
|
|
87
|
-
onRemove: () => this.unselectOption(option?.value), removable: !this.disabled && this.allowDeselect })))), h("span", { class: "select__indicator" }, this.open ? (h("swirl-icon-expand-less", null)) : (h("swirl-icon-expand-more", null))), h("swirl-popover", { animation: "scale-in-y", class: "select__popover", id: `select-options-${this.selectId}`, label: this.label, offset: [0, offset], onPopoverClose: this.onClose, onPopoverOpen: this.onOpen, ref: (el) => (this.popover = el), useContainerWidth: "swirl-form-control" }, h("swirl-option-list", { allowDeselect: this.allowDeselect, onValueChange: this.select, multiSelect: this.multiSelect, ref: (el) => (this.optionList = el), value: this.value }, h("slot", { onSlotchange: this.onSlotChange }))))));
|
|
112
|
+
onRemove: () => this.unselectOption(option?.value), removable: !this.disabled && this.allowDeselect })))), h("span", { class: "select__indicator" }, this.open ? (h("swirl-icon-expand-less", null)) : (h("swirl-icon-expand-more", null))), h("swirl-popover", { animation: "scale-in-y", class: "select__popover", id: `select-options-${this.selectId}`, label: this.label, offset: [0, offset], onPopoverClose: this.onClose, onPopoverOpen: this.onOpen, ref: (el) => (this.popover = el), useContainerWidth: "swirl-form-control" }, this.withSearch && (h("div", { class: "select__search" }, h("swirl-icon-search", { class: "select__search-icon", size: 20 }), h("input", { "aria-label": this.searchInputLabel, class: "select__search-input", onInput: this.onSearchInput, placeholder: this.searchPlaceholder, ref: (el) => (this.searchInput = el), type: "search" }), this.searchLoading && (h("swirl-spinner", { class: "select__search-spinner", size: "s" })))), h("swirl-option-list", { allowDeselect: this.allowDeselect, onValueChange: this.select, multiSelect: this.multiSelect, ref: (el) => (this.optionList = el), value: this.value }, !this.searchLoading && (h("div", { "aria-disabled": "true", class: "select__empty-list-label", role: "option" }, h("swirl-text", { color: "subdued", weight: "medium" }, this.emptyListLabel))), h("slot", { onSlotchange: this.onSlotChange }))))));
|
|
88
113
|
}
|
|
89
114
|
static get is() { return "swirl-select"; }
|
|
90
115
|
static get encapsulation() { return "scoped"; }
|
|
@@ -135,6 +160,24 @@ export class SwirlSelect {
|
|
|
135
160
|
"attribute": "disabled",
|
|
136
161
|
"reflect": false
|
|
137
162
|
},
|
|
163
|
+
"emptyListLabel": {
|
|
164
|
+
"type": "string",
|
|
165
|
+
"mutable": false,
|
|
166
|
+
"complexType": {
|
|
167
|
+
"original": "string",
|
|
168
|
+
"resolved": "string",
|
|
169
|
+
"references": {}
|
|
170
|
+
},
|
|
171
|
+
"required": false,
|
|
172
|
+
"optional": true,
|
|
173
|
+
"docs": {
|
|
174
|
+
"tags": [],
|
|
175
|
+
"text": ""
|
|
176
|
+
},
|
|
177
|
+
"attribute": "empty-list-label",
|
|
178
|
+
"reflect": false,
|
|
179
|
+
"defaultValue": "\"No results found.\""
|
|
180
|
+
},
|
|
138
181
|
"inline": {
|
|
139
182
|
"type": "boolean",
|
|
140
183
|
"mutable": false,
|
|
@@ -220,6 +263,58 @@ export class SwirlSelect {
|
|
|
220
263
|
"attribute": "required",
|
|
221
264
|
"reflect": false
|
|
222
265
|
},
|
|
266
|
+
"searchInputLabel": {
|
|
267
|
+
"type": "string",
|
|
268
|
+
"mutable": false,
|
|
269
|
+
"complexType": {
|
|
270
|
+
"original": "string",
|
|
271
|
+
"resolved": "string",
|
|
272
|
+
"references": {}
|
|
273
|
+
},
|
|
274
|
+
"required": false,
|
|
275
|
+
"optional": true,
|
|
276
|
+
"docs": {
|
|
277
|
+
"tags": [],
|
|
278
|
+
"text": ""
|
|
279
|
+
},
|
|
280
|
+
"attribute": "search-input-label",
|
|
281
|
+
"reflect": false,
|
|
282
|
+
"defaultValue": "\"Search options\""
|
|
283
|
+
},
|
|
284
|
+
"searchLoading": {
|
|
285
|
+
"type": "boolean",
|
|
286
|
+
"mutable": false,
|
|
287
|
+
"complexType": {
|
|
288
|
+
"original": "boolean",
|
|
289
|
+
"resolved": "boolean",
|
|
290
|
+
"references": {}
|
|
291
|
+
},
|
|
292
|
+
"required": false,
|
|
293
|
+
"optional": true,
|
|
294
|
+
"docs": {
|
|
295
|
+
"tags": [],
|
|
296
|
+
"text": ""
|
|
297
|
+
},
|
|
298
|
+
"attribute": "search-loading",
|
|
299
|
+
"reflect": false
|
|
300
|
+
},
|
|
301
|
+
"searchPlaceholder": {
|
|
302
|
+
"type": "string",
|
|
303
|
+
"mutable": false,
|
|
304
|
+
"complexType": {
|
|
305
|
+
"original": "string",
|
|
306
|
+
"resolved": "string",
|
|
307
|
+
"references": {}
|
|
308
|
+
},
|
|
309
|
+
"required": false,
|
|
310
|
+
"optional": true,
|
|
311
|
+
"docs": {
|
|
312
|
+
"tags": [],
|
|
313
|
+
"text": ""
|
|
314
|
+
},
|
|
315
|
+
"attribute": "search-placeholder",
|
|
316
|
+
"reflect": false
|
|
317
|
+
},
|
|
223
318
|
"selectId": {
|
|
224
319
|
"type": "string",
|
|
225
320
|
"mutable": false,
|
|
@@ -269,6 +364,23 @@ export class SwirlSelect {
|
|
|
269
364
|
"tags": [],
|
|
270
365
|
"text": ""
|
|
271
366
|
}
|
|
367
|
+
},
|
|
368
|
+
"withSearch": {
|
|
369
|
+
"type": "boolean",
|
|
370
|
+
"mutable": false,
|
|
371
|
+
"complexType": {
|
|
372
|
+
"original": "boolean",
|
|
373
|
+
"resolved": "boolean",
|
|
374
|
+
"references": {}
|
|
375
|
+
},
|
|
376
|
+
"required": false,
|
|
377
|
+
"optional": true,
|
|
378
|
+
"docs": {
|
|
379
|
+
"tags": [],
|
|
380
|
+
"text": ""
|
|
381
|
+
},
|
|
382
|
+
"attribute": "with-search",
|
|
383
|
+
"reflect": false
|
|
272
384
|
}
|
|
273
385
|
};
|
|
274
386
|
}
|
|
@@ -281,6 +393,21 @@ export class SwirlSelect {
|
|
|
281
393
|
}
|
|
282
394
|
static get events() {
|
|
283
395
|
return [{
|
|
396
|
+
"method": "searchChange",
|
|
397
|
+
"name": "searchChange",
|
|
398
|
+
"bubbles": true,
|
|
399
|
+
"cancelable": true,
|
|
400
|
+
"composed": true,
|
|
401
|
+
"docs": {
|
|
402
|
+
"tags": [],
|
|
403
|
+
"text": ""
|
|
404
|
+
},
|
|
405
|
+
"complexType": {
|
|
406
|
+
"original": "string",
|
|
407
|
+
"resolved": "string",
|
|
408
|
+
"references": {}
|
|
409
|
+
}
|
|
410
|
+
}, {
|
|
284
411
|
"method": "valueChange",
|
|
285
412
|
"name": "valueChange",
|
|
286
413
|
"bubbles": true,
|
|
@@ -35,6 +35,11 @@ describe("swirl-select", () => {
|
|
|
35
35
|
</span>
|
|
36
36
|
<swirl-popover animation="scale-in-y" class="select__popover" id="select-options-${page.root.selectId}" label="Select" usecontainerwidth="swirl-form-control">
|
|
37
37
|
<swirl-option-list allowdeselect="">
|
|
38
|
+
<div aria-disabled="true" class="select__empty-list-label" role="option">
|
|
39
|
+
<swirl-text color="subdued" weight="medium">
|
|
40
|
+
No results found.
|
|
41
|
+
</swirl-text>
|
|
42
|
+
</div>
|
|
38
43
|
<swirl-option-list-item label="This is an option 1" value="1"></swirl-option-list-item>
|
|
39
44
|
<swirl-option-list-item label="This is an option 2" value="2"></swirl-option-list-item>
|
|
40
45
|
</swirl-option-list>
|
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
import { c as classnames } from './index2.js';
|
|
3
3
|
import { q as querySelectorAllDeep } from './utils.js';
|
|
4
|
-
import { d as defineCustomElement$
|
|
5
|
-
import { d as defineCustomElement$
|
|
6
|
-
import { d as defineCustomElement$
|
|
7
|
-
import { d as defineCustomElement$
|
|
8
|
-
import { d as defineCustomElement$
|
|
9
|
-
import { d as defineCustomElement$
|
|
10
|
-
import { d as defineCustomElement$
|
|
4
|
+
import { d as defineCustomElement$c } from './swirl-icon-close2.js';
|
|
5
|
+
import { d as defineCustomElement$b } from './swirl-icon-expand-less2.js';
|
|
6
|
+
import { d as defineCustomElement$a } from './swirl-icon-expand-more2.js';
|
|
7
|
+
import { d as defineCustomElement$9 } from './swirl-icon-search2.js';
|
|
8
|
+
import { d as defineCustomElement$8 } from './swirl-option-list2.js';
|
|
9
|
+
import { d as defineCustomElement$7 } from './swirl-popover2.js';
|
|
10
|
+
import { d as defineCustomElement$6 } from './swirl-popover-trigger2.js';
|
|
11
|
+
import { d as defineCustomElement$5 } from './swirl-spinner2.js';
|
|
12
|
+
import { d as defineCustomElement$4 } from './swirl-tag2.js';
|
|
13
|
+
import { d as defineCustomElement$3 } from './swirl-text2.js';
|
|
11
14
|
import { d as defineCustomElement$2 } from './swirl-visually-hidden2.js';
|
|
12
15
|
|
|
13
|
-
const swirlSelectCss = ".sc-swirl-select-h{display:block;width:100%}.sc-swirl-select-h *.sc-swirl-select{box-sizing:border-box}.select.sc-swirl-select{position:relative;display:flex;width:100%}.select.sc-swirl-select .sc-swirl-select::part(popover__content){margin-top:var(--s-space-16)}.select--placement-top-start.sc-swirl-select .sc-swirl-select::part(popover__content){margin-top:-2.25rem}.select--multi.sc-swirl-select .select__input.sc-swirl-select{position:absolute;width:100%;height:100%;pointer-events:none;opacity:0}.select--multi.sc-swirl-select .select__multi-select-values.sc-swirl-select{display:flex}.select--disabled.sc-swirl-select .select__input.sc-swirl-select{color:var(--s-text-disabled)}.select--disabled.sc-swirl-select .select__indicator.sc-swirl-select{color:var(--s-icon-disabled)}.select--inline.sc-swirl-select .select__indicator.sc-swirl-select{transform:translateY(-50%)}.select__input.sc-swirl-select{display:block;overflow:hidden;width:100%;height:1.25rem;margin:0;padding:0;padding-right:calc(1.5rem + var(--s-space-8));border:none;background-color:transparent;font:inherit;line-height:var(--s-line-height-base);text-align:left;white-space:nowrap;text-overflow:ellipsis;cursor:default}.select__input.sc-swirl-select:focus{outline:none}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.select__input.sc-swirl-select{font-size:var(--s-font-size-sm);line-height:var(--s-line-height-sm)}}.select__multi-select-values.sc-swirl-select{display:none;overflow:hidden;width:100%;min-height:1.25rem;padding-right:calc(1.5rem + var(--s-space-8));flex-wrap:wrap;gap:var(--s-space-8)}.select__multi-select-values.sc-swirl-select .sc-swirl-select::part(tag){height:1.25rem;padding:0 var(--s-space-4)}.select__indicator.sc-swirl-select{position:absolute;top:50%;right:0;display:inline-flex;color:var(--s-icon-default);transform:translateY(calc(-50% - var(--s-space-8)))}";
|
|
16
|
+
const swirlSelectCss = ".sc-swirl-select-h{display:block;width:100%}.sc-swirl-select-h *.sc-swirl-select{box-sizing:border-box}.select.sc-swirl-select{position:relative;display:flex;width:100%}.select.sc-swirl-select .sc-swirl-select::part(popover__content){margin-top:var(--s-space-16)}.select--placement-top-start.sc-swirl-select .sc-swirl-select::part(popover__content){margin-top:-2.25rem}.select--multi.sc-swirl-select .select__input.sc-swirl-select{position:absolute;width:100%;height:100%;pointer-events:none;opacity:0}.select--multi.sc-swirl-select .select__multi-select-values.sc-swirl-select{display:flex}.select--disabled.sc-swirl-select .select__input.sc-swirl-select{color:var(--s-text-disabled)}.select--disabled.sc-swirl-select .select__indicator.sc-swirl-select{color:var(--s-icon-disabled)}.select--inline.sc-swirl-select .select__indicator.sc-swirl-select{transform:translateY(-50%)}.select--search-loading.sc-swirl-select .select__search-input.sc-swirl-select{padding-right:calc(var(--s-space-12) + 1.5rem + var(--s-space-8))}.select__input.sc-swirl-select{display:block;overflow:hidden;width:100%;height:1.25rem;margin:0;padding:0;padding-right:calc(1.5rem + var(--s-space-8));border:none;background-color:transparent;font:inherit;line-height:var(--s-line-height-base);text-align:left;white-space:nowrap;text-overflow:ellipsis;cursor:default}.select__input.sc-swirl-select:focus{outline:none}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.select__input.sc-swirl-select{font-size:var(--s-font-size-sm);line-height:var(--s-line-height-sm)}}.select__multi-select-values.sc-swirl-select{display:none;overflow:hidden;width:100%;min-height:1.25rem;padding-right:calc(1.5rem + var(--s-space-8));flex-wrap:wrap;gap:var(--s-space-8)}.select__multi-select-values.sc-swirl-select .sc-swirl-select::part(tag){height:1.25rem;padding:0 var(--s-space-4)}.select__indicator.sc-swirl-select{position:absolute;top:50%;right:0;display:inline-flex;color:var(--s-icon-default);transform:translateY(calc(-50% - var(--s-space-8)))}.select__search.sc-swirl-select{position:relative;display:flex;width:100%;padding:0.0625rem var(--s-space-8);border-bottom:0.0625rem solid var(--s-border-default)}@media (min-width: 768px){.select__search.sc-swirl-select{padding:0.0625rem}}.select__search-icon.sc-swirl-select{position:absolute;top:50%;left:calc(var(--s-space-8) * 2);display:inline-flex;color:var(--s-icon-default);transform:translateY(-50%)}@media (min-width: 768px){.select__search-icon.sc-swirl-select{left:var(--s-space-12);padding:0.0625rem}}.select__search-input.sc-swirl-select{width:100%;height:2.5rem;padding-right:var(--s-space-12);padding-left:calc(var(--s-space-12) + 1.25rem + var(--s-space-8));align-items:center;border:none;color:var(--s-text-default);background-color:var(--s-surface-overlay-default);font:inherit;line-height:var(--s-line-height-base);caret-color:var(--s-border-highlight)}.select__search-input.sc-swirl-select:focus:not(:focus-visible){outline:none}.select__search-input.sc-swirl-select:focus-visible{outline-color:var(--s-focus-default)}.select__search-input.sc-swirl-select::-moz-placeholder{color:var(--s-text-subdued)}.select__search-input.sc-swirl-select::placeholder{color:var(--s-text-subdued)}.select__search-input.sc-swirl-select::-webkit-search-decoration,.select__search-input.sc-swirl-select::-webkit-search-cancel-button,.select__search-input.sc-swirl-select::-webkit-search-results-button,.select__search-input.sc-swirl-select::-webkit-search-results-decoration{-webkit-appearance:none;appearance:none}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.select__search-input.sc-swirl-select{font-size:var(--s-font-size-sm);line-height:var(--s-line-height-sm)}}.select__search-spinner.sc-swirl-select{position:absolute;top:50%;right:var(--s-space-12);display:inline-flex;transform:translateY(-50%)}.select__empty-list-label.sc-swirl-select{padding:var(--s-space-12) var(--s-space-12) 0}.select__empty-list-label.sc-swirl-select:not(:only-child){display:none}@media (min-width: 768px){.select__empty-list-label.sc-swirl-select{padding:var(--s-space-12) var(--s-space-12) var(--s-space-8)}}";
|
|
14
17
|
|
|
15
18
|
const SwirlSelect$1 = /*@__PURE__*/ proxyCustomElement(class SwirlSelect extends HTMLElement {
|
|
16
19
|
constructor() {
|
|
17
20
|
super();
|
|
18
21
|
this.__registerHost();
|
|
22
|
+
this.searchChange = createEvent(this, "searchChange", 7);
|
|
19
23
|
this.valueChange = createEvent(this, "valueChange", 7);
|
|
20
24
|
this.select = (event) => {
|
|
21
25
|
this.value = event.detail;
|
|
@@ -37,28 +41,52 @@ const SwirlSelect$1 = /*@__PURE__*/ proxyCustomElement(class SwirlSelect extends
|
|
|
37
41
|
this.onOpen = (event) => {
|
|
38
42
|
this.placement = event.detail.position?.placement;
|
|
39
43
|
this.open = true;
|
|
40
|
-
this.
|
|
44
|
+
if (this.withSearch && Boolean(this.searchInput)) {
|
|
45
|
+
this.searchInput.focus();
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
this.optionList.querySelector('[tabIndex="0"]')?.focus();
|
|
49
|
+
}
|
|
41
50
|
};
|
|
42
51
|
this.onClose = () => {
|
|
52
|
+
if (Boolean(this.searchInput)) {
|
|
53
|
+
this.searchInput.value = "";
|
|
54
|
+
this.searchChange.emit("");
|
|
55
|
+
}
|
|
43
56
|
this.open = false;
|
|
44
57
|
this.input.focus();
|
|
45
58
|
};
|
|
46
59
|
this.onKeyDown = (event) => {
|
|
47
60
|
if (event.code === "Space" || event.code === "Enter") {
|
|
61
|
+
if (event.target === this.searchInput) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
48
64
|
event.preventDefault();
|
|
49
65
|
this.popover.open(this.el);
|
|
50
66
|
}
|
|
67
|
+
else if (event.code === "ArrowDown" &&
|
|
68
|
+
event.target === this.searchInput) {
|
|
69
|
+
this.optionList.querySelector('[tabIndex="0"]')?.focus();
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
this.onSearchInput = (event) => {
|
|
73
|
+
this.searchChange.emit(event.target.value);
|
|
51
74
|
};
|
|
52
75
|
this.allowDeselect = true;
|
|
53
76
|
this.disabled = undefined;
|
|
77
|
+
this.emptyListLabel = "No results found.";
|
|
54
78
|
this.inline = undefined;
|
|
55
79
|
this.invalid = undefined;
|
|
56
80
|
this.label = undefined;
|
|
57
81
|
this.multiSelect = undefined;
|
|
58
82
|
this.required = undefined;
|
|
83
|
+
this.searchInputLabel = "Search options";
|
|
84
|
+
this.searchLoading = undefined;
|
|
85
|
+
this.searchPlaceholder = undefined;
|
|
59
86
|
this.selectId = Math.round(Math.random() * 1000000).toString();
|
|
60
87
|
this.swirlAriaDescribedby = undefined;
|
|
61
88
|
this.value = undefined;
|
|
89
|
+
this.withSearch = undefined;
|
|
62
90
|
this.options = [];
|
|
63
91
|
this.open = undefined;
|
|
64
92
|
this.placement = undefined;
|
|
@@ -93,26 +121,32 @@ const SwirlSelect$1 = /*@__PURE__*/ proxyCustomElement(class SwirlSelect extends
|
|
|
93
121
|
"select--disabled": this.disabled,
|
|
94
122
|
"select--inline": this.inline,
|
|
95
123
|
"select--multi": this.multiSelect,
|
|
124
|
+
"select--search-loading": this.searchLoading,
|
|
96
125
|
});
|
|
97
126
|
return (h(Host, { onKeyDown: this.onKeyDown }, h("div", { class: className }, h("swirl-popover-trigger", { popover: this.popover, setAriaAttributes: false }, h("input", { "aria-describedby": this.swirlAriaDescribedby, "aria-disabled": this.disabled ? "true" : undefined, "aria-invalid": ariaInvalid, class: "select__input", disabled: this.disabled, readOnly: true, ref: (el) => (this.input = el), type: "text", value: label })), h("span", { class: "select__multi-select-values" }, this.value
|
|
98
127
|
?.map((value) => this.options.find((option) => option.value === value))
|
|
99
128
|
?.map((option) => (h("swirl-tag", { "aria-hidden": "true", label: option?.label,
|
|
100
129
|
// eslint-disable-next-line react/jsx-no-bind
|
|
101
|
-
onRemove: () => this.unselectOption(option?.value), removable: !this.disabled && this.allowDeselect })))), h("span", { class: "select__indicator" }, this.open ? (h("swirl-icon-expand-less", null)) : (h("swirl-icon-expand-more", null))), h("swirl-popover", { animation: "scale-in-y", class: "select__popover", id: `select-options-${this.selectId}`, label: this.label, offset: [0, offset], onPopoverClose: this.onClose, onPopoverOpen: this.onOpen, ref: (el) => (this.popover = el), useContainerWidth: "swirl-form-control" }, h("swirl-option-list", { allowDeselect: this.allowDeselect, onValueChange: this.select, multiSelect: this.multiSelect, ref: (el) => (this.optionList = el), value: this.value }, h("slot", { onSlotchange: this.onSlotChange }))))));
|
|
130
|
+
onRemove: () => this.unselectOption(option?.value), removable: !this.disabled && this.allowDeselect })))), h("span", { class: "select__indicator" }, this.open ? (h("swirl-icon-expand-less", null)) : (h("swirl-icon-expand-more", null))), h("swirl-popover", { animation: "scale-in-y", class: "select__popover", id: `select-options-${this.selectId}`, label: this.label, offset: [0, offset], onPopoverClose: this.onClose, onPopoverOpen: this.onOpen, ref: (el) => (this.popover = el), useContainerWidth: "swirl-form-control" }, this.withSearch && (h("div", { class: "select__search" }, h("swirl-icon-search", { class: "select__search-icon", size: 20 }), h("input", { "aria-label": this.searchInputLabel, class: "select__search-input", onInput: this.onSearchInput, placeholder: this.searchPlaceholder, ref: (el) => (this.searchInput = el), type: "search" }), this.searchLoading && (h("swirl-spinner", { class: "select__search-spinner", size: "s" })))), h("swirl-option-list", { allowDeselect: this.allowDeselect, onValueChange: this.select, multiSelect: this.multiSelect, ref: (el) => (this.optionList = el), value: this.value }, !this.searchLoading && (h("div", { "aria-disabled": "true", class: "select__empty-list-label", role: "option" }, h("swirl-text", { color: "subdued", weight: "medium" }, this.emptyListLabel))), h("slot", { onSlotchange: this.onSlotChange }))))));
|
|
102
131
|
}
|
|
103
132
|
get el() { return this; }
|
|
104
133
|
static get style() { return swirlSelectCss; }
|
|
105
134
|
}, [6, "swirl-select", {
|
|
106
135
|
"allowDeselect": [4, "allow-deselect"],
|
|
107
136
|
"disabled": [4],
|
|
137
|
+
"emptyListLabel": [1, "empty-list-label"],
|
|
108
138
|
"inline": [4],
|
|
109
139
|
"invalid": [4],
|
|
110
140
|
"label": [1],
|
|
111
141
|
"multiSelect": [4, "multi-select"],
|
|
112
142
|
"required": [4],
|
|
143
|
+
"searchInputLabel": [1, "search-input-label"],
|
|
144
|
+
"searchLoading": [4, "search-loading"],
|
|
145
|
+
"searchPlaceholder": [1, "search-placeholder"],
|
|
113
146
|
"selectId": [1, "select-id"],
|
|
114
147
|
"swirlAriaDescribedby": [1, "swirl-aria-describedby"],
|
|
115
148
|
"value": [1040],
|
|
149
|
+
"withSearch": [4, "with-search"],
|
|
116
150
|
"options": [32],
|
|
117
151
|
"open": [32],
|
|
118
152
|
"placement": [32]
|
|
@@ -121,7 +155,7 @@ function defineCustomElement$1() {
|
|
|
121
155
|
if (typeof customElements === "undefined") {
|
|
122
156
|
return;
|
|
123
157
|
}
|
|
124
|
-
const components = ["swirl-select", "swirl-icon-close", "swirl-icon-expand-less", "swirl-icon-expand-more", "swirl-option-list", "swirl-popover", "swirl-popover-trigger", "swirl-tag", "swirl-visually-hidden"];
|
|
158
|
+
const components = ["swirl-select", "swirl-icon-close", "swirl-icon-expand-less", "swirl-icon-expand-more", "swirl-icon-search", "swirl-option-list", "swirl-popover", "swirl-popover-trigger", "swirl-spinner", "swirl-tag", "swirl-text", "swirl-visually-hidden"];
|
|
125
159
|
components.forEach(tagName => { switch (tagName) {
|
|
126
160
|
case "swirl-select":
|
|
127
161
|
if (!customElements.get(tagName)) {
|
|
@@ -130,35 +164,50 @@ function defineCustomElement$1() {
|
|
|
130
164
|
break;
|
|
131
165
|
case "swirl-icon-close":
|
|
132
166
|
if (!customElements.get(tagName)) {
|
|
133
|
-
defineCustomElement$
|
|
167
|
+
defineCustomElement$c();
|
|
134
168
|
}
|
|
135
169
|
break;
|
|
136
170
|
case "swirl-icon-expand-less":
|
|
137
171
|
if (!customElements.get(tagName)) {
|
|
138
|
-
defineCustomElement$
|
|
172
|
+
defineCustomElement$b();
|
|
139
173
|
}
|
|
140
174
|
break;
|
|
141
175
|
case "swirl-icon-expand-more":
|
|
142
176
|
if (!customElements.get(tagName)) {
|
|
143
|
-
defineCustomElement$
|
|
177
|
+
defineCustomElement$a();
|
|
178
|
+
}
|
|
179
|
+
break;
|
|
180
|
+
case "swirl-icon-search":
|
|
181
|
+
if (!customElements.get(tagName)) {
|
|
182
|
+
defineCustomElement$9();
|
|
144
183
|
}
|
|
145
184
|
break;
|
|
146
185
|
case "swirl-option-list":
|
|
147
186
|
if (!customElements.get(tagName)) {
|
|
148
|
-
defineCustomElement$
|
|
187
|
+
defineCustomElement$8();
|
|
149
188
|
}
|
|
150
189
|
break;
|
|
151
190
|
case "swirl-popover":
|
|
152
191
|
if (!customElements.get(tagName)) {
|
|
153
|
-
defineCustomElement$
|
|
192
|
+
defineCustomElement$7();
|
|
154
193
|
}
|
|
155
194
|
break;
|
|
156
195
|
case "swirl-popover-trigger":
|
|
157
196
|
if (!customElements.get(tagName)) {
|
|
158
|
-
defineCustomElement$
|
|
197
|
+
defineCustomElement$6();
|
|
198
|
+
}
|
|
199
|
+
break;
|
|
200
|
+
case "swirl-spinner":
|
|
201
|
+
if (!customElements.get(tagName)) {
|
|
202
|
+
defineCustomElement$5();
|
|
159
203
|
}
|
|
160
204
|
break;
|
|
161
205
|
case "swirl-tag":
|
|
206
|
+
if (!customElements.get(tagName)) {
|
|
207
|
+
defineCustomElement$4();
|
|
208
|
+
}
|
|
209
|
+
break;
|
|
210
|
+
case "swirl-text":
|
|
162
211
|
if (!customElements.get(tagName)) {
|
|
163
212
|
defineCustomElement$3();
|
|
164
213
|
}
|
|
@@ -3055,10 +3055,6 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
3055
3055
|
return import(
|
|
3056
3056
|
/* webpackMode: "lazy" */
|
|
3057
3057
|
'./swirl-icon-person.entry.js').then(processMod, consoleError);
|
|
3058
|
-
case 'swirl-icon-search':
|
|
3059
|
-
return import(
|
|
3060
|
-
/* webpackMode: "lazy" */
|
|
3061
|
-
'./swirl-icon-search.entry.js').then(processMod, consoleError);
|
|
3062
3058
|
case 'swirl-icon-time-outlined':
|
|
3063
3059
|
return import(
|
|
3064
3060
|
/* webpackMode: "lazy" */
|
|
@@ -3083,6 +3079,10 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
3083
3079
|
return import(
|
|
3084
3080
|
/* webpackMode: "lazy" */
|
|
3085
3081
|
'./swirl-file-viewer_7.entry.js').then(processMod, consoleError);
|
|
3082
|
+
case 'swirl-icon-search':
|
|
3083
|
+
return import(
|
|
3084
|
+
/* webpackMode: "lazy" */
|
|
3085
|
+
'./swirl-icon-search.entry.js').then(processMod, consoleError);
|
|
3086
3086
|
case 'swirl-icon-cancel_4':
|
|
3087
3087
|
return import(
|
|
3088
3088
|
/* webpackMode: "lazy" */
|
|
@@ -3123,14 +3123,14 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
3123
3123
|
return import(
|
|
3124
3124
|
/* webpackMode: "lazy" */
|
|
3125
3125
|
'./swirl-icon-close.entry.js').then(processMod, consoleError);
|
|
3126
|
-
case 'swirl-text':
|
|
3127
|
-
return import(
|
|
3128
|
-
/* webpackMode: "lazy" */
|
|
3129
|
-
'./swirl-text.entry.js').then(processMod, consoleError);
|
|
3130
3126
|
case 'swirl-icon-error_3':
|
|
3131
3127
|
return import(
|
|
3132
3128
|
/* webpackMode: "lazy" */
|
|
3133
3129
|
'./swirl-icon-error_3.entry.js').then(processMod, consoleError);
|
|
3130
|
+
case 'swirl-text':
|
|
3131
|
+
return import(
|
|
3132
|
+
/* webpackMode: "lazy" */
|
|
3133
|
+
'./swirl-text.entry.js').then(processMod, consoleError);
|
|
3134
3134
|
case 'swirl-stack':
|
|
3135
3135
|
return import(
|
|
3136
3136
|
/* webpackMode: "lazy" */
|