@searchcraft/javascript-sdk 0.2.3 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +7 -0
  2. package/dist/cjs/app-globals-3a1e7e63.js.map +1 -0
  3. package/dist/cjs/index-5b0b9d4c.js +84 -0
  4. package/dist/cjs/index-5b0b9d4c.js.map +1 -0
  5. package/dist/cjs/index-6c5282a0.js +1279 -0
  6. package/dist/cjs/index-6c5282a0.js.map +1 -0
  7. package/dist/cjs/index.cjs.js +17 -0
  8. package/dist/cjs/index.cjs.js.map +1 -0
  9. package/dist/cjs/loader.cjs.js +17 -0
  10. package/dist/cjs/loader.cjs.js.map +1 -0
  11. package/dist/cjs/searchcraft-auto-search-form_17.cjs.entry.js +809 -0
  12. package/dist/cjs/searchcraft-auto-search-form_17.cjs.entry.js.map +1 -0
  13. package/dist/cjs/searchcraft-base-search-form.cjs.entry.js +64 -0
  14. package/dist/cjs/searchcraft-base-search-form.cjs.entry.js.map +1 -0
  15. package/dist/cjs/searchcraft-button-icon.cjs.entry.js +18 -0
  16. package/dist/cjs/searchcraft-button-icon.cjs.entry.js.map +1 -0
  17. package/dist/cjs/searchcraft-button.cjs.entry.js +37 -0
  18. package/dist/cjs/searchcraft-button.cjs.entry.js.map +1 -0
  19. package/dist/cjs/searchcraft-javascript-sdk.cjs.js +27 -0
  20. package/dist/cjs/searchcraft-javascript-sdk.cjs.js.map +1 -0
  21. package/dist/cjs/store-c44c58ab.js +314 -0
  22. package/dist/cjs/store-c44c58ab.js.map +1 -0
  23. package/dist/{searchcraft-javascript-sdk/utils-6d98c145.js → cjs/utils-2dc6115c.js} +22 -5
  24. package/dist/cjs/utils-2dc6115c.js.map +1 -0
  25. package/dist/collection/assets/searchcraft-button-icons.js +9 -0
  26. package/dist/collection/assets/searchcraft-button-icons.js.map +1 -0
  27. package/dist/collection/assets/searchcraft-clear-icon-set.js +45 -0
  28. package/dist/collection/assets/searchcraft-clear-icon-set.js.map +1 -0
  29. package/dist/collection/assets/searchcraft-search-icon-set.js +84 -0
  30. package/dist/collection/assets/searchcraft-search-icon-set.js.map +1 -0
  31. package/dist/collection/collection-manifest.json +31 -0
  32. package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.js +365 -0
  33. package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.js.map +1 -0
  34. package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.module.css +15 -0
  35. package/dist/collection/components/searchcraft-base-search-form/searchcraft-base-search-form.js +168 -0
  36. package/dist/collection/components/searchcraft-base-search-form/searchcraft-base-search-form.js.map +1 -0
  37. package/dist/collection/components/searchcraft-base-search-form/searchcraft-base-search-form.module.css +18 -0
  38. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js +329 -0
  39. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js.map +1 -0
  40. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.module.css +214 -0
  41. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js +270 -0
  42. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js.map +1 -0
  43. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.module.css +47 -0
  44. package/dist/collection/components/searchcraft-button/searchcraft-button.js +137 -0
  45. package/dist/collection/components/searchcraft-button/searchcraft-button.js.map +1 -0
  46. package/dist/collection/components/searchcraft-button/searchcraft-button.module.css +82 -0
  47. package/dist/collection/components/searchcraft-clear-input-button/searchcraft-clear-input-button.js +95 -0
  48. package/dist/collection/components/searchcraft-clear-input-button/searchcraft-clear-input-button.js.map +1 -0
  49. package/dist/collection/components/searchcraft-clear-input-button/searchcraft-clear-input-button.module.css +33 -0
  50. package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js +64 -0
  51. package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js.map +1 -0
  52. package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.module.css +21 -0
  53. package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.js +170 -0
  54. package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.js.map +1 -0
  55. package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.module.css +70 -0
  56. package/dist/collection/components/searchcraft-input/searchcraft-input.js +352 -0
  57. package/dist/collection/components/searchcraft-input/searchcraft-input.js.map +1 -0
  58. package/dist/collection/components/searchcraft-input/searchcraft-input.module.css +241 -0
  59. package/dist/collection/components/searchcraft-input-caption/searchcraft-input-caption.js +122 -0
  60. package/dist/collection/components/searchcraft-input-caption/searchcraft-input-caption.js.map +1 -0
  61. package/dist/collection/components/searchcraft-input-caption/searchcraft-input-caption.module.css +79 -0
  62. package/dist/collection/components/searchcraft-input-icon/searchcraft-input-icon.js +109 -0
  63. package/dist/collection/components/searchcraft-input-icon/searchcraft-input-icon.js.map +1 -0
  64. package/dist/collection/components/searchcraft-input-icon/searchcraft-input-icon.module.css +17 -0
  65. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js +76 -0
  66. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js.map +1 -0
  67. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.module.css +21 -0
  68. package/dist/{searchcraft-javascript-sdk/searchcraft-results-info.entry.js → collection/components/searchcraft-results-info/searchcraft-results-info.js} +26 -15
  69. package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.js.map +1 -0
  70. package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.module.css +15 -0
  71. package/dist/collection/components/searchcraft-slider/searchcraft-slider.js +128 -0
  72. package/dist/collection/components/searchcraft-slider/searchcraft-slider.js.map +1 -0
  73. package/dist/collection/components/searchcraft-slider/searchcraft-slider.module.css +68 -0
  74. package/dist/collection/components/searchcraft-spinner-dark/searchcraft-spinner-dark.js +19 -0
  75. package/dist/collection/components/searchcraft-spinner-dark/searchcraft-spinner-dark.js.map +1 -0
  76. package/dist/collection/components/searchcraft-spinner-dark/searchcraft-spinner-dark.module.css +35 -0
  77. package/dist/collection/components/searchcraft-spinner-light/searchcraft-spinner-light.js +19 -0
  78. package/dist/collection/components/searchcraft-spinner-light/searchcraft-spinner-light.js.map +1 -0
  79. package/dist/collection/components/searchcraft-spinner-light/searchcraft-spinner-light.module.css +26 -0
  80. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js +92 -0
  81. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js.map +1 -0
  82. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.module.css +31 -0
  83. package/dist/collection/index.js +12 -0
  84. package/dist/collection/index.js.map +1 -0
  85. package/dist/collection/provider/store.js +96 -0
  86. package/dist/collection/provider/store.js.map +1 -0
  87. package/dist/collection/utils/utils.js +74 -0
  88. package/dist/collection/utils/utils.js.map +1 -0
  89. package/dist/components/index.js +58 -0
  90. package/dist/components/index.js.map +1 -0
  91. package/dist/components/p-157e5b1a.js +310 -0
  92. package/dist/components/p-157e5b1a.js.map +1 -0
  93. package/dist/components/p-1c377190.js +67 -0
  94. package/dist/components/p-1c377190.js.map +1 -0
  95. package/dist/components/p-25f18f2e.js +33 -0
  96. package/dist/components/p-25f18f2e.js.map +1 -0
  97. package/dist/{searchcraft-javascript-sdk/utils-dbb6302b.js → components/p-2bda632c.js} +13 -2
  98. package/dist/components/p-2bda632c.js.map +1 -0
  99. package/dist/components/p-3fece4e2.js +33 -0
  100. package/dist/components/p-3fece4e2.js.map +1 -0
  101. package/dist/components/p-576f0d2b.js +61 -0
  102. package/dist/components/p-576f0d2b.js.map +1 -0
  103. package/dist/{searchcraft-javascript-sdk/index-d6567b9c.js → components/p-5cdc6210.js} +2 -10
  104. package/dist/components/p-5cdc6210.js.map +1 -0
  105. package/dist/{searchcraft-javascript-sdk/searchcraft-input-caption.entry.js → components/p-6237f03e.js} +31 -10
  106. package/dist/components/p-6237f03e.js.map +1 -0
  107. package/dist/{searchcraft-javascript-sdk/searchcraft-clear-icon-set.entry.js → components/p-70722ab2.js} +24 -7
  108. package/dist/components/p-70722ab2.js.map +1 -0
  109. package/dist/components/p-7498e493.js +1113 -0
  110. package/dist/components/p-7498e493.js.map +1 -0
  111. package/dist/components/p-848301b7.js +40 -0
  112. package/dist/components/p-848301b7.js.map +1 -0
  113. package/dist/components/p-8c38185e.js +53 -0
  114. package/dist/components/p-8c38185e.js.map +1 -0
  115. package/dist/{searchcraft-javascript-sdk/searchcraft-search-icon-set.entry.js → components/p-a3bd1bc8.js} +26 -7
  116. package/dist/components/p-a3bd1bc8.js.map +1 -0
  117. package/dist/components/p-ae84b899.js +48 -0
  118. package/dist/components/p-ae84b899.js.map +1 -0
  119. package/dist/{searchcraft-javascript-sdk/searchcraft-input.entry.js → components/p-b5f97e04.js} +83 -12
  120. package/dist/components/p-b5f97e04.js.map +1 -0
  121. package/dist/components/p-bdf281cc.js +89 -0
  122. package/dist/components/p-bdf281cc.js.map +1 -0
  123. package/dist/components/searchcraft-auto-search-form.js +207 -0
  124. package/dist/components/searchcraft-auto-search-form.js.map +1 -0
  125. package/dist/components/searchcraft-base-search-form.js +152 -0
  126. package/dist/components/searchcraft-base-search-form.js.map +1 -0
  127. package/dist/components/searchcraft-base-search-result.js +8 -0
  128. package/dist/components/searchcraft-base-search-result.js.map +1 -0
  129. package/dist/{searchcraft-javascript-sdk/searchcraft-base-search-results.entry.js → components/searchcraft-base-search-results.js} +55 -12
  130. package/dist/components/searchcraft-base-search-results.js.map +1 -0
  131. package/dist/components/searchcraft-button-icon.js +32 -0
  132. package/dist/components/searchcraft-button-icon.js.map +1 -0
  133. package/dist/components/searchcraft-button.js +8 -0
  134. package/dist/components/searchcraft-button.js.map +1 -0
  135. package/dist/components/searchcraft-clear-icon-set.js +8 -0
  136. package/dist/components/searchcraft-clear-icon-set.js.map +1 -0
  137. package/dist/components/searchcraft-clear-input-button.js +8 -0
  138. package/dist/components/searchcraft-clear-input-button.js.map +1 -0
  139. package/dist/components/searchcraft-error-message.js +8 -0
  140. package/dist/components/searchcraft-error-message.js.map +1 -0
  141. package/dist/components/searchcraft-filters-list.js +141 -0
  142. package/dist/components/searchcraft-filters-list.js.map +1 -0
  143. package/dist/components/searchcraft-input-caption.js +8 -0
  144. package/dist/components/searchcraft-input-caption.js.map +1 -0
  145. package/dist/components/searchcraft-input-icon.js +8 -0
  146. package/dist/components/searchcraft-input-icon.js.map +1 -0
  147. package/dist/components/searchcraft-input-label.js +8 -0
  148. package/dist/components/searchcraft-input-label.js.map +1 -0
  149. package/dist/components/searchcraft-input.js +8 -0
  150. package/dist/components/searchcraft-input.js.map +1 -0
  151. package/dist/components/searchcraft-results-info.js +63 -0
  152. package/dist/components/searchcraft-results-info.js.map +1 -0
  153. package/dist/components/searchcraft-search-icon-set.js +8 -0
  154. package/dist/components/searchcraft-search-icon-set.js.map +1 -0
  155. package/dist/{searchcraft-javascript-sdk/searchcraft-slider.entry.js → components/searchcraft-slider.js} +36 -10
  156. package/dist/components/searchcraft-slider.js.map +1 -0
  157. package/dist/components/searchcraft-spinner-dark.js +8 -0
  158. package/dist/components/searchcraft-spinner-dark.js.map +1 -0
  159. package/dist/components/searchcraft-spinner-light.js +8 -0
  160. package/dist/components/searchcraft-spinner-light.js.map +1 -0
  161. package/dist/{searchcraft-javascript-sdk/searchcraft-toggle-button.entry.js → components/searchcraft-toggle-button.js} +33 -10
  162. package/dist/components/searchcraft-toggle-button.js.map +1 -0
  163. package/dist/esm/index-0ac5bb53.js +1251 -0
  164. package/dist/esm/index-0ac5bb53.js.map +1 -0
  165. package/dist/esm/index-72ac5051.js +82 -0
  166. package/dist/esm/index-72ac5051.js.map +1 -0
  167. package/dist/esm/index.js +4 -0
  168. package/dist/esm/index.js.map +1 -0
  169. package/dist/esm/loader.js +13 -0
  170. package/dist/esm/loader.js.map +1 -0
  171. package/dist/esm/searchcraft-auto-search-form_17.entry.js +789 -0
  172. package/dist/esm/searchcraft-auto-search-form_17.entry.js.map +1 -0
  173. package/dist/{searchcraft-javascript-sdk → esm}/searchcraft-base-search-form.entry.js +5 -5
  174. package/dist/esm/searchcraft-base-search-form.entry.js.map +1 -0
  175. package/dist/{searchcraft-javascript-sdk → esm}/searchcraft-button-icon.entry.js +1 -1
  176. package/dist/esm/searchcraft-button-icon.entry.js.map +1 -0
  177. package/dist/{searchcraft-javascript-sdk → esm}/searchcraft-button.entry.js +4 -4
  178. package/dist/esm/searchcraft-button.entry.js.map +1 -0
  179. package/dist/esm/searchcraft-javascript-sdk.js +22 -0
  180. package/dist/esm/searchcraft-javascript-sdk.js.map +1 -0
  181. package/dist/esm/store-9e0b0710.js +310 -0
  182. package/dist/esm/store-9e0b0710.js.map +1 -0
  183. package/dist/{searchcraft-javascript-sdk/utils-d88ac15c.js → esm/utils-a3373179.js} +14 -3
  184. package/dist/esm/utils-a3373179.js.map +1 -0
  185. package/dist/index.cjs.js +1 -0
  186. package/dist/index.js +1 -0
  187. package/dist/loader/cdn.js +1 -0
  188. package/dist/loader/index.cjs.js +1 -0
  189. package/dist/loader/index.d.ts +24 -0
  190. package/dist/loader/index.es2017.js +1 -0
  191. package/dist/loader/index.js +2 -0
  192. package/dist/loader/package.json +11 -0
  193. package/dist/searchcraft-javascript-sdk/index.esm.js +1 -14
  194. package/dist/searchcraft-javascript-sdk/index.esm.js.map +1 -1
  195. package/dist/searchcraft-javascript-sdk/p-0880cfbb.js +3 -0
  196. package/dist/searchcraft-javascript-sdk/p-0880cfbb.js.map +1 -0
  197. package/dist/searchcraft-javascript-sdk/p-2bda632c.js +2 -0
  198. package/dist/searchcraft-javascript-sdk/p-2bda632c.js.map +1 -0
  199. package/dist/searchcraft-javascript-sdk/p-5cdc6210.js +7 -0
  200. package/dist/searchcraft-javascript-sdk/p-5cdc6210.js.map +1 -0
  201. package/dist/searchcraft-javascript-sdk/p-5ec960bd.entry.js +2 -0
  202. package/dist/searchcraft-javascript-sdk/p-5ec960bd.entry.js.map +1 -0
  203. package/dist/searchcraft-javascript-sdk/p-63b3b565.entry.js +2 -0
  204. package/dist/searchcraft-javascript-sdk/p-63b3b565.entry.js.map +1 -0
  205. package/dist/searchcraft-javascript-sdk/p-901fee50.js +11 -0
  206. package/dist/searchcraft-javascript-sdk/p-901fee50.js.map +1 -0
  207. package/dist/searchcraft-javascript-sdk/p-cc454542.entry.js +2 -0
  208. package/dist/searchcraft-javascript-sdk/p-cc454542.entry.js.map +1 -0
  209. package/dist/searchcraft-javascript-sdk/p-cc9a02ef.entry.js +2 -0
  210. package/dist/searchcraft-javascript-sdk/p-cc9a02ef.entry.js.map +1 -0
  211. package/dist/searchcraft-javascript-sdk/p-e1255160.js +2 -0
  212. package/dist/searchcraft-javascript-sdk/p-e1255160.js.map +1 -0
  213. package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js +1 -48
  214. package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js.map +1 -1
  215. package/dist/types/components/searchcraft-base-search-result/searchcraft-base-search-result.d.ts +1 -0
  216. package/dist/types/components/searchcraft-base-search-results/searchcraft-base-search-results.d.ts +1 -0
  217. package/dist/types/components/searchcraft-filters-list/searchcraft-filters-list.d.ts +1 -5
  218. package/dist/types/components.d.ts +4 -0
  219. package/dist/types/utils/utils.d.ts +11 -0
  220. package/package.json +1 -1
  221. package/dist/searchcraft-javascript-sdk/_commonjsHelpers-63cbe26c.js +0 -34
  222. package/dist/searchcraft-javascript-sdk/_commonjsHelpers-63cbe26c.js.map +0 -1
  223. package/dist/searchcraft-javascript-sdk/index-8211f330.js +0 -3043
  224. package/dist/searchcraft-javascript-sdk/index-8211f330.js.map +0 -1
  225. package/dist/searchcraft-javascript-sdk/index-d6567b9c.js.map +0 -1
  226. package/dist/searchcraft-javascript-sdk/searchcraft-auto-search-form.entry.js +0 -113
  227. package/dist/searchcraft-javascript-sdk/searchcraft-auto-search-form.entry.js.map +0 -1
  228. package/dist/searchcraft-javascript-sdk/searchcraft-base-search-form.entry.js.map +0 -1
  229. package/dist/searchcraft-javascript-sdk/searchcraft-base-search-result.entry.js +0 -57
  230. package/dist/searchcraft-javascript-sdk/searchcraft-base-search-result.entry.js.map +0 -1
  231. package/dist/searchcraft-javascript-sdk/searchcraft-base-search-results.entry.js.map +0 -1
  232. package/dist/searchcraft-javascript-sdk/searchcraft-button-icon.entry.js.map +0 -1
  233. package/dist/searchcraft-javascript-sdk/searchcraft-button.entry.js.map +0 -1
  234. package/dist/searchcraft-javascript-sdk/searchcraft-clear-icon-set.entry.js.map +0 -1
  235. package/dist/searchcraft-javascript-sdk/searchcraft-clear-input-button.entry.js +0 -30
  236. package/dist/searchcraft-javascript-sdk/searchcraft-clear-input-button.entry.js.map +0 -1
  237. package/dist/searchcraft-javascript-sdk/searchcraft-error-message.entry.js +0 -22
  238. package/dist/searchcraft-javascript-sdk/searchcraft-error-message.entry.js.map +0 -1
  239. package/dist/searchcraft-javascript-sdk/searchcraft-filters-list.entry.js +0 -99
  240. package/dist/searchcraft-javascript-sdk/searchcraft-filters-list.entry.js.map +0 -1
  241. package/dist/searchcraft-javascript-sdk/searchcraft-input-caption.entry.js.map +0 -1
  242. package/dist/searchcraft-javascript-sdk/searchcraft-input-icon.entry.js +0 -25
  243. package/dist/searchcraft-javascript-sdk/searchcraft-input-icon.entry.js.map +0 -1
  244. package/dist/searchcraft-javascript-sdk/searchcraft-input-label.entry.js +0 -29
  245. package/dist/searchcraft-javascript-sdk/searchcraft-input-label.entry.js.map +0 -1
  246. package/dist/searchcraft-javascript-sdk/searchcraft-input.entry.js.map +0 -1
  247. package/dist/searchcraft-javascript-sdk/searchcraft-results-info.entry.js.map +0 -1
  248. package/dist/searchcraft-javascript-sdk/searchcraft-search-icon-set.entry.js.map +0 -1
  249. package/dist/searchcraft-javascript-sdk/searchcraft-slider.entry.js.map +0 -1
  250. package/dist/searchcraft-javascript-sdk/searchcraft-spinner-dark.entry.js +0 -17
  251. package/dist/searchcraft-javascript-sdk/searchcraft-spinner-dark.entry.js.map +0 -1
  252. package/dist/searchcraft-javascript-sdk/searchcraft-spinner-light.entry.js +0 -17
  253. package/dist/searchcraft-javascript-sdk/searchcraft-spinner-light.entry.js.map +0 -1
  254. package/dist/searchcraft-javascript-sdk/searchcraft-toggle-button.entry.js.map +0 -1
  255. package/dist/searchcraft-javascript-sdk/shadow-css-423dab2c.js +0 -334
  256. package/dist/searchcraft-javascript-sdk/shadow-css-423dab2c.js.map +0 -1
  257. package/dist/searchcraft-javascript-sdk/store-0451a982.js +0 -3070
  258. package/dist/searchcraft-javascript-sdk/store-0451a982.js.map +0 -1
  259. package/dist/searchcraft-javascript-sdk/store-18b7e3ea.js +0 -3071
  260. package/dist/searchcraft-javascript-sdk/store-18b7e3ea.js.map +0 -1
  261. package/dist/searchcraft-javascript-sdk/store-910b9836.js +0 -3071
  262. package/dist/searchcraft-javascript-sdk/store-910b9836.js.map +0 -1
  263. package/dist/searchcraft-javascript-sdk/store-935525f8.js +0 -3071
  264. package/dist/searchcraft-javascript-sdk/store-935525f8.js.map +0 -1
  265. package/dist/searchcraft-javascript-sdk/utils-6d98c145.js.map +0 -1
  266. package/dist/searchcraft-javascript-sdk/utils-d88ac15c.js.map +0 -1
  267. package/dist/searchcraft-javascript-sdk/utils-dbb6302b.js.map +0 -1
  268. /package/dist/{searchcraft-javascript-sdk → esm}/app-globals-0f993ce5.js +0 -0
  269. /package/dist/{searchcraft-javascript-sdk → esm}/app-globals-0f993ce5.js.map +0 -0
@@ -0,0 +1,214 @@
1
+ @charset "UTF-8";
2
+ :root {
3
+ --font-stack: Helvetica, Arial, sans-serif;
4
+ }
5
+
6
+ .interactiveResultContainerLight {
7
+ align-items: flex-start;
8
+ border-radius: 16px;
9
+ display: flex;
10
+ flex-direction: column;
11
+ gap: 16px;
12
+ padding: 8px;
13
+ position: relative;
14
+ background-color: #FAFAFA;
15
+ }
16
+ @media (min-width: 600px) {
17
+ .interactiveResultContainerLight {
18
+ flex-direction: row;
19
+ }
20
+ }
21
+
22
+ .interactiveResultContainerDark {
23
+ align-items: flex-start;
24
+ border-radius: 16px;
25
+ display: flex;
26
+ flex-direction: column;
27
+ gap: 16px;
28
+ padding: 8px;
29
+ position: relative;
30
+ background-color: #2E2E2E;
31
+ }
32
+ @media (min-width: 600px) {
33
+ .interactiveResultContainerDark {
34
+ flex-direction: row;
35
+ }
36
+ }
37
+
38
+ .resultContainer {
39
+ align-items: flex-start;
40
+ display: flex;
41
+ flex-direction: column;
42
+ gap: 16px;
43
+ }
44
+ @media (min-width: 600px) {
45
+ .resultContainer {
46
+ flex-direction: row;
47
+ }
48
+ }
49
+
50
+ .interactiveIconLarge {
51
+ display: inline-block;
52
+ position: absolute;
53
+ right: 5px;
54
+ top: 8px;
55
+ }
56
+ @media (max-width: 600px) {
57
+ .interactiveIconLarge {
58
+ display: none;
59
+ }
60
+ }
61
+
62
+ .interactiveIconSmall {
63
+ display: inline-block;
64
+ position: absolute;
65
+ right: 5px;
66
+ top: -2px;
67
+ }
68
+ @media (min-width: 600px) {
69
+ .interactiveIconSmall {
70
+ display: none;
71
+ }
72
+ }
73
+
74
+ .imageContainer {
75
+ max-width: 100%;
76
+ }
77
+
78
+ .contentContainer {
79
+ max-height: 100%;
80
+ max-width: 100%;
81
+ }
82
+ @media (min-width: 600px) {
83
+ .contentContainer {
84
+ max-width: 50%;
85
+ }
86
+ }
87
+
88
+ .secondaryContentContainer {
89
+ display: flex;
90
+ }
91
+
92
+ .imageLight {
93
+ border-radius: 8px;
94
+ max-height: 100%;
95
+ max-width: 100%;
96
+ border: 1px solid #D9D9D9;
97
+ }
98
+
99
+ .imageDark {
100
+ border-radius: 8px;
101
+ max-height: 100%;
102
+ max-width: 100%;
103
+ border: 1px solid #333;
104
+ }
105
+
106
+ .headingLight {
107
+ font-family: var(--font-stack);
108
+ font-size: 16px;
109
+ font-weight: 700;
110
+ line-height: 20px;
111
+ margin-bottom: 4px;
112
+ margin-top: 0;
113
+ position: relative;
114
+ color: #292929;
115
+ }
116
+
117
+ .headingDark {
118
+ font-family: var(--font-stack);
119
+ font-size: 16px;
120
+ font-weight: 700;
121
+ line-height: 20px;
122
+ margin-bottom: 4px;
123
+ margin-top: 0;
124
+ position: relative;
125
+ color: #FFF;
126
+ }
127
+
128
+ .subheadingLight {
129
+ font-family: var(--font-stack);
130
+ font-size: 12px;
131
+ font-weight: 400;
132
+ line-height: 16px;
133
+ margin-bottom: 4px;
134
+ margin-top: 0px;
135
+ color: #737373;
136
+ }
137
+
138
+ .subheadingDark {
139
+ font-family: var(--font-stack);
140
+ font-size: 12px;
141
+ font-weight: 400;
142
+ line-height: 16px;
143
+ margin-bottom: 4px;
144
+ margin-top: 0px;
145
+ color: #BFBFBF;
146
+ }
147
+
148
+ .primaryContentLight {
149
+ font-family: var(--font-stack);
150
+ font-size: 16px;
151
+ font-weight: 400;
152
+ line-height: 20px;
153
+ margin-bottom: 4px;
154
+ margin-top: 0px;
155
+ color: #404040;
156
+ }
157
+
158
+ .primaryContentDark {
159
+ font-family: var(--font-stack);
160
+ font-size: 16px;
161
+ font-weight: 400;
162
+ line-height: 20px;
163
+ margin-bottom: 4px;
164
+ margin-top: 0px;
165
+ color: #E6E6E6;
166
+ }
167
+
168
+ .secondaryContentLight {
169
+ font-family: var(--font-stack);
170
+ font-size: 16px;
171
+ font-weight: 400;
172
+ line-height: 20px;
173
+ margin-bottom: 4px;
174
+ margin-top: 0px;
175
+ color: #404040;
176
+ }
177
+
178
+ .secondaryContentLight::after {
179
+ content: "•";
180
+ color: #404040;
181
+ font-size: 1em;
182
+ margin-left: 5px;
183
+ margin-right: 5px;
184
+ }
185
+
186
+ .secondaryContentDark {
187
+ font-family: var(--font-stack);
188
+ font-size: 16px;
189
+ font-weight: 400;
190
+ line-height: 20px;
191
+ margin-bottom: 4px;
192
+ margin-top: 0px;
193
+ color: #E6E6E6;
194
+ }
195
+
196
+ .tertiaryContentLight {
197
+ font-family: var(--font-stack);
198
+ font-size: 16px;
199
+ font-weight: 400;
200
+ line-height: 20px;
201
+ margin-bottom: 4px;
202
+ margin-top: 0px;
203
+ color: #404040;
204
+ }
205
+
206
+ .tertiaryContentDark {
207
+ font-family: var(--font-stack);
208
+ font-size: 16px;
209
+ font-weight: 400;
210
+ line-height: 20px;
211
+ margin-bottom: 4px;
212
+ margin-top: 0px;
213
+ color: #E6E6E6;
214
+ }
@@ -0,0 +1,270 @@
1
+ import { h } from "@stencil/core";
2
+ import { useSearchcraftStore } from "../../provider/store";
3
+ import { extractDynamicProperties, getFormattedTimeFromNow, parseSearchKeys, serializeStyles, } from "../../utils/utils";
4
+ export class SearchcraftBaseSearchResults {
5
+ constructor() {
6
+ this.adInterval = 4;
7
+ this.customStylesForResults = {};
8
+ this.documentAttributesForDisplay = '';
9
+ this.fallbackElement = null;
10
+ this.formatTime = true;
11
+ this.placeAdAtEnd = false;
12
+ this.placeAdAtStart = true;
13
+ this.placeResultImageRight = false;
14
+ this.hasSearched = false;
15
+ this.query = '';
16
+ this.searchResults = null;
17
+ }
18
+ componentDidLoad() {
19
+ if (!this.documentAttributesForDisplay ||
20
+ this.documentAttributesForDisplay.length === 0) {
21
+ console.warn('No document attributes provided; using empty keys array.');
22
+ this.documentAttributesForDisplay = '';
23
+ }
24
+ this.unsubscribe = useSearchcraftStore.subscribe((state) => {
25
+ if (state.query.length > 0) {
26
+ this.hasSearched = true;
27
+ }
28
+ else {
29
+ this.hasSearched = false;
30
+ }
31
+ this.searchResults = Object.assign({}, state.searchResults);
32
+ this.query = state.query;
33
+ });
34
+ const { searchResults, query } = useSearchcraftStore.getState();
35
+ this.searchResults = searchResults;
36
+ this.query = query;
37
+ }
38
+ disconnectedCallback() {
39
+ if (this.unsubscribe) {
40
+ this.unsubscribe();
41
+ }
42
+ }
43
+ render() {
44
+ var _a, _b, _c, _d, _e, _f, _g;
45
+ if (!this.hasSearched) {
46
+ return (h("div", { class: 'emptyState' }, h("slot", { name: 'empty-search' })));
47
+ }
48
+ if (!((_a = this.searchResults) === null || _a === void 0 ? void 0 : _a.data)) {
49
+ console.warn('No search results data available');
50
+ return h("div", { class: 'emptyState' }, "No results to display.");
51
+ }
52
+ const parsedSearchKeys = parseSearchKeys(this.documentAttributesForDisplay);
53
+ const serializedStyles = typeof this.customStylesForResults === 'string'
54
+ ? this.customStylesForResults
55
+ : serializeStyles(this.customStylesForResults);
56
+ const resultsComponents = (_d = (_c = (_b = this.searchResults) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.hits) === null || _d === void 0 ? void 0 : _d.map((document, index) => {
57
+ const { doc: result } = document;
58
+ const dynamicProperties = extractDynamicProperties(result, parsedSearchKeys);
59
+ if (this.formatTime) {
60
+ for (const key of parsedSearchKeys) {
61
+ if (dynamicProperties[key]) {
62
+ const value = dynamicProperties[key];
63
+ // Check if the value is a valid ISO timestamp
64
+ if (typeof value === 'string' &&
65
+ !Number.isNaN(Date.parse(value))) {
66
+ dynamicProperties[key] = getFormattedTimeFromNow(value);
67
+ }
68
+ }
69
+ }
70
+ }
71
+ return (h("searchcraft-base-search-result", { "button-callback": () => console.log('button callback'), "custom-styles": serializedStyles, "image-source": dynamicProperties[parsedSearchKeys[parsedSearchKeys.length - 1]], "is-interactive": true, key: `${document.document_id}-${index}`, "keydown-callback": () => console.log('keydown'), "heading-text": dynamicProperties[parsedSearchKeys[0]], "place-image-right": this.placeResultImageRight, "primary-content": dynamicProperties[parsedSearchKeys[2]], "result-callback": () => console.log('interactive element'), "secondary-content": dynamicProperties[parsedSearchKeys[3]], "subheading-text": dynamicProperties[parsedSearchKeys[1]], "tertiary-content": dynamicProperties[parsedSearchKeys[4]] }));
72
+ });
73
+ const finalComponents = [];
74
+ if (this.placeAdAtStart) {
75
+ finalComponents.push(h("div", { key: 'ad-section-start', class: 'adSection' }, h("span", null, "##"), h("p", null, " Ad Impressions")));
76
+ }
77
+ if (this.adInterval > 0) {
78
+ resultsComponents.forEach((component, index) => {
79
+ finalComponents.push(component);
80
+ if ((index + 1) % this.adInterval === 0) {
81
+ finalComponents.push(h("div", { key: `ad-section-${index + 1}`, class: 'adSection' }, h("span", null, "##"), h("p", null, " Ad Impressions")));
82
+ }
83
+ });
84
+ }
85
+ else {
86
+ finalComponents.push(...resultsComponents);
87
+ }
88
+ if (this.placeAdAtEnd) {
89
+ finalComponents.push(h("div", { key: 'ad-section-end', class: 'adSection' }, h("span", null, "##"), h("p", null, " Ad Impressions")));
90
+ }
91
+ return (h("div", { class: 'resultsContainer' }, finalComponents, this.query.length > 0 &&
92
+ ((_g = (_f = (_e = this.searchResults) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f.hits) === null || _g === void 0 ? void 0 : _g.length) === 0 && (h("div", { class: 'errorMessageContainer' }, h("searchcraft-error-message", { "error-message": `No search results found for "${this.query}" query` })))));
93
+ }
94
+ static get is() { return "searchcraft-base-search-results"; }
95
+ static get encapsulation() { return "shadow"; }
96
+ static get originalStyleUrls() {
97
+ return {
98
+ "$": ["searchcraft-base-search-results.module.scss"]
99
+ };
100
+ }
101
+ static get styleUrls() {
102
+ return {
103
+ "$": ["searchcraft-base-search-results.module.css"]
104
+ };
105
+ }
106
+ static get properties() {
107
+ return {
108
+ "adInterval": {
109
+ "type": "number",
110
+ "mutable": false,
111
+ "complexType": {
112
+ "original": "number",
113
+ "resolved": "number",
114
+ "references": {}
115
+ },
116
+ "required": false,
117
+ "optional": false,
118
+ "docs": {
119
+ "tags": [],
120
+ "text": ""
121
+ },
122
+ "attribute": "ad-interval",
123
+ "reflect": false,
124
+ "defaultValue": "4"
125
+ },
126
+ "customStylesForResults": {
127
+ "type": "string",
128
+ "mutable": false,
129
+ "complexType": {
130
+ "original": "| string\n | Record<string, Record<string, string>>",
131
+ "resolved": "string | { [x: string]: Record<string, string>; }",
132
+ "references": {
133
+ "Record": {
134
+ "location": "global",
135
+ "id": "global::Record"
136
+ }
137
+ }
138
+ },
139
+ "required": false,
140
+ "optional": false,
141
+ "docs": {
142
+ "tags": [],
143
+ "text": ""
144
+ },
145
+ "attribute": "custom-styles-for-results",
146
+ "reflect": false,
147
+ "defaultValue": "{}"
148
+ },
149
+ "documentAttributesForDisplay": {
150
+ "type": "string",
151
+ "mutable": false,
152
+ "complexType": {
153
+ "original": "string",
154
+ "resolved": "string",
155
+ "references": {}
156
+ },
157
+ "required": false,
158
+ "optional": false,
159
+ "docs": {
160
+ "tags": [],
161
+ "text": ""
162
+ },
163
+ "attribute": "document-attributes-for-display",
164
+ "reflect": false,
165
+ "defaultValue": "''"
166
+ },
167
+ "fallbackElement": {
168
+ "type": "unknown",
169
+ "mutable": false,
170
+ "complexType": {
171
+ "original": "HTMLElement | null",
172
+ "resolved": "HTMLElement",
173
+ "references": {
174
+ "HTMLElement": {
175
+ "location": "global",
176
+ "id": "global::HTMLElement"
177
+ }
178
+ }
179
+ },
180
+ "required": false,
181
+ "optional": false,
182
+ "docs": {
183
+ "tags": [],
184
+ "text": ""
185
+ },
186
+ "defaultValue": "null"
187
+ },
188
+ "formatTime": {
189
+ "type": "boolean",
190
+ "mutable": false,
191
+ "complexType": {
192
+ "original": "boolean",
193
+ "resolved": "boolean",
194
+ "references": {}
195
+ },
196
+ "required": false,
197
+ "optional": false,
198
+ "docs": {
199
+ "tags": [],
200
+ "text": ""
201
+ },
202
+ "attribute": "format-time",
203
+ "reflect": false,
204
+ "defaultValue": "true"
205
+ },
206
+ "placeAdAtEnd": {
207
+ "type": "boolean",
208
+ "mutable": false,
209
+ "complexType": {
210
+ "original": "boolean",
211
+ "resolved": "boolean",
212
+ "references": {}
213
+ },
214
+ "required": false,
215
+ "optional": false,
216
+ "docs": {
217
+ "tags": [],
218
+ "text": ""
219
+ },
220
+ "attribute": "place-ad-at-end",
221
+ "reflect": false,
222
+ "defaultValue": "false"
223
+ },
224
+ "placeAdAtStart": {
225
+ "type": "boolean",
226
+ "mutable": false,
227
+ "complexType": {
228
+ "original": "boolean",
229
+ "resolved": "boolean",
230
+ "references": {}
231
+ },
232
+ "required": false,
233
+ "optional": false,
234
+ "docs": {
235
+ "tags": [],
236
+ "text": ""
237
+ },
238
+ "attribute": "place-ad-at-start",
239
+ "reflect": false,
240
+ "defaultValue": "true"
241
+ },
242
+ "placeResultImageRight": {
243
+ "type": "boolean",
244
+ "mutable": false,
245
+ "complexType": {
246
+ "original": "boolean",
247
+ "resolved": "boolean",
248
+ "references": {}
249
+ },
250
+ "required": false,
251
+ "optional": false,
252
+ "docs": {
253
+ "tags": [],
254
+ "text": ""
255
+ },
256
+ "attribute": "place-result-image-right",
257
+ "reflect": false,
258
+ "defaultValue": "false"
259
+ }
260
+ };
261
+ }
262
+ static get states() {
263
+ return {
264
+ "hasSearched": {},
265
+ "query": {},
266
+ "searchResults": {}
267
+ };
268
+ }
269
+ }
270
+ //# sourceMappingURL=searchcraft-base-search-results.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"searchcraft-base-search-results.js","sourceRoot":"","sources":["../../../src/components/searchcraft-base-search-results/searchcraft-base-search-results.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAI1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,EACL,wBAAwB,EACxB,uBAAuB,EACvB,eAAe,EACf,eAAe,GAChB,MAAM,cAAc,CAAC;AAOtB,MAAM,OAAO,4BAA4B;;0BAClB,CAAC;sCAGuB,EAAE;4CACR,EAAE;+BACK,IAAI;0BAC7B,IAAI;4BACF,KAAK;8BACH,IAAI;qCACG,KAAK;2BAEd,KAAK;qBACX,EAAE;6BACkC,IAAI;;IAIzD,gBAAgB;QACd,IACE,CAAC,IAAI,CAAC,4BAA4B;YAClC,IAAI,CAAC,4BAA4B,CAAC,MAAM,KAAK,CAAC,EAC9C,CAAC;YACD,OAAO,CAAC,IAAI,CAAC,0DAA0D,CAAC,CAAC;YACzE,IAAI,CAAC,4BAA4B,GAAG,EAAE,CAAC;QACzC,CAAC;QAED,IAAI,CAAC,WAAW,GAA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O,CACL,WAAK,KAAK,EAAC,kBAAkB;YAC1B,eAAe;YACf,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC;gBACpB,CAAA,MAAA,MAAA,MAAA,IAAI,CAAC,aAAa,0CAAE,IAAI,0CAAE,IAAI,0CAAE,MAAM,MAAK,CAAC,IAAI,CAC9C,WAAK,KAAK,EAAC,uBAAuB;gBAChC,kDACiB,gCAAgC,IAAI,CAAC,KAAK,SAAS,GAClE,CACE,CACP,CACC,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, State } from '@stencil/core';\n\nimport type { SearchcraftResponse } from '@searchcraft/core';\n\nimport { useSearchcraftStore } from '@provider/store';\n\nimport {\n extractDynamicProperties,\n getFormattedTimeFromNow,\n parseSearchKeys,\n serializeStyles,\n} from '@utils/utils';\n\n@Component({\n tag: 'searchcraft-base-search-results',\n styleUrl: 'searchcraft-base-search-results.module.scss',\n shadow: true,\n})\nexport class SearchcraftBaseSearchResults {\n @Prop() adInterval = 4;\n @Prop() customStylesForResults:\n | string\n | Record<string, Record<string, string>> = {};\n @Prop() documentAttributesForDisplay = '';\n @Prop() fallbackElement: HTMLElement | null = null;\n @Prop() formatTime = true;\n @Prop() placeAdAtEnd = false;\n @Prop() placeAdAtStart = true;\n @Prop() placeResultImageRight = false;\n\n @State() hasSearched = false;\n @State() query = '';\n @State() searchResults: SearchcraftResponse | null = null;\n\n private unsubscribe: () => void;\n\n componentDidLoad() {\n if (\n !this.documentAttributesForDisplay ||\n this.documentAttributesForDisplay.length === 0\n ) {\n console.warn('No document attributes provided; using empty keys array.');\n this.documentAttributesForDisplay = '';\n }\n\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 render() {\n if (!this.hasSearched) {\n return (\n <div class='emptyState'>\n <slot name='empty-search' />\n </div>\n );\n }\n\n if (!this.searchResults?.data) {\n console.warn('No search results data available');\n return <div class='emptyState'>No results to display.</div>;\n }\n\n const parsedSearchKeys = parseSearchKeys(this.documentAttributesForDisplay);\n const serializedStyles =\n typeof this.customStylesForResults === 'string'\n ? this.customStylesForResults\n : serializeStyles(this.customStylesForResults);\n\n const resultsComponents = this.searchResults?.data?.hits?.map(\n (document, index) => {\n const { doc: result } = document;\n const dynamicProperties = extractDynamicProperties(\n result,\n parsedSearchKeys,\n );\n\n if (this.formatTime) {\n for (const key of parsedSearchKeys) {\n if (dynamicProperties[key]) {\n const value = dynamicProperties[key];\n // Check if the value is a valid ISO timestamp\n if (\n typeof value === 'string' &&\n !Number.isNaN(Date.parse(value))\n ) {\n dynamicProperties[key] = getFormattedTimeFromNow(value);\n }\n }\n }\n }\n\n return (\n <searchcraft-base-search-result\n button-callback={() => console.log('button callback')}\n custom-styles={serializedStyles}\n image-source={\n dynamicProperties[parsedSearchKeys[parsedSearchKeys.length - 1]]\n }\n is-interactive={true}\n key={`${document.document_id}-${index}`}\n keydown-callback={() => console.log('keydown')}\n heading-text={dynamicProperties[parsedSearchKeys[0]]}\n place-image-right={this.placeResultImageRight}\n primary-content={dynamicProperties[parsedSearchKeys[2]]}\n result-callback={() => console.log('interactive element')}\n secondary-content={dynamicProperties[parsedSearchKeys[3]]}\n subheading-text={dynamicProperties[parsedSearchKeys[1]]}\n tertiary-content={dynamicProperties[parsedSearchKeys[4]]}\n />\n );\n },\n );\n\n const finalComponents: JSX.Element[] = [];\n\n if (this.placeAdAtStart) {\n finalComponents.push(\n <div key='ad-section-start' class='adSection'>\n <span>##</span>\n <p> Ad Impressions</p>\n </div>,\n );\n }\n\n if (this.adInterval > 0) {\n resultsComponents.forEach((component, index) => {\n finalComponents.push(component);\n if ((index + 1) % this.adInterval === 0) {\n finalComponents.push(\n <div key={`ad-section-${index + 1}`} class='adSection'>\n <span>##</span>\n <p> Ad Impressions</p>\n </div>,\n );\n }\n });\n } else {\n finalComponents.push(...resultsComponents);\n }\n\n if (this.placeAdAtEnd) {\n finalComponents.push(\n <div key='ad-section-end' class='adSection'>\n <span>##</span>\n <p> Ad Impressions</p>\n </div>,\n );\n }\n\n return (\n <div class='resultsContainer'>\n {finalComponents}\n {this.query.length > 0 &&\n this.searchResults?.data?.hits?.length === 0 && (\n <div class='errorMessageContainer'>\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"]}
@@ -0,0 +1,47 @@
1
+ :root {
2
+ --font-stack: Helvetica, Arial, sans-serif;
3
+ }
4
+
5
+ .resultsContainer {
6
+ display: flex;
7
+ flex-direction: column;
8
+ justify-content: center;
9
+ margin: 16px 0;
10
+ }
11
+ .resultsContainer > p {
12
+ align-self: center;
13
+ }
14
+ .resultsContainer > div {
15
+ margin-bottom: 20px;
16
+ }
17
+ .resultsContainer > div img {
18
+ height: 300px;
19
+ width: 200px;
20
+ }
21
+
22
+ .adSection {
23
+ align-items: center;
24
+ background-color: #F1F1F1;
25
+ border: 1px solid #DCDDDE;
26
+ border-radius: 16px;
27
+ display: flex;
28
+ flex-direction: column;
29
+ font-size: 16px;
30
+ justify-content: center;
31
+ margin: auto;
32
+ min-height: 150px;
33
+ text-align: center;
34
+ width: 100%;
35
+ }
36
+ .adSection p {
37
+ margin-top: 5px;
38
+ }
39
+
40
+ .emptyState {
41
+ text-align: center;
42
+ width: 100%;
43
+ }
44
+
45
+ .errorMessageContainer {
46
+ text-align: center;
47
+ }
@@ -0,0 +1,137 @@
1
+ import { h, Fragment, } from "@stencil/core";
2
+ import classNames from "classnames";
3
+ export class SearchcraftButton {
4
+ constructor() {
5
+ this.handleClick = () => {
6
+ this.buttonClick.emit(); // Emit the event instead of calling a function
7
+ };
8
+ this.iconElement = undefined;
9
+ this.iconOnly = false;
10
+ this.iconPosition = 'left';
11
+ this.label = 'Search';
12
+ this.isRequesting = false;
13
+ this.theme = 'light';
14
+ }
15
+ getButtonStyle() {
16
+ return this.theme === 'light' ? 'buttonLight' : 'buttonDark';
17
+ }
18
+ render() {
19
+ const buttonStyle = this.getButtonStyle();
20
+ return (h(Fragment, { key: 'f10a9faa6357ef626c4e5414a5c8bdc1fe0b63a1' }, this.iconOnly ? (h("button", { class: classNames(buttonStyle, 'searchcraft-button'), onClick: this.handleClick, type: 'submit' }, this.isRequesting ? (h("searchcraft-spinner-dark", null)) : (this.iconElement))) : (h("button", { class: classNames(buttonStyle, 'searchcraft-button'), onClick: this.handleClick, type: 'submit' }, this.iconPosition === 'left' && this.isRequesting ? (h("div", { class: 'spinner-margin-right' }, h("searchcraft-spinner-dark", null))) : (this.iconElement), h("span", { class: classNames(this.isRequesting && 'button-label', 'searchcraft-button-label') }, this.label)))));
21
+ }
22
+ static get is() { return "searchcraft-button"; }
23
+ static get encapsulation() { return "shadow"; }
24
+ static get originalStyleUrls() {
25
+ return {
26
+ "$": ["searchcraft-button.module.scss"]
27
+ };
28
+ }
29
+ static get styleUrls() {
30
+ return {
31
+ "$": ["searchcraft-button.module.css"]
32
+ };
33
+ }
34
+ static get properties() {
35
+ return {
36
+ "iconElement": {
37
+ "type": "unknown",
38
+ "mutable": false,
39
+ "complexType": {
40
+ "original": "Element",
41
+ "resolved": "Element",
42
+ "references": {
43
+ "Element": {
44
+ "location": "global",
45
+ "id": "global::Element"
46
+ }
47
+ }
48
+ },
49
+ "required": false,
50
+ "optional": true,
51
+ "docs": {
52
+ "tags": [],
53
+ "text": ""
54
+ }
55
+ },
56
+ "iconOnly": {
57
+ "type": "boolean",
58
+ "mutable": false,
59
+ "complexType": {
60
+ "original": "boolean",
61
+ "resolved": "boolean",
62
+ "references": {}
63
+ },
64
+ "required": false,
65
+ "optional": false,
66
+ "docs": {
67
+ "tags": [],
68
+ "text": ""
69
+ },
70
+ "attribute": "icon-only",
71
+ "reflect": false,
72
+ "defaultValue": "false"
73
+ },
74
+ "iconPosition": {
75
+ "type": "string",
76
+ "mutable": false,
77
+ "complexType": {
78
+ "original": "string",
79
+ "resolved": "string",
80
+ "references": {}
81
+ },
82
+ "required": false,
83
+ "optional": false,
84
+ "docs": {
85
+ "tags": [],
86
+ "text": ""
87
+ },
88
+ "attribute": "icon-position",
89
+ "reflect": false,
90
+ "defaultValue": "'left'"
91
+ },
92
+ "label": {
93
+ "type": "string",
94
+ "mutable": false,
95
+ "complexType": {
96
+ "original": "string",
97
+ "resolved": "string",
98
+ "references": {}
99
+ },
100
+ "required": false,
101
+ "optional": false,
102
+ "docs": {
103
+ "tags": [],
104
+ "text": ""
105
+ },
106
+ "attribute": "label",
107
+ "reflect": false,
108
+ "defaultValue": "'Search'"
109
+ }
110
+ };
111
+ }
112
+ static get states() {
113
+ return {
114
+ "isRequesting": {},
115
+ "theme": {}
116
+ };
117
+ }
118
+ static get events() {
119
+ return [{
120
+ "method": "buttonClick",
121
+ "name": "buttonClick",
122
+ "bubbles": true,
123
+ "cancelable": true,
124
+ "composed": true,
125
+ "docs": {
126
+ "tags": [],
127
+ "text": ""
128
+ },
129
+ "complexType": {
130
+ "original": "void",
131
+ "resolved": "void",
132
+ "references": {}
133
+ }
134
+ }];
135
+ }
136
+ }
137
+ //# sourceMappingURL=searchcraft-button.js.map