@fluid-topics/ft-search-bar 1.2.19 → 1.2.20

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.
@@ -2887,7 +2887,6 @@ Also for action icons.`,s.colorGray200),contentGlobalSubtle:o.extend("--ft-conte
2887
2887
  <a href="${this.getRequestWithQuery(n)}"
2888
2888
  part="suggestions"
2889
2889
  class="ft-search-bar--suggestion ft-search-bar--recent-search"
2890
- @keyup=${i=>this.onSuggestKeyUp(i)}
2891
2890
  @click=${i=>this.onSuggestClick(i,n)}>
2892
2891
  <ft-ripple></ft-ripple>
2893
2892
  <ft-icon variant="material" value="history" part="suggestion-icon"></ft-icon>
@@ -2908,7 +2907,6 @@ Also for action icons.`,s.colorGray200),contentGlobalSubtle:o.extend("--ft-conte
2908
2907
  <a href="${this.getRequestWithQuery(n.value)}"
2909
2908
  part="suggestions"
2910
2909
  class="ft-search-bar--suggestion"
2911
- @keyup=${i=>this.onSuggestKeyUp(i)}
2912
2910
  @click=${i=>this.onSuggestClick(i,n.value)}>
2913
2911
  <ft-ripple></ft-ripple>
2914
2912
  ${this.getIcon(n)}
@@ -2917,7 +2915,7 @@ Also for action icons.`,s.colorGray200),contentGlobalSubtle:o.extend("--ft-conte
2917
2915
  </div>
2918
2916
  `)}
2919
2917
  </div>
2920
- `}getRequestWithQuery(e){return this.searchBar.searchRequestSerializer({...this.searchBar.request,paging:{page:1},query:e})}update(){return new Promise((e,r)=>{this.updateDebouncer.run(async()=>{this.searchBar.suggestions=this.searchBar.api&&this.searchBar.query.length>2?await this.searchBar.api.getSuggestions(this.searchBar.suggestRequest).then(n=>n.suggestions).catch(()=>[]):[],e()})})}onSuggestKeyDown(e){var r,n;switch(e.key){case"ArrowUp":(r=this.previousSuggestionElement())===null||r===void 0||r.focus(),e.preventDefault(),e.stopPropagation();break;case"ArrowDown":(n=this.nextSuggestionElement())===null||n===void 0||n.focus(),e.preventDefault(),e.stopPropagation();break}}nextSuggestionElement(){var e,r;let n=(e=this.getFocusedSuggestionElement())===null||e===void 0?void 0:e.parentElement,i=(r=n?.nextElementSibling)===null||r===void 0?void 0:r.querySelector("[part=suggestions]");return i??this.getFirstSuggestionElement()}previousSuggestionElement(){var e,r;let n=(e=this.getFocusedSuggestionElement())===null||e===void 0?void 0:e.parentElement,i=(r=n?.previousElementSibling)===null||r===void 0?void 0:r.querySelector("[part=suggestions]");return i??this.getLastSuggestionElement()}onSuggestKeyUp(e){(e.key==="Enter"||e.key===" ")&&e.target.click()}onSuggestClick(e,r){this.searchBar.setQuery(r),this.searchBar.onLaunchSearch()}removeRecentSearch(e,r){var n,i,a,l;e.preventDefault(),e.stopPropagation();let c=e.target.closest("[part='suggestion-container']"),p=(l=(i=(n=c?.previousElementSibling)===null||n===void 0?void 0:n.querySelector("[part='suggestions']"))!==null&&i!==void 0?i:(a=c?.nextElementSibling)===null||a===void 0?void 0:a.querySelector("[part='suggestions']"))!==null&&l!==void 0?l:this.searchBar.input;p?.focus(),this.searchBar.recentSearches=this.searchBar.recentSearches.filter(f=>f.toLowerCase()!==r.toLowerCase()),this.searchBar.saveRecentSearches()}getIcon(e){let r=e.type==="DOCUMENT"?Pe.file_format:Pe.fluid_topics,n;switch(e.type){case"MAP":n=e.editorialType==="BOOK"?wt.BOOK:wt.ARTICLE;break;case"DOCUMENT":n=ds(e.mimeType,e.filenameExtension);break;case"TOPIC":n=wt.TOPICS;break}return Ao.html`
2918
+ `}getRequestWithQuery(e){return this.searchBar.searchRequestSerializer({...this.searchBar.request,paging:{page:1},query:e})}update(){return new Promise((e,r)=>{this.updateDebouncer.run(async()=>{this.searchBar.suggestions=this.searchBar.api&&this.searchBar.query.length>2?await this.searchBar.api.getSuggestions(this.searchBar.suggestRequest).then(n=>n.suggestions).catch(()=>[]):[],e()})})}onSuggestKeyDown(e){var r,n;switch(e.key){case"ArrowUp":(r=this.previousSuggestionElement())===null||r===void 0||r.focus(),e.preventDefault(),e.stopPropagation();break;case"ArrowDown":(n=this.nextSuggestionElement())===null||n===void 0||n.focus(),e.preventDefault(),e.stopPropagation();break}}nextSuggestionElement(){var e,r;let n=(e=this.getFocusedSuggestionElement())===null||e===void 0?void 0:e.parentElement,i=(r=n?.nextElementSibling)===null||r===void 0?void 0:r.querySelector("[part=suggestions]");return i??this.getFirstSuggestionElement()}previousSuggestionElement(){var e,r;let n=(e=this.getFocusedSuggestionElement())===null||e===void 0?void 0:e.parentElement,i=(r=n?.previousElementSibling)===null||r===void 0?void 0:r.querySelector("[part=suggestions]");return i??this.getLastSuggestionElement()}onSuggestClick(e,r){this.searchBar.setQuery(r),this.searchBar.onLaunchSearch()}removeRecentSearch(e,r){var n,i,a,l;e.preventDefault(),e.stopPropagation();let c=e.target.closest("[part='suggestion-container']"),p=(l=(i=(n=c?.previousElementSibling)===null||n===void 0?void 0:n.querySelector("[part='suggestions']"))!==null&&i!==void 0?i:(a=c?.nextElementSibling)===null||a===void 0?void 0:a.querySelector("[part='suggestions']"))!==null&&l!==void 0?l:this.searchBar.input;p?.focus(),this.searchBar.recentSearches=this.searchBar.recentSearches.filter(f=>f.toLowerCase()!==r.toLowerCase()),this.searchBar.saveRecentSearches()}getIcon(e){let r=e.type==="DOCUMENT"?Pe.file_format:Pe.fluid_topics,n;switch(e.type){case"MAP":n=e.editorialType==="BOOK"?wt.BOOK:wt.ARTICLE;break;case"DOCUMENT":n=ds(e.mimeType,e.filenameExtension);break;case"TOPIC":n=wt.TOPICS;break}return Ao.html`
2921
2919
  <ft-icon .variant="${r}" .value="${n}" part="suggestion-icon"></ft-icon>
2922
2920
  `}getFocusedSuggestionElement(){return this.searchBar.querySelector(".ft-search-bar--suggestion:focus-within")}getLastSuggestionElement(){let e=this.searchBar.querySelectorAll(".ft-search-bar--suggestion");return e.length>0?e[e.length-1]:null}getFirstSuggestionElement(){return this.searchBar.querySelector(".ft-search-bar--suggestion")}focusFirstSuggestion(){var e;(e=this.getFirstSuggestionElement())===null||e===void 0||e.focus()}};kt.styles=[pn.wordWrap,Ao.css`
2923
2921
  .ft-search-bar--mobile .ft-search-bar--suggestions {
@@ -2933,7 +2933,6 @@ Also for action icons.`,c.colorGray200),contentGlobalSubtle:o.extend("--ft-conte
2933
2933
  <a href="${this.getRequestWithQuery(i)}"
2934
2934
  part="suggestions"
2935
2935
  class="ft-search-bar--suggestion ft-search-bar--recent-search"
2936
- @keyup=${n=>this.onSuggestKeyUp(n)}
2937
2936
  @click=${n=>this.onSuggestClick(n,i)}>
2938
2937
  <ft-ripple></ft-ripple>
2939
2938
  <ft-icon variant="material" value="history" part="suggestion-icon"></ft-icon>
@@ -2954,7 +2953,6 @@ Also for action icons.`,c.colorGray200),contentGlobalSubtle:o.extend("--ft-conte
2954
2953
  <a href="${this.getRequestWithQuery(i.value)}"
2955
2954
  part="suggestions"
2956
2955
  class="ft-search-bar--suggestion"
2957
- @keyup=${n=>this.onSuggestKeyUp(n)}
2958
2956
  @click=${n=>this.onSuggestClick(n,i.value)}>
2959
2957
  <ft-ripple></ft-ripple>
2960
2958
  ${this.getIcon(i)}
@@ -2963,7 +2961,7 @@ Also for action icons.`,c.colorGray200),contentGlobalSubtle:o.extend("--ft-conte
2963
2961
  </div>
2964
2962
  `)}
2965
2963
  </div>
2966
- `}getRequestWithQuery(e){return this.searchBar.searchRequestSerializer({...this.searchBar.request,paging:{page:1},query:e})}update(){return new Promise((e,t)=>{this.updateDebouncer.run(async()=>{this.searchBar.suggestions=this.searchBar.api&&this.searchBar.query.length>2?await this.searchBar.api.getSuggestions(this.searchBar.suggestRequest).then(i=>i.suggestions).catch(()=>[]):[],e()})})}onSuggestKeyDown(e){var t,i;switch(e.key){case"ArrowUp":(t=this.previousSuggestionElement())===null||t===void 0||t.focus(),e.preventDefault(),e.stopPropagation();break;case"ArrowDown":(i=this.nextSuggestionElement())===null||i===void 0||i.focus(),e.preventDefault(),e.stopPropagation();break}}nextSuggestionElement(){var e,t;let i=(e=this.getFocusedSuggestionElement())===null||e===void 0?void 0:e.parentElement,n=(t=i?.nextElementSibling)===null||t===void 0?void 0:t.querySelector("[part=suggestions]");return n??this.getFirstSuggestionElement()}previousSuggestionElement(){var e,t;let i=(e=this.getFocusedSuggestionElement())===null||e===void 0?void 0:e.parentElement,n=(t=i?.previousElementSibling)===null||t===void 0?void 0:t.querySelector("[part=suggestions]");return n??this.getLastSuggestionElement()}onSuggestKeyUp(e){(e.key==="Enter"||e.key===" ")&&e.target.click()}onSuggestClick(e,t){this.searchBar.setQuery(t),this.searchBar.onLaunchSearch()}removeRecentSearch(e,t){var i,n,a,s;e.preventDefault(),e.stopPropagation();let l=e.target.closest("[part='suggestion-container']"),d=(s=(n=(i=l?.previousElementSibling)===null||i===void 0?void 0:i.querySelector("[part='suggestions']"))!==null&&n!==void 0?n:(a=l?.nextElementSibling)===null||a===void 0?void 0:a.querySelector("[part='suggestions']"))!==null&&s!==void 0?s:this.searchBar.input;d?.focus(),this.searchBar.recentSearches=this.searchBar.recentSearches.filter(p=>p.toLowerCase()!==t.toLowerCase()),this.searchBar.saveRecentSearches()}getIcon(e){let t=e.type==="DOCUMENT"?Me.file_format:Me.fluid_topics,i;switch(e.type){case"MAP":i=e.editorialType==="BOOK"?Ot.BOOK:Ot.ARTICLE;break;case"DOCUMENT":i=zd(e.mimeType,e.filenameExtension);break;case"TOPIC":i=Ot.TOPICS;break}return w`
2964
+ `}getRequestWithQuery(e){return this.searchBar.searchRequestSerializer({...this.searchBar.request,paging:{page:1},query:e})}update(){return new Promise((e,t)=>{this.updateDebouncer.run(async()=>{this.searchBar.suggestions=this.searchBar.api&&this.searchBar.query.length>2?await this.searchBar.api.getSuggestions(this.searchBar.suggestRequest).then(i=>i.suggestions).catch(()=>[]):[],e()})})}onSuggestKeyDown(e){var t,i;switch(e.key){case"ArrowUp":(t=this.previousSuggestionElement())===null||t===void 0||t.focus(),e.preventDefault(),e.stopPropagation();break;case"ArrowDown":(i=this.nextSuggestionElement())===null||i===void 0||i.focus(),e.preventDefault(),e.stopPropagation();break}}nextSuggestionElement(){var e,t;let i=(e=this.getFocusedSuggestionElement())===null||e===void 0?void 0:e.parentElement,n=(t=i?.nextElementSibling)===null||t===void 0?void 0:t.querySelector("[part=suggestions]");return n??this.getFirstSuggestionElement()}previousSuggestionElement(){var e,t;let i=(e=this.getFocusedSuggestionElement())===null||e===void 0?void 0:e.parentElement,n=(t=i?.previousElementSibling)===null||t===void 0?void 0:t.querySelector("[part=suggestions]");return n??this.getLastSuggestionElement()}onSuggestClick(e,t){this.searchBar.setQuery(t),this.searchBar.onLaunchSearch()}removeRecentSearch(e,t){var i,n,a,s;e.preventDefault(),e.stopPropagation();let l=e.target.closest("[part='suggestion-container']"),d=(s=(n=(i=l?.previousElementSibling)===null||i===void 0?void 0:i.querySelector("[part='suggestions']"))!==null&&n!==void 0?n:(a=l?.nextElementSibling)===null||a===void 0?void 0:a.querySelector("[part='suggestions']"))!==null&&s!==void 0?s:this.searchBar.input;d?.focus(),this.searchBar.recentSearches=this.searchBar.recentSearches.filter(p=>p.toLowerCase()!==t.toLowerCase()),this.searchBar.saveRecentSearches()}getIcon(e){let t=e.type==="DOCUMENT"?Me.file_format:Me.fluid_topics,i;switch(e.type){case"MAP":i=e.editorialType==="BOOK"?Ot.BOOK:Ot.ARTICLE;break;case"DOCUMENT":i=zd(e.mimeType,e.filenameExtension);break;case"TOPIC":i=Ot.TOPICS;break}return w`
2967
2965
  <ft-icon .variant="${t}" .value="${i}" part="suggestion-icon"></ft-icon>
2968
2966
  `}getFocusedSuggestionElement(){return this.searchBar.querySelector(".ft-search-bar--suggestion:focus-within")}getLastSuggestionElement(){let e=this.searchBar.querySelectorAll(".ft-search-bar--suggestion");return e.length>0?e[e.length-1]:null}getFirstSuggestionElement(){return this.searchBar.querySelector(".ft-search-bar--suggestion")}focusFirstSuggestion(){var e;(e=this.getFirstSuggestionElement())===null||e===void 0||e.focus()}};At.styles=[_a,L`
2969
2967
  .ft-search-bar--mobile .ft-search-bar--suggestions {
@@ -10,7 +10,6 @@ export declare class SuggestManager {
10
10
  private onSuggestKeyDown;
11
11
  private nextSuggestionElement;
12
12
  private previousSuggestionElement;
13
- private onSuggestKeyUp;
14
13
  private onSuggestClick;
15
14
  private removeRecentSearch;
16
15
  private getIcon;
@@ -20,7 +20,6 @@ class SuggestManager {
20
20
  <a href="${this.getRequestWithQuery(query)}"
21
21
  part="suggestions"
22
22
  class="ft-search-bar--suggestion ft-search-bar--recent-search"
23
- @keyup=${(e) => this.onSuggestKeyUp(e)}
24
23
  @click=${(e) => this.onSuggestClick(e, query)}>
25
24
  <ft-ripple></ft-ripple>
26
25
  <ft-icon variant="material" value="history" part="suggestion-icon"></ft-icon>
@@ -41,7 +40,6 @@ class SuggestManager {
41
40
  <a href="${(this.getRequestWithQuery(suggest.value))}"
42
41
  part="suggestions"
43
42
  class="ft-search-bar--suggestion"
44
- @keyup=${(e) => this.onSuggestKeyUp(e)}
45
43
  @click=${(e) => this.onSuggestClick(e, suggest.value)}>
46
44
  <ft-ripple></ft-ripple>
47
45
  ${this.getIcon(suggest)}
@@ -96,11 +94,6 @@ class SuggestManager {
96
94
  const nextDivElement = (_b = divElement === null || divElement === void 0 ? void 0 : divElement.previousElementSibling) === null || _b === void 0 ? void 0 : _b.querySelector("[part=suggestions]");
97
95
  return nextDivElement !== null && nextDivElement !== void 0 ? nextDivElement : this.getLastSuggestionElement();
98
96
  }
99
- onSuggestKeyUp(e) {
100
- if (e.key === "Enter" || e.key === " ") {
101
- e.target.click();
102
- }
103
- }
104
97
  onSuggestClick(e, suggest) {
105
98
  this.searchBar.setQuery(suggest);
106
99
  this.searchBar.onLaunchSearch();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-search-bar",
3
- "version": "1.2.19",
3
+ "version": "1.2.20",
4
4
  "description": "Search bar component using Fluid Topics public API",
5
5
  "keywords": [
6
6
  "Lit"
@@ -19,23 +19,23 @@
19
19
  "url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
20
20
  },
21
21
  "dependencies": {
22
- "@fluid-topics/ft-accordion": "1.2.19",
23
- "@fluid-topics/ft-app-context": "1.2.19",
24
- "@fluid-topics/ft-button": "1.2.19",
25
- "@fluid-topics/ft-chip": "1.2.19",
26
- "@fluid-topics/ft-filter": "1.2.19",
27
- "@fluid-topics/ft-icon": "1.2.19",
28
- "@fluid-topics/ft-select": "1.2.19",
29
- "@fluid-topics/ft-size-watcher": "1.2.19",
30
- "@fluid-topics/ft-skeleton": "1.2.19",
31
- "@fluid-topics/ft-snap-scroll": "1.2.19",
32
- "@fluid-topics/ft-tooltip": "1.2.19",
33
- "@fluid-topics/ft-typography": "1.2.19",
34
- "@fluid-topics/ft-wc-utils": "1.2.19",
22
+ "@fluid-topics/ft-accordion": "1.2.20",
23
+ "@fluid-topics/ft-app-context": "1.2.20",
24
+ "@fluid-topics/ft-button": "1.2.20",
25
+ "@fluid-topics/ft-chip": "1.2.20",
26
+ "@fluid-topics/ft-filter": "1.2.20",
27
+ "@fluid-topics/ft-icon": "1.2.20",
28
+ "@fluid-topics/ft-select": "1.2.20",
29
+ "@fluid-topics/ft-size-watcher": "1.2.20",
30
+ "@fluid-topics/ft-skeleton": "1.2.20",
31
+ "@fluid-topics/ft-snap-scroll": "1.2.20",
32
+ "@fluid-topics/ft-tooltip": "1.2.20",
33
+ "@fluid-topics/ft-typography": "1.2.20",
34
+ "@fluid-topics/ft-wc-utils": "1.2.20",
35
35
  "lit": "3.1.0"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@fluid-topics/public-api": "1.0.81"
39
39
  },
40
- "gitHead": "eaa2bf8601f59cc5eed082b9c118e81d21a4cf79"
40
+ "gitHead": "4bd72b4e7b35120c6afe320c6be252f7e7641982"
41
41
  }