@searchcraft/javascript-sdk 0.2.9 → 0.3.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.
Files changed (225) hide show
  1. package/dist/cjs/{index-6c5282a0.js → index-264ebadc.js} +290 -9
  2. package/dist/cjs/index-264ebadc.js.map +1 -0
  3. package/dist/cjs/index.cjs.js +1 -1
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/cjs/package-35d3b670.js +68 -0
  6. package/dist/cjs/package-35d3b670.js.map +1 -0
  7. package/dist/cjs/{searchcraft-auto-search-form_19.cjs.entry.js → searchcraft-auto-search-form_17.cjs.entry.js} +144 -121
  8. package/dist/cjs/searchcraft-auto-search-form_17.cjs.entry.js.map +1 -0
  9. package/dist/cjs/searchcraft-base-search-form.cjs.entry.js +13 -5
  10. package/dist/cjs/searchcraft-base-search-form.cjs.entry.js.map +1 -1
  11. package/dist/cjs/searchcraft-button-icon.cjs.entry.js +1 -1
  12. package/dist/cjs/searchcraft-button.cjs.entry.js +4 -4
  13. package/dist/cjs/searchcraft-button.cjs.entry.js.map +1 -1
  14. package/dist/cjs/searchcraft-javascript-sdk.cjs.js +2 -2
  15. package/dist/cjs/searchcraft-spinner-dark.cjs.entry.js +22 -0
  16. package/dist/cjs/searchcraft-spinner-dark.cjs.entry.js.map +1 -0
  17. package/dist/cjs/searchcraft-spinner-light.cjs.entry.js +22 -0
  18. package/dist/cjs/searchcraft-spinner-light.cjs.entry.js.map +1 -0
  19. package/dist/cjs/store-e3bbdd49.js +1022 -0
  20. package/dist/cjs/store-e3bbdd49.js.map +1 -0
  21. package/dist/collection/assets/searchcraft-button-icons.js.map +1 -1
  22. package/dist/collection/assets/searchcraft-check-icon.js.map +1 -1
  23. package/dist/collection/assets/searchcraft-clear-icon-set.js.map +1 -1
  24. package/dist/collection/assets/searchcraft-dash-icon.js.map +1 -1
  25. package/dist/collection/assets/searchcraft-search-icon-set.js.map +1 -1
  26. package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.js +21 -13
  27. package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.js.map +1 -1
  28. package/dist/collection/components/searchcraft-base-search-form/searchcraft-base-search-form.js +17 -10
  29. package/dist/collection/components/searchcraft-base-search-form/searchcraft-base-search-form.js.map +1 -1
  30. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js +76 -26
  31. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js.map +1 -1
  32. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.module.css +42 -22
  33. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js +50 -10
  34. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js.map +1 -1
  35. package/dist/collection/components/searchcraft-button/searchcraft-button.js +2 -3
  36. package/dist/collection/components/searchcraft-button/searchcraft-button.js.map +1 -1
  37. package/dist/collection/components/searchcraft-button/searchcraft-button.module.css +4 -33
  38. package/dist/collection/components/searchcraft-clear-input-button/searchcraft-clear-input-button.js +4 -5
  39. package/dist/collection/components/searchcraft-clear-input-button/searchcraft-clear-input-button.js.map +1 -1
  40. package/dist/collection/components/searchcraft-clear-input-button/searchcraft-clear-input-button.module.css +3 -3
  41. package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js +3 -4
  42. package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js.map +1 -1
  43. package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.js +6 -12
  44. package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.js.map +1 -1
  45. package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.module.css +35 -31
  46. package/dist/collection/components/searchcraft-input/searchcraft-input.js +20 -17
  47. package/dist/collection/components/searchcraft-input/searchcraft-input.js.map +1 -1
  48. package/dist/collection/components/searchcraft-input/searchcraft-input.module.css +28 -28
  49. package/dist/collection/components/searchcraft-input-caption/searchcraft-input-caption.js +2 -3
  50. package/dist/collection/components/searchcraft-input-caption/searchcraft-input-caption.js.map +1 -1
  51. package/dist/collection/components/searchcraft-input-icon/searchcraft-input-icon.js +2 -2
  52. package/dist/collection/components/searchcraft-input-icon/searchcraft-input-icon.js.map +1 -1
  53. package/dist/collection/components/searchcraft-input-icon/searchcraft-input-icon.module.css +2 -2
  54. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js +1 -2
  55. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js.map +1 -1
  56. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.module.css +1 -1
  57. package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.js +5 -3
  58. package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.js.map +1 -1
  59. package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.module.css +14 -4
  60. package/dist/collection/components/searchcraft-slider/searchcraft-slider.js +34 -8
  61. package/dist/collection/components/searchcraft-slider/searchcraft-slider.js.map +1 -1
  62. package/dist/collection/components/searchcraft-slider/searchcraft-slider.module.css +39 -25
  63. package/dist/collection/components/searchcraft-spinner-dark/searchcraft-spinner-dark.js.map +1 -1
  64. package/dist/collection/components/searchcraft-spinner-light/searchcraft-spinner-light.js.map +1 -1
  65. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js +19 -2
  66. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js.map +1 -1
  67. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.module.css +7 -7
  68. package/dist/collection/index.js.map +1 -1
  69. package/dist/collection/provider/store.js +1 -0
  70. package/dist/collection/provider/store.js.map +1 -1
  71. package/dist/collection/utils/utils.js +3 -0
  72. package/dist/collection/utils/utils.js.map +1 -1
  73. package/dist/components/index.js +3 -3
  74. package/dist/components/{p-8c38185e.js → p-4f939ba2.js} +7 -7
  75. package/dist/components/p-4f939ba2.js.map +1 -0
  76. package/dist/components/{p-498c7ef9.js → p-5015a359.js} +4 -5
  77. package/dist/components/p-5015a359.js.map +1 -0
  78. package/dist/components/{p-dd2a4022.js → p-54848b4d.js} +35 -44
  79. package/dist/components/p-54848b4d.js.map +1 -0
  80. package/dist/components/{p-a3bd1bc8.js → p-5a872bdf.js} +2 -2
  81. package/dist/components/{p-a3bd1bc8.js.map → p-5a872bdf.js.map} +1 -1
  82. package/dist/components/{p-7d1bcd2d.js → p-62c40862.js} +5 -2
  83. package/dist/components/p-62c40862.js.map +1 -0
  84. package/dist/components/{p-70722ab2.js → p-62e6b69c.js} +2 -2
  85. package/dist/components/{p-70722ab2.js.map → p-62e6b69c.js.map} +1 -1
  86. package/dist/components/{p-6237f03e.js → p-69ee3b9a.js} +5 -6
  87. package/dist/components/p-69ee3b9a.js.map +1 -0
  88. package/dist/components/{p-7498e493.js → p-6b353c3e.js} +290 -9
  89. package/dist/components/p-6b353c3e.js.map +1 -0
  90. package/dist/components/p-727bfc38.js +925 -0
  91. package/dist/components/p-727bfc38.js.map +1 -0
  92. package/dist/components/{p-bc3f9025.js → p-7c280820.js} +2 -2
  93. package/dist/components/{p-bc3f9025.js.map → p-7c280820.js.map} +1 -1
  94. package/dist/components/{p-4468fba3.js → p-7d385ffb.js} +7 -8
  95. package/dist/components/p-7d385ffb.js.map +1 -0
  96. package/dist/components/p-8524c749.js +54 -0
  97. package/dist/components/p-8524c749.js.map +1 -0
  98. package/dist/components/{p-e5471fcf.js → p-aad03c2a.js} +2 -2
  99. package/dist/components/{p-e5471fcf.js.map → p-aad03c2a.js.map} +1 -1
  100. package/dist/components/p-b0c1fd63.js +66 -0
  101. package/dist/components/p-b0c1fd63.js.map +1 -0
  102. package/dist/components/{p-ae84b899.js → p-b38d171d.js} +5 -6
  103. package/dist/components/p-b38d171d.js.map +1 -0
  104. package/dist/components/{p-d3187f5a.js → p-bbf9973a.js} +2 -2
  105. package/dist/components/{p-d3187f5a.js.map → p-bbf9973a.js.map} +1 -1
  106. package/dist/components/p-cd9a038a.js +105 -0
  107. package/dist/components/p-cd9a038a.js.map +1 -0
  108. package/dist/components/searchcraft-auto-search-form.js +35 -39
  109. package/dist/components/searchcraft-auto-search-form.js.map +1 -1
  110. package/dist/components/searchcraft-base-search-form.js +34 -33
  111. package/dist/components/searchcraft-base-search-form.js.map +1 -1
  112. package/dist/components/searchcraft-base-search-result.js +1 -1
  113. package/dist/components/searchcraft-base-search-results.js +21 -15
  114. package/dist/components/searchcraft-base-search-results.js.map +1 -1
  115. package/dist/components/searchcraft-button-icon.js +1 -1
  116. package/dist/components/searchcraft-button.js +1 -1
  117. package/dist/components/searchcraft-check-icon.js +1 -1
  118. package/dist/components/searchcraft-clear-icon-set.js +1 -1
  119. package/dist/components/searchcraft-clear-input-button.js +1 -1
  120. package/dist/components/searchcraft-dash-icon.js +1 -1
  121. package/dist/components/searchcraft-error-message.js +1 -1
  122. package/dist/components/searchcraft-filters-list.js +12 -18
  123. package/dist/components/searchcraft-filters-list.js.map +1 -1
  124. package/dist/components/searchcraft-input-caption.js +1 -1
  125. package/dist/components/searchcraft-input-icon.js +1 -1
  126. package/dist/components/searchcraft-input-label.js +1 -1
  127. package/dist/components/searchcraft-input.js +1 -1
  128. package/dist/components/searchcraft-results-info.js +9 -7
  129. package/dist/components/searchcraft-results-info.js.map +1 -1
  130. package/dist/components/searchcraft-search-icon-set.js +1 -1
  131. package/dist/components/searchcraft-slider.js +20 -11
  132. package/dist/components/searchcraft-slider.js.map +1 -1
  133. package/dist/components/searchcraft-spinner-dark.js +1 -1
  134. package/dist/components/searchcraft-spinner-light.js +29 -1
  135. package/dist/components/searchcraft-spinner-light.js.map +1 -1
  136. package/dist/components/searchcraft-toggle-button.js +23 -6
  137. package/dist/components/searchcraft-toggle-button.js.map +1 -1
  138. package/dist/esm/{index-0ac5bb53.js → index-d851fb46.js} +290 -9
  139. package/dist/esm/index-d851fb46.js.map +1 -0
  140. package/dist/esm/index.js +1 -1
  141. package/dist/esm/loader.js +3 -3
  142. package/dist/esm/package-82baadd7.js +66 -0
  143. package/dist/esm/package-82baadd7.js.map +1 -0
  144. package/dist/esm/{searchcraft-auto-search-form_19.entry.js → searchcraft-auto-search-form_17.entry.js} +143 -118
  145. package/dist/esm/searchcraft-auto-search-form_17.entry.js.map +1 -0
  146. package/dist/esm/searchcraft-base-search-form.entry.js +13 -5
  147. package/dist/esm/searchcraft-base-search-form.entry.js.map +1 -1
  148. package/dist/esm/searchcraft-button-icon.entry.js +1 -1
  149. package/dist/esm/searchcraft-button.entry.js +4 -4
  150. package/dist/esm/searchcraft-button.entry.js.map +1 -1
  151. package/dist/esm/searchcraft-javascript-sdk.js +3 -3
  152. package/dist/esm/searchcraft-spinner-dark.entry.js +18 -0
  153. package/dist/esm/searchcraft-spinner-dark.entry.js.map +1 -0
  154. package/dist/esm/searchcraft-spinner-light.entry.js +18 -0
  155. package/dist/esm/searchcraft-spinner-light.entry.js.map +1 -0
  156. package/dist/esm/store-b519dd0b.js +1011 -0
  157. package/dist/esm/store-b519dd0b.js.map +1 -0
  158. package/dist/searchcraft-javascript-sdk/index.esm.js +1 -1
  159. package/dist/searchcraft-javascript-sdk/p-1f3ae7f3.entry.js +2 -0
  160. package/dist/searchcraft-javascript-sdk/p-1f3ae7f3.entry.js.map +1 -0
  161. package/dist/searchcraft-javascript-sdk/p-201cb2dc.entry.js +2 -0
  162. package/dist/searchcraft-javascript-sdk/p-201cb2dc.entry.js.map +1 -0
  163. package/dist/searchcraft-javascript-sdk/p-2c220368.entry.js +2 -0
  164. package/dist/searchcraft-javascript-sdk/p-2c220368.entry.js.map +1 -0
  165. package/dist/searchcraft-javascript-sdk/p-39c0ca33.entry.js +2 -0
  166. package/dist/searchcraft-javascript-sdk/p-39c0ca33.entry.js.map +1 -0
  167. package/dist/searchcraft-javascript-sdk/p-476829a4.entry.js +2 -0
  168. package/dist/searchcraft-javascript-sdk/p-476829a4.entry.js.map +1 -0
  169. package/dist/searchcraft-javascript-sdk/{p-5ec960bd.entry.js → p-99356c9a.entry.js} +2 -2
  170. package/dist/searchcraft-javascript-sdk/p-b0c1fd63.js +2 -0
  171. package/dist/searchcraft-javascript-sdk/p-b0c1fd63.js.map +1 -0
  172. package/dist/searchcraft-javascript-sdk/p-b42eaa55.js +3 -0
  173. package/dist/searchcraft-javascript-sdk/p-b42eaa55.js.map +1 -0
  174. package/dist/searchcraft-javascript-sdk/p-d5f8dda2.js +11 -0
  175. package/dist/searchcraft-javascript-sdk/p-d5f8dda2.js.map +1 -0
  176. package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js +1 -1
  177. package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js.map +1 -1
  178. package/dist/types/components/searchcraft-auto-search-form/searchcraft-auto-search-form.d.ts +2 -2
  179. package/dist/types/components/searchcraft-base-search-form/searchcraft-base-search-form.d.ts +2 -2
  180. package/dist/types/components/searchcraft-base-search-result/searchcraft-base-search-result.d.ts +6 -3
  181. package/dist/types/components/searchcraft-base-search-results/searchcraft-base-search-results.d.ts +3 -0
  182. package/dist/types/components/searchcraft-error-message/searchcraft-error-message.d.ts +0 -6
  183. package/dist/types/components/searchcraft-filters-list/searchcraft-filters-list.d.ts +1 -1
  184. package/dist/types/components/searchcraft-input/searchcraft-input.d.ts +3 -3
  185. package/dist/types/components/searchcraft-slider/searchcraft-slider.d.ts +5 -0
  186. package/dist/types/components/searchcraft-toggle-button/searchcraft-toggle-button.d.ts +3 -1
  187. package/dist/types/components.d.ts +48 -22
  188. package/dist/types/provider/store.d.ts +2 -1
  189. package/dist/types/utils/utils.d.ts +1 -0
  190. package/package.json +1 -1
  191. package/dist/cjs/index-6c5282a0.js.map +0 -1
  192. package/dist/cjs/searchcraft-auto-search-form_19.cjs.entry.js.map +0 -1
  193. package/dist/cjs/store-f3bec622.js +0 -406
  194. package/dist/cjs/store-f3bec622.js.map +0 -1
  195. package/dist/components/p-07edaa9b.js +0 -67
  196. package/dist/components/p-07edaa9b.js.map +0 -1
  197. package/dist/components/p-4468fba3.js.map +0 -1
  198. package/dist/components/p-498c7ef9.js.map +0 -1
  199. package/dist/components/p-6237f03e.js.map +0 -1
  200. package/dist/components/p-7498e493.js.map +0 -1
  201. package/dist/components/p-7d1bcd2d.js.map +0 -1
  202. package/dist/components/p-8c38185e.js.map +0 -1
  203. package/dist/components/p-ae84b899.js.map +0 -1
  204. package/dist/components/p-bfb22305.js +0 -33
  205. package/dist/components/p-bfb22305.js.map +0 -1
  206. package/dist/components/p-c31274dd.js +0 -89
  207. package/dist/components/p-c31274dd.js.map +0 -1
  208. package/dist/components/p-dd2a4022.js.map +0 -1
  209. package/dist/components/p-ff049f0a.js +0 -313
  210. package/dist/components/p-ff049f0a.js.map +0 -1
  211. package/dist/esm/index-0ac5bb53.js.map +0 -1
  212. package/dist/esm/searchcraft-auto-search-form_19.entry.js.map +0 -1
  213. package/dist/esm/store-6af9ea01.js +0 -396
  214. package/dist/esm/store-6af9ea01.js.map +0 -1
  215. package/dist/searchcraft-javascript-sdk/p-05416a3e.entry.js +0 -2
  216. package/dist/searchcraft-javascript-sdk/p-05416a3e.entry.js.map +0 -1
  217. package/dist/searchcraft-javascript-sdk/p-0880cfbb.js +0 -3
  218. package/dist/searchcraft-javascript-sdk/p-0880cfbb.js.map +0 -1
  219. package/dist/searchcraft-javascript-sdk/p-1ab836bf.js +0 -11
  220. package/dist/searchcraft-javascript-sdk/p-1ab836bf.js.map +0 -1
  221. package/dist/searchcraft-javascript-sdk/p-3cb77ee1.entry.js +0 -2
  222. package/dist/searchcraft-javascript-sdk/p-3cb77ee1.entry.js.map +0 -1
  223. package/dist/searchcraft-javascript-sdk/p-6c007e2e.entry.js +0 -2
  224. package/dist/searchcraft-javascript-sdk/p-6c007e2e.entry.js.map +0 -1
  225. /package/dist/searchcraft-javascript-sdk/{p-5ec960bd.entry.js.map → p-99356c9a.entry.js.map} +0 -0
@@ -2,9 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-6c5282a0.js');
6
- const store = require('./store-f3bec622.js');
5
+ const index = require('./index-264ebadc.js');
7
6
  const index$1 = require('./index-5b0b9d4c.js');
7
+ const store = require('./store-e3bbdd49.js');
8
+ const _package = require('./package-35d3b670.js');
8
9
 
9
10
  const searchcraftAutoSearchFormModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.formLTR{font-family:var(--font-stack);text-align:left;width:100%}.formRTL{font-family:var(--font-stack);text-align:right;width:100%}";
10
11
  const SearchcraftAutoSearchFormStyle0 = searchcraftAutoSearchFormModuleCss;
@@ -22,11 +23,9 @@ const SearchcraftAutoSearchForm = class {
22
23
  this.searchStore.setQuery(this.query);
23
24
  if (this.query.trim() === '') {
24
25
  this.searchResults = null;
26
+ this.inputClearedOrNoResults.emit();
25
27
  this.searchStore.setSearchResults(null);
26
28
  }
27
- else {
28
- this.querySubmit.emit(this.query);
29
- }
30
29
  };
31
30
  this.handleInputKeyUp = (event) => {
32
31
  const target = event.detail;
@@ -41,6 +40,7 @@ const SearchcraftAutoSearchForm = class {
41
40
  if (this.query.trim() === '') {
42
41
  this.searchResults = null;
43
42
  this.searchStore.setSearchResults(null);
43
+ this.inputClearedOrNoResults.emit();
44
44
  }
45
45
  else {
46
46
  this.searchStore.setQuery(this.query);
@@ -50,6 +50,9 @@ const SearchcraftAutoSearchForm = class {
50
50
  }, this.debounceDelay);
51
51
  };
52
52
  this.handleClearInput = () => {
53
+ if (this.query === '' && !this.searchResults) {
54
+ return;
55
+ }
53
56
  this.query = '';
54
57
  this.searchResults = null;
55
58
  this.searchStore.setQuery('');
@@ -88,9 +91,11 @@ const SearchcraftAutoSearchForm = class {
88
91
  this.autoSearchFormClass = '';
89
92
  this.clearInput = () => { };
90
93
  this.config = {
91
- apiKey: '',
94
+ readKey: '',
92
95
  endpointURL: '',
93
96
  index: [],
97
+ organizationId: '',
98
+ applicationId: '',
94
99
  };
95
100
  this.customStylesForInput = {};
96
101
  this.inputCaptionValue = '';
@@ -106,7 +111,10 @@ const SearchcraftAutoSearchForm = class {
106
111
  this.searchResults = null;
107
112
  }
108
113
  componentDidLoad() {
109
- const searchcraft = new store.g(this.config);
114
+ const searchcraft = new store.ie(this.config, {
115
+ sdkName: _package.packageJson.name,
116
+ sdkVersion: _package.packageJson.version,
117
+ });
110
118
  this.searchStore.initialize(searchcraft, true);
111
119
  this.unsubscribe = store.useSearchcraftStore.subscribe((state) => {
112
120
  this.isRequesting = state.isRequesting;
@@ -121,12 +129,12 @@ const SearchcraftAutoSearchForm = class {
121
129
  render() {
122
130
  const formClass = this.rightToLeftOrientation ? 'formRTL' : 'formLTR';
123
131
  const parsedCustomStyles = store.parseCustomStyles(this.customStylesForInput);
124
- return (index.h("form", { key: '2421495aa88b52a47658af9b682e172da7d23691', class: `${formClass}`, onSubmit: this.handleFormSubmit }, index.h("searchcraft-input-label", { key: '032e7e3a7f83af11422b64b023a38c2f433d3809', label: this.labelForInput }), index.h("searchcraft-input", { key: 'a3a286e6b5ade795a157a1a046278477731684b4', customStyles: parsedCustomStyles, "input-caption-value": this.inputCaptionValue, "input-icon-height": this.inputIconHeight, "input-icon-width": this.inputIconWidth, "is-requesting": this.isRequesting, onClearInput: this.handleClearInput, onInputKeyUp: this.handleInputKeyUp, onSearchInputChange: this.handleInputChange, "placeholder-value": this.placeholderValue, query: this.query, "right-to-left-orientation": this.rightToLeftOrientation }), this.error && (index.h("searchcraft-error-message", { key: '4588522cf331cc8165e789bb3d58f35ef5148f11', errorMessage: 'Please enter a search query.' }))));
132
+ return (index.h("form", { key: '3f8e9a36e827b3f1f8d591622a1c824e7ccc6f83', class: index$1.classNames(`${formClass}`, 'searchcraft-auto-search-form'), onSubmit: this.handleFormSubmit }, index.h("searchcraft-input-label", { key: 'daf9b6aab7185e045891a975ac70a3bf3b7ff75f', label: this.labelForInput }), index.h("searchcraft-input", { key: '655e92d562a73dcf9857f24075c65c6bbe2215f5', customStyles: parsedCustomStyles, "input-caption-value": this.inputCaptionValue, "input-icon-height": this.inputIconHeight, "input-icon-width": this.inputIconWidth, "is-requesting": this.isRequesting, onClearInput: this.handleClearInput, onInputKeyUp: this.handleInputKeyUp, onSearchInputChange: this.handleInputChange, "placeholder-value": this.placeholderValue, query: this.query, "right-to-left-orientation": this.rightToLeftOrientation }), this.error && (index.h("searchcraft-error-message", { key: '988624eb1ff71adde2a2e38ab8adb868a5a12469', errorMessage: 'Please enter a search query.' }))));
125
133
  }
126
134
  };
127
135
  SearchcraftAutoSearchForm.style = SearchcraftAutoSearchFormStyle0;
128
136
 
129
- const searchcraftBaseSearchResultModuleCss = "@charset \"UTF-8\";:root{--font-stack:Helvetica, Arial, sans-serif}.interactiveResultContainerLight{align-items:flex-start;border-radius:16px;display:flex;flex-direction:column;gap:16px;padding:8px;position:relative;background-color:#FAFAFA}@media (min-width: 600px){.interactiveResultContainerLight{flex-direction:row}}.interactiveResultContainerDark{align-items:flex-start;border-radius:16px;display:flex;flex-direction:column;gap:16px;padding:8px;position:relative;background-color:#2E2E2E}@media (min-width: 600px){.interactiveResultContainerDark{flex-direction:row}}.resultContainer{align-items:flex-start;display:flex;flex-direction:column;gap:16px}@media (min-width: 600px){.resultContainer{flex-direction:row}}.interactiveIconLarge{display:inline-block;position:absolute;right:5px;top:8px}@media (max-width: 600px){.interactiveIconLarge{display:none}}.interactiveIconSmall{display:inline-block;position:absolute;right:5px;top:-2px}@media (min-width: 600px){.interactiveIconSmall{display:none}}.imageContainer{max-width:100%}.contentContainer{max-height:100%;max-width:100%}@media (min-width: 600px){.contentContainer{max-width:50%}}.secondaryContentContainer{display:flex}.imageLight{border-radius:8px;max-height:100%;max-width:100%;border:1px solid #D9D9D9}.imageDark{border-radius:8px;max-height:100%;max-width:100%;border:1px solid #333}.headingLight{font-family:var(--font-stack);font-size:16px;font-weight:700;line-height:20px;margin-bottom:4px;margin-top:0;position:relative;-webkit-font-smoothing:antialiased;color:#292929}.headingDark{font-family:var(--font-stack);font-size:16px;font-weight:700;line-height:20px;margin-bottom:4px;margin-top:0;position:relative;-webkit-font-smoothing:antialiased;color:#FFF}.subheadingLight{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-bottom:4px;margin-top:0px;-webkit-font-smoothing:antialiased;color:#737373}.subheadingDark{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-bottom:4px;margin-top:0px;-webkit-font-smoothing:antialiased;color:#BFBFBF}.primaryContentLight{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;-webkit-font-smoothing:antialiased;color:#404040}.primaryContentDark{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;-webkit-font-smoothing:antialiased;color:#E6E6E6}.secondaryContentLight{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;-webkit-font-smoothing:antialiased;color:#404040}.secondaryContentLight::after{content:\"•\";color:#404040;font-size:1em;margin-left:5px;margin-right:5px}.secondaryContentDark{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;-webkit-font-smoothing:antialiased;color:#E6E6E6}.tertiaryContentLight{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;-webkit-font-smoothing:antialiased;color:#404040}.tertiaryContentDark{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;-webkit-font-smoothing:antialiased;color:#E6E6E6}";
137
+ const searchcraftBaseSearchResultModuleCss = "@charset \"UTF-8\";:root{--font-stack:Helvetica, Arial, sans-serif}.interactiveResultContainerLight{align-items:flex-start;border-radius:16px;display:flex;flex-direction:column;gap:16px;padding:8px;position:relative;background-color:#F7F7F7}@media (min-width: 900px){.interactiveResultContainerLight{flex-direction:row;justify-content:space-between}}.interactiveResultContainerDark{align-items:flex-start;border-radius:16px;display:flex;flex-direction:column;gap:16px;padding:8px;position:relative;background-color:#2E2E2E}@media (min-width: 900px){.interactiveResultContainerDark{flex-direction:row;justify-content:space-between}}.resultContainer{align-items:flex-start;display:flex;flex-direction:column;gap:16px;all:unset;display:inline;color:inherit;text-decoration:none}.resultContainer:hover{cursor:pointer}@media (min-width: 900px){.resultContainer{flex-direction:row}}.interactiveIconLarge{display:inline-block;position:absolute;right:5px;top:8px}@media (max-width: 900px){.interactiveIconLarge{display:none}}.interactiveIconSmall{display:inline-block;position:absolute;right:5px;top:-2px}@media (min-width: 900px){.interactiveIconSmall{display:none}}.imageContainer{max-width:100%}@media (min-width: 900px){.imageContainer{max-width:400px}}.contentContainer{max-height:100%;max-width:100%}@media (min-width: 900px){.contentContainer{max-width:50%}}.secondaryContentContainer{display:flex}.imageLight{border-radius:8px;max-height:100%;max-width:100%}.imageDark{border-radius:8px;max-height:100%;max-width:100%}.titleLight{font-family:var(--font-stack);font-size:16px;font-weight:700;line-height:20px;margin-bottom:4px;margin-top:0;position:relative;-webkit-font-smoothing:antialiased;color:#292929}.titleDark{font-family:var(--font-stack);font-size:16px;font-weight:700;line-height:20px;margin-bottom:4px;margin-top:0;position:relative;-webkit-font-smoothing:antialiased;color:#FFFFFF}.subtitleContentLight{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-bottom:4px;margin-top:0px;-webkit-font-smoothing:antialiased;color:#737373}.subtitleContentDark{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-bottom:4px;margin-top:0px;-webkit-font-smoothing:antialiased;color:#BFBFBF}.primaryContentLight{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;-webkit-font-smoothing:antialiased;color:#404040}.primaryContentDark{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;-webkit-font-smoothing:antialiased;color:#E6E6E6}.secondaryContentLight{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;-webkit-font-smoothing:antialiased;color:#404040}.secondaryContentDark{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;-webkit-font-smoothing:antialiased;color:#E6E6E6}.tertiaryContentLight{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;-webkit-font-smoothing:antialiased;color:#404040}.tertiaryContentLight.hasContent::before{color:#404040;content:\"•\";font-size:10px;margin-left:5px;margin-right:5px}.tertiaryContentDark{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;-webkit-font-smoothing:antialiased;color:#E6E6E6}.tertiaryContentDark.hasContent::before{color:#404040;content:\"•\";font-size:10px;margin-left:5px;margin-right:5px}";
130
138
  const SearchcraftBaseSearchResultStyle0 = searchcraftBaseSearchResultModuleCss;
131
139
 
132
140
  const SearchcraftBaseSearchResult = class {
@@ -135,49 +143,62 @@ const SearchcraftBaseSearchResult = class {
135
143
  this.buttonCallback = index.createEvent(this, "buttonCallback", 7);
136
144
  this.keyDownCallback = index.createEvent(this, "keyDownCallback", 7);
137
145
  this.resultCallback = index.createEvent(this, "resultCallback", 7);
138
- this.buttonCallback = () => { }; // Callback for button click
139
- this.keyDownCallback = () => { }; // Callback for key down event
140
- this.resultCallback = () => { }; // Callback for result container click
146
+ this.buttonCallback = () => { };
147
+ this.keyDownCallback = () => { };
148
+ this.resultCallback = () => { };
149
+ this.searchcraftStore = store.useSearchcraftStore.getState();
141
150
  this.handleButtonClick = () => {
142
151
  this.buttonCallback();
143
152
  };
144
- this.handleContainerClick = () => {
145
- if (this.isInteractive) {
146
- this.resultCallback();
153
+ this.handleClick = () => {
154
+ var _a, _b, _c;
155
+ const searchcraft = this.searchcraftStore.getSearchcraftInstance();
156
+ if (searchcraft) {
157
+ const document_position = this.documentPosition;
158
+ const search_term = this.searchcraftStore.query;
159
+ const number_of_documents = ((_c = (_b = (_a = this.searchcraftStore.searchResults) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.hits) === null || _c === void 0 ? void 0 : _c.length) || 0;
160
+ searchcraft.sendMeasureEvent('document_clicked', {
161
+ document_position,
162
+ number_of_documents,
163
+ search_term,
164
+ });
165
+ }
166
+ };
167
+ this.parseStyles = () => {
168
+ try {
169
+ return JSON.parse(this.customStyles);
170
+ }
171
+ catch (error) {
172
+ console.error('Error parsing custom styles:', error);
173
+ return {};
147
174
  }
148
175
  };
149
176
  this.buttonText = '';
150
177
  this.customStyles = '{}';
151
- this.headingText = '';
178
+ this.titleContent = '';
152
179
  this.imageDescription = '';
153
180
  this.imageSource = '';
154
181
  this.isInteractive = false;
182
+ this.linkHref = '';
155
183
  this.primaryContent = '';
156
184
  this.secondaryContent = '';
157
- this.subheadingText = '';
185
+ this.subtitleContent = '';
158
186
  this.tertiaryContent = '';
159
187
  this.themeMode = 'light';
160
188
  this.placeImageRight = false;
161
- }
162
- parseStyles() {
163
- try {
164
- return JSON.parse(this.customStyles);
165
- }
166
- catch (error) {
167
- console.error('Error parsing custom styles:', error);
168
- return {};
169
- }
189
+ this.documentPosition = 0;
170
190
  }
171
191
  render() {
172
192
  const isLightTheme = this.themeMode === 'light';
173
193
  const styles = this.parseStyles();
174
- const imageContainer = this.imageSource && (index.h("div", { key: '5446a636265cf330a7e67f7539dad7e25077ecda', class: 'imageContainer' }, index.h("img", { key: '59529cce35008eb171f4ee634ed94ff96e716dad', alt: this.imageDescription, class: isLightTheme ? 'imageLight' : 'imageDark', src: this.imageSource, style: styles.image || {} })));
175
- const contentContainer = (index.h("div", { key: 'fd052ef1e3dedcf5b1467b6b0760d0be349c1faf', class: 'contentContainer' }, index.h("h2", { key: '1d1eca475651641b34d477ea7e2ea2f3eb7a2c49', class: isLightTheme ? 'headingLight' : 'headingDark', style: styles.heading || {} }, this.headingText), index.h("h3", { key: '9fcf054f634d088b72b67a2675b67a89f651285b', class: isLightTheme ? 'subheadingLight' : 'subheadingDark', style: styles.subheading || {} }, this.subheadingText), index.h("p", { key: '477078081008771a462abb042232b84f1e72ddd5', class: isLightTheme ? 'primaryContentLight' : 'primaryContentDark', style: styles.primaryContent || {} }, this.primaryContent), index.h("div", { key: '716ea0fe1efbd18f0b6313baac80834fbab53001', class: 'secondaryContentContainer' }, index.h("p", { key: '340dad3f568e5cc2b0a1b412b92a335b9afb7a0f', class: isLightTheme ? 'secondaryContentLight' : 'secondaryContentDark', style: styles.secondaryContent || {} }, this.secondaryContent), index.h("p", { key: 'b0c940aab4b48d4e560aabe7551b3c1a0a4ef3ae', class: isLightTheme ? 'tertiaryContentLight' : 'tertiaryContentDark', style: styles.tertiaryContent || {} }, this.tertiaryContent)), this.buttonText && (index.h("button", { key: 'd9a08ff62c8bc7d2b13bb42872e2391290de0712', onClick: this.handleButtonClick, style: styles.button || {}, type: 'button' }, this.buttonText))));
176
- return (index.h("div", { key: '310676a0e48c3a3d76559b3e3012db1681a55499', class: this.isInteractive
194
+ const imageStyle = isLightTheme ? 'imageLight' : 'imageDark';
195
+ const imageContainer = this.imageSource && (index.h("div", { key: '53541a311548a653d43505356b9a4f25a417093f', class: index$1.classNames('imageContainer', 'searchcraft-base-search-result-image-container') }, index.h("img", { key: '919a46fd856b521a548c2ce6bab8b360507469c2', alt: this.imageDescription, class: index$1.classNames(imageStyle, 'searchcraft-search-result-image'), src: this.imageSource, style: styles.image || {} })));
196
+ const contentContainer = (index.h("div", { key: '944700daf2a0b683769bad992253a8482f71f685', class: index$1.classNames('contentContainer', 'searchcraft-base-search-result-content-container') }, index.h("h2", { key: '623096e2c7cf5f11bac7127cb00342386866089e', class: index$1.classNames(isLightTheme ? 'titleLight' : 'titleDark', 'searchcraft-base-search-result-title'), style: styles.title || {} }, this.titleContent), index.h("h3", { key: '2928f4d872e90d99fac31b75c9fecfee7e2a9a41', class: index$1.classNames(isLightTheme ? 'subtitleContentLight' : 'subtitleContentDark', 'searchcraft-base-search-result-subtitle'), style: styles.subtitle || {} }, this.subtitleContent), index.h("p", { key: '93bd00c9482d492a2d3d6262dba33044d4470d2c', class: index$1.classNames(isLightTheme ? 'primaryContentLight' : 'primaryContentDark', 'searchcraft-base-search-result-primary-content'), style: styles.primaryContent || {} }, this.primaryContent), index.h("div", { key: 'dc3bce7c0f75d121ba3068b3717fd5d934036012', class: index$1.classNames('secondaryContentContainer', 'searchcraft-base-search-result-secondary-content-container') }, index.h("p", { key: '80624ec83a0a7086142b6a35b4ac65d1fdb76a4e', class: index$1.classNames(isLightTheme ? 'secondaryContentLight' : 'secondaryContentDark', 'searchcraft-base-search-result-secondary-content'), style: styles.secondaryContent || {} }, this.secondaryContent), index.h("p", { key: '53bdb3471b16fd4a1f525d99472c3a4d5662b722', class: index$1.classNames(`${isLightTheme ? 'tertiaryContentLight' : 'tertiaryContentDark'}${this.tertiaryContent ? ' hasContent' : ''}`, 'searchcraft-base-search-result-tertiary-content'), style: styles.tertiaryContent || {} }, this.tertiaryContent)), this.buttonText && (index.h("button", { key: '442dc9aebe748ef06710e196382a80bf006a383e', onClick: this.handleButtonClick, style: styles.button || {}, type: 'button' }, this.buttonText))));
197
+ return (index.h("a", { key: '2cf6a6d3768266f6d46e700588083aade92142f7', class: index$1.classNames(this.isInteractive
177
198
  ? isLightTheme
178
199
  ? 'interactiveResultContainerLight'
179
200
  : 'interactiveResultContainerDark'
180
- : 'resultContainer', onKeyDown: this.keyDownCallback, onClick: this.handleContainerClick, style: styles.container || {}, tabindex: '0' }, this.placeImageRight ? (index.h(index.Fragment, null, contentContainer, imageContainer)) : (index.h(index.Fragment, null, imageContainer, contentContainer))));
201
+ : 'resultContainer', 'searchcraft-search-result-container'), onKeyDown: this.keyDownCallback, onClick: this.handleClick, href: this.linkHref, rel: 'noreferrer', style: styles.container || {}, tabindex: '0', target: '_blank' }, this.placeImageRight ? (index.h(index.Fragment, null, contentContainer, imageContainer)) : (index.h(index.Fragment, null, imageContainer, contentContainer))));
181
202
  }
182
203
  };
183
204
  SearchcraftBaseSearchResult.style = SearchcraftBaseSearchResultStyle0;
@@ -188,6 +209,7 @@ const SearchcraftBaseSearchResultsStyle0 = searchcraftBaseSearchResultsModuleCss
188
209
  const SearchcraftBaseSearchResults = class {
189
210
  constructor(hostRef) {
190
211
  index.registerInstance(this, hostRef);
212
+ this.noResults = index.createEvent(this, "noResults", 7);
191
213
  this.adInterval = 4;
192
214
  this.customStylesForResults = {};
193
215
  this.documentAttributesForDisplay = '';
@@ -196,6 +218,7 @@ const SearchcraftBaseSearchResults = class {
196
218
  this.placeAdAtEnd = false;
197
219
  this.placeAdAtStart = true;
198
220
  this.placeResultImageRight = false;
221
+ this.isInteractive = false;
199
222
  this.hasSearched = false;
200
223
  this.query = '';
201
224
  this.searchResults = null;
@@ -226,9 +249,9 @@ const SearchcraftBaseSearchResults = class {
226
249
  }
227
250
  }
228
251
  render() {
229
- var _a, _b, _c, _d, _e, _f, _g;
252
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
230
253
  if (!this.hasSearched) {
231
- return (index.h("div", { class: 'emptyState' }, index.h("slot", { name: 'empty-search' })));
254
+ return (index.h("div", { class: index$1.classNames('emptyState', 'searchcraft-search-results-empty-state-container') }, index.h("slot", { name: 'empty-search' })));
232
255
  }
233
256
  if (!((_a = this.searchResults) === null || _a === void 0 ? void 0 : _a.data)) {
234
257
  return;
@@ -251,17 +274,17 @@ const SearchcraftBaseSearchResults = class {
251
274
  }
252
275
  }
253
276
  }
254
- return (index.h("searchcraft-base-search-result", { "button-callback": () => console.log('button callback'), "custom-styles": serializedStyles, "image-source": dynamicProperties[parsedSearchKeys[parsedSearchKeys.length - 1]], "is-interactive": true, key: `${document.document_id}-${index$1}`, "keydown-callback": () => console.log('keydown'), "heading-text": dynamicProperties[parsedSearchKeys[0]], "place-image-right": this.placeResultImageRight, "primary-content": dynamicProperties[parsedSearchKeys[2]], "result-callback": () => console.log('interactive element'), "secondary-content": dynamicProperties[parsedSearchKeys[3]], "subheading-text": dynamicProperties[parsedSearchKeys[1]], "tertiary-content": dynamicProperties[parsedSearchKeys[4]] }));
277
+ return (index.h("searchcraft-base-search-result", { "button-callback": () => console.log('button callback'), "custom-styles": serializedStyles, "image-source": dynamicProperties[parsedSearchKeys[5]], "is-interactive": this.isInteractive, key: `${document.document_id}-${index$1}`, "keydown-callback": () => console.log('keydown'), linkHref: dynamicProperties[parsedSearchKeys[6]], "place-image-right": this.placeResultImageRight, "primary-content": dynamicProperties[parsedSearchKeys[2]], "result-callback": () => console.log('interactive element'), "secondary-content": dynamicProperties[parsedSearchKeys[3]], "subtitle-content": dynamicProperties[parsedSearchKeys[1]], "tertiary-content": dynamicProperties[parsedSearchKeys[4]], "title-content": dynamicProperties[parsedSearchKeys[0]], "document-position": index$1 }));
255
278
  });
256
279
  const finalComponents = [];
257
280
  if (this.placeAdAtStart) {
258
- finalComponents.push(index.h("div", { key: 'ad-section-start', class: 'adSection' }, index.h("span", null, "##"), index.h("p", null, " Ad Impressions")));
281
+ finalComponents.push(index.h("div", { key: 'ad-section-start', class: index$1.classNames('adSection', 'searchcraft-beginning-injected-ad-section') }, index.h("span", null, "##"), index.h("p", null, " Ad Impressions")));
259
282
  }
260
283
  if (this.adInterval > 0) {
261
- resultsComponents.forEach((component, index$1) => {
284
+ resultsComponents.forEach((component, index$2) => {
262
285
  finalComponents.push(component);
263
- if ((index$1 + 1) % this.adInterval === 0) {
264
- finalComponents.push(index.h("div", { key: `ad-section-${index$1 + 1}`, class: 'adSection' }, index.h("span", null, "##"), index.h("p", null, " Ad Impressions")));
286
+ if ((index$2 + 1) % this.adInterval === 0) {
287
+ finalComponents.push(index.h("div", { key: `ad-section-${index$2 + 1}`, class: index$1.classNames('adSection', 'searchcraft-dynamic-injected-ad-section') }, index.h("span", null, "##"), index.h("p", null, " Ad Impressions")));
265
288
  }
266
289
  });
267
290
  }
@@ -269,10 +292,13 @@ const SearchcraftBaseSearchResults = class {
269
292
  finalComponents.push(...resultsComponents);
270
293
  }
271
294
  if (this.placeAdAtEnd) {
272
- finalComponents.push(index.h("div", { key: 'ad-section-end', class: 'adSection' }, index.h("span", null, "##"), index.h("p", null, " Ad Impressions")));
295
+ finalComponents.push(index.h("div", { key: 'ad-section-end', class: index$1.classNames('adSection', 'searchcraft-end-injected-ad-section') }, index.h("span", null, "##"), index.h("p", null, " Ad Impressions")));
273
296
  }
274
- return (index.h("div", { class: 'resultsContainer' }, finalComponents, this.query.length > 0 &&
275
- ((_g = (_f = (_e = this.searchResults) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f.hits) === null || _g === void 0 ? void 0 : _g.length) === 0 && (index.h("div", { class: 'errorMessageContainer' }, index.h("searchcraft-error-message", { "error-message": `No search results found for "${this.query}" query` })))));
297
+ if (this.query.length > 0 && ((_g = (_f = (_e = this.searchResults) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f.hits) === null || _g === void 0 ? void 0 : _g.length) === 0) {
298
+ this.noResults.emit();
299
+ }
300
+ return (index.h("div", { class: index$1.classNames('resultsContainer', 'searchcraft-search-results-container') }, finalComponents, this.query.length > 0 &&
301
+ ((_k = (_j = (_h = this.searchResults) === null || _h === void 0 ? void 0 : _h.data) === null || _j === void 0 ? void 0 : _j.hits) === null || _k === void 0 ? void 0 : _k.length) === 0 && (index.h("div", { class: index$1.classNames('errorMessageContainer', 'searchcraft-search-results-error-message-container') }, index.h("searchcraft-error-message", { "error-message": `No search results found for "${this.query}" query` })))));
276
302
  }
277
303
  };
278
304
  SearchcraftBaseSearchResults.style = SearchcraftBaseSearchResultsStyle0;
@@ -307,13 +333,16 @@ const SearchcraftClearIconSet = class {
307
333
  }
308
334
  };
309
335
 
310
- const searchcraftClearInputButtonModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.inputClearButtonLTR{align-items:center;background:none;border:none;display:flex;height:20px;justify-content:center;padding:0;position:absolute;right:0;top:50%;transform:translateY(-50%);width:20px}.inputClearButtonRTL{align-items:center;background:none;border:none;display:flex;height:20px;justify-content:center;left:0px;padding:0;position:absolute;top:50%;transform:translateY(-50%);width:20px}";
336
+ const searchcraftClearInputButtonModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.inputClearButtonLTR{align-items:center;background:none;border:none;display:flex;height:20px;justify-content:center;padding:0;position:absolute;right:16px;top:52%;transform:translateY(-50%);width:20px}.inputClearButtonRTL{align-items:center;background:none;border:none;display:flex;height:20px;justify-content:center;left:0px;padding:0;position:absolute;top:52%;transform:translateY(-50%);width:20px}";
311
337
  const SearchcraftClearInputButtonStyle0 = searchcraftClearInputButtonModuleCss;
312
338
 
313
339
  const SearchcraftClearInputButton = class {
314
340
  constructor(hostRef) {
315
341
  index.registerInstance(this, hostRef);
316
342
  this.clearInput = index.createEvent(this, "clearInput", 7);
343
+ this.isLightTheme = () => {
344
+ return this.theme === 'light';
345
+ };
317
346
  this.handleClearClick = (event) => {
318
347
  event.preventDefault();
319
348
  this.clearInput.emit();
@@ -322,11 +351,8 @@ const SearchcraftClearInputButton = class {
322
351
  this.rightToLeftOrientation = false;
323
352
  this.theme = 'light';
324
353
  }
325
- isLightTheme() {
326
- return this.theme === 'light';
327
- }
328
354
  render() {
329
- return this.rightToLeftOrientation ? (index.h("button", { class: index$1.classNames('inputClearButtonRTL', '.sc-clear-input-button-rtl'), onClick: this.handleClearClick, type: 'button' }, this.isRequesting ? (this.isLightTheme ? (index.h("searchcraft-spinner-light", null)) : (index.h("searchcraft-spinner-dark", null))) : this.isLightTheme ? (index.h("searchcraft-clear-icon-set", { type: 'clear-light' })) : (index.h("searchcraft-clear-icon-set", { type: 'clear-dark' })))) : (index.h("button", { class: index$1.classNames('inputClearButtonLTR', '.sc-clear-input-button-ltr'), onClick: this.handleClearClick, type: 'button' }, this.isRequesting ? (this.isLightTheme ? (index.h("searchcraft-spinner-light", null)) : (index.h("searchcraft-spinner-dark", null))) : this.isLightTheme ? (index.h("searchcraft-clear-icon-set", { type: 'clear-light' })) : (index.h("searchcraft-clear-icon-set", { type: 'clear-dark' }))));
355
+ return this.rightToLeftOrientation ? (index.h("button", { class: index$1.classNames('inputClearButtonRTL', 'searchcraft-clear-input-button-rtl'), onClick: this.handleClearClick, type: 'button' }, this.isLightTheme ? (index.h("searchcraft-clear-icon-set", { type: 'clear-light' })) : (index.h("searchcraft-clear-icon-set", { type: 'clear-dark' })))) : (index.h("button", { class: index$1.classNames('inputClearButtonLTR', 'searchcraft-clear-input-button-ltr'), onClick: this.handleClearClick, type: 'button' }, this.isLightTheme ? (index.h("searchcraft-clear-icon-set", { type: 'clear-light' })) : (index.h("searchcraft-clear-icon-set", { type: 'clear-dark' }))));
330
356
  }
331
357
  };
332
358
  SearchcraftClearInputButton.style = SearchcraftClearInputButtonStyle0;
@@ -351,12 +377,12 @@ const SearchcraftErrorMessage = class {
351
377
  }
352
378
  render() {
353
379
  const errorMessageStyle = this.theme === 'light' ? 'errorMessageLight' : 'errorMessageDark';
354
- return (index.h("p", { key: '7c26f9a1b2589d57a81f7909c456e712d9b7fe79', class: index$1.classNames(errorMessageStyle) }, this.errorMessage || 'Search term is required.'));
380
+ return (index.h("p", { key: '877438178c5fe951ff4cd184de7130e4e46739a1', class: index$1.classNames(errorMessageStyle, 'searchcraft-error-message') }, this.errorMessage || 'Search term is required.'));
355
381
  }
356
382
  };
357
383
  SearchcraftErrorMessage.style = SearchcraftErrorMessageStyle0;
358
384
 
359
- const searchcraftFiltersListModuleCss = ".filtersList{width:100%}.checkboxLabel{align-items:center;color:#292929;display:flex;font-family:\"Source Sans Pro\";font-size:14px;font-weight:600;gap:14px;position:relative;-webkit-font-smoothing:antialiased}.checkboxLabel input[type=checkbox]{align-items:center;appearance:none;background-color:#EDEDED;border:1px solid #D9D9D9;cursor:pointer;display:flex;height:24px;justify-content:center;width:24px}.checkboxLabel input[type=checkbox]:checked{background-color:#000;position:relative}.checkboxLabel input[type=checkbox]:checked+.checkContainer{display:block}.checkboxLabel input[type=checkbox]:checked+.dashContainer{display:block}.remainingFilterListCheckbox{margin-left:16px}.childCheckboxLabel{align-items:center;color:#292929;display:flex;font-family:\"Source Sans Pro\";font-size:14px;font-weight:600;gap:12px;position:relative}.childCheckboxLabel input[type=checkbox]{align-items:center;appearance:none;background-color:#EDEDED;border:1px solid #D9D9D9;cursor:pointer;display:flex;height:24px;justify-content:center;position:relative;width:24px;-webkit-font-smoothing:antialiased}.childCheckboxLabel input[type=checkbox]:checked{background-color:#000;position:relative}.childCheckboxLabel input[type=checkbox]:checked+.checkContainer{display:block}.childCheckboxLabel input[type=checkbox]:checked+.dashContainer{display:block}.checkContainer{display:none;height:16px;width:16px;position:absolute;top:10px;left:7px}.dashContainer{display:none;height:3px;width:14px;position:absolute;top:5px;left:9px}.loading{align-items:center;display:flex;justify-content:center;margin:100px}";
385
+ const searchcraftFiltersListModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.filtersListContainer{width:100%}.filterCheckboxLabel{align-items:center;color:#292929;display:flex;font-family:var(--font-stack);font-size:14px;font-weight:600;gap:14px;position:relative;-webkit-font-smoothing:antialiased}.filterCheckboxLabel input[type=checkbox]{align-items:center;appearance:none;background-color:#EBEBEB;border:1px solid #D9D9D9;border-radius:8px;cursor:pointer;display:flex;height:24px;justify-content:center;width:24px}.filterCheckboxLabel input[type=checkbox]:focus{outline:2px solid #000000}.filterCheckboxLabel input[type=checkbox]:checked{background-color:#000000;position:relative}.filterCheckboxLabel input[type=checkbox]:checked+.checkContainer{display:block}.filterCheckboxLabel input[type=checkbox]:checked+.dashContainer{display:block}.childFilterCheckboxLabel{align-items:center;color:#292929;display:flex;font-family:var(--font-stack);font-size:14px;font-weight:600;gap:12px;margin-left:24px;position:relative}.childFilterCheckboxLabel input[type=checkbox]{align-items:center;appearance:none;background-color:#EBEBEB;border:1px solid #D9D9D9;border-radius:8px;cursor:pointer;display:flex;height:24px;justify-content:center;position:relative;width:24px;-webkit-font-smoothing:antialiased}.childFilterCheckboxLabel input[type=checkbox]:focus{outline:2px solid #000000}.childFilterCheckboxLabel input[type=checkbox]:checked{background-color:#000000;position:relative}.childFilterCheckboxLabel input[type=checkbox]:checked+.checkContainer{display:block}.childFilterCheckboxLabel input[type=checkbox]:checked+.dashContainer{display:block}.checkContainer{display:none;height:16px;width:16px;position:absolute;top:9px;left:8px}.dashContainer{display:none;height:3px;width:14px;position:absolute;top:3px;left:9px}";
360
386
  const SearchcraftFiltersListStyle0 = searchcraftFiltersListModuleCss;
361
387
 
362
388
  const SearchcraftFiltersList = class {
@@ -370,6 +396,7 @@ const SearchcraftFiltersList = class {
370
396
  this.searchStore.setSelectedFilters([]);
371
397
  this.emitFiltersUpdate();
372
398
  };
399
+ this.formatLabel = (label, count) => `${label.replace(/-/g, ' ').replace(/\b\w/g, (char) => char.toUpperCase())} (${count})`;
373
400
  this.filters = [];
374
401
  this.dynamicFilters = [];
375
402
  this.selectedFilters = [];
@@ -424,16 +451,13 @@ const SearchcraftFiltersList = class {
424
451
  const parentFilter = this.dynamicFilters.find((filter) => filter.value === value);
425
452
  const childValues = ((_a = parentFilter === null || parentFilter === void 0 ? void 0 : parentFilter.children) === null || _a === void 0 ? void 0 : _a.map((child) => child.value)) || [];
426
453
  if (!isChecked) {
427
- // Remove children from selectedFilters when parent is unchecked
428
454
  this.selectedFilters = this.selectedFilters.filter((filter) => filter !== value && !childValues.includes(filter));
429
455
  }
430
456
  else {
431
- // Add parent filter to selectedFilters
432
457
  this.selectedFilters = [...this.selectedFilters, value];
433
458
  }
434
459
  }
435
460
  else {
436
- // Update selectedFilters for child filters
437
461
  this.selectedFilters = isChecked
438
462
  ? [...this.selectedFilters, value]
439
463
  : this.selectedFilters.filter((filter) => filter !== value);
@@ -445,23 +469,19 @@ const SearchcraftFiltersList = class {
445
469
  this.searchStore.setSelectedFilters(this.selectedFilters);
446
470
  this.searchStore.search();
447
471
  }
448
- formatLabel(label, count) {
449
- return `${label.replace(/-/g, ' ').replace(/\b\w/g, (char) => char.toUpperCase())} (${count})`;
450
- }
451
472
  render() {
452
473
  if (!this.query || this.resultsCount === 0) {
453
474
  return null;
454
475
  }
455
- return (index.h("div", { class: 'filtersList' }, this.dynamicFilters.map((filter) => {
476
+ return (index.h("div", { class: index$1.classNames('filtersListContainer', 'searchcraft-filters-list-container') }, this.dynamicFilters.map((filter) => {
456
477
  const isChildSelected = filter.children
457
478
  ? filter.children.some((child) => this.selectedFilters.includes(child.value))
458
479
  : false;
459
- return (index.h("div", { key: filter.value, class: 'filterItem' }, index.h("label", { class: 'checkboxLabel' }, index.h("input", { type: 'checkbox', checked: this.selectedFilters.includes(filter.value), onChange: (event) => this.handleCheckboxChange(filter.value, event.target.checked, true) }), isChildSelected ? (index.h("div", { class: 'dashContainer' }, index.h("searchcraft-dash-icon", null))) : (index.h("div", { class: 'checkContainer' }, index.h("searchcraft-check-icon", null))), this.formatLabel(filter.label, filter.count)), filter.children && filter.children.length > 0 && (index.h("div", { class: 'childrenContainer' }, filter.children.map((child) => (index.h("label", { key: child.value, class: 'childCheckboxLabel', style: {
460
- marginLeft: '20px',
480
+ return (index.h("div", { key: filter.value, class: index$1.classNames('searchcraft-filters-list-item') }, index.h("label", { class: index$1.classNames('filterCheckboxLabel', 'searchcraft-filters-list-checkbox-label') }, index.h("input", { checked: this.selectedFilters.includes(filter.value), onChange: (event) => this.handleCheckboxChange(filter.value, event.target.checked, true), type: 'checkbox' }), isChildSelected ? (index.h("div", { class: index$1.classNames('dashContainer', 'searchcraft-filter-list-dash-container') }, index.h("searchcraft-dash-icon", null))) : (index.h("div", { class: index$1.classNames('checkContainer', 'searchcraft-filter-list-check-container') }, index.h("searchcraft-check-icon", null))), this.formatLabel(filter.label, filter.count)), filter.children && filter.children.length > 0 && (index.h(index.Fragment, null, filter.children.map((child) => (index.h("label", { key: child.value, class: index$1.classNames('childFilterCheckboxLabel', 'searchcraft-child-filter-checkbox-label'), style: {
461
481
  display: this.selectedFilters.includes(filter.value)
462
482
  ? 'flex'
463
483
  : 'none',
464
- } }, index.h("input", { type: 'checkbox', checked: this.selectedFilters.includes(child.value), onChange: (event) => this.handleCheckboxChange(child.value, event.target.checked) }), index.h("div", { class: 'checkContainer' }, index.h("searchcraft-check-icon", null)), this.formatLabel(child.label.includes('/')
484
+ } }, index.h("input", { checked: this.selectedFilters.includes(child.value), onChange: (event) => this.handleCheckboxChange(child.value, event.target.checked), type: 'checkbox' }), index.h("div", { class: index$1.classNames('checkContainer', 'searchcraft-filter-list-check-container') }, index.h("searchcraft-check-icon", null)), this.formatLabel(child.label.includes('/')
465
485
  ? child.label.split('/').pop() || child.label
466
486
  : child.label, child.count))))))));
467
487
  })));
@@ -469,7 +489,7 @@ const SearchcraftFiltersList = class {
469
489
  };
470
490
  SearchcraftFiltersList.style = SearchcraftFiltersListStyle0;
471
491
 
472
- const searchcraftInputModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.inputContainerLTR{position:relative;width:100%}.inputContainerRTL{position:relative;width:100%;margin-left:8px}.inputLightLTR{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#EDEDED;color:#292929;margin-right:8px;padding-left:36px;padding-right:16px}.inputLightLTR::placeholder{font-family:var(--font-stack);font-size:16px}.inputLightLTR::placeholder{color:#737373}.inputLightLTR:focus{outline:2px solid #000}.inputDarkLTR{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#1A1A1A;color:#FFF;margin-right:8px;padding-left:36px;padding-right:16px}.inputDarkLTR::placeholder{font-family:var(--font-stack);font-size:16px}.inputDarkLTR::placeholder{color:#BFBFBF}.inputDarkLTR:focus{outline:2px solid #FFF}.inputErrorLightLTR{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#EDEDED;color:#292929;outline:2px solid #c00;margin-right:8px;padding-left:36px;padding-right:16px}.inputErrorLightLTR::placeholder{font-family:var(--font-stack);font-size:16px}.inputErrorLightLTR::placeholder{color:#737373}.inputErrorLightLTR:focus{outline:2px solid #000}.inputErrorLightLTR:focus-visible{outline:2px solid #c00}.inputErrorDarkLTR{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#1A1A1A;color:#FFF;outline:2px solid #FFB3B3;margin-right:8px;padding-left:36px;padding-right:16px}.inputErrorDarkLTR::placeholder{font-family:var(--font-stack);font-size:16px}.inputErrorDarkLTR::placeholder{color:#BFBFBF}.inputErrorDarkLTR:focus{outline:2px solid #FFF}.inputErrorDarkLTR:focus-visible{outline:2px solid #FFB3B3}.inputLightRTL{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#EDEDED;color:#292929;margin-left:8px;padding-left:16px;padding-right:36px;text-align:right}.inputLightRTL::placeholder{font-family:var(--font-stack);font-size:16px}.inputLightRTL::placeholder{color:#737373}.inputLightRTL:focus{outline:2px solid #000}.inputDarkRTL{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#1A1A1A;color:#FFF;margin-left:8px;padding-left:16px;padding-right:36px;text-align:right}.inputDarkRTL::placeholder{font-family:var(--font-stack);font-size:16px}.inputDarkRTL::placeholder{color:#BFBFBF}.inputDarkRTL:focus{outline:2px solid #FFF}.inputErrorLightRTL{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#EDEDED;color:#292929;outline:2px solid #c00;margin-left:8px;padding-left:16px;padding-right:36px;text-align:right}.inputErrorLightRTL::placeholder{font-family:var(--font-stack);font-size:16px}.inputErrorLightRTL::placeholder{color:#737373}.inputErrorLightRTL:focus{outline:2px solid #000}.inputErrorLightRTL:focus-visible{outline:2px solid #c00}.inputErrorDarkRTL{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#1A1A1A;color:#FFF;outline:2px solid #FFB3B3;margin-left:8px;padding-left:16px;padding-right:36px;text-align:right}.inputErrorDarkRTL::placeholder{font-family:var(--font-stack);font-size:16px}.inputErrorDarkRTL::placeholder{color:#BFBFBF}.inputErrorDarkRTL:focus{outline:2px solid #FFF}.inputErrorDarkRTL:focus-visible{outline:2px solid #FFB3B3}.inputWrapper{align-items:center;display:flex;position:relative;width:100%}";
492
+ const searchcraftInputModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.inputContainerLTR{position:relative;width:100%}.inputContainerRTL{position:relative;width:100%;margin-left:8px}.inputLightLTR{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;background-color:#F3F3F3;color:#292929;margin-right:8px;padding-left:36px;padding-right:16px}.inputLightLTR::placeholder{font-family:var(--font-stack);font-size:16px;font-weight:400}.inputLightLTR::placeholder{color:#737373}.inputLightLTR:focus{outline:2px solid #000000}.inputDarkLTR{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;background-color:#1A1A1A;color:#FFFFFF;margin-right:8px;padding-left:36px;padding-right:16px}.inputDarkLTR::placeholder{font-family:var(--font-stack);font-size:16px;font-weight:400}.inputDarkLTR::placeholder{color:#BFBFBF}.inputDarkLTR:focus{outline:2px solid #FFFFFF}.inputErrorLightLTR{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;background-color:#F3F3F3;color:#292929;outline:2px solid #CC0000;margin-right:8px;padding-left:36px;padding-right:16px}.inputErrorLightLTR::placeholder{font-family:var(--font-stack);font-size:16px;font-weight:400}.inputErrorLightLTR::placeholder{color:#737373}.inputErrorLightLTR:focus{outline:2px solid #000000}.inputErrorLightLTR:focus-visible{outline:2px solid #CC0000}.inputErrorDarkLTR{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;background-color:#1A1A1A;color:#FFFFFF;outline:2px solid #FFB3B3;margin-right:8px;padding-left:36px;padding-right:16px}.inputErrorDarkLTR::placeholder{font-family:var(--font-stack);font-size:16px;font-weight:400}.inputErrorDarkLTR::placeholder{color:#BFBFBF}.inputErrorDarkLTR:focus{outline:2px solid #FFFFFF}.inputErrorDarkLTR:focus-visible{outline:2px solid #FFB3B3}.inputLightRTL{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;background-color:#F3F3F3;color:#292929;margin-left:8px;padding-left:16px;padding-right:36px;text-align:right}.inputLightRTL::placeholder{font-family:var(--font-stack);font-size:16px;font-weight:400}.inputLightRTL::placeholder{color:#737373}.inputLightRTL:focus{outline:2px solid #000000}.inputDarkRTL{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;background-color:#1A1A1A;color:#FFFFFF;margin-left:8px;padding-left:16px;padding-right:36px;text-align:right}.inputDarkRTL::placeholder{font-family:var(--font-stack);font-size:16px;font-weight:400}.inputDarkRTL::placeholder{color:#BFBFBF}.inputDarkRTL:focus{outline:2px solid #FFFFFF}.inputErrorLightRTL{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;background-color:#F3F3F3;color:#292929;outline:2px solid #CC0000;margin-left:8px;padding-left:16px;padding-right:36px;text-align:right}.inputErrorLightRTL::placeholder{font-family:var(--font-stack);font-size:16px;font-weight:400}.inputErrorLightRTL::placeholder{color:#737373}.inputErrorLightRTL:focus{outline:2px solid #000000}.inputErrorLightRTL:focus-visible{outline:2px solid #CC0000}.inputErrorDarkRTL{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;background-color:#1A1A1A;color:#FFFFFF;outline:2px solid #FFB3B3;margin-left:8px;padding-left:16px;padding-right:36px;text-align:right}.inputErrorDarkRTL::placeholder{font-family:var(--font-stack);font-size:16px;font-weight:400}.inputErrorDarkRTL::placeholder{color:#BFBFBF}.inputErrorDarkRTL:focus{outline:2px solid #FFFFFF}.inputErrorDarkRTL:focus-visible{outline:2px solid #FFB3B3}.inputWrapper{align-items:center;display:flex;position:relative;width:100%}";
473
493
  const SearchcraftInputStyle0 = searchcraftInputModuleCss;
474
494
 
475
495
  const SearchcraftInput = class {
@@ -478,6 +498,23 @@ const SearchcraftInput = class {
478
498
  this.clearInput = index.createEvent(this, "clearInput", 7);
479
499
  this.searchInputChange = index.createEvent(this, "searchInputChange", 7);
480
500
  this.inputKeyUp = index.createEvent(this, "inputKeyUp", 7);
501
+ this.handleInputChange = (event) => {
502
+ const input = event.target;
503
+ this.searchInputChange.emit(input.value);
504
+ };
505
+ this.handleInputKeyUp = (event) => {
506
+ const input = event.target;
507
+ this.inputKeyUp.emit(input.value);
508
+ };
509
+ this.handleClearInput = () => {
510
+ if (this.query === '') {
511
+ return;
512
+ }
513
+ this.query = '';
514
+ if (this.clearInput) {
515
+ this.clearInput.emit();
516
+ }
517
+ };
481
518
  this.customStyles = {};
482
519
  this.error = false;
483
520
  this.formClassName = '';
@@ -495,35 +532,22 @@ const SearchcraftInput = class {
495
532
  get isLightTheme() {
496
533
  return this.theme === 'light';
497
534
  }
498
- handleInputChange(event) {
499
- const input = event.target;
500
- this.searchInputChange.emit(input.value);
501
- }
502
- handleInputKeyUp(event) {
503
- const input = event.target;
504
- this.inputKeyUp.emit(input.value);
505
- }
506
- handleClearInput() {
507
- if (this.clearInput) {
508
- this.clearInput.emit();
509
- }
510
- }
511
535
  render() {
512
536
  const containerClassName = this.rightToLeftOrientation
513
537
  ? 'inputContainerRTL'
514
538
  : 'inputContainerLTR';
515
- const inputClassName = index$1.classNames(this.error
539
+ const inputClassName = this.error
516
540
  ? this.isLightTheme
517
541
  ? 'inputErrorLightRTL'
518
542
  : 'inputErrorDarkRTL'
519
543
  : this.isLightTheme
520
544
  ? 'inputLightLTR'
521
- : 'inputDarkLTR', 'searchcraft-input');
545
+ : 'inputDarkLTR';
522
546
  const validatedCustomStyles = store.parseCustomStyles(this.customStyles);
523
547
  const placeholderStyle = {
524
548
  fontSize: validatedCustomStyles.placeholderFontSize || '16px',
525
549
  };
526
- return (index.h("div", { key: '0eea589d7f78b4ae830b1950ab193f9c72797625', class: index$1.classNames(containerClassName, this.formClassName, 'searchcraft-input-form') }, this.rightToLeftOrientation ? (index.h(index.Fragment, null, index.h("input", { autoComplete: 'off', class: index$1.classNames(inputClassName, 'searchcraft-input'), id: 'searchcraft-input-id', onChange: this.handleInputChange.bind(this), onKeyUp: this.handleInputKeyUp.bind(this), placeholder: this.placeholderValue, type: 'text', value: this.query, style: validatedCustomStyles }), index.h("style", null, `
550
+ return (index.h("div", { key: '931c969802f73f4fa4d44ea591b506e5d1f9caf1', class: index$1.classNames(containerClassName, this.formClassName, 'searchcraft-input-form') }, this.rightToLeftOrientation ? (index.h(index.Fragment, null, index.h("input", { autoComplete: 'off', class: index$1.classNames(inputClassName, 'searchcraft-input'), id: 'searchcraft-input-id', onChange: this.handleInputChange.bind(this), onKeyUp: this.handleInputKeyUp.bind(this), placeholder: this.placeholderValue, style: validatedCustomStyles, type: 'text', value: this.query }), index.h("style", null, `
527
551
  #searchcraft-input-id::placeholder {
528
552
  font-size: ${placeholderStyle.fontSize};
529
553
  }
@@ -558,18 +582,18 @@ const SearchcraftInputCaption = class {
558
582
  : 'inputCaptionErrorDarkRTL'
559
583
  : this.isLightTheme
560
584
  ? 'inputCaptionLightRTL'
561
- : 'inputCaptionDarkRTL', this.inputCaptionClassName, '.searchcraft-input-caption') }, this.inputCaptionValue)) : (index.h("p", { class: index$1.classNames(this.error
585
+ : 'inputCaptionDarkRTL', this.inputCaptionClassName, 'searchcraft-input-caption') }, this.inputCaptionValue)) : (index.h("p", { class: index$1.classNames(this.error
562
586
  ? this.isLightTheme
563
587
  ? 'inputCaptionErrorLightLTR'
564
588
  : 'inputCaptionErrorDarkLTR'
565
589
  : this.isLightTheme
566
590
  ? 'inputCaptionLightLTR'
567
- : 'inputCaptionDarkLTR', this.inputCaptionClassName, '.searchcraft-input-caption') }, this.inputCaptionValue));
591
+ : 'inputCaptionDarkLTR', this.inputCaptionClassName, 'searchcraft-input-caption') }, this.inputCaptionValue));
568
592
  }
569
593
  };
570
594
  SearchcraftInputCaption.style = SearchcraftInputCaptionStyle0;
571
595
 
572
- const searchcraftInputIconModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.inputIconLTR{left:15px;position:absolute;top:50%;transform:translateY(-50%)}.inputIconRTL{position:absolute;right:15px;top:50%;transform:translateY(-50%)}";
596
+ const searchcraftInputIconModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.inputIconLTR{left:15px;position:absolute;top:52%;transform:translateY(-50%)}.inputIconRTL{position:absolute;right:15px;top:52%;transform:translateY(-50%)}";
573
597
  const SearchcraftInputIconStyle0 = searchcraftInputIconModuleCss;
574
598
 
575
599
  const SearchcraftInputIcon = class {
@@ -585,12 +609,12 @@ const SearchcraftInputIcon = class {
585
609
  return this.theme === 'light';
586
610
  }
587
611
  render() {
588
- return this.error ? (index.h("div", { class: this.rightToLeftOrientation ? 'inputIconRTL' : 'inputIconLTR' }, this.isLightTheme() ? (index.h("searchcraft-search-icon-set", { height: this.height, type: 'error-light', width: this.width })) : (index.h("searchcraft-search-icon-set", { height: this.height, type: 'error-dark', width: this.width })))) : (index.h("div", { class: this.rightToLeftOrientation ? 'inputIconRTL' : 'inputIconLTR' }, this.isLightTheme() ? (index.h("searchcraft-search-icon-set", { height: this.height, type: 'search-light', width: this.width })) : (index.h("searchcraft-search-icon-set", { height: this.height, type: 'search-dark', width: this.width }))));
612
+ return this.error ? (index.h("div", { class: index$1.classNames(this.rightToLeftOrientation ? 'inputIconRTL' : 'inputIconLTR', 'searchcraft-input-icon-container') }, this.isLightTheme() ? (index.h("searchcraft-search-icon-set", { height: this.height, type: 'error-light', width: this.width })) : (index.h("searchcraft-search-icon-set", { height: this.height, type: 'error-dark', width: this.width })))) : (index.h("div", { class: index$1.classNames(this.rightToLeftOrientation ? 'inputIconRTL' : 'inputIconLTR', 'searchcraft-input-icon-container') }, this.isLightTheme() ? (index.h("searchcraft-search-icon-set", { height: this.height, type: 'search-light', width: this.width })) : (index.h("searchcraft-search-icon-set", { height: this.height, type: 'search-dark', width: this.width }))));
589
613
  }
590
614
  };
591
615
  SearchcraftInputIcon.style = SearchcraftInputIconStyle0;
592
616
 
593
- const searchcraftInputLabelModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.labelLight{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#292929}.labelDark{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#FFF}";
617
+ const searchcraftInputLabelModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.labelLight{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#292929}.labelDark{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#FFFFFF}";
594
618
  const SearchcraftInputLabelStyle0 = searchcraftInputLabelModuleCss;
595
619
 
596
620
  const SearchcraftInputLabel = class {
@@ -608,12 +632,12 @@ const SearchcraftInputLabel = class {
608
632
  return null;
609
633
  }
610
634
  const labelStyle = this.isLightTheme() ? 'labelLight' : 'labelDark';
611
- return (index.h("label", { class: index$1.classNames(labelStyle, this.inputLabelClassName), htmlFor: 'searchcraft-input-id' }, this.label));
635
+ return (index.h("label", { class: index$1.classNames(labelStyle, this.inputLabelClassName, 'searchcraft-input-label'), htmlFor: 'searchcraft-input-id' }, this.label));
612
636
  }
613
637
  };
614
638
  SearchcraftInputLabel.style = SearchcraftInputLabelStyle0;
615
639
 
616
- const searchcraftResultsInfoModuleCss = ".container{border-bottom:1px solid #D9D9D9;display:flex;justify-content:flex-start;width:100%}.resultsInfo{color:#292929;font-size:18px;font-weight:600;line-height:20px;margin:0;margin-bottom:8px}";
640
+ const searchcraftResultsInfoModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.resultsInfoContainer{border-bottom:1px solid #D9D9D9;display:flex;justify-content:flex-start;width:100%}.resultsInfoContent{color:#292929;font-family:var(--font-stack);font-size:18px;font-weight:600;line-height:20px;margin:24px 0 8px}@media (max-width: 900px){.resultsInfoContent{margin:0;margin-bottom:8px}}";
617
641
  const SearchcraftResultsInfoStyle0 = searchcraftResultsInfoModuleCss;
618
642
 
619
643
  const SearchcraftResultsInfo = class {
@@ -630,7 +654,7 @@ const SearchcraftResultsInfo = class {
630
654
  this.isRequesting = state.isRequesting;
631
655
  this.resultsCount = ((_b = (_a = state.searchResults) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.count) || 0;
632
656
  this.responseTime = ((((_d = (_c = state.searchResults) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.time_taken) || 0) * 1000).toFixed(2);
633
- this.query = state.query || ''; // Update query from store
657
+ this.query = state.query || '';
634
658
  });
635
659
  }
636
660
  disconnectedCallback() {
@@ -642,7 +666,8 @@ const SearchcraftResultsInfo = class {
642
666
  if (!this.query || this.resultsCount === 0) {
643
667
  return null;
644
668
  }
645
- return (index.h("div", { class: 'container' }, index.h("p", { class: 'resultsInfo' }, this.resultsCount, " results found in ", this.responseTime, "ms")));
669
+ const formattedResults = store.formatNumberWithCommas(this.resultsCount);
670
+ return (index.h("div", { class: index$1.classNames('resultsInfoContainer', 'searchcraft-results-info-container') }, index.h("p", { class: index$1.classNames('resultsInfoContent', 'searchcraft-results-info-content') }, formattedResults, " results found in ", this.responseTime, "ms")));
646
671
  }
647
672
  };
648
673
  SearchcraftResultsInfo.style = SearchcraftResultsInfoStyle0;
@@ -671,15 +696,20 @@ const SearchcraftSearchIconSet = class {
671
696
  }
672
697
  };
673
698
 
674
- const searchcraftSliderModuleCss = ".sliderContainer{display:flex;flex-direction:column;gap:10px;font-family:Arial, sans-serif;align-items:center;width:100%}.rangeContainer{display:flex;position:relative;width:100%;align-items:center}.rangeContainer .activeRange{position:absolute;top:50%;transform:translateY(-50%);height:4px;background:#007DB3;z-index:0;border-radius:2px}.rangeContainer .rangeSlider{width:100%;height:4px;background:transparent;border-radius:2px;outline:none;-webkit-appearance:none;appearance:none;position:absolute;margin:0}.rangeContainer .rangeSlider::-webkit-slider-thumb{-webkit-appearance:none;width:20px;height:20px;background-color:#FFF;border-radius:50%;border:2px solid #e6e6e6;cursor:pointer}.rangeContainer .rangeSlider::-moz-range-thumb{width:20px;height:20px;background-color:#FFF;border-radius:50%;border:2px solid #e6e6e6;cursor:pointer}.yearLabels{display:flex;justify-content:space-between;width:100%;margin-top:10px;font-size:15px;font-weight:600;font-family:\"Source Sans Pro\", sans-serif;color:#666}.yearLabel{min-width:30px;text-align:center}";
699
+ const searchcraftSliderModuleCss = ".sliderContainer{align-items:center;display:flex;flex-direction:column;gap:10px;width:100%}.rangeContainer{align-items:center;background-color:#D9D9D9;border-radius:999px;display:flex;position:relative;height:4px;width:100%}.rangeContainer::-webkit-slider-runnable-track{pointer-events:none}.rangeContainer .activeRange{background-color:#000000;border-radius:2px;height:4px;position:absolute;top:50%;transform:translateY(-50%);z-index:0}.rangeContainer .activeRange::-webkit-slider-runnable-track{pointer-events:none}.rangeContainer .activeRange::-moz-range-track{pointer-events:none}.rangeContainer .rangeSlider{appearance:none;background:transparent;border-radius:2px;height:4px;margin:0;outline:none;pointer-events:none;position:absolute;width:100%;-webkit-appearance:none}.rangeContainer .rangeSlider::-webkit-slider-thumb{background-color:#FFFFFF;border-radius:50%;border:2px solid #E6E6E6;cursor:pointer;height:20px;pointer-events:all;width:20px;-webkit-appearance:none}.rangeContainer .rangeSlider::-moz-range-thumb{background-color:#FFFFFF;border-radius:50%;border:2px solid #E6E6E6;cursor:pointer;height:20px;pointer-events:all;width:20px}.yearLabels{color:#292929;display:flex;font-family:\"Source Sans Pro\", sans-serif;font-size:15px;font-weight:600;justify-content:space-between;margin-top:10px;width:100%}.yearLabel{min-width:30px;text-align:center}";
675
700
  const SearchcraftSliderStyle0 = searchcraftSliderModuleCss;
676
701
 
677
702
  const SearchcraftSlider = class {
678
703
  constructor(hostRef) {
679
704
  index.registerInstance(this, hostRef);
705
+ this.rangeChanged = index.createEvent(this, "rangeChanged", 7);
680
706
  this.searchStore = store.useSearchcraftStore.getState();
681
707
  this.updateYears = async () => {
682
708
  this.searchStore.setYearsRange([this.startYear, this.endYear]);
709
+ this.rangeChanged.emit({
710
+ startYear: this.startYear,
711
+ endYear: this.endYear,
712
+ });
683
713
  try {
684
714
  if (typeof this.query === 'string' && this.query.trim() !== '') {
685
715
  await this.searchStore.search();
@@ -694,13 +724,17 @@ const SearchcraftSlider = class {
694
724
  };
695
725
  this.handleStartYearChange = (event) => {
696
726
  const value = Number.parseInt(event.target.value, 10);
697
- this.startYear = Math.min(value, this.endYear);
698
- this.updateYears();
727
+ if (value <= this.endYear) {
728
+ this.startYear = value;
729
+ this.updateYears();
730
+ }
699
731
  };
700
732
  this.handleEndYearChange = (event) => {
701
733
  const value = Number.parseInt(event.target.value, 10);
702
- this.endYear = Math.max(value, this.startYear);
703
- this.updateYears();
734
+ if (value >= this.startYear) {
735
+ this.endYear = value;
736
+ this.updateYears();
737
+ }
704
738
  };
705
739
  this.maxYear = new Date().getFullYear();
706
740
  this.minYear = 2014;
@@ -733,47 +767,29 @@ const SearchcraftSlider = class {
733
767
  const rangeMax = this.maxYear;
734
768
  const startPercent = ((this.startYear - rangeMin) / (rangeMax - rangeMin)) * 100;
735
769
  const endPercent = ((this.endYear - rangeMin) / (rangeMax - rangeMin)) * 100;
736
- return (index.h("div", { class: 'sliderContainer' }, index.h("div", { class: 'rangeContainer' }, index.h("div", { class: 'activeRange', style: {
770
+ return (index.h("div", { class: index$1.classNames('sliderContainer', 'searchcraft-slider-container') }, index.h("div", { class: index$1.classNames('rangeContainer', 'searchcraft-slider-range-container') }, index.h("div", { class: index$1.classNames('activeRange', 'searchcraft-slider-active-range'), style: {
737
771
  left: `${startPercent}%`,
738
772
  width: `${endPercent - startPercent}%`,
739
- } }), index.h("input", { class: 'rangeSlider', max: this.maxYear, min: this.minYear, onInput: this.handleStartYearChange, step: '1', type: 'range', value: this.startYear }), index.h("input", { class: 'rangeSlider', max: this.maxYear, min: this.minYear, onInput: this.handleEndYearChange, step: '1', type: 'range', value: this.endYear })), index.h("div", { class: 'yearLabels' }, index.h("span", { class: 'yearLabel' }, this.startYear), index.h("span", { class: 'yearLabel' }, this.endYear))));
773
+ } }), index.h("input", { class: index$1.classNames('rangeSlider', 'searchcraft-slider-range-slider-start-thumb'), max: this.maxYear, min: this.minYear, onInput: this.handleStartYearChange, step: '1', type: 'range', value: this.startYear }), index.h("input", { class: index$1.classNames('rangeSlider', 'searchcraft-slider-range-slider-end-thumb'), max: this.maxYear, min: this.minYear, onInput: this.handleEndYearChange, step: '1', type: 'range', value: this.endYear })), index.h("div", { class: index$1.classNames('yearLabels', 'searchcraft-slider-year-label-container') }, index.h("span", { class: index$1.classNames('yearLabel', 'searchcraft-slider-start-year-label') }, this.startYear), index.h("span", { class: index$1.classNames('yearLabel', 'searchcraft-slider-end-year-label') }, this.endYear))));
740
774
  }
741
775
  };
742
776
  SearchcraftSlider.style = SearchcraftSliderStyle0;
743
777
 
744
- const searchcraftSpinnerDarkModuleCss = ".spinnerContainer{background-color:transparent;height:20px;width:20px}.spinnerDark{animation:spinning 1s linear infinite;background:conic-gradient(#000 50%, #FFFFFF);clip-path:circle(50%);height:100%;mask-image:radial-gradient(circle at center, rgba(0, 0, 0, 0) 6.6666666667px, rgb(0, 0, 0) 6.6666666667px);width:100%}.spinnerLight{animation:spinning 1s linear infinite;background:conic-gradient(#737373 50%, #FFFFFF);clip-path:circle(50%);height:100%;mask-image:radial-gradient(circle at center, rgba(0, 0, 0, 0) 6.6666666667px, rgb(0, 0, 0) 6.6666666667px);width:100%}@keyframes spinning{0%{transform:rotate(0deg)}50%{transform:rotate(180deg)}100%{transform:rotate(360deg)}}";
745
- const SearchcraftSpinnerDarkStyle0 = searchcraftSpinnerDarkModuleCss;
746
-
747
- const SearchcraftSpinnerDark = class {
748
- constructor(hostRef) {
749
- index.registerInstance(this, hostRef);
750
- }
751
- render() {
752
- return (index.h("div", { key: 'be34b9a3ecec05fdc169145a5db5a4f37bbd404b', class: 'spinnerContainer' }, index.h("div", { key: 'b59ffd2fe8dd3ac990003bff3085cb571c08730e', class: 'spinnerDark' })));
753
- }
754
- };
755
- SearchcraftSpinnerDark.style = SearchcraftSpinnerDarkStyle0;
756
-
757
- const searchcraftSpinnerLightModuleCss = ".spinnerContainer{background-color:transparent;height:20px;width:20px}.spinnerLight{animation:spinning 1s linear infinite;background:conic-gradient(#737373 50%, #FFFFFF);clip-path:circle(50%);height:100%;mask-image:radial-gradient(circle at center, rgba(0, 0, 0, 0) 6.6666666667px, rgb(0, 0, 0) 6.6666666667px);width:100%}@keyframes spinning{0%{transform:rotate(0deg)}50%{transform:rotate(180deg)}100%{transform:rotate(360deg)}}";
758
- const SearchcraftSpinnerLightStyle0 = searchcraftSpinnerLightModuleCss;
759
-
760
- const SearchcraftSpinnerLight = class {
761
- constructor(hostRef) {
762
- index.registerInstance(this, hostRef);
763
- }
764
- render() {
765
- return (index.h("div", { key: 'a4f73eee03d4d7253c04c47995315bd121e8ded3', class: 'spinnerContainer' }, index.h("div", { key: '53e3486ef7a2fa6029a6107bae2c0655b1608a12', class: 'spinnerLight' })));
766
- }
767
- };
768
- SearchcraftSpinnerLight.style = SearchcraftSpinnerLightStyle0;
769
-
770
- const searchcraftToggleButtonModuleCss = ".toggle-wrapper{background:#ddd;border:none;border-radius:16px;box-shadow:0px 0px 0px 1px rgba(0, 0, 0, 0.05);cursor:pointer;height:26px;margin-left:10px;position:relative;width:44px}.toggle-wrapper.active{background:#007DB3;box-shadow:0px 0px 0px 1px rgba(0, 0, 0, 0.05)}.toggle-wrapper .toggle-switch{background:#fff;border-radius:50%;height:18px;left:4px;position:absolute;top:calc(50% - 9px);transition:transform 0.3s ease;width:18px}.toggle-wrapper .toggle-switch.active{transform:translateX(16px)}";
778
+ const searchcraftToggleButtonModuleCss = ".toggleWrapper{background:#D9D9D9;border:none;border-radius:16px;box-shadow:0px 0px 0px 1px rgba(0, 0, 0, 0.05);cursor:pointer;height:26px;margin-left:10px;position:relative;width:44px}.toggleWrapper.active{background:#000000;box-shadow:0px 0px 0px 1px rgba(0, 0, 0, 0.05)}.toggleWrapper .toggleSwitch{background:#FFFFFF;border-radius:50%;height:18px;left:4px;position:absolute;top:calc(50% - 9px);transition:transform 0.3s ease;width:18px}.toggleWrapper .toggleSwitch.active{transform:translateX(16px)}";
771
779
  const SearchcraftToggleButtonStyle0 = searchcraftToggleButtonModuleCss;
772
780
 
773
781
  const SearchcraftToggleButton = class {
774
782
  constructor(hostRef) {
775
783
  index.registerInstance(this, hostRef);
784
+ this.autoSearchFormElement = null;
776
785
  this.searchStore = store.useSearchcraftStore.getState();
786
+ this.handleSearchRequest = () => {
787
+ this.isActive = false;
788
+ this.searchStore.setSearchParams({
789
+ mode: 'fuzzy',
790
+ sort: 'asc',
791
+ });
792
+ };
777
793
  this.handleToggle = async () => {
778
794
  this.isActive = !this.isActive;
779
795
  if (this.type === 'mode') {
@@ -806,17 +822,26 @@ const SearchcraftToggleButton = class {
806
822
  this.query = state.query || '';
807
823
  this.resultsCount = ((_c = (_b = (_a = state.searchResults) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.hits) === null || _c === void 0 ? void 0 : _c.length) || 0;
808
824
  });
825
+ this.autoSearchFormElement = document.querySelector('searchcraft-auto-search-form');
826
+ if (this.autoSearchFormElement) {
827
+ this.autoSearchFormElement.addEventListener('querySubmit', this.handleSearchRequest);
828
+ }
809
829
  }
810
830
  disconnectedCallback() {
811
831
  if (this.unsubscribe) {
812
832
  this.unsubscribe();
813
833
  }
834
+ if (this.autoSearchFormElement) {
835
+ this.autoSearchFormElement.addEventListener('querySubmit', this.handleSearchRequest);
836
+ }
814
837
  }
815
838
  render() {
816
839
  if (!this.query || this.resultsCount === 0) {
817
840
  return null;
818
841
  }
819
- return (index.h("button", { class: `toggle-wrapper ${this.isActive ? 'active' : ''}`, onClick: this.handleToggle, type: 'button' }, index.h("div", { class: `toggle-switch ${this.isActive ? 'active' : ''}` })));
842
+ const toggleContainerStyle = `toggleWrapper ${this.isActive ? 'active' : ''}`;
843
+ const toggleSwitchStyle = `toggleSwitch ${this.isActive ? 'active' : ''}`;
844
+ return (index.h("button", { class: index$1.classNames(toggleContainerStyle, 'searchcraft-toggle-button-container'), onClick: this.handleToggle, type: 'button' }, index.h("div", { class: index$1.classNames(toggleSwitchStyle, 'searchcraft-toggle-switch') })));
820
845
  }
821
846
  };
822
847
  SearchcraftToggleButton.style = SearchcraftToggleButtonStyle0;
@@ -837,8 +862,6 @@ exports.searchcraft_input_label = SearchcraftInputLabel;
837
862
  exports.searchcraft_results_info = SearchcraftResultsInfo;
838
863
  exports.searchcraft_search_icon_set = SearchcraftSearchIconSet;
839
864
  exports.searchcraft_slider = SearchcraftSlider;
840
- exports.searchcraft_spinner_dark = SearchcraftSpinnerDark;
841
- exports.searchcraft_spinner_light = SearchcraftSpinnerLight;
842
865
  exports.searchcraft_toggle_button = SearchcraftToggleButton;
843
866
 
844
- //# sourceMappingURL=searchcraft-auto-search-form_19.cjs.entry.js.map
867
+ //# sourceMappingURL=searchcraft-auto-search-form_17.cjs.entry.js.map