@searchcraft/javascript-sdk 0.5.3 → 0.6.0

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 (314) hide show
  1. package/dist/cjs/{index-b76bece0.js → index-b3b77ea2.js} +2 -1
  2. package/dist/cjs/index-b3b77ea2.js.map +1 -0
  3. package/dist/cjs/index.cjs.js +4 -4
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/cjs/searchcraft-base-search-result.cjs.entry.js +3 -3
  6. package/dist/cjs/searchcraft-base-search-result.cjs.entry.js.map +1 -1
  7. package/dist/cjs/searchcraft-base-search-results.cjs.entry.js +13 -12
  8. package/dist/cjs/searchcraft-base-search-results.cjs.entry.js.map +1 -1
  9. package/dist/cjs/searchcraft-button_3.cjs.entry.js +63 -0
  10. package/dist/cjs/searchcraft-button_3.cjs.entry.js.map +1 -0
  11. package/dist/cjs/searchcraft-facet-list_3.cjs.entry.js +140 -14
  12. package/dist/cjs/searchcraft-facet-list_3.cjs.entry.js.map +1 -1
  13. package/dist/cjs/searchcraft-filter-panel.cjs.entry.js +7 -7
  14. package/dist/cjs/searchcraft-filter-panel.cjs.entry.js.map +1 -1
  15. package/dist/cjs/searchcraft-input-form_2.cjs.entry.js +227 -0
  16. package/dist/cjs/searchcraft-input-form_2.cjs.entry.js.map +1 -0
  17. package/dist/cjs/searchcraft-javascript-sdk.cjs.js +2 -2
  18. package/dist/cjs/searchcraft-popover-button.cjs.entry.js +26 -0
  19. package/dist/cjs/searchcraft-popover-button.cjs.entry.js.map +1 -0
  20. package/dist/cjs/searchcraft-popover-form.cjs.entry.js +197 -3
  21. package/dist/cjs/searchcraft-popover-form.cjs.entry.js.map +1 -1
  22. package/dist/cjs/searchcraft-popover-list-item.cjs.entry.js +32 -0
  23. package/dist/cjs/searchcraft-popover-list-item.cjs.entry.js.map +1 -0
  24. package/dist/cjs/searchcraft-results-info.cjs.entry.js +5 -5
  25. package/dist/cjs/searchcraft-results-info.cjs.entry.js.map +1 -1
  26. package/dist/cjs/{store-943576b0.js → store-d7ebcf7a.js} +280 -267
  27. package/dist/cjs/store-d7ebcf7a.js.map +1 -0
  28. package/dist/cjs/styles-7b2d06f2.js +28 -0
  29. package/dist/cjs/styles-7b2d06f2.js.map +1 -0
  30. package/dist/cjs/units-fe4d8083.js +88 -0
  31. package/dist/cjs/units-fe4d8083.js.map +1 -0
  32. package/dist/collection/collection-manifest.json +2 -1
  33. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js +21 -16
  34. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js.map +1 -1
  35. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.module.css +54 -4
  36. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js +45 -13
  37. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js.map +1 -1
  38. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.module.css +52 -2
  39. package/dist/collection/components/searchcraft-button/searchcraft-button.js +11 -6
  40. package/dist/collection/components/searchcraft-button/searchcraft-button.js.map +1 -1
  41. package/dist/collection/components/searchcraft-button/searchcraft-button.module.css +52 -2
  42. package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js +11 -2
  43. package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js.map +1 -1
  44. package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.module.css +52 -2
  45. package/dist/collection/components/searchcraft-facet-list/searchcraft-facet-list.js +23 -4
  46. package/dist/collection/components/searchcraft-facet-list/searchcraft-facet-list.js.map +1 -1
  47. package/dist/collection/components/searchcraft-facet-list/searchcraft-facet-list.module.css +52 -2
  48. package/dist/collection/components/searchcraft-filter-panel/searchcraft-filter-panel.js +13 -4
  49. package/dist/collection/components/searchcraft-filter-panel/searchcraft-filter-panel.js.map +1 -1
  50. package/dist/collection/components/searchcraft-filter-panel/searchcraft-filter-panel.module.css +52 -2
  51. package/dist/collection/components/searchcraft-input-form/searchcraft-input-form.js +66 -49
  52. package/dist/collection/components/searchcraft-input-form/searchcraft-input-form.js.map +1 -1
  53. package/dist/collection/components/searchcraft-input-form/searchcraft-input-form.module.css +56 -6
  54. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js +12 -6
  55. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js.map +1 -1
  56. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.module.css +52 -2
  57. package/dist/collection/components/searchcraft-popover-button/searchcraft-popover-button.js +25 -0
  58. package/dist/collection/components/searchcraft-popover-button/searchcraft-popover-button.js.map +1 -0
  59. package/dist/collection/components/searchcraft-popover-form/searchcraft-popover-form.js +278 -5
  60. package/dist/collection/components/searchcraft-popover-form/searchcraft-popover-form.js.map +1 -1
  61. package/dist/collection/components/searchcraft-popover-form/searchcraft-popover-form.module.css +322 -0
  62. package/dist/collection/components/searchcraft-popover-list-item/searchcraft-popover-list-item.js +139 -0
  63. package/dist/collection/components/searchcraft-popover-list-item/searchcraft-popover-list-item.js.map +1 -0
  64. package/dist/collection/components/searchcraft-popover-list-item/searchcraft-popover-list-item.module.css +209 -0
  65. package/dist/collection/components/searchcraft-popover-list-view/searchcraft-popover-list-view.js +47 -6
  66. package/dist/collection/components/searchcraft-popover-list-view/searchcraft-popover-list-view.js.map +1 -1
  67. package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.js +11 -1
  68. package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.js.map +1 -1
  69. package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.module.css +53 -3
  70. package/dist/collection/components/searchcraft-slider/searchcraft-slider.js +13 -8
  71. package/dist/collection/components/searchcraft-slider/searchcraft-slider.js.map +1 -1
  72. package/dist/collection/components/searchcraft-slider/searchcraft-slider.module.css +52 -2
  73. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js +9 -5
  74. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js.map +1 -1
  75. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.module.css +52 -2
  76. package/dist/collection/index.js +1 -1
  77. package/dist/collection/index.js.map +1 -1
  78. package/dist/collection/provider/store.js +14 -15
  79. package/dist/collection/provider/store.js.map +1 -1
  80. package/dist/collection/types/_shared.types.js +2 -0
  81. package/dist/collection/types/_shared.types.js.map +1 -0
  82. package/dist/collection/types/index.js +1 -0
  83. package/dist/collection/types/index.js.map +1 -1
  84. package/dist/collection/types/searchcraft-base-search-results.types.js.map +1 -1
  85. package/dist/collection/types/searchcraft-popover-form.types.js.map +1 -1
  86. package/dist/collection/utils/{utils.js → facets.js} +7 -105
  87. package/dist/collection/utils/facets.js.map +1 -0
  88. package/dist/collection/utils/index.js +4 -0
  89. package/dist/collection/utils/index.js.map +1 -0
  90. package/dist/collection/utils/styles.js +22 -0
  91. package/dist/collection/utils/styles.js.map +1 -0
  92. package/dist/collection/utils/units.js +83 -0
  93. package/dist/collection/utils/units.js.map +1 -0
  94. package/dist/components/index.js +6 -4
  95. package/dist/components/index.js.map +1 -1
  96. package/dist/components/p-02a16e53.js +240 -0
  97. package/dist/components/p-02a16e53.js.map +1 -0
  98. package/dist/components/{p-cbdcf6df.js → p-04c46179.js} +3 -3
  99. package/dist/components/p-04c46179.js.map +1 -0
  100. package/dist/components/p-0e38a723.js +99 -0
  101. package/dist/components/p-0e38a723.js.map +1 -0
  102. package/dist/components/p-4c45ef80.js +67 -0
  103. package/dist/components/p-4c45ef80.js.map +1 -0
  104. package/dist/components/p-755f491b.js +84 -0
  105. package/dist/components/p-755f491b.js.map +1 -0
  106. package/dist/components/p-85765b81.js +56 -0
  107. package/dist/components/p-85765b81.js.map +1 -0
  108. package/dist/components/p-953f4238.js +35 -0
  109. package/dist/components/p-953f4238.js.map +1 -0
  110. package/dist/components/p-a248ad69.js +276 -0
  111. package/dist/components/p-a248ad69.js.map +1 -0
  112. package/dist/components/p-a9bd1872.js +38 -0
  113. package/dist/components/p-a9bd1872.js.map +1 -0
  114. package/dist/components/p-cf4ced92.js +49 -0
  115. package/dist/components/p-cf4ced92.js.map +1 -0
  116. package/dist/components/{p-ad4ebde0.js → p-d6a88eed.js} +280 -267
  117. package/dist/components/p-d6a88eed.js.map +1 -0
  118. package/dist/components/p-d9551738.js +25 -0
  119. package/dist/components/p-d9551738.js.map +1 -0
  120. package/dist/components/p-f9d778b3.js +48 -0
  121. package/dist/components/p-f9d778b3.js.map +1 -0
  122. package/dist/components/searchcraft-base-search-result.js +1 -1
  123. package/dist/components/searchcraft-base-search-results.js +6 -5
  124. package/dist/components/searchcraft-base-search-results.js.map +1 -1
  125. package/dist/components/searchcraft-button.js +1 -1
  126. package/dist/components/searchcraft-error-message.js +1 -1
  127. package/dist/components/searchcraft-facet-list.js +1 -1
  128. package/dist/components/searchcraft-filter-panel.js +8 -8
  129. package/dist/components/searchcraft-filter-panel.js.map +1 -1
  130. package/dist/components/searchcraft-input-form.js +1 -241
  131. package/dist/components/searchcraft-input-form.js.map +1 -1
  132. package/dist/components/searchcraft-input-label.js +1 -1
  133. package/dist/components/searchcraft-popover-button.d.ts +11 -0
  134. package/dist/components/searchcraft-popover-button.js +39 -0
  135. package/dist/components/searchcraft-popover-button.js.map +1 -0
  136. package/dist/components/searchcraft-popover-form.js +245 -5
  137. package/dist/components/searchcraft-popover-form.js.map +1 -1
  138. package/dist/components/searchcraft-popover-list-item.d.ts +11 -0
  139. package/dist/components/searchcraft-popover-list-item.js +8 -0
  140. package/dist/components/searchcraft-popover-list-item.js.map +1 -0
  141. package/dist/components/searchcraft-popover-list-view.js +1 -1
  142. package/dist/components/searchcraft-results-info.js +3 -3
  143. package/dist/components/searchcraft-results-info.js.map +1 -1
  144. package/dist/components/searchcraft-slider.js +1 -1
  145. package/dist/components/searchcraft-toggle-button.js +1 -1
  146. package/dist/esm/{index-be042742.js → index-11551663.js} +2 -2
  147. package/dist/esm/index-11551663.js.map +1 -0
  148. package/dist/esm/index.js +2 -2
  149. package/dist/esm/loader.js +3 -3
  150. package/dist/esm/searchcraft-base-search-result.entry.js +3 -3
  151. package/dist/esm/searchcraft-base-search-result.entry.js.map +1 -1
  152. package/dist/esm/searchcraft-base-search-results.entry.js +5 -4
  153. package/dist/esm/searchcraft-base-search-results.entry.js.map +1 -1
  154. package/dist/esm/searchcraft-button_3.entry.js +57 -0
  155. package/dist/esm/searchcraft-button_3.entry.js.map +1 -0
  156. package/dist/esm/searchcraft-facet-list_3.entry.js +137 -11
  157. package/dist/esm/searchcraft-facet-list_3.entry.js.map +1 -1
  158. package/dist/esm/searchcraft-filter-panel.entry.js +6 -6
  159. package/dist/esm/searchcraft-filter-panel.entry.js.map +1 -1
  160. package/dist/esm/searchcraft-input-form_2.entry.js +222 -0
  161. package/dist/esm/searchcraft-input-form_2.entry.js.map +1 -0
  162. package/dist/esm/searchcraft-javascript-sdk.js +3 -3
  163. package/dist/esm/searchcraft-popover-button.entry.js +22 -0
  164. package/dist/esm/searchcraft-popover-button.entry.js.map +1 -0
  165. package/dist/esm/searchcraft-popover-form.entry.js +197 -3
  166. package/dist/esm/searchcraft-popover-form.entry.js.map +1 -1
  167. package/dist/esm/searchcraft-popover-list-item.entry.js +28 -0
  168. package/dist/esm/searchcraft-popover-list-item.entry.js.map +1 -0
  169. package/dist/esm/searchcraft-results-info.entry.js +4 -4
  170. package/dist/esm/searchcraft-results-info.entry.js.map +1 -1
  171. package/dist/esm/{store-eb4269d6.js → store-1058f7b0.js} +280 -267
  172. package/dist/esm/store-1058f7b0.js.map +1 -0
  173. package/dist/esm/styles-961644ef.js +25 -0
  174. package/dist/esm/styles-961644ef.js.map +1 -0
  175. package/dist/esm/units-b6eba560.js +84 -0
  176. package/dist/esm/units-b6eba560.js.map +1 -0
  177. package/dist/searchcraft-javascript-sdk/index.esm.js +1 -1
  178. package/dist/searchcraft-javascript-sdk/p-4580e8a4.entry.js +2 -0
  179. package/dist/searchcraft-javascript-sdk/p-4580e8a4.entry.js.map +1 -0
  180. package/dist/searchcraft-javascript-sdk/p-7049b93d.entry.js +2 -0
  181. package/dist/searchcraft-javascript-sdk/p-7049b93d.entry.js.map +1 -0
  182. package/dist/searchcraft-javascript-sdk/p-755f491b.js +2 -0
  183. package/dist/searchcraft-javascript-sdk/p-755f491b.js.map +1 -0
  184. package/dist/searchcraft-javascript-sdk/p-8e539d62.entry.js +2 -0
  185. package/dist/searchcraft-javascript-sdk/p-8e539d62.entry.js.map +1 -0
  186. package/dist/searchcraft-javascript-sdk/p-98640a6a.entry.js +2 -0
  187. package/dist/searchcraft-javascript-sdk/p-98640a6a.entry.js.map +1 -0
  188. package/dist/searchcraft-javascript-sdk/p-9d0f5c89.entry.js +2 -0
  189. package/dist/searchcraft-javascript-sdk/p-9d0f5c89.entry.js.map +1 -0
  190. package/dist/searchcraft-javascript-sdk/p-b8bd53ce.entry.js +2 -0
  191. package/dist/searchcraft-javascript-sdk/p-b8bd53ce.entry.js.map +1 -0
  192. package/dist/searchcraft-javascript-sdk/p-c27a3673.entry.js +2 -0
  193. package/dist/searchcraft-javascript-sdk/p-c27a3673.entry.js.map +1 -0
  194. package/dist/searchcraft-javascript-sdk/p-cd852b84.entry.js +2 -0
  195. package/dist/searchcraft-javascript-sdk/p-cd852b84.entry.js.map +1 -0
  196. package/dist/searchcraft-javascript-sdk/p-d6a88eed.js +11 -0
  197. package/dist/searchcraft-javascript-sdk/p-d6a88eed.js.map +1 -0
  198. package/dist/searchcraft-javascript-sdk/p-d9551738.js +2 -0
  199. package/dist/searchcraft-javascript-sdk/p-d9551738.js.map +1 -0
  200. package/dist/searchcraft-javascript-sdk/p-e042deb9.entry.js +2 -0
  201. package/dist/searchcraft-javascript-sdk/p-e042deb9.entry.js.map +1 -0
  202. package/dist/searchcraft-javascript-sdk/{p-d7d0b88c.js → p-e0be53df.js} +2 -2
  203. package/dist/searchcraft-javascript-sdk/{p-d7d0b88c.js.map → p-e0be53df.js.map} +1 -1
  204. package/dist/searchcraft-javascript-sdk/p-efab9f3c.entry.js +2 -0
  205. package/dist/searchcraft-javascript-sdk/p-efab9f3c.entry.js.map +1 -0
  206. package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js +1 -1
  207. package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js.map +1 -1
  208. package/dist/types/components/searchcraft-base-search-result/searchcraft-base-search-result.d.ts +53 -0
  209. package/dist/types/components/searchcraft-base-search-results/searchcraft-base-search-results.d.ts +68 -0
  210. package/dist/types/components/searchcraft-button/searchcraft-button.d.ts +20 -0
  211. package/dist/types/components/searchcraft-error-message/searchcraft-error-message.d.ts +12 -0
  212. package/dist/types/components/searchcraft-facet-list/searchcraft-facet-list.d.ts +25 -0
  213. package/dist/types/components/searchcraft-filter-panel/searchcraft-filter-panel.d.ts +12 -0
  214. package/dist/types/components/searchcraft-input-form/searchcraft-input-form.d.ts +37 -13
  215. package/dist/types/components/searchcraft-input-label/searchcraft-input-label.d.ts +13 -1
  216. package/dist/types/components/searchcraft-popover-button/searchcraft-popover-button.d.ts +7 -0
  217. package/dist/types/components/searchcraft-popover-form/searchcraft-popover-form.d.ts +97 -1
  218. package/dist/types/components/searchcraft-popover-list-item/searchcraft-popover-list-item.d.ts +22 -0
  219. package/dist/types/components/searchcraft-popover-list-view/searchcraft-popover-list-view.d.ts +19 -3
  220. package/dist/types/components/searchcraft-results-info/searchcraft-results-info.d.ts +10 -0
  221. package/dist/types/components/searchcraft-slider/searchcraft-slider.d.ts +18 -0
  222. package/dist/types/components/searchcraft-toggle-button/searchcraft-toggle-button.d.ts +11 -3
  223. package/dist/types/components.d.ts +1023 -30
  224. package/dist/types/index.d.ts +1 -1
  225. package/dist/types/provider/store.d.ts +4 -2
  226. package/dist/types/types/_shared.types.d.ts +45 -0
  227. package/dist/types/types/index.d.ts +1 -0
  228. package/dist/types/types/searchcraft-base-search-results.types.d.ts +1 -8
  229. package/dist/types/types/searchcraft-popover-form.types.d.ts +2 -1
  230. package/dist/types/utils/facets.d.ts +6 -0
  231. package/dist/types/utils/index.d.ts +3 -0
  232. package/dist/types/utils/styles.d.ts +2 -0
  233. package/dist/types/utils/{utils.d.ts → units.d.ts} +12 -19
  234. package/package.json +7 -4
  235. package/dist/cjs/index-b76bece0.js.map +0 -1
  236. package/dist/cjs/searchcraft-button_2.cjs.entry.js +0 -51
  237. package/dist/cjs/searchcraft-button_2.cjs.entry.js.map +0 -1
  238. package/dist/cjs/searchcraft-error-message.cjs.entry.js +0 -23
  239. package/dist/cjs/searchcraft-error-message.cjs.entry.js.map +0 -1
  240. package/dist/cjs/searchcraft-input-form.cjs.entry.js +0 -202
  241. package/dist/cjs/searchcraft-input-form.cjs.entry.js.map +0 -1
  242. package/dist/cjs/searchcraft-popover-list-view.cjs.entry.js +0 -26
  243. package/dist/cjs/searchcraft-popover-list-view.cjs.entry.js.map +0 -1
  244. package/dist/cjs/searchcraft-popover-result.cjs.entry.js +0 -25
  245. package/dist/cjs/searchcraft-popover-result.cjs.entry.js.map +0 -1
  246. package/dist/cjs/store-943576b0.js.map +0 -1
  247. package/dist/cjs/utils-a17279a2.js +0 -226
  248. package/dist/cjs/utils-a17279a2.js.map +0 -1
  249. package/dist/collection/components/searchcraft-popover-result/searchcraft-popover-result.js +0 -21
  250. package/dist/collection/components/searchcraft-popover-result/searchcraft-popover-result.js.map +0 -1
  251. package/dist/collection/utils/utils.js.map +0 -1
  252. package/dist/components/p-16983367.js +0 -35
  253. package/dist/components/p-16983367.js.map +0 -1
  254. package/dist/components/p-42bfef5f.js +0 -151
  255. package/dist/components/p-42bfef5f.js.map +0 -1
  256. package/dist/components/p-5380505b.js +0 -99
  257. package/dist/components/p-5380505b.js.map +0 -1
  258. package/dist/components/p-672354c0.js +0 -38
  259. package/dist/components/p-672354c0.js.map +0 -1
  260. package/dist/components/p-9cb3d38b.js +0 -48
  261. package/dist/components/p-9cb3d38b.js.map +0 -1
  262. package/dist/components/p-a23d2994.js +0 -67
  263. package/dist/components/p-a23d2994.js.map +0 -1
  264. package/dist/components/p-ad4ebde0.js.map +0 -1
  265. package/dist/components/p-bd5fede3.js +0 -41
  266. package/dist/components/p-bd5fede3.js.map +0 -1
  267. package/dist/components/p-cbdcf6df.js.map +0 -1
  268. package/dist/components/p-f308d05d.js +0 -218
  269. package/dist/components/p-f308d05d.js.map +0 -1
  270. package/dist/components/searchcraft-popover-result.d.ts +0 -11
  271. package/dist/components/searchcraft-popover-result.js +0 -38
  272. package/dist/components/searchcraft-popover-result.js.map +0 -1
  273. package/dist/esm/index-be042742.js.map +0 -1
  274. package/dist/esm/searchcraft-button_2.entry.js +0 -46
  275. package/dist/esm/searchcraft-button_2.entry.js.map +0 -1
  276. package/dist/esm/searchcraft-error-message.entry.js +0 -19
  277. package/dist/esm/searchcraft-error-message.entry.js.map +0 -1
  278. package/dist/esm/searchcraft-input-form.entry.js +0 -198
  279. package/dist/esm/searchcraft-input-form.entry.js.map +0 -1
  280. package/dist/esm/searchcraft-popover-list-view.entry.js +0 -22
  281. package/dist/esm/searchcraft-popover-list-view.entry.js.map +0 -1
  282. package/dist/esm/searchcraft-popover-result.entry.js +0 -21
  283. package/dist/esm/searchcraft-popover-result.entry.js.map +0 -1
  284. package/dist/esm/store-eb4269d6.js.map +0 -1
  285. package/dist/esm/utils-c2ce411f.js +0 -218
  286. package/dist/esm/utils-c2ce411f.js.map +0 -1
  287. package/dist/searchcraft-javascript-sdk/p-04300412.entry.js +0 -2
  288. package/dist/searchcraft-javascript-sdk/p-04300412.entry.js.map +0 -1
  289. package/dist/searchcraft-javascript-sdk/p-09c7fbef.entry.js +0 -2
  290. package/dist/searchcraft-javascript-sdk/p-09c7fbef.entry.js.map +0 -1
  291. package/dist/searchcraft-javascript-sdk/p-32068485.entry.js +0 -2
  292. package/dist/searchcraft-javascript-sdk/p-32068485.entry.js.map +0 -1
  293. package/dist/searchcraft-javascript-sdk/p-4d3682a8.entry.js +0 -2
  294. package/dist/searchcraft-javascript-sdk/p-4d3682a8.entry.js.map +0 -1
  295. package/dist/searchcraft-javascript-sdk/p-61cf9d6c.entry.js +0 -2
  296. package/dist/searchcraft-javascript-sdk/p-61cf9d6c.entry.js.map +0 -1
  297. package/dist/searchcraft-javascript-sdk/p-93b92b65.entry.js +0 -2
  298. package/dist/searchcraft-javascript-sdk/p-93b92b65.entry.js.map +0 -1
  299. package/dist/searchcraft-javascript-sdk/p-a7a7b4e0.entry.js +0 -2
  300. package/dist/searchcraft-javascript-sdk/p-a7a7b4e0.entry.js.map +0 -1
  301. package/dist/searchcraft-javascript-sdk/p-a810aeae.entry.js +0 -2
  302. package/dist/searchcraft-javascript-sdk/p-a810aeae.entry.js.map +0 -1
  303. package/dist/searchcraft-javascript-sdk/p-aa155194.entry.js +0 -2
  304. package/dist/searchcraft-javascript-sdk/p-aa155194.entry.js.map +0 -1
  305. package/dist/searchcraft-javascript-sdk/p-ad4ebde0.js +0 -11
  306. package/dist/searchcraft-javascript-sdk/p-ad4ebde0.js.map +0 -1
  307. package/dist/searchcraft-javascript-sdk/p-adadf38a.entry.js +0 -2
  308. package/dist/searchcraft-javascript-sdk/p-adadf38a.entry.js.map +0 -1
  309. package/dist/searchcraft-javascript-sdk/p-d57eba31.entry.js +0 -2
  310. package/dist/searchcraft-javascript-sdk/p-d57eba31.entry.js.map +0 -1
  311. package/dist/searchcraft-javascript-sdk/p-f308d05d.js +0 -2
  312. package/dist/searchcraft-javascript-sdk/p-f308d05d.js.map +0 -1
  313. package/dist/types/components/searchcraft-popover-result/searchcraft-popover-result.d.ts +0 -6
  314. /package/dist/collection/components/{searchcraft-popover-result/searchcraft-popover-result.module.css → searchcraft-popover-button/searchcraft-popover-button.module.css} +0 -0
@@ -1,218 +0,0 @@
1
- function parseCustomStyles(styles) {
2
- if (typeof styles === 'string') {
3
- try {
4
- return JSON.parse(styles);
5
- }
6
- catch (error) {
7
- console.error('Invalid customStyles format:', styles);
8
- return {};
9
- }
10
- }
11
- return styles || {};
12
- }
13
- function serializeStyles(styles) {
14
- try {
15
- return JSON.stringify(styles);
16
- }
17
- catch (error) {
18
- console.error('Error serializing styles:', error);
19
- return '{}';
20
- }
21
- }
22
- /**
23
- * Given a timestamp value, returns a formatted time string for the time
24
- * since now.
25
- *
26
- * @param timestamp
27
- * @returns {string} Formatted string value
28
- */
29
- function getFormattedTimeFromNow(timestamp) {
30
- const now = new Date();
31
- const inputTime = new Date(timestamp);
32
- const diffInSeconds = Math.floor((now.getTime() - inputTime.getTime()) / 1000);
33
- const minutes = Math.floor(diffInSeconds / 60);
34
- const hours = Math.floor(minutes / 60);
35
- const days = Math.floor(hours / 24);
36
- const years = Math.floor(days / 365);
37
- if (minutes < 60) {
38
- return `${minutes}m ago`;
39
- }
40
- if (hours < 24) {
41
- return `${hours}h ago`;
42
- }
43
- if (days < 365) {
44
- return `${days}d ago`;
45
- }
46
- return `${years}y ago`;
47
- }
48
- function formatNumberWithCommas(number) {
49
- return number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
50
- }
51
- function getMillis(unit) {
52
- const millisInHour = 60 * 60 * 1000;
53
- const millisInDay = 24 * millisInHour;
54
- const millisInMonth = 30 * millisInDay;
55
- const millisInYear = 365 * millisInDay;
56
- switch (unit) {
57
- case 'hour':
58
- return millisInHour;
59
- case 'day':
60
- return millisInDay;
61
- case 'month':
62
- return millisInMonth;
63
- case 'year':
64
- return millisInYear;
65
- default:
66
- return 3600000;
67
- }
68
- }
69
- /**
70
- * Given an array of facet paths, removes parent facet paths.
71
- */
72
- function removeSubstringMatches(arr) {
73
- return arr.filter((entry, index, array) => !array.some((otherEntry, otherIndex) => otherIndex !== index && otherEntry.includes(entry)));
74
- }
75
- /**
76
- * Given a document and a SearchResultMapping, return a mapped value from the document.
77
- *
78
- * @param document
79
- * @param {SearchResultMapping} mapping
80
- * @returns {string | undefined}
81
- */
82
- function getDocumentValueFromSearchResultMapping(document, mapping) {
83
- if (document && mapping) {
84
- return mapping.fieldNames
85
- .map((fieldNameDetails) => {
86
- let valueFound = document[fieldNameDetails.fieldName];
87
- if (valueFound && fieldNameDetails.dataType === 'date') {
88
- valueFound = getFormattedTimeFromNow(valueFound);
89
- }
90
- return valueFound;
91
- })
92
- .filter((value) => !!value)
93
- .join(mapping.delimiter || ' ');
94
- }
95
- }
96
- function deepMergeWithSpread(obj1, obj2) {
97
- const result = Object.assign({}, obj1);
98
- for (const key in obj2) {
99
- // biome-ignore lint/suspicious/noPrototypeBuiltins: <explanation>
100
- if (obj2.hasOwnProperty(key)) {
101
- if (obj2[key] instanceof Object && obj1[key] instanceof Object) {
102
- result[key] = deepMergeWithSpread(obj1[key], obj2[key]);
103
- }
104
- else {
105
- result[key] = obj2[key];
106
- }
107
- }
108
- }
109
- return result;
110
- }
111
- function facetToRecord(facet) {
112
- const records = {};
113
- const traverseAndAddToFragments = (facetChild) => {
114
- var _a;
115
- records[facetChild.path] = {
116
- count: facetChild.count,
117
- path: facetChild.path,
118
- };
119
- (_a = facetChild.children) === null || _a === void 0 ? void 0 : _a.forEach((child) => {
120
- traverseAndAddToFragments(child);
121
- });
122
- };
123
- traverseAndAddToFragments(facet);
124
- return records;
125
- }
126
- function recordToObject(record) {
127
- const root = {
128
- count: 0,
129
- path: '/',
130
- children: {},
131
- };
132
- Object.keys(record).forEach((key) => {
133
- const fragment = record[key];
134
- if (fragment.path === '/') {
135
- return;
136
- }
137
- const pathParts = fragment.path.substring(1).split('/');
138
- let currentRoot = root;
139
- let currentPath = '';
140
- pathParts.forEach((part, index) => {
141
- const nextPath = `${currentPath}/${part}`;
142
- if (!currentRoot.children[nextPath]) {
143
- currentRoot.children[nextPath] = {
144
- count: 0,
145
- path: nextPath,
146
- children: {},
147
- };
148
- }
149
- if (index === pathParts.length - 1) {
150
- currentRoot.children[nextPath].count = fragment.count;
151
- }
152
- currentPath = nextPath;
153
- currentRoot = currentRoot.children[nextPath];
154
- });
155
- });
156
- return root;
157
- }
158
- function objectToFacet(childObject) {
159
- const transformed = {
160
- count: childObject.count,
161
- path: childObject.path,
162
- children: [],
163
- };
164
- if (Object.keys(childObject.children).length > 0) {
165
- transformed.children = Object.values(childObject.children).map((subChildObject) => objectToFacet(subChildObject));
166
- }
167
- return transformed;
168
- }
169
- /**
170
- * Filters records with the parent paths from record2 OUT of record1
171
- */
172
- function filterRecordByParentPaths(record1, record2) {
173
- // Extract all paths (keys) both records
174
- const paths1 = Object.keys(record1);
175
- const paths2 = Object.keys(record2);
176
- // Find all parent paths in record2
177
- const parentPaths = new Set(paths2
178
- .filter((path) => path.split('/').length > 2) // Only consider paths with more than one level
179
- .map((path) => path.substring(0, path.lastIndexOf('/'))));
180
- // Filter out keys in record1 that share a parent path with any of the identified parent paths
181
- const filteredRecord = Object.fromEntries(paths1
182
- .filter((path) => !parentPaths.has(path.substring(0, path.lastIndexOf('/'))))
183
- .map((path) => [path, record1[path]]));
184
- return filteredRecord;
185
- }
186
- function mergeFacetRoots(fieldName, currentRoot, incomingRoot) {
187
- const currentArray = currentRoot[fieldName];
188
- const incomingArray = incomingRoot[fieldName];
189
- const currentRootFacetChild = {
190
- count: 0,
191
- path: '/',
192
- children: currentArray,
193
- };
194
- const incomingRootFacetChild = {
195
- count: 0,
196
- path: '/',
197
- children: incomingArray,
198
- };
199
- // Flatten them into records
200
- const currentRecord = facetToRecord(currentRootFacetChild);
201
- const incomingRecord = facetToRecord(incomingRootFacetChild);
202
- // Filter out the records from record1 (the current set of records)
203
- // that share a parent path with record2 (the incoming records)
204
- const filteredCurrentRecord = filterRecordByParentPaths(currentRecord, incomingRecord);
205
- // Deep merge the records together
206
- const mergedRecord = deepMergeWithSpread(filteredCurrentRecord, incomingRecord);
207
- // Convert into a heirarchical object
208
- const mergedObject = recordToObject(mergedRecord);
209
- // Convert the heirarchical object back to the Facet child structure
210
- const mergedFacetChild = objectToFacet(mergedObject);
211
- return {
212
- [fieldName]: mergedFacetChild.children,
213
- };
214
- }
215
-
216
- export { getMillis as a, formatNumberWithCommas as f, getDocumentValueFromSearchResultMapping as g, mergeFacetRoots as m, parseCustomStyles as p, removeSubstringMatches as r, serializeStyles as s };
217
-
218
- //# sourceMappingURL=utils-c2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AC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CACxC,CAAC;IAEF,OAAO,cAAc,CAAC;AACxB,CAAC;SAEe,eAAe,CAC7B,SAAiB,EACjB,WAAsB,EACtB,YAAuB;IAEvB,MAAM,YAAY,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC;IAC5C,MAAM,aAAa,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;IAE9C,MAAM,qBAAqB,GAAe;QACxC,KAAK,EAAE,CAAC;QACR,IAAI,EAAE,GAAG;QACT,QAAQ,EAAE,YAAY;KACvB,CAAC;IAEF,MAAM,sBAAsB,GAAe;QACzC,KAAK,EAAE,CAAC;QACR,IAAI,EAAE,GAAG;QACT,QAAQ,EAAE,aAAa;KACxB,CAAC;;IAGF,MAAM,aAAa,GAAuC,aAAa,CACrE,qBAAqB,CACtB,CAAC;IAEF,MAAM,cAAc,GAAuC,aAAa,CACtE,sBAAsB,CACvB,CAAC;;;IAIF,MAAM,qBAAqB,GAAG,yBAAyB,CACrD,aAAa,EACb,cAAc,CACf,CAAC;;IAGF,MAAM,YAAY,GAAuC,mBAAmB,CAC1E,qBAAqB,EACrB,cAAc,CACf,CAAC;;IAGF,MAAM,YAAY,GAAqB,cAAc,CAAC,YAAY,CAAC,CAAC;;IAGpE,MAAM,gBAAgB,GAAG,aAAa,CAAC,YAAY,CAAC,CAAC;IAErD,OAAO;QACL,CAAC,SAAS,GAAG,gBAAgB,CAAC,QAAQ;KACvC,CAAC;AACJ;;;;","names":[],"sources":["src/utils/utils.ts"],"sourcesContent":["import type {\n FacetChild,\n FacetChildObject,\n FacetRoot,\n} from '@searchcraft/core';\nimport type { SearchResultMapping } from 'types';\n\nexport function parseCustomStyles(\n styles: string | Record<string, string>,\n): Record<string, string> {\n if (typeof styles === 'string') {\n try {\n return JSON.parse(styles);\n } catch (error) {\n console.error('Invalid customStyles format:', styles);\n return {};\n }\n }\n return styles || {};\n}\n\nexport function serializeStyles(\n styles: Record<string, Record<string, string>>,\n): string {\n try {\n return JSON.stringify(styles);\n } catch (error) {\n console.error('Error serializing styles:', error);\n return '{}';\n }\n}\n\n/**\n * Given a timestamp value, returns a formatted time string for the time\n * since now.\n *\n * @param timestamp\n * @returns {string} Formatted string value\n */\nexport function getFormattedTimeFromNow(timestamp: string): string {\n const now = new Date();\n const inputTime = new Date(timestamp);\n const diffInSeconds = Math.floor(\n (now.getTime() - inputTime.getTime()) / 1000,\n );\n\n const minutes = Math.floor(diffInSeconds / 60);\n const hours = Math.floor(minutes / 60);\n const days = Math.floor(hours / 24);\n const years = Math.floor(days / 365);\n\n if (minutes < 60) {\n return `${minutes}m ago`;\n }\n if (hours < 24) {\n return `${hours}h ago`;\n }\n if (days < 365) {\n return `${days}d ago`;\n }\n return `${years}y ago`;\n}\n\nexport function filterPaths(paths) {\n return paths.filter((path) => {\n const parts = path.split('/').filter(Boolean);\n\n if (parts.length > 1) {\n return true;\n }\n\n return !paths.some(\n (otherPath) => otherPath.startsWith(`${path}/`) && otherPath !== path,\n );\n });\n}\n\nexport function formatNumberWithCommas(number) {\n return number.toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',');\n}\n\nexport function getMillis(unit: 'year' | 'month' | 'day' | 'hour'): number {\n const millisInHour = 60 * 60 * 1000;\n const millisInDay = 24 * millisInHour;\n const millisInMonth = 30 * millisInDay;\n const millisInYear = 365 * millisInDay;\n\n switch (unit) {\n case 'hour':\n return millisInHour;\n case 'day':\n return millisInDay;\n case 'month':\n return millisInMonth;\n case 'year':\n return millisInYear;\n default:\n return 3600000;\n }\n}\n/**\n * Given an array of facet paths, removes parent facet paths.\n */\nexport function removeSubstringMatches(arr: string[]): string[] {\n return arr.filter(\n (entry, index, array) =>\n !array.some(\n (otherEntry, otherIndex) =>\n otherIndex !== index && otherEntry.includes(entry),\n ),\n );\n}\n\n/**\n * Given a document and a SearchResultMapping, return a mapped value from the document.\n *\n * @param document\n * @param {SearchResultMapping} mapping\n * @returns {string | undefined}\n */\nexport function getDocumentValueFromSearchResultMapping(\n document: Record<string, unknown> | undefined,\n mapping: SearchResultMapping | undefined,\n): string | undefined {\n if (document && mapping) {\n return mapping.fieldNames\n .map((fieldNameDetails) => {\n let valueFound = document[fieldNameDetails.fieldName];\n\n if (valueFound && fieldNameDetails.dataType === 'date') {\n valueFound = getFormattedTimeFromNow(valueFound as string);\n }\n\n return valueFound;\n })\n .filter((value) => !!value)\n .join(mapping.delimiter || ' ');\n }\n}\n\nfunction deepMergeWithSpread(obj1, obj2) {\n const result = { ...obj1 };\n\n for (const key in obj2) {\n // biome-ignore lint/suspicious/noPrototypeBuiltins: <explanation>\n if (obj2.hasOwnProperty(key)) {\n if (obj2[key] instanceof Object && obj1[key] instanceof Object) {\n result[key] = deepMergeWithSpread(obj1[key], obj2[key]);\n } else {\n result[key] = obj2[key];\n }\n }\n }\n\n return result;\n}\n\ntype FacetChildFragment = {\n count: number;\n path: string;\n};\n\nfunction facetToRecord(facet: FacetChild): Record<string, FacetChildFragment> {\n const records: Record<string, FacetChildFragment> = {};\n\n const traverseAndAddToFragments = (facetChild: FacetChild) => {\n records[facetChild.path] = {\n count: facetChild.count,\n path: facetChild.path,\n };\n\n facetChild.children?.forEach((child) => {\n traverseAndAddToFragments(child);\n });\n };\n\n traverseAndAddToFragments(facet);\n\n return records;\n}\n\nfunction recordToObject(\n record: Record<string, FacetChildFragment>,\n): FacetChildObject {\n const root: FacetChildObject = {\n count: 0,\n path: '/',\n children: {},\n };\n\n Object.keys(record).forEach((key) => {\n const fragment = record[key];\n if (fragment.path === '/') {\n return;\n }\n const pathParts = fragment.path.substring(1).split('/');\n let currentRoot = root;\n let currentPath = '';\n\n pathParts.forEach((part, index) => {\n const nextPath = `${currentPath}/${part}`;\n if (!currentRoot.children[nextPath]) {\n currentRoot.children[nextPath] = {\n count: 0,\n path: nextPath,\n children: {},\n };\n }\n\n if (index === pathParts.length - 1) {\n currentRoot.children[nextPath].count = fragment.count;\n }\n\n currentPath = nextPath;\n currentRoot = currentRoot.children[nextPath];\n });\n });\n\n return root;\n}\n\nfunction objectToFacet(childObject: FacetChildObject): FacetChild {\n const transformed: FacetChild = {\n count: childObject.count,\n path: childObject.path,\n children: [],\n };\n\n if (Object.keys(childObject.children).length > 0) {\n transformed.children = Object.values(childObject.children).map(\n (subChildObject) => objectToFacet(subChildObject),\n );\n }\n\n return transformed;\n}\n\n/**\n * Filters records with the parent paths from record2 OUT of record1\n */\nfunction filterRecordByParentPaths(\n record1: Record<string, FacetChild>,\n record2: Record<string, FacetChild>,\n): Record<string, FacetChild> {\n // Extract all paths (keys) both records\n const paths1 = Object.keys(record1);\n const paths2 = Object.keys(record2);\n\n // Find all parent paths in record2\n const parentPaths = new Set(\n paths2\n .filter((path) => path.split('/').length > 2) // Only consider paths with more than one level\n .map((path) => path.substring(0, path.lastIndexOf('/'))),\n );\n\n // Filter out keys in record1 that share a parent path with any of the identified parent paths\n const filteredRecord = Object.fromEntries(\n paths1\n .filter(\n (path) => !parentPaths.has(path.substring(0, path.lastIndexOf('/'))),\n )\n .map((path) => [path, record1[path]]), // Reconstruct the key-value pairs\n );\n\n return filteredRecord;\n}\n\nexport function mergeFacetRoots(\n fieldName: string,\n currentRoot: FacetRoot,\n incomingRoot: FacetRoot,\n): FacetRoot {\n const currentArray = currentRoot[fieldName];\n const incomingArray = incomingRoot[fieldName];\n\n const currentRootFacetChild: FacetChild = {\n count: 0,\n path: '/',\n children: currentArray,\n };\n\n const incomingRootFacetChild: FacetChild = {\n count: 0,\n path: '/',\n children: incomingArray,\n };\n\n // Flatten them into records\n const currentRecord: Record<string, FacetChildFragment> = facetToRecord(\n currentRootFacetChild,\n );\n\n const incomingRecord: Record<string, FacetChildFragment> = facetToRecord(\n incomingRootFacetChild,\n );\n\n // Filter out the records from record1 (the current set of records)\n // that share a parent path with record2 (the incoming records)\n const filteredCurrentRecord = filterRecordByParentPaths(\n currentRecord,\n incomingRecord,\n );\n\n // Deep merge the records together\n const mergedRecord: Record<string, FacetChildFragment> = deepMergeWithSpread(\n filteredCurrentRecord,\n incomingRecord,\n );\n\n // Convert into a heirarchical object\n const mergedObject: FacetChildObject = recordToObject(mergedRecord);\n\n // Convert the heirarchical object back to the Facet child structure\n const mergedFacetChild = objectToFacet(mergedObject);\n\n return {\n [fieldName]: mergedFacetChild.children,\n };\n}\n"],"version":3}
@@ -1,2 +0,0 @@
1
- import{r as s,c as e,h as c,F as a}from"./p-d7d0b88c.js";import{c as r}from"./p-5cdc6210.js";const n=":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.searchcraft-button{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-bold-font-size);font-weight:var(--sc-body-bold-font-weight);line-height:var(--sc-body-bold-line-height);border-radius:8px;display:flex;padding:12px 20px;position:relative;background-color:var(--sc-surface-brand-primary);border:1px solid var(--sc-border-primary);color:var(--sc-content-brand-on-primary)}.searchcraft-button:hover{cursor:pointer;background-color:var(--sc-surface-brand-primary-hover)}.searchcraft-button:focus{outline:2px solid var(--sc-surface-brand-primary)}.buttonLabel{position:relative}";const t=n;const i=class{constructor(c){s(this,c);this.buttonClick=e(this,"buttonClick",7);this.handleClick=()=>{this.buttonClick.emit()};this.iconElement=undefined;this.iconOnly=false;this.iconPosition="left";this.label="Search";this.isRequesting=false}render(){return c(a,{key:"8ea823d757ceca459ef80affa8dfdf7e96076c32"},this.iconOnly?c("button",{class:r("searchcraft-button"),onClick:this.handleClick,type:"submit"},this.isRequesting?c("searchcraft-spinner-dark",null):this.iconElement):c("button",{class:r("searchcraft-button"),onClick:this.handleClick,type:"submit"},this.iconPosition==="left"&&this.iconElement,c("span",{class:r("buttonLabel","searchcraft-button-label")},this.label)))}};i.style=t;const o=":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.searchcraft-input-label{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-bold-font-size);font-weight:var(--sc-body-small-bold-font-weight);line-height:var(--sc-body-small-bold-line-height);color:var(--sc-content-neutral-primary);margin-top:4px;margin-bottom:4px}";const d=o;const h=class{constructor(e){s(this,e);this.inputLabelClassName="";this.label=undefined}render(){if(!this.label){return null}return c("label",{class:r("searchcraft-input-label",this.inputLabelClassName),htmlFor:"searchcraft-input-id"},this.label)}};h.style=d;export{i as searchcraft_button,h as searchcraft_input_label};
2
- //# sourceMappingURL=p-04300412.entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["searchcraftButtonModuleCss","SearchcraftButtonStyle0","SearchcraftButton","this","handleClick","buttonClick","emit","render","h","Fragment","key","iconOnly","class","classNames","onClick","type","isRequesting","iconPosition","iconElement","label","searchcraftInputLabelModuleCss","SearchcraftInputLabelStyle0","SearchcraftInputLabel","inputLabelClassName","htmlFor"],"sources":["src/components/searchcraft-button/searchcraft-button.module.scss?tag=searchcraft-button","src/components/searchcraft-button/searchcraft-button.tsx","src/components/searchcraft-input-label/searchcraft-input-label.module.scss?tag=searchcraft-input-label","src/components/searchcraft-input-label/searchcraft-input-label.tsx"],"sourcesContent":[".searchcraft-button {\n @include body-bold;\n\n border-radius: 8px;\n display: flex;\n padding: 12px 20px;\n position: relative;\n\n background-color: var(--sc-surface-brand-primary);\n border: 1px solid var(--sc-border-primary);\n color: var(--sc-content-brand-on-primary);\n\n &:hover {\n cursor: pointer;\n background-color: var(--sc-surface-brand-primary-hover);\n }\n\n &:focus {\n outline: 2px solid var(--sc-surface-brand-primary);\n }\n}\n\n.buttonLabel {\n position: relative;\n}","import {\n Component,\n Event,\n type EventEmitter,\n Prop,\n h,\n State,\n Fragment,\n} from '@stencil/core';\nimport classNames from 'classnames';\n\n@Component({\n tag: 'searchcraft-button',\n styleUrl: 'searchcraft-button.module.scss',\n shadow: false,\n})\nexport class SearchcraftButton {\n @Prop() iconElement?: Element;\n @Prop() iconOnly = false;\n @Prop() iconPosition = 'left';\n @Prop() label = 'Search';\n\n @Event() buttonClick!: EventEmitter<void>;\n\n @State() isRequesting = false;\n\n private handleClick = () => {\n this.buttonClick.emit();\n };\n\n render() {\n return (\n <Fragment>\n {this.iconOnly ? (\n <button\n class={classNames('searchcraft-button')}\n onClick={this.handleClick}\n type='submit'\n >\n {this.isRequesting ? (\n <searchcraft-spinner-dark />\n ) : (\n this.iconElement\n )}\n </button>\n ) : (\n <button\n class={classNames('searchcraft-button')}\n onClick={this.handleClick}\n type='submit'\n >\n {this.iconPosition === 'left' && this.iconElement}\n <span class={classNames('buttonLabel', 'searchcraft-button-label')}>\n {this.label}\n </span>\n </button>\n )}\n </Fragment>\n );\n }\n}\n",".searchcraft-input-label {\n @include body-small-bold();\n color: var(--sc-content-neutral-primary);\n margin-top: 4px;\n margin-bottom: 4px;\n}\n","import { Component, Prop, h } from '@stencil/core';\nimport classNames from 'classnames';\n\n@Component({\n tag: 'searchcraft-input-label',\n styleUrl: 'searchcraft-input-label.module.scss',\n shadow: false,\n})\nexport class SearchcraftInputLabel {\n @Prop() inputLabelClassName? = '';\n @Prop() label?: string;\n\n render() {\n if (!this.label) {\n return null;\n }\n return (\n <label\n class={classNames('searchcraft-input-label', this.inputLabelClassName)}\n htmlFor='searchcraft-input-id'\n >\n {this.label}\n </label>\n );\n }\n}\n"],"mappings":"6FAAA,MAAMA,EAA6B,uoHACnC,MAAAC,EAAeD,E,MCeFE,EAAiB,M,kEAUpBC,KAAAC,YAAc,KACpBD,KAAKE,YAAYC,MAAM,E,yCATN,M,kBACI,O,WACP,S,kBAIQ,K,CAMxB,MAAAC,GACE,OACEC,EAACC,EAAQ,CAAAC,IAAA,4CACNP,KAAKQ,SACJH,EAAA,UACEI,MAAOC,EAAW,sBAClBC,QAASX,KAAKC,YACdW,KAAK,UAEJZ,KAAKa,aACJR,EAAA,iCAEAL,KAAgB,aAIpBK,EAAA,UACEI,MAAOC,EAAW,sBAClBC,QAASX,KAAKC,YACdW,KAAK,UAEJZ,KAAKc,eAAiB,QAAUd,KAAKe,YACtCV,EAAA,QAAMI,MAAOC,EAAW,cAAe,6BACpCV,KAAKgB,Q,aCrDpB,MAAMC,EAAiC,q1GACvC,MAAAC,EAAeD,E,MCOFE,EAAqB,M,kDACD,G,qBAG/B,MAAAf,GACE,IAAKJ,KAAKgB,MAAO,CACf,OAAO,I,CAET,OACEX,EAAA,SACEI,MAAOC,EAAW,0BAA2BV,KAAKoB,qBAClDC,QAAQ,wBAEPrB,KAAKgB,M","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- import{r as s,h as e}from"./p-d7d0b88c.js";const c=":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.searchcraft-error-message{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-body-small-font-weight);line-height:var(--sc-body-small-line-height);color:var(--sc-content-danger);margin:0}";const r=c;const a=class{constructor(e){s(this,e);this.errorMessage=undefined}render(){return e("p",{key:"68c4058c43418e96729a91e6a2a9a106303c8bc0",class:"searchcraft-error-message"},this.errorMessage||"Search term is required.")}};a.style=r;export{a as searchcraft_error_message};
2
- //# sourceMappingURL=p-09c7fbef.entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["searchcraftErrorMessageModuleCss","SearchcraftErrorMessageStyle0","SearchcraftErrorMessage","render","h","key","class","this","errorMessage"],"sources":["src/components/searchcraft-error-message/searchcraft-error-message.module.scss?tag=searchcraft-error-message","src/components/searchcraft-error-message/searchcraft-error-message.tsx"],"sourcesContent":[".searchcraft-error-message {\n @include body-small();\n color: var(--sc-content-danger);\n margin: 0;\n}\n","import { Component, Prop, h } from '@stencil/core';\n\n@Component({\n tag: 'searchcraft-error-message',\n styleUrl: 'searchcraft-error-message.module.scss',\n shadow: false,\n})\nexport class SearchcraftErrorMessage {\n @Prop() errorMessage?: string;\n\n render() {\n return (\n <p class='searchcraft-error-message'>\n {this.errorMessage || 'Search term is required.'}\n </p>\n );\n }\n}\n"],"mappings":"2CAAA,MAAMA,EAAmC,uyGACzC,MAAAC,EAAeD,E,MCMFE,EAAuB,M,qDAGlC,MAAAC,GACE,OACEC,EAAA,KAAAC,IAAA,2CAAGC,MAAM,6BACNC,KAAKC,cAAgB,2B","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- import{r as t,c as e,h as s}from"./p-d7d0b88c.js";import{u as r,i as a}from"./p-ad4ebde0.js";import{p as c}from"./p-f308d05d.js";import{c as i}from"./p-5cdc6210.js";const n="@searchcraft/javascript-sdk";const o="0.5.3";const d="Searchcraft Javascript SDK";const p="Searchcraft";const h="Apache-2.0";const u="dist/index.cjs.js";const f="dist/index.js";const l="dist/types/index.d.ts";const b="dist/collection/collection-manifest.json";const g="dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js";const y={".":{import:"./dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js",require:"./dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.cjs.js",types:"./dist/types/index.d.ts"},"./components":{import:"./dist/components/index.js",types:"./dist/components/index.d.ts"},"./loader":{import:"./dist/loader/index.js",require:"./dist/loader/index.cjs",types:"./dist/loader/index.d.ts"},"./dist/components/*":{import:"./dist/components/*",types:"./dist/components/*"}};const m={type:"git",url:"https://bitbucket.org/madebychalk/searchcraft-javascript-sdks/"};const v=["dist/"];const w={build:"stencil build",dev:"stencil build --dev --watch",test:"stencil test --spec --e2e","test.watch":"stencil test --spec --e2e --watchAll",generate:"stencil generate"};const F={classnames:"^2.3.2"};const x={"@searchcraft/core":"*","@searchcraft/javascript-sdk":"*","@stencil/core":"^4.7.0","@stencil/react-output-target":"^0.8.2","@stencil/sass":"^3.0.12","@types/node":"^16.18.11",zustand:"^5.0.1"};const k={name:n,private:false,version:o,description:d,author:p,license:h,main:u,module:f,types:l,collection:b,"collection:main":"dist/collection/index.js",unpkg:g,exports:y,repository:m,files:v,scripts:w,dependencies:F,devDependencies:x};const C=":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.searchcraft-input-wrapper{position:relative;display:flex}.searchcraft-input-grid{display:grid;gap:4px 8px}.searchcraft-input-grid-buttonLeft{grid-template-rows:repeat(3, auto);grid-template-columns:auto 1fr}.searchcraft-input-grid-buttonLeft .searchcraft-input-button-wrapper{grid-column:1/span 1;grid-row:2/span 1}.searchcraft-input-grid-buttonLeft .searchcraft-input-label-wrapper{grid-column:2/span 1;grid-row:1/span 1}.searchcraft-input-grid-buttonLeft .searchcraft-input-error-wrapper{grid-column:2/span 1;grid-row:3/span 1}.searchcraft-input-grid-buttonLeft .searchcraft-input-wrapper{grid-column:2/span 1;grid-row:2/span 1}.searchcraft-input-grid-buttonRight{grid-template-rows:repeat(3, auto);grid-template-columns:1fr auto}.searchcraft-input-grid-buttonRight .searchcraft-input-button-wrapper{grid-column:2/span 1;grid-row:2/span 1}.searchcraft-input-grid-buttonRight .searchcraft-input-label-wrapper{grid-column:1/span 1;grid-row:1/span 1}.searchcraft-input-grid-buttonRight .searchcraft-input-error-wrapper{grid-column:1/span 1;grid-row:3/span 1}.searchcraft-input-grid-buttonRight .searchcraft-input-wrapper{grid-column:1/span 1;grid-row:2/span 1}.searchcraft-input-grid-buttonNone{grid-template-rows:repeat(3, auto);grid-template-columns:auto}.searchcraft-input-grid-buttonNone .searchcraft-input-button-wrapper{display:none}.searchcraft-input-grid-buttonNone .searchcraft-input-label-wrapper{grid-column:1/span 1;grid-row:1/span 1}.searchcraft-input-grid-buttonNone .searchcraft-input-error-wrapper{grid-column:1/span 1;grid-row:3/span 1}.searchcraft-input-grid-buttonNone .searchcraft-input-wrapper{grid-column:1/span 1;grid-row:2/span 1}.searchcraft-input{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-body-font-weight);line-height:var(--sc-body-line-height);background-color:var(--sc-surface-neutral-secondary);border:none;border-radius:var(--sc-input-border-radius);color:var(--sc-content-neutral-primary);outline:none;padding-left:var(--sc-input-padding-left);padding-right:var(--sc-input-padding-right);padding-top:12px;padding-bottom:12px;flex:1}.searchcraft-input::placeholder{color:var(--sc-content-disabled)}.searchcraft-input:focus{outline:var(--sc-border-brand) solid 2px}.searchcraft-input:focus::placeholder{opacity:0}.searchcraft-input.error{color:var(--sc-content-danger);outline:var(--sc-border-danger) solid 2px}.searchcraft-input.error:focus{outline:var(--sc-border-danger) solid 2px}.searchcraft-input-search-icon-wrapper{align-items:center;justify-content:center;display:flex;position:absolute;pointer-events:none;bottom:0;left:0;top:0;width:var(--sc-input-padding-left)}.searchcraft-input-search-icon{pointer-events:none;width:var(--sc-input-search-icon-size);height:var(--sc-input-search-icon-size)}.searchcraft-input-clear-button{all:unset;align-items:center;justify-content:center;cursor:pointer;display:flex;position:absolute;border:none;outline:none;bottom:0;right:0;top:0;width:var(--sc-input-padding-right)}.searchcraft-input-clear-icon{width:var(--sc-input-clear-icon-size);height:var(--sc-input-clear-icon-size)}";const j=C;const E=class{constructor(s){t(this,s);this.inputCleared=e(this,"inputCleared",7);this.noResultsReceived=e(this,"noResultsReceived",7);this.querySubmit=e(this,"querySubmit",7);this.inputFocus=e(this,"inputFocus",7);this.inputBlur=e(this,"inputBlur",7);this.debounceTimeout=null;this.searchStore=r.getState();this.handleOnInput=t=>{const e=t.target;this.inputValue=e.value;if(e.value.trim()===""){this.inputCleared.emit();return}if(!this.autoSearch){return}if(this.debounceDelay>0){if(this.debounceTimeout){clearTimeout(this.debounceTimeout)}this.debounceTimeout=setTimeout((()=>this.performSearch(e.value)),this.debounceDelay)}else{this.performSearch(e.value)}};this.performSearch=async t=>{if(t===r.getState().query){return}this.querySubmit.emit(t);this.searchTerm=t.trim();this.error=false;this.searchStore.setQuery(this.searchTerm);try{await this.searchStore.search()}catch(t){this.error=true;this.inputCleared.emit()}};this.handleClearInput=()=>{this.inputValue="";if(this.debounceTimeout){clearTimeout(this.debounceTimeout)}this.searchTerm="";this.searchStore.setQuery("");this.searchStore.setSearchResults(null);this.error=false;if(this.inputCleared){this.inputCleared.emit()}};this.handleFormSubmit=async t=>{t.preventDefault();await this.performSearch(this.searchTerm)};this.config=undefined;this.autoSearch=true;this.buttonPlacement="none";this.buttonLabel=undefined;this.inputLabel=undefined;this.customStyles={};this.placeholderValue="Enter Search";this.searchTerm="";this.debounceDelay=0;this.inputValue=this.searchTerm;this.error=false;this.isSearchcraftInitialized=false}init(){if(this.config&&!this.isSearchcraftInitialized){const t=new a(this.config,{sdkName:k.name,sdkVersion:k.version});this.searchStore.initialize(t,true);this.isSearchcraftInitialized=true}}componentDidLoad(){this.init()}onConfigChange(){this.init()}render(){const t=c(this.customStyles);const e=this.inputValue.length>0;const r=i("searchcraft-input-grid",{"searchcraft-input-grid-buttonLeft":this.buttonPlacement==="left","searchcraft-input-grid-buttonRight":this.buttonPlacement==="right","searchcraft-input-grid-buttonNone":this.buttonPlacement==="none"});return s("form",{key:"7f224a10ab80d70660c9db97be5d68830932570b",class:"searchcraft-input-form",onSubmit:this.handleFormSubmit},s("div",{key:"6822a21a43e5be992b11ddb6c86370ddd68e1475",class:r},s("div",{key:"6022989ca876ea46de048398a076bc43d5213554",class:"searchcraft-input-button-wrapper"},s("searchcraft-button",{key:"d48b61729ef9a3f19049dfe751aefa22fdc85e9f",onButtonClick:this.handleFormSubmit,label:this.buttonLabel})),s("div",{key:"3465e467cbb965ad813b6c9c726173bb3fe828f2",class:"searchcraft-input-label-wrapper"},s("searchcraft-input-label",{key:"1026b7834358c6673a72ef8352830c9b4681020f",label:this.inputLabel})),this.error&&s("div",{key:"ff0d55cd88e1895f9b0bd4c0afc917127e76afa2",class:"searchcraft-input-error-wrapper"},s("searchcraft-error-message",{key:"57fc160411f21f45617e1a3b8677fb4c6e96c0f0",errorMessage:"Please enter a search query."})),s("div",{key:"b2783bf86177d22d4abedb4420fdb2a1807527ef",class:"searchcraft-input-wrapper"},s("input",{key:"e985da32be58ab3e200866e085b2acd25b54aa31",autoComplete:"off",class:"searchcraft-input",onFocus:()=>this.inputFocus.emit(),onBlur:()=>this.inputBlur.emit(),onInput:t=>{this.handleOnInput(t)},placeholder:this.placeholderValue,style:t,type:"text",value:this.inputValue}),s("div",{key:"d5277758ae26262f5f3b49e8763add412661e5cf",class:"searchcraft-input-search-icon-wrapper"},s("svg",{key:"79792740ea1207fad40786f555c63c4a26ff3fe2",class:"searchcraft-input-search-icon",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":"searchcraft-title"},s("title",{key:"7a487bdf41babdafb802ebd79c34a6a5da300cd6",id:"searchcraft-title"},"Searchcraft Search Icon Light"),s("path",{key:"27c442bf412aca373cbc982b3a35a00fe7bb82ed",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"}))),e&&s("button",{key:"4c4bc21e9e87f4245ac38d7af269aae35876b6b0",type:"button",class:"searchcraft-input-clear-button",onClick:this.handleClearInput},s("svg",{key:"4b82e65987a8a8c296d2b9c279474c29607727e0",class:"searchcraft-input-clear-icon",viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":"icon-title"},s("title",{key:"9d64212798691a2f8c6c9c4f74ceca1d2fe39fd1",id:"icon-title"},"Searchcraft Clear Input Icon Light"),s("path",{key:"4c6c5b33fbd9ac02661996bb56e0902094e9b140",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"}))))))}static get watchers(){return{config:["onConfigChange"]}}};E.style=j;export{E as searchcraft_input_form};
2
- //# sourceMappingURL=p-32068485.entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["searchcraftInputFormModuleCss","SearchcraftInputFormStyle0","SearchcraftInput","this","debounceTimeout","searchStore","useSearchcraftStore","getState","handleOnInput","event","input","target","inputValue","value","trim","inputCleared","emit","autoSearch","debounceDelay","clearTimeout","setTimeout","performSearch","async","query","querySubmit","searchTerm","error","setQuery","search","handleClearInput","setSearchResults","handleFormSubmit","preventDefault","init","config","isSearchcraftInitialized","searchcraft","SearchcraftCore","sdkName","packageJson","name","sdkVersion","version","initialize","componentDidLoad","onConfigChange","render","validatedCustomStyles","parseCustomStyles","customStyles","isShowingClearButton","length","inputGridClassNames","classNames","buttonPlacement","h","key","class","onSubmit","onButtonClick","label","buttonLabel","inputLabel","errorMessage","autoComplete","onFocus","inputFocus","onBlur","inputBlur","onInput","placeholder","placeholderValue","style","type","viewBox","fill","xmlns","id","d","stroke","onClick"],"sources":["src/components/searchcraft-input-form/searchcraft-input-form.module.scss?tag=searchcraft-input-form","src/components/searchcraft-input-form/searchcraft-input-form.tsx"],"sourcesContent":[".searchcraft-input-wrapper {\n position: relative;\n display: flex;\n}\n\n.searchcraft-input-grid {\n display: grid;\n gap: 4px 8px;\n}\n\n.searchcraft-input-grid-buttonLeft {\n grid-template-rows: repeat(3, auto);\n grid-template-columns: auto 1fr;\n\n & .searchcraft-input-button-wrapper {\n grid-column: 1 / span 1;\n grid-row: 2 / span 1;\n }\n\n & .searchcraft-input-label-wrapper {\n grid-column: 2 / span 1;\n grid-row: 1 / span 1;\n }\n\n & .searchcraft-input-error-wrapper {\n grid-column: 2 / span 1;\n grid-row: 3 / span 1;\n }\n\n & .searchcraft-input-wrapper {\n grid-column: 2 / span 1;\n grid-row: 2 / span 1;\n }\n}\n\n.searchcraft-input-grid-buttonRight {\n grid-template-rows: repeat(3, auto);\n grid-template-columns: 1fr auto;\n\n & .searchcraft-input-button-wrapper {\n grid-column: 2 / span 1;\n grid-row: 2 / span 1;\n }\n\n & .searchcraft-input-label-wrapper {\n grid-column: 1 / span 1;\n grid-row: 1 / span 1;\n }\n\n & .searchcraft-input-error-wrapper {\n grid-column: 1 / span 1;\n grid-row: 3 / span 1;\n }\n\n & .searchcraft-input-wrapper {\n grid-column: 1 / span 1;\n grid-row: 2 / span 1;\n }\n}\n\n.searchcraft-input-grid-buttonNone {\n grid-template-rows: repeat(3, auto);\n grid-template-columns: auto;\n\n & .searchcraft-input-button-wrapper {\n display: none;\n }\n\n & .searchcraft-input-label-wrapper {\n grid-column: 1 / span 1;\n grid-row: 1 / span 1;\n }\n\n & .searchcraft-input-error-wrapper {\n grid-column: 1 / span 1;\n grid-row: 3 / span 1;\n }\n\n & .searchcraft-input-wrapper {\n grid-column: 1 / span 1;\n grid-row: 2 / span 1;\n }\n}\n\n.searchcraft-input {\n @include body();\n background-color: var(--sc-surface-neutral-secondary);\n border: none;\n border-radius: var(--sc-input-border-radius);\n color: var(--sc-content-neutral-primary);\n outline: none;\n padding-left: var(--sc-input-padding-left);\n padding-right: var(--sc-input-padding-right);\n padding-top: 12px;\n padding-bottom: 12px;\n flex: 1;\n\n &::placeholder {\n color: var(--sc-content-disabled);\n }\n\n &:focus {\n outline: var(--sc-border-brand) solid 2px;\n }\n\n &:focus::placeholder {\n opacity: 0;\n }\n}\n\n.searchcraft-input.error {\n color: var(--sc-content-danger);\n outline: var(--sc-border-danger) solid 2px;\n\n &:focus {\n outline: var(--sc-border-danger) solid 2px;\n }\n}\n\n.searchcraft-input-search-icon-wrapper {\n align-items: center;\n justify-content: center;\n display: flex;\n position: absolute;\n pointer-events: none;\n bottom: 0;\n left: 0;\n top: 0;\n width: var(--sc-input-padding-left);\n}\n\n.searchcraft-input-search-icon {\n pointer-events: none;\n width: var(--sc-input-search-icon-size);\n height: var(--sc-input-search-icon-size);\n}\n\n.searchcraft-input-clear-button {\n all: unset;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n display: flex;\n position: absolute;\n border: none;\n outline: none;\n bottom: 0;\n right: 0;\n top: 0;\n width: var(--sc-input-padding-right);\n}\n\n.searchcraft-input-clear-icon {\n width: var(--sc-input-clear-icon-size);\n height: var(--sc-input-clear-icon-size);\n}\n","import {\n Component,\n h,\n Prop,\n State,\n Event,\n type EventEmitter,\n Watch,\n} from '@stencil/core';\n\nimport { type SearchcraftConfig, SearchcraftCore } from '@searchcraft/core';\nimport packageJson from '../../../package.json';\n\nimport { parseCustomStyles } from '@utils/utils';\nimport { useSearchcraftStore } from '@provider/store';\nimport classNames from 'classnames';\n\nexport interface ScInputCustomEvent<T> extends CustomEvent<T> {\n detail: T;\n target: HTMLSearchcraftInputFormElement;\n}\n\n@Component({\n tag: 'searchcraft-input-form',\n styleUrl: 'searchcraft-input-form.module.scss',\n shadow: false,\n})\nexport class SearchcraftInput {\n /**\n * The Searchcraft config object.\n */\n @Prop() config: SearchcraftConfig | undefined;\n /**\n * Whether or not to automatically submit the search term when the input changes.\n */\n @Prop() autoSearch = true;\n /**\n * Where to place the search button.\n */\n @Prop() buttonPlacement: 'left' | 'right' | 'none' = 'none';\n /**\n * The label for the submit button.\n */\n @Prop() buttonLabel: string | undefined;\n /**\n * The label rendered above the input.\n */\n @Prop() inputLabel: string | undefined;\n /**\n * A custom styles object to be applied to the input element.\n */\n @Prop() customStyles: string | Record<string, string> = {};\n /**\n * The input element's placeholder value.\n */\n @Prop() placeholderValue = 'Enter Search';\n /**\n * The starting value of the input element.\n */\n @Prop() searchTerm = '';\n /**\n * The duration to debounce the input's `inputChange` event.\n */\n @Prop() debounceDelay = 0;\n /**\n * Event emitted when the input element has been cleared.\n */\n @Event() inputCleared: EventEmitter<void>;\n /**\n * Event emitted when a query returns with no results received.\n */\n @Event() noResultsReceived: EventEmitter<void>;\n /**\n * Event emitted when a new search request has been submitted.\n */\n @Event() querySubmit: EventEmitter<string>;\n /**\n * Event emitted when the input has gained focus.\n */\n @Event() inputFocus: EventEmitter<void>;\n /**\n * Event emitted when the input has lost focus.\n */\n @Event() inputBlur: EventEmitter<void>;\n\n @State() inputValue = this.searchTerm;\n @State() error = false;\n @State() isSearchcraftInitialized = false;\n\n private debounceTimeout: ReturnType<typeof setTimeout> | null = null;\n private searchStore = useSearchcraftStore.getState();\n\n init() {\n if (this.config && !this.isSearchcraftInitialized) {\n const searchcraft = new SearchcraftCore(this.config, {\n sdkName: packageJson.name,\n sdkVersion: packageJson.version,\n });\n this.searchStore.initialize(searchcraft, true);\n this.isSearchcraftInitialized = true;\n }\n }\n\n componentDidLoad() {\n this.init();\n }\n\n @Watch('config')\n onConfigChange() {\n this.init();\n }\n\n handleOnInput = (event: Event) => {\n const input = event.target as HTMLInputElement;\n this.inputValue = input.value;\n\n if (input.value.trim() === '') {\n this.inputCleared.emit();\n return;\n }\n\n if (!this.autoSearch) {\n return;\n }\n\n if (this.debounceDelay > 0) {\n if (this.debounceTimeout) {\n clearTimeout(this.debounceTimeout);\n }\n\n this.debounceTimeout = setTimeout(\n () => this.performSearch(input.value),\n this.debounceDelay,\n );\n } else {\n this.performSearch(input.value);\n }\n };\n\n private performSearch = async (value: string) => {\n if (value === useSearchcraftStore.getState().query) {\n return;\n }\n this.querySubmit.emit(value);\n this.searchTerm = value.trim();\n this.error = false;\n this.searchStore.setQuery(this.searchTerm);\n\n try {\n await this.searchStore.search();\n } catch (error) {\n this.error = true;\n this.inputCleared.emit();\n }\n };\n\n handleClearInput = () => {\n this.inputValue = '';\n\n if (this.debounceTimeout) {\n clearTimeout(this.debounceTimeout);\n }\n\n this.searchTerm = '';\n this.searchStore.setQuery('');\n this.searchStore.setSearchResults(null);\n this.error = false;\n\n if (this.inputCleared) {\n this.inputCleared.emit();\n }\n };\n\n handleFormSubmit = async (event: Event) => {\n event.preventDefault();\n await this.performSearch(this.searchTerm);\n };\n\n render() {\n const validatedCustomStyles = parseCustomStyles(this.customStyles);\n\n const isShowingClearButton = this.inputValue.length > 0;\n\n const inputGridClassNames = classNames('searchcraft-input-grid', {\n 'searchcraft-input-grid-buttonLeft': this.buttonPlacement === 'left',\n 'searchcraft-input-grid-buttonRight': this.buttonPlacement === 'right',\n 'searchcraft-input-grid-buttonNone': this.buttonPlacement === 'none',\n });\n\n return (\n <form class='searchcraft-input-form' onSubmit={this.handleFormSubmit}>\n <div class={inputGridClassNames}>\n <div class='searchcraft-input-button-wrapper'>\n <searchcraft-button\n onButtonClick={this.handleFormSubmit}\n label={this.buttonLabel}\n />\n </div>\n <div class='searchcraft-input-label-wrapper'>\n <searchcraft-input-label label={this.inputLabel} />\n </div>\n {this.error && (\n <div class='searchcraft-input-error-wrapper'>\n <searchcraft-error-message errorMessage='Please enter a search query.' />\n </div>\n )}\n <div class='searchcraft-input-wrapper'>\n <input\n autoComplete='off'\n class='searchcraft-input'\n onFocus={() => this.inputFocus.emit()}\n onBlur={() => this.inputBlur.emit()}\n onInput={(event) => {\n this.handleOnInput(event);\n }}\n placeholder={this.placeholderValue}\n style={validatedCustomStyles}\n type='text'\n value={this.inputValue}\n />\n <div class='searchcraft-input-search-icon-wrapper'>\n <svg\n class='searchcraft-input-search-icon'\n viewBox='0 0 20 20'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n aria-labelledby='searchcraft-title'\n >\n <title id='searchcraft-title'>\n Searchcraft Search Icon Light\n </title>\n <path\n 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'\n stroke='#404040'\n stroke-width='1.5'\n stroke-linecap='round'\n stroke-linejoin='round'\n />\n </svg>\n </div>\n {isShowingClearButton && (\n <button\n type='button'\n class='searchcraft-input-clear-button'\n onClick={this.handleClearInput}\n >\n <svg\n class='searchcraft-input-clear-icon'\n viewBox='0 0 22 22'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n aria-labelledby='icon-title'\n >\n <title id='icon-title'>\n Searchcraft Clear Input Icon Light\n </title>\n <path\n 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'\n stroke='black'\n stroke-width='1.5'\n stroke-linecap='round'\n stroke-linejoin='round'\n />\n </svg>\n </button>\n )}\n </div>\n </div>\n </form>\n );\n }\n}\n"],"mappings":"ytDAAA,MAAMA,EAAgC,6lMACtC,MAAAC,EAAeD,E,MC0BFE,EAAgB,M,8OA8DnBC,KAAAC,gBAAwD,KACxDD,KAAAE,YAAcC,EAAoBC,WAsB1CJ,KAAAK,cAAiBC,IACf,MAAMC,EAAQD,EAAME,OACpBR,KAAKS,WAAaF,EAAMG,MAExB,GAAIH,EAAMG,MAAMC,SAAW,GAAI,CAC7BX,KAAKY,aAAaC,OAClB,M,CAGF,IAAKb,KAAKc,WAAY,CACpB,M,CAGF,GAAId,KAAKe,cAAgB,EAAG,CAC1B,GAAIf,KAAKC,gBAAiB,CACxBe,aAAahB,KAAKC,gB,CAGpBD,KAAKC,gBAAkBgB,YACrB,IAAMjB,KAAKkB,cAAcX,EAAMG,QAC/BV,KAAKe,c,KAEF,CACLf,KAAKkB,cAAcX,EAAMG,M,GAIrBV,KAAAkB,cAAgBC,MAAOT,IAC7B,GAAIA,IAAUP,EAAoBC,WAAWgB,MAAO,CAClD,M,CAEFpB,KAAKqB,YAAYR,KAAKH,GACtBV,KAAKsB,WAAaZ,EAAMC,OACxBX,KAAKuB,MAAQ,MACbvB,KAAKE,YAAYsB,SAASxB,KAAKsB,YAE/B,UACQtB,KAAKE,YAAYuB,Q,CACvB,MAAOF,GACPvB,KAAKuB,MAAQ,KACbvB,KAAKY,aAAaC,M,GAItBb,KAAA0B,iBAAmB,KACjB1B,KAAKS,WAAa,GAElB,GAAIT,KAAKC,gBAAiB,CACxBe,aAAahB,KAAKC,gB,CAGpBD,KAAKsB,WAAa,GAClBtB,KAAKE,YAAYsB,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AAA,6BAAAC,IAAA,2CAA2BO,aAAa,kCAG5CR,EAAA,OAAAC,IAAA,2CAAKC,MAAM,6BACTF,EAAA,SAAAC,IAAA,2CACEQ,aAAa,MACbP,MAAM,oBACNQ,QAAS,IAAM9D,KAAK+D,WAAWlD,OAC/BmD,OAAQ,IAAMhE,KAAKiE,UAAUpD,OAC7BqD,QAAU5D,IACRN,KAAKK,cAAcC,EAAM,EAE3B6D,YAAanE,KAAKoE,iBAClBC,MAAOzB,EACP0B,KAAK,OACL5D,MAAOV,KAAKS,aAEd2C,EAAA,OAAAC,IAAA,2CAAKC,MAAM,yCACTF,EAAA,OAAAC,IAAA,2CACEC,MAAM,gCACNiB,QAAQ,YACRC,KAAK,OACLC,MAAM,6BAA4B,kBAClB,qBAEhBrB,EAAA,SAAAC,IAAA,2CAAOqB,GAAG,qBAAmB,iCAG7BtB,EAAA,QAAAC,IAAA,2CACEsB,EAAE,oNACFC,OAAO,UAAS,eACH,MAAK,iBACH,QAAO,kBACN,YAIrB7B,GACCK,EAAA,UAAAC,IAAA,2CACEiB,KAAK,SACLhB,MAAM,iCACNuB,QAAS7E,KAAK0B,kBAEd0B,EAAA,OAAAC,IAAA,2CACEC,MAAM,+BACNiB,QAAQ,YACRC,KAAK,OACLC,MAAM,6BAA4B,kBAClB,cAEhBrB,EAAA,SAAAC,IAAA,2CAAOqB,GAAG,cAAY,sCAGtBtB,EAAA,QAAAC,IAAA,2CACEsB,EAAE,wIACFC,OAAO,QAAO,eACD,MAAK,iBACH,QAAO,kBACN,c","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- import{r as s,c as e,h as t}from"./p-d7d0b88c.js";import{u as c}from"./p-ad4ebde0.js";import{g as r,s as i}from"./p-f308d05d.js";const n=":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.searchcraft-search-results-container{display:flex;flex-direction:column;justify-content:center;gap:16px}.searchcraft-ad-section{align-items:center;background-color:#F1F1F1;border-radius:16px;display:flex;flex-direction:column;font-size:16px;justify-content:center;min-height:176px;text-align:center}.searchcraft-ad-section p{margin:0;color:var(--sc-content-disabled)}.searchcraft-search-results-empty-state-container{text-align:center}.searchcraft-search-results-error-message-container{text-align:center}";const a=n;const o=class{constructor(t){s(this,t);this.noResults=e(this,"noResults",7);this.adInterval=4;this.customStylesForResults=undefined;this.searchResultMappings=undefined;this.placeAdAtEnd=false;this.placeAdAtStart=true;this.resultImagePlacement="right";this.buttonLabel=undefined;this.buttonTarget="_blank";this.buttonRel=undefined;this.containerTarget="_blank";this.containerRel=undefined;this.hasSearched=false;this.query="";this.searchResults=null}componentDidLoad(){this.unsubscribe=c.subscribe((s=>{if(s.query.length>0){this.hasSearched=true}else{this.hasSearched=false}this.searchResults=Object.assign({},s.searchResults);this.query=s.query}));const{searchResults:s,query:e}=c.getState();this.searchResults=s;this.query=e}disconnectedCallback(){if(this.unsubscribe){this.unsubscribe()}}renderDocument(s,e){const c=r(s,this.searchResultMappings.title);const n=r(s,this.searchResultMappings.subtitle);const a=r(s,this.searchResultMappings.body);const o=r(s,this.searchResultMappings.containerHref);const d=r(s,this.searchResultMappings.buttonHref);const h=r(s,this.searchResultMappings.imageSource);const l=r(s,this.searchResultMappings.footer);const u=typeof this.customStylesForResults==="string"?this.customStylesForResults:i(this.customStylesForResults);return t("searchcraft-base-search-result",{key:`${s.document_id}-${e}`,"custom-styles":u,"image-placement":this.resultImagePlacement,"container-rel":this.containerRel,"container-target":this.containerTarget,"button-label":this.buttonLabel||"View more","button-rel":this.buttonRel,"button-target":this.buttonTarget,"document-position":e,"title-content":c,"subtitle-content":n,"body-content":a,"footer-content":l,"container-href":o,"button-href":d,"image-src":h})}render(){var s,e,c,r,i,n,a,o,d,h;if(this.query.trim()===""){return t("div",{class:"searchcraft-search-results-empty-state-container"},t("slot",{name:"empty-search"}))}if(!((s=this.searchResults)===null||s===void 0?void 0:s.data)){return}const l=(r=(c=(e=this.searchResults)===null||e===void 0?void 0:e.data)===null||c===void 0?void 0:c.hits)===null||r===void 0?void 0:r.map(((s,e)=>{const{doc:t}=s;return t}));const u=[];if(this.placeAdAtStart){u.push(t("div",{key:"ad-section-start",class:"searchcraft-ad-section"},t("p",null,"Ad Section")))}if(this.adInterval>0){l.forEach(((s,e)=>{u.push(this.renderDocument(s,e));if((e+1)%this.adInterval===0){u.push(t("div",{key:`ad-section-${e+1}`,class:"searchcraft-ad-section "},t("p",null,"Ad Section")))}}))}else{const s=l.map(((s,e)=>this.renderDocument(s,e)));u.push(...s)}if(this.placeAdAtEnd){u.push(t("div",{key:"ad-section-end",class:"searchcraft-ad-section"},t("p",null,"Ad Section")))}if(this.query.length>0&&((a=(n=(i=this.searchResults)===null||i===void 0?void 0:i.data)===null||n===void 0?void 0:n.hits)===null||a===void 0?void 0:a.length)===0){this.noResults.emit()}return t("div",{class:"searchcraft-search-results-container"},u,this.query.length>0&&((h=(d=(o=this.searchResults)===null||o===void 0?void 0:o.data)===null||d===void 0?void 0:d.hits)===null||h===void 0?void 0:h.length)===0&&t("div",{class:"searchcraft-search-results-error-message-container"},t("searchcraft-error-message",{"error-message":`No search results found for "${this.query}" query`})))}};o.style=a;export{o as searchcraft_base_search_results};
2
- //# sourceMappingURL=p-4d3682a8.entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["searchcraftBaseSearchResultsModuleCss","SearchcraftBaseSearchResultsStyle0","SearchcraftBaseSearchResults","componentDidLoad","this","unsubscribe","useSearchcraftStore","subscribe","state","query","length","hasSearched","searchResults","Object","assign","getState","disconnectedCallback","renderDocument","document","index","titleContent","getDocumentValueFromSearchResultMapping","searchResultMappings","title","subtitleContent","subtitle","bodyContent","body","containerHref","buttonHref","imageSource","footerContent","footer","serializedStyles","customStylesForResults","serializeStyles","h","key","document_id","resultImagePlacement","containerRel","containerTarget","buttonLabel","buttonRel","buttonTarget","render","trim","class","name","_a","data","documents","_d","_c","_b","hits","map","_index","doc","result","finalComponents","placeAdAtStart","push","adInterval","forEach","documentElements","placeAdAtEnd","_g","_f","_e","noResults","emit","_k","_j","_h"],"sources":["src/components/searchcraft-base-search-results/searchcraft-base-search-results.module.scss?tag=searchcraft-base-search-results","src/components/searchcraft-base-search-results/searchcraft-base-search-results.tsx"],"sourcesContent":[".searchcraft-search-results-container {\n display: flex;\n flex-direction: column;\n justify-content: center;\n gap: 16px;\n}\n\n.searchcraft-ad-section {\n align-items: center;\n background-color: #F1F1F1;\n border-radius: 16px;\n display: flex;\n flex-direction: column;\n font-size: 16px;\n justify-content: center;\n min-height: 176px;\n text-align: center;\n\n p {\n margin: 0;\n color: var(--sc-content-disabled);\n }\n}\n\n.searchcraft-search-results-empty-state-container {\n text-align: center;\n}\n\n.searchcraft-search-results-error-message-container {\n text-align: center;\n}\n","import {\n Component,\n h,\n Event,\n Prop,\n State,\n type EventEmitter,\n} from '@stencil/core';\n\nimport type { SearchcraftResponse } from '@searchcraft/core';\n\nimport { useSearchcraftStore } from '@provider/store';\n\nimport {\n getDocumentValueFromSearchResultMapping,\n serializeStyles,\n} from '@utils/utils';\nimport type { SearchResultMappings } from 'types';\n\n@Component({\n tag: 'searchcraft-base-search-results',\n styleUrl: 'searchcraft-base-search-results.module.scss',\n shadow: false,\n})\nexport class SearchcraftBaseSearchResults {\n @Prop() adInterval = 4;\n @Prop() customStylesForResults:\n | string\n | Record<string, Record<string, string>>\n | undefined;\n @Prop() searchResultMappings: SearchResultMappings | undefined;\n @Prop() placeAdAtEnd = false;\n @Prop() placeAdAtStart = true;\n @Prop() resultImagePlacement: 'left' | 'right' = 'right';\n @Prop() buttonLabel: string | undefined;\n @Prop() buttonTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n @Prop() buttonRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n @Prop() containerTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n @Prop() containerRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n\n @Event() noResults: EventEmitter<void>;\n\n @State() hasSearched = false;\n @State() query = '';\n @State() searchResults: SearchcraftResponse | null = null;\n\n private unsubscribe: () => void;\n\n componentDidLoad() {\n this.unsubscribe = useSearchcraftStore.subscribe((state) => {\n if (state.query.length > 0) {\n this.hasSearched = true;\n } else {\n this.hasSearched = false;\n }\n this.searchResults = { ...state.searchResults };\n this.query = state.query;\n });\n\n const { searchResults, query } = useSearchcraftStore.getState();\n this.searchResults = searchResults;\n this.query = query;\n }\n\n disconnectedCallback() {\n if (this.unsubscribe) {\n this.unsubscribe();\n }\n }\n\n renderDocument(document: Record<string, unknown>, index: number) {\n /**\n * Index field values -> Result container props mappings.\n */\n const titleContent = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings.title,\n );\n const subtitleContent = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings.subtitle,\n );\n const bodyContent = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings.body,\n );\n const containerHref = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings.containerHref,\n );\n const buttonHref = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings.buttonHref,\n );\n const imageSource = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings.imageSource,\n );\n const footerContent = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings.footer,\n );\n\n const serializedStyles =\n typeof this.customStylesForResults === 'string'\n ? this.customStylesForResults\n : serializeStyles(this.customStylesForResults);\n\n return (\n <searchcraft-base-search-result\n key={`${document.document_id}-${index}`}\n custom-styles={serializedStyles}\n image-placement={this.resultImagePlacement}\n container-rel={this.containerRel}\n container-target={this.containerTarget}\n button-label={this.buttonLabel || 'View more'}\n button-rel={this.buttonRel}\n button-target={this.buttonTarget}\n document-position={index}\n title-content={titleContent}\n subtitle-content={subtitleContent}\n body-content={bodyContent}\n footer-content={footerContent}\n container-href={containerHref}\n button-href={buttonHref}\n image-src={imageSource}\n />\n );\n }\n\n render() {\n if (this.query.trim() === '') {\n return (\n <div class='searchcraft-search-results-empty-state-container'>\n <slot name='empty-search' />\n </div>\n );\n }\n\n if (!this.searchResults?.data) {\n return;\n }\n\n const documents: Record<string, unknown>[] =\n this.searchResults?.data?.hits?.map((data, _index) => {\n const { doc: result } = data;\n return result;\n });\n\n const finalComponents: JSX.Element[] = [];\n\n if (this.placeAdAtStart) {\n finalComponents.push(\n <div key='ad-section-start' class='searchcraft-ad-section'>\n <p>Ad Section</p>\n </div>,\n );\n }\n\n if (this.adInterval > 0) {\n documents.forEach((document, index) => {\n finalComponents.push(this.renderDocument(document, index));\n\n if ((index + 1) % this.adInterval === 0) {\n finalComponents.push(\n <div\n key={`ad-section-${index + 1}`}\n class='searchcraft-ad-section '\n >\n <p>Ad Section</p>\n </div>,\n );\n }\n });\n } else {\n const documentElements = documents.map((document, index) =>\n this.renderDocument(document, index),\n );\n finalComponents.push(...documentElements);\n }\n\n if (this.placeAdAtEnd) {\n finalComponents.push(\n <div key='ad-section-end' class='searchcraft-ad-section'>\n <p>Ad Section</p>\n </div>,\n );\n }\n\n if (this.query.length > 0 && this.searchResults?.data?.hits?.length === 0) {\n this.noResults.emit();\n }\n\n return (\n <div class='searchcraft-search-results-container'>\n {finalComponents}\n {this.query.length > 0 &&\n this.searchResults?.data?.hits?.length === 0 && (\n <div class='searchcraft-search-results-error-message-container'>\n <searchcraft-error-message\n error-message={`No search results found for \"${this.query}\" query`}\n />\n </div>\n )}\n </div>\n );\n }\n}\n"],"mappings":"iIAAA,MAAMA,EAAwC,shHAC9C,MAAAC,EAAeD,E,MCuBFE,EAA4B,M,8EAClB,E,4FAME,M,oBACE,K,0BACwB,Q,6CAEe,S,8CAEG,S,6CAK5C,M,WACN,G,mBACoC,I,CAIrD,gBAAAC,GACEC,KAAKC,YAAcC,EAAoBC,WAAWC,IAChD,GAAIA,EAAMC,MAAMC,OAAS,EAAG,CAC1BN,KAAKO,YAAc,I,KACd,CACLP,KAAKO,YAAc,K,CAErBP,KAAKQ,cAAaC,OAAAC,OAAA,GAAQN,EAAMI,eAChCR,KAAKK,MAAQD,EAAMC,KAAK,IAG1B,MAAMG,cAAEA,EAAaH,MAAEA,GAAUH,EAAoBS,WACrDX,KAAKQ,cAAgBA,EACrBR,KAAKK,MAAQA,C,CAGf,oBAAAO,GACE,GAAIZ,KAAKC,YAAa,CACpBD,KAAKC,a,EAIT,cAAAY,CAAeC,EAAmCC,GAIhD,MAAMC,EAAeC,EACnBH,EACAd,KAAKkB,qBAAqBC,OAE5B,MAAMC,EAAkBH,EACtBH,EACAd,KAAKkB,qBAAqBG,UAE5B,MAAMC,EAAcL,EAClBH,EACAd,KAAKkB,qBAAqBK,MAE5B,MAAMC,EAAgBP,EACpBH,EACAd,KAAKkB,qBAAqBM,eAE5B,MAAMC,EAAaR,EACjBH,EACAd,KAAKkB,qBAAqBO,YAE5B,MAAMC,EAAcT,EAClBH,EACAd,KAAKkB,qBAAqBQ,aAE5B,MAAMC,EAAgBV,EACpBH,EACAd,KAAKkB,qBAAqBU,QAG5B,MAAMC,SACG7B,KAA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,KAAI,CAACtC,EAAUC,IAChDf,KAAKa,eAAeC,EAAUC,KAEhCyC,EAAgBE,QAAQG,E,CAG1B,GAAI7D,KAAK8D,aAAc,CACrBN,EAAgBE,KACd1B,EAAA,OAAKC,IAAI,iBAAiBU,MAAM,0BAC9BX,EAAA,wB,CAKN,GAAIhC,KAAKK,MAAMC,OAAS,KAAKyD,GAAAC,GAAAC,EAAAjE,KAAKQ,iBAAa,MAAAyD,SAAA,SAAAA,EAAEnB,QAAI,MAAAkB,SAAA,SAAAA,EAAEb,QAAI,MAAAY,SAAA,SAAAA,EAAEzD,UAAW,EAAG,CACzEN,KAAKkE,UAAUC,M,CAGjB,OACEnC,EAAA,OAAKW,MAAM,wCACRa,EACAxD,KAAKK,MAAMC,OAAS,KACnB8D,GAAAC,GAAAC,EAAAtE,KAAKQ,iBAAa,MAAA8D,SAAA,SAAAA,EAAExB,QAAI,MAAAuB,SAAA,SAAAA,EAAElB,QAAI,MAAAiB,SAAA,SAAAA,EAAE9D,UAAW,GACzC0B,EAAA,OAAKW,MAAM,sDACTX,EAAA,6CACiB,gCAAgChC,KAAKK,kB","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- import{r as e,h as s}from"./p-d7d0b88c.js";const o="";const c=o;const r=class{constructor(s){e(this,s);this.config=undefined;this.type="inline";this.popoverResultMappings=undefined}render(){return s("div",{key:"a0a5602203dc33f66fd950187e8f9761a13e5bdc",style:{display:"flex",flexDirection:"column",flex:"1"}},s("searchcraft-input",{key:"b8f9b0d86e66a17f8ddd9966e577e16c4834d1cb",onInputFocus:()=>console.log("focused"),onInputBlur:()=>console.log("blurred")}),s("searchcraft-popover-list-view",{key:"a6f5bf1118cd759f28e634e3dadbe64fe3470b6b",popoverResultMappings:this.popoverResultMappings}))}};r.style=c;export{r as searchcraft_popover_form};
2
- //# sourceMappingURL=p-61cf9d6c.entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["searchcraftPopoverFormModuleCss","SearchcraftPopoverFormStyle0","SearchcraftPopoverForm","render","h","key","style","display","flexDirection","flex","onInputFocus","console","log","onInputBlur","popoverResultMappings","this"],"sources":["src/components/searchcraft-popover-form/searchcraft-popover-form.module.scss?tag=searchcraft-popover-form","src/components/searchcraft-popover-form/searchcraft-popover-form.tsx"],"sourcesContent":[null,"import { Component, Prop, h } from '@stencil/core';\n\nimport type { SearchcraftConfig } from '@searchcraft/core';\n\nimport type { PopoverResultMappings } from 'types';\n\n@Component({\n tag: 'searchcraft-popover-form',\n styleUrl: 'searchcraft-popover-form.module.scss',\n shadow: false,\n})\nexport class SearchcraftPopoverForm {\n @Prop() config: SearchcraftConfig | undefined;\n @Prop() type: 'inline' | 'fullscreen' | 'modal' = 'inline';\n @Prop() popoverResultMappings: PopoverResultMappings | undefined;\n\n render() {\n return (\n <div style={{ display: 'flex', flexDirection: 'column', flex: '1' }}>\n <searchcraft-input\n onInputFocus={() => console.log('focused')}\n onInputBlur={() => console.log('blurred')}\n />\n <searchcraft-popover-list-view\n popoverResultMappings={this.popoverResultMappings}\n />\n </div>\n );\n }\n}\n"],"mappings":"2CAAA,MAAMA,EAAkC,GACxC,MAAAC,EAAeD,E,MCUFE,EAAsB,M,yDAEiB,S,qCAGlD,MAAAC,GACE,OACEC,EAAA,OAAAC,IAAA,2CAAKC,MAAO,CAAEC,QAAS,OAAQC,cAAe,SAAUC,KAAM,MAC5DL,EAAA,qBAAAC,IAAA,2CACEK,aAAc,IAAMC,QAAQC,IAAI,WAChCC,YAAa,IAAMF,QAAQC,IAAI,aAEjCR,EAAA,iCAAAC,IAAA,2CACES,sBAAuBC,KAAKD,wB","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- import{r as s,h as e,F as t}from"./p-d7d0b88c.js";import{u as r}from"./p-ad4ebde0.js";const c=":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.searchcraft-search-result-container{all:unset;align-items:flex-start;border-radius:16px;display:flex;flex-direction:column;gap:16px;padding:8px;color:inherit;background-color:var(--sc-surface-neutral-primary)}@media (min-width: 900px){.searchcraft-search-result-container{flex-direction:row}}a.searchcraft-search-result-container{cursor:pointer;transition:background-color 100ms}.searchcraft-base-search-result-content-container{flex:1;display:flex;flex-direction:column;gap:8px}.searchcraft-search-result-image{border-radius:var(--sc-image-border-radius);width:100%}@media (min-width: 900px){.searchcraft-search-result-image{width:200px}}.searchcraft-base-search-result-title{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-bold-font-size);font-weight:var(--sc-body-bold-font-weight);line-height:var(--sc-body-bold-line-height);margin:0;color:var(--sc-content-neutral-primary)}.searchcraft-base-search-result-subtitle{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-body-small-font-weight);line-height:var(--sc-body-small-line-height);margin:0;color:var(--sc-content-disabled)}.searchcraft-base-search-result-body-content{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-body-font-weight);line-height:var(--sc-body-line-height);margin:0;color:var(--sc-content-neutral-secondary)}.searchcraft-base-search-result-footer-content{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-body-font-weight);line-height:var(--sc-body-line-height);margin:0;color:var(--sc-content-disabled)}";const a=c;const i=class{constructor(e){s(this,e);this.searchcraftStore=r.getState();this.recordMeasureEvent=()=>{var s,e,t;const r=this.searchcraftStore.getSearchcraftInstance();if(r){const c=this.documentPosition;const a=this.searchcraftStore.query;const i=((t=(e=(s=this.searchcraftStore.searchResults)===null||s===void 0?void 0:s.data)===null||e===void 0?void 0:e.hits)===null||t===void 0?void 0:t.length)||0;r.sendMeasureEvent("document_clicked",{document_position:c,number_of_documents:i,search_term:a})}};this.parseStyles=()=>{if(this.customStyles){try{return JSON.parse(this.customStyles)}catch(s){console.error("Error parsing custom styles:",s);return{}}}return{}};this.titleContent=undefined;this.subtitleContent=undefined;this.bodyContent=undefined;this.footerContent=undefined;this.buttonLabel=undefined;this.buttonHref=undefined;this.buttonTarget="_blank";this.buttonRel=undefined;this.containerHref=undefined;this.containerTarget="_blank";this.containerRel=undefined;this.imageSrc=undefined;this.imageAlt=undefined;this.imagePlacement=undefined;this.customStyles=undefined;this.documentPosition=0}render(){const s=this.parseStyles();const r=this.imageSrc&&e("img",{alt:this.imageAlt,class:"searchcraft-search-result-image",src:this.imageSrc,style:s.image||{}});const c=e(t,null,this.imageSrc&&this.imagePlacement==="left"&&r,e("div",{class:"searchcraft-base-search-result-content-container"},this.titleContent&&e("h2",{class:"searchcraft-base-search-result-title",style:s.title||{}},this.titleContent),this.subtitleContent&&e("h3",{class:"searchcraft-base-search-result-subtitle",style:s.subtitle||{}},this.subtitleContent),this.bodyContent&&e("p",{class:"searchcraft-base-search-result-body-content",style:s.primaryContent||{}},this.bodyContent),this.footerContent&&e("p",{class:"searchcraft-base-search-result-footer-content",style:s.secondaryContent||{}},this.footerContent),this.buttonHref&&!this.containerHref&&this.buttonLabel&&e("a",{class:"searchcraft-search-result-button",href:this.buttonHref,style:s.button||{},target:this.buttonTarget,rel:this.buttonRel},this.buttonLabel)),this.imageSrc&&this.imagePlacement==="right"&&r);if(this.containerHref){return e("a",{class:"searchcraft-search-result-container",onClick:this.recordMeasureEvent,href:this.containerHref,rel:this.containerRel,style:s.container||{},tabindex:"0",target:this.containerTarget},c)}return e("div",{class:"searchcraft-search-result-container",style:s.container||{}},c)}};i.style=a;export{i as searchcraft_base_search_result};
2
- //# sourceMappingURL=p-93b92b65.entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["searchcraftBaseSearchResultModuleCss","SearchcraftBaseSearchResultStyle0","SearchcraftBaseSearchResult","this","searchcraftStore","useSearchcraftStore","getState","recordMeasureEvent","searchcraft","getSearchcraftInstance","document_position","documentPosition","search_term","query","number_of_documents","_c","_b","_a","searchResults","data","hits","length","sendMeasureEvent","parseStyles","customStyles","JSON","parse","error","console","render","styles","imageContainer","imageSrc","h","alt","imageAlt","class","src","style","image","contentContainer","Fragment","imagePlacement","titleContent","title","subtitleContent","subtitle","bodyContent","primaryContent","footerContent","secondaryContent","buttonHref","containerHref","buttonLabel","href","button","target","buttonTarget","rel","buttonRel","onClick","containerRel","container","tabindex","containerTarget"],"sources":["src/components/searchcraft-base-search-result/searchcraft-base-search-result.module.scss?tag=searchcraft-base-search-result","src/components/searchcraft-base-search-result/searchcraft-base-search-result.tsx"],"sourcesContent":["\n.searchcraft-search-result-container {\n all: unset;\n align-items: flex-start;\n border-radius: 16px;\n display: flex;\n flex-direction: column;\n gap: 16px;\n padding: 8px;\n color: inherit;\n\n background-color: var(--sc-surface-neutral-primary);\n\n @media (min-width: 900px) {\n flex-direction: row;\n }\n}\n\na.searchcraft-search-result-container {\n cursor: pointer;\n transition: background-color 100ms;\n}\n\n.searchcraft-base-search-result-content-container {\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.searchcraft-search-result-image {\n border-radius: var(--sc-image-border-radius);\n width: 100%;\n\n @media (min-width: 900px) {\n width: 200px;\n }\n}\n\n.searchcraft-base-search-result-title {\n @include body-bold();\n margin: 0;\n color: var(--sc-content-neutral-primary);\n}\n\n.searchcraft-base-search-result-subtitle {\n @include body-small();\n margin: 0;\n color: var(--sc-content-disabled);\n}\n\n.searchcraft-base-search-result-body-content {\n @include body();\n margin: 0;\n color: var(--sc-content-neutral-secondary);\n}\n\n.searchcraft-base-search-result-footer-content {\n @include body();\n margin: 0;\n color: var(--sc-content-disabled);\n}\n","import { useSearchcraftStore } from '@provider/store';\nimport { Component, Fragment, h, Prop } from '@stencil/core';\n\n@Component({\n tag: 'searchcraft-base-search-result',\n styleUrl: 'searchcraft-base-search-result.module.scss',\n shadow: false,\n})\nexport class SearchcraftBaseSearchResult {\n @Prop() titleContent: string | undefined;\n @Prop() subtitleContent: string | undefined;\n @Prop() bodyContent: string | undefined;\n @Prop() footerContent: string | undefined;\n @Prop() buttonLabel: string | undefined;\n @Prop() buttonHref: string | undefined;\n @Prop() buttonTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n @Prop() buttonRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n @Prop() containerHref: string | undefined;\n @Prop() containerTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n @Prop() containerRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n @Prop() imageSrc: string | undefined;\n @Prop() imageAlt: string | undefined;\n @Prop() imagePlacement: 'left' | 'right';\n @Prop() customStyles: string | undefined;\n @Prop() documentPosition = 0;\n\n private searchcraftStore = useSearchcraftStore.getState();\n\n private recordMeasureEvent = () => {\n const searchcraft = this.searchcraftStore.getSearchcraftInstance();\n\n if (searchcraft) {\n const document_position = this.documentPosition;\n const search_term = this.searchcraftStore.query;\n const number_of_documents =\n this.searchcraftStore.searchResults?.data?.hits?.length || 0;\n\n searchcraft.sendMeasureEvent('document_clicked', {\n document_position,\n number_of_documents,\n search_term,\n });\n }\n };\n\n private parseStyles = (): Record<string, { [key: string]: string }> => {\n if (this.customStyles) {\n try {\n return JSON.parse(this.customStyles);\n } catch (error) {\n console.error('Error parsing custom styles:', error);\n return {};\n }\n }\n return {};\n };\n\n render() {\n const styles = this.parseStyles();\n const imageContainer = this.imageSrc && (\n <img\n alt={this.imageAlt}\n class='searchcraft-search-result-image'\n src={this.imageSrc}\n style={styles.image || {}}\n />\n );\n\n const contentContainer = (\n <Fragment>\n {this.imageSrc && this.imagePlacement === 'left' && imageContainer}\n <div class='searchcraft-base-search-result-content-container'>\n {this.titleContent && (\n <h2\n class='searchcraft-base-search-result-title'\n style={styles.title || {}}\n >\n {this.titleContent}\n </h2>\n )}\n {this.subtitleContent && (\n <h3\n class='searchcraft-base-search-result-subtitle'\n style={styles.subtitle || {}}\n >\n {this.subtitleContent}\n </h3>\n )}\n {this.bodyContent && (\n <p\n class='searchcraft-base-search-result-body-content'\n style={styles.primaryContent || {}}\n >\n {this.bodyContent}\n </p>\n )}\n\n {this.footerContent && (\n <p\n class='searchcraft-base-search-result-footer-content'\n style={styles.secondaryContent || {}}\n >\n {this.footerContent}\n </p>\n )}\n {this.buttonHref && !this.containerHref && this.buttonLabel && (\n <a\n class='searchcraft-search-result-button'\n href={this.buttonHref}\n style={styles.button || {}}\n target={this.buttonTarget}\n rel={this.buttonRel}\n >\n {this.buttonLabel}\n </a>\n )}\n </div>\n {this.imageSrc && this.imagePlacement === 'right' && imageContainer}\n </Fragment>\n );\n\n /** Render as an anchor tag if the containerHref prop is present. */\n if (this.containerHref) {\n return (\n <a\n class='searchcraft-search-result-container'\n onClick={this.recordMeasureEvent}\n href={this.containerHref}\n rel={this.containerRel}\n style={styles.container || {}}\n tabindex='0'\n target={this.containerTarget}\n >\n {contentContainer}\n </a>\n );\n }\n\n /** Render as a div if no href prop. */\n return (\n <div\n class='searchcraft-search-result-container'\n style={styles.container || {}}\n >\n {contentContainer}\n </div>\n );\n }\n}\n"],"mappings":"sFAA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C,aAIT5C,KAAK8C,eACJhB,EAAA,KACEG,MAAM,gDACNE,MAAOR,EAAOoB,kBAAoB,IAEjC/C,KAAK8C,eAGT9C,KAAKgD,aAAehD,KAAKiD,eAAiBjD,KAAKkD,aAC9CpB,EAAA,KACEG,MAAM,mCACNkB,KAAMnD,KAAKgD,WACXb,MAAOR,EAAOyB,QAAU,GACxBC,OAAQrD,KAAKsD,aACbC,IAAKvD,KAAKwD,WAETxD,KAAKkD,cAIXlD,KAAK6B,UAAY7B,KAAKuC,iBAAmB,SAAWX,GAKzD,GAAI5B,KAAKiD,cAAe,CACtB,OACEnB,EAAA,KACEG,MAAM,sCACNwB,QAASzD,KAAKI,mBACd+C,KAAMnD,KAAKiD,cACXM,IAAKvD,KAAK0D,aACVvB,MAAOR,EAAOgC,WAAa,GAC3BC,SAAS,IACTP,OAAQrD,KAAK6D,iBAEZxB,E,CAMP,OACEP,EAAA,OACEG,MAAM,sCACNE,MAAOR,EAAOgC,WAAa,IAE1BtB,E","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- import{r as e,h as c}from"./p-d7d0b88c.js";const o="";const a=o;const d=class{constructor(c){e(this,c)}componentDidLoad(){}connectedCallback(){}disconnectedCallback(){}render(){return c("div",{key:"e4d6558ca479b241642b04513e173ac9abadeab0",style:{display:"flex"}},c("p",{key:"c9e99c2d2e829d00f7d3905e52deb6061ff71077"},"[popover result]"))}};d.style=a;export{d as searchcraft_popover_result};
2
- //# sourceMappingURL=p-a7a7b4e0.entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["searchcraftPopoverResultModuleCss","SearchcraftPopoverResultStyle0","SearchcraftPopoverResult","componentDidLoad","connectedCallback","disconnectedCallback","render","h","key","style","display"],"sources":["src/components/searchcraft-popover-result/searchcraft-popover-result.module.scss?tag=searchcraft-popover-result","src/components/searchcraft-popover-result/searchcraft-popover-result.tsx"],"sourcesContent":[null,"import { Component, h } from '@stencil/core';\n\n@Component({\n tag: 'searchcraft-popover-result',\n styleUrl: 'searchcraft-popover-result.module.scss',\n shadow: false,\n})\nexport class SearchcraftPopoverResult {\n componentDidLoad() {}\n\n connectedCallback() {}\n\n disconnectedCallback() {}\n\n render() {\n return (\n <div style={{ display: 'flex' }}>\n <p>[popover result]</p>\n </div>\n );\n }\n}\n"],"mappings":"2CAAA,MAAMA,EAAoC,GAC1C,MAAAC,EAAeD,E,MCMFE,EAAwB,M,yBACnC,gBAAAC,GAAgB,CAEhB,iBAAAC,GAAiB,CAEjB,oBAAAC,GAAoB,CAEpB,MAAAC,GACE,OACEC,EAAA,OAAAC,IAAA,2CAAKC,MAAO,CAAEC,QAAS,SACrBH,EAAA,KAAAC,IAAA,gE","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- import{r as e,h as s}from"./p-d7d0b88c.js";import{u as a}from"./p-ad4ebde0.js";import{a as c}from"./p-f308d05d.js";const t=":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.searchcraft-filter-panel{display:flex;flex-direction:column;gap:16px}.searchcraft-filter-panel-section{display:flex;flex-direction:column;gap:8px}.searchcraft-filter-panel-label{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-bold-font-size);font-weight:var(--sc-body-small-bold-font-weight);line-height:var(--sc-body-small-bold-line-height)}";const n=t;const r=class{constructor(s){e(this,s);this.searchStore=a.getState();this.items=[];this.unsubscribe=undefined;this.lastQuery=undefined}componentDidLoad(){this.unsubscribe=a.subscribe((e=>{this.lastQuery=e.query||""}))}disconnectedCallback(){var e;(e=this.unsubscribe)===null||e===void 0?void 0:e.call(this)}handleDateRangeChanged(e,s,a){const c=new Date(s);const t=new Date(a);this.searchStore.addRangeValueForIndexField({fieldName:e,value:`${e}:[${c.toISOString()} TO ${t.toISOString()}]`});this.searchStore.search()}handleNumericRangeChanged(e,s,a){this.searchStore.addRangeValueForIndexField({fieldName:e,value:`${e}:[${s} TO ${a}]`});this.searchStore.search()}handleFacetSelectionUpdated(e,s){if(s.length>0){this.searchStore.addFacetPathsForIndexField({fieldName:e,value:`${e}: IN [${s.join(" ")}]`})}else{this.searchStore.removeFacetPathsForIndexField(e)}this.searchStore.search()}handleExactMatchToggleUpdated(e){this.searchStore.setSearchMode(e?"normal":"fuzzy");this.searchStore.search()}handleMostRecentToggleUpdated(e){this.searchStore.setSortType(e?"desc":"asc");this.searchStore.search()}render(){return s("div",{key:"45bcbe509465b8fe3720f3a535902906acfac2ea",class:"searchcraft-filter-panel"},this.items.map((e=>{switch(e.type){case"dateRange":{const a=e;const t=new Date(a.options.minDate).getTime();const n=new Date(a.options.maxDate).getTime();const r=c(a.options.granularity);return s("div",{class:"searchcraft-filter-panel-section"},s("p",{class:"searchcraft-filter-panel-label"},e.label),s("searchcraft-slider",{min:t,max:n,granularity:r,dataType:"date",onRangeChanged:e=>{this.handleDateRangeChanged(a.fieldName,e.detail.startValue,e.detail.endValue)}}))}case"numericRange":{const a=e;return s("div",{class:"searchcraft-filter-panel-section"},s("p",{class:"searchcraft-filter-panel-label"},e.label),s("searchcraft-slider",{min:a.options.min,max:a.options.max,granularity:a.options.granularity,onRangeChanged:e=>{this.handleNumericRangeChanged(a.fieldName,e.detail.startValue,e.detail.endValue)}}))}case"facets":{const a=e;return s("div",{class:"searchcraft-filter-panel-section"},s("p",{class:"searchcraft-filter-panel-label"},e.label),s("searchcraft-facet-list",{fieldName:a.fieldName,onFacetSelectionUpdated:e=>{this.handleFacetSelectionUpdated(a.fieldName,e.detail.paths)}}))}case"exactMatchToggle":{const a=e;return s("searchcraft-toggle-button",{label:a.label,subLabel:a.options.subLabel,onToggleUpdated:e=>{this.handleExactMatchToggleUpdated(e.detail)}})}case"mostRecentToggle":{const a=e;return s("searchcraft-toggle-button",{label:a.label,subLabel:a.options.subLabel,onToggleUpdated:e=>{this.handleMostRecentToggleUpdated(e.detail)}})}}})))}};r.style=n;export{r as searchcraft_filter_panel};
2
- //# sourceMappingURL=p-a810aeae.entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["searchcraftFilterPanelModuleCss","SearchcraftFilterPanelStyle0","SearchcraftFilterPanel","this","searchStore","useSearchcraftStore","getState","componentDidLoad","unsubscribe","subscribe","state","lastQuery","query","disconnectedCallback","_a","call","handleDateRangeChanged","fieldName","min","max","start","Date","end","addRangeValueForIndexField","value","toISOString","search","handleNumericRangeChanged","handleFacetSelectionUpdated","paths","length","addFacetPathsForIndexField","join","removeFacetPathsForIndexField","handleExactMatchToggleUpdated","isActive","setSearchMode","handleMostRecentToggleUpdated","setSortType","render","h","key","class","items","map","filterItem","type","item","options","minDate","getTime","maxDate","granularityValue","getMillis","granularity","label","dataType","onRangeChanged","event","detail","startValue","endValue","onFacetSelectionUpdated","subLabel","onToggleUpdated"],"sources":["src/components/searchcraft-filter-panel/searchcraft-filter-panel.module.scss?tag=searchcraft-filter-panel","src/components/searchcraft-filter-panel/searchcraft-filter-panel.tsx"],"sourcesContent":[".searchcraft-filter-panel {\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n\n.searchcraft-filter-panel-section {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.searchcraft-filter-panel-label {\n @include body-small-bold();\n}\n","import { Component, h, Prop, State } from '@stencil/core';\nimport type {\n FilterItem,\n DateRangeFilterItem,\n NumericFilterItem,\n ExactMatchToggleFilterItem,\n FacetsFilterItem,\n} from '../../types/searchcraft-filter-panel.types';\nimport { useSearchcraftStore } from '@provider/store';\nimport { getMillis } from '@utils/utils';\n\n@Component({\n tag: 'searchcraft-filter-panel',\n styleUrl: 'searchcraft-filter-panel.module.scss',\n shadow: false,\n})\nexport class SearchcraftFilterPanel {\n @Prop() items: FilterItem[] = [];\n\n @State() unsubscribe: (() => void) | undefined;\n @State() lastQuery: string | undefined;\n\n private searchStore = useSearchcraftStore.getState();\n\n componentDidLoad() {\n this.unsubscribe = useSearchcraftStore.subscribe((state) => {\n if (this.lastQuery !== state.query) {\n // A place to put actions to do when the query changes\n }\n this.lastQuery = state.query || '';\n });\n }\n\n disconnectedCallback() {\n this.unsubscribe?.();\n }\n\n handleDateRangeChanged(fieldName: string, min: number, max: number) {\n const start = new Date(min);\n const end = new Date(max);\n this.searchStore.addRangeValueForIndexField({\n fieldName,\n value: `${fieldName}:[${start.toISOString()} TO ${end.toISOString()}]`,\n });\n\n this.searchStore.search();\n }\n\n handleNumericRangeChanged(fieldName: string, min: number, max: number) {\n this.searchStore.addRangeValueForIndexField({\n fieldName,\n value: `${fieldName}:[${min} TO ${max}]`,\n });\n this.searchStore.search();\n }\n\n handleFacetSelectionUpdated(fieldName: string, paths: string[]) {\n if (paths.length > 0) {\n this.searchStore.addFacetPathsForIndexField({\n fieldName,\n value: `${fieldName}: IN [${paths.join(' ')}]`,\n });\n } else {\n this.searchStore.removeFacetPathsForIndexField(fieldName);\n }\n this.searchStore.search();\n }\n\n handleExactMatchToggleUpdated(isActive: boolean) {\n this.searchStore.setSearchMode(isActive ? 'normal' : 'fuzzy');\n this.searchStore.search();\n }\n\n handleMostRecentToggleUpdated(isActive: boolean) {\n this.searchStore.setSortType(isActive ? 'desc' : 'asc');\n this.searchStore.search();\n }\n\n /**\n * Iterate through `items` and render them based on `type`\n */\n render() {\n return (\n <div class='searchcraft-filter-panel'>\n {this.items.map((filterItem) => {\n switch (filterItem.type) {\n case 'dateRange': {\n const item = filterItem as DateRangeFilterItem;\n const min = new Date(item.options.minDate).getTime();\n const max = new Date(item.options.maxDate).getTime();\n const granularityValue = getMillis(item.options.granularity);\n // return date range slider\n return (\n <div class='searchcraft-filter-panel-section'>\n <p class='searchcraft-filter-panel-label'>\n {filterItem.label}\n </p>\n <searchcraft-slider\n min={min}\n max={max}\n granularity={granularityValue}\n dataType='date'\n onRangeChanged={(event) => {\n this.handleDateRangeChanged(\n item.fieldName,\n event.detail.startValue,\n event.detail.endValue,\n );\n }}\n />\n </div>\n );\n }\n case 'numericRange': {\n const item = filterItem as NumericFilterItem;\n // return date range slider\n return (\n <div class='searchcraft-filter-panel-section'>\n <p class='searchcraft-filter-panel-label'>\n {filterItem.label}\n </p>\n <searchcraft-slider\n min={item.options.min}\n max={item.options.max}\n granularity={item.options.granularity}\n onRangeChanged={(event) => {\n this.handleNumericRangeChanged(\n item.fieldName,\n event.detail.startValue,\n event.detail.endValue,\n );\n }}\n />\n </div>\n );\n }\n case 'facets': {\n const item = filterItem as FacetsFilterItem;\n // return \"filters-list\"\n return (\n <div class='searchcraft-filter-panel-section'>\n <p class='searchcraft-filter-panel-label'>\n {filterItem.label}\n </p>\n <searchcraft-facet-list\n fieldName={item.fieldName}\n onFacetSelectionUpdated={(event) => {\n this.handleFacetSelectionUpdated(\n item.fieldName,\n event.detail.paths,\n );\n }}\n />\n </div>\n );\n }\n case 'exactMatchToggle': {\n const item = filterItem as ExactMatchToggleFilterItem;\n return (\n <searchcraft-toggle-button\n label={item.label}\n subLabel={item.options.subLabel}\n onToggleUpdated={(event) => {\n this.handleExactMatchToggleUpdated(event.detail);\n }}\n />\n );\n }\n case 'mostRecentToggle': {\n const item = filterItem as ExactMatchToggleFilterItem;\n return (\n <searchcraft-toggle-button\n label={item.label}\n subLabel={item.options.subLabel}\n onToggleUpdated={(event) => {\n this.handleMostRecentToggleUpdated(event.detail);\n }}\n />\n );\n }\n }\n })}\n </div>\n );\n }\n}\n"],"mappings":"mHAAA,MAAMA,EAAkC,s6GACxC,MAAAC,EAAeD,E,MCeFE,EAAsB,M,yBAMzBC,KAAAC,YAAcC,EAAoBC,W,WALZ,G,oDAO9B,gBAAAC,GACEJ,KAAKK,YAAcH,EAAoBI,WAAWC,IAIhDP,KAAKQ,UAAYD,EAAME,OAAS,EAAE,G,CAItC,oBAAAC,G,OACEC,EAAAX,KAAKK,eAAW,MAAAM,SAAA,SAAAA,EAAAC,KAAAZ,K,CAGlB,sBAAAa,CAAuBC,EAAmBC,EAAaC,GACrD,MAAMC,EAAQ,IAAIC,KAAKH,GACvB,MAAMI,EAAM,IAAID,KAAKF,GACrBhB,KAAKC,YAAYmB,2BAA2B,CAC1CN,YACAO,MAAO,GAAGP,MAAcG,EAAMK,oBAAoBH,EAAIG,mBAGxDtB,KAAKC,YAAYsB,Q,CAGnB,yBAAAC,CAA0BV,EAAmBC,EAAaC,GACxDhB,KAAKC,YAAYmB,2BAA2B,CAC1CN,YACAO,MAAO,GAAGP,MAAcC,QAAUC,OAEpChB,KAAKC,YAAYsB,Q,CAGnB,2BAAAE,CAA4BX,EAAmBY,GAC7C,GAAIA,EAAMC,OAAS,EAAG,CACpB3B,KAAKC,YAAY2B,2BAA2B,CAC1Cd,YACAO,MAAO,GAAGP,UAAkBY,EAAMG,KAAK,S,KAEpC,CACL7B,KAAKC,YAAY6B,8BAA8BhB,E,CAEjDd,KAAKC,YAAYsB,Q,CAGnB,6BAAAQ,CAA8BC,GAC5BhC,KAAKC,YAAYgC,cAAcD,EAAW,SAAW,SACrDhC,KAAKC,YAAYsB,Q,CAGnB,6BAAAW,CAA8BF,GAC5BhC,KAAKC,YAAYkC,YAAYH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AAKC,QAAQe,SACvBC,gBAAkBN,IAChBvD,KAAK+B,8BAA8BwB,EAAMC,OAAO,G,CAKxD,IAAK,mBAAoB,CACvB,MAAMZ,EAAOF,EACb,OACEL,EAAA,6BACEe,MAAOR,EAAKQ,MACZQ,SAAUhB,EAAKC,QAAQe,SACvBC,gBAAkBN,IAChBvD,KAAKkC,8BAA8BqB,EAAMC,OAAO,G","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- import{r as e,c as s,h as c,F as a}from"./p-d7d0b88c.js";import{c as t}from"./p-5cdc6210.js";import{u as r}from"./p-ad4ebde0.js";import{m as i,r as n,a as o}from"./p-f308d05d.js";const d=":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.filtersListContainer{width:100%}.filterCheckboxLabel{align-items:center;color:var(--sc-content-primary);display:flex;font-family:var(--sc-font-family);font-size:14px;font-weight:600;gap:14px;position:relative;-webkit-font-smoothing:antialiased}.filterCheckboxLabel input[type=checkbox]{align-items:center;appearance:none;background-color:var(--sc-surface-brand-secondary-hover);border:1px solid var(--sc-surface-disabled);border-radius:8px;cursor:pointer;display:flex;height:24px;justify-content:center;width:24px}.filterCheckboxLabel input[type=checkbox]:focus{outline:2px solid var(--sc-surface-brand-primary)}.filterCheckboxLabel input[type=checkbox]:checked{background-color:var(--sc-surface-brand-primary);position:relative}.filterCheckboxLabel input[type=checkbox]:checked+.checkContainer{display:block}.filterCheckboxLabel input[type=checkbox]:checked+.dashContainer{display:block}.childFilterCheckboxLabel{align-items:center;color:var(--sc-content-primary);display:flex;font-family:var(--sc-font-family);font-size:14px;font-weight:600;gap:12px;margin-left:24px;position:relative}.childFilterCheckboxLabel input[type=checkbox]{align-items:center;appearance:none;background-color:var(--sc-surface-brand-secondary-hover);border:1px solid var(--sc-surface-disabled);border-radius:8px;cursor:pointer;display:flex;height:24px;justify-content:center;position:relative;width:24px;-webkit-font-smoothing:antialiased}.childFilterCheckboxLabel input[type=checkbox]:focus{outline:2px solid var(--sc-surface-brand-primary)}.childFilterCheckboxLabel input[type=checkbox]:checked{background-color:var(--sc-surface-brand-primary);position:relative}.childFilterCheckboxLabel input[type=checkbox]:checked+.checkContainer{display:block}.childFilterCheckboxLabel input[type=checkbox]:checked+.dashContainer{display:block}.checkContainer{display:none;height:16px;width:16px;position:absolute;top:9px;left:8px}.dashContainer{display:none;height:3px;width:14px;position:absolute;top:3px;left:9px}.searchcraft-facet-message{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-body-small-font-weight);line-height:var(--sc-body-small-line-height);color:var(--sc-content-disabled);text-align:center}";const h=d;const l=class{constructor(c){e(this,c);this.facetSelectionUpdated=s(this,"facetSelectionUpdated",7);this.searchStore=r.getState();this.formatLabel=e=>{const s=e.path.replace(/^\//,"");const c=e.count;return`${s.replace(/-/g," ").replace(/\b\w/g,(e=>e.toUpperCase()))} (${c})`};this.formatSubLabel=(e,s)=>{const c=e.path.substring(s.path.length);const a=c.replace(/^\//,"");const t=e.count;return`${a.replace(/-/g," ").replace(/\b\w/g,(e=>e.toUpperCase()))} (${t})`};this.fieldName=undefined;this.baseFacetRoot=undefined;this.facetRoot=undefined;this.selectedPaths={};this.lastTimeTaken=undefined;this.hasNewSearchTerm=false;this.lastQuery=undefined;this.lastSearchMode=undefined;this.lastSortType=undefined;this.unsubscribe=undefined}handleStateUpdate(e){var s,c;const a=(s=e.searchResults)===null||s===void 0?void 0:s.data.facets;const t=(c=e.searchResults)===null||c===void 0?void 0:c.data.time_taken;if(e.query!==this.lastQuery||e.searchMode!==this.lastSearchMode||e.sortType!==this.lastSortType){this.selectedPaths={};this.hasNewSearchTerm=true}if(t!==this.lastTimeTaken&&a){this.facetRoot=undefined;const e=a.find((e=>this.fieldName===Object.keys(e)[0]));if(this.hasNewSearchTerm){this.baseFacetRoot=e;this.facetRoot=e;this.hasNewSearchTerm=false}else if(this.baseFacetRoot){this.facetRoot=i(this.fieldName,this.baseFacetRoot,e)}}this.lastQuery=e.query;this.lastSearchMode=e.searchMode;this.lastSortType=e.sortType;this.lastTimeTaken=t}connectedCallback(){this.handleStateUpdate(this.searchStore);this.unsubscribe=r.subscribe((e=>{this.handleStateUpdate(e)}))}disconnectedCallback(){var e;(e=this.unsubscribe)===null||e===void 0?void 0:e.call(this)}handleCheckboxChange(e){const s=!this.selectedPaths[e];if(s){this.selectedPaths=Object.assign(Object.assign({},this.selectedPaths),{[e]:true})}else{const s=Object.keys(this.selectedPaths).filter((s=>!s.includes(e)));this.selectedPaths=s.reduce(((e,s)=>{e[s]=true;return e}),{})}const c=Object.keys(this.selectedPaths).filter((e=>this.selectedPaths[e]));const a=n(c);this.facetSelectionUpdated.emit({paths:a})}render(){var e;const s=(e=this.facetRoot)===null||e===void 0?void 0:e[this.fieldName];return c("div",{key:"c7b6a2c7bbb48d0835745b4bcae43a283ade4139",class:t("filtersListContainer","searchcraft-filters-list-container")},!s&&c("p",{key:"a682f57ff51fdcfec670744ef84930c90c9b9c20",class:"searchcraft-facet-message"},"Enter a search to view facets."),s===null||s===void 0?void 0:s.map((e=>{var s;const r=e.children?(s=e.children)===null||s===void 0?void 0:s.some((e=>this.selectedPaths[e.path])):false;return c("div",{key:e.path,class:t("searchcraft-filters-list-item")},c("label",{class:t("filterCheckboxLabel","searchcraft-filters-list-checkbox-label")},c("input",{checked:this.selectedPaths[e.path],onChange:s=>this.handleCheckboxChange(e.path),type:"checkbox"}),r?c("div",{class:t("dashContainer","searchcraft-filter-list-dash-container")},c("searchcraft-dash-icon",null)):c("div",{class:t("checkContainer","searchcraft-filter-list-check-container")},c("searchcraft-check-icon",null)),this.formatLabel(e)),e.children&&e.children.length>0&&c(a,null,e.children.map((s=>c("label",{key:s.path,class:t("childFilterCheckboxLabel","searchcraft-child-filter-checkbox-label"),style:{display:this.selectedPaths[e.path]?"flex":"none"}},c("input",{checked:this.selectedPaths[s.path],onChange:e=>{this.handleCheckboxChange(s.path)},type:"checkbox"}),c("div",{class:t("checkContainer","searchcraft-filter-list-check-container")},c("searchcraft-check-icon",null)),this.formatSubLabel(s,e))))))})))}};l.style=h;const f=':root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.searchcraft-slider-container{align-items:center;display:flex;flex-direction:column;gap:10px;width:100%}.searchcraft-slider-range-container{align-items:center;background-color:var(--sc-surface-disabled);border-radius:999px;display:flex;position:relative;height:4px;width:100%}.searchcraft-slider-range-container::-webkit-slider-runnable-track{pointer-events:none}.searchcraft-slider-range-container .searchcraft-slider-active-range{background-color:var(--sc-surface-brand-primary);border-radius:2px;height:4px;position:absolute;top:50%;transform:translateY(-50%);z-index:0}.searchcraft-slider-range-container .searchcraft-slider-active-range::-webkit-slider-runnable-track{pointer-events:none}.searchcraft-slider-range-container .searchcraft-slider-active-range::-moz-range-track{pointer-events:none}.searchcraft-slider-range-container .searchcraft-slider-input{appearance:none;background:transparent;border-radius:2px;height:4px;margin:0;outline:none;pointer-events:none;position:absolute;width:100%;-webkit-appearance:none}.searchcraft-slider-range-container .searchcraft-slider-input::-webkit-slider-thumb{background-color:var(--sc-surface-neutral-light);border-radius:50%;border:2px solid var(--sc-border-neutral);cursor:pointer;height:20px;pointer-events:all;width:20px;-webkit-appearance:none}.searchcraft-slider-range-container .searchcraft-slider-input::-moz-range-thumb{background-color:var(--sc-surface-neutral-light);border-radius:50%;border:2px solid var(--sc-border-neutral);cursor:pointer;height:20px;pointer-events:all;width:20px}.searchcraft-slider-label-container{color:var(--sc-content-primary);display:flex;font-family:"Source Sans Pro", sans-serif;font-size:15px;font-weight:600;justify-content:space-between;margin-top:10px;width:100%}.searchcraft-slider-label{min-width:30px;text-align:center}';const u=f;const p=class{constructor(c){e(this,c);this.rangeChanged=s(this,"rangeChanged",7);this.emitUpdate=async()=>{this.rangeChanged.emit({startValue:this.startValue,endValue:this.endValue})};this.handleStartValueChange=e=>{const s=e.target;const c=Number.parseInt(s.value,10);this.lastFocusedHandle="min";if(c<=this.endValue){this.startValue=c;this.emitUpdate()}else{this.startValue=this.endValue;s.value=`${this.endValue}`}};this.handleEndValueChange=e=>{const s=e.target;const c=Number.parseInt(s.value,10);this.lastFocusedHandle="max";if(c>=this.startValue){this.endValue=c;this.emitUpdate()}else{this.endValue=this.startValue;s.value=`${this.startValue}`}};this.max=100;this.min=0;this.granularity=o("month");this.dataType="number";this.endValue=this.max;this.startValue=this.min;this.lastFocusedHandle="max"}componentDidLoad(){this.startValue=this.min;this.endValue=this.max}render(){const e=this.min;const s=this.max;const a=(this.startValue-e)/(s-e)*100;const r=(this.endValue-e)/(s-e)*100;const i=this.dataType==="number"?this.startValue:new Date(this.startValue).getFullYear();const n=this.dataType==="number"?this.endValue:new Date(this.endValue).getFullYear();return c("div",{key:"51de4996df052bf178590aeb4c56a67ec57c92e5",class:"searchcraft-slider-container"},c("div",{key:"634bead69c3fbc462cda3dd65dd4ba6a398c6913",class:"searchcraft-slider-range-container"},c("div",{key:"1b7a0b63ef208884f24b9f56b48a72bca320c71b",class:"searchcraft-slider-active-range",style:{left:`${a}%`,width:`${r-a}%`}}),c("input",{key:"29313d6909d5ff646d7f3810163f5f01fe09cc36",class:t("searchcraft-slider-input","searchcraft-slider-input-min-handle"),max:this.max,min:this.min,onInput:this.handleStartValueChange.bind(this),step:this.granularity,style:{zIndex:this.lastFocusedHandle==="min"?"2":"1"},type:"range",value:this.startValue}),c("input",{key:"1e95e93a028c7bc204e2f3894bfe8b77ac6c9d28",class:t("searchcraft-slider-input","searchcraft-slider-input-max-handle"),max:this.max,min:this.min,onInput:this.handleEndValueChange.bind(this),step:this.granularity,style:{zIndex:this.lastFocusedHandle==="max"?"2":"1"},type:"range",value:this.endValue})),c("div",{key:"c1560933a38f3153ac1dbaece041ef75df479dc4",class:"searchcraft-slider-label-container"},c("span",{key:"638f72b8c081a324cc3ecb833163cd036a6ab90c",class:"searchcraft-slider-label"},i),c("span",{key:"011968bdf897de9960fe2214b4adceee4d79b6d0",class:"searchcraft-slider-label"},n)))}};p.style=u;const b=":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.searchcraft-toggle-button-container{display:flex;justify-content:space-between;align-items:flex-start;gap:10px}.searchcraft-toggle-button-label{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-body-font-weight);line-height:var(--sc-body-line-height);margin:0;color:var(--sc-content-neutral-primary)}.searchcraft-toggle-button-sub-label{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-body-small-font-weight);line-height:var(--sc-body-small-line-height);margin:0;color:var(--sc-content-neutral-secondary)}.searchcraft-toggle-button-background{transition:background-color 0.2s;background:var(--sc-surface-disabled);border:none;border-radius:16px;cursor:pointer;height:26px;position:relative;width:44px;flex-shrink:0}.searchcraft-toggle-button-background.active{background:var(--sc-surface-brand-primary);box-shadow:0px 0px 0px 1px rgba(0, 0, 0, 0.05)}.searchcraft-toggle-button-handle{background:var(--sc-surface-neutral-light);border-radius:50%;height:18px;left:4px;position:absolute;top:calc(50% - 9px);transition:transform 0.3s ease;width:18px}.searchcraft-toggle-button-handle.active{transform:translateX(16px)}";const g=b;const y=class{constructor(c){e(this,c);this.toggleUpdated=s(this,"toggleUpdated",7);this.handleToggle=async()=>{this.isActive=!this.isActive;this.toggleUpdated.emit(this.isActive)};this.label="Toggle";this.subLabel=undefined;this.isActive=false;this.unsubscribe=undefined;this.lastQuery=undefined}connectedCallback(){this.unsubscribe=r.subscribe((e=>{if(e.query!==this.lastQuery&&e.query.trim().length===0){this.isActive=false}this.lastQuery=e.query}))}disconnectedCallback(){var e;(e=this.unsubscribe)===null||e===void 0?void 0:e.call(this)}render(){return c("div",{key:"90a7816e1e02125939f3f05a9dbfd94a5f161959",class:"searchcraft-toggle-button-container"},c("div",{key:"6a3e570ba3d00ccc315cd092d5b1c618c0b23ea2"},c("p",{key:"41d1d0ab4557c856bb0ed12af8a4b0c81203d6d5",class:"searchcraft-toggle-button-label"},this.label),this.subLabel&&c("p",{key:"ec145b4f655bacec600ac9aa137662f7fed9b7d2",class:"searchcraft-toggle-button-sub-label"},this.subLabel)),c("button",{key:"226599543806881f306630708eee24e922ff592e",class:t("searchcraft-toggle-button-background",{active:this.isActive}),onClick:this.handleToggle,type:"button"},c("div",{key:"b83e81e7820705952cfc8c911223e67dfbc0f98d",class:t("searchcraft-toggle-button-handle",{active:this.isActive})})))}};y.style=g;export{l as searchcraft_facet_list,p as searchcraft_slider,y as searchcraft_toggle_button};
2
- //# sourceMappingURL=p-aa155194.entry.js.map