@threadlabs/looma 0.1.28 → 0.2.1
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-WW7Y67EW.js} +32 -33
- package/dist/{chunk-M7FPK6GN.js → chunk-Z4W5W53T.js} +19 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/looma.cjs.js +1 -1
- package/dist/cjs/{positioning-D5q9DM-0.js → positioning-BiPpyC-_.js} +26 -0
- package/dist/cjs/ui-affordance-scope.cjs.entry.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 +2 -2
- 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 +2 -2
- package/dist/cjs/ui-popover.cjs.entry.js +2 -2
- 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 +2 -2
- 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/collection/overlay/positioning.js +26 -0
- package/dist/components/index.d.ts +0 -2
- package/dist/components/index.js +1 -1
- package/dist/components/p-BOC_l2hE.js +1 -0
- package/dist/components/{p-B1macZOS.js → p-Btk_75st.js} +1 -1
- package/dist/components/p-biKnomFl.js +1 -0
- package/dist/components/ui-affordance-scope.js +1 -1
- 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/{positioning-Drmwg-C1.js → positioning-Ig1jYhE1.js} +26 -0
- package/dist/esm/ui-affordance-scope.entry.js +1 -1
- package/dist/esm/ui-chip_2.entry.js +193 -501
- package/dist/esm/ui-combobox.entry.js +706 -0
- package/dist/esm/ui-context-menu.entry.js +2 -2
- 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 +2 -2
- package/dist/esm/ui-popover.entry.js +2 -2
- 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 +2 -2
- 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 +516 -524
- package/dist/index.js +19 -2
- package/dist/looma/looma.esm.js +1 -1
- package/dist/looma/{p-32c85198.entry.js → p-08c9e253.entry.js} +1 -1
- package/dist/looma/{p-88e61cab.entry.js → p-0fa7062f.entry.js} +1 -1
- package/dist/looma/{p-9a82c523.entry.js → p-1249a806.entry.js} +1 -1
- package/dist/looma/p-172d67ff.entry.js +1 -0
- 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-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-3fba3edd.entry.js +1 -0
- package/dist/looma/{p-9551ebf6.entry.js → p-424d6719.entry.js} +1 -1
- package/dist/looma/p-4354f48f.entry.js +1 -0
- package/dist/looma/{p-6cc3180b.entry.js → p-4caccfce.entry.js} +1 -1
- 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-7ebbe74e.entry.js +1 -0
- 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-Ig1jYhE1.js +1 -0
- package/dist/looma/{p-607c3056.entry.js → p-b6ede6bb.entry.js} +1 -1
- 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-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-ec1c02e5.entry.js +1 -0
- 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-FENYADN3.js} +2 -2
- package/dist/{ui-avatar-group.entry-U72MPB5K.js → ui-avatar-group.entry-K7D6QKDP.js} +1 -1
- package/dist/{ui-avatar.entry-OC4J3LTV.js → ui-avatar.entry-WCYFUQZT.js} +1 -1
- package/dist/{ui-badge.entry-4MSUQRQV.js → ui-badge.entry-VZC4LONR.js} +1 -1
- package/dist/{ui-button.entry-22DESWN4.js → ui-button.entry-7E2KMPRF.js} +1 -1
- package/dist/{ui-callout.entry-LOGODDM5.js → ui-callout.entry-7WXQ47S6.js} +1 -1
- package/dist/{ui-checkbox.entry-XAGW3BW4.js → ui-checkbox.entry-GTSEB7ZS.js} +1 -1
- package/dist/{ui-tooltip.entry-AQ6UPBUP.js → ui-chip_2.entry-PG24H67I.js} +19 -4
- package/dist/{ui-chip_2.entry-JCPHPXAG.js → ui-combobox.entry-NTCOCZOH.js} +170 -31
- package/dist/{ui-context-menu.entry-24YOHF7L.js → ui-context-menu.entry-7GSDWHTP.js} +3 -3
- package/dist/{ui-dialog.entry-XKNYDWOQ.js → ui-dialog.entry-F53O6FBQ.js} +2 -2
- package/dist/{ui-disclosure.entry-2AWCGZ4C.js → ui-disclosure.entry-YWJA42GQ.js} +2 -2
- package/dist/{ui-editable.entry-HLEWO7BN.js → ui-editable.entry-3QPCWDPM.js} +3 -3
- package/dist/{ui-floating-action-button.entry-2NJDB4YN.js → ui-floating-action-button.entry-L4UC6RFM.js} +2 -2
- package/dist/{ui-form-field.entry-FJ5HYCTN.js → ui-form-field.entry-2VCITLQA.js} +2 -2
- package/dist/{ui-icon-button.entry-YZHJQ5YR.js → ui-icon-button.entry-MRRA6NVP.js} +2 -2
- package/dist/{ui-input.entry-JMBLMNP6.js → ui-input.entry-7LYLUJNT.js} +2 -2
- package/dist/{ui-menu-item.entry-VBGXM66D.js → ui-menu-item.entry-YHSIKO5W.js} +2 -2
- package/dist/{ui-menu.entry-I2N5H3YC.js → ui-menu.entry-ZQBF7B4T.js} +3 -3
- package/dist/{ui-popover.entry-7JRSJM5S.js → ui-popover.entry-2HG5ZWQX.js} +3 -3
- package/dist/{ui-radio-group.entry-Q2XB7P3B.js → ui-radio-group.entry-A6LI3KHW.js} +2 -2
- package/dist/{ui-radio.entry-NJO4NA4M.js → ui-radio.entry-WBCZZG5D.js} +2 -2
- package/dist/{ui-search-result-row.entry-RPMNDSRN.js → ui-search-result-row.entry-P25POOYP.js} +2 -2
- package/dist/{ui-search-shell.entry-FMIMYD3B.js → ui-search-shell.entry-R6IVRPSW.js} +2 -2
- package/dist/{ui-select.entry-7NDBWNAU.js → ui-select.entry-CAAGCELJ.js} +2 -2
- package/dist/{ui-switch.entry-YUCPIZE4.js → ui-switch.entry-SKU445KH.js} +3 -3
- package/dist/{ui-tabs.entry-FXZWV665.js → ui-tabs.entry-7BQPZEH3.js} +2 -2
- package/dist/{ui-textarea.entry-HHLQR5GG.js → ui-textarea.entry-OFC4YUU7.js} +2 -2
- package/dist/{ui-toast-region.entry-PIIBHNYA.js → ui-toast-region.entry-7VNTFVDO.js} +3 -3
- package/dist/{ui-top-bar.entry-S2L7ZM4U.js → ui-top-bar.entry-2N3EKMVF.js} +2 -2
- package/dist/{ui-tree-item.entry-UID7IJPA.js → ui-tree-item.entry-SLHAE42A.js} +3 -3
- package/dist/{ui-tree.entry-UMD3DNG5.js → ui-tree.entry-LF45JUC4.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-Drw41pSY.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-3957f7ef.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-Drmwg-C1.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 +0,0 @@
|
|
|
1
|
-
import{r as e,c as i,g as t,h as s,H as a}from"./p-8BGiMGQ0.js";const o=class{constructor(t){e(this,t),this.queryChange=i(this,"query-change"),this.addItem=i(this,"add-item"),this.removeItem=i(this,"remove-item"),this.createItem=i(this,"create-item"),this.optionsChange=i(this,"options-change")}get host(){return t(this)}label="";placeholder="";items=[];config={};query;defaultQuery="";tokenSeparators=[];disabled=!1;readOnly=!1;required=!1;name="";queryChange;addItem;removeItem;createItem;optionsChange;raw="";rows=[];combobox;filteredConfig;filteredConfigSource;filteredSelection="";componentWillLoad(){this.raw=this.query??this.defaultQuery}syncQuery(){void 0!==this.query&&(this.raw=this.query)}get selectedValues(){return new Set(this.items.map((e=>e.value)))}get comboboxConfig(){const e=this.items.map((e=>e.value)).join("\0");if(this.filteredConfig&&this.filteredConfigSource===this.config&&this.filteredSelection===e)return this.filteredConfig;const i=this.config.filter,t=this.selectedValues;return this.filteredConfigSource=this.config,this.filteredSelection=e,this.filteredConfig={...this.config,filter:(e,s,a)=>!t.has(e.value)&&(i?i(e,s,a):e.label.toLocaleLowerCase().includes(s.toLocaleLowerCase()))},this.filteredConfig}setQuery(e,i){void 0===this.query&&(this.raw=e),this.queryChange.emit({query:e,display:e,trigger:i})}clearCommittedQuery(e,i){e.value="",this.raw="",this.setQuery("",i)}onQueryChange=e=>{e.stopPropagation(),this.setQuery(e.detail.query,e.detail.trigger)};onOptionsChange=e=>{e.stopPropagation(),this.rows=e.detail,this.optionsChange.emit(e.detail)};onValueChange=e=>{e.stopPropagation(),"selection"===e.detail.kind&&e.detail.option&&(this.addItem.emit({item:e.detail.option,index:this.items.length,trigger:e.detail.trigger}),queueMicrotask((()=>this.setQuery("",e.detail.trigger))))};onCreateEntry=e=>{e.stopPropagation();const i=e.detail.query.trim();i&&(this.setQuery("",e.detail.trigger),this.createItem.emit({query:i,trigger:e.detail.trigger}))};commitQuery(e,i){const t=this.raw.trim();if(!t)return;const s=t.toLocaleLowerCase(),a=this.rows.find((e=>e.label.trim().toLocaleLowerCase()===s));a?(this.clearCommittedQuery(e,i),this.addItem.emit({item:a,index:this.items.length,trigger:i})):this.config.allowCreate&&(this.clearCommittedQuery(e,i),this.createItem.emit({query:t,trigger:i}))}remove(e,i){const t=this.items[e];!t||t.disabled||this.disabled||this.readOnly||(this.removeItem.emit({item:t,index:e,trigger:i}),requestAnimationFrame((()=>{const i=this.host.shadowRoot?.querySelectorAll('[part="item"]')??[],s=i[Math.min(e,i.length-1)]??i[e-1];s&&s.dataset.value!==t.value?s.focus():this.focusInput()})))}focusItem(e){this.host.shadowRoot?.querySelectorAll('[part="item"]')[e]?.focus()}onItemKeyDown=(e,i)=>{e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||("ArrowLeft"===e.key?(e.preventDefault(),e.stopPropagation(),this.focusItem(Math.max(0,i-1))):"ArrowRight"===e.key?(e.preventDefault(),e.stopPropagation(),i===this.items.length-1?this.focusInput():this.focusItem(i+1)):"Backspace"!==e.key&&"Delete"!==e.key||(e.preventDefault(),e.stopPropagation(),this.remove(i,"keyboard")))};onKeyDown=e=>{if(e.defaultPrevented||e.isComposing||this.disabled||this.readOnly||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;const i=e.composedPath().find((e=>e instanceof HTMLInputElement));return i?this.tokenSeparators.includes(e.key)?(e.preventDefault(),e.stopPropagation(),void this.commitQuery(i,"keyboard")):void(this.raw||(i.selectionStart??0)>0||("ArrowLeft"===e.key&&this.items.length?(e.preventDefault(),this.focusItem(this.items.length-1)):"Backspace"===e.key&&this.items.length&&(e.preventDefault(),this.remove(this.items.length-1,"keyboard")))):void 0};async focusInput(){await(this.combobox?.focusInput())}render(){return s(a,{key:"ba4db0fdca6cae344fe6b0bf06c933a9a90d2d3f",onKeyDown:this.onKeyDown},s("ui-combobox",{key:"f5901b0b078b479425114d998618828cc458e7dd",ref:e=>this.combobox=e,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},s("div",{key:"374c80862302d5c36f4849f42e5ed13222addd1c",slot:"start",class:"items",role:"group","aria-label":`Selected ${this.label}`},this.items.map(((e,i)=>s("button",{type:"button",part:"item",class:"item","data-value":e.value,tabIndex:-1,disabled:this.disabled||this.readOnly||e.disabled,"aria-label":`${e.label}, press Delete or Backspace to remove`,onKeyDown:e=>this.onItemKeyDown(e,i)},s("slot",{name:`item-${e.id}`},s("ui-chip",{appearance:"pill"},e.label)))))),this.rows.map((e=>s("span",{slot:`option-${e.id}`},s("slot",{name:`option-${e.id}`},e.label)))),s("span",{key:"a23781c153e154cdff7066868c2da956e26b7d52",slot:"create"},s("slot",{key:"e3bde0d1e549e785fff877a1a7aac10df308f7a3",name:"create"},"Create “",this.raw,"”")),s("span",{key:"5837c4cde35d5984aaf1d364f1b850b9d63ff8ca",slot:"loading"},s("slot",{key:"1bdfa30849bea752bc5c93268b3427c964d1b5d3",name:"loading"},"Loading suggestions…")),s("span",{key:"519d7b1a7f28f9d19cd441598a690c8b4fdacf5b",slot:"empty"},s("slot",{key:"3163150e0f1edebb50509a5dacd576e4568eaaae",name:"empty"},"No suggestions.")),s("span",{key:"655e4f85d70eb97f0f0ecb2bac7b4228f5cf580f",slot:"error"},s("slot",{key:"a22667db30ee30003855ee69774eff3a4aab8566",name:"error"},"Unable to load suggestions.")),s("div",{key:"b01b74f3fc7136a3bf1875c81b9f3a662f3e993c",slot:"footer"},s("slot",{key:"7565ee0798072eebc6d1c458f89ce6c7941577dd",name:"footer"}))))}static get watchers(){return{query:[{syncQuery:0}]}}};o.style=":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}";export{o as ui_multi_combobox}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { type EventEmitter } from '../../stencil-public-runtime';
|
|
2
|
-
import type { ComboboxConfig, ComboboxOption } from '../../field/combobox';
|
|
3
|
-
import type { MultiComboboxCreate, MultiComboboxItem, MultiComboboxItemChange } from '../../field/multi-combobox';
|
|
4
|
-
/** A multi-value combobox with removable, customizable selected items. */
|
|
5
|
-
export declare class UIMultiCombobox {
|
|
6
|
-
host: HTMLElement;
|
|
7
|
-
label: string;
|
|
8
|
-
placeholder: string;
|
|
9
|
-
items: readonly MultiComboboxItem[];
|
|
10
|
-
config: ComboboxConfig;
|
|
11
|
-
query?: string;
|
|
12
|
-
defaultQuery: string;
|
|
13
|
-
/** Characters that commit the current query and leave the input ready for the next item. */
|
|
14
|
-
tokenSeparators: readonly string[];
|
|
15
|
-
disabled: boolean;
|
|
16
|
-
readOnly: boolean;
|
|
17
|
-
required: boolean;
|
|
18
|
-
name: string;
|
|
19
|
-
queryChange: EventEmitter<{
|
|
20
|
-
query: string;
|
|
21
|
-
display: string;
|
|
22
|
-
trigger: 'keyboard' | 'pointer' | 'programmatic';
|
|
23
|
-
}>;
|
|
24
|
-
addItem: EventEmitter<MultiComboboxItemChange>;
|
|
25
|
-
removeItem: EventEmitter<MultiComboboxItemChange>;
|
|
26
|
-
createItem: EventEmitter<MultiComboboxCreate>;
|
|
27
|
-
optionsChange: EventEmitter<readonly ComboboxOption[]>;
|
|
28
|
-
raw: string;
|
|
29
|
-
rows: readonly ComboboxOption[];
|
|
30
|
-
private combobox?;
|
|
31
|
-
private filteredConfig?;
|
|
32
|
-
private filteredConfigSource?;
|
|
33
|
-
private filteredSelection;
|
|
34
|
-
componentWillLoad(): void;
|
|
35
|
-
syncQuery(): void;
|
|
36
|
-
private get selectedValues();
|
|
37
|
-
private get comboboxConfig();
|
|
38
|
-
private setQuery;
|
|
39
|
-
private clearCommittedQuery;
|
|
40
|
-
private onQueryChange;
|
|
41
|
-
private onOptionsChange;
|
|
42
|
-
private onValueChange;
|
|
43
|
-
private onCreateEntry;
|
|
44
|
-
private commitQuery;
|
|
45
|
-
private remove;
|
|
46
|
-
private focusItem;
|
|
47
|
-
private onItemKeyDown;
|
|
48
|
-
private onKeyDown;
|
|
49
|
-
focusInput(): Promise<void>;
|
|
50
|
-
render(): any;
|
|
51
|
-
}
|
|
@@ -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
|
-
};
|