@searchcraft/javascript-sdk 0.6.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (271) hide show
  1. package/README.md +59 -55
  2. package/dist/cjs/{index-b3b77ea2.js → index-a81df4f0.js} +258 -239
  3. package/dist/cjs/index-a81df4f0.js.map +1 -0
  4. package/dist/cjs/index.cjs.js +1 -1
  5. package/dist/cjs/loader.cjs.js +2 -2
  6. package/dist/cjs/searchcraft-base-search-result.cjs.entry.js +91 -48
  7. package/dist/cjs/searchcraft-base-search-result.cjs.entry.js.map +1 -1
  8. package/dist/cjs/searchcraft-base-search-results.cjs.entry.js +74 -37
  9. package/dist/cjs/searchcraft-base-search-results.cjs.entry.js.map +1 -1
  10. package/dist/cjs/searchcraft-button_3.cjs.entry.js +37 -27
  11. package/dist/cjs/searchcraft-button_3.cjs.entry.js.map +1 -1
  12. package/dist/cjs/searchcraft-facet-list_3.cjs.entry.js +141 -117
  13. package/dist/cjs/searchcraft-facet-list_3.cjs.entry.js.map +1 -1
  14. package/dist/cjs/searchcraft-filter-panel.cjs.entry.js +11 -13
  15. package/dist/cjs/searchcraft-filter-panel.cjs.entry.js.map +1 -1
  16. package/dist/cjs/searchcraft-input-form_2.cjs.entry.js +128 -82
  17. package/dist/cjs/searchcraft-input-form_2.cjs.entry.js.map +1 -1
  18. package/dist/cjs/searchcraft-javascript-sdk.cjs.js +3 -3
  19. package/dist/cjs/searchcraft-javascript-sdk.cjs.js.map +1 -1
  20. package/dist/cjs/searchcraft-popover-button.cjs.entry.js +3 -7
  21. package/dist/cjs/searchcraft-popover-button.cjs.entry.js.map +1 -1
  22. package/dist/cjs/searchcraft-popover-form.cjs.entry.js +81 -68
  23. package/dist/cjs/searchcraft-popover-form.cjs.entry.js.map +1 -1
  24. package/dist/cjs/searchcraft-popover-list-item.cjs.entry.js +29 -12
  25. package/dist/cjs/searchcraft-popover-list-item.cjs.entry.js.map +1 -1
  26. package/dist/cjs/searchcraft-results-info.cjs.entry.js +9 -13
  27. package/dist/cjs/searchcraft-results-info.cjs.entry.js.map +1 -1
  28. package/dist/cjs/searchcraft-theme.cjs.entry.js +38 -0
  29. package/dist/cjs/searchcraft-theme.cjs.entry.js.map +1 -0
  30. package/dist/cjs/{store-d7ebcf7a.js → store-f6ba3dfb.js} +633 -107
  31. package/dist/cjs/store-f6ba3dfb.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 +134 -66
  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-results/searchcraft-base-search-results.js +100 -49
  36. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js.map +1 -1
  37. package/dist/collection/components/searchcraft-button/searchcraft-button.js +35 -23
  38. package/dist/collection/components/searchcraft-button/searchcraft-button.js.map +1 -1
  39. package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js +8 -15
  40. package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js.map +1 -1
  41. package/dist/collection/components/searchcraft-facet-list/searchcraft-facet-list.js +61 -59
  42. package/dist/collection/components/searchcraft-facet-list/searchcraft-facet-list.js.map +1 -1
  43. package/dist/collection/components/searchcraft-filter-panel/searchcraft-filter-panel.js +11 -19
  44. package/dist/collection/components/searchcraft-filter-panel/searchcraft-filter-panel.js.map +1 -1
  45. package/dist/collection/components/searchcraft-input-form/searchcraft-input-form.js +126 -76
  46. package/dist/collection/components/searchcraft-input-form/searchcraft-input-form.js.map +1 -1
  47. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js +14 -18
  48. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js.map +1 -1
  49. package/dist/collection/components/searchcraft-popover-button/searchcraft-popover-button.js +1 -11
  50. package/dist/collection/components/searchcraft-popover-button/searchcraft-popover-button.js.map +1 -1
  51. package/dist/collection/components/searchcraft-popover-form/searchcraft-popover-form.js +93 -77
  52. package/dist/collection/components/searchcraft-popover-form/searchcraft-popover-form.js.map +1 -1
  53. package/dist/collection/components/searchcraft-popover-list-item/searchcraft-popover-list-item.js +47 -25
  54. package/dist/collection/components/searchcraft-popover-list-item/searchcraft-popover-list-item.js.map +1 -1
  55. package/dist/collection/components/searchcraft-popover-list-view/searchcraft-popover-list-view.js +23 -25
  56. package/dist/collection/components/searchcraft-popover-list-view/searchcraft-popover-list-view.js.map +1 -1
  57. package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.js +7 -19
  58. package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.js.map +1 -1
  59. package/dist/collection/components/searchcraft-slider/searchcraft-slider.js +65 -55
  60. package/dist/collection/components/searchcraft-slider/searchcraft-slider.js.map +1 -1
  61. package/dist/collection/components/searchcraft-theme/searchcraft-theme.js +27 -0
  62. package/dist/collection/components/searchcraft-theme/searchcraft-theme.js.map +1 -0
  63. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js +27 -26
  64. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js.map +1 -1
  65. package/dist/collection/index.js.map +1 -1
  66. package/dist/collection/provider/store.js +25 -9
  67. package/dist/collection/provider/store.js.map +1 -1
  68. package/dist/collection/utils/facets.js +5 -3
  69. package/dist/collection/utils/facets.js.map +1 -1
  70. package/dist/components/index.js +4 -2
  71. package/dist/components/index.js.map +1 -1
  72. package/dist/components/p-0ef4ab33.js +66 -0
  73. package/dist/components/p-0ef4ab33.js.map +1 -0
  74. package/dist/components/p-1234974c.js +72 -0
  75. package/dist/components/p-1234974c.js.map +1 -0
  76. package/dist/components/p-4b92ae26.js +109 -0
  77. package/dist/components/p-4b92ae26.js.map +1 -0
  78. package/dist/components/{p-85765b81.js → p-506cdac1.js} +18 -16
  79. package/dist/components/p-506cdac1.js.map +1 -0
  80. package/dist/components/p-521fe971.js +60 -0
  81. package/dist/components/p-521fe971.js.map +1 -0
  82. package/dist/components/{p-e4846fa2.js → p-5365011f.js} +215 -231
  83. package/dist/components/p-5365011f.js.map +1 -0
  84. package/dist/components/p-54998882.js +285 -0
  85. package/dist/components/p-54998882.js.map +1 -0
  86. package/dist/components/{p-d6a88eed.js → p-936e2ed4.js} +633 -107
  87. package/dist/components/p-936e2ed4.js.map +1 -0
  88. package/dist/components/p-a75ef832.js +34 -0
  89. package/dist/components/p-a75ef832.js.map +1 -0
  90. package/dist/components/p-b4a8fcbe.js +144 -0
  91. package/dist/components/p-b4a8fcbe.js.map +1 -0
  92. package/dist/components/p-ca881e5c.js +37 -0
  93. package/dist/components/p-ca881e5c.js.map +1 -0
  94. package/dist/components/p-d95bc2a0.js +284 -0
  95. package/dist/components/p-d95bc2a0.js.map +1 -0
  96. package/dist/components/searchcraft-base-search-result.js +1 -1
  97. package/dist/components/searchcraft-base-search-results.js +76 -39
  98. package/dist/components/searchcraft-base-search-results.js.map +1 -1
  99. package/dist/components/searchcraft-button.js +1 -1
  100. package/dist/components/searchcraft-error-message.js +1 -1
  101. package/dist/components/searchcraft-facet-list.js +1 -1
  102. package/dist/components/searchcraft-filter-panel.js +14 -16
  103. package/dist/components/searchcraft-filter-panel.js.map +1 -1
  104. package/dist/components/searchcraft-input-form.js +1 -1
  105. package/dist/components/searchcraft-input-label.js +1 -1
  106. package/dist/components/searchcraft-popover-button.js +3 -7
  107. package/dist/components/searchcraft-popover-button.js.map +1 -1
  108. package/dist/components/searchcraft-popover-form.js +87 -74
  109. package/dist/components/searchcraft-popover-form.js.map +1 -1
  110. package/dist/components/searchcraft-popover-list-item.js +1 -1
  111. package/dist/components/searchcraft-popover-list-view.js +1 -1
  112. package/dist/components/searchcraft-results-info.js +9 -13
  113. package/dist/components/searchcraft-results-info.js.map +1 -1
  114. package/dist/components/searchcraft-slider.js +1 -1
  115. package/dist/components/searchcraft-theme.d.ts +11 -0
  116. package/dist/components/searchcraft-theme.js +51 -0
  117. package/dist/components/searchcraft-theme.js.map +1 -0
  118. package/dist/components/searchcraft-toggle-button.js +1 -1
  119. package/dist/esm/{index-11551663.js → index-3608c57d.js} +258 -239
  120. package/dist/esm/index-3608c57d.js.map +1 -0
  121. package/dist/esm/index.js +1 -1
  122. package/dist/esm/loader.js +3 -3
  123. package/dist/esm/searchcraft-base-search-result.entry.js +91 -48
  124. package/dist/esm/searchcraft-base-search-result.entry.js.map +1 -1
  125. package/dist/esm/searchcraft-base-search-results.entry.js +74 -37
  126. package/dist/esm/searchcraft-base-search-results.entry.js.map +1 -1
  127. package/dist/esm/searchcraft-button_3.entry.js +37 -27
  128. package/dist/esm/searchcraft-button_3.entry.js.map +1 -1
  129. package/dist/esm/searchcraft-facet-list_3.entry.js +141 -117
  130. package/dist/esm/searchcraft-facet-list_3.entry.js.map +1 -1
  131. package/dist/esm/searchcraft-filter-panel.entry.js +11 -13
  132. package/dist/esm/searchcraft-filter-panel.entry.js.map +1 -1
  133. package/dist/esm/searchcraft-input-form_2.entry.js +128 -82
  134. package/dist/esm/searchcraft-input-form_2.entry.js.map +1 -1
  135. package/dist/esm/searchcraft-javascript-sdk.js +4 -4
  136. package/dist/esm/searchcraft-javascript-sdk.js.map +1 -1
  137. package/dist/esm/searchcraft-popover-button.entry.js +3 -7
  138. package/dist/esm/searchcraft-popover-button.entry.js.map +1 -1
  139. package/dist/esm/searchcraft-popover-form.entry.js +81 -68
  140. package/dist/esm/searchcraft-popover-form.entry.js.map +1 -1
  141. package/dist/esm/searchcraft-popover-list-item.entry.js +29 -12
  142. package/dist/esm/searchcraft-popover-list-item.entry.js.map +1 -1
  143. package/dist/esm/searchcraft-results-info.entry.js +9 -13
  144. package/dist/esm/searchcraft-results-info.entry.js.map +1 -1
  145. package/dist/esm/searchcraft-theme.entry.js +34 -0
  146. package/dist/esm/searchcraft-theme.entry.js.map +1 -0
  147. package/dist/esm/{store-1058f7b0.js → store-aa071d9c.js} +633 -107
  148. package/dist/esm/store-aa071d9c.js.map +1 -0
  149. package/dist/searchcraft-javascript-sdk/index.esm.js +1 -1
  150. package/dist/searchcraft-javascript-sdk/p-26f5263d.entry.js +2 -0
  151. package/dist/searchcraft-javascript-sdk/p-26f5263d.entry.js.map +1 -0
  152. package/dist/searchcraft-javascript-sdk/p-2ff7eb35.entry.js +2 -0
  153. package/dist/searchcraft-javascript-sdk/p-2ff7eb35.entry.js.map +1 -0
  154. package/dist/searchcraft-javascript-sdk/p-36f0532e.entry.js +2 -0
  155. package/dist/searchcraft-javascript-sdk/p-36f0532e.entry.js.map +1 -0
  156. package/dist/searchcraft-javascript-sdk/p-41b6bc5d.entry.js +2 -0
  157. package/dist/searchcraft-javascript-sdk/p-41b6bc5d.entry.js.map +1 -0
  158. package/dist/searchcraft-javascript-sdk/p-57eddb07.entry.js +2 -0
  159. package/dist/searchcraft-javascript-sdk/p-57eddb07.entry.js.map +1 -0
  160. package/dist/searchcraft-javascript-sdk/p-5d6fbee0.entry.js +2 -0
  161. package/dist/searchcraft-javascript-sdk/p-5d6fbee0.entry.js.map +1 -0
  162. package/dist/searchcraft-javascript-sdk/p-64c5a1d2.entry.js +2 -0
  163. package/dist/searchcraft-javascript-sdk/p-64c5a1d2.entry.js.map +1 -0
  164. package/dist/searchcraft-javascript-sdk/p-7e13c128.js +3 -0
  165. package/dist/searchcraft-javascript-sdk/p-7e13c128.js.map +1 -0
  166. package/dist/searchcraft-javascript-sdk/p-8b0a60b3.entry.js +2 -0
  167. package/dist/searchcraft-javascript-sdk/p-8b0a60b3.entry.js.map +1 -0
  168. package/dist/searchcraft-javascript-sdk/p-936e2ed4.js +11 -0
  169. package/dist/searchcraft-javascript-sdk/p-936e2ed4.js.map +1 -0
  170. package/dist/searchcraft-javascript-sdk/p-c7df8be6.entry.js +2 -0
  171. package/dist/searchcraft-javascript-sdk/p-c7df8be6.entry.js.map +1 -0
  172. package/dist/searchcraft-javascript-sdk/p-eb6058e8.entry.js +2 -0
  173. package/dist/searchcraft-javascript-sdk/p-eb6058e8.entry.js.map +1 -0
  174. package/dist/searchcraft-javascript-sdk/p-faaa4394.entry.js +2 -0
  175. package/dist/searchcraft-javascript-sdk/p-faaa4394.entry.js.map +1 -0
  176. package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js +1 -1
  177. package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js.map +1 -1
  178. package/dist/types/components/searchcraft-base-search-result/searchcraft-base-search-result.d.ts +1 -0
  179. package/dist/types/components/searchcraft-base-search-results/searchcraft-base-search-results.d.ts +2 -1
  180. package/dist/types/components/searchcraft-button/searchcraft-button.d.ts +1 -0
  181. package/dist/types/components/searchcraft-error-message/searchcraft-error-message.d.ts +1 -0
  182. package/dist/types/components/searchcraft-facet-list/searchcraft-facet-list.d.ts +2 -1
  183. package/dist/types/components/searchcraft-filter-panel/searchcraft-filter-panel.d.ts +1 -0
  184. package/dist/types/components/searchcraft-input-form/searchcraft-input-form.d.ts +7 -10
  185. package/dist/types/components/searchcraft-input-label/searchcraft-input-label.d.ts +2 -1
  186. package/dist/types/components/searchcraft-popover-button/searchcraft-popover-button.d.ts +1 -0
  187. package/dist/types/components/searchcraft-popover-form/searchcraft-popover-form.d.ts +2 -1
  188. package/dist/types/components/searchcraft-popover-list-item/searchcraft-popover-list-item.d.ts +2 -0
  189. package/dist/types/components/searchcraft-popover-list-view/searchcraft-popover-list-view.d.ts +1 -0
  190. package/dist/types/components/searchcraft-results-info/searchcraft-results-info.d.ts +1 -0
  191. package/dist/types/components/searchcraft-slider/searchcraft-slider.d.ts +2 -1
  192. package/dist/types/components/searchcraft-theme/searchcraft-theme.d.ts +5 -0
  193. package/dist/types/components/searchcraft-toggle-button/searchcraft-toggle-button.d.ts +2 -1
  194. package/dist/types/components.d.ts +17 -4
  195. package/dist/types/index.d.ts +2 -1
  196. package/dist/types/provider/store.d.ts +1 -0
  197. package/dist/types/types/_shared.types.d.ts +1 -0
  198. package/dist/types/types/index.d.ts +1 -0
  199. package/dist/types/types/raw.d.ts +4 -0
  200. package/dist/types/types/searchcraft-base-search-results.types.d.ts +1 -0
  201. package/dist/types/types/searchcraft-filter-panel.types.d.ts +1 -0
  202. package/dist/types/types/searchcraft-popover-form.types.d.ts +1 -0
  203. package/dist/types/utils/facets.d.ts +1 -0
  204. package/dist/types/utils/index.d.ts +1 -0
  205. package/dist/types/utils/styles.d.ts +1 -0
  206. package/dist/types/utils/units.d.ts +1 -0
  207. package/package.json +6 -4
  208. package/dist/cjs/index-b3b77ea2.js.map +0 -1
  209. package/dist/cjs/store-d7ebcf7a.js.map +0 -1
  210. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.module.css +0 -227
  211. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.module.css +0 -179
  212. package/dist/collection/components/searchcraft-button/searchcraft-button.module.css +0 -174
  213. package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.module.css +0 -158
  214. package/dist/collection/components/searchcraft-facet-list/searchcraft-facet-list.module.css +0 -266
  215. package/dist/collection/components/searchcraft-filter-panel/searchcraft-filter-panel.module.css +0 -168
  216. package/dist/collection/components/searchcraft-input-form/searchcraft-input-form.module.css +0 -293
  217. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.module.css +0 -159
  218. package/dist/collection/components/searchcraft-popover-button/searchcraft-popover-button.module.css +0 -0
  219. package/dist/collection/components/searchcraft-popover-form/searchcraft-popover-form.module.css +0 -322
  220. package/dist/collection/components/searchcraft-popover-list-item/searchcraft-popover-list-item.module.css +0 -209
  221. package/dist/collection/components/searchcraft-popover-list-view/searchcraft-popover-list-view.module.css +0 -0
  222. package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.module.css +0 -169
  223. package/dist/collection/components/searchcraft-slider/searchcraft-slider.module.css +0 -231
  224. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.module.css +0 -207
  225. package/dist/components/p-02a16e53.js +0 -240
  226. package/dist/components/p-02a16e53.js.map +0 -1
  227. package/dist/components/p-04c46179.js +0 -101
  228. package/dist/components/p-04c46179.js.map +0 -1
  229. package/dist/components/p-0e38a723.js +0 -99
  230. package/dist/components/p-0e38a723.js.map +0 -1
  231. package/dist/components/p-4c45ef80.js +0 -67
  232. package/dist/components/p-4c45ef80.js.map +0 -1
  233. package/dist/components/p-85765b81.js.map +0 -1
  234. package/dist/components/p-953f4238.js +0 -35
  235. package/dist/components/p-953f4238.js.map +0 -1
  236. package/dist/components/p-a248ad69.js +0 -276
  237. package/dist/components/p-a248ad69.js.map +0 -1
  238. package/dist/components/p-a9bd1872.js +0 -38
  239. package/dist/components/p-a9bd1872.js.map +0 -1
  240. package/dist/components/p-cf4ced92.js +0 -49
  241. package/dist/components/p-cf4ced92.js.map +0 -1
  242. package/dist/components/p-d6a88eed.js.map +0 -1
  243. package/dist/components/p-e4846fa2.js.map +0 -1
  244. package/dist/components/p-f9d778b3.js +0 -48
  245. package/dist/components/p-f9d778b3.js.map +0 -1
  246. package/dist/esm/index-11551663.js.map +0 -1
  247. package/dist/esm/store-1058f7b0.js.map +0 -1
  248. package/dist/searchcraft-javascript-sdk/p-4580e8a4.entry.js +0 -2
  249. package/dist/searchcraft-javascript-sdk/p-4580e8a4.entry.js.map +0 -1
  250. package/dist/searchcraft-javascript-sdk/p-7049b93d.entry.js +0 -2
  251. package/dist/searchcraft-javascript-sdk/p-7049b93d.entry.js.map +0 -1
  252. package/dist/searchcraft-javascript-sdk/p-8e539d62.entry.js +0 -2
  253. package/dist/searchcraft-javascript-sdk/p-8e539d62.entry.js.map +0 -1
  254. package/dist/searchcraft-javascript-sdk/p-98640a6a.entry.js +0 -2
  255. package/dist/searchcraft-javascript-sdk/p-98640a6a.entry.js.map +0 -1
  256. package/dist/searchcraft-javascript-sdk/p-9d0f5c89.entry.js +0 -2
  257. package/dist/searchcraft-javascript-sdk/p-9d0f5c89.entry.js.map +0 -1
  258. package/dist/searchcraft-javascript-sdk/p-b8bd53ce.entry.js +0 -2
  259. package/dist/searchcraft-javascript-sdk/p-b8bd53ce.entry.js.map +0 -1
  260. package/dist/searchcraft-javascript-sdk/p-c27a3673.entry.js +0 -2
  261. package/dist/searchcraft-javascript-sdk/p-c27a3673.entry.js.map +0 -1
  262. package/dist/searchcraft-javascript-sdk/p-cd852b84.entry.js +0 -2
  263. package/dist/searchcraft-javascript-sdk/p-cd852b84.entry.js.map +0 -1
  264. package/dist/searchcraft-javascript-sdk/p-d6a88eed.js +0 -11
  265. package/dist/searchcraft-javascript-sdk/p-d6a88eed.js.map +0 -1
  266. package/dist/searchcraft-javascript-sdk/p-e042deb9.entry.js +0 -2
  267. package/dist/searchcraft-javascript-sdk/p-e042deb9.entry.js.map +0 -1
  268. package/dist/searchcraft-javascript-sdk/p-e0be53df.js +0 -3
  269. package/dist/searchcraft-javascript-sdk/p-e0be53df.js.map +0 -1
  270. package/dist/searchcraft-javascript-sdk/p-efab9f3c.entry.js +0 -2
  271. package/dist/searchcraft-javascript-sdk/p-efab9f3c.entry.js.map +0 -1
@@ -2,59 +2,103 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-b3b77ea2.js');
6
- const store = require('./store-d7ebcf7a.js');
7
-
8
- const searchcraftBaseSearchResultModuleCss = ":root{--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;--sc-popover-form-border-radius:8px;--sc-popover-list-view-height:400px;--sc-popover-list-item-image-size:60px;--sc-popover-list-item-padding-horizontal:8px;--sc-popover-list-item-padding-vertical:8px;--sc-popover-modal-max-width:570px}: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}:root{--sc-breakpoint-sm:576px;--sc-breakpoint-md:768px;--sc-breakpoint-lg:992px}.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: 768px){.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: 768px){.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)}";
9
- const SearchcraftBaseSearchResultStyle0 = searchcraftBaseSearchResultModuleCss;
5
+ const index = require('./index-a81df4f0.js');
6
+ const store = require('./store-f6ba3dfb.js');
10
7
 
11
8
  const SearchcraftBaseSearchResult = class {
12
9
  constructor(hostRef) {
13
10
  index.registerInstance(this, hostRef);
14
- this.searchcraftStore = store.useSearchcraftStore.getState();
15
- this.recordMeasureEvent = () => {
16
- var _a, _b, _c;
17
- const searchcraft = this.searchcraftStore.getSearchcraftInstance();
18
- if (searchcraft) {
19
- const document_position = this.documentPosition;
20
- const search_term = this.searchcraftStore.query;
21
- const number_of_documents = ((_c = (_b = (_a = this.searchcraftStore.searchResults) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.hits) === null || _c === void 0 ? void 0 : _c.length) || 0;
22
- searchcraft.sendMeasureEvent('document_clicked', {
23
- document_position,
24
- number_of_documents,
25
- search_term,
26
- });
11
+ }
12
+ /**
13
+ * The title content.
14
+ */
15
+ titleContent;
16
+ /**
17
+ * The subtitle content.
18
+ */
19
+ subtitleContent;
20
+ /**
21
+ * The body content.
22
+ */
23
+ bodyContent;
24
+ /**
25
+ * The footer content.
26
+ */
27
+ footerContent;
28
+ /**
29
+ * The label for the button rendered when containerHref is not present.
30
+ */
31
+ buttonLabel;
32
+ /**
33
+ * The link for the button rendered when containerHref is not present.
34
+ */
35
+ buttonHref;
36
+ /**
37
+ * Where to open the link for the button rendered when containerHref is not present.
38
+ */
39
+ buttonTarget = '_blank';
40
+ /**
41
+ * The relationship between the current document and the link for the button rendered when containerHref is not present.
42
+ */
43
+ buttonRel;
44
+ /**
45
+ * The link for the containing element.
46
+ */
47
+ containerHref;
48
+ /**
49
+ * Where to open the link for the containing element.
50
+ */
51
+ containerTarget = '_blank';
52
+ /**
53
+ * The relationship between the current document and the link for the containing element.
54
+ */
55
+ containerRel;
56
+ /**
57
+ * The image source.
58
+ */
59
+ imageSrc;
60
+ /**
61
+ * The image alternative text.
62
+ */
63
+ imageAlt;
64
+ /**
65
+ * The placement of the image.
66
+ */
67
+ imagePlacement = 'right';
68
+ /**
69
+ * A custom styles object.
70
+ */
71
+ customStyles;
72
+ /**
73
+ * The position in the document. Used with the "document_clicked" measure event.
74
+ */
75
+ documentPosition = 0;
76
+ searchcraftStore = store.useSearchcraftStore.getState();
77
+ recordMeasureEvent = () => {
78
+ const searchcraft = this.searchcraftStore.getSearchcraftInstance();
79
+ if (searchcraft) {
80
+ const document_position = this.documentPosition;
81
+ const search_term = this.searchcraftStore.query;
82
+ const number_of_documents = this.searchcraftStore.searchResults?.data?.hits?.length || 0;
83
+ searchcraft.sendMeasureEvent('document_clicked', {
84
+ document_position,
85
+ number_of_documents,
86
+ search_term,
87
+ });
88
+ }
89
+ };
90
+ parseStyles = () => {
91
+ if (this.customStyles) {
92
+ try {
93
+ return JSON.parse(this.customStyles);
27
94
  }
28
- };
29
- this.parseStyles = () => {
30
- if (this.customStyles) {
31
- try {
32
- return JSON.parse(this.customStyles);
33
- }
34
- catch (error) {
35
- console.error('Error parsing custom styles:', error);
36
- return {};
37
- }
95
+ catch (error) {
96
+ console.error('Error parsing custom styles:', error);
97
+ return {};
38
98
  }
39
- return {};
40
- };
41
- this.titleContent = undefined;
42
- this.subtitleContent = undefined;
43
- this.bodyContent = undefined;
44
- this.footerContent = undefined;
45
- this.buttonLabel = undefined;
46
- this.buttonHref = undefined;
47
- this.buttonTarget = '_blank';
48
- this.buttonRel = undefined;
49
- this.containerHref = undefined;
50
- this.containerTarget = '_blank';
51
- this.containerRel = undefined;
52
- this.imageSrc = undefined;
53
- this.imageAlt = undefined;
54
- this.imagePlacement = undefined;
55
- this.customStyles = undefined;
56
- this.documentPosition = 0;
57
- }
99
+ }
100
+ return {};
101
+ };
58
102
  render() {
59
103
  const styles = this.parseStyles();
60
104
  const imageContainer = this.imageSrc && (index.h("img", { alt: this.imageAlt, class: 'searchcraft-search-result-image', src: this.imageSrc, style: styles.image || {} }));
@@ -67,7 +111,6 @@ const SearchcraftBaseSearchResult = class {
67
111
  return (index.h("div", { class: 'searchcraft-search-result-container', style: styles.container || {} }, contentContainer));
68
112
  }
69
113
  };
70
- SearchcraftBaseSearchResult.style = SearchcraftBaseSearchResultStyle0;
71
114
 
72
115
  exports.searchcraft_base_search_result = SearchcraftBaseSearchResult;
73
116
 
@@ -1 +1 @@
1
- {"file":"searchcraft-base-search-result.entry.cjs.js","mappings":";;;;;;;AAAA,MAAM,oCAAoC,GAAG,6hKAA6hK,CAAC;AAC3kK,0CAAe,oCAAoC;;MCYtC,2BAA2B;;;QAkE9B,qBAAgB,GAAGA,yBAAmB,CAAC,QAAQ,EAAE,CAAC;QAElD,uBAAkB,GAAG;;YAC3B,MAAM,WAAW,GAAG,IAAI,CAAC,gBAAgB,CAAC,sBAAsB,EAAE,CAAC;YAEnE,IAAI,WAAW,EAAE;gBACf,MAAM,iBAAiB,GAAG,IAAI,CAAC,gBAAgB,CAAC;gBAChD,MAAM,WAAW,GAAG,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC;gBAChD,MAAM,mBAAmB,GACvB,CAAA,MAAA,MAAA,MAAA,IAAI,CAAC,gBAAgB,CAAC,aAAa,0CAAE,IAAI,0CAAE,IAAI,0CAAE,MAAM,KAAI,CAAC,CAAC;gBAE/D,WAAW,CAAC,gBAAgB,CAAC,kBAAkB,EAAE;oBAC/C,iBAAiB;oBACjB,mBAAmB;oBACnB,WAAW;iBACZ,CAAC,CAAC;aACJ;SACF,CAAC;QAEM,gBAAW,GAAG;YACpB,IAAI,IAAI,CAAC,YAAY,EAAE;gBACrB,IAAI;oBACF,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;iBACtC;gBAAC,OAAO,KAAK,EAAE;oBACd,OAAO,CAAC,KAAK,CAAC,8BAA8B,EAAE,KAAK,CAAC,CAAC;oBACrD,OAAO,EAAE,CAAC;iBACX;aACF;YACD,OAAO,EAAE,CAAC;SACX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MAAM,CAAC,MAAM,IAAI,EAAE,EAC1B,MAAM,EAAE,IAAI,CAAC,YAAY,EACzB,GAAG,EAAE,IAAI,CAAC,SAAS,IAElB,IAAI,CAAC,WAAW,CACf,CACL,CACG,EACL,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,cAAc,KAAK,OAAO,IAAI,cAAc,CAC1D,CACZ,CAAC;;QAGF,IAAI,IAAI,CAAC,aAAa,EAAE;YACtB,QACEA,eACE,KAAK,EAAC,qCAAqC,EAC3C,OAAO,EAAE,IAAI,CAAC,kBAAkB,EAChC,IAAI,EAAE,IAAI,CAAC,aAAa,EACxB,GAAG,EAAE,IAAI,CAAC,YAAY,EACtB,KAAK,EAAE,MAAM,CAAC,SAAS,IAAI,EAAE,EAC7B,QAAQ,EAAC,GAAG,EACZ,MAAM,EAAE,IAAI,CAAC,eAAe,IAE3B,gBAAgB,CACf,EACJ;SACH;;QAGD,QACEA,iBACE,KAAK,EAAC,qCAAqC,EAC3C,KAAK,EAAE,MAAM,CAAC,SAAS,IAAI,EAAE,IAE5B,gBAAgB,CACb,EACN;KACH;;;;;;","names":["useSearchcraftStore","h","Fragment"],"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: $breakpoint-md) {\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: $breakpoint-md) {\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/**\n * This web component is designed to display detailed information for a single search result.\n * Once a query is submitted, the component formats and presents the result.\n * It is consumed within the `searchcraft-base-search-results` component.\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 /**\n * The title content.\n */\n @Prop() titleContent: string | undefined;\n /**\n * The subtitle content.\n */\n @Prop() subtitleContent: string | undefined;\n /**\n * The body content.\n */\n @Prop() bodyContent: string | undefined;\n /**\n * The footer content.\n */\n @Prop() footerContent: string | undefined;\n /**\n * The label for the button rendered when containerHref is not present.\n */\n @Prop() buttonLabel: string | undefined;\n /**\n * The link for the button rendered when containerHref is not present.\n */\n @Prop() buttonHref: string | undefined;\n /**\n * Where to open the link for the button rendered when containerHref is not present.\n */\n @Prop() buttonTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n /**\n * The relationship between the current document and the link for the button rendered when containerHref is not present.\n */\n @Prop() buttonRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n /**\n * The link for the containing element.\n */\n @Prop() containerHref: string | undefined;\n /**\n * Where to open the link for the containing element.\n */\n @Prop() containerTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n /**\n * The relationship between the current document and the link for the containing element.\n */\n @Prop() containerRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n /**\n * The image source.\n */\n @Prop() imageSrc: string | undefined;\n /**\n * The image alternative text.\n */\n @Prop() imageAlt: string | undefined;\n /**\n * The placement of the image.\n */\n @Prop() imagePlacement: 'left' | 'right';\n /**\n * A custom styles object.\n */\n @Prop() customStyles: string | undefined;\n /**\n * The position in the document. Used with the \"document_clicked\" measure event.\n */\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"],"version":3}
1
+ {"file":"searchcraft-base-search-result.entry.cjs.js","mappings":";;;;;;;MAYa,2BAA2B;;;;;;;IAI9B,YAAY,CAAqB;;;;IAIjC,eAAe,CAAqB;;;;IAIpC,WAAW,CAAqB;;;;IAIhC,aAAa,CAAqB;;;;IAIlC,WAAW,CAAqB;;;;IAIhC,UAAU,CAAqB;;;;IAI/B,YAAY,GAA4C,QAAQ,CAAC;;;;IAIjE,SAAS,CAAqD;;;;IAI9D,aAAa,CAAqB;;;;IAIlC,eAAe,GAA4C,QAAQ,CAAC;;;;IAIpE,YAAY,CAAqD;;;;IAIjE,QAAQ,CAAqB;;;;IAI7B,QAAQ,CAAqB;;;;IAI7B,cAAc,GAAqB,OAAO,CAAC;;;;IAI3C,YAAY,CAAqB;;;;IAIjC,gBAAgB,GAAG,CAAC,CAAC;IAErB,gBAAgB,GAAGA,yBAAmB,CAAC,QAAQ,EAAE,CAAC;IAElD,kBAAkB,GAAG;QAC3B,MAAM,WAAW,GAAG,IAAI,CAAC,gBAAgB,CAAC,sBAAsB,EAAE,CAAC;QAEnE,IAAI,WAAW,EAAE;YACf,MAAM,iBAAiB,GAAG,IAAI,CAAC,gBAAgB,CAAC;YAChD,MAAM,WAAW,GAAG,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC;YAChD,MAAM,mBAAmB,GACvB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AI,CAAC,WAAW,KACfA,eACE,KAAK,EAAC,6CAA6C,EACnD,KAAK,EAAE,MAAM,CAAC,cAAc,IAAI,EAAE,IAEjC,IAAI,CAAC,WAAW,CACf,CACL,EAEA,IAAI,CAAC,aAAa,KACjBA,eACE,KAAK,EAAC,+CAA+C,EACrD,KAAK,EAAE,MAAM,CAAC,gBAAgB,IAAI,EAAE,IAEnC,IAAI,CAAC,aAAa,CACjB,CACL,EACA,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,WAAW,KACzDA,eACE,KAAK,EAAC,kCAAkC,EACxC,IAAI,EAAE,IAAI,CAAC,UAAU,EACrB,KAAK,EAAE,MAAM,CAAC,MAAM,IAAI,EAAE,EAC1B,MAAM,EAAE,IAAI,CAAC,YAAY,EACzB,GAAG,EAAE,IAAI,CAAC,SAAS,IAElB,IAAI,CAAC,WAAW,CACf,CACL,CACG,EACL,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,cAAc,KAAK,OAAO,IAAI,cAAc,CAC1D,CACZ,CAAC;;QAGF,IAAI,IAAI,CAAC,aAAa,EAAE;YACtB,QACEA,eACE,KAAK,EAAC,qCAAqC,EAC3C,OAAO,EAAE,IAAI,CAAC,kBAAkB,EAChC,IAAI,EAAE,IAAI,CAAC,aAAa,EACxB,GAAG,EAAE,IAAI,CAAC,YAAY,EACtB,KAAK,EAAE,MAAM,CAAC,SAAS,IAAI,EAAE,EAC7B,QAAQ,EAAC,GAAG,EACZ,MAAM,EAAE,IAAI,CAAC,eAAe,IAE3B,gBAAgB,CACf,EACJ;SACH;;QAGD,QACEA,iBACE,KAAK,EAAC,qCAAqC,EAC3C,KAAK,EAAE,MAAM,CAAC,SAAS,IAAI,EAAE,IAE5B,gBAAgB,CACb,EACN;KACH;;;;;","names":["useSearchcraftStore","h","Fragment"],"sources":["src/components/searchcraft-base-search-result/searchcraft-base-search-result.tsx"],"sourcesContent":["import { useSearchcraftStore } from '@provider/store';\nimport { Component, Fragment, h, Prop } from '@stencil/core';\n\n/**\n * This web component is designed to display detailed information for a single search result.\n * Once a query is submitted, the component formats and presents the result.\n * It is consumed within the `searchcraft-base-search-results` component.\n */\n@Component({\n tag: 'searchcraft-base-search-result',\n shadow: false,\n})\nexport class SearchcraftBaseSearchResult {\n /**\n * The title content.\n */\n @Prop() titleContent: string | undefined;\n /**\n * The subtitle content.\n */\n @Prop() subtitleContent: string | undefined;\n /**\n * The body content.\n */\n @Prop() bodyContent: string | undefined;\n /**\n * The footer content.\n */\n @Prop() footerContent: string | undefined;\n /**\n * The label for the button rendered when containerHref is not present.\n */\n @Prop() buttonLabel: string | undefined;\n /**\n * The link for the button rendered when containerHref is not present.\n */\n @Prop() buttonHref: string | undefined;\n /**\n * Where to open the link for the button rendered when containerHref is not present.\n */\n @Prop() buttonTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n /**\n * The relationship between the current document and the link for the button rendered when containerHref is not present.\n */\n @Prop() buttonRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n /**\n * The link for the containing element.\n */\n @Prop() containerHref: string | undefined;\n /**\n * Where to open the link for the containing element.\n */\n @Prop() containerTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n /**\n * The relationship between the current document and the link for the containing element.\n */\n @Prop() containerRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n /**\n * The image source.\n */\n @Prop() imageSrc: string | undefined;\n /**\n * The image alternative text.\n */\n @Prop() imageAlt: string | undefined;\n /**\n * The placement of the image.\n */\n @Prop() imagePlacement: 'left' | 'right' = 'right';\n /**\n * A custom styles object.\n */\n @Prop() customStyles: string | undefined;\n /**\n * The position in the document. Used with the \"document_clicked\" measure event.\n */\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"],"version":3}
@@ -2,33 +2,68 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-b3b77ea2.js');
6
- const store = require('./store-d7ebcf7a.js');
5
+ const index = require('./index-a81df4f0.js');
6
+ const store = require('./store-f6ba3dfb.js');
7
7
  const units = require('./units-fe4d8083.js');
8
8
  const styles = require('./styles-7b2d06f2.js');
9
9
 
10
- const searchcraftBaseSearchResultsModuleCss = ":root{--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;--sc-popover-form-border-radius:8px;--sc-popover-list-view-height:400px;--sc-popover-list-item-image-size:60px;--sc-popover-list-item-padding-horizontal:8px;--sc-popover-list-item-padding-vertical:8px;--sc-popover-modal-max-width:570px}: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}:root{--sc-breakpoint-sm:576px;--sc-breakpoint-md:768px;--sc-breakpoint-lg:992px}.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}";
11
- const SearchcraftBaseSearchResultsStyle0 = searchcraftBaseSearchResultsModuleCss;
12
-
13
10
  const SearchcraftBaseSearchResults = class {
14
11
  constructor(hostRef) {
15
12
  index.registerInstance(this, hostRef);
16
13
  this.noResults = index.createEvent(this, "noResults", 7);
17
- this.adInterval = 4;
18
- this.customStylesForResults = undefined;
19
- this.searchResultMappings = undefined;
20
- this.placeAdAtEnd = false;
21
- this.placeAdAtStart = true;
22
- this.resultImagePlacement = 'right';
23
- this.buttonLabel = undefined;
24
- this.buttonTarget = '_blank';
25
- this.buttonRel = undefined;
26
- this.containerTarget = '_blank';
27
- this.containerRel = undefined;
28
- this.hasSearched = false;
29
- this.query = '';
30
- this.searchResults = null;
31
14
  }
15
+ /**
16
+ * How often ads are injected.
17
+ */
18
+ adInterval = 4;
19
+ /**
20
+ * A custom styles object.
21
+ */
22
+ customStylesForResults;
23
+ /**
24
+ * Formats the content rendered for each result.
25
+ */
26
+ searchResultMappings;
27
+ /**
28
+ * Should an ad be placed at the end of the results.
29
+ */
30
+ placeAdAtEnd = false;
31
+ /**
32
+ * Should an ad be placed at the start of the results.
33
+ */
34
+ placeAdAtStart = true;
35
+ /**
36
+ * The placement of the image for each result.
37
+ */
38
+ resultImagePlacement = 'right';
39
+ /**
40
+ * The label for the button rendered when containerHref is not present for each result.
41
+ */
42
+ buttonLabel;
43
+ /**
44
+ * Where to open the link for the button rendered when containerHref is not present for each result.
45
+ */
46
+ buttonTarget = '_blank';
47
+ /**
48
+ * The relationship between the current document and the link for the button rendered when containerHref is not present for each result.
49
+ */
50
+ buttonRel;
51
+ /**
52
+ * Where to open the link for the containing element for each result.
53
+ */
54
+ containerTarget = '_blank';
55
+ /**
56
+ * The relationship between the current document and the link for the containing element for each result.
57
+ */
58
+ containerRel;
59
+ /**
60
+ * When no results are returned.
61
+ */
62
+ noResults;
63
+ hasSearched = false;
64
+ query = '';
65
+ searchResults = null;
66
+ unsubscribe = () => { };
32
67
  componentDidLoad() {
33
68
  this.unsubscribe = store.useSearchcraftStore.subscribe((state) => {
34
69
  if (state.query.length > 0) {
@@ -37,7 +72,7 @@ const SearchcraftBaseSearchResults = class {
37
72
  else {
38
73
  this.hasSearched = false;
39
74
  }
40
- this.searchResults = Object.assign({}, state.searchResults);
75
+ this.searchResults = { ...state.searchResults };
41
76
  this.query = state.query;
42
77
  });
43
78
  const { searchResults, query } = store.useSearchcraftStore.getState();
@@ -53,27 +88,30 @@ const SearchcraftBaseSearchResults = class {
53
88
  /**
54
89
  * Index field values -> Result container props mappings.
55
90
  */
56
- const titleContent = units.getDocumentValueFromSearchResultMapping(document, this.searchResultMappings.title);
57
- const subtitleContent = units.getDocumentValueFromSearchResultMapping(document, this.searchResultMappings.subtitle);
58
- const bodyContent = units.getDocumentValueFromSearchResultMapping(document, this.searchResultMappings.body);
59
- const containerHref = units.getDocumentValueFromSearchResultMapping(document, this.searchResultMappings.containerHref);
60
- const buttonHref = units.getDocumentValueFromSearchResultMapping(document, this.searchResultMappings.buttonHref);
61
- const imageSource = units.getDocumentValueFromSearchResultMapping(document, this.searchResultMappings.imageSource);
62
- const footerContent = units.getDocumentValueFromSearchResultMapping(document, this.searchResultMappings.footer);
63
- const serializedStyles = typeof this.customStylesForResults === 'string'
64
- ? this.customStylesForResults
65
- : styles.serializeStyles(this.customStylesForResults);
91
+ const titleContent = units.getDocumentValueFromSearchResultMapping(document, this.searchResultMappings?.title);
92
+ const subtitleContent = units.getDocumentValueFromSearchResultMapping(document, this.searchResultMappings?.subtitle);
93
+ const bodyContent = units.getDocumentValueFromSearchResultMapping(document, this.searchResultMappings?.body);
94
+ const containerHref = units.getDocumentValueFromSearchResultMapping(document, this.searchResultMappings?.containerHref);
95
+ const buttonHref = units.getDocumentValueFromSearchResultMapping(document, this.searchResultMappings?.buttonHref);
96
+ const imageSource = units.getDocumentValueFromSearchResultMapping(document, this.searchResultMappings?.imageSource);
97
+ const footerContent = units.getDocumentValueFromSearchResultMapping(document, this.searchResultMappings?.footer);
98
+ let serializedStyles = '';
99
+ if (this.customStylesForResults) {
100
+ serializedStyles =
101
+ typeof this.customStylesForResults === 'string'
102
+ ? this.customStylesForResults
103
+ : styles.serializeStyles(this.customStylesForResults);
104
+ }
66
105
  return (index.h("searchcraft-base-search-result", { key: `${document.document_id}-${index$1}`, "custom-styles": serializedStyles, "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": index$1, "title-content": titleContent, "subtitle-content": subtitleContent, "body-content": bodyContent, "footer-content": footerContent, "container-href": containerHref, "button-href": buttonHref, "image-src": imageSource }));
67
106
  }
68
107
  render() {
69
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
70
108
  if (this.query.trim() === '') {
71
109
  return (index.h("div", { class: 'searchcraft-search-results-empty-state-container' }, index.h("slot", { name: 'empty-search' })));
72
110
  }
73
- if (!((_a = this.searchResults) === null || _a === void 0 ? void 0 : _a.data)) {
111
+ if (!this.searchResults?.data) {
74
112
  return;
75
113
  }
76
- const documents = (_d = (_c = (_b = this.searchResults) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.hits) === null || _d === void 0 ? void 0 : _d.map((data, _index) => {
114
+ const documents = this.searchResults?.data?.hits?.map((data, _index) => {
77
115
  const { doc: result } = data;
78
116
  return result;
79
117
  });
@@ -96,14 +134,13 @@ const SearchcraftBaseSearchResults = class {
96
134
  if (this.placeAdAtEnd) {
97
135
  finalComponents.push(index.h("div", { key: 'ad-section-end', class: 'searchcraft-ad-section' }, index.h("p", null, "Ad Section")));
98
136
  }
99
- if (this.query.length > 0 && ((_g = (_f = (_e = this.searchResults) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f.hits) === null || _g === void 0 ? void 0 : _g.length) === 0) {
100
- this.noResults.emit();
137
+ if (this.query.length > 0 && this.searchResults?.data?.hits?.length === 0) {
138
+ this.noResults?.emit();
101
139
  }
102
140
  return (index.h("div", { class: 'searchcraft-search-results-container' }, finalComponents, this.query.length > 0 &&
103
- ((_k = (_j = (_h = this.searchResults) === null || _h === void 0 ? void 0 : _h.data) === null || _j === void 0 ? void 0 : _j.hits) === null || _k === void 0 ? void 0 : _k.length) === 0 && (index.h("div", { class: 'searchcraft-search-results-error-message-container' }, index.h("searchcraft-error-message", { "error-message": `No search results found for "${this.query}" query` })))));
141
+ this.searchResults?.data?.hits?.length === 0 && (index.h("div", { class: 'searchcraft-search-results-error-message-container' }, index.h("searchcraft-error-message", { "error-message": `No search results found for "${this.query}" query` })))));
104
142
  }
105
143
  };
106
- SearchcraftBaseSearchResults.style = SearchcraftBaseSearchResultsStyle0;
107
144
 
108
145
  exports.searchcraft_base_search_results = SearchcraftBaseSearchResults;
109
146
 
@@ -1 +1 @@
1
- {"file":"searchcraft-base-search-results.entry.cjs.js","mappings":";;;;;;;;;AAAA,MAAM,qCAAqC,GAAG,2zHAA2zH,CAAC;AAC12H,2CAAe,qCAAqC;;MCuDvC,4BAA4B;;;;0BAIlB,CAAC;;;4BAeC,KAAK;8BAIH,IAAI;oCAIoB,OAAO;;4BAQQ,QAAQ;;+BAQL,QAAQ;;2BAWpD,KAAK;qBACX,EAAE;6BACkC,IAAI;;IAIzD,gBAAgB;QACd,IAAI,CAAC,WAAW,GAAGA,yBAAmB,CAAC,SAAS,CAAC,CAAC,KAAK;YACrD,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC1B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;aACzB;iBAAM;gBACL,IA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,EACN;KACH;;;;;;","names":["useSearchcraftStore","index","getDocumentValueFromSearchResultMapping","serializeStyles","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';\nimport type { SearchResultMappings } from 'types';\n\n/**\n * This web component is responsible for displaying the results of a search query.\n * Once a query is submitted, the component formats and presents an ordered list of the results.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-base-search-results\n * ad-interval=\"4\"\n * place-ad-at-start=\"false\"\n * result-image-placement=\"right\"\n * />\n * ```\n *\n * ```js\n * // index.js\n * const baseSearchResults = document.querySelector('searchcraft-base-search-results');\n *\n * baseSearchResults.searchResultMappings = containerHref: {\n * fieldNames: [\n * {\n * fieldName: 'canonical_link',\n * dataType: 'text',\n * },\n * ],\n * };\n *\n * baseSearchResults.addEventListener('noResults', () => {\n * console.log('No search results found');\n * });\n * ```\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 /**\n * How often ads are injected.\n */\n @Prop() adInterval = 4;\n /**\n * A custom styles object.\n */\n @Prop() customStylesForResults:\n | string\n | Record<string, Record<string, string>>\n | undefined;\n /**\n * Formats the content rendered for each result.\n */\n @Prop() searchResultMappings: SearchResultMappings | undefined;\n /**\n * Should an ad be placed at the end of the results.\n */\n @Prop() placeAdAtEnd = false;\n /**\n * Should an ad be placed at the start of the results.\n */\n @Prop() placeAdAtStart = true;\n /**\n * The placement of the image for each result.\n */\n @Prop() resultImagePlacement: 'left' | 'right' = 'right';\n /**\n * The label for the button rendered when containerHref is not present for each result.\n */\n @Prop() buttonLabel: string | undefined;\n /**\n * Where to open the link for the button rendered when containerHref is not present for each result.\n */\n @Prop() buttonTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n /**\n * The relationship between the current document and the link for the button rendered when containerHref is not present for each result.\n */\n @Prop() buttonRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n /**\n * Where to open the link for the containing element for each result.\n */\n @Prop() containerTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n /**\n * The relationship between the current document and the link for the containing element for each result.\n */\n @Prop() containerRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n\n /**\n * When no results are returned.\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"],"version":3}
1
+ {"file":"searchcraft-base-search-results.entry.cjs.js","mappings":";;;;;;;;;MAwDa,4BAA4B;;;;;;;;IAI/B,UAAU,GAAG,CAAC,CAAC;;;;IAIf,sBAAsB,CAGhB;;;;IAIN,oBAAoB,CAAmC;;;;IAIvD,YAAY,GAAG,KAAK,CAAC;;;;IAIrB,cAAc,GAAG,IAAI,CAAC;;;;IAItB,oBAAoB,GAAqB,OAAO,CAAC;;;;IAIjD,WAAW,CAAqB;;;;IAIhC,YAAY,GAA4C,QAAQ,CAAC;;;;IAIjE,SAAS,CAAqD;;;;IAI9D,eAAe,GAA4C,QAAQ,CAAC;;;;IAIpE,YAAY,CAAqD;;;;IAKhE,SAAS,CAAsB;IAE/B,WAAW,GAAG,KAAK,CAAC;IACpB,KAAK,GAAG,EAAE,CAAC;IACX,aAAa,GAA+B,IAAI,CAAC;IAElD,WAAW,GAAe,SAAQ,CAAC;IAE3C,gBAAgB;QACd,IAAI,CAAC,WAAW,GAAGA,yBAAmB,CAAC,SAAS,CAAC,CAAC,KAAK;YACrD,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC1B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;aACzB;iBAAM;gBACL,IAAI,CAAC,WAAW,GAAG,KAAK,CAA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index","getDocumentValueFromSearchResultMapping","serializeStyles","h"],"sources":["src/components/searchcraft-base-search-results/searchcraft-base-search-results.tsx"],"sourcesContent":["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';\nimport type { SearchResultMappings } from 'types';\nimport type { JSX } from '@stencil/core/internal';\n\n/**\n * This web component is responsible for displaying the results of a search query.\n * Once a query is submitted, the component formats and presents an ordered list of the results.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-base-search-results\n * ad-interval=\"4\"\n * place-ad-at-start=\"false\"\n * result-image-placement=\"right\"\n * />\n * ```\n *\n * ```js\n * // index.js\n * const baseSearchResults = document.querySelector('searchcraft-base-search-results');\n *\n * baseSearchResults.searchResultMappings = containerHref: {\n * fieldNames: [\n * {\n * fieldName: 'canonical_link',\n * dataType: 'text',\n * },\n * ],\n * };\n *\n * baseSearchResults.addEventListener('noResults', () => {\n * console.log('No search results found');\n * });\n * ```\n */\n@Component({\n tag: 'searchcraft-base-search-results',\n shadow: false,\n})\nexport class SearchcraftBaseSearchResults {\n /**\n * How often ads are injected.\n */\n @Prop() adInterval = 4;\n /**\n * A custom styles object.\n */\n @Prop() customStylesForResults:\n | string\n | Record<string, Record<string, string>>\n | undefined;\n /**\n * Formats the content rendered for each result.\n */\n @Prop() searchResultMappings: SearchResultMappings | undefined;\n /**\n * Should an ad be placed at the end of the results.\n */\n @Prop() placeAdAtEnd = false;\n /**\n * Should an ad be placed at the start of the results.\n */\n @Prop() placeAdAtStart = true;\n /**\n * The placement of the image for each result.\n */\n @Prop() resultImagePlacement: 'left' | 'right' = 'right';\n /**\n * The label for the button rendered when containerHref is not present for each result.\n */\n @Prop() buttonLabel: string | undefined;\n /**\n * Where to open the link for the button rendered when containerHref is not present for each result.\n */\n @Prop() buttonTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n /**\n * The relationship between the current document and the link for the button rendered when containerHref is not present for each result.\n */\n @Prop() buttonRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n /**\n * Where to open the link for the containing element for each result.\n */\n @Prop() containerTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n /**\n * The relationship between the current document and the link for the containing element for each result.\n */\n @Prop() containerRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n\n /**\n * When no results are returned.\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 } as SearchcraftResponse;\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 let serializedStyles = '';\n if (this.customStylesForResults) {\n serializedStyles =\n typeof this.customStylesForResults === 'string'\n ? this.customStylesForResults\n : serializeStyles(this.customStylesForResults);\n }\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 }) as Record<string, unknown>[];\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"],"version":3}
@@ -2,59 +2,69 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-b3b77ea2.js');
5
+ const index = require('./index-a81df4f0.js');
6
6
  const index$1 = require('./index-5b0b9d4c.js');
7
7
 
8
- const searchcraftButtonModuleCss = ":root{--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;--sc-popover-form-border-radius:8px;--sc-popover-list-view-height:400px;--sc-popover-list-item-image-size:60px;--sc-popover-list-item-padding-horizontal:8px;--sc-popover-list-item-padding-vertical:8px;--sc-popover-modal-max-width:570px}: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}:root{--sc-breakpoint-sm:576px;--sc-breakpoint-md:768px;--sc-breakpoint-lg:992px}.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}";
9
- const SearchcraftButtonStyle0 = searchcraftButtonModuleCss;
10
-
11
8
  const SearchcraftButton = class {
12
9
  constructor(hostRef) {
13
10
  index.registerInstance(this, hostRef);
14
11
  this.buttonClick = index.createEvent(this, "buttonClick", 7);
15
- this.handleClick = () => {
16
- this.buttonClick.emit();
17
- };
18
- this.iconElement = undefined;
19
- this.iconOnly = false;
20
- this.iconPosition = 'left';
21
- this.label = 'Search';
22
- this.isRequesting = false;
23
12
  }
13
+ /**
14
+ * The icon element.
15
+ */
16
+ iconElement;
17
+ /**
18
+ * Should the button only display an icon.
19
+ */
20
+ iconOnly = false;
21
+ /**
22
+ * The position of the icon.
23
+ */
24
+ iconPosition = 'left';
25
+ /**
26
+ * The label for the button.
27
+ */
28
+ label = 'Search';
29
+ /**
30
+ * When the button is clicked.
31
+ */
32
+ buttonClick;
33
+ isRequesting = false;
34
+ handleClick = () => {
35
+ this.buttonClick.emit();
36
+ };
24
37
  render() {
25
- return (index.h(index.Fragment, { key: '52b95f09f5da9f281b250285623e150c5d952dce' }, this.iconOnly ? (index.h("button", { class: index$1.classNames('searchcraft-button'), onClick: this.handleClick, type: 'submit' }, this.isRequesting ? (index.h("searchcraft-spinner-dark", null)) : (this.iconElement))) : (index.h("button", { class: index$1.classNames('searchcraft-button'), onClick: this.handleClick, type: 'submit' }, this.iconPosition === 'left' && this.iconElement, index.h("span", { class: index$1.classNames('buttonLabel', 'searchcraft-button-label') }, this.label)))));
38
+ return (index.h(index.Fragment, { key: 'af99927e7c05f06ec9a63123c7f740a0e96e734b' }, this.iconOnly ? (index.h("button", { class: index$1.classNames('searchcraft-button'), onClick: this.handleClick, type: 'submit' }, this.isRequesting ? (index.h("searchcraft-spinner-dark", null)) : (this.iconElement))) : (index.h("button", { class: index$1.classNames('searchcraft-button'), onClick: this.handleClick, type: 'submit' }, this.iconPosition === 'left' && this.iconElement, index.h("span", { class: index$1.classNames('buttonLabel', 'searchcraft-button-label') }, this.label)))));
26
39
  }
27
40
  };
28
- SearchcraftButton.style = SearchcraftButtonStyle0;
29
-
30
- const searchcraftErrorMessageModuleCss = ":root{--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;--sc-popover-form-border-radius:8px;--sc-popover-list-view-height:400px;--sc-popover-list-item-image-size:60px;--sc-popover-list-item-padding-horizontal:8px;--sc-popover-list-item-padding-vertical:8px;--sc-popover-modal-max-width:570px}: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}:root{--sc-breakpoint-sm:576px;--sc-breakpoint-md:768px;--sc-breakpoint-lg:992px}.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}";
31
- const SearchcraftErrorMessageStyle0 = searchcraftErrorMessageModuleCss;
32
41
 
33
42
  const SearchcraftErrorMessage = class {
34
43
  constructor(hostRef) {
35
44
  index.registerInstance(this, hostRef);
36
- this.errorMessage = undefined;
37
45
  }
46
+ /**
47
+ * The error message.
48
+ */
49
+ errorMessage;
38
50
  render() {
39
- return (index.h("p", { key: '5bdc428adf6f239d66a9b0f946ee6e582de41e86', class: 'searchcraft-error-message' }, this.errorMessage || 'Search term is required.'));
51
+ return (index.h("p", { key: '432bc13abc15f4d9c62ebc751e44e266b258b1f9', class: 'searchcraft-error-message' }, this.errorMessage || 'Search term is required.'));
40
52
  }
41
53
  };
42
- SearchcraftErrorMessage.style = SearchcraftErrorMessageStyle0;
43
-
44
- const searchcraftInputLabelModuleCss = ":root{--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;--sc-popover-form-border-radius:8px;--sc-popover-list-view-height:400px;--sc-popover-list-item-image-size:60px;--sc-popover-list-item-padding-horizontal:8px;--sc-popover-list-item-padding-vertical:8px;--sc-popover-modal-max-width:570px}: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}:root{--sc-breakpoint-sm:576px;--sc-breakpoint-md:768px;--sc-breakpoint-lg:992px}.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}";
45
- const SearchcraftInputLabelStyle0 = searchcraftInputLabelModuleCss;
46
54
 
47
55
  const SearchcraftInputLabel = class {
48
56
  constructor(hostRef) {
49
57
  index.registerInstance(this, hostRef);
50
- this.inputLabelClassName = '';
51
- this.label = undefined;
52
58
  }
59
+ /**
60
+ * The classname applied to the label element.
61
+ */
62
+ inputLabelClassName = '';
63
+ label = '';
53
64
  render() {
54
- return (index.h("label", { key: '4f913c1d9027ff781725a01e71e241cb5767eadb', class: index$1.classNames('searchcraft-input-label', this.inputLabelClassName), htmlFor: 'searchcraft-input-id' }, this.label));
65
+ return (index.h("label", { key: '9c71dc7429d7289ed59e7effacb91e040a9ac6a1', class: index$1.classNames('searchcraft-input-label', this.inputLabelClassName), htmlFor: 'searchcraft-input-id' }, this.label));
55
66
  }
56
67
  };
57
- SearchcraftInputLabel.style = SearchcraftInputLabelStyle0;
58
68
 
59
69
  exports.searchcraft_button = SearchcraftButton;
60
70
  exports.searchcraft_error_message = SearchcraftErrorMessage;
@@ -1 +1 @@
1
- {"file":"searchcraft-button.searchcraft-error-message.searchcraft-input-label.entry.cjs.js","mappings":";;;;;;;AAAA,MAAM,0BAA0B,GAAG,46HAA46H,CAAC;AACh9H,gCAAe,0BAA0B;;MCoB5B,iBAAiB;;;;QAyBpB,gBAAW,GAAG;YACpB,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;SACzB,CAAC;;wBAnBiB,KAAK;4BAID,MAAM;qBAIb,QAAQ;4BAOA,KAAK;;IAM7B,MAAM;QACJ,QACEA,QAACC,cAAQ,uDACN,IAAI,CAAC,QAAQ,IACZD,oBACE,KAAK,EAAEE,kBAAU,CAAC,oBAAoB,CAAC,EACvC,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,IAAI,EAAC,QAAQ,IAEZ,IAAI,CAAC,YAAY,IAChBF,yCAA4B,KAE5B,IAAI,CAAC,WAAW,CACjB,CACM,KAETA,oBACE,KAAK,EAAEE,kBAAU,CAAC,oBAAoB,CAAC,EACvC,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,IAAI,EAAC,QAAQ,IAEZ,IAAI,CAAC,YAAY,KAAK,MAAM,IAAI,IAAI,CAAC,WAAW,EACjDF,kBAAM,KAAK,EAAEE,kBAAU,CAAC,aAAa,EAAE,0BAA0B,CAAC,IAC/D,IAAI,CAAC,KAAK,CACN,CACA,CACV,CACQ,EACX;KACH;;;;AC/EH,MAAM,gCAAgC,GAAG,4kHAA4kH,CAAC;AACtnH,sCAAe,gCAAgC;;MCelC,uBAAuB;;;;;IAMlC,MAAM;QACJ,QACEF,gEAAG,KAAK,EAAC,2BAA2B,IACjC,IAAI,CAAC,YAAY,IAAI,0BAA0B,CAC9C,EACJ;KACH;;;;AC5BH,MAAM,8BAA8B,GAAG,0nHAA0nH,CAAC;AAClqH,oCAAe,8BAA8B;;MCgBhC,qBAAqB;;;mCAID,EAAE;;;IAGjC,MAAM;QACJ,QACEA,oEACE,KAAK,EAAEE,kBAAU,CAAC,yBAAyB,EAAE,IAAI,CAAC,mBAAmB,CAAC,EACtE,OAAO,EAAC,sBAAsB,IAE7B,IAAI,CAAC,KAAK,CACL,EACR;KACH;;;;;;;;","names":["h","Fragment","classNames"],"sources":["src/components/searchcraft-button/searchcraft-button.module.scss?tag=searchcraft-button","src/components/searchcraft-button/searchcraft-button.tsx","src/components/searchcraft-error-message/searchcraft-error-message.module.scss?tag=searchcraft-error-message","src/components/searchcraft-error-message/searchcraft-error-message.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/**\n * This web component represents a button to be consumed within the `search-input-form` component.\n * It provides a clear, interactive way for users to submit search queries or trigger actions in a search interface.\n * It is consumed within the `searchcraft-input-form` component.\n */\n@Component({\n tag: 'searchcraft-button',\n styleUrl: 'searchcraft-button.module.scss',\n shadow: false,\n})\nexport class SearchcraftButton {\n /**\n * The icon element.\n */\n @Prop() iconElement?: Element;\n /**\n * Should the button only display an icon.\n */\n @Prop() iconOnly = false;\n /**\n * The position of the icon.\n */\n @Prop() iconPosition = 'left';\n /**\n * The label for the button.\n */\n @Prop() label = 'Search';\n\n /**\n * When the button is clicked.\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-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/**\n * This web component is designed to display a user-friendly error message when a search query fails, providing clear feedback to users and enhancing their experience when an issue arises during the search process.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-error-message error-message=\"No search results found for query\" />\n * ```\n */\n@Component({\n tag: 'searchcraft-error-message',\n styleUrl: 'searchcraft-error-message.module.scss',\n shadow: false,\n})\nexport class SearchcraftErrorMessage {\n /**\n * The error message.\n */\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",".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/**\n * This web component serves as the input label for the searchcraft-input-form component.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-input-label label=\"Search\" />\n * ```\n */\n@Component({\n tag: 'searchcraft-input-label',\n styleUrl: 'searchcraft-input-label.module.scss',\n shadow: false,\n})\nexport class SearchcraftInputLabel {\n /**\n * The classname applied to the label element.\n */\n @Prop() inputLabelClassName? = '';\n @Prop() label: string;\n\n render() {\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"],"version":3}
1
+ {"file":"searchcraft-button.searchcraft-error-message.searchcraft-input-label.entry.cjs.js","mappings":";;;;;;;MAoBa,iBAAiB;;;;;;;;IAIpB,WAAW,CAAW;;;;IAItB,QAAQ,GAAG,KAAK,CAAC;;;;IAIjB,YAAY,GAAG,MAAM,CAAC;;;;IAItB,KAAK,GAAG,QAAQ,CAAC;;;;IAKhB,WAAW,CAAsB;IAEjC,YAAY,GAAG,KAAK,CAAC;IAEtB,WAAW,GAAG;QACpB,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;KACzB,CAAC;IAEF,MAAM;QACJ,QACEA,QAACC,cAAQ,uDACN,IAAI,CAAC,QAAQ,IACZD,oBACE,KAAK,EAAEE,kBAAU,CAAC,oBAAoB,CAAC,EACvC,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,IAAI,EAAC,QAAQ,IAEZ,IAAI,CAAC,YAAY,IAChBF,yCAA4B,KAE5B,IAAI,CAAC,WAAW,CACjB,CACM,KAETA,oBACE,KAAK,EAAEE,kBAAU,CAAC,oBAAoB,CAAC,EACvC,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,IAAI,EAAC,QAAQ,IAEZ,IAAI,CAAC,YAAY,KAAK,MAAM,IAAI,IAAI,CAAC,WAAW,EACjDF,kBAAM,KAAK,EAAEE,kBAAU,CAAC,aAAa,EAAE,0BAA0B,CAAC,IAC/D,IAAI,CAAC,KAAK,CACN,CACA,CACV,CACQ,EACX;KACH;;;MC/DU,uBAAuB;;;;;;;IAI1B,YAAY,CAAU;IAE9B,MAAM;QACJ,QACEF,gEAAG,KAAK,EAAC,2BAA2B,IACjC,IAAI,CAAC,YAAY,IAAI,0BAA0B,CAC9C,EACJ;KACH;;;MCXU,qBAAqB;;;;;;;IAIxB,mBAAmB,GAAI,EAAE,CAAC;IAC1B,KAAK,GAAG,EAAE,CAAC;IAEnB,MAAM;QACJ,QACEA,oEACE,KAAK,EAAEE,kBAAU,CAAC,yBAAyB,EAAE,IAAI,CAAC,mBAAmB,CAAC,EACtE,OAAO,EAAC,sBAAsB,IAE7B,IAAI,CAAC,KAAK,CACL,EACR;KACH;;;;;;;","names":["h","Fragment","classNames"],"sources":["src/components/searchcraft-button/searchcraft-button.tsx","src/components/searchcraft-error-message/searchcraft-error-message.tsx","src/components/searchcraft-input-label/searchcraft-input-label.tsx"],"sourcesContent":["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/**\n * This web component represents a button to be consumed within the `search-input-form` component.\n * It provides a clear, interactive way for users to submit search queries or trigger actions in a search interface.\n * It is consumed within the `searchcraft-input-form` component.\n */\n@Component({\n tag: 'searchcraft-button',\n shadow: false,\n})\nexport class SearchcraftButton {\n /**\n * The icon element.\n */\n @Prop() iconElement?: Element;\n /**\n * Should the button only display an icon.\n */\n @Prop() iconOnly = false;\n /**\n * The position of the icon.\n */\n @Prop() iconPosition = 'left';\n /**\n * The label for the button.\n */\n @Prop() label = 'Search';\n\n /**\n * When the button is clicked.\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","import { Component, Prop, h } from '@stencil/core';\n\n/**\n * This web component is designed to display a user-friendly error message when a search query fails, providing clear feedback to users and enhancing their experience when an issue arises during the search process.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-error-message error-message=\"No search results found for query\" />\n * ```\n */\n@Component({\n tag: 'searchcraft-error-message',\n shadow: false,\n})\nexport class SearchcraftErrorMessage {\n /**\n * The error message.\n */\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","import { Component, Prop, h } from '@stencil/core';\nimport classNames from 'classnames';\n\n/**\n * This web component serves as the input label for the searchcraft-input-form component.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-input-label label=\"Search\" />\n * ```\n */\n@Component({\n tag: 'searchcraft-input-label',\n shadow: false,\n})\nexport class SearchcraftInputLabel {\n /**\n * The classname applied to the label element.\n */\n @Prop() inputLabelClassName? = '';\n @Prop() label = '';\n\n render() {\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"],"version":3}