@searchcraft/javascript-sdk 0.2.2 → 0.2.4

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 (133) hide show
  1. package/dist/cjs/index.cjs.js +2 -2
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/searchcraft-auto-search-form_17.cjs.entry.js +46 -61
  4. package/dist/cjs/searchcraft-auto-search-form_17.cjs.entry.js.map +1 -1
  5. package/dist/cjs/searchcraft-base-search-form.cjs.entry.js +3 -3
  6. package/dist/cjs/searchcraft-base-search-form.cjs.entry.js.map +1 -1
  7. package/dist/cjs/searchcraft-javascript-sdk.cjs.js +1 -1
  8. package/dist/cjs/{store-ccdd30e6.js → store-b0a26894.js} +3 -4
  9. package/dist/cjs/{store-ccdd30e6.js.map → store-b0a26894.js.map} +1 -1
  10. package/dist/cjs/{utils-bd99e8b0.js → utils-15f85bca.js} +23 -4
  11. package/dist/cjs/utils-15f85bca.js.map +1 -0
  12. package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.js +10 -10
  13. package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.js.map +1 -1
  14. package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.module.css +2 -0
  15. package/dist/collection/components/searchcraft-base-search-form/searchcraft-base-search-form.js +1 -1
  16. package/dist/collection/components/searchcraft-base-search-form/searchcraft-base-search-form.js.map +1 -1
  17. package/dist/collection/components/searchcraft-base-search-form/searchcraft-base-search-form.module.css +6 -2
  18. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js +37 -37
  19. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js.map +1 -1
  20. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.module.css +7 -7
  21. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js +53 -73
  22. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js.map +1 -1
  23. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.module.css +1 -1
  24. package/dist/collection/components/searchcraft-clear-input-button/searchcraft-clear-input-button.js +2 -3
  25. package/dist/collection/components/searchcraft-clear-input-button/searchcraft-clear-input-button.js.map +1 -1
  26. package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.js +8 -8
  27. package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.js.map +1 -1
  28. package/dist/collection/components/searchcraft-input-icon/searchcraft-input-icon.js +15 -15
  29. package/dist/collection/components/searchcraft-input-icon/searchcraft-input-icon.js.map +1 -1
  30. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js +0 -1
  31. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js.map +1 -1
  32. package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.module.css +0 -1
  33. package/dist/collection/components/searchcraft-slider/searchcraft-slider.js +20 -13
  34. package/dist/collection/components/searchcraft-slider/searchcraft-slider.js.map +1 -1
  35. package/dist/collection/components/searchcraft-slider/searchcraft-slider.module.css +26 -35
  36. package/dist/collection/components/searchcraft-spinner-dark/searchcraft-spinner-dark.module.css +6 -6
  37. package/dist/collection/components/searchcraft-spinner-light/searchcraft-spinner-light.module.css +3 -3
  38. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.module.css +9 -9
  39. package/dist/collection/index.js +0 -2
  40. package/dist/collection/index.js.map +1 -1
  41. package/dist/collection/provider/store.js +2 -4
  42. package/dist/collection/provider/store.js.map +1 -1
  43. package/dist/collection/utils/utils.js +21 -3
  44. package/dist/collection/utils/utils.js.map +1 -1
  45. package/dist/components/index.js +2 -2
  46. package/dist/components/{p-2350c0ab.js → p-1204b43a.js} +6 -6
  47. package/dist/components/{p-2350c0ab.js.map → p-1204b43a.js.map} +1 -1
  48. package/dist/components/{p-c70cd874.js → p-1c377190.js} +5 -6
  49. package/dist/components/p-1c377190.js.map +1 -0
  50. package/dist/components/{p-c815eb98.js → p-25f18f2e.js} +2 -2
  51. package/dist/components/{p-c815eb98.js.map → p-25f18f2e.js.map} +1 -1
  52. package/dist/components/{p-99971aa9.js → p-33bb5c45.js} +3 -4
  53. package/dist/components/{p-99971aa9.js.map → p-33bb5c45.js.map} +1 -1
  54. package/dist/components/{p-15dd4fe4.js → p-3fece4e2.js} +2 -2
  55. package/dist/components/{p-15dd4fe4.js.map → p-3fece4e2.js.map} +1 -1
  56. package/dist/components/{p-85693c64.js → p-576f0d2b.js} +2 -2
  57. package/dist/components/{p-85693c64.js.map → p-576f0d2b.js.map} +1 -1
  58. package/dist/components/{p-1101288c.js → p-8c38185e.js} +3 -3
  59. package/dist/components/p-8c38185e.js.map +1 -0
  60. package/dist/components/{p-bd90d9b4.js → p-8c70054a.js} +10 -10
  61. package/dist/components/p-8c70054a.js.map +1 -0
  62. package/dist/components/{p-8fe6289d.js → p-ae84b899.js} +1 -2
  63. package/dist/components/p-ae84b899.js.map +1 -0
  64. package/dist/components/{p-aff5cd24.js → p-ff6c3650.js} +23 -5
  65. package/dist/components/p-ff6c3650.js.map +1 -0
  66. package/dist/components/searchcraft-auto-search-form.js +11 -11
  67. package/dist/components/searchcraft-auto-search-form.js.map +1 -1
  68. package/dist/components/searchcraft-base-search-form.js +10 -10
  69. package/dist/components/searchcraft-base-search-form.js.map +1 -1
  70. package/dist/components/searchcraft-base-search-result.js +1 -1
  71. package/dist/components/searchcraft-base-search-results.js +21 -41
  72. package/dist/components/searchcraft-base-search-results.js.map +1 -1
  73. package/dist/components/searchcraft-button.js +1 -1
  74. package/dist/components/searchcraft-clear-input-button.js +1 -1
  75. package/dist/components/searchcraft-filters-list.js +9 -9
  76. package/dist/components/searchcraft-filters-list.js.map +1 -1
  77. package/dist/components/searchcraft-input-icon.js +1 -1
  78. package/dist/components/searchcraft-input-label.js +1 -1
  79. package/dist/components/searchcraft-input.js +1 -1
  80. package/dist/components/searchcraft-results-info.js +2 -2
  81. package/dist/components/searchcraft-results-info.js.map +1 -1
  82. package/dist/components/searchcraft-slider.js +17 -10
  83. package/dist/components/searchcraft-slider.js.map +1 -1
  84. package/dist/components/searchcraft-spinner-dark.js +1 -1
  85. package/dist/components/searchcraft-spinner-light.js +1 -1
  86. package/dist/components/searchcraft-toggle-button.js +2 -2
  87. package/dist/components/searchcraft-toggle-button.js.map +1 -1
  88. package/dist/esm/index.js +2 -2
  89. package/dist/esm/loader.js +1 -1
  90. package/dist/esm/searchcraft-auto-search-form_17.entry.js +46 -61
  91. package/dist/esm/searchcraft-auto-search-form_17.entry.js.map +1 -1
  92. package/dist/esm/searchcraft-base-search-form.entry.js +3 -3
  93. package/dist/esm/searchcraft-base-search-form.entry.js.map +1 -1
  94. package/dist/esm/searchcraft-javascript-sdk.js +1 -1
  95. package/dist/esm/{store-311de204.js → store-97358312.js} +3 -4
  96. package/dist/esm/{store-311de204.js.map → store-97358312.js.map} +1 -1
  97. package/dist/esm/{utils-e2076797.js → utils-dbb6302b.js} +23 -5
  98. package/dist/esm/utils-dbb6302b.js.map +1 -0
  99. package/dist/searchcraft-javascript-sdk/index.esm.js +1 -1
  100. package/dist/searchcraft-javascript-sdk/p-1a0e85ee.entry.js +2 -0
  101. package/dist/searchcraft-javascript-sdk/p-1a0e85ee.entry.js.map +1 -0
  102. package/dist/searchcraft-javascript-sdk/p-acca6173.entry.js +2 -0
  103. package/dist/searchcraft-javascript-sdk/p-acca6173.entry.js.map +1 -0
  104. package/dist/searchcraft-javascript-sdk/{p-80ea9602.js → p-cd489e98.js} +1 -1
  105. package/dist/searchcraft-javascript-sdk/p-cd489e98.js.map +1 -0
  106. package/dist/searchcraft-javascript-sdk/p-ff6c3650.js +2 -0
  107. package/dist/searchcraft-javascript-sdk/p-ff6c3650.js.map +1 -0
  108. package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js +1 -1
  109. package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js.map +1 -1
  110. package/dist/types/components/searchcraft-auto-search-form/searchcraft-auto-search-form.d.ts +1 -1
  111. package/dist/types/components/searchcraft-base-search-result/searchcraft-base-search-result.d.ts +3 -3
  112. package/dist/types/components/searchcraft-base-search-results/searchcraft-base-search-results.d.ts +8 -9
  113. package/dist/types/components/searchcraft-filters-list/searchcraft-filters-list.d.ts +1 -1
  114. package/dist/types/components/searchcraft-input-icon/searchcraft-input-icon.d.ts +1 -7
  115. package/dist/types/components/searchcraft-slider/searchcraft-slider.d.ts +4 -4
  116. package/dist/types/components.d.ts +1 -13
  117. package/dist/types/provider/store.d.ts +8 -8
  118. package/dist/types/utils/utils.d.ts +1 -0
  119. package/package.json +1 -1
  120. package/dist/cjs/utils-bd99e8b0.js.map +0 -1
  121. package/dist/components/p-1101288c.js.map +0 -1
  122. package/dist/components/p-8fe6289d.js.map +0 -1
  123. package/dist/components/p-aff5cd24.js.map +0 -1
  124. package/dist/components/p-bd90d9b4.js.map +0 -1
  125. package/dist/components/p-c70cd874.js.map +0 -1
  126. package/dist/esm/utils-e2076797.js.map +0 -1
  127. package/dist/searchcraft-javascript-sdk/p-6108dd80.entry.js +0 -2
  128. package/dist/searchcraft-javascript-sdk/p-6108dd80.entry.js.map +0 -1
  129. package/dist/searchcraft-javascript-sdk/p-80ea9602.js.map +0 -1
  130. package/dist/searchcraft-javascript-sdk/p-a9bac3ca.entry.js +0 -2
  131. package/dist/searchcraft-javascript-sdk/p-a9bac3ca.entry.js.map +0 -1
  132. package/dist/searchcraft-javascript-sdk/p-aff5cd24.js +0 -2
  133. package/dist/searchcraft-javascript-sdk/p-aff5cd24.js.map +0 -1
@@ -1,16 +1,16 @@
1
1
  import { r as registerInstance, c as createEvent, h, F as Fragment } from './index-0ac5bb53.js';
2
- import { u as useSearchcraftStore, g } from './store-311de204.js';
3
- import { p as parseCustomStyles, a as parseSearchKeys, s as serializeStyles, e as extractDynamicProperties } from './utils-e2076797.js';
2
+ import { u as useSearchcraftStore, g } from './store-97358312.js';
3
+ import { p as parseCustomStyles, a as parseSearchKeys, s as serializeStyles, e as extractDynamicProperties, g as getFormattedTimeFromNow } from './utils-dbb6302b.js';
4
4
  import { c as classNames } from './index-72ac5051.js';
5
5
 
6
- const searchcraftAutoSearchFormModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.formLTR{text-align:left;width:100%}.formRTL{text-align:right;width:100%}";
6
+ const searchcraftAutoSearchFormModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.formLTR{font-family:var(--font-stack);text-align:left;width:100%}.formRTL{font-family:var(--font-stack);text-align:right;width:100%}";
7
7
  const SearchcraftAutoSearchFormStyle0 = searchcraftAutoSearchFormModuleCss;
8
8
 
9
9
  const SearchcraftAutoSearchForm = class {
10
10
  constructor(hostRef) {
11
11
  registerInstance(this, hostRef);
12
- this.querySubmit = createEvent(this, "querySubmit", 7);
13
12
  this.inputClearedOrNoResults = createEvent(this, "inputClearedOrNoResults", 7);
13
+ this.querySubmit = createEvent(this, "querySubmit", 7);
14
14
  this.debounceTimeout = null;
15
15
  this.debounceDelay = 0;
16
16
  this.searchStore = useSearchcraftStore.getState();
@@ -104,12 +104,12 @@ const SearchcraftAutoSearchForm = class {
104
104
  if (this.query.length > 0 && ((_c = (_b = (_a = this.searchResults) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.hits) === null || _c === void 0 ? void 0 : _c.length) === 0) {
105
105
  this.inputClearedOrNoResults.emit();
106
106
  }
107
- return (h("form", { key: '49950058e612dc1017fb56235affd3b8077b6926', class: `${formClass}`, onSubmit: this.handleFormSubmit }, h("searchcraft-input-label", { key: 'ce2cb4d74c139fc4f010d1ca51739c49a8e9f6c2', label: this.labelForInput }), h("searchcraft-input", { key: '8fb1eee5dca952ba472f03e768b57663528f5c84', customStyles: parsedCustomStyles, "input-caption-value": this.inputCaptionValue, "is-requesting": this.isRequesting, "input-icon-height": this.inputIconHeight, "input-icon-width": this.inputIconWidth, onClearInput: this.handleClearInput, onInputKeyUp: this.handleInputKeyUp, onSearchInputChange: this.handleInputChange, "placeholder-value": this.placeholderValue, query: this.query, "right-to-left-orientation": this.rightToLeftOrientation }), this.error && (h("searchcraft-error-message", { key: 'd1c893186af4cdb927f31b086aa7d027947c1d2c', errorMessage: 'Please enter a search query.' }))));
107
+ return (h("form", { key: '1ecc90be4b39c7fbfff4a3c89c319343f6478a1e', class: `${formClass}`, onSubmit: this.handleFormSubmit }, h("searchcraft-input-label", { key: '82ee01912536de6a11e20f7df533856a41ebc343', label: this.labelForInput }), h("searchcraft-input", { key: 'ad00322933a20db2865cd79241056f7b0ee84a15', customStyles: parsedCustomStyles, "input-caption-value": this.inputCaptionValue, "input-icon-height": this.inputIconHeight, "input-icon-width": this.inputIconWidth, "is-requesting": this.isRequesting, onClearInput: this.handleClearInput, onInputKeyUp: this.handleInputKeyUp, onSearchInputChange: this.handleInputChange, "placeholder-value": this.placeholderValue, query: this.query, "right-to-left-orientation": this.rightToLeftOrientation }), this.error && (h("searchcraft-error-message", { key: '588a134a1130d3c4e4fc921b09450268057b8217', errorMessage: 'Please enter a search query.' }))));
108
108
  }
109
109
  };
110
110
  SearchcraftAutoSearchForm.style = SearchcraftAutoSearchFormStyle0;
111
111
 
112
- const searchcraftBaseSearchResultModuleCss = "@charset \"UTF-8\";:root{--font-stack:Helvetica, Arial, sans-serif}.interactiveResultContainerLight{background-color:#FAFAFA;align-items:flex-start;border-radius:16px;display:flex;position:relative;flex-direction:column;gap:16px;padding:8px}@media (min-width: 600px){.interactiveResultContainerLight{flex-direction:row}}.interactiveResultContainerDark{background-color:#2E2E2E;align-items:flex-start;border-radius:16px;display:flex;position:relative;flex-direction:column;gap:16px;padding:8px}@media (min-width: 600px){.interactiveResultContainerDark{flex-direction:row}}.resultContainer{align-items:flex-start;display:flex;flex-direction:column;gap:16px}@media (min-width: 600px){.resultContainer{flex-direction:row}}.interactiveIconLarge{display:inline-block;position:absolute;right:5px;top:8px}@media (max-width: 600px){.interactiveIconLarge{display:none}}.interactiveIconSmall{position:absolute;right:5px;top:-2px;display:inline-block}@media (min-width: 600px){.interactiveIconSmall{display:none}}.imageContainer{max-width:100%}.contentContainer{max-height:100%;max-width:100%}@media (min-width: 600px){.contentContainer{max-width:50%}}.secondaryContentContainer{display:flex}.imageLight{aspect-ratio:2/1;border-radius:8px;max-height:100%;max-width:100%;border:1px solid #D9D9D9}.imageDark{aspect-ratio:2/1;border-radius:8px;max-height:100%;max-width:100%;border:1px solid #333}.headingLight{font-family:var(--font-stack);font-size:16px;font-weight:700;line-height:20px;margin-bottom:4px;margin-top:0px;position:relative;color:#292929}.headingDark{font-family:var(--font-stack);font-size:16px;font-weight:700;line-height:20px;margin-bottom:4px;margin-top:0px;position:relative;color:#FFF}.subheadingLight{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-bottom:4px;margin-top:0px;color:#737373}.subheadingDark{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-bottom:4px;margin-top:0px;color:#BFBFBF}.primaryContentLight{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#404040}.primaryContentDark{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#E6E6E6}.secondaryContentLight{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#404040}.secondaryContentLight::after{content:\"•\";color:#404040;font-size:1em;margin-left:5px;margin-right:5px}.secondaryContentDark{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#E6E6E6}.tertiaryContentLight{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#404040}.tertiaryContentDark{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#E6E6E6}";
112
+ const searchcraftBaseSearchResultModuleCss = "@charset \"UTF-8\";:root{--font-stack:Helvetica, Arial, sans-serif}.interactiveResultContainerLight{align-items:flex-start;border-radius:16px;display:flex;flex-direction:column;gap:16px;padding:8px;position:relative;background-color:#FAFAFA}@media (min-width: 600px){.interactiveResultContainerLight{flex-direction:row}}.interactiveResultContainerDark{align-items:flex-start;border-radius:16px;display:flex;flex-direction:column;gap:16px;padding:8px;position:relative;background-color:#2E2E2E}@media (min-width: 600px){.interactiveResultContainerDark{flex-direction:row}}.resultContainer{align-items:flex-start;display:flex;flex-direction:column;gap:16px}@media (min-width: 600px){.resultContainer{flex-direction:row}}.interactiveIconLarge{display:inline-block;position:absolute;right:5px;top:8px}@media (max-width: 600px){.interactiveIconLarge{display:none}}.interactiveIconSmall{display:inline-block;position:absolute;right:5px;top:-2px}@media (min-width: 600px){.interactiveIconSmall{display:none}}.imageContainer{max-width:100%}.contentContainer{max-height:100%;max-width:100%}@media (min-width: 600px){.contentContainer{max-width:50%}}.secondaryContentContainer{display:flex}.imageLight{aspect-ratio:2/1;border-radius:8px;max-height:100%;max-width:100%;border:1px solid #D9D9D9}.imageDark{aspect-ratio:2/1;border-radius:8px;max-height:100%;max-width:100%;border:1px solid #333}.headingLight{font-family:var(--font-stack);font-size:16px;font-weight:700;line-height:20px;margin-bottom:4px;margin-top:0;position:relative;color:#292929}.headingDark{font-family:var(--font-stack);font-size:16px;font-weight:700;line-height:20px;margin-bottom:4px;margin-top:0;position:relative;color:#FFF}.subheadingLight{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-bottom:4px;margin-top:0px;color:#737373}.subheadingDark{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-bottom:4px;margin-top:0px;color:#BFBFBF}.primaryContentLight{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#404040}.primaryContentDark{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#E6E6E6}.secondaryContentLight{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#404040}.secondaryContentLight::after{content:\"•\";color:#404040;font-size:1em;margin-left:5px;margin-right:5px}.secondaryContentDark{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#E6E6E6}.tertiaryContentLight{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#404040}.tertiaryContentDark{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#E6E6E6}";
113
113
  const SearchcraftBaseSearchResultStyle0 = searchcraftBaseSearchResultModuleCss;
114
114
 
115
115
  const SearchcraftBaseSearchResult = class {
@@ -130,16 +130,16 @@ const SearchcraftBaseSearchResult = class {
130
130
  }
131
131
  };
132
132
  this.buttonText = '';
133
+ this.customStyles = '{}';
134
+ this.headingText = '';
133
135
  this.imageDescription = '';
134
136
  this.imageSource = '';
135
137
  this.isInteractive = false;
136
138
  this.primaryContent = '';
137
139
  this.secondaryContent = '';
138
- this.tertiaryContent = '';
139
- this.headingText = '';
140
140
  this.subheadingText = '';
141
+ this.tertiaryContent = '';
141
142
  this.themeMode = 'light';
142
- this.customStyles = '{}';
143
143
  }
144
144
  parseStyles() {
145
145
  try {
@@ -157,27 +157,27 @@ const SearchcraftBaseSearchResult = class {
157
157
  ? isLightTheme
158
158
  ? 'interactiveResultContainerLight'
159
159
  : 'interactiveResultContainerDark'
160
- : 'resultContainer', style: styles.container || {}, tabindex: '0', onClick: this.handleContainerClick, onKeyDown: this.keyDownCallback }, h("div", { key: 'ccda236ef60aee285472155889c5490c69a86415', class: 'imageContainer' }, h("img", { key: 'e55d743952e2997d91f6486436e3a7955ffc1dcc', alt: this.imageDescription, src: this.imageSource, style: styles.image || {}, class: isLightTheme ? 'imageLight' : 'imageDark' })), h("div", { key: 'b0e831c0c7bfef46b8b6da4e84536adf3ebd7158', class: 'contentContainer' }, h("h2", { key: '54137612623a39d711f4e3c888bf2015b6fb9500', style: styles.heading || {}, class: isLightTheme ? 'headingLight' : 'headingDark' }, this.headingText), h("h3", { key: 'de46df990be3d0b5d2134d272e1766e911ab094a', style: styles.subheading || {}, class: isLightTheme ? 'subheadingLight' : 'subheadingDark' }, this.subheadingText), h("p", { key: 'd9e7656bc739b0dd2267f86ac51b17d9ca16da6a', style: styles.primaryContent || {}, class: isLightTheme ? 'primaryContentLight' : 'primaryContentDark' }, this.primaryContent), h("div", { key: 'd05813b3da29b8b21c2e370db9c0cbc7b48b9556', class: 'secondaryContentContainer' }, h("p", { key: 'e8d2ede937705a5bd88927779ee24e35ba2efbd8', style: styles.secondaryContent || {}, class: isLightTheme ? 'secondaryContentLight' : 'secondaryContentDark' }, this.secondaryContent), h("p", { key: '2f9b9f603d55bcefe8347675cb31f705b1f7a0e8', style: styles.tertiaryContent || {}, class: isLightTheme ? 'tertiaryContentLight' : 'tertiaryContentDark' }, this.tertiaryContent)), this.buttonText && (h("button", { key: '58724046c9704974cb3ae1c34335ebb7131b91ab', onClick: this.handleButtonClick, style: styles.button || {}, type: 'button' }, this.buttonText)))));
160
+ : 'resultContainer', onKeyDown: this.keyDownCallback, onClick: this.handleContainerClick, style: styles.container || {}, tabindex: '0' }, h("div", { key: 'ccda236ef60aee285472155889c5490c69a86415', class: 'imageContainer' }, h("img", { key: 'e55d743952e2997d91f6486436e3a7955ffc1dcc', alt: this.imageDescription, class: isLightTheme ? 'imageLight' : 'imageDark', src: this.imageSource, style: styles.image || {} })), h("div", { key: 'b0e831c0c7bfef46b8b6da4e84536adf3ebd7158', class: 'contentContainer' }, h("h2", { key: '54137612623a39d711f4e3c888bf2015b6fb9500', class: isLightTheme ? 'headingLight' : 'headingDark', style: styles.heading || {} }, this.headingText), h("h3", { key: 'de46df990be3d0b5d2134d272e1766e911ab094a', class: isLightTheme ? 'subheadingLight' : 'subheadingDark', style: styles.subheading || {} }, this.subheadingText), h("p", { key: 'd9e7656bc739b0dd2267f86ac51b17d9ca16da6a', class: isLightTheme ? 'primaryContentLight' : 'primaryContentDark', style: styles.primaryContent || {} }, this.primaryContent), h("div", { key: 'd05813b3da29b8b21c2e370db9c0cbc7b48b9556', class: 'secondaryContentContainer' }, h("p", { key: 'e8d2ede937705a5bd88927779ee24e35ba2efbd8', class: isLightTheme ? 'secondaryContentLight' : 'secondaryContentDark', style: styles.secondaryContent || {} }, this.secondaryContent), h("p", { key: '2f9b9f603d55bcefe8347675cb31f705b1f7a0e8', class: isLightTheme ? 'tertiaryContentLight' : 'tertiaryContentDark', style: styles.tertiaryContent || {} }, this.tertiaryContent)), this.buttonText && (h("button", { key: '58724046c9704974cb3ae1c34335ebb7131b91ab', onClick: this.handleButtonClick, style: styles.button || {}, type: 'button' }, this.buttonText)))));
161
161
  }
162
162
  };
163
163
  SearchcraftBaseSearchResult.style = SearchcraftBaseSearchResultStyle0;
164
164
 
165
- const searchcraftBaseSearchResultsModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.resultsContainer{display:flex;flex-direction:column;justify-content:center;margin:16px 0}.resultsContainer>p{align-self:center}.resultsContainer>div{margin-bottom:20px}.resultsContainer>div img{height:300px;width:200px}.adSection{align-items:center;background-color:#F1F1F1;border:1px solid #DCDDDE;border-radius:16px;display:flex;flex-direction:column;font-size:16px;justify-content:center;margin:auto;min-height:150px;text-align:center;width:100%}.adSection p{margin-top:5px}.emptyState{width:100%;text-align:center}.errorMessageContainer{text-align:center}";
165
+ const searchcraftBaseSearchResultsModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.resultsContainer{display:flex;flex-direction:column;justify-content:center;margin:16px 0}.resultsContainer>p{align-self:center}.resultsContainer>div{margin-bottom:20px}.resultsContainer>div img{height:300px;width:200px}.adSection{align-items:center;background-color:#F1F1F1;border:1px solid #DCDDDE;border-radius:16px;display:flex;flex-direction:column;font-size:16px;justify-content:center;margin:auto;min-height:150px;text-align:center;width:100%}.adSection p{margin-top:5px}.emptyState{text-align:center;width:100%}.errorMessageContainer{text-align:center}";
166
166
  const SearchcraftBaseSearchResultsStyle0 = searchcraftBaseSearchResultsModuleCss;
167
167
 
168
168
  const SearchcraftBaseSearchResults = class {
169
169
  constructor(hostRef) {
170
170
  registerInstance(this, hostRef);
171
- this.query = '';
172
- this.searchResults = null;
173
- this.hasSearched = false;
174
- this.documentAttributesForDisplay = '';
175
- this.customStylesForResults = {};
176
- this.placeAdAtStart = true;
177
- this.placeAdAtEnd = false;
178
171
  this.adInterval = 4;
179
- this.formatTime = true;
172
+ this.customStylesForResults = {};
173
+ this.documentAttributesForDisplay = '';
180
174
  this.fallbackElement = null;
175
+ this.formatTime = true;
176
+ this.placeAdAtEnd = false;
177
+ this.placeAdAtStart = true;
178
+ this.hasSearched = false;
179
+ this.query = '';
180
+ this.searchResults = null;
181
181
  }
182
182
  componentDidLoad() {
183
183
  if (!this.documentAttributesForDisplay ||
@@ -204,25 +204,6 @@ const SearchcraftBaseSearchResults = class {
204
204
  this.unsubscribe();
205
205
  }
206
206
  }
207
- timeAgo(timestamp) {
208
- const now = new Date();
209
- const inputTime = new Date(timestamp);
210
- const diffInSeconds = Math.floor((now.getTime() - inputTime.getTime()) / 1000);
211
- const minutes = Math.floor(diffInSeconds / 60);
212
- const hours = Math.floor(minutes / 60);
213
- const days = Math.floor(hours / 24);
214
- const years = Math.floor(days / 365);
215
- if (minutes < 60) {
216
- return `${minutes}m ago`;
217
- }
218
- if (hours < 24) {
219
- return `${hours}h ago`;
220
- }
221
- if (days < 365) {
222
- return `${days}d ago`;
223
- }
224
- return `${years}y ago`;
225
- }
226
207
  render() {
227
208
  var _a, _b, _c, _d, _e, _f, _g;
228
209
  if (!this.hasSearched) {
@@ -239,7 +220,6 @@ const SearchcraftBaseSearchResults = class {
239
220
  const resultsComponents = (_d = (_c = (_b = this.searchResults) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.hits) === null || _d === void 0 ? void 0 : _d.map((document, index) => {
240
221
  const { doc: result } = document;
241
222
  const dynamicProperties = extractDynamicProperties(result, parsedSearchKeys);
242
- // Apply timeAgo formatting if formatTime is true
243
223
  if (this.formatTime) {
244
224
  for (const key of parsedSearchKeys) {
245
225
  if (dynamicProperties[key]) {
@@ -247,12 +227,12 @@ const SearchcraftBaseSearchResults = class {
247
227
  // Check if the value is a valid ISO timestamp
248
228
  if (typeof value === 'string' &&
249
229
  !Number.isNaN(Date.parse(value))) {
250
- dynamicProperties[key] = this.timeAgo(value);
230
+ dynamicProperties[key] = getFormattedTimeFromNow(value);
251
231
  }
252
232
  }
253
233
  }
254
234
  }
255
- return (h("searchcraft-base-search-result", { key: `${document.document_id}-${index}`, "button-callback": () => console.log('button callback'), "result-callback": () => console.log('interactive element'), "keydown-callback": () => console.log('keydown'), "is-interactive": true, "heading-text": dynamicProperties[parsedSearchKeys[0]], "subheading-text": dynamicProperties[parsedSearchKeys[1]], "primary-content": dynamicProperties[parsedSearchKeys[2]], "secondary-content": dynamicProperties[parsedSearchKeys[3]], "tertiary-content": dynamicProperties[parsedSearchKeys[4]], "image-source": dynamicProperties[parsedSearchKeys[parsedSearchKeys.length - 1]], "custom-styles": serializedStyles }));
235
+ return (h("searchcraft-base-search-result", { "button-callback": () => console.log('button callback'), "custom-styles": serializedStyles, "image-source": dynamicProperties[parsedSearchKeys[parsedSearchKeys.length - 1]], "is-interactive": true, key: `${document.document_id}-${index}`, "keydown-callback": () => console.log('keydown'), "heading-text": dynamicProperties[parsedSearchKeys[0]], "primary-content": dynamicProperties[parsedSearchKeys[2]], "result-callback": () => console.log('interactive element'), "secondary-content": dynamicProperties[parsedSearchKeys[3]], "subheading-text": dynamicProperties[parsedSearchKeys[1]], "tertiary-content": dynamicProperties[parsedSearchKeys[4]] }));
256
236
  });
257
237
  const finalComponents = [];
258
238
  if (this.placeAdAtStart) {
@@ -306,10 +286,9 @@ const SearchcraftClearInputButton = class {
306
286
  constructor(hostRef) {
307
287
  registerInstance(this, hostRef);
308
288
  this.clearInput = createEvent(this, "clearInput", 7);
309
- // Added a click handler to emit the event
310
289
  this.handleClearClick = (event) => {
311
- event.preventDefault(); // Prevent default if necessary
312
- this.clearInput.emit(); // Emit the event
290
+ event.preventDefault();
291
+ this.clearInput.emit();
313
292
  };
314
293
  this.isRequesting = false;
315
294
  this.rightToLeftOrientation = false;
@@ -364,10 +343,10 @@ const SearchcraftFiltersList = class {
364
343
  this.dynamicFilters = [];
365
344
  this.initialFilters = [];
366
345
  this.isRequesting = false;
367
- this.selectedFilters = new Set();
368
346
  this.originalFilterCounts = {};
369
347
  this.query = '';
370
348
  this.resultsCount = 0;
349
+ this.selectedFilters = new Set();
371
350
  }
372
351
  connectedCallback() {
373
352
  this.unsubscribe = useSearchcraftStore.subscribe((state) => {
@@ -409,10 +388,10 @@ const SearchcraftFiltersList = class {
409
388
  }
410
389
  formatLabel(label) {
411
390
  return label
412
- .replace(/-/g, ' ') // Replace dashes with spaces
413
- .split(' ') // Split words
414
- .map((word) => word.charAt(0).toUpperCase() + word.slice(1)) // Capitalize the first letter
415
- .join(' '); // Join words back into a single string
391
+ .replace(/-/g, ' ')
392
+ .split(' ')
393
+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
394
+ .join(' ');
416
395
  }
417
396
  render() {
418
397
  if (!this.query || this.resultsCount === 0) {
@@ -426,7 +405,7 @@ const SearchcraftFiltersList = class {
426
405
  });
427
406
  return (h("div", { class: 'filtersList' }, filtersToRender.map((filter) => (h("div", { key: filter.value }, h("label", { class: 'checkboxLabel' }, h("input", { class: 'filterCheckbox', checked: filter.isChecked, onChange: (event) => this.handleFilterChange(filter.value, event.target.checked), type: 'checkbox', value: filter.value }), this.formatLabel(filter.label)), filter.isChecked &&
428
407
  filter.children.map((childFilter) => {
429
- const childLabel = childFilter.label.split('/').pop(); // Get only the part after the last '/'
408
+ const childLabel = childFilter.label.split('/').pop();
430
409
  return (h("label", { class: 'childCheckboxLabel', key: childFilter.value, style: { marginLeft: '20px' } }, h("input", { class: 'childFilterCheckbox', checked: this.selectedFilters.has(childFilter.value), onChange: (event) => this.handleFilterChange(childFilter.value, event.target.checked), type: 'checkbox', value: childFilter.value }), this.formatLabel(childLabel || '')));
431
410
  }))))));
432
411
  }
@@ -540,8 +519,8 @@ const SearchcraftInputIcon = class {
540
519
  constructor(hostRef) {
541
520
  registerInstance(this, hostRef);
542
521
  this.error = undefined;
543
- this.rightToLeftOrientation = false;
544
522
  this.height = 20;
523
+ this.rightToLeftOrientation = false;
545
524
  this.width = 20;
546
525
  this.theme = 'light';
547
526
  }
@@ -568,7 +547,6 @@ const SearchcraftInputLabel = class {
568
547
  return this.theme === 'light';
569
548
  }
570
549
  render() {
571
- // Render nothing if no label prop is provided
572
550
  if (!this.label) {
573
551
  return null;
574
552
  }
@@ -578,7 +556,7 @@ const SearchcraftInputLabel = class {
578
556
  };
579
557
  SearchcraftInputLabel.style = SearchcraftInputLabelStyle0;
580
558
 
581
- const searchcraftResultsInfoModuleCss = ".container{border-bottom:1px solid #D9D9D9;display:flex;justify-content:flex-start;width:100%}.resultsInfo{color:#292929;font-family:\"Brygada 1918\";font-size:18px;font-weight:600;line-height:20px;margin:0;margin-bottom:8px}";
559
+ const searchcraftResultsInfoModuleCss = ".container{border-bottom:1px solid #D9D9D9;display:flex;justify-content:flex-start;width:100%}.resultsInfo{color:#292929;font-size:18px;font-weight:600;line-height:20px;margin:0;margin-bottom:8px}";
582
560
  const SearchcraftResultsInfoStyle0 = searchcraftResultsInfoModuleCss;
583
561
 
584
562
  const SearchcraftResultsInfo = class {
@@ -636,7 +614,7 @@ const SearchcraftSearchIconSet = class {
636
614
  }
637
615
  };
638
616
 
639
- const searchcraftSliderModuleCss = ".slider-container{display:flex;flex-direction:column;gap:10px;font-family:Arial, sans-serif;align-items:center}label{font-size:14px;font-weight:bold;margin-bottom:10px}.range-container{display:flex;width:100%;align-items:center}.range-slider{width:100%;height:4px;background:#ddd;border-radius:2px;outline:none;margin:0 -1px;position:relative}.range-slider::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:20px;height:20px;background-color:#FFF;border-radius:50%;border:1px solid #E6E6E6;cursor:pointer;position:relative}.range-slider::-moz-range-thumb{width:20px;height:20px;background-color:#FFF;border-radius:50%;border:1px solid #E6E6E6;cursor:pointer}.range-slider:before{content:\"\";position:absolute;height:4px;background-color:#FFF;border-radius:2px;left:0;right:0;z-index:-1}.year-labels{display:flex;justify-content:space-between;width:100%;margin-top:10px;font-size:15px;font-weight:600;font-family:\"Source Sans Pro\";color:#666}.year-label{min-width:30px;text-align:center}";
617
+ const searchcraftSliderModuleCss = ".sliderContainer{display:flex;flex-direction:column;gap:10px;font-family:Arial, sans-serif;align-items:center;width:100%}.rangeContainer{display:flex;position:relative;width:100%;align-items:center}.rangeContainer .activeRange{position:absolute;top:50%;transform:translateY(-50%);height:4px;background:#007DB3;z-index:0;border-radius:2px}.rangeContainer .rangeSlider{width:100%;height:4px;background:transparent;border-radius:2px;outline:none;-webkit-appearance:none;appearance:none;position:absolute;margin:0}.rangeContainer .rangeSlider::-webkit-slider-thumb{-webkit-appearance:none;width:20px;height:20px;background-color:#FFF;border-radius:50%;border:2px solid #e6e6e6;cursor:pointer}.rangeContainer .rangeSlider::-moz-range-thumb{width:20px;height:20px;background-color:#FFF;border-radius:50%;border:2px solid #e6e6e6;cursor:pointer}.yearLabels{display:flex;justify-content:space-between;width:100%;margin-top:10px;font-size:15px;font-weight:600;font-family:\"Source Sans Pro\", sans-serif;color:#666}.yearLabel{min-width:30px;text-align:center}";
640
618
  const SearchcraftSliderStyle0 = searchcraftSliderModuleCss;
641
619
 
642
620
  const SearchcraftSlider = class {
@@ -667,13 +645,13 @@ const SearchcraftSlider = class {
667
645
  this.endYear = Math.max(value, this.startYear);
668
646
  this.updateYears();
669
647
  };
670
- this.minYear = 2000;
671
648
  this.maxYear = new Date().getFullYear();
649
+ this.minYear = 2014;
672
650
  this.endYear = this.maxYear;
673
- this.query = '';
674
- this.startYear = this.minYear;
675
651
  this.hasSearched = false;
652
+ this.query = '';
676
653
  this.resultsCount = 0;
654
+ this.startYear = this.minYear;
677
655
  }
678
656
  componentDidLoad() {
679
657
  this.unsubscribe = useSearchcraftStore.subscribe((state) => {
@@ -694,12 +672,19 @@ const SearchcraftSlider = class {
694
672
  if (!this.query || this.resultsCount === 0) {
695
673
  return null;
696
674
  }
697
- return (h("div", { class: 'slider-container' }, h("div", { class: 'range-container' }, h("input", { class: 'range-slider', max: this.maxYear, min: this.minYear, onInput: this.handleStartYearChange, step: '1', type: 'range', value: this.startYear }), h("input", { class: 'range-slider', max: this.maxYear, min: this.minYear, onInput: this.handleEndYearChange, step: '1', type: 'range', value: this.endYear })), h("div", { class: 'year-labels' }, h("span", { class: 'year-label' }, this.startYear), h("span", { class: 'year-label' }, this.endYear))));
675
+ const rangeMin = this.minYear;
676
+ const rangeMax = this.maxYear;
677
+ const startPercent = ((this.startYear - rangeMin) / (rangeMax - rangeMin)) * 100;
678
+ const endPercent = ((this.endYear - rangeMin) / (rangeMax - rangeMin)) * 100;
679
+ return (h("div", { class: 'sliderContainer' }, h("div", { class: 'rangeContainer' }, h("div", { class: 'activeRange', style: {
680
+ left: `${startPercent}%`,
681
+ width: `${endPercent - startPercent}%`,
682
+ } }), h("input", { class: 'rangeSlider', max: this.maxYear, min: this.minYear, onInput: this.handleStartYearChange, step: '1', type: 'range', value: this.startYear }), h("input", { class: 'rangeSlider', max: this.maxYear, min: this.minYear, onInput: this.handleEndYearChange, step: '1', type: 'range', value: this.endYear })), h("div", { class: 'yearLabels' }, h("span", { class: 'yearLabel' }, this.startYear), h("span", { class: 'yearLabel' }, this.endYear))));
698
683
  }
699
684
  };
700
685
  SearchcraftSlider.style = SearchcraftSliderStyle0;
701
686
 
702
- const searchcraftSpinnerDarkModuleCss = ".spinnerContainer{background-color:transparent;height:20px;width:20px}.spinnerDark{height:100%;width:100%;background:conic-gradient(#000 50%, #FFFFFF);clip-path:circle(50%);mask-image:radial-gradient(circle at center, rgba(0, 0, 0, 0) 6.6666666667px, rgb(0, 0, 0) 6.6666666667px);animation:spinning 1s linear infinite}.spinnerLight{height:100%;width:100%;background:conic-gradient(#737373 50%, #FFFFFF);clip-path:circle(50%);mask-image:radial-gradient(circle at center, rgba(0, 0, 0, 0) 6.6666666667px, rgb(0, 0, 0) 6.6666666667px);animation:spinning 1s linear infinite}@keyframes spinning{0%{transform:rotate(0deg)}50%{transform:rotate(180deg)}100%{transform:rotate(360deg)}}";
687
+ const searchcraftSpinnerDarkModuleCss = ".spinnerContainer{background-color:transparent;height:20px;width:20px}.spinnerDark{animation:spinning 1s linear infinite;background:conic-gradient(#000 50%, #FFFFFF);clip-path:circle(50%);height:100%;mask-image:radial-gradient(circle at center, rgba(0, 0, 0, 0) 6.6666666667px, rgb(0, 0, 0) 6.6666666667px);width:100%}.spinnerLight{animation:spinning 1s linear infinite;background:conic-gradient(#737373 50%, #FFFFFF);clip-path:circle(50%);height:100%;mask-image:radial-gradient(circle at center, rgba(0, 0, 0, 0) 6.6666666667px, rgb(0, 0, 0) 6.6666666667px);width:100%}@keyframes spinning{0%{transform:rotate(0deg)}50%{transform:rotate(180deg)}100%{transform:rotate(360deg)}}";
703
688
  const SearchcraftSpinnerDarkStyle0 = searchcraftSpinnerDarkModuleCss;
704
689
 
705
690
  const SearchcraftSpinnerDark = class {
@@ -712,7 +697,7 @@ const SearchcraftSpinnerDark = class {
712
697
  };
713
698
  SearchcraftSpinnerDark.style = SearchcraftSpinnerDarkStyle0;
714
699
 
715
- const searchcraftSpinnerLightModuleCss = ".spinnerContainer{background-color:transparent;height:20px;width:20px}.spinnerLight{height:100%;width:100%;background:conic-gradient(#737373 50%, #FFFFFF);clip-path:circle(50%);mask-image:radial-gradient(circle at center, rgba(0, 0, 0, 0) 6.6666666667px, rgb(0, 0, 0) 6.6666666667px);animation:spinning 1s linear infinite}@keyframes spinning{0%{transform:rotate(0deg)}50%{transform:rotate(180deg)}100%{transform:rotate(360deg)}}";
700
+ const searchcraftSpinnerLightModuleCss = ".spinnerContainer{background-color:transparent;height:20px;width:20px}.spinnerLight{animation:spinning 1s linear infinite;background:conic-gradient(#737373 50%, #FFFFFF);clip-path:circle(50%);height:100%;mask-image:radial-gradient(circle at center, rgba(0, 0, 0, 0) 6.6666666667px, rgb(0, 0, 0) 6.6666666667px);width:100%}@keyframes spinning{0%{transform:rotate(0deg)}50%{transform:rotate(180deg)}100%{transform:rotate(360deg)}}";
716
701
  const SearchcraftSpinnerLightStyle0 = searchcraftSpinnerLightModuleCss;
717
702
 
718
703
  const SearchcraftSpinnerLight = class {
@@ -725,7 +710,7 @@ const SearchcraftSpinnerLight = class {
725
710
  };
726
711
  SearchcraftSpinnerLight.style = SearchcraftSpinnerLightStyle0;
727
712
 
728
- const searchcraftToggleButtonModuleCss = ".toggle-wrapper{box-shadow:0px 0px 0px 1px rgba(0, 0, 0, 0.05);margin-left:10px;border:none;border-radius:16px;width:44px;height:26px;background:#ddd;position:relative;cursor:pointer}.toggle-wrapper.active{box-shadow:0px 0px 0px 1px rgba(0, 0, 0, 0.05);background:#007DB3}.toggle-wrapper .toggle-switch{width:18px;height:18px;background:#fff;border-radius:50%;position:absolute;top:calc(50% - 9px);left:4px;transition:transform 0.3s ease}.toggle-wrapper .toggle-switch.active{transform:translateX(16px)}";
713
+ const searchcraftToggleButtonModuleCss = ".toggle-wrapper{background:#ddd;border:none;border-radius:16px;box-shadow:0px 0px 0px 1px rgba(0, 0, 0, 0.05);cursor:pointer;height:26px;margin-left:10px;position:relative;width:44px}.toggle-wrapper.active{background:#007DB3;box-shadow:0px 0px 0px 1px rgba(0, 0, 0, 0.05)}.toggle-wrapper .toggle-switch{background:#fff;border-radius:50%;height:18px;left:4px;position:absolute;top:calc(50% - 9px);transition:transform 0.3s ease;width:18px}.toggle-wrapper .toggle-switch.active{transform:translateX(16px)}";
729
714
  const SearchcraftToggleButtonStyle0 = searchcraftToggleButtonModuleCss;
730
715
 
731
716
  const SearchcraftToggleButton = class {