@searchcraft/javascript-sdk 0.2.6 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (267) hide show
  1. package/dist/components/searchcraft-check-icon.d.ts +11 -0
  2. package/dist/components/searchcraft-dash-icon.d.ts +11 -0
  3. package/dist/searchcraft-javascript-sdk/_commonjsHelpers-63cbe26c.js +34 -0
  4. package/dist/searchcraft-javascript-sdk/_commonjsHelpers-63cbe26c.js.map +1 -0
  5. package/dist/searchcraft-javascript-sdk/index-8211f330.js +3043 -0
  6. package/dist/searchcraft-javascript-sdk/index-8211f330.js.map +1 -0
  7. package/dist/{components/p-5cdc6210.js → searchcraft-javascript-sdk/index-d6567b9c.js} +10 -2
  8. package/dist/searchcraft-javascript-sdk/index-d6567b9c.js.map +1 -0
  9. package/dist/searchcraft-javascript-sdk/index.esm.js +14 -1
  10. package/dist/searchcraft-javascript-sdk/index.esm.js.map +1 -1
  11. package/dist/searchcraft-javascript-sdk/searchcraft-auto-search-form.entry.js +127 -0
  12. package/dist/searchcraft-javascript-sdk/searchcraft-auto-search-form.entry.js.map +1 -0
  13. package/dist/{esm → searchcraft-javascript-sdk}/searchcraft-base-search-form.entry.js +6 -5
  14. package/dist/searchcraft-javascript-sdk/searchcraft-base-search-form.entry.js.map +1 -0
  15. package/dist/searchcraft-javascript-sdk/searchcraft-base-search-result.entry.js +60 -0
  16. package/dist/searchcraft-javascript-sdk/searchcraft-base-search-result.entry.js.map +1 -0
  17. package/dist/{components/searchcraft-base-search-results.js → searchcraft-javascript-sdk/searchcraft-base-search-results.entry.js} +12 -56
  18. package/dist/searchcraft-javascript-sdk/searchcraft-base-search-results.entry.js.map +1 -0
  19. package/dist/{esm → searchcraft-javascript-sdk}/searchcraft-button-icon.entry.js +1 -1
  20. package/dist/searchcraft-javascript-sdk/searchcraft-button-icon.entry.js.map +1 -0
  21. package/dist/{esm → searchcraft-javascript-sdk}/searchcraft-button.entry.js +5 -5
  22. package/dist/searchcraft-javascript-sdk/searchcraft-button.entry.js.map +1 -0
  23. package/dist/searchcraft-javascript-sdk/searchcraft-check-icon.entry.js +14 -0
  24. package/dist/searchcraft-javascript-sdk/searchcraft-check-icon.entry.js.map +1 -0
  25. package/dist/{components/p-70722ab2.js → searchcraft-javascript-sdk/searchcraft-clear-icon-set.entry.js} +7 -24
  26. package/dist/searchcraft-javascript-sdk/searchcraft-clear-icon-set.entry.js.map +1 -0
  27. package/dist/searchcraft-javascript-sdk/searchcraft-clear-input-button.entry.js +30 -0
  28. package/dist/searchcraft-javascript-sdk/searchcraft-clear-input-button.entry.js.map +1 -0
  29. package/dist/searchcraft-javascript-sdk/searchcraft-dash-icon.entry.js +14 -0
  30. package/dist/searchcraft-javascript-sdk/searchcraft-dash-icon.entry.js.map +1 -0
  31. package/dist/searchcraft-javascript-sdk/searchcraft-error-message.entry.js +22 -0
  32. package/dist/searchcraft-javascript-sdk/searchcraft-error-message.entry.js.map +1 -0
  33. package/dist/searchcraft-javascript-sdk/searchcraft-filters-list.entry.js +120 -0
  34. package/dist/searchcraft-javascript-sdk/searchcraft-filters-list.entry.js.map +1 -0
  35. package/dist/{components/p-6237f03e.js → searchcraft-javascript-sdk/searchcraft-input-caption.entry.js} +10 -31
  36. package/dist/searchcraft-javascript-sdk/searchcraft-input-caption.entry.js.map +1 -0
  37. package/dist/searchcraft-javascript-sdk/searchcraft-input-icon.entry.js +25 -0
  38. package/dist/searchcraft-javascript-sdk/searchcraft-input-icon.entry.js.map +1 -0
  39. package/dist/searchcraft-javascript-sdk/searchcraft-input-label.entry.js +29 -0
  40. package/dist/searchcraft-javascript-sdk/searchcraft-input-label.entry.js.map +1 -0
  41. package/dist/{components/p-b5f97e04.js → searchcraft-javascript-sdk/searchcraft-input.entry.js} +12 -83
  42. package/dist/searchcraft-javascript-sdk/searchcraft-input.entry.js.map +1 -0
  43. package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js +48 -1
  44. package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js.map +1 -1
  45. package/dist/{collection/components/searchcraft-results-info/searchcraft-results-info.js → searchcraft-javascript-sdk/searchcraft-results-info.entry.js} +16 -26
  46. package/dist/searchcraft-javascript-sdk/searchcraft-results-info.entry.js.map +1 -0
  47. package/dist/{components/p-a3bd1bc8.js → searchcraft-javascript-sdk/searchcraft-search-icon-set.entry.js} +7 -26
  48. package/dist/searchcraft-javascript-sdk/searchcraft-search-icon-set.entry.js.map +1 -0
  49. package/dist/{components/searchcraft-slider.js → searchcraft-javascript-sdk/searchcraft-slider.entry.js} +11 -36
  50. package/dist/searchcraft-javascript-sdk/searchcraft-slider.entry.js.map +1 -0
  51. package/dist/searchcraft-javascript-sdk/searchcraft-spinner-dark.entry.js +17 -0
  52. package/dist/searchcraft-javascript-sdk/searchcraft-spinner-dark.entry.js.map +1 -0
  53. package/dist/searchcraft-javascript-sdk/searchcraft-spinner-light.entry.js +17 -0
  54. package/dist/searchcraft-javascript-sdk/searchcraft-spinner-light.entry.js.map +1 -0
  55. package/dist/{components/searchcraft-toggle-button.js → searchcraft-javascript-sdk/searchcraft-toggle-button.entry.js} +11 -33
  56. package/dist/searchcraft-javascript-sdk/searchcraft-toggle-button.entry.js.map +1 -0
  57. package/dist/searchcraft-javascript-sdk/shadow-css-423dab2c.js +334 -0
  58. package/dist/searchcraft-javascript-sdk/shadow-css-423dab2c.js.map +1 -0
  59. package/dist/searchcraft-javascript-sdk/store-08ee97f6.js +3073 -0
  60. package/dist/searchcraft-javascript-sdk/store-08ee97f6.js.map +1 -0
  61. package/dist/{components/p-2bda632c.js → searchcraft-javascript-sdk/utils-9f198636.js} +19 -8
  62. package/dist/searchcraft-javascript-sdk/utils-9f198636.js.map +1 -0
  63. package/dist/types/assets/searchcraft-check-icon.d.ts +3 -0
  64. package/dist/types/assets/searchcraft-dash-icon.d.ts +3 -0
  65. package/dist/types/components/searchcraft-filters-list/searchcraft-filters-list.d.ts +13 -5
  66. package/dist/types/components.d.ts +26 -0
  67. package/dist/types/utils/utils.d.ts +3 -0
  68. package/package.json +1 -1
  69. package/dist/cjs/app-globals-3a1e7e63.js +0 -7
  70. package/dist/cjs/app-globals-3a1e7e63.js.map +0 -1
  71. package/dist/cjs/index-5b0b9d4c.js +0 -84
  72. package/dist/cjs/index-5b0b9d4c.js.map +0 -1
  73. package/dist/cjs/index-6c5282a0.js +0 -1279
  74. package/dist/cjs/index-6c5282a0.js.map +0 -1
  75. package/dist/cjs/index.cjs.js +0 -17
  76. package/dist/cjs/index.cjs.js.map +0 -1
  77. package/dist/cjs/loader.cjs.js +0 -17
  78. package/dist/cjs/loader.cjs.js.map +0 -1
  79. package/dist/cjs/searchcraft-auto-search-form_17.cjs.entry.js +0 -809
  80. package/dist/cjs/searchcraft-auto-search-form_17.cjs.entry.js.map +0 -1
  81. package/dist/cjs/searchcraft-base-search-form.cjs.entry.js +0 -64
  82. package/dist/cjs/searchcraft-base-search-form.cjs.entry.js.map +0 -1
  83. package/dist/cjs/searchcraft-button-icon.cjs.entry.js +0 -18
  84. package/dist/cjs/searchcraft-button-icon.cjs.entry.js.map +0 -1
  85. package/dist/cjs/searchcraft-button.cjs.entry.js +0 -37
  86. package/dist/cjs/searchcraft-button.cjs.entry.js.map +0 -1
  87. package/dist/cjs/searchcraft-javascript-sdk.cjs.js +0 -27
  88. package/dist/cjs/searchcraft-javascript-sdk.cjs.js.map +0 -1
  89. package/dist/cjs/store-c44c58ab.js +0 -314
  90. package/dist/cjs/store-c44c58ab.js.map +0 -1
  91. package/dist/cjs/utils-2dc6115c.js +0 -84
  92. package/dist/cjs/utils-2dc6115c.js.map +0 -1
  93. package/dist/collection/assets/searchcraft-button-icons.js +0 -9
  94. package/dist/collection/assets/searchcraft-button-icons.js.map +0 -1
  95. package/dist/collection/assets/searchcraft-clear-icon-set.js +0 -45
  96. package/dist/collection/assets/searchcraft-clear-icon-set.js.map +0 -1
  97. package/dist/collection/assets/searchcraft-search-icon-set.js +0 -84
  98. package/dist/collection/assets/searchcraft-search-icon-set.js.map +0 -1
  99. package/dist/collection/collection-manifest.json +0 -31
  100. package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.js +0 -365
  101. package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.js.map +0 -1
  102. package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.module.css +0 -15
  103. package/dist/collection/components/searchcraft-base-search-form/searchcraft-base-search-form.js +0 -168
  104. package/dist/collection/components/searchcraft-base-search-form/searchcraft-base-search-form.js.map +0 -1
  105. package/dist/collection/components/searchcraft-base-search-form/searchcraft-base-search-form.module.css +0 -18
  106. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js +0 -329
  107. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js.map +0 -1
  108. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.module.css +0 -214
  109. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js +0 -270
  110. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js.map +0 -1
  111. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.module.css +0 -47
  112. package/dist/collection/components/searchcraft-button/searchcraft-button.js +0 -137
  113. package/dist/collection/components/searchcraft-button/searchcraft-button.js.map +0 -1
  114. package/dist/collection/components/searchcraft-button/searchcraft-button.module.css +0 -82
  115. package/dist/collection/components/searchcraft-clear-input-button/searchcraft-clear-input-button.js +0 -95
  116. package/dist/collection/components/searchcraft-clear-input-button/searchcraft-clear-input-button.js.map +0 -1
  117. package/dist/collection/components/searchcraft-clear-input-button/searchcraft-clear-input-button.module.css +0 -33
  118. package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js +0 -64
  119. package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js.map +0 -1
  120. package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.module.css +0 -21
  121. package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.js +0 -170
  122. package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.js.map +0 -1
  123. package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.module.css +0 -70
  124. package/dist/collection/components/searchcraft-input/searchcraft-input.js +0 -352
  125. package/dist/collection/components/searchcraft-input/searchcraft-input.js.map +0 -1
  126. package/dist/collection/components/searchcraft-input/searchcraft-input.module.css +0 -241
  127. package/dist/collection/components/searchcraft-input-caption/searchcraft-input-caption.js +0 -122
  128. package/dist/collection/components/searchcraft-input-caption/searchcraft-input-caption.js.map +0 -1
  129. package/dist/collection/components/searchcraft-input-caption/searchcraft-input-caption.module.css +0 -79
  130. package/dist/collection/components/searchcraft-input-icon/searchcraft-input-icon.js +0 -109
  131. package/dist/collection/components/searchcraft-input-icon/searchcraft-input-icon.js.map +0 -1
  132. package/dist/collection/components/searchcraft-input-icon/searchcraft-input-icon.module.css +0 -17
  133. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js +0 -76
  134. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js.map +0 -1
  135. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.module.css +0 -21
  136. package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.js.map +0 -1
  137. package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.module.css +0 -15
  138. package/dist/collection/components/searchcraft-slider/searchcraft-slider.js +0 -128
  139. package/dist/collection/components/searchcraft-slider/searchcraft-slider.js.map +0 -1
  140. package/dist/collection/components/searchcraft-slider/searchcraft-slider.module.css +0 -68
  141. package/dist/collection/components/searchcraft-spinner-dark/searchcraft-spinner-dark.js +0 -19
  142. package/dist/collection/components/searchcraft-spinner-dark/searchcraft-spinner-dark.js.map +0 -1
  143. package/dist/collection/components/searchcraft-spinner-dark/searchcraft-spinner-dark.module.css +0 -35
  144. package/dist/collection/components/searchcraft-spinner-light/searchcraft-spinner-light.js +0 -19
  145. package/dist/collection/components/searchcraft-spinner-light/searchcraft-spinner-light.js.map +0 -1
  146. package/dist/collection/components/searchcraft-spinner-light/searchcraft-spinner-light.module.css +0 -26
  147. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js +0 -92
  148. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js.map +0 -1
  149. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.module.css +0 -31
  150. package/dist/collection/index.js +0 -12
  151. package/dist/collection/index.js.map +0 -1
  152. package/dist/collection/provider/store.js +0 -96
  153. package/dist/collection/provider/store.js.map +0 -1
  154. package/dist/collection/utils/utils.js +0 -74
  155. package/dist/collection/utils/utils.js.map +0 -1
  156. package/dist/components/index.js +0 -58
  157. package/dist/components/index.js.map +0 -1
  158. package/dist/components/p-023371c8.js +0 -89
  159. package/dist/components/p-023371c8.js.map +0 -1
  160. package/dist/components/p-157e5b1a.js +0 -310
  161. package/dist/components/p-157e5b1a.js.map +0 -1
  162. package/dist/components/p-1c377190.js +0 -67
  163. package/dist/components/p-1c377190.js.map +0 -1
  164. package/dist/components/p-25f18f2e.js +0 -33
  165. package/dist/components/p-25f18f2e.js.map +0 -1
  166. package/dist/components/p-2bda632c.js.map +0 -1
  167. package/dist/components/p-3fece4e2.js +0 -33
  168. package/dist/components/p-3fece4e2.js.map +0 -1
  169. package/dist/components/p-576f0d2b.js +0 -61
  170. package/dist/components/p-576f0d2b.js.map +0 -1
  171. package/dist/components/p-5cdc6210.js.map +0 -1
  172. package/dist/components/p-6237f03e.js.map +0 -1
  173. package/dist/components/p-70722ab2.js.map +0 -1
  174. package/dist/components/p-7498e493.js +0 -1113
  175. package/dist/components/p-7498e493.js.map +0 -1
  176. package/dist/components/p-848301b7.js +0 -40
  177. package/dist/components/p-848301b7.js.map +0 -1
  178. package/dist/components/p-8c38185e.js +0 -53
  179. package/dist/components/p-8c38185e.js.map +0 -1
  180. package/dist/components/p-a3bd1bc8.js.map +0 -1
  181. package/dist/components/p-ae84b899.js +0 -48
  182. package/dist/components/p-ae84b899.js.map +0 -1
  183. package/dist/components/p-b5f97e04.js.map +0 -1
  184. package/dist/components/searchcraft-auto-search-form.js +0 -207
  185. package/dist/components/searchcraft-auto-search-form.js.map +0 -1
  186. package/dist/components/searchcraft-base-search-form.js +0 -152
  187. package/dist/components/searchcraft-base-search-form.js.map +0 -1
  188. package/dist/components/searchcraft-base-search-result.js +0 -8
  189. package/dist/components/searchcraft-base-search-result.js.map +0 -1
  190. package/dist/components/searchcraft-base-search-results.js.map +0 -1
  191. package/dist/components/searchcraft-button-icon.js +0 -32
  192. package/dist/components/searchcraft-button-icon.js.map +0 -1
  193. package/dist/components/searchcraft-button.js +0 -8
  194. package/dist/components/searchcraft-button.js.map +0 -1
  195. package/dist/components/searchcraft-clear-icon-set.js +0 -8
  196. package/dist/components/searchcraft-clear-icon-set.js.map +0 -1
  197. package/dist/components/searchcraft-clear-input-button.js +0 -8
  198. package/dist/components/searchcraft-clear-input-button.js.map +0 -1
  199. package/dist/components/searchcraft-error-message.js +0 -8
  200. package/dist/components/searchcraft-error-message.js.map +0 -1
  201. package/dist/components/searchcraft-filters-list.js +0 -141
  202. package/dist/components/searchcraft-filters-list.js.map +0 -1
  203. package/dist/components/searchcraft-input-caption.js +0 -8
  204. package/dist/components/searchcraft-input-caption.js.map +0 -1
  205. package/dist/components/searchcraft-input-icon.js +0 -8
  206. package/dist/components/searchcraft-input-icon.js.map +0 -1
  207. package/dist/components/searchcraft-input-label.js +0 -8
  208. package/dist/components/searchcraft-input-label.js.map +0 -1
  209. package/dist/components/searchcraft-input.js +0 -8
  210. package/dist/components/searchcraft-input.js.map +0 -1
  211. package/dist/components/searchcraft-results-info.js +0 -63
  212. package/dist/components/searchcraft-results-info.js.map +0 -1
  213. package/dist/components/searchcraft-search-icon-set.js +0 -8
  214. package/dist/components/searchcraft-search-icon-set.js.map +0 -1
  215. package/dist/components/searchcraft-slider.js.map +0 -1
  216. package/dist/components/searchcraft-spinner-dark.js +0 -8
  217. package/dist/components/searchcraft-spinner-dark.js.map +0 -1
  218. package/dist/components/searchcraft-spinner-light.js +0 -8
  219. package/dist/components/searchcraft-spinner-light.js.map +0 -1
  220. package/dist/components/searchcraft-toggle-button.js.map +0 -1
  221. package/dist/esm/index-0ac5bb53.js +0 -1251
  222. package/dist/esm/index-0ac5bb53.js.map +0 -1
  223. package/dist/esm/index-72ac5051.js +0 -82
  224. package/dist/esm/index-72ac5051.js.map +0 -1
  225. package/dist/esm/index.js +0 -4
  226. package/dist/esm/index.js.map +0 -1
  227. package/dist/esm/loader.js +0 -13
  228. package/dist/esm/loader.js.map +0 -1
  229. package/dist/esm/searchcraft-auto-search-form_17.entry.js +0 -789
  230. package/dist/esm/searchcraft-auto-search-form_17.entry.js.map +0 -1
  231. package/dist/esm/searchcraft-base-search-form.entry.js.map +0 -1
  232. package/dist/esm/searchcraft-button-icon.entry.js.map +0 -1
  233. package/dist/esm/searchcraft-button.entry.js.map +0 -1
  234. package/dist/esm/searchcraft-javascript-sdk.js +0 -22
  235. package/dist/esm/searchcraft-javascript-sdk.js.map +0 -1
  236. package/dist/esm/store-9e0b0710.js +0 -310
  237. package/dist/esm/store-9e0b0710.js.map +0 -1
  238. package/dist/esm/utils-a3373179.js +0 -77
  239. package/dist/esm/utils-a3373179.js.map +0 -1
  240. package/dist/index.cjs.js +0 -1
  241. package/dist/index.js +0 -1
  242. package/dist/loader/cdn.js +0 -1
  243. package/dist/loader/index.cjs.js +0 -1
  244. package/dist/loader/index.d.ts +0 -24
  245. package/dist/loader/index.es2017.js +0 -1
  246. package/dist/loader/index.js +0 -2
  247. package/dist/loader/package.json +0 -11
  248. package/dist/searchcraft-javascript-sdk/p-0880cfbb.js +0 -3
  249. package/dist/searchcraft-javascript-sdk/p-0880cfbb.js.map +0 -1
  250. package/dist/searchcraft-javascript-sdk/p-2bda632c.js +0 -2
  251. package/dist/searchcraft-javascript-sdk/p-2bda632c.js.map +0 -1
  252. package/dist/searchcraft-javascript-sdk/p-5cdc6210.js +0 -7
  253. package/dist/searchcraft-javascript-sdk/p-5cdc6210.js.map +0 -1
  254. package/dist/searchcraft-javascript-sdk/p-5ec960bd.entry.js +0 -2
  255. package/dist/searchcraft-javascript-sdk/p-5ec960bd.entry.js.map +0 -1
  256. package/dist/searchcraft-javascript-sdk/p-63b3b565.entry.js +0 -2
  257. package/dist/searchcraft-javascript-sdk/p-63b3b565.entry.js.map +0 -1
  258. package/dist/searchcraft-javascript-sdk/p-901fee50.js +0 -11
  259. package/dist/searchcraft-javascript-sdk/p-901fee50.js.map +0 -1
  260. package/dist/searchcraft-javascript-sdk/p-c2c4f6b7.entry.js +0 -2
  261. package/dist/searchcraft-javascript-sdk/p-c2c4f6b7.entry.js.map +0 -1
  262. package/dist/searchcraft-javascript-sdk/p-cc454542.entry.js +0 -2
  263. package/dist/searchcraft-javascript-sdk/p-cc454542.entry.js.map +0 -1
  264. package/dist/searchcraft-javascript-sdk/p-e1255160.js +0 -2
  265. package/dist/searchcraft-javascript-sdk/p-e1255160.js.map +0 -1
  266. /package/dist/{esm → searchcraft-javascript-sdk}/app-globals-0f993ce5.js +0 -0
  267. /package/dist/{esm → searchcraft-javascript-sdk}/app-globals-0f993ce5.js.map +0 -0
@@ -1,214 +0,0 @@
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
- }
@@ -1,270 +0,0 @@
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
@@ -1 +0,0 @@
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,E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AU,KAAK,CAAC,EAAE,CAAC;oBACxC,eAAe,CAAC,IAAI,CAClB,WAAK,GAAG,EAAE,cAAc,KAAK,GAAG,CAAC,EAAE,EAAE,KAAK,EAAC,WAAW;wBACpD,qBAAe;wBACf,+BAAsB,CAClB,CACP,CAAC;gBACJ,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,eAAe,CAAC,IAAI,CAAC,GAAG,iBAAiB,CAAC,CAAC;QAC7C,CAAC;QAED,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,eAAe,CAAC,IAAI,CAClB,WAAK,GAAG,EAAC,gBAAgB,EAAC,KAAK,EAAC,WAAW;gBACzC,qBAAe;gBACf,+BAAsB,CAClB,CACP,CAAC;QACJ,CAAC;QAED,OAAO,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"]}
@@ -1,47 +0,0 @@
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
- }
@@ -1,137 +0,0 @@
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