@fluid-topics/ft-search-input 1.2.6 → 1.2.8

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.
@@ -1238,27 +1238,27 @@ Also for action icons.`,l.colorGray200),contentGlobalSubtle:o.extend("--ft-conte
1238
1238
  @keydown=${r=>this.onSuggestKeyDown(r)}>
1239
1239
  ${Pn(this.suggestResults||[],r=>r.value,r=>this.renderSuggestion(r,e))}
1240
1240
  </div>
1241
- `}renderSuggestion(e,r){if(this.launchSearchPath){let n={...this.request,query:e.value},i=r.serializeToCurrentPageIfPossible(n,this.launchSearchPath);return V`
1242
- <a href="${i}"
1241
+ `}renderSuggestion(e,r){let n=V`
1242
+ <ft-ripple></ft-ripple>
1243
+ ${this.getIcon(e)}
1244
+ <ft-typography variant="body1">${e.value}</ft-typography>
1245
+ `;if(this.launchSearchPath){let i={...this.request,query:e.value},a=r.serializeToCurrentPageIfPossible(i,this.launchSearchPath);return V`
1246
+ <a href="${a}"
1243
1247
  part="suggestion"
1244
1248
  class="ft-search-input-suggestion--suggestion"
1245
- @keyup=${a=>this.onSuggestKeyUp(a)}
1246
- @click=${a=>this.onSuggestLinkClick(a,e)}>
1247
- <ft-ripple></ft-ripple>
1248
- ${this.getIcon(e)}
1249
- <ft-typography variant="body1">${e.value}</ft-typography>
1249
+ @keyup=${s=>this.onSuggestKeyUp(s)}
1250
+ @click=${()=>this.onSuggestSelected(e.value)}>
1251
+ ${n}
1250
1252
  </a>
1251
1253
  `}return V`
1252
1254
  <div tabindex="0"
1253
1255
  part="suggestion"
1254
1256
  class="ft-search-input-suggestion--suggestion"
1255
- @keyup=${n=>this.onSuggestKeyUp(n)}
1256
- @click=${n=>this.onSuggestSelected(e.value)}>
1257
- <ft-ripple></ft-ripple>
1258
- ${this.getIcon(e)}
1259
- <ft-typography variant="body1">${e.value}</ft-typography>
1257
+ @keyup=${i=>this.onSuggestKeyUp(i)}
1258
+ @click=${()=>this.onSuggestSelected(e.value)}>
1259
+ ${n}
1260
1260
  </div>
1261
- `}onSuggestLinkClick(e,r){!e.metaKey&&!e.ctrlKey&&(e.preventDefault(),e.stopPropagation()),this.onSuggestSelected(r.value)}onSuggestKeyDown(e){var r,n,i,a,s,c;switch(e.key){case"ArrowUp":(i=(n=(r=this.getFocusedSuggestionElement())===null||r===void 0?void 0:r.previousElementSibling)!==null&&n!==void 0?n:this.getLastSuggestionElement())===null||i===void 0||i.focus(),e.preventDefault(),e.stopPropagation();break;case"ArrowDown":(c=(s=(a=this.getFocusedSuggestionElement())===null||a===void 0?void 0:a.nextElementSibling)!==null&&s!==void 0?s:this.getFirstSuggestionElement())===null||c===void 0||c.focus(),e.preventDefault(),e.stopPropagation();break}}onSuggestKeyUp(e){(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),e.stopPropagation(),e.target.click())}onSuggestSelected(e){this.dispatchEvent(new qa(e))}getIcon(e){let r=e.type==="DOCUMENT"?Ee.file_format:Ee.fluid_topics,n;switch(e.type){case"MAP":n=e.editorialType==="BOOK"?St.BOOK:St.ARTICLE;break;case"DOCUMENT":n=ql(e.mimeType,e.filenameExtension);break;case"TOPIC":n=St.TOPICS;break}return V`
1261
+ `}onSuggestKeyDown(e){var r,n,i,a,s,c;switch(e.key){case"ArrowUp":(i=(n=(r=this.getFocusedSuggestionElement())===null||r===void 0?void 0:r.previousElementSibling)!==null&&n!==void 0?n:this.getLastSuggestionElement())===null||i===void 0||i.focus(),e.preventDefault(),e.stopPropagation();break;case"ArrowDown":(c=(s=(a=this.getFocusedSuggestionElement())===null||a===void 0?void 0:a.nextElementSibling)!==null&&s!==void 0?s:this.getFirstSuggestionElement())===null||c===void 0||c.focus(),e.preventDefault(),e.stopPropagation();break}}onSuggestKeyUp(e){(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),e.stopPropagation(),e.target.click())}onSuggestSelected(e){this.dispatchEvent(new qa(e))}getIcon(e){let r=e.type==="DOCUMENT"?Ee.file_format:Ee.fluid_topics,n;switch(e.type){case"MAP":n=e.editorialType==="BOOK"?St.BOOK:St.ARTICLE;break;case"DOCUMENT":n=ql(e.mimeType,e.filenameExtension);break;case"TOPIC":n=St.TOPICS;break}return V`
1262
1262
  <ft-icon .variant="${r}" .value="${n}" part="suggestion-icon"></ft-icon>
1263
1263
  `}getFocusedSuggestionElement(){return this.shadowRoot.querySelector(".ft-search-input-suggestion--suggestion:focus-within")}getLastSuggestionElement(){let e=this.shadowRoot.querySelectorAll(".ft-search-input-suggestion--suggestion");return e.length>0?e[e.length-1]:null}getFirstSuggestionElement(){return this.shadowRoot.querySelector(".ft-search-input-suggestion--suggestion")}focusFirstSuggestion(){var e;(e=this.getFirstSuggestionElement())===null||e===void 0||e.focus()}};ot.elementDefinitions={"ft-ripple":J,"ft-typography":Ce,"ft-icon":xe};ot.styles=[ji,od];pn([_e()],ot.prototype,"request",void 0);pn([_e()],ot.prototype,"suggestResults",void 0);pn([A()],ot.prototype,"launchSearchPath",void 0);ot=pn([Rn("ft-search-input-suggestion")],ot);var nt=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(a=(i<3?s(a):i>3?s(e,r,a):s(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},he=class extends dn(Or){constructor(){super(),this.liveQuery="",this.forceCloseSuggestion=!1,this.useCustomSearchPath=!1,this.addI18nContext(ao)}render(){var e,r;let n={"ft-search-input":!0,"ft-search-input--with-suggestions":(r=(e=this.suggestResults)===null||e===void 0?void 0:e.length)!==null&&r!==void 0?r:!1,"ft-search-input--with-suggestions-closed":this.forceCloseSuggestion},i={...this.request,query:this.liveQuery},a=this.useCustomSearchPath?this.launchSearchPath:void 0,s=Sr.get().serializeToCurrentPageIfPossible(i,a);return V`
1264
1264
  <div class="${lt(n)}" @focusout=${()=>this.forceCloseSuggestion=!1} role="search">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-search-input",
3
- "version": "1.2.6",
3
+ "version": "1.2.8",
4
4
  "description": "Search bar input for integrated search component",
5
5
  "keywords": [
6
6
  "Lit"
@@ -19,18 +19,18 @@
19
19
  "url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
20
20
  },
21
21
  "dependencies": {
22
- "@fluid-topics/ft-app-context": "1.2.6",
23
- "@fluid-topics/ft-button": "1.2.6",
24
- "@fluid-topics/ft-i18n": "1.2.6",
25
- "@fluid-topics/ft-icon": "1.2.6",
26
- "@fluid-topics/ft-ripple": "1.2.6",
27
- "@fluid-topics/ft-search-context": "1.2.6",
28
- "@fluid-topics/ft-typography": "1.2.6",
29
- "@fluid-topics/ft-wc-utils": "1.2.6",
22
+ "@fluid-topics/ft-app-context": "1.2.8",
23
+ "@fluid-topics/ft-button": "1.2.8",
24
+ "@fluid-topics/ft-i18n": "1.2.8",
25
+ "@fluid-topics/ft-icon": "1.2.8",
26
+ "@fluid-topics/ft-ripple": "1.2.8",
27
+ "@fluid-topics/ft-search-context": "1.2.8",
28
+ "@fluid-topics/ft-typography": "1.2.8",
29
+ "@fluid-topics/ft-wc-utils": "1.2.8",
30
30
  "lit": "3.1.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@fluid-topics/public-api": "1.0.78"
34
34
  },
35
- "gitHead": "6e3206b79d8e76e981cb3f36a80f90a13cc09116"
35
+ "gitHead": "26d2cbd5aba536de63759b72e1c171449519d74e"
36
36
  }