@searchcraft/javascript-sdk 0.2.6 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (267) hide show
  1. package/dist/components/searchcraft-check-icon.d.ts +11 -0
  2. package/dist/components/searchcraft-dash-icon.d.ts +11 -0
  3. package/dist/searchcraft-javascript-sdk/_commonjsHelpers-63cbe26c.js +34 -0
  4. package/dist/searchcraft-javascript-sdk/_commonjsHelpers-63cbe26c.js.map +1 -0
  5. package/dist/searchcraft-javascript-sdk/index-8211f330.js +3043 -0
  6. package/dist/searchcraft-javascript-sdk/index-8211f330.js.map +1 -0
  7. package/dist/{components/p-5cdc6210.js → searchcraft-javascript-sdk/index-d6567b9c.js} +10 -2
  8. package/dist/searchcraft-javascript-sdk/index-d6567b9c.js.map +1 -0
  9. package/dist/searchcraft-javascript-sdk/index.esm.js +14 -1
  10. package/dist/searchcraft-javascript-sdk/index.esm.js.map +1 -1
  11. package/dist/searchcraft-javascript-sdk/searchcraft-auto-search-form.entry.js +127 -0
  12. package/dist/searchcraft-javascript-sdk/searchcraft-auto-search-form.entry.js.map +1 -0
  13. package/dist/{esm → searchcraft-javascript-sdk}/searchcraft-base-search-form.entry.js +6 -5
  14. package/dist/searchcraft-javascript-sdk/searchcraft-base-search-form.entry.js.map +1 -0
  15. package/dist/searchcraft-javascript-sdk/searchcraft-base-search-result.entry.js +60 -0
  16. package/dist/searchcraft-javascript-sdk/searchcraft-base-search-result.entry.js.map +1 -0
  17. package/dist/{components/searchcraft-base-search-results.js → searchcraft-javascript-sdk/searchcraft-base-search-results.entry.js} +12 -56
  18. package/dist/searchcraft-javascript-sdk/searchcraft-base-search-results.entry.js.map +1 -0
  19. package/dist/{esm → searchcraft-javascript-sdk}/searchcraft-button-icon.entry.js +1 -1
  20. package/dist/searchcraft-javascript-sdk/searchcraft-button-icon.entry.js.map +1 -0
  21. package/dist/{esm → searchcraft-javascript-sdk}/searchcraft-button.entry.js +5 -5
  22. package/dist/searchcraft-javascript-sdk/searchcraft-button.entry.js.map +1 -0
  23. package/dist/searchcraft-javascript-sdk/searchcraft-check-icon.entry.js +14 -0
  24. package/dist/searchcraft-javascript-sdk/searchcraft-check-icon.entry.js.map +1 -0
  25. package/dist/{components/p-70722ab2.js → searchcraft-javascript-sdk/searchcraft-clear-icon-set.entry.js} +7 -24
  26. package/dist/searchcraft-javascript-sdk/searchcraft-clear-icon-set.entry.js.map +1 -0
  27. package/dist/searchcraft-javascript-sdk/searchcraft-clear-input-button.entry.js +30 -0
  28. package/dist/searchcraft-javascript-sdk/searchcraft-clear-input-button.entry.js.map +1 -0
  29. package/dist/searchcraft-javascript-sdk/searchcraft-dash-icon.entry.js +14 -0
  30. package/dist/searchcraft-javascript-sdk/searchcraft-dash-icon.entry.js.map +1 -0
  31. package/dist/searchcraft-javascript-sdk/searchcraft-error-message.entry.js +22 -0
  32. package/dist/searchcraft-javascript-sdk/searchcraft-error-message.entry.js.map +1 -0
  33. package/dist/searchcraft-javascript-sdk/searchcraft-filters-list.entry.js +120 -0
  34. package/dist/searchcraft-javascript-sdk/searchcraft-filters-list.entry.js.map +1 -0
  35. package/dist/{components/p-6237f03e.js → searchcraft-javascript-sdk/searchcraft-input-caption.entry.js} +10 -31
  36. package/dist/searchcraft-javascript-sdk/searchcraft-input-caption.entry.js.map +1 -0
  37. package/dist/searchcraft-javascript-sdk/searchcraft-input-icon.entry.js +25 -0
  38. package/dist/searchcraft-javascript-sdk/searchcraft-input-icon.entry.js.map +1 -0
  39. package/dist/searchcraft-javascript-sdk/searchcraft-input-label.entry.js +29 -0
  40. package/dist/searchcraft-javascript-sdk/searchcraft-input-label.entry.js.map +1 -0
  41. package/dist/{components/p-b5f97e04.js → searchcraft-javascript-sdk/searchcraft-input.entry.js} +12 -83
  42. package/dist/searchcraft-javascript-sdk/searchcraft-input.entry.js.map +1 -0
  43. package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js +48 -1
  44. package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js.map +1 -1
  45. package/dist/{collection/components/searchcraft-results-info/searchcraft-results-info.js → searchcraft-javascript-sdk/searchcraft-results-info.entry.js} +16 -26
  46. package/dist/searchcraft-javascript-sdk/searchcraft-results-info.entry.js.map +1 -0
  47. package/dist/{components/p-a3bd1bc8.js → searchcraft-javascript-sdk/searchcraft-search-icon-set.entry.js} +7 -26
  48. package/dist/searchcraft-javascript-sdk/searchcraft-search-icon-set.entry.js.map +1 -0
  49. package/dist/{components/searchcraft-slider.js → searchcraft-javascript-sdk/searchcraft-slider.entry.js} +11 -36
  50. package/dist/searchcraft-javascript-sdk/searchcraft-slider.entry.js.map +1 -0
  51. package/dist/searchcraft-javascript-sdk/searchcraft-spinner-dark.entry.js +17 -0
  52. package/dist/searchcraft-javascript-sdk/searchcraft-spinner-dark.entry.js.map +1 -0
  53. package/dist/searchcraft-javascript-sdk/searchcraft-spinner-light.entry.js +17 -0
  54. package/dist/searchcraft-javascript-sdk/searchcraft-spinner-light.entry.js.map +1 -0
  55. package/dist/{components/searchcraft-toggle-button.js → searchcraft-javascript-sdk/searchcraft-toggle-button.entry.js} +11 -33
  56. package/dist/searchcraft-javascript-sdk/searchcraft-toggle-button.entry.js.map +1 -0
  57. package/dist/searchcraft-javascript-sdk/shadow-css-423dab2c.js +334 -0
  58. package/dist/searchcraft-javascript-sdk/shadow-css-423dab2c.js.map +1 -0
  59. package/dist/searchcraft-javascript-sdk/store-08ee97f6.js +3073 -0
  60. package/dist/searchcraft-javascript-sdk/store-08ee97f6.js.map +1 -0
  61. package/dist/{components/p-2bda632c.js → searchcraft-javascript-sdk/utils-9f198636.js} +19 -8
  62. package/dist/searchcraft-javascript-sdk/utils-9f198636.js.map +1 -0
  63. package/dist/types/assets/searchcraft-check-icon.d.ts +3 -0
  64. package/dist/types/assets/searchcraft-dash-icon.d.ts +3 -0
  65. package/dist/types/components/searchcraft-filters-list/searchcraft-filters-list.d.ts +13 -5
  66. package/dist/types/components.d.ts +26 -0
  67. package/dist/types/utils/utils.d.ts +3 -0
  68. package/package.json +1 -1
  69. package/dist/cjs/app-globals-3a1e7e63.js +0 -7
  70. package/dist/cjs/app-globals-3a1e7e63.js.map +0 -1
  71. package/dist/cjs/index-5b0b9d4c.js +0 -84
  72. package/dist/cjs/index-5b0b9d4c.js.map +0 -1
  73. package/dist/cjs/index-6c5282a0.js +0 -1279
  74. package/dist/cjs/index-6c5282a0.js.map +0 -1
  75. package/dist/cjs/index.cjs.js +0 -17
  76. package/dist/cjs/index.cjs.js.map +0 -1
  77. package/dist/cjs/loader.cjs.js +0 -17
  78. package/dist/cjs/loader.cjs.js.map +0 -1
  79. package/dist/cjs/searchcraft-auto-search-form_17.cjs.entry.js +0 -809
  80. package/dist/cjs/searchcraft-auto-search-form_17.cjs.entry.js.map +0 -1
  81. package/dist/cjs/searchcraft-base-search-form.cjs.entry.js +0 -64
  82. package/dist/cjs/searchcraft-base-search-form.cjs.entry.js.map +0 -1
  83. package/dist/cjs/searchcraft-button-icon.cjs.entry.js +0 -18
  84. package/dist/cjs/searchcraft-button-icon.cjs.entry.js.map +0 -1
  85. package/dist/cjs/searchcraft-button.cjs.entry.js +0 -37
  86. package/dist/cjs/searchcraft-button.cjs.entry.js.map +0 -1
  87. package/dist/cjs/searchcraft-javascript-sdk.cjs.js +0 -27
  88. package/dist/cjs/searchcraft-javascript-sdk.cjs.js.map +0 -1
  89. package/dist/cjs/store-c44c58ab.js +0 -314
  90. package/dist/cjs/store-c44c58ab.js.map +0 -1
  91. package/dist/cjs/utils-2dc6115c.js +0 -84
  92. package/dist/cjs/utils-2dc6115c.js.map +0 -1
  93. package/dist/collection/assets/searchcraft-button-icons.js +0 -9
  94. package/dist/collection/assets/searchcraft-button-icons.js.map +0 -1
  95. package/dist/collection/assets/searchcraft-clear-icon-set.js +0 -45
  96. package/dist/collection/assets/searchcraft-clear-icon-set.js.map +0 -1
  97. package/dist/collection/assets/searchcraft-search-icon-set.js +0 -84
  98. package/dist/collection/assets/searchcraft-search-icon-set.js.map +0 -1
  99. package/dist/collection/collection-manifest.json +0 -31
  100. package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.js +0 -365
  101. package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.js.map +0 -1
  102. package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.module.css +0 -15
  103. package/dist/collection/components/searchcraft-base-search-form/searchcraft-base-search-form.js +0 -168
  104. package/dist/collection/components/searchcraft-base-search-form/searchcraft-base-search-form.js.map +0 -1
  105. package/dist/collection/components/searchcraft-base-search-form/searchcraft-base-search-form.module.css +0 -18
  106. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js +0 -329
  107. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js.map +0 -1
  108. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.module.css +0 -214
  109. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js +0 -270
  110. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js.map +0 -1
  111. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.module.css +0 -47
  112. package/dist/collection/components/searchcraft-button/searchcraft-button.js +0 -137
  113. package/dist/collection/components/searchcraft-button/searchcraft-button.js.map +0 -1
  114. package/dist/collection/components/searchcraft-button/searchcraft-button.module.css +0 -82
  115. package/dist/collection/components/searchcraft-clear-input-button/searchcraft-clear-input-button.js +0 -95
  116. package/dist/collection/components/searchcraft-clear-input-button/searchcraft-clear-input-button.js.map +0 -1
  117. package/dist/collection/components/searchcraft-clear-input-button/searchcraft-clear-input-button.module.css +0 -33
  118. package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js +0 -64
  119. package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js.map +0 -1
  120. package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.module.css +0 -21
  121. package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.js +0 -170
  122. package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.js.map +0 -1
  123. package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.module.css +0 -70
  124. package/dist/collection/components/searchcraft-input/searchcraft-input.js +0 -352
  125. package/dist/collection/components/searchcraft-input/searchcraft-input.js.map +0 -1
  126. package/dist/collection/components/searchcraft-input/searchcraft-input.module.css +0 -241
  127. package/dist/collection/components/searchcraft-input-caption/searchcraft-input-caption.js +0 -122
  128. package/dist/collection/components/searchcraft-input-caption/searchcraft-input-caption.js.map +0 -1
  129. package/dist/collection/components/searchcraft-input-caption/searchcraft-input-caption.module.css +0 -79
  130. package/dist/collection/components/searchcraft-input-icon/searchcraft-input-icon.js +0 -109
  131. package/dist/collection/components/searchcraft-input-icon/searchcraft-input-icon.js.map +0 -1
  132. package/dist/collection/components/searchcraft-input-icon/searchcraft-input-icon.module.css +0 -17
  133. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js +0 -76
  134. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js.map +0 -1
  135. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.module.css +0 -21
  136. package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.js.map +0 -1
  137. package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.module.css +0 -15
  138. package/dist/collection/components/searchcraft-slider/searchcraft-slider.js +0 -128
  139. package/dist/collection/components/searchcraft-slider/searchcraft-slider.js.map +0 -1
  140. package/dist/collection/components/searchcraft-slider/searchcraft-slider.module.css +0 -68
  141. package/dist/collection/components/searchcraft-spinner-dark/searchcraft-spinner-dark.js +0 -19
  142. package/dist/collection/components/searchcraft-spinner-dark/searchcraft-spinner-dark.js.map +0 -1
  143. package/dist/collection/components/searchcraft-spinner-dark/searchcraft-spinner-dark.module.css +0 -35
  144. package/dist/collection/components/searchcraft-spinner-light/searchcraft-spinner-light.js +0 -19
  145. package/dist/collection/components/searchcraft-spinner-light/searchcraft-spinner-light.js.map +0 -1
  146. package/dist/collection/components/searchcraft-spinner-light/searchcraft-spinner-light.module.css +0 -26
  147. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js +0 -92
  148. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js.map +0 -1
  149. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.module.css +0 -31
  150. package/dist/collection/index.js +0 -12
  151. package/dist/collection/index.js.map +0 -1
  152. package/dist/collection/provider/store.js +0 -96
  153. package/dist/collection/provider/store.js.map +0 -1
  154. package/dist/collection/utils/utils.js +0 -74
  155. package/dist/collection/utils/utils.js.map +0 -1
  156. package/dist/components/index.js +0 -58
  157. package/dist/components/index.js.map +0 -1
  158. package/dist/components/p-023371c8.js +0 -89
  159. package/dist/components/p-023371c8.js.map +0 -1
  160. package/dist/components/p-157e5b1a.js +0 -310
  161. package/dist/components/p-157e5b1a.js.map +0 -1
  162. package/dist/components/p-1c377190.js +0 -67
  163. package/dist/components/p-1c377190.js.map +0 -1
  164. package/dist/components/p-25f18f2e.js +0 -33
  165. package/dist/components/p-25f18f2e.js.map +0 -1
  166. package/dist/components/p-2bda632c.js.map +0 -1
  167. package/dist/components/p-3fece4e2.js +0 -33
  168. package/dist/components/p-3fece4e2.js.map +0 -1
  169. package/dist/components/p-576f0d2b.js +0 -61
  170. package/dist/components/p-576f0d2b.js.map +0 -1
  171. package/dist/components/p-5cdc6210.js.map +0 -1
  172. package/dist/components/p-6237f03e.js.map +0 -1
  173. package/dist/components/p-70722ab2.js.map +0 -1
  174. package/dist/components/p-7498e493.js +0 -1113
  175. package/dist/components/p-7498e493.js.map +0 -1
  176. package/dist/components/p-848301b7.js +0 -40
  177. package/dist/components/p-848301b7.js.map +0 -1
  178. package/dist/components/p-8c38185e.js +0 -53
  179. package/dist/components/p-8c38185e.js.map +0 -1
  180. package/dist/components/p-a3bd1bc8.js.map +0 -1
  181. package/dist/components/p-ae84b899.js +0 -48
  182. package/dist/components/p-ae84b899.js.map +0 -1
  183. package/dist/components/p-b5f97e04.js.map +0 -1
  184. package/dist/components/searchcraft-auto-search-form.js +0 -207
  185. package/dist/components/searchcraft-auto-search-form.js.map +0 -1
  186. package/dist/components/searchcraft-base-search-form.js +0 -152
  187. package/dist/components/searchcraft-base-search-form.js.map +0 -1
  188. package/dist/components/searchcraft-base-search-result.js +0 -8
  189. package/dist/components/searchcraft-base-search-result.js.map +0 -1
  190. package/dist/components/searchcraft-base-search-results.js.map +0 -1
  191. package/dist/components/searchcraft-button-icon.js +0 -32
  192. package/dist/components/searchcraft-button-icon.js.map +0 -1
  193. package/dist/components/searchcraft-button.js +0 -8
  194. package/dist/components/searchcraft-button.js.map +0 -1
  195. package/dist/components/searchcraft-clear-icon-set.js +0 -8
  196. package/dist/components/searchcraft-clear-icon-set.js.map +0 -1
  197. package/dist/components/searchcraft-clear-input-button.js +0 -8
  198. package/dist/components/searchcraft-clear-input-button.js.map +0 -1
  199. package/dist/components/searchcraft-error-message.js +0 -8
  200. package/dist/components/searchcraft-error-message.js.map +0 -1
  201. package/dist/components/searchcraft-filters-list.js +0 -141
  202. package/dist/components/searchcraft-filters-list.js.map +0 -1
  203. package/dist/components/searchcraft-input-caption.js +0 -8
  204. package/dist/components/searchcraft-input-caption.js.map +0 -1
  205. package/dist/components/searchcraft-input-icon.js +0 -8
  206. package/dist/components/searchcraft-input-icon.js.map +0 -1
  207. package/dist/components/searchcraft-input-label.js +0 -8
  208. package/dist/components/searchcraft-input-label.js.map +0 -1
  209. package/dist/components/searchcraft-input.js +0 -8
  210. package/dist/components/searchcraft-input.js.map +0 -1
  211. package/dist/components/searchcraft-results-info.js +0 -63
  212. package/dist/components/searchcraft-results-info.js.map +0 -1
  213. package/dist/components/searchcraft-search-icon-set.js +0 -8
  214. package/dist/components/searchcraft-search-icon-set.js.map +0 -1
  215. package/dist/components/searchcraft-slider.js.map +0 -1
  216. package/dist/components/searchcraft-spinner-dark.js +0 -8
  217. package/dist/components/searchcraft-spinner-dark.js.map +0 -1
  218. package/dist/components/searchcraft-spinner-light.js +0 -8
  219. package/dist/components/searchcraft-spinner-light.js.map +0 -1
  220. package/dist/components/searchcraft-toggle-button.js.map +0 -1
  221. package/dist/esm/index-0ac5bb53.js +0 -1251
  222. package/dist/esm/index-0ac5bb53.js.map +0 -1
  223. package/dist/esm/index-72ac5051.js +0 -82
  224. package/dist/esm/index-72ac5051.js.map +0 -1
  225. package/dist/esm/index.js +0 -4
  226. package/dist/esm/index.js.map +0 -1
  227. package/dist/esm/loader.js +0 -13
  228. package/dist/esm/loader.js.map +0 -1
  229. package/dist/esm/searchcraft-auto-search-form_17.entry.js +0 -789
  230. package/dist/esm/searchcraft-auto-search-form_17.entry.js.map +0 -1
  231. package/dist/esm/searchcraft-base-search-form.entry.js.map +0 -1
  232. package/dist/esm/searchcraft-button-icon.entry.js.map +0 -1
  233. package/dist/esm/searchcraft-button.entry.js.map +0 -1
  234. package/dist/esm/searchcraft-javascript-sdk.js +0 -22
  235. package/dist/esm/searchcraft-javascript-sdk.js.map +0 -1
  236. package/dist/esm/store-9e0b0710.js +0 -310
  237. package/dist/esm/store-9e0b0710.js.map +0 -1
  238. package/dist/esm/utils-a3373179.js +0 -77
  239. package/dist/esm/utils-a3373179.js.map +0 -1
  240. package/dist/index.cjs.js +0 -1
  241. package/dist/index.js +0 -1
  242. package/dist/loader/cdn.js +0 -1
  243. package/dist/loader/index.cjs.js +0 -1
  244. package/dist/loader/index.d.ts +0 -24
  245. package/dist/loader/index.es2017.js +0 -1
  246. package/dist/loader/index.js +0 -2
  247. package/dist/loader/package.json +0 -11
  248. package/dist/searchcraft-javascript-sdk/p-0880cfbb.js +0 -3
  249. package/dist/searchcraft-javascript-sdk/p-0880cfbb.js.map +0 -1
  250. package/dist/searchcraft-javascript-sdk/p-2bda632c.js +0 -2
  251. package/dist/searchcraft-javascript-sdk/p-2bda632c.js.map +0 -1
  252. package/dist/searchcraft-javascript-sdk/p-5cdc6210.js +0 -7
  253. package/dist/searchcraft-javascript-sdk/p-5cdc6210.js.map +0 -1
  254. package/dist/searchcraft-javascript-sdk/p-5ec960bd.entry.js +0 -2
  255. package/dist/searchcraft-javascript-sdk/p-5ec960bd.entry.js.map +0 -1
  256. package/dist/searchcraft-javascript-sdk/p-63b3b565.entry.js +0 -2
  257. package/dist/searchcraft-javascript-sdk/p-63b3b565.entry.js.map +0 -1
  258. package/dist/searchcraft-javascript-sdk/p-901fee50.js +0 -11
  259. package/dist/searchcraft-javascript-sdk/p-901fee50.js.map +0 -1
  260. package/dist/searchcraft-javascript-sdk/p-c2c4f6b7.entry.js +0 -2
  261. package/dist/searchcraft-javascript-sdk/p-c2c4f6b7.entry.js.map +0 -1
  262. package/dist/searchcraft-javascript-sdk/p-cc454542.entry.js +0 -2
  263. package/dist/searchcraft-javascript-sdk/p-cc454542.entry.js.map +0 -1
  264. package/dist/searchcraft-javascript-sdk/p-e1255160.js +0 -2
  265. package/dist/searchcraft-javascript-sdk/p-e1255160.js.map +0 -1
  266. /package/dist/{esm → searchcraft-javascript-sdk}/app-globals-0f993ce5.js +0 -0
  267. /package/dist/{esm → searchcraft-javascript-sdk}/app-globals-0f993ce5.js.map +0 -0
@@ -1,789 +0,0 @@
1
- import { r as registerInstance, c as createEvent, h, F as Fragment } from './index-0ac5bb53.js';
2
- import { u as useSearchcraftStore, g } from './store-9e0b0710.js';
3
- import { p as parseCustomStyles, a as parseSearchKeys, s as serializeStyles, e as extractDynamicProperties, g as getFormattedTimeFromNow, f as flattenFacets } from './utils-a3373179.js';
4
- import { c as classNames } from './index-72ac5051.js';
5
-
6
- 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%}";
7
- const SearchcraftAutoSearchFormStyle0 = searchcraftAutoSearchFormModuleCss;
8
-
9
- const SearchcraftAutoSearchForm = class {
10
- constructor(hostRef) {
11
- registerInstance(this, hostRef);
12
- this.inputClearedOrNoResults = createEvent(this, "inputClearedOrNoResults", 7);
13
- this.querySubmit = createEvent(this, "querySubmit", 7);
14
- this.debounceTimeout = null;
15
- this.debounceDelay = 0;
16
- this.searchStore = useSearchcraftStore.getState();
17
- this.handleInputChange = (event) => {
18
- this.query = event.detail;
19
- this.searchStore.setQuery(this.query);
20
- this.querySubmit.emit(this.query);
21
- };
22
- this.handleInputKeyUp = (event) => {
23
- const target = event.detail;
24
- this.query = target;
25
- this.searchStore.setQuery(this.query);
26
- this.querySubmit.emit(this.query);
27
- if (this.debounceTimeout) {
28
- clearTimeout(this.debounceTimeout);
29
- }
30
- this.debounceTimeout = setTimeout(() => {
31
- this.query.trim() !== '' && this.runSearch();
32
- }, this.debounceDelay);
33
- };
34
- this.handleClearInput = () => {
35
- this.query = '';
36
- this.searchStore.setQuery('');
37
- if (typeof this.clearInput === 'function') {
38
- this.clearInput();
39
- }
40
- if (this.debounceTimeout) {
41
- clearTimeout(this.debounceTimeout);
42
- }
43
- this.error = false;
44
- this.inputClearedOrNoResults.emit();
45
- };
46
- this.runSearch = async () => {
47
- if (this.query.trim() === '') {
48
- this.error = true;
49
- this.inputClearedOrNoResults.emit();
50
- }
51
- else {
52
- this.error = false;
53
- this.searchStore.setQuery(this.query);
54
- try {
55
- await this.searchStore.search();
56
- }
57
- catch (error) {
58
- this.error = true;
59
- this.inputClearedOrNoResults.emit();
60
- }
61
- }
62
- };
63
- this.handleFormSubmit = async (event) => {
64
- event.preventDefault();
65
- await this.runSearch();
66
- };
67
- this.autoSearchFormClass = '';
68
- this.clearInput = () => { };
69
- this.config = {
70
- apiKey: '',
71
- endpointURL: '',
72
- index: [],
73
- };
74
- this.customStylesForInput = {};
75
- this.inputCaptionValue = '';
76
- this.inputIconHeight = 20;
77
- this.inputIconWidth = 20;
78
- this.labelForInput = '';
79
- this.placeholderValue = 'Search here';
80
- this.rightToLeftOrientation = false;
81
- this.searchContainerClass = '';
82
- this.error = false;
83
- this.isRequesting = false;
84
- this.query = '';
85
- this.searchResults = null;
86
- }
87
- componentDidLoad() {
88
- const searchcraft = new g(this.config);
89
- this.searchStore.initialize(searchcraft, true);
90
- this.unsubscribe = useSearchcraftStore.subscribe((state) => {
91
- this.isRequesting = state.isRequesting;
92
- this.searchResults = Object.assign({}, state.searchResults);
93
- });
94
- }
95
- disconnectedCallback() {
96
- if (this.unsubscribe) {
97
- this.unsubscribe();
98
- }
99
- }
100
- render() {
101
- var _a, _b, _c;
102
- const formClass = this.rightToLeftOrientation ? 'formRTL' : 'formLTR';
103
- const parsedCustomStyles = parseCustomStyles(this.customStylesForInput);
104
- if (this.query.length > 0 && ((_c = (_b = (_a = this.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) {
105
- this.inputClearedOrNoResults.emit();
106
- }
107
- return (h("form", { key: '1ecc90be4b39c7fbfff4a3c89c319343f6478a1e', class: `${formClass}`, onSubmit: this.handleFormSubmit }, h("searchcraft-input-label", { key: '82ee01912536de6a11e20f7df533856a41ebc343', label: this.labelForInput }), h("searchcraft-input", { key: 'ad00322933a20db2865cd79241056f7b0ee84a15', 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 && (h("searchcraft-error-message", { key: '588a134a1130d3c4e4fc921b09450268057b8217', errorMessage: 'Please enter a search query.' }))));
108
- }
109
- };
110
- SearchcraftAutoSearchForm.style = SearchcraftAutoSearchFormStyle0;
111
-
112
- 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;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;color:#FFF}.subheadingLight{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-bottom:4px;margin-top:0px;color:#737373}.subheadingDark{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-bottom:4px;margin-top:0px;color:#BFBFBF}.primaryContentLight{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#404040}.primaryContentDark{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#E6E6E6}.secondaryContentLight{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;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;color:#E6E6E6}.tertiaryContentLight{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#404040}.tertiaryContentDark{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#E6E6E6}";
113
- const SearchcraftBaseSearchResultStyle0 = searchcraftBaseSearchResultModuleCss;
114
-
115
- const SearchcraftBaseSearchResult = class {
116
- constructor(hostRef) {
117
- registerInstance(this, hostRef);
118
- this.buttonCallback = createEvent(this, "buttonCallback", 7);
119
- this.keyDownCallback = createEvent(this, "keyDownCallback", 7);
120
- this.resultCallback = createEvent(this, "resultCallback", 7);
121
- this.buttonCallback = () => { }; // Callback for button click
122
- this.keyDownCallback = () => { }; // Callback for key down event
123
- this.resultCallback = () => { }; // Callback for result container click
124
- this.handleButtonClick = () => {
125
- this.buttonCallback();
126
- };
127
- this.handleContainerClick = () => {
128
- if (this.isInteractive) {
129
- this.resultCallback();
130
- }
131
- };
132
- this.buttonText = '';
133
- this.customStyles = '{}';
134
- this.headingText = '';
135
- this.imageDescription = '';
136
- this.imageSource = '';
137
- this.isInteractive = false;
138
- this.primaryContent = '';
139
- this.secondaryContent = '';
140
- this.subheadingText = '';
141
- this.tertiaryContent = '';
142
- this.themeMode = 'light';
143
- this.placeImageRight = false;
144
- }
145
- parseStyles() {
146
- try {
147
- return JSON.parse(this.customStyles);
148
- }
149
- catch (error) {
150
- console.error('Error parsing custom styles:', error);
151
- return {};
152
- }
153
- }
154
- render() {
155
- const isLightTheme = this.themeMode === 'light';
156
- const styles = this.parseStyles();
157
- const imageContainer = this.imageSource && (h("div", { key: '1dee969549e02c262a9fdf050438630961d1954e', class: 'imageContainer' }, h("img", { key: '2a08fd81d563ad2f18e91d22449afefb772244c8', alt: this.imageDescription, class: isLightTheme ? 'imageLight' : 'imageDark', src: this.imageSource, style: styles.image || {} })));
158
- const contentContainer = (h("div", { key: '93f350bba36c296377dc09824d86631e4f731e78', class: 'contentContainer' }, h("h2", { key: 'd630e930eba15b86c84f7e62f73d1d3539c3650d', class: isLightTheme ? 'headingLight' : 'headingDark', style: styles.heading || {} }, this.headingText), h("h3", { key: '0f8639094f2f64695d887b2de6fc1d777564cbb2', class: isLightTheme ? 'subheadingLight' : 'subheadingDark', style: styles.subheading || {} }, this.subheadingText), h("p", { key: 'e8562ca0a438f9ff0848920a5bae1e208eb3ae72', class: isLightTheme ? 'primaryContentLight' : 'primaryContentDark', style: styles.primaryContent || {} }, this.primaryContent), h("div", { key: 'dd97fb5946a1a50ccba31ae97c8b5b6e0cac91d9', class: 'secondaryContentContainer' }, h("p", { key: '9c6d705bfbd4eccb24f5afcbaad9ec92ca6fda9f', class: isLightTheme ? 'secondaryContentLight' : 'secondaryContentDark', style: styles.secondaryContent || {} }, this.secondaryContent), h("p", { key: '7147e47a9ed408066439431329cda75495567227', class: isLightTheme ? 'tertiaryContentLight' : 'tertiaryContentDark', style: styles.tertiaryContent || {} }, this.tertiaryContent)), this.buttonText && (h("button", { key: 'e620382ea1fe2f0e60645330ec087f767ff535a0', onClick: this.handleButtonClick, style: styles.button || {}, type: 'button' }, this.buttonText))));
159
- return (h("div", { key: 'a104499c8adaa7d57743aaea20ee4af7caf6bdb9', class: this.isInteractive
160
- ? isLightTheme
161
- ? 'interactiveResultContainerLight'
162
- : 'interactiveResultContainerDark'
163
- : 'resultContainer', onKeyDown: this.keyDownCallback, onClick: this.handleContainerClick, style: styles.container || {}, tabindex: '0' }, this.placeImageRight ? (h(Fragment, null, contentContainer, imageContainer)) : (h(Fragment, null, imageContainer, contentContainer))));
164
- }
165
- };
166
- SearchcraftBaseSearchResult.style = SearchcraftBaseSearchResultStyle0;
167
-
168
- const searchcraftBaseSearchResultsModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.resultsContainer{display:flex;flex-direction:column;justify-content:center;margin:16px 0}.resultsContainer>p{align-self:center}.resultsContainer>div{margin-bottom:20px}.resultsContainer>div img{height:300px;width:200px}.adSection{align-items:center;background-color:#F1F1F1;border:1px solid #DCDDDE;border-radius:16px;display:flex;flex-direction:column;font-size:16px;justify-content:center;margin:auto;min-height:150px;text-align:center;width:100%}.adSection p{margin-top:5px}.emptyState{text-align:center;width:100%}.errorMessageContainer{text-align:center}";
169
- const SearchcraftBaseSearchResultsStyle0 = searchcraftBaseSearchResultsModuleCss;
170
-
171
- const SearchcraftBaseSearchResults = class {
172
- constructor(hostRef) {
173
- registerInstance(this, hostRef);
174
- this.adInterval = 4;
175
- this.customStylesForResults = {};
176
- this.documentAttributesForDisplay = '';
177
- this.fallbackElement = null;
178
- this.formatTime = true;
179
- this.placeAdAtEnd = false;
180
- this.placeAdAtStart = true;
181
- this.placeResultImageRight = false;
182
- this.hasSearched = false;
183
- this.query = '';
184
- this.searchResults = null;
185
- }
186
- componentDidLoad() {
187
- if (!this.documentAttributesForDisplay ||
188
- this.documentAttributesForDisplay.length === 0) {
189
- console.warn('No document attributes provided; using empty keys array.');
190
- this.documentAttributesForDisplay = '';
191
- }
192
- this.unsubscribe = useSearchcraftStore.subscribe((state) => {
193
- if (state.query.length > 0) {
194
- this.hasSearched = true;
195
- }
196
- else {
197
- this.hasSearched = false;
198
- }
199
- this.searchResults = Object.assign({}, state.searchResults);
200
- this.query = state.query;
201
- });
202
- const { searchResults, query } = useSearchcraftStore.getState();
203
- this.searchResults = searchResults;
204
- this.query = query;
205
- }
206
- disconnectedCallback() {
207
- if (this.unsubscribe) {
208
- this.unsubscribe();
209
- }
210
- }
211
- render() {
212
- var _a, _b, _c, _d, _e, _f, _g;
213
- if (!this.hasSearched) {
214
- return (h("div", { class: 'emptyState' }, h("slot", { name: 'empty-search' })));
215
- }
216
- if (!((_a = this.searchResults) === null || _a === void 0 ? void 0 : _a.data)) {
217
- console.warn('No search results data available');
218
- return h("div", { class: 'emptyState' }, "No results to display.");
219
- }
220
- const parsedSearchKeys = parseSearchKeys(this.documentAttributesForDisplay);
221
- const serializedStyles = typeof this.customStylesForResults === 'string'
222
- ? this.customStylesForResults
223
- : serializeStyles(this.customStylesForResults);
224
- const resultsComponents = (_d = (_c = (_b = this.searchResults) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.hits) === null || _d === void 0 ? void 0 : _d.map((document, index) => {
225
- const { doc: result } = document;
226
- const dynamicProperties = extractDynamicProperties(result, parsedSearchKeys);
227
- if (this.formatTime) {
228
- for (const key of parsedSearchKeys) {
229
- if (dynamicProperties[key]) {
230
- const value = dynamicProperties[key];
231
- // Check if the value is a valid ISO timestamp
232
- if (typeof value === 'string' &&
233
- !Number.isNaN(Date.parse(value))) {
234
- dynamicProperties[key] = getFormattedTimeFromNow(value);
235
- }
236
- }
237
- }
238
- }
239
- return (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}`, "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]] }));
240
- });
241
- const finalComponents = [];
242
- if (this.placeAdAtStart) {
243
- finalComponents.push(h("div", { key: 'ad-section-start', class: 'adSection' }, h("span", null, "##"), h("p", null, " Ad Impressions")));
244
- }
245
- if (this.adInterval > 0) {
246
- resultsComponents.forEach((component, index) => {
247
- finalComponents.push(component);
248
- if ((index + 1) % this.adInterval === 0) {
249
- finalComponents.push(h("div", { key: `ad-section-${index + 1}`, class: 'adSection' }, h("span", null, "##"), h("p", null, " Ad Impressions")));
250
- }
251
- });
252
- }
253
- else {
254
- finalComponents.push(...resultsComponents);
255
- }
256
- if (this.placeAdAtEnd) {
257
- finalComponents.push(h("div", { key: 'ad-section-end', class: 'adSection' }, h("span", null, "##"), h("p", null, " Ad Impressions")));
258
- }
259
- return (h("div", { class: 'resultsContainer' }, finalComponents, this.query.length > 0 &&
260
- ((_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 && (h("div", { class: 'errorMessageContainer' }, h("searchcraft-error-message", { "error-message": `No search results found for "${this.query}" query` })))));
261
- }
262
- };
263
- SearchcraftBaseSearchResults.style = SearchcraftBaseSearchResultsStyle0;
264
-
265
- const SearchcraftClearIconSet = class {
266
- constructor(hostRef) {
267
- registerInstance(this, hostRef);
268
- this.type = 'clear-light';
269
- }
270
- render() {
271
- switch (this.type) {
272
- case 'clear-light':
273
- return (h("svg", { width: '22', height: '22', viewBox: '0 0 22 22', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'icon-title' }, h("title", { id: 'icon-title' }, "Searchcraft Clear Input Icon Light"), h("path", { d: 'M14 8L8 14M8 8L14 14M21 11C21 16.5228 16.5228 21 11 21C5.47715 21 1 16.5228 1 11C1 5.47715 5.47715 1 11 1C16.5228 1 21 5.47715 21 11Z', stroke: 'black', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' })));
274
- case 'clear-dark':
275
- return (h("svg", { width: '22', height: '22', viewBox: '0 0 22 22', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'icon-title' }, h("title", { id: 'icon-title' }, "Searchcraft Clear Input Icon Dark"), h("path", { d: 'M14 8L8 14M8 8L14 14M21 11C21 16.5228 16.5228 21 11 21C5.47715 21 1 16.5228 1 11C1 5.47715 5.47715 1 11 1C16.5228 1 21 5.47715 21 11Z', stroke: 'white', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' })));
276
- case 'arrow-light':
277
- return (h("svg", { width: '20', height: '21', viewBox: '0 0 20 21', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'icon-title' }, h("title", { id: 'icon-title' }, "Searchcraft Arrow Right Icon Light"), h("path", { d: 'M7.5 15.0444L12.5 10.0444L7.5 5.04443', stroke: '#737373', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' })));
278
- case 'arrow-dark':
279
- return (h("svg", { width: '8', height: '12', viewBox: '0 0 8 12', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'icon-title' }, h("title", { id: 'icon-title' }, "Searchcraft Arrow Right Icon Dark"), h("path", { d: 'M1.5 11L6.5 6L1.5 1', stroke: '#BFBFBF', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' })));
280
- default:
281
- return null;
282
- }
283
- }
284
- };
285
-
286
- 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}";
287
- const SearchcraftClearInputButtonStyle0 = searchcraftClearInputButtonModuleCss;
288
-
289
- const SearchcraftClearInputButton = class {
290
- constructor(hostRef) {
291
- registerInstance(this, hostRef);
292
- this.clearInput = createEvent(this, "clearInput", 7);
293
- this.handleClearClick = (event) => {
294
- event.preventDefault();
295
- this.clearInput.emit();
296
- };
297
- this.isRequesting = false;
298
- this.rightToLeftOrientation = false;
299
- this.theme = 'light';
300
- }
301
- isLightTheme() {
302
- return this.theme === 'light';
303
- }
304
- render() {
305
- return this.rightToLeftOrientation ? (h("button", { class: classNames('inputClearButtonRTL', '.sc-clear-input-button-rtl'), onClick: this.handleClearClick, type: 'button' }, this.isRequesting ? (this.isLightTheme ? (h("searchcraft-spinner-light", null)) : (h("searchcraft-spinner-dark", null))) : this.isLightTheme ? (h("searchcraft-clear-icon-set", { type: 'clear-light' })) : (h("searchcraft-clear-icon-set", { type: 'clear-dark' })))) : (h("button", { class: classNames('inputClearButtonLTR', '.sc-clear-input-button-ltr'), onClick: this.handleClearClick, type: 'button' }, this.isRequesting ? (this.isLightTheme ? (h("searchcraft-spinner-light", null)) : (h("searchcraft-spinner-dark", null))) : this.isLightTheme ? (h("searchcraft-clear-icon-set", { type: 'clear-light' })) : (h("searchcraft-clear-icon-set", { type: 'clear-dark' }))));
306
- }
307
- };
308
- SearchcraftClearInputButton.style = SearchcraftClearInputButtonStyle0;
309
-
310
- const searchcraftErrorMessageModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.errorMessageLight{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#990000}.errorMessageDark{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#FFB3B3}";
311
- const SearchcraftErrorMessageStyle0 = searchcraftErrorMessageModuleCss;
312
-
313
- const SearchcraftErrorMessage = class {
314
- constructor(hostRef) {
315
- registerInstance(this, hostRef);
316
- this.errorMessage = undefined;
317
- this.theme = 'light';
318
- }
319
- render() {
320
- const errorMessageStyle = this.theme === 'light' ? 'errorMessageLight' : 'errorMessageDark';
321
- return (h("p", { key: '544903d700810ed5d6efdefedab646cafed2376d', class: classNames(errorMessageStyle) }, this.errorMessage || 'Search term is required.'));
322
- }
323
- };
324
- SearchcraftErrorMessage.style = SearchcraftErrorMessageStyle0;
325
-
326
- const searchcraftFiltersListModuleCss = "@charset \"UTF-8\";.filtersList{width:100%}.checkboxLabel{align-items:center;color:#292929;display:flex;font-family:\"Source Sans Pro\";font-size:14px;font-weight:600;gap:14px}.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}.checkboxLabel input[type=checkbox]:checked::before{color:#fff;content:\"✔\"}.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}.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;width:24px}.childCheckboxLabel input[type=checkbox]:checked{background-color:#000}.childCheckboxLabel input[type=checkbox]:checked::before{color:#fff;content:\"✔\"}";
327
- const SearchcraftFiltersListStyle0 = searchcraftFiltersListModuleCss;
328
-
329
- const SearchcraftFiltersList = class {
330
- constructor(hostRef) {
331
- registerInstance(this, hostRef);
332
- this.filtersUpdated = createEvent(this, "filtersUpdated", 7);
333
- this.searchStore = useSearchcraftStore.getState();
334
- this.handleFilterChange = (value, checked) => {
335
- if (checked) {
336
- this.selectedFilters.add(value);
337
- }
338
- else {
339
- this.selectedFilters.delete(value);
340
- }
341
- const deduplicatedFilters = this.deduplicatePaths(Array.from(this.selectedFilters));
342
- this.filtersUpdated.emit(deduplicatedFilters);
343
- this.searchStore.setSelectedFilters(deduplicatedFilters);
344
- this.searchStore.search();
345
- };
346
- this.filters = [];
347
- this.dynamicFilters = [];
348
- this.isRequesting = false;
349
- this.query = '';
350
- this.resultsCount = 0;
351
- this.selectedFilters = new Set();
352
- }
353
- connectedCallback() {
354
- var _a;
355
- const state = this.searchStore; // Fetch the initial state
356
- // Initial population of facets if available
357
- if ((_a = state.searchResults) === null || _a === void 0 ? void 0 : _a.data.facets) {
358
- this.populateFiltersFromFacets(state.searchResults.data.facets);
359
- }
360
- this.unsubscribe = useSearchcraftStore.subscribe((state) => {
361
- var _a, _b, _c, _d;
362
- if (!state.query || state.query.trim().length === 0) {
363
- if (this.selectedFilters.size > 0) {
364
- this.selectedFilters.clear();
365
- this.filtersUpdated.emit([]);
366
- if (this.searchStore.selectedFilters.length > 0) {
367
- this.searchStore.setSelectedFilters([]);
368
- }
369
- }
370
- }
371
- this.query = state.query || '';
372
- this.isRequesting = state.isRequesting;
373
- 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;
374
- // Populate filters when facets are updated
375
- if ((_d = state.searchResults) === null || _d === void 0 ? void 0 : _d.data.facets) {
376
- this.populateFiltersFromFacets(state.searchResults.data.facets);
377
- }
378
- });
379
- }
380
- disconnectedCallback() {
381
- if (this.unsubscribe) {
382
- this.unsubscribe();
383
- }
384
- }
385
- populateFiltersFromFacets(facets) {
386
- var _a;
387
- const newFilters = flattenFacets(((_a = facets[0]) === null || _a === void 0 ? void 0 : _a.section) || []);
388
- const filtersMap = new Map();
389
- newFilters.forEach((filter) => {
390
- const key = filter.value.split('/').pop() || '';
391
- const existingFilter = filtersMap.get(key);
392
- if (!existingFilter ||
393
- filter.value.length < existingFilter.value.length) {
394
- filtersMap.set(key, filter);
395
- }
396
- });
397
- this.dynamicFilters = Array.from(filtersMap.values());
398
- }
399
- deduplicatePaths(filters) {
400
- const pathMap = new Map();
401
- filters.forEach((path) => {
402
- const key = path.split('/').pop() || '';
403
- const existingPath = pathMap.get(key);
404
- if (!existingPath || path.length < existingPath.length) {
405
- pathMap.set(key, path);
406
- }
407
- });
408
- return Array.from(pathMap.values());
409
- }
410
- formatLabel(label) {
411
- return label
412
- .replace(/-/g, ' ')
413
- .split(' ')
414
- .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
415
- .join(' ');
416
- }
417
- render() {
418
- if (!this.query || this.resultsCount === 0) {
419
- return null;
420
- }
421
- const filtersToRender = this.dynamicFilters.filter((filter) => !filter.value.includes('/', filter.value.indexOf('/') + 1));
422
- return (h("div", { class: 'filtersList' }, filtersToRender.map((filter) => {
423
- const isChecked = this.selectedFilters.has(filter.value);
424
- const children = this.dynamicFilters.filter((child) => child.value.startsWith(`${filter.value}/`) &&
425
- child.value !== filter.value);
426
- return (h("div", { key: filter.value }, h("label", { class: 'checkboxLabel' }, h("input", { class: 'filterCheckbox', checked: isChecked, onChange: (event) => this.handleFilterChange(filter.value, event.target.checked), type: 'checkbox' }), this.formatLabel(filter.label)), children.map((child) => {
427
- const isChildChecked = this.selectedFilters.has(child.value);
428
- return (h("label", { class: 'childCheckboxLabel', key: child.value, style: { marginLeft: '20px' } }, h("input", { class: 'childFilterCheckbox', checked: isChildChecked, onChange: (event) => this.handleFilterChange(child.value, event.target.checked), type: 'checkbox' }), this.formatLabel(child.label.split('/').pop() || '')));
429
- })));
430
- })));
431
- }
432
- };
433
- SearchcraftFiltersList.style = SearchcraftFiltersListStyle0;
434
-
435
- 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%}";
436
- const SearchcraftInputStyle0 = searchcraftInputModuleCss;
437
-
438
- const SearchcraftInput = class {
439
- constructor(hostRef) {
440
- registerInstance(this, hostRef);
441
- this.clearInput = createEvent(this, "clearInput", 7);
442
- this.searchInputChange = createEvent(this, "searchInputChange", 7);
443
- this.inputKeyUp = createEvent(this, "inputKeyUp", 7);
444
- this.customStyles = {};
445
- this.error = false;
446
- this.formClassName = '';
447
- this.inputCaptionClassName = '';
448
- this.inputCaptionValue = '';
449
- this.inputClassName = '';
450
- this.inputIconHeight = 20;
451
- this.inputIconWidth = 20;
452
- this.isRequesting = false;
453
- this.placeholderValue = 'Enter Search';
454
- this.rightToLeftOrientation = false;
455
- this.query = '';
456
- this.theme = 'light';
457
- }
458
- get isLightTheme() {
459
- return this.theme === 'light';
460
- }
461
- handleInputChange(event) {
462
- const input = event.target;
463
- this.searchInputChange.emit(input.value);
464
- }
465
- handleInputKeyUp(event) {
466
- const input = event.target;
467
- this.inputKeyUp.emit(input.value);
468
- }
469
- handleClearInput() {
470
- if (this.clearInput) {
471
- this.clearInput.emit();
472
- }
473
- }
474
- render() {
475
- const containerClassName = this.rightToLeftOrientation
476
- ? 'inputContainerRTL'
477
- : 'inputContainerLTR';
478
- const inputClassName = classNames(this.error
479
- ? this.isLightTheme
480
- ? 'inputErrorLightRTL'
481
- : 'inputErrorDarkRTL'
482
- : this.isLightTheme
483
- ? 'inputLightLTR'
484
- : 'inputDarkLTR', 'searchcraft-input');
485
- const validatedCustomStyles = parseCustomStyles(this.customStyles);
486
- const placeholderStyle = {
487
- fontSize: validatedCustomStyles.placeholderFontSize || '16px',
488
- };
489
- return (h("div", { key: 'ca2698b808ef606d890817f6b8c133503663570e', class: classNames(containerClassName, this.formClassName, 'searchcraft-input-form') }, this.rightToLeftOrientation ? (h(Fragment, null, h("input", { autoComplete: 'off', class: 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 }), h("style", null, `
490
- #searchcraft-input-id::placeholder {
491
- font-size: ${placeholderStyle.fontSize};
492
- }
493
- `), this.inputCaptionValue && (h("searchcraft-input-caption", { inputCaptionClassName: this.inputCaptionClassName, inputCaptionValue: this.inputCaptionValue, rightToLeftOrientation: this.rightToLeftOrientation })), this.query.length > 0 && (h("searchcraft-clear-input-button", { isRequesting: this.isRequesting, onClearInput: this.handleClearInput, rightToLeftOrientation: this.rightToLeftOrientation })), h("searchcraft-input-icon", { error: this.error, height: this.inputIconHeight, rightToLeftOrientation: this.rightToLeftOrientation, width: this.inputIconWidth }))) : (h(Fragment, null, h("searchcraft-input-icon", { error: this.error, height: this.inputIconHeight, rightToLeftOrientation: this.rightToLeftOrientation, width: this.inputIconWidth }), h("input", { autoComplete: 'off', class: 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 }), h("style", null, `
494
- #searchcraft-input-id::placeholder {
495
- font-size: ${placeholderStyle.fontSize};
496
- }
497
- `), this.inputCaptionValue && (h("searchcraft-input-caption", { inputCaptionClassName: this.inputCaptionClassName, inputCaptionValue: this.inputCaptionValue, rightToLeftOrientation: this.rightToLeftOrientation })), this.query.length > 0 && (h("searchcraft-clear-input-button", { isRequesting: this.isRequesting, onClearInput: this.handleClearInput, rightToLeftOrientation: this.rightToLeftOrientation }))))));
498
- }
499
- };
500
- SearchcraftInput.style = SearchcraftInputStyle0;
501
-
502
- const searchcraftInputCaptionModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.inputCaptionLightLTR{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#404040}.inputCaptionDarkLTR{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#E6E6E6}.inputCaptionErrorLightLTR{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#990000}.inputCaptionErrorDarkLTR{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#FFB3B3}.inputCaptionLightRTL{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#404040;text-align:right}.inputCaptionDarkRTL{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#E6E6E6;text-align:right}.inputCaptionErrorLightRTL{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#990000;text-align:right}.inputCaptionErrorDarkRTL{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#FFB3B3;text-align:right}";
503
- const SearchcraftInputCaptionStyle0 = searchcraftInputCaptionModuleCss;
504
-
505
- const SearchcraftInputCaption = class {
506
- constructor(hostRef) {
507
- registerInstance(this, hostRef);
508
- this.error = undefined;
509
- this.inputCaptionClassName = '';
510
- this.inputCaptionValue = 'Enter Search';
511
- this.rightToLeftOrientation = false;
512
- this.theme = 'light';
513
- }
514
- isLightTheme() {
515
- return this.theme === 'light';
516
- }
517
- render() {
518
- return this.rightToLeftOrientation ? (h("p", { class: classNames(this.error
519
- ? this.isLightTheme
520
- ? 'inputCaptionErrorLightRTL'
521
- : 'inputCaptionErrorDarkRTL'
522
- : this.isLightTheme
523
- ? 'inputCaptionLightRTL'
524
- : 'inputCaptionDarkRTL', this.inputCaptionClassName, '.searchcraft-input-caption') }, this.inputCaptionValue)) : (h("p", { class: classNames(this.error
525
- ? this.isLightTheme
526
- ? 'inputCaptionErrorLightLTR'
527
- : 'inputCaptionErrorDarkLTR'
528
- : this.isLightTheme
529
- ? 'inputCaptionLightLTR'
530
- : 'inputCaptionDarkLTR', this.inputCaptionClassName, '.searchcraft-input-caption') }, this.inputCaptionValue));
531
- }
532
- };
533
- SearchcraftInputCaption.style = SearchcraftInputCaptionStyle0;
534
-
535
- 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%)}";
536
- const SearchcraftInputIconStyle0 = searchcraftInputIconModuleCss;
537
-
538
- const SearchcraftInputIcon = class {
539
- constructor(hostRef) {
540
- registerInstance(this, hostRef);
541
- this.error = undefined;
542
- this.height = 20;
543
- this.rightToLeftOrientation = false;
544
- this.width = 20;
545
- this.theme = 'light';
546
- }
547
- isLightTheme() {
548
- return this.theme === 'light';
549
- }
550
- render() {
551
- return this.error ? (h("div", { class: this.rightToLeftOrientation ? 'inputIconRTL' : 'inputIconLTR' }, this.isLightTheme() ? (h("searchcraft-search-icon-set", { height: this.height, type: 'error-light', width: this.width })) : (h("searchcraft-search-icon-set", { height: this.height, type: 'error-dark', width: this.width })))) : (h("div", { class: this.rightToLeftOrientation ? 'inputIconRTL' : 'inputIconLTR' }, this.isLightTheme() ? (h("searchcraft-search-icon-set", { height: this.height, type: 'search-light', width: this.width })) : (h("searchcraft-search-icon-set", { height: this.height, type: 'search-dark', width: this.width }))));
552
- }
553
- };
554
- SearchcraftInputIcon.style = SearchcraftInputIconStyle0;
555
-
556
- 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}";
557
- const SearchcraftInputLabelStyle0 = searchcraftInputLabelModuleCss;
558
-
559
- const SearchcraftInputLabel = class {
560
- constructor(hostRef) {
561
- registerInstance(this, hostRef);
562
- this.inputLabelClassName = '';
563
- this.label = undefined;
564
- this.theme = 'light';
565
- }
566
- isLightTheme() {
567
- return this.theme === 'light';
568
- }
569
- render() {
570
- if (!this.label) {
571
- return null;
572
- }
573
- const labelStyle = this.isLightTheme() ? 'labelLight' : 'labelDark';
574
- return (h("label", { class: classNames(labelStyle, this.inputLabelClassName), htmlFor: 'searchcraft-input-id' }, this.label));
575
- }
576
- };
577
- SearchcraftInputLabel.style = SearchcraftInputLabelStyle0;
578
-
579
- 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}";
580
- const SearchcraftResultsInfoStyle0 = searchcraftResultsInfoModuleCss;
581
-
582
- const SearchcraftResultsInfo = class {
583
- constructor(hostRef) {
584
- registerInstance(this, hostRef);
585
- this.isRequesting = false;
586
- this.resultsCount = 0;
587
- this.responseTime = '';
588
- this.query = '';
589
- }
590
- connectedCallback() {
591
- this.unsubscribe = useSearchcraftStore.subscribe((state) => {
592
- var _a, _b, _c, _d;
593
- this.isRequesting = state.isRequesting;
594
- this.resultsCount = ((_b = (_a = state.searchResults) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.count) || 0;
595
- 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);
596
- this.query = state.query || ''; // Update query from store
597
- });
598
- }
599
- disconnectedCallback() {
600
- if (this.unsubscribe) {
601
- this.unsubscribe();
602
- }
603
- }
604
- render() {
605
- if (!this.query || this.resultsCount === 0) {
606
- return null;
607
- }
608
- return (h("div", { class: 'container' }, h("p", { class: 'resultsInfo' }, this.resultsCount, " results found in ", this.responseTime, "ms")));
609
- }
610
- };
611
- SearchcraftResultsInfo.style = SearchcraftResultsInfoStyle0;
612
-
613
- const SearchcraftSearchIconSet = class {
614
- constructor(hostRef) {
615
- registerInstance(this, hostRef);
616
- this.type = 'search-dark';
617
- this.width = 20;
618
- this.height = 20;
619
- }
620
- render() {
621
- const { width, height } = this;
622
- switch (this.type) {
623
- case 'search-light':
624
- return (h("svg", { width: width, height: height, viewBox: '0 0 20 20', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'searchcraft-title' }, h("title", { id: 'searchcraft-title' }, "Searchcraft Search Icon Light"), h("path", { d: 'M17.5 17.5L13.875 13.875M15.8333 9.16667C15.8333 12.8486 12.8486 15.8333 9.16667 15.8333C5.48477 15.8333 2.5 12.8486 2.5 9.16667C2.5 5.48477 5.48477 2.5 9.16667 2.5C12.8486 2.5 15.8333 5.48477 15.8333 9.16667Z', stroke: '#404040', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' })));
625
- case 'search-dark':
626
- return (h("svg", { width: width, height: height, viewBox: '0 0 18 18', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'searchcraft-title' }, h("title", { id: 'searchcraft-title' }, "Searchcraft Search Icon Dark"), h("path", { d: 'M16.5 16.5L12.875 12.875M14.8333 8.16667C14.8333 11.8486 11.8486 14.8333 8.16667 14.8333C4.48477 14.8333 1.5 11.8486 1.5 8.16667C1.5 4.48477 4.48477 1.5 8.16667 1.5C11.8486 1.5 14.8333 4.48477 14.8333 8.16667Z', stroke: '#E6E6E6', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' })));
627
- case 'error-light':
628
- return (h("svg", { width: width, height: height, viewBox: '0 0 20 20', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'searchcraft-title' }, h("title", { id: 'searchcraft-title' }, "Searchcraft Error Search Icon Light"), h("path", { d: 'M17.5 17.5L13.875 13.875M15.8333 9.16667C15.8333 12.8486 12.8486 15.8333 9.16667 15.8333C5.48477 15.8333 2.5 12.8486 2.5 9.16667C2.5 5.48477 5.48477 2.5 9.16667 2.5C12.8486 2.5 15.8333 5.48477 15.8333 9.16667Z', stroke: '#737373', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' })));
629
- case 'error-dark':
630
- return (h("svg", { width: width, height: height, viewBox: '0 0 18 18', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'searchcraft-title' }, h("title", { id: 'searchcraft-title' }, "Searchcraft Error Search Icon Dark"), h("path", { d: 'M16.5 16.5L12.875 12.875M14.8333 8.16667C14.8333 11.8486 11.8486 14.8333 8.16667 14.8333C4.48477 14.8333 1.5 11.8486 1.5 8.16667C1.5 4.48477 4.48477 1.5 8.16667 1.5C11.8486 1.5 14.8333 4.48477 14.8333 8.16667Z', stroke: '#BFBFBF', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' })));
631
- default:
632
- return null;
633
- }
634
- }
635
- };
636
-
637
- 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}";
638
- const SearchcraftSliderStyle0 = searchcraftSliderModuleCss;
639
-
640
- const SearchcraftSlider = class {
641
- constructor(hostRef) {
642
- registerInstance(this, hostRef);
643
- this.searchStore = useSearchcraftStore.getState();
644
- this.updateYears = async () => {
645
- this.searchStore.setYearsRange([this.startYear, this.endYear]);
646
- try {
647
- if (typeof this.query === 'string' && this.query.trim() !== '') {
648
- await this.searchStore.search();
649
- }
650
- else {
651
- console.warn('Query is missing or empty, skipping search request.');
652
- }
653
- }
654
- catch (error) {
655
- console.error('Search failed:', error);
656
- }
657
- };
658
- this.handleStartYearChange = (event) => {
659
- const value = Number.parseInt(event.target.value, 10);
660
- this.startYear = Math.min(value, this.endYear);
661
- this.updateYears();
662
- };
663
- this.handleEndYearChange = (event) => {
664
- const value = Number.parseInt(event.target.value, 10);
665
- this.endYear = Math.max(value, this.startYear);
666
- this.updateYears();
667
- };
668
- this.maxYear = new Date().getFullYear();
669
- this.minYear = 2014;
670
- this.endYear = this.maxYear;
671
- this.hasSearched = false;
672
- this.query = '';
673
- this.resultsCount = 0;
674
- this.startYear = this.minYear;
675
- }
676
- componentDidLoad() {
677
- this.unsubscribe = useSearchcraftStore.subscribe((state) => {
678
- var _a, _b, _c;
679
- if (state.query.length > 0) {
680
- this.hasSearched = true;
681
- 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;
682
- }
683
- this.query = state.query;
684
- });
685
- }
686
- disconnectedCallback() {
687
- if (this.unsubscribe) {
688
- this.unsubscribe();
689
- }
690
- }
691
- render() {
692
- if (!this.query || this.resultsCount === 0) {
693
- return null;
694
- }
695
- const rangeMin = this.minYear;
696
- const rangeMax = this.maxYear;
697
- const startPercent = ((this.startYear - rangeMin) / (rangeMax - rangeMin)) * 100;
698
- const endPercent = ((this.endYear - rangeMin) / (rangeMax - rangeMin)) * 100;
699
- return (h("div", { class: 'sliderContainer' }, h("div", { class: 'rangeContainer' }, h("div", { class: 'activeRange', style: {
700
- left: `${startPercent}%`,
701
- width: `${endPercent - startPercent}%`,
702
- } }), h("input", { class: 'rangeSlider', max: this.maxYear, min: this.minYear, onInput: this.handleStartYearChange, step: '1', type: 'range', value: this.startYear }), h("input", { class: 'rangeSlider', max: this.maxYear, min: this.minYear, onInput: this.handleEndYearChange, step: '1', type: 'range', value: this.endYear })), h("div", { class: 'yearLabels' }, h("span", { class: 'yearLabel' }, this.startYear), h("span", { class: 'yearLabel' }, this.endYear))));
703
- }
704
- };
705
- SearchcraftSlider.style = SearchcraftSliderStyle0;
706
-
707
- 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)}}";
708
- const SearchcraftSpinnerDarkStyle0 = searchcraftSpinnerDarkModuleCss;
709
-
710
- const SearchcraftSpinnerDark = class {
711
- constructor(hostRef) {
712
- registerInstance(this, hostRef);
713
- }
714
- render() {
715
- return (h("div", { key: '60b629930c2e2795236f6768b40c95ce9390e882', class: 'spinnerContainer' }, h("div", { key: 'bfef3329f2e81ecf6538738ac0213da6259dd1c3', class: 'spinnerDark' })));
716
- }
717
- };
718
- SearchcraftSpinnerDark.style = SearchcraftSpinnerDarkStyle0;
719
-
720
- 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)}}";
721
- const SearchcraftSpinnerLightStyle0 = searchcraftSpinnerLightModuleCss;
722
-
723
- const SearchcraftSpinnerLight = class {
724
- constructor(hostRef) {
725
- registerInstance(this, hostRef);
726
- }
727
- render() {
728
- return (h("div", { key: 'ad5224c97faf7e329d2a8904488c17dfd7414b9e', class: 'spinnerContainer' }, h("div", { key: '6336ce7737af65eedac46ee290b20291ce5b6096', class: 'spinnerLight' })));
729
- }
730
- };
731
- SearchcraftSpinnerLight.style = SearchcraftSpinnerLightStyle0;
732
-
733
- 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)}";
734
- const SearchcraftToggleButtonStyle0 = searchcraftToggleButtonModuleCss;
735
-
736
- const SearchcraftToggleButton = class {
737
- constructor(hostRef) {
738
- registerInstance(this, hostRef);
739
- this.searchStore = useSearchcraftStore.getState();
740
- this.handleToggle = async () => {
741
- this.isActive = !this.isActive;
742
- if (this.type === 'mode') {
743
- const mode = this.isActive ? 'normal' : 'fuzzy';
744
- this.searchStore.setSearchParams({
745
- mode,
746
- });
747
- }
748
- else if (this.type === 'sort') {
749
- const sort = this.isActive ? 'desc' : 'asc';
750
- this.searchStore.setSearchParams({
751
- sort,
752
- });
753
- }
754
- try {
755
- await this.searchStore.search();
756
- }
757
- catch (error) {
758
- console.error('Search failed:', error);
759
- }
760
- };
761
- this.type = 'mode';
762
- this.isActive = false;
763
- this.query = '';
764
- this.resultsCount = 0;
765
- }
766
- componentDidLoad() {
767
- this.unsubscribe = useSearchcraftStore.subscribe((state) => {
768
- var _a, _b, _c;
769
- this.query = state.query || '';
770
- 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;
771
- });
772
- }
773
- disconnectedCallback() {
774
- if (this.unsubscribe) {
775
- this.unsubscribe();
776
- }
777
- }
778
- render() {
779
- if (!this.query || this.resultsCount === 0) {
780
- return null;
781
- }
782
- return (h("button", { class: `toggle-wrapper ${this.isActive ? 'active' : ''}`, onClick: this.handleToggle, type: 'button' }, h("div", { class: `toggle-switch ${this.isActive ? 'active' : ''}` })));
783
- }
784
- };
785
- SearchcraftToggleButton.style = SearchcraftToggleButtonStyle0;
786
-
787
- export { SearchcraftAutoSearchForm as searchcraft_auto_search_form, SearchcraftBaseSearchResult as searchcraft_base_search_result, SearchcraftBaseSearchResults as searchcraft_base_search_results, SearchcraftClearIconSet as searchcraft_clear_icon_set, SearchcraftClearInputButton as searchcraft_clear_input_button, SearchcraftErrorMessage as searchcraft_error_message, SearchcraftFiltersList as searchcraft_filters_list, SearchcraftInput as searchcraft_input, SearchcraftInputCaption as searchcraft_input_caption, SearchcraftInputIcon as searchcraft_input_icon, SearchcraftInputLabel as searchcraft_input_label, SearchcraftResultsInfo as searchcraft_results_info, SearchcraftSearchIconSet as searchcraft_search_icon_set, SearchcraftSlider as searchcraft_slider, SearchcraftSpinnerDark as searchcraft_spinner_dark, SearchcraftSpinnerLight as searchcraft_spinner_light, SearchcraftToggleButton as searchcraft_toggle_button };
788
-
789
- //# sourceMappingURL=searchcraft-auto-search-form_17.entry.js.map