@searchcraft/javascript-sdk 0.7.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (263) hide show
  1. package/README.md +7 -1
  2. package/dist/cjs/{index-d4b4a45e.js → index-a81df4f0.js} +29 -113
  3. package/dist/{components/p-6cafd48d.js.map → cjs/index-a81df4f0.js.map} +1 -1
  4. package/dist/cjs/index.cjs.js +1 -1
  5. package/dist/cjs/loader.cjs.js +2 -2
  6. package/dist/cjs/searchcraft-base-search-result.cjs.entry.js +91 -44
  7. package/dist/cjs/searchcraft-base-search-result.cjs.entry.js.map +1 -1
  8. package/dist/cjs/searchcraft-base-search-results.cjs.entry.js +74 -50
  9. package/dist/cjs/searchcraft-base-search-results.cjs.entry.js.map +1 -1
  10. package/dist/cjs/searchcraft-button_3.cjs.entry.js +37 -36
  11. package/dist/cjs/searchcraft-button_3.cjs.entry.js.map +1 -1
  12. package/dist/cjs/searchcraft-facet-list_3.cjs.entry.js +141 -119
  13. package/dist/cjs/searchcraft-facet-list_3.cjs.entry.js.map +1 -1
  14. package/dist/cjs/searchcraft-filter-panel.cjs.entry.js +11 -14
  15. package/dist/cjs/searchcraft-filter-panel.cjs.entry.js.map +1 -1
  16. package/dist/cjs/searchcraft-input-form_2.cjs.entry.js +127 -92
  17. package/dist/cjs/searchcraft-input-form_2.cjs.entry.js.map +1 -1
  18. package/dist/cjs/searchcraft-javascript-sdk.cjs.js +2 -2
  19. package/dist/cjs/searchcraft-popover-button.cjs.entry.js +3 -7
  20. package/dist/cjs/searchcraft-popover-button.cjs.entry.js.map +1 -1
  21. package/dist/cjs/searchcraft-popover-form.cjs.entry.js +81 -75
  22. package/dist/cjs/searchcraft-popover-form.cjs.entry.js.map +1 -1
  23. package/dist/cjs/searchcraft-popover-list-item.cjs.entry.js +29 -6
  24. package/dist/cjs/searchcraft-popover-list-item.cjs.entry.js.map +1 -1
  25. package/dist/cjs/searchcraft-results-info.cjs.entry.js +9 -13
  26. package/dist/cjs/searchcraft-results-info.cjs.entry.js.map +1 -1
  27. package/dist/cjs/searchcraft-theme.cjs.entry.js +38 -0
  28. package/dist/cjs/searchcraft-theme.cjs.entry.js.map +1 -0
  29. package/dist/cjs/{store-abe47006.js → store-f6ba3dfb.js} +26 -10
  30. package/dist/cjs/{store-abe47006.js.map → store-f6ba3dfb.js.map} +1 -1
  31. package/dist/collection/collection-manifest.json +1 -0
  32. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js +102 -62
  33. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js.map +1 -1
  34. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js +77 -61
  35. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js.map +1 -1
  36. package/dist/collection/components/searchcraft-button/searchcraft-button.js +26 -30
  37. package/dist/collection/components/searchcraft-button/searchcraft-button.js.map +1 -1
  38. package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js +6 -12
  39. package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js.map +1 -1
  40. package/dist/collection/components/searchcraft-facet-list/searchcraft-facet-list.js +59 -51
  41. package/dist/collection/components/searchcraft-facet-list/searchcraft-facet-list.js.map +1 -1
  42. package/dist/collection/components/searchcraft-filter-panel/searchcraft-filter-panel.js +9 -20
  43. package/dist/collection/components/searchcraft-filter-panel/searchcraft-filter-panel.js.map +1 -1
  44. package/dist/collection/components/searchcraft-input-form/searchcraft-input-form.js +109 -87
  45. package/dist/collection/components/searchcraft-input-form/searchcraft-input-form.js.map +1 -1
  46. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js +10 -20
  47. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js.map +1 -1
  48. package/dist/collection/components/searchcraft-popover-button/searchcraft-popover-button.js +1 -11
  49. package/dist/collection/components/searchcraft-popover-button/searchcraft-popover-button.js.map +1 -1
  50. package/dist/collection/components/searchcraft-popover-form/searchcraft-popover-form.js +81 -82
  51. package/dist/collection/components/searchcraft-popover-form/searchcraft-popover-form.js.map +1 -1
  52. package/dist/collection/components/searchcraft-popover-list-item/searchcraft-popover-list-item.js +35 -17
  53. package/dist/collection/components/searchcraft-popover-list-item/searchcraft-popover-list-item.js.map +1 -1
  54. package/dist/collection/components/searchcraft-popover-list-view/searchcraft-popover-list-view.js +17 -19
  55. package/dist/collection/components/searchcraft-popover-list-view/searchcraft-popover-list-view.js.map +1 -1
  56. package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.js +7 -19
  57. package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.js.map +1 -1
  58. package/dist/collection/components/searchcraft-slider/searchcraft-slider.js +57 -65
  59. package/dist/collection/components/searchcraft-slider/searchcraft-slider.js.map +1 -1
  60. package/dist/collection/components/searchcraft-theme/searchcraft-theme.js +27 -0
  61. package/dist/collection/components/searchcraft-theme/searchcraft-theme.js.map +1 -0
  62. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js +23 -26
  63. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js.map +1 -1
  64. package/dist/collection/index.js.map +1 -1
  65. package/dist/collection/provider/store.js +25 -9
  66. package/dist/collection/provider/store.js.map +1 -1
  67. package/dist/collection/utils/facets.js +5 -3
  68. package/dist/collection/utils/facets.js.map +1 -1
  69. package/dist/components/index.js +4 -2
  70. package/dist/components/index.js.map +1 -1
  71. package/dist/components/p-0ef4ab33.js +66 -0
  72. package/dist/components/p-0ef4ab33.js.map +1 -0
  73. package/dist/components/p-1234974c.js +72 -0
  74. package/dist/components/p-1234974c.js.map +1 -0
  75. package/dist/components/p-4b92ae26.js +109 -0
  76. package/dist/components/p-4b92ae26.js.map +1 -0
  77. package/dist/components/{p-e1cf5f9d.js → p-506cdac1.js} +18 -14
  78. package/dist/components/p-506cdac1.js.map +1 -0
  79. package/dist/components/p-521fe971.js +60 -0
  80. package/dist/components/p-521fe971.js.map +1 -0
  81. package/dist/components/{p-6cafd48d.js → p-5365011f.js} +30 -123
  82. package/dist/components/p-5365011f.js.map +1 -0
  83. package/dist/components/p-54998882.js +285 -0
  84. package/dist/components/p-54998882.js.map +1 -0
  85. package/dist/{esm/store-712f0586.js → components/p-936e2ed4.js} +26 -10
  86. package/dist/components/{p-01dc5b3b.js.map → p-936e2ed4.js.map} +1 -1
  87. package/dist/components/p-a75ef832.js +34 -0
  88. package/dist/components/p-a75ef832.js.map +1 -0
  89. package/dist/components/p-b4a8fcbe.js +144 -0
  90. package/dist/components/p-b4a8fcbe.js.map +1 -0
  91. package/dist/components/p-ca881e5c.js +37 -0
  92. package/dist/components/p-ca881e5c.js.map +1 -0
  93. package/dist/components/p-d95bc2a0.js +284 -0
  94. package/dist/components/p-d95bc2a0.js.map +1 -0
  95. package/dist/components/searchcraft-base-search-result.js +1 -1
  96. package/dist/components/searchcraft-base-search-results.js +76 -52
  97. package/dist/components/searchcraft-base-search-results.js.map +1 -1
  98. package/dist/components/searchcraft-button.js +1 -1
  99. package/dist/components/searchcraft-error-message.js +1 -1
  100. package/dist/components/searchcraft-facet-list.js +1 -1
  101. package/dist/components/searchcraft-filter-panel.js +14 -17
  102. package/dist/components/searchcraft-filter-panel.js.map +1 -1
  103. package/dist/components/searchcraft-input-form.js +1 -1
  104. package/dist/components/searchcraft-input-label.js +1 -1
  105. package/dist/components/searchcraft-popover-button.js +3 -7
  106. package/dist/components/searchcraft-popover-button.js.map +1 -1
  107. package/dist/components/searchcraft-popover-form.js +87 -81
  108. package/dist/components/searchcraft-popover-form.js.map +1 -1
  109. package/dist/components/searchcraft-popover-list-item.js +1 -1
  110. package/dist/components/searchcraft-popover-list-view.js +1 -1
  111. package/dist/components/searchcraft-results-info.js +9 -13
  112. package/dist/components/searchcraft-results-info.js.map +1 -1
  113. package/dist/components/searchcraft-slider.js +1 -1
  114. package/dist/components/searchcraft-theme.d.ts +11 -0
  115. package/dist/components/searchcraft-theme.js +51 -0
  116. package/dist/components/searchcraft-theme.js.map +1 -0
  117. package/dist/components/searchcraft-toggle-button.js +1 -1
  118. package/dist/esm/{index-56b713de.js → index-3608c57d.js} +29 -113
  119. package/dist/esm/index-3608c57d.js.map +1 -0
  120. package/dist/esm/index.js +1 -1
  121. package/dist/esm/loader.js +3 -3
  122. package/dist/esm/searchcraft-base-search-result.entry.js +91 -44
  123. package/dist/esm/searchcraft-base-search-result.entry.js.map +1 -1
  124. package/dist/esm/searchcraft-base-search-results.entry.js +74 -50
  125. package/dist/esm/searchcraft-base-search-results.entry.js.map +1 -1
  126. package/dist/esm/searchcraft-button_3.entry.js +37 -36
  127. package/dist/esm/searchcraft-button_3.entry.js.map +1 -1
  128. package/dist/esm/searchcraft-facet-list_3.entry.js +141 -119
  129. package/dist/esm/searchcraft-facet-list_3.entry.js.map +1 -1
  130. package/dist/esm/searchcraft-filter-panel.entry.js +11 -14
  131. package/dist/esm/searchcraft-filter-panel.entry.js.map +1 -1
  132. package/dist/esm/searchcraft-input-form_2.entry.js +127 -92
  133. package/dist/esm/searchcraft-input-form_2.entry.js.map +1 -1
  134. package/dist/esm/searchcraft-javascript-sdk.js +3 -3
  135. package/dist/esm/searchcraft-popover-button.entry.js +3 -7
  136. package/dist/esm/searchcraft-popover-button.entry.js.map +1 -1
  137. package/dist/esm/searchcraft-popover-form.entry.js +81 -75
  138. package/dist/esm/searchcraft-popover-form.entry.js.map +1 -1
  139. package/dist/esm/searchcraft-popover-list-item.entry.js +29 -6
  140. package/dist/esm/searchcraft-popover-list-item.entry.js.map +1 -1
  141. package/dist/esm/searchcraft-results-info.entry.js +9 -13
  142. package/dist/esm/searchcraft-results-info.entry.js.map +1 -1
  143. package/dist/esm/searchcraft-theme.entry.js +34 -0
  144. package/dist/esm/searchcraft-theme.entry.js.map +1 -0
  145. package/dist/{components/p-01dc5b3b.js → esm/store-aa071d9c.js} +26 -10
  146. package/dist/esm/{store-712f0586.js.map → store-aa071d9c.js.map} +1 -1
  147. package/dist/searchcraft-javascript-sdk/index.esm.js +1 -1
  148. package/dist/searchcraft-javascript-sdk/p-26f5263d.entry.js +2 -0
  149. package/dist/searchcraft-javascript-sdk/p-26f5263d.entry.js.map +1 -0
  150. package/dist/searchcraft-javascript-sdk/p-2ff7eb35.entry.js +2 -0
  151. package/dist/searchcraft-javascript-sdk/p-2ff7eb35.entry.js.map +1 -0
  152. package/dist/searchcraft-javascript-sdk/p-36f0532e.entry.js +2 -0
  153. package/dist/searchcraft-javascript-sdk/p-36f0532e.entry.js.map +1 -0
  154. package/dist/searchcraft-javascript-sdk/p-41b6bc5d.entry.js +2 -0
  155. package/dist/searchcraft-javascript-sdk/p-41b6bc5d.entry.js.map +1 -0
  156. package/dist/searchcraft-javascript-sdk/p-57eddb07.entry.js +2 -0
  157. package/dist/searchcraft-javascript-sdk/p-57eddb07.entry.js.map +1 -0
  158. package/dist/searchcraft-javascript-sdk/p-5d6fbee0.entry.js +2 -0
  159. package/dist/searchcraft-javascript-sdk/p-5d6fbee0.entry.js.map +1 -0
  160. package/dist/searchcraft-javascript-sdk/p-64c5a1d2.entry.js +2 -0
  161. package/dist/searchcraft-javascript-sdk/p-64c5a1d2.entry.js.map +1 -0
  162. package/dist/searchcraft-javascript-sdk/p-7e13c128.js +3 -0
  163. package/dist/searchcraft-javascript-sdk/p-7e13c128.js.map +1 -0
  164. package/dist/searchcraft-javascript-sdk/p-8b0a60b3.entry.js +2 -0
  165. package/dist/searchcraft-javascript-sdk/p-8b0a60b3.entry.js.map +1 -0
  166. package/dist/searchcraft-javascript-sdk/{p-01dc5b3b.js → p-936e2ed4.js} +2 -2
  167. package/dist/searchcraft-javascript-sdk/{p-01dc5b3b.js.map → p-936e2ed4.js.map} +1 -1
  168. package/dist/searchcraft-javascript-sdk/p-c7df8be6.entry.js +2 -0
  169. package/dist/searchcraft-javascript-sdk/p-c7df8be6.entry.js.map +1 -0
  170. package/dist/searchcraft-javascript-sdk/p-eb6058e8.entry.js +2 -0
  171. package/dist/searchcraft-javascript-sdk/p-eb6058e8.entry.js.map +1 -0
  172. package/dist/searchcraft-javascript-sdk/p-faaa4394.entry.js +2 -0
  173. package/dist/searchcraft-javascript-sdk/p-faaa4394.entry.js.map +1 -0
  174. package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js +1 -1
  175. package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js.map +1 -1
  176. package/dist/types/components/searchcraft-base-search-result/searchcraft-base-search-result.d.ts +1 -0
  177. package/dist/types/components/searchcraft-base-search-results/searchcraft-base-search-results.d.ts +2 -1
  178. package/dist/types/components/searchcraft-button/searchcraft-button.d.ts +1 -0
  179. package/dist/types/components/searchcraft-error-message/searchcraft-error-message.d.ts +1 -0
  180. package/dist/types/components/searchcraft-facet-list/searchcraft-facet-list.d.ts +2 -1
  181. package/dist/types/components/searchcraft-filter-panel/searchcraft-filter-panel.d.ts +1 -0
  182. package/dist/types/components/searchcraft-input-form/searchcraft-input-form.d.ts +7 -10
  183. package/dist/types/components/searchcraft-input-label/searchcraft-input-label.d.ts +2 -1
  184. package/dist/types/components/searchcraft-popover-button/searchcraft-popover-button.d.ts +1 -0
  185. package/dist/types/components/searchcraft-popover-form/searchcraft-popover-form.d.ts +2 -1
  186. package/dist/types/components/searchcraft-popover-list-item/searchcraft-popover-list-item.d.ts +2 -0
  187. package/dist/types/components/searchcraft-popover-list-view/searchcraft-popover-list-view.d.ts +1 -0
  188. package/dist/types/components/searchcraft-results-info/searchcraft-results-info.d.ts +1 -0
  189. package/dist/types/components/searchcraft-slider/searchcraft-slider.d.ts +2 -1
  190. package/dist/types/components/searchcraft-theme/searchcraft-theme.d.ts +5 -0
  191. package/dist/types/components/searchcraft-toggle-button/searchcraft-toggle-button.d.ts +2 -1
  192. package/dist/types/components.d.ts +17 -4
  193. package/dist/types/index.d.ts +2 -1
  194. package/dist/types/provider/store.d.ts +1 -0
  195. package/dist/types/types/_shared.types.d.ts +1 -0
  196. package/dist/types/types/index.d.ts +1 -0
  197. package/dist/types/types/raw.d.ts +4 -0
  198. package/dist/types/types/searchcraft-base-search-results.types.d.ts +1 -0
  199. package/dist/types/types/searchcraft-filter-panel.types.d.ts +1 -0
  200. package/dist/types/types/searchcraft-popover-form.types.d.ts +1 -0
  201. package/dist/types/utils/facets.d.ts +1 -0
  202. package/dist/types/utils/index.d.ts +1 -0
  203. package/dist/types/utils/styles.d.ts +1 -0
  204. package/dist/types/utils/units.d.ts +1 -0
  205. package/package.json +5 -4
  206. package/dist/cjs/index-d4b4a45e.js.map +0 -1
  207. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.module.css +0 -227
  208. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.module.css +0 -179
  209. package/dist/collection/components/searchcraft-button/searchcraft-button.module.css +0 -174
  210. package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.module.css +0 -158
  211. package/dist/collection/components/searchcraft-facet-list/searchcraft-facet-list.module.css +0 -266
  212. package/dist/collection/components/searchcraft-filter-panel/searchcraft-filter-panel.module.css +0 -168
  213. package/dist/collection/components/searchcraft-input-form/searchcraft-input-form.module.css +0 -293
  214. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.module.css +0 -159
  215. package/dist/collection/components/searchcraft-popover-button/searchcraft-popover-button.module.css +0 -0
  216. package/dist/collection/components/searchcraft-popover-form/searchcraft-popover-form.module.css +0 -322
  217. package/dist/collection/components/searchcraft-popover-list-item/searchcraft-popover-list-item.module.css +0 -209
  218. package/dist/collection/components/searchcraft-popover-list-view/searchcraft-popover-list-view.module.css +0 -0
  219. package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.module.css +0 -169
  220. package/dist/collection/components/searchcraft-slider/searchcraft-slider.module.css +0 -231
  221. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.module.css +0 -207
  222. package/dist/components/p-1ae87308.js +0 -43
  223. package/dist/components/p-1ae87308.js.map +0 -1
  224. package/dist/components/p-649654b5.js +0 -268
  225. package/dist/components/p-649654b5.js.map +0 -1
  226. package/dist/components/p-662cb490.js +0 -67
  227. package/dist/components/p-662cb490.js.map +0 -1
  228. package/dist/components/p-87d1611b.js +0 -97
  229. package/dist/components/p-87d1611b.js.map +0 -1
  230. package/dist/components/p-c273e43d.js +0 -40
  231. package/dist/components/p-c273e43d.js.map +0 -1
  232. package/dist/components/p-cc9f8c61.js +0 -109
  233. package/dist/components/p-cc9f8c61.js.map +0 -1
  234. package/dist/components/p-cf096782.js +0 -56
  235. package/dist/components/p-cf096782.js.map +0 -1
  236. package/dist/components/p-da5b92ef.js +0 -253
  237. package/dist/components/p-da5b92ef.js.map +0 -1
  238. package/dist/components/p-e1cf5f9d.js.map +0 -1
  239. package/dist/components/p-f5a06210.js +0 -34
  240. package/dist/components/p-f5a06210.js.map +0 -1
  241. package/dist/esm/index-56b713de.js.map +0 -1
  242. package/dist/searchcraft-javascript-sdk/p-117fcdd3.entry.js +0 -2
  243. package/dist/searchcraft-javascript-sdk/p-117fcdd3.entry.js.map +0 -1
  244. package/dist/searchcraft-javascript-sdk/p-129e6f2c.js +0 -3
  245. package/dist/searchcraft-javascript-sdk/p-129e6f2c.js.map +0 -1
  246. package/dist/searchcraft-javascript-sdk/p-27cb401c.entry.js +0 -2
  247. package/dist/searchcraft-javascript-sdk/p-27cb401c.entry.js.map +0 -1
  248. package/dist/searchcraft-javascript-sdk/p-4df4a29e.entry.js +0 -2
  249. package/dist/searchcraft-javascript-sdk/p-4df4a29e.entry.js.map +0 -1
  250. package/dist/searchcraft-javascript-sdk/p-54248dd8.entry.js +0 -2
  251. package/dist/searchcraft-javascript-sdk/p-54248dd8.entry.js.map +0 -1
  252. package/dist/searchcraft-javascript-sdk/p-69430dbf.entry.js +0 -2
  253. package/dist/searchcraft-javascript-sdk/p-69430dbf.entry.js.map +0 -1
  254. package/dist/searchcraft-javascript-sdk/p-a460755d.entry.js +0 -2
  255. package/dist/searchcraft-javascript-sdk/p-a460755d.entry.js.map +0 -1
  256. package/dist/searchcraft-javascript-sdk/p-bc2c4259.entry.js +0 -2
  257. package/dist/searchcraft-javascript-sdk/p-bc2c4259.entry.js.map +0 -1
  258. package/dist/searchcraft-javascript-sdk/p-caecdcda.entry.js +0 -2
  259. package/dist/searchcraft-javascript-sdk/p-caecdcda.entry.js.map +0 -1
  260. package/dist/searchcraft-javascript-sdk/p-f8129731.entry.js +0 -2
  261. package/dist/searchcraft-javascript-sdk/p-f8129731.entry.js.map +0 -1
  262. package/dist/searchcraft-javascript-sdk/p-f839b682.entry.js +0 -2
  263. package/dist/searchcraft-javascript-sdk/p-f839b682.entry.js.map +0 -1
@@ -1,268 +0,0 @@
1
- import { p as proxyCustomElement, H, c as createEvent, h, F as Fragment } from './p-6cafd48d.js';
2
- import { c as classNames } from './p-5cdc6210.js';
3
- import { u as useSearchcraftStore } from './p-01dc5b3b.js';
4
-
5
- function deepMergeWithSpread(obj1, obj2) {
6
- const result = Object.assign({}, obj1);
7
- for (const key in obj2) {
8
- // biome-ignore lint/suspicious/noPrototypeBuiltins: <explanation>
9
- if (obj2.hasOwnProperty(key)) {
10
- if (obj2[key] instanceof Object && obj1[key] instanceof Object) {
11
- result[key] = deepMergeWithSpread(obj1[key], obj2[key]);
12
- }
13
- else {
14
- result[key] = obj2[key];
15
- }
16
- }
17
- }
18
- return result;
19
- }
20
- /**
21
- * Given an array of facet paths, removes parent facet paths.
22
- */
23
- function removeSubstringMatches(arr) {
24
- return arr.filter((entry, index, array) => !array.some((otherEntry, otherIndex) => otherIndex !== index && otherEntry.includes(entry)));
25
- }
26
- function facetToRecord(facet) {
27
- const records = {};
28
- const traverseAndAddToFragments = (facetChild) => {
29
- var _a;
30
- records[facetChild.path] = {
31
- count: facetChild.count,
32
- path: facetChild.path,
33
- };
34
- (_a = facetChild.children) === null || _a === void 0 ? void 0 : _a.forEach((child) => {
35
- traverseAndAddToFragments(child);
36
- });
37
- };
38
- traverseAndAddToFragments(facet);
39
- return records;
40
- }
41
- function recordToObject(record) {
42
- const root = {
43
- count: 0,
44
- path: '/',
45
- children: {},
46
- };
47
- Object.keys(record).forEach((key) => {
48
- const fragment = record[key];
49
- if (fragment.path === '/') {
50
- return;
51
- }
52
- const pathParts = fragment.path.substring(1).split('/');
53
- let currentRoot = root;
54
- let currentPath = '';
55
- pathParts.forEach((part, index) => {
56
- const nextPath = `${currentPath}/${part}`;
57
- if (!currentRoot.children[nextPath]) {
58
- currentRoot.children[nextPath] = {
59
- count: 0,
60
- path: nextPath,
61
- children: {},
62
- };
63
- }
64
- if (index === pathParts.length - 1) {
65
- currentRoot.children[nextPath].count = fragment.count;
66
- }
67
- currentPath = nextPath;
68
- currentRoot = currentRoot.children[nextPath];
69
- });
70
- });
71
- return root;
72
- }
73
- function objectToFacet(childObject) {
74
- const transformed = {
75
- count: childObject.count,
76
- path: childObject.path,
77
- children: [],
78
- };
79
- if (Object.keys(childObject.children).length > 0) {
80
- transformed.children = Object.values(childObject.children).map((subChildObject) => objectToFacet(subChildObject));
81
- }
82
- return transformed;
83
- }
84
- /**
85
- * Filters records with the parent paths from record2 OUT of record1
86
- */
87
- function filterRecordByParentPaths(record1, record2) {
88
- // Extract all paths (keys) both records
89
- const paths1 = Object.keys(record1);
90
- const paths2 = Object.keys(record2);
91
- // Find all parent paths in record2
92
- const parentPaths = new Set(paths2
93
- .filter((path) => path.split('/').length > 2) // Only consider paths with more than one level
94
- .map((path) => path.substring(0, path.lastIndexOf('/'))));
95
- // Filter out keys in record1 that share a parent path with any of the identified parent paths
96
- const filteredRecord = Object.fromEntries(paths1
97
- .filter((path) => !parentPaths.has(path.substring(0, path.lastIndexOf('/'))))
98
- .map((path) => [path, record1[path]]));
99
- return filteredRecord;
100
- }
101
- function mergeFacetRoots(fieldName, currentRoot, incomingRoot) {
102
- const currentArray = currentRoot[fieldName];
103
- const incomingArray = incomingRoot[fieldName];
104
- const currentRootFacetChild = {
105
- count: 0,
106
- path: '/',
107
- children: currentArray,
108
- };
109
- const incomingRootFacetChild = {
110
- count: 0,
111
- path: '/',
112
- children: incomingArray,
113
- };
114
- // Flatten them into records
115
- const currentRecord = facetToRecord(currentRootFacetChild);
116
- const incomingRecord = facetToRecord(incomingRootFacetChild);
117
- // Filter out the records from record1 (the current set of records)
118
- // that share a parent path with record2 (the incoming records)
119
- const filteredCurrentRecord = filterRecordByParentPaths(currentRecord, incomingRecord);
120
- // Deep merge the records together
121
- const mergedRecord = deepMergeWithSpread(filteredCurrentRecord, incomingRecord);
122
- // Convert into a heirarchical object
123
- const mergedObject = recordToObject(mergedRecord);
124
- // Convert the heirarchical object back to the Facet child structure
125
- const mergedFacetChild = objectToFacet(mergedObject);
126
- return {
127
- [fieldName]: mergedFacetChild.children,
128
- };
129
- }
130
-
131
- const searchcraftFacetListModuleCss = ":root{--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px;--sc-popover-form-border-radius:8px;--sc-popover-list-view-height:400px;--sc-popover-list-item-image-size:60px;--sc-popover-list-item-padding-horizontal:8px;--sc-popover-list-item-padding-vertical:8px;--sc-popover-modal-max-width:570px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}:root{--sc-breakpoint-sm:576px;--sc-breakpoint-md:768px;--sc-breakpoint-lg:992px}.filtersListContainer{width:100%}.filterCheckboxLabel{align-items:center;color:var(--sc-content-primary);display:flex;font-family:var(--sc-font-family);font-size:14px;font-weight:600;gap:14px;position:relative;-webkit-font-smoothing:antialiased}.filterCheckboxLabel input[type=checkbox]{align-items:center;appearance:none;background-color:var(--sc-surface-brand-secondary-hover);border:1px solid var(--sc-surface-disabled);border-radius:8px;cursor:pointer;display:flex;height:24px;justify-content:center;width:24px}.filterCheckboxLabel input[type=checkbox]:focus{outline:2px solid var(--sc-surface-brand-primary)}.filterCheckboxLabel input[type=checkbox]:checked{background-color:var(--sc-surface-brand-primary);position:relative}.filterCheckboxLabel input[type=checkbox]:checked+.checkContainer{display:block}.filterCheckboxLabel input[type=checkbox]:checked+.dashContainer{display:block}.childFilterCheckboxLabel{align-items:center;color:var(--sc-content-primary);display:flex;font-family:var(--sc-font-family);font-size:14px;font-weight:600;gap:12px;margin-left:24px;position:relative}.childFilterCheckboxLabel input[type=checkbox]{align-items:center;appearance:none;background-color:var(--sc-surface-brand-secondary-hover);border:1px solid var(--sc-surface-disabled);border-radius:8px;cursor:pointer;display:flex;height:24px;justify-content:center;position:relative;width:24px;-webkit-font-smoothing:antialiased}.childFilterCheckboxLabel input[type=checkbox]:focus{outline:2px solid var(--sc-surface-brand-primary)}.childFilterCheckboxLabel input[type=checkbox]:checked{background-color:var(--sc-surface-brand-primary);position:relative}.childFilterCheckboxLabel input[type=checkbox]:checked+.checkContainer{display:block}.childFilterCheckboxLabel input[type=checkbox]:checked+.dashContainer{display:block}.checkContainer{display:none;height:16px;width:16px;position:absolute;top:9px;left:8px}.dashContainer{display:none;height:3px;width:14px;position:absolute;top:3px;left:9px}.searchcraft-facet-message{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-body-small-font-weight);line-height:var(--sc-body-small-line-height);color:var(--sc-content-disabled);text-align:center}";
132
- const SearchcraftFacetListStyle0 = searchcraftFacetListModuleCss;
133
-
134
- const SearchcraftFacetList = /*@__PURE__*/ proxyCustomElement(class SearchcraftFacetList extends H {
135
- constructor() {
136
- super();
137
- this.__registerHost();
138
- this.facetSelectionUpdated = createEvent(this, "facetSelectionUpdated", 7);
139
- this.selectedPaths = {};
140
- this.hasNewSearchTerm = false;
141
- this.searchStore = useSearchcraftStore.getState();
142
- this.formatLabel = (facetChild) => {
143
- const label = facetChild.path.replace(/^\//, '');
144
- const count = facetChild.count;
145
- return `${label.replace(/-/g, ' ').replace(/\b\w/g, (char) => char.toUpperCase())} (${count})`;
146
- };
147
- this.formatSubLabel = (facetChild, facetChildAncestor) => {
148
- const facetChildPath = facetChild.path.substring(facetChildAncestor.path.length);
149
- const label = facetChildPath.replace(/^\//, '');
150
- const count = facetChild.count;
151
- return `${label.replace(/-/g, ' ').replace(/\b\w/g, (char) => char.toUpperCase())} (${count})`;
152
- };
153
- }
154
- handleStateUpdate(state) {
155
- var _a, _b;
156
- const facetPrime = (_a = state.searchResults) === null || _a === void 0 ? void 0 : _a.data.facets;
157
- const timeTaken = (_b = state.searchResults) === null || _b === void 0 ? void 0 : _b.data.time_taken;
158
- /** Things to do when the state's search term has changed, but before the response received */
159
- if (state.query !== this.lastQuery ||
160
- state.searchMode !== this.lastSearchMode ||
161
- state.sortType !== this.lastSortType) {
162
- this.selectedPaths = {};
163
- this.hasNewSearchTerm = true;
164
- }
165
- /** Things to do when a new response with a new facet prime has been received */
166
- if (timeTaken !== this.lastTimeTaken && facetPrime) {
167
- this.facetRoot = undefined;
168
- const incomingFacetRoot = facetPrime.find((facet) => this.fieldName === Object.keys(facet)[0]);
169
- /** Data is from a new search term: completely override our facets */
170
- if (this.hasNewSearchTerm) {
171
- this.baseFacetRoot = incomingFacetRoot;
172
- this.facetRoot = incomingFacetRoot;
173
- this.hasNewSearchTerm = false;
174
- }
175
- else if (this.baseFacetRoot) {
176
- /** Data is from an existing search term, merge the facets together */
177
- this.facetRoot = mergeFacetRoots(this.fieldName, this.baseFacetRoot, incomingFacetRoot);
178
- }
179
- }
180
- this.lastQuery = state.query;
181
- this.lastSearchMode = state.searchMode;
182
- this.lastSortType = state.sortType;
183
- this.lastTimeTaken = timeTaken;
184
- }
185
- connectedCallback() {
186
- this.handleStateUpdate(this.searchStore);
187
- this.unsubscribe = useSearchcraftStore.subscribe((state) => {
188
- this.handleStateUpdate(state);
189
- });
190
- }
191
- disconnectedCallback() {
192
- var _a;
193
- (_a = this.unsubscribe) === null || _a === void 0 ? void 0 : _a.call(this);
194
- }
195
- handleCheckboxChange(path) {
196
- const isCheckboxChecked = !this.selectedPaths[path];
197
- if (isCheckboxChecked) {
198
- /**
199
- * Checkbox Checked: Add to the selectedPaths record
200
- * Uses spread operator here so UI updates.
201
- */
202
- this.selectedPaths = Object.assign(Object.assign({}, this.selectedPaths), { [path]: true });
203
- }
204
- else {
205
- /**
206
- * Checkbox Uncheck: Remove any paths and sub-paths
207
- */
208
- const updatedPaths = Object.keys(this.selectedPaths).filter((testPath) => !testPath.includes(path));
209
- this.selectedPaths = updatedPaths.reduce((acc, str) => {
210
- acc[str] = true;
211
- return acc;
212
- }, {});
213
- }
214
- /**
215
- * Emit the paths array, with parent paths removed.
216
- */
217
- const paths = Object.keys(this.selectedPaths).filter((path) => this.selectedPaths[path]);
218
- const pathsWithParentPathsRemoved = removeSubstringMatches(paths);
219
- this.facetSelectionUpdated.emit({ paths: pathsWithParentPathsRemoved });
220
- }
221
- render() {
222
- var _a;
223
- const firstFacet = (_a = this.facetRoot) === null || _a === void 0 ? void 0 : _a[this.fieldName];
224
- return (h("div", { key: '709834d9f86b75257ae0c67e9340c0fea4131035', class: classNames('filtersListContainer', 'searchcraft-filters-list-container') }, !firstFacet && (h("p", { key: 'a6e2ced40fcc0762ae8ea835c9d6c573aceeb1f1', class: 'searchcraft-facet-message' }, "Enter a search to view facets.")), firstFacet === null || firstFacet === void 0 ? void 0 :
225
- firstFacet.map((facetChild) => {
226
- var _a;
227
- const isChildSelected = facetChild.children
228
- ? (_a = facetChild.children) === null || _a === void 0 ? void 0 : _a.some((child) => this.selectedPaths[child.path])
229
- : false;
230
- return (h("div", { key: facetChild.path, class: classNames('searchcraft-filters-list-item') }, h("label", { class: classNames('filterCheckboxLabel', 'searchcraft-filters-list-checkbox-label') }, h("input", { checked: this.selectedPaths[facetChild.path], onChange: (_event) => this.handleCheckboxChange(facetChild.path), type: 'checkbox' }), isChildSelected ? (h("div", { class: classNames('dashContainer', 'searchcraft-filter-list-dash-container') }, h("searchcraft-dash-icon", null))) : (h("div", { class: classNames('checkContainer', 'searchcraft-filter-list-check-container') }, h("searchcraft-check-icon", null))), this.formatLabel(facetChild)), facetChild.children && facetChild.children.length > 0 && (h(Fragment, null, facetChild.children.map((grandchild) => (h("label", { key: grandchild.path, class: classNames('childFilterCheckboxLabel', 'searchcraft-child-filter-checkbox-label'), style: {
231
- display: this.selectedPaths[facetChild.path]
232
- ? 'flex'
233
- : 'none',
234
- } }, h("input", { checked: this.selectedPaths[grandchild.path], onChange: (_event) => {
235
- this.handleCheckboxChange(grandchild.path);
236
- }, type: 'checkbox' }), h("div", { class: classNames('checkContainer', 'searchcraft-filter-list-check-container') }, h("searchcraft-check-icon", null)), this.formatSubLabel(grandchild, facetChild))))))));
237
- })));
238
- }
239
- static get style() { return SearchcraftFacetListStyle0; }
240
- }, [0, "searchcraft-facet-list", {
241
- "fieldName": [1, "field-name"],
242
- "baseFacetRoot": [32],
243
- "facetRoot": [32],
244
- "selectedPaths": [32],
245
- "lastTimeTaken": [32],
246
- "hasNewSearchTerm": [32],
247
- "lastQuery": [32],
248
- "lastSearchMode": [32],
249
- "lastSortType": [32],
250
- "unsubscribe": [32]
251
- }]);
252
- function defineCustomElement() {
253
- if (typeof customElements === "undefined") {
254
- return;
255
- }
256
- const components = ["searchcraft-facet-list"];
257
- components.forEach(tagName => { switch (tagName) {
258
- case "searchcraft-facet-list":
259
- if (!customElements.get(tagName)) {
260
- customElements.define(tagName, SearchcraftFacetList);
261
- }
262
- break;
263
- } });
264
- }
265
-
266
- export { SearchcraftFacetList as S, defineCustomElement as d };
267
-
268
- //# sourceMappingURL=p-649654b5.js.map
@@ -1 +0,0 @@
1
- {"file":"p-649654b5.js","mappings":";;;;AAMA,SAAS,mBAAmB,CAAC,IAAI,EAAE,IAAI;IACrC,MAAM,MAAM,qBAAQ,IAAI,CAAE,CAAC;IAE3B,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;;QAEtB,IAAI,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;YAC5B,IAAI,IAAI,CAAC,GAAG,CAAC,YAAY,MAAM,IAAI,IAAI,CAAC,GAAG,CAAC,YAAY,MAAM,EAAE;gBAC9D,MAAM,CAAC,GAAG,CAAC,GAAG,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;aACzD;iBAAM;gBACL,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;aACzB;SACF;KACF;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;SAGgB,sBAAsB,CAAC,GAAa;IAClD,OAAO,GAAG,CAAC,MAAM,CACf,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,KAClB,CAAC,KAAK,CAAC,IAAI,CACT,CAAC,UAAU,EAAE,UAAU,KACrB,UAAU,KAAK,KAAK,IAAI,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CACrD,CACJ,CAAC;AACJ,CAAC;AAOD,SAAS,aAAa,CAAC,KAAiB;IACtC,MAAM,OAAO,GAAuC,EAAE,CAAC;IAEvD,MAAM,yBAAyB,GAAG,CAAC,UAAsB;;QACvD,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG;YACzB,KAAK,EAAE,UAAU,CAAC,KAAK;YACvB,IAAI,EAAE,UAAU,CAAC,IAAI;SACtB,CAAC;QAEF,MAAA,UAAU,CAA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1C,IAED,iCAA0B,CACtB,EACL,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,UAAU,CAAC,CACtC,CACT,CAAC,CACO,CACZ,CACG,EACN;aACH,CAAC,CACE,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/utils/facets.ts","src/components/searchcraft-facet-list/searchcraft-facet-list.module.scss?tag=searchcraft-facet-list","src/components/searchcraft-facet-list/searchcraft-facet-list.tsx"],"sourcesContent":["import type {\n FacetChild,\n FacetChildObject,\n FacetRoot,\n} from '@searchcraft/core';\n\nfunction deepMergeWithSpread(obj1, obj2) {\n const result = { ...obj1 };\n\n for (const key in obj2) {\n // biome-ignore lint/suspicious/noPrototypeBuiltins: <explanation>\n if (obj2.hasOwnProperty(key)) {\n if (obj2[key] instanceof Object && obj1[key] instanceof Object) {\n result[key] = deepMergeWithSpread(obj1[key], obj2[key]);\n } else {\n result[key] = obj2[key];\n }\n }\n }\n\n return result;\n}\n\n/**\n * Given an array of facet paths, removes parent facet paths.\n */\nexport function removeSubstringMatches(arr: string[]): string[] {\n return arr.filter(\n (entry, index, array) =>\n !array.some(\n (otherEntry, otherIndex) =>\n otherIndex !== index && otherEntry.includes(entry),\n ),\n );\n}\n\ntype FacetChildFragment = {\n count: number;\n path: string;\n};\n\nfunction facetToRecord(facet: FacetChild): Record<string, FacetChildFragment> {\n const records: Record<string, FacetChildFragment> = {};\n\n const traverseAndAddToFragments = (facetChild: FacetChild) => {\n records[facetChild.path] = {\n count: facetChild.count,\n path: facetChild.path,\n };\n\n facetChild.children?.forEach((child) => {\n traverseAndAddToFragments(child);\n });\n };\n\n traverseAndAddToFragments(facet);\n\n return records;\n}\n\nfunction recordToObject(\n record: Record<string, FacetChildFragment>,\n): FacetChildObject {\n const root: FacetChildObject = {\n count: 0,\n path: '/',\n children: {},\n };\n\n Object.keys(record).forEach((key) => {\n const fragment = record[key];\n if (fragment.path === '/') {\n return;\n }\n const pathParts = fragment.path.substring(1).split('/');\n let currentRoot = root;\n let currentPath = '';\n\n pathParts.forEach((part, index) => {\n const nextPath = `${currentPath}/${part}`;\n if (!currentRoot.children[nextPath]) {\n currentRoot.children[nextPath] = {\n count: 0,\n path: nextPath,\n children: {},\n };\n }\n\n if (index === pathParts.length - 1) {\n currentRoot.children[nextPath].count = fragment.count;\n }\n\n currentPath = nextPath;\n currentRoot = currentRoot.children[nextPath];\n });\n });\n\n return root;\n}\n\nfunction objectToFacet(childObject: FacetChildObject): FacetChild {\n const transformed: FacetChild = {\n count: childObject.count,\n path: childObject.path,\n children: [],\n };\n\n if (Object.keys(childObject.children).length > 0) {\n transformed.children = Object.values(childObject.children).map(\n (subChildObject) => objectToFacet(subChildObject),\n );\n }\n\n return transformed;\n}\n\n/**\n * Filters records with the parent paths from record2 OUT of record1\n */\nfunction filterRecordByParentPaths(\n record1: Record<string, FacetChild>,\n record2: Record<string, FacetChild>,\n): Record<string, FacetChild> {\n // Extract all paths (keys) both records\n const paths1 = Object.keys(record1);\n const paths2 = Object.keys(record2);\n\n // Find all parent paths in record2\n const parentPaths = new Set(\n paths2\n .filter((path) => path.split('/').length > 2) // Only consider paths with more than one level\n .map((path) => path.substring(0, path.lastIndexOf('/'))),\n );\n\n // Filter out keys in record1 that share a parent path with any of the identified parent paths\n const filteredRecord = Object.fromEntries(\n paths1\n .filter(\n (path) => !parentPaths.has(path.substring(0, path.lastIndexOf('/'))),\n )\n .map((path) => [path, record1[path]]), // Reconstruct the key-value pairs\n );\n\n return filteredRecord;\n}\n\nexport function mergeFacetRoots(\n fieldName: string,\n currentRoot: FacetRoot,\n incomingRoot: FacetRoot,\n): FacetRoot {\n const currentArray = currentRoot[fieldName];\n const incomingArray = incomingRoot[fieldName];\n\n const currentRootFacetChild: FacetChild = {\n count: 0,\n path: '/',\n children: currentArray,\n };\n\n const incomingRootFacetChild: FacetChild = {\n count: 0,\n path: '/',\n children: incomingArray,\n };\n\n // Flatten them into records\n const currentRecord: Record<string, FacetChildFragment> = facetToRecord(\n currentRootFacetChild,\n );\n\n const incomingRecord: Record<string, FacetChildFragment> = facetToRecord(\n incomingRootFacetChild,\n );\n\n // Filter out the records from record1 (the current set of records)\n // that share a parent path with record2 (the incoming records)\n const filteredCurrentRecord = filterRecordByParentPaths(\n currentRecord,\n incomingRecord,\n );\n\n // Deep merge the records together\n const mergedRecord: Record<string, FacetChildFragment> = deepMergeWithSpread(\n filteredCurrentRecord,\n incomingRecord,\n );\n\n // Convert into a heirarchical object\n const mergedObject: FacetChildObject = recordToObject(mergedRecord);\n\n // Convert the heirarchical object back to the Facet child structure\n const mergedFacetChild = objectToFacet(mergedObject);\n\n return {\n [fieldName]: mergedFacetChild.children,\n };\n}\n",".filtersListContainer {\n width: 100%;\n}\n\n.filterCheckboxLabel {\n align-items: center;\n color: var(--sc-content-primary);\n display: flex;\n font-family: var(--sc-font-family);\n font-size: 14px;\n font-weight: 600;\n gap: 14px;\n position: relative;\n -webkit-font-smoothing: antialiased;\n}\n\n.filterCheckboxLabel input[type=\"checkbox\"] {\n align-items: center;\n appearance: none;\n background-color: var(--sc-surface-brand-secondary-hover);\n border: 1px solid var(--sc-surface-disabled);\n border-radius: 8px;\n cursor: pointer;\n display: flex;\n height: 24px;\n justify-content: center;\n width: 24px;\n}\n\n.filterCheckboxLabel input[type=\"checkbox\"]:focus {\n outline: 2px solid var(--sc-surface-brand-primary);\n}\n\n.filterCheckboxLabel input[type=\"checkbox\"]:checked {\n background-color: var(--sc-surface-brand-primary);\n position: relative;\n}\n\n.filterCheckboxLabel input[type=\"checkbox\"]:checked + .checkContainer {\n display: block;\n}\n\n.filterCheckboxLabel input[type=\"checkbox\"]:checked + .dashContainer {\n display: block;\n}\n\n.childFilterCheckboxLabel {\n align-items: center;\n color: var(--sc-content-primary);\n display: flex;\n font-family: var(--sc-font-family);\n font-size: 14px;\n font-weight: 600;\n gap: 12px;\n margin-left: 24px;\n position: relative;\n}\n\n.childFilterCheckboxLabel input[type=\"checkbox\"] {\n align-items: center;\n appearance: none;\n background-color: var(--sc-surface-brand-secondary-hover);\n border: 1px solid var(--sc-surface-disabled);\n border-radius: 8px;\n cursor: pointer;\n display: flex;\n height: 24px;\n justify-content: center;\n position: relative;\n width: 24px;\n -webkit-font-smoothing: antialiased;\n}\n\n.childFilterCheckboxLabel input[type=\"checkbox\"]:focus {\n outline: 2px solid var(--sc-surface-brand-primary);\n}\n\n.childFilterCheckboxLabel input[type=\"checkbox\"]:checked {\n background-color: var(--sc-surface-brand-primary);\n position: relative;\n}\n\n.childFilterCheckboxLabel input[type=\"checkbox\"]:checked + .checkContainer {\n display: block;\n}\n\n.childFilterCheckboxLabel input[type=\"checkbox\"]:checked + .dashContainer {\n display: block;\n}\n\n.checkContainer {\n display: none;\n height: 16px;\n width: 16px;\n position: absolute;\n top: 9px;\n left: 8px;\n}\n\n.dashContainer {\n display: none;\n height: 3px;\n width: 14px;\n position: absolute;\n top: 3px;\n left: 9px;\n}\n\n.searchcraft-facet-message {\n @include body-small();\n color: var(--sc-content-disabled);\n text-align: center;\n}","import {\n Component,\n h,\n State,\n Prop,\n Event,\n type EventEmitter,\n Fragment,\n} from '@stencil/core';\nimport classNames from 'classnames';\n\nimport type { FacetChild, FacetRoot } from '@searchcraft/core';\n\nimport { useSearchcraftStore, type SearchcraftState } from '@provider/store';\nimport { mergeFacetRoots, removeSubstringMatches } from '@utils';\n\n/**\n * This web component is designed to display facets in a search interface, allowing users to refine their search results by applying filters based on various attributes.\n * It is consumed within the `searchcraft-filter-panel`.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-facet-list field-name=\"title\" />\n * ```\n *\n * ```js\n * // index.js\n * const facetList = document.querySelector('searchcraft-facet-list');\n *\n * facetList.addEventListener('facetSelectionUpdated', () => {\n * console.log('Facet selection updated');\n * });\n * ```\n */\n@Component({\n tag: 'searchcraft-facet-list',\n styleUrl: 'searchcraft-facet-list.module.scss',\n shadow: false,\n})\nexport class SearchcraftFacetList {\n /**\n * The name of the field where facets are applied.\n */\n @Prop() fieldName: string;\n\n /**\n * When the facets are updated.\n */\n @Event() facetSelectionUpdated: EventEmitter<{ paths: string[] }>;\n\n @State() baseFacetRoot: FacetRoot | undefined;\n @State() facetRoot: FacetRoot | undefined;\n @State() selectedPaths: Record<string, boolean> = {};\n @State() lastTimeTaken: number | undefined;\n @State() hasNewSearchTerm = false;\n\n @State() lastQuery: string | undefined;\n @State() lastSearchMode: string | undefined;\n @State() lastSortType: string | undefined;\n\n @State() unsubscribe: (() => void) | undefined;\n\n private searchStore = useSearchcraftStore.getState();\n\n handleStateUpdate(state: SearchcraftState) {\n const facetPrime = state.searchResults?.data.facets;\n const timeTaken = state.searchResults?.data.time_taken;\n\n /** Things to do when the state's search term has changed, but before the response received */\n if (\n state.query !== this.lastQuery ||\n state.searchMode !== this.lastSearchMode ||\n state.sortType !== this.lastSortType\n ) {\n this.selectedPaths = {};\n this.hasNewSearchTerm = true;\n }\n\n /** Things to do when a new response with a new facet prime has been received */\n if (timeTaken !== this.lastTimeTaken && facetPrime) {\n this.facetRoot = undefined;\n const incomingFacetRoot: FacetRoot = facetPrime.find(\n (facet) => this.fieldName === Object.keys(facet)[0],\n );\n\n /** Data is from a new search term: completely override our facets */\n if (this.hasNewSearchTerm) {\n this.baseFacetRoot = incomingFacetRoot;\n this.facetRoot = incomingFacetRoot;\n this.hasNewSearchTerm = false;\n } else if (this.baseFacetRoot) {\n /** Data is from an existing search term, merge the facets together */\n this.facetRoot = mergeFacetRoots(\n this.fieldName,\n this.baseFacetRoot,\n incomingFacetRoot,\n );\n }\n }\n\n this.lastQuery = state.query;\n this.lastSearchMode = state.searchMode;\n this.lastSortType = state.sortType;\n this.lastTimeTaken = timeTaken;\n }\n\n connectedCallback() {\n this.handleStateUpdate(this.searchStore);\n\n this.unsubscribe = useSearchcraftStore.subscribe((state) => {\n this.handleStateUpdate(state);\n });\n }\n\n disconnectedCallback() {\n this.unsubscribe?.();\n }\n\n handleCheckboxChange(path: string) {\n const isCheckboxChecked = !this.selectedPaths[path];\n\n if (isCheckboxChecked) {\n /**\n * Checkbox Checked: Add to the selectedPaths record\n * Uses spread operator here so UI updates.\n */\n this.selectedPaths = {\n ...this.selectedPaths,\n [path]: true,\n };\n } else {\n /**\n * Checkbox Uncheck: Remove any paths and sub-paths\n */\n const updatedPaths = Object.keys(this.selectedPaths).filter(\n (testPath) => !testPath.includes(path),\n );\n\n this.selectedPaths = updatedPaths.reduce(\n (acc, str) => {\n acc[str] = true;\n return acc;\n },\n {} as Record<string, boolean>,\n );\n }\n\n /**\n * Emit the paths array, with parent paths removed.\n */\n const paths = Object.keys(this.selectedPaths).filter(\n (path) => this.selectedPaths[path],\n );\n const pathsWithParentPathsRemoved = removeSubstringMatches(paths);\n\n this.facetSelectionUpdated.emit({ paths: pathsWithParentPathsRemoved });\n }\n\n formatLabel = (facetChild: FacetChild): string => {\n const label = facetChild.path.replace(/^\\//, '');\n const count = facetChild.count;\n return `${label.replace(/-/g, ' ').replace(/\\b\\w/g, (char) => char.toUpperCase())} (${count})`;\n };\n\n formatSubLabel = (\n facetChild: FacetChild,\n facetChildAncestor: FacetChild,\n ): string => {\n const facetChildPath = facetChild.path.substring(\n facetChildAncestor.path.length,\n );\n const label = facetChildPath.replace(/^\\//, '');\n const count = facetChild.count;\n return `${label.replace(/-/g, ' ').replace(/\\b\\w/g, (char) => char.toUpperCase())} (${count})`;\n };\n\n render() {\n const firstFacet = this.facetRoot?.[this.fieldName];\n\n return (\n <div\n class={classNames(\n 'filtersListContainer',\n 'searchcraft-filters-list-container',\n )}\n >\n {!firstFacet && (\n <p class='searchcraft-facet-message'>\n Enter a search to view facets.\n </p>\n )}\n {firstFacet?.map((facetChild: FacetChild) => {\n const isChildSelected = facetChild.children\n ? facetChild.children?.some(\n (child) => this.selectedPaths[child.path],\n )\n : false;\n\n return (\n <div\n key={facetChild.path}\n class={classNames('searchcraft-filters-list-item')}\n >\n <label\n class={classNames(\n 'filterCheckboxLabel',\n 'searchcraft-filters-list-checkbox-label',\n )}\n >\n <input\n checked={this.selectedPaths[facetChild.path]}\n onChange={(_event: Event) =>\n this.handleCheckboxChange(facetChild.path)\n }\n type='checkbox'\n />\n {isChildSelected ? (\n <div\n class={classNames(\n 'dashContainer',\n 'searchcraft-filter-list-dash-container',\n )}\n >\n <searchcraft-dash-icon />\n </div>\n ) : (\n <div\n class={classNames(\n 'checkContainer',\n 'searchcraft-filter-list-check-container',\n )}\n >\n <searchcraft-check-icon />\n </div>\n )}\n {this.formatLabel(facetChild)}\n </label>\n {facetChild.children && facetChild.children.length > 0 && (\n <Fragment>\n {facetChild.children.map((grandchild) => (\n <label\n key={grandchild.path}\n class={classNames(\n 'childFilterCheckboxLabel',\n 'searchcraft-child-filter-checkbox-label',\n )}\n style={{\n display: this.selectedPaths[facetChild.path]\n ? 'flex'\n : 'none',\n }}\n >\n <input\n checked={this.selectedPaths[grandchild.path]}\n onChange={(_event: Event) => {\n this.handleCheckboxChange(grandchild.path);\n }}\n type='checkbox'\n />\n <div\n class={classNames(\n 'checkContainer',\n 'searchcraft-filter-list-check-container',\n )}\n >\n <searchcraft-check-icon />\n </div>\n {this.formatSubLabel(grandchild, facetChild)}\n </label>\n ))}\n </Fragment>\n )}\n </div>\n );\n })}\n </div>\n );\n }\n}\n"],"version":3}
@@ -1,67 +0,0 @@
1
- import { p as proxyCustomElement, H, c as createEvent, h } from './p-6cafd48d.js';
2
- import { u as useSearchcraftStore } from './p-01dc5b3b.js';
3
- import { c as classNames } from './p-5cdc6210.js';
4
-
5
- const searchcraftToggleButtonModuleCss = ":root{--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px;--sc-popover-form-border-radius:8px;--sc-popover-list-view-height:400px;--sc-popover-list-item-image-size:60px;--sc-popover-list-item-padding-horizontal:8px;--sc-popover-list-item-padding-vertical:8px;--sc-popover-modal-max-width:570px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}:root{--sc-breakpoint-sm:576px;--sc-breakpoint-md:768px;--sc-breakpoint-lg:992px}.searchcraft-toggle-button-container{display:flex;justify-content:space-between;align-items:flex-start;gap:10px}.searchcraft-toggle-button-label{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-body-font-weight);line-height:var(--sc-body-line-height);margin:0;color:var(--sc-content-neutral-primary)}.searchcraft-toggle-button-sub-label{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-body-small-font-weight);line-height:var(--sc-body-small-line-height);margin:0;color:var(--sc-content-neutral-secondary)}.searchcraft-toggle-button-background{transition:background-color 0.2s;background:var(--sc-surface-disabled);border:none;border-radius:16px;cursor:pointer;height:26px;position:relative;width:44px;flex-shrink:0}.searchcraft-toggle-button-background.active{background:var(--sc-surface-brand-primary);box-shadow:0px 0px 0px 1px rgba(0, 0, 0, 0.05)}.searchcraft-toggle-button-handle{background:var(--sc-surface-neutral-light);border-radius:50%;height:18px;left:4px;position:absolute;top:calc(50% - 9px);transition:transform 0.3s ease;width:18px}.searchcraft-toggle-button-handle.active{transform:translateX(16px)}";
6
- const SearchcraftToggleButtonStyle0 = searchcraftToggleButtonModuleCss;
7
-
8
- const SearchcraftToggleButton = /*@__PURE__*/ proxyCustomElement(class SearchcraftToggleButton extends H {
9
- constructor() {
10
- super();
11
- this.__registerHost();
12
- this.toggleUpdated = createEvent(this, "toggleUpdated", 7);
13
- /**
14
- * The label.
15
- */
16
- this.label = 'Toggle';
17
- this.isActive = false;
18
- this.handleToggle = async () => {
19
- this.isActive = !this.isActive;
20
- this.toggleUpdated.emit(this.isActive);
21
- };
22
- }
23
- connectedCallback() {
24
- /** When the query changes, sets toggle button state back to inactive. */
25
- this.unsubscribe = useSearchcraftStore.subscribe((state) => {
26
- if (state.query !== this.lastQuery && state.query.trim().length === 0) {
27
- this.isActive = false;
28
- }
29
- this.lastQuery = state.query;
30
- });
31
- }
32
- disconnectedCallback() {
33
- var _a;
34
- (_a = this.unsubscribe) === null || _a === void 0 ? void 0 : _a.call(this);
35
- }
36
- render() {
37
- return (h("div", { key: '607bbc1adc109ec918effb25c6b91052227a2f7b', class: 'searchcraft-toggle-button-container' }, h("div", { key: 'b452e1690c617020866f6bf3e591f62cc3fce111' }, h("p", { key: '1bd8fa345516e412ea57bdbeac37dc8e26f2feaa', class: 'searchcraft-toggle-button-label' }, this.label), this.subLabel && (h("p", { key: 'fce324a14721bab5f6173838f677ecb290200c8f', class: 'searchcraft-toggle-button-sub-label' }, this.subLabel))), h("button", { key: '7b293a3ef64da88f463e5e6e303dabcbc63589bd', class: classNames('searchcraft-toggle-button-background', {
38
- active: this.isActive,
39
- }), onClick: this.handleToggle, type: 'button' }, h("div", { key: '6afd68afeea5bb15ce1bde486ac59f7a958f6752', class: classNames('searchcraft-toggle-button-handle', {
40
- active: this.isActive,
41
- }) }))));
42
- }
43
- static get style() { return SearchcraftToggleButtonStyle0; }
44
- }, [0, "searchcraft-toggle-button", {
45
- "label": [1],
46
- "subLabel": [1, "sub-label"],
47
- "isActive": [32],
48
- "unsubscribe": [32],
49
- "lastQuery": [32]
50
- }]);
51
- function defineCustomElement() {
52
- if (typeof customElements === "undefined") {
53
- return;
54
- }
55
- const components = ["searchcraft-toggle-button"];
56
- components.forEach(tagName => { switch (tagName) {
57
- case "searchcraft-toggle-button":
58
- if (!customElements.get(tagName)) {
59
- customElements.define(tagName, SearchcraftToggleButton);
60
- }
61
- break;
62
- } });
63
- }
64
-
65
- export { SearchcraftToggleButton as S, defineCustomElement as d };
66
-
67
- //# sourceMappingURL=p-662cb490.js.map
@@ -1 +0,0 @@
1
- {"file":"p-662cb490.js","mappings":";;;;AAAA,MAAM,gCAAgC,GAAG,0jJAA0jJ,CAAC;AACpmJ,sCAAe,gCAAgC;;MCmBlC,uBAAuB;IALpC;;;;;;;QASU,UAAK,GAAG,QAAQ,CAAC;QAWhB,aAAQ,GAAG,KAAK,CAAC;QAIlB,iBAAY,GAAG;YACrB,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC;YAC/B,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SACxC,CAAC;KAyCH;IAvCC,iBAAiB;;QAEf,IAAI,CAAC,WAAW,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC,KAAK;YACrD,IAAI,KAAK,CAAC,KAAK,KAAK,IAAI,CAAC,SAAS,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE;gBACrE,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;aACvB;YACD,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC;SAC9B,CAAC,CAAC;KACJ;IAED,oBAAoB;;QAClB,MAAA,IAAI,CAAC,WAAW,oDAAI,CAAC;KACtB;IAED,MAAM;QACJ,QACE,4DAAK,KAAK,EAAC,qCAAqC,IAC9C,8DACE,0DAAG,KAAK,EAAC,iCAAiC,IAAE,IAAI,CAAC,KAAK,CAAK,EAC1D,IAAI,CAAC,QAAQ,KACZ,0DAAG,KAAK,EAAC,qCAAqC,IAAE,IAAI,CAAC,QAAQ,CAAK,CACnE,CACG,EACN,+DACE,KAAK,EAAE,UAAU,CAAC,sCAAsC,EAAE;gBACxD,MAAM,EAAE,IAAI,CAAC,QAAQ;aACtB,CAAC,EACF,OAAO,EAAE,IAAI,CAAC,YAAY,EAC1B,IAAI,EAAC,QAAQ,IAEb,4DACE,KAAK,EAAE,UAAU,CAAC,kCAAkC,EAAE;gBACpD,MAAM,EAAE,IAAI,CAAC,QAAQ;aACtB,CAAC,GACF,CACK,CACL,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/searchcraft-toggle-button/searchcraft-toggle-button.module.scss?tag=searchcraft-toggle-button","src/components/searchcraft-toggle-button/searchcraft-toggle-button.tsx"],"sourcesContent":[".searchcraft-toggle-button-container {\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n gap: 10px;\n}\n\n.searchcraft-toggle-button-label {\n @include body();\n margin: 0;\n color: var(--sc-content-neutral-primary);\n}\n\n.searchcraft-toggle-button-sub-label {\n @include body-small();\n margin: 0;\n color: var(--sc-content-neutral-secondary);\n}\n\n.searchcraft-toggle-button-background {\n transition: background-color 0.2s;\n background: var(--sc-surface-disabled);\n border: none;\n border-radius: 16px;\n cursor: pointer;\n height: 26px;\n position: relative;\n width: 44px;\n flex-shrink: 0;\n}\n\n.searchcraft-toggle-button-background.active {\n background: var(--sc-surface-brand-primary);\n box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.05);\n}\n\n.searchcraft-toggle-button-handle {\n background: var(--sc-surface-neutral-light);\n border-radius: 50%;\n height: 18px;\n left: 4px;\n position: absolute;\n top: calc(50% - 18px/2);\n transition: transform 0.3s ease;\n width: 18px;\n}\n\n.searchcraft-toggle-button-handle.active {\n transform: translateX(16px);\n}\n","import { useSearchcraftStore } from '@provider/store';\nimport {\n Component,\n Event,\n h,\n Prop,\n State,\n type EventEmitter,\n} from '@stencil/core';\nimport classNames from 'classnames';\n\n/**\n * This web component simulates a light switch functionality, providing a simple and intuitive toggle between two states—on and off.\n * It is consumed within the `searchcraft-filter-panel` component.\n */\n@Component({\n tag: 'searchcraft-toggle-button',\n styleUrl: 'searchcraft-toggle-button.module.scss',\n shadow: false,\n})\nexport class SearchcraftToggleButton {\n /**\n * The label.\n */\n @Prop() label = 'Toggle';\n /**\n * The secondary label displayed below the main label.\n */\n @Prop() subLabel: string | undefined;\n\n /**\n * When the toggle element is changed.\n */\n @Event() toggleUpdated: EventEmitter<boolean>;\n\n @State() isActive = false;\n @State() unsubscribe: (() => void) | undefined;\n @State() lastQuery: string | undefined;\n\n private handleToggle = async () => {\n this.isActive = !this.isActive;\n this.toggleUpdated.emit(this.isActive);\n };\n\n connectedCallback() {\n /** When the query changes, sets toggle button state back to inactive. */\n this.unsubscribe = useSearchcraftStore.subscribe((state) => {\n if (state.query !== this.lastQuery && state.query.trim().length === 0) {\n this.isActive = false;\n }\n this.lastQuery = state.query;\n });\n }\n\n disconnectedCallback() {\n this.unsubscribe?.();\n }\n\n render() {\n return (\n <div class='searchcraft-toggle-button-container'>\n <div>\n <p class='searchcraft-toggle-button-label'>{this.label}</p>\n {this.subLabel && (\n <p class='searchcraft-toggle-button-sub-label'>{this.subLabel}</p>\n )}\n </div>\n <button\n class={classNames('searchcraft-toggle-button-background', {\n active: this.isActive,\n })}\n onClick={this.handleToggle}\n type='button'\n >\n <div\n class={classNames('searchcraft-toggle-button-handle', {\n active: this.isActive,\n })}\n />\n </button>\n </div>\n );\n }\n}\n"],"version":3}
@@ -1,97 +0,0 @@
1
- import { p as proxyCustomElement, H, h, F as Fragment } from './p-6cafd48d.js';
2
- import { u as useSearchcraftStore } from './p-01dc5b3b.js';
3
-
4
- const searchcraftBaseSearchResultModuleCss = ":root{--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px;--sc-popover-form-border-radius:8px;--sc-popover-list-view-height:400px;--sc-popover-list-item-image-size:60px;--sc-popover-list-item-padding-horizontal:8px;--sc-popover-list-item-padding-vertical:8px;--sc-popover-modal-max-width:570px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}:root{--sc-breakpoint-sm:576px;--sc-breakpoint-md:768px;--sc-breakpoint-lg:992px}.searchcraft-search-result-container{all:unset;align-items:flex-start;border-radius:16px;display:flex;flex-direction:column;gap:16px;padding:8px;color:inherit;background-color:var(--sc-surface-neutral-primary)}@media (min-width: 768px){.searchcraft-search-result-container{flex-direction:row}}a.searchcraft-search-result-container{cursor:pointer;transition:background-color 100ms}.searchcraft-base-search-result-content-container{flex:1;display:flex;flex-direction:column;gap:8px}.searchcraft-search-result-image{border-radius:var(--sc-image-border-radius);width:100%}@media (min-width: 768px){.searchcraft-search-result-image{width:200px}}.searchcraft-base-search-result-title{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-bold-font-size);font-weight:var(--sc-body-bold-font-weight);line-height:var(--sc-body-bold-line-height);margin:0;color:var(--sc-content-neutral-primary)}.searchcraft-base-search-result-subtitle{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-body-small-font-weight);line-height:var(--sc-body-small-line-height);margin:0;color:var(--sc-content-disabled)}.searchcraft-base-search-result-body-content{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-body-font-weight);line-height:var(--sc-body-line-height);margin:0;color:var(--sc-content-neutral-secondary)}.searchcraft-base-search-result-footer-content{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-body-font-weight);line-height:var(--sc-body-line-height);margin:0;color:var(--sc-content-disabled)}";
5
- const SearchcraftBaseSearchResultStyle0 = searchcraftBaseSearchResultModuleCss;
6
-
7
- const SearchcraftBaseSearchResult = /*@__PURE__*/ proxyCustomElement(class SearchcraftBaseSearchResult extends H {
8
- constructor() {
9
- super();
10
- this.__registerHost();
11
- /**
12
- * Where to open the link for the button rendered when containerHref is not present.
13
- */
14
- this.buttonTarget = '_blank';
15
- /**
16
- * Where to open the link for the containing element.
17
- */
18
- this.containerTarget = '_blank';
19
- /**
20
- * The position in the document. Used with the "document_clicked" measure event.
21
- */
22
- this.documentPosition = 0;
23
- this.searchcraftStore = useSearchcraftStore.getState();
24
- this.recordMeasureEvent = () => {
25
- var _a, _b, _c;
26
- const searchcraft = this.searchcraftStore.getSearchcraftInstance();
27
- if (searchcraft) {
28
- const document_position = this.documentPosition;
29
- const search_term = this.searchcraftStore.query;
30
- const number_of_documents = ((_c = (_b = (_a = this.searchcraftStore.searchResults) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.hits) === null || _c === void 0 ? void 0 : _c.length) || 0;
31
- searchcraft.sendMeasureEvent('document_clicked', {
32
- document_position,
33
- number_of_documents,
34
- search_term,
35
- });
36
- }
37
- };
38
- this.parseStyles = () => {
39
- if (this.customStyles) {
40
- try {
41
- return JSON.parse(this.customStyles);
42
- }
43
- catch (error) {
44
- console.error('Error parsing custom styles:', error);
45
- return {};
46
- }
47
- }
48
- return {};
49
- };
50
- }
51
- render() {
52
- const styles = this.parseStyles();
53
- const imageContainer = this.imageSrc && (h("img", { alt: this.imageAlt, class: 'searchcraft-search-result-image', src: this.imageSrc, style: styles.image || {} }));
54
- const contentContainer = (h(Fragment, null, this.imageSrc && this.imagePlacement === 'left' && imageContainer, h("div", { class: 'searchcraft-base-search-result-content-container' }, this.titleContent && (h("h2", { class: 'searchcraft-base-search-result-title', style: styles.title || {} }, this.titleContent)), this.subtitleContent && (h("h3", { class: 'searchcraft-base-search-result-subtitle', style: styles.subtitle || {} }, this.subtitleContent)), this.bodyContent && (h("p", { class: 'searchcraft-base-search-result-body-content', style: styles.primaryContent || {} }, this.bodyContent)), this.footerContent && (h("p", { class: 'searchcraft-base-search-result-footer-content', style: styles.secondaryContent || {} }, this.footerContent)), this.buttonHref && !this.containerHref && this.buttonLabel && (h("a", { class: 'searchcraft-search-result-button', href: this.buttonHref, style: styles.button || {}, target: this.buttonTarget, rel: this.buttonRel }, this.buttonLabel))), this.imageSrc && this.imagePlacement === 'right' && imageContainer));
55
- /** Render as an anchor tag if the containerHref prop is present. */
56
- if (this.containerHref) {
57
- return (h("a", { class: 'searchcraft-search-result-container', onClick: this.recordMeasureEvent, href: this.containerHref, rel: this.containerRel, style: styles.container || {}, tabindex: '0', target: this.containerTarget }, contentContainer));
58
- }
59
- /** Render as a div if no href prop. */
60
- return (h("div", { class: 'searchcraft-search-result-container', style: styles.container || {} }, contentContainer));
61
- }
62
- static get style() { return SearchcraftBaseSearchResultStyle0; }
63
- }, [0, "searchcraft-base-search-result", {
64
- "titleContent": [1, "title-content"],
65
- "subtitleContent": [1, "subtitle-content"],
66
- "bodyContent": [1, "body-content"],
67
- "footerContent": [1, "footer-content"],
68
- "buttonLabel": [1, "button-label"],
69
- "buttonHref": [1, "button-href"],
70
- "buttonTarget": [1, "button-target"],
71
- "buttonRel": [1, "button-rel"],
72
- "containerHref": [1, "container-href"],
73
- "containerTarget": [1, "container-target"],
74
- "containerRel": [1, "container-rel"],
75
- "imageSrc": [1, "image-src"],
76
- "imageAlt": [1, "image-alt"],
77
- "imagePlacement": [1, "image-placement"],
78
- "customStyles": [1, "custom-styles"],
79
- "documentPosition": [2, "document-position"]
80
- }]);
81
- function defineCustomElement() {
82
- if (typeof customElements === "undefined") {
83
- return;
84
- }
85
- const components = ["searchcraft-base-search-result"];
86
- components.forEach(tagName => { switch (tagName) {
87
- case "searchcraft-base-search-result":
88
- if (!customElements.get(tagName)) {
89
- customElements.define(tagName, SearchcraftBaseSearchResult);
90
- }
91
- break;
92
- } });
93
- }
94
-
95
- export { SearchcraftBaseSearchResult as S, defineCustomElement as d };
96
-
97
- //# sourceMappingURL=p-87d1611b.js.map
@@ -1 +0,0 @@
1
- {"file":"p-87d1611b.js","mappings":";;;AAAA,MAAM,oCAAoC,GAAG,6hKAA6hK,CAAC;AAC3kK,0CAAe,oCAAoC;;MCYtC,2BAA2B;IALxC;;;;;;QAiCU,iBAAY,GAA4C,QAAQ,CAAC;;;;QAYjE,oBAAe,GAA4C,QAAQ,CAAC;;;;QAwBpE,qBAAgB,GAAG,CAAC,CAAC;QAErB,qBAAgB,GAAG,mBAAmB,CAAC,QAAQ,EAAE,CAAC;QAElD,uBAAkB,GAAG;;YAC3B,MAAM,WAAW,GAAG,IAAI,CAAC,gBAAgB,CAAC,sBAAsB,EAAE,CAAC;YAEnE,IAAI,WAAW,EAAE;gBACf,MAAM,iBAAiB,GAAG,IAAI,CAAC,gBAAgB,CAAC;gBAChD,MAAM,WAAW,GAAG,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC;gBAChD,MAAM,mBAAmB,GACvB,CAAA,MAAA,MAAA,MAAA,IAAI,CAAC,gBAAgB,CAAC,aAAa,0CAAE,IAAI,0CAAE,IAAI,0CAAE,MAAM,KAAI,CAAC,CAAC;gBAE/D,WAAW,CAAC,gBA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I,CAAC,WAAW,CACf,CACL,EAEA,IAAI,CAAC,aAAa,KACjB,SACE,KAAK,EAAC,+CAA+C,EACrD,KAAK,EAAE,MAAM,CAAC,gBAAgB,IAAI,EAAE,IAEnC,IAAI,CAAC,aAAa,CACjB,CACL,EACA,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,WAAW,KACzD,SACE,KAAK,EAAC,kCAAkC,EACxC,IAAI,EAAE,IAAI,CAAC,UAAU,EACrB,KAAK,EAAE,MAAM,CAAC,MAAM,IAAI,EAAE,EAC1B,MAAM,EAAE,IAAI,CAAC,YAAY,EACzB,GAAG,EAAE,IAAI,CAAC,SAAS,IAElB,IAAI,CAAC,WAAW,CACf,CACL,CACG,EACL,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,cAAc,KAAK,OAAO,IAAI,cAAc,CAC1D,CACZ,CAAC;;QAGF,IAAI,IAAI,CAAC,aAAa,EAAE;YACtB,QACE,SACE,KAAK,EAAC,qCAAqC,EAC3C,OAAO,EAAE,IAAI,CAAC,kBAAkB,EAChC,IAAI,EAAE,IAAI,CAAC,aAAa,EACxB,GAAG,EAAE,IAAI,CAAC,YAAY,EACtB,KAAK,EAAE,MAAM,CAAC,SAAS,IAAI,EAAE,EAC7B,QAAQ,EAAC,GAAG,EACZ,MAAM,EAAE,IAAI,CAAC,eAAe,IAE3B,gBAAgB,CACf,EACJ;SACH;;QAGD,QACE,WACE,KAAK,EAAC,qCAAqC,EAC3C,KAAK,EAAE,MAAM,CAAC,SAAS,IAAI,EAAE,IAE5B,gBAAgB,CACb,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/searchcraft-base-search-result/searchcraft-base-search-result.module.scss?tag=searchcraft-base-search-result","src/components/searchcraft-base-search-result/searchcraft-base-search-result.tsx"],"sourcesContent":["\n.searchcraft-search-result-container {\n all: unset;\n align-items: flex-start;\n border-radius: 16px;\n display: flex;\n flex-direction: column;\n gap: 16px;\n padding: 8px;\n color: inherit;\n\n background-color: var(--sc-surface-neutral-primary);\n\n @media (min-width: $breakpoint-md) {\n flex-direction: row;\n }\n}\n\na.searchcraft-search-result-container {\n cursor: pointer;\n transition: background-color 100ms;\n}\n\n.searchcraft-base-search-result-content-container {\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.searchcraft-search-result-image {\n border-radius: var(--sc-image-border-radius);\n width: 100%;\n\n @media (min-width: $breakpoint-md) {\n width: 200px;\n }\n}\n\n.searchcraft-base-search-result-title {\n @include body-bold();\n margin: 0;\n color: var(--sc-content-neutral-primary);\n}\n\n.searchcraft-base-search-result-subtitle {\n @include body-small();\n margin: 0;\n color: var(--sc-content-disabled);\n}\n\n.searchcraft-base-search-result-body-content {\n @include body();\n margin: 0;\n color: var(--sc-content-neutral-secondary);\n}\n\n.searchcraft-base-search-result-footer-content {\n @include body();\n margin: 0;\n color: var(--sc-content-disabled);\n}\n","import { useSearchcraftStore } from '@provider/store';\nimport { Component, Fragment, h, Prop } from '@stencil/core';\n\n/**\n * This web component is designed to display detailed information for a single search result.\n * Once a query is submitted, the component formats and presents the result.\n * It is consumed within the `searchcraft-base-search-results` component.\n */\n@Component({\n tag: 'searchcraft-base-search-result',\n styleUrl: 'searchcraft-base-search-result.module.scss',\n shadow: false,\n})\nexport class SearchcraftBaseSearchResult {\n /**\n * The title content.\n */\n @Prop() titleContent: string | undefined;\n /**\n * The subtitle content.\n */\n @Prop() subtitleContent: string | undefined;\n /**\n * The body content.\n */\n @Prop() bodyContent: string | undefined;\n /**\n * The footer content.\n */\n @Prop() footerContent: string | undefined;\n /**\n * The label for the button rendered when containerHref is not present.\n */\n @Prop() buttonLabel: string | undefined;\n /**\n * The link for the button rendered when containerHref is not present.\n */\n @Prop() buttonHref: string | undefined;\n /**\n * Where to open the link for the button rendered when containerHref is not present.\n */\n @Prop() buttonTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n /**\n * The relationship between the current document and the link for the button rendered when containerHref is not present.\n */\n @Prop() buttonRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n /**\n * The link for the containing element.\n */\n @Prop() containerHref: string | undefined;\n /**\n * Where to open the link for the containing element.\n */\n @Prop() containerTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n /**\n * The relationship between the current document and the link for the containing element.\n */\n @Prop() containerRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n /**\n * The image source.\n */\n @Prop() imageSrc: string | undefined;\n /**\n * The image alternative text.\n */\n @Prop() imageAlt: string | undefined;\n /**\n * The placement of the image.\n */\n @Prop() imagePlacement: 'left' | 'right';\n /**\n * A custom styles object.\n */\n @Prop() customStyles: string | undefined;\n /**\n * The position in the document. Used with the \"document_clicked\" measure event.\n */\n @Prop() documentPosition = 0;\n\n private searchcraftStore = useSearchcraftStore.getState();\n\n private recordMeasureEvent = () => {\n const searchcraft = this.searchcraftStore.getSearchcraftInstance();\n\n if (searchcraft) {\n const document_position = this.documentPosition;\n const search_term = this.searchcraftStore.query;\n const number_of_documents =\n this.searchcraftStore.searchResults?.data?.hits?.length || 0;\n\n searchcraft.sendMeasureEvent('document_clicked', {\n document_position,\n number_of_documents,\n search_term,\n });\n }\n };\n\n private parseStyles = (): Record<string, { [key: string]: string }> => {\n if (this.customStyles) {\n try {\n return JSON.parse(this.customStyles);\n } catch (error) {\n console.error('Error parsing custom styles:', error);\n return {};\n }\n }\n return {};\n };\n\n render() {\n const styles = this.parseStyles();\n const imageContainer = this.imageSrc && (\n <img\n alt={this.imageAlt}\n class='searchcraft-search-result-image'\n src={this.imageSrc}\n style={styles.image || {}}\n />\n );\n\n const contentContainer = (\n <Fragment>\n {this.imageSrc && this.imagePlacement === 'left' && imageContainer}\n <div class='searchcraft-base-search-result-content-container'>\n {this.titleContent && (\n <h2\n class='searchcraft-base-search-result-title'\n style={styles.title || {}}\n >\n {this.titleContent}\n </h2>\n )}\n {this.subtitleContent && (\n <h3\n class='searchcraft-base-search-result-subtitle'\n style={styles.subtitle || {}}\n >\n {this.subtitleContent}\n </h3>\n )}\n {this.bodyContent && (\n <p\n class='searchcraft-base-search-result-body-content'\n style={styles.primaryContent || {}}\n >\n {this.bodyContent}\n </p>\n )}\n\n {this.footerContent && (\n <p\n class='searchcraft-base-search-result-footer-content'\n style={styles.secondaryContent || {}}\n >\n {this.footerContent}\n </p>\n )}\n {this.buttonHref && !this.containerHref && this.buttonLabel && (\n <a\n class='searchcraft-search-result-button'\n href={this.buttonHref}\n style={styles.button || {}}\n target={this.buttonTarget}\n rel={this.buttonRel}\n >\n {this.buttonLabel}\n </a>\n )}\n </div>\n {this.imageSrc && this.imagePlacement === 'right' && imageContainer}\n </Fragment>\n );\n\n /** Render as an anchor tag if the containerHref prop is present. */\n if (this.containerHref) {\n return (\n <a\n class='searchcraft-search-result-container'\n onClick={this.recordMeasureEvent}\n href={this.containerHref}\n rel={this.containerRel}\n style={styles.container || {}}\n tabindex='0'\n target={this.containerTarget}\n >\n {contentContainer}\n </a>\n );\n }\n\n /** Render as a div if no href prop. */\n return (\n <div\n class='searchcraft-search-result-container'\n style={styles.container || {}}\n >\n {contentContainer}\n </div>\n );\n }\n}\n"],"version":3}
@@ -1,40 +0,0 @@
1
- import { p as proxyCustomElement, H, h } from './p-6cafd48d.js';
2
- import { c as classNames } from './p-5cdc6210.js';
3
-
4
- const searchcraftInputLabelModuleCss = ":root{--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px;--sc-popover-form-border-radius:8px;--sc-popover-list-view-height:400px;--sc-popover-list-item-image-size:60px;--sc-popover-list-item-padding-horizontal:8px;--sc-popover-list-item-padding-vertical:8px;--sc-popover-modal-max-width:570px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}:root{--sc-breakpoint-sm:576px;--sc-breakpoint-md:768px;--sc-breakpoint-lg:992px}.searchcraft-input-label{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-bold-font-size);font-weight:var(--sc-body-small-bold-font-weight);line-height:var(--sc-body-small-bold-line-height);color:var(--sc-content-neutral-primary);margin-top:4px;margin-bottom:4px}";
5
- const SearchcraftInputLabelStyle0 = searchcraftInputLabelModuleCss;
6
-
7
- const SearchcraftInputLabel = /*@__PURE__*/ proxyCustomElement(class SearchcraftInputLabel extends H {
8
- constructor() {
9
- super();
10
- this.__registerHost();
11
- /**
12
- * The classname applied to the label element.
13
- */
14
- this.inputLabelClassName = '';
15
- }
16
- render() {
17
- return (h("label", { key: '4f913c1d9027ff781725a01e71e241cb5767eadb', class: classNames('searchcraft-input-label', this.inputLabelClassName), htmlFor: 'searchcraft-input-id' }, this.label));
18
- }
19
- static get style() { return SearchcraftInputLabelStyle0; }
20
- }, [0, "searchcraft-input-label", {
21
- "inputLabelClassName": [1, "input-label-class-name"],
22
- "label": [1]
23
- }]);
24
- function defineCustomElement() {
25
- if (typeof customElements === "undefined") {
26
- return;
27
- }
28
- const components = ["searchcraft-input-label"];
29
- components.forEach(tagName => { switch (tagName) {
30
- case "searchcraft-input-label":
31
- if (!customElements.get(tagName)) {
32
- customElements.define(tagName, SearchcraftInputLabel);
33
- }
34
- break;
35
- } });
36
- }
37
-
38
- export { SearchcraftInputLabel as S, defineCustomElement as d };
39
-
40
- //# sourceMappingURL=p-c273e43d.js.map
@@ -1 +0,0 @@
1
- {"file":"p-c273e43d.js","mappings":";;;AAAA,MAAM,8BAA8B,GAAG,0nHAA0nH,CAAC;AAClqH,oCAAe,8BAA8B;;MCgBhC,qBAAqB;IALlC;;;;;;QASU,wBAAmB,GAAI,EAAE,CAAC;KAanC;IAVC,MAAM;QACJ,QACE,8DACE,KAAK,EAAE,UAAU,CAAC,yBAAyB,EAAE,IAAI,CAAC,mBAAmB,CAAC,EACtE,OAAO,EAAC,sBAAsB,IAE7B,IAAI,CAAC,KAAK,CACL,EACR;KACH;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/searchcraft-input-label/searchcraft-input-label.module.scss?tag=searchcraft-input-label","src/components/searchcraft-input-label/searchcraft-input-label.tsx"],"sourcesContent":[".searchcraft-input-label {\n @include body-small-bold();\n color: var(--sc-content-neutral-primary);\n margin-top: 4px;\n margin-bottom: 4px;\n}\n","import { Component, Prop, h } from '@stencil/core';\nimport classNames from 'classnames';\n\n/**\n * This web component serves as the input label for the searchcraft-input-form component.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-input-label label=\"Search\" />\n * ```\n */\n@Component({\n tag: 'searchcraft-input-label',\n styleUrl: 'searchcraft-input-label.module.scss',\n shadow: false,\n})\nexport class SearchcraftInputLabel {\n /**\n * The classname applied to the label element.\n */\n @Prop() inputLabelClassName? = '';\n @Prop() label: string;\n\n render() {\n return (\n <label\n class={classNames('searchcraft-input-label', this.inputLabelClassName)}\n htmlFor='searchcraft-input-id'\n >\n {this.label}\n </label>\n );\n }\n}\n"],"version":3}