@searchcraft/javascript-sdk 0.6.0 → 0.7.0

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 (186) hide show
  1. package/README.md +53 -55
  2. package/dist/cjs/{index-b3b77ea2.js → index-d4b4a45e.js} +233 -130
  3. package/dist/cjs/index-d4b4a45e.js.map +1 -0
  4. package/dist/cjs/index.cjs.js +1 -1
  5. package/dist/cjs/loader.cjs.js +1 -1
  6. package/dist/cjs/searchcraft-base-search-result.cjs.entry.js +14 -18
  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 +20 -7
  9. package/dist/cjs/searchcraft-base-search-results.cjs.entry.js.map +1 -1
  10. package/dist/cjs/searchcraft-button_3.cjs.entry.js +16 -7
  11. package/dist/cjs/searchcraft-button_3.cjs.entry.js.map +1 -1
  12. package/dist/cjs/searchcraft-facet-list_3.cjs.entry.js +26 -24
  13. package/dist/cjs/searchcraft-facet-list_3.cjs.entry.js.map +1 -1
  14. package/dist/cjs/searchcraft-filter-panel.cjs.entry.js +6 -5
  15. package/dist/cjs/searchcraft-filter-panel.cjs.entry.js.map +1 -1
  16. package/dist/cjs/searchcraft-input-form_2.cjs.entry.js +28 -17
  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-javascript-sdk.cjs.js.map +1 -1
  20. package/dist/cjs/searchcraft-popover-button.cjs.entry.js +2 -2
  21. package/dist/cjs/searchcraft-popover-form.cjs.entry.js +23 -16
  22. package/dist/cjs/searchcraft-popover-form.cjs.entry.js.map +1 -1
  23. package/dist/cjs/searchcraft-popover-list-item.cjs.entry.js +1 -7
  24. package/dist/cjs/searchcraft-popover-list-item.cjs.entry.js.map +1 -1
  25. package/dist/cjs/searchcraft-results-info.cjs.entry.js +2 -2
  26. package/dist/cjs/searchcraft-results-info.cjs.entry.js.map +1 -1
  27. package/dist/cjs/{store-d7ebcf7a.js → store-abe47006.js} +608 -98
  28. package/dist/cjs/store-abe47006.js.map +1 -0
  29. package/dist/collection/collection-manifest.json +1 -1
  30. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js +44 -16
  31. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js.map +1 -1
  32. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js +41 -6
  33. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js.map +1 -1
  34. package/dist/collection/components/searchcraft-button/searchcraft-button.js +21 -5
  35. package/dist/collection/components/searchcraft-button/searchcraft-button.js.map +1 -1
  36. package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js +2 -3
  37. package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js.map +1 -1
  38. package/dist/collection/components/searchcraft-facet-list/searchcraft-facet-list.js +4 -10
  39. package/dist/collection/components/searchcraft-facet-list/searchcraft-facet-list.js.map +1 -1
  40. package/dist/collection/components/searchcraft-filter-panel/searchcraft-filter-panel.js +6 -3
  41. package/dist/collection/components/searchcraft-filter-panel/searchcraft-filter-panel.js.map +1 -1
  42. package/dist/collection/components/searchcraft-input-form/searchcraft-input-form.js +40 -12
  43. package/dist/collection/components/searchcraft-input-form/searchcraft-input-form.js.map +1 -1
  44. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js +7 -1
  45. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js.map +1 -1
  46. package/dist/collection/components/searchcraft-popover-form/searchcraft-popover-form.js +33 -16
  47. package/dist/collection/components/searchcraft-popover-form/searchcraft-popover-form.js.map +1 -1
  48. package/dist/collection/components/searchcraft-popover-list-item/searchcraft-popover-list-item.js +12 -8
  49. package/dist/collection/components/searchcraft-popover-list-item/searchcraft-popover-list-item.js.map +1 -1
  50. package/dist/collection/components/searchcraft-popover-list-view/searchcraft-popover-list-view.js +6 -6
  51. package/dist/collection/components/searchcraft-popover-list-view/searchcraft-popover-list-view.js.map +1 -1
  52. package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.js.map +1 -1
  53. package/dist/collection/components/searchcraft-slider/searchcraft-slider.js +25 -7
  54. package/dist/collection/components/searchcraft-slider/searchcraft-slider.js.map +1 -1
  55. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js +9 -5
  56. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js.map +1 -1
  57. package/dist/components/index.js +2 -2
  58. package/dist/components/{p-d6a88eed.js → p-01dc5b3b.js} +608 -98
  59. package/dist/components/p-01dc5b3b.js.map +1 -0
  60. package/dist/components/{p-cf4ced92.js → p-1ae87308.js} +2 -8
  61. package/dist/components/p-1ae87308.js.map +1 -0
  62. package/dist/components/{p-a248ad69.js → p-649654b5.js} +5 -13
  63. package/dist/components/p-649654b5.js.map +1 -0
  64. package/dist/components/{p-4c45ef80.js → p-662cb490.js} +8 -8
  65. package/dist/components/p-662cb490.js.map +1 -0
  66. package/dist/components/{p-e4846fa2.js → p-6cafd48d.js} +189 -112
  67. package/dist/components/p-6cafd48d.js.map +1 -0
  68. package/dist/components/{p-04c46179.js → p-87d1611b.js} +15 -19
  69. package/dist/components/p-87d1611b.js.map +1 -0
  70. package/dist/components/{p-a9bd1872.js → p-c273e43d.js} +5 -3
  71. package/dist/components/p-c273e43d.js.map +1 -0
  72. package/dist/components/{p-0e38a723.js → p-cc9f8c61.js} +19 -9
  73. package/dist/components/p-cc9f8c61.js.map +1 -0
  74. package/dist/components/{p-f9d778b3.js → p-cf096782.js} +14 -6
  75. package/dist/components/p-cf096782.js.map +1 -0
  76. package/dist/components/{p-02a16e53.js → p-da5b92ef.js} +32 -19
  77. package/dist/components/p-da5b92ef.js.map +1 -0
  78. package/dist/components/{p-85765b81.js → p-e1cf5f9d.js} +3 -5
  79. package/dist/components/p-e1cf5f9d.js.map +1 -0
  80. package/dist/components/{p-953f4238.js → p-f5a06210.js} +2 -3
  81. package/dist/components/p-f5a06210.js.map +1 -0
  82. package/dist/components/searchcraft-base-search-result.js +1 -1
  83. package/dist/components/searchcraft-base-search-results.js +22 -9
  84. package/dist/components/searchcraft-base-search-results.js.map +1 -1
  85. package/dist/components/searchcraft-button.js +1 -1
  86. package/dist/components/searchcraft-error-message.js +1 -1
  87. package/dist/components/searchcraft-facet-list.js +1 -1
  88. package/dist/components/searchcraft-filter-panel.js +9 -8
  89. package/dist/components/searchcraft-filter-panel.js.map +1 -1
  90. package/dist/components/searchcraft-input-form.js +1 -1
  91. package/dist/components/searchcraft-input-label.js +1 -1
  92. package/dist/components/searchcraft-popover-button.js +2 -2
  93. package/dist/components/searchcraft-popover-form.js +29 -22
  94. package/dist/components/searchcraft-popover-form.js.map +1 -1
  95. package/dist/components/searchcraft-popover-list-item.js +1 -1
  96. package/dist/components/searchcraft-popover-list-view.js +1 -1
  97. package/dist/components/searchcraft-results-info.js +2 -2
  98. package/dist/components/searchcraft-results-info.js.map +1 -1
  99. package/dist/components/searchcraft-slider.js +1 -1
  100. package/dist/components/searchcraft-toggle-button.js +1 -1
  101. package/dist/esm/{index-11551663.js → index-56b713de.js} +233 -130
  102. package/dist/esm/index-56b713de.js.map +1 -0
  103. package/dist/esm/index.js +1 -1
  104. package/dist/esm/loader.js +2 -2
  105. package/dist/esm/searchcraft-base-search-result.entry.js +14 -18
  106. package/dist/esm/searchcraft-base-search-result.entry.js.map +1 -1
  107. package/dist/esm/searchcraft-base-search-results.entry.js +20 -7
  108. package/dist/esm/searchcraft-base-search-results.entry.js.map +1 -1
  109. package/dist/esm/searchcraft-button_3.entry.js +16 -7
  110. package/dist/esm/searchcraft-button_3.entry.js.map +1 -1
  111. package/dist/esm/searchcraft-facet-list_3.entry.js +26 -24
  112. package/dist/esm/searchcraft-facet-list_3.entry.js.map +1 -1
  113. package/dist/esm/searchcraft-filter-panel.entry.js +6 -5
  114. package/dist/esm/searchcraft-filter-panel.entry.js.map +1 -1
  115. package/dist/esm/searchcraft-input-form_2.entry.js +28 -17
  116. package/dist/esm/searchcraft-input-form_2.entry.js.map +1 -1
  117. package/dist/esm/searchcraft-javascript-sdk.js +3 -3
  118. package/dist/esm/searchcraft-javascript-sdk.js.map +1 -1
  119. package/dist/esm/searchcraft-popover-button.entry.js +2 -2
  120. package/dist/esm/searchcraft-popover-form.entry.js +23 -16
  121. package/dist/esm/searchcraft-popover-form.entry.js.map +1 -1
  122. package/dist/esm/searchcraft-popover-list-item.entry.js +1 -7
  123. package/dist/esm/searchcraft-popover-list-item.entry.js.map +1 -1
  124. package/dist/esm/searchcraft-results-info.entry.js +2 -2
  125. package/dist/esm/searchcraft-results-info.entry.js.map +1 -1
  126. package/dist/esm/{store-1058f7b0.js → store-712f0586.js} +608 -98
  127. package/dist/esm/store-712f0586.js.map +1 -0
  128. package/dist/searchcraft-javascript-sdk/index.esm.js +1 -1
  129. package/dist/searchcraft-javascript-sdk/p-01dc5b3b.js +11 -0
  130. package/dist/searchcraft-javascript-sdk/p-01dc5b3b.js.map +1 -0
  131. package/dist/searchcraft-javascript-sdk/p-117fcdd3.entry.js +2 -0
  132. package/dist/searchcraft-javascript-sdk/p-117fcdd3.entry.js.map +1 -0
  133. package/dist/searchcraft-javascript-sdk/p-129e6f2c.js +3 -0
  134. package/dist/searchcraft-javascript-sdk/p-129e6f2c.js.map +1 -0
  135. package/dist/searchcraft-javascript-sdk/{p-8e539d62.entry.js → p-27cb401c.entry.js} +2 -2
  136. package/dist/searchcraft-javascript-sdk/p-27cb401c.entry.js.map +1 -0
  137. package/dist/searchcraft-javascript-sdk/p-4df4a29e.entry.js +2 -0
  138. package/dist/searchcraft-javascript-sdk/p-4df4a29e.entry.js.map +1 -0
  139. package/dist/searchcraft-javascript-sdk/{p-98640a6a.entry.js → p-54248dd8.entry.js} +2 -2
  140. package/dist/searchcraft-javascript-sdk/{p-98640a6a.entry.js.map → p-54248dd8.entry.js.map} +1 -1
  141. package/dist/searchcraft-javascript-sdk/{p-cd852b84.entry.js → p-69430dbf.entry.js} +2 -2
  142. package/dist/searchcraft-javascript-sdk/p-69430dbf.entry.js.map +1 -0
  143. package/dist/searchcraft-javascript-sdk/{p-e042deb9.entry.js → p-a460755d.entry.js} +2 -2
  144. package/dist/searchcraft-javascript-sdk/p-a460755d.entry.js.map +1 -0
  145. package/dist/searchcraft-javascript-sdk/{p-7049b93d.entry.js → p-bc2c4259.entry.js} +2 -2
  146. package/dist/searchcraft-javascript-sdk/p-bc2c4259.entry.js.map +1 -0
  147. package/dist/searchcraft-javascript-sdk/p-caecdcda.entry.js +2 -0
  148. package/dist/searchcraft-javascript-sdk/p-caecdcda.entry.js.map +1 -0
  149. package/dist/searchcraft-javascript-sdk/{p-c27a3673.entry.js → p-f8129731.entry.js} +2 -2
  150. package/dist/searchcraft-javascript-sdk/p-f8129731.entry.js.map +1 -0
  151. package/dist/searchcraft-javascript-sdk/{p-b8bd53ce.entry.js → p-f839b682.entry.js} +2 -2
  152. package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js +1 -1
  153. package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js.map +1 -1
  154. package/package.json +4 -3
  155. package/dist/cjs/index-b3b77ea2.js.map +0 -1
  156. package/dist/cjs/store-d7ebcf7a.js.map +0 -1
  157. package/dist/components/p-02a16e53.js.map +0 -1
  158. package/dist/components/p-04c46179.js.map +0 -1
  159. package/dist/components/p-0e38a723.js.map +0 -1
  160. package/dist/components/p-4c45ef80.js.map +0 -1
  161. package/dist/components/p-85765b81.js.map +0 -1
  162. package/dist/components/p-953f4238.js.map +0 -1
  163. package/dist/components/p-a248ad69.js.map +0 -1
  164. package/dist/components/p-a9bd1872.js.map +0 -1
  165. package/dist/components/p-cf4ced92.js.map +0 -1
  166. package/dist/components/p-d6a88eed.js.map +0 -1
  167. package/dist/components/p-e4846fa2.js.map +0 -1
  168. package/dist/components/p-f9d778b3.js.map +0 -1
  169. package/dist/esm/index-11551663.js.map +0 -1
  170. package/dist/esm/store-1058f7b0.js.map +0 -1
  171. package/dist/searchcraft-javascript-sdk/p-4580e8a4.entry.js +0 -2
  172. package/dist/searchcraft-javascript-sdk/p-4580e8a4.entry.js.map +0 -1
  173. package/dist/searchcraft-javascript-sdk/p-7049b93d.entry.js.map +0 -1
  174. package/dist/searchcraft-javascript-sdk/p-8e539d62.entry.js.map +0 -1
  175. package/dist/searchcraft-javascript-sdk/p-9d0f5c89.entry.js +0 -2
  176. package/dist/searchcraft-javascript-sdk/p-9d0f5c89.entry.js.map +0 -1
  177. package/dist/searchcraft-javascript-sdk/p-c27a3673.entry.js.map +0 -1
  178. package/dist/searchcraft-javascript-sdk/p-cd852b84.entry.js.map +0 -1
  179. package/dist/searchcraft-javascript-sdk/p-d6a88eed.js +0 -11
  180. package/dist/searchcraft-javascript-sdk/p-d6a88eed.js.map +0 -1
  181. package/dist/searchcraft-javascript-sdk/p-e042deb9.entry.js.map +0 -1
  182. package/dist/searchcraft-javascript-sdk/p-e0be53df.js +0 -3
  183. package/dist/searchcraft-javascript-sdk/p-e0be53df.js.map +0 -1
  184. package/dist/searchcraft-javascript-sdk/p-efab9f3c.entry.js +0 -2
  185. package/dist/searchcraft-javascript-sdk/p-efab9f3c.entry.js.map +0 -1
  186. /package/dist/searchcraft-javascript-sdk/{p-b8bd53ce.entry.js.map → p-f839b682.entry.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- import { p as proxyCustomElement, H, h } from './p-e4846fa2.js';
1
+ import { p as proxyCustomElement, H, h } from './p-6cafd48d.js';
2
2
  import { c as classNames } from './p-5cdc6210.js';
3
3
 
4
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}";
@@ -8,8 +8,10 @@ const SearchcraftInputLabel = /*@__PURE__*/ proxyCustomElement(class Searchcraft
8
8
  constructor() {
9
9
  super();
10
10
  this.__registerHost();
11
+ /**
12
+ * The classname applied to the label element.
13
+ */
11
14
  this.inputLabelClassName = '';
12
- this.label = undefined;
13
15
  }
14
16
  render() {
15
17
  return (h("label", { key: '4f913c1d9027ff781725a01e71e241cb5767eadb', class: classNames('searchcraft-input-label', this.inputLabelClassName), htmlFor: 'searchcraft-input-id' }, this.label));
@@ -35,4 +37,4 @@ function defineCustomElement() {
35
37
 
36
38
  export { SearchcraftInputLabel as S, defineCustomElement as d };
37
39
 
38
- //# sourceMappingURL=p-a9bd1872.js.map
40
+ //# sourceMappingURL=p-c273e43d.js.map
@@ -0,0 +1 @@
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}
@@ -1,4 +1,4 @@
1
- import { p as proxyCustomElement, H, c as createEvent, h } from './p-e4846fa2.js';
1
+ import { p as proxyCustomElement, H, c as createEvent, h } from './p-6cafd48d.js';
2
2
  import { a as getMillis } from './p-755f491b.js';
3
3
  import { c as classNames } from './p-5cdc6210.js';
4
4
 
@@ -10,6 +10,23 @@ const SearchcraftSlider = /*@__PURE__*/ proxyCustomElement(class SearchcraftSlid
10
10
  super();
11
11
  this.__registerHost();
12
12
  this.rangeChanged = createEvent(this, "rangeChanged", 7);
13
+ /**
14
+ * The maximum value allowed.
15
+ */
16
+ this.max = 100;
17
+ /**
18
+ * The minimum value allowed.
19
+ */
20
+ this.min = 0;
21
+ /**
22
+ * The granularity that the value must adhere to.
23
+ */
24
+ this.granularity = getMillis('month');
25
+ /** The type of data allowed. */
26
+ this.dataType = 'number';
27
+ this.endValue = this.max;
28
+ this.startValue = this.min;
29
+ this.lastFocusedHandle = 'max';
13
30
  this.emitUpdate = async () => {
14
31
  this.rangeChanged.emit({
15
32
  startValue: this.startValue,
@@ -42,13 +59,6 @@ const SearchcraftSlider = /*@__PURE__*/ proxyCustomElement(class SearchcraftSlid
42
59
  inputElement.value = `${this.startValue}`;
43
60
  }
44
61
  };
45
- this.max = 100;
46
- this.min = 0;
47
- this.granularity = getMillis('month');
48
- this.dataType = 'number';
49
- this.endValue = this.max;
50
- this.startValue = this.min;
51
- this.lastFocusedHandle = 'max';
52
62
  }
53
63
  componentDidLoad() {
54
64
  this.startValue = this.min;
@@ -96,4 +106,4 @@ function defineCustomElement() {
96
106
 
97
107
  export { SearchcraftSlider as S, defineCustomElement as d };
98
108
 
99
- //# sourceMappingURL=p-0e38a723.js.map
109
+ //# sourceMappingURL=p-cc9f8c61.js.map
@@ -0,0 +1 @@
1
+ {"file":"p-cc9f8c61.js","mappings":";;;;AAAA,MAAM,0BAA0B,GAAG,0lKAA0lK,CAAC;AAC9nK,gCAAe,0BAA0B;;MCoB5B,iBAAiB;IAL9B;;;;;;;QASU,QAAG,GAAG,GAAG,CAAC;;;;QAIV,QAAG,GAAG,CAAC,CAAC;;;;QAIR,gBAAW,GAAW,SAAS,CAAC,OAAO,CAAC,CAAC;;QAEzC,aAAQ,GAAsB,QAAQ,CAAC;QAEtC,aAAQ,GAAG,IAAI,CAAC,GAAG,CAAC;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,IAAI,CAAC,EAC/C,IAAI,EAAE,IAAI,CAAC,WAAW,EACtB,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,iBAAiB,KAAK,KAAK,GAAG,GAAG,GAAG,GAAG,EAAE,EAC/D,IAAI,EAAC,OAAO,EACZ,KAAK,EAAE,IAAI,CAAC,UAAU,GACtB,EACF,8DACE,KAAK,EAAE,UAAU,CACf,0BAA0B,EAC1B,qCAAqC,CACtC,EACD,GAAG,EAAE,IAAI,CAAC,GAAG,EACb,GAAG,EAAE,IAAI,CAAC,GAAG,EACb,OAAO,EAAE,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,EAC7C,IAAI,EAAE,IAAI,CAAC,WAAW,EACtB,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,iBAAiB,KAAK,KAAK,GAAG,GAAG,GAAG,GAAG,EAAE,EAC/D,IAAI,EAAC,OAAO,EACZ,KAAK,EAAE,IAAI,CAAC,QAAQ,GACpB,CACE,EACN,4DAAK,KAAK,EAAC,oCAAoC,IAC7C,6DAAM,KAAK,EAAC,0BAA0B,IAAE,UAAU,CAAQ,EAC1D,6DAAM,KAAK,EAAC,0BAA0B,IAAE,QAAQ,CAAQ,CACpD,CACF,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/searchcraft-slider/searchcraft-slider.module.scss?tag=searchcraft-slider","src/components/searchcraft-slider/searchcraft-slider.tsx"],"sourcesContent":[".searchcraft-slider-container {\n align-items: center;\n display: flex;\n flex-direction: column;\n gap: 10px;\n width: 100%;\n}\n\n.searchcraft-slider-range-container {\n align-items: center;\n background-color: var(--sc-surface-disabled);\n border-radius: 999px;\n display: flex;\n position: relative;\n height: 4px;\n width: 100%;\n\n &::-webkit-slider-runnable-track {\n pointer-events: none;\n }\n\n .searchcraft-slider-active-range {\n background-color: var(--sc-surface-brand-primary);\n border-radius: 2px;\n height: 4px;\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n z-index: 0;\n\n &::-webkit-slider-runnable-track {\n pointer-events: none;\n }\n\n &::-moz-range-track {\n pointer-events: none;\n }\n }\n\n .searchcraft-slider-input {\n appearance: none;\n background: transparent;\n border-radius: 2px;\n height: 4px;\n margin: 0;\n outline: none;\n pointer-events: none;\n position: absolute;\n width: 100%;\n -webkit-appearance: none;\n\n &::-webkit-slider-thumb {\n background-color: var(--sc-surface-neutral-light);\n border-radius: 50%;\n border: 2px solid var(--sc-border-neutral);\n cursor: pointer;\n height: 20px;\n pointer-events: all;\n width: 20px;\n -webkit-appearance: none;\n }\n\n &::-moz-range-thumb {\n background-color: var(--sc-surface-neutral-light);\n border-radius: 50%;\n border: 2px solid var(--sc-border-neutral);\n cursor: pointer;\n height: 20px;\n pointer-events: all;\n width: 20px;\n }\n }\n}\n\n.searchcraft-slider-label-container {\n color: var(--sc-content-primary);\n display: flex;\n font-family: 'Source Sans Pro', sans-serif;\n font-size: 15px;\n font-weight: 600;\n justify-content: space-between;\n margin-top: 10px;\n width: 100%;\n}\n\n.searchcraft-slider-label {\n min-width: 30px;\n text-align: center;\n}","import {\n Component,\n Event,\n type EventEmitter,\n h,\n State,\n Prop,\n} from '@stencil/core';\nimport { getMillis } from '@utils';\nimport classNames from 'classnames';\n\n/**\n * This web component is designed to allow users to select a value from a range defined by a minimum and maximum value.\n * The component renders a slider interface, which can be used to visually choose a value between two boundaries.\n * It is consumed by the `searchcraft-filter-panel` component.\n */\n@Component({\n tag: 'searchcraft-slider',\n styleUrl: 'searchcraft-slider.module.scss',\n shadow: false,\n})\nexport class SearchcraftSlider {\n /**\n * The maximum value allowed.\n */\n @Prop() max = 100;\n /**\n * The minimum value allowed.\n */\n @Prop() min = 0;\n /**\n * The granularity that the value must adhere to.\n */\n @Prop() granularity: number = getMillis('month');\n /** The type of data allowed. */\n @Prop() dataType: 'number' | 'date' = 'number';\n\n @State() endValue = this.max;\n @State() startValue = this.min;\n @State() lastFocusedHandle: 'min' | 'max' = 'max';\n\n /**\n * When the range has changed.\n * */\n @Event() rangeChanged: EventEmitter<{ startValue: number; endValue: number }>;\n\n componentDidLoad() {\n this.startValue = this.min;\n this.endValue = this.max;\n }\n\n private emitUpdate = async () => {\n this.rangeChanged.emit({\n startValue: this.startValue,\n endValue: this.endValue,\n });\n };\n\n private handleStartValueChange = (event: InputEvent) => {\n const inputElement = event.target as HTMLInputElement;\n const value = Number.parseInt(inputElement.value, 10);\n this.lastFocusedHandle = 'min';\n if (value <= this.endValue) {\n this.startValue = value;\n this.emitUpdate();\n } else {\n this.startValue = this.endValue;\n inputElement.value = `${this.endValue}`;\n }\n };\n\n private handleEndValueChange = (event: InputEvent) => {\n const inputElement = event.target as HTMLInputElement;\n const value = Number.parseInt(inputElement.value, 10);\n this.lastFocusedHandle = 'max';\n if (value >= this.startValue) {\n this.endValue = value;\n this.emitUpdate();\n } else {\n this.endValue = this.startValue;\n inputElement.value = `${this.startValue}`;\n }\n };\n\n render() {\n const rangeMin = this.min;\n const rangeMax = this.max;\n const startPercent =\n ((this.startValue - rangeMin) / (rangeMax - rangeMin)) * 100;\n const endPercent =\n ((this.endValue - rangeMin) / (rangeMax - rangeMin)) * 100;\n\n const startLabel =\n this.dataType === 'number'\n ? this.startValue\n : new Date(this.startValue).getFullYear();\n\n const endLabel =\n this.dataType === 'number'\n ? this.endValue\n : new Date(this.endValue).getFullYear();\n\n return (\n <div class='searchcraft-slider-container'>\n <div class='searchcraft-slider-range-container'>\n <div\n class='searchcraft-slider-active-range'\n style={{\n left: `${startPercent}%`,\n width: `${endPercent - startPercent}%`,\n }}\n />\n <input\n class={classNames(\n 'searchcraft-slider-input',\n 'searchcraft-slider-input-min-handle',\n )}\n max={this.max}\n min={this.min}\n onInput={this.handleStartValueChange.bind(this)}\n step={this.granularity}\n style={{ zIndex: this.lastFocusedHandle === 'min' ? '2' : '1' }}\n type='range'\n value={this.startValue}\n />\n <input\n class={classNames(\n 'searchcraft-slider-input',\n 'searchcraft-slider-input-max-handle',\n )}\n max={this.max}\n min={this.min}\n onInput={this.handleEndValueChange.bind(this)}\n step={this.granularity}\n style={{ zIndex: this.lastFocusedHandle === 'max' ? '2' : '1' }}\n type='range'\n value={this.endValue}\n />\n </div>\n <div class='searchcraft-slider-label-container'>\n <span class='searchcraft-slider-label'>{startLabel}</span>\n <span class='searchcraft-slider-label'>{endLabel}</span>\n </div>\n </div>\n );\n }\n}\n"],"version":3}
@@ -1,4 +1,4 @@
1
- import { p as proxyCustomElement, H, c as createEvent, h, F as Fragment } from './p-e4846fa2.js';
1
+ import { p as proxyCustomElement, H, c as createEvent, h, F as Fragment } from './p-6cafd48d.js';
2
2
  import { c as classNames } from './p-5cdc6210.js';
3
3
 
4
4
  const searchcraftButtonModuleCss = ":root{--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px;--sc-popover-form-border-radius:8px;--sc-popover-list-view-height:400px;--sc-popover-list-item-image-size:60px;--sc-popover-list-item-padding-horizontal:8px;--sc-popover-list-item-padding-vertical:8px;--sc-popover-modal-max-width:570px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}:root{--sc-breakpoint-sm:576px;--sc-breakpoint-md:768px;--sc-breakpoint-lg:992px}.searchcraft-button{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-bold-font-size);font-weight:var(--sc-body-bold-font-weight);line-height:var(--sc-body-bold-line-height);border-radius:8px;display:flex;padding:12px 20px;position:relative;background-color:var(--sc-surface-brand-primary);border:1px solid var(--sc-border-primary);color:var(--sc-content-brand-on-primary)}.searchcraft-button:hover{cursor:pointer;background-color:var(--sc-surface-brand-primary-hover)}.searchcraft-button:focus{outline:2px solid var(--sc-surface-brand-primary)}.buttonLabel{position:relative}";
@@ -9,14 +9,22 @@ const SearchcraftButton = /*@__PURE__*/ proxyCustomElement(class SearchcraftButt
9
9
  super();
10
10
  this.__registerHost();
11
11
  this.buttonClick = createEvent(this, "buttonClick", 7);
12
- this.handleClick = () => {
13
- this.buttonClick.emit();
14
- };
15
- this.iconElement = undefined;
12
+ /**
13
+ * Should the button only display an icon.
14
+ */
16
15
  this.iconOnly = false;
16
+ /**
17
+ * The position of the icon.
18
+ */
17
19
  this.iconPosition = 'left';
20
+ /**
21
+ * The label for the button.
22
+ */
18
23
  this.label = 'Search';
19
24
  this.isRequesting = false;
25
+ this.handleClick = () => {
26
+ this.buttonClick.emit();
27
+ };
20
28
  }
21
29
  render() {
22
30
  return (h(Fragment, { key: '52b95f09f5da9f281b250285623e150c5d952dce' }, this.iconOnly ? (h("button", { class: classNames('searchcraft-button'), onClick: this.handleClick, type: 'submit' }, this.isRequesting ? (h("searchcraft-spinner-dark", null)) : (this.iconElement))) : (h("button", { class: classNames('searchcraft-button'), onClick: this.handleClick, type: 'submit' }, this.iconPosition === 'left' && this.iconElement, h("span", { class: classNames('buttonLabel', 'searchcraft-button-label') }, this.label)))));
@@ -45,4 +53,4 @@ function defineCustomElement() {
45
53
 
46
54
  export { SearchcraftButton as S, defineCustomElement as d };
47
55
 
48
- //# sourceMappingURL=p-f9d778b3.js.map
56
+ //# sourceMappingURL=p-cf096782.js.map
@@ -0,0 +1 @@
1
+ {"file":"p-cf096782.js","mappings":";;;AAAA,MAAM,0BAA0B,GAAG,46HAA46H,CAAC;AACh9H,gCAAe,0BAA0B;;MCoB5B,iBAAiB;IAL9B;;;;;;;QAaU,aAAQ,GAAG,KAAK,CAAC;;;;QAIjB,iBAAY,GAAG,MAAM,CAAC;;;;QAItB,UAAK,GAAG,QAAQ,CAAC;QAOhB,iBAAY,GAAG,KAAK,CAAC;QAEtB,gBAAW,GAAG;YACpB,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;SACzB,CAAC;KAgCH;IA9BC,MAAM;QACJ,QACE,EAAC,QAAQ,uDACN,IAAI,CAAC,QAAQ,IACZ,cACE,KAAK,EAAE,UAAU,CAAC,oBAAoB,CAAC,EACvC,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,IAAI,EAAC,QAAQ,IAEZ,IAAI,CAAC,YAAY,IAChB,mCAA4B,KAE5B,IAAI,CAAC,WAAW,CACjB,CACM,KAET,cACE,KAAK,EAAE,UAAU,CAAC,oBAAoB,CAAC,EACvC,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,IAAI,EAAC,QAAQ,IAEZ,IAAI,CAAC,YAAY,KAAK,MAAM,IAAI,IAAI,CAAC,WAAW,EACjD,YAAM,KAAK,EAAE,UAAU,CAAC,aAAa,EAAE,0BAA0B,CAAC,IAC/D,IAAI,CAAC,KAAK,CACN,CACA,CACV,CACQ,EACX;KACH;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/searchcraft-button/searchcraft-button.module.scss?tag=searchcraft-button","src/components/searchcraft-button/searchcraft-button.tsx"],"sourcesContent":[".searchcraft-button {\n @include body-bold;\n\n border-radius: 8px;\n display: flex;\n padding: 12px 20px;\n position: relative;\n\n background-color: var(--sc-surface-brand-primary);\n border: 1px solid var(--sc-border-primary);\n color: var(--sc-content-brand-on-primary);\n\n &:hover {\n cursor: pointer;\n background-color: var(--sc-surface-brand-primary-hover);\n }\n\n &:focus {\n outline: 2px solid var(--sc-surface-brand-primary);\n }\n}\n\n.buttonLabel {\n position: relative;\n}","import {\n Component,\n Event,\n type EventEmitter,\n Prop,\n h,\n State,\n Fragment,\n} from '@stencil/core';\nimport classNames from 'classnames';\n\n/**\n * This web component represents a button to be consumed within the `search-input-form` component.\n * It provides a clear, interactive way for users to submit search queries or trigger actions in a search interface.\n * It is consumed within the `searchcraft-input-form` component.\n */\n@Component({\n tag: 'searchcraft-button',\n styleUrl: 'searchcraft-button.module.scss',\n shadow: false,\n})\nexport class SearchcraftButton {\n /**\n * The icon element.\n */\n @Prop() iconElement?: Element;\n /**\n * Should the button only display an icon.\n */\n @Prop() iconOnly = false;\n /**\n * The position of the icon.\n */\n @Prop() iconPosition = 'left';\n /**\n * The label for the button.\n */\n @Prop() label = 'Search';\n\n /**\n * When the button is clicked.\n */\n @Event() buttonClick!: EventEmitter<void>;\n\n @State() isRequesting = false;\n\n private handleClick = () => {\n this.buttonClick.emit();\n };\n\n render() {\n return (\n <Fragment>\n {this.iconOnly ? (\n <button\n class={classNames('searchcraft-button')}\n onClick={this.handleClick}\n type='submit'\n >\n {this.isRequesting ? (\n <searchcraft-spinner-dark />\n ) : (\n this.iconElement\n )}\n </button>\n ) : (\n <button\n class={classNames('searchcraft-button')}\n onClick={this.handleClick}\n type='submit'\n >\n {this.iconPosition === 'left' && this.iconElement}\n <span class={classNames('buttonLabel', 'searchcraft-button-label')}>\n {this.label}\n </span>\n </button>\n )}\n </Fragment>\n );\n }\n}\n"],"version":3}
@@ -1,13 +1,13 @@
1
- import { p as proxyCustomElement, H, c as createEvent, h } from './p-e4846fa2.js';
2
- import { u as useSearchcraftStore, b as ae } from './p-d6a88eed.js';
1
+ import { p as proxyCustomElement, H, c as createEvent, h } from './p-6cafd48d.js';
2
+ import { u as useSearchcraftStore, b as ae } from './p-01dc5b3b.js';
3
3
  import { p as parseCustomStyles } from './p-d9551738.js';
4
4
  import { c as classNames } from './p-5cdc6210.js';
5
- import { d as defineCustomElement$3 } from './p-f9d778b3.js';
6
- import { d as defineCustomElement$2 } from './p-953f4238.js';
7
- import { d as defineCustomElement$1 } from './p-a9bd1872.js';
5
+ import { d as defineCustomElement$3 } from './p-cf096782.js';
6
+ import { d as defineCustomElement$2 } from './p-f5a06210.js';
7
+ import { d as defineCustomElement$1 } from './p-c273e43d.js';
8
8
 
9
9
  const name = "@searchcraft/javascript-sdk";
10
- const version = "0.6.0";
10
+ const version = "0.7.0";
11
11
  const description = "Searchcraft Javascript SDK";
12
12
  const author = "Searchcraft";
13
13
  const license = "Apache-2.0";
@@ -51,10 +51,11 @@ const scripts = {
51
51
  generate: "stencil generate"
52
52
  };
53
53
  const dependencies = {
54
+ "@stencil/vue-output-target": "^0.9.2",
54
55
  classnames: "^2.3.2"
55
56
  };
56
57
  const devDependencies = {
57
- "@searchcraft/core": "^0.6.0",
58
+ "@searchcraft/core": "^0.7.0",
58
59
  "@searchcraft/javascript-sdk": "*",
59
60
  "@stencil/core": "^4.7.0",
60
61
  "@stencil/react-output-target": "^0.8.2",
@@ -96,6 +97,29 @@ const SearchcraftInput = /*@__PURE__*/ proxyCustomElement(class SearchcraftInput
96
97
  this.inputBlur = createEvent(this, "inputBlur", 7);
97
98
  this.inputInit = createEvent(this, "inputInit", 7);
98
99
  this.querySubmit = createEvent(this, "querySubmit", 7);
100
+ /**
101
+ * Whether or not to automatically submit the search term when the input changes.
102
+ */
103
+ this.autoSearch = true;
104
+ /**
105
+ * Where to place the search button.
106
+ */
107
+ this.buttonPlacement = 'none';
108
+ /**
109
+ * A custom styles object to be applied to the input element.
110
+ */
111
+ this.customStyles = {};
112
+ /**
113
+ * The input element's placeholder value.
114
+ */
115
+ this.placeholderValue = 'Enter Search';
116
+ /**
117
+ * The starting value of the input element.
118
+ */
119
+ this.searchTerm = '';
120
+ this.inputValue = this.searchTerm;
121
+ this.error = false;
122
+ this.isSearchcraftInitialized = false;
99
123
  this.searchStore = useSearchcraftStore.getState();
100
124
  this.handleOnInput = (event) => {
101
125
  const input = event.target;
@@ -142,17 +166,6 @@ const SearchcraftInput = /*@__PURE__*/ proxyCustomElement(class SearchcraftInput
142
166
  event.preventDefault();
143
167
  await this.performSearch(this.searchTerm);
144
168
  };
145
- this.config = undefined;
146
- this.autoSearch = true;
147
- this.buttonPlacement = 'none';
148
- this.buttonLabel = undefined;
149
- this.inputLabel = undefined;
150
- this.customStyles = {};
151
- this.placeholderValue = 'Enter Search';
152
- this.searchTerm = '';
153
- this.inputValue = this.searchTerm;
154
- this.error = false;
155
- this.isSearchcraftInitialized = false;
156
169
  }
157
170
  init() {
158
171
  if (this.config && !this.isSearchcraftInitialized) {
@@ -237,4 +250,4 @@ function defineCustomElement() {
237
250
 
238
251
  export { SearchcraftInput as S, defineCustomElement as d };
239
252
 
240
- //# sourceMappingURL=p-02a16e53.js.map
253
+ //# sourceMappingURL=p-da5b92ef.js.map
@@ -0,0 +1 @@
1
+ {"file":"p-da5b92ef.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAM,6BAA6B,GAAG,k4MAAk4M,CAAC;AACz6M,mCAAe,6BAA6B;;MCmD/B,gBAAgB;IAL7B;;;;;;;;;;;;QAaU,eAAU,GAAG,IAAI,CAAC;;;;QAIlB,oBAAe,GAA8B,MAAM,CAAC;;;;QAYpD,iBAAY,GAAoC,EAAE,CAAC;;;;QAInD,qBAAgB,GAAG,cAAc,CAAC;;;;QAIlC,eAAU,GAAG,EAAE,CAAC;QA0Bf,eAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAC7B,UAAK,GAAG,KAAK,CAAC;QACd,6BAAwB,GAAG,KAAK,CAAC;QAElC,gBAAW,GAAG,mBAAmB,CAAC,QAAQ,EAAE,CAAC;QAuBrD,kBAAa,GAAG,CAAC,KAAY;YAC3B,MAA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AAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,4BAA4B,qBAClB,mBAAmB,IAEnC,8DAAO,EAAE,EAAC,mBAAmB,oCAErB,EACR,6DACE,CAAC,EAAC,mNAAmN,EACrN,MAAM,EAAC,SAAS,kBACH,KAAK,oBACH,OAAO,qBACN,OAAO,GACvB,CACE,CACF,EACL,oBAAoB,KACnB,+DACE,IAAI,EAAC,QAAQ,EACb,KAAK,EAAC,gCAAgC,EACtC,OAAO,EAAE,IAAI,CAAC,gBAAgB,IAE9B,4DACE,KAAK,EAAC,8BAA8B,EACpC,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,4BAA4B,qBAClB,YAAY,IAE5B,8DAAO,EAAE,EAAC,YAAY,yCAEd,EACR,6DACE,CAAC,EAAC,uIAAuI,EACzI,MAAM,EAAC,OAAO,kBACD,KAAK,oBACH,OAAO,qBACN,OAAO,GACvB,CACE,CACC,CACV,CACG,CACF,CACD,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["SearchcraftCore"],"sources":["src/components/searchcraft-input-form/searchcraft-input-form.module.scss?tag=searchcraft-input-form","src/components/searchcraft-input-form/searchcraft-input-form.tsx"],"sourcesContent":[".searchcraft-input-grid {\n display: grid;\n gap: 4px 8px;\n}\n\n.searchcraft-input-grid-buttonLeft {\n grid-template-rows: repeat(3, auto);\n grid-template-columns: auto 1fr;\n\n & .searchcraft-input-button-wrapper {\n grid-column: 1 / span 1;\n grid-row: 2 / span 1;\n }\n\n & .searchcraft-input-label-wrapper {\n grid-column: 2 / span 1;\n grid-row: 1 / span 1;\n }\n\n & .searchcraft-input-error-wrapper {\n grid-column: 2 / span 1;\n grid-row: 3 / span 1;\n }\n\n & .searchcraft-input-wrapper {\n grid-column: 2 / span 1;\n grid-row: 2 / span 1;\n }\n}\n\n.searchcraft-input-grid-buttonRight {\n grid-template-rows: repeat(3, auto);\n grid-template-columns: 1fr auto;\n\n & .searchcraft-input-button-wrapper {\n grid-column: 2 / span 1;\n grid-row: 2 / span 1;\n }\n\n & .searchcraft-input-label-wrapper {\n grid-column: 1 / span 1;\n grid-row: 1 / span 1;\n }\n\n & .searchcraft-input-error-wrapper {\n grid-column: 1 / span 1;\n grid-row: 3 / span 1;\n }\n\n & .searchcraft-input-wrapper {\n grid-column: 1 / span 1;\n grid-row: 2 / span 1;\n }\n}\n\n.searchcraft-input-grid-buttonNone {\n grid-template-rows: repeat(3, auto);\n grid-template-columns: auto;\n\n & .searchcraft-input-button-wrapper {\n display: none;\n }\n\n & .searchcraft-input-label-wrapper {\n grid-column: 1 / span 1;\n grid-row: 1 / span 1;\n }\n\n & .searchcraft-input-error-wrapper {\n grid-column: 1 / span 1;\n grid-row: 3 / span 1;\n }\n\n & .searchcraft-input-wrapper {\n grid-column: 1 / span 1;\n grid-row: 2 / span 1;\n }\n}\n\n.searchcraft-input-wrapper {\n position: relative;\n display: flex;\n}\n\n.searchcraft-input {\n @include body();\n background-color: var(--sc-surface-neutral-secondary);\n border-radius: var(--sc-input-border-radius);\n border: none;\n color: var(--sc-content-neutral-primary);\n outline: none;\n padding-left: var(--sc-input-padding-left);\n padding-right: var(--sc-input-padding-right);\n padding-top: 12px;\n padding-bottom: 12px;\n flex: 1;\n\n &::placeholder {\n color: var(--sc-content-disabled);\n }\n\n &:focus {\n outline: var(--sc-border-brand) solid 2px;\n }\n\n &:focus::placeholder {\n opacity: 0;\n }\n}\n\n.searchcraft-input.error {\n color: var(--sc-content-danger);\n outline: var(--sc-border-danger) solid 2px;\n\n &:focus {\n outline: var(--sc-border-danger) solid 2px;\n }\n}\n\n.searchcraft-input-search-icon-wrapper {\n align-items: center;\n justify-content: center;\n display: flex;\n position: absolute;\n pointer-events: none;\n bottom: 0;\n left: 0;\n top: 0;\n width: var(--sc-input-padding-left);\n}\n\n.searchcraft-input-search-icon {\n pointer-events: none;\n width: var(--sc-input-search-icon-size);\n height: var(--sc-input-search-icon-size);\n}\n\n.searchcraft-input-clear-button {\n all: unset;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n display: flex;\n position: absolute;\n border: none;\n outline: none;\n bottom: 0;\n right: 0;\n top: 0;\n width: var(--sc-input-padding-right);\n}\n\n.searchcraft-input-clear-icon {\n width: var(--sc-input-clear-icon-size);\n height: var(--sc-input-clear-icon-size);\n}\n","import {\n Component,\n h,\n Prop,\n State,\n Event,\n type EventEmitter,\n Watch,\n} from '@stencil/core';\n\nimport { type SearchcraftConfig, SearchcraftCore } from '@searchcraft/core';\nimport packageJson from '../../../package.json';\n\nimport { parseCustomStyles } from '@utils';\nimport { useSearchcraftStore } from '@provider/store';\nimport classNames from 'classnames';\n\nexport interface ScInputCustomEvent<T> extends CustomEvent<T> {\n detail: T;\n target: HTMLSearchcraftInputFormElement;\n}\n\n/**\n * This web component provides a user-friendly interface for querying an indexed dataset, enabling users to easily search large collections of data.\n * It abstracts the complexities of index-based searching, making it accessible to users of all technical levels.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-input-form placeholder-value=\"Search here\" />\n * ```\n *\n * ```js\n * // index.js\n * const searchInputForm = document.querySelector('searchcraft-input-form');\n *\n * seardchInputForm.config = {\n * index: [],\n * readKey: '',\n * endpointUrl: '',\n * };\n *\n * searchForm.addEventListener('querySubmit', (event) => {\n * console.log('Query submitted', event.detail);\n * });\n * ```\n */\n@Component({\n tag: 'searchcraft-input-form',\n styleUrl: 'searchcraft-input-form.module.scss',\n shadow: false,\n})\nexport class SearchcraftInput {\n /**\n * The Searchcraft config object.\n */\n @Prop() config: SearchcraftConfig | undefined;\n /**\n * Whether or not to automatically submit the search term when the input changes.\n */\n @Prop() autoSearch = true;\n /**\n * Where to place the search button.\n */\n @Prop() buttonPlacement: 'left' | 'right' | 'none' = 'none';\n /**\n * The label for the submit button.\n */\n @Prop() buttonLabel: string | undefined;\n /**\n * The label rendered above the input.\n */\n @Prop() inputLabel: string | undefined;\n /**\n * A custom styles object to be applied to the input element.\n */\n @Prop() customStyles: string | Record<string, string> = {};\n /**\n * The input element's placeholder value.\n */\n @Prop() placeholderValue = 'Enter Search';\n /**\n * The starting value of the input element.\n */\n @Prop() searchTerm = '';\n /**\n * When the input is cleared.\n */\n @Event() inputCleared: EventEmitter<void>;\n /**\n * When no results are returned.\n */\n @Event() noResultsReceived: EventEmitter<void>;\n /**\n * When the input becomes focused.\n */\n @Event() inputFocus: EventEmitter<void>;\n /**\n * When the input becomes unfocused.\n */\n @Event() inputBlur: EventEmitter<void>;\n /**\n * Event emitted when input initializes.\n */\n @Event() inputInit: EventEmitter<void>;\n /**\n * Event emitted when a query has been submitted.\n */\n @Event() querySubmit: EventEmitter<string>;\n\n @State() inputValue = this.searchTerm;\n @State() error = false;\n @State() isSearchcraftInitialized = false;\n\n private searchStore = useSearchcraftStore.getState();\n\n init() {\n if (this.config && !this.isSearchcraftInitialized) {\n const searchcraft = new SearchcraftCore(this.config, {\n sdkName: packageJson.name,\n sdkVersion: packageJson.version,\n });\n this.searchStore.initialize(searchcraft, true);\n this.isSearchcraftInitialized = true;\n this.inputInit.emit();\n }\n }\n\n componentDidLoad() {\n this.init();\n }\n\n @Watch('config')\n onConfigChange() {\n this.init();\n }\n\n handleOnInput = (event: Event) => {\n const input = event.target as HTMLInputElement;\n this.inputValue = input.value;\n\n if (input.value.trim() === '') {\n this.inputCleared.emit();\n this.searchTerm = '';\n this.searchStore.setQuery('');\n this.searchStore.setSearchResults(null);\n return;\n }\n\n if (!this.autoSearch) {\n return;\n }\n\n this.performSearch(input.value);\n };\n\n private performSearch = async (value: string) => {\n if (value === useSearchcraftStore.getState().query) {\n return;\n }\n\n this.searchTerm = value.trim();\n this.error = false;\n this.searchStore.setQuery(this.searchTerm);\n this.querySubmit.emit(this.searchTerm);\n\n try {\n await this.searchStore.search();\n } catch (error) {\n this.error = true;\n this.inputCleared.emit();\n }\n };\n\n handleClearInput = () => {\n this.inputValue = '';\n this.searchTerm = '';\n this.searchStore.setQuery('');\n this.searchStore.setSearchResults(null);\n this.error = false;\n\n if (this.inputCleared) {\n this.inputCleared.emit();\n }\n };\n\n handleFormSubmit = async (event: Event) => {\n event.preventDefault();\n await this.performSearch(this.searchTerm);\n };\n\n render() {\n const validatedCustomStyles = parseCustomStyles(this.customStyles);\n\n const isShowingClearButton = this.inputValue.length > 0;\n\n const inputGridClassNames = classNames('searchcraft-input-grid', {\n 'searchcraft-input-grid-buttonLeft': this.buttonPlacement === 'left',\n 'searchcraft-input-grid-buttonRight': this.buttonPlacement === 'right',\n 'searchcraft-input-grid-buttonNone': this.buttonPlacement === 'none',\n });\n\n const shouldHaveVerticalGap = this.inputLabel || this.error;\n const inputGridStyles = {\n gap: shouldHaveVerticalGap ? '4px 8px' : '0px 8px',\n };\n\n return (\n <form class='searchcraft-input-form' onSubmit={this.handleFormSubmit}>\n <div class={inputGridClassNames} style={inputGridStyles}>\n <div class='searchcraft-input-button-wrapper'>\n <searchcraft-button\n onButtonClick={this.handleFormSubmit}\n label={this.buttonLabel}\n />\n </div>\n {this.inputLabel && (\n <div class='searchcraft-input-label-wrapper'>\n <searchcraft-input-label label={this.inputLabel} />\n </div>\n )}\n {this.error && (\n <div class='searchcraft-input-error-wrapper'>\n <searchcraft-error-message errorMessage='Something went wrong.' />\n </div>\n )}\n <div class='searchcraft-input-wrapper'>\n <input\n autoComplete='off'\n class='searchcraft-input'\n onFocus={() => this.inputFocus.emit()}\n onBlur={() => this.inputBlur.emit()}\n onInput={(event) => {\n this.handleOnInput(event);\n }}\n placeholder={this.placeholderValue}\n style={validatedCustomStyles}\n type='text'\n value={this.inputValue}\n />\n <div class='searchcraft-input-search-icon-wrapper'>\n <svg\n class='searchcraft-input-search-icon'\n viewBox='0 0 20 20'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n aria-labelledby='searchcraft-title'\n >\n <title id='searchcraft-title'>\n Searchcraft Search Icon Light\n </title>\n <path\n d='M17.5 17.5L13.875 13.875M15.8333 9.16667C15.8333 12.8486 12.8486 15.8333 9.16667 15.8333C5.48477 15.8333 2.5 12.8486 2.5 9.16667C2.5 5.48477 5.48477 2.5 9.16667 2.5C12.8486 2.5 15.8333 5.48477 15.8333 9.16667Z'\n stroke='#404040'\n stroke-width='1.5'\n stroke-linecap='round'\n stroke-linejoin='round'\n />\n </svg>\n </div>\n {isShowingClearButton && (\n <button\n type='button'\n class='searchcraft-input-clear-button'\n onClick={this.handleClearInput}\n >\n <svg\n class='searchcraft-input-clear-icon'\n viewBox='0 0 22 22'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n aria-labelledby='icon-title'\n >\n <title id='icon-title'>\n Searchcraft Clear Input Icon Light\n </title>\n <path\n d='M14 8L8 14M8 8L14 14M21 11C21 16.5228 16.5228 21 11 21C5.47715 21 1 16.5228 1 11C1 5.47715 5.47715 1 11 1C16.5228 1 21 5.47715 21 11Z'\n stroke='black'\n stroke-width='1.5'\n stroke-linecap='round'\n stroke-linejoin='round'\n />\n </svg>\n </button>\n )}\n </div>\n </div>\n </form>\n );\n }\n}\n"],"version":3}
@@ -1,6 +1,6 @@
1
- import { p as proxyCustomElement, H, h } from './p-e4846fa2.js';
1
+ import { p as proxyCustomElement, H, h } from './p-6cafd48d.js';
2
2
  import { g as getDocumentValueFromSearchResultMapping } from './p-755f491b.js';
3
- import { d as defineCustomElement$1 } from './p-cf4ced92.js';
3
+ import { d as defineCustomElement$1 } from './p-1ae87308.js';
4
4
 
5
5
  const searchcraftPopoverListViewModuleCss = "";
6
6
  const SearchcraftPopoverListViewStyle0 = searchcraftPopoverListViewModuleCss;
@@ -9,8 +9,6 @@ const SearchcraftPopoverListView = /*@__PURE__*/ proxyCustomElement(class Search
9
9
  constructor() {
10
10
  super();
11
11
  this.__registerHost();
12
- this.popoverResultMappings = undefined;
13
- this.documents = undefined;
14
12
  }
15
13
  renderDocument(document, index) {
16
14
  /**
@@ -53,4 +51,4 @@ function defineCustomElement() {
53
51
 
54
52
  export { SearchcraftPopoverListView as S, defineCustomElement as d };
55
53
 
56
- //# sourceMappingURL=p-85765b81.js.map
54
+ //# sourceMappingURL=p-e1cf5f9d.js.map
@@ -0,0 +1 @@
1
+ {"file":"p-e1cf5f9d.js","mappings":";;;;AAAA,MAAM,mCAAmC,GAAG,EAAE,CAAC;AAC/C,yCAAe,mCAAmC;;MCmBrC,0BAA0B;;;;;IAWrC,cAAc,CAAC,QAAiC,EAAE,KAAa;;;;QAI7D,MAAM,YAAY,GAAG,uCAAuC,CAC1D,QAAQ,EACR,IAAI,CAAC,qBAAqB,CAAC,KAAK,CACjC,CAAC;QACF,MAAM,eAAe,GAAG,uCAAuC,CAC7D,QAAQ,EACR,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CACpC,CAAC;QACF,MAAM,IAAI,GAAG,uCAAuC,CAClD,QAAQ,EACR,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAChC,CAAC;QACF,MAAM,WAAW,GAAG,uCAAuC,CACzD,QAAQ,EACR,IAAI,CAAC,qBAAqB,CAAC,WAAW,CACvC,CAAC;QACF,MAAM,QAAQ,GAAG,uCAAuC,CACtD,QAAQ,EACR,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CACpC,CAAC;QAEF,QACE,qCACE,GAAG,EAAE,GAAG,QAAQ,CAAC,WAAW,IAAI,KAAK,EAAE,mBACxB,YAAY,sBACT,eAAe,eACtB,WAAW,eACX,QAAQ,EACnB,IAAI,EAAE,IAAI,uBACS,KAAK,GACxB,EACF;KACH;IAED,MAAM;;QACJ,QACE,4DAAK,KAAK,EAAC,+BAA+B,IACvC,MAAA,IAAI,CAAC,SAAS,0CAAE,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK,KACnC,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,KAAK,CAAC,CACrC,CACG,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/searchcraft-popover-list-view/searchcraft-popover-list-view.module.scss?tag=searchcraft-popover-list-view","src/components/searchcraft-popover-list-view/searchcraft-popover-list-view.tsx"],"sourcesContent":["","import { Component, h, Prop } from '@stencil/core';\n\nimport { getDocumentValueFromSearchResultMapping } from '@utils';\nimport type { PopoverResultMappings } from 'types';\n\n/**\n * This web component is designed to display a list of results within a popover interface.\n * It is consumed within the `searchcraft-popover-form` component.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-popover-list-view />\n * ```\n */\n@Component({\n tag: 'searchcraft-popover-list-view',\n styleUrl: 'searchcraft-popover-list-view.module.scss',\n shadow: false,\n})\nexport class SearchcraftPopoverListView {\n /**\n * The mappings that define how the data in the documents are mapped to the\n * list-view-item elements.\n */\n @Prop() popoverResultMappings: PopoverResultMappings | undefined;\n /**\n * The documents to render in the list view.\n */\n @Prop() documents: Record<string, unknown>[] | undefined;\n\n renderDocument(document: Record<string, unknown>, index: number) {\n /**\n * Index field values -> Result container props mappings.\n */\n const titleContent = getDocumentValueFromSearchResultMapping(\n document,\n this.popoverResultMappings.title,\n );\n const subtitleContent = getDocumentValueFromSearchResultMapping(\n document,\n this.popoverResultMappings.subtitle,\n );\n const href = getDocumentValueFromSearchResultMapping(\n document,\n this.popoverResultMappings.href,\n );\n const imageSource = getDocumentValueFromSearchResultMapping(\n document,\n this.popoverResultMappings.imageSource,\n );\n const imageAlt = getDocumentValueFromSearchResultMapping(\n document,\n this.popoverResultMappings.imageAlt,\n );\n\n return (\n <searchcraft-popover-list-item\n key={`${document.document_id}-${index}`}\n title-content={titleContent}\n subtitle-content={subtitleContent}\n image-src={imageSource}\n image-alt={imageAlt}\n href={href}\n document-position={index}\n />\n );\n }\n\n render() {\n return (\n <div class='searchcraft-popover-list-view'>\n {this.documents?.map((document, index) =>\n this.renderDocument(document, index),\n )}\n </div>\n );\n }\n}\n"],"version":3}
@@ -1,4 +1,4 @@
1
- import { p as proxyCustomElement, H, h } from './p-e4846fa2.js';
1
+ import { p as proxyCustomElement, H, h } from './p-6cafd48d.js';
2
2
 
3
3
  const searchcraftErrorMessageModuleCss = ":root{--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px;--sc-popover-form-border-radius:8px;--sc-popover-list-view-height:400px;--sc-popover-list-item-image-size:60px;--sc-popover-list-item-padding-horizontal:8px;--sc-popover-list-item-padding-vertical:8px;--sc-popover-modal-max-width:570px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}:root{--sc-breakpoint-sm:576px;--sc-breakpoint-md:768px;--sc-breakpoint-lg:992px}.searchcraft-error-message{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-body-small-font-weight);line-height:var(--sc-body-small-line-height);color:var(--sc-content-danger);margin:0}";
4
4
  const SearchcraftErrorMessageStyle0 = searchcraftErrorMessageModuleCss;
@@ -7,7 +7,6 @@ const SearchcraftErrorMessage = /*@__PURE__*/ proxyCustomElement(class Searchcra
7
7
  constructor() {
8
8
  super();
9
9
  this.__registerHost();
10
- this.errorMessage = undefined;
11
10
  }
12
11
  render() {
13
12
  return (h("p", { key: '5bdc428adf6f239d66a9b0f946ee6e582de41e86', class: 'searchcraft-error-message' }, this.errorMessage || 'Search term is required.'));
@@ -32,4 +31,4 @@ function defineCustomElement() {
32
31
 
33
32
  export { SearchcraftErrorMessage as S, defineCustomElement as d };
34
33
 
35
- //# sourceMappingURL=p-953f4238.js.map
34
+ //# sourceMappingURL=p-f5a06210.js.map
@@ -0,0 +1 @@
1
+ {"file":"p-f5a06210.js","mappings":";;AAAA,MAAM,gCAAgC,GAAG,4kHAA4kH,CAAC;AACtnH,sCAAe,gCAAgC;;MCelC,uBAAuB;;;;;IAMlC,MAAM;QACJ,QACE,0DAAG,KAAK,EAAC,2BAA2B,IACjC,IAAI,CAAC,YAAY,IAAI,0BAA0B,CAC9C,EACJ;KACH;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/searchcraft-error-message/searchcraft-error-message.module.scss?tag=searchcraft-error-message","src/components/searchcraft-error-message/searchcraft-error-message.tsx"],"sourcesContent":[".searchcraft-error-message {\n @include body-small();\n color: var(--sc-content-danger);\n margin: 0;\n}\n","import { Component, Prop, h } from '@stencil/core';\n\n/**\n * This web component is designed to display a user-friendly error message when a search query fails, providing clear feedback to users and enhancing their experience when an issue arises during the search process.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-error-message error-message=\"No search results found for query\" />\n * ```\n */\n@Component({\n tag: 'searchcraft-error-message',\n styleUrl: 'searchcraft-error-message.module.scss',\n shadow: false,\n})\nexport class SearchcraftErrorMessage {\n /**\n * The error message.\n */\n @Prop() errorMessage?: string;\n\n render() {\n return (\n <p class='searchcraft-error-message'>\n {this.errorMessage || 'Search term is required.'}\n </p>\n );\n }\n}\n"],"version":3}
@@ -1,4 +1,4 @@
1
- import { S as SearchcraftBaseSearchResult$1, d as defineCustomElement$1 } from './p-04c46179.js';
1
+ import { S as SearchcraftBaseSearchResult$1, d as defineCustomElement$1 } from './p-87d1611b.js';
2
2
 
3
3
  const SearchcraftBaseSearchResult = SearchcraftBaseSearchResult$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,9 +1,9 @@
1
- import { p as proxyCustomElement, H, c as createEvent, h } from './p-e4846fa2.js';
2
- import { u as useSearchcraftStore } from './p-d6a88eed.js';
1
+ import { p as proxyCustomElement, H, c as createEvent, h } from './p-6cafd48d.js';
2
+ import { u as useSearchcraftStore } from './p-01dc5b3b.js';
3
3
  import { g as getDocumentValueFromSearchResultMapping } from './p-755f491b.js';
4
4
  import { s as serializeStyles } from './p-d9551738.js';
5
- import { d as defineCustomElement$3 } from './p-04c46179.js';
6
- import { d as defineCustomElement$2 } from './p-953f4238.js';
5
+ import { d as defineCustomElement$3 } from './p-87d1611b.js';
6
+ import { d as defineCustomElement$2 } from './p-f5a06210.js';
7
7
 
8
8
  const searchcraftBaseSearchResultsModuleCss = ":root{--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px;--sc-popover-form-border-radius:8px;--sc-popover-list-view-height:400px;--sc-popover-list-item-image-size:60px;--sc-popover-list-item-padding-horizontal:8px;--sc-popover-list-item-padding-vertical:8px;--sc-popover-modal-max-width:570px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}:root{--sc-breakpoint-sm:576px;--sc-breakpoint-md:768px;--sc-breakpoint-lg:992px}.searchcraft-search-results-container{display:flex;flex-direction:column;justify-content:center;gap:16px}.searchcraft-ad-section{align-items:center;background-color:#F1F1F1;border-radius:16px;display:flex;flex-direction:column;font-size:16px;justify-content:center;min-height:176px;text-align:center}.searchcraft-ad-section p{margin:0;color:var(--sc-content-disabled)}.searchcraft-search-results-empty-state-container{text-align:center}.searchcraft-search-results-error-message-container{text-align:center}";
9
9
  const SearchcraftBaseSearchResultsStyle0 = searchcraftBaseSearchResultsModuleCss;
@@ -13,17 +13,30 @@ const SearchcraftBaseSearchResults$1 = /*@__PURE__*/ proxyCustomElement(class Se
13
13
  super();
14
14
  this.__registerHost();
15
15
  this.noResults = createEvent(this, "noResults", 7);
16
+ /**
17
+ * How often ads are injected.
18
+ */
16
19
  this.adInterval = 4;
17
- this.customStylesForResults = undefined;
18
- this.searchResultMappings = undefined;
20
+ /**
21
+ * Should an ad be placed at the end of the results.
22
+ */
19
23
  this.placeAdAtEnd = false;
24
+ /**
25
+ * Should an ad be placed at the start of the results.
26
+ */
20
27
  this.placeAdAtStart = true;
28
+ /**
29
+ * The placement of the image for each result.
30
+ */
21
31
  this.resultImagePlacement = 'right';
22
- this.buttonLabel = undefined;
32
+ /**
33
+ * Where to open the link for the button rendered when containerHref is not present for each result.
34
+ */
23
35
  this.buttonTarget = '_blank';
24
- this.buttonRel = undefined;
36
+ /**
37
+ * Where to open the link for the containing element for each result.
38
+ */
25
39
  this.containerTarget = '_blank';
26
- this.containerRel = undefined;
27
40
  this.hasSearched = false;
28
41
  this.query = '';
29
42
  this.searchResults = null;
@@ -1 +1 @@
1
- {"file":"searchcraft-base-search-results.js","mappings":";;;;;;;AAAA,MAAM,qCAAqC,GAAG,2zHAA2zH,CAAC;AAC12H,2CAAe,qCAA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,CAAC,IAAI,EAAE,CAAC;SACvB;QAED,QACE,WAAK,KAAK,EAAC,sCAAsC,IAC9C,eAAe,EACf,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC;YACpB,CAAA,MAAA,MAAA,MAAA,IAAI,CAAC,aAAa,0CAAE,IAAI,0CAAE,IAAI,0CAAE,MAAM,MAAK,CAAC,KAC1C,WAAK,KAAK,EAAC,oDAAoD,IAC7D,kDACiB,gCAAgC,IAAI,CAAC,KAAK,SAAS,GAClE,CACE,CACP,CACC,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["SearchcraftBaseSearchResults"],"sources":["src/components/searchcraft-base-search-results/searchcraft-base-search-results.module.scss?tag=searchcraft-base-search-results","src/components/searchcraft-base-search-results/searchcraft-base-search-results.tsx"],"sourcesContent":[".searchcraft-search-results-container {\n display: flex;\n flex-direction: column;\n justify-content: center;\n gap: 16px;\n}\n\n.searchcraft-ad-section {\n align-items: center;\n background-color: #F1F1F1;\n border-radius: 16px;\n display: flex;\n flex-direction: column;\n font-size: 16px;\n justify-content: center;\n min-height: 176px;\n text-align: center;\n\n p {\n margin: 0;\n color: var(--sc-content-disabled);\n }\n}\n\n.searchcraft-search-results-empty-state-container {\n text-align: center;\n}\n\n.searchcraft-search-results-error-message-container {\n text-align: center;\n}\n","import {\n Component,\n h,\n Event,\n Prop,\n State,\n type EventEmitter,\n} from '@stencil/core';\n\nimport type { SearchcraftResponse } from '@searchcraft/core';\n\nimport { useSearchcraftStore } from '@provider/store';\n\nimport {\n getDocumentValueFromSearchResultMapping,\n serializeStyles,\n} from '@utils';\nimport type { SearchResultMappings } from 'types';\n\n/**\n * This web component is responsible for displaying the results of a search query.\n * Once a query is submitted, the component formats and presents an ordered list of the results.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-base-search-results\n * ad-interval=\"4\"\n * place-ad-at-start=\"false\"\n * result-image-placement=\"right\"\n * />\n * ```\n *\n * ```js\n * // index.js\n * const baseSearchResults = document.querySelector('searchcraft-base-search-results');\n *\n * baseSearchResults.searchResultMappings = containerHref: {\n * fieldNames: [\n * {\n * fieldName: 'canonical_link',\n * dataType: 'text',\n * },\n * ],\n * };\n *\n * baseSearchResults.addEventListener('noResults', () => {\n * console.log('No search results found');\n * });\n * ```\n */\n@Component({\n tag: 'searchcraft-base-search-results',\n styleUrl: 'searchcraft-base-search-results.module.scss',\n shadow: false,\n})\nexport class SearchcraftBaseSearchResults {\n /**\n * How often ads are injected.\n */\n @Prop() adInterval = 4;\n /**\n * A custom styles object.\n */\n @Prop() customStylesForResults:\n | string\n | Record<string, Record<string, string>>\n | undefined;\n /**\n * Formats the content rendered for each result.\n */\n @Prop() searchResultMappings: SearchResultMappings | undefined;\n /**\n * Should an ad be placed at the end of the results.\n */\n @Prop() placeAdAtEnd = false;\n /**\n * Should an ad be placed at the start of the results.\n */\n @Prop() placeAdAtStart = true;\n /**\n * The placement of the image for each result.\n */\n @Prop() resultImagePlacement: 'left' | 'right' = 'right';\n /**\n * The label for the button rendered when containerHref is not present for each result.\n */\n @Prop() buttonLabel: string | undefined;\n /**\n * Where to open the link for the button rendered when containerHref is not present for each result.\n */\n @Prop() buttonTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n /**\n * The relationship between the current document and the link for the button rendered when containerHref is not present for each result.\n */\n @Prop() buttonRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n /**\n * Where to open the link for the containing element for each result.\n */\n @Prop() containerTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n /**\n * The relationship between the current document and the link for the containing element for each result.\n */\n @Prop() containerRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n\n /**\n * When no results are returned.\n */\n @Event() noResults: EventEmitter<void>;\n\n @State() hasSearched = false;\n @State() query = '';\n @State() searchResults: SearchcraftResponse | null = null;\n\n private unsubscribe: () => void;\n\n componentDidLoad() {\n this.unsubscribe = useSearchcraftStore.subscribe((state) => {\n if (state.query.length > 0) {\n this.hasSearched = true;\n } else {\n this.hasSearched = false;\n }\n this.searchResults = { ...state.searchResults };\n this.query = state.query;\n });\n\n const { searchResults, query } = useSearchcraftStore.getState();\n this.searchResults = searchResults;\n this.query = query;\n }\n\n disconnectedCallback() {\n if (this.unsubscribe) {\n this.unsubscribe();\n }\n }\n\n renderDocument(document: Record<string, unknown>, index: number) {\n /**\n * Index field values -> Result container props mappings.\n */\n const titleContent = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings.title,\n );\n const subtitleContent = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings.subtitle,\n );\n const bodyContent = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings.body,\n );\n const containerHref = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings.containerHref,\n );\n const buttonHref = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings.buttonHref,\n );\n const imageSource = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings.imageSource,\n );\n const footerContent = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings.footer,\n );\n\n const serializedStyles =\n typeof this.customStylesForResults === 'string'\n ? this.customStylesForResults\n : serializeStyles(this.customStylesForResults);\n\n return (\n <searchcraft-base-search-result\n key={`${document.document_id}-${index}`}\n custom-styles={serializedStyles}\n image-placement={this.resultImagePlacement}\n container-rel={this.containerRel}\n container-target={this.containerTarget}\n button-label={this.buttonLabel || 'View more'}\n button-rel={this.buttonRel}\n button-target={this.buttonTarget}\n document-position={index}\n title-content={titleContent}\n subtitle-content={subtitleContent}\n body-content={bodyContent}\n footer-content={footerContent}\n container-href={containerHref}\n button-href={buttonHref}\n image-src={imageSource}\n />\n );\n }\n\n render() {\n if (this.query.trim() === '') {\n return (\n <div class='searchcraft-search-results-empty-state-container'>\n <slot name='empty-search' />\n </div>\n );\n }\n\n if (!this.searchResults?.data) {\n return;\n }\n\n const documents: Record<string, unknown>[] =\n this.searchResults?.data?.hits?.map((data, _index) => {\n const { doc: result } = data;\n return result;\n });\n\n const finalComponents: JSX.Element[] = [];\n\n if (this.placeAdAtStart) {\n finalComponents.push(\n <div key='ad-section-start' class='searchcraft-ad-section'>\n <p>Ad Section</p>\n </div>,\n );\n }\n\n if (this.adInterval > 0) {\n documents.forEach((document, index) => {\n finalComponents.push(this.renderDocument(document, index));\n\n if ((index + 1) % this.adInterval === 0) {\n finalComponents.push(\n <div\n key={`ad-section-${index + 1}`}\n class='searchcraft-ad-section '\n >\n <p>Ad Section</p>\n </div>,\n );\n }\n });\n } else {\n const documentElements = documents.map((document, index) =>\n this.renderDocument(document, index),\n );\n finalComponents.push(...documentElements);\n }\n\n if (this.placeAdAtEnd) {\n finalComponents.push(\n <div key='ad-section-end' class='searchcraft-ad-section'>\n <p>Ad Section</p>\n </div>,\n );\n }\n\n if (this.query.length > 0 && this.searchResults?.data?.hits?.length === 0) {\n this.noResults.emit();\n }\n\n return (\n <div class='searchcraft-search-results-container'>\n {finalComponents}\n {this.query.length > 0 &&\n this.searchResults?.data?.hits?.length === 0 && (\n <div class='searchcraft-search-results-error-message-container'>\n <searchcraft-error-message\n error-message={`No search results found for \"${this.query}\" query`}\n />\n </div>\n )}\n </div>\n );\n }\n}\n"],"version":3}
1
+ {"file":"searchcraft-base-search-results.js","mappings":";;;;;;;AAAA,MAAM,qCAAqC,GAAG,2zHAA2zH,CAAC;AAC12H,2CAAe,qCAAqC;;MCuDvCA,8BAA4B;IALzC;;;;;;;QASU,eAAU,GAAG,CAAC,CAAC;;;;QAef,iBAAY,GAAG,KAAK,CAAC;;;;QAIrB,mBAAc,GAAG,IAAI,CAAC;;;;QAItB,yBAAoB,GAAqB,OAAO,CAAC;;;;QAQjD,iBAAY,GAA4C,QAAQ,CAAC;;;;QAQjE,oBAAe,GAA4C,QAAQ,CAAC;QAWnE,gBAAW,GAAG,KAAK,CAAC;QACpB,UAAK,GAAG,EAAE,CAAC;QACX,kBAAa,GAA+B,IAAI,CAAC;KAmK3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IAAI,CAAC,aAAa,0CAAE,IAAI,0CAAE,IAAI,0CAAE,MAAM,MAAK,CAAC,KAC1C,WAAK,KAAK,EAAC,oDAAoD,IAC7D,kDACiB,gCAAgC,IAAI,CAAC,KAAK,SAAS,GAClE,CACE,CACP,CACC,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["SearchcraftBaseSearchResults"],"sources":["src/components/searchcraft-base-search-results/searchcraft-base-search-results.module.scss?tag=searchcraft-base-search-results","src/components/searchcraft-base-search-results/searchcraft-base-search-results.tsx"],"sourcesContent":[".searchcraft-search-results-container {\n display: flex;\n flex-direction: column;\n justify-content: center;\n gap: 16px;\n}\n\n.searchcraft-ad-section {\n align-items: center;\n background-color: #F1F1F1;\n border-radius: 16px;\n display: flex;\n flex-direction: column;\n font-size: 16px;\n justify-content: center;\n min-height: 176px;\n text-align: center;\n\n p {\n margin: 0;\n color: var(--sc-content-disabled);\n }\n}\n\n.searchcraft-search-results-empty-state-container {\n text-align: center;\n}\n\n.searchcraft-search-results-error-message-container {\n text-align: center;\n}\n","import {\n Component,\n h,\n Event,\n Prop,\n State,\n type EventEmitter,\n} from '@stencil/core';\n\nimport type { SearchcraftResponse } from '@searchcraft/core';\n\nimport { useSearchcraftStore } from '@provider/store';\n\nimport {\n getDocumentValueFromSearchResultMapping,\n serializeStyles,\n} from '@utils';\nimport type { SearchResultMappings } from 'types';\n\n/**\n * This web component is responsible for displaying the results of a search query.\n * Once a query is submitted, the component formats and presents an ordered list of the results.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-base-search-results\n * ad-interval=\"4\"\n * place-ad-at-start=\"false\"\n * result-image-placement=\"right\"\n * />\n * ```\n *\n * ```js\n * // index.js\n * const baseSearchResults = document.querySelector('searchcraft-base-search-results');\n *\n * baseSearchResults.searchResultMappings = containerHref: {\n * fieldNames: [\n * {\n * fieldName: 'canonical_link',\n * dataType: 'text',\n * },\n * ],\n * };\n *\n * baseSearchResults.addEventListener('noResults', () => {\n * console.log('No search results found');\n * });\n * ```\n */\n@Component({\n tag: 'searchcraft-base-search-results',\n styleUrl: 'searchcraft-base-search-results.module.scss',\n shadow: false,\n})\nexport class SearchcraftBaseSearchResults {\n /**\n * How often ads are injected.\n */\n @Prop() adInterval = 4;\n /**\n * A custom styles object.\n */\n @Prop() customStylesForResults:\n | string\n | Record<string, Record<string, string>>\n | undefined;\n /**\n * Formats the content rendered for each result.\n */\n @Prop() searchResultMappings: SearchResultMappings | undefined;\n /**\n * Should an ad be placed at the end of the results.\n */\n @Prop() placeAdAtEnd = false;\n /**\n * Should an ad be placed at the start of the results.\n */\n @Prop() placeAdAtStart = true;\n /**\n * The placement of the image for each result.\n */\n @Prop() resultImagePlacement: 'left' | 'right' = 'right';\n /**\n * The label for the button rendered when containerHref is not present for each result.\n */\n @Prop() buttonLabel: string | undefined;\n /**\n * Where to open the link for the button rendered when containerHref is not present for each result.\n */\n @Prop() buttonTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n /**\n * The relationship between the current document and the link for the button rendered when containerHref is not present for each result.\n */\n @Prop() buttonRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n /**\n * Where to open the link for the containing element for each result.\n */\n @Prop() containerTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n /**\n * The relationship between the current document and the link for the containing element for each result.\n */\n @Prop() containerRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n\n /**\n * When no results are returned.\n */\n @Event() noResults: EventEmitter<void>;\n\n @State() hasSearched = false;\n @State() query = '';\n @State() searchResults: SearchcraftResponse | null = null;\n\n private unsubscribe: () => void;\n\n componentDidLoad() {\n this.unsubscribe = useSearchcraftStore.subscribe((state) => {\n if (state.query.length > 0) {\n this.hasSearched = true;\n } else {\n this.hasSearched = false;\n }\n this.searchResults = { ...state.searchResults };\n this.query = state.query;\n });\n\n const { searchResults, query } = useSearchcraftStore.getState();\n this.searchResults = searchResults;\n this.query = query;\n }\n\n disconnectedCallback() {\n if (this.unsubscribe) {\n this.unsubscribe();\n }\n }\n\n renderDocument(document: Record<string, unknown>, index: number) {\n /**\n * Index field values -> Result container props mappings.\n */\n const titleContent = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings.title,\n );\n const subtitleContent = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings.subtitle,\n );\n const bodyContent = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings.body,\n );\n const containerHref = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings.containerHref,\n );\n const buttonHref = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings.buttonHref,\n );\n const imageSource = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings.imageSource,\n );\n const footerContent = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings.footer,\n );\n\n const serializedStyles =\n typeof this.customStylesForResults === 'string'\n ? this.customStylesForResults\n : serializeStyles(this.customStylesForResults);\n\n return (\n <searchcraft-base-search-result\n key={`${document.document_id}-${index}`}\n custom-styles={serializedStyles}\n image-placement={this.resultImagePlacement}\n container-rel={this.containerRel}\n container-target={this.containerTarget}\n button-label={this.buttonLabel || 'View more'}\n button-rel={this.buttonRel}\n button-target={this.buttonTarget}\n document-position={index}\n title-content={titleContent}\n subtitle-content={subtitleContent}\n body-content={bodyContent}\n footer-content={footerContent}\n container-href={containerHref}\n button-href={buttonHref}\n image-src={imageSource}\n />\n );\n }\n\n render() {\n if (this.query.trim() === '') {\n return (\n <div class='searchcraft-search-results-empty-state-container'>\n <slot name='empty-search' />\n </div>\n );\n }\n\n if (!this.searchResults?.data) {\n return;\n }\n\n const documents: Record<string, unknown>[] =\n this.searchResults?.data?.hits?.map((data, _index) => {\n const { doc: result } = data;\n return result;\n });\n\n const finalComponents: JSX.Element[] = [];\n\n if (this.placeAdAtStart) {\n finalComponents.push(\n <div key='ad-section-start' class='searchcraft-ad-section'>\n <p>Ad Section</p>\n </div>,\n );\n }\n\n if (this.adInterval > 0) {\n documents.forEach((document, index) => {\n finalComponents.push(this.renderDocument(document, index));\n\n if ((index + 1) % this.adInterval === 0) {\n finalComponents.push(\n <div\n key={`ad-section-${index + 1}`}\n class='searchcraft-ad-section '\n >\n <p>Ad Section</p>\n </div>,\n );\n }\n });\n } else {\n const documentElements = documents.map((document, index) =>\n this.renderDocument(document, index),\n );\n finalComponents.push(...documentElements);\n }\n\n if (this.placeAdAtEnd) {\n finalComponents.push(\n <div key='ad-section-end' class='searchcraft-ad-section'>\n <p>Ad Section</p>\n </div>,\n );\n }\n\n if (this.query.length > 0 && this.searchResults?.data?.hits?.length === 0) {\n this.noResults.emit();\n }\n\n return (\n <div class='searchcraft-search-results-container'>\n {finalComponents}\n {this.query.length > 0 &&\n this.searchResults?.data?.hits?.length === 0 && (\n <div class='searchcraft-search-results-error-message-container'>\n <searchcraft-error-message\n error-message={`No search results found for \"${this.query}\" query`}\n />\n </div>\n )}\n </div>\n );\n }\n}\n"],"version":3}
@@ -1,4 +1,4 @@
1
- import { S as SearchcraftButton$1, d as defineCustomElement$1 } from './p-f9d778b3.js';
1
+ import { S as SearchcraftButton$1, d as defineCustomElement$1 } from './p-cf096782.js';
2
2
 
3
3
  const SearchcraftButton = SearchcraftButton$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { S as SearchcraftErrorMessage$1, d as defineCustomElement$1 } from './p-953f4238.js';
1
+ import { S as SearchcraftErrorMessage$1, d as defineCustomElement$1 } from './p-f5a06210.js';
2
2
 
3
3
  const SearchcraftErrorMessage = SearchcraftErrorMessage$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { S as SearchcraftFacetList$1, d as defineCustomElement$1 } from './p-a248ad69.js';
1
+ import { S as SearchcraftFacetList$1, d as defineCustomElement$1 } from './p-649654b5.js';
2
2
 
3
3
  const SearchcraftFacetList = SearchcraftFacetList$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,9 +1,9 @@
1
- import { p as proxyCustomElement, H, h } from './p-e4846fa2.js';
2
- import { u as useSearchcraftStore } from './p-d6a88eed.js';
1
+ import { p as proxyCustomElement, H, h } from './p-6cafd48d.js';
2
+ import { u as useSearchcraftStore } from './p-01dc5b3b.js';
3
3
  import { a as getMillis } from './p-755f491b.js';
4
- import { d as defineCustomElement$4 } from './p-a248ad69.js';
5
- import { d as defineCustomElement$3 } from './p-0e38a723.js';
6
- import { d as defineCustomElement$2 } from './p-4c45ef80.js';
4
+ import { d as defineCustomElement$4 } from './p-649654b5.js';
5
+ import { d as defineCustomElement$3 } from './p-cc9f8c61.js';
6
+ import { d as defineCustomElement$2 } from './p-662cb490.js';
7
7
 
8
8
  const searchcraftFilterPanelModuleCss = ":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-filter-panel{display:flex;flex-direction:column;gap:16px}.searchcraft-filter-panel-section{display:flex;flex-direction:column;gap:8px}.searchcraft-filter-panel-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)}";
9
9
  const SearchcraftFilterPanelStyle0 = searchcraftFilterPanelModuleCss;
@@ -12,10 +12,11 @@ const SearchcraftFilterPanel$1 = /*@__PURE__*/ proxyCustomElement(class Searchcr
12
12
  constructor() {
13
13
  super();
14
14
  this.__registerHost();
15
- this.searchStore = useSearchcraftStore.getState();
15
+ /**
16
+ * The items to filter.
17
+ */
16
18
  this.items = [];
17
- this.unsubscribe = undefined;
18
- this.lastQuery = undefined;
19
+ this.searchStore = useSearchcraftStore.getState();
19
20
  }
20
21
  componentDidLoad() {
21
22
  this.unsubscribe = useSearchcraftStore.subscribe((state) => {