@searchcraft/javascript-sdk 0.8.2 → 0.9.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 (287) hide show
  1. package/README.md +25 -37
  2. package/dist/components/defineCustomElements.d.ts +1 -0
  3. package/dist/components/defineCustomElements.js +46 -0
  4. package/dist/components/index.d.ts +44 -11
  5. package/dist/components/index.js +104 -53
  6. package/dist/components/index.js.map +1 -1
  7. package/dist/components/p-05872320.js +1462 -0
  8. package/dist/components/p-05872320.js.map +1 -0
  9. package/dist/components/{p-433f974c.js → p-11b05b94.js} +5 -5
  10. package/dist/components/p-11b05b94.js.map +1 -0
  11. package/dist/components/{p-ec0d230e.js → p-3568414f.js} +4 -4
  12. package/dist/components/p-3568414f.js.map +1 -0
  13. package/dist/components/{p-6e2eef88.js → p-5bd5c3cb.js} +17 -126
  14. package/dist/components/p-5bd5c3cb.js.map +1 -0
  15. package/dist/{cjs/SearchcraftStore-75fac5e0.js → components/p-6d8b0ead.js} +1408 -1350
  16. package/dist/components/p-6d8b0ead.js.map +1 -0
  17. package/dist/components/{p-fc7cda96.js → p-7777d986.js} +4 -4
  18. package/dist/components/{p-fc7cda96.js.map → p-7777d986.js.map} +1 -1
  19. package/dist/components/p-b0bc5cee.js +102 -0
  20. package/dist/components/p-b0bc5cee.js.map +1 -0
  21. package/dist/components/{p-4e9cd62e.js → p-bb12ab5a.js} +3 -3
  22. package/dist/components/{p-4e9cd62e.js.map → p-bb12ab5a.js.map} +1 -1
  23. package/dist/components/{p-97332d3e.js → p-cd9ba361.js} +3 -3
  24. package/dist/components/p-cd9ba361.js.map +1 -0
  25. package/dist/components/searchcraft-ad.d.ts +11 -0
  26. package/dist/components/searchcraft-ad.js +8 -0
  27. package/dist/components/searchcraft-ad.js.map +1 -0
  28. package/dist/components/searchcraft-base-search-result.js +1 -1
  29. package/dist/components/searchcraft-base-search-results.js +79 -29
  30. package/dist/components/searchcraft-base-search-results.js.map +1 -1
  31. package/dist/components/searchcraft-facet-list.js +1 -1
  32. package/dist/components/searchcraft-filter-panel.js +9 -9
  33. package/dist/components/searchcraft-filter-panel.js.map +1 -1
  34. package/dist/components/searchcraft-input-form.js +1 -1
  35. package/dist/components/searchcraft-pagination.js +2 -2
  36. package/dist/components/searchcraft-pagination.js.map +1 -1
  37. package/dist/components/searchcraft-popover-button.js +3 -3
  38. package/dist/components/searchcraft-popover-button.js.map +1 -1
  39. package/dist/components/searchcraft-popover-form.js +28 -35
  40. package/dist/components/searchcraft-popover-form.js.map +1 -1
  41. package/dist/components/searchcraft-popover-list-item.js +1 -1
  42. package/dist/components/searchcraft-popover-list-view.js +1 -1
  43. package/dist/components/searchcraft-results-info.js +2 -2
  44. package/dist/components/searchcraft-results-info.js.map +1 -1
  45. package/dist/components/searchcraft-search-results-per-page.js +3 -3
  46. package/dist/components/searchcraft-search-results-per-page.js.map +1 -1
  47. package/dist/components/searchcraft-slider.js +1 -1
  48. package/dist/components/searchcraft-theme.js +5 -5
  49. package/dist/components/searchcraft-theme.js.map +1 -1
  50. package/dist/components/searchcraft-toggle-button.js +1 -1
  51. package/dist/types/components/searchcraft-ad/searchcraft-ad.d.ts +19 -0
  52. package/dist/types/components/searchcraft-base-search-result/searchcraft-base-search-result.d.ts +5 -5
  53. package/dist/types/components/searchcraft-base-search-results/searchcraft-base-search-results.d.ts +15 -12
  54. package/dist/types/components/searchcraft-facet-list/searchcraft-facet-list.d.ts +1 -1
  55. package/dist/types/components/searchcraft-input-form/searchcraft-input-form.d.ts +6 -31
  56. package/dist/types/components/searchcraft-popover-form/searchcraft-popover-form.d.ts +2 -12
  57. package/dist/types/components/searchcraft-popover-list-view/searchcraft-popover-list-view.d.ts +4 -0
  58. package/dist/types/components/searchcraft-theme/searchcraft-theme.d.ts +2 -2
  59. package/dist/types/components.d.ts +62 -189
  60. package/dist/types/index.d.ts +14 -1
  61. package/dist/types/store/SearchcraftStore.d.ts +4 -0
  62. package/dist/types/{provider → store}/SearchcraftStore.types.d.ts +2 -1
  63. package/dist/{collection/provider/store.js → types/store/index.d.ts} +2 -2
  64. package/package.json +8 -17
  65. package/dist/cjs/SearchcraftStore-75fac5e0.js.map +0 -1
  66. package/dist/cjs/app-globals-3a1e7e63.js +0 -7
  67. package/dist/cjs/app-globals-3a1e7e63.js.map +0 -1
  68. package/dist/cjs/index-5b0b9d4c.js +0 -84
  69. package/dist/cjs/index-5b0b9d4c.js.map +0 -1
  70. package/dist/cjs/index-a81df4f0.js +0 -1577
  71. package/dist/cjs/index-a81df4f0.js.map +0 -1
  72. package/dist/cjs/index.cjs.js +0 -14
  73. package/dist/cjs/index.cjs.js.map +0 -1
  74. package/dist/cjs/loader.cjs.js +0 -17
  75. package/dist/cjs/loader.cjs.js.map +0 -1
  76. package/dist/cjs/searchcraft-base-search-result_2.cjs.entry.js +0 -152
  77. package/dist/cjs/searchcraft-base-search-result_2.cjs.entry.js.map +0 -1
  78. package/dist/cjs/searchcraft-base-search-results.cjs.entry.js +0 -97
  79. package/dist/cjs/searchcraft-base-search-results.cjs.entry.js.map +0 -1
  80. package/dist/cjs/searchcraft-button_3.cjs.entry.js +0 -88
  81. package/dist/cjs/searchcraft-button_3.cjs.entry.js.map +0 -1
  82. package/dist/cjs/searchcraft-facet-list_3.cjs.entry.js +0 -393
  83. package/dist/cjs/searchcraft-facet-list_3.cjs.entry.js.map +0 -1
  84. package/dist/cjs/searchcraft-filter-panel.cjs.entry.js +0 -113
  85. package/dist/cjs/searchcraft-filter-panel.cjs.entry.js.map +0 -1
  86. package/dist/cjs/searchcraft-input-form_2.cjs.entry.js +0 -260
  87. package/dist/cjs/searchcraft-input-form_2.cjs.entry.js.map +0 -1
  88. package/dist/cjs/searchcraft-javascript-sdk.cjs.js +0 -27
  89. package/dist/cjs/searchcraft-javascript-sdk.cjs.js.map +0 -1
  90. package/dist/cjs/searchcraft-pagination.cjs.entry.js +0 -106
  91. package/dist/cjs/searchcraft-pagination.cjs.entry.js.map +0 -1
  92. package/dist/cjs/searchcraft-popover-button.cjs.entry.js +0 -22
  93. package/dist/cjs/searchcraft-popover-button.cjs.entry.js.map +0 -1
  94. package/dist/cjs/searchcraft-popover-form.cjs.entry.js +0 -234
  95. package/dist/cjs/searchcraft-popover-form.cjs.entry.js.map +0 -1
  96. package/dist/cjs/searchcraft-popover-list-item_2.cjs.entry.js +0 -101
  97. package/dist/cjs/searchcraft-popover-list-item_2.cjs.entry.js.map +0 -1
  98. package/dist/cjs/searchcraft-results-info.cjs.entry.js +0 -80
  99. package/dist/cjs/searchcraft-results-info.cjs.entry.js.map +0 -1
  100. package/dist/cjs/searchcraft-search-results-per-page.cjs.entry.js +0 -75
  101. package/dist/cjs/searchcraft-search-results-per-page.cjs.entry.js.map +0 -1
  102. package/dist/cjs/searchcraft-select.cjs.entry.js +0 -70
  103. package/dist/cjs/searchcraft-select.cjs.entry.js.map +0 -1
  104. package/dist/cjs/searchcraft-theme.cjs.entry.js +0 -56
  105. package/dist/cjs/searchcraft-theme.cjs.entry.js.map +0 -1
  106. package/dist/cjs/styles-7b2d06f2.js +0 -28
  107. package/dist/cjs/styles-7b2d06f2.js.map +0 -1
  108. package/dist/cjs/units-fe4d8083.js +0 -88
  109. package/dist/cjs/units-fe4d8083.js.map +0 -1
  110. package/dist/collection/collection-manifest.json +0 -32
  111. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js +0 -302
  112. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js.map +0 -1
  113. package/dist/collection/components/searchcraft-base-search-result-ad/searchcraft-base-search-result-ad.js +0 -73
  114. package/dist/collection/components/searchcraft-base-search-result-ad/searchcraft-base-search-result-ad.js.map +0 -1
  115. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js +0 -313
  116. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js.map +0 -1
  117. package/dist/collection/components/searchcraft-button/searchcraft-button.js +0 -217
  118. package/dist/collection/components/searchcraft-button/searchcraft-button.js.map +0 -1
  119. package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js +0 -44
  120. package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js.map +0 -1
  121. package/dist/collection/components/searchcraft-facet-list/searchcraft-facet-list.js +0 -200
  122. package/dist/collection/components/searchcraft-facet-list/searchcraft-facet-list.js.map +0 -1
  123. package/dist/collection/components/searchcraft-filter-panel/searchcraft-filter-panel.js +0 -149
  124. package/dist/collection/components/searchcraft-filter-panel/searchcraft-filter-panel.js.map +0 -1
  125. package/dist/collection/components/searchcraft-input-form/searchcraft-input-form.js +0 -443
  126. package/dist/collection/components/searchcraft-input-form/searchcraft-input-form.js.map +0 -1
  127. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js +0 -67
  128. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js.map +0 -1
  129. package/dist/collection/components/searchcraft-pagination/searchcraft-pagination.js +0 -141
  130. package/dist/collection/components/searchcraft-pagination/searchcraft-pagination.js.map +0 -1
  131. package/dist/collection/components/searchcraft-popover-button/searchcraft-popover-button.js +0 -15
  132. package/dist/collection/components/searchcraft-popover-button/searchcraft-popover-button.js.map +0 -1
  133. package/dist/collection/components/searchcraft-popover-form/searchcraft-popover-form.js +0 -381
  134. package/dist/collection/components/searchcraft-popover-form/searchcraft-popover-form.js.map +0 -1
  135. package/dist/collection/components/searchcraft-popover-list-item/searchcraft-popover-list-item.js +0 -128
  136. package/dist/collection/components/searchcraft-popover-list-item/searchcraft-popover-list-item.js.map +0 -1
  137. package/dist/collection/components/searchcraft-popover-list-item-ad/searchcraft-popover-list-item-ad.js +0 -73
  138. package/dist/collection/components/searchcraft-popover-list-item-ad/searchcraft-popover-list-item-ad.js.map +0 -1
  139. package/dist/collection/components/searchcraft-popover-list-view/searchcraft-popover-list-view.js +0 -141
  140. package/dist/collection/components/searchcraft-popover-list-view/searchcraft-popover-list-view.js.map +0 -1
  141. package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.js +0 -138
  142. package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.js.map +0 -1
  143. package/dist/collection/components/searchcraft-search-results-per-page/searchcraft-search-results-per-page.js +0 -129
  144. package/dist/collection/components/searchcraft-search-results-per-page/searchcraft-search-results-per-page.js.map +0 -1
  145. package/dist/collection/components/searchcraft-select/searchcraft-select.js +0 -261
  146. package/dist/collection/components/searchcraft-select/searchcraft-select.js.map +0 -1
  147. package/dist/collection/components/searchcraft-slider/searchcraft-slider.js +0 -194
  148. package/dist/collection/components/searchcraft-slider/searchcraft-slider.js.map +0 -1
  149. package/dist/collection/components/searchcraft-theme/searchcraft-theme.js +0 -97
  150. package/dist/collection/components/searchcraft-theme/searchcraft-theme.js.map +0 -1
  151. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js +0 -118
  152. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js.map +0 -1
  153. package/dist/collection/index.js +0 -3
  154. package/dist/collection/index.js.map +0 -1
  155. package/dist/collection/provider/SearchcraftStore.js +0 -160
  156. package/dist/collection/provider/SearchcraftStore.js.map +0 -1
  157. package/dist/collection/provider/SearchcraftStore.types.js +0 -2
  158. package/dist/collection/provider/SearchcraftStore.types.js.map +0 -1
  159. package/dist/collection/provider/store.js.map +0 -1
  160. package/dist/collection/utils/facets.js +0 -128
  161. package/dist/collection/utils/facets.js.map +0 -1
  162. package/dist/collection/utils/index.js +0 -4
  163. package/dist/collection/utils/index.js.map +0 -1
  164. package/dist/collection/utils/styles.js +0 -22
  165. package/dist/collection/utils/styles.js.map +0 -1
  166. package/dist/collection/utils/units.js +0 -83
  167. package/dist/collection/utils/units.js.map +0 -1
  168. package/dist/components/p-25ee7496.js +0 -58
  169. package/dist/components/p-25ee7496.js.map +0 -1
  170. package/dist/components/p-38419178.js +0 -1625
  171. package/dist/components/p-38419178.js.map +0 -1
  172. package/dist/components/p-433f974c.js.map +0 -1
  173. package/dist/components/p-6e2eef88.js.map +0 -1
  174. package/dist/components/p-97332d3e.js.map +0 -1
  175. package/dist/components/p-bff4d3fc.js +0 -65
  176. package/dist/components/p-bff4d3fc.js.map +0 -1
  177. package/dist/components/p-de4a48b1.js +0 -65
  178. package/dist/components/p-de4a48b1.js.map +0 -1
  179. package/dist/components/p-ec0d230e.js.map +0 -1
  180. package/dist/components/searchcraft-base-search-result-ad.d.ts +0 -11
  181. package/dist/components/searchcraft-base-search-result-ad.js +0 -8
  182. package/dist/components/searchcraft-base-search-result-ad.js.map +0 -1
  183. package/dist/components/searchcraft-popover-list-item-ad.d.ts +0 -11
  184. package/dist/components/searchcraft-popover-list-item-ad.js +0 -8
  185. package/dist/components/searchcraft-popover-list-item-ad.js.map +0 -1
  186. package/dist/esm/SearchcraftStore-3cfd565a.js +0 -1625
  187. package/dist/esm/SearchcraftStore-3cfd565a.js.map +0 -1
  188. package/dist/esm/app-globals-0f993ce5.js +0 -5
  189. package/dist/esm/app-globals-0f993ce5.js.map +0 -1
  190. package/dist/esm/index-3608c57d.js +0 -1548
  191. package/dist/esm/index-3608c57d.js.map +0 -1
  192. package/dist/esm/index-72ac5051.js +0 -82
  193. package/dist/esm/index-72ac5051.js.map +0 -1
  194. package/dist/esm/index.js +0 -4
  195. package/dist/esm/index.js.map +0 -1
  196. package/dist/esm/loader.js +0 -13
  197. package/dist/esm/loader.js.map +0 -1
  198. package/dist/esm/searchcraft-base-search-result_2.entry.js +0 -147
  199. package/dist/esm/searchcraft-base-search-result_2.entry.js.map +0 -1
  200. package/dist/esm/searchcraft-base-search-results.entry.js +0 -93
  201. package/dist/esm/searchcraft-base-search-results.entry.js.map +0 -1
  202. package/dist/esm/searchcraft-button_3.entry.js +0 -82
  203. package/dist/esm/searchcraft-button_3.entry.js.map +0 -1
  204. package/dist/esm/searchcraft-facet-list_3.entry.js +0 -387
  205. package/dist/esm/searchcraft-facet-list_3.entry.js.map +0 -1
  206. package/dist/esm/searchcraft-filter-panel.entry.js +0 -109
  207. package/dist/esm/searchcraft-filter-panel.entry.js.map +0 -1
  208. package/dist/esm/searchcraft-input-form_2.entry.js +0 -255
  209. package/dist/esm/searchcraft-input-form_2.entry.js.map +0 -1
  210. package/dist/esm/searchcraft-javascript-sdk.js +0 -22
  211. package/dist/esm/searchcraft-javascript-sdk.js.map +0 -1
  212. package/dist/esm/searchcraft-pagination.entry.js +0 -102
  213. package/dist/esm/searchcraft-pagination.entry.js.map +0 -1
  214. package/dist/esm/searchcraft-popover-button.entry.js +0 -18
  215. package/dist/esm/searchcraft-popover-button.entry.js.map +0 -1
  216. package/dist/esm/searchcraft-popover-form.entry.js +0 -230
  217. package/dist/esm/searchcraft-popover-form.entry.js.map +0 -1
  218. package/dist/esm/searchcraft-popover-list-item_2.entry.js +0 -96
  219. package/dist/esm/searchcraft-popover-list-item_2.entry.js.map +0 -1
  220. package/dist/esm/searchcraft-results-info.entry.js +0 -76
  221. package/dist/esm/searchcraft-results-info.entry.js.map +0 -1
  222. package/dist/esm/searchcraft-search-results-per-page.entry.js +0 -71
  223. package/dist/esm/searchcraft-search-results-per-page.entry.js.map +0 -1
  224. package/dist/esm/searchcraft-select.entry.js +0 -66
  225. package/dist/esm/searchcraft-select.entry.js.map +0 -1
  226. package/dist/esm/searchcraft-theme.entry.js +0 -52
  227. package/dist/esm/searchcraft-theme.entry.js.map +0 -1
  228. package/dist/esm/styles-961644ef.js +0 -25
  229. package/dist/esm/styles-961644ef.js.map +0 -1
  230. package/dist/esm/units-daaf96f5.js +0 -84
  231. package/dist/esm/units-daaf96f5.js.map +0 -1
  232. package/dist/index.cjs.js +0 -1
  233. package/dist/index.js +0 -1
  234. package/dist/loader/cdn.js +0 -1
  235. package/dist/loader/index.cjs.js +0 -1
  236. package/dist/loader/index.d.ts +0 -24
  237. package/dist/loader/index.es2017.js +0 -1
  238. package/dist/loader/index.js +0 -2
  239. package/dist/loader/package.json +0 -11
  240. package/dist/searchcraft-javascript-sdk/index.esm.js +0 -2
  241. package/dist/searchcraft-javascript-sdk/index.esm.js.map +0 -1
  242. package/dist/searchcraft-javascript-sdk/p-279f3e15.entry.js +0 -2
  243. package/dist/searchcraft-javascript-sdk/p-279f3e15.entry.js.map +0 -1
  244. package/dist/searchcraft-javascript-sdk/p-2bc82b48.entry.js +0 -2
  245. package/dist/searchcraft-javascript-sdk/p-2bc82b48.entry.js.map +0 -1
  246. package/dist/searchcraft-javascript-sdk/p-2dc07b47.entry.js +0 -2
  247. package/dist/searchcraft-javascript-sdk/p-2dc07b47.entry.js.map +0 -1
  248. package/dist/searchcraft-javascript-sdk/p-37842dee.entry.js +0 -2
  249. package/dist/searchcraft-javascript-sdk/p-37842dee.entry.js.map +0 -1
  250. package/dist/searchcraft-javascript-sdk/p-38419178.js +0 -11
  251. package/dist/searchcraft-javascript-sdk/p-38419178.js.map +0 -1
  252. package/dist/searchcraft-javascript-sdk/p-3be70f20.entry.js +0 -2
  253. package/dist/searchcraft-javascript-sdk/p-3be70f20.entry.js.map +0 -1
  254. package/dist/searchcraft-javascript-sdk/p-5cdc6210.js +0 -7
  255. package/dist/searchcraft-javascript-sdk/p-5cdc6210.js.map +0 -1
  256. package/dist/searchcraft-javascript-sdk/p-5e064c07.entry.js +0 -2
  257. package/dist/searchcraft-javascript-sdk/p-5e064c07.entry.js.map +0 -1
  258. package/dist/searchcraft-javascript-sdk/p-6104fe5d.js +0 -2
  259. package/dist/searchcraft-javascript-sdk/p-6104fe5d.js.map +0 -1
  260. package/dist/searchcraft-javascript-sdk/p-6bffd3f5.entry.js +0 -2
  261. package/dist/searchcraft-javascript-sdk/p-6bffd3f5.entry.js.map +0 -1
  262. package/dist/searchcraft-javascript-sdk/p-7813f3cc.entry.js +0 -2
  263. package/dist/searchcraft-javascript-sdk/p-7813f3cc.entry.js.map +0 -1
  264. package/dist/searchcraft-javascript-sdk/p-7e13c128.js +0 -3
  265. package/dist/searchcraft-javascript-sdk/p-7e13c128.js.map +0 -1
  266. package/dist/searchcraft-javascript-sdk/p-7f4dd50c.entry.js +0 -2
  267. package/dist/searchcraft-javascript-sdk/p-7f4dd50c.entry.js.map +0 -1
  268. package/dist/searchcraft-javascript-sdk/p-9340f4e4.entry.js +0 -2
  269. package/dist/searchcraft-javascript-sdk/p-9340f4e4.entry.js.map +0 -1
  270. package/dist/searchcraft-javascript-sdk/p-a84b1548.entry.js +0 -2
  271. package/dist/searchcraft-javascript-sdk/p-a84b1548.entry.js.map +0 -1
  272. package/dist/searchcraft-javascript-sdk/p-b8ea0454.entry.js +0 -2
  273. package/dist/searchcraft-javascript-sdk/p-b8ea0454.entry.js.map +0 -1
  274. package/dist/searchcraft-javascript-sdk/p-c4a9d8ab.entry.js +0 -2
  275. package/dist/searchcraft-javascript-sdk/p-c4a9d8ab.entry.js.map +0 -1
  276. package/dist/searchcraft-javascript-sdk/p-d9551738.js +0 -2
  277. package/dist/searchcraft-javascript-sdk/p-d9551738.js.map +0 -1
  278. package/dist/searchcraft-javascript-sdk/p-e11de2d6.entry.js +0 -2
  279. package/dist/searchcraft-javascript-sdk/p-e11de2d6.entry.js.map +0 -1
  280. package/dist/searchcraft-javascript-sdk/p-e1255160.js +0 -2
  281. package/dist/searchcraft-javascript-sdk/p-e1255160.js.map +0 -1
  282. package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js +0 -2
  283. package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js.map +0 -1
  284. package/dist/types/components/searchcraft-base-search-result-ad/searchcraft-base-search-result-ad.d.ts +0 -14
  285. package/dist/types/components/searchcraft-popover-list-item-ad/searchcraft-popover-list-item-ad.d.ts +0 -14
  286. package/dist/types/provider/SearchcraftStore.d.ts +0 -4
  287. package/dist/types/provider/store.d.ts +0 -3
@@ -1,141 +0,0 @@
1
- import { useSearchcraftStore } from "../../provider/store";
2
- import { h } from "@stencil/core";
3
- import classNames from "classnames";
4
- import { parseCustomStyles } from "../../utils/index";
5
- /**
6
- * This web component is designed to facilitate pagination of search results.
7
- * Once a query is submitted, calculates the number for pages.
8
- *
9
- * ## Usage
10
- * ```html
11
- * <!-- index.html -->
12
- * <searchcraft-pagination />
13
- * ```
14
- */
15
- export class SearchcraftPagination {
16
- /**
17
- * The custom styles object.
18
- */
19
- customStyles;
20
- // store vars
21
- searchTerm;
22
- searchResultsPerPage;
23
- searchResultsPage;
24
- searchResultsCount;
25
- // local vars
26
- searchResultsPagesCount = 1;
27
- searchResultsRangeMin = 1;
28
- searchResultsRangeMax = 1;
29
- // store functions
30
- setSearchResultsPage = () => { };
31
- unsubscribe = () => { };
32
- componentDidLoad() {
33
- this.unsubscribe = useSearchcraftStore.subscribe((state) => {
34
- // store vars
35
- this.searchTerm = state.searchTerm;
36
- this.searchResultsPerPage = state.searchResultsPerPage;
37
- this.searchResultsPage = state.searchResultsPage;
38
- this.searchResultsCount = state.searchResultsCount;
39
- // local vars
40
- this.searchResultsPagesCount = Math.ceil(this.searchResultsCount / this.searchResultsPerPage);
41
- this.searchResultsRangeMin =
42
- (this.searchResultsPage - 1) * this.searchResultsPerPage + 1;
43
- this.searchResultsRangeMax =
44
- (this.searchResultsPerPage - 1) * this.searchResultsPerPage +
45
- this.searchResultsPerPage;
46
- // store functions
47
- this.setSearchResultsPage = state.setSearchResultsPage;
48
- });
49
- }
50
- disconnectedCallback() {
51
- this.unsubscribe?.();
52
- }
53
- handleGoToPage(page) {
54
- this.setSearchResultsPage(page);
55
- }
56
- renderOddPaginationItem(page) {
57
- return (h("li", null, h("button", { class: classNames('searchcraft-pagination-item', {
58
- 'searchcraft-pagination-item-active': this.searchResultsPage === page,
59
- }), onClick: () => this.handleGoToPage(page), type: 'button' }, page)));
60
- }
61
- renderEvenPaginationItem(page) {
62
- if (this.searchResultsPagesCount <= page) {
63
- return;
64
- }
65
- if (this.searchResultsPagesCount <= 5 ||
66
- page < Math.ceil(this.searchResultsPagesCount / 2) // is the first or second even pagination item
67
- ? this.searchResultsPage <= page + 1
68
- : this.searchResultsPage >= page - 1) {
69
- return (h("li", null, h("button", { class: classNames('searchcraft-pagination-item', {
70
- 'searchcraft-pagination-item-active': this.searchResultsPage === page,
71
- }), onClick: () => this.handleGoToPage(page), type: 'button' }, page)));
72
- }
73
- return (h("li", null, h("span", { class: 'searchcraft-pagination-item' }, "...")));
74
- }
75
- renderMiddlePaginationItem() {
76
- if (this.searchResultsPagesCount <= 3) {
77
- return;
78
- }
79
- if (this.searchResultsPagesCount <= 5 ||
80
- this.searchResultsPage <= 3 ||
81
- this.searchResultsPage >= this.searchResultsPagesCount - 2) {
82
- return (h("li", null, h("button", { class: classNames('searchcraft-pagination-item', {
83
- 'searchcraft-pagination-item-active': this.searchResultsPage === 3 ||
84
- this.searchResultsPage === this.searchResultsPagesCount - 2,
85
- }), type: 'button', onClick: () => this.handleGoToPage(this.searchResultsPage >= this.searchResultsPagesCount - 2
86
- ? this.searchResultsPagesCount - 2
87
- : 3) }, this.searchResultsPage >= this.searchResultsPagesCount - 2
88
- ? this.searchResultsPagesCount - 2
89
- : 3)));
90
- }
91
- return (h("li", null, h("span", { class: 'searchcraft-pagination-item searchcraft-pagination-item-active' }, this.searchResultsPage)));
92
- }
93
- render() {
94
- // early return if there isn't a searchTerm or there is 1 or fewer pages of results
95
- if (!this.searchTerm || this.searchResultsPagesCount <= 1) {
96
- return;
97
- }
98
- return (h("div", { class: classNames('searchcraft-pagination', parseCustomStyles(this.customStyles || {})) }, h("div", { class: 'searchcraft-pagination-control' }, h("searchcraft-button", { disabled: this.searchResultsPage === 1, hierarchy: 'tertiary', onButtonClick: () => this.handleGoToPage(Math.max(1, this.searchResultsPage - 1)), label: 'Previous', iconPosition: 'left', icon: h("svg", { width: '20', height: '20', viewBox: '0 0 20 20', fill: 'none', xmlns: 'http://www.w3.org/2000/svg' }, h("title", null, "Previous page icon"), h("path", { d: 'M12.5 15L7.5 10L12.5 5', stroke: 'currentColor', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' })), iconOnly: true })), h("ul", { class: 'searchcraft-pagination-list' }, this.renderOddPaginationItem(1), this.renderEvenPaginationItem(2), this.renderMiddlePaginationItem(), this.renderEvenPaginationItem(this.searchResultsPagesCount > 4
99
- ? this.searchResultsPagesCount - 1
100
- : 4), this.renderOddPaginationItem(this.searchResultsPagesCount)), h("div", { class: 'searchcraft-pagination-control' }, h("searchcraft-button", { disabled: this.searchResultsPage === this.searchResultsPagesCount, hierarchy: 'tertiary', onButtonClick: () => {
101
- this.handleGoToPage(Math.min(this.searchResultsPagesCount, this.searchResultsPage + 1));
102
- }, label: 'Next', iconPosition: 'right', icon: h("svg", { width: '20', height: '20', viewBox: '0 0 20 20', fill: 'none', xmlns: 'http://www.w3.org/2000/svg' }, h("title", null, "Next page icon"), h("path", { d: 'M7.5 15L12.5 10L7.5 5', stroke: 'currentColor', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' })), iconOnly: true }))));
103
- }
104
- static get is() { return "searchcraft-pagination"; }
105
- static get properties() {
106
- return {
107
- "customStyles": {
108
- "type": "string",
109
- "mutable": false,
110
- "complexType": {
111
- "original": "string",
112
- "resolved": "string | undefined",
113
- "references": {}
114
- },
115
- "required": false,
116
- "optional": true,
117
- "docs": {
118
- "tags": [],
119
- "text": "The custom styles object."
120
- },
121
- "getter": false,
122
- "setter": false,
123
- "attribute": "custom-styles",
124
- "reflect": false
125
- }
126
- };
127
- }
128
- static get states() {
129
- return {
130
- "searchTerm": {},
131
- "searchResultsPerPage": {},
132
- "searchResultsPage": {},
133
- "searchResultsCount": {},
134
- "searchResultsPagesCount": {},
135
- "searchResultsRangeMin": {},
136
- "searchResultsRangeMax": {},
137
- "setSearchResultsPage": {}
138
- };
139
- }
140
- }
141
- //# sourceMappingURL=searchcraft-pagination.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"searchcraft-pagination.js","sourceRoot":"","sources":["../../../../src/components/searchcraft-pagination/searchcraft-pagination.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,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AAuB,EAC5B,IAAI,CAAC,iBAAiB,GAAG,CAAC,CAC3B,CACF,CAAC;oBACJ,CAAC,EACD,KAAK,EAAC,MAAM,EACZ,YAAY,EAAC,OAAO,EACpB,IAAI,EACF,WACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,4BAA4B;wBAElC,kCAA6B;wBAC7B,YACE,CAAC,EAAC,uBAAuB,EACzB,MAAM,EAAC,cAAc,kBACR,KAAK,oBACH,OAAO,qBACN,OAAO,GACvB,CACE,EAER,QAAQ,SACR,CACE,CACF,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { useSearchcraftStore } from '@provider/store';\nimport { Component, h, State, Prop } from '@stencil/core';\nimport classNames from 'classnames';\n\nimport { parseCustomStyles } from '@utils';\n\n/**\n * This web component is designed to facilitate pagination of search results.\n * Once a query is submitted, calculates the number for pages.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-pagination />\n * ```\n */\n@Component({\n tag: 'searchcraft-pagination',\n shadow: false,\n})\nexport class SearchcraftPagination {\n /**\n * The custom styles object.\n */\n @Prop() customStyles?: string;\n\n // store vars\n @State() searchTerm;\n @State() searchResultsPerPage;\n @State() searchResultsPage;\n @State() searchResultsCount;\n\n // local vars\n @State() searchResultsPagesCount = 1;\n @State() searchResultsRangeMin = 1;\n @State() searchResultsRangeMax = 1;\n\n // store functions\n @State() setSearchResultsPage: (page: number) => void = () => {};\n\n private unsubscribe: () => void = () => {};\n\n componentDidLoad() {\n this.unsubscribe = useSearchcraftStore.subscribe((state) => {\n // store vars\n this.searchTerm = state.searchTerm;\n this.searchResultsPerPage = state.searchResultsPerPage;\n this.searchResultsPage = state.searchResultsPage;\n this.searchResultsCount = state.searchResultsCount;\n\n // local vars\n this.searchResultsPagesCount = Math.ceil(\n this.searchResultsCount / this.searchResultsPerPage,\n );\n this.searchResultsRangeMin =\n (this.searchResultsPage - 1) * this.searchResultsPerPage + 1;\n this.searchResultsRangeMax =\n (this.searchResultsPerPage - 1) * this.searchResultsPerPage +\n this.searchResultsPerPage;\n\n // store functions\n this.setSearchResultsPage = state.setSearchResultsPage;\n });\n }\n\n disconnectedCallback() {\n this.unsubscribe?.();\n }\n\n handleGoToPage(page: number) {\n this.setSearchResultsPage(page);\n }\n\n renderOddPaginationItem(page: number) {\n return (\n <li>\n <button\n class={classNames('searchcraft-pagination-item', {\n 'searchcraft-pagination-item-active':\n this.searchResultsPage === page,\n })}\n onClick={() => this.handleGoToPage(page)}\n type='button'\n >\n {page}\n </button>\n </li>\n );\n }\n\n renderEvenPaginationItem(page: number) {\n if (this.searchResultsPagesCount <= page) {\n return;\n }\n\n if (\n this.searchResultsPagesCount <= 5 ||\n page < Math.ceil(this.searchResultsPagesCount / 2) // is the first or second even pagination item\n ? this.searchResultsPage <= page + 1\n : this.searchResultsPage >= page - 1\n ) {\n return (\n <li>\n <button\n class={classNames('searchcraft-pagination-item', {\n 'searchcraft-pagination-item-active':\n this.searchResultsPage === page,\n })}\n onClick={() => this.handleGoToPage(page)}\n type='button'\n >\n {page}\n </button>\n </li>\n );\n }\n\n return (\n <li>\n <span class='searchcraft-pagination-item'>...</span>\n </li>\n );\n }\n\n renderMiddlePaginationItem() {\n if (this.searchResultsPagesCount <= 3) {\n return;\n }\n\n if (\n this.searchResultsPagesCount <= 5 ||\n this.searchResultsPage <= 3 ||\n this.searchResultsPage >= this.searchResultsPagesCount - 2\n ) {\n return (\n <li>\n <button\n class={classNames('searchcraft-pagination-item', {\n 'searchcraft-pagination-item-active':\n this.searchResultsPage === 3 ||\n this.searchResultsPage === this.searchResultsPagesCount - 2,\n })}\n type='button'\n onClick={() =>\n this.handleGoToPage(\n this.searchResultsPage >= this.searchResultsPagesCount - 2\n ? this.searchResultsPagesCount - 2\n : 3,\n )\n }\n >\n {this.searchResultsPage >= this.searchResultsPagesCount - 2\n ? this.searchResultsPagesCount - 2\n : 3}\n </button>\n </li>\n );\n }\n\n return (\n <li>\n <span class='searchcraft-pagination-item searchcraft-pagination-item-active'>\n {this.searchResultsPage}\n </span>\n </li>\n );\n }\n\n render() {\n // early return if there isn't a searchTerm or there is 1 or fewer pages of results\n if (!this.searchTerm || this.searchResultsPagesCount <= 1) {\n return;\n }\n\n return (\n <div\n class={classNames(\n 'searchcraft-pagination',\n parseCustomStyles(this.customStyles || {}),\n )}\n >\n <div class='searchcraft-pagination-control'>\n <searchcraft-button\n disabled={this.searchResultsPage === 1}\n hierarchy='tertiary'\n onButtonClick={() =>\n this.handleGoToPage(Math.max(1, this.searchResultsPage - 1))\n }\n label='Previous'\n iconPosition='left'\n icon={\n <svg\n width='20'\n height='20'\n viewBox='0 0 20 20'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n >\n <title>Previous page icon</title>\n <path\n d='M12.5 15L7.5 10L12.5 5'\n stroke='currentColor'\n stroke-width='1.5'\n stroke-linecap='round'\n stroke-linejoin='round'\n />\n </svg>\n }\n iconOnly\n />\n </div>\n <ul class='searchcraft-pagination-list'>\n {this.renderOddPaginationItem(1)}\n {this.renderEvenPaginationItem(2)}\n {this.renderMiddlePaginationItem()}\n {this.renderEvenPaginationItem(\n this.searchResultsPagesCount > 4\n ? this.searchResultsPagesCount - 1\n : 4,\n )}\n {this.renderOddPaginationItem(this.searchResultsPagesCount)}\n </ul>\n <div class='searchcraft-pagination-control'>\n <searchcraft-button\n disabled={this.searchResultsPage === this.searchResultsPagesCount}\n hierarchy='tertiary'\n onButtonClick={() => {\n this.handleGoToPage(\n Math.min(\n this.searchResultsPagesCount,\n this.searchResultsPage + 1,\n ),\n );\n }}\n label='Next'\n iconPosition='right'\n icon={\n <svg\n width='20'\n height='20'\n viewBox='0 0 20 20'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n >\n <title>Next page icon</title>\n <path\n d='M7.5 15L12.5 10L7.5 5'\n stroke='currentColor'\n stroke-width='1.5'\n stroke-linecap='round'\n stroke-linejoin='round'\n />\n </svg>\n }\n iconOnly\n />\n </div>\n </div>\n );\n }\n}\n"]}
@@ -1,15 +0,0 @@
1
- import { useSearchcraftStore } from "../../provider/store";
2
- import { h } from "@stencil/core";
3
- /**
4
- * Renders a button which, when clicked, turns on popover visibility.
5
- */
6
- export class SearchcraftPopoverButton {
7
- handleOnClick() {
8
- useSearchcraftStore.getState().setPopoverVisibility(true);
9
- }
10
- render() {
11
- return (h("button", { key: '538e1e8506bea196e6ba45482f9daa75d032462f', type: 'button', onClick: this.handleOnClick.bind(this) }, h("slot", { key: '788b70da6edcbfb283d373ada36709582ad16e51' })));
12
- }
13
- static get is() { return "searchcraft-popover-button"; }
14
- }
15
- //# sourceMappingURL=searchcraft-popover-button.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"searchcraft-popover-button.js","sourceRoot":"","sources":["../../../../src/components/searchcraft-popover-button/searchcraft-popover-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAE7C;;GAEG;AAKH,MAAM,OAAO,wBAAwB;IACnC,aAAa;QACX,mBAAmB,CAAC,QAAQ,EAAE,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;IAC5D,CAAC;IAED,MAAM;QACJ,OAAO,CACL,+DAAQ,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC;YAC1D,8DAAQ,CACD,CACV,CAAC;IACJ,CAAC;;CACF","sourcesContent":["import { useSearchcraftStore } from '@provider/store';\nimport { Component, h } from '@stencil/core';\n\n/**\n * Renders a button which, when clicked, turns on popover visibility.\n */\n@Component({\n tag: 'searchcraft-popover-button',\n shadow: false,\n})\nexport class SearchcraftPopoverButton {\n handleOnClick() {\n useSearchcraftStore.getState().setPopoverVisibility(true);\n }\n\n render() {\n return (\n <button type='button' onClick={this.handleOnClick.bind(this)}>\n <slot />\n </button>\n );\n }\n}\n"]}
@@ -1,381 +0,0 @@
1
- import { h } from "@stencil/core";
2
- import classNames from "classnames";
3
- import { useSearchcraftStore } from "../../provider/store";
4
- /**
5
- * This web component is designed to display search results in a popover container that dynamically appears when the user interacts with a search input field, or when a popover-button is pressed.
6
- *
7
- * ## Usage
8
- * ```html
9
- * <!-- index.html -->
10
- * <searchcraft-popover-form type="fullscreen" />
11
- * ```
12
- *
13
- * ```js
14
- * // index.js
15
- * const popoverForm = document.querySelector('searchcraft-popover-form');
16
- *
17
- * popoverForm.config = {
18
- * index: [index_name_from_vektron],
19
- * readKey: 'read_key_from_vektron',
20
- * endpointUrl: 'enpoint_url_from_vektron',
21
- * };
22
- *
23
- * popoverForm.popoverResultMappings = {
24
- * containerHref: {
25
- * fieldNames: [
26
- * {
27
- * fieldName: 'canonical_link',
28
- * dataType: 'text',
29
- * },
30
- * ],
31
- * };
32
- * ```
33
- */
34
- export class SearchcraftPopoverForm {
35
- /**
36
- * The Searchcraft config object.
37
- */
38
- config;
39
- /**
40
- * The type of popover form to render.
41
- *
42
- * - `inline` - Renders inline with the rest of the content on the page. The search results pop over the page content.
43
- * - `fullscreen` - Renders in fullscreen view. Used together with the `searchcraft-popover-button` component.
44
- * - `modal` - Renders in a modal view. Used together with the `searchcraft-popover-button` component.
45
- */
46
- type = 'inline';
47
- /**
48
- * Formats the content rendered for each result.
49
- */
50
- popoverResultMappings;
51
- /**
52
- * The hotkey that activates the popover.
53
- */
54
- hotkey = 'k';
55
- /**
56
- * The hotkey modifier that activates the popover. Used together with the `hotkey` prop.
57
- */
58
- hotkeyModifier = 'meta';
59
- isPopoverVisibleInState = false;
60
- unsubscribe;
61
- searchClientResponseItems = [];
62
- adClientResponseItems = [];
63
- searchTerm;
64
- isFocused = false;
65
- breakpointSm = 576;
66
- breakpointMd = 768;
67
- breakpointLg = 992;
68
- searchResultsPage;
69
- searchResultsPerPage;
70
- modalElement;
71
- hostElement;
72
- componentDidLoad() {
73
- // Loads the breakpoint values into state
74
- const computedStyle = getComputedStyle(document.documentElement);
75
- this.breakpointSm = Number.parseFloat(computedStyle.getPropertyValue('--sc-breakpoint-sm').trim());
76
- this.breakpointMd = Number.parseFloat(computedStyle.getPropertyValue('--sc-breakpoint-md').trim());
77
- this.breakpointLg = Number.parseFloat(computedStyle.getPropertyValue('--sc-breakpoint-lg').trim());
78
- // Set popover visiblity in state
79
- this.isPopoverVisibleInState =
80
- useSearchcraftStore.getState().isPopoverVisible;
81
- // Add event listeners
82
- document.addEventListener('click', this.handleDocumentClick);
83
- document.addEventListener('keydown', this.handleDocumentKeyDown);
84
- // Subscribe to state events
85
- this.unsubscribe = useSearchcraftStore.subscribe((state) => {
86
- if (this.isPopoverVisibleInState !== state.isPopoverVisible) {
87
- this.handlePopoverVisibilityChange(state.isPopoverVisible);
88
- }
89
- this.searchClientResponseItems = [...state.searchClientResponseItems];
90
- this.adClientResponseItems = [...state.adClientResponseItems];
91
- this.searchTerm = state.searchTerm;
92
- this.searchResultsPage = state.searchResultsPage;
93
- this.searchResultsPerPage = state.searchResultsPerPage;
94
- });
95
- }
96
- disconnectedCallback() {
97
- this.unsubscribe?.();
98
- document.removeEventListener('click', this.handleDocumentClick);
99
- document.removeEventListener('keydown', this.handleDocumentKeyDown);
100
- }
101
- handleDocumentClick = (event) => {
102
- if (!this.hostElement.contains(event.target)) {
103
- this.isFocused = false;
104
- }
105
- };
106
- /**
107
- * Handles when popover visibility is changed in state
108
- */
109
- handlePopoverVisibilityChange(isVisible) {
110
- this.isPopoverVisibleInState = isVisible;
111
- document.body.style.overflow = isVisible ? 'hidden' : 'auto';
112
- }
113
- /**
114
- * Actions to perform when various keys are pressed within the popover form.
115
- */
116
- handleDocumentKeyDown = (event) => {
117
- // Document-scoped actions
118
- if (event.key === this.hotkey) {
119
- this.handleHotkeyPressed(event);
120
- }
121
- // Document-scoped -> Popover-scoped keyboard event boundary
122
- if (!this.hostElement.contains(document.activeElement)) {
123
- return;
124
- }
125
- // Popover-scoped actions
126
- switch (event.key) {
127
- case 'ArrowDown':
128
- case 'ArrowUp':
129
- event.preventDefault();
130
- this.focusOnNextListItem(event.key);
131
- break;
132
- case 'Escape':
133
- useSearchcraftStore.getState().setPopoverVisibility(false);
134
- break;
135
- default:
136
- return;
137
- }
138
- };
139
- handleInputInit = () => {
140
- const input = this.hostElement.querySelector('.searchcraft-input');
141
- input?.focus();
142
- };
143
- /**
144
- * When popover is `inline` and the viewport is at the smallest breakpoint,
145
- * focusing on the input will open a modal version of the popover form.
146
- */
147
- handleInputFocus() {
148
- this.isFocused = true;
149
- if (this.type === 'inline' &&
150
- window.visualViewport &&
151
- window.visualViewport.width < this.breakpointSm) {
152
- useSearchcraftStore.getState().setPopoverVisibility(true);
153
- // Appends a popover form of type=`modal` to the body
154
- if (!this.modalElement) {
155
- this.modalElement = document.createElement('searchcraft-popover-form');
156
- this.modalElement.config = this.config;
157
- this.modalElement.popoverResultMappings = this.popoverResultMappings;
158
- this.modalElement.setAttribute('type', 'fullscreen');
159
- document.body.appendChild(this.modalElement);
160
- }
161
- }
162
- }
163
- handleModalBackdropClick(_event) {
164
- useSearchcraftStore.getState().setPopoverVisibility(false);
165
- }
166
- /**
167
- * When a hotkey is pressed, tests if the modifiers also match.
168
- * If modifiers match, toggles visibility of the popover modal.
169
- */
170
- handleHotkeyPressed(event) {
171
- if ((event.ctrlKey && this.hotkeyModifier === 'ctrl') ||
172
- (event.altKey && this.hotkeyModifier === 'alt') ||
173
- (event.metaKey && this.hotkeyModifier === 'meta')) {
174
- event.preventDefault();
175
- if (this.type === 'inline' && !this.isPopoverVisibleInState) {
176
- const hostElementInput = this.hostElement.querySelector('.searchcraft-input');
177
- hostElementInput?.focus();
178
- }
179
- else {
180
- useSearchcraftStore
181
- .getState()
182
- .setPopoverVisibility(!this.isPopoverVisibleInState);
183
- }
184
- }
185
- }
186
- handleCancelButtonClick() {
187
- useSearchcraftStore.getState().setPopoverVisibility(false);
188
- }
189
- /**
190
- * Moves focus to the next/previous list item in the list view. If you are at the top
191
- * of the list view, it moves focus back to the input.
192
- *
193
- * @param direction
194
- */
195
- focusOnNextListItem(direction) {
196
- const listItems = Array.from(document.querySelectorAll('a.searchcraft-popover-list-item')).filter((el) => !el.hasAttribute('disabled') && el.offsetParent !== null);
197
- const currentIndex = listItems.indexOf(document.activeElement);
198
- if (direction === 'ArrowDown') {
199
- listItems[(currentIndex + 1) % listItems.length]?.focus();
200
- }
201
- else if (direction === 'ArrowUp') {
202
- if (currentIndex >= 1) {
203
- listItems[currentIndex - 1]?.focus();
204
- }
205
- else {
206
- const input = document.querySelector('.searchcraft-input');
207
- if (input) {
208
- input.focus();
209
- requestAnimationFrame(() => {
210
- input.selectionEnd = input.value.length;
211
- input.selectionStart = input.value.length;
212
- });
213
- }
214
- }
215
- }
216
- }
217
- get hasResultsToShow() {
218
- return (this.searchTerm &&
219
- this.searchTerm?.trim()?.length > 0 &&
220
- this.searchClientResponseItems.length > 0);
221
- }
222
- renderInlinePopover() {
223
- const isListViewVisible = this.hasResultsToShow && this.isFocused;
224
- const popoverFormClassNames = classNames('searchcraft-popover-form searchcraft-popover-form-inline', {
225
- 'searchcraft-popover-form-active': isListViewVisible,
226
- });
227
- return (h("div", { class: popoverFormClassNames }, h("searchcraft-input-form", { config: this.config, onInputFocus: this.handleInputFocus.bind(this) }), isListViewVisible && (h("div", { class: 'searchcraft-popover-inline-wrapper-outer' }, h("div", { class: 'searchcraft-popover-inline-wrapper-inner' }, h("searchcraft-popover-list-view", { popoverResultMappings: this.popoverResultMappings, searchClientResponseItems: this.searchClientResponseItems, adClientResponseItems: this.adClientResponseItems, searchResultsPage: this.searchResultsPage, searchResultsPerPage: this.searchResultsPerPage }))))));
228
- }
229
- renderModalPopover() {
230
- if (this.isPopoverVisibleInState) {
231
- const popoverFormClassNames = classNames('searchcraft-popover-form', {
232
- 'searchcraft-popover-form-active': this.hasResultsToShow,
233
- });
234
- return (h("div", { class: 'searchcraft-popover-form-modal' }, h("div", { class: 'searchcraft-popover-form-modal-backdrop', onClick: this.handleModalBackdropClick }), h("div", { class: 'searchcraft-popover-form-modal-inner' }, h("div", { class: popoverFormClassNames }, h("div", { class: 'searchcraft-popover-form-input-wrapper' }, h("searchcraft-input-form", { config: this.config, onInputFocus: this.handleInputFocus.bind(this), onInputInit: this.handleInputInit.bind(this) }), h("button", { type: 'button', class: 'searchcraft-popover-form-cancel-button', onClick: this.handleCancelButtonClick.bind(this) }, "Cancel")), this.hasResultsToShow && (h("searchcraft-popover-list-view", { popoverResultMappings: this.popoverResultMappings, searchClientResponseItems: this.searchClientResponseItems, adClientResponseItems: this.adClientResponseItems, searchResultsPage: this.searchResultsPage, searchResultsPerPage: this.searchResultsPerPage }))))));
235
- }
236
- }
237
- renderFullscreenPopover() {
238
- if (this.isPopoverVisibleInState) {
239
- return (h("div", { class: 'searchcraft-popover-form-fullscreen' }, h("div", { class: 'searchcraft-popover-form' }, h("div", { class: 'searchcraft-popover-form-input-wrapper' }, h("searchcraft-input-form", { config: this.config, onInputFocus: this.handleInputFocus.bind(this), onInputInit: this.handleInputInit.bind(this) }), h("button", { type: 'button', class: 'searchcraft-popover-form-cancel-button', onClick: this.handleCancelButtonClick.bind(this) }, "Cancel")), this.hasResultsToShow && (h("searchcraft-popover-list-view", { popoverResultMappings: this.popoverResultMappings, searchClientResponseItems: this.searchClientResponseItems, adClientResponseItems: this.adClientResponseItems, searchResultsPage: this.searchResultsPage, searchResultsPerPage: this.searchResultsPerPage })))));
240
- }
241
- }
242
- render() {
243
- switch (this.type) {
244
- case 'inline':
245
- return this.renderInlinePopover();
246
- case 'modal':
247
- return this.renderModalPopover();
248
- case 'fullscreen':
249
- return this.renderFullscreenPopover();
250
- }
251
- }
252
- static get is() { return "searchcraft-popover-form"; }
253
- static get properties() {
254
- return {
255
- "config": {
256
- "type": "unknown",
257
- "mutable": false,
258
- "complexType": {
259
- "original": "SearchcraftConfig | undefined",
260
- "resolved": "SearchcraftConfig | undefined",
261
- "references": {
262
- "SearchcraftConfig": {
263
- "location": "import",
264
- "path": "@searchcraft/core",
265
- "id": "../core-sdk/dist/index.d.ts::SearchcraftConfig"
266
- }
267
- }
268
- },
269
- "required": false,
270
- "optional": false,
271
- "docs": {
272
- "tags": [],
273
- "text": "The Searchcraft config object."
274
- },
275
- "getter": false,
276
- "setter": false
277
- },
278
- "type": {
279
- "type": "string",
280
- "mutable": false,
281
- "complexType": {
282
- "original": "'inline' | 'fullscreen' | 'modal'",
283
- "resolved": "\"fullscreen\" | \"inline\" | \"modal\"",
284
- "references": {}
285
- },
286
- "required": false,
287
- "optional": false,
288
- "docs": {
289
- "tags": [],
290
- "text": "The type of popover form to render.\n\n- `inline` - Renders inline with the rest of the content on the page. The search results pop over the page content.\n- `fullscreen` - Renders in fullscreen view. Used together with the `searchcraft-popover-button` component.\n- `modal` - Renders in a modal view. Used together with the `searchcraft-popover-button` component."
291
- },
292
- "getter": false,
293
- "setter": false,
294
- "attribute": "type",
295
- "reflect": false,
296
- "defaultValue": "'inline'"
297
- },
298
- "popoverResultMappings": {
299
- "type": "unknown",
300
- "mutable": false,
301
- "complexType": {
302
- "original": "PopoverResultMappings | undefined",
303
- "resolved": "undefined | { title?: SearchResultMapping | undefined; subtitle?: SearchResultMapping | undefined; imageSource?: SearchResultMapping | undefined; imageAlt?: SearchResultMapping | undefined; href?: SearchResultMapping | undefined; }",
304
- "references": {
305
- "PopoverResultMappings": {
306
- "location": "import",
307
- "path": "@searchcraft/core",
308
- "id": "../core-sdk/dist/index.d.ts::PopoverResultMappings"
309
- }
310
- }
311
- },
312
- "required": false,
313
- "optional": false,
314
- "docs": {
315
- "tags": [],
316
- "text": "Formats the content rendered for each result."
317
- },
318
- "getter": false,
319
- "setter": false
320
- },
321
- "hotkey": {
322
- "type": "string",
323
- "mutable": false,
324
- "complexType": {
325
- "original": "string",
326
- "resolved": "string",
327
- "references": {}
328
- },
329
- "required": false,
330
- "optional": false,
331
- "docs": {
332
- "tags": [],
333
- "text": "The hotkey that activates the popover."
334
- },
335
- "getter": false,
336
- "setter": false,
337
- "attribute": "hotkey",
338
- "reflect": false,
339
- "defaultValue": "'k'"
340
- },
341
- "hotkeyModifier": {
342
- "type": "string",
343
- "mutable": false,
344
- "complexType": {
345
- "original": "'ctrl' | 'meta' | 'alt' | 'option'",
346
- "resolved": "\"alt\" | \"ctrl\" | \"meta\" | \"option\"",
347
- "references": {}
348
- },
349
- "required": false,
350
- "optional": false,
351
- "docs": {
352
- "tags": [],
353
- "text": "The hotkey modifier that activates the popover. Used together with the `hotkey` prop."
354
- },
355
- "getter": false,
356
- "setter": false,
357
- "attribute": "hotkey-modifier",
358
- "reflect": false,
359
- "defaultValue": "'meta'"
360
- }
361
- };
362
- }
363
- static get states() {
364
- return {
365
- "isPopoverVisibleInState": {},
366
- "unsubscribe": {},
367
- "searchClientResponseItems": {},
368
- "adClientResponseItems": {},
369
- "searchTerm": {},
370
- "isFocused": {},
371
- "breakpointSm": {},
372
- "breakpointMd": {},
373
- "breakpointLg": {},
374
- "searchResultsPage": {},
375
- "searchResultsPerPage": {},
376
- "modalElement": {}
377
- };
378
- }
379
- static get elementRef() { return "hostElement"; }
380
- }
381
- //# sourceMappingURL=searchcraft-popover-form.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"searchcraft-popover-form.js","sourceRoot":"","sources":["../../../../src/components/searchcraft-popover-form/searchcraft-popover-form.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,UAAU,MAAM,YAAY,CAAC;AAQpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAKH,MAAM,OAAO,sBAAsB;IACjC;;OAEG;IACK,MAAM,CAAgC;IAC9C;;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qBAAqB,EACjD,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,EACzC,oBAAoB,EAAE,IAAI,CAAC,oBAAoB,GAC/C,CACH,CACG,CACF,CACP,CAAC;QACJ,CAAC;IACH,CAAC;IAED,MAAM;QACJ,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;YAClB,KAAK,QAAQ;gBACX,OAAO,IAAI,CAAC,mBAAmB,EAAE,CAAC;YACpC,KAAK,OAAO;gBACV,OAAO,IAAI,CAAC,kBAAkB,EAAE,CAAC;YACnC,KAAK,YAAY;gBACf,OAAO,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAC1C,CAAC;IACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Prop, State, h } from '@stencil/core';\nimport classNames from 'classnames';\nimport type {\n SearchcraftConfig,\n SearchClientResponseItem,\n AdClientResponseItem,\n PopoverResultMappings,\n} from '@searchcraft/core';\n\nimport { useSearchcraftStore } from '@provider/store';\n\n/**\n * This web component is designed to display search results in a popover container that dynamically appears when the user interacts with a search input field, or when a popover-button is pressed.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-popover-form type=\"fullscreen\" />\n * ```\n *\n * ```js\n * // index.js\n * const popoverForm = document.querySelector('searchcraft-popover-form');\n *\n * popoverForm.config = {\n * index: [index_name_from_vektron],\n * readKey: 'read_key_from_vektron',\n * endpointUrl: 'enpoint_url_from_vektron',\n * };\n *\n * popoverForm.popoverResultMappings = {\n * containerHref: {\n * fieldNames: [\n * {\n * fieldName: 'canonical_link',\n * dataType: 'text',\n * },\n * ],\n * };\n * ```\n */\n@Component({\n tag: 'searchcraft-popover-form',\n shadow: false,\n})\nexport class SearchcraftPopoverForm {\n /**\n * The Searchcraft config object.\n */\n @Prop() config: SearchcraftConfig | undefined;\n /**\n * The type of popover form to render.\n *\n * - `inline` - Renders inline with the rest of the content on the page. The search results pop over the page content.\n * - `fullscreen` - Renders in fullscreen view. Used together with the `searchcraft-popover-button` component.\n * - `modal` - Renders in a modal view. Used together with the `searchcraft-popover-button` component.\n */\n @Prop() type: 'inline' | 'fullscreen' | 'modal' = 'inline';\n /**\n * Formats the content rendered for each result.\n */\n @Prop() popoverResultMappings: PopoverResultMappings | undefined;\n /**\n * The hotkey that activates the popover.\n */\n @Prop() hotkey = 'k';\n /**\n * The hotkey modifier that activates the popover. Used together with the `hotkey` prop.\n */\n @Prop() hotkeyModifier: 'ctrl' | 'meta' | 'alt' | 'option' = 'meta';\n\n @State() isPopoverVisibleInState = false;\n @State() unsubscribe: (() => void) | undefined;\n @State() searchClientResponseItems: SearchClientResponseItem[] = [];\n @State() adClientResponseItems: AdClientResponseItem[] = [];\n @State() searchTerm: string | undefined;\n @State() isFocused = false;\n @State() breakpointSm = 576;\n @State() breakpointMd = 768;\n @State() breakpointLg = 992;\n @State() searchResultsPage;\n @State() searchResultsPerPage;\n\n @State() modalElement;\n\n @Element() hostElement!: HTMLElement;\n\n componentDidLoad() {\n // Loads the breakpoint values into state\n const computedStyle = getComputedStyle(document.documentElement);\n this.breakpointSm = Number.parseFloat(\n computedStyle.getPropertyValue('--sc-breakpoint-sm').trim(),\n );\n this.breakpointMd = Number.parseFloat(\n computedStyle.getPropertyValue('--sc-breakpoint-md').trim(),\n );\n this.breakpointLg = Number.parseFloat(\n computedStyle.getPropertyValue('--sc-breakpoint-lg').trim(),\n );\n // Set popover visiblity in state\n this.isPopoverVisibleInState =\n useSearchcraftStore.getState().isPopoverVisible;\n\n // Add event listeners\n document.addEventListener('click', this.handleDocumentClick);\n document.addEventListener('keydown', this.handleDocumentKeyDown);\n\n // Subscribe to state events\n this.unsubscribe = useSearchcraftStore.subscribe((state) => {\n if (this.isPopoverVisibleInState !== state.isPopoverVisible) {\n this.handlePopoverVisibilityChange(state.isPopoverVisible);\n }\n\n this.searchClientResponseItems = [...state.searchClientResponseItems];\n this.adClientResponseItems = [...state.adClientResponseItems];\n this.searchTerm = state.searchTerm;\n this.searchResultsPage = state.searchResultsPage;\n this.searchResultsPerPage = state.searchResultsPerPage;\n });\n }\n\n disconnectedCallback() {\n this.unsubscribe?.();\n document.removeEventListener('click', this.handleDocumentClick);\n document.removeEventListener('keydown', this.handleDocumentKeyDown);\n }\n\n handleDocumentClick = (event: MouseEvent) => {\n if (!this.hostElement.contains(event.target as Node)) {\n this.isFocused = false;\n }\n };\n\n /**\n * Handles when popover visibility is changed in state\n */\n handlePopoverVisibilityChange(isVisible: boolean) {\n this.isPopoverVisibleInState = isVisible;\n document.body.style.overflow = isVisible ? 'hidden' : 'auto';\n }\n\n /**\n * Actions to perform when various keys are pressed within the popover form.\n */\n handleDocumentKeyDown = (event: KeyboardEvent) => {\n // Document-scoped actions\n if (event.key === this.hotkey) {\n this.handleHotkeyPressed(event);\n }\n\n // Document-scoped -> Popover-scoped keyboard event boundary\n if (!this.hostElement.contains(document.activeElement)) {\n return;\n }\n\n // Popover-scoped actions\n switch (event.key) {\n case 'ArrowDown':\n case 'ArrowUp':\n event.preventDefault();\n this.focusOnNextListItem(event.key);\n break;\n case 'Escape':\n useSearchcraftStore.getState().setPopoverVisibility(false);\n break;\n default:\n return;\n }\n };\n\n handleInputInit = () => {\n const input = this.hostElement.querySelector('.searchcraft-input') as\n | HTMLInputElement\n | undefined;\n input?.focus();\n };\n\n /**\n * When popover is `inline` and the viewport is at the smallest breakpoint,\n * focusing on the input will open a modal version of the popover form.\n */\n handleInputFocus() {\n this.isFocused = true;\n\n if (\n this.type === 'inline' &&\n window.visualViewport &&\n window.visualViewport.width < this.breakpointSm\n ) {\n useSearchcraftStore.getState().setPopoverVisibility(true);\n\n // Appends a popover form of type=`modal` to the body\n if (!this.modalElement) {\n this.modalElement = document.createElement('searchcraft-popover-form');\n this.modalElement.config = this.config;\n this.modalElement.popoverResultMappings = this.popoverResultMappings;\n this.modalElement.setAttribute('type', 'fullscreen');\n document.body.appendChild(this.modalElement);\n }\n }\n }\n\n handleModalBackdropClick(_event: MouseEvent) {\n useSearchcraftStore.getState().setPopoverVisibility(false);\n }\n\n /**\n * When a hotkey is pressed, tests if the modifiers also match.\n * If modifiers match, toggles visibility of the popover modal.\n */\n handleHotkeyPressed(event: KeyboardEvent) {\n if (\n (event.ctrlKey && this.hotkeyModifier === 'ctrl') ||\n (event.altKey && this.hotkeyModifier === 'alt') ||\n (event.metaKey && this.hotkeyModifier === 'meta')\n ) {\n event.preventDefault();\n if (this.type === 'inline' && !this.isPopoverVisibleInState) {\n const hostElementInput = this.hostElement.querySelector(\n '.searchcraft-input',\n ) as HTMLInputElement | undefined;\n hostElementInput?.focus();\n } else {\n useSearchcraftStore\n .getState()\n .setPopoverVisibility(!this.isPopoverVisibleInState);\n }\n }\n }\n\n handleCancelButtonClick() {\n useSearchcraftStore.getState().setPopoverVisibility(false);\n }\n\n /**\n * Moves focus to the next/previous list item in the list view. If you are at the top\n * of the list view, it moves focus back to the input.\n *\n * @param direction\n */\n focusOnNextListItem(direction: 'ArrowDown' | 'ArrowUp') {\n const listItems = Array.from(\n document.querySelectorAll<HTMLAnchorElement>(\n 'a.searchcraft-popover-list-item',\n ),\n ).filter((el) => !el.hasAttribute('disabled') && el.offsetParent !== null);\n\n const currentIndex = listItems.indexOf(\n document.activeElement as HTMLAnchorElement,\n );\n\n if (direction === 'ArrowDown') {\n listItems[(currentIndex + 1) % listItems.length]?.focus();\n } else if (direction === 'ArrowUp') {\n if (currentIndex >= 1) {\n listItems[currentIndex - 1]?.focus();\n } else {\n const input = document.querySelector('.searchcraft-input') as\n | HTMLInputElement\n | undefined;\n\n if (input) {\n input.focus();\n requestAnimationFrame(() => {\n input.selectionEnd = input.value.length;\n input.selectionStart = input.value.length;\n });\n }\n }\n }\n }\n\n get hasResultsToShow() {\n return (\n this.searchTerm &&\n this.searchTerm?.trim()?.length > 0 &&\n this.searchClientResponseItems.length > 0\n );\n }\n\n renderInlinePopover() {\n const isListViewVisible = this.hasResultsToShow && this.isFocused;\n\n const popoverFormClassNames = classNames(\n 'searchcraft-popover-form searchcraft-popover-form-inline',\n {\n 'searchcraft-popover-form-active': isListViewVisible,\n },\n );\n\n return (\n <div class={popoverFormClassNames}>\n <searchcraft-input-form\n config={this.config}\n onInputFocus={this.handleInputFocus.bind(this)}\n />\n {isListViewVisible && (\n <div class='searchcraft-popover-inline-wrapper-outer'>\n <div class='searchcraft-popover-inline-wrapper-inner'>\n <searchcraft-popover-list-view\n popoverResultMappings={this.popoverResultMappings}\n searchClientResponseItems={this.searchClientResponseItems}\n adClientResponseItems={this.adClientResponseItems}\n searchResultsPage={this.searchResultsPage}\n searchResultsPerPage={this.searchResultsPerPage}\n />\n </div>\n </div>\n )}\n </div>\n );\n }\n\n renderModalPopover() {\n if (this.isPopoverVisibleInState) {\n const popoverFormClassNames = classNames('searchcraft-popover-form', {\n 'searchcraft-popover-form-active': this.hasResultsToShow,\n });\n\n return (\n <div class='searchcraft-popover-form-modal'>\n {/* biome-ignore lint/a11y/useKeyWithClickEvents: <explanation> */}\n <div\n class='searchcraft-popover-form-modal-backdrop'\n onClick={this.handleModalBackdropClick}\n />\n <div class='searchcraft-popover-form-modal-inner'>\n <div class={popoverFormClassNames}>\n <div class='searchcraft-popover-form-input-wrapper'>\n <searchcraft-input-form\n config={this.config}\n onInputFocus={this.handleInputFocus.bind(this)}\n onInputInit={this.handleInputInit.bind(this)}\n />\n <button\n type='button'\n class='searchcraft-popover-form-cancel-button'\n onClick={this.handleCancelButtonClick.bind(this)}\n >\n Cancel\n </button>\n </div>\n {this.hasResultsToShow && (\n <searchcraft-popover-list-view\n popoverResultMappings={this.popoverResultMappings}\n searchClientResponseItems={this.searchClientResponseItems}\n adClientResponseItems={this.adClientResponseItems}\n searchResultsPage={this.searchResultsPage}\n searchResultsPerPage={this.searchResultsPerPage}\n />\n )}\n </div>\n </div>\n </div>\n );\n }\n }\n\n renderFullscreenPopover() {\n if (this.isPopoverVisibleInState) {\n return (\n <div class='searchcraft-popover-form-fullscreen'>\n <div class='searchcraft-popover-form'>\n <div class='searchcraft-popover-form-input-wrapper'>\n <searchcraft-input-form\n config={this.config}\n onInputFocus={this.handleInputFocus.bind(this)}\n onInputInit={this.handleInputInit.bind(this)}\n />\n <button\n type='button'\n class='searchcraft-popover-form-cancel-button'\n onClick={this.handleCancelButtonClick.bind(this)}\n >\n Cancel\n </button>\n </div>\n {this.hasResultsToShow && (\n <searchcraft-popover-list-view\n popoverResultMappings={this.popoverResultMappings}\n searchClientResponseItems={this.searchClientResponseItems}\n adClientResponseItems={this.adClientResponseItems}\n searchResultsPage={this.searchResultsPage}\n searchResultsPerPage={this.searchResultsPerPage}\n />\n )}\n </div>\n </div>\n );\n }\n }\n\n render() {\n switch (this.type) {\n case 'inline':\n return this.renderInlinePopover();\n case 'modal':\n return this.renderModalPopover();\n case 'fullscreen':\n return this.renderFullscreenPopover();\n }\n }\n}\n"]}