@searchcraft/javascript-sdk 0.2.7 → 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 (269) hide show
  1. package/dist/components/searchcraft-dash-icon.d.ts +11 -0
  2. package/dist/searchcraft-javascript-sdk/_commonjsHelpers-63cbe26c.js +34 -0
  3. package/dist/searchcraft-javascript-sdk/_commonjsHelpers-63cbe26c.js.map +1 -0
  4. package/dist/searchcraft-javascript-sdk/index-8211f330.js +3043 -0
  5. package/dist/searchcraft-javascript-sdk/index-8211f330.js.map +1 -0
  6. package/dist/{components/p-5cdc6210.js → searchcraft-javascript-sdk/index-d6567b9c.js} +10 -2
  7. package/dist/searchcraft-javascript-sdk/index-d6567b9c.js.map +1 -0
  8. package/dist/searchcraft-javascript-sdk/index.esm.js +14 -1
  9. package/dist/searchcraft-javascript-sdk/index.esm.js.map +1 -1
  10. package/dist/searchcraft-javascript-sdk/searchcraft-auto-search-form.entry.js +127 -0
  11. package/dist/searchcraft-javascript-sdk/searchcraft-auto-search-form.entry.js.map +1 -0
  12. package/dist/{esm → searchcraft-javascript-sdk}/searchcraft-base-search-form.entry.js +6 -5
  13. package/dist/searchcraft-javascript-sdk/searchcraft-base-search-form.entry.js.map +1 -0
  14. package/dist/{components/p-1b18e9fe.js → searchcraft-javascript-sdk/searchcraft-base-search-result.entry.js} +11 -40
  15. package/dist/searchcraft-javascript-sdk/searchcraft-base-search-result.entry.js.map +1 -0
  16. package/dist/{components/searchcraft-base-search-results.js → searchcraft-javascript-sdk/searchcraft-base-search-results.entry.js} +12 -56
  17. package/dist/searchcraft-javascript-sdk/searchcraft-base-search-results.entry.js.map +1 -0
  18. package/dist/{esm → searchcraft-javascript-sdk}/searchcraft-button-icon.entry.js +1 -1
  19. package/dist/searchcraft-javascript-sdk/searchcraft-button-icon.entry.js.map +1 -0
  20. package/dist/{esm → searchcraft-javascript-sdk}/searchcraft-button.entry.js +5 -5
  21. package/dist/searchcraft-javascript-sdk/searchcraft-button.entry.js.map +1 -0
  22. package/dist/{collection/assets/searchcraft-check-icon.js → searchcraft-javascript-sdk/searchcraft-check-icon.entry.js} +11 -6
  23. package/dist/searchcraft-javascript-sdk/searchcraft-check-icon.entry.js.map +1 -0
  24. package/dist/{components/p-70722ab2.js → searchcraft-javascript-sdk/searchcraft-clear-icon-set.entry.js} +7 -24
  25. package/dist/searchcraft-javascript-sdk/searchcraft-clear-icon-set.entry.js.map +1 -0
  26. package/dist/searchcraft-javascript-sdk/searchcraft-clear-input-button.entry.js +30 -0
  27. package/dist/searchcraft-javascript-sdk/searchcraft-clear-input-button.entry.js.map +1 -0
  28. package/dist/searchcraft-javascript-sdk/searchcraft-dash-icon.entry.js +14 -0
  29. package/dist/searchcraft-javascript-sdk/searchcraft-dash-icon.entry.js.map +1 -0
  30. package/dist/searchcraft-javascript-sdk/searchcraft-error-message.entry.js +22 -0
  31. package/dist/searchcraft-javascript-sdk/searchcraft-error-message.entry.js.map +1 -0
  32. package/dist/searchcraft-javascript-sdk/searchcraft-filters-list.entry.js +120 -0
  33. package/dist/searchcraft-javascript-sdk/searchcraft-filters-list.entry.js.map +1 -0
  34. package/dist/{components/p-6237f03e.js → searchcraft-javascript-sdk/searchcraft-input-caption.entry.js} +10 -31
  35. package/dist/searchcraft-javascript-sdk/searchcraft-input-caption.entry.js.map +1 -0
  36. package/dist/searchcraft-javascript-sdk/searchcraft-input-icon.entry.js +25 -0
  37. package/dist/searchcraft-javascript-sdk/searchcraft-input-icon.entry.js.map +1 -0
  38. package/dist/searchcraft-javascript-sdk/searchcraft-input-label.entry.js +29 -0
  39. package/dist/searchcraft-javascript-sdk/searchcraft-input-label.entry.js.map +1 -0
  40. package/dist/{components/p-643cfdcf.js → searchcraft-javascript-sdk/searchcraft-input.entry.js} +12 -83
  41. package/dist/searchcraft-javascript-sdk/searchcraft-input.entry.js.map +1 -0
  42. package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js +48 -1
  43. package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js.map +1 -1
  44. package/dist/{collection/components/searchcraft-results-info/searchcraft-results-info.js → searchcraft-javascript-sdk/searchcraft-results-info.entry.js} +16 -26
  45. package/dist/searchcraft-javascript-sdk/searchcraft-results-info.entry.js.map +1 -0
  46. package/dist/{components/p-a3bd1bc8.js → searchcraft-javascript-sdk/searchcraft-search-icon-set.entry.js} +7 -26
  47. package/dist/searchcraft-javascript-sdk/searchcraft-search-icon-set.entry.js.map +1 -0
  48. package/dist/{components/searchcraft-slider.js → searchcraft-javascript-sdk/searchcraft-slider.entry.js} +11 -36
  49. package/dist/searchcraft-javascript-sdk/searchcraft-slider.entry.js.map +1 -0
  50. package/dist/searchcraft-javascript-sdk/searchcraft-spinner-dark.entry.js +17 -0
  51. package/dist/searchcraft-javascript-sdk/searchcraft-spinner-dark.entry.js.map +1 -0
  52. package/dist/searchcraft-javascript-sdk/searchcraft-spinner-light.entry.js +17 -0
  53. package/dist/searchcraft-javascript-sdk/searchcraft-spinner-light.entry.js.map +1 -0
  54. package/dist/{components/searchcraft-toggle-button.js → searchcraft-javascript-sdk/searchcraft-toggle-button.entry.js} +11 -33
  55. package/dist/searchcraft-javascript-sdk/searchcraft-toggle-button.entry.js.map +1 -0
  56. package/dist/searchcraft-javascript-sdk/shadow-css-423dab2c.js +334 -0
  57. package/dist/searchcraft-javascript-sdk/shadow-css-423dab2c.js.map +1 -0
  58. package/dist/searchcraft-javascript-sdk/store-08ee97f6.js +3073 -0
  59. package/dist/searchcraft-javascript-sdk/store-08ee97f6.js.map +1 -0
  60. package/dist/{components/p-2bda632c.js → searchcraft-javascript-sdk/utils-9f198636.js} +19 -8
  61. package/dist/searchcraft-javascript-sdk/utils-9f198636.js.map +1 -0
  62. package/dist/types/assets/searchcraft-dash-icon.d.ts +3 -0
  63. package/dist/types/components/searchcraft-filters-list/searchcraft-filters-list.d.ts +13 -5
  64. package/dist/types/components.d.ts +13 -0
  65. package/dist/types/utils/utils.d.ts +3 -0
  66. package/package.json +1 -1
  67. package/dist/cjs/app-globals-3a1e7e63.js +0 -7
  68. package/dist/cjs/app-globals-3a1e7e63.js.map +0 -1
  69. package/dist/cjs/index-5b0b9d4c.js +0 -84
  70. package/dist/cjs/index-5b0b9d4c.js.map +0 -1
  71. package/dist/cjs/index-6c5282a0.js +0 -1279
  72. package/dist/cjs/index-6c5282a0.js.map +0 -1
  73. package/dist/cjs/index.cjs.js +0 -17
  74. package/dist/cjs/index.cjs.js.map +0 -1
  75. package/dist/cjs/loader.cjs.js +0 -17
  76. package/dist/cjs/loader.cjs.js.map +0 -1
  77. package/dist/cjs/searchcraft-auto-search-form_18.cjs.entry.js +0 -821
  78. package/dist/cjs/searchcraft-auto-search-form_18.cjs.entry.js.map +0 -1
  79. package/dist/cjs/searchcraft-base-search-form.cjs.entry.js +0 -64
  80. package/dist/cjs/searchcraft-base-search-form.cjs.entry.js.map +0 -1
  81. package/dist/cjs/searchcraft-button-icon.cjs.entry.js +0 -18
  82. package/dist/cjs/searchcraft-button-icon.cjs.entry.js.map +0 -1
  83. package/dist/cjs/searchcraft-button.cjs.entry.js +0 -37
  84. package/dist/cjs/searchcraft-button.cjs.entry.js.map +0 -1
  85. package/dist/cjs/searchcraft-javascript-sdk.cjs.js +0 -27
  86. package/dist/cjs/searchcraft-javascript-sdk.cjs.js.map +0 -1
  87. package/dist/cjs/store-c44c58ab.js +0 -314
  88. package/dist/cjs/store-c44c58ab.js.map +0 -1
  89. package/dist/cjs/utils-2dc6115c.js +0 -84
  90. package/dist/cjs/utils-2dc6115c.js.map +0 -1
  91. package/dist/collection/assets/searchcraft-button-icons.js +0 -9
  92. package/dist/collection/assets/searchcraft-button-icons.js.map +0 -1
  93. package/dist/collection/assets/searchcraft-check-icon.js.map +0 -1
  94. package/dist/collection/assets/searchcraft-clear-icon-set.js +0 -45
  95. package/dist/collection/assets/searchcraft-clear-icon-set.js.map +0 -1
  96. package/dist/collection/assets/searchcraft-search-icon-set.js +0 -84
  97. package/dist/collection/assets/searchcraft-search-icon-set.js.map +0 -1
  98. package/dist/collection/collection-manifest.json +0 -32
  99. package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.js +0 -365
  100. package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.js.map +0 -1
  101. package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.module.css +0 -15
  102. package/dist/collection/components/searchcraft-base-search-form/searchcraft-base-search-form.js +0 -168
  103. package/dist/collection/components/searchcraft-base-search-form/searchcraft-base-search-form.js.map +0 -1
  104. package/dist/collection/components/searchcraft-base-search-form/searchcraft-base-search-form.module.css +0 -18
  105. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js +0 -329
  106. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js.map +0 -1
  107. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.module.css +0 -224
  108. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js +0 -270
  109. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js.map +0 -1
  110. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.module.css +0 -47
  111. package/dist/collection/components/searchcraft-button/searchcraft-button.js +0 -137
  112. package/dist/collection/components/searchcraft-button/searchcraft-button.js.map +0 -1
  113. package/dist/collection/components/searchcraft-button/searchcraft-button.module.css +0 -82
  114. package/dist/collection/components/searchcraft-clear-input-button/searchcraft-clear-input-button.js +0 -95
  115. package/dist/collection/components/searchcraft-clear-input-button/searchcraft-clear-input-button.js.map +0 -1
  116. package/dist/collection/components/searchcraft-clear-input-button/searchcraft-clear-input-button.module.css +0 -33
  117. package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js +0 -64
  118. package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js.map +0 -1
  119. package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.module.css +0 -21
  120. package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.js +0 -172
  121. package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.js.map +0 -1
  122. package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.module.css +0 -83
  123. package/dist/collection/components/searchcraft-input/searchcraft-input.js +0 -352
  124. package/dist/collection/components/searchcraft-input/searchcraft-input.js.map +0 -1
  125. package/dist/collection/components/searchcraft-input/searchcraft-input.module.css +0 -241
  126. package/dist/collection/components/searchcraft-input-caption/searchcraft-input-caption.js +0 -122
  127. package/dist/collection/components/searchcraft-input-caption/searchcraft-input-caption.js.map +0 -1
  128. package/dist/collection/components/searchcraft-input-caption/searchcraft-input-caption.module.css +0 -79
  129. package/dist/collection/components/searchcraft-input-icon/searchcraft-input-icon.js +0 -109
  130. package/dist/collection/components/searchcraft-input-icon/searchcraft-input-icon.js.map +0 -1
  131. package/dist/collection/components/searchcraft-input-icon/searchcraft-input-icon.module.css +0 -17
  132. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js +0 -76
  133. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js.map +0 -1
  134. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.module.css +0 -21
  135. package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.js.map +0 -1
  136. package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.module.css +0 -15
  137. package/dist/collection/components/searchcraft-slider/searchcraft-slider.js +0 -128
  138. package/dist/collection/components/searchcraft-slider/searchcraft-slider.js.map +0 -1
  139. package/dist/collection/components/searchcraft-slider/searchcraft-slider.module.css +0 -68
  140. package/dist/collection/components/searchcraft-spinner-dark/searchcraft-spinner-dark.js +0 -19
  141. package/dist/collection/components/searchcraft-spinner-dark/searchcraft-spinner-dark.js.map +0 -1
  142. package/dist/collection/components/searchcraft-spinner-dark/searchcraft-spinner-dark.module.css +0 -35
  143. package/dist/collection/components/searchcraft-spinner-light/searchcraft-spinner-light.js +0 -19
  144. package/dist/collection/components/searchcraft-spinner-light/searchcraft-spinner-light.js.map +0 -1
  145. package/dist/collection/components/searchcraft-spinner-light/searchcraft-spinner-light.module.css +0 -26
  146. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js +0 -92
  147. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js.map +0 -1
  148. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.module.css +0 -31
  149. package/dist/collection/index.js +0 -12
  150. package/dist/collection/index.js.map +0 -1
  151. package/dist/collection/provider/store.js +0 -96
  152. package/dist/collection/provider/store.js.map +0 -1
  153. package/dist/collection/utils/utils.js +0 -74
  154. package/dist/collection/utils/utils.js.map +0 -1
  155. package/dist/components/index.js +0 -60
  156. package/dist/components/index.js.map +0 -1
  157. package/dist/components/p-0eb562da.js +0 -67
  158. package/dist/components/p-0eb562da.js.map +0 -1
  159. package/dist/components/p-14f328f4.js +0 -40
  160. package/dist/components/p-14f328f4.js.map +0 -1
  161. package/dist/components/p-157e5b1a.js +0 -310
  162. package/dist/components/p-157e5b1a.js.map +0 -1
  163. package/dist/components/p-1b18e9fe.js.map +0 -1
  164. package/dist/components/p-2bda632c.js.map +0 -1
  165. package/dist/components/p-52b81ff4.js +0 -61
  166. package/dist/components/p-52b81ff4.js.map +0 -1
  167. package/dist/components/p-5cdc6210.js.map +0 -1
  168. package/dist/components/p-6237f03e.js.map +0 -1
  169. package/dist/components/p-643cfdcf.js.map +0 -1
  170. package/dist/components/p-70722ab2.js.map +0 -1
  171. package/dist/components/p-7498e493.js +0 -1113
  172. package/dist/components/p-7498e493.js.map +0 -1
  173. package/dist/components/p-8c38185e.js +0 -53
  174. package/dist/components/p-8c38185e.js.map +0 -1
  175. package/dist/components/p-9952c9ba.js +0 -33
  176. package/dist/components/p-9952c9ba.js.map +0 -1
  177. package/dist/components/p-a3bd1bc8.js.map +0 -1
  178. package/dist/components/p-ae84b899.js +0 -48
  179. package/dist/components/p-ae84b899.js.map +0 -1
  180. package/dist/components/p-bdf84774.js +0 -33
  181. package/dist/components/p-bdf84774.js.map +0 -1
  182. package/dist/components/p-d3187f5a.js +0 -29
  183. package/dist/components/p-d3187f5a.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-check-icon.js +0 -8
  196. package/dist/components/searchcraft-check-icon.js.map +0 -1
  197. package/dist/components/searchcraft-clear-icon-set.js +0 -8
  198. package/dist/components/searchcraft-clear-icon-set.js.map +0 -1
  199. package/dist/components/searchcraft-clear-input-button.js +0 -8
  200. package/dist/components/searchcraft-clear-input-button.js.map +0 -1
  201. package/dist/components/searchcraft-error-message.js +0 -8
  202. package/dist/components/searchcraft-error-message.js.map +0 -1
  203. package/dist/components/searchcraft-filters-list.js +0 -149
  204. package/dist/components/searchcraft-filters-list.js.map +0 -1
  205. package/dist/components/searchcraft-input-caption.js +0 -8
  206. package/dist/components/searchcraft-input-caption.js.map +0 -1
  207. package/dist/components/searchcraft-input-icon.js +0 -8
  208. package/dist/components/searchcraft-input-icon.js.map +0 -1
  209. package/dist/components/searchcraft-input-label.js +0 -8
  210. package/dist/components/searchcraft-input-label.js.map +0 -1
  211. package/dist/components/searchcraft-input.js +0 -8
  212. package/dist/components/searchcraft-input.js.map +0 -1
  213. package/dist/components/searchcraft-results-info.js +0 -63
  214. package/dist/components/searchcraft-results-info.js.map +0 -1
  215. package/dist/components/searchcraft-search-icon-set.js +0 -8
  216. package/dist/components/searchcraft-search-icon-set.js.map +0 -1
  217. package/dist/components/searchcraft-slider.js.map +0 -1
  218. package/dist/components/searchcraft-spinner-dark.js +0 -8
  219. package/dist/components/searchcraft-spinner-dark.js.map +0 -1
  220. package/dist/components/searchcraft-spinner-light.js +0 -8
  221. package/dist/components/searchcraft-spinner-light.js.map +0 -1
  222. package/dist/components/searchcraft-toggle-button.js.map +0 -1
  223. package/dist/esm/index-0ac5bb53.js +0 -1251
  224. package/dist/esm/index-0ac5bb53.js.map +0 -1
  225. package/dist/esm/index-72ac5051.js +0 -82
  226. package/dist/esm/index-72ac5051.js.map +0 -1
  227. package/dist/esm/index.js +0 -4
  228. package/dist/esm/index.js.map +0 -1
  229. package/dist/esm/loader.js +0 -13
  230. package/dist/esm/loader.js.map +0 -1
  231. package/dist/esm/searchcraft-auto-search-form_18.entry.js +0 -800
  232. package/dist/esm/searchcraft-auto-search-form_18.entry.js.map +0 -1
  233. package/dist/esm/searchcraft-base-search-form.entry.js.map +0 -1
  234. package/dist/esm/searchcraft-button-icon.entry.js.map +0 -1
  235. package/dist/esm/searchcraft-button.entry.js.map +0 -1
  236. package/dist/esm/searchcraft-javascript-sdk.js +0 -22
  237. package/dist/esm/searchcraft-javascript-sdk.js.map +0 -1
  238. package/dist/esm/store-9e0b0710.js +0 -310
  239. package/dist/esm/store-9e0b0710.js.map +0 -1
  240. package/dist/esm/utils-a3373179.js +0 -77
  241. package/dist/esm/utils-a3373179.js.map +0 -1
  242. package/dist/index.cjs.js +0 -1
  243. package/dist/index.js +0 -1
  244. package/dist/loader/cdn.js +0 -1
  245. package/dist/loader/index.cjs.js +0 -1
  246. package/dist/loader/index.d.ts +0 -24
  247. package/dist/loader/index.es2017.js +0 -1
  248. package/dist/loader/index.js +0 -2
  249. package/dist/loader/package.json +0 -11
  250. package/dist/searchcraft-javascript-sdk/p-0880cfbb.js +0 -3
  251. package/dist/searchcraft-javascript-sdk/p-0880cfbb.js.map +0 -1
  252. package/dist/searchcraft-javascript-sdk/p-2bda632c.js +0 -2
  253. package/dist/searchcraft-javascript-sdk/p-2bda632c.js.map +0 -1
  254. package/dist/searchcraft-javascript-sdk/p-5cdc6210.js +0 -7
  255. package/dist/searchcraft-javascript-sdk/p-5cdc6210.js.map +0 -1
  256. package/dist/searchcraft-javascript-sdk/p-5ec960bd.entry.js +0 -2
  257. package/dist/searchcraft-javascript-sdk/p-5ec960bd.entry.js.map +0 -1
  258. package/dist/searchcraft-javascript-sdk/p-66f38e89.entry.js +0 -2
  259. package/dist/searchcraft-javascript-sdk/p-66f38e89.entry.js.map +0 -1
  260. package/dist/searchcraft-javascript-sdk/p-67cc5ccb.entry.js +0 -2
  261. package/dist/searchcraft-javascript-sdk/p-67cc5ccb.entry.js.map +0 -1
  262. package/dist/searchcraft-javascript-sdk/p-901fee50.js +0 -11
  263. package/dist/searchcraft-javascript-sdk/p-901fee50.js.map +0 -1
  264. package/dist/searchcraft-javascript-sdk/p-d9efd790.entry.js +0 -2
  265. package/dist/searchcraft-javascript-sdk/p-d9efd790.entry.js.map +0 -1
  266. package/dist/searchcraft-javascript-sdk/p-e1255160.js +0 -2
  267. package/dist/searchcraft-javascript-sdk/p-e1255160.js.map +0 -1
  268. /package/dist/{esm → searchcraft-javascript-sdk}/app-globals-0f993ce5.js +0 -0
  269. /package/dist/{esm → searchcraft-javascript-sdk}/app-globals-0f993ce5.js.map +0 -0
@@ -1,800 +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: 'cfc0e29f0f35598c13f5d87720f38d74cba292fb', class: `${formClass}`, onSubmit: this.handleFormSubmit }, h("searchcraft-input-label", { key: 'fd5635505ee5f863f128912377960752d4dccd2d', label: this.labelForInput }), h("searchcraft-input", { key: '84c3a6da7ed48e835aa74f87ad862672d38876c7', 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: 'bcb99f333d73ed811c7d7a6d85736ba94fb7fa56', 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;-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}";
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: 'bc2c9e7e6fdfdd7a159adeaae93ee295f3871bb1', class: 'imageContainer' }, h("img", { key: '403cf6f083a0fab8c0d84f858e6f799bb5e39856', alt: this.imageDescription, class: isLightTheme ? 'imageLight' : 'imageDark', src: this.imageSource, style: styles.image || {} })));
158
- const contentContainer = (h("div", { key: 'ec56243d676a5dfbdc7d9dc5be9f2e078ab3e599', class: 'contentContainer' }, h("h2", { key: 'e2d73b3c6c18753fee3e3a2a8526a68c62a0a2f5', class: isLightTheme ? 'headingLight' : 'headingDark', style: styles.heading || {} }, this.headingText), h("h3", { key: 'fccf35b5a06c09c96150568d4cd71bacea1fe15d', class: isLightTheme ? 'subheadingLight' : 'subheadingDark', style: styles.subheading || {} }, this.subheadingText), h("p", { key: '95b64831fd0248f69773cafa6357133f9758748c', class: isLightTheme ? 'primaryContentLight' : 'primaryContentDark', style: styles.primaryContent || {} }, this.primaryContent), h("div", { key: 'f1e597968aab316067762bca3e39bccb50f3b34a', class: 'secondaryContentContainer' }, h("p", { key: '05ccdbb2854cd538fa2fd9e3a6efe8fa8ea46003', class: isLightTheme ? 'secondaryContentLight' : 'secondaryContentDark', style: styles.secondaryContent || {} }, this.secondaryContent), h("p", { key: 'ca2b96c02c9d8b073b0e0cff3e288d9eba7e3cd1', class: isLightTheme ? 'tertiaryContentLight' : 'tertiaryContentDark', style: styles.tertiaryContent || {} }, this.tertiaryContent)), this.buttonText && (h("button", { key: '9d728eb6dcc2cdc2d0b438e79286795835dbf9e6', onClick: this.handleButtonClick, style: styles.button || {}, type: 'button' }, this.buttonText))));
159
- return (h("div", { key: '44c9677d5c3c75439b9d73d8e60e5744d2ee9be0', 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 SearchcraftCheckIcon = class {
266
- constructor(hostRef) {
267
- registerInstance(this, hostRef);
268
- }
269
- render() {
270
- return (h("svg", { key: '3db200942b79612a38293544a029c6854dfa4beb', width: '16', height: '16', viewBox: '0 0 16 16', fill: 'none' }, h("title", { key: 'b7b6af8651edb5cc0e054ed775b9029c6c93535e' }, "Checkbox Check"), h("path", { key: '7c74edc45f007245e4c6e4fd5d37dbc6dad20de0', d: 'M13.9999 2L5.74988 10L1.99988 6.36364', stroke: 'white', "stroke-width": '3', "stroke-linecap": 'round', "stroke-linejoin": 'round' })));
271
- }
272
- };
273
-
274
- const SearchcraftClearIconSet = class {
275
- constructor(hostRef) {
276
- registerInstance(this, hostRef);
277
- this.type = 'clear-light';
278
- }
279
- render() {
280
- switch (this.type) {
281
- case 'clear-light':
282
- 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' })));
283
- case 'clear-dark':
284
- 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' })));
285
- case 'arrow-light':
286
- 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' })));
287
- case 'arrow-dark':
288
- 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' })));
289
- default:
290
- return null;
291
- }
292
- }
293
- };
294
-
295
- 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}";
296
- const SearchcraftClearInputButtonStyle0 = searchcraftClearInputButtonModuleCss;
297
-
298
- const SearchcraftClearInputButton = class {
299
- constructor(hostRef) {
300
- registerInstance(this, hostRef);
301
- this.clearInput = createEvent(this, "clearInput", 7);
302
- this.handleClearClick = (event) => {
303
- event.preventDefault();
304
- this.clearInput.emit();
305
- };
306
- this.isRequesting = false;
307
- this.rightToLeftOrientation = false;
308
- this.theme = 'light';
309
- }
310
- isLightTheme() {
311
- return this.theme === 'light';
312
- }
313
- render() {
314
- 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' }))));
315
- }
316
- };
317
- SearchcraftClearInputButton.style = SearchcraftClearInputButtonStyle0;
318
-
319
- 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}";
320
- const SearchcraftErrorMessageStyle0 = searchcraftErrorMessageModuleCss;
321
-
322
- const SearchcraftErrorMessage = class {
323
- constructor(hostRef) {
324
- registerInstance(this, hostRef);
325
- this.errorMessage = undefined;
326
- this.theme = 'light';
327
- }
328
- render() {
329
- const errorMessageStyle = this.theme === 'light' ? 'errorMessageLight' : 'errorMessageDark';
330
- return (h("p", { key: 'af47ef1acca6beb5ba557f55a6f911fad9184bb7', class: classNames(errorMessageStyle) }, this.errorMessage || 'Search term is required.'));
331
- }
332
- };
333
- SearchcraftErrorMessage.style = SearchcraftErrorMessageStyle0;
334
-
335
- 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}.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}.checkContainer{display:none;height:16px;width:16px;position:absolute;top:10px;left:7px}";
336
- const SearchcraftFiltersListStyle0 = searchcraftFiltersListModuleCss;
337
-
338
- const SearchcraftFiltersList = class {
339
- constructor(hostRef) {
340
- registerInstance(this, hostRef);
341
- this.filtersUpdated = createEvent(this, "filtersUpdated", 7);
342
- this.searchStore = useSearchcraftStore.getState();
343
- this.handleFilterChange = (value, checked) => {
344
- if (checked) {
345
- this.selectedFilters.add(value);
346
- }
347
- else {
348
- this.selectedFilters.delete(value);
349
- }
350
- const deduplicatedFilters = this.deduplicatePaths(Array.from(this.selectedFilters));
351
- this.filtersUpdated.emit(deduplicatedFilters);
352
- this.searchStore.setSelectedFilters(deduplicatedFilters);
353
- this.searchStore.search();
354
- };
355
- this.filters = [];
356
- this.dynamicFilters = [];
357
- this.isRequesting = false;
358
- this.query = '';
359
- this.resultsCount = 0;
360
- this.selectedFilters = new Set();
361
- }
362
- connectedCallback() {
363
- var _a;
364
- const state = this.searchStore;
365
- if ((_a = state.searchResults) === null || _a === void 0 ? void 0 : _a.data.facets) {
366
- this.populateFiltersFromFacets(state.searchResults.data.facets);
367
- }
368
- this.unsubscribe = useSearchcraftStore.subscribe((state) => {
369
- var _a, _b, _c, _d;
370
- if (!state.query || state.query.trim().length === 0) {
371
- if (this.selectedFilters.size > 0) {
372
- this.selectedFilters.clear();
373
- this.filtersUpdated.emit([]);
374
- if (this.searchStore.selectedFilters.length > 0) {
375
- this.searchStore.setSelectedFilters([]);
376
- }
377
- }
378
- }
379
- this.query = state.query || '';
380
- this.isRequesting = state.isRequesting;
381
- 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;
382
- if ((_d = state.searchResults) === null || _d === void 0 ? void 0 : _d.data.facets) {
383
- this.populateFiltersFromFacets(state.searchResults.data.facets);
384
- }
385
- });
386
- }
387
- disconnectedCallback() {
388
- if (this.unsubscribe) {
389
- this.unsubscribe();
390
- }
391
- }
392
- populateFiltersFromFacets(facets) {
393
- var _a;
394
- const newFilters = flattenFacets(((_a = facets[0]) === null || _a === void 0 ? void 0 : _a.section) || []);
395
- const filtersMap = new Map();
396
- this.dynamicFilters.forEach((filter) => {
397
- const key = filter.value.split('/').pop() || '';
398
- filtersMap.set(key, filter);
399
- });
400
- newFilters.forEach((filter) => {
401
- const key = filter.value.split('/').pop() || '';
402
- const existingFilter = filtersMap.get(key);
403
- if (!existingFilter ||
404
- filter.value.length < existingFilter.value.length) {
405
- filtersMap.set(key, filter);
406
- }
407
- });
408
- this.dynamicFilters = Array.from(filtersMap.values());
409
- }
410
- deduplicatePaths(filters) {
411
- const pathMap = new Map();
412
- filters.forEach((path) => {
413
- const key = path.split('/').pop() || '';
414
- const existingPath = pathMap.get(key);
415
- if (!existingPath || path.length < existingPath.length) {
416
- pathMap.set(key, path);
417
- }
418
- });
419
- return Array.from(pathMap.values());
420
- }
421
- formatLabel(label) {
422
- return label
423
- .replace(/-/g, ' ')
424
- .split(' ')
425
- .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
426
- .join(' ');
427
- }
428
- render() {
429
- if (!this.query || this.resultsCount === 0) {
430
- return null;
431
- }
432
- const filtersToRender = this.dynamicFilters.filter((filter) => !filter.value.includes('/', filter.value.indexOf('/') + 1));
433
- return (h("div", { class: 'filtersList' }, filtersToRender.map((filter) => {
434
- const isChecked = this.selectedFilters.has(filter.value);
435
- const children = this.dynamicFilters.filter((child) => child.value.startsWith(`${filter.value}/`) &&
436
- child.value !== filter.value);
437
- 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' }), h("div", { class: 'checkContainer' }, h("searchcraft-check-icon", null)), this.formatLabel(filter.label)), children.map((child) => {
438
- const isChildChecked = this.selectedFilters.has(child.value);
439
- 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' }), h("div", { class: 'checkContainer' }, h("searchcraft-check-icon", null)), this.formatLabel(child.label.split('/').pop() || '')));
440
- })));
441
- })));
442
- }
443
- };
444
- SearchcraftFiltersList.style = SearchcraftFiltersListStyle0;
445
-
446
- 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%}";
447
- const SearchcraftInputStyle0 = searchcraftInputModuleCss;
448
-
449
- const SearchcraftInput = class {
450
- constructor(hostRef) {
451
- registerInstance(this, hostRef);
452
- this.clearInput = createEvent(this, "clearInput", 7);
453
- this.searchInputChange = createEvent(this, "searchInputChange", 7);
454
- this.inputKeyUp = createEvent(this, "inputKeyUp", 7);
455
- this.customStyles = {};
456
- this.error = false;
457
- this.formClassName = '';
458
- this.inputCaptionClassName = '';
459
- this.inputCaptionValue = '';
460
- this.inputClassName = '';
461
- this.inputIconHeight = 20;
462
- this.inputIconWidth = 20;
463
- this.isRequesting = false;
464
- this.placeholderValue = 'Enter Search';
465
- this.rightToLeftOrientation = false;
466
- this.query = '';
467
- this.theme = 'light';
468
- }
469
- get isLightTheme() {
470
- return this.theme === 'light';
471
- }
472
- handleInputChange(event) {
473
- const input = event.target;
474
- this.searchInputChange.emit(input.value);
475
- }
476
- handleInputKeyUp(event) {
477
- const input = event.target;
478
- this.inputKeyUp.emit(input.value);
479
- }
480
- handleClearInput() {
481
- if (this.clearInput) {
482
- this.clearInput.emit();
483
- }
484
- }
485
- render() {
486
- const containerClassName = this.rightToLeftOrientation
487
- ? 'inputContainerRTL'
488
- : 'inputContainerLTR';
489
- const inputClassName = classNames(this.error
490
- ? this.isLightTheme
491
- ? 'inputErrorLightRTL'
492
- : 'inputErrorDarkRTL'
493
- : this.isLightTheme
494
- ? 'inputLightLTR'
495
- : 'inputDarkLTR', 'searchcraft-input');
496
- const validatedCustomStyles = parseCustomStyles(this.customStyles);
497
- const placeholderStyle = {
498
- fontSize: validatedCustomStyles.placeholderFontSize || '16px',
499
- };
500
- return (h("div", { key: '3c655e3572de20f333b75f85e45cc957ac0bc006', 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, `
501
- #searchcraft-input-id::placeholder {
502
- font-size: ${placeholderStyle.fontSize};
503
- }
504
- `), 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, `
505
- #searchcraft-input-id::placeholder {
506
- font-size: ${placeholderStyle.fontSize};
507
- }
508
- `), 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 }))))));
509
- }
510
- };
511
- SearchcraftInput.style = SearchcraftInputStyle0;
512
-
513
- 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}";
514
- const SearchcraftInputCaptionStyle0 = searchcraftInputCaptionModuleCss;
515
-
516
- const SearchcraftInputCaption = class {
517
- constructor(hostRef) {
518
- registerInstance(this, hostRef);
519
- this.error = undefined;
520
- this.inputCaptionClassName = '';
521
- this.inputCaptionValue = 'Enter Search';
522
- this.rightToLeftOrientation = false;
523
- this.theme = 'light';
524
- }
525
- isLightTheme() {
526
- return this.theme === 'light';
527
- }
528
- render() {
529
- return this.rightToLeftOrientation ? (h("p", { class: classNames(this.error
530
- ? this.isLightTheme
531
- ? 'inputCaptionErrorLightRTL'
532
- : 'inputCaptionErrorDarkRTL'
533
- : this.isLightTheme
534
- ? 'inputCaptionLightRTL'
535
- : 'inputCaptionDarkRTL', this.inputCaptionClassName, '.searchcraft-input-caption') }, this.inputCaptionValue)) : (h("p", { class: classNames(this.error
536
- ? this.isLightTheme
537
- ? 'inputCaptionErrorLightLTR'
538
- : 'inputCaptionErrorDarkLTR'
539
- : this.isLightTheme
540
- ? 'inputCaptionLightLTR'
541
- : 'inputCaptionDarkLTR', this.inputCaptionClassName, '.searchcraft-input-caption') }, this.inputCaptionValue));
542
- }
543
- };
544
- SearchcraftInputCaption.style = SearchcraftInputCaptionStyle0;
545
-
546
- 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%)}";
547
- const SearchcraftInputIconStyle0 = searchcraftInputIconModuleCss;
548
-
549
- const SearchcraftInputIcon = class {
550
- constructor(hostRef) {
551
- registerInstance(this, hostRef);
552
- this.error = undefined;
553
- this.height = 20;
554
- this.rightToLeftOrientation = false;
555
- this.width = 20;
556
- this.theme = 'light';
557
- }
558
- isLightTheme() {
559
- return this.theme === 'light';
560
- }
561
- render() {
562
- 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 }))));
563
- }
564
- };
565
- SearchcraftInputIcon.style = SearchcraftInputIconStyle0;
566
-
567
- 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}";
568
- const SearchcraftInputLabelStyle0 = searchcraftInputLabelModuleCss;
569
-
570
- const SearchcraftInputLabel = class {
571
- constructor(hostRef) {
572
- registerInstance(this, hostRef);
573
- this.inputLabelClassName = '';
574
- this.label = undefined;
575
- this.theme = 'light';
576
- }
577
- isLightTheme() {
578
- return this.theme === 'light';
579
- }
580
- render() {
581
- if (!this.label) {
582
- return null;
583
- }
584
- const labelStyle = this.isLightTheme() ? 'labelLight' : 'labelDark';
585
- return (h("label", { class: classNames(labelStyle, this.inputLabelClassName), htmlFor: 'searchcraft-input-id' }, this.label));
586
- }
587
- };
588
- SearchcraftInputLabel.style = SearchcraftInputLabelStyle0;
589
-
590
- 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}";
591
- const SearchcraftResultsInfoStyle0 = searchcraftResultsInfoModuleCss;
592
-
593
- const SearchcraftResultsInfo = class {
594
- constructor(hostRef) {
595
- registerInstance(this, hostRef);
596
- this.isRequesting = false;
597
- this.resultsCount = 0;
598
- this.responseTime = '';
599
- this.query = '';
600
- }
601
- connectedCallback() {
602
- this.unsubscribe = useSearchcraftStore.subscribe((state) => {
603
- var _a, _b, _c, _d;
604
- this.isRequesting = state.isRequesting;
605
- this.resultsCount = ((_b = (_a = state.searchResults) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.count) || 0;
606
- 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);
607
- this.query = state.query || ''; // Update query from store
608
- });
609
- }
610
- disconnectedCallback() {
611
- if (this.unsubscribe) {
612
- this.unsubscribe();
613
- }
614
- }
615
- render() {
616
- if (!this.query || this.resultsCount === 0) {
617
- return null;
618
- }
619
- return (h("div", { class: 'container' }, h("p", { class: 'resultsInfo' }, this.resultsCount, " results found in ", this.responseTime, "ms")));
620
- }
621
- };
622
- SearchcraftResultsInfo.style = SearchcraftResultsInfoStyle0;
623
-
624
- const SearchcraftSearchIconSet = class {
625
- constructor(hostRef) {
626
- registerInstance(this, hostRef);
627
- this.type = 'search-dark';
628
- this.width = 20;
629
- this.height = 20;
630
- }
631
- render() {
632
- const { width, height } = this;
633
- switch (this.type) {
634
- case 'search-light':
635
- 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' })));
636
- case 'search-dark':
637
- 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' })));
638
- case 'error-light':
639
- 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' })));
640
- case 'error-dark':
641
- 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' })));
642
- default:
643
- return null;
644
- }
645
- }
646
- };
647
-
648
- 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}";
649
- const SearchcraftSliderStyle0 = searchcraftSliderModuleCss;
650
-
651
- const SearchcraftSlider = class {
652
- constructor(hostRef) {
653
- registerInstance(this, hostRef);
654
- this.searchStore = useSearchcraftStore.getState();
655
- this.updateYears = async () => {
656
- this.searchStore.setYearsRange([this.startYear, this.endYear]);
657
- try {
658
- if (typeof this.query === 'string' && this.query.trim() !== '') {
659
- await this.searchStore.search();
660
- }
661
- else {
662
- console.warn('Query is missing or empty, skipping search request.');
663
- }
664
- }
665
- catch (error) {
666
- console.error('Search failed:', error);
667
- }
668
- };
669
- this.handleStartYearChange = (event) => {
670
- const value = Number.parseInt(event.target.value, 10);
671
- this.startYear = Math.min(value, this.endYear);
672
- this.updateYears();
673
- };
674
- this.handleEndYearChange = (event) => {
675
- const value = Number.parseInt(event.target.value, 10);
676
- this.endYear = Math.max(value, this.startYear);
677
- this.updateYears();
678
- };
679
- this.maxYear = new Date().getFullYear();
680
- this.minYear = 2014;
681
- this.endYear = this.maxYear;
682
- this.hasSearched = false;
683
- this.query = '';
684
- this.resultsCount = 0;
685
- this.startYear = this.minYear;
686
- }
687
- componentDidLoad() {
688
- this.unsubscribe = useSearchcraftStore.subscribe((state) => {
689
- var _a, _b, _c;
690
- if (state.query.length > 0) {
691
- this.hasSearched = true;
692
- 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;
693
- }
694
- this.query = state.query;
695
- });
696
- }
697
- disconnectedCallback() {
698
- if (this.unsubscribe) {
699
- this.unsubscribe();
700
- }
701
- }
702
- render() {
703
- if (!this.query || this.resultsCount === 0) {
704
- return null;
705
- }
706
- const rangeMin = this.minYear;
707
- const rangeMax = this.maxYear;
708
- const startPercent = ((this.startYear - rangeMin) / (rangeMax - rangeMin)) * 100;
709
- const endPercent = ((this.endYear - rangeMin) / (rangeMax - rangeMin)) * 100;
710
- return (h("div", { class: 'sliderContainer' }, h("div", { class: 'rangeContainer' }, h("div", { class: 'activeRange', style: {
711
- left: `${startPercent}%`,
712
- width: `${endPercent - startPercent}%`,
713
- } }), 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))));
714
- }
715
- };
716
- SearchcraftSlider.style = SearchcraftSliderStyle0;
717
-
718
- 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)}}";
719
- const SearchcraftSpinnerDarkStyle0 = searchcraftSpinnerDarkModuleCss;
720
-
721
- const SearchcraftSpinnerDark = class {
722
- constructor(hostRef) {
723
- registerInstance(this, hostRef);
724
- }
725
- render() {
726
- return (h("div", { key: 'fbbd8b46026e1c1c83b59efd68a5cecdca7cad59', class: 'spinnerContainer' }, h("div", { key: '7fb274ca3ed3d9b69eef7faa77413b1e1fe68ef5', class: 'spinnerDark' })));
727
- }
728
- };
729
- SearchcraftSpinnerDark.style = SearchcraftSpinnerDarkStyle0;
730
-
731
- 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)}}";
732
- const SearchcraftSpinnerLightStyle0 = searchcraftSpinnerLightModuleCss;
733
-
734
- const SearchcraftSpinnerLight = class {
735
- constructor(hostRef) {
736
- registerInstance(this, hostRef);
737
- }
738
- render() {
739
- return (h("div", { key: '5f8d9dbe616324b466436037581491efff818065', class: 'spinnerContainer' }, h("div", { key: '8152d98d48ac5a4a55c49048a385301238b54932', class: 'spinnerLight' })));
740
- }
741
- };
742
- SearchcraftSpinnerLight.style = SearchcraftSpinnerLightStyle0;
743
-
744
- 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)}";
745
- const SearchcraftToggleButtonStyle0 = searchcraftToggleButtonModuleCss;
746
-
747
- const SearchcraftToggleButton = class {
748
- constructor(hostRef) {
749
- registerInstance(this, hostRef);
750
- this.searchStore = useSearchcraftStore.getState();
751
- this.handleToggle = async () => {
752
- this.isActive = !this.isActive;
753
- if (this.type === 'mode') {
754
- const mode = this.isActive ? 'normal' : 'fuzzy';
755
- this.searchStore.setSearchParams({
756
- mode,
757
- });
758
- }
759
- else if (this.type === 'sort') {
760
- const sort = this.isActive ? 'desc' : 'asc';
761
- this.searchStore.setSearchParams({
762
- sort,
763
- });
764
- }
765
- try {
766
- await this.searchStore.search();
767
- }
768
- catch (error) {
769
- console.error('Search failed:', error);
770
- }
771
- };
772
- this.type = 'mode';
773
- this.isActive = false;
774
- this.query = '';
775
- this.resultsCount = 0;
776
- }
777
- componentDidLoad() {
778
- this.unsubscribe = useSearchcraftStore.subscribe((state) => {
779
- var _a, _b, _c;
780
- this.query = state.query || '';
781
- 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;
782
- });
783
- }
784
- disconnectedCallback() {
785
- if (this.unsubscribe) {
786
- this.unsubscribe();
787
- }
788
- }
789
- render() {
790
- if (!this.query || this.resultsCount === 0) {
791
- return null;
792
- }
793
- return (h("button", { class: `toggle-wrapper ${this.isActive ? 'active' : ''}`, onClick: this.handleToggle, type: 'button' }, h("div", { class: `toggle-switch ${this.isActive ? 'active' : ''}` })));
794
- }
795
- };
796
- SearchcraftToggleButton.style = SearchcraftToggleButtonStyle0;
797
-
798
- export { SearchcraftAutoSearchForm as searchcraft_auto_search_form, SearchcraftBaseSearchResult as searchcraft_base_search_result, SearchcraftBaseSearchResults as searchcraft_base_search_results, SearchcraftCheckIcon as searchcraft_check_icon, 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 };
799
-
800
- //# sourceMappingURL=searchcraft-auto-search-form_18.entry.js.map