@threadlabs/looma 0.1.28 → 0.2.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/dist/{chunk-G5AWV77V.js → chunk-JXSHRMYW.js} +32 -33
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/looma.cjs.js +1 -1
- package/dist/cjs/ui-chip_2.cjs.entry.js +190 -498
- package/dist/cjs/ui-combobox.cjs.entry.js +708 -0
- package/dist/cjs/ui-context-menu.cjs.entry.js +1 -1
- package/dist/cjs/ui-dialog.cjs.entry.js +1 -1
- package/dist/cjs/ui-disclosure.cjs.entry.js +1 -1
- package/dist/cjs/ui-editable.cjs.entry.js +3 -3
- package/dist/cjs/ui-floating-action-button.cjs.entry.js +1 -1
- package/dist/cjs/ui-form-field.cjs.entry.js +1 -1
- package/dist/cjs/ui-icon-button.cjs.entry.js +1 -1
- package/dist/cjs/ui-input.cjs.entry.js +1 -1
- package/dist/cjs/ui-menu-item.cjs.entry.js +1 -1
- package/dist/cjs/ui-menu.cjs.entry.js +1 -1
- package/dist/cjs/ui-popover.cjs.entry.js +1 -1
- package/dist/cjs/ui-radio-group.cjs.entry.js +1 -1
- package/dist/cjs/ui-radio.cjs.entry.js +1 -1
- package/dist/cjs/ui-search-result-row.cjs.entry.js +1 -1
- package/dist/cjs/ui-search-shell.cjs.entry.js +1 -1
- package/dist/cjs/ui-select.cjs.entry.js +1 -1
- package/dist/cjs/ui-switch.cjs.entry.js +2 -2
- package/dist/cjs/ui-tabs.cjs.entry.js +1 -1
- package/dist/cjs/ui-textarea.cjs.entry.js +1 -1
- package/dist/cjs/ui-toast-region.cjs.entry.js +1 -1
- package/dist/cjs/ui-top-bar.cjs.entry.js +1 -1
- package/dist/cjs/ui-tree-item.cjs.entry.js +2 -2
- package/dist/cjs/ui-tree.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +0 -1
- package/dist/collection/components/ui-combobox/ui-combobox.css +23 -0
- package/dist/collection/components/ui-combobox/ui-combobox.js +298 -21
- package/dist/collection/components/ui-context-menu/ui-context-menu.js +1 -1
- package/dist/collection/components/ui-dialog/ui-dialog.js +1 -1
- package/dist/collection/components/ui-disclosure/ui-disclosure.js +1 -1
- package/dist/collection/components/ui-editable/ui-editable.js +3 -3
- package/dist/collection/components/ui-floating-action-button/ui-floating-action-button.js +1 -1
- package/dist/collection/components/ui-form-field/ui-form-field.js +1 -1
- package/dist/collection/components/ui-icon-button/ui-icon-button.js +1 -1
- package/dist/collection/components/ui-input/ui-input.js +1 -1
- package/dist/collection/components/ui-menu/ui-menu.js +1 -1
- package/dist/collection/components/ui-menu-item/ui-menu-item.js +1 -1
- package/dist/collection/components/ui-popover/ui-popover.js +1 -1
- package/dist/collection/components/ui-radio/ui-radio.js +1 -1
- package/dist/collection/components/ui-radio-group/ui-radio-group.js +1 -1
- package/dist/collection/components/ui-search-result-row/ui-search-result-row.js +1 -1
- package/dist/collection/components/ui-search-shell/ui-search-shell.js +1 -1
- package/dist/collection/components/ui-select/ui-select.js +1 -1
- package/dist/collection/components/ui-switch/ui-switch.js +2 -2
- package/dist/collection/components/ui-tabs/ui-tabs.js +1 -1
- package/dist/collection/components/ui-textarea/ui-textarea.js +1 -1
- package/dist/collection/components/ui-toast-region/ui-toast-region.js +1 -1
- package/dist/collection/components/ui-tooltip/ui-tooltip.js +1 -1
- package/dist/collection/components/ui-top-bar/ui-top-bar.js +1 -1
- package/dist/collection/components/ui-tree/ui-tree.js +1 -1
- package/dist/collection/components/ui-tree-item/ui-tree-item.js +2 -2
- package/dist/components/index.d.ts +0 -2
- package/dist/components/index.js +1 -1
- package/dist/components/{p-B1macZOS.js → p-DWN2m6ta.js} +1 -1
- package/dist/components/p-DYiNETk6.js +1 -0
- package/dist/components/ui-combobox.js +1 -1
- package/dist/components/ui-context-menu.js +1 -1
- package/dist/components/ui-dialog.js +1 -1
- package/dist/components/ui-disclosure.js +1 -1
- package/dist/components/ui-editable.js +1 -1
- package/dist/components/ui-floating-action-button.js +1 -1
- package/dist/components/ui-form-field.js +1 -1
- package/dist/components/ui-icon-button.js +1 -1
- package/dist/components/ui-input.js +1 -1
- package/dist/components/ui-menu-item.js +1 -1
- package/dist/components/ui-menu.js +1 -1
- package/dist/components/ui-popover.js +1 -1
- package/dist/components/ui-radio-group.js +1 -1
- package/dist/components/ui-radio.js +1 -1
- package/dist/components/ui-search-result-row.js +1 -1
- package/dist/components/ui-search-shell.js +1 -1
- package/dist/components/ui-select.js +1 -1
- package/dist/components/ui-switch.js +1 -1
- package/dist/components/ui-tabs.js +1 -1
- package/dist/components/ui-textarea.js +1 -1
- package/dist/components/ui-toast-region.js +1 -1
- package/dist/components/ui-tooltip.js +1 -1
- package/dist/components/ui-top-bar.js +1 -1
- package/dist/components/ui-tree-item.js +1 -1
- package/dist/components/ui-tree.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/looma.js +1 -1
- package/dist/esm/ui-chip_2.entry.js +192 -500
- package/dist/esm/ui-combobox.entry.js +706 -0
- package/dist/esm/ui-context-menu.entry.js +1 -1
- package/dist/esm/ui-dialog.entry.js +1 -1
- package/dist/esm/ui-disclosure.entry.js +1 -1
- package/dist/esm/ui-editable.entry.js +3 -3
- package/dist/esm/ui-floating-action-button.entry.js +1 -1
- package/dist/esm/ui-form-field.entry.js +1 -1
- package/dist/esm/ui-icon-button.entry.js +1 -1
- package/dist/esm/ui-input.entry.js +1 -1
- package/dist/esm/ui-menu-item.entry.js +1 -1
- package/dist/esm/ui-menu.entry.js +1 -1
- package/dist/esm/ui-popover.entry.js +1 -1
- package/dist/esm/ui-radio-group.entry.js +1 -1
- package/dist/esm/ui-radio.entry.js +1 -1
- package/dist/esm/ui-search-result-row.entry.js +1 -1
- package/dist/esm/ui-search-shell.entry.js +1 -1
- package/dist/esm/ui-select.entry.js +1 -1
- package/dist/esm/ui-switch.entry.js +2 -2
- package/dist/esm/ui-tabs.entry.js +1 -1
- package/dist/esm/ui-textarea.entry.js +1 -1
- package/dist/esm/ui-toast-region.entry.js +1 -1
- package/dist/esm/ui-top-bar.entry.js +1 -1
- package/dist/esm/ui-tree-item.entry.js +2 -2
- package/dist/esm/ui-tree.entry.js +1 -1
- package/dist/index.cjs +471 -514
- package/dist/index.js +2 -2
- package/dist/looma/looma.esm.js +1 -1
- package/dist/looma/{p-9a82c523.entry.js → p-1249a806.entry.js} +1 -1
- package/dist/looma/p-1c00670f.entry.js +1 -0
- package/dist/looma/p-22842f8c.entry.js +1 -0
- package/dist/looma/{p-1e1de77f.entry.js → p-2915d5c0.entry.js} +1 -1
- package/dist/looma/{p-88e61cab.entry.js → p-37ec2b4b.entry.js} +1 -1
- package/dist/looma/{p-2f3c1b57.entry.js → p-3b2961a6.entry.js} +1 -1
- package/dist/looma/{p-e07e6ac2.entry.js → p-3f60f4c8.entry.js} +1 -1
- package/dist/looma/{p-9551ebf6.entry.js → p-424d6719.entry.js} +1 -1
- package/dist/looma/{p-6cc3180b.entry.js → p-4caccfce.entry.js} +1 -1
- package/dist/looma/p-55e06e2e.entry.js +1 -0
- package/dist/looma/{p-3957f7ef.entry.js → p-56dac38a.entry.js} +1 -1
- package/dist/looma/p-5cbbf7a0.entry.js +1 -0
- package/dist/looma/{p-f431dc13.entry.js → p-6f20d470.entry.js} +1 -1
- package/dist/looma/{p-b68762f2.entry.js → p-7c0b5364.entry.js} +1 -1
- package/dist/looma/{p-e82f104c.entry.js → p-8bdd9495.entry.js} +1 -1
- package/dist/looma/{p-df696cca.entry.js → p-9cfbf722.entry.js} +1 -1
- package/dist/looma/{p-607c3056.entry.js → p-b6ede6bb.entry.js} +1 -1
- package/dist/looma/p-b6fb6ba3.entry.js +1 -0
- package/dist/looma/{p-da6e2d01.entry.js → p-b76e2111.entry.js} +1 -1
- package/dist/looma/{p-1a12eb5c.entry.js → p-d372b0db.entry.js} +1 -1
- package/dist/looma/p-d46317e0.entry.js +1 -0
- package/dist/looma/{p-20387ffa.entry.js → p-d4825822.entry.js} +1 -1
- package/dist/looma/{p-8a5e3fe1.entry.js → p-d5c3954f.entry.js} +1 -1
- package/dist/looma/{p-4f68f939.entry.js → p-e604e906.entry.js} +1 -1
- package/dist/looma/{p-e406656e.entry.js → p-f1f7c5cb.entry.js} +1 -1
- package/dist/types/components/ui-combobox/ui-combobox.d.ts +35 -4
- package/dist/types/components.d.ts +56 -153
- package/dist/{ui-affordance-scope.entry-X5526PRP.js → ui-affordance-scope.entry-VR7FLAWG.js} +1 -1
- package/dist/{ui-avatar-group.entry-U72MPB5K.js → ui-avatar-group.entry-L3UKOY3U.js} +1 -1
- package/dist/{ui-avatar.entry-OC4J3LTV.js → ui-avatar.entry-VM5OHEFQ.js} +1 -1
- package/dist/{ui-badge.entry-4MSUQRQV.js → ui-badge.entry-ZTM4OPUD.js} +1 -1
- package/dist/{ui-button.entry-22DESWN4.js → ui-button.entry-CIPUSV5B.js} +1 -1
- package/dist/{ui-callout.entry-LOGODDM5.js → ui-callout.entry-OBFCI2O7.js} +1 -1
- package/dist/{ui-checkbox.entry-XAGW3BW4.js → ui-checkbox.entry-XT6ET56H.js} +1 -1
- package/dist/{ui-tooltip.entry-AQ6UPBUP.js → ui-chip_2.entry-32SHCLV6.js} +18 -3
- package/dist/{ui-chip_2.entry-JCPHPXAG.js → ui-combobox.entry-ONBBPQ2C.js} +169 -30
- package/dist/{ui-context-menu.entry-24YOHF7L.js → ui-context-menu.entry-RXNUOK24.js} +2 -2
- package/dist/{ui-dialog.entry-XKNYDWOQ.js → ui-dialog.entry-IJXNUARC.js} +2 -2
- package/dist/{ui-disclosure.entry-2AWCGZ4C.js → ui-disclosure.entry-5QS7UDRH.js} +2 -2
- package/dist/{ui-editable.entry-HLEWO7BN.js → ui-editable.entry-D7LOQN2H.js} +3 -3
- package/dist/{ui-floating-action-button.entry-2NJDB4YN.js → ui-floating-action-button.entry-XQZCTZQT.js} +2 -2
- package/dist/{ui-form-field.entry-FJ5HYCTN.js → ui-form-field.entry-A654LJZE.js} +2 -2
- package/dist/{ui-icon-button.entry-YZHJQ5YR.js → ui-icon-button.entry-MJ7F7ZIH.js} +2 -2
- package/dist/{ui-input.entry-JMBLMNP6.js → ui-input.entry-B2XM7JQU.js} +2 -2
- package/dist/{ui-menu-item.entry-VBGXM66D.js → ui-menu-item.entry-JULYSFVW.js} +2 -2
- package/dist/{ui-menu.entry-I2N5H3YC.js → ui-menu.entry-ORRWW7HD.js} +2 -2
- package/dist/{ui-popover.entry-7JRSJM5S.js → ui-popover.entry-W67V4UPA.js} +2 -2
- package/dist/{ui-radio-group.entry-Q2XB7P3B.js → ui-radio-group.entry-KCFOR27M.js} +2 -2
- package/dist/{ui-radio.entry-NJO4NA4M.js → ui-radio.entry-I2P4V5E3.js} +2 -2
- package/dist/{ui-search-result-row.entry-RPMNDSRN.js → ui-search-result-row.entry-GHODLSLR.js} +2 -2
- package/dist/{ui-search-shell.entry-FMIMYD3B.js → ui-search-shell.entry-PDB5UN4B.js} +2 -2
- package/dist/{ui-select.entry-7NDBWNAU.js → ui-select.entry-D3CZHCKB.js} +2 -2
- package/dist/{ui-switch.entry-YUCPIZE4.js → ui-switch.entry-WUDRL4H5.js} +3 -3
- package/dist/{ui-tabs.entry-FXZWV665.js → ui-tabs.entry-MW64GKIJ.js} +2 -2
- package/dist/{ui-textarea.entry-HHLQR5GG.js → ui-textarea.entry-VHRBYY6G.js} +2 -2
- package/dist/{ui-toast-region.entry-PIIBHNYA.js → ui-toast-region.entry-ET75RWYP.js} +2 -2
- package/dist/{ui-top-bar.entry-S2L7ZM4U.js → ui-top-bar.entry-QIYA3LD3.js} +2 -2
- package/dist/{ui-tree-item.entry-UID7IJPA.js → ui-tree-item.entry-BDB7VEUS.js} +3 -3
- package/dist/{ui-tree.entry-UMD3DNG5.js → ui-tree.entry-GSC7BPRN.js} +2 -2
- package/package.json +1 -1
- package/vue/{chunk-2DDIBSFD.js → chunk-ROMBQS2L.js} +32 -89
- package/vue/editor/index.js +1 -1
- package/vue/index.d.ts +30 -107
- package/vue/index.js +1 -3
- package/dist/cjs/ui-multi-combobox.cjs.entry.js +0 -190
- package/dist/cjs/ui-tooltip.cjs.entry.js +0 -241
- package/dist/collection/components/ui-multi-combobox/ui-multi-combobox.css +0 -33
- package/dist/collection/components/ui-multi-combobox/ui-multi-combobox.js +0 -553
- package/dist/components/p-DiyiodGX.js +0 -1
- package/dist/components/p-d5fk1vBI.js +0 -1
- package/dist/components/ui-multi-combobox.d.ts +0 -11
- package/dist/components/ui-multi-combobox.js +0 -1
- package/dist/esm/ui-multi-combobox.entry.js +0 -188
- package/dist/esm/ui-tooltip.entry.js +0 -239
- package/dist/looma/p-071c139c.entry.js +0 -1
- package/dist/looma/p-311e54d4.entry.js +0 -1
- package/dist/looma/p-4a10a875.entry.js +0 -1
- package/dist/looma/p-4fc9917f.entry.js +0 -1
- package/dist/looma/p-63a9159f.entry.js +0 -1
- package/dist/looma/p-82de1112.entry.js +0 -1
- package/dist/looma/p-caa37be2.entry.js +0 -1
- package/dist/types/components/ui-multi-combobox/ui-multi-combobox.d.ts +0 -51
- package/dist/ui-multi-combobox.entry-MEX7MU7P.js +0 -196
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Host,
|
|
3
|
-
createEvent,
|
|
4
|
-
getElement,
|
|
5
|
-
h,
|
|
6
|
-
registerInstance
|
|
7
|
-
} from "./chunk-G5AWV77V.js";
|
|
8
|
-
|
|
9
|
-
// dist/esm/ui-multi-combobox.entry.js
|
|
10
|
-
var uiMultiComboboxCss = () => `:host{display:block;min-inline-size:0;color:var(--ui-text-primary);font:inherit}ui-combobox::part(field){flex-wrap:wrap;align-items:center;gap:var(--ui-space-1);min-block-size:var(--ui-multi-combobox-min-block-size, 2.5rem);padding:var(--ui-space-1)}ui-combobox::part(input){flex:1 0 var(--ui-multi-combobox-input-min-inline-size, 5rem);width:auto;min-block-size:1.75rem;padding:var(--ui-space-0-5) var(--ui-space-1)}.items{display:contents}.item{appearance:none;display:inline-flex;min-inline-size:0;max-inline-size:min(100%, var(--ui-multi-combobox-item-max-inline-size, 12rem));overflow:hidden;padding:0;border:0;border-radius:var(--ui-radius-1);background:transparent;color:inherit;font:inherit;cursor:default}.item>slot{display:block;min-inline-size:0;max-inline-size:100%;overflow:hidden}.item>slot::slotted(*){min-inline-size:0;max-inline-size:100%}.item:focus-visible{outline:2px solid var(--ui-focus-ring);outline-offset:1px}.item:disabled{opacity:.6}`;
|
|
11
|
-
var UIMultiCombobox = class {
|
|
12
|
-
constructor(hostRef) {
|
|
13
|
-
registerInstance(this, hostRef);
|
|
14
|
-
this.queryChange = createEvent(this, "query-change");
|
|
15
|
-
this.addItem = createEvent(this, "add-item");
|
|
16
|
-
this.removeItem = createEvent(this, "remove-item");
|
|
17
|
-
this.createItem = createEvent(this, "create-item");
|
|
18
|
-
this.optionsChange = createEvent(this, "options-change");
|
|
19
|
-
}
|
|
20
|
-
get host() {
|
|
21
|
-
return getElement(this);
|
|
22
|
-
}
|
|
23
|
-
label = "";
|
|
24
|
-
placeholder = "";
|
|
25
|
-
items = [];
|
|
26
|
-
config = {};
|
|
27
|
-
query;
|
|
28
|
-
defaultQuery = "";
|
|
29
|
-
/** Characters that commit the current query and leave the input ready for the next item. */
|
|
30
|
-
tokenSeparators = [];
|
|
31
|
-
disabled = false;
|
|
32
|
-
readOnly = false;
|
|
33
|
-
required = false;
|
|
34
|
-
name = "";
|
|
35
|
-
queryChange;
|
|
36
|
-
addItem;
|
|
37
|
-
removeItem;
|
|
38
|
-
createItem;
|
|
39
|
-
optionsChange;
|
|
40
|
-
raw = "";
|
|
41
|
-
rows = [];
|
|
42
|
-
combobox;
|
|
43
|
-
filteredConfig;
|
|
44
|
-
filteredConfigSource;
|
|
45
|
-
filteredSelection = "";
|
|
46
|
-
componentWillLoad() {
|
|
47
|
-
this.raw = this.query ?? this.defaultQuery;
|
|
48
|
-
}
|
|
49
|
-
syncQuery() {
|
|
50
|
-
if (this.query !== void 0)
|
|
51
|
-
this.raw = this.query;
|
|
52
|
-
}
|
|
53
|
-
get selectedValues() {
|
|
54
|
-
return new Set(this.items.map((item) => item.value));
|
|
55
|
-
}
|
|
56
|
-
get comboboxConfig() {
|
|
57
|
-
const selectionKey = this.items.map((item) => item.value).join("\0");
|
|
58
|
-
if (this.filteredConfig && this.filteredConfigSource === this.config && this.filteredSelection === selectionKey) {
|
|
59
|
-
return this.filteredConfig;
|
|
60
|
-
}
|
|
61
|
-
const ownerFilter = this.config.filter;
|
|
62
|
-
const selected = this.selectedValues;
|
|
63
|
-
this.filteredConfigSource = this.config;
|
|
64
|
-
this.filteredSelection = selectionKey;
|
|
65
|
-
this.filteredConfig = {
|
|
66
|
-
...this.config,
|
|
67
|
-
filter: (option, query, context) => !selected.has(option.value) && (ownerFilter ? ownerFilter(option, query, context) : option.label.toLocaleLowerCase().includes(query.toLocaleLowerCase()))
|
|
68
|
-
};
|
|
69
|
-
return this.filteredConfig;
|
|
70
|
-
}
|
|
71
|
-
setQuery(query, trigger) {
|
|
72
|
-
if (this.query === void 0)
|
|
73
|
-
this.raw = query;
|
|
74
|
-
this.queryChange.emit({ query, display: query, trigger });
|
|
75
|
-
}
|
|
76
|
-
clearCommittedQuery(input, trigger) {
|
|
77
|
-
input.value = "";
|
|
78
|
-
this.raw = "";
|
|
79
|
-
this.setQuery("", trigger);
|
|
80
|
-
}
|
|
81
|
-
onQueryChange = (event) => {
|
|
82
|
-
event.stopPropagation();
|
|
83
|
-
this.setQuery(event.detail.query, event.detail.trigger);
|
|
84
|
-
};
|
|
85
|
-
onOptionsChange = (event) => {
|
|
86
|
-
event.stopPropagation();
|
|
87
|
-
this.rows = event.detail;
|
|
88
|
-
this.optionsChange.emit(event.detail);
|
|
89
|
-
};
|
|
90
|
-
onValueChange = (event) => {
|
|
91
|
-
event.stopPropagation();
|
|
92
|
-
if (event.detail.kind !== "selection" || !event.detail.option)
|
|
93
|
-
return;
|
|
94
|
-
const item = event.detail.option;
|
|
95
|
-
this.addItem.emit({ item, index: this.items.length, trigger: event.detail.trigger });
|
|
96
|
-
queueMicrotask(() => this.setQuery("", event.detail.trigger));
|
|
97
|
-
};
|
|
98
|
-
onCreateEntry = (event) => {
|
|
99
|
-
event.stopPropagation();
|
|
100
|
-
const query = event.detail.query.trim();
|
|
101
|
-
if (!query)
|
|
102
|
-
return;
|
|
103
|
-
this.setQuery("", event.detail.trigger);
|
|
104
|
-
this.createItem.emit({ query, trigger: event.detail.trigger });
|
|
105
|
-
};
|
|
106
|
-
commitQuery(input, trigger) {
|
|
107
|
-
const query = this.raw.trim();
|
|
108
|
-
if (!query)
|
|
109
|
-
return;
|
|
110
|
-
const normalizedQuery = query.toLocaleLowerCase();
|
|
111
|
-
const option = this.rows.find((row) => row.label.trim().toLocaleLowerCase() === normalizedQuery);
|
|
112
|
-
if (option) {
|
|
113
|
-
this.clearCommittedQuery(input, trigger);
|
|
114
|
-
this.addItem.emit({ item: option, index: this.items.length, trigger });
|
|
115
|
-
} else if (this.config.allowCreate) {
|
|
116
|
-
this.clearCommittedQuery(input, trigger);
|
|
117
|
-
this.createItem.emit({ query, trigger });
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
remove(index, trigger) {
|
|
121
|
-
const item = this.items[index];
|
|
122
|
-
if (!item || item.disabled || this.disabled || this.readOnly)
|
|
123
|
-
return;
|
|
124
|
-
this.removeItem.emit({ item, index, trigger });
|
|
125
|
-
requestAnimationFrame(() => {
|
|
126
|
-
const buttons = this.host.shadowRoot?.querySelectorAll('[part="item"]') ?? [];
|
|
127
|
-
const next = buttons[Math.min(index, buttons.length - 1)] ?? buttons[index - 1];
|
|
128
|
-
if (next && next.dataset.value !== item.value)
|
|
129
|
-
next.focus();
|
|
130
|
-
else
|
|
131
|
-
void this.focusInput();
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
focusItem(index) {
|
|
135
|
-
this.host.shadowRoot?.querySelectorAll('[part="item"]')[index]?.focus();
|
|
136
|
-
}
|
|
137
|
-
onItemKeyDown = (event, index) => {
|
|
138
|
-
if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey)
|
|
139
|
-
return;
|
|
140
|
-
if (event.key === "ArrowLeft") {
|
|
141
|
-
event.preventDefault();
|
|
142
|
-
event.stopPropagation();
|
|
143
|
-
this.focusItem(Math.max(0, index - 1));
|
|
144
|
-
} else if (event.key === "ArrowRight") {
|
|
145
|
-
event.preventDefault();
|
|
146
|
-
event.stopPropagation();
|
|
147
|
-
if (index === this.items.length - 1)
|
|
148
|
-
void this.focusInput();
|
|
149
|
-
else
|
|
150
|
-
this.focusItem(index + 1);
|
|
151
|
-
} else if (event.key === "Backspace" || event.key === "Delete") {
|
|
152
|
-
event.preventDefault();
|
|
153
|
-
event.stopPropagation();
|
|
154
|
-
this.remove(index, "keyboard");
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
onKeyDown = (event) => {
|
|
158
|
-
if (event.defaultPrevented || event.isComposing || this.disabled || this.readOnly || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey)
|
|
159
|
-
return;
|
|
160
|
-
const input = event.composedPath().find((node) => node instanceof HTMLInputElement);
|
|
161
|
-
if (!input)
|
|
162
|
-
return;
|
|
163
|
-
if (this.tokenSeparators.includes(event.key)) {
|
|
164
|
-
event.preventDefault();
|
|
165
|
-
event.stopPropagation();
|
|
166
|
-
this.commitQuery(input, "keyboard");
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
if (this.raw || (input.selectionStart ?? 0) > 0)
|
|
170
|
-
return;
|
|
171
|
-
if (event.key === "ArrowLeft" && this.items.length) {
|
|
172
|
-
event.preventDefault();
|
|
173
|
-
this.focusItem(this.items.length - 1);
|
|
174
|
-
} else if (event.key === "Backspace" && this.items.length) {
|
|
175
|
-
event.preventDefault();
|
|
176
|
-
this.remove(this.items.length - 1, "keyboard");
|
|
177
|
-
}
|
|
178
|
-
};
|
|
179
|
-
async focusInput() {
|
|
180
|
-
await this.combobox?.focusInput();
|
|
181
|
-
}
|
|
182
|
-
render() {
|
|
183
|
-
return h(Host, { key: "ba4db0fdca6cae344fe6b0bf06c933a9a90d2d3f", onKeyDown: this.onKeyDown }, h("ui-combobox", { key: "f5901b0b078b479425114d998618828cc458e7dd", ref: (element) => this.combobox = element, label: this.label, "label-visibility": "sr-only", placeholder: this.placeholder, name: this.name, value: null, query: this.raw, config: this.comboboxConfig, size: "sm", disabled: this.disabled, readOnly: this.readOnly, required: this.required, "onQuery-change": this.onQueryChange, "onValue-change": this.onValueChange, "onCreate-entry": this.onCreateEntry, "onOptions-change": this.onOptionsChange }, h("div", { key: "374c80862302d5c36f4849f42e5ed13222addd1c", slot: "start", class: "items", role: "group", "aria-label": `Selected ${this.label}` }, this.items.map((item, index) => h("button", { type: "button", part: "item", class: "item", "data-value": item.value, tabIndex: -1, disabled: this.disabled || this.readOnly || item.disabled, "aria-label": `${item.label}, press Delete or Backspace to remove`, onKeyDown: (event) => this.onItemKeyDown(event, index) }, h("slot", { name: `item-${item.id}` }, h("ui-chip", { appearance: "pill" }, item.label))))), this.rows.map((option) => h("span", { slot: `option-${option.id}` }, h("slot", { name: `option-${option.id}` }, option.label))), h("span", { key: "a23781c153e154cdff7066868c2da956e26b7d52", slot: "create" }, h("slot", { key: "e3bde0d1e549e785fff877a1a7aac10df308f7a3", name: "create" }, "Create \u201C", this.raw, "\u201D")), h("span", { key: "5837c4cde35d5984aaf1d364f1b850b9d63ff8ca", slot: "loading" }, h("slot", { key: "1bdfa30849bea752bc5c93268b3427c964d1b5d3", name: "loading" }, "Loading suggestions\u2026")), h("span", { key: "519d7b1a7f28f9d19cd441598a690c8b4fdacf5b", slot: "empty" }, h("slot", { key: "3163150e0f1edebb50509a5dacd576e4568eaaae", name: "empty" }, "No suggestions.")), h("span", { key: "655e4f85d70eb97f0f0ecb2bac7b4228f5cf580f", slot: "error" }, h("slot", { key: "a22667db30ee30003855ee69774eff3a4aab8566", name: "error" }, "Unable to load suggestions.")), h("div", { key: "b01b74f3fc7136a3bf1875c81b9f3a662f3e993c", slot: "footer" }, h("slot", { key: "7565ee0798072eebc6d1c458f89ce6c7941577dd", name: "footer" }))));
|
|
184
|
-
}
|
|
185
|
-
static get watchers() {
|
|
186
|
-
return {
|
|
187
|
-
"query": [{
|
|
188
|
-
"syncQuery": 0
|
|
189
|
-
}]
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
};
|
|
193
|
-
UIMultiCombobox.style = uiMultiComboboxCss();
|
|
194
|
-
export {
|
|
195
|
-
UIMultiCombobox as ui_multi_combobox
|
|
196
|
-
};
|