@nyaruka/temba-components 0.40.0 → 0.40.2

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/CHANGELOG.md CHANGED
@@ -4,8 +4,15 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ #### [v0.40.2](https://github.com/nyaruka/temba-components/compare/v0.40.0...v0.40.2)
8
+
9
+ - Remove support for searching by urns in omnibox [`#261`](https://github.com/nyaruka/temba-components/pull/261)
10
+ - Don't filter results for omnibox [`#260`](https://github.com/nyaruka/temba-components/pull/260)
11
+
7
12
  #### [v0.40.0](https://github.com/nyaruka/temba-components/compare/v0.39.1...v0.40.0)
8
13
 
14
+ > 8 February 2023
15
+
9
16
  - Simplify temba-menu interaction model [`#259`](https://github.com/nyaruka/temba-components/pull/259)
10
17
  - Remove multi path selection in favor of focus-only [`42bddb8`](https://github.com/nyaruka/temba-components/commit/42bddb895a669b79460787b1a95f03996cc2c3e7)
11
18
  - honor value property for temba-menu after root change [`3578e80`](https://github.com/nyaruka/temba-components/commit/3578e8075ee3cbad7e7c3a7510b7fd4257b5fadd)
@@ -254,19 +261,13 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
254
261
  - Allow null labels [`ca6e105`](https://github.com/nyaruka/temba-components/commit/ca6e10560fa3ee2099043d26ae1a11c43610d29e)
255
262
  - Fix checkboxes with no label [`0587ed9`](https://github.com/nyaruka/temba-components/commit/0587ed9fb6fd1833d2b669d3b6e0f8cb9d710557)
256
263
 
257
- #### [v0.31.0](https://github.com/nyaruka/temba-components/compare/v0.30.0...v0.31.0)
264
+ #### [v0.31.0](https://github.com/nyaruka/temba-components/compare/v0.29.3...v0.31.0)
258
265
 
259
266
  > 23 August 2022
260
267
 
261
268
  - Add RunList component [`#191`](https://github.com/nyaruka/temba-components/pull/191)
262
269
  - fixed goofy checkbox label background hover [`#190`](https://github.com/nyaruka/temba-components/pull/190)
263
270
  - added trim for whitespace to remove goofy label background hover [`fd6ed1a`](https://github.com/nyaruka/temba-components/commit/fd6ed1aa961844d997376d025ff817725d63f1cb)
264
-
265
- #### [v0.30.0](https://github.com/nyaruka/temba-components/compare/v0.29.3...v0.30.0)
266
-
267
- > 23 August 2022
268
-
269
- - Add RunList component [`4135992`](https://github.com/nyaruka/temba-components/commit/41359924c09ed0b75f73207e7f182bebb325b5e3)
270
271
  - Remove comment, tweak formatting [`f31ac4b`](https://github.com/nyaruka/temba-components/commit/f31ac4b423b38d0feaf59a05a254f8aac726f4da)
271
272
  - Reduce wait for screenshot a bit [`1ef77ae`](https://github.com/nyaruka/temba-components/commit/1ef77aecb941e2cc0442308e580aa6a55920d127)
272
273
 
@@ -817,19 +818,13 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
817
818
 
818
819
  - Create index build [`68cff93`](https://github.com/nyaruka/temba-components/commit/68cff937919ff4dec7a7764a9b60363d33f1209a)
819
820
 
820
- #### [v0.11.1](https://github.com/nyaruka/temba-components/compare/v0.11.0...v0.11.1)
821
+ #### [v0.11.1](https://github.com/nyaruka/temba-components/compare/v0.10.3...v0.11.1)
821
822
 
822
823
  > 27 April 2021
823
824
 
824
825
  - Revert "Create bundle index" [`94b11ca`](https://github.com/nyaruka/temba-components/commit/94b11caecf0004f53c75780720548e0f1240908d)
825
- - Revert "version" [`ea3cd27`](https://github.com/nyaruka/temba-components/commit/ea3cd27f218c970b8ef018275c05d0802bd202b2)
826
- - version [`6a211a0`](https://github.com/nyaruka/temba-components/commit/6a211a0447d7f2c14954e8d9b97843daf8bca15b)
827
-
828
- #### [v0.11.0](https://github.com/nyaruka/temba-components/compare/v0.10.3...v0.11.0)
829
-
830
- > 27 April 2021
831
-
832
826
  - Create bundle index [`c39f230`](https://github.com/nyaruka/temba-components/commit/c39f2304271f2c437e87eab6918babe8191371de)
827
+ - Revert "version" [`ea3cd27`](https://github.com/nyaruka/temba-components/commit/ea3cd27f218c970b8ef018275c05d0802bd202b2)
833
828
 
834
829
  #### [v0.10.3](https://github.com/nyaruka/temba-components/compare/v0.10.2...v0.10.3)
835
830
 
@@ -3324,7 +3324,7 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
3324
3324
  />
3325
3325
  </svg>
3326
3326
  </div>
3327
- `}}var va;t([st({type:String})],ga.prototype,"name",void 0),t([st({type:String})],ga.prototype,"prefix",void 0),t([st({type:String})],ga.prototype,"id",void 0),t([st({type:Number})],ga.prototype,"size",void 0),t([st({type:Boolean})],ga.prototype,"clickable",void 0),t([st({type:Boolean})],ga.prototype,"circled",void 0),t([st({type:String})],ga.prototype,"animateChange",void 0),t([st({type:String})],ga.prototype,"animateClick",void 0),t([st({type:Number})],ga.prototype,"animationDuration",void 0),t([st({type:String})],ga.prototype,"src",void 0),t([st({type:Number,attribute:!1})],ga.prototype,"steps",void 0),t([st({type:Number,attribute:!1})],ga.prototype,"animationStep",void 0),t([st({type:String})],ga.prototype,"easing",void 0),function(t){t.Group="group",t.Contact="contact",t.Urn="urn"}(va||(va={}));const ya={color:"var(--color-text-dark)",padding:"0px 6px",fontSize:"12px"};class ba extends nt{constructor(){super(...arguments),this.groups=!1,this.contacts=!1,this.urns=!1,this.value=[],this.placeholder="Select recipients",this.disabled=!1}static get styles(){return r`
3327
+ `}}var va;t([st({type:String})],ga.prototype,"name",void 0),t([st({type:String})],ga.prototype,"prefix",void 0),t([st({type:String})],ga.prototype,"id",void 0),t([st({type:Number})],ga.prototype,"size",void 0),t([st({type:Boolean})],ga.prototype,"clickable",void 0),t([st({type:Boolean})],ga.prototype,"circled",void 0),t([st({type:String})],ga.prototype,"animateChange",void 0),t([st({type:String})],ga.prototype,"animateClick",void 0),t([st({type:Number})],ga.prototype,"animationDuration",void 0),t([st({type:String})],ga.prototype,"src",void 0),t([st({type:Number,attribute:!1})],ga.prototype,"steps",void 0),t([st({type:Number,attribute:!1})],ga.prototype,"animationStep",void 0),t([st({type:String})],ga.prototype,"easing",void 0),function(t){t.Group="group",t.Contact="contact"}(va||(va={}));const ya={color:"var(--color-text-dark)",padding:"0px 6px",fontSize:"12px"};class ba extends nt{constructor(){super(...arguments),this.groups=!1,this.contacts=!1,this.value=[],this.placeholder="Select recipients",this.disabled=!1}static get styles(){return r`
3328
3328
  temba-select:focus {
3329
3329
  outline: none;
3330
3330
  box-shadow: none;
@@ -3363,7 +3363,7 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
3363
3363
  ${this.getPostName(t)}
3364
3364
  </div>
3365
3365
  </div>
3366
- `}getIcon(t){return t.type===va.Group?D` <temba-icon name="${at.group}" /> `:t.type===va.Contact?D` <temba-icon name="${at.contact}" /> `:void 0}getEndpoint(){const t=this.endpoint;let e="&types=";return this.groups&&(e+="g"),this.contacts&&(e+="c"),this.urns&&(e+="u"),t+e}createArbitraryOption(t){if(this.urns){const e=parseFloat(t);if(!isNaN(e)&&isFinite(e))return{id:"tel:"+t,name:t,type:"urn"}}}getValues(){return this.shadowRoot.querySelector("temba-select").values}render(){return D`
3366
+ `}getIcon(t){return t.type===va.Group?D` <temba-icon name="${at.group}" /> `:t.type===va.Contact?D` <temba-icon name="${at.contact}" /> `:void 0}getEndpoint(){const t=this.endpoint;let e="&types=";return this.groups&&(e+="g"),this.contacts&&(e+="c"),t+e}getValues(){return this.shadowRoot.querySelector("temba-select").values}isMatch(){return!0}render(){return D`
3367
3367
  <temba-select
3368
3368
  name=${this.name}
3369
3369
  endpoint=${this.getEndpoint()}
@@ -3377,13 +3377,13 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
3377
3377
  .values=${this.value}
3378
3378
  .renderOption=${this.renderOption.bind(this)}
3379
3379
  .renderSelectedItem=${this.renderSelection.bind(this)}
3380
- .createArbitraryOption=${this.createArbitraryOption.bind(this)}
3381
3380
  .inputRoot=${this}
3381
+ .isMatch=${this.isMatch}
3382
3382
  searchable
3383
3383
  searchOnFocus
3384
3384
  multi
3385
3385
  ></temba-select>
3386
- `}}t([st()],ba.prototype,"endpoint",void 0),t([st()],ba.prototype,"name",void 0),t([st({type:Boolean})],ba.prototype,"groups",void 0),t([st({type:Boolean})],ba.prototype,"contacts",void 0),t([st({type:Boolean})],ba.prototype,"urns",void 0),t([st({type:Array})],ba.prototype,"value",void 0),t([st({type:Array})],ba.prototype,"errors",void 0),t([st()],ba.prototype,"placeholder",void 0),t([st({type:Boolean})],ba.prototype,"disabled",void 0),t([st({type:String,attribute:"help_text"})],ba.prototype,"helpText",void 0),t([st({type:Boolean,attribute:"help_always"})],ba.prototype,"helpAlways",void 0),t([st({type:Boolean,attribute:"widget_only"})],ba.prototype,"widgetOnly",void 0),t([st({type:Boolean,attribute:"hide_label"})],ba.prototype,"hideLabel",void 0),t([st({type:String})],ba.prototype,"label",void 0);const _a=(t,e)=>t.top+t.height/2-e.height/2,xa=(t,e)=>t.left+t.width/2-e.width/2;class wa extends nt{constructor(){super(...arguments),this.visible=!1,this.position="auto",this.lastEnter=0,this.failSafe=0}static get styles(){return r`
3386
+ `}}t([st()],ba.prototype,"endpoint",void 0),t([st()],ba.prototype,"name",void 0),t([st({type:Boolean})],ba.prototype,"groups",void 0),t([st({type:Boolean})],ba.prototype,"contacts",void 0),t([st({type:Array})],ba.prototype,"value",void 0),t([st({type:Array})],ba.prototype,"errors",void 0),t([st()],ba.prototype,"placeholder",void 0),t([st({type:Boolean})],ba.prototype,"disabled",void 0),t([st({type:String,attribute:"help_text"})],ba.prototype,"helpText",void 0),t([st({type:Boolean,attribute:"help_always"})],ba.prototype,"helpAlways",void 0),t([st({type:Boolean,attribute:"widget_only"})],ba.prototype,"widgetOnly",void 0),t([st({type:Boolean,attribute:"hide_label"})],ba.prototype,"hideLabel",void 0),t([st({type:String})],ba.prototype,"label",void 0);const _a=(t,e)=>t.top+t.height/2-e.height/2,xa=(t,e)=>t.left+t.width/2-e.width/2;class wa extends nt{constructor(){super(...arguments),this.visible=!1,this.position="auto",this.lastEnter=0,this.failSafe=0}static get styles(){return r`
3387
3387
  .tip {
3388
3388
  transition: opacity 200ms ease-in-out;
3389
3389
  margin: 0px;
package/dist/index.js CHANGED
@@ -3324,7 +3324,7 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
3324
3324
  />
3325
3325
  </svg>
3326
3326
  </div>
3327
- `}}var va;t([st({type:String})],ga.prototype,"name",void 0),t([st({type:String})],ga.prototype,"prefix",void 0),t([st({type:String})],ga.prototype,"id",void 0),t([st({type:Number})],ga.prototype,"size",void 0),t([st({type:Boolean})],ga.prototype,"clickable",void 0),t([st({type:Boolean})],ga.prototype,"circled",void 0),t([st({type:String})],ga.prototype,"animateChange",void 0),t([st({type:String})],ga.prototype,"animateClick",void 0),t([st({type:Number})],ga.prototype,"animationDuration",void 0),t([st({type:String})],ga.prototype,"src",void 0),t([st({type:Number,attribute:!1})],ga.prototype,"steps",void 0),t([st({type:Number,attribute:!1})],ga.prototype,"animationStep",void 0),t([st({type:String})],ga.prototype,"easing",void 0),function(t){t.Group="group",t.Contact="contact",t.Urn="urn"}(va||(va={}));const ya={color:"var(--color-text-dark)",padding:"0px 6px",fontSize:"12px"};class ba extends nt{constructor(){super(...arguments),this.groups=!1,this.contacts=!1,this.urns=!1,this.value=[],this.placeholder="Select recipients",this.disabled=!1}static get styles(){return r`
3327
+ `}}var va;t([st({type:String})],ga.prototype,"name",void 0),t([st({type:String})],ga.prototype,"prefix",void 0),t([st({type:String})],ga.prototype,"id",void 0),t([st({type:Number})],ga.prototype,"size",void 0),t([st({type:Boolean})],ga.prototype,"clickable",void 0),t([st({type:Boolean})],ga.prototype,"circled",void 0),t([st({type:String})],ga.prototype,"animateChange",void 0),t([st({type:String})],ga.prototype,"animateClick",void 0),t([st({type:Number})],ga.prototype,"animationDuration",void 0),t([st({type:String})],ga.prototype,"src",void 0),t([st({type:Number,attribute:!1})],ga.prototype,"steps",void 0),t([st({type:Number,attribute:!1})],ga.prototype,"animationStep",void 0),t([st({type:String})],ga.prototype,"easing",void 0),function(t){t.Group="group",t.Contact="contact"}(va||(va={}));const ya={color:"var(--color-text-dark)",padding:"0px 6px",fontSize:"12px"};class ba extends nt{constructor(){super(...arguments),this.groups=!1,this.contacts=!1,this.value=[],this.placeholder="Select recipients",this.disabled=!1}static get styles(){return r`
3328
3328
  temba-select:focus {
3329
3329
  outline: none;
3330
3330
  box-shadow: none;
@@ -3363,7 +3363,7 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
3363
3363
  ${this.getPostName(t)}
3364
3364
  </div>
3365
3365
  </div>
3366
- `}getIcon(t){return t.type===va.Group?D` <temba-icon name="${at.group}" /> `:t.type===va.Contact?D` <temba-icon name="${at.contact}" /> `:void 0}getEndpoint(){const t=this.endpoint;let e="&types=";return this.groups&&(e+="g"),this.contacts&&(e+="c"),this.urns&&(e+="u"),t+e}createArbitraryOption(t){if(this.urns){const e=parseFloat(t);if(!isNaN(e)&&isFinite(e))return{id:"tel:"+t,name:t,type:"urn"}}}getValues(){return this.shadowRoot.querySelector("temba-select").values}render(){return D`
3366
+ `}getIcon(t){return t.type===va.Group?D` <temba-icon name="${at.group}" /> `:t.type===va.Contact?D` <temba-icon name="${at.contact}" /> `:void 0}getEndpoint(){const t=this.endpoint;let e="&types=";return this.groups&&(e+="g"),this.contacts&&(e+="c"),t+e}getValues(){return this.shadowRoot.querySelector("temba-select").values}isMatch(){return!0}render(){return D`
3367
3367
  <temba-select
3368
3368
  name=${this.name}
3369
3369
  endpoint=${this.getEndpoint()}
@@ -3377,13 +3377,13 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
3377
3377
  .values=${this.value}
3378
3378
  .renderOption=${this.renderOption.bind(this)}
3379
3379
  .renderSelectedItem=${this.renderSelection.bind(this)}
3380
- .createArbitraryOption=${this.createArbitraryOption.bind(this)}
3381
3380
  .inputRoot=${this}
3381
+ .isMatch=${this.isMatch}
3382
3382
  searchable
3383
3383
  searchOnFocus
3384
3384
  multi
3385
3385
  ></temba-select>
3386
- `}}t([st()],ba.prototype,"endpoint",void 0),t([st()],ba.prototype,"name",void 0),t([st({type:Boolean})],ba.prototype,"groups",void 0),t([st({type:Boolean})],ba.prototype,"contacts",void 0),t([st({type:Boolean})],ba.prototype,"urns",void 0),t([st({type:Array})],ba.prototype,"value",void 0),t([st({type:Array})],ba.prototype,"errors",void 0),t([st()],ba.prototype,"placeholder",void 0),t([st({type:Boolean})],ba.prototype,"disabled",void 0),t([st({type:String,attribute:"help_text"})],ba.prototype,"helpText",void 0),t([st({type:Boolean,attribute:"help_always"})],ba.prototype,"helpAlways",void 0),t([st({type:Boolean,attribute:"widget_only"})],ba.prototype,"widgetOnly",void 0),t([st({type:Boolean,attribute:"hide_label"})],ba.prototype,"hideLabel",void 0),t([st({type:String})],ba.prototype,"label",void 0);const _a=(t,e)=>t.top+t.height/2-e.height/2,xa=(t,e)=>t.left+t.width/2-e.width/2;class wa extends nt{constructor(){super(...arguments),this.visible=!1,this.position="auto",this.lastEnter=0,this.failSafe=0}static get styles(){return r`
3386
+ `}}t([st()],ba.prototype,"endpoint",void 0),t([st()],ba.prototype,"name",void 0),t([st({type:Boolean})],ba.prototype,"groups",void 0),t([st({type:Boolean})],ba.prototype,"contacts",void 0),t([st({type:Array})],ba.prototype,"value",void 0),t([st({type:Array})],ba.prototype,"errors",void 0),t([st()],ba.prototype,"placeholder",void 0),t([st({type:Boolean})],ba.prototype,"disabled",void 0),t([st({type:String,attribute:"help_text"})],ba.prototype,"helpText",void 0),t([st({type:Boolean,attribute:"help_always"})],ba.prototype,"helpAlways",void 0),t([st({type:Boolean,attribute:"widget_only"})],ba.prototype,"widgetOnly",void 0),t([st({type:Boolean,attribute:"hide_label"})],ba.prototype,"hideLabel",void 0),t([st({type:String})],ba.prototype,"label",void 0);const _a=(t,e)=>t.top+t.height/2-e.height/2,xa=(t,e)=>t.left+t.width/2-e.width/2;class wa extends nt{constructor(){super(...arguments),this.visible=!1,this.position="auto",this.lastEnter=0,this.failSafe=0}static get styles(){return r`
3387
3387
  .tip {
3388
3388
  transition: opacity 200ms ease-in-out;
3389
3389
  margin: 0px;
package/dist/sw.js CHANGED
@@ -1,2 +1,2 @@
1
- if(!self.define){let e,t={};const o=(o,n)=>(o=new URL(o+".js",n).href,t[o]||new Promise((t=>{if("document"in self){const e=document.createElement("script");e.src=o,e.onload=t,document.head.appendChild(e)}else e=o,importScripts(o),t()})).then((()=>{let e=t[o];if(!e)throw new Error(`Module ${o} didn’t register its module`);return e})));self.define=(n,s)=>{const i=e||("document"in self?document.currentScript.src:"")||location.href;if(t[i])return;let r={};const d=e=>o(e,i),l={module:{uri:i},exports:r,require:d};t[i]=Promise.all(n.map((e=>l[e]||d(e)))).then((e=>(s(...e),r)))}}define(["./workbox-919adfb7"],(function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"b885f7d6.js",revision:"4a4f27824f1806ebbd3ea41736e72d71"},{url:"templates/components-body.html",revision:"e20df09bd3338b5803faba488ff25c85"},{url:"templates/components-head.html",revision:"0ec12dae53d7ed76dd9d7a642cf6c8eb"}],{}),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("/index.html"))),e.registerRoute("polyfills/*.js",new e.CacheFirst,"GET")}));
1
+ if(!self.define){let e,t={};const o=(o,n)=>(o=new URL(o+".js",n).href,t[o]||new Promise((t=>{if("document"in self){const e=document.createElement("script");e.src=o,e.onload=t,document.head.appendChild(e)}else e=o,importScripts(o),t()})).then((()=>{let e=t[o];if(!e)throw new Error(`Module ${o} didn’t register its module`);return e})));self.define=(n,s)=>{const c=e||("document"in self?document.currentScript.src:"")||location.href;if(t[c])return;let i={};const r=e=>o(e,c),l={module:{uri:c},exports:i,require:r};t[c]=Promise.all(n.map((e=>l[e]||r(e)))).then((e=>(s(...e),i)))}}define(["./workbox-919adfb7"],(function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"19e1c8c5.js",revision:"4c522089cef8ddbb017aef25801a28fa"},{url:"templates/components-body.html",revision:"85d4d52eea961a04ffa99fbde5c884c7"},{url:"templates/components-head.html",revision:"1c15381e4669dceaa8cc18b6c19246c0"}],{}),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("/index.html"))),e.registerRoute("polyfills/*.js",new e.CacheFirst,"GET")}));
2
2
  //# sourceMappingURL=sw.js.map
package/dist/sw.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"sw.js","sources":["../../../../../tmp/d0632a26fb72cd69c85046a087ad853b/sw.js"],"sourcesContent":["import {registerRoute as workbox_routing_registerRoute} from '/home/runner/work/temba-components/temba-components/node_modules/workbox-routing/registerRoute.mjs';\nimport {CacheFirst as workbox_strategies_CacheFirst} from '/home/runner/work/temba-components/temba-components/node_modules/workbox-strategies/CacheFirst.mjs';\nimport {clientsClaim as workbox_core_clientsClaim} from '/home/runner/work/temba-components/temba-components/node_modules/workbox-core/clientsClaim.mjs';\nimport {precacheAndRoute as workbox_precaching_precacheAndRoute} from '/home/runner/work/temba-components/temba-components/node_modules/workbox-precaching/precacheAndRoute.mjs';\nimport {NavigationRoute as workbox_routing_NavigationRoute} from '/home/runner/work/temba-components/temba-components/node_modules/workbox-routing/NavigationRoute.mjs';\nimport {createHandlerBoundToURL as workbox_precaching_createHandlerBoundToURL} from '/home/runner/work/temba-components/temba-components/node_modules/workbox-precaching/createHandlerBoundToURL.mjs';/**\n * Welcome to your Workbox-powered service worker!\n *\n * You'll need to register this file in your web app.\n * See https://goo.gl/nhQhGp\n *\n * The rest of the code is auto-generated. Please don't update this file\n * directly; instead, make changes to your Workbox build configuration\n * and re-run your build process.\n * See https://goo.gl/2aRDsh\n */\n\n\n\n\n\n\n\n\nself.skipWaiting();\n\nworkbox_core_clientsClaim();\n\n\n/**\n * The precacheAndRoute() method efficiently caches and responds to\n * requests for URLs in the manifest.\n * See https://goo.gl/S9QRab\n */\nworkbox_precaching_precacheAndRoute([\n {\n \"url\": \"b885f7d6.js\",\n \"revision\": \"4a4f27824f1806ebbd3ea41736e72d71\"\n },\n {\n \"url\": \"templates/components-body.html\",\n \"revision\": \"e20df09bd3338b5803faba488ff25c85\"\n },\n {\n \"url\": \"templates/components-head.html\",\n \"revision\": \"0ec12dae53d7ed76dd9d7a642cf6c8eb\"\n }\n], {});\n\nworkbox_routing_registerRoute(new workbox_routing_NavigationRoute(workbox_precaching_createHandlerBoundToURL(\"/index.html\")));\n\n\nworkbox_routing_registerRoute(\"polyfills/*.js\", new workbox_strategies_CacheFirst(), 'GET');\n\n\n\n\n"],"names":["self","skipWaiting","workbox_core_clientsClaim","workbox_precaching_precacheAndRoute","url","revision","workbox","registerRoute","workbox_routing_NavigationRoute","workbox_precaching_createHandlerBoundToURL","workbox_strategies_CacheFirst"],"mappings":"0nBAwBAA,KAAKC,cAELC,EAAAA,eAQAC,EAAAA,iBAAoC,CAClC,CACEC,IAAO,cACPC,SAAY,oCAEd,CACED,IAAO,iCACPC,SAAY,oCAEd,CACED,IAAO,iCACPC,SAAY,qCAEb,CAAE,GAEwBC,EAAAC,cAAC,IAAIC,EAAAA,gBAAgCC,EAAAA,wBAA2C,iBAGhFH,EAAAC,cAAC,iBAAkB,IAAIG,aAAiC"}
1
+ {"version":3,"file":"sw.js","sources":["../../../../../tmp/de45ce887a7569132b6a73b735670905/sw.js"],"sourcesContent":["import {registerRoute as workbox_routing_registerRoute} from '/home/runner/work/temba-components/temba-components/node_modules/workbox-routing/registerRoute.mjs';\nimport {CacheFirst as workbox_strategies_CacheFirst} from '/home/runner/work/temba-components/temba-components/node_modules/workbox-strategies/CacheFirst.mjs';\nimport {clientsClaim as workbox_core_clientsClaim} from '/home/runner/work/temba-components/temba-components/node_modules/workbox-core/clientsClaim.mjs';\nimport {precacheAndRoute as workbox_precaching_precacheAndRoute} from '/home/runner/work/temba-components/temba-components/node_modules/workbox-precaching/precacheAndRoute.mjs';\nimport {NavigationRoute as workbox_routing_NavigationRoute} from '/home/runner/work/temba-components/temba-components/node_modules/workbox-routing/NavigationRoute.mjs';\nimport {createHandlerBoundToURL as workbox_precaching_createHandlerBoundToURL} from '/home/runner/work/temba-components/temba-components/node_modules/workbox-precaching/createHandlerBoundToURL.mjs';/**\n * Welcome to your Workbox-powered service worker!\n *\n * You'll need to register this file in your web app.\n * See https://goo.gl/nhQhGp\n *\n * The rest of the code is auto-generated. Please don't update this file\n * directly; instead, make changes to your Workbox build configuration\n * and re-run your build process.\n * See https://goo.gl/2aRDsh\n */\n\n\n\n\n\n\n\n\nself.skipWaiting();\n\nworkbox_core_clientsClaim();\n\n\n/**\n * The precacheAndRoute() method efficiently caches and responds to\n * requests for URLs in the manifest.\n * See https://goo.gl/S9QRab\n */\nworkbox_precaching_precacheAndRoute([\n {\n \"url\": \"19e1c8c5.js\",\n \"revision\": \"4c522089cef8ddbb017aef25801a28fa\"\n },\n {\n \"url\": \"templates/components-body.html\",\n \"revision\": \"85d4d52eea961a04ffa99fbde5c884c7\"\n },\n {\n \"url\": \"templates/components-head.html\",\n \"revision\": \"1c15381e4669dceaa8cc18b6c19246c0\"\n }\n], {});\n\nworkbox_routing_registerRoute(new workbox_routing_NavigationRoute(workbox_precaching_createHandlerBoundToURL(\"/index.html\")));\n\n\nworkbox_routing_registerRoute(\"polyfills/*.js\", new workbox_strategies_CacheFirst(), 'GET');\n\n\n\n\n"],"names":["self","skipWaiting","workbox_core_clientsClaim","workbox_precaching_precacheAndRoute","url","revision","workbox","registerRoute","workbox_routing_NavigationRoute","workbox_precaching_createHandlerBoundToURL","workbox_strategies_CacheFirst"],"mappings":"0nBAwBAA,KAAKC,cAELC,EAAAA,eAQAC,EAAAA,iBAAoC,CAClC,CACEC,IAAO,cACPC,SAAY,oCAEd,CACED,IAAO,iCACPC,SAAY,oCAEd,CACED,IAAO,iCACPC,SAAY,qCAEb,CAAE,GAEwBC,EAAAC,cAAC,IAAIC,EAAAA,gBAAgCC,EAAAA,wBAA2C,iBAGhFH,EAAAC,cAAC,iBAAkB,IAAIG,aAAiC"}
@@ -1 +1 @@
1
- <script type="module" src="{{STATIC_URL}}@nyaruka/temba-components/dist/b885f7d6.js"></script><script>window.TEMBA_COMPONENTS_VERSION="0.40.0"</script>
1
+ <script type="module" src="{{STATIC_URL}}@nyaruka/temba-components/dist/19e1c8c5.js"></script><script>window.TEMBA_COMPONENTS_VERSION="0.40.2"</script>
@@ -1 +1 @@
1
- <link rel="modulepreload" href="{{STATIC_URL}}@nyaruka/temba-components/dist/b885f7d6.js" crossorigin="anonymous">
1
+ <link rel="modulepreload" href="{{STATIC_URL}}@nyaruka/temba-components/dist/19e1c8c5.js" crossorigin="anonymous">
@@ -8,7 +8,6 @@ var OmniType;
8
8
  (function (OmniType) {
9
9
  OmniType["Group"] = "group";
10
10
  OmniType["Contact"] = "contact";
11
- OmniType["Urn"] = "urn";
12
11
  })(OmniType || (OmniType = {}));
13
12
  const postNameStyle = {
14
13
  color: 'var(--color-text-dark)',
@@ -20,7 +19,6 @@ export class Omnibox extends RapidElement {
20
19
  super(...arguments);
21
20
  this.groups = false;
22
21
  this.contacts = false;
23
- this.urns = false;
24
22
  this.value = [];
25
23
  this.placeholder = 'Select recipients';
26
24
  this.disabled = false;
@@ -104,24 +102,15 @@ export class Omnibox extends RapidElement {
104
102
  if (this.contacts) {
105
103
  types += 'c';
106
104
  }
107
- if (this.urns) {
108
- types += 'u';
109
- }
110
105
  return endpoint + types;
111
106
  }
112
- /** If we support urns, let them enter an arbitrary number */
113
- createArbitraryOption(input) {
114
- if (this.urns) {
115
- const num = parseFloat(input);
116
- if (!isNaN(num) && isFinite(num)) {
117
- return { id: 'tel:' + input, name: input, type: 'urn' };
118
- }
119
- }
120
- }
121
107
  getValues() {
122
108
  const select = this.shadowRoot.querySelector('temba-select');
123
109
  return select.values;
124
110
  }
111
+ isMatch() {
112
+ return true;
113
+ }
125
114
  render() {
126
115
  return html `
127
116
  <temba-select
@@ -137,8 +126,8 @@ export class Omnibox extends RapidElement {
137
126
  .values=${this.value}
138
127
  .renderOption=${this.renderOption.bind(this)}
139
128
  .renderSelectedItem=${this.renderSelection.bind(this)}
140
- .createArbitraryOption=${this.createArbitraryOption.bind(this)}
141
129
  .inputRoot=${this}
130
+ .isMatch=${this.isMatch}
142
131
  searchable
143
132
  searchOnFocus
144
133
  multi
@@ -158,9 +147,6 @@ __decorate([
158
147
  __decorate([
159
148
  property({ type: Boolean })
160
149
  ], Omnibox.prototype, "contacts", void 0);
161
- __decorate([
162
- property({ type: Boolean })
163
- ], Omnibox.prototype, "urns", void 0);
164
150
  __decorate([
165
151
  property({ type: Array })
166
152
  ], Omnibox.prototype, "value", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"Omnibox.js","sourceRoot":"","sources":["../../../src/omnibox/Omnibox.ts"],"names":[],"mappings":";AAAA,OAAO,EAAkB,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,IAAK,QAIJ;AAJD,WAAK,QAAQ;IACX,2BAAe,CAAA;IACf,+BAAmB,CAAA;IACnB,uBAAW,CAAA;AACb,CAAC,EAJI,QAAQ,KAAR,QAAQ,QAIZ;AAYD,MAAM,aAAa,GAAG;IACpB,KAAK,EAAE,wBAAwB;IAC/B,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,MAAM;CACjB,CAAC;AAEF,MAAM,OAAO,OAAQ,SAAQ,YAAY;IAAzC;;QAoBE,WAAM,GAAG,KAAK,CAAC;QAGf,aAAQ,GAAG,KAAK,CAAC;QAGjB,SAAI,GAAG,KAAK,CAAC;QAGb,UAAK,GAAiB,EAAE,CAAC;QAMzB,gB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';\nimport { property } from 'lit/decorators.js';\nimport { styleMap } from 'lit-html/directives/style-map.js';\nimport { RapidElement } from '../RapidElement';\nimport { Select } from '../select/Select';\nimport { Icon } from '../vectoricon';\n\nenum OmniType {\n Group = 'group',\n Contact = 'contact',\n Urn = 'urn',\n}\n\ninterface OmniOption {\n id: string;\n name: string;\n type: OmniType;\n urn?: string;\n count?: number;\n contact?: string;\n scheme?: string;\n}\n\nconst postNameStyle = {\n color: 'var(--color-text-dark)',\n padding: '0px 6px',\n fontSize: '12px',\n};\n\nexport class Omnibox extends RapidElement {\n static get styles() {\n return css`\n temba-select:focus {\n outline: none;\n box-shadow: none;\n }\n\n :host {\n }\n `;\n }\n\n @property()\n endpoint: string;\n\n @property()\n name: string;\n\n @property({ type: Boolean })\n groups = false;\n\n @property({ type: Boolean })\n contacts = false;\n\n @property({ type: Boolean })\n urns = false;\n\n @property({ type: Array })\n value: OmniOption[] = [];\n\n @property({ type: Array })\n errors: string[];\n\n @property()\n placeholder = 'Select recipients';\n\n @property({ type: Boolean })\n disabled = false;\n\n @property({ type: String, attribute: 'help_text' })\n helpText: string;\n\n @property({ type: Boolean, attribute: 'help_always' })\n helpAlways: boolean;\n\n @property({ type: Boolean, attribute: 'widget_only' })\n widgetOnly: boolean;\n\n @property({ type: Boolean, attribute: 'hide_label' })\n hideLabel: boolean;\n\n @property({ type: String })\n label: string;\n\n /** An option in the drop down */\n private renderOption(option: OmniOption): TemplateResult {\n return html`\n <div style=\"display:flex;\">\n <div style=\"margin-right: 8px\">${this.getIcon(option)}</div>\n <div style=\"flex: 1\">${option.name}</div>\n <div\n style=\"background: rgba(50, 50, 50, 0.15); margin-left: 5px; display: flex; align-items: center; border-radius: 4px\"\n >\n ${this.getPostName(option)}\n </div>\n </div>\n `;\n }\n\n private getPostName(option: OmniOption): TemplateResult {\n const style = { ...postNameStyle };\n\n if (option.urn && option.type === OmniType.Contact) {\n if (option.urn !== option.name) {\n return html` <div style=${styleMap(style)}>${option.urn}</div> `;\n }\n }\n\n if (option.type === OmniType.Group) {\n return html`\n <div style=${styleMap(style)}>${option.count.toLocaleString()}</div>\n `;\n }\n\n return null;\n }\n\n /** Selection in the multi-select select box */\n private renderSelection(option: OmniOption): TemplateResult {\n return html`\n <div\n style=\"flex:1 1 auto; display: flex; align-items: stretch; color: var(--color-text-dark); font-size: 12px;\"\n >\n <div style=\"align-self: center; padding: 0px 7px; color: #bbb\">\n ${this.getIcon(option)}\n </div>\n <div\n class=\"name\"\n style=\"align-self: center; padding: 0px; font-size: 12px;\"\n >\n ${option.name}\n </div>\n <div\n style=\"background: rgba(100, 100, 100, 0.05); border-left: 1px solid rgba(100, 100, 100, 0.1); margin-left: 12px; display: flex; align-items: center\"\n >\n ${this.getPostName(option)}\n </div>\n </div>\n `;\n }\n\n private getIcon(option: OmniOption): TemplateResult {\n if (option.type === OmniType.Group) {\n return html` <temba-icon name=\"${Icon.group}\" /> `;\n }\n\n if (option.type === OmniType.Contact) {\n return html` <temba-icon name=\"${Icon.contact}\" /> `;\n }\n }\n\n private getEndpoint() {\n const endpoint = this.endpoint;\n let types = '&types=';\n if (this.groups) {\n types += 'g';\n }\n\n if (this.contacts) {\n types += 'c';\n }\n\n if (this.urns) {\n types += 'u';\n }\n\n return endpoint + types;\n }\n\n /** If we support urns, let them enter an arbitrary number */\n private createArbitraryOption(input: string): any {\n if (this.urns) {\n const num = parseFloat(input);\n if (!isNaN(num) && isFinite(num)) {\n return { id: 'tel:' + input, name: input, type: 'urn' };\n }\n }\n }\n\n public getValues(): any[] {\n const select = this.shadowRoot.querySelector('temba-select') as Select;\n return select.values;\n }\n\n public render(): TemplateResult {\n return html`\n <temba-select\n name=${this.name}\n endpoint=${this.getEndpoint()}\n placeholder=${this.placeholder}\n queryParam=\"search\"\n .label=${this.label}\n .helpText=${this.helpText}\n .widgetOnly=${this.widgetOnly}\n ?disabled=${this.disabled}\n .errors=${this.errors}\n .values=${this.value}\n .renderOption=${this.renderOption.bind(this)}\n .renderSelectedItem=${this.renderSelection.bind(this)}\n .createArbitraryOption=${this.createArbitraryOption.bind(this)}\n .inputRoot=${this}\n searchable\n searchOnFocus\n multi\n ></temba-select>\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"Omnibox.js","sourceRoot":"","sources":["../../../src/omnibox/Omnibox.ts"],"names":[],"mappings":";AAAA,OAAO,EAAkB,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,IAAK,QAGJ;AAHD,WAAK,QAAQ;IACX,2BAAe,CAAA;IACf,+BAAmB,CAAA;AACrB,CAAC,EAHI,QAAQ,KAAR,QAAQ,QAGZ;AAYD,MAAM,aAAa,GAAG;IACpB,KAAK,EAAE,wBAAwB;IAC/B,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,MAAM;CACjB,CAAC;AAEF,MAAM,OAAO,OAAQ,SAAQ,YAAY;IAAzC;;QAoBE,WAAM,GAAG,KAAK,CAAC;QAGf,aAAQ,GAAG,KAAK,CAAC;QAGjB,UAAK,GAAiB,EAAE,CAAC;QAMzB,gBAAW,GAAG,mBAAmB,CAAC;QAGlC,aAAQ,GAAG,KAAK,CAAC;IAkInB,CAAC;IApKC,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;KAQT,CAAC;IACJ,CAAC;IAyCD,iCAAiC;IACzB,YAAY,CAAC,MAAkB;QACrC,OAAO,IAAI,CAAA;;yCAE0B,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;+BAC9B,MAAM,CAAC,IAAI;;;;YAI9B,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC;;;KAG/B,CAAC;IACJ,CAAC;IAEO,WAAW,CAAC,MA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C;yCAClC;AAGjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;2CAClC;AAGpB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;2CAClC;AAGpB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;0CAClC;AAGnB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sCACb","sourcesContent":["import { TemplateResult, html, css } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { styleMap } from 'lit-html/directives/style-map.js';\nimport { RapidElement } from '../RapidElement';\nimport { Select } from '../select/Select';\nimport { Icon } from '../vectoricon';\n\nenum OmniType {\n Group = 'group',\n Contact = 'contact',\n}\n\ninterface OmniOption {\n id: string;\n name: string;\n type: OmniType;\n urn?: string;\n count?: number;\n contact?: string;\n scheme?: string;\n}\n\nconst postNameStyle = {\n color: 'var(--color-text-dark)',\n padding: '0px 6px',\n fontSize: '12px',\n};\n\nexport class Omnibox extends RapidElement {\n static get styles() {\n return css`\n temba-select:focus {\n outline: none;\n box-shadow: none;\n }\n\n :host {\n }\n `;\n }\n\n @property()\n endpoint: string;\n\n @property()\n name: string;\n\n @property({ type: Boolean })\n groups = false;\n\n @property({ type: Boolean })\n contacts = false;\n\n @property({ type: Array })\n value: OmniOption[] = [];\n\n @property({ type: Array })\n errors: string[];\n\n @property()\n placeholder = 'Select recipients';\n\n @property({ type: Boolean })\n disabled = false;\n\n @property({ type: String, attribute: 'help_text' })\n helpText: string;\n\n @property({ type: Boolean, attribute: 'help_always' })\n helpAlways: boolean;\n\n @property({ type: Boolean, attribute: 'widget_only' })\n widgetOnly: boolean;\n\n @property({ type: Boolean, attribute: 'hide_label' })\n hideLabel: boolean;\n\n @property({ type: String })\n label: string;\n\n /** An option in the drop down */\n private renderOption(option: OmniOption): TemplateResult {\n return html`\n <div style=\"display:flex;\">\n <div style=\"margin-right: 8px\">${this.getIcon(option)}</div>\n <div style=\"flex: 1\">${option.name}</div>\n <div\n style=\"background: rgba(50, 50, 50, 0.15); margin-left: 5px; display: flex; align-items: center; border-radius: 4px\"\n >\n ${this.getPostName(option)}\n </div>\n </div>\n `;\n }\n\n private getPostName(option: OmniOption): TemplateResult {\n const style = { ...postNameStyle };\n\n if (option.urn && option.type === OmniType.Contact) {\n if (option.urn !== option.name) {\n return html` <div style=${styleMap(style)}>${option.urn}</div> `;\n }\n }\n\n if (option.type === OmniType.Group) {\n return html`\n <div style=${styleMap(style)}>${option.count.toLocaleString()}</div>\n `;\n }\n\n return null;\n }\n\n /** Selection in the multi-select select box */\n private renderSelection(option: OmniOption): TemplateResult {\n return html`\n <div\n style=\"flex:1 1 auto; display: flex; align-items: stretch; color: var(--color-text-dark); font-size: 12px;\"\n >\n <div style=\"align-self: center; padding: 0px 7px; color: #bbb\">\n ${this.getIcon(option)}\n </div>\n <div\n class=\"name\"\n style=\"align-self: center; padding: 0px; font-size: 12px;\"\n >\n ${option.name}\n </div>\n <div\n style=\"background: rgba(100, 100, 100, 0.05); border-left: 1px solid rgba(100, 100, 100, 0.1); margin-left: 12px; display: flex; align-items: center\"\n >\n ${this.getPostName(option)}\n </div>\n </div>\n `;\n }\n\n private getIcon(option: OmniOption): TemplateResult {\n if (option.type === OmniType.Group) {\n return html` <temba-icon name=\"${Icon.group}\" /> `;\n }\n\n if (option.type === OmniType.Contact) {\n return html` <temba-icon name=\"${Icon.contact}\" /> `;\n }\n }\n\n private getEndpoint() {\n const endpoint = this.endpoint;\n let types = '&types=';\n if (this.groups) {\n types += 'g';\n }\n\n if (this.contacts) {\n types += 'c';\n }\n\n return endpoint + types;\n }\n\n public getValues(): any[] {\n const select = this.shadowRoot.querySelector('temba-select') as Select;\n return select.values;\n }\n\n public isMatch() {\n return true;\n }\n\n public render(): TemplateResult {\n return html`\n <temba-select\n name=${this.name}\n endpoint=${this.getEndpoint()}\n placeholder=${this.placeholder}\n queryParam=\"search\"\n .label=${this.label}\n .helpText=${this.helpText}\n .widgetOnly=${this.widgetOnly}\n ?disabled=${this.disabled}\n .errors=${this.errors}\n .values=${this.value}\n .renderOption=${this.renderOption.bind(this)}\n .renderSelectedItem=${this.renderSelection.bind(this)}\n .inputRoot=${this}\n .isMatch=${this.isMatch}\n searchable\n searchOnFocus\n multi\n ></temba-select>\n `;\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nyaruka/temba-components",
3
- "version": "0.40.0",
3
+ "version": "0.40.2",
4
4
  "description": "Web components to support rapidpro and related projects",
5
5
  "author": "Nyaruka <code@nyaruka.coim>",
6
6
  "main": "dist/index.js",
@@ -8,7 +8,6 @@ import { Icon } from '../vectoricon';
8
8
  enum OmniType {
9
9
  Group = 'group',
10
10
  Contact = 'contact',
11
- Urn = 'urn',
12
11
  }
13
12
 
14
13
  interface OmniOption {
@@ -52,9 +51,6 @@ export class Omnibox extends RapidElement {
52
51
  @property({ type: Boolean })
53
52
  contacts = false;
54
53
 
55
- @property({ type: Boolean })
56
- urns = false;
57
-
58
54
  @property({ type: Array })
59
55
  value: OmniOption[] = [];
60
56
 
@@ -160,28 +156,18 @@ export class Omnibox extends RapidElement {
160
156
  types += 'c';
161
157
  }
162
158
 
163
- if (this.urns) {
164
- types += 'u';
165
- }
166
-
167
159
  return endpoint + types;
168
160
  }
169
161
 
170
- /** If we support urns, let them enter an arbitrary number */
171
- private createArbitraryOption(input: string): any {
172
- if (this.urns) {
173
- const num = parseFloat(input);
174
- if (!isNaN(num) && isFinite(num)) {
175
- return { id: 'tel:' + input, name: input, type: 'urn' };
176
- }
177
- }
178
- }
179
-
180
162
  public getValues(): any[] {
181
163
  const select = this.shadowRoot.querySelector('temba-select') as Select;
182
164
  return select.values;
183
165
  }
184
166
 
167
+ public isMatch() {
168
+ return true;
169
+ }
170
+
185
171
  public render(): TemplateResult {
186
172
  return html`
187
173
  <temba-select
@@ -197,8 +183,8 @@ export class Omnibox extends RapidElement {
197
183
  .values=${this.value}
198
184
  .renderOption=${this.renderOption.bind(this)}
199
185
  .renderSelectedItem=${this.renderSelection.bind(this)}
200
- .createArbitraryOption=${this.createArbitraryOption.bind(this)}
201
186
  .inputRoot=${this}
187
+ .isMatch=${this.isMatch}
202
188
  searchable
203
189
  searchOnFocus
204
190
  multi